diff --git a/README.md b/README.md index fdaa4fc..19a7b38 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ ## Features This kit is deceptively simple – it may look like a 3 page site but there's a whole treasure trove of business logic and UI detail just under the surface. -### Turbo Powered +### Livewire Powered -Podcaster's frontend uses [Turbo](https://turbo.hotwire.dev/) to eliminate full page reloads, allowing the podcast player to persist across page changes without having to build and maintain the site as a SPA (single page application). State changes to the UI (such as which episode is playing) are persisted using [Alpine.js](https://alpinejs.dev). +Podcaster's frontend uses [Livewire](https://livewire.laravel.com.dev/) to eliminate full page reloads, allowing the podcast player to persist across page changes without having to build and maintain the site as a SPA (single page application). ### The Player @@ -75,3 +75,9 @@ Just a few extra things built on the PHP/Laravel site to make the experience bet - AddSlashes Modifier - PubSubHubbub Event Listener - Getting Started Dashboard Widget + +### Customize the Frontend + +If you want to customize the frontend (it's a _starter_ kit after all), all you need to do while working on the site is run `npm run dev` for Vite to watch changes and recompile your Tailwind-driven CSS or JS. + +In production, use `npm run build` in your deploy script instead for Production-ready compiled resources. diff --git a/package.json b/package.json index cb0bfc8..7b82f6c 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,6 @@ "vite": "^4.0.0" }, "dependencies": { - "@hotwired/turbo": "^7.0.0-rc.1", - "alpinejs": "^3.9.3", "chroma-js": "^2.1.2", "plyr": "^3.6.8" } diff --git a/public/build/assets/site-380fa510.js b/public/build/assets/site-380fa510.js new file mode 100644 index 0000000..b3f6e71 --- /dev/null +++ b/public/build/assets/site-380fa510.js @@ -0,0 +1,57 @@ +function _(e,r,t){return(r=cc(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function oc(e,r){if(typeof e!="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var a=t.call(e,r||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function cc(e){var r=oc(e,"string");return typeof r=="symbol"?r:String(r)}function uc(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function rn(e,r){for(var t=0;tr){var t=kc(r);return parseFloat(e.toFixed(t))}return Math.round(e/r)*r}var Cc=function(){function e(r,t){uc(this,e),ve.element(r)?this.element=r:ve.string(r)&&(this.element=document.querySelector(r)),ve.element(this.element)&&ve.empty(this.element.rangeTouch)&&(this.config=an({},sn,{},t),this.init())}return hc(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(r){var t=this,a=r?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(l){t.element[a](l,function(o){return t.set(o)},!1)})}},{key:"get",value:function(r){if(!e.enabled||!ve.event(r))return null;var t,a=r.target,l=r.changedTouches[0],o=parseFloat(a.getAttribute("min"))||0,h=parseFloat(a.getAttribute("max"))||100,f=parseFloat(a.getAttribute("step"))||1,w=a.getBoundingClientRect(),k=100/w.width*(this.config.thumbWidth/2)/100;return 0>(t=100/w.width*(l.clientX-w.left))?t=0:100t?t-=(100-2*t)*k:50e!=null?e.constructor:null,Ne=(e,r)=>!!(e&&r&&e instanceof r),Ti=e=>e==null,bn=e=>pt(e)===Object,$c=e=>pt(e)===Number&&!Number.isNaN(e),Nt=e=>pt(e)===String,Ac=e=>pt(e)===Boolean,vn=e=>typeof e=="function",yn=e=>Array.isArray(e),Ec=e=>Ne(e,WeakMap),wn=e=>Ne(e,NodeList),_c=e=>pt(e)===Text,Pc=e=>Ne(e,Event),Mc=e=>Ne(e,KeyboardEvent),Sc=e=>Ne(e,window.TextTrackCue)||Ne(e,window.VTTCue),Nc=e=>Ne(e,TextTrack)||!Ti(e)&&Nt(e.kind),xc=e=>Ne(e,Promise)&&vn(e.then),Lc=e=>e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object",kn=e=>Ti(e)||(Nt(e)||yn(e)||wn(e))&&!e.length||bn(e)&&!Object.keys(e).length,Ic=e=>{if(Ne(e,window.URL))return!0;if(!Nt(e))return!1;let r=e;e.startsWith("http://")&&e.startsWith("https://")||(r=`http://${e}`);try{return!kn(new URL(r).hostname)}catch{return!1}};var u={nullOrUndefined:Ti,object:bn,number:$c,string:Nt,boolean:Ac,function:vn,array:yn,weakMap:Ec,nodeList:wn,element:Lc,textNode:_c,event:Pc,keyboardEvent:Mc,cue:Sc,track:Nc,promise:xc,url:Ic,empty:kn};const mi=(()=>{const e=document.createElement("span"),r={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},t=Object.keys(r).find(a=>e.style[a]!==void 0);return!!u.string(t)&&r[t]})();function Tn(e,r){setTimeout(()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch{}},r)}const Oc=!!window.document.documentMode,Rc=/Edge/g.test(navigator.userAgent),Fc="WebkitAppearance"in document.documentElement.style&&!/Edge/g.test(navigator.userAgent),Dc=/iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1,qc=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,jc=/iPad|iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1;var me={isIE:Oc,isEdge:Rc,isWebKit:Fc,isIPhone:Dc,isIPadOS:qc,isIos:jc};function Hc(e){return JSON.parse(JSON.stringify(e))}function Cn(e,r){return r.split(".").reduce((t,a)=>t&&t[a],e)}function le(e={},...r){if(!r.length)return e;const t=r.shift();return u.object(t)?(Object.keys(t).forEach(a=>{u.object(t[a])?(Object.keys(e).includes(a)||Object.assign(e,{[a]:{}}),le(e[a],t[a])):Object.assign(e,{[a]:t[a]})}),le(e,...r)):e}function $n(e,r){const t=e.length?e:[e];Array.from(t).reverse().forEach((a,l)=>{const o=l>0?r.cloneNode(!0):r,h=a.parentNode,f=a.nextSibling;o.appendChild(a),f?h.insertBefore(o,f):h.appendChild(o)})}function fi(e,r){u.element(e)&&!u.empty(r)&&Object.entries(r).filter(([,t])=>!u.nullOrUndefined(t)).forEach(([t,a])=>e.setAttribute(t,a))}function R(e,r,t){const a=document.createElement(e);return u.object(r)&&fi(a,r),u.string(t)&&(a.innerText=t),a}function Vc(e,r){u.element(e)&&u.element(r)&&r.parentNode.insertBefore(e,r.nextSibling)}function ln(e,r,t,a){u.element(r)&&r.appendChild(R(e,t,a))}function Se(e){u.nodeList(e)||u.array(e)?Array.from(e).forEach(Se):u.element(e)&&u.element(e.parentNode)&&e.parentNode.removeChild(e)}function At(e){if(!u.element(e))return;let{length:r}=e.childNodes;for(;r>0;)e.removeChild(e.lastChild),r-=1}function Pt(e,r){return u.element(r)&&u.element(r.parentNode)&&u.element(e)?(r.parentNode.replaceChild(e,r),e):null}function Ee(e,r){if(!u.string(e)||u.empty(e))return{};const t={},a=le({},r);return e.split(",").forEach(l=>{const o=l.trim(),h=o.replace(".",""),f=o.replace(/[[\]]/g,"").split("="),[w]=f,k=f.length>1?f[1].replace(/["']/g,""):"";switch(o.charAt(0)){case".":u.string(a.class)?t.class=`${a.class} ${h}`:t.class=h;break;case"#":t.id=o.replace("#","");break;case"[":t[w]=k}}),le(a,t)}function He(e,r){if(!u.element(e))return;let t=r;u.boolean(t)||(t=!e.hidden),e.hidden=t}function te(e,r,t){if(u.nodeList(e))return Array.from(e).map(a=>te(a,r,t));if(u.element(e)){let a="toggle";return t!==void 0&&(a=t?"add":"remove"),e.classList[a](r),e.classList.contains(r)}return!1}function Mt(e,r){return u.element(e)&&e.classList.contains(r)}function Ve(e,r){const{prototype:t}=Element;return(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||function(){return Array.from(document.querySelectorAll(r)).includes(this)}).call(e,r)}function Bc(e,r){const{prototype:t}=Element;return(t.closest||function(){let a=this;do{if(Ve.matches(a,r))return a;a=a.parentElement||a.parentNode}while(a!==null&&a.nodeType===1);return null}).call(e,r)}function ot(e){return this.elements.container.querySelectorAll(e)}function ue(e){return this.elements.container.querySelector(e)}function ui(e=null,r=!1){u.element(e)&&e.focus({preventScroll:!0,focusVisible:r})}const on={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},oe={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,r){const t=oe[e]||r!=="html5";return{api:t,ui:t&&oe.rangeInput}},pip:!(me.isIPhone||!u.function(R("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||R("video").disablePictureInPicture)),airplay:u.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(u.empty(e))return!1;const[r]=e.split("/");let t=e;if(!this.isHTML5||r!==this.type)return!1;Object.keys(on).includes(t)&&(t+=`; codecs="${on[e]}"`);try{return!!(t&&this.media.canPlayType(t).replace(/no/,""))}catch{return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range",e.type==="range"})(),touch:"ontouchstart"in document.documentElement,transitions:mi!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},zc=(()=>{let e=!1;try{const r=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,r),window.removeEventListener("test",null,r)}catch{}return e})();function ct(e,r,t,a=!1,l=!0,o=!1){if(!e||!("addEventListener"in e)||u.empty(r)||!u.function(t))return;const h=r.split(" ");let f=o;zc&&(f={passive:l,capture:o}),h.forEach(w=>{this&&this.eventListeners&&a&&this.eventListeners.push({element:e,type:w,callback:t,options:f}),e[a?"addEventListener":"removeEventListener"](w,t,f)})}function X(e,r="",t,a=!0,l=!1){ct.call(this,e,r,t,!0,a,l)}function xt(e,r="",t,a=!0,l=!1){ct.call(this,e,r,t,!1,a,l)}function Ci(e,r="",t,a=!0,l=!1){const o=(...h)=>{xt(e,r,o,a,l),t.apply(this,h)};ct.call(this,e,r,o,!0,a,l)}function F(e,r="",t=!1,a={}){if(!u.element(e)||u.empty(r))return;const l=new CustomEvent(r,{bubbles:t,detail:{...a,plyr:this}});e.dispatchEvent(l)}function Uc(){this&&this.eventListeners&&(this.eventListeners.forEach(e=>{const{element:r,type:t,callback:a,options:l}=e;r.removeEventListener(t,a,l)}),this.eventListeners=[])}function Wc(){return new Promise(e=>this.ready?setTimeout(e,0):X.call(this,this.elements.container,"ready",e)).then(()=>{})}function _e(e){u.promise(e)&&e.then(null,()=>{})}function gi(e){return u.array(e)?e.filter((r,t)=>e.indexOf(r)===t):e}function An(e,r){return u.array(e)&&e.length?e.reduce((t,a)=>Math.abs(a-r)({...e,[r/t]:[r,t]}),{});function _n(e){return u.array(e)||u.string(e)&&e.includes(":")?(u.array(e)?e:e.split(":")).map(Number).every(u.number):!1}function St(e){if(!u.array(e)||!e.every(u.number))return null;const[r,t]=e,a=(o,h)=>h===0?o:a(h,o%h),l=a(r,t);return[r/l,t/l]}function $i(e){const r=a=>_n(a)?a.split(":").map(Number):null;let t=r(e);if(t===null&&(t=r(this.config.ratio)),t===null&&!u.empty(this.embed)&&u.array(this.embed.ratio)&&({ratio:t}=this.embed),t===null&&this.isHTML5){const{videoWidth:a,videoHeight:l}=this.media;t=[a,l]}return St(t)}function tt(e){if(!this.isVideo)return{};const{wrapper:r}=this.elements,t=$i.call(this,e);if(!u.array(t))return{};const[a,l]=St(t),o=100/a*l;if(En(`aspect-ratio: ${a}/${l}`)?r.style.aspectRatio=`${a}/${l}`:r.style.paddingBottom=`${o}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const h=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),f=(h-o)/(h/50);this.fullscreen.active?r.style.paddingBottom=null:this.media.style.transform=`translateY(-${f}%)`}else this.isHTML5&&r.classList.add(this.config.classNames.videoFixedRatio);return{padding:o,ratio:t}}function Pn(e,r,t=.05){const a=e/r,l=An(Object.keys(cn),a);return Math.abs(l-a)<=t?cn[l]:[e,r]}function Gc(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}const Fe={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(e=>{const r=e.getAttribute("type");return!!u.empty(r)||oe.mime.call(this,r)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:Fe.getSources.call(this).map(e=>Number(e.getAttribute("size"))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,u.empty(this.config.ratio)||tt.call(e),Object.defineProperty(e.media,"quality",{get(){const r=Fe.getSources.call(e).find(t=>t.getAttribute("src")===e.source);return r&&Number(r.getAttribute("size"))},set(r){if(e.quality!==r){if(e.config.quality.forced&&u.function(e.config.quality.onChange))e.config.quality.onChange(r);else{const t=Fe.getSources.call(e).find(w=>Number(w.getAttribute("size"))===r);if(!t)return;const{currentTime:a,paused:l,preload:o,readyState:h,playbackRate:f}=e.media;e.media.src=t.getAttribute("src"),(o!=="none"||h)&&(e.once("loadedmetadata",()=>{e.speed=f,e.currentTime=a,l||_e(e.play())}),e.media.load())}F.call(e,e.media,"qualitychange",!1,{quality:r})}}})},cancelRequests(){this.isHTML5&&(Se(Fe.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function Yc(e){return`${e}-${Math.floor(1e4*Math.random())}`}function bi(e,...r){return u.empty(e)?e:e.toString().replace(/{(\d+)}/g,(t,a)=>r[a].toString())}function Kc(e,r){return e===0||r===0||Number.isNaN(e)||Number.isNaN(r)?0:(e/r*100).toFixed(2)}const lt=(e="",r="",t="")=>e.replace(new RegExp(r.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),t.toString()),Mn=(e="")=>e.toString().replace(/\w\S*/g,r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase());function Xc(e=""){let r=e.toString();return r=lt(r,"-"," "),r=lt(r,"_"," "),r=Mn(r),lt(r," ","")}function Qc(e=""){let r=e.toString();return r=Xc(r),r.charAt(0).toLowerCase()+r.slice(1)}function Jc(e){const r=document.createDocumentFragment(),t=document.createElement("div");return r.appendChild(t),t.innerHTML=e,r.firstChild.innerText}function Zc(e){const r=document.createElement("div");return r.appendChild(e),r.innerHTML}const un={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},pe={get(e="",r={}){if(u.empty(e)||u.empty(r))return"";let t=Cn(r.i18n,e);if(u.empty(t))return Object.keys(un).includes(e)?un[e]:"";const a={"{seektime}":r.seekTime,"{title}":r.title};return Object.entries(a).forEach(([l,o])=>{t=lt(t,l,o)}),t}};class ut{constructor(r){_(this,"get",t=>{if(!ut.supported||!this.enabled)return null;const a=window.localStorage.getItem(this.key);if(u.empty(a))return null;const l=JSON.parse(a);return u.string(t)&&t.length?l[t]:l}),_(this,"set",t=>{if(!ut.supported||!this.enabled||!u.object(t))return;let a=this.get();u.empty(a)&&(a={}),le(a,t);try{window.localStorage.setItem(this.key,JSON.stringify(a))}catch{}}),this.enabled=r.config.storage.enabled,this.key=r.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const r="___test";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}}function mt(e,r="text"){return new Promise((t,a)=>{try{const l=new XMLHttpRequest;if(!("withCredentials"in l))return;l.addEventListener("load",()=>{if(r==="text")try{t(JSON.parse(l.responseText))}catch{t(l.responseText)}else t(l.response)}),l.addEventListener("error",()=>{throw new Error(l.status)}),l.open("GET",e,!0),l.responseType=r,l.send()}catch(l){a(l)}})}function Sn(e,r){if(!u.string(e))return;const t="cache",a=u.string(r);let l=!1;const o=()=>document.getElementById(r)!==null,h=(f,w)=>{f.innerHTML=w,a&&o()||document.body.insertAdjacentElement("afterbegin",f)};if(!a||!o()){const f=ut.supported,w=document.createElement("div");if(w.setAttribute("hidden",""),a&&w.setAttribute("id",r),f){const k=window.localStorage.getItem(`${t}-${r}`);if(l=k!==null,l){const S=JSON.parse(k);h(w,S.content)}}mt(e).then(k=>{if(!u.empty(k)){if(f)try{window.localStorage.setItem(`${t}-${r}`,JSON.stringify({content:k}))}catch{}h(w,k)}}).catch(()=>{})}}const Nn=e=>Math.trunc(e/60/60%60,10),eu=e=>Math.trunc(e/60%60,10),tu=e=>Math.trunc(e%60,10);function Lt(e=0,r=!1,t=!1){if(!u.number(e))return Lt(void 0,r,t);const a=f=>`0${f}`.slice(-2);let l=Nn(e);const o=eu(e),h=tu(e);return l=r||l>0?`${l}:`:"",`${t&&e>0?"-":""}${l}${a(o)}:${a(h)}`}const E={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),r=window.location.host?window.location.host:window.top.location.host,t=e.host!==r||me.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:t}},findElements(){try{return this.elements.controls=ue.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:ot.call(this,this.config.selectors.buttons.play),pause:ue.call(this,this.config.selectors.buttons.pause),restart:ue.call(this,this.config.selectors.buttons.restart),rewind:ue.call(this,this.config.selectors.buttons.rewind),fastForward:ue.call(this,this.config.selectors.buttons.fastForward),mute:ue.call(this,this.config.selectors.buttons.mute),pip:ue.call(this,this.config.selectors.buttons.pip),airplay:ue.call(this,this.config.selectors.buttons.airplay),settings:ue.call(this,this.config.selectors.buttons.settings),captions:ue.call(this,this.config.selectors.buttons.captions),fullscreen:ue.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=ue.call(this,this.config.selectors.progress),this.elements.inputs={seek:ue.call(this,this.config.selectors.inputs.seek),volume:ue.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:ue.call(this,this.config.selectors.display.buffer),currentTime:ue.call(this,this.config.selectors.display.currentTime),duration:ue.call(this,this.config.selectors.display.duration)},u.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon(e,r){const t="http://www.w3.org/2000/svg",a=E.getIconUrl.call(this),l=`${a.cors?"":a.url}#${this.config.iconPrefix}`,o=document.createElementNS(t,"svg");fi(o,le(r,{"aria-hidden":"true",focusable:"false"}));const h=document.createElementNS(t,"use"),f=`${l}-${e}`;return"href"in h&&h.setAttributeNS("http://www.w3.org/1999/xlink","href",f),h.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f),o.appendChild(h),o},createLabel(e,r={}){const t=pe.get(e,this.config);return R("span",{...r,class:[r.class,this.config.classNames.hidden].filter(Boolean).join(" ")},t)},createBadge(e){if(u.empty(e))return null;const r=R("span",{class:this.config.classNames.menu.value});return r.appendChild(R("span",{class:this.config.classNames.menu.badge},e)),r},createButton(e,r){const t=le({},r);let a=Qc(e);const l={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(h=>{Object.keys(t).includes(h)&&(l[h]=t[h],delete t[h])}),l.element!=="button"||Object.keys(t).includes("type")||(t.type="button"),Object.keys(t).includes("class")?t.class.split(" ").some(h=>h===this.config.classNames.control)||le(t,{class:`${t.class} ${this.config.classNames.control}`}):t.class=this.config.classNames.control,e){case"play":l.toggle=!0,l.label="play",l.labelPressed="pause",l.icon="play",l.iconPressed="pause";break;case"mute":l.toggle=!0,l.label="mute",l.labelPressed="unmute",l.icon="volume",l.iconPressed="muted";break;case"captions":l.toggle=!0,l.label="enableCaptions",l.labelPressed="disableCaptions",l.icon="captions-off",l.iconPressed="captions-on";break;case"fullscreen":l.toggle=!0,l.label="enterFullscreen",l.labelPressed="exitFullscreen",l.icon="enter-fullscreen",l.iconPressed="exit-fullscreen";break;case"play-large":t.class+=` ${this.config.classNames.control}--overlaid`,a="play",l.label="play",l.icon="play";break;default:u.empty(l.label)&&(l.label=a),u.empty(l.icon)&&(l.icon=e)}const o=R(l.element);return l.toggle?(o.appendChild(E.createIcon.call(this,l.iconPressed,{class:"icon--pressed"})),o.appendChild(E.createIcon.call(this,l.icon,{class:"icon--not-pressed"})),o.appendChild(E.createLabel.call(this,l.labelPressed,{class:"label--pressed"})),o.appendChild(E.createLabel.call(this,l.label,{class:"label--not-pressed"}))):(o.appendChild(E.createIcon.call(this,l.icon)),o.appendChild(E.createLabel.call(this,l.label))),le(t,Ee(this.config.selectors.buttons[a],t)),fi(o,t),a==="play"?(u.array(this.elements.buttons[a])||(this.elements.buttons[a]=[]),this.elements.buttons[a].push(o)):this.elements.buttons[a]=o,o},createRange(e,r){const t=R("input",le(Ee(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":pe.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},r));return this.elements.inputs[e]=t,E.updateRangeFill.call(this,t),Cc.setup(t),t},createProgress(e,r){const t=R("progress",le(Ee(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},r));if(e!=="volume"){t.appendChild(R("span",null,"0"));const a={played:"played",buffer:"buffered"}[e],l=a?pe.get(a,this.config):"";t.innerText=`% ${l.toLowerCase()}`}return this.elements.display[e]=t,t},createTime(e,r){const t=Ee(this.config.selectors.display[e],r),a=R("div",le(t,{class:`${t.class?t.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":pe.get(e,this.config),role:"timer"}),"00:00");return this.elements.display[e]=a,a},bindMenuItemShortcuts(e,r){X.call(this,e,"keydown keyup",t=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(t.key)||(t.preventDefault(),t.stopPropagation(),t.type==="keydown"))return;const a=Ve(e,'[role="menuitemradio"]');if(!a&&[" ","ArrowRight"].includes(t.key))E.showMenuPanel.call(this,r,!0);else{let l;t.key!==" "&&(t.key==="ArrowDown"||a&&t.key==="ArrowRight"?(l=e.nextElementSibling,u.element(l)||(l=e.parentNode.firstElementChild)):(l=e.previousElementSibling,u.element(l)||(l=e.parentNode.lastElementChild)),ui.call(this,l,!0))}},!1),X.call(this,e,"keyup",t=>{t.key==="Return"&&E.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:e,list:r,type:t,title:a,badge:l=null,checked:o=!1}){const h=Ee(this.config.selectors.inputs[t]),f=R("button",le(h,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${h.class?h.class:""}`.trim(),"aria-checked":o,value:e})),w=R("span");w.innerHTML=a,u.element(l)&&w.appendChild(l),f.appendChild(w),Object.defineProperty(f,"checked",{enumerable:!0,get:()=>f.getAttribute("aria-checked")==="true",set(k){k&&Array.from(f.parentNode.children).filter(S=>Ve(S,'[role="menuitemradio"]')).forEach(S=>S.setAttribute("aria-checked","false")),f.setAttribute("aria-checked",k?"true":"false")}}),this.listeners.bind(f,"click keyup",k=>{if(!u.keyboardEvent(k)||k.key===" "){switch(k.preventDefault(),k.stopPropagation(),f.checked=!0,t){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}E.showMenuPanel.call(this,"home",u.keyboardEvent(k))}},t,!1),E.bindMenuItemShortcuts.call(this,f,t),r.appendChild(f)},formatTime(e=0,r=!1){return u.number(e)?Lt(e,Nn(this.duration)>0,r):e},updateTimeDisplay(e=null,r=0,t=!1){u.element(e)&&u.number(r)&&(e.innerText=E.formatTime(r,t))},updateVolume(){this.supported.ui&&(u.element(this.elements.inputs.volume)&&E.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),u.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(e,r=0){u.element(e)&&(e.value=r,E.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!u.event(e))return;let r=0;const t=(a,l)=>{const o=u.number(l)?l:0,h=u.element(a)?a:this.elements.display.buffer;if(u.element(h)){h.value=o;const f=h.getElementsByTagName("span")[0];u.element(f)&&(f.childNodes[0].nodeValue=o)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":r=Kc(this.currentTime,this.duration),e.type==="timeupdate"&&E.setRange.call(this,this.elements.inputs.seek,r);break;case"playing":case"progress":t(this.elements.display.buffer,100*this.buffered)}},updateRangeFill(e){const r=u.event(e)?e.target:e;if(u.element(r)&&r.getAttribute("type")==="range"){if(Ve(r,this.config.selectors.inputs.seek)){r.setAttribute("aria-valuenow",this.currentTime);const t=E.formatTime(this.currentTime),a=E.formatTime(this.duration),l=pe.get("seekLabel",this.config);r.setAttribute("aria-valuetext",l.replace("{currentTime}",t).replace("{duration}",a))}else if(Ve(r,this.config.selectors.inputs.volume)){const t=100*r.value;r.setAttribute("aria-valuenow",t),r.setAttribute("aria-valuetext",`${t.toFixed(1)}%`)}else r.setAttribute("aria-valuenow",r.value);(me.isWebKit||me.isIPadOS)&&r.style.setProperty("--value",r.value/r.max*100+"%")}},updateSeekTooltip(e){var r,t;if(!this.config.tooltips.seek||!u.element(this.elements.inputs.seek)||!u.element(this.elements.display.seekTooltip)||this.duration===0)return;const a=this.elements.display.seekTooltip,l=`${this.config.classNames.tooltip}--visible`,o=S=>te(a,l,S);if(this.touch)return void o(!1);let h=0;const f=this.elements.progress.getBoundingClientRect();if(u.event(e))h=100/f.width*(e.pageX-f.left);else{if(!Mt(a,l))return;h=parseFloat(a.style.left,10)}h<0?h=0:h>100&&(h=100);const w=this.duration/100*h;a.innerText=E.formatTime(w);const k=(r=this.config.markers)===null||r===void 0||(t=r.points)===null||t===void 0?void 0:t.find(({time:S})=>S===Math.round(w));k&&a.insertAdjacentHTML("afterbegin",`${k.label}
`),a.style.left=`${h}%`,u.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&o(e.type==="mouseenter")},timeUpdate(e){const r=!u.element(this.elements.display.duration)&&this.config.invertTime;E.updateTimeDisplay.call(this,this.elements.display.currentTime,r?this.duration-this.currentTime:this.currentTime,r),e&&e.type==="timeupdate"&&this.media.seeking||E.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return He(this.elements.display.currentTime,!0),void He(this.elements.progress,!0);u.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=u.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&E.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&E.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&E.setMarkers.call(this),E.updateSeekTooltip.call(this)},toggleMenuButton(e,r){He(this.elements.settings.buttons[e],!r)},updateSetting(e,r,t){const a=this.elements.settings.panels[e];let l=null,o=r;if(e==="captions")l=this.currentTrack;else{if(l=u.empty(t)?this[e]:t,u.empty(l)&&(l=this.config[e].default),!u.empty(this.options[e])&&!this.options[e].includes(l))return void this.debug.warn(`Unsupported value of '${l}' for ${e}`);if(!this.config[e].options.includes(l))return void this.debug.warn(`Disabled value of '${l}' for ${e}`)}if(u.element(o)||(o=a&&a.querySelector('[role="menu"]')),!u.element(o))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=E.getLabel.call(this,e,l);const h=o&&o.querySelector(`[value="${l}"]`);u.element(h)&&(h.checked=!0)},getLabel(e,r){switch(e){case"speed":return r===1?pe.get("normal",this.config):`${r}×`;case"quality":if(u.number(r)){const t=pe.get(`qualityLabel.${r}`,this.config);return t.length?t:`${r}p`}return Mn(r);case"captions":return Q.getLabel.call(this);default:return null}},setQualityMenu(e){if(!u.element(this.elements.settings.panels.quality))return;const r="quality",t=this.elements.settings.panels.quality.querySelector('[role="menu"]');u.array(e)&&(this.options.quality=gi(e).filter(o=>this.config.quality.options.includes(o)));const a=!u.empty(this.options.quality)&&this.options.quality.length>1;if(E.toggleMenuButton.call(this,r,a),At(t),E.checkMenu.call(this),!a)return;const l=o=>{const h=pe.get(`qualityBadge.${o}`,this.config);return h.length?E.createBadge.call(this,h):null};this.options.quality.sort((o,h)=>{const f=this.config.quality.options;return f.indexOf(o)>f.indexOf(h)?1:-1}).forEach(o=>{E.createMenuItem.call(this,{value:o,list:t,type:r,title:E.getLabel.call(this,"quality",o),badge:l(o)})}),E.updateSetting.call(this,r,t)},setCaptionsMenu(){if(!u.element(this.elements.settings.panels.captions))return;const e="captions",r=this.elements.settings.panels.captions.querySelector('[role="menu"]'),t=Q.getTracks.call(this),a=!!t.length;if(E.toggleMenuButton.call(this,e,a),At(r),E.checkMenu.call(this),!a)return;const l=t.map((o,h)=>({value:h,checked:this.captions.toggled&&this.currentTrack===h,title:Q.getLabel.call(this,o),badge:o.language&&E.createBadge.call(this,o.language.toUpperCase()),list:r,type:"language"}));l.unshift({value:-1,checked:!this.captions.toggled,title:pe.get("disabled",this.config),list:r,type:"language"}),l.forEach(E.createMenuItem.bind(this)),E.updateSetting.call(this,e,r)},setSpeedMenu(){if(!u.element(this.elements.settings.panels.speed))return;const e="speed",r=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(a=>a>=this.minimumSpeed&&a<=this.maximumSpeed);const t=!u.empty(this.options.speed)&&this.options.speed.length>1;E.toggleMenuButton.call(this,e,t),At(r),E.checkMenu.call(this),t&&(this.options.speed.forEach(a=>{E.createMenuItem.call(this,{value:a,list:r,type:e,title:E.getLabel.call(this,"speed",a)})}),E.updateSetting.call(this,e,r))},checkMenu(){const{buttons:e}=this.elements.settings,r=!u.empty(e)&&Object.values(e).some(t=>!t.hidden);He(this.elements.settings.menu,!r)},focusFirstMenuItem(e,r=!1){if(this.elements.settings.popup.hidden)return;let t=e;u.element(t)||(t=Object.values(this.elements.settings.panels).find(l=>!l.hidden));const a=t.querySelector('[role^="menuitem"]');ui.call(this,a,r)},toggleMenu(e){const{popup:r}=this.elements.settings,t=this.elements.buttons.settings;if(!u.element(r)||!u.element(t))return;const{hidden:a}=r;let l=a;if(u.boolean(e))l=e;else if(u.keyboardEvent(e)&&e.key==="Escape")l=!1;else if(u.event(e)){const o=u.function(e.composedPath)?e.composedPath()[0]:e.target,h=r.contains(o);if(h||!h&&e.target!==t&&l)return}t.setAttribute("aria-expanded",l),He(r,!l),te(this.elements.container,this.config.classNames.menu.open,l),l&&u.keyboardEvent(e)?E.focusFirstMenuItem.call(this,null,!0):l||a||ui.call(this,t,u.keyboardEvent(e))},getMenuSize(e){const r=e.cloneNode(!0);r.style.position="absolute",r.style.opacity=0,r.removeAttribute("hidden"),e.parentNode.appendChild(r);const t=r.scrollWidth,a=r.scrollHeight;return Se(r),{width:t,height:a}},showMenuPanel(e="",r=!1){const t=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!u.element(t))return;const a=t.parentNode,l=Array.from(a.children).find(o=>!o.hidden);if(oe.transitions&&!oe.reducedMotion){a.style.width=`${l.scrollWidth}px`,a.style.height=`${l.scrollHeight}px`;const o=E.getMenuSize.call(this,t),h=f=>{f.target===a&&["width","height"].includes(f.propertyName)&&(a.style.width="",a.style.height="",xt.call(this,a,mi,h))};X.call(this,a,mi,h),a.style.width=`${o.width}px`,a.style.height=`${o.height}px`}He(l,!0),He(t,!1),E.focusFirstMenuItem.call(this,t,r)},setDownloadUrl(){const e=this.elements.buttons.download;u.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:r,createButton:t,createProgress:a,createRange:l,createTime:o,setQualityMenu:h,setSpeedMenu:f,showMenuPanel:w}=E;this.elements.controls=null,u.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(t.call(this,"play-large"));const k=R("div",Ee(this.config.selectors.controls.wrapper));this.elements.controls=k;const S={class:"plyr__controls__item"};return gi(u.array(this.config.controls)?this.config.controls:[]).forEach(L=>{if(L==="restart"&&k.appendChild(t.call(this,"restart",S)),L==="rewind"&&k.appendChild(t.call(this,"rewind",S)),L==="play"&&k.appendChild(t.call(this,"play",S)),L==="fast-forward"&&k.appendChild(t.call(this,"fast-forward",S)),L==="progress"){const A=R("div",{class:`${S.class} plyr__progress__container`}),D=R("div",Ee(this.config.selectors.progress));if(D.appendChild(l.call(this,"seek",{id:`plyr-seek-${e.id}`})),D.appendChild(a.call(this,"buffer")),this.config.tooltips.seek){const H=R("span",{class:this.config.classNames.tooltip},"00:00");D.appendChild(H),this.elements.display.seekTooltip=H}this.elements.progress=D,A.appendChild(this.elements.progress),k.appendChild(A)}if(L==="current-time"&&k.appendChild(o.call(this,"currentTime",S)),L==="duration"&&k.appendChild(o.call(this,"duration",S)),L==="mute"||L==="volume"){let{volume:A}=this.elements;if(u.element(A)&&k.contains(A)||(A=R("div",le({},S,{class:`${S.class} plyr__volume`.trim()})),this.elements.volume=A,k.appendChild(A)),L==="mute"&&A.appendChild(t.call(this,"mute")),L==="volume"&&!me.isIos&&!me.isIPadOS){const D={max:1,step:.05,value:this.config.volume};A.appendChild(l.call(this,"volume",le(D,{id:`plyr-volume-${e.id}`})))}}if(L==="captions"&&k.appendChild(t.call(this,"captions",S)),L==="settings"&&!u.empty(this.config.settings)){const A=R("div",le({},S,{class:`${S.class} plyr__menu`.trim(),hidden:""}));A.appendChild(t.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const D=R("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),H=R("div"),y=R("div",{id:`plyr-settings-${e.id}-home`}),q=R("div",{role:"menu"});y.appendChild(q),H.appendChild(y),this.elements.settings.panels.home=y,this.config.settings.forEach(j=>{const M=R("button",le(Ee(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));r.call(this,M,j),X.call(this,M,"click",()=>{w.call(this,j,!1)});const W=R("span",null,pe.get(j,this.config)),re=R("span",{class:this.config.classNames.menu.value});re.innerHTML=e[j],W.appendChild(re),M.appendChild(W),q.appendChild(M);const fe=R("div",{id:`plyr-settings-${e.id}-${j}`,hidden:""}),I=R("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});I.appendChild(R("span",{"aria-hidden":!0},pe.get(j,this.config))),I.appendChild(R("span",{class:this.config.classNames.hidden},pe.get("menuBack",this.config))),X.call(this,fe,"keydown",ye=>{ye.key==="ArrowLeft"&&(ye.preventDefault(),ye.stopPropagation(),w.call(this,"home",!0))},!1),X.call(this,I,"click",()=>{w.call(this,"home",!1)}),fe.appendChild(I),fe.appendChild(R("div",{role:"menu"})),H.appendChild(fe),this.elements.settings.buttons[j]=M,this.elements.settings.panels[j]=fe}),D.appendChild(H),A.appendChild(D),k.appendChild(A),this.elements.settings.popup=D,this.elements.settings.menu=A}if(L==="pip"&&oe.pip&&k.appendChild(t.call(this,"pip",S)),L==="airplay"&&oe.airplay&&k.appendChild(t.call(this,"airplay",S)),L==="download"){const A=le({},S,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(A.download="");const{download:D}=this.config.urls;!u.url(D)&&this.isEmbed&&le(A,{icon:`logo-${this.provider}`,label:this.provider}),k.appendChild(t.call(this,"download",A))}L==="fullscreen"&&k.appendChild(t.call(this,"fullscreen",S))}),this.isHTML5&&h.call(this,Fe.getQualityOptions.call(this)),f.call(this),k},inject(){if(this.config.loadSprite){const l=E.getIconUrl.call(this);l.cors&&Sn(l.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const r={id:this.id,seektime:this.config.seekTime,title:this.config.title};let t=!0;u.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,r)),this.config.controls||(this.config.controls=[]),u.element(this.config.controls)||u.string(this.config.controls)?e=this.config.controls:(e=E.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:Q.getLabel.call(this)}),t=!1);let a;if(t&&u.string(this.config.controls)&&(e=(l=>{let o=l;return Object.entries(r).forEach(([h,f])=>{o=lt(o,`{${h}}`,f)}),o})(e)),u.string(this.config.selectors.controls.container)&&(a=document.querySelector(this.config.selectors.controls.container)),u.element(a)||(a=this.elements.container),a[u.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),u.element(this.elements.controls)||E.findElements.call(this),!u.empty(this.elements.buttons)){const l=o=>{const h=this.config.classNames.controlPressed;o.setAttribute("aria-pressed","false"),Object.defineProperty(o,"pressed",{configurable:!0,enumerable:!0,get:()=>Mt(o,h),set(f=!1){te(o,h,f),o.setAttribute("aria-pressed",f?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach(o=>{u.array(o)||u.nodeList(o)?Array.from(o).filter(Boolean).forEach(l):l(o)})}if(me.isEdge&&Tn(a),this.config.tooltips.controls){const{classNames:l,selectors:o}=this.config,h=`${o.controls.wrapper} ${o.labels} .${l.hidden}`,f=ot.call(this,h);Array.from(f).forEach(w=>{te(w,this.config.classNames.hidden,!1),te(w,this.config.classNames.tooltip,!0)})}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch{}},setMarkers(){var e,r;if(!this.duration||this.elements.markers)return;const t=(e=this.config.markers)===null||e===void 0||(r=e.points)===null||r===void 0?void 0:r.filter(({time:w})=>w>0&&wte(o,h,w);t.forEach(w=>{const k=R("span",{class:this.config.classNames.marker},""),S=w.time/this.duration*100+"%";o&&(k.addEventListener("mouseenter",()=>{w.label||(o.style.left=S,o.innerHTML=w.label,f(!0))}),k.addEventListener("mouseleave",()=>{f(!1)})),k.addEventListener("click",()=>{this.currentTime=w.time}),k.style.left=S,l.appendChild(k)}),a.appendChild(l),this.config.tooltips.seek||(o=R("span",{class:this.config.classNames.tooltip},""),a.appendChild(o)),this.elements.markers={points:l,tip:o},this.elements.progress.appendChild(a)}};function xn(e,r=!0){let t=e;if(r){const a=document.createElement("a");a.href=t,t=a.href}try{return new URL(t)}catch{return null}}function Ln(e){const r=new URLSearchParams;return u.object(e)&&Object.entries(e).forEach(([t,a])=>{r.set(t,a)}),r}const Q={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!oe.textTracks)return void(u.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&E.setCaptionsMenu.call(this));if(u.element(this.elements.captions)||(this.elements.captions=R("div",Ee(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),Vc(this.elements.captions,this.elements.wrapper)),me.isIE&&window.URL){const a=this.media.querySelectorAll("track");Array.from(a).forEach(l=>{const o=l.getAttribute("src"),h=xn(o);h!==null&&h.hostname!==window.location.href.hostname&&["http:","https:"].includes(h.protocol)&&mt(o,"blob").then(f=>{l.setAttribute("src",window.URL.createObjectURL(f))}).catch(()=>{Se(l)})})}const e=gi((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(a=>a.split("-")[0]));let r=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();r==="auto"&&([r]=e);let t=this.storage.get("captions");if(u.boolean(t)||({active:t}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:t,language:r,languages:e}),this.isHTML5){const a=this.config.captions.update?"addtrack removetrack":"removetrack";X.call(this,this.media.textTracks,a,Q.update.bind(this))}setTimeout(Q.update.bind(this),0)},update(){const e=Q.getTracks.call(this,!0),{active:r,language:t,meta:a,currentTrackNode:l}=this.captions,o=!!e.find(h=>h.language===t);this.isHTML5&&this.isVideo&&e.filter(h=>!a.get(h)).forEach(h=>{this.debug.log("Track added",h),a.set(h,{default:h.mode==="showing"}),h.mode==="showing"&&(h.mode="hidden"),X.call(this,h,"cuechange",()=>Q.updateCues.call(this))}),(o&&this.language!==t||!e.includes(l))&&(Q.setLanguage.call(this,t),Q.toggle.call(this,r&&o)),this.elements&&te(this.elements.container,this.config.classNames.captions.enabled,!u.empty(e)),u.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&E.setCaptionsMenu.call(this)},toggle(e,r=!0){if(!this.supported.ui)return;const{toggled:t}=this.captions,a=this.config.classNames.captions.active,l=u.nullOrUndefined(e)?!t:e;if(l!==t){if(r||(this.captions.active=l,this.storage.set({captions:l})),!this.language&&l&&!r){const o=Q.getTracks.call(this),h=Q.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=h.language,void Q.set.call(this,o.indexOf(h))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=l),te(this.elements.container,a,l),this.captions.toggled=l,E.updateSetting.call(this,"captions"),F.call(this,this.media,l?"captionsenabled":"captionsdisabled")}setTimeout(()=>{l&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(e,r=!0){const t=Q.getTracks.call(this);if(e!==-1)if(u.number(e))if(e in t){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const a=t[e],{language:l}=a||{};this.captions.currentTrackNode=a,E.updateSetting.call(this,"captions"),r||(this.captions.language=l,this.storage.set({language:l})),this.isVimeo&&this.embed.enableTextTrack(l),F.call(this,this.media,"languagechange")}Q.toggle.call(this,!0,r),this.isHTML5&&this.isVideo&&Q.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else Q.toggle.call(this,!1,r)},setLanguage(e,r=!0){if(!u.string(e))return void this.debug.warn("Invalid language argument",e);const t=e.toLowerCase();this.captions.language=t;const a=Q.getTracks.call(this),l=Q.findTrack.call(this,[t]);Q.set.call(this,a.indexOf(l),r)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter(r=>!this.isHTML5||e||this.captions.meta.has(r)).filter(r=>["captions","subtitles"].includes(r.kind))},findTrack(e,r=!1){const t=Q.getTracks.call(this),a=h=>Number((this.captions.meta.get(h)||{}).default),l=Array.from(t).sort((h,f)=>a(f)-a(h));let o;return e.every(h=>(o=l.find(f=>f.language===h),!o)),o||(r?l[0]:void 0)},getCurrentTrack(){return Q.getTracks.call(this)[this.currentTrack]},getLabel(e){let r=e;return!u.track(r)&&oe.textTracks&&this.captions.toggled&&(r=Q.getCurrentTrack.call(this)),u.track(r)?u.empty(r.label)?u.empty(r.language)?pe.get("enabled",this.config):e.language.toUpperCase():r.label:pe.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!u.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!u.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let r=e;if(!r){const a=Q.getCurrentTrack.call(this);r=Array.from((a||{}).activeCues||[]).map(l=>l.getCueAsHTML()).map(Zc)}const t=r.map(a=>a.trim()).join(` +`);if(t!==this.elements.captions.innerHTML){At(this.elements.captions);const a=R("span",Ee(this.config.selectors.caption));a.innerHTML=t,this.elements.captions.appendChild(a),F.call(this,this.media,"cuechange")}}},In={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.7.8/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},hi={active:"picture-in-picture",inactive:"inline"},Re={html5:"html5",youtube:"youtube",vimeo:"vimeo"},di={audio:"audio",video:"video"};function iu(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?Re.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?Re.vimeo:null}const pi=()=>{};class ru{constructor(r=!1){this.enabled=window.console&&r,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):pi}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):pi}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):pi}}class Ae{constructor(r){_(this,"onChange",()=>{if(!this.supported)return;const t=this.player.elements.buttons.fullscreen;u.element(t)&&(t.pressed=this.active);const a=this.target===this.player.media?this.target:this.player.elements.container;F.call(this.player,a,this.active?"enterfullscreen":"exitfullscreen",!0)}),_(this,"toggleFallback",(t=!1)=>{if(t?this.scrollPosition={x:window.scrollX??0,y:window.scrollY??0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=t?"hidden":"",te(this.target,this.player.config.classNames.fullscreen.fallback,t),me.isIos){let a=document.head.querySelector('meta[name="viewport"]');const l="viewport-fit=cover";a||(a=document.createElement("meta"),a.setAttribute("name","viewport"));const o=u.string(a.content)&&a.content.includes(l);t?(this.cleanupViewport=!o,o||(a.content+=`,${l}`)):this.cleanupViewport&&(a.content=a.content.split(",").filter(h=>h.trim()!==l).join(","))}this.onChange()}),_(this,"trapFocus",t=>{if(me.isIos||me.isIPadOS||!this.active||t.key!=="Tab")return;const a=document.activeElement,l=ot.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[o]=l,h=l[l.length-1];a!==h||t.shiftKey?a===o&&t.shiftKey&&(h.focus(),t.preventDefault()):(o.focus(),t.preventDefault())}),_(this,"update",()=>{if(this.supported){let t;t=this.forceFallback?"Fallback (forced)":Ae.nativeSupported?"Native":"Fallback",this.player.debug.log(`${t} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");te(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)}),_(this,"enter",()=>{this.supported&&(me.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!Ae.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?u.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),_(this,"exit",()=>{if(this.supported)if(me.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),_e(this.player.play());else if(!Ae.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!u.empty(this.prefix)){const t=this.prefix==="moz"?"Cancel":"Exit";document[`${this.prefix}${t}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}),_(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=r,this.prefix=Ae.prefix,this.property=Ae.property,this.scrollPosition={x:0,y:0},this.forceFallback=r.config.fullscreen.fallback==="force",this.player.elements.fullscreen=r.config.fullscreen.container&&Bc(this.player.elements.container,r.config.fullscreen.container),X.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),X.call(this.player,this.player.elements.container,"dblclick",t=>{u.element(this.player.elements.controls)&&this.player.elements.controls.contains(t.target)||this.player.listeners.proxy(t,this.toggle,"fullscreen")}),X.call(this,this.player.elements.container,"keydown",t=>this.trapFocus(t)),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return Ae.nativeSupported&&!this.forceFallback}static get prefix(){if(u.function(document.exitFullscreen))return"";let r="";return["webkit","moz","ms"].some(t=>!(!u.function(document[`${t}ExitFullscreen`])&&!u.function(document[`${t}CancelFullScreen`]))&&(r=t,!0)),r}static get property(){return this.prefix==="moz"?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,Ae.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||Ae.nativeSupported||!me.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!Ae.nativeSupported||this.forceFallback)return Mt(this.target,this.player.config.classNames.fullscreen.fallback);const r=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return r&&r.shadowRoot?r===this.target.getRootNode().host:r===this.target}get target(){return me.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen??this.player.elements.container}}function Et(e,r=1){return new Promise((t,a)=>{const l=new Image,o=()=>{delete l.onload,delete l.onerror,(l.naturalWidth>=r?t:a)(l)};Object.assign(l,{onload:o,onerror:o,src:e})})}const ne={addStyleHook(){te(this.elements.container,this.config.selectors.container.replace(".",""),!0),te(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void ne.toggleNativeControls.call(this,!0);u.element(this.elements.controls)||(E.inject.call(this),this.listeners.controls()),ne.toggleNativeControls.call(this),this.isHTML5&&Q.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,E.updateVolume.call(this),E.timeUpdate.call(this),E.durationUpdate.call(this),ne.checkPlaying.call(this),te(this.elements.container,this.config.classNames.pip.supported,oe.pip&&this.isHTML5&&this.isVideo),te(this.elements.container,this.config.classNames.airplay.supported,oe.airplay&&this.isHTML5),te(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{F.call(this,this.media,"ready")},0),ne.setTitle.call(this),this.poster&&ne.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&E.durationUpdate.call(this),this.config.mediaMetadata&&E.setMediaMetadata.call(this)},setTitle(){let e=pe.get("play",this.config);if(u.string(this.config.title)&&!u.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(r=>{r.setAttribute("aria-label",e)}),this.isEmbed){const r=ue.call(this,"iframe");if(!u.element(r))return;const t=u.empty(this.config.title)?"video":this.config.title,a=pe.get("frameTitle",this.config);r.setAttribute("title",a.replace("{title}",t))}},togglePoster(e){te(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,r=!0){return r&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),Wc.call(this).then(()=>Et(e)).catch(t=>{throw e===this.poster&&ne.togglePoster.call(this,!1),t}).then(()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),ne.togglePoster.call(this,!0),e)))},checkPlaying(e){te(this.elements.container,this.config.classNames.playing,this.playing),te(this.elements.container,this.config.classNames.paused,this.paused),te(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(r=>{Object.assign(r,{pressed:this.playing}),r.setAttribute("aria-label",pe.get(this.playing?"pause":"play",this.config))}),u.event(e)&&e.type==="timeupdate"||ne.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{te(this.elements.container,this.config.classNames.loading,this.loading),ne.toggleControls.call(this)},this.loading?250:0)},toggleControls(e){const{controls:r}=this.elements;if(r&&this.config.hideControls){const t=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(!!(e||this.loading||this.paused||r.pressed||r.hover||t))}},migrateStyles(){Object.values({...this.media.style}).filter(e=>!u.empty(e)&&u.string(e)&&e.startsWith("--plyr")).forEach(e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)}),u.empty(this.media.style)&&this.media.removeAttribute("style")}};class nu{constructor(r){_(this,"firstTouch",()=>{const{player:t}=this,{elements:a}=t;t.touch=!0,te(a.container,t.config.classNames.isTouch,!0)}),_(this,"global",(t=!0)=>{const{player:a}=this;a.config.keyboard.global&&ct.call(a,window,"keydown keyup",this.handleKey,t,!1),ct.call(a,document.body,"click",this.toggleMenu,t),Ci.call(a,document.body,"touchstart",this.firstTouch)}),_(this,"container",()=>{const{player:t}=this,{config:a,elements:l,timers:o}=t;!a.keyboard.global&&a.keyboard.focused&&X.call(t,l.container,"keydown keyup",this.handleKey,!1),X.call(t,l.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",w=>{const{controls:k}=l;k&&w.type==="enterfullscreen"&&(k.pressed=!1,k.hover=!1);let S=0;["touchstart","touchmove","mousemove"].includes(w.type)&&(ne.toggleControls.call(t,!0),S=t.touch?3e3:2e3),clearTimeout(o.controls),o.controls=setTimeout(()=>ne.toggleControls.call(t,!1),S)});const h=()=>{if(!t.isVimeo||t.config.vimeo.premium)return;const w=l.wrapper,{active:k}=t.fullscreen,[S,L]=$i.call(t),A=En(`aspect-ratio: ${S} / ${L}`);if(!k)return void(A?(w.style.width=null,w.style.height=null):(w.style.maxWidth=null,w.style.margin=null));const[D,H]=Gc(),y=D/H>S/L;A?(w.style.width=y?"auto":"100%",w.style.height=y?"100%":"auto"):(w.style.maxWidth=y?H/L*S+"px":null,w.style.margin=y?"0 auto":null)},f=()=>{clearTimeout(o.resized),o.resized=setTimeout(h,50)};X.call(t,l.container,"enterfullscreen exitfullscreen",w=>{const{target:k}=t.fullscreen;k===l.container&&(!t.isEmbed&&u.empty(t.config.ratio)||(h(),(w.type==="enterfullscreen"?X:xt).call(t,window,"resize",f)))})}),_(this,"media",()=>{const{player:t}=this,{elements:a}=t;if(X.call(t,t.media,"timeupdate seeking seeked",o=>E.timeUpdate.call(t,o)),X.call(t,t.media,"durationchange loadeddata loadedmetadata",o=>E.durationUpdate.call(t,o)),X.call(t,t.media,"ended",()=>{t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())}),X.call(t,t.media,"progress playing seeking seeked",o=>E.updateProgress.call(t,o)),X.call(t,t.media,"volumechange",o=>E.updateVolume.call(t,o)),X.call(t,t.media,"playing play pause ended emptied timeupdate",o=>ne.checkPlaying.call(t,o)),X.call(t,t.media,"waiting canplay seeked playing",o=>ne.checkLoading.call(t,o)),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){const o=ue.call(t,`.${t.config.classNames.video}`);if(!u.element(o))return;X.call(t,a.container,"click",h=>{([a.container,o].includes(h.target)||o.contains(h.target))&&(t.touch&&t.config.hideControls||(t.ended?(this.proxy(h,t.restart,"restart"),this.proxy(h,()=>{_e(t.play())},"play")):this.proxy(h,()=>{_e(t.togglePlay())},"play")))})}t.supported.ui&&t.config.disableContextMenu&&X.call(t,a.wrapper,"contextmenu",o=>{o.preventDefault()},!1),X.call(t,t.media,"volumechange",()=>{t.storage.set({volume:t.volume,muted:t.muted})}),X.call(t,t.media,"ratechange",()=>{E.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})}),X.call(t,t.media,"qualitychange",o=>{E.updateSetting.call(t,"quality",null,o.detail.quality)}),X.call(t,t.media,"ready qualitychange",()=>{E.setDownloadUrl.call(t)});const l=t.config.events.concat(["keyup","keydown"]).join(" ");X.call(t,t.media,l,o=>{let{detail:h={}}=o;o.type==="error"&&(h=t.media.error),F.call(t,a.container,o.type,!0,h)})}),_(this,"proxy",(t,a,l)=>{const{player:o}=this,h=o.config.listeners[l];let f=!0;u.function(h)&&(f=h.call(o,t)),f!==!1&&u.function(a)&&a.call(o,t)}),_(this,"bind",(t,a,l,o,h=!0)=>{const{player:f}=this,w=f.config.listeners[o],k=u.function(w);X.call(f,t,a,S=>this.proxy(S,l,o),h&&!k)}),_(this,"controls",()=>{const{player:t}=this,{elements:a}=t,l=me.isIE?"change":"input";if(a.buttons.play&&Array.from(a.buttons.play).forEach(o=>{this.bind(o,"click",()=>{_e(t.togglePlay())},"play")}),this.bind(a.buttons.restart,"click",t.restart,"restart"),this.bind(a.buttons.rewind,"click",()=>{t.lastSeekTime=Date.now(),t.rewind()},"rewind"),this.bind(a.buttons.fastForward,"click",()=>{t.lastSeekTime=Date.now(),t.forward()},"fastForward"),this.bind(a.buttons.mute,"click",()=>{t.muted=!t.muted},"mute"),this.bind(a.buttons.captions,"click",()=>t.toggleCaptions()),this.bind(a.buttons.download,"click",()=>{F.call(t,t.media,"download")},"download"),this.bind(a.buttons.fullscreen,"click",()=>{t.fullscreen.toggle()},"fullscreen"),this.bind(a.buttons.pip,"click",()=>{t.pip="toggle"},"pip"),this.bind(a.buttons.airplay,"click",t.airplay,"airplay"),this.bind(a.buttons.settings,"click",o=>{o.stopPropagation(),o.preventDefault(),E.toggleMenu.call(t,o)},null,!1),this.bind(a.buttons.settings,"keyup",o=>{[" ","Enter"].includes(o.key)&&(o.key!=="Enter"?(o.preventDefault(),o.stopPropagation(),E.toggleMenu.call(t,o)):E.focusFirstMenuItem.call(t,null,!0))},null,!1),this.bind(a.settings.menu,"keydown",o=>{o.key==="Escape"&&E.toggleMenu.call(t,o)}),this.bind(a.inputs.seek,"mousedown mousemove",o=>{const h=a.progress.getBoundingClientRect(),f=100/h.width*(o.pageX-h.left);o.currentTarget.setAttribute("seek-value",f)}),this.bind(a.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",o=>{const h=o.currentTarget,f="play-on-seeked";if(u.keyboardEvent(o)&&!["ArrowLeft","ArrowRight"].includes(o.key))return;t.lastSeekTime=Date.now();const w=h.hasAttribute(f),k=["mouseup","touchend","keyup"].includes(o.type);w&&k?(h.removeAttribute(f),_e(t.play())):!k&&t.playing&&(h.setAttribute(f,""),t.pause())}),me.isIos){const o=ot.call(t,'input[type="range"]');Array.from(o).forEach(h=>this.bind(h,l,f=>Tn(f.target)))}this.bind(a.inputs.seek,l,o=>{const h=o.currentTarget;let f=h.getAttribute("seek-value");u.empty(f)&&(f=h.value),h.removeAttribute("seek-value"),t.currentTime=f/h.max*t.duration},"seek"),this.bind(a.progress,"mouseenter mouseleave mousemove",o=>E.updateSeekTooltip.call(t,o)),this.bind(a.progress,"mousemove touchmove",o=>{const{previewThumbnails:h}=t;h&&h.loaded&&h.startMove(o)}),this.bind(a.progress,"mouseleave touchend click",()=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.endMove(!1,!0)}),this.bind(a.progress,"mousedown touchstart",o=>{const{previewThumbnails:h}=t;h&&h.loaded&&h.startScrubbing(o)}),this.bind(a.progress,"mouseup touchend",o=>{const{previewThumbnails:h}=t;h&&h.loaded&&h.endScrubbing(o)}),me.isWebKit&&Array.from(ot.call(t,'input[type="range"]')).forEach(o=>{this.bind(o,"input",h=>E.updateRangeFill.call(t,h.target))}),t.config.toggleInvert&&!u.element(a.display.duration)&&this.bind(a.display.currentTime,"click",()=>{t.currentTime!==0&&(t.config.invertTime=!t.config.invertTime,E.timeUpdate.call(t))}),this.bind(a.inputs.volume,l,o=>{t.volume=o.target.value},"volume"),this.bind(a.controls,"mouseenter mouseleave",o=>{a.controls.hover=!t.touch&&o.type==="mouseenter"}),a.fullscreen&&Array.from(a.fullscreen.children).filter(o=>!o.contains(a.container)).forEach(o=>{this.bind(o,"mouseenter mouseleave",h=>{a.controls&&(a.controls.hover=!t.touch&&h.type==="mouseenter")})}),this.bind(a.controls,"mousedown mouseup touchstart touchend touchcancel",o=>{a.controls.pressed=["mousedown","touchstart"].includes(o.type)}),this.bind(a.controls,"focusin",()=>{const{config:o,timers:h}=t;te(a.controls,o.classNames.noTransition,!0),ne.toggleControls.call(t,!0),setTimeout(()=>{te(a.controls,o.classNames.noTransition,!1)},0);const f=this.touch?3e3:4e3;clearTimeout(h.controls),h.controls=setTimeout(()=>ne.toggleControls.call(t,!1),f)}),this.bind(a.inputs.volume,"wheel",o=>{const h=o.webkitDirectionInvertedFromDevice,[f,w]=[o.deltaX,-o.deltaY].map(L=>h?-L:L),k=Math.sign(Math.abs(f)>Math.abs(w)?f:w);t.increaseVolume(k/50);const{volume:S}=t.media;(k===1&&S<1||k===-1&&S>0)&&o.preventDefault()},"volume",!1)}),this.player=r,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(r){const{player:t}=this,{elements:a}=t,{key:l,type:o,altKey:h,ctrlKey:f,metaKey:w,shiftKey:k}=r,S=o==="keydown",L=S&&l===this.lastKey;if(!(h||f||w||k)&&l){if(S){const D=document.activeElement;if(u.element(D)){const{editable:H}=t.config.selectors,{seek:y}=a.inputs;if(D!==y&&Ve(D,H)||r.key===" "&&Ve(D,'button, [role^="menuitem"]'))return}switch([" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(l)&&(r.preventDefault(),r.stopPropagation()),l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":L||(A=parseInt(l,10),t.currentTime=t.duration/10*A);break;case" ":case"k":L||_e(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":L||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":L||t.toggleCaptions();break;case"l":t.loop=!t.loop}l==="Escape"&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=l}else this.lastKey=null;var A}}toggleMenu(r){E.toggleMenu.call(this.player,r)}}function au(e,r){return e(r={exports:{}},r.exports),r.exports}var su=au(function(e,r){e.exports=function(){var t=function(){},a={},l={},o={};function h(A,D){A=A.push?A:[A];var H,y,q,j=[],M=A.length,W=M;for(H=function(re,fe){fe.length&&j.push(re),--W||D(j)};M--;)y=A[M],(q=l[y])?H(y,q):(o[y]=o[y]||[]).push(H)}function f(A,D){if(A){var H=o[A];if(l[A]=D,H)for(;H.length;)H[0](A,D),H.splice(0,1)}}function w(A,D){A.call&&(A={success:A}),D.length?(A.error||t)(D):(A.success||t)(A)}function k(A,D,H,y){var q,j,M=document,W=H.async,re=(H.numRetries||0)+1,fe=H.before||t,I=A.replace(/[\?|#].*$/,""),ye=A.replace(/^(css|img)!/,"");y=y||0,/(^css!|\.css$)/.test(I)?((j=M.createElement("link")).rel="stylesheet",j.href=ye,(q="hideFocus"in j)&&j.relList&&(q=0,j.rel="preload",j.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(I)?(j=M.createElement("img")).src=ye:((j=M.createElement("script")).src=A,j.async=W===void 0||W),j.onload=j.onerror=j.onbeforeload=function(se){var Be=se.type[0];if(q)try{j.sheet.cssText.length||(Be="e")}catch(ft){ft.code!=18&&(Be="e")}if(Be=="e"){if((y+=1){su(e,{success:r,error:t})})}function lu(e){return u.empty(e)?null:u.number(Number(e))?e:e.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:e}function ou(e){const r=e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return r&&r.length===5?r[4]:null}function at(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,F.call(this,this.media,e?"play":"pause"))}const vi={setup(){const e=this;te(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,tt.call(e),u.object(window.Vimeo)?vi.ready.call(e):Ai(e.config.urls.vimeo.sdk).then(()=>{vi.ready.call(e)}).catch(r=>{e.debug.warn("Vimeo SDK (player.js) failed to load",r)})},ready(){const e=this,r=e.config.vimeo,{premium:t,referrerPolicy:a,...l}=r;let o=e.media.getAttribute("src"),h="";u.empty(o)?(o=e.media.getAttribute(e.config.attributes.embed.id),h=e.media.getAttribute(e.config.attributes.embed.hash)):h=ou(o);const f=h?{h}:{};t&&Object.assign(l,{controls:!1,sidedock:!1});const w=Ln({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:e.config.playsinline,...f,...l}),k=lu(o),S=R("iframe"),L=bi(e.config.urls.vimeo.iframe,k,w);if(S.setAttribute("src",L),S.setAttribute("allowfullscreen",""),S.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),u.empty(a)||S.setAttribute("referrerPolicy",a),t||!r.customControls)S.setAttribute("data-poster",e.poster),e.media=Pt(S,e.media);else{const M=R("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});M.appendChild(S),e.media=Pt(M,e.media)}r.customControls||mt(bi(e.config.urls.vimeo.api,L)).then(M=>{!u.empty(M)&&M.thumbnail_url&&ne.setPoster.call(e,M.thumbnail_url).catch(()=>{})}),e.embed=new window.Vimeo.Player(S,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(at.call(e,!0),e.embed.play()),e.media.pause=()=>(at.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:A}=e.media;Object.defineProperty(e.media,"currentTime",{get:()=>A,set(M){const{embed:W,media:re,paused:fe,volume:I}=e,ye=fe&&!W.hasPlayed;re.seeking=!0,F.call(e,re,"seeking"),Promise.resolve(ye&&W.setVolume(0)).then(()=>W.setCurrentTime(M)).then(()=>ye&&W.pause()).then(()=>ye&&W.setVolume(I)).catch(()=>{})}});let D=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get:()=>D,set(M){e.embed.setPlaybackRate(M).then(()=>{D=M,F.call(e,e.media,"ratechange")}).catch(()=>{e.options.speed=[1]})}});let{volume:H}=e.config;Object.defineProperty(e.media,"volume",{get:()=>H,set(M){e.embed.setVolume(M).then(()=>{H=M,F.call(e,e.media,"volumechange")})}});let{muted:y}=e.config;Object.defineProperty(e.media,"muted",{get:()=>y,set(M){const W=!!u.boolean(M)&&M;e.embed.setMuted(!!W||e.config.muted).then(()=>{y=W,F.call(e,e.media,"volumechange")})}});let q,{loop:j}=e.config;Object.defineProperty(e.media,"loop",{get:()=>j,set(M){const W=u.boolean(M)?M:e.config.loop.active;e.embed.setLoop(W).then(()=>{j=W})}}),e.embed.getVideoUrl().then(M=>{q=M,E.setDownloadUrl.call(e)}).catch(M=>{this.debug.warn(M)}),Object.defineProperty(e.media,"currentSrc",{get:()=>q}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then(M=>{const[W,re]=M;e.embed.ratio=Pn(W,re),tt.call(this)}),e.embed.setAutopause(e.config.autopause).then(M=>{e.config.autopause=M}),e.embed.getVideoTitle().then(M=>{e.config.title=M,ne.setTitle.call(this)}),e.embed.getCurrentTime().then(M=>{A=M,F.call(e,e.media,"timeupdate")}),e.embed.getDuration().then(M=>{e.media.duration=M,F.call(e,e.media,"durationchange")}),e.embed.getTextTracks().then(M=>{e.media.textTracks=M,Q.setup.call(e)}),e.embed.on("cuechange",({cues:M=[]})=>{const W=M.map(re=>Jc(re.text));Q.updateCues.call(e,W)}),e.embed.on("loaded",()=>{e.embed.getPaused().then(M=>{at.call(e,!M),M||F.call(e,e.media,"playing")}),u.element(e.embed.element)&&e.supported.ui&&e.embed.element.setAttribute("tabindex",-1)}),e.embed.on("bufferstart",()=>{F.call(e,e.media,"waiting")}),e.embed.on("bufferend",()=>{F.call(e,e.media,"playing")}),e.embed.on("play",()=>{at.call(e,!0),F.call(e,e.media,"playing")}),e.embed.on("pause",()=>{at.call(e,!1)}),e.embed.on("timeupdate",M=>{e.media.seeking=!1,A=M.seconds,F.call(e,e.media,"timeupdate")}),e.embed.on("progress",M=>{e.media.buffered=M.percent,F.call(e,e.media,"progress"),parseInt(M.percent,10)===1&&F.call(e,e.media,"canplaythrough"),e.embed.getDuration().then(W=>{W!==e.media.duration&&(e.media.duration=W,F.call(e,e.media,"durationchange"))})}),e.embed.on("seeked",()=>{e.media.seeking=!1,F.call(e,e.media,"seeked")}),e.embed.on("ended",()=>{e.media.paused=!0,F.call(e,e.media,"ended")}),e.embed.on("error",M=>{e.media.error=M,F.call(e,e.media,"error")}),r.customControls&&setTimeout(()=>ne.build.call(e),0)}};function cu(e){return u.empty(e)?null:e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:e}function st(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,F.call(this,this.media,e?"play":"pause"))}function uu(e){return e.noCookie?"https://www.youtube-nocookie.com":window.location.protocol==="http:"?"http://www.youtube.com":void 0}const _t={setup(){if(te(this.elements.wrapper,this.config.classNames.embed,!0),u.object(window.YT)&&u.function(window.YT.Player))_t.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{u.function(e)&&e(),_t.ready.call(this)},Ai(this.config.urls.youtube.sdk).catch(r=>{this.debug.warn("YouTube API failed to load",r)})}},getTitle(e){mt(bi(this.config.urls.youtube.api,e)).then(r=>{if(u.object(r)){const{title:t,height:a,width:l}=r;this.config.title=t,ne.setTitle.call(this),this.embed.ratio=Pn(l,a)}tt.call(this)}).catch(()=>{tt.call(this)})},ready(){const e=this,r=e.config.youtube,t=e.media&&e.media.getAttribute("id");if(!u.empty(t)&&t.startsWith("youtube-"))return;let a=e.media.getAttribute("src");u.empty(a)&&(a=e.media.getAttribute(this.config.attributes.embed.id));const l=cu(a),o=R("div",{id:Yc(e.provider),"data-poster":r.customControls?e.poster:void 0});if(e.media=Pt(o,e.media),r.customControls){const h=f=>`https://i.ytimg.com/vi/${l}/${f}default.jpg`;Et(h("maxres"),121).catch(()=>Et(h("sd"),121)).catch(()=>Et(h("hq"))).then(f=>ne.setPoster.call(e,f.src)).then(f=>{f.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}e.embed=new window.YT.Player(e.media,{videoId:l,host:uu(r),playerVars:le({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&r.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},r),events:{onError(h){if(!e.media.error){const f=h.data,w={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[f]||"An unknown error occurred";e.media.error={code:f,message:w},F.call(e,e.media,"error")}},onPlaybackRateChange(h){const f=h.target;e.media.playbackRate=f.getPlaybackRate(),F.call(e,e.media,"ratechange")},onReady(h){if(u.function(e.media.play))return;const f=h.target;_t.getTitle.call(e,l),e.media.play=()=>{st.call(e,!0),f.playVideo()},e.media.pause=()=>{st.call(e,!1),f.pauseVideo()},e.media.stop=()=>{f.stopVideo()},e.media.duration=f.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(f.getCurrentTime()),set(L){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,F.call(e,e.media,"seeking"),f.seekTo(L)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>f.getPlaybackRate(),set(L){f.setPlaybackRate(L)}});let{volume:w}=e.config;Object.defineProperty(e.media,"volume",{get:()=>w,set(L){w=L,f.setVolume(100*w),F.call(e,e.media,"volumechange")}});let{muted:k}=e.config;Object.defineProperty(e.media,"muted",{get:()=>k,set(L){const A=u.boolean(L)?L:k;k=A,f[A?"mute":"unMute"](),f.setVolume(100*w),F.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>f.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const S=f.getAvailablePlaybackRates();e.options.speed=S.filter(L=>e.config.speed.options.includes(L)),e.supported.ui&&r.customControls&&e.media.setAttribute("tabindex",-1),F.call(e,e.media,"timeupdate"),F.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(()=>{e.media.buffered=f.getVideoLoadedFraction(),(e.media.lastBuffered===null||e.media.lastBufferedne.build.call(e),50)},onStateChange(h){const f=h.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(h.data)&&(e.media.seeking=!1,F.call(e,e.media,"seeked")),h.data){case-1:F.call(e,e.media,"timeupdate"),e.media.buffered=f.getVideoLoadedFraction(),F.call(e,e.media,"progress");break;case 0:st.call(e,!1),e.media.loop?(f.stopVideo(),f.playVideo()):F.call(e,e.media,"ended");break;case 1:r.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(st.call(e,!0),F.call(e,e.media,"playing"),e.timers.playing=setInterval(()=>{F.call(e,e.media,"timeupdate")},50),e.media.duration!==f.getDuration()&&(e.media.duration=f.getDuration(),F.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),st.call(e,!1);break;case 3:F.call(e,e.media,"waiting")}F.call(e,e.elements.container,"statechange",!1,{code:h.data})}}})}},On={setup(){this.media?(te(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),te(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&te(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=R("div",{class:this.config.classNames.video}),$n(this.media,this.elements.wrapper),this.elements.poster=R("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?Fe.setup.call(this):this.isYouTube?_t.setup.call(this):this.isVimeo&&vi.setup.call(this)):this.debug.warn("No media element found!")}};class hu{constructor(r){_(this,"load",()=>{this.enabled&&(u.object(window.google)&&u.object(window.google.ima)?this.ready():Ai(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}),_(this,"ready",()=>{var t;this.enabled||((t=this).manager&&t.manager.destroy(),t.elements.displayContainer&&t.elements.displayContainer.destroy(),t.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),_(this,"setupIMA",()=>{this.elements.container=R("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,t=>this.onAdsManagerLoaded(t),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,t=>this.onAdError(t),!1),this.requestAds()}),_(this,"requestAds",()=>{const{container:t}=this.player.elements;try{const a=new google.ima.AdsRequest;a.adTagUrl=this.tagUrl,a.linearAdSlotWidth=t.offsetWidth,a.linearAdSlotHeight=t.offsetHeight,a.nonLinearAdSlotWidth=t.offsetWidth,a.nonLinearAdSlotHeight=t.offsetHeight,a.forceNonLinearFullSlot=!1,a.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(a)}catch(a){this.onAdError(a)}}),_(this,"pollCountdown",(t=!1)=>{if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(()=>{const a=Lt(Math.max(this.manager.getRemainingTime(),0)),l=`${pe.get("advertisement",this.player.config)} - ${a}`;this.elements.container.setAttribute("data-badge-text",l)},100)}),_(this,"onAdsManagerLoaded",t=>{if(!this.enabled)return;const a=new google.ima.AdsRenderingSettings;a.restoreCustomPlaybackStateOnAdBreakComplete=!0,a.enablePreloading=!0,this.manager=t.getAdsManager(this.player,a),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,l=>this.onAdError(l)),Object.keys(google.ima.AdEvent.Type).forEach(l=>{this.manager.addEventListener(google.ima.AdEvent.Type[l],o=>this.onAdEvent(o))}),this.trigger("loaded")}),_(this,"addCuePoints",()=>{u.empty(this.cuePoints)||this.cuePoints.forEach(t=>{if(t!==0&&t!==-1&&t{const{container:a}=this.player.elements,l=t.getAd(),o=t.getAdData();switch((h=>{F.call(this.player,this.player.media,`ads${h.replace(/_/g,"").toLowerCase()}`)})(t.type),t.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),l.isLinear()||(l.width=a.offsetWidth,l.height=a.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:o.adError&&this.player.debug.warn(`Non-fatal ad error: ${o.adError.getMessage()}`)}}),_(this,"onAdError",t=>{this.cancel(),this.player.debug.warn("Ads error",t)}),_(this,"listeners",()=>{const{container:t}=this.player.elements;let a;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{a=this.player.currentTime}),this.player.on("seeked",()=>{const l=this.player.currentTime;u.empty(this.cuePoints)||this.cuePoints.forEach((o,h)=>{a{this.manager&&this.manager.resize(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL)})}),_(this,"play",()=>{const{container:t}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(a){this.onAdError(a)}}).catch(()=>{})}),_(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,_e(this.player.media.play())}),_(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),_(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),_(this,"loadAds",()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(t=>{this.on("loaded",t),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),_(this,"trigger",(t,...a)=>{const l=this.events[t];u.array(l)&&l.forEach(o=>{u.function(o)&&o.apply(this,a)})}),_(this,"on",(t,a)=>(u.array(this.events[t])||(this.events[t]=[]),this.events[t].push(a),this)),_(this,"startSafetyTimer",(t,a)=>{this.player.debug.log(`Safety timer invoked from: ${a}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},t)}),_(this,"clearSafetyTimer",t=>{u.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${t}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=r,this.config=r.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((t,a)=>{this.on("loaded",t),this.on("error",a)}),this.load()}get enabled(){const{config:r}=this;return this.player.isHTML5&&this.player.isVideo&&r.enabled&&(!u.empty(r.publisherId)||u.url(r.tagUrl))}get tagUrl(){const{config:r}=this;return u.url(r.tagUrl)?r.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${Ln({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:r.publisherId})}`}}function Rn(e=0,r=0,t=255){return Math.min(Math.max(e,r),t)}const du=e=>{const r=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach(t=>{const a={};t.split(/\r\n|\n|\r/).forEach(l=>{if(u.number(a.startTime)){if(!u.empty(l.trim())&&u.empty(a.text)){const o=l.trim().split("#xywh=");[a.text]=o,o[1]&&([a.x,a.y,a.w,a.h]=o[1].split(","))}}else{const o=l.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);o&&(a.startTime=60*Number(o[1]||0)*60+60*Number(o[2])+Number(o[3])+ +`0.${o[4]}`,a.endTime=60*Number(o[6]||0)*60+60*Number(o[7])+Number(o[8])+ +`0.${o[9]}`)}}),a.text&&r.push(a)}),r},hn=(e,r)=>{const t={};return e>r.width/r.height?(t.width=r.width,t.height=1/e*r.width):(t.height=r.height,t.width=e*r.height),t};class yi{constructor(r){_(this,"load",()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)})}),_(this,"getThumbnails",()=>new Promise(t=>{const{src:a}=this.player.config.previewThumbnails;if(u.empty(a))throw new Error("Missing previewThumbnails.src config attribute");const l=()=>{this.thumbnails.sort((o,h)=>o.height-h.height),this.player.debug.log("Preview thumbnails",this.thumbnails),t()};if(u.function(a))a(o=>{this.thumbnails=o,l()});else{const o=(u.string(a)?[a]:a).map(h=>this.getThumbnail(h));Promise.all(o).then(l)}})),_(this,"getThumbnail",t=>new Promise(a=>{mt(t).then(l=>{const o={frames:du(l),height:null,urlPrefix:""};o.frames[0].text.startsWith("/")||o.frames[0].text.startsWith("http://")||o.frames[0].text.startsWith("https://")||(o.urlPrefix=t.substring(0,t.lastIndexOf("/")+1));const h=new Image;h.onload=()=>{o.height=h.naturalHeight,o.width=h.naturalWidth,this.thumbnails.push(o),a()},h.src=o.urlPrefix+o.frames[0].text})})),_(this,"startMove",t=>{if(this.loaded&&u.event(t)&&["touchmove","mousemove"].includes(t.type)&&this.player.media.duration){if(t.type==="touchmove")this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var a,l;const o=this.player.elements.progress.getBoundingClientRect(),h=100/o.width*(t.pageX-o.left);this.seekTime=this.player.media.duration*(h/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=t.pageX,this.elements.thumb.time.innerText=Lt(this.seekTime);const f=(a=this.player.config.markers)===null||a===void 0||(l=a.points)===null||l===void 0?void 0:l.find(({time:w})=>w===Math.round(this.seekTime));f&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${f.label}
`)}this.showImageAtCurrentTime()}}),_(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),_(this,"startScrubbing",t=>{(u.nullOrUndefined(t.button)||t.button===!1||t.button===0)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),_(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Ci.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),_(this,"listeners",()=>{this.player.on("play",()=>{this.toggleThumbContainer(!1,!0)}),this.player.on("seeked",()=>{this.toggleThumbContainer(!1)}),this.player.on("timeupdate",()=>{this.lastTime=this.player.media.currentTime})}),_(this,"render",()=>{this.elements.thumb.container=R("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=R("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const t=R("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=R("span",{},"00:00"),t.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(t),u.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=R("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),_(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),_(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const t=this.thumbnails[0].frames.findIndex(o=>this.seekTime>=o.startTime&&this.seekTime<=o.endTime),a=t>=0;let l=0;this.mouseDown||this.toggleThumbContainer(a),a&&(this.thumbnails.forEach((o,h)=>{this.loadedImages.includes(o.frames[t].text)&&(l=h)}),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(l)))}),_(this,"loadImage",(t=0)=>{const a=this.showingThumb,l=this.thumbnails[t],{urlPrefix:o}=l,h=l.frames[a],f=l.frames[a].text,w=o+f;if(this.currentImageElement&&this.currentImageElement.dataset.filename===f)this.showImage(this.currentImageElement,h,t,a,f,!1),this.currentImageElement.dataset.index=a,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const k=new Image;k.src=w,k.dataset.index=a,k.dataset.filename=f,this.showingThumbFilename=f,this.player.debug.log(`Loading image: ${w}`),k.onload=()=>this.showImage(k,h,t,a,f,!0),this.loadingImage=k,this.removeOldImages(k)}}),_(this,"showImage",(t,a,l,o,h,f=!0)=>{this.player.debug.log(`Showing thumb: ${h}. num: ${o}. qual: ${l}. newimg: ${f}`),this.setImageSizeAndOffset(t,a),f&&(this.currentImageContainer.appendChild(t),this.currentImageElement=t,this.loadedImages.includes(h)||this.loadedImages.push(h)),this.preloadNearby(o,!0).then(this.preloadNearby(o,!1)).then(this.getHigherQuality(l,t,a,h))}),_(this,"removeOldImages",t=>{Array.from(this.currentImageContainer.children).forEach(a=>{if(a.tagName.toLowerCase()!=="img")return;const l=this.usingSprites?500:1e3;if(a.dataset.index!==t.dataset.index&&!a.dataset.deleting){a.dataset.deleting=!0;const{currentImageContainer:o}=this;setTimeout(()=>{o.removeChild(a),this.player.debug.log(`Removing thumb: ${a.dataset.filename}`)},l)}})}),_(this,"preloadNearby",(t,a=!0)=>new Promise(l=>{setTimeout(()=>{const o=this.thumbnails[0].frames[t].text;if(this.showingThumbFilename===o){let h;h=a?this.thumbnails[0].frames.slice(t):this.thumbnails[0].frames.slice(0,t).reverse();let f=!1;h.forEach(w=>{const k=w.text;if(k!==o&&!this.loadedImages.includes(k)){f=!0,this.player.debug.log(`Preloading thumb filename: ${k}`);const{urlPrefix:S}=this.thumbnails[0],L=S+k,A=new Image;A.src=L,A.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${k}`),this.loadedImages.includes(k)||this.loadedImages.push(k),l()}}}),f||l()}},300)})),_(this,"getHigherQuality",(t,a,l,o)=>{if(t{this.showingThumbFilename===o&&(this.player.debug.log(`Showing higher quality thumb for: ${o}`),this.loadImage(t+1))},300)}}),_(this,"toggleThumbContainer",(t=!1,a=!1)=>{const l=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(l,t),!t&&a&&(this.showingThumb=null,this.showingThumbFilename=null)}),_(this,"toggleScrubbingContainer",(t=!1)=>{const a=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(a,t),t||(this.showingThumb=null,this.showingThumbFilename=null)}),_(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),_(this,"setThumbContainerSizeAndPos",()=>{const{imageContainer:t}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(t.clientHeight>20&&t.clientWidth<20){const a=Math.floor(t.clientHeight*this.thumbAspectRatio);t.style.width=`${a}px`}else if(t.clientHeight<20&&t.clientWidth>20){const a=Math.floor(t.clientWidth/this.thumbAspectRatio);t.style.height=`${a}px`}}else{const a=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);t.style.height=`${this.thumbContainerHeight}px`,t.style.width=`${a}px`}this.setThumbContainerPos()}),_(this,"setThumbContainerPos",()=>{const t=this.player.elements.progress.getBoundingClientRect(),a=this.player.elements.container.getBoundingClientRect(),{container:l}=this.elements.thumb,o=a.left-t.left+10,h=a.right-t.left-l.clientWidth-10,f=this.mousePosX-t.left-l.clientWidth/2,w=Rn(f,o,h);l.style.left=`${w}px`,l.style.setProperty("--preview-arrow-offset",f-w+"px")}),_(this,"setScrubbingContainerSize",()=>{const{width:t,height:a}=hn(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${t}px`,this.elements.scrubbing.container.style.height=`${a}px`}),_(this,"setImageSizeAndOffset",(t,a)=>{if(!this.usingSprites)return;const l=this.thumbContainerHeight/a.h;t.style.height=t.naturalHeight*l+"px",t.style.width=t.naturalWidth*l+"px",t.style.left=`-${a.x*l}px`,t.style.top=`-${a.y*l}px`}),this.player=r,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:r}=hn(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return r}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(r){this.mouseDown?this.currentScrubbingImageElement=r:this.currentThumbnailImageElement=r}}const wi={insertElements(e,r){u.string(r)?ln(e,this.media,{src:r}):u.array(r)&&r.forEach(t=>{ln(e,this.media,t)})},change(e){Cn(e,"sources.length")?(Fe.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],Se(this.media),this.media=null,u.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:r,type:t}=e,[{provider:a=Re.html5,src:l}]=r,o=a==="html5"?t:"div",h=a==="html5"?{}:{src:l};Object.assign(this,{provider:a,type:t,supported:oe.check(t,a,this.config.playsinline),media:R(o,h)}),this.elements.container.appendChild(this.media),u.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),u.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),ne.addStyleHook.call(this),this.isHTML5&&wi.insertElements.call(this,"source",r),this.config.title=e.title,On.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&wi.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&ne.build.call(this),this.isHTML5&&this.media.load(),u.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new yi(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};class ht{constructor(r,t){if(_(this,"play",()=>u.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>_e(this.media.play())),this.media.play()):null),_(this,"pause",()=>this.playing&&u.function(this.media.pause)?this.media.pause():null),_(this,"togglePlay",f=>(u.boolean(f)?f:!this.playing)?this.play():this.pause()),_(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):u.function(this.media.stop)&&this.media.stop()}),_(this,"restart",()=>{this.currentTime=0}),_(this,"rewind",f=>{this.currentTime-=u.number(f)?f:this.config.seekTime}),_(this,"forward",f=>{this.currentTime+=u.number(f)?f:this.config.seekTime}),_(this,"increaseVolume",f=>{const w=this.media.muted?0:this.volume;this.volume=w+(u.number(f)?f:0)}),_(this,"decreaseVolume",f=>{this.increaseVolume(-f)}),_(this,"airplay",()=>{oe.airplay&&this.media.webkitShowPlaybackTargetPicker()}),_(this,"toggleControls",f=>{if(this.supported.ui&&!this.isAudio){const w=Mt(this.elements.container,this.config.classNames.hideControls),k=f===void 0?void 0:!f,S=te(this.elements.container,this.config.classNames.hideControls,k);if(S&&u.array(this.config.controls)&&this.config.controls.includes("settings")&&!u.empty(this.config.settings)&&E.toggleMenu.call(this,!1),S!==w){const L=S?"controlshidden":"controlsshown";F.call(this,this.media,L)}return!S}return!1}),_(this,"on",(f,w)=>{X.call(this,this.elements.container,f,w)}),_(this,"once",(f,w)=>{Ci.call(this,this.elements.container,f,w)}),_(this,"off",(f,w)=>{xt(this.elements.container,f,w)}),_(this,"destroy",(f,w=!1)=>{if(!this.ready)return;const k=()=>{document.body.style.overflow="",this.embed=null,w?(Object.keys(this.elements).length&&(Se(this.elements.buttons.play),Se(this.elements.captions),Se(this.elements.controls),Se(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),u.function(f)&&f()):(Uc.call(this),Fe.cancelRequests.call(this),Pt(this.elements.original,this.elements.container),F.call(this,this.elements.original,"destroyed",!0),u.function(f)&&f.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(ne.toggleNativeControls.call(this,!0),k()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&u.function(this.embed.destroy)&&this.embed.destroy(),k()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(k),setTimeout(k,200))}),_(this,"supports",f=>oe.mime.call(this,f)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=oe.touch,this.media=r,u.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||u.nodeList(this.media)||u.array(this.media))&&(this.media=this.media[0]),this.config=le({},In,ht.defaults,t||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch{return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new ru(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",oe),u.nullOrUndefined(this.media)||!u.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!oe.check().api)return void this.debug.error("Setup failed: no support");const a=this.media.cloneNode(!0);a.autoplay=!1,this.elements.original=a;const l=this.media.tagName.toLowerCase();let o=null,h=null;switch(l){case"div":if(o=this.media.querySelector("iframe"),u.element(o)){if(h=xn(o.getAttribute("src")),this.provider=iu(h.toString()),this.elements.container=this.media,this.media=o,this.elements.container.className="",h.search.length){const f=["1","true"];f.includes(h.searchParams.get("autoplay"))&&(this.config.autoplay=!0),f.includes(h.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=f.includes(h.searchParams.get("playsinline")),this.config.youtube.hl=h.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(u.empty(this.provider)||!Object.values(Re).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=di.video;break;case"video":case"audio":this.type=l,this.provider=Re.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=oe.check(this.type,this.provider),this.supported.api?(this.eventListeners=[],this.listeners=new nu(this),this.storage=new ut(this),this.media.plyr=this,u.element(this.elements.container)||(this.elements.container=R("div"),$n(this.media,this.elements.container)),ne.migrateStyles.call(this),ne.addStyleHook.call(this),On.setup.call(this),this.config.debug&&X.call(this,this.elements.container,this.config.events.join(" "),f=>{this.debug.log(`event: ${f.type}`)}),this.fullscreen=new Ae(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&ne.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new hu(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>_e(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new yi(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===Re.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===Re.youtube}get isVimeo(){return this.provider===Re.vimeo}get isVideo(){return this.type===di.video}get isAudio(){return this.type===di.audio}get playing(){return!!(this.ready&&!this.paused&&!this.ended)}get paused(){return!!this.media.paused}get stopped(){return!!(this.paused&&this.currentTime===0)}get ended(){return!!this.media.ended}set currentTime(r){if(!this.duration)return;const t=u.number(r)&&r>0;this.media.currentTime=t?Math.min(r,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:r}=this.media;return u.number(r)?r:r&&r.length&&this.duration>0?r.end(0)/this.duration:0}get seeking(){return!!this.media.seeking}get duration(){const r=parseFloat(this.config.duration),t=(this.media||{}).duration,a=u.number(t)&&t!==1/0?t:0;return r||a}set volume(r){let t=r;u.string(t)&&(t=Number(t)),u.number(t)||(t=this.storage.get("volume")),u.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!u.empty(r)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(r){let t=r;u.boolean(t)||(t=this.storage.get("muted")),u.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return!!this.media.muted}get hasAudio(){return!this.isHTML5||!!this.isAudio||!!this.media.mozHasAudio||!!this.media.webkitAudioDecodedByteCount||!!(this.media.audioTracks&&this.media.audioTracks.length)}set speed(r){let t=null;u.number(r)&&(t=r),u.number(t)||(t=this.storage.get("speed")),u.number(t)||(t=this.config.speed.selected);const{minimumSpeed:a,maximumSpeed:l}=this;t=Rn(t,a,l),this.config.speed.selected=t,setTimeout(()=>{this.media&&(this.media.playbackRate=t)},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(r){const t=this.config.quality,a=this.options.quality;if(!a.length)return;let l=[!u.empty(r)&&Number(r),this.storage.get("quality"),t.selected,t.default].find(u.number),o=!0;if(!a.includes(l)){const h=An(a,l);this.debug.warn(`Unsupported quality option: ${l}, using ${h} instead`),l=h,o=!1}t.selected=l,this.media.quality=l,o&&this.storage.set({quality:l})}get quality(){return this.media.quality}set loop(r){const t=u.boolean(r)?r:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return!!this.media.loop}set source(r){wi.change.call(this,r)}get source(){return this.media.currentSrc}get download(){const{download:r}=this.config.urls;return u.url(r)?r:this.source}set download(r){u.url(r)&&(this.config.urls.download=r,E.setDownloadUrl.call(this))}set poster(r){this.isVideo?ne.setPoster.call(this,r,!1).catch(()=>{}):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const r=St($i.call(this));return u.array(r)?r.join(":"):r}set ratio(r){this.isVideo?u.string(r)&&_n(r)?(this.config.ratio=St(r),tt.call(this)):this.debug.error(`Invalid aspect ratio specified (${r})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(r){this.config.autoplay=u.boolean(r)?r:this.config.autoplay}get autoplay(){return!!this.config.autoplay}toggleCaptions(r){Q.toggle.call(this,r,!1)}set currentTrack(r){Q.set.call(this,r,!1),Q.setup.call(this)}get currentTrack(){const{toggled:r,currentTrack:t}=this.captions;return r?t:-1}set language(r){Q.setLanguage.call(this,r,!1)}get language(){return(Q.getCurrentTrack.call(this)||{}).language}set pip(r){if(!oe.pip)return;const t=u.boolean(r)?r:!this.pip;u.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?hi.active:hi.inactive),u.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return oe.pip?u.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===hi.active:null}setPreviewThumbnails(r){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,r),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new yi(this))}static supported(r,t){return oe.check(r,t)}static loadSprite(r,t){return Sn(r,t)}static setup(r,t={}){let a=null;return u.string(r)?a=Array.from(document.querySelectorAll(r)):u.nodeList(r)?a=Array.from(r):u.array(r)&&(a=r.filter(u.element)),u.empty(a)?null:a.map(l=>new ht(l,t))}}ht.defaults=Hc(In);var pu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fn={exports:{}};/** + * chroma.js - JavaScript library for color conversions + * + * Copyright (c) 2011-2019, Gregor Aisch + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name Gregor Aisch may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ------------------------------------------------------- + * + * chroma.js includes colors from colorbrewer2.org, which are released under + * the following license: + * + * Copyright (c) 2002 Cynthia Brewer, Mark Harrower, + * and The Pennsylvania State University. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + * + * ------------------------------------------------------ + * + * Named colors are taken from X11 Color Names. + * http://www.w3.org/TR/css3-color/#svg-color + * + * @preserve + */(function(e,r){(function(t,a){e.exports=a()})(pu,function(){for(var t=function(i,n,s){return n===void 0&&(n=0),s===void 0&&(s=1),is?s:i},a=t,l=function(i){i._clipped=!1,i._unclipped=i.slice(0);for(var n=0;n<=3;n++)n<3?((i[n]<0||i[n]>255)&&(i._clipped=!0),i[n]=a(i[n],0,255)):n===3&&(i[n]=a(i[n],0,1));return i},o={},h=0,f=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];h=3?Array.prototype.slice.call(i):S(i[0])=="object"&&n?n.split("").filter(function(s){return i[0][s]!==void 0}).map(function(s){return i[0][s]}):i[0]},A=k,D=function(i){if(i.length<2)return null;var n=i.length-1;return A(i[n])=="string"?i[n].toLowerCase():null},H=Math.PI,y={clip_rgb:l,limit:t,type:k,unpack:L,last:D,PI:H,TWOPI:H*2,PITHIRD:H/3,DEG2RAD:H/180,RAD2DEG:180/H},q={format:{},autodetect:[]},j=y.last,M=y.clip_rgb,W=y.type,re=q,fe=function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];var c=this;if(W(n[0])==="object"&&n[0].constructor&&n[0].constructor===this.constructor)return n[0];var p=j(n),m=!1;if(!p){m=!0,re.sorted||(re.autodetect=re.autodetect.sort(function(T,P){return P.p-T.p}),re.sorted=!0);for(var d=0,g=re.autodetect;d4?i[4]:1;return m===1?[0,0,0,d]:[s>=1?0:255*(1-s)*(1-m),c>=1?0:255*(1-c)*(1-m),p>=1?0:255*(1-p)*(1-m),d]},Vn=Hn,Bn=se,Ei=I,_i=q,zn=y.unpack,Un=y.type,Wn=qn;Ei.prototype.cmyk=function(){return Wn(this._rgb)},Bn.cmyk=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(Ei,[null].concat(i,["cmyk"])))},_i.format.cmyk=Vn,_i.autodetect.push({p:2,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=zn(i,"cmyk"),Un(i)==="array"&&i.length===4)return"cmyk"}});var Gn=y.unpack,Yn=y.last,It=function(i){return Math.round(i*100)/100},Kn=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=Gn(i,"hsla"),c=Yn(i)||"lsa";return s[0]=It(s[0]||0),s[1]=It(s[1]*100)+"%",s[2]=It(s[2]*100)+"%",c==="hsla"||s.length>3&&s[3]<1?(s[3]=s.length>3?s[3]:1,c="hsla"):s.length=3,c+"("+s.join(",")+")"},Xn=Kn,Qn=y.unpack,Jn=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];i=Qn(i,"rgba");var s=i[0],c=i[1],p=i[2];s/=255,c/=255,p/=255;var m=Math.min(s,c,p),d=Math.max(s,c,p),g=(d+m)/2,b,v;return d===m?(b=0,v=Number.NaN):b=g<.5?(d-m)/(d+m):(d-m)/(2-d-m),s==d?v=(c-p)/(d-m):c==d?v=2+(p-s)/(d-m):p==d&&(v=4+(s-c)/(d-m)),v*=60,v<0&&(v+=360),i.length>3&&i[3]!==void 0?[v,b,g,i[3]]:[v,b,g]},Pi=Jn,Zn=y.unpack,ea=y.last,ta=Xn,ia=Pi,Ot=Math.round,ra=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=Zn(i,"rgba"),c=ea(i)||"rgb";return c.substr(0,3)=="hsl"?ta(ia(s),c):(s[0]=Ot(s[0]),s[1]=Ot(s[1]),s[2]=Ot(s[2]),(c==="rgba"||s.length>3&&s[3]<1)&&(s[3]=s.length>3?s[3]:1,c="rgba"),c+"("+s.slice(0,c==="rgb"?3:4).join(",")+")")},na=ra,aa=y.unpack,Rt=Math.round,sa=function(){for(var i,n=[],s=arguments.length;s--;)n[s]=arguments[s];n=aa(n,"hsl");var c=n[0],p=n[1],m=n[2],d,g,b;if(p===0)d=g=b=m*255;else{var v=[0,0,0],T=[0,0,0],P=m<.5?m*(1+p):m+p-m*p,C=2*m-P,x=c/360;v[0]=x+1/3,v[1]=x,v[2]=x-1/3;for(var N=0;N<3;N++)v[N]<0&&(v[N]+=1),v[N]>1&&(v[N]-=1),6*v[N]<1?T[N]=C+(P-C)*6*v[N]:2*v[N]<1?T[N]=P:3*v[N]<2?T[N]=C+(P-C)*(2/3-v[N])*6:T[N]=C;i=[Rt(T[0]*255),Rt(T[1]*255),Rt(T[2]*255)],d=i[0],g=i[1],b=i[2]}return n.length>3?[d,g,b,n[3]]:[d,g,b,1]},Mi=sa,Si=Mi,Ni=q,xi=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,Li=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Ii=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Oi=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Ri=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Fi=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Di=Math.round,qi=function(i){i=i.toLowerCase().trim();var n;if(Ni.format.named)try{return Ni.format.named(i)}catch{}if(n=i.match(xi)){for(var s=n.slice(1,4),c=0;c<3;c++)s[c]=+s[c];return s[3]=1,s}if(n=i.match(Li)){for(var p=n.slice(1,5),m=0;m<4;m++)p[m]=+p[m];return p}if(n=i.match(Ii)){for(var d=n.slice(1,4),g=0;g<3;g++)d[g]=Di(d[g]*2.55);return d[3]=1,d}if(n=i.match(Oi)){for(var b=n.slice(1,5),v=0;v<3;v++)b[v]=Di(b[v]*2.55);return b[3]=+b[3],b}if(n=i.match(Ri)){var T=n.slice(1,4);T[1]*=.01,T[2]*=.01;var P=Si(T);return P[3]=1,P}if(n=i.match(Fi)){var C=n.slice(1,4);C[1]*=.01,C[2]*=.01;var x=Si(C);return x[3]=+n[4],x}};qi.test=function(i){return xi.test(i)||Li.test(i)||Ii.test(i)||Oi.test(i)||Ri.test(i)||Fi.test(i)};var la=qi,oa=se,ji=I,Hi=q,ca=y.type,ua=na,Vi=la;ji.prototype.css=function(i){return ua(this._rgb,i)},oa.css=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(ji,[null].concat(i,["css"])))},Hi.format.css=Vi,Hi.autodetect.push({p:5,test:function(i){for(var n=[],s=arguments.length-1;s-- >0;)n[s]=arguments[s+1];if(!n.length&&ca(i)==="string"&&Vi.test(i))return"css"}});var Bi=I,ha=se,da=q,pa=y.unpack;da.format.gl=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=pa(i,"rgba");return s[0]*=255,s[1]*=255,s[2]*=255,s},ha.gl=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(Bi,[null].concat(i,["gl"])))},Bi.prototype.gl=function(){var i=this._rgb;return[i[0]/255,i[1]/255,i[2]/255,i[3]]};var ma=y.unpack,fa=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=ma(i,"rgb"),c=s[0],p=s[1],m=s[2],d=Math.min(c,p,m),g=Math.max(c,p,m),b=g-d,v=b*100/255,T=d/(255-b)*100,P;return b===0?P=Number.NaN:(c===g&&(P=(p-m)/b),p===g&&(P=2+(m-c)/b),m===g&&(P=4+(c-p)/b),P*=60,P<0&&(P+=360)),[P,v,T]},ga=fa,ba=y.unpack,va=Math.floor,ya=function(){for(var i,n,s,c,p,m,d=[],g=arguments.length;g--;)d[g]=arguments[g];d=ba(d,"hcg");var b=d[0],v=d[1],T=d[2],P,C,x;T=T*255;var N=v*255;if(v===0)P=C=x=T;else{b===360&&(b=0),b>360&&(b-=360),b<0&&(b+=360),b/=60;var V=va(b),U=b-V,Y=T*(1-v),J=Y+N*(1-U),ge=Y+N*U,de=Y+N;switch(V){case 0:i=[de,ge,Y],P=i[0],C=i[1],x=i[2];break;case 1:n=[J,de,Y],P=n[0],C=n[1],x=n[2];break;case 2:s=[Y,de,ge],P=s[0],C=s[1],x=s[2];break;case 3:c=[Y,J,de],P=c[0],C=c[1],x=c[2];break;case 4:p=[ge,Y,de],P=p[0],C=p[1],x=p[2];break;case 5:m=[de,Y,J],P=m[0],C=m[1],x=m[2];break}}return[P,C,x,d.length>3?d[3]:1]},wa=ya,ka=y.unpack,Ta=y.type,Ca=se,zi=I,Ui=q,$a=ga;zi.prototype.hcg=function(){return $a(this._rgb)},Ca.hcg=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(zi,[null].concat(i,["hcg"])))},Ui.format.hcg=wa,Ui.autodetect.push({p:1,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=ka(i,"hcg"),Ta(i)==="array"&&i.length===3)return"hcg"}});var Aa=y.unpack,Ea=y.last,gt=Math.round,_a=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=Aa(i,"rgba"),c=s[0],p=s[1],m=s[2],d=s[3],g=Ea(i)||"auto";d===void 0&&(d=1),g==="auto"&&(g=d<1?"rgba":"rgb"),c=gt(c),p=gt(p),m=gt(m);var b=c<<16|p<<8|m,v="000000"+b.toString(16);v=v.substr(v.length-6);var T="0"+gt(d*255).toString(16);switch(T=T.substr(T.length-2),g.toLowerCase()){case"rgba":return"#"+v+T;case"argb":return"#"+T+v;default:return"#"+v}},Wi=_a,Pa=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Ma=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Sa=function(i){if(i.match(Pa)){(i.length===4||i.length===7)&&(i=i.substr(1)),i.length===3&&(i=i.split(""),i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);var n=parseInt(i,16),s=n>>16,c=n>>8&255,p=n&255;return[s,c,p,1]}if(i.match(Ma)){(i.length===5||i.length===9)&&(i=i.substr(1)),i.length===4&&(i=i.split(""),i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]+i[3]+i[3]);var m=parseInt(i,16),d=m>>24&255,g=m>>16&255,b=m>>8&255,v=Math.round((m&255)/255*100)/100;return[d,g,b,v]}throw new Error("unknown hex color: "+i)},Gi=Sa,Na=se,Yi=I,xa=y.type,Ki=q,La=Wi;Yi.prototype.hex=function(i){return La(this._rgb,i)},Na.hex=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(Yi,[null].concat(i,["hex"])))},Ki.format.hex=Gi,Ki.autodetect.push({p:4,test:function(i){for(var n=[],s=arguments.length-1;s-- >0;)n[s]=arguments[s+1];if(!n.length&&xa(i)==="string"&&[3,4,5,6,7,8,9].indexOf(i.length)>=0)return"hex"}});var Ia=y.unpack,Xi=y.TWOPI,Oa=Math.min,Ra=Math.sqrt,Fa=Math.acos,Da=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=Ia(i,"rgb"),c=s[0],p=s[1],m=s[2];c/=255,p/=255,m/=255;var d,g=Oa(c,p,m),b=(c+p+m)/3,v=b>0?1-g/b:0;return v===0?d=NaN:(d=(c-p+(c-m))/2,d/=Ra((c-p)*(c-p)+(c-m)*(p-m)),d=Fa(d),m>p&&(d=Xi-d),d/=Xi),[d*360,v,b]},qa=Da,ja=y.unpack,Ft=y.limit,ze=y.TWOPI,Dt=y.PITHIRD,Ue=Math.cos,Ha=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];i=ja(i,"hsi");var s=i[0],c=i[1],p=i[2],m,d,g;return isNaN(s)&&(s=0),isNaN(c)&&(c=0),s>360&&(s-=360),s<0&&(s+=360),s/=360,s<1/3?(g=(1-c)/3,m=(1+c*Ue(ze*s)/Ue(Dt-ze*s))/3,d=1-(g+m)):s<2/3?(s-=1/3,m=(1-c)/3,d=(1+c*Ue(ze*s)/Ue(Dt-ze*s))/3,g=1-(m+d)):(s-=2/3,d=(1-c)/3,g=(1+c*Ue(ze*s)/Ue(Dt-ze*s))/3,m=1-(d+g)),m=Ft(p*m*3),d=Ft(p*d*3),g=Ft(p*g*3),[m*255,d*255,g*255,i.length>3?i[3]:1]},Va=Ha,Ba=y.unpack,za=y.type,Ua=se,Qi=I,Ji=q,Wa=qa;Qi.prototype.hsi=function(){return Wa(this._rgb)},Ua.hsi=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(Qi,[null].concat(i,["hsi"])))},Ji.format.hsi=Va,Ji.autodetect.push({p:2,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=Ba(i,"hsi"),za(i)==="array"&&i.length===3)return"hsi"}});var Ga=y.unpack,Ya=y.type,Ka=se,Zi=I,er=q,Xa=Pi;Zi.prototype.hsl=function(){return Xa(this._rgb)},Ka.hsl=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(Zi,[null].concat(i,["hsl"])))},er.format.hsl=Mi,er.autodetect.push({p:2,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=Ga(i,"hsl"),Ya(i)==="array"&&i.length===3)return"hsl"}});var Qa=y.unpack,Ja=Math.min,Za=Math.max,es=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];i=Qa(i,"rgb");var s=i[0],c=i[1],p=i[2],m=Ja(s,c,p),d=Za(s,c,p),g=d-m,b,v,T;return T=d/255,d===0?(b=Number.NaN,v=0):(v=g/d,s===d&&(b=(c-p)/g),c===d&&(b=2+(p-s)/g),p===d&&(b=4+(s-c)/g),b*=60,b<0&&(b+=360)),[b,v,T]},ts=es,is=y.unpack,rs=Math.floor,ns=function(){for(var i,n,s,c,p,m,d=[],g=arguments.length;g--;)d[g]=arguments[g];d=is(d,"hsv");var b=d[0],v=d[1],T=d[2],P,C,x;if(T*=255,v===0)P=C=x=T;else{b===360&&(b=0),b>360&&(b-=360),b<0&&(b+=360),b/=60;var N=rs(b),V=b-N,U=T*(1-v),Y=T*(1-v*V),J=T*(1-v*(1-V));switch(N){case 0:i=[T,J,U],P=i[0],C=i[1],x=i[2];break;case 1:n=[Y,T,U],P=n[0],C=n[1],x=n[2];break;case 2:s=[U,T,J],P=s[0],C=s[1],x=s[2];break;case 3:c=[U,Y,T],P=c[0],C=c[1],x=c[2];break;case 4:p=[J,U,T],P=p[0],C=p[1],x=p[2];break;case 5:m=[T,U,Y],P=m[0],C=m[1],x=m[2];break}}return[P,C,x,d.length>3?d[3]:1]},as=ns,ss=y.unpack,ls=y.type,os=se,tr=I,ir=q,cs=ts;tr.prototype.hsv=function(){return cs(this._rgb)},os.hsv=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(tr,[null].concat(i,["hsv"])))},ir.format.hsv=as,ir.autodetect.push({p:2,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=ss(i,"hsv"),ls(i)==="array"&&i.length===3)return"hsv"}});var bt={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},We=bt,us=y.unpack,rr=Math.pow,hs=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=us(i,"rgb"),c=s[0],p=s[1],m=s[2],d=ds(c,p,m),g=d[0],b=d[1],v=d[2],T=116*b-16;return[T<0?0:T,500*(g-b),200*(b-v)]},qt=function(i){return(i/=255)<=.04045?i/12.92:rr((i+.055)/1.055,2.4)},jt=function(i){return i>We.t3?rr(i,1/3):i/We.t2+We.t0},ds=function(i,n,s){i=qt(i),n=qt(n),s=qt(s);var c=jt((.4124564*i+.3575761*n+.1804375*s)/We.Xn),p=jt((.2126729*i+.7151522*n+.072175*s)/We.Yn),m=jt((.0193339*i+.119192*n+.9503041*s)/We.Zn);return[c,p,m]},nr=hs,Ge=bt,ps=y.unpack,ms=Math.pow,fs=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];i=ps(i,"lab");var s=i[0],c=i[1],p=i[2],m,d,g,b,v,T;return d=(s+16)/116,m=isNaN(c)?d:d+c/500,g=isNaN(p)?d:d-p/200,d=Ge.Yn*Vt(d),m=Ge.Xn*Vt(m),g=Ge.Zn*Vt(g),b=Ht(3.2404542*m-1.5371385*d-.4985314*g),v=Ht(-.969266*m+1.8760108*d+.041556*g),T=Ht(.0556434*m-.2040259*d+1.0572252*g),[b,v,T,i.length>3?i[3]:1]},Ht=function(i){return 255*(i<=.00304?12.92*i:1.055*ms(i,1/2.4)-.055)},Vt=function(i){return i>Ge.t1?i*i*i:Ge.t2*(i-Ge.t0)},ar=fs,gs=y.unpack,bs=y.type,vs=se,sr=I,lr=q,ys=nr;sr.prototype.lab=function(){return ys(this._rgb)},vs.lab=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(sr,[null].concat(i,["lab"])))},lr.format.lab=ar,lr.autodetect.push({p:2,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=gs(i,"lab"),bs(i)==="array"&&i.length===3)return"lab"}});var ws=y.unpack,ks=y.RAD2DEG,Ts=Math.sqrt,Cs=Math.atan2,$s=Math.round,As=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=ws(i,"lab"),c=s[0],p=s[1],m=s[2],d=Ts(p*p+m*m),g=(Cs(m,p)*ks+360)%360;return $s(d*1e4)===0&&(g=Number.NaN),[c,d,g]},or=As,Es=y.unpack,_s=nr,Ps=or,Ms=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=Es(i,"rgb"),c=s[0],p=s[1],m=s[2],d=_s(c,p,m),g=d[0],b=d[1],v=d[2];return Ps(g,b,v)},Ss=Ms,Ns=y.unpack,xs=y.DEG2RAD,Ls=Math.sin,Is=Math.cos,Os=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=Ns(i,"lch"),c=s[0],p=s[1],m=s[2];return isNaN(m)&&(m=0),m=m*xs,[c,Is(m)*p,Ls(m)*p]},cr=Os,Rs=y.unpack,Fs=cr,Ds=ar,qs=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];i=Rs(i,"lch");var s=i[0],c=i[1],p=i[2],m=Fs(s,c,p),d=m[0],g=m[1],b=m[2],v=Ds(d,g,b),T=v[0],P=v[1],C=v[2];return[T,P,C,i.length>3?i[3]:1]},ur=qs,js=y.unpack,Hs=ur,Vs=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=js(i,"hcl").reverse();return Hs.apply(void 0,s)},Bs=Vs,zs=y.unpack,Us=y.type,hr=se,vt=I,Bt=q,dr=Ss;vt.prototype.lch=function(){return dr(this._rgb)},vt.prototype.hcl=function(){return dr(this._rgb).reverse()},hr.lch=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(vt,[null].concat(i,["lch"])))},hr.hcl=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(vt,[null].concat(i,["hcl"])))},Bt.format.lch=ur,Bt.format.hcl=Bs,["lch","hcl"].forEach(function(i){return Bt.autodetect.push({p:2,test:function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];if(n=zs(n,i),Us(n)==="array"&&n.length===3)return i}})});var Ws={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},pr=Ws,Gs=I,mr=q,Ys=y.type,it=pr,Ks=Gi,Xs=Wi;Gs.prototype.name=function(){for(var i=Xs(this._rgb,"rgb"),n=0,s=Object.keys(it);n0;)n[s]=arguments[s+1];if(!n.length&&Ys(i)==="string"&&it[i.toLowerCase()])return"named"}});var Qs=y.unpack,Js=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=Qs(i,"rgb"),c=s[0],p=s[1],m=s[2];return(c<<16)+(p<<8)+m},Zs=Js,el=y.type,tl=function(i){if(el(i)=="number"&&i>=0&&i<=16777215){var n=i>>16,s=i>>8&255,c=i&255;return[n,s,c,1]}throw new Error("unknown num color: "+i)},il=tl,rl=se,fr=I,gr=q,nl=y.type,al=Zs;fr.prototype.num=function(){return al(this._rgb)},rl.num=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(fr,[null].concat(i,["num"])))},gr.format.num=il,gr.autodetect.push({p:5,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i.length===1&&nl(i[0])==="number"&&i[0]>=0&&i[0]<=16777215)return"num"}});var sl=se,zt=I,br=q,vr=y.unpack,yr=y.type,wr=Math.round;zt.prototype.rgb=function(i){return i===void 0&&(i=!0),i===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(wr)},zt.prototype.rgba=function(i){return i===void 0&&(i=!0),this._rgb.slice(0,4).map(function(n,s){return s<3?i===!1?n:wr(n):n})},sl.rgb=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(zt,[null].concat(i,["rgb"])))},br.format.rgb=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=vr(i,"rgba");return s[3]===void 0&&(s[3]=1),s},br.autodetect.push({p:3,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=vr(i,"rgba"),yr(i)==="array"&&(i.length===3||i.length===4&&yr(i[3])=="number"&&i[3]>=0&&i[3]<=1))return"rgb"}});var yt=Math.log,ll=function(i){var n=i/100,s,c,p;return n<66?(s=255,c=n<6?0:-155.25485562709179-.44596950469579133*(c=n-2)+104.49216199393888*yt(c),p=n<20?0:-254.76935184120902+.8274096064007395*(p=n-10)+115.67994401066147*yt(p)):(s=351.97690566805693+.114206453784165*(s=n-55)-40.25366309332127*yt(s),c=325.4494125711974+.07943456536662342*(c=n-50)-28.0852963507957*yt(c),p=255),[s,c,p,1]},kr=ll,ol=kr,cl=y.unpack,ul=Math.round,hl=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];for(var s=cl(i,"rgb"),c=s[0],p=s[2],m=1e3,d=4e4,g=.4,b;d-m>g;){b=(d+m)*.5;var v=ol(b);v[2]/v[0]>=p/c?d=b:m=b}return ul(b)},dl=hl,Ut=se,wt=I,Wt=q,pl=dl;wt.prototype.temp=wt.prototype.kelvin=wt.prototype.temperature=function(){return pl(this._rgb)},Ut.temp=Ut.kelvin=Ut.temperature=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(wt,[null].concat(i,["temp"])))},Wt.format.temp=Wt.format.kelvin=Wt.format.temperature=kr;var ml=y.unpack,Gt=Math.cbrt,fl=Math.pow,gl=Math.sign,bl=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=ml(i,"rgb"),c=s[0],p=s[1],m=s[2],d=[Yt(c/255),Yt(p/255),Yt(m/255)],g=d[0],b=d[1],v=d[2],T=Gt(.4122214708*g+.5363325363*b+.0514459929*v),P=Gt(.2119034982*g+.6806995451*b+.1073969566*v),C=Gt(.0883024619*g+.2817188376*b+.6299787005*v);return[.2104542553*T+.793617785*P-.0040720468*C,1.9779984951*T-2.428592205*P+.4505937099*C,.0259040371*T+.7827717662*P-.808675766*C]},Tr=bl;function Yt(i){var n=Math.abs(i);return n<.04045?i/12.92:(gl(i)||1)*fl((n+.055)/1.055,2.4)}var vl=y.unpack,kt=Math.pow,yl=Math.sign,wl=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];i=vl(i,"lab");var s=i[0],c=i[1],p=i[2],m=kt(s+.3963377774*c+.2158037573*p,3),d=kt(s-.1055613458*c-.0638541728*p,3),g=kt(s-.0894841775*c-1.291485548*p,3);return[255*Kt(4.0767416621*m-3.3077115913*d+.2309699292*g),255*Kt(-1.2684380046*m+2.6097574011*d-.3413193965*g),255*Kt(-.0041960863*m-.7034186147*d+1.707614701*g),i.length>3?i[3]:1]},Cr=wl;function Kt(i){var n=Math.abs(i);return n>.0031308?(yl(i)||1)*(1.055*kt(n,1/2.4)-.055):i*12.92}var kl=y.unpack,Tl=y.type,Cl=se,$r=I,Ar=q,$l=Tr;$r.prototype.oklab=function(){return $l(this._rgb)},Cl.oklab=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply($r,[null].concat(i,["oklab"])))},Ar.format.oklab=Cr,Ar.autodetect.push({p:3,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=kl(i,"oklab"),Tl(i)==="array"&&i.length===3)return"oklab"}});var Al=y.unpack,El=Tr,_l=or,Pl=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];var s=Al(i,"rgb"),c=s[0],p=s[1],m=s[2],d=El(c,p,m),g=d[0],b=d[1],v=d[2];return _l(g,b,v)},Ml=Pl,Sl=y.unpack,Nl=cr,xl=Cr,Ll=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];i=Sl(i,"lch");var s=i[0],c=i[1],p=i[2],m=Nl(s,c,p),d=m[0],g=m[1],b=m[2],v=xl(d,g,b),T=v[0],P=v[1],C=v[2];return[T,P,C,i.length>3?i[3]:1]},Il=Ll,Ol=y.unpack,Rl=y.type,Fl=se,Er=I,_r=q,Dl=Ml;Er.prototype.oklch=function(){return Dl(this._rgb)},Fl.oklch=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];return new(Function.prototype.bind.apply(Er,[null].concat(i,["oklch"])))},_r.format.oklch=Il,_r.autodetect.push({p:3,test:function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(i=Ol(i,"oklch"),Rl(i)==="array"&&i.length===3)return"oklch"}});var Pr=I,ql=y.type;Pr.prototype.alpha=function(i,n){return n===void 0&&(n=!1),i!==void 0&&ql(i)==="number"?n?(this._rgb[3]=i,this):new Pr([this._rgb[0],this._rgb[1],this._rgb[2],i],"rgb"):this._rgb[3]};var jl=I;jl.prototype.clipped=function(){return this._rgb._clipped||!1};var De=I,Hl=bt;De.prototype.darken=function(i){i===void 0&&(i=1);var n=this,s=n.lab();return s[0]-=Hl.Kn*i,new De(s,"lab").alpha(n.alpha(),!0)},De.prototype.brighten=function(i){return i===void 0&&(i=1),this.darken(-i)},De.prototype.darker=De.prototype.darken,De.prototype.brighter=De.prototype.brighten;var Vl=I;Vl.prototype.get=function(i){var n=i.split("."),s=n[0],c=n[1],p=this[s]();if(c){var m=s.indexOf(c)-(s.substr(0,2)==="ok"?2:0);if(m>-1)return p[m];throw new Error("unknown channel "+c+" in mode "+s)}else return p};var Ye=I,Bl=y.type,zl=Math.pow,Ul=1e-7,Wl=20;Ye.prototype.luminance=function(i){if(i!==void 0&&Bl(i)==="number"){if(i===0)return new Ye([0,0,0,this._rgb[3]],"rgb");if(i===1)return new Ye([255,255,255,this._rgb[3]],"rgb");var n=this.luminance(),s="rgb",c=Wl,p=function(d,g){var b=d.interpolate(g,.5,s),v=b.luminance();return Math.abs(i-v)i?p(d,b):p(b,g)},m=(n>i?p(new Ye([0,0,0]),this):p(this,new Ye([255,255,255]))).rgb();return new Ye(m.concat([this._rgb[3]]))}return Gl.apply(void 0,this._rgb.slice(0,3))};var Gl=function(i,n,s){return i=Xt(i),n=Xt(n),s=Xt(s),.2126*i+.7152*n+.0722*s},Xt=function(i){return i/=255,i<=.03928?i/12.92:zl((i+.055)/1.055,2.4)},ke={},Mr=I,Sr=y.type,Tt=ke,Nr=function(i,n,s){s===void 0&&(s=.5);for(var c=[],p=arguments.length-3;p-- >0;)c[p]=arguments[p+3];var m=c[0]||"lrgb";if(!Tt[m]&&!c.length&&(m=Object.keys(Tt)[0]),!Tt[m])throw new Error("interpolation mode "+m+" is not defined");return Sr(i)!=="object"&&(i=new Mr(i)),Sr(n)!=="object"&&(n=new Mr(n)),Tt[m](i,n,s).alpha(i.alpha()+s*(n.alpha()-i.alpha()))},xr=I,Yl=Nr;xr.prototype.mix=xr.prototype.interpolate=function(i,n){n===void 0&&(n=.5);for(var s=[],c=arguments.length-2;c-- >0;)s[c]=arguments[c+2];return Yl.apply(void 0,[this,i,n].concat(s))};var Lr=I;Lr.prototype.premultiply=function(i){i===void 0&&(i=!1);var n=this._rgb,s=n[3];return i?(this._rgb=[n[0]*s,n[1]*s,n[2]*s,s],this):new Lr([n[0]*s,n[1]*s,n[2]*s,s],"rgb")};var Qt=I,Kl=bt;Qt.prototype.saturate=function(i){i===void 0&&(i=1);var n=this,s=n.lch();return s[1]+=Kl.Kn*i,s[1]<0&&(s[1]=0),new Qt(s,"lch").alpha(n.alpha(),!0)},Qt.prototype.desaturate=function(i){return i===void 0&&(i=1),this.saturate(-i)};var Ir=I,Or=y.type;Ir.prototype.set=function(i,n,s){s===void 0&&(s=!1);var c=i.split("."),p=c[0],m=c[1],d=this[p]();if(m){var g=p.indexOf(m)-(p.substr(0,2)==="ok"?2:0);if(g>-1){if(Or(n)=="string")switch(n.charAt(0)){case"+":d[g]+=+n;break;case"-":d[g]+=+n;break;case"*":d[g]*=+n.substr(1);break;case"/":d[g]/=+n.substr(1);break;default:d[g]=+n}else if(Or(n)==="number")d[g]=n;else throw new Error("unsupported value for Color.set");var b=new Ir(d,p);return s?(this._rgb=b._rgb,this):b}throw new Error("unknown channel "+m+" in mode "+p)}else return d};var Xl=I,Ql=function(i,n,s){var c=i._rgb,p=n._rgb;return new Xl(c[0]+s*(p[0]-c[0]),c[1]+s*(p[1]-c[1]),c[2]+s*(p[2]-c[2]),"rgb")};ke.rgb=Ql;var Jl=I,Jt=Math.sqrt,Ke=Math.pow,Zl=function(i,n,s){var c=i._rgb,p=c[0],m=c[1],d=c[2],g=n._rgb,b=g[0],v=g[1],T=g[2];return new Jl(Jt(Ke(p,2)*(1-s)+Ke(b,2)*s),Jt(Ke(m,2)*(1-s)+Ke(v,2)*s),Jt(Ke(d,2)*(1-s)+Ke(T,2)*s),"rgb")};ke.lrgb=Zl;var eo=I,to=function(i,n,s){var c=i.lab(),p=n.lab();return new eo(c[0]+s*(p[0]-c[0]),c[1]+s*(p[1]-c[1]),c[2]+s*(p[2]-c[2]),"lab")};ke.lab=to;var Rr=I,Xe=function(i,n,s,c){var p,m,d,g;c==="hsl"?(d=i.hsl(),g=n.hsl()):c==="hsv"?(d=i.hsv(),g=n.hsv()):c==="hcg"?(d=i.hcg(),g=n.hcg()):c==="hsi"?(d=i.hsi(),g=n.hsi()):c==="lch"||c==="hcl"?(c="hcl",d=i.hcl(),g=n.hcl()):c==="oklch"&&(d=i.oklch().reverse(),g=n.oklch().reverse());var b,v,T,P,C,x;(c.substr(0,1)==="h"||c==="oklch")&&(p=d,b=p[0],T=p[1],C=p[2],m=g,v=m[0],P=m[1],x=m[2]);var N,V,U,Y;return!isNaN(b)&&!isNaN(v)?(v>b&&v-b>180?Y=v-(b+360):v180?Y=v+360-b:Y=v-b,V=b+s*Y):isNaN(b)?isNaN(v)?V=Number.NaN:(V=v,(C==1||C==0)&&c!="hsv"&&(N=P)):(V=b,(x==1||x==0)&&c!="hsv"&&(N=T)),N===void 0&&(N=T+s*(P-T)),U=C+s*(x-C),c==="oklch"?new Rr([U,N,V],c):new Rr([V,N,U],c)},io=Xe,Fr=function(i,n,s){return io(i,n,s,"lch")};ke.lch=Fr,ke.hcl=Fr;var ro=I,no=function(i,n,s){var c=i.num(),p=n.num();return new ro(c+s*(p-c),"num")};ke.num=no;var ao=Xe,so=function(i,n,s){return ao(i,n,s,"hcg")};ke.hcg=so;var lo=Xe,oo=function(i,n,s){return lo(i,n,s,"hsi")};ke.hsi=oo;var co=Xe,uo=function(i,n,s){return co(i,n,s,"hsl")};ke.hsl=uo;var ho=Xe,po=function(i,n,s){return ho(i,n,s,"hsv")};ke.hsv=po;var mo=I,fo=function(i,n,s){var c=i.oklab(),p=n.oklab();return new mo(c[0]+s*(p[0]-c[0]),c[1]+s*(p[1]-c[1]),c[2]+s*(p[2]-c[2]),"oklab")};ke.oklab=fo;var go=Xe,bo=function(i,n,s){return go(i,n,s,"oklch")};ke.oklch=bo;var Zt=I,vo=y.clip_rgb,ei=Math.pow,ti=Math.sqrt,ii=Math.PI,Dr=Math.cos,qr=Math.sin,yo=Math.atan2,wo=function(i,n,s){n===void 0&&(n="lrgb"),s===void 0&&(s=null);var c=i.length;s||(s=Array.from(new Array(c)).map(function(){return 1}));var p=c/s.reduce(function(V,U){return V+U});if(s.forEach(function(V,U){s[U]*=p}),i=i.map(function(V){return new Zt(V)}),n==="lrgb")return ko(i,s);for(var m=i.shift(),d=m.get(n),g=[],b=0,v=0,T=0;T=360;)N-=360;d[x]=N}else d[x]=d[x]/g[x];return C/=c,new Zt(d,n).alpha(C>.99999?1:C,!0)},ko=function(i,n){for(var s=i.length,c=[0,0,0,0],p=0;p.9999999&&(c[3]=1),new Zt(vo(c))},Te=se,Qe=y.type,To=Math.pow,ri=function(i){var n="rgb",s=Te("#ccc"),c=0,p=[0,1],m=[],d=[0,0],g=!1,b=[],v=!1,T=0,P=1,C=!1,x={},N=!0,V=1,U=function($){if($=$||["#fff","#000"],$&&Qe($)==="string"&&Te.brewer&&Te.brewer[$.toLowerCase()]&&($=Te.brewer[$.toLowerCase()]),Qe($)==="array"){$.length===1&&($=[$[0],$[0]]),$=$.slice(0);for(var O=0;O<$.length;O++)$[O]=Te($[O]);m.length=0;for(var z=0;z<$.length;z++)m.push(z/($.length-1))}return we(),b=$},Y=function($){if(g!=null){for(var O=g.length-1,z=0;z=g[z];)z++;return z-1}return 0},J=function($){return $},ge=function($){return $},de=function($,O){var z,B;if(O==null&&(O=!1),isNaN($)||$===null)return s;if(O)B=$;else if(g&&g.length>2){var be=Y($);B=be/(g.length-2)}else P!==T?B=($-T)/(P-T):B=1;B=ge(B),O||(B=J(B)),V!==1&&(B=To(B,V)),B=d[0]+B*(1-d[0]-d[1]),B=Math.min(1,Math.max(0,B));var ae=Math.floor(B*1e4);if(N&&x[ae])z=x[ae];else{if(Qe(b)==="array")for(var K=0;K=Z&&K===m.length-1){z=b[K];break}if(B>Z&&B2){var K=$.map(function(ee,ie){return ie/($.length-1)}),Z=$.map(function(ee){return(ee-T)/(P-T)});Z.every(function(ee,ie){return K[ie]===ee})||(ge=function(ee){if(ee<=0||ee>=1)return ee;for(var ie=0;ee>=Z[ie+1];)ie++;var $e=(ee-Z[ie])/(Z[ie+1]-Z[ie]),Ie=K[ie]+$e*(K[ie+1]-K[ie]);return Ie})}}return p=[T,P],G},G.mode=function($){return arguments.length?(n=$,we(),G):n},G.range=function($,O){return U($),G},G.out=function($){return v=$,G},G.spread=function($){return arguments.length?(c=$,G):c},G.correctLightness=function($){return $==null&&($=!0),C=$,we(),C?J=function(O){for(var z=de(0,!0).lab()[0],B=de(1,!0).lab()[0],be=z>B,ae=de(O,!0).lab()[0],K=z+(B-z)*O,Z=ae-K,ee=0,ie=1,$e=20;Math.abs(Z)>.01&&$e-- >0;)(function(){return be&&(Z*=-1),Z<0?(ee=O,O+=(ie-O)*.5):(ie=O,O+=(ee-O)*.5),ae=de(O,!0).lab()[0],Z=ae-K})();return O}:J=function(O){return O},G},G.padding=function($){return $!=null?(Qe($)==="number"&&($=[$,$]),d=$,G):d},G.colors=function($,O){arguments.length<2&&(O="hex");var z=[];if(arguments.length===0)z=b.slice(0);else if($===1)z=[G(.5)];else if($>1){var B=p[0],be=p[1]-B;z=Co(0,$,!1).map(function(ie){return G(B+ie/($-1)*be)})}else{i=[];var ae=[];if(g&&g.length>2)for(var K=1,Z=g.length,ee=1<=Z;ee?KZ;ee?K++:K--)ae.push((g[K-1]+g[K])*.5);else ae=p;z=ae.map(function(ie){return G(ie)})}return Te[O]&&(z=z.map(function(ie){return ie[O]()})),z},G.cache=function($){return $!=null?(N=$,G):N},G.gamma=function($){return $!=null?(V=$,G):V},G.nodata=function($){return $!=null?(s=Te($),G):s},G};function Co(i,n,s){for(var c=[],p=im;p?d++:d--)c.push(d);return c}var rt=I,$o=ri,Ao=function(i){for(var n=[1,1],s=1;s=5){var v,T,P;v=i.map(function(C){return C.lab()}),P=i.length-1,T=Ao(P),p=function(C){var x=1-C,N=[0,1,2].map(function(V){return v.reduce(function(U,Y,J){return U+T[J]*Math.pow(x,P-J)*Math.pow(C,J)*Y[V]},0)});return new rt(N,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return p},_o=function(i){var n=Eo(i);return n.scale=function(){return $o(n)},n},ni=se,Ce=function(i,n,s){if(!Ce[s])throw new Error("unknown blend mode "+s);return Ce[s](i,n)},xe=function(i){return function(n,s){var c=ni(s).rgb(),p=ni(n).rgb();return ni.rgb(i(c,p))}},Le=function(i){return function(n,s){var c=[];return c[0]=i(n[0],s[0]),c[1]=i(n[1],s[1]),c[2]=i(n[2],s[2]),c}},Po=function(i){return i},Mo=function(i,n){return i*n/255},So=function(i,n){return i>n?n:i},No=function(i,n){return i>n?i:n},xo=function(i,n){return 255*(1-(1-i/255)*(1-n/255))},Lo=function(i,n){return n<128?2*i*n/255:255*(1-2*(1-i/255)*(1-n/255))},Io=function(i,n){return 255*(1-(1-n/255)/(i/255))},Oo=function(i,n){return i===255?255:(i=255*(n/255)/(1-i/255),i>255?255:i)};Ce.normal=xe(Le(Po)),Ce.multiply=xe(Le(Mo)),Ce.screen=xe(Le(xo)),Ce.overlay=xe(Le(Lo)),Ce.darken=xe(Le(So)),Ce.lighten=xe(Le(No)),Ce.dodge=xe(Le(Oo)),Ce.burn=xe(Le(Io));for(var Ro=Ce,ai=y.type,Fo=y.clip_rgb,Do=y.TWOPI,qo=Math.pow,jo=Math.sin,Ho=Math.cos,jr=se,Vo=function(i,n,s,c,p){i===void 0&&(i=300),n===void 0&&(n=-1.5),s===void 0&&(s=1),c===void 0&&(c=1),p===void 0&&(p=[0,1]);var m=0,d;ai(p)==="array"?d=p[1]-p[0]:(d=0,p=[p,p]);var g=function(b){var v=Do*((i+120)/360+n*b),T=qo(p[0]+d*b,c),P=m!==0?s[0]+b*m:s,C=P*T*(1-T)/2,x=Ho(v),N=jo(v),V=T+C*(-.14861*x+1.78277*N),U=T+C*(-.29227*x-.90649*N),Y=T+C*(1.97294*x);return jr(Fo([V*255,U*255,Y*255,1]))};return g.start=function(b){return b==null?i:(i=b,g)},g.rotations=function(b){return b==null?n:(n=b,g)},g.gamma=function(b){return b==null?c:(c=b,g)},g.hue=function(b){return b==null?s:(s=b,ai(s)==="array"?(m=s[1]-s[0],m===0&&(s=s[1])):m=0,g)},g.lightness=function(b){return b==null?p:(ai(b)==="array"?(p=b,d=b[1]-b[0]):(p=[b,b],d=0),g)},g.scale=function(){return jr.scale(g)},g.hue(s),g},Bo=I,zo="0123456789abcdef",Uo=Math.floor,Wo=Math.random,Go=function(){for(var i="#",n=0;n<6;n++)i+=zo.charAt(Uo(Wo()*16));return new Bo(i,"hex")},si=k,Hr=Math.log,Yo=Math.pow,Ko=Math.floor,Xo=Math.abs,Vr=function(i,n){n===void 0&&(n=null);var s={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return si(i)==="object"&&(i=Object.values(i)),i.forEach(function(c){n&&si(c)==="object"&&(c=c[n]),c!=null&&!isNaN(c)&&(s.values.push(c),s.sum+=c,cs.max&&(s.max=c),s.count+=1)}),s.domain=[s.min,s.max],s.limits=function(c,p){return Br(s,c,p)},s},Br=function(i,n,s){n===void 0&&(n="equal"),s===void 0&&(s=7),si(i)=="array"&&(i=Vr(i));var c=i.min,p=i.max,m=i.values.sort(function(oi,ci){return oi-ci});if(s===1)return[c,p];var d=[];if(n.substr(0,1)==="c"&&(d.push(c),d.push(p)),n.substr(0,1)==="e"){d.push(c);for(var g=1;g 0");var b=Math.LOG10E*Hr(c),v=Math.LOG10E*Hr(p);d.push(c);for(var T=1;T200&&(ge=!1)}for(var Oe={},Je=0;Jec?(s+.05)/(c+.05):(c+.05)/(s+.05)},Wr=I,Pe=Math.sqrt,ce=Math.pow,Jo=Math.min,Zo=Math.max,Gr=Math.atan2,Yr=Math.abs,Ct=Math.cos,Kr=Math.sin,ec=Math.exp,Xr=Math.PI,tc=function(i,n,s,c,p){s===void 0&&(s=1),c===void 0&&(c=1),p===void 0&&(p=1);var m=function(je){return 360*je/(2*Xr)},d=function(je){return 2*Xr*je/360};i=new Wr(i),n=new Wr(n);var g=Array.from(i.lab()),b=g[0],v=g[1],T=g[2],P=Array.from(n.lab()),C=P[0],x=P[1],N=P[2],V=(b+C)/2,U=Pe(ce(v,2)+ce(T,2)),Y=Pe(ce(x,2)+ce(N,2)),J=(U+Y)/2,ge=.5*(1-Pe(ce(J,7)/(ce(J,7)+ce(25,7)))),de=v*(1+ge),we=x*(1+ge),G=Pe(ce(de,2)+ce(T,2)),$=Pe(ce(we,2)+ce(N,2)),O=(G+$)/2,z=m(Gr(T,de)),B=m(Gr(N,we)),be=z>=0?z:z+360,ae=B>=0?B:B+360,K=Yr(be-ae)>180?(be+ae+360)/2:(be+ae)/2,Z=1-.17*Ct(d(K-30))+.24*Ct(d(2*K))+.32*Ct(d(3*K+6))-.2*Ct(d(4*K-63)),ee=ae-be;ee=Yr(ee)<=180?ee:ae<=be?ee+360:ee-360,ee=2*Pe(G*$)*Kr(d(ee)/2);var ie=C-b,$e=$-G,Ie=1+.015*ce(V-50,2)/Pe(20+ce(V-50,2)),Oe=1+.045*O,Je=1+.015*O*Z,Ze=30*ec(-ce((K-275)/25,2)),Me=2*Pe(ce(O,7)/(ce(O,7)+ce(25,7))),qe=-Me*Kr(2*d(Ze)),nt=Pe(ce(ie/(s*Ie),2)+ce($e/(c*Oe),2)+ce(ee/(p*Je),2)+qe*($e/(c*Oe))*(ee/(p*Je)));return Zo(0,Jo(100,nt))},Qr=I,ic=function(i,n,s){s===void 0&&(s="lab"),i=new Qr(i),n=new Qr(n);var c=i.get(s),p=n.get(s),m=0;for(var d in c){var g=(c[d]||0)-(p[d]||0);m+=g*g}return Math.sqrt(m)},rc=I,nc=function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];try{return new(Function.prototype.bind.apply(rc,[null].concat(i))),!0}catch{return!1}},Jr=se,Zr=ri,ac={cool:function(){return Zr([Jr.hsl(180,1,.9),Jr.hsl(250,.7,.4)])},hot:function(){return Zr(["#000","#f00","#ff0","#fff"]).mode("rgb")}},$t={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},li=0,en=Object.keys($t);li{Alpine.store("player").playing=!0}),et.on("pause",e=>{Alpine.store("player").playing=!1}),et.on("ended",e=>{Alpine.store("player").playing=!1})},playEpisode(e,r,t,a){this.audio_file!==r&&(et.source={type:"audio",title:e,audio_file:r,sources:[{src:r,type:t}]}),this.toggle(r),this.title=e,this.audio_file=r,this.episode_url=a,this.show=!0},toggle(e){if(this.playing&&e===this.audio_file){et.pause(),Alpine.store("player").playing=!1;return}et.togglePlay()}}); diff --git a/public/build/assets/site-381f6df3.js b/public/build/assets/site-381f6df3.js deleted file mode 100644 index 9027cb1..0000000 --- a/public/build/assets/site-381f6df3.js +++ /dev/null @@ -1,86 +0,0 @@ -(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;const e=HTMLElement,t={HTMLElement:function(){return Reflect.construct(e,[],this.constructor)}};window.HTMLElement=t.HTMLElement,HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)})();(function(e){if(typeof e.requestSubmit=="function")return;e.requestSubmit=function(i){i?(t(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function t(i,n){i instanceof HTMLElement||r(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||r(TypeError,"The specified element is not a submit button"),i.form==n||r(DOMException,"The specified element is not owned by this form element","NotFoundError")}function r(i,n,s){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+n+".",s)}})(HTMLFormElement.prototype);const Xa=new WeakMap;function Cf(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null,r=t?t.closest("input, button"):null;return(r==null?void 0:r.type)=="submit"?r:null}function Af(e){const t=Cf(e.target);t&&t.form&&Xa.set(t.form,t)}(function(){if("submitter"in Event.prototype)return;let e=window.Event.prototype;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))e=window.SubmitEvent.prototype;else if("SubmitEvent"in window)return;addEventListener("click",Af,!0),Object.defineProperty(e,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Xa.get(this.target)}})})();var it;(function(e){e.eager="eager",e.lazy="lazy"})(it||(it={}));class Ke extends HTMLElement{static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new Ke.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){t=="loading"?this.delegate.loadingStyleChanged():t=="complete"?this.delegate.completeChanged():t=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get loading(){return xf(this.getAttribute("loading")||"")}set loading(t){t?this.setAttribute("loading",t):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(t){t?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var t,r;return(r=(t=this.ownerDocument)===null||t===void 0?void 0:t.documentElement)===null||r===void 0?void 0:r.hasAttribute("data-turbo-preview")}}function xf(e){switch(e.toLowerCase()){case"lazy":return it.lazy;default:return it.eager}}function Te(e){return new URL(e.toString(),document.baseURI)}function bt(e){let t;if(e.hash)return e.hash.slice(1);if(t=e.href.match(/#(.*)$/))return t[1]}function _n(e,t){const r=(t==null?void 0:t.getAttribute("formaction"))||e.getAttribute("action")||e.action;return Te(r)}function Pf(e){return(If(e).match(/\.[^.]*$/)||[])[0]||""}function Lf(e){return!!Pf(e).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function Mf(e,t){const r=Nf(t);return e.href===Te(r).href||e.href.startsWith(r)}function Ft(e,t){return Mf(e,t)&&Lf(e)}function zi(e){const t=bt(e);return t!=null?e.href.slice(0,-(t.length+1)):e.href}function xr(e){return zi(e)}function Rf(e,t){return Te(e).href==Te(t).href}function $f(e){return e.pathname.split("/").slice(1)}function If(e){return $f(e).slice(-1)[0]}function Nf(e){return Of(e.origin+e.pathname)}function Of(e){return e.endsWith("/")?e:e+"/"}class Sn{constructor(t){this.response=t}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return Te(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(t){return this.response.headers.get(t)}}function ir(e){if(e.getAttribute("data-turbo-eval")=="false")return e;{const t=document.createElement("script"),r=Or("csp-nonce");return r&&(t.nonce=r),t.textContent=e.textContent,t.async=!1,Ff(t,e),t}}function Ff(e,t){for(const{name:r,value:i}of t.attributes)e.setAttribute(r,i)}function Hf(e){const t=document.createElement("template");return t.innerHTML=e,t.content}function Se(e,{target:t,cancelable:r,detail:i}={}){const n=new CustomEvent(e,{cancelable:r,bubbles:!0,composed:!0,detail:i});return t&&t.isConnected?t.dispatchEvent(n):document.documentElement.dispatchEvent(n),n}function Lr(){return new Promise(e=>requestAnimationFrame(()=>e()))}function qf(){return new Promise(e=>setTimeout(()=>e(),0))}function Df(){return Promise.resolve()}function Ja(e=""){return new DOMParser().parseFromString(e,"text/html")}function Qa(e,...t){const r=Bf(e,t).replace(/^\n/,"").split(` -`),i=r[0].match(/^\s+/),n=i?i[0].length:0;return r.map(s=>s.slice(n)).join(` -`)}function Bf(e,t){return e.reduce((r,i,n)=>{const s=t[n]==null?"":t[n];return r+i+s},"")}function Ht(){return Array.from({length:36}).map((e,t)=>t==8||t==13||t==18||t==23?"-":t==14?"4":t==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function Nr(e,...t){for(const r of t.map(i=>i==null?void 0:i.getAttribute(e)))if(typeof r=="string")return r;return null}function jf(e,...t){return t.some(r=>r&&r.hasAttribute(e))}function Ki(...e){for(const t of e)t.localName=="turbo-frame"&&t.setAttribute("busy",""),t.setAttribute("aria-busy","true")}function Gi(...e){for(const t of e)t.localName=="turbo-frame"&&t.removeAttribute("busy"),t.removeAttribute("aria-busy")}function Vf(e,t=2e3){return new Promise(r=>{const i=()=>{e.removeEventListener("error",i),e.removeEventListener("load",i),r()};e.addEventListener("load",i,{once:!0}),e.addEventListener("error",i,{once:!0}),setTimeout(r,t)})}function Za(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Wf(e){return e=="advance"||e=="replace"||e=="restore"}function Ur(...e){const t=Nr("data-turbo-action",...e);return Wf(t)?t:null}function eo(e){return document.querySelector(`meta[name="${e}"]`)}function Or(e){const t=eo(e);return t&&t.content}function Uf(e,t){let r=eo(e);return r||(r=document.createElement("meta"),r.setAttribute("name",e),document.head.appendChild(r)),r.setAttribute("content",t),r}function Fr(e,t){var r;if(e instanceof Element)return e.closest(t)||Fr(e.assignedSlot||((r=e.getRootNode())===null||r===void 0?void 0:r.host),t)}var xe;(function(e){e[e.get=0]="get",e[e.post=1]="post",e[e.put=2]="put",e[e.patch=3]="patch",e[e.delete=4]="delete"})(xe||(xe={}));function zf(e){switch(e.toLowerCase()){case"get":return xe.get;case"post":return xe.post;case"put":return xe.put;case"patch":return xe.patch;case"delete":return xe.delete}}class kn{constructor(t,r,i,n=new URLSearchParams,s=null){this.abortController=new AbortController,this.resolveRequestPromise=l=>{},this.delegate=t,this.method=r,this.headers=this.defaultHeaders,this.body=n,this.url=i,this.target=s}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:t}=this;this.delegate.prepareRequest(this),await this.allowRequestToBeIntercepted(t);try{this.delegate.requestStarted(this);const r=await fetch(this.url.href,t);return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.willDelegateErrorHandling(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(t){const r=new Sn(t);return Se("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:r},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,r):r.succeeded?this.delegate.requestSucceededWithResponse(this,r):this.delegate.requestFailedWithResponse(this,r),r}get fetchOptions(){var t;return{method:xe[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isSafe?null:this.body,signal:this.abortSignal,referrer:(t=this.delegate.referrer)===null||t===void 0?void 0:t.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return this.method===xe.get}get abortSignal(){return this.abortController.signal}acceptResponseType(t){this.headers.Accept=[t,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(t){const r=new Promise(n=>this.resolveRequestPromise=n);Se("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:t,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await r}willDelegateErrorHandling(t){return!Se("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:t}}).defaultPrevented}}class Kf{constructor(t,r){this.started=!1,this.intersect=i=>{const n=i.slice(-1)[0];n!=null&&n.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=t,this.element=r,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}}class St{static wrap(t){return typeof t=="string"?new this(Hf(t)):t}constructor(t){this.fragment=Gf(t)}}St.contentType="text/vnd.turbo-stream.html";function Gf(e){for(const t of e.querySelectorAll("turbo-stream")){const r=document.importNode(t,!0);for(const i of r.templateElement.content.querySelectorAll("script"))i.replaceWith(ir(i));t.replaceWith(r)}return e}var Ze;(function(e){e[e.initialized=0]="initialized",e[e.requesting=1]="requesting",e[e.waiting=2]="waiting",e[e.receiving=3]="receiving",e[e.stopping=4]="stopping",e[e.stopped=5]="stopped"})(Ze||(Ze={}));var et;(function(e){e.urlEncoded="application/x-www-form-urlencoded",e.multipart="multipart/form-data",e.plain="text/plain"})(et||(et={}));function Yf(e){switch(e.toLowerCase()){case et.multipart:return et.multipart;case et.plain:return et.plain;default:return et.urlEncoded}}class ur{static confirmMethod(t,r,i){return Promise.resolve(confirm(t))}constructor(t,r,i,n=!1){this.state=Ze.initialized,this.delegate=t,this.formElement=r,this.submitter=i,this.formData=Xf(r,i),this.location=Te(this.action),this.method==xe.get&&Zf(this.location,[...this.body.entries()]),this.fetchRequest=new kn(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=n}get method(){var t;const r=((t=this.submitter)===null||t===void 0?void 0:t.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return zf(r.toLowerCase())||xe.get}get action(){var t;const r=typeof this.formElement.action=="string"?this.formElement.action:null;return!((t=this.submitter)===null||t===void 0)&&t.hasAttribute("formaction")?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||r||""}get body(){return this.enctype==et.urlEncoded||this.method==xe.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var t;return Yf(((t=this.submitter)===null||t===void 0?void 0:t.getAttribute("formenctype"))||this.formElement.enctype)}get isSafe(){return this.fetchRequest.isSafe}get stringFormData(){return[...this.formData].reduce((t,[r,i])=>t.concat(typeof i=="string"?[[r,i]]:[]),[])}async start(){const{initialized:t,requesting:r}=Ze,i=Nr("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await ur.confirmMethod(i,this.formElement,this.submitter))&&this.state==t)return this.state=r,this.fetchRequest.perform()}stop(){const{stopping:t,stopped:r}=Ze;if(this.state!=t&&this.state!=r)return this.state=t,this.fetchRequest.cancel(),!0}prepareRequest(t){if(!t.isSafe){const r=Jf(Or("csrf-param"))||Or("csrf-token");r&&(t.headers["X-CSRF-Token"]=r)}this.requestAcceptsTurboStreamResponse(t)&&t.acceptResponseType(St.contentType)}requestStarted(t){var r;this.state=Ze.waiting,(r=this.submitter)===null||r===void 0||r.setAttribute("disabled",""),this.setSubmitsWith(),Se("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(t,r){this.result={success:r.succeeded,fetchResponse:r}}requestSucceededWithResponse(t,r){if(r.clientError||r.serverError)this.delegate.formSubmissionFailedWithResponse(this,r);else if(this.requestMustRedirect(t)&&Qf(r)){const i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=Ze.receiving,this.result={success:!0,fetchResponse:r},this.delegate.formSubmissionSucceededWithResponse(this,r)}requestFailedWithResponse(t,r){this.result={success:!1,fetchResponse:r},this.delegate.formSubmissionFailedWithResponse(this,r)}requestErrored(t,r){this.result={success:!1,error:r},this.delegate.formSubmissionErrored(this,r)}requestFinished(t){var r;this.state=Ze.stopped,(r=this.submitter)===null||r===void 0||r.removeAttribute("disabled"),this.resetSubmitterText(),Se("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){const t=this.submitter;this.originalSubmitText=t.value,t.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){const t=this.submitter;t.value=this.originalSubmitText}}}requestMustRedirect(t){return!t.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(t){return!t.isSafe||jf("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var t;return(t=this.submitter)===null||t===void 0?void 0:t.getAttribute("data-turbo-submits-with")}}function Xf(e,t){const r=new FormData(e),i=t==null?void 0:t.getAttribute("name"),n=t==null?void 0:t.getAttribute("value");return i&&r.append(i,n||""),r}function Jf(e){if(e!=null){const r=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(e));if(r){const i=r.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function Qf(e){return e.statusCode==200&&!e.redirected}function Zf(e,t){const r=new URLSearchParams;for(const[i,n]of t)n instanceof File||r.append(i,n);return e.search=r.toString(),e}class zr{constructor(t){this.element=t}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(t){return this.getElementForAnchor(t)!=null}getElementForAnchor(t){return t?this.element.querySelector(`[id='${t}'], a[name='${t}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){const t="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";for(const r of this.element.querySelectorAll("[autofocus]"))if(r.closest(t)==null)return r;return null}get permanentElements(){return ro(this.element)}getPermanentElementById(t){return to(this.element,t)}getPermanentElementMapForSnapshot(t){const r={};for(const i of this.permanentElements){const{id:n}=i,s=t.getPermanentElementById(n);s&&(r[n]=[i,s])}return r}}function to(e,t){return e.querySelector(`#${t}[data-turbo-permanent]`)}function ro(e){return e.querySelectorAll("[id][data-turbo-permanent]")}class Tn{constructor(t,r){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=i=>{if(!i.defaultPrevented){const n=i.target instanceof HTMLFormElement?i.target:void 0,s=i.submitter||void 0;n&&ep(n,s)&&tp(n,s)&&this.delegate.willSubmitForm(n,s)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmitted(n,s))}},this.delegate=t,this.eventTarget=r}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}}function ep(e,t){return((t==null?void 0:t.getAttribute("formmethod"))||e.getAttribute("method"))!="dialog"}function tp(e,t){if(t!=null&&t.hasAttribute("formtarget")||e.hasAttribute("target")){const r=(t==null?void 0:t.getAttribute("formtarget"))||e.target;for(const i of document.getElementsByName(r))if(i instanceof HTMLIFrameElement)return!1;return!0}else return!0}class io{constructor(t,r){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},this.delegate=t,this.element=r}scrollToAnchor(t){const r=this.snapshot.getElementForAnchor(t);r?(this.scrollToElement(r),this.focusElement(r)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(t){this.scrollToAnchor(bt(t))}scrollToElement(t){t.scrollIntoView()}focusElement(t){t instanceof HTMLElement&&(t.hasAttribute("tabindex")?t.focus():(t.setAttribute("tabindex","-1"),t.focus(),t.removeAttribute("tabindex")))}scrollToPosition({x:t,y:r}){this.scrollRoot.scrollTo(t,r)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(t){const{isPreview:r,shouldRender:i,newSnapshot:n}=t;if(i)try{this.renderPromise=new Promise(f=>this.resolveRenderPromise=f),this.renderer=t,await this.prepareToRenderSnapshot(t);const s=new Promise(f=>this.resolveInterceptionPromise=f),l={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(n,l)||await s,await this.renderSnapshot(t),this.delegate.viewRenderedSnapshot(n,r),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(t)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(t.reloadReason)}invalidate(t){this.delegate.viewInvalidated(t)}async prepareToRenderSnapshot(t){this.markAsPreview(t.isPreview),await t.prepareToRender()}markAsPreview(t){t?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(t){await t.render()}finishRenderingSnapshot(t){t.finishRendering()}}class rp extends io{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new zr(this.element)}}class no{constructor(t,r){this.clickBubbled=i=>{this.respondsToEventTarget(i.target)?this.clickEvent=i:delete this.clickEvent},this.linkClicked=i=>{this.clickEvent&&this.respondsToEventTarget(i.target)&&i.target instanceof Element&&this.delegate.shouldInterceptLinkClick(i.target,i.detail.url,i.detail.originalEvent)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url,i.detail.originalEvent)),delete this.clickEvent},this.willVisit=i=>{delete this.clickEvent},this.delegate=t,this.element=r}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(t){const r=t instanceof Element?t:t instanceof Node?t.parentElement:null;return r&&r.closest("turbo-frame, html")==this.element}}class so{constructor(t,r){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=i=>{if(i instanceof MouseEvent&&this.clickEventIsSignificant(i)){const n=i.composedPath&&i.composedPath()[0]||i.target,s=this.findLinkFromClickTarget(n);if(s&&ip(s)){const l=this.getLocationForLink(s);this.delegate.willFollowLinkToLocation(s,l,i)&&(i.preventDefault(),this.delegate.followedLinkToLocation(s,l))}}},this.delegate=t,this.eventTarget=r}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(t){return!(t.target&&t.target.isContentEditable||t.defaultPrevented||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)}findLinkFromClickTarget(t){return Fr(t,"a[href]:not([target^=_]):not([download])")}getLocationForLink(t){return Te(t.getAttribute("href")||"")}}function ip(e){if(e.hasAttribute("target")){for(const t of document.getElementsByName(e.target))if(t instanceof HTMLIFrameElement)return!1;return!0}else return!0}class ao{constructor(t,r){this.delegate=t,this.linkInterceptor=new so(this,r)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(t,r,i){return this.delegate.willSubmitFormLinkToLocation(t,r,i)&&t.hasAttribute("data-turbo-method")}followedLinkToLocation(t,r){const i=document.createElement("form"),n="hidden";for(const[T,_]of r.searchParams)i.append(Object.assign(document.createElement("input"),{type:n,name:T,value:_}));const s=Object.assign(r,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",s.href),i.setAttribute("hidden","");const l=t.getAttribute("data-turbo-method");l&&i.setAttribute("method",l);const u=t.getAttribute("data-turbo-frame");u&&i.setAttribute("data-turbo-frame",u);const f=Ur(t);f&&i.setAttribute("data-turbo-action",f);const v=t.getAttribute("data-turbo-confirm");v&&i.setAttribute("data-turbo-confirm",v),t.hasAttribute("data-turbo-stream")&&i.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(t,r,i),document.body.appendChild(i),i.addEventListener("turbo:submit-end",()=>i.remove(),{once:!0}),requestAnimationFrame(()=>i.requestSubmit())}}class oo{static async preservingPermanentElements(t,r,i){const n=new this(t,r);n.enter(),await i(),n.leave()}constructor(t,r){this.delegate=t,this.permanentElementMap=r}enter(){for(const t in this.permanentElementMap){const[r,i]=this.permanentElementMap[t];this.delegate.enteringBardo(r,i),this.replaceNewPermanentElementWithPlaceholder(i)}}leave(){for(const t in this.permanentElementMap){const[r]=this.permanentElementMap[t];this.replaceCurrentPermanentElementWithClone(r),this.replacePlaceholderWithPermanentElement(r),this.delegate.leavingBardo(r)}}replaceNewPermanentElementWithPlaceholder(t){const r=np(t);t.replaceWith(r)}replaceCurrentPermanentElementWithClone(t){const r=t.cloneNode(!0);t.replaceWith(r)}replacePlaceholderWithPermanentElement(t){const r=this.getPlaceholderById(t.id);r==null||r.replaceWith(t)}getPlaceholderById(t){return this.placeholders.find(r=>r.content==t)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}function np(e){const t=document.createElement("meta");return t.setAttribute("name","turbo-permanent-placeholder"),t.setAttribute("content",e.id),t}class Cn{constructor(t,r,i,n,s=!0){this.activeElement=null,this.currentSnapshot=t,this.newSnapshot=r,this.isPreview=n,this.willRender=s,this.renderElement=i,this.promise=new Promise((l,u)=>this.resolvingFunctions={resolve:l,reject:u})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(t){await oo.preservingPermanentElements(this,this.permanentElementMap,t)}focusFirstAutofocusableElement(){const t=this.connectedSnapshot.firstAutofocusableElement;sp(t)&&t.focus()}enteringBardo(t){this.activeElement||t.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(t){t.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}}function sp(e){return e&&typeof e.focus=="function"}class Yi extends Cn{static renderElement(t,r){var i;const n=document.createRange();n.selectNodeContents(t),n.deleteContents();const s=r,l=(i=s.ownerDocument)===null||i===void 0?void 0:i.createRange();l&&(l.selectNodeContents(s),t.appendChild(l.extractContents()))}constructor(t,r,i,n,s,l=!0){super(r,i,n,s,l),this.delegate=t}get shouldRender(){return!0}async render(){await Lr(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await Lr(),this.focusFirstAutofocusableElement(),await Lr(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){const t=this.currentElement.firstElementChild,r=ap(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=op(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(t)return t.scrollIntoView({block:r,behavior:i}),!0}return!1}activateScriptElements(){for(const t of this.newScriptElements){const r=ir(t);t.replaceWith(r)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}function ap(e,t){return e=="end"||e=="start"||e=="center"||e=="nearest"?e:t}function op(e,t){return e=="auto"||e=="smooth"?e:t}class We{static get defaultCSS(){return Qa` - .turbo-progress-bar { - position: fixed; - display: block; - top: 0; - left: 0; - height: 3px; - background: #0076ff; - z-index: 2147483647; - transition: - width ${We.animationDuration}ms ease-out, - opacity ${We.animationDuration/2}ms ${We.animationDuration/2}ms ease-in; - transform: translate3d(0, 0, 0); - } - `}constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(t){this.value=t,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(t){this.progressElement.style.opacity="0",setTimeout(t,We.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,We.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){const t=document.createElement("style");return t.type="text/css",t.textContent=We.defaultCSS,this.cspNonce&&(t.nonce=this.cspNonce),t}createProgressElement(){const t=document.createElement("div");return t.className="turbo-progress-bar",t}get cspNonce(){return Or("csp-nonce")}}We.animationDuration=300;class lp extends zr{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter(t=>!dp(t)).map(t=>mp(t)).reduce((t,r)=>{const{outerHTML:i}=r,n=i in t?t[i]:{type:cp(r),tracked:up(r),elements:[]};return Object.assign(Object.assign({},t),{[i]:Object.assign(Object.assign({},n),{elements:[...n.elements,r]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(t=>this.detailsByOuterHTML[t].tracked).join("")}getScriptElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("script",t)}getStylesheetElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",t)}getElementsMatchingTypeNotInSnapshot(t,r){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in r.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==t).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{const{type:i,tracked:n,elements:s}=this.detailsByOuterHTML[r];return i==null&&!n?[...t,...s]:s.length>1?[...t,...s.slice(1)]:t},[])}getMetaValue(t){const r=this.findMetaElementByName(t);return r?r.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce((r,i)=>{const{elements:[n]}=this.detailsByOuterHTML[i];return pp(n,t)?n:r},void 0)}}function cp(e){if(hp(e))return"script";if(fp(e))return"stylesheet"}function up(e){return e.getAttribute("data-turbo-track")=="reload"}function hp(e){return e.localName=="script"}function dp(e){return e.localName=="noscript"}function fp(e){const t=e.localName;return t=="style"||t=="link"&&e.getAttribute("rel")=="stylesheet"}function pp(e,t){return e.localName=="meta"&&e.getAttribute("name")==t}function mp(e){return e.hasAttribute("nonce")&&e.setAttribute("nonce",""),e}class Ne extends zr{static fromHTMLString(t=""){return this.fromDocument(Ja(t))}static fromElement(t){return this.fromDocument(t.ownerDocument)}static fromDocument({head:t,body:r}){return new this(r,new lp(t))}constructor(t,r){super(t),this.headSnapshot=r}clone(){const t=this.element.cloneNode(!0),r=this.element.querySelectorAll("select"),i=t.querySelectorAll("select");for(const[n,s]of r.entries()){const l=i[n];for(const u of l.selectedOptions)u.selected=!1;for(const u of s.selectedOptions)l.options[u.index].selected=!0}for(const n of t.querySelectorAll('input[type="password"]'))n.value="";return new Ne(t,this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var t;const r=(t=this.getSetting("root"))!==null&&t!==void 0?t:"/";return Te(r)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(t){return this.headSnapshot.getMetaValue(`turbo-${t}`)}}var Ot;(function(e){e.visitStart="visitStart",e.requestStart="requestStart",e.requestEnd="requestEnd",e.visitEnd="visitEnd"})(Ot||(Ot={}));var $e;(function(e){e.initialized="initialized",e.started="started",e.canceled="canceled",e.failed="failed",e.completed="completed"})($e||($e={}));const gp={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1};var at;(function(e){e[e.networkFailure=0]="networkFailure",e[e.timeoutFailure=-1]="timeoutFailure",e[e.contentTypeMismatch=-2]="contentTypeMismatch"})(at||(at={}));class vp{constructor(t,r,i,n={}){this.identifier=Ht(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.shouldCacheSnapshot=!0,this.acceptsStreamResponse=!1,this.snapshotCached=!1,this.state=$e.initialized,this.delegate=t,this.location=r,this.restorationIdentifier=i||Ht();const{action:s,historyChanged:l,referrer:u,snapshot:f,snapshotHTML:v,response:w,visitCachedSnapshot:T,willRender:_,updateHistory:N,shouldCacheSnapshot:H,acceptsStreamResponse:S}=Object.assign(Object.assign({},gp),n);this.action=s,this.historyChanged=l,this.referrer=u,this.snapshot=f,this.snapshotHTML=v,this.response=w,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=T,this.willRender=_,this.updateHistory=N,this.scrolled=!_,this.shouldCacheSnapshot=H,this.acceptsStreamResponse=S}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==$e.initialized&&(this.recordTimingMetric(Ot.visitStart),this.state=$e.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==$e.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=$e.canceled)}complete(){this.state==$e.started&&(this.recordTimingMetric(Ot.visitEnd),this.state=$e.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==$e.started&&(this.state=$e.failed,this.adapter.visitFailed(this))}changeHistory(){var t;if(!this.historyChanged&&this.updateHistory){const r=this.location.href===((t=this.referrer)===null||t===void 0?void 0:t.href)?"replace":this.action,i=Za(r);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new kn(this,xe.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Ot.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(t=this.response){if(this.response=t,t){const{statusCode:r}=t;xa(r)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,r)}}finishRequest(){this.recordTimingMetric(Ot.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){const{statusCode:t,responseHTML:r}=this.response;this.render(async()=>{this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,xa(t)&&r!=null?(await this.view.renderPage(Ne.fromHTMLString(r),!1,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(Ne.fromHTMLString(r),this),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){const t=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(t&&(!bt(this.location)||t.hasAnchor(bt(this.location)))&&(this.action=="restore"||t.isPreviewable))return t}getPreloadedSnapshot(){if(this.snapshotHTML)return Ne.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){const t=this.getCachedSnapshot();if(t){const r=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(t,r,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),r||this.complete())})}}followRedirect(){var t;this.redirectedToLocation&&!this.followedRedirect&&(!((t=this.response)===null||t===void 0)&&t.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(t){this.acceptsStreamResponse&&t.acceptResponseType(St.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(t,r){}async requestSucceededWithResponse(t,r){const i=await r.responseHTML,{redirected:n,statusCode:s}=r;i==null?this.recordResponse({statusCode:at.contentTypeMismatch,redirected:n}):(this.redirectedToLocation=r.redirected?r.location:void 0,this.recordResponse({statusCode:s,responseHTML:i,redirected:n}))}async requestFailedWithResponse(t,r){const i=await r.responseHTML,{redirected:n,statusCode:s}=r;i==null?this.recordResponse({statusCode:at.contentTypeMismatch,redirected:n}):this.recordResponse({statusCode:s,responseHTML:i,redirected:n})}requestErrored(t,r){this.recordResponse({statusCode:at.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){const{scrollPosition:t}=this.restorationData;if(t)return this.view.scrollToPosition(t),!0}scrollToAnchor(){const t=bt(this.location);if(t!=null)return this.view.scrollToAnchor(t),!0}recordTimingMetric(t){this.timingMetrics[t]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(t){switch(t){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(t=>t&&this.visitCachedSnapshot(t)),this.snapshotCached=!0)}async render(t){this.cancelRender(),await new Promise(r=>{this.frame=requestAnimationFrame(()=>r())}),await t(),delete this.frame}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}}function xa(e){return e>=200&&e<300}class bp{constructor(t){this.progressBar=new We,this.showProgressBar=()=>{this.progressBar.show()},this.session=t}visitProposedToLocation(t,r){this.navigator.startVisit(t,(r==null?void 0:r.restorationIdentifier)||Ht(),r)}visitStarted(t){this.location=t.location,t.loadCachedSnapshot(),t.issueRequest(),t.goToSamePageAnchor()}visitRequestStarted(t){this.progressBar.setValue(0),t.hasCachedSnapshot()||t.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(t){t.loadResponse()}visitRequestFailedWithStatusCode(t,r){switch(r){case at.networkFailure:case at.timeoutFailure:case at.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:r}});default:return t.loadResponse()}}visitRequestFinished(t){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(t){}pageInvalidated(t){this.reload(t)}visitFailed(t){}visitRendered(t){}formSubmissionStarted(t){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(t){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(t){var r;Se("turbo:reload",{detail:t}),window.location.href=((r=this.location)===null||r===void 0?void 0:r.toString())||window.location.href}get navigator(){return this.session.navigator}}class yp{constructor(){this.selector="[data-turbo-temporary]",this.deprecatedSelector="[data-turbo-cache=false]",this.started=!1,this.removeTemporaryElements=t=>{for(const r of this.temporaryElements)r.remove()}}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){const t=document.querySelectorAll(this.deprecatedSelector);return t.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...t]}}class wp{constructor(t,r){this.session=t,this.element=r,this.linkInterceptor=new no(this,r),this.formSubmitObserver=new Tn(this,r)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(t,r,i){return this.shouldRedirect(t)}linkClickIntercepted(t,r,i){const n=this.findFrameElement(t);n&&n.delegate.linkClickIntercepted(t,r,i)}willSubmitForm(t,r){return t.closest("turbo-frame")==null&&this.shouldSubmit(t,r)&&this.shouldRedirect(t,r)}formSubmitted(t,r){const i=this.findFrameElement(t,r);i&&i.delegate.formSubmitted(t,r)}shouldSubmit(t,r){var i;const n=_n(t,r),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),l=Te((i=s==null?void 0:s.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(t,r)&&Ft(n,l)}shouldRedirect(t,r){if(t instanceof HTMLFormElement?this.session.submissionIsNavigatable(t,r):this.session.elementIsNavigatable(t)){const n=this.findFrameElement(t,r);return n?n!=t.closest("turbo-frame"):!1}else return!1}findFrameElement(t,r){const i=(r==null?void 0:r.getAttribute("data-turbo-frame"))||t.getAttribute("data-turbo-frame");if(i&&i!="_top"){const n=this.element.querySelector(`#${i}:not([disabled])`);if(n instanceof Ke)return n}}}class Ep{constructor(t){this.restorationIdentifier=Ht(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=r=>{if(this.shouldHandlePopState()){const{turbo:i}=r.state||{};if(i){this.location=new URL(window.location.href);const{restorationIdentifier:n}=i;this.restorationIdentifier=n,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,n)}}},this.onPageLoad=async r=>{await Df(),this.pageLoaded=!0},this.delegate=t}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(t,r){this.update(history.pushState,t,r)}replace(t,r){this.update(history.replaceState,t,r)}update(t,r,i=Ht()){const n={turbo:{restorationIdentifier:i}};t.call(history,n,"",r.href),this.location=r,this.restorationIdentifier=i}getRestorationDataForIdentifier(t){return this.restorationData[t]||{}}updateRestorationData(t){const{restorationIdentifier:r}=this,i=this.restorationData[r];this.restorationData[r]=Object.assign(Object.assign({},i),t)}assumeControlOfScrollRestoration(){var t;this.previousScrollRestoration||(this.previousScrollRestoration=(t=history.scrollRestoration)!==null&&t!==void 0?t:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}}class _p{constructor(t){this.delegate=t}proposeVisit(t,r={}){this.delegate.allowsVisitingLocationWithAction(t,r.action)&&(Ft(t,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(t,r):window.location.href=t.toString())}startVisit(t,r,i={}){this.stop(),this.currentVisit=new vp(this,Te(t),r,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(t,r){this.stop(),this.formSubmission=new ur(this,t,r,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(t){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(t)}async formSubmissionSucceededWithResponse(t,r){if(t==this.formSubmission){const i=await r.responseHTML;if(i){const n=t.isSafe;n||this.view.clearSnapshotCache();const{statusCode:s,redirected:l}=r,f={action:this.getActionForFormSubmission(t),shouldCacheSnapshot:n,response:{statusCode:s,responseHTML:i,redirected:l}};this.proposeVisit(r.location,f)}}}async formSubmissionFailedWithResponse(t,r){const i=await r.responseHTML;if(i){const n=Ne.fromHTMLString(i);r.serverError?await this.view.renderError(n,this.currentVisit):await this.view.renderPage(n,!1,!0,this.currentVisit),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(t,r){console.error(r)}formSubmissionFinished(t){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(t)}visitStarted(t){this.delegate.visitStarted(t)}visitCompleted(t){this.delegate.visitCompleted(t)}locationWithActionIsSamePage(t,r){const i=bt(t),n=bt(this.view.lastRenderedLocation),s=r==="restore"&&typeof i>"u";return r!=="replace"&&zi(t)===zi(this.view.lastRenderedLocation)&&(s||i!=null&&i!==n)}visitScrolledToSamePageLocation(t,r){this.delegate.visitScrolledToSamePageLocation(t,r)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission({submitter:t,formElement:r}){return Ur(t,r)||"advance"}}var Ve;(function(e){e[e.initial=0]="initial",e[e.loading=1]="loading",e[e.interactive=2]="interactive",e[e.complete=3]="complete"})(Ve||(Ve={}));class Sp{constructor(t){this.stage=Ve.initial,this.started=!1,this.interpretReadyState=()=>{const{readyState:r}=this;r=="interactive"?this.pageIsInteractive():r=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=t}start(){this.started||(this.stage==Ve.initial&&(this.stage=Ve.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==Ve.loading&&(this.stage=Ve.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Ve.interactive&&(this.stage=Ve.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}}class kp{constructor(t){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=t}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(t){this.delegate.scrollPositionChanged(t)}}class Tp{render({fragment:t}){oo.preservingPermanentElements(this,Cp(t),()=>document.documentElement.appendChild(t))}enteringBardo(t,r){r.replaceWith(t.cloneNode(!0))}leavingBardo(){}}function Cp(e){const t=ro(document.documentElement),r={};for(const i of t){const{id:n}=i;for(const s of e.querySelectorAll("turbo-stream")){const l=to(s.templateElement.content,n);l&&(r[n]=[i,l])}}return r}class Ap{constructor(t){this.sources=new Set,this.started=!1,this.inspectFetchResponse=r=>{const i=xp(r);i&&Pp(i)&&(r.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=r=>{this.started&&typeof r.data=="string"&&this.receiveMessageHTML(r.data)},this.delegate=t}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(t){this.streamSourceIsConnected(t)||(this.sources.add(t),t.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(t){this.streamSourceIsConnected(t)&&(this.sources.delete(t),t.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(t){return this.sources.has(t)}async receiveMessageResponse(t){const r=await t.responseHTML;r&&this.receiveMessageHTML(r)}receiveMessageHTML(t){this.delegate.receivedMessageFromStream(St.wrap(t))}}function xp(e){var t;const r=(t=e.detail)===null||t===void 0?void 0:t.fetchResponse;if(r instanceof Sn)return r}function Pp(e){var t;return((t=e.contentType)!==null&&t!==void 0?t:"").startsWith(St.contentType)}class Pa extends Cn{static renderElement(t,r){const{documentElement:i,body:n}=document;i.replaceChild(r,n)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){const{documentElement:t,head:r}=document;t.replaceChild(this.newHead,r),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(const t of this.scriptElements){const r=t.parentNode;if(r){const i=ir(t);r.replaceChild(i,t)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}class Xi extends Cn{static renderElement(t,r){document.body&&r instanceof HTMLBodyElement?document.body.replaceWith(r):document.documentElement.appendChild(r)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}async mergeHead(){const t=this.mergeProvisionalElements(),r=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await t,await r}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){const t=[];for(const r of this.newHeadStylesheetElements)t.push(Vf(r)),document.head.appendChild(r);await Promise.all(t)}copyNewHeadScriptElements(){for(const t of this.newHeadScriptElements)document.head.appendChild(ir(t))}async mergeProvisionalElements(){const t=[...this.newHeadProvisionalElements];for(const r of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(r,t)||document.head.removeChild(r);for(const r of t)document.head.appendChild(r)}isCurrentElementInElementList(t,r){for(const[i,n]of r.entries()){if(t.tagName=="TITLE"){if(n.tagName!="TITLE")continue;if(t.innerHTML==n.innerHTML)return r.splice(i,1),!0}if(n.isEqualNode(t))return r.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(const t of this.currentHeadProvisionalElements)document.head.removeChild(t)}copyNewHeadProvisionalElements(){for(const t of this.newHeadProvisionalElements)document.head.appendChild(t)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(const t of this.newBodyScriptElements){const r=ir(t);t.replaceWith(r)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}}class Lp{constructor(t){this.keys=[],this.snapshots={},this.size=t}has(t){return xr(t)in this.snapshots}get(t){if(this.has(t)){const r=this.read(t);return this.touch(t),r}}put(t,r){return this.write(t,r),this.touch(t),r}clear(){this.snapshots={}}read(t){return this.snapshots[xr(t)]}write(t,r){this.snapshots[xr(t)]=r}touch(t){const r=xr(t),i=this.keys.indexOf(r);i>-1&&this.keys.splice(i,1),this.keys.unshift(r),this.trim()}trim(){for(const t of this.keys.splice(this.size))delete this.snapshots[t]}}class Mp extends io{constructor(){super(...arguments),this.snapshotCache=new Lp(10),this.lastRenderedLocation=new URL(location.href),this.forceReloaded=!1}renderPage(t,r=!1,i=!0,n){const s=new Xi(this.snapshot,t,Xi.renderElement,r,i);return s.shouldRender?n==null||n.changeHistory():this.forceReloaded=!0,this.render(s)}renderError(t,r){r==null||r.changeHistory();const i=new Pa(this.snapshot,t,Pa.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:r}=this;await qf();const i=t.clone();return this.snapshotCache.put(r,i),i}}getCachedSnapshotForLocation(t){return this.snapshotCache.get(t)}get snapshot(){return Ne.fromElement(this.element)}}class Rp{constructor(t){this.selector="a[data-turbo-preload]",this.delegate=t}get snapshotCache(){return this.delegate.navigator.view.snapshotCache}start(){if(document.readyState==="loading")return document.addEventListener("DOMContentLoaded",()=>{this.preloadOnLoadLinksForView(document.body)});this.preloadOnLoadLinksForView(document.body)}preloadOnLoadLinksForView(t){for(const r of t.querySelectorAll(this.selector))this.preloadURL(r)}async preloadURL(t){const r=new URL(t.href);if(!this.snapshotCache.has(r))try{const n=await(await fetch(r.toString(),{headers:{"VND.PREFETCH":"true",Accept:"text/html"}})).text(),s=Ne.fromHTMLString(n);this.snapshotCache.put(r,s)}catch{}}}class $p{constructor(){this.navigator=new _p(this),this.history=new Ep(this),this.preloader=new Rp(this),this.view=new Mp(this,document.documentElement),this.adapter=new bp(this),this.pageObserver=new Sp(this),this.cacheObserver=new yp,this.linkClickObserver=new so(this,window),this.formSubmitObserver=new Tn(this,document),this.scrollObserver=new kp(this),this.streamObserver=new Ap(this),this.formLinkClickObserver=new ao(this,document.documentElement),this.frameRedirector=new wp(this,document.documentElement),this.streamMessageRenderer=new Tp,this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1,this.formMode="on"}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(t){this.adapter=t}visit(t,r={}){const i=r.frame?document.getElementById(r.frame):null;i instanceof Ke?(i.src=t.toString(),i.loaded):this.navigator.proposeVisit(Te(t),r)}connectStreamSource(t){this.streamObserver.connectStreamSource(t)}disconnectStreamSource(t){this.streamObserver.disconnectStreamSource(t)}renderStreamMessage(t){this.streamMessageRenderer.render(St.wrap(t))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(t){this.progressBarDelay=t}setFormMode(t){this.formMode=t}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(t,r){this.enabled?this.navigator.startVisit(t,r,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(t){this.history.updateRestorationData({scrollPosition:t})}willSubmitFormLinkToLocation(t,r){return this.elementIsNavigatable(t)&&Ft(r,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}willFollowLinkToLocation(t,r,i){return this.elementIsNavigatable(t)&&Ft(r,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(t,r,i)}followedLinkToLocation(t,r){const i=this.getActionForLink(t),n=t.hasAttribute("data-turbo-stream");this.visit(r.href,{action:i,acceptsStreamResponse:n})}allowsVisitingLocationWithAction(t,r){return this.locationWithActionIsSamePage(t,r)||this.applicationAllowsVisitingLocation(t)}visitProposedToLocation(t,r){La(t),this.adapter.visitProposedToLocation(t,r)}visitStarted(t){t.acceptsStreamResponse||Ki(document.documentElement),La(t.location),t.silent||this.notifyApplicationAfterVisitingLocation(t.location,t.action)}visitCompleted(t){Gi(document.documentElement),this.notifyApplicationAfterPageLoad(t.getTimingMetrics())}locationWithActionIsSamePage(t,r){return this.navigator.locationWithActionIsSamePage(t,r)}visitScrolledToSamePageLocation(t,r){this.notifyApplicationAfterVisitingSamePageLocation(t,r)}willSubmitForm(t,r){const i=_n(t,r);return this.submissionIsNavigatable(t,r)&&Ft(Te(i),this.snapshot.rootLocation)}formSubmitted(t,r){this.navigator.submitForm(t,r)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(t){this.renderStreamMessage(t)}viewWillCacheSnapshot(){var t;!((t=this.navigator.currentVisit)===null||t===void 0)&&t.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:t},r){const i=this.notifyApplicationBeforeRender(t,r),{defaultPrevented:n,detail:{render:s}}=i;return this.view.renderer&&s&&(this.view.renderer.renderElement=s),!n}viewRenderedSnapshot(t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}preloadOnLoadLinksForView(t){this.preloader.preloadOnLoadLinksForView(t)}viewInvalidated(t){this.adapter.pageInvalidated(t)}frameLoaded(t){this.notifyApplicationAfterFrameLoad(t)}frameRendered(t,r){this.notifyApplicationAfterFrameRender(t,r)}applicationAllowsFollowingLinkToLocation(t,r,i){return!this.notifyApplicationAfterClickingLinkToLocation(t,r,i).defaultPrevented}applicationAllowsVisitingLocation(t){return!this.notifyApplicationBeforeVisitingLocation(t).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(t,r,i){return Se("turbo:click",{target:t,detail:{url:r.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(t){return Se("turbo:before-visit",{detail:{url:t.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(t,r){return Se("turbo:visit",{detail:{url:t.href,action:r}})}notifyApplicationBeforeCachingSnapshot(){return Se("turbo:before-cache")}notifyApplicationBeforeRender(t,r){return Se("turbo:before-render",{detail:Object.assign({newBody:t},r),cancelable:!0})}notifyApplicationAfterRender(){return Se("turbo:render")}notifyApplicationAfterPageLoad(t={}){return Se("turbo:load",{detail:{url:this.location.href,timing:t}})}notifyApplicationAfterVisitingSamePageLocation(t,r){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:t.toString(),newURL:r.toString()}))}notifyApplicationAfterFrameLoad(t){return Se("turbo:frame-load",{target:t})}notifyApplicationAfterFrameRender(t,r){return Se("turbo:frame-render",{detail:{fetchResponse:t},target:r,cancelable:!0})}submissionIsNavigatable(t,r){if(this.formMode=="off")return!1;{const i=r?this.elementIsNavigatable(r):!0;return this.formMode=="optin"?i&&t.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(t)}}elementIsNavigatable(t){const r=Fr(t,"[data-turbo]"),i=Fr(t,"turbo-frame");return this.drive||i?r?r.getAttribute("data-turbo")!="false":!0:r?r.getAttribute("data-turbo")=="true":!1}getActionForLink(t){return Ur(t)||"advance"}get snapshot(){return this.view.snapshot}}function La(e){Object.defineProperties(e,Ip)}const Ip={absoluteURL:{get(){return this.toString()}}};class Np{constructor(t){this.session=t}clear(){this.session.clearCache()}resetCacheControl(){this.setCacheControl("")}exemptPageFromCache(){this.setCacheControl("no-cache")}exemptPageFromPreview(){this.setCacheControl("no-preview")}setCacheControl(t){Uf("turbo-cache-control",t)}}const lo={after(){this.targetElements.forEach(e=>{var t;return(t=e.parentElement)===null||t===void 0?void 0:t.insertBefore(this.templateContent,e.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(e=>e.append(this.templateContent))},before(){this.targetElements.forEach(e=>{var t;return(t=e.parentElement)===null||t===void 0?void 0:t.insertBefore(this.templateContent,e)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(e=>e.prepend(this.templateContent))},remove(){this.targetElements.forEach(e=>e.remove())},replace(){this.targetElements.forEach(e=>e.replaceWith(this.templateContent))},update(){this.targetElements.forEach(e=>{e.innerHTML="",e.append(this.templateContent)})}},ce=new $p,Op=new Np(ce),{navigator:Fp}=ce;function co(){ce.start()}function Hp(e){ce.registerAdapter(e)}function qp(e,t){ce.visit(e,t)}function uo(e){ce.connectStreamSource(e)}function ho(e){ce.disconnectStreamSource(e)}function Dp(e){ce.renderStreamMessage(e)}function Bp(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),ce.clearCache()}function jp(e){ce.setProgressBarDelay(e)}function Vp(e){ur.confirmMethod=e}function Wp(e){ce.setFormMode(e)}var Up=Object.freeze({__proto__:null,navigator:Fp,session:ce,cache:Op,PageRenderer:Xi,PageSnapshot:Ne,FrameRenderer:Yi,start:co,registerAdapter:Hp,visit:qp,connectStreamSource:uo,disconnectStreamSource:ho,renderStreamMessage:Dp,clearCache:Bp,setProgressBarDelay:jp,setConfirmMethod:Vp,setFormMode:Wp,StreamActions:lo});class zp extends Error{}class Kp{constructor(t){this.fetchResponseLoaded=r=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.ignoredAttributes=new Set,this.action=null,this.visitCachedSnapshot=({element:r})=>{const i=r.querySelector("#"+this.element.id);i&&this.previousFrameElement&&i.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement},this.element=t,this.view=new rp(this,this.element),this.appearanceObserver=new Kf(this,this.element),this.formLinkClickObserver=new ao(this,this.element),this.linkInterceptor=new no(this,this.element),this.restorationIdentifier=Ht(),this.formSubmitObserver=new Tn(this,this.element)}connect(){this.connected||(this.connected=!0,this.loadingStyle==it.lazy?this.appearanceObserver.start():this.loadSourceURL(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==it.eager&&this.loadSourceURL()}sourceURLChanged(){this.isIgnoringChangesTo("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==it.eager||this.hasBeenLoaded)&&this.loadSourceURL())}sourceURLReloaded(){const{src:t}=this.element;return this.ignoringChangesToAttribute("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=t,this.element.loaded}completeChanged(){this.isIgnoringChangesTo("complete")||this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==it.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.visit(Te(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0)}async loadResponse(t){(t.redirected||t.succeeded&&t.isHTML)&&(this.sourceURL=t.response.url);try{const r=await t.responseHTML;if(r){const i=Ja(r);Ne.fromDocument(i).isVisitable?await this.loadFrameResponse(t,i):await this.handleUnvisitableFrameResponse(t)}}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(t){this.proposeVisitIfNavigatedWithAction(t,t),this.loadSourceURL()}willSubmitFormLinkToLocation(t){return this.shouldInterceptNavigation(t)}submittedFormLinkToLocation(t,r,i){const n=this.findFrameElement(t);n&&i.setAttribute("data-turbo-frame",n.id)}shouldInterceptLinkClick(t,r,i){return this.shouldInterceptNavigation(t)}linkClickIntercepted(t,r){this.navigateFrame(t,r)}willSubmitForm(t,r){return t.closest("turbo-frame")==this.element&&this.shouldInterceptNavigation(t,r)}formSubmitted(t,r){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new ur(this,t,r);const{fetchRequest:i}=this.formSubmission;this.prepareRequest(i),this.formSubmission.start()}prepareRequest(t){var r;t.headers["Turbo-Frame"]=this.id,!((r=this.currentNavigationElement)===null||r===void 0)&&r.hasAttribute("data-turbo-stream")&&t.acceptResponseType(St.contentType)}requestStarted(t){Ki(this.element)}requestPreventedHandlingResponse(t,r){this.resolveVisitPromise()}async requestSucceededWithResponse(t,r){await this.loadResponse(r),this.resolveVisitPromise()}async requestFailedWithResponse(t,r){await this.loadResponse(r),this.resolveVisitPromise()}requestErrored(t,r){console.error(r),this.resolveVisitPromise()}requestFinished(t){Gi(this.element)}formSubmissionStarted({formElement:t}){Ki(t,this.findFrameElement(t))}formSubmissionSucceededWithResponse(t,r){const i=this.findFrameElement(t.formElement,t.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,t.formElement,t.submitter),i.delegate.loadResponse(r),t.isSafe||ce.clearCache()}formSubmissionFailedWithResponse(t,r){this.element.delegate.loadResponse(r),ce.clearCache()}formSubmissionErrored(t,r){console.error(r)}formSubmissionFinished({formElement:t}){Gi(t,this.findFrameElement(t))}allowsImmediateRender({element:t},r){const i=Se("turbo:before-frame-render",{target:this.element,detail:Object.assign({newFrame:t},r),cancelable:!0}),{defaultPrevented:n,detail:{render:s}}=i;return this.view.renderer&&s&&(this.view.renderer.renderElement=s),!n}viewRenderedSnapshot(t,r){}preloadOnLoadLinksForView(t){ce.preloadOnLoadLinksForView(t)}viewInvalidated(){}willRenderFrame(t,r){this.previousFrameElement=t.cloneNode(!0)}async loadFrameResponse(t,r){const i=await this.extractForeignFrameElement(r.body);if(i){const n=new zr(i),s=new Yi(this,this.view.snapshot,n,Yi.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(s),this.complete=!0,ce.frameRendered(t,this.element),ce.frameLoaded(this.element),this.fetchResponseLoaded(t)}else this.willHandleFrameMissingFromResponse(t)&&this.handleFrameMissingFromResponse(t)}async visit(t){var r;const i=new kn(this,xe.get,t,new URLSearchParams,this.element);return(r=this.currentFetchRequest)===null||r===void 0||r.cancel(),this.currentFetchRequest=i,new Promise(n=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,n()},i.perform()})}navigateFrame(t,r,i){const n=this.findFrameElement(t,i);n.delegate.proposeVisitIfNavigatedWithAction(n,t,i),this.withCurrentNavigationElement(t,()=>{n.src=r})}proposeVisitIfNavigatedWithAction(t,r,i){if(this.action=Ur(i,r,t),this.action){const n=Ne.fromElement(t).clone(),{visitCachedSnapshot:s}=t.delegate;t.delegate.fetchResponseLoaded=l=>{if(t.src){const{statusCode:u,redirected:f}=l,v=t.ownerDocument.documentElement.outerHTML,T={response:{statusCode:u,redirected:f,responseHTML:v},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:n};this.action&&(T.action=this.action),ce.visit(t.src,T)}}}}changeHistory(){if(this.action){const t=Za(this.action);ce.history.update(t,Te(this.element.src||""),this.restorationIdentifier)}}async handleUnvisitableFrameResponse(t){console.warn(`The response (${t.statusCode}) from is performing a full page visit due to turbo-visit-control.`),await this.visitResponse(t.response)}willHandleFrameMissingFromResponse(t){this.element.setAttribute("complete","");const r=t.response,i=async(s,l={})=>{s instanceof Response?this.visitResponse(s):ce.visit(s,l)};return!Se("turbo:frame-missing",{target:this.element,detail:{response:r,visit:i},cancelable:!0}).defaultPrevented}handleFrameMissingFromResponse(t){this.view.missing(),this.throwFrameMissingError(t)}throwFrameMissingError(t){const r=`The response (${t.statusCode}) did not contain the expected and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new zp(r)}async visitResponse(t){const r=new Sn(t),i=await r.responseHTML,{location:n,redirected:s,statusCode:l}=r;return ce.visit(n,{response:{redirected:s,statusCode:l,responseHTML:i}})}findFrameElement(t,r){var i;const n=Nr("data-turbo-frame",r,t)||this.element.getAttribute("target");return(i=Ma(n))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(t){let r;const i=CSS.escape(this.id);try{if(r=Ra(t.querySelector(`turbo-frame#${i}`),this.sourceURL),r)return r;if(r=Ra(t.querySelector(`turbo-frame[src][recurse~=${i}]`),this.sourceURL),r)return await r.loaded,await this.extractForeignFrameElement(r)}catch(n){return console.error(n),new Ke}return null}formActionIsVisitable(t,r){const i=_n(t,r);return Ft(Te(i),this.rootLocation)}shouldInterceptNavigation(t,r){const i=Nr("data-turbo-frame",r,t)||this.element.getAttribute("target");if(t instanceof HTMLFormElement&&!this.formActionIsVisitable(t,r)||!this.enabled||i=="_top")return!1;if(i){const n=Ma(i);if(n)return!n.disabled}return!(!ce.elementIsNavigatable(t)||r&&!ce.elementIsNavigatable(r))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(t){this.ignoringChangesToAttribute("src",()=>{this.element.src=t??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(t){this.ignoringChangesToAttribute("complete",()=>{t?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var t;const r=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(t=r==null?void 0:r.content)!==null&&t!==void 0?t:"/";return Te(i)}isIgnoringChangesTo(t){return this.ignoredAttributes.has(t)}ignoringChangesToAttribute(t,r){this.ignoredAttributes.add(t),r(),this.ignoredAttributes.delete(t)}withCurrentNavigationElement(t,r){this.currentNavigationElement=t,r(),delete this.currentNavigationElement}}function Ma(e){if(e!=null){const t=document.getElementById(e);if(t instanceof Ke)return t}}function Ra(e,t){if(e){const r=e.getAttribute("src");if(r!=null&&t!=null&&Rf(r,t))throw new Error(`Matching element has a source URL which references itself`);if(e.ownerDocument!==document&&(e=document.importNode(e,!0)),e instanceof Ke)return e.connectedCallback(),e.disconnectedCallback(),e}}class An extends HTMLElement{static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){console.error(t)}finally{this.disconnect()}}async render(){var t;return(t=this.renderPromise)!==null&&t!==void 0?t:this.renderPromise=(async()=>{const r=this.beforeRenderEvent;this.dispatchEvent(r)&&(await Lr(),await r.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(t=>t.remove())}get duplicateChildren(){var t;const r=this.targetElements.flatMap(n=>[...n.children]).filter(n=>!!n.id),i=[...((t=this.templateContent)===null||t===void 0?void 0:t.children)||[]].filter(n=>!!n.id).map(n=>n.id);return r.filter(n=>i.includes(n.id))}get performAction(){if(this.action){const t=lo[this.action];if(t)return t;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){const t=this.ownerDocument.createElement("template");return this.appendChild(t),t}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a