1var m=Object.defineProperty;var b=(o,e,t)=>e in o?m(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var d=(o,e,t)=>b(o,typeof e!="symbol"?e+"":e,t);import{D as E}from"./DeferWebComponent.min.BrKhvwE6.js";class v{constructor(){d(this,"YOUTUBE_PLAYER_API_SRC","https://www.youtube.com/player_api");d(this,"injectScript",e=>{const t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)});this.callbacks=[],this.isLoading=null}async register(e){if(window.YT&&typeof window.YT.Player=="function")return e(null,window.YT);this.callbacks.push(e),Array.from(document.getElementsByTagName("script")).some(i=>i.src===this.YOUTUBE_PLAYER_API_SRC)||(this.isLoading=await this.loadScript()),this.isLoading&&await this.isLoading(),window.onYouTubePlayerAPIReady=()=>{this.loadCallbacks()}}loadCallbacks(){for(;this.callbacks.length;)this.callbacks.shift()(null,window.YT)}async loadScript(){return new Promise((e,t)=>{const s=document.createElement("script");s.async=!0,s.type="text/javascript",s.onload=s.onreadystatechange=()=>{(!s.readyState||s.readyState==="complete"||s.readyState==="loaded")&&e()},s.onerror=()=>{t(new Error(`Failed to load script "${s.src}"`))},s.src=this.YOUTUBE_PLAYER_API_SRC,this.injectScript(s)})}}const w=new v;class y{constructor(){this.registry=new WeakMap}elementExists(e){return this.registry.has(e)}getElement(e){return this.registry.get(e)}addElement(e,t){e&&this.registry.set(e,t||{})}removeElement(e){this.registry.delete(e)}destroyRegistry(){this.registry=new WeakMap}}const O=()=>{};var h;(function(o){o.enter="enter",o.exit="exit"})(h||(h={}));class R{constructor(){this.registry=new y}addCallback(e,t,s){let i;e===h.enter?i={[h.enter]:s}:i={[h.exit]:s},this.registry.addElement(t,Object.assign({},this.registry.getElement(t),i))}removeElementNotification(e){this.registry.removeElement(e)}elementNotificationExists(e){return!!this.registry.elementExists(e)}dispatchCallback(e,t,s){if(e===h.enter){const{enter:i=O}=this.registry.getElement(t);i(s)}else{const i=this.registry.getElement(t);i&&i.exit&&i.exit(s)}}}class k extends R{constructor(){super(),this.elementRegistry=new y}observe(e,t={}){e&&(this.elementRegistry.addElement(e,Object.assign({},t)),this.setupObserver(e,Object.assign({},t)))}unobserve(e,t){const s=this.findMatchingRootEntry(t);s?this.clearRootEntry(e,s):(this.removeElement(e),this.clearDefaultRoot(e))}addEnterCallback(e,t){this.addCallback(h.enter,e,t)}addExitCallback(e,t){this.addCallback(h.exit,e,t)}
1dispatchEnterCallback(e,t){this.dispatchCallback(h.enter,e,t)}dispatchExitCallback(e,t){this.dispatchCallback(h.exit,e,t)}destroy(){this.elementRegistry.destroyRegistry()}removeElement(e){this.removeElementNotification(e),this.elementRegistry.removeElement(e)}elementExists(e){return!!(this.elementNotificationExists(e)||this.elementRegistry.elementExists(e))}setupOnIntersection(e){return t=>this.onIntersection(e,t)}setupObserver(e,t){const{root:s=window}=t,i=this.findRootFromRegistry(s);let r;if(i&&(r=this.determineMatchingElements(t,i)),r){const{elements:a,intersectionObserver:l}=r;a.push(e),l&&l.observe(e)}else{const a=this.newObserver(e,t),l={elements:[e],intersectionObserver:a,options:t},c=this.stringifyOptions(t);i?i[c]=l:this.elementRegistry.elementExists(s)||this.elementRegistry.addElement(s,{[c]:l})}}newObserver(e,t){const{root:s,rootMargin:i,threshold:r}=t,a=new IntersectionObserver(this.setupOnIntersection(t).bind(this),{root:s,rootMargin:i,threshold:r});return a.observe(e),a}onIntersection(e,t){t.forEach(s=>{const{isIntersecting:i,intersectionRatio:r}=s;let a=e.threshold||0;Array.isArray(a)&&(a=a[a.length-1]);const l=this.findMatchingRootEntry(e);i||r>a?l&&l.elements.some(c=>c&&c===s.target?(this.dispatchEnterCallback(c,s),!0):!1):l&&l.elements.some(c=>c&&c===s.target?(this.dispatchExitCallback(c,s),!0):!1)})}findRootFromRegistry(e){if(this.elementRegistry)return this.elementRegistry.getElement(e)}findMatchingRootEntry(e){const{root:t=window}=e,s=this.findRootFromRegistry(t);if(s){const i=this.stringifyOptions(e);return s[i]}}determineMatchingElements(e,t){const s=Object.keys(t).filter(i=>{const{options:r}=t[i];return this.areOptionsSame(e,r)})[0];return t[s]}areOptionsSame(e,t){if(e===t)return!0;const s=Object.prototype.toString.call(e),i=Object.prototype.toString.call(t);if(s!==i)return!1;if(s!=="[object Object]"&&i!=="[object Object]")return e===t;if(e&&t&&typeof e=="object"&&typeof t=="object"){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&this.areOptionsSame(e[r],t[r])===!1)return!1}return!0}stringifyOptions(e){const{root:t}=e;return JSON.stringify(e,(i,r)=>{if(i==="root"&&t){const l=Array.prototype.slice.call(t.classList).reduce((f,g)=>f+=g,"");return`${t.id}-${l}`}return r})}clearRootEntry(e,t){const{intersectionObserver:s}=t;s.unobserve(e),t.elements&&(t.elements=t.elements.filter(i=>i!==e)),this.removeElement(e),this.clearDefaultRoot(e)}clearDefaultRoot(e){const t=this.elementRegistry.getElement(window);t&&t.elements&&(t.elements=t.elements.filter(s=>s!==e))}}const p=new k,n=class n extends E{constructor(){super();d(this,"observerOptions",{rootMargin:"20%"})}ready(){if(this.player=null,this.videoId===null||this.videoId==="")throw new Error("No youtube url provided");this.options={...n.defaultOptions,videoId:this.videoId,events:{onStateChange:this.onStateChange.bind(this),onReady:this.onReady.bind(this)}},this.options.playerVars=n.mergeOptions(this.dataset.playerVars,JSON.parse(this.dataset.playerVars)),this.elPlay=[...this.querySelectorAll(n.selectors.cta_play)],this.elPause=[...this.querySelectorAll(n.selectors.cta_pause)],this.elToggle=[...this.querySelectorAll(n.selectors.cta_toggle)],this.bindEvents(),this.addObserver()}async bindEvents(){this.elPlay.forEach(t=>t.addEventListener("click",this.play.bind(this))),this.elPause.forEach(t=>t.addEventListener("click",this.pause.bind(this))),this.elToggle.forEach(t=>t.addEventListener("click",this.onClick.bind(this)))}addObserver(){p.observe(this,this.observerOptions),p.addEnterCallback(this,this.onEnter.bind(this)),p.addExitCallback(this,this.onLeave.bind(this))}onEnter(){if(this.state!==void 0||this.player!==null)return!1;w.register(this.createPlayer.bind(this))}onLeave(){if(this.player===null||this.isAutoplay)return!1;this.pause()}createPlayer(){const t=`youtube-player-${this.videoId}-${Math.floor(Math.random()*100)}`;this.createIframeWrapper(t),this.player=new YT.Player(t,this.options),this.isAutoplay&&this.setAttribute("data-state","loading")}createIframeWrapper(t=""){this.insertAdjacentHTML("beforeend",n.iframeWrapper(t))}onClick(){if(this.dataset.state==="loading")return!1;this.state===1?this.pause():(this.state===2||this.state===-1||this.state===5)&&this.play()}play(){if(this.dataset.state==="loading")return!1;if(this.player===null||this.player.playVideo===void 0)return this.setAttribute("data-state","loading"),!1;this.player.playVideo(),this.updateToggle(!0)}pause(){if(this.player===null||this.player.pauseVideo===void 0)return!1;this.player.pauseVideo(),this.options.playerVars.autoplay=0,this.updateToggle(!1)}updateToggle(t){const s=t?window.accessibilityStrings.play:window.accessibilityStrings.pause;this.elToggle.forEach(i=>
1{i.setAttribute("aria-pressed",!t),i.title=s})}onReady(){this.isAutoplay&&this.player.mute();const t=this.player.getIframe();t.removeAttribute("width"),t.removeAttribute("height"),t.removeAttribute("frameborder"),(this.dataset.state==="loading"||this.isAutoplay)&&(this.play(),this.setAttribute("data-state",""))}onStateChange(t){this.setAttribute("data-state",n.youtubeStates[this.state]),t.data==0&&this.isAutoplay&&this.player.seekTo(0)}get videoId(){return this.dataset.id}get state(){var t;return(t=this.player)==null?void 0:t.getPlayerState()}get isAutoplay(){return this.options.playerVars.autoplay===1}static mergeOptions(t,s){return{...t,...s.playerVars}}};d(n,"youtubeStates",{"-1":"unstarted",0:"ended",1:"playing",2:"paused",3:"buffering",5:"cued"}),d(n,"defaultOptions",{host:"https://www.youtube-nocookie.com",playerVars:{autoplay:0,controls:2,showinfo:1,cc_load_policy:0,disablekb:0,enablejsapi:1,fs:1,iv_load_policy:3,loop:0,rel:0}}),d(n,"selectors",{cta_play:"[data-player-video-play]",cta_pause:"[data-player-video-pause]",cta_toggle:"[data-player-video-toggle]",status:"[data-player-video-status]"}),d(n,"iframeWrapper",t=>`<div class='u-w-full u-h-full u-object-cover' 2id='${t}'></div>`);let u=n;customElements.get("youtube-player")===void 0&&customElements.define("youtube-player",u); 3//# sourceMappingURL=YoutubePlayer.min.KHfwwNDr.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.