\n `,this.target.classList.add("loaded"),this.player=new globalThis.Twitch.Player(this.twitchEmbedId,{channel:e.name,layout:"video",autoplay:!0,muted:!0})):this.destroy()}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a1&&void 0!==arguments[1]?arguments[1]:{};return R[e]||(t=function(e,t){var a=e.countries[t];if(!a)return null;var i=function(e){return P||(P=function(e){return Object.keys(e.timezones).reduce((function(t,a){var i=e.timezones[a],r=i.c,n=i.a,s=e.timezones[n]||{},o=r||s.c;if(!o)return t;var c,l=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=C(e))){t&&(e=t);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,n=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return n=e.done,e},e:function(e){s=!0,r=e},f:function(){try{n||null==t.return||t.return()}finally{if(s)throw r}}}}(o);try{for(l.s();!(c=l.n()).done;){var u=c.value;t[u]||Object.assign(t,L({},u,{current:[],all:[]})),void 0===i.r&&t[u].current.push(a),t[u].all.push(a)}}catch(e){l.e(e)}finally{l.f()}return t}),{})}(e)),P}(e)[t]||{};return{id:t,name:a,timezones:i.current||[],allTimezones:i.all||[]}}(I,e),t&&(R[t.id]=t)),function(e,t){if(!e)return null;var a=(t||{}).deprecated;e.allTimezones;var i=function(e,t){if(null==e)return{};var a,i,r=function(e,t){if(null==e)return{};var a={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;a[i]=e[i]}return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i1&&void 0!==arguments[1]?arguments[1]:{};return((t=e,U[t]||(a=function(e,t){var a=e.timezones[t];if(!a)return null;var i=a.a,r=void 0===i?null:i,n=k(k({},r?e.timezones[r]:{}),e.timezones[t]),s=n.c||[],o=n.u,c=Number.isInteger(n.d)?n.d:o,l={name:t,countries:s,utcOffset:o,utcOffsetStr:B(o),dstOffset:c,dstOffsetStr:B(c),aliasOf:r};return a.r&&(l.deprecated=!0),l}(I,t),a&&(U[a.name]=a,Object.keys(a).length)),(U[t]?k({},U[t]):null)||{}).countries||[]).map((function(e){return H(e,i)}))}function N(e){return(t=G(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),a=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,r,n,s,o=[],c=!0,l=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;c=!1}else for(;!(c=(i=n.call(a)).done)&&(o.push(i.value),o.length!==t);c=!0);}catch(e){l=!0,r=e}finally{try{if(!c&&null!=a.return&&(s=a.return(),Object(s)!==s))return}finally{if(l)throw r}}return o}}(t,a)||C(t,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0]||null;var t,a}const D=()=>{if(Intl){const{timeZone:e}=Intl.DateTimeFormat().resolvedOptions(),t=N(e);if(t)return t.id}return"UNKNOWN"};class F{constructor(e){this.target=e.target,this.endpoint=e.endpoint,this.channelId=e.channelId,this.adsEnabled=e.adsEnabled,this.autoLoad=!!e.autoLoad,this.spinnerClassList=e.spinnerClassList||"spinner large",this.descriptionLength="number"==typeof e.descriptionLength?e.descriptionLength:500,this.loc={error:"Sorry, there was an error loading the video player.",loading:"Loading",seeMore:"See more %1% videos",subscribe:"Subscribe",thumbnail:"%1% thumbnail",title:"Video player"},e.loc&&Object.keys(this.loc).forEach((t=>{e.loc[t]&&(this.loc[t]=e.loc[t])})),this.observer=null,this.playlist=[],this.videoHolder=null,this.videoWrapper=null,this.channel={},this.videos=[]}static isTargetingAllowed(){return!!globalThis.BrockmanAllowedCookies&&globalThis.BrockmanAllowedCookies.targeting}run(){this.target&&this.channelId&&(this.renderSpinner(),this.autoLoad?this.fetch():this.observe())}renderSpinner(){this.target.innerHTML=``}observe(){"IntersectionObserver"in window?(this.observer=new IntersectionObserver((e=>this.intersect(e))),this.observer.observe(this.target)):this.fetch()}intersect(e){e[0].isIntersecting&&(this.fetch(),this.observer.disconnect())}fetch(){this.target.dataset.loaded=!1;const e=`${this.endpoint}?channel_id=${this.channelId}`;fetch(e).then((e=>{if(!e.ok)throw new Error("Response status not ok");return e})).then((e=>e.text())).then((e=>this.parse(e))).catch((()=>this.renderError()))}parse(e){const t=(new DOMParser).parseFromString(e,"text/xml"),a=t.getElementsByTagName("author")[0];this.channel={name:a.getElementsByTagName("name")[0].textContent,uri:a.getElementsByTagName("uri")[0].textContent};const i=t.getElementsByTagName("entry");for(let e=0;e\n
`}renderError(){this.target.innerHTML=this.renderAlert(this.loc.error),this.target.dataset.loaded=!0}async setVideo(e){const t=this.getVideoById(e);this.resetVideo(),this.renderTitleLink(t),this.renderDescription(t),this.renderVideo(e)}async renderVideo(e){F.isTargetingAllowed()&&this.adsEnabled?this.renderIframe(`https://www.youtube.com/embed/${e}`):this.renderIframe(`https://www.youtube-nocookie.com/embed/${e}`)}}var q=self;for(var O in t)q[O]=t[O];t.__esModule&&Object.defineProperty(q,"__esModule",{value:!0})}();
//# sourceMappingURL=main.min.js.map