1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.BrArzm-x.min.js","./vendor.D2HIaoTS.min.js"])))=>i.map(i=>d[i]); 2import{_ as e}from"./preload-helper.M8DPJa5q.min.js";import{B as t}from"./BaseElement.wji90fuE.min.js";import{k as i}from"./video-block-control-focus.CjDKQo_D.min.js";import{n as s,t as n}from"./vendor-lit.2u3dzq2T.min.js";const r="video-block:play",o="video-block-media, video-block-youtube, product-gallery-video",l=["video-block-media","video-block-youtube","product-gallery-video"],a=["https://www.youtube.com","https://www.youtube-nocookie.com","*"],u=new Set;function c(e){u.add(e)}function d(e){u.delete(e)}let h=!1;function y(e,t){e.querySelectorAll('iframe[src*="youtube.com"], iframe[src*="youtu.be"]').forEach(e=>{const i=e;(null==t?void 0:t.contains(i))||function(e){const t=JSON.stringify({event:"command",func:"pauseVideo",args:[]}),i=e.contentWindow;if(i)for(const s of a)try{i.postMessage(t,s)}catch{}}(i)})}function p(e,t={}){const i=new Set,s=t=>{i.has(t)||(i.add(t),function(e,t){if(e===t||!e.isConnected)return;const i=e;if("function"==typeof i.pause)i.pause();else{const i=e.tagName.toLowerCase();l.includes(i)&&customElements.whenDefined(i).then(()=>{var i;e!==t&&e.isConnected&&(null==(i=e.pause)||i.call(e))})}y(e)}(t,e))};document.querySelectorAll(o).forEach(e=>{s(e)});for(const n of u)n.isConnected&&s(n);!function(e){document.querySelectorAll("deferred-media").forEach(t=>{var i;if(t===e)return;const s=t;null==(i=s.pause)||i.call(s,!0)})}(e),function(e,t){e.querySelectorAll("video").forEach(e=>{const i=e;if(!t.contains(i)&&i.closest(o))try{i.pause()}catch{}})}(document,e),y(document,e),t.skipEvent||document.dispatchEvent(new CustomEvent(r,{detail:{source:e}}))}h||"undefined"==typeof document||(h=!0,document.addEventListener("click",e=>{if(e.defaultPrevented)return;const t=e.target;if(!(t instanceof Element))return;const i=t.closest("[play-toggle]");if(!i)return;const s=i.closest(o);s instanceof HTMLElement&&(function(e){return!0===e.playing||"true"===e.getAttribute("data-playing")}(s)||p(s,{skipEvent:!0}))},!0));const m="data-css-fullscreen",f="data-video-block-css-fullscreen-lock",b="data-video-block-fs-unlock-transform",g="data-video-block-fs-hide",v="data-video-block-fs-popover",w=new WeakMap;function _(e){const t=document;return document.fullscreenElement===e||t.webkitFullscreenElement===e}function E(){const e=document;return Boolean(document.fullscreenElement||e.webkitFullscreenElement)}function P(e){return e.hasAttribute(m)}function k(){if("undefined"!=typeof navigator&&/iPhone|iPod/.test(navigator.userAgent))return!0;const e=document;return!1===document.fullscreenEnabled&&!e.webkitFullscreenEnabled}async function A(e){var t,i;if(k())return!1;const s=e,n=(null==(t=e.requestFullscreen)?void 0:t.bind(e))||(null==(i=s.webkitRequestFullscreen)?void 0:i.bind(e));if(!n)return!1;try{await n()}catch{return!1}return _(e)}async function C(){const e=document;document.fullscreenElement?await document.exitFullscreen():e.webkitExitFullscreen&&await e.webkitExitFullscreen()}function F(e){const t=getComputedStyle(e);if("none"!==t.transform)return!0;if("none"!==t.perspective)return!0;if("none"!==t.filter)return!0;if(/\b(?:paint|strict|content)\b/.test(t.contain))return!0;const i=t.willChange;return i.includes("transform")||i.includes("filter")||i.includes("perspective")}function T(e){var t;const i=e;try{e.matches(":popover-open")&&(null==(t=i.hidePopover)||t.call(i))}catch{}e.removeAttribute("popover"),e.removeAttribute(v)}function S(e){if(P(e))return;let t=[],i=[];const s=function(e){var t;if(!function(e){return"function"==typeof e.showPopover}(e))return!1;const i=e;try{if(e.setAttribute("popover","manual"),e.setAttribute(v,""),null==(t=i.showPopover)||t.call(i),e.matches(":popover-open"))return!0}catch{}return e.removeAttribute("popover"),e.removeAttribute(v),!1}(e);s||(t=function(e){const t=[];let i=e.parentElement;for(;i&&i!==document.documentElement;){const e=getComputedStyle(i),s="visible"!==e.overflow||"visible"!==e.overflowX||"visible"!==e.overflowY;(F(i)||s)&&(i.setAttribute(b,""),t.push(i)),i=i.parentElement}return t}(e),i=function(e){const t=[],i=e.closest("swiper-slide, .swiper-slide"),s=null==i?void 0:i.parentElement;if(!i||!s)return t;for(const n of Array.from(s.children))n!==i&&n instanceof HTMLElement&&(n.setAttribute(g,""),t.push(n));return t}(e)),w.set(e,{unlocked:t,hidden:i,usedPopover:s}),e.setAttribute(m,""),document.documentElement.setAttribute(f,"")}function M(e){const t=w.get(e);if(t){t.usedPopover&&T(e);for(const e of t.unlocked)e.removeAttribute(b);for(const e of t.hidden)e.removeAttribute(g);w.delete(e)}else e.hasAttribute(v)&&T(e);e.removeAttribute(m),document.querySelector(`[${m}]`)||document.documentElement.removeAttribute(f)}function q(e){const t=e;
2if(!t.webkitSupportsFullscreen||!t.webkitEnterFullscreen)return!1;try{return t.webkitEnterFullscreen(),!0}catch{return!1}}var L=Object.defineProperty,x=Object.getOwnPropertyDescriptor,U=(e,t,i,s)=>{for(var n,r=s>1?void 0:s?x(t,i):t,o=e.length-1;o>=0;o--)(n=e[o])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&L(t,i,r),r};let O=class extends t{constructor(){super(...arguments),this.playing=!1,this.muted=!0,this.youtubeId="",this.player=null,this.playerReady=null,this.progressTimer=null,this.duration=0,this.frameObserver=null,this.wantPlaying=!1,this.onFullscreenChange=()=>{this._syncFullscreenUi()},this.onCssFullscreenKeydown=e=>{"Escape"===e.key&&P(this)&&this._exitCssFullscreenMode()},this.onSiblingVideoPlay=e=>{var t;const i=null==(t=e.detail)?void 0:t.source;i&&i!==this&&this.pause()},this.onProgressInput=e=>{const t=e.target;if(!this.player||!this.duration)return;const i=Number(t.value)/100*this.duration;this.player.seekTo(i,!0),this._syncProgressFill(t)}}connectedCallback(){var e;super.connectedCallback(),c(this),null==(e=this.querySelector("[data-progress]"))||e.addEventListener("input",this.onProgressInput);const t=this.getAttribute("data-muted");"false"===t?this.muted=!1:("true"===t||this.hasAttribute("muted"))&&(this.muted=!0),this._syncMediaUiAttributes(),document.addEventListener("fullscreenchange",this.onFullscreenChange),document.addEventListener("webkitfullscreenchange",this.onFullscreenChange),document.addEventListener(r,this.onSiblingVideoPlay)}disconnectedCallback(){this.wantPlaying=!1,this._stopProgressTimer(),d(this),document.removeEventListener("fullscreenchange",this.onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this.onFullscreenChange),document.removeEventListener("keydown",this.onCssFullscreenKeydown),document.removeEventListener(r,this.onSiblingVideoPlay),P(this)&&M(this),this._teardownPlayer(),super.disconnectedCallback()}_teardownPlayer(){var e;const t=this.player,i=this.playerReady;this.player=null,this.playerReady=null,null==(e=this.frameObserver)||e.disconnect(),this.frameObserver=null,t?t.destroy().catch(()=>{}):i&&i.then(e=>e.destroy()).catch(()=>{})}async play(){this.wantPlaying=!0,p(this);try{const e=await this._ensurePlayer();if(!this._canContinuePlayback())return void e.pauseVideo();if(this.muted?await e.mute():await e.unMute(),!this._canContinuePlayback())return void e.pauseVideo();await e.playVideo(),this._canContinuePlayback()||(e.pauseVideo(),this.isConnected&&(this.playing=!1,this._syncMediaUiAttributes(),this._stopProgressTimer()))}catch{if(!this.isConnected)return;this.player=null,this.playerReady=null,this.setAttribute("data-load-error",""),this.playing=!1,this._syncMediaUiAttributes()}}pause(){this.wantPlaying=!1,this.player&&this.player.pauseVideo().catch(()=>{}),!this.player&&this.playerReady&&this.playerReady.then(e=>{this.wantPlaying&&this.isConnected||e.pauseVideo()}),y(this),this.isConnected&&(this.playing=!1,this._syncMediaUiAttributes(),this._stopProgressTimer())}_canContinuePlayback(){return this.isConnected&&this.wantPlaying}toggleMute(){this._toggleMute()}toggleFullscreen(){this._toggleFullscreen()}exitFullscreenMode(){this._exitFullscreen()}async _toggleMute(){const e=this.player;if(!e){if(!this.isConnected)return;return this.muted=!this.muted,void this._syncMediaUiAttributes()}const t=await e.isMuted();if(this.isConnected){if(t){if(await e.unMute(),!this.isConnected)return;this.muted=!1}else{if(await e.mute(),!this.isConnected)return;this.muted=!0}this._syncMediaUiAttributes()}}async _ensurePlayer(){return this.player?this.player:(this.playerReady||(this.playerReady=this._createPlayer().then(e=>{if(!this.isConnected)throw e.destroy().catch(()=>{}),this.playerReady=null,new Error("Disconnected during YouTube init");return this.player=e,e}).catch(e=>{throw this.playerReady=null,this.player=null,e})),this.playerReady)}_buildEmbedSrc(){const e=new URLSearchParams({enablejsapi:"1",controls:"0",rel:"0",modestbranding:"1",playsinline:"1",fs:"0",disablekb:"1",iv_load_policy:"3",cc_load_policy:"0",autoplay:"0",origin:window.location.origin});return`https://www.youtube.com/embed/${this.youtubeId}?${e.toString()}`}_waitForIframeLoad(e){return new Promise(t=>{let i=!1;const s=()=>{i||(i=!0,t())};e.addEventListener("load",s,{once:!0}),window.setTimeout(s,2500)})}async _createPlayer(){const t=this.querySelector("[data-yt-mount]");
2if(!t||!this.youtubeId)throw new Error("Missing YouTube mount or id");t.replaceChildren();const i=document.createElement("iframe");if(i.setAttribute("data-yt-iframe",""),i.src=this._buildEmbedSrc(),i.title=this.getAttribute("aria-label")||"Video",i.allow="autoplay; encrypted-media; picture-in-picture",i.setAttribute("tabindex","-1"),i.setAttribute("aria-hidden","true"),i.style.pointerEvents="none",t.appendChild(i),this._fitIframeToFrame(t,i),await this._waitForIframeLoad(i),!this.isConnected)throw i.remove(),new Error("Disconnected during YouTube init");const{default:s}=await e(async()=>{const{default:e}=await import("./index.BrArzm-x.min.js").then(e=>e.i);return{default:e}},__vite__mapDeps([0,1]),import.meta.url);if(!this.isConnected)throw i.remove(),new Error("Disconnected during YouTube init");const n=s(i,{playerVars:{controls:0,disablekb:1,fs:0,iv_load_policy:3,modestbranding:1,playsinline:1,rel:0,origin:window.location.origin}});if(await this._withTimeout(n.mute(),1e4),!this.isConnected)throw n.destroy().catch(()=>{}),new Error("Disconnected during YouTube init");return n.on("stateChange",e=>{if(this.isConnected)switch(e.data){case 1:p(this),this.playing=!0,this._syncMediaUiAttributes(),this._startProgressTimer(),n.getDuration().then(e=>{this.isConnected&&(this.duration=e)});break;case 2:this.playing=!1,this._syncMediaUiAttributes(),this._stopProgressTimer();break;case 0:this.playing=!1,n.seekTo(0,!0),this._syncMediaUiAttributes(),this._stopProgressTimer(),this._resetProgress()}}),n.on("error",()=>{this.isConnected&&this.setAttribute("data-load-error","")}),n}_fitIframeToFrame(e,t){var i;const s=Number(this.dataset.videoAspect);if(!(s>0))return;const n=()=>{const{clientWidth:i,clientHeight:n}=e;if(!i||!n)return;const r=Math.min(i,n*s);t.style.left=(i-r)/2+"px",t.style.top="-120px",t.style.right="auto",t.style.bottom="auto",t.style.width=`${r}px`,t.style.height=`${n+240}px`};n(),null==(i=this.frameObserver)||i.disconnect(),this.frameObserver=new ResizeObserver(n),this.frameObserver.observe(e)}_withTimeout(e,t){return new Promise((i,s)=>{const n=window.setTimeout(()=>{s(new Error("YouTube player ready timeout"))},t);e.then(e=>{window.clearTimeout(n),i(e)},e=>{window.clearTimeout(n),s(e)})})}_startProgressTimer(){this.querySelector("[data-progress]")&&(this._stopProgressTimer(),this.progressTimer=window.setInterval(()=>{this._updateProgress()},250))}_stopProgressTimer(){null!==this.progressTimer&&(window.clearInterval(this.progressTimer),this.progressTimer=null)}async _updateProgress(){if(!this.player||!this.duration)return;const e=this.querySelector("[data-progress]");if(e)try{const t=await this.player.getCurrentTime();e.value=String(t/this.duration*100),this._syncProgressFill(e)}catch{}}_resetProgress(){const e=this.querySelector("[data-progress]");e&&(e.value="0",this._syncProgressFill(e))}_syncProgressFill(e){e.style.setProperty("--video-progress-pct",`${e.value}%`)}_syncMediaUiAttributes(){this.setAttribute("data-playing",this.playing?"true":"false"),this.setAttribute("data-muted",this.muted?"true":"false"),this.toggleAttribute("muted",this.muted),this.querySelectorAll(".video-block-icon--play").forEach(e=>{e.hidden=this.playing}),this.querySelectorAll(".video-block-icon--pause").forEach(e=>{e.hidden=!this.playing}),this.querySelectorAll(".video-block-icon--unmute").forEach(e=>{e.hidden=this.muted}),this.querySelectorAll(".video-block-icon--mute").forEach(e=>{e.hidden=!this.muted});const e=this.querySelector("[play-toggle]"),t=this.querySelector("[volume-toggle]"),s=this.dataset.labelPlay,n=this.dataset.labelPause,r=this.dataset.labelMute,o=this.dataset.labelUnmute;e&&s&&n&&e.setAttribute("aria-label",this.playing?n:s),t&&r&&o&&t.setAttribute("aria-label",this.muted?o:r),i(this,this.playing)}async _toggleFullscreen(){if(P(this)||E())return void(await this._exitFullscreen());let e=!1;(k()||(e=await A(this),this.isConnected))&&(e||this._enterCssFullscreenMode(),this.play())}async _exitFullscreen(){P(this)?this._exitCssFullscreenMode():(await C(),this.isConnected&&this._syncFullscreenUi())}_enterCssFullscreenMode(){S(this),document.addEventListener("keydown",this.onCssFullscreenKeydown),this._syncFullscreenUi()}_exitCssFullscreenMode(){document.removeEventListener("keydown",this.onCssFullscreenKeydown),M(this),this.isConnected&&this._syncFullscreenUi()}_syncFullscreenUi(){const e=P(this)||_(this);this.toggleAttribute("data-fullscreen",e);const t=this.querySelector("[fullscreen-close]");t&&(t.hidden=!e)}};U([s({type:Boolean,reflect:!0})],O.prototype,"playing",2),U([s({type:Boolean,reflect:!0})],O.prototype,"muted",2),U([s({type:String,attribute:"youtube-id"})],O.prototype,"youtubeId",2),O=U([n("video-block-youtube")],O);const R=Object.freeze(Object.defineProperty({__proto__:null,get VideoBlockYoutube(){return O}},Symbol.toStringTag,{value:"Module"}));
2export{r as V,E as a,q as b,A as c,C as d,M as e,S as f,_ as g,O as h,P as i,p,c as r,k as s,d as u,R as v};
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.