import{R as I}from"./index-95Cb4Zif.js";const W=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],L=globalThis.document?.createElement("template");L&&(L.innerHTML=`
    <style>
      :host {
        display: inline-block;
        line-height: 0;
      }

      video,
      audio {
        max-width: 100%;
        max-height: 100%;
        min-width: 100%;
        min-height: 100%;
      }
    </style>
    <slot></slot>
  `);const j=(i,{tag:e,is:o})=>{const d=globalThis.document?.createElement(e,{is:o}),u=d?S(d):[];return class g extends i{static Events=W;static template=L;static skipAttributes=[];static#s;static get observedAttributes(){return g.#l(),[...d?.constructor?.observedAttributes??[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}static#l(){if(this.#s)return;this.#s=!0;const t=new Set(this.observedAttributes);t.delete("muted");for(let s of u){if(s in this.prototype)continue;if(typeof d[s]=="function")this.prototype[s]=function(...r){this.#t();const a=()=>this.call?this.call(s,...r):this.nativeEl[s].apply(this.nativeEl,r);return this.loadComplete&&!this.isLoaded?this.loadComplete.then(a):a()};else{let r={get(){this.#t();let a=s.toLowerCase();if(t.has(a)){const p=this.getAttribute(a);return p===null?!1:p===""?!0:p}return this.get?.(s)??this.nativeEl?.[s]??this.#i[s]}};s!==s.toUpperCase()&&(r.set=async function(a){this.#t();let p=s.toLowerCase();if(t.has(p)){a===!0||a===!1||a==null?this.toggleAttribute(p,!!a):this.setAttribute(p,a);return}if(this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.set){this.set(s,a);return}this.nativeEl[s]=a}),Object.defineProperty(this.prototype,s,r)}}}#o;#n;#r=!1;#e=!1;#a;#i;constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0))),this.load!==g.prototype.load&&(this.loadComplete=new O)}get loadComplete(){return this.#n}set loadComplete(t){this.#e=!1,this.#n=t,t?.then(()=>{this.#e=!0})}get isLoaded(){return this.#e}get nativeEl(){return this.#a??this.shadowRoot.querySelector(e)??this.querySelector(e)}set nativeEl(t){this.#a=t}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(t){this.toggleAttribute("muted",!!t)}get src(){return this.getAttribute("src")}set src(t){this.setAttribute("src",`${t}`)}get preload(){return this.getAttribute("preload")??this.nativeEl?.preload}set preload(t){this.setAttribute("preload",`${t}`)}async#t(){if(this.#o)return;this.#o=!0,this.#c(),this.#u();for(let c of u)this.#d(c);const t=new Map,s=this.shadowRoot.querySelector("slot:not([name])");s?.addEventListener("slotchange",()=>{const c=new Map(t);s.assignedElements().filter(r=>["track","source"].includes(r.localName)).forEach(async r=>{c.delete(r);let a=t.get(r);a||(a=r.cloneNode(),t.set(r,a)),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl.append?.(a)}),c.forEach(r=>r.remove())});for(let c of this.constructor.Events)this.shadowRoot.addEventListener?.(c,r=>{r.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(r.type,{detail:r.detail}))},!0)}#d(t){if(Object.prototype.hasOwnProperty.call(this,t)){const s=this[t];delete this[t],this[t]=s}}#c(){const t=document.createElement(e,{is:o});t.muted=this.hasAttribute("muted");for(let{name:s,value:c}of this.attributes)t.setAttribute(s,c);this.#i={};for(let s of S(t))this.#i[s]=t[s];t.removeAttribute("src"),t.load()}async#u(){if(this.loadComplete&&!this.isLoaded&&await this.loadComplete,!this.nativeEl){const t=document.createElement(e,{is:o});t.part=e,this.shadowRoot.append(t)}this.nativeEl.muted=this.hasAttribute("muted")}attributeChangedCallback(t,s,c){this.#t(),t==="src"&&this.load!==g.prototype.load&&this.#h(),this.#p(t,s,c)}async#h(){this.#r&&(this.loadComplete=new O),this.#r=!0,await Promise.resolve(),await this.load(),this.loadComplete?.resolve(),await this.loadComplete}async#p(t,s,c){this.loadComplete&&!this.isLoaded&&await this.loadComplete,!["id","class",...this.constructor.skipAttributes].includes(t)&&(c===null?this.nativeEl.removeAttribute?.(t):this.nativeEl.setAttribute?.(t,c))}connectedCallback(){this.#t()}}};function S(i){let e=[];for(let o=Object.getPrototypeOf(i);o&&o!==HTMLElement.prototype;o=Object.getPrototypeOf(o))e.push(...Object.getOwnPropertyNames(o));return e}class O extends Promise{constructor(e=()=>{}){let o,d;super((u,f)=>{e(u,f),o=u,d=f}),this.resolve=o,this.reject=d}}const $=globalThis.document?j(HTMLElement,{tag:"video"}):class{};globalThis.document&&j(HTMLElement,{tag:"audio"});var H,R;const A=(H=globalThis.document)==null?void 0:H.createElement("template");A&&(A.innerHTML=`
  <div class="wistia_embed"></div>
  `);const M=(R=globalThis.document)==null?void 0:R.createElement("template");M&&(M.innerHTML=`
  <style>
    :host {
      display: inline-block;
      min-width: 300px;
      min-height: 150px;
      position: relative;
    }
    ::slotted(.wistia_embed) {
      position: absolute;
      width: 100%;
      height: 100%;
    }
  </style>
  <slot></slot>
  `);class q extends ${static template=M;static skipAttributes=["src"];get nativeEl(){var e;return((e=this.api)==null?void 0:e.elem())??this.querySelector("video")}async load(){var e;if((e=this.querySelector(".wistia_embed"))==null||e.remove(),!this.src)return;await new Promise(s=>setTimeout(s,50));const o=/(?:wistia\.com|wi\.st)\/(?:medias|embed)\/(.*)$/i,d=this.src.match(o)[1],u={autoPlay:this.autoplay,preload:this.preload??"metadata",playsinline:this.playsInline,endVideoBehavior:this.loop&&"loop",chromeless:!this.controls,playButton:this.controls,muted:this.defaultMuted};this.append(A.content.cloneNode(!0));const f=this.querySelector(".wistia_embed");f.id||(f.id=F(d)),f.classList.add(`wistia_async_${d}`),await B("https://fast.wistia.com/assets/external/E-v1.js","Wistia"),this.api=await new Promise(s=>{globalThis._wq.push({id:f.id,onReady:s,options:u})})}async attributeChangedCallback(e,o,d){if(e==="controls"){switch(await this.loadComplete,e){case"controls":this.api.bigPlayButtonEnabled(this.controls),this.controls?this.api.releaseChromeless():this.api.requestChromeless();break}return}super.attributeChangedCallback(e,o,d)}get duration(){var e;return(e=this.api)==null?void 0:e.duration()}play(){return this.api.play(),new Promise(e=>this.addEventListener("playing",e))}}const T={};async function B(i,e){return T[i]?T[i]:self[e]?self[e]:T[i]=new Promise((o,d)=>{const u=document.createElement("script");u.defer=!0,u.src=i,u.onload=()=>o(self[e]),u.onerror=d,document.head.append(u)})}let D=0;function F(i){const e=++D;return`${i}${e}`}globalThis.customElements&&!globalThis.customElements.get("wistia-video")&&globalThis.customElements.define("wistia-video",q);var U=q,z=new Set(["style","children","ref","key","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML"]),V={className:"class",htmlFor:"for"};function G(i){return i.toLowerCase()}function N(i){if(typeof i=="boolean")return i?"":void 0;if(typeof i!="function"&&!(typeof i=="object"&&i!==null))return i}function J({react:i,tagName:e,elementClass:o,events:d,displayName:u,defaultProps:f,toAttributeName:t=G,toAttributeValue:s=N}){const c=Number.parseInt(i.version)>=19,r=i.forwardRef((a,p)=>{var P,k;const m=i.useRef(null),E=i.useRef(new Map),C={},_={},b={},w={};for(const[n,l]of Object.entries(a)){if(z.has(n)){b[n]=l;continue}const h=t(V[n]??n);if(n in o.prototype&&!(n in(((P=globalThis.HTMLElement)==null?void 0:P.prototype)??{}))&&!((k=o.observedAttributes)!=null&&k.some(y=>y===h))){w[n]=l;continue}if(n.startsWith("on")){C[n]=l;continue}const v=s(l);if(h&&v!=null&&(_[h]=String(v),c||(b[h]=v)),h&&c){const y=N(l);v!==y?b[h]=v:b[h]=l}}if(typeof window<"u"){for(const n in C){const l=C[n],h=n.endsWith("Capture"),v=(d?.[n]??n.slice(2).toLowerCase()).slice(0,h?-7:void 0);i.useLayoutEffect(()=>{const y=m?.current;if(!(!y||typeof l!="function"))return y.addEventListener(v,l,h),()=>{y.removeEventListener(v,l,h)}},[m?.current,l])}i.useLayoutEffect(()=>{if(m.current===null)return;const n=new Map;for(const l in w)x(m.current,l,w[l]),E.current.delete(l),n.set(l,w[l]);for(const[l,h]of E.current)x(m.current,l,void 0);E.current=n})}if(typeof window>"u"&&o?.getTemplateHTML&&o?.shadowRootOptions){const{mode:n,delegatesFocus:l}=o.shadowRootOptions,h=i.createElement("template",{shadowrootmode:n,shadowrootdelegatesfocus:l,dangerouslySetInnerHTML:{__html:o.getTemplateHTML(_,a)}});b.children=[h,b.children]}return i.createElement(e,{...f,...b,ref:i.useCallback(n=>{m.current=n,typeof p=="function"?p(n):p!==null&&(p.current=n)},[p])})});return r.displayName=u??o.name,r}function x(i,e,o){var d;i[e]=o,o==null&&e in(((d=globalThis.HTMLElement)==null?void 0:d.prototype)??{})&&i.removeAttribute(e)}var Q=J({react:I,tagName:"wistia-video",elementClass:U});/*! Bundled license information:

ce-la-react/dist/ce-la-react.js:
  (**
   * @license
   * Copyright 2018 Google LLC
   * SPDX-License-Identifier: BSD-3-Clause
   *
   * Modified version of `@lit/react` for vanilla custom elements with support for SSR.
   *)
*/export{Q as default};
