@kinxcdn/commerce-player 1.6.3-alpha.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,30 +1,30 @@
1
- import*as e from"react";import t,{useRef as n,useEffect as r,forwardRef as o,createElement as i,useState as a,useLayoutEffect as s,createContext as l,useContext as c,useCallback as d,useMemo as u,memo as p,PureComponent as f}from"react";import{jsx as m,Fragment as h,jsxs as g}from"react/jsx-runtime";import*as v from"react-dom";import b,{createPortal as y,flushSync as w}from"react-dom";import{renderToString as E}from"react-dom/server";var x=function(){return x=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},x.apply(this,arguments)};function S(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function T(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let O=null,C="";const P=({file:e,mute:o=!0,thumbnail:i,play:a=!0})=>{const s=n(null),l=n(null),c=n(!1);return r(()=>{const t=s.current;let n=function(e,t){if(O&&C===t){O.style.cssText="width:100%;height:100%;object-fit:cover;",e.appendChild(O);const t=O;return O=null,C="",t}return null}(t,e);return n||(n=document.createElement("video"),n.playsInline=!0,n.setAttribute("playsinline",""),n.setAttribute("webkit-playsinline",""),n.loop=!0,n.autoplay=!0,n.preload="auto",n.crossOrigin="anonymous",n.style.cssText="width:100%;height:100%;object-fit:cover;",i&&(n.poster=i),n.src=e,n.load(),t.appendChild(n)),n.muted=o,l.current=n,n.onerror=e=>{console.error(e)},()=>{try{n.pause(),n.removeAttribute("src"),n.load()}catch(e){}n.parentElement===t&&t.removeChild(n),l.current=null}},[e]),r(()=>{const e=l.current;e&&(e.muted=o)},[o]),r(()=>{const e=l.current;if(!e)return;if(c.current=!!a,!a)return void e.pause();const t=T(void 0,void 0,void 0,function*(){if(!e||!c.current)return;try{return void(yield e.play())}catch(e){}let t=requestAnimationFrame(()=>T(void 0,void 0,void 0,function*(){if(e&&c.current)try{e.readyState<2&&(yield new Promise(t=>{const n=()=>{e.removeEventListener("loadeddata",n),t()};e.addEventListener("loadeddata",n,{once:!0})})),yield e.play()}catch(t){const n=e.muted;try{e.muted=!0,yield e.play()}catch(e){}const r=()=>{e.muted=n,e.play().catch(()=>{}),window.removeEventListener("touchstart",r,!0),window.removeEventListener("pointerup",r,!0)};window.addEventListener("touchstart",r,!0),window.addEventListener("pointerup",r,!0)}}));return()=>cancelAnimationFrame(t)});return()=>{"function"==typeof t&&t()}},[a]),t.createElement("div",{className:"w-full h-full relative"},t.createElement("div",{ref:s,className:"w-full h-full"}))};function N(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=N(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const k=e=>{const t=R(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),M(n,t)||D(e)},getConflictingClassGroupIds:(e,t)=>{const o=n[e]||[];return t&&r[e]?[...o,...r[e]]:o}}},M=(e,t)=>{if(0===e.length)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?M(e.slice(1),r):void 0;if(o)return o;if(0===t.validators.length)return;const i=e.join("-");return t.validators.find(({validator:e})=>e(i))?.classGroupId},I=/^\[(.+)\]$/,D=e=>{if(I.test(e)){const t=I.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},R=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const e in n)A(n[e],r,e,t);return r},A=(e,t,n,r)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:z(t,e)).classGroupId=n)}if("function"==typeof e)return _(e)?void A(e(r),t,n,r):void t.validators.push({validator:e,classGroupId:n});Object.entries(e).forEach(([e,o])=>{A(o,z(t,e),n,r)})})},z=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},_=e=>e.isThemeGetter,L=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(o(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):o(e,t)}}},$=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,o=0,i=0;for(let a=0;a<e.length;a++){let s=e[a];if(0===r&&0===o){if(":"===s){t.push(e.slice(i,a)),i=a+1;continue}if("/"===s){n=a;continue}}"["===s?r++:"]"===s?r--:"("===s?o++:")"===s&&o--}const a=0===t.length?e:e.substring(i),s=j(a);return{modifiers:t,hasImportantModifier:s!==a,baseClassName:s,maybePostfixModifierPosition:n&&n>i?n-i:void 0}};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:t,maybePostfixModifierPosition:void 0}}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},j=e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,F=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(e=>[e,!0]));return e=>{if(e.length<=1)return e;const n=[];let r=[];return e.forEach(e=>{"["===e[0]||t[e]?(n.push(...r.sort(),e),r=[]):r.push(e)}),n.push(...r.sort()),n}},W=/\s+/;function B(){let e,t,n=0,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=H(e))&&(r&&(r+=" "),r+=t);return r}const H=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=H(e[r]))&&(n&&(n+=" "),n+=t);return n};function V(e,...t){let n,r,o,i=function(s){const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:L(e.cacheSize),parseClassName:$(e),sortModifiers:F(e),...k(e)}))(l),r=n.cache.get,o=n.cache.set,i=a,a(s)};function a(e){const t=r(e);if(t)return t;const i=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,a=[],s=e.trim().split(W);let l="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:c,modifiers:d,hasImportantModifier:u,baseClassName:p,maybePostfixModifierPosition:f}=n(t);if(c){l=t+(l.length>0?" "+l:l);continue}let m=!!f,h=r(m?p.substring(0,f):p);if(!h){if(!m){l=t+(l.length>0?" "+l:l);continue}if(h=r(p),!h){l=t+(l.length>0?" "+l:l);continue}m=!1}const g=i(d).join(":"),v=u?g+"!":g,b=v+h;if(a.includes(b))continue;a.push(b);const y=o(h,m);for(let e=0;e<y.length;++e){const t=y[e];a.push(v+t)}l=t+(l.length>0?" "+l:l)}return l})(e,n);return o(e,i),i}return function(){return i(B.apply(null,arguments))}}const U=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Y=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,G=/^\((?:(\w[\w-]*):)?(.+)\)$/i,q=/^\d+\/\d+$/,X=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,K=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Z=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,J=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Q=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ee=e=>q.test(e),te=e=>!!e&&!Number.isNaN(Number(e)),ne=e=>!!e&&Number.isInteger(Number(e)),re=e=>e.endsWith("%")&&te(e.slice(0,-1)),oe=e=>X.test(e),ie=()=>!0,ae=e=>K.test(e)&&!Z.test(e),se=()=>!1,le=e=>J.test(e),ce=e=>Q.test(e),de=e=>!pe(e)&&!be(e),ue=e=>Oe(e,ke,se),pe=e=>Y.test(e),fe=e=>Oe(e,Me,ae),me=e=>Oe(e,Ie,te),he=e=>Oe(e,Pe,se),ge=e=>Oe(e,Ne,ce),ve=e=>Oe(e,Re,le),be=e=>G.test(e),ye=e=>Ce(e,Me),we=e=>Ce(e,De),Ee=e=>Ce(e,Pe),xe=e=>Ce(e,ke),Se=e=>Ce(e,Ne),Te=e=>Ce(e,Re,!0),Oe=(e,t,n)=>{const r=Y.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},Ce=(e,t,n=!1)=>{const r=G.exec(e);return!!r&&(r[1]?t(r[1]):n)},Pe=e=>"position"===e||"percentage"===e,Ne=e=>"image"===e||"url"===e,ke=e=>"length"===e||"size"===e||"bg-size"===e,Me=e=>"length"===e,Ie=e=>"number"===e,De=e=>"family-name"===e,Re=e=>"shadow"===e,Ae=V(()=>{const e=U("color"),t=U("font"),n=U("text"),r=U("font-weight"),o=U("tracking"),i=U("leading"),a=U("breakpoint"),s=U("container"),l=U("spacing"),c=U("radius"),d=U("shadow"),u=U("inset-shadow"),p=U("text-shadow"),f=U("drop-shadow"),m=U("blur"),h=U("perspective"),g=U("aspect"),v=U("ease"),b=U("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",be,pe],w=()=>[be,pe,l],E=()=>[ee,"full","auto",...w()],x=()=>[ne,"none","subgrid",be,pe],S=()=>["auto",{span:["full",ne,be,pe]},ne,be,pe],T=()=>[ne,"auto",be,pe],O=()=>["auto","min","max","fr",be,pe],C=()=>["auto",...w()],P=()=>[ee,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],N=()=>[e,be,pe],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ee,he,{position:[be,pe]}],M=()=>["auto","cover","contain",xe,ue,{size:[be,pe]}],I=()=>[re,ye,fe],D=()=>["","none","full",c,be,pe],R=()=>["",te,ye,fe],A=()=>[te,re,Ee,he],z=()=>["","none",m,be,pe],_=()=>["none",te,be,pe],L=()=>["none",te,be,pe],$=()=>[te,be,pe],j=()=>[ee,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[oe],breakpoint:[oe],color:[ie],container:[oe],"drop-shadow":[oe],ease:["in","out","in-out"],font:[de],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[oe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[oe],shadow:[oe],spacing:["px",te],text:[oe],"text-shadow":[oe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ee,pe,be,g]}],container:["container"],columns:[{columns:[te,pe,be,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{start:E()}],end:[{end:E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[ne,"auto",be,pe]}],basis:[{basis:[ee,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[te,ee,"auto","initial","none",pe]}],grow:[{grow:["",te,be,pe]}],shrink:[{shrink:["",te,be,pe]}],order:[{order:[ne,"first","last","none",be,pe]}],"grid-cols":[{"grid-cols":x()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":x()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],w:[{w:[s,"screen",...P()]}],"min-w":[{"min-w":[s,"screen","none",...P()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},...P()]}],h:[{h:["screen",...P()]}],"min-h":[{"min-h":["screen","none",...P()]}],"max-h":[{"max-h":["screen",...P()]}],"font-size":[{text:["base",n,ye,fe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,be,me]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",re,pe]}],"font-family":[{font:[we,pe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,be,pe]}],"line-clamp":[{"line-clamp":[te,"none",be,me]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",be,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[te,"from-font","auto",be,fe]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[te,"auto",be,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ne,be,pe],radial:["",be,pe],conic:[ne,be,pe]},Se,ge]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":R()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[te,be,pe]}],"outline-w":[{outline:["",te,ye,fe]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",d,Te,ve]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",u,Te,ve]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[te,fe]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",p,Te,ve]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[te,be,pe]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[te]}],"mask-image-linear-from-pos":[{"mask-linear-from":A()}],"mask-image-linear-to-pos":[{"mask-linear-to":A()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":A()}],"mask-image-t-to-pos":[{"mask-t-to":A()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":A()}],"mask-image-r-to-pos":[{"mask-r-to":A()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":A()}],"mask-image-b-to-pos":[{"mask-b-to":A()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":A()}],"mask-image-l-to-pos":[{"mask-l-to":A()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":A()}],"mask-image-x-to-pos":[{"mask-x-to":A()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":A()}],"mask-image-y-to-pos":[{"mask-y-to":A()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[be,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":A()}],"mask-image-radial-to-pos":[{"mask-radial-to":A()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[te]}],"mask-image-conic-from-pos":[{"mask-conic-from":A()}],"mask-image-conic-to-pos":[{"mask-conic-to":A()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,pe]}],filter:[{filter:["","none",be,pe]}],blur:[{blur:z()}],brightness:[{brightness:[te,be,pe]}],contrast:[{contrast:[te,be,pe]}],"drop-shadow":[{"drop-shadow":["","none",f,Te,ve]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",te,be,pe]}],"hue-rotate":[{"hue-rotate":[te,be,pe]}],invert:[{invert:["",te,be,pe]}],saturate:[{saturate:[te,be,pe]}],sepia:[{sepia:["",te,be,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",be,pe]}],"backdrop-blur":[{"backdrop-blur":z()}],"backdrop-brightness":[{"backdrop-brightness":[te,be,pe]}],"backdrop-contrast":[{"backdrop-contrast":[te,be,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",te,be,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[te,be,pe]}],"backdrop-invert":[{"backdrop-invert":["",te,be,pe]}],"backdrop-opacity":[{"backdrop-opacity":[te,be,pe]}],"backdrop-saturate":[{"backdrop-saturate":[te,be,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",te,be,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",be,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[te,"initial",be,pe]}],ease:[{ease:["linear","initial",v,be,pe]}],delay:[{delay:[te,be,pe]}],animate:[{animate:["none",b,be,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,be,pe]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:_()}],"rotate-x":[{"rotate-x":_()}],"rotate-y":[{"rotate-y":_()}],"rotate-z":[{"rotate-z":_()}],scale:[{scale:L()}],"scale-x":[{"scale-x":L()}],"scale-y":[{"scale-y":L()}],"scale-z":[{"scale-z":L()}],"scale-3d":["scale-3d"],skew:[{skew:$()}],"skew-x":[{"skew-x":$()}],"skew-y":[{"skew-y":$()}],transform:[{transform:[be,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:j()}],"translate-x":[{"translate-x":j()}],"translate-y":[{"translate-y":j()}],"translate-z":[{"translate-z":j()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be,pe]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[te,ye,fe,me]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});var ze,_e,Le,$e,je,Fe;!function(e){e.INSTA="INSTA",e.YOUTUBE="YOUTUBE",e.SQUARE="SQUARE"}(ze||(ze={})),function(e){e.MANY="MANY",e.ONE="ONE"}(_e||(_e={})),function(e){e.ALWAYS="ALWAYS",e.DAY="DAY",e.DISAPPEAR="DISAPPEAR",e.NONE="NONE"}(Le||(Le={})),function(e){e.POPUP="POPUP",e.PLATFORM="PLATFORM",e.TABLET="TABLET",e.GRID="GRID",e.VERTICAL="VERTICAL",e.HORIZONTAL="HORIZONTAL"}($e||($e={})),function(e){e.BOTTOM="BOTTOM",e.INNER="INNER"}(je||(je={})),function(e){e[e.PLATFORM=1]="PLATFORM",e[e.VERTICAL=2]="VERTICAL",e[e.PRODUCTS=3]="PRODUCTS",e[e.HORIZONTAL=4]="HORIZONTAL",e[e.TABLET=5]="TABLET"}(Fe||(Fe={}));const We="mbus-viewed-shorts",Be="mbus-last-played";function He(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ve(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Ue,Ye={exports:{}};function Ge(){return Ue||(Ue=1,Ye.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",a="hour",s="day",l="week",c="month",d="quarter",u="year",p="date",f="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},v=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},b={s:v,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+v(r,2,"0")+":"+v(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),i=n-o<0,a=t.clone().add(r+(i?-1:1),c);return+(-(r+(n-o)/(i?o-a:a-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:u,w:l,d:s,D:p,h:a,m:i,s:o,ms:r,Q:d}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},y="en",w={};w[y]=g;var E="$isDayjsObject",x=function(e){return e instanceof C||!(!e||!e[E])},S=function e(t,n,r){var o;if(!t)return y;if("string"==typeof t){var i=t.toLowerCase();w[i]&&(o=i),n&&(w[i]=n,o=i);var a=t.split("-");if(!o&&a.length>1)return e(a[0])}else{var s=t.name;w[s]=t,o=s}return!r&&o&&(y=o),o||!r&&y},T=function(e,t){if(x(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new C(n)},O=b;O.l=S,O.i=x,O.w=function(e,t){return T(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var C=function(){function g(e){this.$L=S(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[E]=!0}var v=g.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(O.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(m);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return O},v.isValid=function(){return!(this.$d.toString()===f)},v.isSame=function(e,t){var n=T(e);return this.startOf(t)<=n&&n<=this.endOf(t)},v.isAfter=function(e,t){return T(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<T(e)},v.$g=function(e,t,n){return O.u(e)?this[t]:this.set(n,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var n=this,r=!!O.u(t)||t,d=O.p(e),f=function(e,t){var o=O.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(s)},m=function(e,t){return O.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,v=this.$D,b="set"+(this.$u?"UTC":"");switch(d){case u:return r?f(1,0):f(31,11);case c:return r?f(1,g):f(0,g+1);case l:var y=this.$locale().weekStart||0,w=(h<y?h+7:h)-y;return f(r?v-w:v+(6-w),g);case s:case p:return m(b+"Hours",0);case a:return m(b+"Minutes",1);case i:return m(b+"Seconds",2);case o:return m(b+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var n,l=O.p(e),d="set"+(this.$u?"UTC":""),f=(n={},n[s]=d+"Date",n[p]=d+"Date",n[c]=d+"Month",n[u]=d+"FullYear",n[a]=d+"Hours",n[i]=d+"Minutes",n[o]=d+"Seconds",n[r]=d+"Milliseconds",n)[l],m=l===s?this.$D+(t-this.$W):t;if(l===c||l===u){var h=this.clone().set(p,1);h.$d[f](m),h.init(),this.$d=h.set(p,Math.min(this.$D,h.daysInMonth())).$d}else f&&this.$d[f](m);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[O.p(e)]()},v.add=function(r,d){var p,f=this;r=Number(r);var m=O.p(d),h=function(e){var t=T(f);return O.w(t.date(t.date()+Math.round(e*r)),f)};if(m===c)return this.set(c,this.$M+r);if(m===u)return this.set(u,this.$y+r);if(m===s)return h(1);if(m===l)return h(7);var g=(p={},p[i]=t,p[a]=n,p[o]=e,p)[m]||1,v=this.$d.getTime()+r*g;return O.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=O.z(this),i=this.$H,a=this.$m,s=this.$M,l=n.weekdays,c=n.months,d=n.meridiem,u=function(e,n,o,i){return e&&(e[n]||e(t,r))||o[n].slice(0,i)},p=function(e){return O.s(i%12||12,e,"0")},m=d||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(h,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return O.s(t.$y,4,"0");case"M":return s+1;case"MM":return O.s(s+1,2,"0");case"MMM":return u(n.monthsShort,s,c,3);case"MMMM":return u(c,s);case"D":return t.$D;case"DD":return O.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return u(n.weekdaysMin,t.$W,l,2);case"ddd":return u(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(i);case"HH":return O.s(i,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return m(i,a,!0);case"A":return m(i,a,!1);case"m":return String(a);case"mm":return O.s(a,2,"0");case"s":return String(t.$s);case"ss":return O.s(t.$s,2,"0");case"SSS":return O.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(r,p,f){var m,h=this,g=O.p(p),v=T(r),b=(v.utcOffset()-this.utcOffset())*t,y=this-v,w=function(){return O.m(h,v)};switch(g){case u:m=w()/12;break;case c:m=w();break;case d:m=w()/3;break;case l:m=(y-b)/6048e5;break;case s:m=(y-b)/864e5;break;case a:m=y/n;break;case i:m=y/t;break;case o:m=y/e;break;default:m=y}return f?m:O.a(m)},v.daysInMonth=function(){return this.endOf(c).$D},v.$locale=function(){return w[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=S(e,t,!0);return r&&(n.$L=r),n},v.clone=function(){return O.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},g}(),P=C.prototype;return T.prototype=P,[["$ms",r],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",u],["$D",p]].forEach(function(e){P[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),T.extend=function(e,t){return e.$i||(e(t,C,T),e.$i=!0),T},T.locale=S,T.isDayjs=x,T.unix=function(e){return T(1e3*e)},T.en=w[y],T.Ls=w,T.p={},T}()),Ye.exports}var qe,Xe=He(Ge()),Ke={exports:{}};var Ze,Je,Qe,et,tt=(qe||(qe=1,Ke.exports=(Ze="minute",Je=/[+-]\d\d(?::?\d\d)?/g,Qe=/([+-]|\d\d)/g,function(e,t,n){var r=t.prototype;n.utc=function(e){return new t({date:e,utc:!0,args:arguments})},r.utc=function(e){var t=n(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),Ze):t},r.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=r.parse;r.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),o.call(this,e)};var i=r.init;r.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else i.call(this)};var a=r.utcOffset;r.utcOffset=function(e,t){var n=this.$utils().u;if(n(e))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof e&&(e=function(e){void 0===e&&(e="");var t=e.match(Je);if(!t)return null;var n=(""+t[0]).match(Qe)||["-",0,0],r=n[0],o=60*+n[1]+ +n[2];return 0===o?0:"+"===r?o:-o}(e),null===e))return this;var r=Math.abs(e)<=16?60*e:e;if(0===r)return this.utc(t);var o=this.clone();if(t)return o.$offset=r,o.$u=!1,o;var i=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(o=this.local().add(r+i,Ze)).$offset=r,o.$x.$localOffset=i,o};var s=r.format;r.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return s.call(this,t)},r.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},r.isUTC=function(){return!!this.$u},r.toISOString=function(){return this.toDate().toISOString()},r.toString=function(){return this.toDate().toUTCString()};var l=r.toDate;r.toDate=function(e){return"s"===e&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=r.diff;r.diff=function(e,t,r){if(e&&this.$u===e.$u)return c.call(this,e,t,r);var o=this.local(),i=n(e).local();return c.call(o,i,t,r)}})),Ke.exports),nt=He(tt),rt={exports:{}};et||(et=1,rt.exports=function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r={name:"ko",weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),ordinal:function(e){return e+"일"},formats:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h:mm",LLLL:"YYYY년 MMMM D일 dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY년 MMMM D일",lll:"YYYY년 MMMM D일 A h:mm",llll:"YYYY년 MMMM D일 dddd A h:mm"},meridiem:function(e){return e<12?"오전":"오후"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",m:"1분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"}};return n.default.locale(r,null,!0),r}(Ge()));var ot,it={exports:{}};var at,st=(ot||(ot=1,it.exports=function(){var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(n,r,o){var i,a=function(e,n,r){void 0===r&&(r={});var o=new Date(e),i=function(e,n){void 0===n&&(n={});var r=n.timeZoneName||"short",o=e+"|"+r,i=t[o];return i||(i=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:r}),t[o]=i),i}(n,r);return i.formatToParts(o)},s=function(t,n){for(var r=a(t,n),i=[],s=0;s<r.length;s+=1){var l=r[s],c=l.type,d=l.value,u=e[c];u>=0&&(i[u]=parseInt(d,10))}var p=i[3],f=24===p?0:p,m=i[0]+"-"+i[1]+"-"+i[2]+" "+f+":"+i[4]+":"+i[5]+":000",h=+t;return(o.utc(m).valueOf()-(h-=h%1e3))/6e4},l=r.prototype;l.tz=function(e,t){void 0===e&&(e=i);var n,r=this.utcOffset(),a=this.toDate(),s=a.toLocaleString("en-US",{timeZone:e}),l=Math.round((a-new Date(s))/1e3/60),c=15*-Math.round(a.getTimezoneOffset()/15)-l;if(Number(c)){if(n=o(s,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(c,!0),t){var d=n.utcOffset();n=n.add(r-d,"minute")}}else n=this.utcOffset(0,t);return n.$x.$timezone=e,n},l.offsetName=function(e){var t=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),t,{timeZoneName:e}).find(function(e){return"timezonename"===e.type.toLowerCase()});return n&&n.value};var c=l.startOf;l.startOf=function(e,t){if(!this.$x||!this.$x.$timezone)return c.call(this,e,t);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(n,e,t).tz(this.$x.$timezone,!0)},o.tz=function(e,t,n){var r=n&&t,a=n||t||i,l=s(+o(),a);if("string"!=typeof e)return o(e).tz(a);var c=function(e,t,n){var r=e-60*t*1e3,o=s(r,n);if(t===o)return[r,t];var i=s(r-=60*(o-t)*1e3,n);return o===i?[r,o]:[e-60*Math.min(o,i)*1e3,Math.max(o,i)]}(o.utc(e,r).valueOf(),l,a),d=c[0],u=c[1],p=o(d).utcOffset(u);return p.$x.$timezone=a,p},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(e){i=e}}}()),it.exports),lt=He(st),ct={exports:{}};var dt=(at||(at=1,ct.exports=function(){var e,t,n=1e3,r=6e4,o=36e5,i=864e5,a=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,s=31536e6,l=2628e6,c=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,d={years:s,months:l,days:i,hours:o,minutes:r,seconds:n,milliseconds:1,weeks:6048e5},u=function(e){return e instanceof b},p=function(e,t,n){return new b(e,n,t.$l)},f=function(e){return t.p(e)+"s"},m=function(e){return e<0},h=function(e){return m(e)?Math.ceil(e):Math.floor(e)},g=function(e){return Math.abs(e)},v=function(e,t){return e?m(e)?{negative:!0,format:""+g(e)+t}:{negative:!1,format:""+e+t}:{negative:!1,format:""}},b=function(){function m(e,t,n){var r=this;if(this.$d={},this.$l=n,void 0===e&&(this.$ms=0,this.parseFromMilliseconds()),t)return p(e*d[f(t)],this);if("number"==typeof e)return this.$ms=e,this.parseFromMilliseconds(),this;if("object"==typeof e)return Object.keys(e).forEach(function(t){r.$d[f(t)]=e[t]}),this.calMilliseconds(),this;if("string"==typeof e){var o=e.match(c);if(o){var i=o.slice(2).map(function(e){return null!=e?Number(e):0});return this.$d.years=i[0],this.$d.months=i[1],this.$d.weeks=i[2],this.$d.days=i[3],this.$d.hours=i[4],this.$d.minutes=i[5],this.$d.seconds=i[6],this.calMilliseconds(),this}}return this}var g=m.prototype;return g.calMilliseconds=function(){var e=this;this.$ms=Object.keys(this.$d).reduce(function(t,n){return t+(e.$d[n]||0)*d[n]},0)},g.parseFromMilliseconds=function(){var e=this.$ms;this.$d.years=h(e/s),e%=s,this.$d.months=h(e/l),e%=l,this.$d.days=h(e/i),e%=i,this.$d.hours=h(e/o),e%=o,this.$d.minutes=h(e/r),e%=r,this.$d.seconds=h(e/n),e%=n,this.$d.milliseconds=e},g.toISOString=function(){var e=v(this.$d.years,"Y"),t=v(this.$d.months,"M"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var r=v(n,"D"),o=v(this.$d.hours,"H"),i=v(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3,a=Math.round(1e3*a)/1e3);var s=v(a,"S"),l=e.negative||t.negative||r.negative||o.negative||i.negative||s.negative,c=o.format||i.format||s.format?"T":"",d=(l?"-":"")+"P"+e.format+t.format+r.format+c+o.format+i.format+s.format;return"P"===d||"-P"===d?"P0D":d},g.toJSON=function(){return this.toISOString()},g.format=function(e){var n=e||"YYYY-MM-DDTHH:mm:ss",r={Y:this.$d.years,YY:t.s(this.$d.years,2,"0"),YYYY:t.s(this.$d.years,4,"0"),M:this.$d.months,MM:t.s(this.$d.months,2,"0"),D:this.$d.days,DD:t.s(this.$d.days,2,"0"),H:this.$d.hours,HH:t.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:t.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:t.s(this.$d.seconds,2,"0"),SSS:t.s(this.$d.milliseconds,3,"0")};return n.replace(a,function(e,t){return t||String(r[e])})},g.as=function(e){return this.$ms/d[f(e)]},g.get=function(e){var t=this.$ms,n=f(e);return"milliseconds"===n?t%=1e3:t="weeks"===n?h(t/d[n]):this.$d[n],t||0},g.add=function(e,t,n){var r;return r=t?e*d[f(t)]:u(e)?e.$ms:p(e,this).$ms,p(this.$ms+r*(n?-1:1),this)},g.subtract=function(e,t){return this.add(e,t,!0)},g.locale=function(e){var t=this.clone();return t.$l=e,t},g.clone=function(){return p(this.$ms,this)},g.humanize=function(t){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!t)},g.valueOf=function(){return this.asMilliseconds()},g.milliseconds=function(){return this.get("milliseconds")},g.asMilliseconds=function(){return this.as("milliseconds")},g.seconds=function(){return this.get("seconds")},g.asSeconds=function(){return this.as("seconds")},g.minutes=function(){return this.get("minutes")},g.asMinutes=function(){return this.as("minutes")},g.hours=function(){return this.get("hours")},g.asHours=function(){return this.as("hours")},g.days=function(){return this.get("days")},g.asDays=function(){return this.as("days")},g.weeks=function(){return this.get("weeks")},g.asWeeks=function(){return this.as("weeks")},g.months=function(){return this.get("months")},g.asMonths=function(){return this.as("months")},g.years=function(){return this.get("years")},g.asYears=function(){return this.as("years")},m}(),y=function(e,t,n){return e.add(t.years()*n,"y").add(t.months()*n,"M").add(t.days()*n,"d").add(t.hours()*n,"h").add(t.minutes()*n,"m").add(t.seconds()*n,"s").add(t.milliseconds()*n,"ms")};return function(n,r,o){e=o,t=o().$utils(),o.duration=function(e,t){var n=o.locale();return p(e,{$l:n},t)},o.isDuration=u;var i=r.prototype.add,a=r.prototype.subtract;r.prototype.add=function(e,t){return u(e)?y(this,e,1):i.bind(this)(e,t)},r.prototype.subtract=function(e,t){return u(e)?y(this,e,-1):a.bind(this)(e,t)}}}()),ct.exports),ut=He(dt);console.log("[commerce-player configs instance]",Math.random());const pt={API_BASE_URL:"https://api.midibus.im:8001",STATISTICS_BASE_URL:"https://playdata.midibus.im",PLAYER_BACK_BASE_URL:"https://back-playdata.midibus.im",PLAYER_BASE_URL:"https://mcommerce-play.midibus.kinxcdn.com"},ft="__KINXCDN_COMMERCE_PLAYER_ENDPOINTS__";function mt(){return globalThis[ft]||{}}function ht(e){e.endpoints&&function(e){globalThis[ft]=Object.assign(Object.assign({},mt()),e)}(e.endpoints)}function gt(){return Object.assign(Object.assign({},pt),mt())}var vt,bt,yt,wt;function Et(...e){return Ae(function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=N(e))&&(r&&(r+=" "),r+=t);return r}(e))}!function(e){e[e.UNLIVE=0]="UNLIVE",e[e.LIVE=1]="LIVE"}(vt||(vt={})),function(e){e[e.NOT_ON_SALE=0]="NOT_ON_SALE",e[e.ON_SALE=1]="ON_SALE"}(bt||(bt={})),function(e){e.LANDSCAPE="landscape",e.PORTRAIT="portrait"}(yt||(yt={})),function(e){e.LIVE="live",e.SHORTS="shorts",e.COLLECTION="collection"}(wt||(wt={})),Xe.extend(nt),Xe.extend(lt),Xe.extend(ut),Xe.locale("ko");const xt=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),St=e=>{const{API_BASE_URL:t}=gt();return`${t}/direct/${e}`},Tt=e=>{if(void 0===e||null==e)return"";return e.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g,",")},Ot=()=>{const e=new Date;return`${e.getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}${String(e.getHours()).padStart(2,"0")}${String(e.getMinutes()).padStart(2,"0")}${String(e.getSeconds()).padStart(2,"0")}`},Ct=()=>{if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e).map(e=>e.toString(16).padStart(2,"0"));return`${t.slice(0,4).join("")}-${t.slice(4,6).join("")}-${t.slice(6,8).join("")}-${t.slice(8,10).join("")}-${t.slice(10,16).join("")}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},Pt=e=>{const t=We,n=JSON.parse(localStorage.getItem(t)||"[]"),r=n.includes(e);return r||(n.push(e),localStorage.setItem(t,JSON.stringify(n))),r},Nt=e=>{const t=Be,n=Math.floor((new Date).getTime()/1e3);let r=!0;switch(e){case Le.NONE:r=!1;break;case Le.DISAPPEAR:localStorage.getItem(t)&&(r=!1);break;case Le.DAY:const e=localStorage.getItem(t);if(!e)break;n-parseInt(e)<86400&&(r=!1)}return r},kt=e=>e.includes("https")?e:"https://"+e,Mt=e=>{e instanceof Error?console.error(e.toString()):console.error(e)};const It=(e,t)=>e>t?yt.LANDSCAPE:yt.PORTRAIT,Dt=({shortform:e,mute:n,play:r})=>{const o=St(e.media.objectId);return Object.assign({hideProducts:!0},e.playerSettings),t.createElement("div",{className:"relative w-full h-full text-white"},t.createElement(P,{file:o,mute:n,play:r}))};var Rt;!function(e){e[e.PLATFORM=1]="PLATFORM",e[e.GRID=2]="GRID",e[e.VERTICAL=3]="VERTICAL",e[e.HORIZONTAL=4]="HORIZONTAL"}(Rt||(Rt={}));
1
+ import*as e from"react";import t,{useRef as r,useEffect as i,forwardRef as n,createElement as s,useState as a,useLayoutEffect as o,createContext as l,useContext as d,useCallback as c,useMemo as u,memo as h,PureComponent as f}from"react";import{jsx as p,Fragment as m,jsxs as g}from"react/jsx-runtime";import*as v from"react-dom";import y,{createPortal as b,flushSync as E}from"react-dom";import{renderToString as w}from"react-dom/server";var S=function(){return S=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},S.apply(this,arguments)};function T(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}function x(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let A=null,k="";const L=({file:e,mute:n=!0,thumbnail:s,play:a=!0})=>{const o=r(null),l=r(null),d=r(!1);return i(()=>{const t=o.current;let r=function(e,t){if(A&&k===t){A.style.cssText="width:100%;height:100%;object-fit:cover;",e.appendChild(A);const t=A;return A=null,k="",t}return null}(t,e);return r||(r=document.createElement("video"),r.playsInline=!0,r.setAttribute("playsinline",""),r.setAttribute("webkit-playsinline",""),r.loop=!0,r.autoplay=!0,r.preload="auto",r.crossOrigin="anonymous",r.style.cssText="width:100%;height:100%;object-fit:cover;",s&&(r.poster=s),r.src=e,r.load(),t.appendChild(r)),r.muted=n,l.current=r,r.onerror=e=>{console.error(e)},()=>{try{r.pause(),r.removeAttribute("src"),r.load()}catch(e){}r.parentElement===t&&t.removeChild(r),l.current=null}},[e]),i(()=>{const e=l.current;e&&(e.muted=n)},[n]),i(()=>{const e=l.current;if(!e)return;if(d.current=!!a,!a)return void e.pause();const t=x(void 0,void 0,void 0,function*(){if(!e||!d.current)return;try{return void(yield e.play())}catch(e){}let t=requestAnimationFrame(()=>x(void 0,void 0,void 0,function*(){if(e&&d.current)try{e.readyState<2&&(yield new Promise(t=>{const r=()=>{e.removeEventListener("loadeddata",r),t()};e.addEventListener("loadeddata",r,{once:!0})})),yield e.play()}catch(t){const r=e.muted;try{e.muted=!0,yield e.play()}catch(e){}const i=()=>{e.muted=r,e.play().catch(()=>{}),window.removeEventListener("touchstart",i,!0),window.removeEventListener("pointerup",i,!0)};window.addEventListener("touchstart",i,!0),window.addEventListener("pointerup",i,!0)}}));return()=>cancelAnimationFrame(t)});return()=>{"function"==typeof t&&t()}},[a]),t.createElement("div",{className:"w-full h-full relative"},t.createElement("div",{ref:o,className:"w-full h-full"}))};function I(e){var t,r,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=I(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}const R=e=>{const t=_(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:e=>{const r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),P(r,t)||C(e)},getConflictingClassGroupIds:(e,t)=>{const n=r[e]||[];return t&&i[e]?[...n,...i[e]]:n}}},P=(e,t)=>{if(0===e.length)return t.classGroupId;const r=e[0],i=t.nextPart.get(r),n=i?P(e.slice(1),i):void 0;if(n)return n;if(0===t.validators.length)return;const s=e.join("-");return t.validators.find(({validator:e})=>e(s))?.classGroupId},D=/^\[(.+)\]$/,C=e=>{if(D.test(e)){const t=D.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},_=e=>{const{theme:t,classGroups:r}=e,i={nextPart:new Map,validators:[]};for(const e in r)O(r[e],i,e,t);return i},O=(e,t,r,i)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:M(t,e)).classGroupId=r)}if("function"==typeof e)return N(e)?void O(e(i),t,r,i):void t.validators.push({validator:e,classGroupId:r});Object.entries(e).forEach(([e,n])=>{O(n,M(t,e),r,i)})})},M=(e,t)=>{let r=e;return t.split("-").forEach(e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)}),r},N=e=>e.isThemeGetter,F=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,i=new Map;const n=(n,s)=>{r.set(n,s),t++,t>e&&(t=0,i=r,r=new Map)};return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=i.get(e))?(n(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):n(e,t)}}},$=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=e=>{const t=[];let r,i=0,n=0,s=0;for(let a=0;a<e.length;a++){let o=e[a];if(0===i&&0===n){if(":"===o){t.push(e.slice(s,a)),s=a+1;continue}if("/"===o){r=a;continue}}"["===o?i++:"]"===o?i--:"("===o?n++:")"===o&&n--}const a=0===t.length?e:e.substring(s),o=B(a);return{modifiers:t,hasImportantModifier:o!==a,baseClassName:o,maybePostfixModifierPosition:r&&r>s?r-s:void 0}};if(t){const e=t+":",r=i;i=t=>t.startsWith(e)?r(t.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:t,maybePostfixModifierPosition:void 0}}if(r){const e=i;i=t=>r({className:t,parseClassName:e})}return i},B=e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,U=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(e=>[e,!0]));return e=>{if(e.length<=1)return e;const r=[];let i=[];return e.forEach(e=>{"["===e[0]||t[e]?(r.push(...i.sort(),e),i=[]):i.push(e)}),r.push(...i.sort()),r}},z=/\s+/;function G(){let e,t,r=0,i="";for(;r<arguments.length;)(e=arguments[r++])&&(t=j(e))&&(i&&(i+=" "),i+=t);return i}const j=e=>{if("string"==typeof e)return e;let t,r="";for(let i=0;i<e.length;i++)e[i]&&(t=j(e[i]))&&(r&&(r+=" "),r+=t);return r};function H(e,...t){let r,i,n,s=function(o){const l=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:F(e.cacheSize),parseClassName:$(e),sortModifiers:U(e),...R(e)}))(l),i=r.cache.get,n=r.cache.set,s=a,a(o)};function a(e){const t=i(e);if(t)return t;const s=((e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:n,sortModifiers:s}=t,a=[],o=e.trim().split(z);let l="";for(let e=o.length-1;e>=0;e-=1){const t=o[e],{isExternal:d,modifiers:c,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:f}=r(t);if(d){l=t+(l.length>0?" "+l:l);continue}let p=!!f,m=i(p?h.substring(0,f):h);if(!m){if(!p){l=t+(l.length>0?" "+l:l);continue}if(m=i(h),!m){l=t+(l.length>0?" "+l:l);continue}p=!1}const g=s(c).join(":"),v=u?g+"!":g,y=v+m;if(a.includes(y))continue;a.push(y);const b=n(m,p);for(let e=0;e<b.length;++e){const t=b[e];a.push(v+t)}l=t+(l.length>0?" "+l:l)}return l})(e,r);return n(e,s),s}return function(){return s(G.apply(null,arguments))}}const V=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},W=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Y=/^\((?:(\w[\w-]*):)?(.+)\)$/i,K=/^\d+\/\d+$/,q=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,X=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Q=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Z=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,J=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ee=e=>K.test(e),te=e=>!!e&&!Number.isNaN(Number(e)),re=e=>!!e&&Number.isInteger(Number(e)),ie=e=>e.endsWith("%")&&te(e.slice(0,-1)),ne=e=>q.test(e),se=()=>!0,ae=e=>X.test(e)&&!Q.test(e),oe=()=>!1,le=e=>Z.test(e),de=e=>J.test(e),ce=e=>!he(e)&&!ye(e),ue=e=>Ae(e,Re,oe),he=e=>W.test(e),fe=e=>Ae(e,Pe,ae),pe=e=>Ae(e,De,te),me=e=>Ae(e,Le,oe),ge=e=>Ae(e,Ie,de),ve=e=>Ae(e,_e,le),ye=e=>Y.test(e),be=e=>ke(e,Pe),Ee=e=>ke(e,Ce),we=e=>ke(e,Le),Se=e=>ke(e,Re),Te=e=>ke(e,Ie),xe=e=>ke(e,_e,!0),Ae=(e,t,r)=>{const i=W.exec(e);return!!i&&(i[1]?t(i[1]):r(i[2]))},ke=(e,t,r=!1)=>{const i=Y.exec(e);return!!i&&(i[1]?t(i[1]):r)},Le=e=>"position"===e||"percentage"===e,Ie=e=>"image"===e||"url"===e,Re=e=>"length"===e||"size"===e||"bg-size"===e,Pe=e=>"length"===e,De=e=>"number"===e,Ce=e=>"family-name"===e,_e=e=>"shadow"===e,Oe=H(()=>{const e=V("color"),t=V("font"),r=V("text"),i=V("font-weight"),n=V("tracking"),s=V("leading"),a=V("breakpoint"),o=V("container"),l=V("spacing"),d=V("radius"),c=V("shadow"),u=V("inset-shadow"),h=V("text-shadow"),f=V("drop-shadow"),p=V("blur"),m=V("perspective"),g=V("aspect"),v=V("ease"),y=V("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ye,he],E=()=>[ye,he,l],w=()=>[ee,"full","auto",...E()],S=()=>[re,"none","subgrid",ye,he],T=()=>["auto",{span:["full",re,ye,he]},re,ye,he],x=()=>[re,"auto",ye,he],A=()=>["auto","min","max","fr",ye,he],k=()=>["auto",...E()],L=()=>[ee,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],I=()=>[e,ye,he],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",we,me,{position:[ye,he]}],P=()=>["auto","cover","contain",Se,ue,{size:[ye,he]}],D=()=>[ie,be,fe],C=()=>["","none","full",d,ye,he],_=()=>["",te,be,fe],O=()=>[te,ie,we,me],M=()=>["","none",p,ye,he],N=()=>["none",te,ye,he],F=()=>["none",te,ye,he],$=()=>[te,ye,he],B=()=>[ee,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ne],breakpoint:[ne],color:[se],container:[ne],"drop-shadow":[ne],ease:["in","out","in-out"],font:[ce],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ne],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ne],shadow:[ne],spacing:["px",te],text:[ne],"text-shadow":[ne],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ee,he,ye,g]}],container:["container"],columns:[{columns:[te,he,ye,o]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[re,"auto",ye,he]}],basis:[{basis:[ee,"full","auto",o,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[te,ee,"auto","initial","none",he]}],grow:[{grow:["",te,ye,he]}],shrink:[{shrink:["",te,ye,he]}],order:[{order:[re,"first","last","none",ye,he]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:T()}],"col-start":[{"col-start":x()}],"col-end":[{"col-end":x()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:T()}],"row-start":[{"row-start":x()}],"row-end":[{"row-end":x()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[o,"screen",...L()]}],"min-w":[{"min-w":[o,"screen","none",...L()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...L()]}],h:[{h:["screen",...L()]}],"min-h":[{"min-h":["screen","none",...L()]}],"max-h":[{"max-h":["screen",...L()]}],"font-size":[{text:["base",r,be,fe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ye,pe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ie,he]}],"font-family":[{font:[Ee,he,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,ye,he]}],"line-clamp":[{"line-clamp":[te,"none",ye,pe]}],leading:[{leading:[s,...E()]}],"list-image":[{"list-image":["none",ye,he]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,he]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[te,"from-font","auto",ye,fe]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[te,"auto",ye,he]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,he]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye,he]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},re,ye,he],radial:["",ye,he],conic:[re,ye,he]},Te,ge]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:C()}],"rounded-s":[{"rounded-s":C()}],"rounded-e":[{"rounded-e":C()}],"rounded-t":[{"rounded-t":C()}],"rounded-r":[{"rounded-r":C()}],"rounded-b":[{"rounded-b":C()}],"rounded-l":[{"rounded-l":C()}],"rounded-ss":[{"rounded-ss":C()}],"rounded-se":[{"rounded-se":C()}],"rounded-ee":[{"rounded-ee":C()}],"rounded-es":[{"rounded-es":C()}],"rounded-tl":[{"rounded-tl":C()}],"rounded-tr":[{"rounded-tr":C()}],"rounded-br":[{"rounded-br":C()}],"rounded-bl":[{"rounded-bl":C()}],"border-w":[{border:_()}],"border-w-x":[{"border-x":_()}],"border-w-y":[{"border-y":_()}],"border-w-s":[{"border-s":_()}],"border-w-e":[{"border-e":_()}],"border-w-t":[{"border-t":_()}],"border-w-r":[{"border-r":_()}],"border-w-b":[{"border-b":_()}],"border-w-l":[{"border-l":_()}],"divide-x":[{"divide-x":_()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":_()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[te,ye,he]}],"outline-w":[{outline:["",te,be,fe]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",c,xe,ve]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",u,xe,ve]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[te,fe]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":_()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",h,xe,ve]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[te,ye,he]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[te]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[ye,he]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[te]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,he]}],filter:[{filter:["","none",ye,he]}],blur:[{blur:M()}],brightness:[{brightness:[te,ye,he]}],contrast:[{contrast:[te,ye,he]}],"drop-shadow":[{"drop-shadow":["","none",f,xe,ve]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",te,ye,he]}],"hue-rotate":[{"hue-rotate":[te,ye,he]}],invert:[{invert:["",te,ye,he]}],saturate:[{saturate:[te,ye,he]}],sepia:[{sepia:["",te,ye,he]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,he]}],"backdrop-blur":[{"backdrop-blur":M()}],"backdrop-brightness":[{"backdrop-brightness":[te,ye,he]}],"backdrop-contrast":[{"backdrop-contrast":[te,ye,he]}],"backdrop-grayscale":[{"backdrop-grayscale":["",te,ye,he]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[te,ye,he]}],"backdrop-invert":[{"backdrop-invert":["",te,ye,he]}],"backdrop-opacity":[{"backdrop-opacity":[te,ye,he]}],"backdrop-saturate":[{"backdrop-saturate":[te,ye,he]}],"backdrop-sepia":[{"backdrop-sepia":["",te,ye,he]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,he]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[te,"initial",ye,he]}],ease:[{ease:["linear","initial",v,ye,he]}],delay:[{delay:[te,ye,he]}],animate:[{animate:["none",y,ye,he]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ye,he]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:N()}],"rotate-x":[{"rotate-x":N()}],"rotate-y":[{"rotate-y":N()}],"rotate-z":[{"rotate-z":N()}],scale:[{scale:F()}],"scale-x":[{"scale-x":F()}],"scale-y":[{"scale-y":F()}],"scale-z":[{"scale-z":F()}],"scale-3d":["scale-3d"],skew:[{skew:$()}],"skew-x":[{"skew-x":$()}],"skew-y":[{"skew-y":$()}],transform:[{transform:[ye,he,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:B()}],"translate-x":[{"translate-x":B()}],"translate-y":[{"translate-y":B()}],"translate-z":[{"translate-z":B()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ye,he]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye,he]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[te,be,fe,pe]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});var Me,Ne,Fe,$e,Be,Ue;!function(e){e.INSTA="INSTA",e.YOUTUBE="YOUTUBE",e.SQUARE="SQUARE"}(Me||(Me={})),function(e){e.MANY="MANY",e.ONE="ONE"}(Ne||(Ne={})),function(e){e.ALWAYS="ALWAYS",e.DAY="DAY",e.DISAPPEAR="DISAPPEAR",e.NONE="NONE"}(Fe||(Fe={})),function(e){e.POPUP="POPUP",e.PLATFORM="PLATFORM",e.TABLET="TABLET",e.GRID="GRID",e.VERTICAL="VERTICAL",e.HORIZONTAL="HORIZONTAL"}($e||($e={})),function(e){e.BOTTOM="BOTTOM",e.INNER="INNER"}(Be||(Be={})),function(e){e[e.PLATFORM=1]="PLATFORM",e[e.VERTICAL=2]="VERTICAL",e[e.PRODUCTS=3]="PRODUCTS",e[e.HORIZONTAL=4]="HORIZONTAL",e[e.TABLET=5]="TABLET"}(Ue||(Ue={}));const ze="mbus-viewed-shorts",Ge="mbus-last-played";function je(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function He(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}),r}var Ve,We={exports:{}};function Ye(){return Ve||(Ve=1,We.exports=function(){var e=1e3,t=6e4,r=36e5,i="millisecond",n="second",s="minute",a="hour",o="day",l="week",d="month",c="quarter",u="year",h="date",f="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},v=function(e,t,r){var i=String(e);return!i||i.length>=t?e:""+Array(t+1-i.length).join(r)+e},y={s:v,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),i=Math.floor(r/60),n=r%60;return(t<=0?"+":"-")+v(i,2,"0")+":"+v(n,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var i=12*(r.year()-t.year())+(r.month()-t.month()),n=t.clone().add(i,d),s=r-n<0,a=t.clone().add(i+(s?-1:1),d);return+(-(i+(r-n)/(s?n-a:a-n))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:d,y:u,w:l,d:o,D:h,h:a,m:s,s:n,ms:i,Q:c}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",E={};E[b]=g;var w="$isDayjsObject",S=function(e){return e instanceof k||!(!e||!e[w])},T=function e(t,r,i){var n;if(!t)return b;if("string"==typeof t){var s=t.toLowerCase();E[s]&&(n=s),r&&(E[s]=r,n=s);var a=t.split("-");if(!n&&a.length>1)return e(a[0])}else{var o=t.name;E[o]=t,n=o}return!i&&n&&(b=n),n||!i&&b},x=function(e,t){if(S(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new k(r)},A=y;A.l=T,A.i=S,A.w=function(e,t){return x(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var k=function(){function g(e){this.$L=T(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[w]=!0}var v=g.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(A.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var i=t.match(p);if(i){var n=i[2]-1||0,s=(i[7]||"0").substring(0,3);return r?new Date(Date.UTC(i[1],n,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],n,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(t)}(e),this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return A},v.isValid=function(){return!(this.$d.toString()===f)},v.isSame=function(e,t){var r=x(e);return this.startOf(t)<=r&&r<=this.endOf(t)},v.isAfter=function(e,t){return x(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<x(e)},v.$g=function(e,t,r){return A.u(e)?this[t]:this.set(r,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var r=this,i=!!A.u(t)||t,c=A.p(e),f=function(e,t){var n=A.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return i?n:n.endOf(o)},p=function(e,t){return A.w(r.toDate()[e].apply(r.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},m=this.$W,g=this.$M,v=this.$D,y="set"+(this.$u?"UTC":"");switch(c){case u:return i?f(1,0):f(31,11);case d:return i?f(1,g):f(0,g+1);case l:var b=this.$locale().weekStart||0,E=(m<b?m+7:m)-b;return f(i?v-E:v+(6-E),g);case o:case h:return p(y+"Hours",0);case a:return p(y+"Minutes",1);case s:return p(y+"Seconds",2);case n:return p(y+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var r,l=A.p(e),c="set"+(this.$u?"UTC":""),f=(r={},r[o]=c+"Date",r[h]=c+"Date",r[d]=c+"Month",r[u]=c+"FullYear",r[a]=c+"Hours",r[s]=c+"Minutes",r[n]=c+"Seconds",r[i]=c+"Milliseconds",r)[l],p=l===o?this.$D+(t-this.$W):t;if(l===d||l===u){var m=this.clone().set(h,1);m.$d[f](p),m.init(),this.$d=m.set(h,Math.min(this.$D,m.daysInMonth())).$d}else f&&this.$d[f](p);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[A.p(e)]()},v.add=function(i,c){var h,f=this;i=Number(i);var p=A.p(c),m=function(e){var t=x(f);return A.w(t.date(t.date()+Math.round(e*i)),f)};if(p===d)return this.set(d,this.$M+i);if(p===u)return this.set(u,this.$y+i);if(p===o)return m(1);if(p===l)return m(7);var g=(h={},h[s]=t,h[a]=r,h[n]=e,h)[p]||1,v=this.$d.getTime()+i*g;return A.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||f;var i=e||"YYYY-MM-DDTHH:mm:ssZ",n=A.z(this),s=this.$H,a=this.$m,o=this.$M,l=r.weekdays,d=r.months,c=r.meridiem,u=function(e,r,n,s){return e&&(e[r]||e(t,i))||n[r].slice(0,s)},h=function(e){return A.s(s%12||12,e,"0")},p=c||function(e,t,r){var i=e<12?"AM":"PM";return r?i.toLowerCase():i};return i.replace(m,function(e,i){return i||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return A.s(t.$y,4,"0");case"M":return o+1;case"MM":return A.s(o+1,2,"0");case"MMM":return u(r.monthsShort,o,d,3);case"MMMM":return u(d,o);case"D":return t.$D;case"DD":return A.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return u(r.weekdaysMin,t.$W,l,2);case"ddd":return u(r.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(s);case"HH":return A.s(s,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return p(s,a,!0);case"A":return p(s,a,!1);case"m":return String(a);case"mm":return A.s(a,2,"0");case"s":return String(t.$s);case"ss":return A.s(t.$s,2,"0");case"SSS":return A.s(t.$ms,3,"0");case"Z":return n}return null}(e)||n.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(i,h,f){var p,m=this,g=A.p(h),v=x(i),y=(v.utcOffset()-this.utcOffset())*t,b=this-v,E=function(){return A.m(m,v)};switch(g){case u:p=E()/12;break;case d:p=E();break;case c:p=E()/3;break;case l:p=(b-y)/6048e5;break;case o:p=(b-y)/864e5;break;case a:p=b/r;break;case s:p=b/t;break;case n:p=b/e;break;default:p=b}return f?p:A.a(p)},v.daysInMonth=function(){return this.endOf(d).$D},v.$locale=function(){return E[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),i=T(e,t,!0);return i&&(r.$L=i),r},v.clone=function(){return A.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},g}(),L=k.prototype;return x.prototype=L,[["$ms",i],["$s",n],["$m",s],["$H",a],["$W",o],["$M",d],["$y",u],["$D",h]].forEach(function(e){L[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),x.extend=function(e,t){return e.$i||(e(t,k,x),e.$i=!0),x},x.locale=T,x.isDayjs=S,x.unix=function(e){return x(1e3*e)},x.en=E[b],x.Ls=E,x.p={},x}()),We.exports}var Ke,qe=je(Ye()),Xe={exports:{}};var Qe,Ze,Je,et,tt=(Ke||(Ke=1,Xe.exports=(Qe="minute",Ze=/[+-]\d\d(?::?\d\d)?/g,Je=/([+-]|\d\d)/g,function(e,t,r){var i=t.prototype;r.utc=function(e){return new t({date:e,utc:!0,args:arguments})},i.utc=function(e){var t=r(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),Qe):t},i.local=function(){return r(this.toDate(),{locale:this.$L,utc:!1})};var n=i.parse;i.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),n.call(this,e)};var s=i.init;i.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else s.call(this)};var a=i.utcOffset;i.utcOffset=function(e,t){var r=this.$utils().u;if(r(e))return this.$u?0:r(this.$offset)?a.call(this):this.$offset;if("string"==typeof e&&(e=function(e){void 0===e&&(e="");var t=e.match(Ze);if(!t)return null;var r=(""+t[0]).match(Je)||["-",0,0],i=r[0],n=60*+r[1]+ +r[2];return 0===n?0:"+"===i?n:-n}(e),null===e))return this;var i=Math.abs(e)<=16?60*e:e;if(0===i)return this.utc(t);var n=this.clone();if(t)return n.$offset=i,n.$u=!1,n;var s=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(n=this.local().add(i+s,Qe)).$offset=i,n.$x.$localOffset=s,n};var o=i.format;i.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return o.call(this,t)},i.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var l=i.toDate;i.toDate=function(e){return"s"===e&&this.$offset?r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var d=i.diff;i.diff=function(e,t,i){if(e&&this.$u===e.$u)return d.call(this,e,t,i);var n=this.local(),s=r(e).local();return d.call(n,s,t,i)}})),Xe.exports),rt=je(tt),it={exports:{}};et||(et=1,it.exports=function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e),i={name:"ko",weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),ordinal:function(e){return e+"일"},formats:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h:mm",LLLL:"YYYY년 MMMM D일 dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY년 MMMM D일",lll:"YYYY년 MMMM D일 A h:mm",llll:"YYYY년 MMMM D일 dddd A h:mm"},meridiem:function(e){return e<12?"오전":"오후"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",m:"1분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"}};return r.default.locale(i,null,!0),i}(Ye()));var nt,st={exports:{}};var at,ot=(nt||(nt=1,st.exports=function(){var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,i,n){var s,a=function(e,r,i){void 0===i&&(i={});var n=new Date(e),s=function(e,r){void 0===r&&(r={});var i=r.timeZoneName||"short",n=e+"|"+i,s=t[n];return s||(s=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),t[n]=s),s}(r,i);return s.formatToParts(n)},o=function(t,r){for(var i=a(t,r),s=[],o=0;o<i.length;o+=1){var l=i[o],d=l.type,c=l.value,u=e[d];u>=0&&(s[u]=parseInt(c,10))}var h=s[3],f=24===h?0:h,p=s[0]+"-"+s[1]+"-"+s[2]+" "+f+":"+s[4]+":"+s[5]+":000",m=+t;return(n.utc(p).valueOf()-(m-=m%1e3))/6e4},l=i.prototype;l.tz=function(e,t){void 0===e&&(e=s);var r,i=this.utcOffset(),a=this.toDate(),o=a.toLocaleString("en-US",{timeZone:e}),l=Math.round((a-new Date(o))/1e3/60),d=15*-Math.round(a.getTimezoneOffset()/15)-l;if(Number(d)){if(r=n(o,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(d,!0),t){var c=r.utcOffset();r=r.add(i-c,"minute")}}else r=this.utcOffset(0,t);return r.$x.$timezone=e,r},l.offsetName=function(e){var t=this.$x.$timezone||n.tz.guess(),r=a(this.valueOf(),t,{timeZoneName:e}).find(function(e){return"timezonename"===e.type.toLowerCase()});return r&&r.value};var d=l.startOf;l.startOf=function(e,t){if(!this.$x||!this.$x.$timezone)return d.call(this,e,t);var r=n(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return d.call(r,e,t).tz(this.$x.$timezone,!0)},n.tz=function(e,t,r){var i=r&&t,a=r||t||s,l=o(+n(),a);if("string"!=typeof e)return n(e).tz(a);var d=function(e,t,r){var i=e-60*t*1e3,n=o(i,r);if(t===n)return[i,t];var s=o(i-=60*(n-t)*1e3,r);return n===s?[i,n]:[e-60*Math.min(n,s)*1e3,Math.max(n,s)]}(n.utc(e,i).valueOf(),l,a),c=d[0],u=d[1],h=n(c).utcOffset(u);return h.$x.$timezone=a,h},n.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},n.tz.setDefault=function(e){s=e}}}()),st.exports),lt=je(ot),dt={exports:{}};var ct=(at||(at=1,dt.exports=function(){var e,t,r=1e3,i=6e4,n=36e5,s=864e5,a=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,o=31536e6,l=2628e6,d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,c={years:o,months:l,days:s,hours:n,minutes:i,seconds:r,milliseconds:1,weeks:6048e5},u=function(e){return e instanceof y},h=function(e,t,r){return new y(e,r,t.$l)},f=function(e){return t.p(e)+"s"},p=function(e){return e<0},m=function(e){return p(e)?Math.ceil(e):Math.floor(e)},g=function(e){return Math.abs(e)},v=function(e,t){return e?p(e)?{negative:!0,format:""+g(e)+t}:{negative:!1,format:""+e+t}:{negative:!1,format:""}},y=function(){function p(e,t,r){var i=this;if(this.$d={},this.$l=r,void 0===e&&(this.$ms=0,this.parseFromMilliseconds()),t)return h(e*c[f(t)],this);if("number"==typeof e)return this.$ms=e,this.parseFromMilliseconds(),this;if("object"==typeof e)return Object.keys(e).forEach(function(t){i.$d[f(t)]=e[t]}),this.calMilliseconds(),this;if("string"==typeof e){var n=e.match(d);if(n){var s=n.slice(2).map(function(e){return null!=e?Number(e):0});return this.$d.years=s[0],this.$d.months=s[1],this.$d.weeks=s[2],this.$d.days=s[3],this.$d.hours=s[4],this.$d.minutes=s[5],this.$d.seconds=s[6],this.calMilliseconds(),this}}return this}var g=p.prototype;return g.calMilliseconds=function(){var e=this;this.$ms=Object.keys(this.$d).reduce(function(t,r){return t+(e.$d[r]||0)*c[r]},0)},g.parseFromMilliseconds=function(){var e=this.$ms;this.$d.years=m(e/o),e%=o,this.$d.months=m(e/l),e%=l,this.$d.days=m(e/s),e%=s,this.$d.hours=m(e/n),e%=n,this.$d.minutes=m(e/i),e%=i,this.$d.seconds=m(e/r),e%=r,this.$d.milliseconds=e},g.toISOString=function(){var e=v(this.$d.years,"Y"),t=v(this.$d.months,"M"),r=+this.$d.days||0;this.$d.weeks&&(r+=7*this.$d.weeks);var i=v(r,"D"),n=v(this.$d.hours,"H"),s=v(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3,a=Math.round(1e3*a)/1e3);var o=v(a,"S"),l=e.negative||t.negative||i.negative||n.negative||s.negative||o.negative,d=n.format||s.format||o.format?"T":"",c=(l?"-":"")+"P"+e.format+t.format+i.format+d+n.format+s.format+o.format;return"P"===c||"-P"===c?"P0D":c},g.toJSON=function(){return this.toISOString()},g.format=function(e){var r=e||"YYYY-MM-DDTHH:mm:ss",i={Y:this.$d.years,YY:t.s(this.$d.years,2,"0"),YYYY:t.s(this.$d.years,4,"0"),M:this.$d.months,MM:t.s(this.$d.months,2,"0"),D:this.$d.days,DD:t.s(this.$d.days,2,"0"),H:this.$d.hours,HH:t.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:t.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:t.s(this.$d.seconds,2,"0"),SSS:t.s(this.$d.milliseconds,3,"0")};return r.replace(a,function(e,t){return t||String(i[e])})},g.as=function(e){return this.$ms/c[f(e)]},g.get=function(e){var t=this.$ms,r=f(e);return"milliseconds"===r?t%=1e3:t="weeks"===r?m(t/c[r]):this.$d[r],t||0},g.add=function(e,t,r){var i;return i=t?e*c[f(t)]:u(e)?e.$ms:h(e,this).$ms,h(this.$ms+i*(r?-1:1),this)},g.subtract=function(e,t){return this.add(e,t,!0)},g.locale=function(e){var t=this.clone();return t.$l=e,t},g.clone=function(){return h(this.$ms,this)},g.humanize=function(t){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!t)},g.valueOf=function(){return this.asMilliseconds()},g.milliseconds=function(){return this.get("milliseconds")},g.asMilliseconds=function(){return this.as("milliseconds")},g.seconds=function(){return this.get("seconds")},g.asSeconds=function(){return this.as("seconds")},g.minutes=function(){return this.get("minutes")},g.asMinutes=function(){return this.as("minutes")},g.hours=function(){return this.get("hours")},g.asHours=function(){return this.as("hours")},g.days=function(){return this.get("days")},g.asDays=function(){return this.as("days")},g.weeks=function(){return this.get("weeks")},g.asWeeks=function(){return this.as("weeks")},g.months=function(){return this.get("months")},g.asMonths=function(){return this.as("months")},g.years=function(){return this.get("years")},g.asYears=function(){return this.as("years")},p}(),b=function(e,t,r){return e.add(t.years()*r,"y").add(t.months()*r,"M").add(t.days()*r,"d").add(t.hours()*r,"h").add(t.minutes()*r,"m").add(t.seconds()*r,"s").add(t.milliseconds()*r,"ms")};return function(r,i,n){e=n,t=n().$utils(),n.duration=function(e,t){var r=n.locale();return h(e,{$l:r},t)},n.isDuration=u;var s=i.prototype.add,a=i.prototype.subtract;i.prototype.add=function(e,t){return u(e)?b(this,e,1):s.bind(this)(e,t)},i.prototype.subtract=function(e,t){return u(e)?b(this,e,-1):a.bind(this)(e,t)}}}()),dt.exports),ut=je(ct);console.log("[commerce-player configs instance]",Math.random());const ht={API_BASE_URL:"https://api.midibus.im:8001",STATISTICS_BASE_URL:"https://playdata.midibus.im",PLAYER_BACK_BASE_URL:"https://back-playdata.midibus.im",PLAYER_BASE_URL:"https://mcommerce-play.midibus.kinxcdn.com"},ft="__KINXCDN_COMMERCE_PLAYER_ENDPOINTS__";function pt(){return globalThis[ft]||{}}function mt(e){e.endpoints&&function(e){globalThis[ft]=Object.assign(Object.assign({},pt()),e)}(e.endpoints)}function gt(){return Object.assign(Object.assign({},ht),pt())}var vt,yt,bt,Et;function wt(...e){return Oe(function(){for(var e,t,r=0,i="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=I(e))&&(i&&(i+=" "),i+=t);return i}(e))}!function(e){e[e.UNLIVE=0]="UNLIVE",e[e.LIVE=1]="LIVE"}(vt||(vt={})),function(e){e[e.NOT_ON_SALE=0]="NOT_ON_SALE",e[e.ON_SALE=1]="ON_SALE"}(yt||(yt={})),function(e){e.LANDSCAPE="landscape",e.PORTRAIT="portrait"}(bt||(bt={})),function(e){e.LIVE="live",e.SHORTS="shorts",e.COLLECTION="collection"}(Et||(Et={})),qe.extend(rt),qe.extend(lt),qe.extend(ut),qe.locale("ko");const St=e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),Tt=e=>{const{API_BASE_URL:t}=gt();return`${t}/direct/${e}`},xt=e=>{if(void 0===e||null==e)return"";return e.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g,",")},At=()=>{const e=new Date;return`${e.getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}${String(e.getHours()).padStart(2,"0")}${String(e.getMinutes()).padStart(2,"0")}${String(e.getSeconds()).padStart(2,"0")}`},kt=()=>{if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e).map(e=>e.toString(16).padStart(2,"0"));return`${t.slice(0,4).join("")}-${t.slice(4,6).join("")}-${t.slice(6,8).join("")}-${t.slice(8,10).join("")}-${t.slice(10,16).join("")}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},Lt=e=>{const t=ze,r=JSON.parse(localStorage.getItem(t)||"[]"),i=r.includes(e);return i||(r.push(e),localStorage.setItem(t,JSON.stringify(r))),i},It=e=>{const t=Ge,r=Math.floor((new Date).getTime()/1e3);let i=!0;switch(e){case Fe.NONE:i=!1;break;case Fe.DISAPPEAR:localStorage.getItem(t)&&(i=!1);break;case Fe.DAY:const e=localStorage.getItem(t);if(!e)break;r-parseInt(e)<86400&&(i=!1)}return i},Rt=e=>e.includes("https")?e:"https://"+e,Pt=e=>{e instanceof Error?console.error(e.toString()):console.error(e)};const Dt=(e,t)=>e>t?bt.LANDSCAPE:bt.PORTRAIT,Ct=({shortform:e,mute:r,play:i})=>{const n=Tt(e.media.objectId);return Object.assign({hideProducts:!0},e.playerSettings),t.createElement("div",{className:"relative w-full h-full text-white"},t.createElement(L,{file:n,mute:r,play:i}))};var _t;!function(e){e[e.PLATFORM=1]="PLATFORM",e[e.GRID=2]="GRID",e[e.VERTICAL=3]="VERTICAL",e[e.HORIZONTAL=4]="HORIZONTAL"}(_t||(_t={}));
2
2
  /**
3
3
  * @license lucide-react v0.503.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
7
  */
8
- const At=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},zt=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),_t=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
8
+ const Ot=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},Mt=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),Nt=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
9
9
  /**
10
10
  * @license lucide-react v0.503.0 - ISC
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
13
  * See the LICENSE file in the root directory of this source tree.
14
14
  */
15
- var Lt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
15
+ var Ft={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
16
16
  /**
17
17
  * @license lucide-react v0.503.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const $t=o(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:a,iconNode:s,...l},c)=>i("svg",{ref:c,...Lt,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:zt("lucide",o),...!a&&!_t(l)&&{"aria-hidden":"true"},...l},[...s.map(([e,t])=>i(e,t)),...Array.isArray(a)?a:[a]])),jt=(e,t)=>{const n=o(({className:n,...r},o)=>{return i($t,{ref:o,iconNode:t,className:zt(`lucide-${a=At(e),a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...r});var a});return n.displayName=At(e),n},Ft=jt("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Wt=jt("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Bt=jt("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Ht=jt("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Vt=jt("heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]),Ut=jt("pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]),Yt=jt("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),Gt=jt("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),qt=jt("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),Xt=jt("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),Kt=jt("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Zt=()=>t.createElement("div",{className:"text-white rounded max-w-fit bg-[rgba(0,0,0,.3)] flex overflow-hidden items-center text-[12px] h-6 mt-2"},t.createElement("div",{className:"bg-[#0ab060] h-full flex gap-1 items-center"},t.createElement(Yt,{size:18}),t.createElement("span",{className:"pr-1"},"조회수")),t.createElement("div",{className:"p-1"},"123 시청")),Jt=({width:e,height:n})=>t.createElement("div",{className:"w-full h-full flex items-center justify-center"},t.createElement("img",{src:"public/images/noImage.svg",alt:"no image",width:e||50,height:n||50})),Qt=({product:e,onError:n})=>t.createElement("img",{src:e.thumbPath,alt:e.productName,className:"object-cover p-0 flex-none",style:{height:"80px",width:"80px"},onError:n}),en=({product:e})=>{const[n,r]=a(!1);return t.createElement("div",{className:"flex gap-3 text-sm cursor-pointer h-[100px] items-center"},t.createElement("div",{className:"h-full border rounded aspect-square"},e.thumbPath&&!n?t.createElement(Qt,{product:e,onError:()=>r(!0)}):t.createElement(Jt,null)),t.createElement("div",{className:"justify-center flex flex-col"},e.brand&&t.createElement("p",{className:"max-w-52 break-keep line-clamp-1 text-xs text-gray-500"},e.brand.brandName),t.createElement("p",{className:"max-w-52 break-keep line-clamp-2"},e.productName),t.createElement("div",null,t.createElement("span",{className:"font-semibold text-red-500"},e.discount,"%"," "),t.createElement("span",{className:"font-semibold"},Tt(e.sellingPrice),"원"))))},tn=()=>t.createElement("div",{className:"flex flex-col gap-2 overflow-y-auto max-h-[150px] px-2"},t.createElement("p",{className:"font-medium text-gray-400 text-sm"},"영상과 무관하거나 욕설, 비방 등의 댓글은 관리자에 의해 삭제될 수 있습니다."),t.createElement("div",null,t.createElement("div",{className:"flex justify-between"},t.createElement("div",null,t.createElement("p",{className:"font-semibold"},"유저 ID"),t.createElement("p",null,"댓글 내용"),t.createElement("span",{className:"text-gray-500"},"2024.01.01"))))),nn=()=>t.createElement("div",{className:"inline-block absolute pointer-events-none top-0 z-10 animate-float"},t.createElement(Vt,{className:"fill-red-500 text-transparent"})),rn=({rounded:e})=>{const[n,r]=a(234),[o,i]=a([]),s=()=>T(void 0,void 0,void 0,function*(){(()=>{const e=Date.now();i(t=>[...t,e]),setTimeout(()=>{i(t=>t.filter(t=>t!==e))},2e3)})(),r(e=>e+1)});return e?t.createElement("div",{className:"w-14 h-14 bg-white rounded-full flex justify-center"},t.createElement("div",{className:"flex justify-center flex-col items-center relative"},t.createElement("div",{onClick:s,style:{border:"none"},className:"z-[5] cursor-pointer"},t.createElement(Vt,{className:"text-xl fill-black"})),o.map(e=>t.createElement(nn,{key:e})),t.createElement("span",{className:"break-keep text-xs"},Tt(n)))):t.createElement("div",{className:"flex justify-center flex-col items-center relative"},t.createElement("div",{onClick:s,className:"z-[5] cursor-pointer"},t.createElement(Vt,{className:"text-xl fill-white"})),o.map(e=>t.createElement(nn,{key:e})),t.createElement("span",{className:"break-keep text-xs"},Tt(n)))},on=({rounded:e})=>e?t.createElement("div",{className:"w-14 h-14 bg-white rounded-full flex justify-center "},t.createElement("button",{className:"cursor-pointer"},t.createElement(Gt,{size:28}))):t.createElement("button",{className:"cursor-pointer"},t.createElement(Gt,{size:28})),an=({rounded:e,mute:n,handleMute:r,iconSize:o})=>e?t.createElement("div",{className:"w-12 h-12 bg-white rounded-full flex justify-center items-center "},t.createElement("button",Object.assign({className:"cursor-pointer"},r&&{onClick:r}),n?t.createElement(qt,{size:28}):t.createElement(Xt,{size:28}))):t.createElement("button",Object.assign({className:"cursor-pointer"},r&&{onClick:r}),n?t.createElement(qt,{size:o||28}):t.createElement(Xt,{size:o||28}));
21
+ */const $t=n(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:n="",children:a,iconNode:o,...l},d)=>s("svg",{ref:d,...Ft,width:t,height:t,stroke:e,strokeWidth:i?24*Number(r)/Number(t):r,className:Mt("lucide",n),...!a&&!Nt(l)&&{"aria-hidden":"true"},...l},[...o.map(([e,t])=>s(e,t)),...Array.isArray(a)?a:[a]])),Bt=(e,t)=>{const r=n(({className:r,...i},n)=>{return s($t,{ref:n,iconNode:t,className:Mt(`lucide-${a=Ot(e),a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...i});var a});return r.displayName=Ot(e),r},Ut=Bt("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),zt=Bt("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Gt=Bt("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),jt=Bt("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Ht=Bt("heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]),Vt=Bt("pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]),Wt=Bt("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),Yt=Bt("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Kt=Bt("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),qt=Bt("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),Xt=Bt("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Qt=()=>t.createElement("div",{className:"text-white rounded max-w-fit bg-[rgba(0,0,0,.3)] flex overflow-hidden items-center text-[12px] h-6 mt-2"},t.createElement("div",{className:"bg-[#0ab060] h-full flex gap-1 items-center"},t.createElement(Wt,{size:18}),t.createElement("span",{className:"pr-1"},"조회수")),t.createElement("div",{className:"p-1"},"123 시청")),Zt=({width:e,height:r})=>t.createElement("div",{className:"w-full h-full flex items-center justify-center"},t.createElement("img",{src:"public/images/noImage.svg",alt:"no image",width:e||50,height:r||50})),Jt=({product:e,onError:r})=>t.createElement("img",{src:e.thumbPath,alt:e.productName,className:"object-cover p-0 flex-none",style:{height:"80px",width:"80px"},onError:r}),er=({product:e})=>{const[r,i]=a(!1);return t.createElement("div",{className:"flex gap-3 text-sm cursor-pointer h-[100px] items-center"},t.createElement("div",{className:"h-full border rounded aspect-square"},e.thumbPath&&!r?t.createElement(Jt,{product:e,onError:()=>i(!0)}):t.createElement(Zt,null)),t.createElement("div",{className:"justify-center flex flex-col"},e.brand&&t.createElement("p",{className:"max-w-52 break-keep line-clamp-1 text-xs text-gray-500"},e.brand.brandName),t.createElement("p",{className:"max-w-52 break-keep line-clamp-2"},e.productName),t.createElement("div",null,t.createElement("span",{className:"font-semibold text-red-500"},e.discount,"%"," "),t.createElement("span",{className:"font-semibold"},xt(e.sellingPrice),"원"))))},tr=()=>t.createElement("div",{className:"flex flex-col gap-2 overflow-y-auto max-h-[150px] px-2"},t.createElement("p",{className:"font-medium text-gray-400 text-sm"},"영상과 무관하거나 욕설, 비방 등의 댓글은 관리자에 의해 삭제될 수 있습니다."),t.createElement("div",null,t.createElement("div",{className:"flex justify-between"},t.createElement("div",null,t.createElement("p",{className:"font-semibold"},"유저 ID"),t.createElement("p",null,"댓글 내용"),t.createElement("span",{className:"text-gray-500"},"2024.01.01"))))),rr=()=>t.createElement("div",{className:"inline-block absolute pointer-events-none top-0 z-10 animate-float"},t.createElement(Ht,{className:"fill-red-500 text-transparent"})),ir=({rounded:e})=>{const[r,i]=a(234),[n,s]=a([]),o=()=>x(void 0,void 0,void 0,function*(){(()=>{const e=Date.now();s(t=>[...t,e]),setTimeout(()=>{s(t=>t.filter(t=>t!==e))},2e3)})(),i(e=>e+1)});return e?t.createElement("div",{className:"w-14 h-14 bg-white rounded-full flex justify-center"},t.createElement("div",{className:"flex justify-center flex-col items-center relative"},t.createElement("div",{onClick:o,style:{border:"none"},className:"z-[5] cursor-pointer"},t.createElement(Ht,{className:"text-xl fill-black"})),n.map(e=>t.createElement(rr,{key:e})),t.createElement("span",{className:"break-keep text-xs"},xt(r)))):t.createElement("div",{className:"flex justify-center flex-col items-center relative"},t.createElement("div",{onClick:o,className:"z-[5] cursor-pointer"},t.createElement(Ht,{className:"text-xl fill-white"})),n.map(e=>t.createElement(rr,{key:e})),t.createElement("span",{className:"break-keep text-xs"},xt(r)))},nr=({rounded:e})=>e?t.createElement("div",{className:"w-14 h-14 bg-white rounded-full flex justify-center "},t.createElement("button",{className:"cursor-pointer"},t.createElement(Yt,{size:28}))):t.createElement("button",{className:"cursor-pointer"},t.createElement(Yt,{size:28})),sr=({rounded:e,mute:r,handleMute:i,iconSize:n})=>e?t.createElement("div",{className:"w-12 h-12 bg-white rounded-full flex justify-center items-center "},t.createElement("button",Object.assign({className:"cursor-pointer"},i&&{onClick:i}),r?t.createElement(Kt,{size:28}):t.createElement(qt,{size:28}))):t.createElement("button",Object.assign({className:"cursor-pointer"},i&&{onClick:i}),r?t.createElement(Kt,{size:n||28}):t.createElement(qt,{size:n||28}));
22
22
  /**
23
23
  * @license lucide-react v0.503.0 - ISC
24
24
  *
25
25
  * This source code is licensed under the ISC license.
26
26
  * See the LICENSE file in the root directory of this source tree.
27
- */function sn(t,n=[]){let r=[];const o=()=>{const n=r.map(t=>e.createContext(t));return function(r){const o=r?.[t]||n;return e.useMemo(()=>({[`__scope${t}`]:{...r,[t]:o}}),[r,o])}};return o.scopeName=t,[function(n,o){const i=e.createContext(o),a=r.length;r=[...r,o];const s=n=>{const{scope:r,children:o,...s}=n,l=r?.[t]?.[a]||i,c=e.useMemo(()=>s,Object.values(s));return m(l.Provider,{value:c,children:o})};return s.displayName=n+"Provider",[s,function(r,s){const l=s?.[t]?.[a]||i,c=e.useContext(l);if(c)return c;if(void 0!==o)return o;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},ln(o,...n)]}function ln(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const o=r.reduce((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]}),{});return e.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return r.scopeName=n.scopeName,r}function cn(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function dn(...e){return t=>{let n=!1;const r=e.map(e=>{const r=cn(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():cn(e[t],null)}}}}function un(...t){return e.useCallback(dn(...t),t)}var pn=e.forwardRef((t,n)=>{const{children:r,...o}=t,i=e.Children.toArray(r),a=i.find(hn);if(a){const t=a.props.children,r=i.map(n=>n===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return m(fn,{...o,ref:n,children:e.isValidElement(t)?e.cloneElement(t,void 0,r):null})}return m(fn,{...o,ref:n,children:r})});pn.displayName="Slot";var fn=e.forwardRef((t,n)=>{const{children:r,...o}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),i=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==e.Fragment&&(i.ref=n?dn(n,t):t),e.cloneElement(r,i)}return e.Children.count(r)>1?e.Children.only(null):null});fn.displayName="SlotClone";var mn=({children:e})=>m(h,{children:e});function hn(t){return e.isValidElement(t)&&t.type===mn}function gn(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function vn(...e){return t=>{let n=!1;const r=e.map(e=>{const r=gn(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():gn(e[t],null)}}}}function bn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function yn(t){const n=e.useRef(t);return e.useEffect(()=>{n.current=t}),e.useMemo(()=>(...e)=>n.current?.(...e),[])}function wn({prop:t,defaultProp:n,onChange:r=()=>{}}){const[o,i]=function({defaultProp:t,onChange:n}){const r=e.useState(t),[o]=r,i=e.useRef(o),a=yn(n);return e.useEffect(()=>{i.current!==o&&(a(o),i.current=o)},[o,i,a]),r}({defaultProp:n,onChange:r}),a=void 0!==t,s=a?t:o,l=yn(r);return[s,e.useCallback(e=>{if(a){const n="function"==typeof e?e(t):e;n!==t&&l(n)}else i(e)},[a,t,i,l])]}var En=e.forwardRef((t,n)=>{const{children:r,...o}=t,i=e.Children.toArray(r),a=i.find(Tn);if(a){const t=a.props.children,r=i.map(n=>n===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return m(xn,{...o,ref:n,children:e.isValidElement(t)?e.cloneElement(t,void 0,r):null})}return m(xn,{...o,ref:n,children:r})});En.displayName="Slot";var xn=e.forwardRef((t,n)=>{const{children:r,...o}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),i=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==e.Fragment&&(i.ref=n?vn(n,t):t),e.cloneElement(r,i)}return e.Children.count(r)>1?e.Children.only(null):null});xn.displayName="SlotClone";var Sn=({children:e})=>m(h,{children:e});function Tn(t){return e.isValidElement(t)&&t.type===Sn}var On=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((t,n)=>{const r=e.forwardRef((e,t)=>{const{asChild:r,...o}=e,i=r?En:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),m(i,{...o,ref:t})});return r.displayName=`Primitive.${n}`,{...t,[n]:r}},{}),Cn=Boolean(globalThis?.document)?e.useLayoutEffect:()=>{};function Pn(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Nn(...e){return t=>{let n=!1;const r=e.map(e=>{const r=Pn(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():Pn(e[t],null)}}}}function kn(...t){return e.useCallback(Nn(...t),t)}var Mn=e.forwardRef((t,n)=>{const{children:r,...o}=t,i=e.Children.toArray(r),a=i.find(Rn);if(a){const t=a.props.children,r=i.map(n=>n===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return m(In,{...o,ref:n,children:e.isValidElement(t)?e.cloneElement(t,void 0,r):null})}return m(In,{...o,ref:n,children:r})});Mn.displayName="Slot";var In=e.forwardRef((t,n)=>{const{children:r,...o}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),i=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==e.Fragment&&(i.ref=n?Nn(n,t):t),e.cloneElement(r,i)}return e.Children.count(r)>1?e.Children.only(null):null});In.displayName="SlotClone";var Dn=({children:e})=>m(h,{children:e});function Rn(t){return e.isValidElement(t)&&t.type===Dn}var An=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((t,n)=>{const r=e.forwardRef((e,t)=>{const{asChild:r,...o}=e,i=r?Mn:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),m(i,{...o,ref:t})});return r.displayName=`Primitive.${n}`,{...t,[n]:r}},{});var zn=t=>{const{present:n,children:r}=t,o=function(t){const[n,r]=e.useState(),o=e.useRef({}),i=e.useRef(t),a=e.useRef("none"),s=t?"mounted":"unmounted",[l,c]=function(t,n){return e.useReducer((e,t)=>n[e][t]??e,t)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=_n(o.current);a.current="mounted"===l?e:"none"},[l]),Cn(()=>{const e=o.current,n=i.current;if(n!==t){const r=a.current,o=_n(e);if(t)c("MOUNT");else if("none"===o||"none"===e?.display)c("UNMOUNT");else{c(n&&r!==o?"ANIMATION_OUT":"UNMOUNT")}i.current=t}},[t,c]),Cn(()=>{if(n){let e;const t=n.ownerDocument.defaultView??window,r=r=>{const a=_n(o.current).includes(r.animationName);if(r.target===n&&a&&(c("ANIMATION_END"),!i.current)){const r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},s=e=>{e.target===n&&(a.current=_n(o.current))};return n.addEventListener("animationstart",s),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",s),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{e&&(o.current=getComputedStyle(e)),r(e)},[])}}(n),i="function"==typeof r?r({present:o.isPresent}):e.Children.only(r),a=kn(o.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof r||o.isPresent?e.cloneElement(i,{ref:a}):null};function _n(e){return e?.animationName||"none"}zn.displayName="Presence";var Ln=Boolean(globalThis?.document)?e.useLayoutEffect:()=>{},$n=e["useId".toString()]||(()=>{}),jn=0;function Fn(t){const[n,r]=e.useState($n());return Ln(()=>{r(e=>e??String(jn++))},[t]),n?`radix-${n}`:""}var Wn="Collapsible",[Bn,Hn]=sn(Wn),[Vn,Un]=Bn(Wn),Yn=e.forwardRef((t,n)=>{const{__scopeCollapsible:r,open:o,defaultOpen:i,disabled:a,onOpenChange:s,...l}=t,[c=!1,d]=wn({prop:o,defaultProp:i,onChange:s});return m(Vn,{scope:r,disabled:a,contentId:Fn(),open:c,onOpenToggle:e.useCallback(()=>d(e=>!e),[d]),children:m(An.div,{"data-state":Jn(c),"data-disabled":a?"":void 0,...l,ref:n})})});Yn.displayName=Wn;var Gn="CollapsibleTrigger",qn=e.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Un(Gn,n);return m(An.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Jn(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:bn(e.onClick,o.onOpenToggle)})});qn.displayName=Gn;var Xn="CollapsibleContent",Kn=e.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Un(Xn,e.__scopeCollapsible);return m(zn,{present:n||o.open,children:({present:e})=>m(Zn,{...r,ref:t,present:e})})});Kn.displayName=Xn;var Zn=e.forwardRef((t,n)=>{const{__scopeCollapsible:r,present:o,children:i,...a}=t,s=Un(Xn,r),[l,c]=e.useState(o),d=e.useRef(null),u=kn(n,d),p=e.useRef(0),f=p.current,h=e.useRef(0),g=h.current,v=s.open||l,b=e.useRef(v),y=e.useRef(void 0);return e.useEffect(()=>{const e=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(e)},[]),Cn(()=>{const e=d.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const t=e.getBoundingClientRect();p.current=t.height,h.current=t.width,b.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),c(o)}},[s.open,o]),m(An.div,{"data-state":Jn(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:v&&i})});function Jn(e){return e?"open":"closed"}var Qn=Yn,er=qn,tr=Kn,nr=e.createContext(void 0);var rr="Accordion",or=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ir,ar,sr]=function(e){const n=e+"CollectionProvider",[r,o]=sn(n),[i,a]=r(n,{collectionRef:{current:null},itemMap:new Map}),s=e=>{const{scope:n,children:r}=e,o=t.useRef(null),a=t.useRef(new Map).current;return m(i,{scope:n,itemMap:a,collectionRef:o,children:r})};s.displayName=n;const l=e+"CollectionSlot",c=t.forwardRef((e,t)=>{const{scope:n,children:r}=e,o=un(t,a(l,n).collectionRef);return m(pn,{ref:o,children:r})});c.displayName=l;const d=e+"CollectionItemSlot",u="data-radix-collection-item",p=t.forwardRef((e,n)=>{const{scope:r,children:o,...i}=e,s=t.useRef(null),l=un(n,s),c=a(d,r);return t.useEffect(()=>(c.itemMap.set(s,{ref:s,...i}),()=>{c.itemMap.delete(s)})),m(pn,{[u]:"",ref:l,children:o})});return p.displayName=d,[{Provider:s,Slot:c,ItemSlot:p},function(n){const r=a(e+"CollectionConsumer",n),o=t.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${u}]`)),n=Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current));return n},[r.collectionRef,r.itemMap]);return o},o]}(rr),[lr,cr]=sn(rr,[sr,Hn]),dr=Hn(),ur=t.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return m(ir.Provider,{scope:e.__scopeAccordion,children:"multiple"===n?m(vr,{...i,ref:t}):m(gr,{...o,ref:t})})});ur.displayName=rr;var[pr,fr]=lr(rr),[mr,hr]=lr(rr,{collapsible:!1}),gr=t.forwardRef((e,n)=>{const{value:r,defaultValue:o,onValueChange:i=()=>{},collapsible:a=!1,...s}=e,[l,c]=wn({prop:r,defaultProp:o,onChange:i});return m(pr,{scope:e.__scopeAccordion,value:l?[l]:[],onItemOpen:c,onItemClose:t.useCallback(()=>a&&c(""),[a,c]),children:m(mr,{scope:e.__scopeAccordion,collapsible:a,children:m(wr,{...s,ref:n})})})}),vr=t.forwardRef((e,n)=>{const{value:r,defaultValue:o,onValueChange:i=()=>{},...a}=e,[s=[],l]=wn({prop:r,defaultProp:o,onChange:i}),c=t.useCallback(e=>l((t=[])=>[...t,e]),[l]),d=t.useCallback(e=>l((t=[])=>t.filter(t=>t!==e)),[l]);return m(pr,{scope:e.__scopeAccordion,value:s,onItemOpen:c,onItemClose:d,children:m(mr,{scope:e.__scopeAccordion,collapsible:!0,children:m(wr,{...a,ref:n})})})}),[br,yr]=lr(rr),wr=t.forwardRef((n,r)=>{const{__scopeAccordion:o,disabled:i,dir:a,orientation:s="vertical",...l}=n,c=function(...t){return e.useCallback(vn(...t),t)}(t.useRef(null),r),d=ar(o),u="ltr"===function(t){const n=e.useContext(nr);return t||n||"ltr"}(a),p=bn(n.onKeyDown,e=>{if(!or.includes(e.key))return;const t=e.target,n=d().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),o=n.length;if(-1===r)return;e.preventDefault();let i=r;const a=o-1,l=()=>{i=r+1,i>a&&(i=0)},c=()=>{i=r-1,i<0&&(i=a)};switch(e.key){case"Home":i=0;break;case"End":i=a;break;case"ArrowRight":"horizontal"===s&&(u?l():c());break;case"ArrowDown":"vertical"===s&&l();break;case"ArrowLeft":"horizontal"===s&&(u?c():l());break;case"ArrowUp":"vertical"===s&&c()}const p=i%o;n[p].ref.current?.focus()});return m(br,{scope:o,disabled:i,direction:a,orientation:s,children:m(ir.Slot,{scope:o,children:m(On.div,{...l,"data-orientation":s,ref:c,onKeyDown:i?void 0:p})})})}),Er="AccordionItem",[xr,Sr]=lr(Er),Tr=t.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=yr(Er,n),a=fr(Er,n),s=dr(n),l=Fn(),c=r&&a.value.includes(r)||!1,d=i.disabled||e.disabled;return m(xr,{scope:n,open:c,disabled:d,triggerId:l,children:m(Qn,{"data-orientation":i.orientation,"data-state":Ir(c),...s,...o,ref:t,disabled:d,open:c,onOpenChange:e=>{e?a.onItemOpen(r):a.onItemClose(r)}})})});Tr.displayName=Er;var Or="AccordionHeader",Cr=t.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=yr(rr,n),i=Sr(Or,n);return m(On.h3,{"data-orientation":o.orientation,"data-state":Ir(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Cr.displayName=Or;var Pr="AccordionTrigger",Nr=t.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=yr(rr,n),i=Sr(Pr,n),a=hr(Pr,n),s=dr(n);return m(ir.ItemSlot,{scope:n,children:m(er,{"aria-disabled":i.open&&!a.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...s,...r,ref:t})})});Nr.displayName=Pr;var kr="AccordionContent",Mr=t.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=yr(rr,n),i=Sr(kr,n),a=dr(n);return m(tr,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...a,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function Ir(e){return e?"open":"closed"}Mr.displayName=kr;var Dr=ur,Rr=Tr,Ar=Cr,zr=Nr,_r=Mr;function Lr(t){var n=S(t,[]);return e.createElement(Dr,Object.assign({"data-slot":"accordion"},n))}function $r(t){var{className:n}=t,r=S(t,["className"]);return e.createElement(Rr,Object.assign({"data-slot":"accordion-item",className:Et("border-b last:border-b-0",n)},r))}function jr(t){var{className:n,children:r}=t,o=S(t,["className","children"]);return e.createElement(Ar,{className:"flex"},e.createElement(zr,Object.assign({"data-slot":"accordion-trigger",className:Et("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",n)},o),r,e.createElement(Ft,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})))}function Fr(t){var{className:n,children:r}=t,o=S(t,["className","children"]);return e.createElement(_r,Object.assign({"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"},o),e.createElement("div",{className:Et("pt-0 pb-4",n)},r))}const Wr=({title:e,content:n})=>t.createElement(Lr,{style:{borderRadius:"0.625rem"},type:"single",collapsible:!0,className:"bg-white px-4",defaultValue:"item"},t.createElement($r,{value:"item"},t.createElement(jr,{className:""},e),t.createElement(Fr,{className:"text-gray-700"},n))),Br=({logo:e})=>t.createElement("div",{className:"w-full bg-zinc-700 h-[60px] flex"},t.createElement("div",{className:"my-0 mx-auto w-full px-[24px] flex items-center justify-between"},e?t.createElement("div",{className:"h-10"},t.createElement("img",{src:e.thumbPath,alt:e.logoName,width:100,height:100,className:"object-contain w-full h-full"})):t.createElement("div",null),t.createElement("button",{className:"text-white cursor-pointer"},t.createElement(Kt,null)))),Hr=e=>{const{playerSettings:n,shortform:{description:r,productsInfo:o,logo:i,brand:a,title:s},player:l}=e;return t.createElement("div",{className:"w-full h-full bg-[#f4f4f4] overflow-scroll"},t.createElement(Br,{logo:i}),t.createElement("div",{className:" w-full h-full flex justify-between p-10 gap-10"},t.createElement("div",{className:""},t.createElement("div",{className:"flex gap-4 w-full mb-2 h-[125px] flex-col"},a?t.createElement("div",{className:"items-center flex gap-3"},a.thumbPath&&t.createElement("div",{className:"w-16 h-16 bg-white rounded-full border "},t.createElement("img",{src:a.thumbPath,alt:a.brandName,width:100,height:100,className:"object-contain w-full h-full rounded-full"})),t.createElement("div",null,t.createElement("p",null,a.brandName),t.createElement("p",{className:"text-lg font-semibold"},s))):t.createElement("p",{className:"text-xl font-semibold"},s),t.createElement(Zt,null)),t.createElement("div",{className:"w-full pb-10 flex gap-4 justify-center"},t.createElement("div",{className:"flex gap-3"},l),t.createElement("div",{className:"flex flex-col gap-4 justify-end"},t.createElement(rn,{rounded:!0}),t.createElement(on,{rounded:!0}),t.createElement(an,{rounded:!0})))),t.createElement("div",{className:"flex flex-col gap-4 max-w-[40%]"},r&&t.createElement(Wr,{title:"숏클립 안내",content:t.createElement("p",{className:"font-medium"},r)}),t.createElement(Wr,{title:"상품 목록",content:t.createElement(t.Fragment,null,t.createElement("div",{className:"max-h-[300px] overflow-y-auto font-medium"},o.map((e,n)=>t.createElement(t.Fragment,null,t.createElement(en,{product:e}),n!==o.length-1&&t.createElement("div",{className:"h-1 w-full border-t my-2"})))),t.createElement("button",{className:"w-full mt-3 border rounded py-2 px-4 cursor-pointer",disabled:!(null==o?void 0:o.length)},"상품 전체 보기"))}),n.comment&&t.createElement(Wr,{title:"댓글",content:t.createElement(tn,null)}))))};function Vr(e){return null!==e&&"object"==typeof e&&"constructor"in e&&e.constructor===Object}function Ur(e,t){void 0===e&&(e={}),void 0===t&&(t={}),Object.keys(t).forEach(n=>{void 0===e[n]?e[n]=t[n]:Vr(t[n])&&Vr(e[n])&&Object.keys(t[n]).length>0&&Ur(e[n],t[n])})}const Yr={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector:()=>null,querySelectorAll:()=>[],getElementById:()=>null,createEvent:()=>({initEvent(){}}),createElement:()=>({children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName:()=>[]}),createElementNS:()=>({}),importNode:()=>null,location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function Gr(){const e="undefined"!=typeof document?document:{};return Ur(e,Yr),e}const qr={document:Yr,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle:()=>({getPropertyValue:()=>""}),Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia:()=>({}),requestAnimationFrame:e=>"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0),cancelAnimationFrame(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function Xr(){const e="undefined"!=typeof window?window:{};return Ur(e,qr),e}function Kr(e,t){return void 0===t&&(t=0),setTimeout(e,t)}function Zr(){return Date.now()}function Jr(e,t){void 0===t&&(t="x");const n=Xr();let r,o,i;const a=function(e){const t=Xr();let n;return t.getComputedStyle&&(n=t.getComputedStyle(e,null)),!n&&e.currentStyle&&(n=e.currentStyle),n||(n=e.style),n}(e);return n.WebKitCSSMatrix?(o=a.transform||a.webkitTransform,o.split(",").length>6&&(o=o.split(", ").map(e=>e.replace(",",".")).join(", ")),i=new n.WebKitCSSMatrix("none"===o?"":o)):(i=a.MozTransform||a.OTransform||a.MsTransform||a.msTransform||a.transform||a.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=i.toString().split(",")),"x"===t&&(o=n.WebKitCSSMatrix?i.m41:16===r.length?parseFloat(r[12]):parseFloat(r[4])),"y"===t&&(o=n.WebKitCSSMatrix?i.m42:16===r.length?parseFloat(r[13]):parseFloat(r[5])),o||0}function Qr(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)}function eo(e){return"undefined"!=typeof window&&void 0!==window.HTMLElement?e instanceof HTMLElement:e&&(1===e.nodeType||11===e.nodeType)}function to(){const e=Object(arguments.length<=0?void 0:arguments[0]),t=["__proto__","constructor","prototype"];for(let n=1;n<arguments.length;n+=1){const r=n<0||arguments.length<=n?void 0:arguments[n];if(null!=r&&!eo(r)){const n=Object.keys(Object(r)).filter(e=>t.indexOf(e)<0);for(let t=0,o=n.length;t<o;t+=1){const o=n[t],i=Object.getOwnPropertyDescriptor(r,o);void 0!==i&&i.enumerable&&(Qr(e[o])&&Qr(r[o])?r[o].__swiper__?e[o]=r[o]:to(e[o],r[o]):!Qr(e[o])&&Qr(r[o])?(e[o]={},r[o].__swiper__?e[o]=r[o]:to(e[o],r[o])):e[o]=r[o])}}}return e}function no(e,t,n){e.style.setProperty(t,n)}function ro(e){let{swiper:t,targetPosition:n,side:r}=e;const o=Xr(),i=-t.translate;let a,s=null;const l=t.params.speed;t.wrapperEl.style.scrollSnapType="none",o.cancelAnimationFrame(t.cssModeFrameID);const c=n>i?"next":"prev",d=(e,t)=>"next"===c&&e>=t||"prev"===c&&e<=t,u=()=>{a=(new Date).getTime(),null===s&&(s=a);const e=Math.max(Math.min((a-s)/l,1),0),c=.5-Math.cos(e*Math.PI)/2;let p=i+c*(n-i);if(d(p,n)&&(p=n),t.wrapperEl.scrollTo({[r]:p}),d(p,n))return t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout(()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[r]:p})}),void o.cancelAnimationFrame(t.cssModeFrameID);t.cssModeFrameID=o.requestAnimationFrame(u)};u()}function oo(e){return e.querySelector(".swiper-slide-transform")||e.shadowRoot&&e.shadowRoot.querySelector(".swiper-slide-transform")||e}function io(e,t){void 0===t&&(t="");const n=[...e.children];return e instanceof HTMLSlotElement&&n.push(...e.assignedElements()),t?n.filter(e=>e.matches(t)):n}function ao(e){try{return void console.warn(e)}catch(e){}}function so(e,t){void 0===t&&(t=[]);const n=document.createElement(e);return n.classList.add(...Array.isArray(t)?t:function(e){return void 0===e&&(e=""),e.trim().split(" ").filter(e=>!!e.trim())}(t)),n}function lo(e,t){return Xr().getComputedStyle(e,null).getPropertyValue(t)}function co(e){let t,n=e;if(n){for(t=0;null!==(n=n.previousSibling);)1===n.nodeType&&(t+=1);return t}}function uo(e,t,n){const r=Xr();return e["width"===t?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(e,null).getPropertyValue("width"===t?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(e,null).getPropertyValue("width"===t?"margin-left":"margin-bottom"))}function po(e){return(Array.isArray(e)?e:[e]).filter(e=>!!e)}let fo,mo,ho;function go(){return fo||(fo=function(){const e=Xr(),t=Gr();return{smoothScroll:t.documentElement&&t.documentElement.style&&"scrollBehavior"in t.documentElement.style,touch:!!("ontouchstart"in e||e.DocumentTouch&&t instanceof e.DocumentTouch)}}()),fo}function vo(e){return void 0===e&&(e={}),mo||(mo=function(e){let{userAgent:t}=void 0===e?{}:e;const n=go(),r=Xr(),o=r.navigator.platform,i=t||r.navigator.userAgent,a={ios:!1,android:!1},s=r.screen.width,l=r.screen.height,c=i.match(/(Android);?[\s\/]+([\d.]+)?/);let d=i.match(/(iPad).*OS\s([\d_]+)/);const u=i.match(/(iPod)(.*OS\s([\d_]+))?/),p=!d&&i.match(/(iPhone\sOS|iOS)\s([\d_]+)/),f="Win32"===o;let m="MacIntel"===o;return!d&&m&&n.touch&&["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"].indexOf(`${s}x${l}`)>=0&&(d=i.match(/(Version)\/([\d.]+)/),d||(d=[0,1,"13_0_0"]),m=!1),c&&!f&&(a.os="android",a.android=!0),(d||p||u)&&(a.os="ios",a.ios=!0),a}(e)),mo}function bo(){return ho||(ho=function(){const e=Xr(),t=vo();let n=!1;function r(){const t=e.navigator.userAgent.toLowerCase();return t.indexOf("safari")>=0&&t.indexOf("chrome")<0&&t.indexOf("android")<0}if(r()){const t=String(e.navigator.userAgent);if(t.includes("Version/")){const[e,r]=t.split("Version/")[1].split(" ")[0].split(".").map(e=>Number(e));n=e<16||16===e&&r<2}}const o=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(e.navigator.userAgent),i=r();return{isSafari:n||i,needPerspectiveFix:n,need3dFix:i||o&&t.ios,isWebView:o}}()),ho}var yo={on(e,t,n){const r=this;if(!r.eventsListeners||r.destroyed)return r;if("function"!=typeof t)return r;const o=n?"unshift":"push";return e.split(" ").forEach(e=>{r.eventsListeners[e]||(r.eventsListeners[e]=[]),r.eventsListeners[e][o](t)}),r},once(e,t,n){const r=this;if(!r.eventsListeners||r.destroyed)return r;if("function"!=typeof t)return r;function o(){r.off(e,o),o.__emitterProxy&&delete o.__emitterProxy;for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];t.apply(r,i)}return o.__emitterProxy=t,r.on(e,o,n)},onAny(e,t){const n=this;if(!n.eventsListeners||n.destroyed)return n;if("function"!=typeof e)return n;const r=t?"unshift":"push";return n.eventsAnyListeners.indexOf(e)<0&&n.eventsAnyListeners[r](e),n},offAny(e){const t=this;if(!t.eventsListeners||t.destroyed)return t;if(!t.eventsAnyListeners)return t;const n=t.eventsAnyListeners.indexOf(e);return n>=0&&t.eventsAnyListeners.splice(n,1),t},off(e,t){const n=this;return!n.eventsListeners||n.destroyed?n:n.eventsListeners?(e.split(" ").forEach(e=>{void 0===t?n.eventsListeners[e]=[]:n.eventsListeners[e]&&n.eventsListeners[e].forEach((r,o)=>{(r===t||r.__emitterProxy&&r.__emitterProxy===t)&&n.eventsListeners[e].splice(o,1)})}),n):n},emit(){const e=this;if(!e.eventsListeners||e.destroyed)return e;if(!e.eventsListeners)return e;let t,n,r;for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];"string"==typeof i[0]||Array.isArray(i[0])?(t=i[0],n=i.slice(1,i.length),r=e):(t=i[0].events,n=i[0].data,r=i[0].context||e),n.unshift(r);return(Array.isArray(t)?t:t.split(" ")).forEach(t=>{e.eventsAnyListeners&&e.eventsAnyListeners.length&&e.eventsAnyListeners.forEach(e=>{e.apply(r,[t,...n])}),e.eventsListeners&&e.eventsListeners[t]&&e.eventsListeners[t].forEach(e=>{e.apply(r,n)})}),e}};const wo=(e,t,n)=>{t&&!e.classList.contains(n)?e.classList.add(n):!t&&e.classList.contains(n)&&e.classList.remove(n)};const Eo=(e,t,n)=>{t&&!e.classList.contains(n)?e.classList.add(n):!t&&e.classList.contains(n)&&e.classList.remove(n)};const xo=(e,t)=>{if(!e||e.destroyed||!e.params)return;const n=t.closest(e.isElement?"swiper-slide":`.${e.params.slideClass}`);if(n){let t=n.querySelector(`.${e.params.lazyPreloaderClass}`);!t&&e.isElement&&(n.shadowRoot?t=n.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{n.shadowRoot&&(t=n.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`),t&&t.remove())})),t&&t.remove()}},So=(e,t)=>{if(!e.slides[t])return;const n=e.slides[t].querySelector('[loading="lazy"]');n&&n.removeAttribute("loading")},To=e=>{if(!e||e.destroyed||!e.params)return;let t=e.params.lazyPreloadPrevNext;const n=e.slides.length;if(!n||!t||t<0)return;t=Math.min(t,n);const r="auto"===e.params.slidesPerView?e.slidesPerViewDynamic():Math.ceil(e.params.slidesPerView),o=e.activeIndex;if(e.params.grid&&e.params.grid.rows>1){const n=o,i=[n-t];return i.push(...Array.from({length:t}).map((e,t)=>n+r+t)),void e.slides.forEach((t,n)=>{i.includes(t.column)&&So(e,n)})}const i=o+r-1;if(e.params.rewind||e.params.loop)for(let r=o-t;r<=i+t;r+=1){const t=(r%n+n)%n;(t<o||t>i)&&So(e,t)}else for(let r=Math.max(o-t,0);r<=Math.min(i+t,n-1);r+=1)r!==o&&(r>i||r<o)&&So(e,r)};var Oo={updateSize:function(){const e=this;let t,n;const r=e.el;t=void 0!==e.params.width&&null!==e.params.width?e.params.width:r.clientWidth,n=void 0!==e.params.height&&null!==e.params.height?e.params.height:r.clientHeight,0===t&&e.isHorizontal()||0===n&&e.isVertical()||(t=t-parseInt(lo(r,"padding-left")||0,10)-parseInt(lo(r,"padding-right")||0,10),n=n-parseInt(lo(r,"padding-top")||0,10)-parseInt(lo(r,"padding-bottom")||0,10),Number.isNaN(t)&&(t=0),Number.isNaN(n)&&(n=0),Object.assign(e,{width:t,height:n,size:e.isHorizontal()?t:n}))},updateSlides:function(){const e=this;function t(t,n){return parseFloat(t.getPropertyValue(e.getDirectionLabel(n))||0)}const n=e.params,{wrapperEl:r,slidesEl:o,size:i,rtlTranslate:a,wrongRTL:s}=e,l=e.virtual&&n.virtual.enabled,c=l?e.virtual.slides.length:e.slides.length,d=io(o,`.${e.params.slideClass}, swiper-slide`),u=l?e.virtual.slides.length:d.length;let p=[];const f=[],m=[];let h=n.slidesOffsetBefore;"function"==typeof h&&(h=n.slidesOffsetBefore.call(e));let g=n.slidesOffsetAfter;"function"==typeof g&&(g=n.slidesOffsetAfter.call(e));const v=e.snapGrid.length,b=e.slidesGrid.length;let y=n.spaceBetween,w=-h,E=0,x=0;if(void 0===i)return;"string"==typeof y&&y.indexOf("%")>=0?y=parseFloat(y.replace("%",""))/100*i:"string"==typeof y&&(y=parseFloat(y)),e.virtualSize=-y,d.forEach(e=>{a?e.style.marginLeft="":e.style.marginRight="",e.style.marginBottom="",e.style.marginTop=""}),n.centeredSlides&&n.cssMode&&(no(r,"--swiper-centered-offset-before",""),no(r,"--swiper-centered-offset-after",""));const S=n.grid&&n.grid.rows>1&&e.grid;let T;S?e.grid.initSlides(d):e.grid&&e.grid.unsetSlides();const O="auto"===n.slidesPerView&&n.breakpoints&&Object.keys(n.breakpoints).filter(e=>void 0!==n.breakpoints[e].slidesPerView).length>0;for(let r=0;r<u;r+=1){let o;if(T=0,d[r]&&(o=d[r]),S&&e.grid.updateSlide(r,o,d),!d[r]||"none"!==lo(o,"display")){if("auto"===n.slidesPerView){O&&(d[r].style[e.getDirectionLabel("width")]="");const i=getComputedStyle(o),a=o.style.transform,s=o.style.webkitTransform;if(a&&(o.style.transform="none"),s&&(o.style.webkitTransform="none"),n.roundLengths)T=e.isHorizontal()?uo(o,"width"):uo(o,"height");else{const e=t(i,"width"),n=t(i,"padding-left"),r=t(i,"padding-right"),a=t(i,"margin-left"),s=t(i,"margin-right"),l=i.getPropertyValue("box-sizing");if(l&&"border-box"===l)T=e+a+s;else{const{clientWidth:t,offsetWidth:i}=o;T=e+n+r+a+s+(i-t)}}a&&(o.style.transform=a),s&&(o.style.webkitTransform=s),n.roundLengths&&(T=Math.floor(T))}else T=(i-(n.slidesPerView-1)*y)/n.slidesPerView,n.roundLengths&&(T=Math.floor(T)),d[r]&&(d[r].style[e.getDirectionLabel("width")]=`${T}px`);d[r]&&(d[r].swiperSlideSize=T),m.push(T),n.centeredSlides?(w=w+T/2+E/2+y,0===E&&0!==r&&(w=w-i/2-y),0===r&&(w=w-i/2-y),Math.abs(w)<.001&&(w=0),n.roundLengths&&(w=Math.floor(w)),x%n.slidesPerGroup===0&&p.push(w),f.push(w)):(n.roundLengths&&(w=Math.floor(w)),(x-Math.min(e.params.slidesPerGroupSkip,x))%e.params.slidesPerGroup===0&&p.push(w),f.push(w),w=w+T+y),e.virtualSize+=T+y,E=T,x+=1}}if(e.virtualSize=Math.max(e.virtualSize,i)+g,a&&s&&("slide"===n.effect||"coverflow"===n.effect)&&(r.style.width=`${e.virtualSize+y}px`),n.setWrapperSize&&(r.style[e.getDirectionLabel("width")]=`${e.virtualSize+y}px`),S&&e.grid.updateWrapperSize(T,p),!n.centeredSlides){const t=[];for(let r=0;r<p.length;r+=1){let o=p[r];n.roundLengths&&(o=Math.floor(o)),p[r]<=e.virtualSize-i&&t.push(o)}p=t,Math.floor(e.virtualSize-i)-Math.floor(p[p.length-1])>1&&p.push(e.virtualSize-i)}if(l&&n.loop){const t=m[0]+y;if(n.slidesPerGroup>1){const r=Math.ceil((e.virtual.slidesBefore+e.virtual.slidesAfter)/n.slidesPerGroup),o=t*n.slidesPerGroup;for(let e=0;e<r;e+=1)p.push(p[p.length-1]+o)}for(let r=0;r<e.virtual.slidesBefore+e.virtual.slidesAfter;r+=1)1===n.slidesPerGroup&&p.push(p[p.length-1]+t),f.push(f[f.length-1]+t),e.virtualSize+=t}if(0===p.length&&(p=[0]),0!==y){const t=e.isHorizontal()&&a?"marginLeft":e.getDirectionLabel("marginRight");d.filter((e,t)=>!(n.cssMode&&!n.loop)||t!==d.length-1).forEach(e=>{e.style[t]=`${y}px`})}if(n.centeredSlides&&n.centeredSlidesBounds){let e=0;m.forEach(t=>{e+=t+(y||0)}),e-=y;const t=e>i?e-i:0;p=p.map(e=>e<=0?-h:e>t?t+g:e)}if(n.centerInsufficientSlides){let e=0;m.forEach(t=>{e+=t+(y||0)}),e-=y;const t=(n.slidesOffsetBefore||0)+(n.slidesOffsetAfter||0);if(e+t<i){const n=(i-e-t)/2;p.forEach((e,t)=>{p[t]=e-n}),f.forEach((e,t)=>{f[t]=e+n})}}if(Object.assign(e,{slides:d,snapGrid:p,slidesGrid:f,slidesSizesGrid:m}),n.centeredSlides&&n.cssMode&&!n.centeredSlidesBounds){no(r,"--swiper-centered-offset-before",-p[0]+"px"),no(r,"--swiper-centered-offset-after",e.size/2-m[m.length-1]/2+"px");const t=-e.snapGrid[0],n=-e.slidesGrid[0];e.snapGrid=e.snapGrid.map(e=>e+t),e.slidesGrid=e.slidesGrid.map(e=>e+n)}if(u!==c&&e.emit("slidesLengthChange"),p.length!==v&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),f.length!==b&&e.emit("slidesGridLengthChange"),n.watchSlidesProgress&&e.updateSlidesOffset(),e.emit("slidesUpdated"),!(l||n.cssMode||"slide"!==n.effect&&"fade"!==n.effect)){const t=`${n.containerModifierClass}backface-hidden`,r=e.el.classList.contains(t);u<=n.maxBackfaceHiddenSlides?r||e.el.classList.add(t):r&&e.el.classList.remove(t)}},updateAutoHeight:function(e){const t=this,n=[],r=t.virtual&&t.params.virtual.enabled;let o,i=0;"number"==typeof e?t.setTransition(e):!0===e&&t.setTransition(t.params.speed);const a=e=>r?t.slides[t.getSlideIndexByData(e)]:t.slides[e];if("auto"!==t.params.slidesPerView&&t.params.slidesPerView>1)if(t.params.centeredSlides)(t.visibleSlides||[]).forEach(e=>{n.push(e)});else for(o=0;o<Math.ceil(t.params.slidesPerView);o+=1){const e=t.activeIndex+o;if(e>t.slides.length&&!r)break;n.push(a(e))}else n.push(a(t.activeIndex));for(o=0;o<n.length;o+=1)if(void 0!==n[o]){const e=n[o].offsetHeight;i=e>i?e:i}(i||0===i)&&(t.wrapperEl.style.height=`${i}px`)},updateSlidesOffset:function(){const e=this,t=e.slides,n=e.isElement?e.isHorizontal()?e.wrapperEl.offsetLeft:e.wrapperEl.offsetTop:0;for(let r=0;r<t.length;r+=1)t[r].swiperSlideOffset=(e.isHorizontal()?t[r].offsetLeft:t[r].offsetTop)-n-e.cssOverflowAdjustment()},updateSlidesProgress:function(e){void 0===e&&(e=this&&this.translate||0);const t=this,n=t.params,{slides:r,rtlTranslate:o,snapGrid:i}=t;if(0===r.length)return;void 0===r[0].swiperSlideOffset&&t.updateSlidesOffset();let a=-e;o&&(a=e),t.visibleSlidesIndexes=[],t.visibleSlides=[];let s=n.spaceBetween;"string"==typeof s&&s.indexOf("%")>=0?s=parseFloat(s.replace("%",""))/100*t.size:"string"==typeof s&&(s=parseFloat(s));for(let e=0;e<r.length;e+=1){const l=r[e];let c=l.swiperSlideOffset;n.cssMode&&n.centeredSlides&&(c-=r[0].swiperSlideOffset);const d=(a+(n.centeredSlides?t.minTranslate():0)-c)/(l.swiperSlideSize+s),u=(a-i[0]+(n.centeredSlides?t.minTranslate():0)-c)/(l.swiperSlideSize+s),p=-(a-c),f=p+t.slidesSizesGrid[e],m=p>=0&&p<=t.size-t.slidesSizesGrid[e],h=p>=0&&p<t.size-1||f>1&&f<=t.size||p<=0&&f>=t.size;h&&(t.visibleSlides.push(l),t.visibleSlidesIndexes.push(e)),wo(l,h,n.slideVisibleClass),wo(l,m,n.slideFullyVisibleClass),l.progress=o?-d:d,l.originalProgress=o?-u:u}},updateProgress:function(e){const t=this;if(void 0===e){const n=t.rtlTranslate?-1:1;e=t&&t.translate&&t.translate*n||0}const n=t.params,r=t.maxTranslate()-t.minTranslate();let{progress:o,isBeginning:i,isEnd:a,progressLoop:s}=t;const l=i,c=a;if(0===r)o=0,i=!0,a=!0;else{o=(e-t.minTranslate())/r;const n=Math.abs(e-t.minTranslate())<1,s=Math.abs(e-t.maxTranslate())<1;i=n||o<=0,a=s||o>=1,n&&(o=0),s&&(o=1)}if(n.loop){const n=t.getSlideIndexByData(0),r=t.getSlideIndexByData(t.slides.length-1),o=t.slidesGrid[n],i=t.slidesGrid[r],a=t.slidesGrid[t.slidesGrid.length-1],l=Math.abs(e);s=l>=o?(l-o)/a:(l+a-i)/a,s>1&&(s-=1)}Object.assign(t,{progress:o,progressLoop:s,isBeginning:i,isEnd:a}),(n.watchSlidesProgress||n.centeredSlides&&n.autoHeight)&&t.updateSlidesProgress(e),i&&!l&&t.emit("reachBeginning toEdge"),a&&!c&&t.emit("reachEnd toEdge"),(l&&!i||c&&!a)&&t.emit("fromEdge"),t.emit("progress",o)},updateSlidesClasses:function(){const e=this,{slides:t,params:n,slidesEl:r,activeIndex:o}=e,i=e.virtual&&n.virtual.enabled,a=e.grid&&n.grid&&n.grid.rows>1,s=e=>io(r,`.${n.slideClass}${e}, swiper-slide${e}`)[0];let l,c,d;if(i)if(n.loop){let t=o-e.virtual.slidesBefore;t<0&&(t=e.virtual.slides.length+t),t>=e.virtual.slides.length&&(t-=e.virtual.slides.length),l=s(`[data-swiper-slide-index="${t}"]`)}else l=s(`[data-swiper-slide-index="${o}"]`);else a?(l=t.filter(e=>e.column===o)[0],d=t.filter(e=>e.column===o+1)[0],c=t.filter(e=>e.column===o-1)[0]):l=t[o];l&&(a||(d=function(e,t){const n=[];for(;e.nextElementSibling;){const r=e.nextElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}(l,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!d&&(d=t[0]),c=function(e,t){const n=[];for(;e.previousElementSibling;){const r=e.previousElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}(l,`.${n.slideClass}, swiper-slide`)[0],n.loop&&0===!c&&(c=t[t.length-1]))),t.forEach(e=>{Eo(e,e===l,n.slideActiveClass),Eo(e,e===d,n.slideNextClass),Eo(e,e===c,n.slidePrevClass)}),e.emitSlidesClasses()},updateActiveIndex:function(e){const t=this,n=t.rtlTranslate?t.translate:-t.translate,{snapGrid:r,params:o,activeIndex:i,realIndex:a,snapIndex:s}=t;let l,c=e;const d=e=>{let n=e-t.virtual.slidesBefore;return n<0&&(n=t.virtual.slides.length+n),n>=t.virtual.slides.length&&(n-=t.virtual.slides.length),n};if(void 0===c&&(c=function(e){const{slidesGrid:t,params:n}=e,r=e.rtlTranslate?e.translate:-e.translate;let o;for(let e=0;e<t.length;e+=1)void 0!==t[e+1]?r>=t[e]&&r<t[e+1]-(t[e+1]-t[e])/2?o=e:r>=t[e]&&r<t[e+1]&&(o=e+1):r>=t[e]&&(o=e);return n.normalizeSlideIndex&&(o<0||void 0===o)&&(o=0),o}(t)),r.indexOf(n)>=0)l=r.indexOf(n);else{const e=Math.min(o.slidesPerGroupSkip,c);l=e+Math.floor((c-e)/o.slidesPerGroup)}if(l>=r.length&&(l=r.length-1),c===i&&!t.params.loop)return void(l!==s&&(t.snapIndex=l,t.emit("snapIndexChange")));if(c===i&&t.params.loop&&t.virtual&&t.params.virtual.enabled)return void(t.realIndex=d(c));const u=t.grid&&o.grid&&o.grid.rows>1;let p;if(t.virtual&&o.virtual.enabled&&o.loop)p=d(c);else if(u){const e=t.slides.filter(e=>e.column===c)[0];let n=parseInt(e.getAttribute("data-swiper-slide-index"),10);Number.isNaN(n)&&(n=Math.max(t.slides.indexOf(e),0)),p=Math.floor(n/o.grid.rows)}else if(t.slides[c]){const e=t.slides[c].getAttribute("data-swiper-slide-index");p=e?parseInt(e,10):c}else p=c;Object.assign(t,{previousSnapIndex:s,snapIndex:l,previousRealIndex:a,realIndex:p,previousIndex:i,activeIndex:c}),t.initialized&&To(t),t.emit("activeIndexChange"),t.emit("snapIndexChange"),(t.initialized||t.params.runCallbacksOnInit)&&(a!==p&&t.emit("realIndexChange"),t.emit("slideChange"))},updateClickedSlide:function(e,t){const n=this,r=n.params;let o=e.closest(`.${r.slideClass}, swiper-slide`);!o&&n.isElement&&t&&t.length>1&&t.includes(e)&&[...t.slice(t.indexOf(e)+1,t.length)].forEach(e=>{!o&&e.matches&&e.matches(`.${r.slideClass}, swiper-slide`)&&(o=e)});let i,a=!1;if(o)for(let e=0;e<n.slides.length;e+=1)if(n.slides[e]===o){a=!0,i=e;break}if(!o||!a)return n.clickedSlide=void 0,void(n.clickedIndex=void 0);n.clickedSlide=o,n.virtual&&n.params.virtual.enabled?n.clickedIndex=parseInt(o.getAttribute("data-swiper-slide-index"),10):n.clickedIndex=i,r.slideToClickedSlide&&void 0!==n.clickedIndex&&n.clickedIndex!==n.activeIndex&&n.slideToClickedSlide()}};var Co={getTranslate:function(e){void 0===e&&(e=this.isHorizontal()?"x":"y");const{params:t,rtlTranslate:n,translate:r,wrapperEl:o}=this;if(t.virtualTranslate)return n?-r:r;if(t.cssMode)return r;let i=Jr(o,e);return i+=this.cssOverflowAdjustment(),n&&(i=-i),i||0},setTranslate:function(e,t){const n=this,{rtlTranslate:r,params:o,wrapperEl:i,progress:a}=n;let s,l=0,c=0;n.isHorizontal()?l=r?-e:e:c=e,o.roundLengths&&(l=Math.floor(l),c=Math.floor(c)),n.previousTranslate=n.translate,n.translate=n.isHorizontal()?l:c,o.cssMode?i[n.isHorizontal()?"scrollLeft":"scrollTop"]=n.isHorizontal()?-l:-c:o.virtualTranslate||(n.isHorizontal()?l-=n.cssOverflowAdjustment():c-=n.cssOverflowAdjustment(),i.style.transform=`translate3d(${l}px, ${c}px, 0px)`);const d=n.maxTranslate()-n.minTranslate();s=0===d?0:(e-n.minTranslate())/d,s!==a&&n.updateProgress(e),n.emit("setTranslate",n.translate,t)},minTranslate:function(){return-this.snapGrid[0]},maxTranslate:function(){return-this.snapGrid[this.snapGrid.length-1]},translateTo:function(e,t,n,r,o){void 0===e&&(e=0),void 0===t&&(t=this.params.speed),void 0===n&&(n=!0),void 0===r&&(r=!0);const i=this,{params:a,wrapperEl:s}=i;if(i.animating&&a.preventInteractionOnTransition)return!1;const l=i.minTranslate(),c=i.maxTranslate();let d;if(d=r&&e>l?l:r&&e<c?c:e,i.updateProgress(d),a.cssMode){const e=i.isHorizontal();if(0===t)s[e?"scrollLeft":"scrollTop"]=-d;else{if(!i.support.smoothScroll)return ro({swiper:i,targetPosition:-d,side:e?"left":"top"}),!0;s.scrollTo({[e?"left":"top"]:-d,behavior:"smooth"})}return!0}return 0===t?(i.setTransition(0),i.setTranslate(d),n&&(i.emit("beforeTransitionStart",t,o),i.emit("transitionEnd"))):(i.setTransition(t),i.setTranslate(d),n&&(i.emit("beforeTransitionStart",t,o),i.emit("transitionStart")),i.animating||(i.animating=!0,i.onTranslateToWrapperTransitionEnd||(i.onTranslateToWrapperTransitionEnd=function(e){i&&!i.destroyed&&e.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onTranslateToWrapperTransitionEnd),i.onTranslateToWrapperTransitionEnd=null,delete i.onTranslateToWrapperTransitionEnd,i.animating=!1,n&&i.emit("transitionEnd"))}),i.wrapperEl.addEventListener("transitionend",i.onTranslateToWrapperTransitionEnd))),!0}};function Po(e){let{swiper:t,runCallbacks:n,direction:r,step:o}=e;const{activeIndex:i,previousIndex:a}=t;let s=r;if(s||(s=i>a?"next":i<a?"prev":"reset"),t.emit(`transition${o}`),n&&i!==a){if("reset"===s)return void t.emit(`slideResetTransition${o}`);t.emit(`slideChangeTransition${o}`),"next"===s?t.emit(`slideNextTransition${o}`):t.emit(`slidePrevTransition${o}`)}}var No={setTransition:function(e,t){const n=this;n.params.cssMode||(n.wrapperEl.style.transitionDuration=`${e}ms`,n.wrapperEl.style.transitionDelay=0===e?"0ms":""),n.emit("setTransition",e,t)},transitionStart:function(e,t){void 0===e&&(e=!0);const n=this,{params:r}=n;r.cssMode||(r.autoHeight&&n.updateAutoHeight(),Po({swiper:n,runCallbacks:e,direction:t,step:"Start"}))},transitionEnd:function(e,t){void 0===e&&(e=!0);const n=this,{params:r}=n;n.animating=!1,r.cssMode||(n.setTransition(0),Po({swiper:n,runCallbacks:e,direction:t,step:"End"}))}};var ko={slideTo:function(e,t,n,r,o){void 0===e&&(e=0),void 0===n&&(n=!0),"string"==typeof e&&(e=parseInt(e,10));const i=this;let a=e;a<0&&(a=0);const{params:s,snapGrid:l,slidesGrid:c,previousIndex:d,activeIndex:u,rtlTranslate:p,wrapperEl:f,enabled:m}=i;if(!m&&!r&&!o||i.destroyed||i.animating&&s.preventInteractionOnTransition)return!1;void 0===t&&(t=i.params.speed);const h=Math.min(i.params.slidesPerGroupSkip,a);let g=h+Math.floor((a-h)/i.params.slidesPerGroup);g>=l.length&&(g=l.length-1);const v=-l[g];if(s.normalizeSlideIndex)for(let e=0;e<c.length;e+=1){const t=-Math.floor(100*v),n=Math.floor(100*c[e]),r=Math.floor(100*c[e+1]);void 0!==c[e+1]?t>=n&&t<r-(r-n)/2?a=e:t>=n&&t<r&&(a=e+1):t>=n&&(a=e)}if(i.initialized&&a!==u){if(!i.allowSlideNext&&(p?v>i.translate&&v>i.minTranslate():v<i.translate&&v<i.minTranslate()))return!1;if(!i.allowSlidePrev&&v>i.translate&&v>i.maxTranslate()&&(u||0)!==a)return!1}let b;a!==(d||0)&&n&&i.emit("beforeSlideChangeStart"),i.updateProgress(v),b=a>u?"next":a<u?"prev":"reset";const y=i.virtual&&i.params.virtual.enabled;if(!(y&&o)&&(p&&-v===i.translate||!p&&v===i.translate))return i.updateActiveIndex(a),s.autoHeight&&i.updateAutoHeight(),i.updateSlidesClasses(),"slide"!==s.effect&&i.setTranslate(v),"reset"!==b&&(i.transitionStart(n,b),i.transitionEnd(n,b)),!1;if(s.cssMode){const e=i.isHorizontal(),n=p?v:-v;if(0===t)y&&(i.wrapperEl.style.scrollSnapType="none",i._immediateVirtual=!0),y&&!i._cssModeVirtualInitialSet&&i.params.initialSlide>0?(i._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{f[e?"scrollLeft":"scrollTop"]=n})):f[e?"scrollLeft":"scrollTop"]=n,y&&requestAnimationFrame(()=>{i.wrapperEl.style.scrollSnapType="",i._immediateVirtual=!1});else{if(!i.support.smoothScroll)return ro({swiper:i,targetPosition:n,side:e?"left":"top"}),!0;f.scrollTo({[e?"left":"top"]:n,behavior:"smooth"})}return!0}return i.setTransition(t),i.setTranslate(v),i.updateActiveIndex(a),i.updateSlidesClasses(),i.emit("beforeTransitionStart",t,r),i.transitionStart(n,b),0===t?i.transitionEnd(n,b):i.animating||(i.animating=!0,i.onSlideToWrapperTransitionEnd||(i.onSlideToWrapperTransitionEnd=function(e){i&&!i.destroyed&&e.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onSlideToWrapperTransitionEnd),i.onSlideToWrapperTransitionEnd=null,delete i.onSlideToWrapperTransitionEnd,i.transitionEnd(n,b))}),i.wrapperEl.addEventListener("transitionend",i.onSlideToWrapperTransitionEnd)),!0},slideToLoop:function(e,t,n,r){if(void 0===e&&(e=0),void 0===n&&(n=!0),"string"==typeof e){e=parseInt(e,10)}const o=this;if(o.destroyed)return;void 0===t&&(t=o.params.speed);const i=o.grid&&o.params.grid&&o.params.grid.rows>1;let a=e;if(o.params.loop)if(o.virtual&&o.params.virtual.enabled)a+=o.virtual.slidesBefore;else{let e;if(i){const t=a*o.params.grid.rows;e=o.slides.filter(e=>1*e.getAttribute("data-swiper-slide-index")===t)[0].column}else e=o.getSlideIndexByData(a);const t=i?Math.ceil(o.slides.length/o.params.grid.rows):o.slides.length,{centeredSlides:n}=o.params;let s=o.params.slidesPerView;"auto"===s?s=o.slidesPerViewDynamic():(s=Math.ceil(parseFloat(o.params.slidesPerView,10)),n&&s%2==0&&(s+=1));let l=t-e<s;if(n&&(l=l||e<Math.ceil(s/2)),r&&n&&"auto"!==o.params.slidesPerView&&!i&&(l=!1),l){const r=n?e<o.activeIndex?"prev":"next":e-o.activeIndex-1<o.params.slidesPerView?"next":"prev";o.loopFix({direction:r,slideTo:!0,activeSlideIndex:"next"===r?e+1:e-t+1,slideRealIndex:"next"===r?o.realIndex:void 0})}if(i){const e=a*o.params.grid.rows;a=o.slides.filter(t=>1*t.getAttribute("data-swiper-slide-index")===e)[0].column}else a=o.getSlideIndexByData(a)}return requestAnimationFrame(()=>{o.slideTo(a,t,n,r)}),o},slideNext:function(e,t,n){void 0===t&&(t=!0);const r=this,{enabled:o,params:i,animating:a}=r;if(!o||r.destroyed)return r;void 0===e&&(e=r.params.speed);let s=i.slidesPerGroup;"auto"===i.slidesPerView&&1===i.slidesPerGroup&&i.slidesPerGroupAuto&&(s=Math.max(r.slidesPerViewDynamic("current",!0),1));const l=r.activeIndex<i.slidesPerGroupSkip?1:s,c=r.virtual&&i.virtual.enabled;if(i.loop){if(a&&!c&&i.loopPreventsSliding)return!1;if(r.loopFix({direction:"next"}),r._clientLeft=r.wrapperEl.clientLeft,r.activeIndex===r.slides.length-1&&i.cssMode)return requestAnimationFrame(()=>{r.slideTo(r.activeIndex+l,e,t,n)}),!0}return i.rewind&&r.isEnd?r.slideTo(0,e,t,n):r.slideTo(r.activeIndex+l,e,t,n)},slidePrev:function(e,t,n){void 0===t&&(t=!0);const r=this,{params:o,snapGrid:i,slidesGrid:a,rtlTranslate:s,enabled:l,animating:c}=r;if(!l||r.destroyed)return r;void 0===e&&(e=r.params.speed);const d=r.virtual&&o.virtual.enabled;if(o.loop){if(c&&!d&&o.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}function u(e){return e<0?-Math.floor(Math.abs(e)):Math.floor(e)}const p=u(s?r.translate:-r.translate),f=i.map(e=>u(e));let m=i[f.indexOf(p)-1];if(void 0===m&&o.cssMode){let e;i.forEach((t,n)=>{p>=t&&(e=n)}),void 0!==e&&(m=i[e>0?e-1:e])}let h=0;if(void 0!==m&&(h=a.indexOf(m),h<0&&(h=r.activeIndex-1),"auto"===o.slidesPerView&&1===o.slidesPerGroup&&o.slidesPerGroupAuto&&(h=h-r.slidesPerViewDynamic("previous",!0)+1,h=Math.max(h,0))),o.rewind&&r.isBeginning){const o=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(o,e,t,n)}return o.loop&&0===r.activeIndex&&o.cssMode?(requestAnimationFrame(()=>{r.slideTo(h,e,t,n)}),!0):r.slideTo(h,e,t,n)},slideReset:function(e,t,n){void 0===t&&(t=!0);const r=this;if(!r.destroyed)return void 0===e&&(e=r.params.speed),r.slideTo(r.activeIndex,e,t,n)},slideToClosest:function(e,t,n,r){void 0===t&&(t=!0),void 0===r&&(r=.5);const o=this;if(o.destroyed)return;void 0===e&&(e=o.params.speed);let i=o.activeIndex;const a=Math.min(o.params.slidesPerGroupSkip,i),s=a+Math.floor((i-a)/o.params.slidesPerGroup),l=o.rtlTranslate?o.translate:-o.translate;if(l>=o.snapGrid[s]){const e=o.snapGrid[s];l-e>(o.snapGrid[s+1]-e)*r&&(i+=o.params.slidesPerGroup)}else{const e=o.snapGrid[s-1];l-e<=(o.snapGrid[s]-e)*r&&(i-=o.params.slidesPerGroup)}return i=Math.max(i,0),i=Math.min(i,o.slidesGrid.length-1),o.slideTo(i,e,t,n)},slideToClickedSlide:function(){const e=this;if(e.destroyed)return;const{params:t,slidesEl:n}=e,r="auto"===t.slidesPerView?e.slidesPerViewDynamic():t.slidesPerView;let o,i=e.clickedIndex;const a=e.isElement?"swiper-slide":`.${t.slideClass}`;if(t.loop){if(e.animating)return;o=parseInt(e.clickedSlide.getAttribute("data-swiper-slide-index"),10),t.centeredSlides?i<e.loopedSlides-r/2||i>e.slides.length-e.loopedSlides+r/2?(e.loopFix(),i=e.getSlideIndex(io(n,`${a}[data-swiper-slide-index="${o}"]`)[0]),Kr(()=>{e.slideTo(i)})):e.slideTo(i):i>e.slides.length-r?(e.loopFix(),i=e.getSlideIndex(io(n,`${a}[data-swiper-slide-index="${o}"]`)[0]),Kr(()=>{e.slideTo(i)})):e.slideTo(i)}else e.slideTo(i)}};var Mo={loopCreate:function(e){const t=this,{params:n,slidesEl:r}=t;if(!n.loop||t.virtual&&t.params.virtual.enabled)return;const o=()=>{io(r,`.${n.slideClass}, swiper-slide`).forEach((e,t)=>{e.setAttribute("data-swiper-slide-index",t)})},i=t.grid&&n.grid&&n.grid.rows>1,a=n.slidesPerGroup*(i?n.grid.rows:1),s=t.slides.length%a!==0,l=i&&t.slides.length%n.grid.rows!==0,c=e=>{for(let r=0;r<e;r+=1){const e=t.isElement?so("swiper-slide",[n.slideBlankClass]):so("div",[n.slideClass,n.slideBlankClass]);t.slidesEl.append(e)}};if(s){if(n.loopAddBlankSlides){c(a-t.slides.length%a),t.recalcSlides(),t.updateSlides()}else ao("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");o()}else if(l){if(n.loopAddBlankSlides){c(n.grid.rows-t.slides.length%n.grid.rows),t.recalcSlides(),t.updateSlides()}else ao("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");o()}else o();t.loopFix({slideRealIndex:e,direction:n.centeredSlides?void 0:"next"})},loopFix:function(e){let{slideRealIndex:t,slideTo:n=!0,direction:r,setTranslate:o,activeSlideIndex:i,byController:a,byMousewheel:s}=void 0===e?{}:e;const l=this;if(!l.params.loop)return;l.emit("beforeLoopFix");const{slides:c,allowSlidePrev:d,allowSlideNext:u,slidesEl:p,params:f}=l,{centeredSlides:m}=f;if(l.allowSlidePrev=!0,l.allowSlideNext=!0,l.virtual&&f.virtual.enabled)return n&&(f.centeredSlides||0!==l.snapIndex?f.centeredSlides&&l.snapIndex<f.slidesPerView?l.slideTo(l.virtual.slides.length+l.snapIndex,0,!1,!0):l.snapIndex===l.snapGrid.length-1&&l.slideTo(l.virtual.slidesBefore,0,!1,!0):l.slideTo(l.virtual.slides.length,0,!1,!0)),l.allowSlidePrev=d,l.allowSlideNext=u,void l.emit("loopFix");let h=f.slidesPerView;"auto"===h?h=l.slidesPerViewDynamic():(h=Math.ceil(parseFloat(f.slidesPerView,10)),m&&h%2==0&&(h+=1));const g=f.slidesPerGroupAuto?h:f.slidesPerGroup;let v=g;v%g!==0&&(v+=g-v%g),v+=f.loopAdditionalSlides,l.loopedSlides=v;const b=l.grid&&f.grid&&f.grid.rows>1;c.length<h+v?ao("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):b&&"row"===f.grid.fill&&ao("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const y=[],w=[];let E=l.activeIndex;void 0===i?i=l.getSlideIndex(c.filter(e=>e.classList.contains(f.slideActiveClass))[0]):E=i;const x="next"===r||!r,S="prev"===r||!r;let T=0,O=0;const C=b?Math.ceil(c.length/f.grid.rows):c.length,P=(b?c[i].column:i)+(m&&void 0===o?-h/2+.5:0);if(P<v){T=Math.max(v-P,g);for(let e=0;e<v-P;e+=1){const t=e-Math.floor(e/C)*C;if(b){const e=C-t-1;for(let t=c.length-1;t>=0;t-=1)c[t].column===e&&y.push(t)}else y.push(C-t-1)}}else if(P+h>C-v){O=Math.max(P-(C-2*v),g);for(let e=0;e<O;e+=1){const t=e-Math.floor(e/C)*C;b?c.forEach((e,n)=>{e.column===t&&w.push(n)}):w.push(t)}}if(l.__preventObserver__=!0,requestAnimationFrame(()=>{l.__preventObserver__=!1}),S&&y.forEach(e=>{c[e].swiperLoopMoveDOM=!0,p.prepend(c[e]),c[e].swiperLoopMoveDOM=!1}),x&&w.forEach(e=>{c[e].swiperLoopMoveDOM=!0,p.append(c[e]),c[e].swiperLoopMoveDOM=!1}),l.recalcSlides(),"auto"===f.slidesPerView?l.updateSlides():b&&(y.length>0&&S||w.length>0&&x)&&l.slides.forEach((e,t)=>{l.grid.updateSlide(t,e,l.slides)}),f.watchSlidesProgress&&l.updateSlidesOffset(),n)if(y.length>0&&S){if(void 0===t){const e=l.slidesGrid[E],t=l.slidesGrid[E+T]-e;s?l.setTranslate(l.translate-t):(l.slideTo(E+Math.ceil(T),0,!1,!0),o&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-t,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-t))}else if(o){const e=b?y.length/f.grid.rows:y.length;l.slideTo(l.activeIndex+e,0,!1,!0),l.touchEventsData.currentTranslate=l.translate}}else if(w.length>0&&x)if(void 0===t){const e=l.slidesGrid[E],t=l.slidesGrid[E-O]-e;s?l.setTranslate(l.translate-t):(l.slideTo(E-O,0,!1,!0),o&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-t,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-t))}else{const e=b?w.length/f.grid.rows:w.length;l.slideTo(l.activeIndex-e,0,!1,!0)}if(l.allowSlidePrev=d,l.allowSlideNext=u,l.controller&&l.controller.control&&!a){const e={slideRealIndex:t,direction:r,setTranslate:o,activeSlideIndex:i,byController:!0};Array.isArray(l.controller.control)?l.controller.control.forEach(t=>{!t.destroyed&&t.params.loop&&t.loopFix({...e,slideTo:t.params.slidesPerView===f.slidesPerView&&n})}):l.controller.control instanceof l.constructor&&l.controller.control.params.loop&&l.controller.control.loopFix({...e,slideTo:l.controller.control.params.slidesPerView===f.slidesPerView&&n})}l.emit("loopFix")},loopDestroy:function(){const e=this,{params:t,slidesEl:n}=e;if(!t.loop||e.virtual&&e.params.virtual.enabled)return;e.recalcSlides();const r=[];e.slides.forEach(e=>{const t=void 0===e.swiperSlideIndex?1*e.getAttribute("data-swiper-slide-index"):e.swiperSlideIndex;r[t]=e}),e.slides.forEach(e=>{e.removeAttribute("data-swiper-slide-index")}),r.forEach(e=>{n.append(e)}),e.recalcSlides(),e.slideTo(e.realIndex,0)}};function Io(e,t,n){const r=Xr(),{params:o}=e,i=o.edgeSwipeDetection,a=o.edgeSwipeThreshold;return!i||!(n<=a||n>=r.innerWidth-a)||"prevent"===i&&(t.preventDefault(),!0)}function Do(e){const t=this,n=Gr();let r=e;r.originalEvent&&(r=r.originalEvent);const o=t.touchEventsData;if("pointerdown"===r.type){if(null!==o.pointerId&&o.pointerId!==r.pointerId)return;o.pointerId=r.pointerId}else"touchstart"===r.type&&1===r.targetTouches.length&&(o.touchId=r.targetTouches[0].identifier);if("touchstart"===r.type)return void Io(t,r,r.targetTouches[0].pageX);const{params:i,touches:a,enabled:s}=t;if(!s)return;if(!i.simulateTouch&&"mouse"===r.pointerType)return;if(t.animating&&i.preventInteractionOnTransition)return;!t.animating&&i.cssMode&&i.loop&&t.loopFix();let l=r.target;if("wrapper"===i.touchEventsTarget&&!function(e,t){const n=t.contains(e);if(!n&&t instanceof HTMLSlotElement)return[...t.assignedElements()].includes(e);return n}(l,t.wrapperEl))return;if("which"in r&&3===r.which)return;if("button"in r&&r.button>0)return;if(o.isTouched&&o.isMoved)return;const c=!!i.noSwipingClass&&""!==i.noSwipingClass,d=r.composedPath?r.composedPath():r.path;c&&r.target&&r.target.shadowRoot&&d&&(l=d[0]);const u=i.noSwipingSelector?i.noSwipingSelector:`.${i.noSwipingClass}`,p=!(!r.target||!r.target.shadowRoot);if(i.noSwiping&&(p?function(e,t){return void 0===t&&(t=this),function t(n){if(!n||n===Gr()||n===Xr())return null;n.assignedSlot&&(n=n.assignedSlot);const r=n.closest(e);return r||n.getRootNode?r||t(n.getRootNode().host):null}(t)}(u,l):l.closest(u)))return void(t.allowClick=!0);if(i.swipeHandler&&!l.closest(i.swipeHandler))return;a.currentX=r.pageX,a.currentY=r.pageY;const f=a.currentX,m=a.currentY;if(!Io(t,r,f))return;Object.assign(o,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=f,a.startY=m,o.touchStartTime=Zr(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,i.threshold>0&&(o.allowThresholdMove=!1);let h=!0;l.matches(o.focusableElements)&&(h=!1,"SELECT"===l.nodeName&&(o.isTouched=!1)),n.activeElement&&n.activeElement.matches(o.focusableElements)&&n.activeElement!==l&&("mouse"===r.pointerType||"mouse"!==r.pointerType&&!l.matches(o.focusableElements))&&n.activeElement.blur();const g=h&&t.allowTouchMove&&i.touchStartPreventDefault;!i.touchStartForcePreventDefault&&!g||l.isContentEditable||r.preventDefault(),i.freeMode&&i.freeMode.enabled&&t.freeMode&&t.animating&&!i.cssMode&&t.freeMode.onTouchStart(),t.emit("touchStart",r)}function Ro(e){const t=Gr(),n=this,r=n.touchEventsData,{params:o,touches:i,rtlTranslate:a,enabled:s}=n;if(!s)return;if(!o.simulateTouch&&"mouse"===e.pointerType)return;let l,c=e;if(c.originalEvent&&(c=c.originalEvent),"pointermove"===c.type){if(null!==r.touchId)return;if(c.pointerId!==r.pointerId)return}if("touchmove"===c.type){if(l=[...c.changedTouches].filter(e=>e.identifier===r.touchId)[0],!l||l.identifier!==r.touchId)return}else l=c;if(!r.isTouched)return void(r.startMoving&&r.isScrolling&&n.emit("touchMoveOpposite",c));const d=l.pageX,u=l.pageY;if(c.preventedByNestedSwiper)return i.startX=d,void(i.startY=u);if(!n.allowTouchMove)return c.target.matches(r.focusableElements)||(n.allowClick=!1),void(r.isTouched&&(Object.assign(i,{startX:d,startY:u,currentX:d,currentY:u}),r.touchStartTime=Zr()));if(o.touchReleaseOnEdges&&!o.loop)if(n.isVertical()){if(u<i.startY&&n.translate<=n.maxTranslate()||u>i.startY&&n.translate>=n.minTranslate())return r.isTouched=!1,void(r.isMoved=!1)}else if(d<i.startX&&n.translate<=n.maxTranslate()||d>i.startX&&n.translate>=n.minTranslate())return;if(t.activeElement&&t.activeElement.matches(r.focusableElements)&&t.activeElement!==c.target&&"mouse"!==c.pointerType&&t.activeElement.blur(),t.activeElement&&c.target===t.activeElement&&c.target.matches(r.focusableElements))return r.isMoved=!0,void(n.allowClick=!1);r.allowTouchCallbacks&&n.emit("touchMove",c),i.previousX=i.currentX,i.previousY=i.currentY,i.currentX=d,i.currentY=u;const p=i.currentX-i.startX,f=i.currentY-i.startY;if(n.params.threshold&&Math.sqrt(p**2+f**2)<n.params.threshold)return;if(void 0===r.isScrolling){let e;n.isHorizontal()&&i.currentY===i.startY||n.isVertical()&&i.currentX===i.startX?r.isScrolling=!1:p*p+f*f>=25&&(e=180*Math.atan2(Math.abs(f),Math.abs(p))/Math.PI,r.isScrolling=n.isHorizontal()?e>o.touchAngle:90-e>o.touchAngle)}if(r.isScrolling&&n.emit("touchMoveOpposite",c),void 0===r.startMoving&&(i.currentX===i.startX&&i.currentY===i.startY||(r.startMoving=!0)),r.isScrolling||"touchmove"===c.type&&r.preventTouchMoveFromPointerMove)return void(r.isTouched=!1);if(!r.startMoving)return;n.allowClick=!1,!o.cssMode&&c.cancelable&&c.preventDefault(),o.touchMoveStopPropagation&&!o.nested&&c.stopPropagation();let m=n.isHorizontal()?p:f,h=n.isHorizontal()?i.currentX-i.previousX:i.currentY-i.previousY;o.oneWayMovement&&(m=Math.abs(m)*(a?1:-1),h=Math.abs(h)*(a?1:-1)),i.diff=m,m*=o.touchRatio,a&&(m=-m,h=-h);const g=n.touchesDirection;n.swipeDirection=m>0?"prev":"next",n.touchesDirection=h>0?"prev":"next";const v=n.params.loop&&!o.cssMode,b="next"===n.touchesDirection&&n.allowSlideNext||"prev"===n.touchesDirection&&n.allowSlidePrev;if(!r.isMoved){if(v&&b&&n.loopFix({direction:n.swipeDirection}),r.startTranslate=n.getTranslate(),n.setTransition(0),n.animating){const e=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});n.wrapperEl.dispatchEvent(e)}r.allowMomentumBounce=!1,!o.grabCursor||!0!==n.allowSlideNext&&!0!==n.allowSlidePrev||n.setGrabCursor(!0),n.emit("sliderFirstMove",c)}if((new Date).getTime(),r.isMoved&&r.allowThresholdMove&&g!==n.touchesDirection&&v&&b&&Math.abs(m)>=1)return Object.assign(i,{startX:d,startY:u,currentX:d,currentY:u,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,void(r.startTranslate=r.currentTranslate);n.emit("sliderMove",c),r.isMoved=!0,r.currentTranslate=m+r.startTranslate;let y=!0,w=o.resistanceRatio;if(o.touchReleaseOnEdges&&(w=0),m>0?(v&&b&&r.allowThresholdMove&&r.currentTranslate>(o.centeredSlides?n.minTranslate()-n.slidesSizesGrid[n.activeIndex+1]-("auto"!==o.slidesPerView&&n.slides.length-o.slidesPerView>=2?n.slidesSizesGrid[n.activeIndex+1]+n.params.spaceBetween:0)-n.params.spaceBetween:n.minTranslate())&&n.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>n.minTranslate()&&(y=!1,o.resistance&&(r.currentTranslate=n.minTranslate()-1+(-n.minTranslate()+r.startTranslate+m)**w))):m<0&&(v&&b&&r.allowThresholdMove&&r.currentTranslate<(o.centeredSlides?n.maxTranslate()+n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween+("auto"!==o.slidesPerView&&n.slides.length-o.slidesPerView>=2?n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween:0):n.maxTranslate())&&n.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:n.slides.length-("auto"===o.slidesPerView?n.slidesPerViewDynamic():Math.ceil(parseFloat(o.slidesPerView,10)))}),r.currentTranslate<n.maxTranslate()&&(y=!1,o.resistance&&(r.currentTranslate=n.maxTranslate()+1-(n.maxTranslate()-r.startTranslate-m)**w))),y&&(c.preventedByNestedSwiper=!0),!n.allowSlideNext&&"next"===n.swipeDirection&&r.currentTranslate<r.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&"prev"===n.swipeDirection&&r.currentTranslate>r.startTranslate&&(r.currentTranslate=r.startTranslate),n.allowSlidePrev||n.allowSlideNext||(r.currentTranslate=r.startTranslate),o.threshold>0){if(!(Math.abs(m)>o.threshold||r.allowThresholdMove))return void(r.currentTranslate=r.startTranslate);if(!r.allowThresholdMove)return r.allowThresholdMove=!0,i.startX=i.currentX,i.startY=i.currentY,r.currentTranslate=r.startTranslate,void(i.diff=n.isHorizontal()?i.currentX-i.startX:i.currentY-i.startY)}o.followFinger&&!o.cssMode&&((o.freeMode&&o.freeMode.enabled&&n.freeMode||o.watchSlidesProgress)&&(n.updateActiveIndex(),n.updateSlidesClasses()),o.freeMode&&o.freeMode.enabled&&n.freeMode&&n.freeMode.onTouchMove(),n.updateProgress(r.currentTranslate),n.setTranslate(r.currentTranslate))}function Ao(e){const t=this,n=t.touchEventsData;let r,o=e;o.originalEvent&&(o=o.originalEvent);if("touchend"===o.type||"touchcancel"===o.type){if(r=[...o.changedTouches].filter(e=>e.identifier===n.touchId)[0],!r||r.identifier!==n.touchId)return}else{if(null!==n.touchId)return;if(o.pointerId!==n.pointerId)return;r=o}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(o.type)){if(!(["pointercancel","contextmenu"].includes(o.type)&&(t.browser.isSafari||t.browser.isWebView)))return}n.pointerId=null,n.touchId=null;const{params:i,touches:a,rtlTranslate:s,slidesGrid:l,enabled:c}=t;if(!c)return;if(!i.simulateTouch&&"mouse"===o.pointerType)return;if(n.allowTouchCallbacks&&t.emit("touchEnd",o),n.allowTouchCallbacks=!1,!n.isTouched)return n.isMoved&&i.grabCursor&&t.setGrabCursor(!1),n.isMoved=!1,void(n.startMoving=!1);i.grabCursor&&n.isMoved&&n.isTouched&&(!0===t.allowSlideNext||!0===t.allowSlidePrev)&&t.setGrabCursor(!1);const d=Zr(),u=d-n.touchStartTime;if(t.allowClick){const e=o.path||o.composedPath&&o.composedPath();t.updateClickedSlide(e&&e[0]||o.target,e),t.emit("tap click",o),u<300&&d-n.lastClickTime<300&&t.emit("doubleTap doubleClick",o)}if(n.lastClickTime=Zr(),Kr(()=>{t.destroyed||(t.allowClick=!0)}),!n.isTouched||!n.isMoved||!t.swipeDirection||0===a.diff&&!n.loopSwapReset||n.currentTranslate===n.startTranslate&&!n.loopSwapReset)return n.isTouched=!1,n.isMoved=!1,void(n.startMoving=!1);let p;if(n.isTouched=!1,n.isMoved=!1,n.startMoving=!1,p=i.followFinger?s?t.translate:-t.translate:-n.currentTranslate,i.cssMode)return;if(i.freeMode&&i.freeMode.enabled)return void t.freeMode.onTouchEnd({currentPos:p});const f=p>=-t.maxTranslate()&&!t.params.loop;let m=0,h=t.slidesSizesGrid[0];for(let e=0;e<l.length;e+=e<i.slidesPerGroupSkip?1:i.slidesPerGroup){const t=e<i.slidesPerGroupSkip-1?1:i.slidesPerGroup;void 0!==l[e+t]?(f||p>=l[e]&&p<l[e+t])&&(m=e,h=l[e+t]-l[e]):(f||p>=l[e])&&(m=e,h=l[l.length-1]-l[l.length-2])}let g=null,v=null;i.rewind&&(t.isBeginning?v=i.virtual&&i.virtual.enabled&&t.virtual?t.virtual.slides.length-1:t.slides.length-1:t.isEnd&&(g=0));const b=(p-l[m])/h,y=m<i.slidesPerGroupSkip-1?1:i.slidesPerGroup;if(u>i.longSwipesMs){if(!i.longSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&(b>=i.longSwipesRatio?t.slideTo(i.rewind&&t.isEnd?g:m+y):t.slideTo(m)),"prev"===t.swipeDirection&&(b>1-i.longSwipesRatio?t.slideTo(m+y):null!==v&&b<0&&Math.abs(b)>i.longSwipesRatio?t.slideTo(v):t.slideTo(m))}else{if(!i.shortSwipes)return void t.slideTo(t.activeIndex);t.navigation&&(o.target===t.navigation.nextEl||o.target===t.navigation.prevEl)?o.target===t.navigation.nextEl?t.slideTo(m+y):t.slideTo(m):("next"===t.swipeDirection&&t.slideTo(null!==g?g:m+y),"prev"===t.swipeDirection&&t.slideTo(null!==v?v:m))}}function zo(){const e=this,{params:t,el:n}=e;if(n&&0===n.offsetWidth)return;t.breakpoints&&e.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:o,snapGrid:i}=e,a=e.virtual&&e.params.virtual.enabled;e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),e.updateSlidesClasses();const s=a&&t.loop;!("auto"===t.slidesPerView||t.slidesPerView>1)||!e.isEnd||e.isBeginning||e.params.centeredSlides||s?e.params.loop&&!a?e.slideToLoop(e.realIndex,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0):e.slideTo(e.slides.length-1,0,!1,!0),e.autoplay&&e.autoplay.running&&e.autoplay.paused&&(clearTimeout(e.autoplay.resizeTimeout),e.autoplay.resizeTimeout=setTimeout(()=>{e.autoplay&&e.autoplay.running&&e.autoplay.paused&&e.autoplay.resume()},500)),e.allowSlidePrev=o,e.allowSlideNext=r,e.params.watchOverflow&&i!==e.snapGrid&&e.checkOverflow()}function _o(e){const t=this;t.enabled&&(t.allowClick||(t.params.preventClicks&&e.preventDefault(),t.params.preventClicksPropagation&&t.animating&&(e.stopPropagation(),e.stopImmediatePropagation())))}function Lo(){const e=this,{wrapperEl:t,rtlTranslate:n,enabled:r}=e;if(!r)return;let o;e.previousTranslate=e.translate,e.isHorizontal()?e.translate=-t.scrollLeft:e.translate=-t.scrollTop,0===e.translate&&(e.translate=0),e.updateActiveIndex(),e.updateSlidesClasses();const i=e.maxTranslate()-e.minTranslate();o=0===i?0:(e.translate-e.minTranslate())/i,o!==e.progress&&e.updateProgress(n?-e.translate:e.translate),e.emit("setTranslate",e.translate,!1)}function $o(e){const t=this;xo(t,e.target),t.params.cssMode||"auto"!==t.params.slidesPerView&&!t.params.autoHeight||t.update()}function jo(){const e=this;e.documentTouchHandlerProceeded||(e.documentTouchHandlerProceeded=!0,e.params.touchReleaseOnEdges&&(e.el.style.touchAction="auto"))}const Fo=(e,t)=>{const n=Gr(),{params:r,el:o,wrapperEl:i,device:a}=e,s=!!r.nested,l="on"===t?"addEventListener":"removeEventListener",c=t;o&&"string"!=typeof o&&(n[l]("touchstart",e.onDocumentTouchStart,{passive:!1,capture:s}),o[l]("touchstart",e.onTouchStart,{passive:!1}),o[l]("pointerdown",e.onTouchStart,{passive:!1}),n[l]("touchmove",e.onTouchMove,{passive:!1,capture:s}),n[l]("pointermove",e.onTouchMove,{passive:!1,capture:s}),n[l]("touchend",e.onTouchEnd,{passive:!0}),n[l]("pointerup",e.onTouchEnd,{passive:!0}),n[l]("pointercancel",e.onTouchEnd,{passive:!0}),n[l]("touchcancel",e.onTouchEnd,{passive:!0}),n[l]("pointerout",e.onTouchEnd,{passive:!0}),n[l]("pointerleave",e.onTouchEnd,{passive:!0}),n[l]("contextmenu",e.onTouchEnd,{passive:!0}),(r.preventClicks||r.preventClicksPropagation)&&o[l]("click",e.onClick,!0),r.cssMode&&i[l]("scroll",e.onScroll),r.updateOnWindowResize?e[c](a.ios||a.android?"resize orientationchange observerUpdate":"resize observerUpdate",zo,!0):e[c]("observerUpdate",zo,!0),o[l]("load",e.onLoad,{capture:!0}))};const Wo=(e,t)=>e.grid&&t.grid&&t.grid.rows>1;var Bo={setBreakpoint:function(){const e=this,{realIndex:t,initialized:n,params:r,el:o}=e,i=r.breakpoints;if(!i||i&&0===Object.keys(i).length)return;const a=e.getBreakpoint(i,e.params.breakpointsBase,e.el);if(!a||e.currentBreakpoint===a)return;const s=(a in i?i[a]:void 0)||e.originalParams,l=Wo(e,r),c=Wo(e,s),d=e.params.grabCursor,u=s.grabCursor,p=r.enabled;l&&!c?(o.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),e.emitContainerClasses()):!l&&c&&(o.classList.add(`${r.containerModifierClass}grid`),(s.grid.fill&&"column"===s.grid.fill||!s.grid.fill&&"column"===r.grid.fill)&&o.classList.add(`${r.containerModifierClass}grid-column`),e.emitContainerClasses()),d&&!u?e.unsetGrabCursor():!d&&u&&e.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(t=>{if(void 0===s[t])return;const n=r[t]&&r[t].enabled,o=s[t]&&s[t].enabled;n&&!o&&e[t].disable(),!n&&o&&e[t].enable()});const f=s.direction&&s.direction!==r.direction,m=r.loop&&(s.slidesPerView!==r.slidesPerView||f),h=r.loop;f&&n&&e.changeDirection(),to(e.params,s);const g=e.params.enabled,v=e.params.loop;Object.assign(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),p&&!g?e.disable():!p&&g&&e.enable(),e.currentBreakpoint=a,e.emit("_beforeBreakpoint",s),n&&(m?(e.loopDestroy(),e.loopCreate(t),e.updateSlides()):!h&&v?(e.loopCreate(t),e.updateSlides()):h&&!v&&e.loopDestroy()),e.emit("breakpoint",s)},getBreakpoint:function(e,t,n){if(void 0===t&&(t="window"),!e||"container"===t&&!n)return;let r=!1;const o=Xr(),i="window"===t?o.innerHeight:n.clientHeight,a=Object.keys(e).map(e=>{if("string"==typeof e&&0===e.indexOf("@")){const t=parseFloat(e.substr(1));return{value:i*t,point:e}}return{value:e,point:e}});a.sort((e,t)=>parseInt(e.value,10)-parseInt(t.value,10));for(let e=0;e<a.length;e+=1){const{point:i,value:s}=a[e];"window"===t?o.matchMedia(`(min-width: ${s}px)`).matches&&(r=i):s<=n.clientWidth&&(r=i)}return r||"max"}};var Ho={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function Vo(e,t){return function(n){void 0===n&&(n={});const r=Object.keys(n)[0],o=n[r];"object"==typeof o&&null!==o?(!0===e[r]&&(e[r]={enabled:!0}),"navigation"===r&&e[r]&&e[r].enabled&&!e[r].prevEl&&!e[r].nextEl&&(e[r].auto=!0),["pagination","scrollbar"].indexOf(r)>=0&&e[r]&&e[r].enabled&&!e[r].el&&(e[r].auto=!0),r in e&&"enabled"in o?("object"!=typeof e[r]||"enabled"in e[r]||(e[r].enabled=!0),e[r]||(e[r]={enabled:!1}),to(t,n)):to(t,n)):to(t,n)}}const Uo={eventsEmitter:yo,update:Oo,translate:Co,transition:No,slide:ko,loop:Mo,grabCursor:{setGrabCursor:function(e){const t=this;if(!t.params.simulateTouch||t.params.watchOverflow&&t.isLocked||t.params.cssMode)return;const n="container"===t.params.touchEventsTarget?t.el:t.wrapperEl;t.isElement&&(t.__preventObserver__=!0),n.style.cursor="move",n.style.cursor=e?"grabbing":"grab",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1})},unsetGrabCursor:function(){const e=this;e.params.watchOverflow&&e.isLocked||e.params.cssMode||(e.isElement&&(e.__preventObserver__=!0),e["container"===e.params.touchEventsTarget?"el":"wrapperEl"].style.cursor="",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1}))}},events:{attachEvents:function(){const e=this,{params:t}=e;e.onTouchStart=Do.bind(e),e.onTouchMove=Ro.bind(e),e.onTouchEnd=Ao.bind(e),e.onDocumentTouchStart=jo.bind(e),t.cssMode&&(e.onScroll=Lo.bind(e)),e.onClick=_o.bind(e),e.onLoad=$o.bind(e),Fo(e,"on")},detachEvents:function(){Fo(this,"off")}},breakpoints:Bo,checkOverflow:{checkOverflow:function(){const e=this,{isLocked:t,params:n}=e,{slidesOffsetBefore:r}=n;if(r){const t=e.slides.length-1,n=e.slidesGrid[t]+e.slidesSizesGrid[t]+2*r;e.isLocked=e.size>n}else e.isLocked=1===e.snapGrid.length;!0===n.allowSlideNext&&(e.allowSlideNext=!e.isLocked),!0===n.allowSlidePrev&&(e.allowSlidePrev=!e.isLocked),t&&t!==e.isLocked&&(e.isEnd=!1),t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock")}},classes:{addClasses:function(){const e=this,{classNames:t,params:n,rtl:r,el:o,device:i}=e,a=function(e,t){const n=[];return e.forEach(e=>{"object"==typeof e?Object.keys(e).forEach(r=>{e[r]&&n.push(t+r)}):"string"==typeof e&&n.push(t+e)}),n}(["initialized",n.direction,{"free-mode":e.params.freeMode&&n.freeMode.enabled},{autoheight:n.autoHeight},{rtl:r},{grid:n.grid&&n.grid.rows>1},{"grid-column":n.grid&&n.grid.rows>1&&"column"===n.grid.fill},{android:i.android},{ios:i.ios},{"css-mode":n.cssMode},{centered:n.cssMode&&n.centeredSlides},{"watch-progress":n.watchSlidesProgress}],n.containerModifierClass);t.push(...a),o.classList.add(...t),e.emitContainerClasses()},removeClasses:function(){const{el:e,classNames:t}=this;e&&"string"!=typeof e&&(e.classList.remove(...t),this.emitContainerClasses())}}},Yo={};let Go=class e{constructor(){let t,n;for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];1===o.length&&o[0].constructor&&"Object"===Object.prototype.toString.call(o[0]).slice(8,-1)?n=o[0]:[t,n]=o,n||(n={}),n=to({},n),t&&!n.el&&(n.el=t);const a=Gr();if(n.el&&"string"==typeof n.el&&a.querySelectorAll(n.el).length>1){const t=[];return a.querySelectorAll(n.el).forEach(r=>{const o=to({},n,{el:r});t.push(new e(o))}),t}const s=this;s.__swiper__=!0,s.support=go(),s.device=vo({userAgent:n.userAgent}),s.browser=bo(),s.eventsListeners={},s.eventsAnyListeners=[],s.modules=[...s.__modules__],n.modules&&Array.isArray(n.modules)&&s.modules.push(...n.modules);const l={};s.modules.forEach(e=>{e({params:n,swiper:s,extendParams:Vo(n,l),on:s.on.bind(s),once:s.once.bind(s),off:s.off.bind(s),emit:s.emit.bind(s)})});const c=to({},Ho,l);return s.params=to({},c,Yo,n),s.originalParams=to({},s.params),s.passedParams=to({},n),s.params&&s.params.on&&Object.keys(s.params.on).forEach(e=>{s.on(e,s.params.on[e])}),s.params&&s.params.onAny&&s.onAny(s.params.onAny),Object.assign(s,{enabled:s.params.enabled,el:t,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal:()=>"horizontal"===s.params.direction,isVertical:()=>"vertical"===s.params.direction,activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:s.params.allowSlideNext,allowSlidePrev:s.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:s.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:s.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),s.emit("_swiper"),s.params.init&&s.init(),s}getDirectionLabel(e){return this.isHorizontal()?e:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[e]}getSlideIndex(e){const{slidesEl:t,params:n}=this,r=co(io(t,`.${n.slideClass}, swiper-slide`)[0]);return co(e)-r}getSlideIndexByData(e){return this.getSlideIndex(this.slides.filter(t=>1*t.getAttribute("data-swiper-slide-index")===e)[0])}recalcSlides(){const{slidesEl:e,params:t}=this;this.slides=io(e,`.${t.slideClass}, swiper-slide`)}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,t){const n=this;e=Math.min(Math.max(e,0),1);const r=n.minTranslate(),o=(n.maxTranslate()-r)*e+r;n.translateTo(o,void 0===t?0:t),n.updateActiveIndex(),n.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=e.el.className.split(" ").filter(t=>0===t.indexOf("swiper")||0===t.indexOf(e.params.containerModifierClass));e.emit("_containerClasses",t.join(" "))}getSlideClasses(e){const t=this;return t.destroyed?"":e.className.split(" ").filter(e=>0===e.indexOf("swiper-slide")||0===e.indexOf(t.params.slideClass)).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=[];e.slides.forEach(n=>{const r=e.getSlideClasses(n);t.push({slideEl:n,classNames:r}),e.emit("_slideClass",n,r)}),e.emit("_slideClasses",t)}slidesPerViewDynamic(e,t){void 0===e&&(e="current"),void 0===t&&(t=!1);const{params:n,slides:r,slidesGrid:o,slidesSizesGrid:i,size:a,activeIndex:s}=this;let l=1;if("number"==typeof n.slidesPerView)return n.slidesPerView;if(n.centeredSlides){let e,t=r[s]?Math.ceil(r[s].swiperSlideSize):0;for(let n=s+1;n<r.length;n+=1)r[n]&&!e&&(t+=Math.ceil(r[n].swiperSlideSize),l+=1,t>a&&(e=!0));for(let n=s-1;n>=0;n-=1)r[n]&&!e&&(t+=r[n].swiperSlideSize,l+=1,t>a&&(e=!0))}else if("current"===e)for(let e=s+1;e<r.length;e+=1){(t?o[e]+i[e]-o[s]<a:o[e]-o[s]<a)&&(l+=1)}else for(let e=s-1;e>=0;e-=1){o[s]-o[e]<a&&(l+=1)}return l}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:n}=e;function r(){const t=e.rtlTranslate?-1*e.translate:e.translate,n=Math.min(Math.max(t,e.maxTranslate()),e.minTranslate());e.setTranslate(n),e.updateActiveIndex(),e.updateSlidesClasses()}let o;if(n.breakpoints&&e.setBreakpoint(),[...e.el.querySelectorAll('[loading="lazy"]')].forEach(t=>{t.complete&&xo(e,t)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),n.freeMode&&n.freeMode.enabled&&!n.cssMode)r(),n.autoHeight&&e.updateAutoHeight();else{if(("auto"===n.slidesPerView||n.slidesPerView>1)&&e.isEnd&&!n.centeredSlides){const t=e.virtual&&n.virtual.enabled?e.virtual.slides:e.slides;o=e.slideTo(t.length-1,0,!1,!0)}else o=e.slideTo(e.activeIndex,0,!1,!0);o||r()}n.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t){void 0===t&&(t=!0);const n=this,r=n.params.direction;return e||(e="horizontal"===r?"vertical":"horizontal"),e===r||"horizontal"!==e&&"vertical"!==e||(n.el.classList.remove(`${n.params.containerModifierClass}${r}`),n.el.classList.add(`${n.params.containerModifierClass}${e}`),n.emitContainerClasses(),n.params.direction=e,n.slides.forEach(t=>{"vertical"===e?t.style.width="":t.style.height=""}),n.emit("changeDirection"),t&&n.update()),n}changeLanguageDirection(e){const t=this;t.rtl&&"rtl"===e||!t.rtl&&"ltr"===e||(t.rtl="rtl"===e,t.rtlTranslate="horizontal"===t.params.direction&&t.rtl,t.rtl?(t.el.classList.add(`${t.params.containerModifierClass}rtl`),t.el.dir="rtl"):(t.el.classList.remove(`${t.params.containerModifierClass}rtl`),t.el.dir="ltr"),t.update())}mount(e){const t=this;if(t.mounted)return!0;let n=e||t.params.el;if("string"==typeof n&&(n=document.querySelector(n)),!n)return!1;n.swiper=t,n.parentNode&&n.parentNode.host&&n.parentNode.host.nodeName===t.params.swiperElementNodeName.toUpperCase()&&(t.isElement=!0);const r=()=>`.${(t.params.wrapperClass||"").trim().split(" ").join(".")}`;let o=(()=>{if(n&&n.shadowRoot&&n.shadowRoot.querySelector){return n.shadowRoot.querySelector(r())}return io(n,r())[0]})();return!o&&t.params.createElements&&(o=so("div",t.params.wrapperClass),n.append(o),io(n,`.${t.params.slideClass}`).forEach(e=>{o.append(e)})),Object.assign(t,{el:n,wrapperEl:o,slidesEl:t.isElement&&!n.parentNode.host.slideSlots?n.parentNode.host:o,hostEl:t.isElement?n.parentNode.host:n,mounted:!0,rtl:"rtl"===n.dir.toLowerCase()||"rtl"===lo(n,"direction"),rtlTranslate:"horizontal"===t.params.direction&&("rtl"===n.dir.toLowerCase()||"rtl"===lo(n,"direction")),wrongRTL:"-webkit-box"===lo(o,"display")}),!0}init(e){const t=this;if(t.initialized)return t;if(!1===t.mount(e))return t;t.emit("beforeInit"),t.params.breakpoints&&t.setBreakpoint(),t.addClasses(),t.updateSize(),t.updateSlides(),t.params.watchOverflow&&t.checkOverflow(),t.params.grabCursor&&t.enabled&&t.setGrabCursor(),t.params.loop&&t.virtual&&t.params.virtual.enabled?t.slideTo(t.params.initialSlide+t.virtual.slidesBefore,0,t.params.runCallbacksOnInit,!1,!0):t.slideTo(t.params.initialSlide,0,t.params.runCallbacksOnInit,!1,!0),t.params.loop&&t.loopCreate(),t.attachEvents();const n=[...t.el.querySelectorAll('[loading="lazy"]')];return t.isElement&&n.push(...t.hostEl.querySelectorAll('[loading="lazy"]')),n.forEach(e=>{e.complete?xo(t,e):e.addEventListener("load",e=>{xo(t,e.target)})}),To(t),t.initialized=!0,To(t),t.emit("init"),t.emit("afterInit"),t}destroy(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0);const n=this,{params:r,el:o,wrapperEl:i,slides:a}=n;return void 0===n.params||n.destroyed||(n.emit("beforeDestroy"),n.initialized=!1,n.detachEvents(),r.loop&&n.loopDestroy(),t&&(n.removeClasses(),o&&"string"!=typeof o&&o.removeAttribute("style"),i&&i.removeAttribute("style"),a&&a.length&&a.forEach(e=>{e.classList.remove(r.slideVisibleClass,r.slideFullyVisibleClass,r.slideActiveClass,r.slideNextClass,r.slidePrevClass),e.removeAttribute("style"),e.removeAttribute("data-swiper-slide-index")})),n.emit("destroy"),Object.keys(n.eventsListeners).forEach(e=>{n.off(e)}),!1!==e&&(n.el&&"string"!=typeof n.el&&(n.el.swiper=null),function(e){const t=e;Object.keys(t).forEach(e=>{try{t[e]=null}catch(e){}try{delete t[e]}catch(e){}})}(n)),n.destroyed=!0),null}static extendDefaults(e){to(Yo,e)}static get extendedDefaults(){return Yo}static get defaults(){return Ho}static installModule(t){e.prototype.__modules__||(e.prototype.__modules__=[]);const n=e.prototype.__modules__;"function"==typeof t&&n.indexOf(t)<0&&n.push(t)}static use(t){return Array.isArray(t)?(t.forEach(t=>e.installModule(t)),e):(e.installModule(t),e)}};Object.keys(Uo).forEach(e=>{Object.keys(Uo[e]).forEach(t=>{Go.prototype[t]=Uo[e][t]})}),Go.use([function(e){let{swiper:t,on:n,emit:r}=e;const o=Xr();let i=null,a=null;const s=()=>{t&&!t.destroyed&&t.initialized&&(r("beforeResize"),r("resize"))},l=()=>{t&&!t.destroyed&&t.initialized&&r("orientationchange")};n("init",()=>{t.params.resizeObserver&&void 0!==o.ResizeObserver?t&&!t.destroyed&&t.initialized&&(i=new ResizeObserver(e=>{a=o.requestAnimationFrame(()=>{const{width:n,height:r}=t;let o=n,i=r;e.forEach(e=>{let{contentBoxSize:n,contentRect:r,target:a}=e;a&&a!==t.el||(o=r?r.width:(n[0]||n).inlineSize,i=r?r.height:(n[0]||n).blockSize)}),o===n&&i===r||s()})}),i.observe(t.el)):(o.addEventListener("resize",s),o.addEventListener("orientationchange",l))}),n("destroy",()=>{a&&o.cancelAnimationFrame(a),i&&i.unobserve&&t.el&&(i.unobserve(t.el),i=null),o.removeEventListener("resize",s),o.removeEventListener("orientationchange",l)})},function(e){let{swiper:t,extendParams:n,on:r,emit:o}=e;const i=[],a=Xr(),s=function(e,n){void 0===n&&(n={});const r=new(a.MutationObserver||a.WebkitMutationObserver)(e=>{if(t.__preventObserver__)return;if(1===e.length)return void o("observerUpdate",e[0]);const n=function(){o("observerUpdate",e[0])};a.requestAnimationFrame?a.requestAnimationFrame(n):a.setTimeout(n,0)});r.observe(e,{attributes:void 0===n.attributes||n.attributes,childList:t.isElement||(void 0===n.childList||n).childList,characterData:void 0===n.characterData||n.characterData}),i.push(r)};n({observer:!1,observeParents:!1,observeSlideChildren:!1}),r("init",()=>{if(t.params.observer){if(t.params.observeParents){const e=function(e){const t=[];let n=e.parentElement;for(;n;)t.push(n),n=n.parentElement;return t}(t.hostEl);for(let t=0;t<e.length;t+=1)s(e[t])}s(t.hostEl,{childList:t.params.observeSlideChildren}),s(t.wrapperEl,{attributes:!1})}}),r("destroy",()=>{i.forEach(e=>{e.disconnect()}),i.splice(0,i.length)})}]);const qo=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function Xo(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!e.__swiper__}function Ko(e,t){const n=["__proto__","constructor","prototype"];Object.keys(t).filter(e=>n.indexOf(e)<0).forEach(n=>{void 0===e[n]?e[n]=t[n]:Xo(t[n])&&Xo(e[n])&&Object.keys(t[n]).length>0?t[n].__swiper__?e[n]=t[n]:Ko(e[n],t[n]):e[n]=t[n]})}function Zo(e){return void 0===e&&(e={}),e.navigation&&void 0===e.navigation.nextEl&&void 0===e.navigation.prevEl}function Jo(e){return void 0===e&&(e={}),e.pagination&&void 0===e.pagination.el}function Qo(e){return void 0===e&&(e={}),e.scrollbar&&void 0===e.scrollbar.el}function ei(e){void 0===e&&(e="");const t=e.split(" ").map(e=>e.trim()).filter(e=>!!e),n=[];return t.forEach(e=>{n.indexOf(e)<0&&n.push(e)}),n.join(" ")}function ti(e){return void 0===e&&(e=""),e?e.includes("swiper-wrapper")?e:`swiper-wrapper ${e}`:"swiper-wrapper"}function ni(){return ni=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ni.apply(this,arguments)}function ri(e){return e.type&&e.type.displayName&&e.type.displayName.includes("SwiperSlide")}function oi(e){const n=[];return t.Children.toArray(e).forEach(e=>{ri(e)?n.push(e):e.props&&e.props.children&&oi(e.props.children).forEach(e=>n.push(e))}),n}function ii(e){const n=[],r={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return t.Children.toArray(e).forEach(e=>{if(ri(e))n.push(e);else if(e.props&&e.props.slot&&r[e.props.slot])r[e.props.slot].push(e);else if(e.props&&e.props.children){const t=oi(e.props.children);t.length>0?t.forEach(e=>n.push(e)):r["container-end"].push(e)}else r["container-end"].push(e)}),{slides:n,slots:r}}function ai(e,t){return"undefined"==typeof window?r(e,t):s(e,t)}const si=l(null),li=l(null),ci=o(function(e,o){let{className:i,tag:s="div",wrapperTag:l="div",children:c,onSwiper:d,...u}=void 0===e?{}:e,p=!1;const[f,m]=a("swiper"),[h,g]=a(null),[v,b]=a(!1),y=n(!1),w=n(null),E=n(null),x=n(null),S=n(null),T=n(null),O=n(null),C=n(null),P=n(null),{params:N,passedParams:k,rest:M,events:I}=function(e,t){void 0===e&&(e={}),void 0===t&&(t=!0);const n={on:{}},r={},o={};Ko(n,Ho),n._emitClasses=!0,n.init=!1;const i={},a=qo.map(e=>e.replace(/_/,"")),s=Object.assign({},e);return Object.keys(s).forEach(s=>{void 0!==e[s]&&(a.indexOf(s)>=0?Xo(e[s])?(n[s]={},o[s]={},Ko(n[s],e[s]),Ko(o[s],e[s])):(n[s]=e[s],o[s]=e[s]):0===s.search(/on[A-Z]/)&&"function"==typeof e[s]?t?r[`${s[2].toLowerCase()}${s.substr(3)}`]=e[s]:n.on[`${s[2].toLowerCase()}${s.substr(3)}`]=e[s]:i[s]=e[s])}),["navigation","pagination","scrollbar"].forEach(e=>{!0===n[e]&&(n[e]={}),!1===n[e]&&delete n[e]}),{params:n,passedParams:o,rest:i,events:r}}(u),{slides:D,slots:R}=ii(c),A=()=>{b(!v)};Object.assign(N.on,{_containerClasses(e,t){m(t)}});const z=()=>{Object.assign(N.on,I),p=!0;const e={...N};if(delete e.wrapperClass,E.current=new Go(e),E.current.virtual&&E.current.params.virtual.enabled){E.current.virtual.slides=D;const e={cache:!1,slides:D,renderExternal:g,renderExternalUpdate:!1};Ko(E.current.params.virtual,e),Ko(E.current.originalParams.virtual,e)}};w.current||z(),E.current&&E.current.on("_beforeBreakpoint",A);return r(()=>()=>{E.current&&E.current.off("_beforeBreakpoint",A)}),r(()=>{!y.current&&E.current&&(E.current.emitSlidesClasses(),y.current=!0)}),ai(()=>{if(o&&(o.current=w.current),w.current)return E.current.destroyed&&z(),function(e,t){let{el:n,nextEl:r,prevEl:o,paginationEl:i,scrollbarEl:a,swiper:s}=e;Zo(t)&&r&&o&&(s.params.navigation.nextEl=r,s.originalParams.navigation.nextEl=r,s.params.navigation.prevEl=o,s.originalParams.navigation.prevEl=o),Jo(t)&&i&&(s.params.pagination.el=i,s.originalParams.pagination.el=i),Qo(t)&&a&&(s.params.scrollbar.el=a,s.originalParams.scrollbar.el=a),s.init(n)}({el:w.current,nextEl:T.current,prevEl:O.current,paginationEl:C.current,scrollbarEl:P.current,swiper:E.current},N),d&&!E.current.destroyed&&d(E.current),()=>{E.current&&!E.current.destroyed&&E.current.destroy(!0,!1)}},[]),ai(()=>{!p&&I&&E.current&&Object.keys(I).forEach(e=>{E.current.on(e,I[e])});const e=function(e,t,n,r,o){const i=[];if(!t)return i;const a=e=>{i.indexOf(e)<0&&i.push(e)};if(n&&r){const e=r.map(o),t=n.map(o);e.join("")!==t.join("")&&a("children"),r.length!==n.length&&a("children")}return qo.filter(e=>"_"===e[0]).map(e=>e.replace(/_/,"")).forEach(n=>{if(n in e&&n in t)if(Xo(e[n])&&Xo(t[n])){const r=Object.keys(e[n]),o=Object.keys(t[n]);r.length!==o.length?a(n):(r.forEach(r=>{e[n][r]!==t[n][r]&&a(n)}),o.forEach(r=>{e[n][r]!==t[n][r]&&a(n)}))}else e[n]!==t[n]&&a(n)}),i}(k,x.current,D,S.current,e=>e.key);return x.current=k,S.current=D,e.length&&E.current&&!E.current.destroyed&&function(e){let{swiper:t,slides:n,passedParams:r,changedParams:o,nextEl:i,prevEl:a,scrollbarEl:s,paginationEl:l}=e;const c=o.filter(e=>"children"!==e&&"direction"!==e&&"wrapperClass"!==e),{params:d,pagination:u,navigation:p,scrollbar:f,virtual:m,thumbs:h}=t;let g,v,b,y,w,E,x,S;o.includes("thumbs")&&r.thumbs&&r.thumbs.swiper&&!r.thumbs.swiper.destroyed&&d.thumbs&&(!d.thumbs.swiper||d.thumbs.swiper.destroyed)&&(g=!0),o.includes("controller")&&r.controller&&r.controller.control&&d.controller&&!d.controller.control&&(v=!0),o.includes("pagination")&&r.pagination&&(r.pagination.el||l)&&(d.pagination||!1===d.pagination)&&u&&!u.el&&(b=!0),o.includes("scrollbar")&&r.scrollbar&&(r.scrollbar.el||s)&&(d.scrollbar||!1===d.scrollbar)&&f&&!f.el&&(y=!0),o.includes("navigation")&&r.navigation&&(r.navigation.prevEl||a)&&(r.navigation.nextEl||i)&&(d.navigation||!1===d.navigation)&&p&&!p.prevEl&&!p.nextEl&&(w=!0);const T=e=>{t[e]&&(t[e].destroy(),"navigation"===e?(t.isElement&&(t[e].prevEl.remove(),t[e].nextEl.remove()),d[e].prevEl=void 0,d[e].nextEl=void 0,t[e].prevEl=void 0,t[e].nextEl=void 0):(t.isElement&&t[e].el.remove(),d[e].el=void 0,t[e].el=void 0))};o.includes("loop")&&t.isElement&&(d.loop&&!r.loop?E=!0:!d.loop&&r.loop?x=!0:S=!0),c.forEach(e=>{if(Xo(d[e])&&Xo(r[e]))Object.assign(d[e],r[e]),"navigation"!==e&&"pagination"!==e&&"scrollbar"!==e||!("enabled"in r[e])||r[e].enabled||T(e);else{const t=r[e];!0!==t&&!1!==t||"navigation"!==e&&"pagination"!==e&&"scrollbar"!==e?d[e]=r[e]:!1===t&&T(e)}}),c.includes("controller")&&!v&&t.controller&&t.controller.control&&d.controller&&d.controller.control&&(t.controller.control=d.controller.control),o.includes("children")&&n&&m&&d.virtual.enabled?(m.slides=n,m.update(!0)):o.includes("virtual")&&m&&d.virtual.enabled&&(n&&(m.slides=n),m.update(!0)),o.includes("children")&&n&&d.loop&&(S=!0),g&&h.init()&&h.update(!0);v&&(t.controller.control=d.controller.control),b&&(!t.isElement||l&&"string"!=typeof l||(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),t.el.appendChild(l)),l&&(d.pagination.el=l),u.init(),u.render(),u.update()),y&&(!t.isElement||s&&"string"!=typeof s||(s=document.createElement("div"),s.classList.add("swiper-scrollbar"),s.part.add("scrollbar"),t.el.appendChild(s)),s&&(d.scrollbar.el=s),f.init(),f.updateSize(),f.setTranslate()),w&&(t.isElement&&(i&&"string"!=typeof i||(i=document.createElement("div"),i.classList.add("swiper-button-next"),i.innerHTML=t.hostEl.constructor.nextButtonSvg,i.part.add("button-next"),t.el.appendChild(i)),a&&"string"!=typeof a||(a=document.createElement("div"),a.classList.add("swiper-button-prev"),a.innerHTML=t.hostEl.constructor.prevButtonSvg,a.part.add("button-prev"),t.el.appendChild(a))),i&&(d.navigation.nextEl=i),a&&(d.navigation.prevEl=a),p.init(),p.update()),o.includes("allowSlideNext")&&(t.allowSlideNext=r.allowSlideNext),o.includes("allowSlidePrev")&&(t.allowSlidePrev=r.allowSlidePrev),o.includes("direction")&&t.changeDirection(r.direction,!1),(E||S)&&t.loopDestroy(),(x||S)&&t.loopCreate(),t.update()}({swiper:E.current,slides:D,passedParams:k,changedParams:e,nextEl:T.current,prevEl:O.current,scrollbarEl:P.current,paginationEl:C.current}),()=>{I&&E.current&&Object.keys(I).forEach(e=>{E.current.off(e,I[e])})}}),ai(()=>{var e;!(e=E.current)||e.destroyed||!e.params.virtual||e.params.virtual&&!e.params.virtual.enabled||(e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),e.parallax&&e.params.parallax&&e.params.parallax.enabled&&e.parallax.setTranslate())},[h]),t.createElement(s,ni({ref:w,className:ei(`${f}${i?` ${i}`:""}`)},M),t.createElement(li.Provider,{value:E.current},R["container-start"],t.createElement(l,{className:ti(N.wrapperClass)},R["wrapper-start"],N.virtual?function(e,n,r){if(!r)return null;const o=e=>{let t=e;return e<0?t=n.length+e:t>=n.length&&(t-=n.length),t},i=e.isHorizontal()?{[e.rtlTranslate?"right":"left"]:`${r.offset}px`}:{top:`${r.offset}px`},{from:a,to:s}=r,l=e.params.loop?-n.length:0,c=e.params.loop?2*n.length:n.length,d=[];for(let e=l;e<c;e+=1)e>=a&&e<=s&&d.push(n[o(e)]);return d.map((n,r)=>t.cloneElement(n,{swiper:e,style:i,key:n.props.virtualIndex||n.key||`slide-${r}`}))}(E.current,D,h):D.map((e,n)=>t.cloneElement(e,{swiper:E.current,swiperSlideIndex:n})),R["wrapper-end"]),Zo(N)&&t.createElement(t.Fragment,null,t.createElement("div",{ref:O,className:"swiper-button-prev"}),t.createElement("div",{ref:T,className:"swiper-button-next"})),Qo(N)&&t.createElement("div",{ref:P,className:"swiper-scrollbar"}),Jo(N)&&t.createElement("div",{ref:C,className:"swiper-pagination"}),R["container-end"]))});ci.displayName="Swiper";const di=o(function(e,r){let{tag:o="div",children:i,className:s="",swiper:l,zoom:c,lazy:d,virtualIndex:u,swiperSlideIndex:p,...f}=void 0===e?{}:e;const m=n(null),[h,g]=a("swiper-slide"),[v,b]=a(!1);function y(e,t,n){t===m.current&&g(n)}ai(()=>{if(void 0!==p&&(m.current.swiperSlideIndex=p),r&&(r.current=m.current),m.current&&l){if(!l.destroyed)return l.on("_slideClass",y),()=>{l&&l.off("_slideClass",y)};"swiper-slide"!==h&&g("swiper-slide")}}),ai(()=>{l&&m.current&&!l.destroyed&&g(l.getSlideClasses(m.current))},[l]);const w={isActive:h.indexOf("swiper-slide-active")>=0,isVisible:h.indexOf("swiper-slide-visible")>=0,isPrev:h.indexOf("swiper-slide-prev")>=0,isNext:h.indexOf("swiper-slide-next")>=0},E=()=>"function"==typeof i?i(w):i;return t.createElement(o,ni({ref:m,className:ei(`${h}${s?` ${s}`:""}`),"data-swiper-slide-index":u,onLoad:()=>{b(!0)}},f),c&&t.createElement(si.Provider,{value:w},t.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":"number"==typeof c?c:void 0},E(),d&&!v&&t.createElement("div",{className:"swiper-lazy-preloader"}))),!c&&t.createElement(si.Provider,{value:w},E(),d&&!v&&t.createElement("div",{className:"swiper-lazy-preloader"})))});function ui(e){let{swiper:t,extendParams:n,on:r,emit:o}=e;const i=Xr();let a;n({mousewheel:{enabled:!1,releaseOnEdges:!1,invert:!1,forceToAxis:!1,sensitivity:1,eventsTarget:"container",thresholdDelta:null,thresholdTime:null,noMousewheelClass:"swiper-no-mousewheel"}}),t.mousewheel={enabled:!1};let s,l=Zr();const c=[];function d(){t.enabled&&(t.mouseEntered=!0)}function u(){t.enabled&&(t.mouseEntered=!1)}function p(e){return!(t.params.mousewheel.thresholdDelta&&e.delta<t.params.mousewheel.thresholdDelta)&&(!(t.params.mousewheel.thresholdTime&&Zr()-l<t.params.mousewheel.thresholdTime)&&(e.delta>=6&&Zr()-l<60||(e.direction<0?t.isEnd&&!t.params.loop||t.animating||(t.slideNext(),o("scroll",e.raw)):t.isBeginning&&!t.params.loop||t.animating||(t.slidePrev(),o("scroll",e.raw)),l=(new i.Date).getTime(),!1)))}function f(e){let n=e,r=!0;if(!t.enabled)return;if(e.target.closest(`.${t.params.mousewheel.noMousewheelClass}`))return;const i=t.params.mousewheel;t.params.cssMode&&n.preventDefault();let l=t.el;"container"!==t.params.mousewheel.eventsTarget&&(l=document.querySelector(t.params.mousewheel.eventsTarget));const d=l&&l.contains(n.target);if(!t.mouseEntered&&!d&&!i.releaseOnEdges)return!0;n.originalEvent&&(n=n.originalEvent);let u=0;const f=t.rtlTranslate?-1:1,m=function(e){let t=0,n=0,r=0,o=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,o=10*n,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(r=e.deltaX),e.shiftKey&&!r&&(r=o,o=0),(r||o)&&e.deltaMode&&(1===e.deltaMode?(r*=40,o*=40):(r*=800,o*=800)),r&&!t&&(t=r<1?-1:1),o&&!n&&(n=o<1?-1:1),{spinX:t,spinY:n,pixelX:r,pixelY:o}}(n);if(i.forceToAxis)if(t.isHorizontal()){if(!(Math.abs(m.pixelX)>Math.abs(m.pixelY)))return!0;u=-m.pixelX*f}else{if(!(Math.abs(m.pixelY)>Math.abs(m.pixelX)))return!0;u=-m.pixelY}else u=Math.abs(m.pixelX)>Math.abs(m.pixelY)?-m.pixelX*f:-m.pixelY;if(0===u)return!0;i.invert&&(u=-u);let h=t.getTranslate()+u*i.sensitivity;if(h>=t.minTranslate()&&(h=t.minTranslate()),h<=t.maxTranslate()&&(h=t.maxTranslate()),r=!!t.params.loop||!(h===t.minTranslate()||h===t.maxTranslate()),r&&t.params.nested&&n.stopPropagation(),t.params.freeMode&&t.params.freeMode.enabled){const e={time:Zr(),delta:Math.abs(u),direction:Math.sign(u)},r=s&&e.time<s.time+500&&e.delta<=s.delta&&e.direction===s.direction;if(!r){s=void 0;let l=t.getTranslate()+u*i.sensitivity;const d=t.isBeginning,p=t.isEnd;if(l>=t.minTranslate()&&(l=t.minTranslate()),l<=t.maxTranslate()&&(l=t.maxTranslate()),t.setTransition(0),t.setTranslate(l),t.updateProgress(),t.updateActiveIndex(),t.updateSlidesClasses(),(!d&&t.isBeginning||!p&&t.isEnd)&&t.updateSlidesClasses(),t.params.loop&&t.loopFix({direction:e.direction<0?"next":"prev",byMousewheel:!0}),t.params.freeMode.sticky){clearTimeout(a),a=void 0,c.length>=15&&c.shift();const n=c.length?c[c.length-1]:void 0,r=c[0];if(c.push(e),n&&(e.delta>n.delta||e.direction!==n.direction))c.splice(0);else if(c.length>=15&&e.time-r.time<500&&r.delta-e.delta>=1&&e.delta<=6){const n=u>0?.8:.2;s=e,c.splice(0),a=Kr(()=>{!t.destroyed&&t.params&&t.slideToClosest(t.params.speed,!0,void 0,n)},0)}a||(a=Kr(()=>{if(t.destroyed||!t.params)return;s=e,c.splice(0),t.slideToClosest(t.params.speed,!0,void 0,.5)},500))}if(r||o("scroll",n),t.params.autoplay&&t.params.autoplayDisableOnInteraction&&t.autoplay.stop(),i.releaseOnEdges&&(l===t.minTranslate()||l===t.maxTranslate()))return!0}}else{const n={time:Zr(),delta:Math.abs(u),direction:Math.sign(u),raw:e};c.length>=2&&c.shift();const r=c.length?c[c.length-1]:void 0;if(c.push(n),r?(n.direction!==r.direction||n.delta>r.delta||n.time>r.time+150)&&p(n):p(n),function(e){const n=t.params.mousewheel;if(e.direction<0){if(t.isEnd&&!t.params.loop&&n.releaseOnEdges)return!0}else if(t.isBeginning&&!t.params.loop&&n.releaseOnEdges)return!0;return!1}(n))return!0}return n.preventDefault?n.preventDefault():n.returnValue=!1,!1}function m(e){let n=t.el;"container"!==t.params.mousewheel.eventsTarget&&(n=document.querySelector(t.params.mousewheel.eventsTarget)),n[e]("mouseenter",d),n[e]("mouseleave",u),n[e]("wheel",f)}function h(){return t.params.cssMode?(t.wrapperEl.removeEventListener("wheel",f),!0):!t.mousewheel.enabled&&(m("addEventListener"),t.mousewheel.enabled=!0,!0)}function g(){return t.params.cssMode?(t.wrapperEl.addEventListener(event,f),!0):!!t.mousewheel.enabled&&(m("removeEventListener"),t.mousewheel.enabled=!1,!0)}r("init",()=>{!t.params.mousewheel.enabled&&t.params.cssMode&&g(),t.params.mousewheel.enabled&&h()}),r("destroy",()=>{t.params.cssMode&&h(),t.mousewheel.enabled&&g()}),Object.assign(t.mousewheel,{enable:h,disable:g})}function pi(e){let{swiper:t,extendParams:n,on:r,emit:o}=e;function i(e){let n;return e&&"string"==typeof e&&t.isElement&&(n=t.el.querySelector(e)||t.hostEl.querySelector(e),n)?n:(e&&("string"==typeof e&&(n=[...document.querySelectorAll(e)]),t.params.uniqueNavElements&&"string"==typeof e&&n&&n.length>1&&1===t.el.querySelectorAll(e).length?n=t.el.querySelector(e):n&&1===n.length&&(n=n[0])),e&&!n?e:n)}function a(e,n){const r=t.params.navigation;(e=po(e)).forEach(e=>{e&&(e.classList[n?"add":"remove"](...r.disabledClass.split(" ")),"BUTTON"===e.tagName&&(e.disabled=n),t.params.watchOverflow&&t.enabled&&e.classList[t.isLocked?"add":"remove"](r.lockClass))})}function s(){const{nextEl:e,prevEl:n}=t.navigation;if(t.params.loop)return a(n,!1),void a(e,!1);a(n,t.isBeginning&&!t.params.rewind),a(e,t.isEnd&&!t.params.rewind)}function l(e){e.preventDefault(),(!t.isBeginning||t.params.loop||t.params.rewind)&&(t.slidePrev(),o("navigationPrev"))}function c(e){e.preventDefault(),(!t.isEnd||t.params.loop||t.params.rewind)&&(t.slideNext(),o("navigationNext"))}function d(){const e=t.params.navigation;if(t.params.navigation=function(e,t,n,r){return e.params.createElements&&Object.keys(r).forEach(o=>{if(!n[o]&&!0===n.auto){let i=io(e.el,`.${r[o]}`)[0];i||(i=so("div",r[o]),i.className=r[o],e.el.append(i)),n[o]=i,t[o]=i}}),n}(t,t.originalParams.navigation,t.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!e.nextEl&&!e.prevEl)return;let n=i(e.nextEl),r=i(e.prevEl);Object.assign(t.navigation,{nextEl:n,prevEl:r}),n=po(n),r=po(r);const o=(n,r)=>{n&&n.addEventListener("click","next"===r?c:l),!t.enabled&&n&&n.classList.add(...e.lockClass.split(" "))};n.forEach(e=>o(e,"next")),r.forEach(e=>o(e,"prev"))}function u(){let{nextEl:e,prevEl:n}=t.navigation;e=po(e),n=po(n);const r=(e,n)=>{e.removeEventListener("click","next"===n?c:l),e.classList.remove(...t.params.navigation.disabledClass.split(" "))};e.forEach(e=>r(e,"next")),n.forEach(e=>r(e,"prev"))}n({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),t.navigation={nextEl:null,prevEl:null},r("init",()=>{!1===t.params.navigation.enabled?p():(d(),s())}),r("toEdge fromEdge lock unlock",()=>{s()}),r("destroy",()=>{u()}),r("enable disable",()=>{let{nextEl:e,prevEl:n}=t.navigation;e=po(e),n=po(n),t.enabled?s():[...e,...n].filter(e=>!!e).forEach(e=>e.classList.add(t.params.navigation.lockClass))}),r("click",(e,n)=>{let{nextEl:r,prevEl:i}=t.navigation;r=po(r),i=po(i);const a=n.target;let s=i.includes(a)||r.includes(a);if(t.isElement&&!s){const e=n.path||n.composedPath&&n.composedPath();e&&(s=e.find(e=>r.includes(e)||i.includes(e)))}if(t.params.navigation.hideOnClick&&!s){if(t.pagination&&t.params.pagination&&t.params.pagination.clickable&&(t.pagination.el===a||t.pagination.el.contains(a)))return;let e;r.length?e=r[0].classList.contains(t.params.navigation.hiddenClass):i.length&&(e=i[0].classList.contains(t.params.navigation.hiddenClass)),o(!0===e?"navigationShow":"navigationHide"),[...r,...i].filter(e=>!!e).forEach(e=>e.classList.toggle(t.params.navigation.hiddenClass))}});const p=()=>{t.el.classList.add(...t.params.navigation.navigationDisabledClass.split(" ")),u()};Object.assign(t.navigation,{enable:()=>{t.el.classList.remove(...t.params.navigation.navigationDisabledClass.split(" ")),d(),s()},disable:p,update:s,init:d,destroy:u})}function fi(e){let t,n,{swiper:r,extendParams:o,on:i,emit:a,params:s}=e;r.autoplay={running:!1,paused:!1,timeLeft:0},o({autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!1,stopOnLastSlide:!1,reverseDirection:!1,pauseOnMouseEnter:!1}});let l,c,d,u,p,f,m,h,g=s&&s.autoplay?s.autoplay.delay:3e3,v=s&&s.autoplay?s.autoplay.delay:3e3,b=(new Date).getTime();function y(e){r&&!r.destroyed&&r.wrapperEl&&e.target===r.wrapperEl&&(r.wrapperEl.removeEventListener("transitionend",y),h||e.detail&&e.detail.bySwiperTouchMove||O())}const w=()=>{if(r.destroyed||!r.autoplay.running)return;r.autoplay.paused?c=!0:c&&(v=l,c=!1);const e=r.autoplay.paused?l:b+v-(new Date).getTime();r.autoplay.timeLeft=e,a("autoplayTimeLeft",e,e/g),n=requestAnimationFrame(()=>{w()})},E=e=>{if(r.destroyed||!r.autoplay.running)return;cancelAnimationFrame(n),w();let o=void 0===e?r.params.autoplay.delay:e;g=r.params.autoplay.delay,v=r.params.autoplay.delay;const i=(()=>{let e;if(e=r.virtual&&r.params.virtual.enabled?r.slides.filter(e=>e.classList.contains("swiper-slide-active"))[0]:r.slides[r.activeIndex],!e)return;return parseInt(e.getAttribute("data-swiper-autoplay"),10)})();!Number.isNaN(i)&&i>0&&void 0===e&&(o=i,g=i,v=i),l=o;const s=r.params.speed,c=()=>{r&&!r.destroyed&&(r.params.autoplay.reverseDirection?!r.isBeginning||r.params.loop||r.params.rewind?(r.slidePrev(s,!0,!0),a("autoplay")):r.params.autoplay.stopOnLastSlide||(r.slideTo(r.slides.length-1,s,!0,!0),a("autoplay")):!r.isEnd||r.params.loop||r.params.rewind?(r.slideNext(s,!0,!0),a("autoplay")):r.params.autoplay.stopOnLastSlide||(r.slideTo(0,s,!0,!0),a("autoplay")),r.params.cssMode&&(b=(new Date).getTime(),requestAnimationFrame(()=>{E()})))};return o>0?(clearTimeout(t),t=setTimeout(()=>{c()},o)):requestAnimationFrame(()=>{c()}),o},x=()=>{b=(new Date).getTime(),r.autoplay.running=!0,E(),a("autoplayStart")},S=()=>{r.autoplay.running=!1,clearTimeout(t),cancelAnimationFrame(n),a("autoplayStop")},T=(e,n)=>{if(r.destroyed||!r.autoplay.running)return;clearTimeout(t),e||(m=!0);const o=()=>{a("autoplayPause"),r.params.autoplay.waitForTransition?r.wrapperEl.addEventListener("transitionend",y):O()};if(r.autoplay.paused=!0,n)return f&&(l=r.params.autoplay.delay),f=!1,void o();const i=l||r.params.autoplay.delay;l=i-((new Date).getTime()-b),r.isEnd&&l<0&&!r.params.loop||(l<0&&(l=0),o())},O=()=>{r.isEnd&&l<0&&!r.params.loop||r.destroyed||!r.autoplay.running||(b=(new Date).getTime(),m?(m=!1,E(l)):E(),r.autoplay.paused=!1,a("autoplayResume"))},C=()=>{if(r.destroyed||!r.autoplay.running)return;const e=Gr();"hidden"===e.visibilityState&&(m=!0,T(!0)),"visible"===e.visibilityState&&O()},P=e=>{"mouse"===e.pointerType&&(m=!0,h=!0,r.animating||r.autoplay.paused||T(!0))},N=e=>{"mouse"===e.pointerType&&(h=!1,r.autoplay.paused&&O())};i("init",()=>{r.params.autoplay.enabled&&(r.params.autoplay.pauseOnMouseEnter&&(r.el.addEventListener("pointerenter",P),r.el.addEventListener("pointerleave",N)),Gr().addEventListener("visibilitychange",C),x())}),i("destroy",()=>{r.el&&"string"!=typeof r.el&&(r.el.removeEventListener("pointerenter",P),r.el.removeEventListener("pointerleave",N)),Gr().removeEventListener("visibilitychange",C),r.autoplay.running&&S()}),i("_freeModeStaticRelease",()=>{(u||m)&&O()}),i("_freeModeNoMomentumRelease",()=>{r.params.autoplay.disableOnInteraction?S():T(!0,!0)}),i("beforeTransitionStart",(e,t,n)=>{!r.destroyed&&r.autoplay.running&&(n||!r.params.autoplay.disableOnInteraction?T(!0,!0):S())}),i("sliderFirstMove",()=>{!r.destroyed&&r.autoplay.running&&(r.params.autoplay.disableOnInteraction?S():(d=!0,u=!1,m=!1,p=setTimeout(()=>{m=!0,u=!0,T(!0)},200)))}),i("touchEnd",()=>{if(!r.destroyed&&r.autoplay.running&&d){if(clearTimeout(p),clearTimeout(t),r.params.autoplay.disableOnInteraction)return u=!1,void(d=!1);u&&r.params.cssMode&&O(),u=!1,d=!1}}),i("slideChange",()=>{!r.destroyed&&r.autoplay.running&&(f=!0)}),Object.assign(r.autoplay,{start:x,stop:S,pause:T,resume:O})}function mi(e){let t,n,r,o,{swiper:i,extendParams:a,on:s}=e;a({grid:{rows:1,fill:"column"}});const l=()=>{let e=i.params.spaceBetween;return"string"==typeof e&&e.indexOf("%")>=0?e=parseFloat(e.replace("%",""))/100*i.size:"string"==typeof e&&(e=parseFloat(e)),e};s("init",()=>{o=i.params.grid&&i.params.grid.rows>1}),s("update",()=>{const{params:e,el:t}=i,n=e.grid&&e.grid.rows>1;o&&!n?(t.classList.remove(`${e.containerModifierClass}grid`,`${e.containerModifierClass}grid-column`),r=1,i.emitContainerClasses()):!o&&n&&(t.classList.add(`${e.containerModifierClass}grid`),"column"===e.grid.fill&&t.classList.add(`${e.containerModifierClass}grid-column`),i.emitContainerClasses()),o=n}),i.grid={initSlides:e=>{const{slidesPerView:o}=i.params,{rows:a,fill:s}=i.params.grid,l=i.virtual&&i.params.virtual.enabled?i.virtual.slides.length:e.length;r=Math.floor(l/a),t=Math.floor(l/a)===l/a?l:Math.ceil(l/a)*a,"auto"!==o&&"row"===s&&(t=Math.max(t,o*a)),n=t/a},unsetSlides:()=>{i.slides&&i.slides.forEach(e=>{e.swiperSlideGridSet&&(e.style.height="",e.style[i.getDirectionLabel("margin-top")]="")})},updateSlide:(e,o,a)=>{const{slidesPerGroup:s}=i.params,c=l(),{rows:d,fill:u}=i.params.grid,p=i.virtual&&i.params.virtual.enabled?i.virtual.slides.length:a.length;let f,m,h;if("row"===u&&s>1){const n=Math.floor(e/(s*d)),r=e-d*s*n,i=0===n?s:Math.min(Math.ceil((p-n*d*s)/d),s);h=Math.floor(r/i),m=r-h*i+n*s,f=m+h*t/d,o.style.order=f}else"column"===u?(m=Math.floor(e/d),h=e-m*d,(m>r||m===r&&h===d-1)&&(h+=1,h>=d&&(h=0,m+=1))):(h=Math.floor(e/n),m=e-h*n);o.row=h,o.column=m,o.style.height=`calc((100% - ${(d-1)*c}px) / ${d})`,o.style[i.getDirectionLabel("margin-top")]=0!==h?c&&`${c}px`:"",o.swiperSlideGridSet=!0},updateWrapperSize:(e,n)=>{const{centeredSlides:r,roundLengths:o}=i.params,a=l(),{rows:s}=i.params.grid;if(i.virtualSize=(e+a)*t,i.virtualSize=Math.ceil(i.virtualSize/s)-a,i.params.cssMode||(i.wrapperEl.style[i.getDirectionLabel("width")]=`${i.virtualSize+a}px`),r){const e=[];for(let t=0;t<n.length;t+=1){let r=n[t];o&&(r=Math.floor(r)),n[t]<i.virtualSize+n[0]&&e.push(r)}n.splice(0,n.length),n.push(...e)}}}}function hi(e){const t=this,{params:n,slidesEl:r}=t;n.loop&&t.loopDestroy();const o=e=>{if("string"==typeof e){const t=document.createElement("div");t.innerHTML=e,r.append(t.children[0]),t.innerHTML=""}else r.append(e)};if("object"==typeof e&&"length"in e)for(let t=0;t<e.length;t+=1)e[t]&&o(e[t]);else o(e);t.recalcSlides(),n.loop&&t.loopCreate(),n.observer&&!t.isElement||t.update()}function gi(e){const t=this,{params:n,activeIndex:r,slidesEl:o}=t;n.loop&&t.loopDestroy();let i=r+1;const a=e=>{if("string"==typeof e){const t=document.createElement("div");t.innerHTML=e,o.prepend(t.children[0]),t.innerHTML=""}else o.prepend(e)};if("object"==typeof e&&"length"in e){for(let t=0;t<e.length;t+=1)e[t]&&a(e[t]);i=r+e.length}else a(e);t.recalcSlides(),n.loop&&t.loopCreate(),n.observer&&!t.isElement||t.update(),t.slideTo(i,0,!1)}function vi(e,t){const n=this,{params:r,activeIndex:o,slidesEl:i}=n;let a=o;r.loop&&(a-=n.loopedSlides,n.loopDestroy(),n.recalcSlides());const s=n.slides.length;if(e<=0)return void n.prependSlide(t);if(e>=s)return void n.appendSlide(t);let l=a>e?a+1:a;const c=[];for(let t=s-1;t>=e;t-=1){const e=n.slides[t];e.remove(),c.unshift(e)}if("object"==typeof t&&"length"in t){for(let e=0;e<t.length;e+=1)t[e]&&i.append(t[e]);l=a>e?a+t.length:a}else i.append(t);for(let e=0;e<c.length;e+=1)i.append(c[e]);n.recalcSlides(),r.loop&&n.loopCreate(),r.observer&&!n.isElement||n.update(),r.loop?n.slideTo(l+n.loopedSlides,0,!1):n.slideTo(l,0,!1)}function bi(e){const t=this,{params:n,activeIndex:r}=t;let o=r;n.loop&&(o-=t.loopedSlides,t.loopDestroy());let i,a=o;if("object"==typeof e&&"length"in e){for(let n=0;n<e.length;n+=1)i=e[n],t.slides[i]&&t.slides[i].remove(),i<a&&(a-=1);a=Math.max(a,0)}else i=e,t.slides[i]&&t.slides[i].remove(),i<a&&(a-=1),a=Math.max(a,0);t.recalcSlides(),n.loop&&t.loopCreate(),n.observer&&!t.isElement||t.update(),n.loop?t.slideTo(a+t.loopedSlides,0,!1):t.slideTo(a,0,!1)}function yi(){const e=this,t=[];for(let n=0;n<e.slides.length;n+=1)t.push(n);e.removeSlide(t)}function wi(e){let{swiper:t}=e;Object.assign(t,{appendSlide:hi.bind(t),prependSlide:gi.bind(t),addSlide:vi.bind(t),removeSlide:bi.bind(t),removeAllSlides:yi.bind(t)})}function Ei(e,t){const n=oo(t);return n!==t&&(n.style.backfaceVisibility="hidden",n.style["-webkit-backface-visibility"]="hidden"),n}function xi(e){let{swiper:t,duration:n,transformElements:r,allSlides:o}=e;const{activeIndex:i}=t;if(t.params.virtualTranslate&&0!==n){let e,n=!1;e=o?r:r.filter(e=>{const n=e.classList.contains("swiper-slide-transform")?(e=>{if(!e.parentElement)return t.slides.filter(t=>t.shadowRoot&&t.shadowRoot===e.parentNode)[0];return e.parentElement})(e):e;return t.getSlideIndex(n)===i}),e.forEach(e=>{!function(e,t){t&&e.addEventListener("transitionend",function n(r){r.target===e&&(t.call(e,r),e.removeEventListener("transitionend",n))})}(e,()=>{if(n)return;if(!t||t.destroyed)return;n=!0,t.animating=!1;const e=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});t.wrapperEl.dispatchEvent(e)})})}}function Si(e,t,n){const r=`swiper-slide-shadow swiper-slide-shadow-${e}`,o=oo(t);let i=o.querySelector(`.${r.split(" ").join(".")}`);return i||(i=so("div",r.split(" ")),o.append(i)),i}function Ti(e){let{swiper:t,extendParams:n,on:r}=e;n({cardsEffect:{slideShadows:!0,rotate:!0,perSlideRotate:2,perSlideOffset:8}});!function(e){const{effect:t,swiper:n,on:r,setTranslate:o,setTransition:i,overwriteParams:a,perspective:s,recreateShadows:l,getEffectParams:c}=e;let d;r("beforeInit",()=>{if(n.params.effect!==t)return;n.classNames.push(`${n.params.containerModifierClass}${t}`),s&&s()&&n.classNames.push(`${n.params.containerModifierClass}3d`);const e=a?a():{};Object.assign(n.params,e),Object.assign(n.originalParams,e)}),r("setTranslate",()=>{n.params.effect===t&&o()}),r("setTransition",(e,r)=>{n.params.effect===t&&i(r)}),r("transitionEnd",()=>{if(n.params.effect===t&&l){if(!c||!c().slideShadows)return;n.slides.forEach(e=>{e.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(e=>e.remove())}),l()}}),r("virtualUpdate",()=>{n.params.effect===t&&(n.slides.length||(d=!0),requestAnimationFrame(()=>{d&&n.slides&&n.slides.length&&(o(),d=!1)}))})}({effect:"cards",swiper:t,on:r,setTranslate:()=>{const{slides:e,activeIndex:n,rtlTranslate:r}=t,o=t.params.cardsEffect,{startTranslate:i,isTouched:a}=t.touchEventsData,s=r?-t.translate:t.translate;for(let l=0;l<e.length;l+=1){const c=e[l],d=c.progress,u=Math.min(Math.max(d,-4),4);let p=c.swiperSlideOffset;t.params.centeredSlides&&!t.params.cssMode&&(t.wrapperEl.style.transform=`translateX(${t.minTranslate()}px)`),t.params.centeredSlides&&t.params.cssMode&&(p-=e[0].swiperSlideOffset);let f=t.params.cssMode?-p-t.translate:-p,m=0;const h=-100*Math.abs(u);let g=1,v=-o.perSlideRotate*u,b=o.perSlideOffset-.75*Math.abs(u);const y=t.virtual&&t.params.virtual.enabled?t.virtual.from+l:l,w=(y===n||y===n-1)&&u>0&&u<1&&(a||t.params.cssMode)&&s<i,E=(y===n||y===n+1)&&u<0&&u>-1&&(a||t.params.cssMode)&&s>i;if(w||E){const e=(1-Math.abs((Math.abs(u)-.5)/.5))**.5;v+=-28*u*e,g+=-.5*e,b+=96*e,m=-25*e*Math.abs(u)+"%"}if(f=u<0?`calc(${f}px ${r?"-":"+"} (${b*Math.abs(u)}%))`:u>0?`calc(${f}px ${r?"-":"+"} (-${b*Math.abs(u)}%))`:`${f}px`,!t.isHorizontal()){const e=m;m=f,f=e}const x=u<0?""+(1+(1-g)*u):""+(1-(1-g)*u),S=`\n translate3d(${f}, ${m}, ${h}px)\n rotateZ(${o.rotate?r?-v:v:0}deg)\n scale(${x})\n `;if(o.slideShadows){let e=c.querySelector(".swiper-slide-shadow");e||(e=Si("cards",c)),e&&(e.style.opacity=Math.min(Math.max((Math.abs(u)-.5)/.5,0),1))}c.style.zIndex=-Math.abs(Math.round(d))+e.length;Ei(0,c).style.transform=S}},setTransition:e=>{const n=t.slides.map(e=>oo(e));n.forEach(t=>{t.style.transitionDuration=`${e}ms`,t.querySelectorAll(".swiper-slide-shadow").forEach(t=>{t.style.transitionDuration=`${e}ms`})}),xi({swiper:t,duration:e,transformElements:n})},perspective:()=>!0,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!t.params.cssMode})})}di.displayName="SwiperSlide";const Oi=({product:e})=>{const[n,r]=a(!1);return t.createElement("a",{href:e.linkPath,target:"_blank"},t.createElement("div",{className:"w-full h-full flex gap-2 flex-col"},t.createElement("div",{className:"w-full max-h-fit aspect-square border mb-2 flex justify-center items-center"},e.thumbPath&&!n?t.createElement(Qt,{product:e,onError:()=>r(!0)}):t.createElement(Jt,null)),t.createElement("div",{className:"justify-center flex flex-col"},e.brand&&t.createElement("p",{className:"max-w-52 break-keep line-clamp-1 text-xs text-gray-500"},e.brand.brandName),t.createElement("p",null,e.productName),t.createElement("div",null,t.createElement("span",{className:"font-semibold text-red-500"},e.discount,"%"," "),t.createElement("span",{className:"font-semibold"},Tt(e.sellingPrice),"원")))))},Ci=({products:e})=>{const o=n(null),[i,s]=a(0),l=n(null);r(()=>{u(),window.addEventListener("resize",()=>{clearInterval(c),c=setTimeout(u,d)})},[]);let c=null;const d=100,u=()=>{l.current&&s(l.current.offsetWidth)};return e&&t.createElement("div",{className:"flex items-center h-full justify-center w-full",ref:l},e.length>3?t.createElement(Wt,{size:50,className:"cursor-pointer slide__prev",onClick:()=>{var e;null===(e=o.current)||void 0===e||e.slidePrev()}}):t.createElement("div",{className:"w-[50px]"}),t.createElement(ci,{modules:[pi],onSwiper:e=>{o.current=e},style:{width:i},slidesPerView:3,navigation:{prevEl:".slide__prev",nextEl:".slide__next"},spaceBetween:20},e.map(e=>t.createElement(di,{key:e.productId},t.createElement(Oi,{product:e})))),e.length>3?t.createElement(Bt,{onClick:()=>{var e;null===(e=o.current)||void 0===e||e.slideNext()},size:50,className:"cursor-pointer slide__next"}):t.createElement("div",{className:"w-[50px]"}))},Pi=e=>{const{player:n,shortform:r}=e;return t.createElement("div",{className:"flex h-full gap-5"},t.createElement("div",{className:"h-full aspect-[9/16]"},n),t.createElement("div",{className:"w-full min-w-44 max-w-[800px] overflow-hidden text-sm"},t.createElement(Ci,{products:r.productsInfo})))},Ni=({products:e})=>{const r=n(null);return t.createElement("div",{className:"flex items-center flex-col h-full"},e.length>4&&t.createElement(Ht,{size:50,className:"cursor-pointer slide__prev"}),t.createElement(ci,{modules:[ui,pi],mousewheel:!0,onSwiper:e=>{r.current=e},spaceBetween:10,className:"max-w-full h-[80%]",slidesPerView:4,direction:"vertical",navigation:{prevEl:".slide__prev",nextEl:".slide__next"}},e.map(e=>t.createElement(di,{key:e.productId},t.createElement(en,{product:e})))),e.length>4&&t.createElement(Ft,{size:50,className:"cursor-pointer slide__next"}))},ki=e=>{const{playerSettings:n,shortform:{productsInfo:r},player:o}=e;return t.createElement("div",{className:"flex h-full w-full gap-5"},t.createElement("div",{className:" h-full "},o),t.createElement("div",{className:"max-w-[800px] overflow-hidden"},t.createElement(Ni,{products:r})))},Mi=({products:e})=>{const r=n(null),o=e.length>6;return t.createElement("div",{className:"flex items-center my-10 h-full text-sm w-full"},o?t.createElement(Wt,{onClick:()=>{var e;null===(e=r.current)||void 0===e||e.slidePrev()},size:50,className:"cursor-pointer"}):t.createElement("div",{className:"w-[50px]"}),t.createElement(ci,{onSwiper:e=>{r.current=e},className:"w-[80%] h-[80%]",slidesPerView:3,spaceBetween:20,modules:[mi],grid:{rows:2,fill:"row"}},e.map(e=>t.createElement(di,{key:e.productId},t.createElement(Oi,{product:e})))),o?t.createElement(Bt,{onClick:()=>{var e;null===(e=r.current)||void 0===e||e.slideNext()},size:50,className:"cursor-pointer"}):t.createElement("div",{className:"w-[50px]"}))},Ii=e=>{const{player:n,shortform:{productsInfo:r}}=e;return t.createElement("div",{className:"flex gap-4 w-full h-full min-w-[768px]"},t.createElement("div",{className:"flex-1 w-full"},t.createElement("div",{className:"h-full aspect-[9/16]"},n)),t.createElement("div",{className:"flex-[2] w-full h-full overflow-hidden"},t.createElement(Mi,{products:r})))},Di=e=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}),Ri=()=>document.visibilityState,Ai=()=>{throw Error("useVisibilityChange is a client-only hook")};function zi(){return"visible"===e.useSyncExternalStore(Di,Ri,Ai)}var _i=(e,t,o=!0)=>{const i=n(e),a=n(null),s=()=>{a.current&&(clearInterval(a.current),a.current=null)},l=d(()=>{a.current||(a.current=setInterval(()=>i.current(),t))},[t]);return r(()=>{i.current=e},[e]),r(()=>(o&&l(),()=>s()),[l,o]),{clear:s,run:l}};const Li=()=>{const[e,t]=a(0);_i(()=>{t(e=>e+1)},1e3);return{playtime:e,resetPlaytime:()=>t(0)}};let $i=0;const ji=e=>T(void 0,void 0,void 0,function*(){const{PLAYER_BACK_BASE_URL:t}=gt(),{contentId:n,uuid:r,type:o,userId:i}=e;try{if(3===$i)return;const e=`${t}/statistics/play`,a=Object.assign({contentId:n,uuid:r,type:o,date:Ot(),userId:+i,playtime:0,isLive:!1},"shorts"===o&&{isFinished:!1,playedOver5Sec:!1});yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(e){console.error(`Error in statisticsApi.join - contentId: ${n}`),Mt(e),$i++}}),Fi=e=>{const{PLAYER_BACK_BASE_URL:t}=gt(),{contentId:n,uuid:r,type:o,isFinished:i,playtime:a,userId:s}=e,l=Object.assign({contentId:n,uuid:r,playtime:a,type:o,date:Ot(),userId:+s,isLive:!1},"shorts"===o&&{isFinished:i,playedOver5Sec:Number(a)>5});fetch(`${t}/statistics/play`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l),keepalive:!0})},Wi=e=>T(void 0,void 0,void 0,function*(){const{PLAYER_BACK_BASE_URL:t}=gt(),{contentProductId:n}=e;try{yield fetch(`${t}/statistics/products/${n}/clicks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({date:Ot()},e))})}catch(e){console.error(`Error in statisticsApi.productClick - contentProductId: ${n}`),Mt(e)}}),Bi=e=>T(void 0,void 0,void 0,function*(){const{STATISTICS_BASE_URL:t}=gt();try{return(yield(yield fetch(`${t}/${e}/likes`)).json()).result||0}catch(t){return console.error(`Error in statisticsApi.getLike - contentId: ${e}`),Mt(t),0}}),Hi=e=>T(void 0,void 0,void 0,function*(){const{PLAYER_BACK_BASE_URL:t}=gt();try{yield fetch(`${t}/statistics/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contentId:e,isLive:!1,isFirst:!1})})}catch(t){console.error(`Error in statisticsApi.getLike - contentId: ${e}`),Mt(t)}}),Vi=e=>T(void 0,[e],void 0,function*({collectionId:e,nextKey:t,size:n=5}){const{PLAYER_BACK_BASE_URL:r}=gt();try{const o=new URLSearchParams;-1!==n&&o.set("size",String(n)),t&&o.set("nextKey",t);const i=yield fetch(`${r}/commerce/collection/${e}?${o.toString()}`);return i.ok?yield i.json():null}catch(e){return Mt(e),null}}),Ui=(e,...t)=>T(void 0,[e,...t],void 0,function*(e,t=!1){const{API_BASE_URL:n,PLAYER_BACK_BASE_URL:r}=gt();if(t)try{const t=(yield(yield fetch(`${n}/shorts/player/${e}`)).json()).result;if(!t.media)return null;t.file=`${n}/direct/${t.media.objectId}`;const{player:{viewPlayer:{width:r,height:o}}}=t;return Object.assign(Object.assign(Object.assign(Object.assign({layout:t.player.layout},t.player.shoppingPlayer),{aspectRatio:It(r,o)}),t),{uuid:Ct()})}catch(e){return Mt(e),null}try{const t=yield fetch(`${r}/commerce/short-form/${e}`),n=yield t.json();return n.shortsId?n:null}catch(e){return Mt(e),null}}),Yi=(e,t)=>T(void 0,void 0,void 0,function*(){const{API_BASE_URL:n}=gt();try{const{result:r}=yield(yield fetch(`${n}/live/${e}/list?size=${t||6}`)).json();return r}catch(e){return console.error("Error in getLiveWidgetContents: ",e),[]}}),Gi=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e))},a=t=e(r,o,i);return i},qi=e=>e?Gi(e):Gi,Xi=e=>e;function Ki(e,n=Xi){const r=t.useSyncExternalStore(e.subscribe,t.useCallback(()=>n(e.getState()),[e,n]),t.useCallback(()=>n(e.getInitialState()),[e,n]));return t.useDebugValue(r),r}const Zi=e=>{const t=qi(e),n=e=>Ki(t,e);return Object.assign(n,t),n},Ji=e=>e?Zi(e):Zi,Qi=Ji(e=>({priceText:"",isPreview:!1,setPriceText:t=>e({priceText:t}),setIsPreview:t=>e({isPreview:t})})),ea=t.createContext(null),ta=({children:e})=>{const n=t.useRef(null);return n.current||(n.current=qi(e=>({collection:null,setCollection:t=>e({collection:t}),nextKey:"",setNextKey:t=>e({nextKey:t}),isFetching:!1,setIsFetching:t=>e({isFetching:t})}))),t.createElement(ea.Provider,{value:n.current},e)},na=()=>(e=>{const n=t.useContext(ea);if(!n)throw new Error("Missing CollectionProvider");return Ki(n,e)})(e=>e),ra=(e,t)=>{const{collection:n,setCollection:o,isFetching:i,setIsFetching:a,nextKey:s,setNextKey:l}=na(),{isPreview:c}=Qi(),d=(null==e?void 0:e.media)?e.media.duration.split(":").reduce((e,t,n)=>e+ +t*60**(2-n),0):0;const{resetPlaytime:u,playtime:p}=Li(),{playtime:f,resetPlaytime:m}=Li(),h=zi(),g=()=>{if(!n)return;const{colId:t,uuid:r,userId:o}=n,i=Be,a=Math.floor((new Date).getTime()/1e3);localStorage.setItem(i,a.toString()),c||(Fi({contentId:t,uuid:r,type:wt.COLLECTION,userId:o,playtime:f}),e&&Fi({contentId:e.shortsId,uuid:e.uuid,type:wt.SHORTS,userId:o,playtime:p,isFinished:p>=d}),m(),u())};r(()=>{h||g()},[h]);return{onSlideChange:r=>T(void 0,void 0,void 0,function*(){if(e&&n&&(yield(e=>T(void 0,void 0,void 0,function*(){var t,r;if(!n)return;const{contents:c,count:d}=n;if((null!=d?d:Number.MAX_SAFE_INTEGER)>c.length&&e>=c.length-5&&!i){a(!0);try{const e=yield Vi({collectionId:n.colId,nextKey:s});if(!e||!(null===(t=e.contents)||void 0===t?void 0:t.length))return;l((null===(r=e.contents.at(-1))||void 0===r?void 0:r.shortsId)||"");const i=new Set(n.contents.map(e=>e.shortsId)),a=e.contents.filter(e=>!i.has(e.shortsId));if(!a.length)return;const c=n.contents.concat(a);o(Object.assign(Object.assign({},n),{contents:c}))}catch(e){console.error(e)}finally{a(!1)}}}))(r),!c)){const{shortsId:o,uuid:i,userId:a}=e;Fi({contentId:o,uuid:i,type:wt.SHORTS,playtime:p,isFinished:p>=d,userId:a}),u();const s=Ct(),l=n.contents[r];t(Object.assign(Object.assign({},l),{uuid:s})),yield ji({contentId:l.shortsId,uuid:s,type:wt.SHORTS,userId:l.userId,isFirstPlay:!Pt(l.shortsId)})}}),onCollectionClose:g}},oa=e=>{const{collection:r,playerSettings:o,shortform:i,setShortform:a}=e,s=n(null),{onSlideChange:l}=ra(r,i);return t.createElement(t.Fragment,null,t.createElement("div",{className:"self-center flex gap-4 flex-col"},t.createElement(Ht,{size:44,onClick:()=>{var e;null===(e=s.current)||void 0===e||e.swiper.slidePrev()}}),t.createElement(Ft,{size:44,onClick:()=>{var e;null===(e=s.current)||void 0===e||e.swiper.slideNext()}})),t.createElement("div",{className:"h-full aspect-[9/16] my-10"},t.createElement(ci,{modules:[ui,wi],mousewheel:!0,loop:!0,direction:"vertical",touchEventsTarget:"container",slidesPerView:1,ref:s,className:"h-full",onSlideChangeTransitionEnd:e=>T(void 0,void 0,void 0,function*(){yield l(e.realIndex)})},r.contents.map(e=>t.createElement(di,{key:e.shortsId},i.shortsId===e.shortsId&&t.createElement("div",{className:"h-full rounded-xl absolute z-[999] aspect-[9/16] overflow-hidden"},t.createElement(P,{file:St(i.media.objectId)})),t.createElement("img",{src:kt(e.thumbPath),alt:e.title,className:"rounded-xl overflow-hidden h-full bg-black aspect-[9/16] "+(e.media.width>e.media.height?"object-contain":"object-cover")}))))))},ia=e=>{const{collection:r,shortform:o,setShortform:i,playerSettings:a}=e,s=n(null);ra(r,o);return t.createElement("div",{className:"mx-10 flex h-full gap-4"},t.createElement("div",{className:"self-center flex gap-4 flex-col"},t.createElement(Ht,{size:44,onClick:()=>{var e;null===(e=s.current)||void 0===e||e.swiper.slidePrev()}}),t.createElement(Ft,{size:44,onClick:()=>{var e;null===(e=s.current)||void 0===e||e.swiper.slideNext()}})),t.createElement("div",{className:"h-full aspect-[9/16]"},t.createElement(ci,{modules:[ui,wi],mousewheel:!0,direction:"vertical",slidesPerView:1,ref:s,className:"h-full",preventClicksPropagation:!1,preventClicks:!1,noSwiping:!0,allowTouchMove:!1,loop:!0},r.contents.map(e=>t.createElement(di,{key:e.shortsId},t.createElement("div",{className:"flex justify-center gap-3 h-full w-full"},o.shortsId===e.shortsId&&t.createElement("div",{className:"h-full absolute z-[999] w-full"},t.createElement("div",{className:"h-full aspect-[9/16]"},t.createElement(P,{file:St(o.media.objectId)}))),t.createElement("div",{className:"h-full aspec[9/16]"},t.createElement("img",{src:"https://"+e.thumbPath,alt:e.title,className:"w-full h-full bg-black "+(e.media.width>e.media.height?"object-contain":"object-cover")}))))))))},aa=()=>t.createElement("div",{className:"inline-block absolute pointer-events-none top-0 z-10 animate-float w-[24px] h-[24px]"},t.createElement(Vt,{className:"fill-red-500 text-transparent w-[24px] h-[24px]"})),sa=({shortsId:e})=>{const{isPreview:n}=Qi(),[o,i]=a(n?123:0),[s,l]=a([]);r(()=>{n||T(void 0,void 0,void 0,function*(){try{const t=yield Bi(e);i(t)}catch(e){return console.error(`Error in statistics getLikeInLive: ${e.toString()}`),0}})},[]);return t.createElement("div",{className:"flex justify-center flex-col items-center relative w-[24px] h-[24px]"},t.createElement("button",{onClick:()=>T(void 0,void 0,void 0,function*(){(()=>{const e=Date.now();l(t=>[...t,e]),setTimeout(()=>{l(t=>t.filter(t=>t!==e))},2e3)})(),i(e=>e+1),n||(yield T(void 0,void 0,void 0,function*(){yield Hi(e)}))}),className:"z-[5] cursor-pointer"},t.createElement(Vt,{className:"text-xl fill-white w-[24px] h-[24px]"})),s.map(e=>t.createElement(aa,{key:e})),t.createElement("span",{className:"break-keep text-[10px]"},Tt(o)))};var la,ca,da={},ua={exports:{}},pa=ua.exports;function fa(){return la||(la=1,e=ua,t=ua.exports,function(n,r){var o="function",i="undefined",a="object",s="string",l="major",c="model",d="name",u="type",p="vendor",f="version",m="architecture",h="console",g="mobile",v="tablet",b="smarttv",y="wearable",w="embedded",E="Amazon",x="Apple",S="ASUS",T="BlackBerry",O="Browser",C="Chrome",P="Firefox",N="Google",k="Huawei",M="LG",I="Microsoft",D="Motorola",R="Opera",A="Samsung",z="Sharp",_="Sony",L="Xiaomi",$="Zebra",j="Facebook",F="Chromium OS",W="Mac OS",B=" Browser",H=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},V=function(e,t){return typeof e===s&&-1!==U(t).indexOf(U(e))},U=function(e){return e.toLowerCase()},Y=function(e,t){if(typeof e===s)return e=e.replace(/^\s\s*/,""),typeof t===i?e:e.substring(0,500)},G=function(e,t){for(var n,i,s,l,c,d,u=0;u<t.length&&!c;){var p=t[u],f=t[u+1];for(n=i=0;n<p.length&&!c&&p[n];)if(c=p[n++].exec(e))for(s=0;s<f.length;s++)d=c[++i],typeof(l=f[s])===a&&l.length>0?2===l.length?typeof l[1]==o?this[l[0]]=l[1].call(this,d):this[l[0]]=l[1]:3===l.length?typeof l[1]!==o||l[1].exec&&l[1].test?this[l[0]]=d?d.replace(l[1],l[2]):r:this[l[0]]=d?l[1].call(this,d,l[2]):r:4===l.length&&(this[l[0]]=d?l[3].call(this,d.replace(l[1],l[2])):r):this[l]=d||r;u+=2}},q=function(e,t){for(var n in t)if(typeof t[n]===a&&t[n].length>0){for(var o=0;o<t[n].length;o++)if(V(t[n][o],e))return"?"===n?r:n}else if(V(t[n],e))return"?"===n?r:n;return t.hasOwnProperty("*")?t["*"]:e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},K={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,f],[/opios[\/ ]+([\w\.]+)/i],[f,[d,R+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[d,R+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[d,R]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[d,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[f,[d,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[d,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[d,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[d,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[d,"UC"+O]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[d,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[d,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[d,"Smart Lenovo "+O]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure "+O],f],[/\bfocus\/([\w\.]+)/i],[f,[d,P+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[d,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[d,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[d,"MIUI"+B]],[/fxios\/([\w\.-]+)/i],[f,[d,P]],[/\bqihoobrowser\/?([\w\.]*)/i],[f,[d,"360"]],[/\b(qq)\/([\w\.]+)/i],[[d,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1"+B],f],[/samsungbrowser\/([\w\.]+)/i],[f,[d,A+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[f,[d,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[d,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[d,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[d],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[f,d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,j],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[d,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[d,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[d,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[d,C+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,C+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[d,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[d,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[f,q,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[d,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],f],[/(wolvic|librewolf)\/([\w\.]+)/i],[d,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[d,P+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[d,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[d,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,U]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,"",U]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,U]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[p,A],[u,v]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[c,[p,A],[u,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[c,[p,x],[u,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[p,x],[u,v]],[/(macintosh);/i],[c,[p,x]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[p,z],[u,g]],[/(?:honor)([-\w ]+)[;\)]/i],[c,[p,"Honor"],[u,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[p,k],[u,v]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[p,k],[u,g]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[c,/_/g," "],[p,L],[u,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[p,L],[u,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[p,"OPPO"],[u,g]],[/\b(opd2\d{3}a?) bui/i],[c,[p,"OPPO"],[u,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[p,"Vivo"],[u,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[c,[p,"Realme"],[u,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[p,D],[u,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[p,D],[u,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[p,M],[u,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[p,M],[u,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[p,"Lenovo"],[u,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[p,"Nokia"],[u,g]],[/(pixel c)\b/i],[c,[p,N],[u,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[p,N],[u,g]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[p,_],[u,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[p,_],[u,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[p,"OnePlus"],[u,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[p,E],[u,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[p,E],[u,g]],[/(playbook);[-\w\),; ]+(rim)/i],[c,p,[u,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[p,T],[u,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[p,S],[u,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[p,S],[u,g]],[/(nexus 9)/i],[c,[p,"HTC"],[u,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[c,/_/g," "],[u,g]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[c,[p,"TCL"],[u,v]],[/(itel) ((\w+))/i],[[p,U],c,[u,q,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[p,"Acer"],[u,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[p,"Meizu"],[u,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[c,[p,"Ulefone"],[u,g]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[c,[p,"Energizer"],[u,g]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[c,[p,"Cat"],[u,g]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[c,[p,"Smartfren"],[u,g]],[/droid.+; (a(?:015|06[35]|142p?))/i],[c,[p,"Nothing"],[u,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,c,[u,g]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,c,[u,v]],[/(surface duo)/i],[c,[p,I],[u,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[p,"Fairphone"],[u,g]],[/(u304aa)/i],[c,[p,"AT&T"],[u,g]],[/\bsie-(\w*)/i],[c,[p,"Siemens"],[u,g]],[/\b(rct\w+) b/i],[c,[p,"RCA"],[u,v]],[/\b(venue[\d ]{2,7}) b/i],[c,[p,"Dell"],[u,v]],[/\b(q(?:mv|ta)\w+) b/i],[c,[p,"Verizon"],[u,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[p,"Barnes & Noble"],[u,v]],[/\b(tm\d{3}\w+) b/i],[c,[p,"NuVision"],[u,v]],[/\b(k88) b/i],[c,[p,"ZTE"],[u,v]],[/\b(nx\d{3}j) b/i],[c,[p,"ZTE"],[u,g]],[/\b(gen\d{3}) b.+49h/i],[c,[p,"Swiss"],[u,g]],[/\b(zur\d{3}) b/i],[c,[p,"Swiss"],[u,v]],[/\b((zeki)?tb.*\b) b/i],[c,[p,"Zeki"],[u,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],c,[u,v]],[/\b(ns-?\w{0,9}) b/i],[c,[p,"Insignia"],[u,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[p,"NextBook"],[u,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],c,[u,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],c,[u,g]],[/\b(ph-1) /i],[c,[p,"Essential"],[u,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[p,"Envizen"],[u,v]],[/\b(trio[-\w\. ]+) b/i],[c,[p,"MachSpeed"],[u,v]],[/\btu_(1491) b/i],[c,[p,"Rotor"],[u,v]],[/(shield[\w ]+) b/i],[c,[p,"Nvidia"],[u,v]],[/(sprint) (\w+)/i],[p,c,[u,g]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[p,I],[u,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[p,$],[u,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[p,$],[u,g]],[/smart-tv.+(samsung)/i],[p,[u,b]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[p,A],[u,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,M],[u,b]],[/(apple) ?tv/i],[p,[c,x+" TV"],[u,b]],[/crkey/i],[[c,C+"cast"],[p,N],[u,b]],[/droid.+aft(\w+)( bui|\))/i],[c,[p,E],[u,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[p,z],[u,b]],[/(bravia[\w ]+)( bui|\))/i],[c,[p,_],[u,b]],[/(mitv-\w{5}) bui/i],[c,[p,L],[u,b]],[/Hbbtv.*(technisat) (.*);/i],[p,c,[u,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,Y],[c,Y],[u,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[u,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,c,[u,h]],[/droid.+; (shield) bui/i],[c,[p,"Nvidia"],[u,h]],[/(playstation [345portablevi]+)/i],[c,[p,_],[u,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[p,I],[u,h]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[c,[p,A],[u,y]],[/((pebble))app/i],[p,c,[u,y]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[c,[p,x],[u,y]],[/droid.+; (glass) \d/i],[c,[p,N],[u,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[p,$],[u,y]],[/droid.+; (glass) \d/i],[c,[p,N],[u,y]],[/(pico) (4|neo3(?: link|pro)?)/i],[p,c,[u,y]],[/; (quest( \d| pro)?)/i],[c,[p,j],[u,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[u,w]],[/(aeobc)\b/i],[c,[p,E],[u,w]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[c,[u,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[u,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[u,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[u,g]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[d,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[d,f],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[d,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[d,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[d,[f,q,X]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,q,X],[d,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,W],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,d],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[d,f],[/\(bb(10);/i],[f,[d,T]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[d,P+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[d,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[d,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[d,C+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[d,F],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[d,f],[/(sunos) ?([\w\.\d]*)/i],[[d,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[d,f]]},Z=function(e,t){if(typeof e===a&&(t=e,e=r),!(this instanceof Z))return new Z(e,t).getResult();var h=typeof n!==i&&n.navigator?n.navigator:r,b=e||(h&&h.userAgent?h.userAgent:""),y=h&&h.userAgentData?h.userAgentData:r,w=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(K,t):K,E=h&&h.userAgent==b;return this.getBrowser=function(){var e,t={};return t[d]=r,t[f]=r,G.call(t,b,w.browser),t[l]=typeof(e=t[f])===s?e.replace(/[^\d\.]/g,"").split(".")[0]:r,E&&h&&h.brave&&typeof h.brave.isBrave==o&&(t[d]="Brave"),t},this.getCPU=function(){var e={};return e[m]=r,G.call(e,b,w.cpu),e},this.getDevice=function(){var e={};return e[p]=r,e[c]=r,e[u]=r,G.call(e,b,w.device),E&&!e[u]&&y&&y.mobile&&(e[u]=g),E&&"Macintosh"==e[c]&&h&&typeof h.standalone!==i&&h.maxTouchPoints&&h.maxTouchPoints>2&&(e[c]="iPad",e[u]=v),e},this.getEngine=function(){var e={};return e[d]=r,e[f]=r,G.call(e,b,w.engine),e},this.getOS=function(){var e={};return e[d]=r,e[f]=r,G.call(e,b,w.os),E&&!e[d]&&y&&y.platform&&"Unknown"!=y.platform&&(e[d]=y.platform.replace(/chrome os/i,F).replace(/macos/i,W)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return b},this.setUA=function(e){return b=typeof e===s&&e.length>500?Y(e,500):e,this},this.setUA(b),this};Z.VERSION="1.0.40",Z.BROWSER=H([d,f,l]),Z.CPU=H([m]),Z.DEVICE=H([c,p,u,h,g,b,v,y,w]),Z.ENGINE=Z.OS=H([d,f]),e.exports&&(t=e.exports=Z),t.UAParser=Z;var J=typeof n!==i&&(n.jQuery||n.Zepto);if(J&&!J.ua){var Q=new Z;J.ua=Q.getResult(),J.ua.get=function(){return Q.getUA()},J.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var n in t)J.ua[n]=t[n]}}}("object"==typeof window?window:pa)),ua.exports;var e,t}var ma=function(){if(ca)return da;ca=1,Object.defineProperty(da,"__esModule",{value:!0});var e,n=t,r=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,o=fa(),i=new o,a=i.getBrowser(),s=i.getCPU(),l=i.getDevice(),c=i.getEngine(),d=i.getOS(),u=i.getUA(),p=function(e){return i.setUA(e)},f=function(e){if(e){var t=new o(e);return{UA:t,browser:t.getBrowser(),cpu:t.getCPU(),device:t.getDevice(),engine:t.getEngine(),os:t.getOS(),ua:t.getUA(),setUserAgent:function(e){return t.setUA(e)}}}console.error("No userAgent string was provided")},m=Object.freeze({ClientUAInstance:i,browser:a,cpu:s,device:l,engine:c,os:d,ua:u,setUa:p,parseUserAgent:f});function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(){return y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y.apply(this,arguments)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function E(e,t){return E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},E(e,t)}function x(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function S(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var C="mobile",P="tablet",N="smarttv",k="console",M="wearable",I="embedded",D=void 0,R={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},A={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},z={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},_=function(e){return e||(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none")},L=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},$=function(e){var t=L();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)},j=function(e,t,n,r){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e,{vendor:_(t.vendor),model:_(t.model),os:_(n.name),osVersion:_(n.version),ua:_(r)})},F=function(e){return e.type===C},W=function(e){return e.type===P},B=function(e){var t=e.type;return t===C||t===P},H=function(e){return e.type===N},V=function(e){return e.type===D},U=function(e){return e.type===M},Y=function(e){return e.type===k},G=function(e){return e.type===I},q=function(e){var t=e.vendor;return _(t)},X=function(e){var t=e.model;return _(t)},K=function(e){var t=e.type;return _(t,"browser")},Z=function(e){return e.name===A.Android},J=function(e){return e.name===A.Windows},Q=function(e){return e.name===A.MAC_OS},ee=function(e){return e.name===A.WindowsPhone},te=function(e){return e.name===A.IOS},ne=function(e){var t=e.version;return _(t)},re=function(e){var t=e.name;return _(t)},oe=function(e){return e.name===R.Chrome},ie=function(e){return e.name===R.Firefox},ae=function(e){return e.name===R.Chromium},se=function(e){return e.name===R.Edge},le=function(e){return e.name===R.Yandex},ce=function(e){var t=e.name;return t===R.Safari||t===R.MobileSafari},de=function(e){return e.name===R.MobileSafari},ue=function(e){return e.name===R.Opera},pe=function(e){var t=e.name;return t===R.InternetExplorer||t===R.Ie},fe=function(e){return e.name===R.MIUI},me=function(e){return e.name===R.SamsungBrowser},he=function(e){var t=e.version;return _(t)},ge=function(e){var t=e.major;return _(t)},ve=function(e){var t=e.name;return _(t)},be=function(e){var t=e.name;return _(t)},ye=function(e){var t=e.version;return _(t)},we=function(){var e=L(),t=e&&e.userAgent&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)},Ee=function(e){return"string"==typeof e&&-1!==e.indexOf("Edg/")},xe=function(){var e=L();return e&&(/iPad|iPhone|iPod/.test(e.platform)||"MacIntel"===e.platform&&e.maxTouchPoints>1)&&!window.MSStream},Se=function(){return $("iPad")},Te=function(){return $("iPhone")},Oe=function(){return $("iPod")},Ce=function(e){return _(e)};function Pe(e){var t=e||m,n=t.device,r=t.browser,o=t.os,i=t.engine,a=t.ua;return{isSmartTV:H(n),isConsole:Y(n),isWearable:U(n),isEmbedded:G(n),isMobileSafari:de(r)||Se(),isChromium:ae(r),isMobile:B(n)||Se(),isMobileOnly:F(n),isTablet:W(n)||Se(),isBrowser:V(n),isDesktop:V(n),isAndroid:Z(o),isWinPhone:ee(o),isIOS:te(o)||Se(),isChrome:oe(r),isFirefox:ie(r),isSafari:ce(r),isOpera:ue(r),isIE:pe(r),osVersion:ne(o),osName:re(o),fullBrowserVersion:he(r),browserVersion:ge(r),browserName:ve(r),mobileVendor:q(n),mobileModel:X(n),engineName:be(i),engineVersion:ye(i),getUA:Ce(a),isEdge:se(r)||Ee(a),isYandex:le(r),deviceType:K(n),isIOS13:xe(),isIPad13:Se(),isIPhone13:Te(),isIPod13:Oe(),isElectron:we(),isEdgeChromium:Ee(a),isLegacyEdge:se(r)&&!Ee(a),isWindows:J(o),isMacOs:Q(o),isMIUI:fe(r),isSamsungBrowser:me(r)}}var Ne=H(l),ke=Y(l),Me=U(l),Ie=G(l),De=de(a)||Se(),Re=ae(a),Ae=B(l)||Se(),ze=F(l),_e=W(l)||Se(),Le=V(l),$e=V(l),je=Z(d),Fe=ee(d),We=te(d)||Se(),Be=oe(a),He=ie(a),Ve=ce(a),Ue=ue(a),Ye=pe(a),Ge=ne(d),qe=re(d),Xe=he(a),Ke=ge(a),Ze=ve(a),Je=q(l),Qe=X(l),et=be(c),tt=ye(c),nt=Ce(u),rt=se(a)||Ee(u),ot=le(a),it=K(l),at=xe(),st=Se(),lt=Te(),ct=Oe(),dt=we(),ut=Ee(u),pt=se(a)&&!Ee(u),ft=J(d),mt=Q(d),ht=fe(a),gt=me(a);function vt(e){var t=e||window.navigator.userAgent;return f(t)}return da.AndroidView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return je?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.BrowserTypes=R,da.BrowserView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return Le?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.ConsoleView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return ke?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.CustomView=function(e){var t=e.renderWithFragment,o=e.children;e.viewClassName,e.style;var i=e.condition,a=x(e,["renderWithFragment","children","viewClassName","style","condition"]);return i?t?r.createElement(n.Fragment,null,o):r.createElement("div",a,o):null},da.IEView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return Ye?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.IOSView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return We?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.MobileOnlyView=function(e){var t=e.renderWithFragment,o=e.children;e.viewClassName,e.style;var i=x(e,["renderWithFragment","children","viewClassName","style"]);return ze?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.MobileView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return Ae?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.OsTypes=A,da.SmartTVView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return Ne?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.TabletView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return _e?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.WearableView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return Me?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.WinPhoneView=function(e){var t=e.renderWithFragment,o=e.children,i=x(e,["renderWithFragment","children"]);return Fe?t?r.createElement(n.Fragment,null,o):r.createElement("div",i,o):null},da.browserName=Ze,da.browserVersion=Ke,da.deviceDetect=function(e){var t=e?f(e):m,n=t.device,r=t.browser,o=t.engine,i=t.os,a=t.ua,s=function(e){switch(e){case C:return{isMobile:!0};case P:return{isTablet:!0};case N:return{isSmartTV:!0};case k:return{isConsole:!0};case M:return{isWearable:!0};case D:return{isBrowser:!0};case I:return{isEmbedded:!0};default:return z}}(n.type),l=s.isBrowser,c=s.isMobile,d=s.isTablet,u=s.isSmartTV,p=s.isConsole,h=s.isWearable,g=s.isEmbedded;return l?function(e,t,n,r,o){return{isBrowser:e,browserMajorVersion:_(t.major),browserFullVersion:_(t.version),browserName:_(t.name),engineName:_(n.name),engineVersion:_(n.version),osName:_(r.name),osVersion:_(r.version),userAgent:_(o)}}(l,r,o,i,a):u?function(e,t,n,r){return{isSmartTV:e,engineName:_(t.name),engineVersion:_(t.version),osName:_(n.name),osVersion:_(n.version),userAgent:_(r)}}(u,o,i,a):p?function(e,t,n,r){return{isConsole:e,engineName:_(t.name),engineVersion:_(t.version),osName:_(n.name),osVersion:_(n.version),userAgent:_(r)}}(p,o,i,a):c||d?j(s,n,i,a):h?function(e,t,n,r){return{isWearable:e,engineName:_(t.name),engineVersion:_(t.version),osName:_(n.name),osVersion:_(n.version),userAgent:_(r)}}(h,o,i,a):g?function(e,t,n,r,o){return{isEmbedded:e,vendor:_(t.vendor),model:_(t.model),engineName:_(n.name),engineVersion:_(n.version),osName:_(r.name),osVersion:_(r.version),userAgent:_(o)}}(g,n,o,i,a):void 0},da.deviceType=it,da.engineName=et,da.engineVersion=tt,da.fullBrowserVersion=Xe,da.getSelectorsByUserAgent=function(e){if(e&&"string"==typeof e){var t=f(e);return Pe({device:t.device,browser:t.browser,os:t.os,engine:t.engine,ua:t.ua})}console.error("No valid user agent string was provided")},da.getUA=nt,da.isAndroid=je,da.isBrowser=Le,da.isChrome=Be,da.isChromium=Re,da.isConsole=ke,da.isDesktop=$e,da.isEdge=rt,da.isEdgeChromium=ut,da.isElectron=dt,da.isEmbedded=Ie,da.isFirefox=He,da.isIE=Ye,da.isIOS=We,da.isIOS13=at,da.isIPad13=st,da.isIPhone13=lt,da.isIPod13=ct,da.isLegacyEdge=pt,da.isMIUI=ht,da.isMacOs=mt,da.isMobile=Ae,da.isMobileOnly=ze,da.isMobileSafari=De,da.isOpera=Ue,da.isSafari=Ve,da.isSamsungBrowser=gt,da.isSmartTV=Ne,da.isTablet=_e,da.isWearable=Me,da.isWinPhone=Fe,da.isWindows=ft,da.isYandex=ot,da.mobileModel=Qe,da.mobileVendor=Je,da.osName=qe,da.osVersion=Ge,da.parseUserAgent=f,da.setUserAgent=function(e){return p(e)},da.useDeviceData=vt,da.useDeviceSelectors=function(e){var t=vt(e||window.navigator.userAgent);return[Pe(t),t]},da.useMobileOrientation=function(){var e=T(n.useState(function(){var e=window.innerWidth>window.innerHeight?90:0;return{isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"}}),2),t=e[0],r=e[1],o=n.useCallback(function(){var e=window.innerWidth>window.innerHeight?90:0,n={isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"};t.orientation!==n.orientation&&r(n)},[t.orientation]);return n.useEffect(function(){return void 0!==("undefined"==typeof window?"undefined":g(window))&&Ae&&(o(),window.addEventListener("load",o,!1),window.addEventListener("resize",o,!1)),function(){window.removeEventListener("resize",o,!1),window.removeEventListener("load",o,!1)}},[o]),t},da.withOrientationChange=function(e){return function(t){function n(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(t=function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return S(e)}(this,w(n).call(this,e))).isEventListenerAdded=!1,t.handleOrientationChange=t.handleOrientationChange.bind(S(t)),t.onOrientationChange=t.onOrientationChange.bind(S(t)),t.onPageLoad=t.onPageLoad.bind(S(t)),t.state={isLandscape:!1,isPortrait:!1},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&E(e,t)}(n,t),v(n,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var e=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:0===e,isLandscape:90===e})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){void 0!==("undefined"==typeof window?"undefined":g(window))&&Ae&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return r.createElement(e,y({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}]),n}(r.Component)},da}();function ha({message:e,duration:n=3e3,visible:o,setVisible:i}){return r(()=>{const e=setTimeout(()=>i(!1),n);return()=>clearTimeout(e)},[o]),o?t.createElement("div",{style:{position:"fixed",top:"1rem",left:"50%",transform:"translateX(-50%)",background:"rgba(0,0,0,0.8)",color:"#fff",padding:"0.75rem 1.25rem",borderRadius:"0.375rem",fontSize:"14px",zIndex:9999,boxShadow:"0 2px 10px rgba(0,0,0,0.2)"}},e):null}const ga=({shortForm:e,shareUrl:n})=>{const r=null!=n?n:window.location.href,[o,i]=a(!1);return t.createElement(t.Fragment,null,t.createElement("button",{onClick:()=>T(void 0,void 0,void 0,function*(){try{i(!0),ma.isMobile&&navigator.share&&e?yield navigator.share({title:e.title,url:r}):(e=>{if(void 0!==navigator.clipboard)navigator.clipboard.writeText(e).then(()=>{});else{const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999);try{document.execCommand("copy")}catch(e){console.error("복사 실패",e)}t.setSelectionRange(0,0),document.body.removeChild(t)}})(r)}catch(e){console.error("Fail to copy on clipboard")}}),className:"cursor-pointer"},t.createElement(Gt,{size:22}),t.createElement(ha,{message:"공유 링크 복사 완료",setVisible:i,visible:o})))},va=({product:e,hideMoreBtn:n,contentId:r})=>{const{isPreview:o,priceText:i}=Qi(),[s,l]=a(!1);return t.createElement("div",{style:{height:"80px"},className:"flex gap-2 items-center w-full",onClick:()=>T(void 0,void 0,void 0,function*(){n&&(window.open(e.linkPath,"_blank"),o||(yield Wi({contentProductId:e.eventProductId,contentId:r,productId:e.productId})))})},e.thumbPath&&!s?t.createElement(Qt,{product:e,onError:()=>l(!0)}):t.createElement(Jt,null),t.createElement("div",{className:"flex flex-col text-left p-2 w-full justify-center"},e.brand&&t.createElement("span",{className:"break-keep line-clamp-1 text-gray-500",style:{fontSize:"10px"}},e.brand.brandName),t.createElement("div",{className:"text-gray-800 text-ellipsis line-clamp-1 ",style:{fontSize:"12px"}},e.productName),t.createElement("div",{className:"text-red-500 break-keep",style:{fontSize:"12px"}},i?i+" ":"할인가 ",t.createElement("span",{className:"font-semibold break-keep"},Tt(e.sellingPrice),"원"))))};function ba(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function ya(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function wa(...e){return t=>{let n=!1;const r=e.map(e=>{const r=ya(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():ya(e[t],null)}}}}function Ea(...t){return e.useCallback(wa(...t),t)}function xa(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const o=r.reduce((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]}),{});return e.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return r.scopeName=n.scopeName,r}var Sa=globalThis?.document?e.useLayoutEffect:()=>{},Ta=e[" useId ".trim().toString()]||(()=>{}),Oa=0;function Ca(t){const[n,r]=e.useState(Ta());return Sa(()=>{t||r(e=>e??String(Oa++))},[t]),t||(n?`radix-${n}`:"")}var Pa=e[" useInsertionEffect ".trim().toString()]||Sa;function Na({prop:t,defaultProp:n,onChange:r=()=>{},caller:o}){const[i,a,s]=function({defaultProp:t,onChange:n}){const[r,o]=e.useState(t),i=e.useRef(r),a=e.useRef(n);return Pa(()=>{a.current=n},[n]),e.useEffect(()=>{i.current!==r&&(a.current?.(r),i.current=r)},[r,i]),[r,o,a]}({defaultProp:n,onChange:r}),l=void 0!==t,c=l?t:i;{const n=e.useRef(void 0!==t);e.useEffect(()=>{const e=n.current;if(e!==l){const t=e?"controlled":"uncontrolled",n=l?"controlled":"uncontrolled";console.warn(`${o} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}n.current=l},[l,o])}const d=e.useCallback(e=>{if(l){const n=function(e){return"function"==typeof e}(e)?e(t):e;n!==t&&s.current?.(n)}else a(e)},[l,t,a,s]);return[c,d]}function ka(t){const n=Ma(t),r=e.forwardRef((t,r)=>{const{children:o,...i}=t,a=e.Children.toArray(o),s=a.find(Da);if(s){const t=s.props.children,o=a.map(n=>n===s?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return m(n,{...i,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,o):null})}return m(n,{...i,ref:r,children:o})});return r.displayName=`${t}.Slot`,r}function Ma(t){const n=e.forwardRef((t,n)=>{const{children:r,...o}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),i=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{const t=i(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==e.Fragment&&(i.ref=n?wa(n,t):t),e.cloneElement(r,i)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Ia=Symbol("radix.slottable");function Da(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===Ia}var Ra=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=ka(`Primitive.${n}`),o=e.forwardRef((e,t)=>{const{asChild:o,...i}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),m(a,{...i,ref:t})});return o.displayName=`Primitive.${n}`,{...t,[n]:o}},{});function Aa(t){const n=e.useRef(t);return e.useEffect(()=>{n.current=t}),e.useMemo(()=>(...e)=>n.current?.(...e),[])}function za(t,n=globalThis?.document){const r=Aa(t);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return n.addEventListener("keydown",e,{capture:!0}),()=>n.removeEventListener("keydown",e,{capture:!0})},[r,n])}var _a,La="dismissableLayer.update",$a="dismissableLayer.pointerDownOutside",ja="dismissableLayer.focusOutside",Fa=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wa=e.forwardRef((t,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...c}=t,d=e.useContext(Fa),[u,p]=e.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=e.useState({}),g=Ea(n,e=>p(e)),v=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=u?v.indexOf(u):-1,E=d.layersWithOutsidePointerEventsDisabled.size>0,x=w>=y,S=function(t,n=globalThis?.document){const r=Aa(t),o=e.useRef(!1),i=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!o.current){let t=function(){Ha($a,r,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",i.current),i.current=t,n.addEventListener("click",i.current,{once:!0})):t()}else n.removeEventListener("click",i.current);o.current=!1},t=window.setTimeout(()=>{n.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",i.current)}},[n,r]),{onPointerDownCapture:()=>o.current=!0}}(e=>{const t=e.target,n=[...d.branches].some(e=>e.contains(t));x&&!n&&(i?.(e),s?.(e),e.defaultPrevented||l?.())},f),T=function(t,n=globalThis?.document){const r=Aa(t),o=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!o.current){Ha(ja,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}(e=>{const t=e.target;[...d.branches].some(e=>e.contains(t))||(a?.(e),s?.(e),e.defaultPrevented||l?.())},f);return za(e=>{w===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},f),e.useEffect(()=>{if(u)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(_a=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),Ba(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=_a)}},[u,f,r,d]),e.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),Ba())},[u,d]),e.useEffect(()=>{const e=()=>h({});return document.addEventListener(La,e),()=>document.removeEventListener(La,e)},[]),m(Ra.div,{...c,ref:g,style:{pointerEvents:E?x?"auto":"none":void 0,...t.style},onFocusCapture:ba(t.onFocusCapture,T.onFocusCapture),onBlurCapture:ba(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:ba(t.onPointerDownCapture,S.onPointerDownCapture)})});Wa.displayName="DismissableLayer";function Ba(){const e=new CustomEvent(La);document.dispatchEvent(e)}function Ha(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}(o,i):o.dispatchEvent(i)}e.forwardRef((t,n)=>{const r=e.useContext(Fa),o=e.useRef(null),i=Ea(n,o);return e.useEffect(()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),m(Ra.div,{...t,ref:i})}).displayName="DismissableLayerBranch";var Va="focusScope.autoFocusOnMount",Ua="focusScope.autoFocusOnUnmount",Ya={bubbles:!1,cancelable:!0},Ga=e.forwardRef((t,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...s}=t,[l,c]=e.useState(null),d=Aa(i),u=Aa(a),p=e.useRef(null),f=Ea(n,e=>c(e)),h=e.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;e.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:Za(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Za(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Za(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[o,l,h.paused]),e.useEffect(()=>{if(l){Ja.add(h);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(Va,Ya);l.addEventListener(Va,d),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Za(r,{select:t}),document.activeElement!==n)return}((e=qa(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Za(l))}return()=>{l.removeEventListener(Va,d),setTimeout(()=>{const e=new CustomEvent(Ua,Ya);l.addEventListener(Ua,u),l.dispatchEvent(e),e.defaultPrevented||Za(t??document.body,{select:!0}),l.removeEventListener(Ua,u),Ja.remove(h)},0)}}var e},[l,d,u,h]);const g=e.useCallback(e=>{if(!r&&!o)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[o,i]=function(e){const t=qa(e),n=Xa(t,e),r=Xa(t.reverse(),e);return[n,r]}(t);o&&i?e.shiftKey||n!==i?e.shiftKey&&n===o&&(e.preventDefault(),r&&Za(i,{select:!0})):(e.preventDefault(),r&&Za(o,{select:!0})):n===t&&e.preventDefault()}},[r,o,h.paused]);return m(Ra.div,{tabIndex:-1,...s,ref:f,onKeyDown:g})});function qa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Xa(e,t){for(const n of e)if(!Ka(n,{upTo:t}))return n}function Ka(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Za(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Ga.displayName="FocusScope";var Ja=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Qa(e,t),e.unshift(t)},remove(t){e=Qa(e,t),e[0]?.resume()}}}();function Qa(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var es=e.forwardRef((t,n)=>{const{container:r,...o}=t,[i,a]=e.useState(!1);Sa(()=>a(!0),[]);const s=r||i&&globalThis?.document?.body;return s?b.createPortal(m(Ra.div,{...o,ref:n}),s):null});es.displayName="Portal";var ts=t=>{const{present:n,children:r}=t,o=function(t){const[n,r]=e.useState(),o=e.useRef(null),i=e.useRef(t),a=e.useRef("none"),s=t?"mounted":"unmounted",[l,c]=function(t,n){return e.useReducer((e,t)=>n[e][t]??e,t)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=ns(o.current);a.current="mounted"===l?e:"none"},[l]),Sa(()=>{const e=o.current,n=i.current;if(n!==t){const r=a.current,o=ns(e);if(t)c("MOUNT");else if("none"===o||"none"===e?.display)c("UNMOUNT");else{c(n&&r!==o?"ANIMATION_OUT":"UNMOUNT")}i.current=t}},[t,c]),Sa(()=>{if(n){let e;const t=n.ownerDocument.defaultView??window,r=r=>{const a=ns(o.current).includes(r.animationName);if(r.target===n&&a&&(c("ANIMATION_END"),!i.current)){const r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},s=e=>{e.target===n&&(a.current=ns(o.current))};return n.addEventListener("animationstart",s),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",s),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{o.current=e?getComputedStyle(e):null,r(e)},[])}}(n),i="function"==typeof r?r({present:o.isPresent}):e.Children.only(r),a=Ea(o.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof r||o.isPresent?e.cloneElement(i,{ref:a}):null};function ns(e){return e?.animationName||"none"}ts.displayName="Presence";var rs=0;function os(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var is="right-scroll-bar-position",as="width-before-scroll-bar";function ss(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var ls="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,cs=new WeakMap;function ds(e,t){var n,r,o,i=(n=null,r=function(t){return e.forEach(function(e){return ss(e,t)})},(o=a(function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=r,o.facade);return ls(function(){var t=cs.get(i);if(t){var n=new Set(t),r=new Set(e),o=i.current;n.forEach(function(e){r.has(e)||ss(e,null)}),r.forEach(function(e){n.has(e)||ss(e,o)})}cs.set(i,e)},[e]),i}function us(e){return e}var ps=function(t){var n=t.sideCar,r=S(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=n.read();if(!o)throw new Error("Sidecar medium not found");return e.createElement(o,x({},r))};ps.isSideCarExport=!0;var fs=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=us);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter(function(e){return e!==o})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var i=function(){var n=t;t=[],n.forEach(e)},a=function(){return Promise.resolve().then(i)};a(),n={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),n}}}};return o}(null);return t.options=x({async:!0,ssr:!1},e),t}(),ms=function(){},hs=e.forwardRef(function(t,n){var r=e.useRef(null),o=e.useState({onScrollCapture:ms,onWheelCapture:ms,onTouchMoveCapture:ms}),i=o[0],a=o[1],s=t.forwardProps,l=t.children,c=t.className,d=t.removeScrollBar,u=t.enabled,p=t.shards,f=t.sideCar,m=t.noRelative,h=t.noIsolation,g=t.inert,v=t.allowPinchZoom,b=t.as,y=void 0===b?"div":b,w=t.gapMode,E=S(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=f,O=ds([r,n]),C=x(x({},E),i);return e.createElement(e.Fragment,null,u&&e.createElement(T,{sideCar:fs,removeScrollBar:d,shards:p,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!v,lockRef:r,gapMode:w}),s?e.cloneElement(e.Children.only(l),x(x({},C),{ref:O})):e.createElement(y,x({},C,{className:c,ref:O}),l))});hs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},hs.classNames={fullWidth:as,zeroRight:is};function gs(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var vs=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=gs())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},bs=function(){var t,n=(t=vs(),function(n,r){e.useEffect(function(){return t.add(n),function(){t.remove()}},[n&&r])});return function(e){var t=e.styles,r=e.dynamic;return n(t,r),null}},ys={left:0,top:0,right:0,gap:0},ws=function(e){return parseInt(e||"",10)||0},Es=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return ys;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[ws(n),ws(r),ws(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},xs=bs(),Ss="data-scroll-locked",Ts=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body[").concat(Ss,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(i,"px;\n padding-right: ").concat(a,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(is," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(as," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(is," .").concat(is," {\n right: 0 ").concat(r,";\n }\n \n .").concat(as," .").concat(as," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(Ss,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},Os=function(){var e=parseInt(document.body.getAttribute(Ss)||"0",10);return isFinite(e)?e:0},Cs=function(t){var n=t.noRelative,r=t.noImportant,o=t.gapMode,i=void 0===o?"margin":o;e.useEffect(function(){return document.body.setAttribute(Ss,(Os()+1).toString()),function(){var e=Os()-1;e<=0?document.body.removeAttribute(Ss):document.body.setAttribute(Ss,e.toString())}},[]);var a=e.useMemo(function(){return Es(i)},[i]);return e.createElement(xs,{styles:Ts(a,!n,i,r?"":"!important")})},Ps=!1;if("undefined"!=typeof window)try{var Ns=Object.defineProperty({},"passive",{get:function(){return Ps=!0,!0}});window.addEventListener("test",Ns,Ns),window.removeEventListener("test",Ns,Ns)}catch(e){Ps=!1}var ks=!!Ps&&{passive:!1},Ms=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},Is=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),Ds(e,r)){var o=Rs(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ds=function(e,t){return"v"===e?function(e){return Ms(e,"overflowY")}(t):function(e){return Ms(e,"overflowX")}(t)},Rs=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},As=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},zs=function(e){return[e.deltaX,e.deltaY]},_s=function(e){return e&&"current"in e?e.current:e},Ls=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},$s=0,js=[];function Fs(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Ws,Bs=(Ws=function(t){var n=e.useRef([]),r=e.useRef([0,0]),o=e.useRef(),i=e.useState($s++)[0],a=e.useState(bs)[0],s=e.useRef(t);e.useEffect(function(){s.current=t},[t]),e.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var e=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([t.lockRef.current],(t.shards||[]).map(_s),!0).filter(Boolean);return e.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),e.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var l=e.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,i=As(e),a=r.current,l="deltaX"in e?e.deltaX:a[0]-i[0],c="deltaY"in e?e.deltaY:a[1]-i[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var p=Is(u,d);if(!p)return!0;if(p?n=u:(n="v"===u?"h":"v",p=Is(u,d)),!p)return!1;if(!o.current&&"changedTouches"in e&&(l||c)&&(o.current=n),!n)return!0;var f=o.current||n;return function(e,t,n,r,o){var i=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=i*r,s=n.target,l=t.contains(s),c=!1,d=a>0,u=0,p=0;do{if(!s)break;var f=Rs(e,s),m=f[0],h=f[1]-f[2]-i*m;(m||h)&&Ds(e,s)&&(u+=h,p+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return d&&(Math.abs(u)<1||!o)?c=!0:d||!(Math.abs(p)<1)&&o||(c=!0),c}(f,t,e,"h"===f?l:c,!0)},[]),c=e.useCallback(function(e){var t=e;if(js.length&&js[js.length-1]===a){var r="deltaY"in t?zs(t):As(t),o=n.current.filter(function(e){return e.name===t.type&&(e.target===t.target||t.target===e.shadowParent)&&function(e,t){return e[0]===t[0]&&e[1]===t[1]}(e.delta,r)})[0];if(o&&o.should)t.cancelable&&t.preventDefault();else if(!o){var i=(s.current.shards||[]).map(_s).filter(Boolean).filter(function(e){return e.contains(t.target)});(i.length>0?l(t,i[0]):!s.current.noIsolation)&&t.cancelable&&t.preventDefault()}}},[]),d=e.useCallback(function(e,t,r,o){var i={name:e,delta:t,target:r,should:o,shadowParent:Fs(r)};n.current.push(i),setTimeout(function(){n.current=n.current.filter(function(e){return e!==i})},1)},[]),u=e.useCallback(function(e){r.current=As(e),o.current=void 0},[]),p=e.useCallback(function(e){d(e.type,zs(e),e.target,l(e,t.lockRef.current))},[]),f=e.useCallback(function(e){d(e.type,As(e),e.target,l(e,t.lockRef.current))},[]);e.useEffect(function(){return js.push(a),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",c,ks),document.addEventListener("touchmove",c,ks),document.addEventListener("touchstart",u,ks),function(){js=js.filter(function(e){return e!==a}),document.removeEventListener("wheel",c,ks),document.removeEventListener("touchmove",c,ks),document.removeEventListener("touchstart",u,ks)}},[]);var m=t.removeScrollBar,h=t.inert;return e.createElement(e.Fragment,null,h?e.createElement(a,{styles:Ls(i)}):null,m?e.createElement(Cs,{noRelative:t.noRelative,gapMode:t.gapMode}):null)},fs.useMedium(Ws),ps),Hs=e.forwardRef(function(t,n){return e.createElement(hs,x({},t,{ref:n,sideCar:Bs}))});Hs.classNames=hs.classNames;var Vs=new WeakMap,Us=new WeakMap,Ys={},Gs=0,qs=function(e){return e&&(e.host||qs(e.parentNode))},Xs=function(e,t,n,r){var o=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=qs(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);Ys[n]||(Ys[n]=new WeakMap);var i=Ys[n],a=[],s=new Set,l=new Set(o),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};o.forEach(c);var d=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,l=(Vs.get(e)||0)+1,c=(i.get(e)||0)+1;Vs.set(e,l),i.set(e,c),a.push(e),1===l&&o&&Us.set(e,!0),1===c&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),Gs++,function(){a.forEach(function(e){var t=Vs.get(e)-1,o=i.get(e)-1;Vs.set(e,t),i.set(e,o),t||(Us.has(e)||e.removeAttribute(r),Us.delete(e)),o||e.removeAttribute(n)}),--Gs||(Vs=new WeakMap,Vs=new WeakMap,Us=new WeakMap,Ys={})}},Ks=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Xs(r,o,n,"aria-hidden")):function(){return null}},Zs="Dialog",[Js,Qs]=function(t,n=[]){let r=[];const o=()=>{const n=r.map(t=>e.createContext(t));return function(r){const o=r?.[t]||n;return e.useMemo(()=>({[`__scope${t}`]:{...r,[t]:o}}),[r,o])}};return o.scopeName=t,[function(n,o){const i=e.createContext(o),a=r.length;r=[...r,o];const s=n=>{const{scope:r,children:o,...s}=n,l=r?.[t]?.[a]||i,c=e.useMemo(()=>s,Object.values(s));return m(l.Provider,{value:c,children:o})};return s.displayName=n+"Provider",[s,function(r,s){const l=s?.[t]?.[a]||i,c=e.useContext(l);if(c)return c;if(void 0!==o)return o;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},xa(o,...n)]}(Zs),[el,tl]=Js(Zs),nl=t=>{const{__scopeDialog:n,children:r,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,l=e.useRef(null),c=e.useRef(null),[d,u]=Na({prop:o,defaultProp:i??!1,onChange:a,caller:Zs});return m(el,{scope:n,triggerRef:l,contentRef:c,contentId:Ca(),titleId:Ca(),descriptionId:Ca(),open:d,onOpenChange:u,onOpenToggle:e.useCallback(()=>u(e=>!e),[u]),modal:s,children:r})};nl.displayName=Zs;var rl="DialogTrigger",ol=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tl(rl,n),i=Ea(t,o.triggerRef);return m(Ra.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Tl(o.open),...r,ref:i,onClick:ba(e.onClick,o.onOpenToggle)})});ol.displayName=rl;var il="DialogPortal",[al,sl]=Js(il,{forceMount:void 0}),ll=t=>{const{__scopeDialog:n,forceMount:r,children:o,container:i}=t,a=tl(il,n);return m(al,{scope:n,forceMount:r,children:e.Children.map(o,e=>m(ts,{present:r||a.open,children:m(es,{asChild:!0,container:i,children:e})}))})};ll.displayName=il;var cl="DialogOverlay",dl=e.forwardRef((e,t)=>{const n=sl(cl,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=tl(cl,e.__scopeDialog);return i.modal?m(ts,{present:r||i.open,children:m(pl,{...o,ref:t})}):null});dl.displayName=cl;var ul=ka("DialogOverlay.RemoveScroll"),pl=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tl(cl,n);return m(Hs,{as:ul,allowPinchZoom:!0,shards:[o.contentRef],children:m(Ra.div,{"data-state":Tl(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),fl="DialogContent",ml=e.forwardRef((e,t)=>{const n=sl(fl,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=tl(fl,e.__scopeDialog);return m(ts,{present:r||i.open,children:i.modal?m(hl,{...o,ref:t}):m(gl,{...o,ref:t})})});ml.displayName=fl;var hl=e.forwardRef((t,n)=>{const r=tl(fl,t.__scopeDialog),o=e.useRef(null),i=Ea(n,r.contentRef,o);return e.useEffect(()=>{const e=o.current;if(e)return Ks(e)},[]),m(vl,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ba(t.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ba(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:ba(t.onFocusOutside,e=>e.preventDefault())})}),gl=e.forwardRef((t,n)=>{const r=tl(fl,t.__scopeDialog),o=e.useRef(!1),i=e.useRef(!1);return m(vl,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(o.current||r.triggerRef.current?.focus(),e.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(o.current=!0,"pointerdown"===e.detail.originalEvent.type&&(i.current=!0));const n=e.target,a=r.triggerRef.current?.contains(n);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&i.current&&e.preventDefault()}})}),vl=e.forwardRef((t,n)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,...s}=t,l=tl(fl,r),c=e.useRef(null),d=Ea(n,c);return e.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??os()),document.body.insertAdjacentElement("beforeend",e[1]??os()),rs++,()=>{1===rs&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),rs--}},[]),g(h,{children:[m(Ga,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:a,children:m(Wa,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Tl(l.open),...s,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),g(h,{children:[m(Nl,{titleId:l.titleId}),m(kl,{contentRef:c,descriptionId:l.descriptionId})]})]})}),bl="DialogTitle",yl=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tl(bl,n);return m(Ra.h2,{id:o.titleId,...r,ref:t})});yl.displayName=bl;var wl="DialogDescription",El=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tl(wl,n);return m(Ra.p,{id:o.descriptionId,...r,ref:t})});El.displayName=wl;var xl="DialogClose",Sl=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=tl(xl,n);return m(Ra.button,{type:"button",...r,ref:t,onClick:ba(e.onClick,()=>o.onOpenChange(!1))})});function Tl(e){return e?"open":"closed"}Sl.displayName=xl;var Ol="DialogTitleWarning",[Cl,Pl]=function(t,n){const r=e.createContext(n),o=t=>{const{children:n,...o}=t,i=e.useMemo(()=>o,Object.values(o));return m(r.Provider,{value:i,children:n})};return o.displayName=t+"Provider",[o,function(o){const i=e.useContext(r);if(i)return i;if(void 0!==n)return n;throw new Error(`\`${o}\` must be used within \`${t}\``)}]}(Ol,{contentName:fl,titleName:bl,docsSlug:"dialog"}),Nl=({titleId:t})=>{const n=Pl(Ol),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return e.useEffect(()=>{if(t){document.getElementById(t)||console.error(r)}},[r,t]),null},kl=({contentRef:t,descriptionId:n})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Pl("DialogDescriptionWarning").contentName}}.`;return e.useEffect(()=>{const e=t.current?.getAttribute("aria-describedby");if(n&&e){document.getElementById(n)||console.warn(r)}},[r,t,n]),null},Ml=nl,Il=ol,Dl=ll,Rl=dl,Al=ml,zl=yl,_l=El,Ll=Sl;const $l=t.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),jl=()=>{const e=t.useContext($l);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};function Fl(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Wl(){return Hl(/^iPad/)||Hl(/^Mac/)&&navigator.maxTouchPoints>1}function Bl(){return Hl(/^iPhone/)||Wl()}function Hl(e){return"undefined"!=typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if("undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");const Vl="undefined"!=typeof window?s:r;function Ul(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}const Yl="undefined"!=typeof document&&window.visualViewport;function Gl(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function ql(e){for(Gl(e)&&(e=e.parentElement);e&&!Gl(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Xl=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Kl,Zl=0;function Jl(e={}){let{isDisabled:t}=e;Vl(()=>{if(!t)return Zl++,1===Zl&&Bl()&&(Kl=function(){let e,t=0,n=n=>{e=ql(n.target),e===document.documentElement&&e===document.body||(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body)return void n.preventDefault();let r=n.changedTouches[0].pageY,o=e.scrollTop,i=e.scrollHeight-e.clientHeight;0!==i&&((o<=0&&r>t||o>=i&&r<t)&&n.preventDefault(),t=r)},o=e=>{let t=e.target;tc(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},i=e=>{let t=e.target;tc(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",Yl&&(Yl.height<window.innerHeight?requestAnimationFrame(()=>{ec(t)}):Yl.addEventListener("resize",()=>ec(t),{once:!0}))}))},a=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,c=Ul(function(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}(document.documentElement,"paddingRight",window.innerWidth-document.documentElement.clientWidth+"px"));window.scrollTo(0,0);let d=Ul(Ql(document,"touchstart",n,{passive:!1,capture:!0}),Ql(document,"touchmove",r,{passive:!1,capture:!0}),Ql(document,"touchend",o,{passive:!1,capture:!0}),Ql(document,"focus",i,!0),Ql(window,"scroll",a));return()=>{c(),d(),window.scrollTo(s,l)}}()),()=>{Zl--,0===Zl&&(null==Kl||Kl())}},[t])}function Ql(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function ec(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=ql(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=r-n)}e=t.parentElement}}function tc(e){return e instanceof HTMLInputElement&&!Xl.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function nc(...t){return e.useCallback(function(...e){return t=>e.forEach(e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t))}(...t),t)}const rc=new WeakMap;function oc(e,t,n=!1){if(!(e&&e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{t.startsWith("--")?e.style.setProperty(t,n):(r[t]=e.style[t],e.style[t]=n)}),n||rc.set(e,r)}const ic=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function ac(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[ic(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[ic(t)?5:4]):null)}function sc(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}const lc={DURATION:.5,EASE:[.32,.72,0,1]},cc=16,dc="vaul-dragging";function uc(e){const n=t.useRef(e);return t.useEffect(()=>{n.current=e}),t.useMemo(()=>(...e)=>null==n.current?void 0:n.current.call(n,...e),[])}function pc({prop:e,defaultProp:n,onChange:r=()=>{}}){const[o,i]=function({defaultProp:e,onChange:n}){const r=t.useState(e),[o]=r,i=t.useRef(o),a=uc(n);return t.useEffect(()=>{i.current!==o&&(a(o),i.current=o)},[o,i,a]),r}({defaultProp:n,onChange:r}),a=void 0!==e,s=a?e:o,l=uc(r),c=t.useCallback(t=>{if(a){const n="function"==typeof t?t(e):t;n!==e&&l(n)}else i(t)},[a,e,i,l]);return[s,c]}let fc=null;function mc({open:e,onOpenChange:n,children:r,onDrag:o,onRelease:i,snapPoints:a,shouldScaleBackground:s=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=.25,scrollLockTimeout:d=100,dismissible:u=!0,handleOnly:p=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:m,setActiveSnapPoint:h,fixed:g,modal:v=!0,onClose:b,nested:y,noBodyStyles:w=!1,direction:E="bottom",defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:T=!1,preventScrollRestoration:O=!1,repositionInputs:C=!0,onAnimationEnd:P,container:N,autoFocus:k=!1}){var M,I;const[D=!1,R]=pc({defaultProp:x,prop:e,onChange:e=>{null==n||n(e),e||y||de(),setTimeout(()=>{null==P||P(e)},1e3*lc.DURATION),e&&!v&&"undefined"!=typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[A,z]=t.useState(!1),[_,L]=t.useState(!1),[$,j]=t.useState(!1),F=t.useRef(null),W=t.useRef(null),B=t.useRef(null),H=t.useRef(null),V=t.useRef(null),U=t.useRef(!1),Y=t.useRef(null),G=t.useRef(0),q=t.useRef(!1),X=t.useRef(!x),K=t.useRef(0),Z=t.useRef(null),J=t.useRef((null==(M=Z.current)?void 0:M.getBoundingClientRect().height)||0),Q=t.useRef((null==(I=Z.current)?void 0:I.getBoundingClientRect().width)||0),ee=t.useRef(0),te=t.useCallback(e=>{a&&e===ae.length-1&&(W.current=new Date)},[]),{activeSnapPoint:ne,activeSnapPointIndex:re,setActiveSnapPoint:oe,onRelease:ie,snapPointsOffset:ae,onDrag:se,shouldFade:le,getPercentageDragged:ce}=function({activeSnapPointProp:e,setActiveSnapPointProp:n,snapPoints:r,drawerRef:o,overlayRef:i,fadeFromIndex:a,onSnapPointChange:s,direction:l="bottom",container:c,snapToSequentialPoint:d}){const[u,p]=pc({prop:e,defaultProp:null==r?void 0:r[0],onChange:n}),[f,m]=t.useState("undefined"!=typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);t.useEffect(()=>{function e(){m({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const h=t.useMemo(()=>u===(null==r?void 0:r[r.length-1])||null,[r,u]),g=t.useMemo(()=>{var e;return null!=(e=null==r?void 0:r.findIndex(e=>e===u))?e:null},[r,u]),v=r&&r.length>0&&(a||0===a)&&!Number.isNaN(a)&&r[a]===u||!r,b=t.useMemo(()=>{const e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:"undefined"!=typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var t;return null!=(t=null==r?void 0:r.map(t=>{const n="string"==typeof t;let r=0;if(n&&(r=parseInt(t,10)),ic(l)){const o=n?r:f?t*e.height:0;return f?"bottom"===l?e.height-o:-e.height+o:o}const o=n?r:f?t*e.width:0;return f?"right"===l?e.width-o:-e.width+o:o}))?t:[]},[r,f,c]),y=t.useMemo(()=>null!==g?null==b?void 0:b[g]:null,[b,g]),w=t.useCallback(e=>{var t;const n=null!=(t=null==b?void 0:b.findIndex(t=>t===e))?t:null;s(n),oc(o.current,{transition:`transform ${lc.DURATION}s cubic-bezier(${lc.EASE.join(",")})`,transform:ic(l)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),b&&n!==b.length-1&&void 0!==a&&n!==a&&n<a?oc(i.current,{transition:`opacity ${lc.DURATION}s cubic-bezier(${lc.EASE.join(",")})`,opacity:"0"}):oc(i.current,{transition:`opacity ${lc.DURATION}s cubic-bezier(${lc.EASE.join(",")})`,opacity:"1"}),p(null==r?void 0:r[Math.max(n,0)])},[o.current,r,b,a,i,p]);return t.useEffect(()=>{if(u||e){var t;const n=null!=(t=null==r?void 0:r.findIndex(t=>t===e||t===u))?t:-1;b&&-1!==n&&"number"==typeof b[n]&&w(b[n])}},[u,e,r,b,w]),{isLastSnapPoint:h,activeSnapPoint:u,shouldFade:v,getPercentageDragged:function(e,t){if(!r||"number"!=typeof g||!b||void 0===a)return null;const n=g===a-1;if(g>=a&&t)return 0;if(n&&!t)return 1;if(!v&&!n)return null;const o=n?g+1:g-1,i=n?b[o]-b[o-1]:b[o+1]-b[o],s=e/Math.abs(i);return n?1-s:s},setActiveSnapPoint:p,activeSnapPointIndex:g,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:n,dismissible:o}){if(void 0===a)return;const s="bottom"===l||"right"===l?(null!=y?y:0)-e:(null!=y?y:0)+e,c=0===g,u=e>0;if(g===a-1&&oc(i.current,{transition:`opacity ${lc.DURATION}s cubic-bezier(${lc.EASE.join(",")})`}),!d&&n>2&&!u)return void(o?t():w(b[0]));if(!d&&n>2&&u&&b&&r)return void w(b[r.length-1]);const p=null==b?void 0:b.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-s)<Math.abs(e-s)?t:e),f=ic(l)?window.innerHeight:window.innerWidth;if(n>.4&&Math.abs(e)<.4*f){const e=u?1:-1;if(e>0&&h&&r)return void w(b[r.length-1]);if(c&&e<0&&o&&t(),null===g)return;return void w(b[g+e])}w(p)},onDrag:function({draggedDistance:e}){if(null===y)return;const t="bottom"===l||"right"===l?y-e:y+e;("bottom"===l||"right"===l)&&t<b[b.length-1]||("top"===l||"left"===l)&&t>b[b.length-1]||oc(o.current,{transform:ic(l)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:b}}({snapPoints:a,activeSnapPointProp:m,setActiveSnapPointProp:h,drawerRef:Z,fadeFromIndex:f,overlayRef:F,onSnapPointChange:te,direction:E,container:N,snapToSequentialPoint:T});Jl({isDisabled:!D||_||!v||$||!A||!C||!S});const{restorePositionSetting:de}=function({isOpen:e,modal:n,nested:r,hasBeenOpened:o,preventScrollRestoration:i,noBodyStyles:a}){const[s,l]=t.useState(()=>"undefined"!=typeof window?window.location.href:""),c=t.useRef(0),d=t.useCallback(()=>{if(Fl()&&null===fc&&e&&!a){fc={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:-c.current+"px",left:-e+"px",right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=-(c.current+e)+"px")}),300)}},[e]),u=t.useCallback(()=>{if(Fl()&&null!==fc&&!a){const e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,fc),window.requestAnimationFrame(()=>{i&&s!==window.location.href?l(window.location.href):window.scrollTo(t,e)}),fc=null}},[s]);return t.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),t.useEffect(()=>{if(n)return()=>{"undefined"!=typeof document&&(document.querySelector("[data-vaul-drawer]")||u())}},[n,u]),t.useEffect(()=>{!r&&o&&(e?(!window.matchMedia("(display-mode: standalone)").matches&&d(),n||window.setTimeout(()=>{u()},500)):u())},[e,o,s,n,r,d,u]),{restorePositionSetting:u}}({isOpen:D,modal:v,nested:null!=y&&y,hasBeenOpened:A,preventScrollRestoration:O,noBodyStyles:w});function ue(){return(window.innerWidth-26)/window.innerWidth}function pe(e,t){var n;let r=e;const o=null==(n=window.getSelection())?void 0:n.toString(),i=Z.current?ac(Z.current,E):null,a=new Date;if("SELECT"===r.tagName)return!1;if(r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===E||"left"===E)return!0;if(W.current&&a.getTime()-W.current.getTime()<500)return!1;if(null!==i&&("bottom"===E?i>0:i<0))return!0;if(o&&o.length>0)return!1;if(V.current&&a.getTime()-V.current.getTime()<d&&0===i)return V.current=a,!1;if(t)return V.current=a,!1;for(;r;){if(r.scrollHeight>r.clientHeight){if(0!==r.scrollTop)return V.current=new Date,!1;if("dialog"===r.getAttribute("role"))return!0}r=r.parentNode}return!0}function fe(e){!function(){if(!_||!Z.current)return;Z.current.classList.remove(dc),U.current=!1,L(!1),H.current=new Date}(),null==b||b(),e||R(!1),setTimeout(()=>{a&&oe(a[0])},1e3*lc.DURATION)}function me(){if(!Z.current)return;const e=document.querySelector("[data-vaul-drawer-wrapper]"),t=ac(Z.current,E);oc(Z.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${lc.DURATION}s cubic-bezier(${lc.EASE.join(",")})`}),oc(F.current,{transition:`opacity ${lc.DURATION}s cubic-bezier(${lc.EASE.join(",")})`,opacity:"1"}),s&&t&&t>0&&D&&oc(e,{borderRadius:"8px",overflow:"hidden",...ic(E)?{transform:`scale(${ue()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ue()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${lc.DURATION}s`,transitionTimingFunction:`cubic-bezier(${lc.EASE.join(",")})`},!0)}return t.useEffect(()=>{window.requestAnimationFrame(()=>{X.current=!0})},[]),t.useEffect(()=>{var e;function t(){if(!Z.current||!C)return;if(tc(document.activeElement)||q.current){var e;const t=(null==(e=window.visualViewport)?void 0:e.height)||0,n=window.innerHeight;let r=n-t;const o=Z.current.getBoundingClientRect().height||0,i=o>.8*n;ee.current||(ee.current=o);const s=Z.current.getBoundingClientRect().top;if(Math.abs(K.current-r)>60&&(q.current=!q.current),a&&a.length>0&&ae&&re){r+=ae[re]||0}if(K.current=r,o>t||q.current){const e=Z.current.getBoundingClientRect().height;let n=e;e>t&&(n=t-(i?s:26)),Z.current.style.height=g?e-Math.max(r,0)+"px":`${Math.max(n,t-s)}px`}else(function(){const e=navigator.userAgent;return"undefined"!=typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))})()||(Z.current.style.height=`${ee.current}px`);a&&a.length>0&&!q.current?Z.current.style.bottom="0px":Z.current.style.bottom=`${Math.max(r,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[re,a,ae]),t.useEffect(()=>(D&&(oc(document.documentElement,{scrollBehavior:"auto"}),W.current=new Date),()=>{!function(e,t){if(!(e&&e instanceof HTMLElement))return;let n=rc.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[D]),t.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),t.createElement(Ml,{defaultOpen:x,onOpenChange:e=>{(u||e)&&(e?z(!0):fe(!0),R(e))},open:D},t.createElement($l.Provider,{value:{activeSnapPoint:ne,snapPoints:a,setActiveSnapPoint:oe,drawerRef:Z,overlayRef:F,onOpenChange:n,onPress:function(e){var t,n;(u||a)&&(Z.current&&!Z.current.contains(e.target)||(J.current=(null==(t=Z.current)?void 0:t.getBoundingClientRect().height)||0,Q.current=(null==(n=Z.current)?void 0:n.getBoundingClientRect().width)||0,L(!0),B.current=new Date,Bl()&&window.addEventListener("touchend",()=>U.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),G.current=ic(E)?e.pageY:e.pageX))},onRelease:function(e){if(!_||!Z.current)return;Z.current.classList.remove(dc),U.current=!1,L(!1),H.current=new Date;const t=ac(Z.current,E);if(!e||!pe(e.target,!1)||!t||Number.isNaN(t))return;if(null===B.current)return;const n=H.current.getTime()-B.current.getTime(),r=G.current-(ic(E)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(j(!0),setTimeout(()=>{j(!1)},200)),a){return ie({draggedDistance:r*("bottom"===E||"right"===E?1:-1),closeDrawer:fe,velocity:o,dismissible:u}),void(null==i||i(e,!0))}if("bottom"===E||"right"===E?r>0:r<0)return me(),void(null==i||i(e,!0));if(o>.4)return fe(),void(null==i||i(e,!1));var s;const l=Math.min(null!=(s=Z.current.getBoundingClientRect().height)?s:0,window.innerHeight);var d;const p=Math.min(null!=(d=Z.current.getBoundingClientRect().width)?d:0,window.innerWidth),f="left"===E||"right"===E;if(Math.abs(t)>=(f?p:l)*c)return fe(),void(null==i||i(e,!1));null==i||i(e,!0),me()},onDrag:function(e){if(Z.current&&_){const t="bottom"===E||"right"===E?1:-1,n=(G.current-(ic(E)?e.pageY:e.pageX))*t,r=n>0,i=a&&!u&&!r;if(i&&0===re)return;const l=Math.abs(n),c=document.querySelector("[data-vaul-drawer-wrapper]");let d=l/("bottom"===E||"top"===E?J.current:Q.current);const p=ce(l,r);if(null!==p&&(d=p),i&&d>=1)return;if(!U.current&&!pe(e.target,r))return;if(Z.current.classList.add(dc),U.current=!0,oc(Z.current,{transition:"none"}),oc(F.current,{transition:"none"}),a&&se({draggedDistance:n}),r&&!a){const e=function(e){return 8*(Math.log(e+1)-2)}(n),r=Math.min(-1*e,0)*t;return void oc(Z.current,{transform:ic(E)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`})}const m=1-d;if((le||f&&re===f-1)&&(null==o||o(e,d),oc(F.current,{opacity:`${m}`,transition:"none"},!0)),c&&F.current&&s){const e=Math.min(ue()+d*(1-ue()),1),t=8-8*d,n=Math.max(0,14-14*d);oc(c,{borderRadius:`${t}px`,transform:ic(E)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!a){const e=l*t;oc(Z.current,{transform:ic(E)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:u,shouldAnimate:X,handleOnly:p,isOpen:D,isDragging:_,shouldFade:le,closeDrawer:fe,onNestedDrag:function(e,t){if(t<0)return;const n=(window.innerWidth-cc)/window.innerWidth,r=n+t*(1-n),o=t*cc-16;oc(Z.current,{transform:ic(E)?`scale(${r}) translate3d(0, ${o}px, 0)`:`scale(${r}) translate3d(${o}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){const t=e?(window.innerWidth-cc)/window.innerWidth:1,n=e?-16:0;Y.current&&window.clearTimeout(Y.current),oc(Z.current,{transition:`transform ${lc.DURATION}s cubic-bezier(${lc.EASE.join(",")})`,transform:ic(E)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&Z.current&&(Y.current=setTimeout(()=>{const e=ac(Z.current,E);oc(Z.current,{transition:"none",transform:ic(E)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){const n=ic(E)?window.innerHeight:window.innerWidth,r=t?(n-cc)/n:1,o=t?-16:0;t&&oc(Z.current,{transition:`transform ${lc.DURATION}s cubic-bezier(${lc.EASE.join(",")})`,transform:ic(E)?`scale(${r}) translate3d(0, ${o}px, 0)`:`scale(${r}) translate3d(${o}px, 0, 0)`})},keyboardIsOpen:q,modal:v,snapPointsOffset:ae,activeSnapPointIndex:re,direction:E,shouldScaleBackground:s,setBackgroundColorOnScale:l,noBodyStyles:w,container:N,autoFocus:k}},r))}const hc=t.forwardRef(function({...e},n){const{overlayRef:r,snapPoints:o,onRelease:i,shouldFade:a,isOpen:s,modal:l,shouldAnimate:c}=jl(),d=nc(n,r),u=o&&o.length>0;if(!l)return null;const p=t.useCallback(e=>i(e),[i]);return t.createElement(Rl,{onMouseUp:p,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":s&&u?"true":"false","data-vaul-snap-points-overlay":s&&a?"true":"false","data-vaul-animate":(null==c?void 0:c.current)?"true":"false",...e})});hc.displayName="Drawer.Overlay";const gc=t.forwardRef(function({onPointerDownOutside:e,style:n,onOpenAutoFocus:r,...o},i){const{drawerRef:a,onPress:s,onRelease:l,onDrag:c,keyboardIsOpen:d,snapPointsOffset:p,activeSnapPointIndex:f,modal:m,isOpen:h,direction:g,snapPoints:v,container:b,handleOnly:y,shouldAnimate:w,autoFocus:E}=jl(),[x,S]=t.useState(!1),T=nc(i,a),O=t.useRef(null),C=t.useRef(null),P=t.useRef(!1),N=v&&v.length>0;!function(){const{direction:e,isOpen:n,shouldScaleBackground:r,setBackgroundColorOnScale:o,noBodyStyles:i}=jl(),a=t.useRef(null),s=u(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-26)/window.innerWidth}t.useEffect(()=>{if(n&&r){a.current&&clearTimeout(a.current);const t=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!t)return;o&&!i&&sc(document.body,{background:"black"}),sc(t,{transformOrigin:ic(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${lc.DURATION}s`,transitionTimingFunction:`cubic-bezier(${lc.EASE.join(",")})`});const n=sc(t,{borderRadius:"8px",overflow:"hidden",...ic(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{s?document.body.style.background=s:document.body.style.removeProperty("background")},1e3*lc.DURATION)}}},[n,r,s])}();function k(e){O.current=null,P.current=!1,l(e)}return t.useEffect(()=>{N&&window.requestAnimationFrame(()=>{S(!0)})},[]),t.createElement(Al,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":x?"true":"false","data-vaul-snap-points":h&&N?"true":"false","data-vaul-custom-container":b?"true":"false","data-vaul-animate":(null==w?void 0:w.current)?"true":"false",...o,ref:T,style:p&&p.length>0?{"--snap-point-height":`${p[null!=f?f:0]}px`,...n}:n,onPointerDown:e=>{y||(null==o.onPointerDown||o.onPointerDown.call(o,e),O.current={x:e.pageX,y:e.pageY},s(e))},onOpenAutoFocus:e=>{null==r||r(e),E||e.preventDefault()},onPointerDownOutside:t=>{null==e||e(t),m&&!t.defaultPrevented?d.current&&(d.current=!1):t.preventDefault()},onFocusOutside:e=>{m||e.preventDefault()},onPointerMove:e=>{if(C.current=e,y)return;if(null==o.onPointerMove||o.onPointerMove.call(o,e),!O.current)return;const t=e.pageY-O.current.y,n=e.pageX-O.current.x,r="touch"===e.pointerType?10:2,i=((e,t,n=0)=>{if(P.current)return!0;const r=Math.abs(e.y),o=Math.abs(e.x),i=o>r,a=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*a<0)&&o>=0&&o<=n)return i}else if(!(e.y*a<0)&&r>=0&&r<=n)return!i;return P.current=!0,!0})({x:n,y:t},g,r);i?c(e):(Math.abs(n)>r||Math.abs(t)>r)&&(O.current=null)},onPointerUp:e=>{null==o.onPointerUp||o.onPointerUp.call(o,e),O.current=null,P.current=!1,l(e)},onPointerOut:e=>{null==o.onPointerOut||o.onPointerOut.call(o,e),k(C.current)},onContextMenu:e=>{null==o.onContextMenu||o.onContextMenu.call(o,e),C.current&&k(C.current)}})});gc.displayName="Drawer.Content";const vc=t.forwardRef(function({preventCycle:e=!1,children:n,...r},o){const{closeDrawer:i,isDragging:a,snapPoints:s,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:d,handleOnly:u,isOpen:p,onPress:f,onDrag:m}=jl(),h=t.useRef(null),g=t.useRef(!1);function v(){h.current&&window.clearTimeout(h.current),g.current=!1}return t.createElement("div",{onClick:function(){g.current?v():window.setTimeout(()=>{!function(){if(a||e||g.current)return void v();if(v(),!s||0===s.length)return void(d||i());if(l===s[s.length-1]&&d)return void i();const t=s.findIndex(e=>e===l);if(-1===t)return;const n=s[t+1];c(n)}()},120)},onPointerCancel:v,onPointerDown:e=>{u&&f(e),h.current=window.setTimeout(()=>{g.current=!0},250)},onPointerMove:e=>{u&&m(e)},ref:o,"data-vaul-drawer-visible":p?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},t.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},n))});vc.displayName="Drawer.Handle";const bc={Root:mc,NestedRoot:function({onDrag:e,onOpenChange:n,open:r,...o}){const{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:s}=jl();if(!i)throw new Error("Drawer.NestedRoot must be placed in another drawer");return t.createElement(mc,{nested:!0,open:r,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),null==e||e(t,n)},onOpenChange:e=>{e&&a(e),null==n||n(e)},onRelease:s,...o})},Content:gc,Overlay:hc,Trigger:Il,Portal:function(e){const n=jl(),{container:r=n.container,...o}=e;return t.createElement(Dl,{container:r,...o})},Handle:vc,Close:Ll,Title:zl,Description:_l};function yc(t){var n=S(t,[]);return e.createElement(bc.Root,Object.assign({"data-slot":"drawer"},n))}function wc(t){var n=S(t,[]);return e.createElement(bc.Trigger,Object.assign({"data-slot":"drawer-trigger"},n))}function Ec(t){var n=S(t,[]);return e.createElement(bc.Portal,Object.assign({"data-slot":"drawer-portal"},n))}function xc(t){var{className:n}=t,r=S(t,["className"]);return e.createElement(bc.Overlay,Object.assign({"data-slot":"drawer-overlay",className:Et("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[999999] bg-black/50",n)},r))}function Sc(t){var{className:n,children:r}=t,o=S(t,["className","children"]);return e.createElement(Ec,{"data-slot":"drawer-portal"},e.createElement(xc,null),e.createElement(bc.Content,Object.assign({"data-slot":"drawer-content",className:Et("group/drawer-content bg-background fixed z-[999999] flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",n)},o),e.createElement("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),r))}function Tc(t){var{className:n}=t,r=S(t,["className"]);return e.createElement("div",Object.assign({"data-slot":"drawer-header",className:Et("flex flex-col gap-1.5 p-4",n)},r))}function Oc(t){var{className:n}=t,r=S(t,["className"]);return e.createElement(bc.Title,Object.assign({"data-slot":"drawer-title",className:Et("text-foreground font-semibold",n)},r))}const Cc=({children:e,products:n,contentId:r})=>{const{isPreview:o}=Qi();return t.createElement(yc,{direction:"right",fadeFromIndex:0,snapPoints:[1]},t.createElement(wc,{className:"w-full"},e),t.createElement(Sc,null,t.createElement(Tc,null,t.createElement(Oc,null,"상품 목록")),t.createElement("div",{className:"overflow-y-scroll grid-cols-2 grid items-baseline justify-items-center scrollbar-hide"},n.map(e=>e.linkPath?t.createElement("a",{key:e.productId,className:"p-2 text-gray-800 w-full h-full flex flex-col items-center justify-center no-underline",href:e.linkPath,target:"_blank",onClick:()=>T(void 0,void 0,void 0,function*(){o||(yield Wi({contentId:r,contentProductId:e.eventProductId,productId:e.productId}))})},t.createElement(Pc,{product:e})):t.createElement(Pc,{key:e.productId,product:e})))))},Pc=({product:e})=>t.createElement("div",{className:"text-gray-800 w-32"},t.createElement("div",{className:"w-full aspect-square mb-2 border border-[#f4f3f6] rounded "},t.createElement("img",{src:e.thumbPath,alt:e.productName,className:"w-full h-full"})),e.brand&&t.createElement("p",{className:"text-xs text-gray-400 mb-1"},e.brand.brandName),t.createElement("p",{className:"w-full text-[12px] md:text-[15px] mb-1"},e.productName),t.createElement("div",{className:"w-full "},t.createElement("div",{className:"flex"},t.createElement("span",{className:"text-sm text-red-500 mr-2 font-semibold"},e.discount,"%"),t.createElement("span",{className:"font-semibold"},xt(e.sellingPrice),"원")))),Nc=({products:e,useDrawer:n,contentId:r})=>{const o=u(()=>(e=>{if(e.length>=3)return e;const t=[...e];for(;t.length<3;)t.push(...e);return t})(e),[e]),i=1===(null==e?void 0:e.length);return(null==e?void 0:e.length)?t.createElement("div",{className:"w-full",style:{height:"80px"}},i?t.createElement("div",{className:"bg-white overflow-hidden rounded-xl w-full",style:{borderRadius:"10px",height:"80px"}},n?t.createElement(Cc,{products:e,contentId:r},t.createElement(va,{product:e[0],productsLength:e.length,contentId:r})):t.createElement(va,{product:e[0],productsLength:e.length,hideMoreBtn:!0,contentId:r})):t.createElement(ci,{nested:!0,modules:[Ti,fi],slidesPerView:1.1,effect:"cards",autoplay:!0,loop:!0,grabCursor:!0,cardsEffect:{rotate:!1},className:"w-full",style:{height:"80px"}},o.map((o,i)=>t.createElement(di,{key:i+o.productId,className:"bg-white overflow-hidden rounded-xl",style:{borderRadius:"10px",height:"80px"}},n?t.createElement(Cc,{products:e,contentId:r},t.createElement(va,{product:o,productsLength:e.length,contentId:r})):t.createElement(va,{product:o,productsLength:e.length,hideMoreBtn:!0,contentId:r}))))):null},kc=({shortForm:e,useDrawer:n,isPopup:r,shareUrl:o,handleClose:i})=>{const[s,l]=a(!Boolean(r)),[c,d]=a(!0),{logo:u,productsInfo:p,thumbPath:f,title:m,media:h,brand:g,shortsId:v}=e;return t.createElement("div",{className:"h-full w-full text-sm overflow-hidden text-white relative"},t.createElement("div",{style:{backgroundImage:"linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 50%, rgba(0,0,0,0.4) 100%)",padding:"15px"},className:"absolute h-full flex flex-col w-full z-[1] justify-between inset-0 bg-gradient-to-b from-black/40 via-transparent to-black/40"},t.createElement("div",{className:"flex gap-2 justify-between "},t.createElement("div",{className:"max-w-16"},(null==u?void 0:u.thumbPath)?t.createElement("img",{className:"mb-1",src:u.thumbPath,alt:u.logoName,width:100,height:100}):null),t.createElement("div",{className:"justify-self-end flex gap-2"},t.createElement("div",{className:"cursor-pointer text-white ",onClick:()=>{d(e=>!e)}},c?t.createElement(Ut,{size:20}):t.createElement(Yt,{size:20})),t.createElement("div",{className:"cursor-pointer text-white ",onClick:()=>{l(e=>!e)}},s?t.createElement(Xt,{size:20}):t.createElement(qt,{size:20})),t.createElement("div",{className:"cursor-pointer text-white ",onClick:i},t.createElement(Kt,{size:20})))),t.createElement("div",null,t.createElement("div",{className:"flex justify-between items-end mb-3 gap-3"},t.createElement("div",{className:"w-full"},g&&t.createElement("div",{className:"items-center flex gap-3 mb-2"},t.createElement("div",{className:"w-12 h-12 bg-white rounded-full border overflow-hidden"},t.createElement("img",{src:g.thumbPath,alt:g.brandName,width:100,height:100,className:"object-contain w-full h-full"})),t.createElement("p",{style:{fontSize:"14px",textAlign:"start"}},null==g?void 0:g.brandName)),t.createElement("p",{style:{fontSize:"14px",textAlign:"start"}},m)),t.createElement("div",{className:"flex flex-col items-center",style:{gap:"15px"}},t.createElement(sa,{shortsId:v}),t.createElement("div",{className:"w-[24px] h-[24px] flex items-center justify-center"},t.createElement(ga,{shortForm:e,shareUrl:o})))),p&&t.createElement(Nc,{products:p,useDrawer:n,contentId:e.shortsId}))),t.createElement(P,{file:St(null==h?void 0:h.objectId),thumbnail:`${kt(f)}`,mute:s,isVertical:(null==h?void 0:h.height)>(null==h?void 0:h.width),play:c}))},Mc=({collection:e,playerSettings:n})=>{const[r,o]=a(e.contents[0]);return t.createElement("div",{className:"w-full h-full aspect-[9/16]"},t.createElement(ci,{modules:[ui,wi],loop:!0,mousewheel:!0,direction:"vertical",touchEventsTarget:"container",slidesPerView:1,onSlideChangeTransitionEnd:t=>{const n=e.contents[t.realIndex];o(Object.assign({},n))},className:"h-full"},e.contents.map(e=>t.createElement(di,{key:e.shortsId,className:"rounded-xl overflow-hidden"},r.shortsId===e.shortsId&&t.createElement("div",{className:"h-full rounded-xl absolute z-[999] w-full"},t.createElement(kc,{shortForm:r,isPopup:!0})),t.createElement("img",{src:kt(e.thumbPath),alt:e.title,className:"rounded-xl w-full h-full bg-black "+(e.media.width>e.media.height?"object-contain":"object-cover")})))))},Ic=e=>{const{isMobile:n}=e,[r,o]=a("collection"in e?e.collection.contents[0]:null);if(n){if("shortform"in e)return t.createElement(kc,{shortForm:e.shortform});if(e.collection)return t.createElement(Mc,{collection:e.collection,playerSettings:e.collection.player.shoppingPlayer})}if("shortform"in e){const{layout:n}=e.shortform.player,r=e.shortform.player.shoppingPlayer;switch(n){case Rt.PLATFORM:return t.createElement(Hr,{shortform:e.shortform,playerSettings:r,player:t.createElement("div",{className:"aspect-[9/16] h-full rounded-xl border overflow-hidden"},t.createElement(P,{file:St(e.shortform.media.objectId)}))});case Rt.HORIZONTAL:return t.createElement(Pi,{shortform:e.shortform,playerSettings:r,player:t.createElement(P,{file:St(e.shortform.media.objectId)})});case Rt.VERTICAL:return t.createElement(ki,{shortform:e.shortform,playerSettings:r,player:t.createElement("div",{className:"aspect-[9/16] h-full"},t.createElement(P,{file:St(e.shortform.media.objectId)}))});case Rt.GRID:return t.createElement(Ii,{shortform:e.shortform,playerSettings:r,player:t.createElement(P,{file:St(e.shortform.media.objectId)})})}}else{if(!e.collection||!r)return null;{const{layout:n}=e.collection.player,i=e.collection.player.shoppingPlayer;switch(n){case Rt.PLATFORM:return t.createElement(Hr,{shortform:r,playerSettings:i,player:t.createElement("div",{className:"w-full flex items-center justify-center gap-4",style:{height:"calc(-220px + 100vh)"}},t.createElement(oa,{collection:e.collection,playerSettings:i,shortform:r,setShortform:o}))});case Rt.HORIZONTAL:return t.createElement(Pi,{shortform:r,playerSettings:Object.assign({},i),player:t.createElement("div",{className:"h-full aspect-[9/16]"},t.createElement(ia,{collection:e.collection,playerSettings:i,shortform:r,setShortform:o}))});case Rt.VERTICAL:return t.createElement(ki,{playerSettings:Object.assign({},i),shortform:r,player:t.createElement(ia,{collection:e.collection,playerSettings:i,shortform:r,setShortform:o})});case Rt.GRID:return t.createElement(Ii,{shortform:r,playerSettings:Object.assign({},i),player:t.createElement(ia,{collection:e.collection,playerSettings:i,shortform:r,setShortform:o})})}}}},Dc=e=>t.createElement(kc,Object.assign({},e));function Rc(){const[e,t]=a({width:window.innerWidth,height:window.innerHeight});return r(()=>{const e=()=>t({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}const Ac=t.memo(({shortform:e,shareUrl:n,handleClose:r})=>t.createElement(t.Fragment,null,t.createElement("div",{onClick:e=>e.stopPropagation(),className:"overflow-hidden",style:{borderRadius:"10px",overflow:"hidden",width:"100%",height:"100%",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",backgroundImage:`url(${kt(e.thumbPath)})`}},t.createElement(kc,{handleClose:r,shortForm:e,useDrawer:!1,isPopup:!0,shareUrl:n})))),zc=t.memo(({shortform:e})=>t.createElement("div",{onClick:e=>{e.stopPropagation()},style:{width:"100%",height:"100%",borderRadius:"10px",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",backgroundImage:`url(${e.thumbPath.includes("https")?e.thumbPath:`https://${e.thumbPath}`})`}})),_c=({shortform:e,shareUrl:n,handleClose:r})=>{const{isActive:o}=c(si),i=c(li),a=Rc().width<430||ma.isMobile;return t.createElement("div",{className:"flex items-center justify-center w-full h-full select-none",onClick:e=>{r()}},t.createElement("div",{className:"max-h-full flex items-center justify-center",style:{width:"100%",aspectRatio:a?"auto":"9 / 16",height:a?"100dvh":"auto",maxHeight:a?void 0:"90vh",transform:a?void 0:`scale(${o?1:.8})`,transition:"transform 180ms ease"}},o?t.createElement("div",{className:"flex items-center justify-between w-full h-full text-white relative"},t.createElement("div",{className:"cursor-pointer absolute",onClick:e=>{e.stopPropagation(),i.slidePrev()},style:{zIndex:1e5,left:a?"0":"-30px",top:"50%",transform:"translateY(-50%)",width:30,height:30,display:"grid",placeItems:"center",pointerEvents:"auto"}},t.createElement(Wt,{size:28})),t.createElement(Ac,{shortform:e,shareUrl:n,handleClose:r}),t.createElement("div",{className:"cursor-pointer absolute",style:{zIndex:1e5,right:a?"0":"-30px",top:"50%",transform:"translateY(-50%)",width:30,height:30,display:"grid",placeItems:"center",pointerEvents:"auto"},onClick:e=>{e.stopPropagation(),i.slideNext()}},t.createElement(Bt,{size:28}))):t.createElement(zc,{shortform:e})))},{PLAYER_BACK_BASE_URL:Lc}=gt(),$c=({collection:e,initialShortsId:r,onSlideChange:o,onClosePlayer:i})=>{var a;const s=u(()=>Math.max(e.contents.findIndex(e=>e.shortsId===r),0),[e.contents,r]),l=e.contents.length,c=Math.max(l,10),d=null!==(a=Rc().width)&&void 0!==a?a:0,p=d<430||ma.isMobile,f=p?1:d>=1200?4:d>=900?3:2,m=u(()=>(e=>{const t=[...e];for(;t.length<c;)t.push(...e);return t})(e.contents),[e.contents]),h=n(null);return t.createElement("div",{style:{minHeight:100,minWidth:300},className:"w-full"},t.createElement(ci,{style:{minHeight:100,overflow:"visible"},initialSlide:s,ref:h,lazyPreloadPrevNext:2,className:"w-full",spaceBetween:p?8:d>=1200?24:d>=900?25:16,slidesPerView:f,grabCursor:!0,centeredSlides:1!==f,onSlideChangeTransitionEnd:t=>{const n=t.realIndex%l;null==o||o(n);const r=e.contents[(n+1)%l];var i;i=St(r.media.objectId),O||(O=document.createElement("video"),O.muted=!0,O.playsInline=!0,O.preload="metadata",O.loop=!0,O.style.cssText="position:fixed;left:-9999px;top:-9999px;width:1px;height:1px;opacity:0",document.body.appendChild(O)),C!==i&&(O.src=i,O.load(),C=i)},loop:!0,slideToClickedSlide:!0},m.map((n,r)=>t.createElement(di,{key:r},t.createElement(_c,{handleClose:i,shortform:n,shareUrl:`${Lc}/collection/${e.colId}?start=${n.shortsId}&layout=5`})))))},jc=({shortform:e,onThumbnailClick:n,iconSize:r,exposeTitle:o,borderLine:i})=>{const a=u(()=>Nt(i),[i])?{background:"linear-gradient(#fff,#fff) padding-box, conic-gradient(#f58529,#f77737,#fd1d1d,#833ab4,#c13584,#f58529) border-box",border:"3px solid transparent"}:{background:"#fff",border:"3px solid #fff"};return t.createElement("div",{className:"flex flex-col w-full gap-2",onClick:()=>n(e.shortsId)},t.createElement("div",{className:"rounded-full overflow-hidden cursor-pointer",style:Object.assign({width:r,height:r,padding:4},a)},t.createElement("img",{src:kt(e.thumbPath),alt:"thumbnail",className:"w-full h-full object-cover block rounded-full"})),o&&t.createElement("span",{style:{width:r},className:"text-black overflow-hidden text-[12px] whitespace-nowrap text-center text-clip cursor-default"},e.title))},Fc=Ji(e=>({open:!1,setOpen:t=>e({open:t})})),Wc=({product:e,productLength:n,hideMoreBadge:r=!1,contentId:o,lineClamp:i,showMoreBtn:a=!1,openProductPopup:s})=>{const{isPreview:l}=Qi();return t.createElement(t.Fragment,null,t.createElement("div",{className:"product-banner border mbus-border",onClick:()=>T(void 0,void 0,void 0,function*(){r&&(window.open(e.linkPath,"_blank"),l||(yield Wi({contentProductId:e.eventProductId,contentId:o,productId:e.productId})))})},t.createElement("span",{className:"product-banner__clip","aria-hidden":!0},t.createElement("span",{className:"product-banner__sheen"})),t.createElement("div",{className:"relative",style:{width:"40%",minWidth:"40%"}},t.createElement("img",{style:{borderRadius:"0.625rem"},className:"aspect-square rounded-lg object-cover w-full",src:kt(e.thumbPath),alt:e.productName}),!r&&t.createElement("p",{className:"absolute text-white rounded-lg",style:{backgroundColor:"#797979",top:-10,right:-10,padding:"2px 4px",fontSize:"10px",borderRadius:"0.625rem"}},"+",n)),t.createElement("div",{style:{position:"relative",zIndex:2,minWidth:0,flex:1,paddingRight:24}},t.createElement("p",{style:{display:"-webkit-box",WebkitLineClamp:i||2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word",fontWeight:600,color:"#494949"}},e.productName)),t.createElement("span",{className:"product-banner__arrow","aria-hidden":!0},"›")),a&&n>1&&t.createElement("div",{onClick:s,className:" flex items-center justify-center border mbus-border cursor-pointer",style:{borderRadius:"0.625rem",padding:"10px",backgroundColor:"#f5f5f5",fontWeight:600}},"+ 더보기 (",n,")"))},Bc=({products:e,iconSize:n,contentId:r,setSelectedProducts:o,showMoreBtn:i,hideMoreBadge:a})=>{const{setOpen:s}=Fc(),l=()=>{o({productsInfo:e,shortsId:r}),s(!0)};return t.createElement(t.Fragment,null,t.createElement("div",{onClick:()=>T(void 0,void 0,void 0,function*(){1===e.length||i||l()}),className:"flex flex-col gap-2 mt-4 text-gray-800",style:{maxWidth:n||"100%",fontSize:13}},t.createElement(Wc,{showMoreBtn:i,lineClamp:2,product:e[0],contentId:r,productLength:e.length,hideMoreBadge:null!=a?a:1===e.length,openProductPopup:l})))},Hc=({product:e,maxWidth:n="100%",height:r,cardWidth:o})=>t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,borderRadius:8,backgroundColor:"#ffffff",color:"#111827",maxWidth:n,height:r,width:"100%",paddingRight:8}},t.createElement("img",{src:kt(e.thumbPath),alt:e.productName,style:{height:"100%",aspectRatio:"1 / 1",borderRadius:6,objectFit:"cover",flexShrink:0}}),t.createElement("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center"}},t.createElement("span",{style:{lineHeight:1.25,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:12}},e.productName),t.createElement("span",{style:{lineHeight:1.25,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:11}},"number"==typeof e.sellingPrice&&e.sellingPrice<e.price?"number"==typeof o&&o>=190?t.createElement(t.Fragment,null,t.createElement("span",{style:{color:"#dc2626",fontWeight:600,marginRight:4}},xt(e.sellingPrice),"원"),t.createElement("span",{style:{color:"#9ca3af",textDecoration:"line-through"}},xt(e.price),"원")):t.createElement("span",{style:{color:"#dc2626",fontWeight:600}},xt(e.sellingPrice),"원"):t.createElement("span",{style:{color:"#dc2626",fontWeight:600}},xt(e.price),"원")))),Vc=({playUrl:e,poster:n})=>t.createElement("div",{className:"w-full h-full absolute top-0 left-0 z-10 pointer-events-none",style:{backgroundImage:`url(${n})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}},t.createElement("video",{src:e,autoPlay:!0,muted:!0,preload:"auto",playsInline:!0,loop:!0,className:"w-full h-full object-cover"})),{API_BASE_URL:Uc}=gt(),Yc=({shortform:e,onThumbnailClick:n,iconSize:r,exposeTitle:o,rounded:i,borderLine:s,titlePosition:l,exposeProductBanner:c,setSelectedProducts:d,iconRatio:p,hoverPlay:f,exposeProductBadge:m})=>{var h;const g=u(()=>Nt(s),[s]),[v,b]=a(!1);return t.createElement("div",{className:"relative"},t.createElement("div",{onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),onClick:()=>n(e.shortsId),style:Object.assign({width:r,aspectRatio:p},i&&{borderRadius:"10px"}),className:`cursor-pointer p-[3px] ${i&&"rounded-xl"} ${g&&"bg-insta"} relative overflow-hidden`},v&&f&&t.createElement(Vc,{playUrl:`${Uc}/direct/${e.media.objectId}`,poster:kt(e.thumbPath)}),t.createElement("img",{style:Object.assign({},i&&{borderRadius:"10px"}),src:kt(e.thumbPath),alt:"thumbnail",className:`w-full h-full object-cover ${i&&"rounded-xl"}`}),m&&(null===(h=e.productsInfo)||void 0===h?void 0:h.length)>0&&!(f&&v)&&t.createElement("div",{className:"absolute pointer-events-none flex items-center justify-center z-20",style:{left:2,right:2,bottom:10,height:"20%"}},t.createElement("div",{className:"h-full inline-block",style:{width:"95%"}},t.createElement(Hc,{product:e.productsInfo[0],maxWidth:"100%",height:"100%",cardWidth:r})))),o&&!(f&&v&&l===je.INNER)&&t.createElement("p",{style:Object.assign({width:r,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},l===je.INNER&&m?{bottom:"22%"}:{}),className:`my-2 ${l===je.INNER?"absolute bottom-0 left-0 text-white px-2 z-10":""} text-[12px] cursor-default truncate`},e.title),c&&t.createElement(Bc,{setSelectedProducts:d,products:e.productsInfo,iconSize:r,contentId:e.shortsId}))},Gc=e=>{const{iconShape:n,collection:r}=e;return n===_e.MANY?t.createElement(qc,Object.assign({},e)):t.createElement(Xc,Object.assign({},e,{shortform:r.contents[0]}))},qc=e=>{const{collection:n}=e,{thumbnailAutoPlay:r}=e,{setCollection:o,nextKey:i,setNextKey:a,isFetching:s,setIsFetching:l}=na();return t.createElement(ci,{freeMode:!0,slidesPerView:"auto",spaceBetween:12,onReachEnd:()=>T(void 0,void 0,void 0,function*(){var e,t,r;if(n&&!(s||(null!==(e=n.count)&&void 0!==e?e:Number.MAX_SAFE_INTEGER)<=n.contents.length)){l(!0);try{const e=yield Vi({collectionId:n.colId,nextKey:i});if(!e||!(null===(t=e.contents)||void 0===t?void 0:t.length))return;a((null===(r=e.contents.at(-1))||void 0===r?void 0:r.shortsId)||"");const s=new Set(n.contents.map(e=>e.shortsId)),l=e.contents.filter(e=>!s.has(e.shortsId));if(!l.length)return;o(Object.assign(Object.assign({},n),{contents:[...n.contents,...l]}))}catch(e){console.error(e)}finally{l(!1)}}}),modules:r?[fi]:[],autoplay:!!r&&{delay:3e3,disableOnInteraction:!1,pauseOnMouseEnter:!0},loop:r||void 0},null==n?void 0:n.contents.map(n=>t.createElement(di,{key:n.shortsId,className:"!w-auto"},t.createElement(Xc,Object.assign({},e,{shortform:n})))))},Xc=e=>{const{iconForm:n}=e;return n===ze.INSTA?t.createElement(jc,Object.assign({},e)):t.createElement(Yc,Object.assign({},e))};function Kc(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Zc(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Jc(...e){return t=>{let n=!1;const r=e.map(e=>{const r=Zc(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():Zc(e[t],null)}}}}function Qc(...t){return e.useCallback(Jc(...t),t)}function ed(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const o=r.reduce((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]}),{});return e.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return r.scopeName=n.scopeName,r}var td=globalThis?.document?e.useLayoutEffect:()=>{},nd=e[" useId ".trim().toString()]||(()=>{}),rd=0;function od(t){const[n,r]=e.useState(nd());return td(()=>{t||r(e=>e??String(rd++))},[t]),t||(n?`radix-${n}`:"")}var id=e[" useInsertionEffect ".trim().toString()]||td;function ad({prop:t,defaultProp:n,onChange:r=()=>{},caller:o}){const[i,a,s]=function({defaultProp:t,onChange:n}){const[r,o]=e.useState(t),i=e.useRef(r),a=e.useRef(n);return id(()=>{a.current=n},[n]),e.useEffect(()=>{i.current!==r&&(a.current?.(r),i.current=r)},[r,i]),[r,o,a]}({defaultProp:n,onChange:r}),l=void 0!==t,c=l?t:i;{const n=e.useRef(void 0!==t);e.useEffect(()=>{const e=n.current;if(e!==l){const t=e?"controlled":"uncontrolled",n=l?"controlled":"uncontrolled";console.warn(`${o} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}n.current=l},[l,o])}const d=e.useCallback(e=>{if(l){const n=function(e){return"function"==typeof e}(e)?e(t):e;n!==t&&s.current?.(n)}else a(e)},[l,t,a,s]);return[c,d]}function sd(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function ld(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function cd(...e){return t=>{let n=!1;const r=e.map(e=>{const r=ld(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():ld(e[t],null)}}}}function dd(...t){return e.useCallback(cd(...t),t)}function ud(t){const n=e.forwardRef((t,n)=>{const{children:r,...o}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),i=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{const t=i(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==e.Fragment&&(i.ref=n?cd(n,t):t),e.cloneElement(r,i)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var pd=Symbol("radix.slottable");function fd(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===pd}var md=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=function(t){const n=ud(t),r=e.forwardRef((t,r)=>{const{children:o,...i}=t,a=e.Children.toArray(o),s=a.find(fd);if(s){const t=s.props.children,o=a.map(n=>n===s?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return m(n,{...i,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,o):null})}return m(n,{...i,ref:r,children:o})});return r.displayName=`${t}.Slot`,r}(`Primitive.${n}`),o=e.forwardRef((e,t)=>{const{asChild:o,...i}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),m(a,{...i,ref:t})});return o.displayName=`Primitive.${n}`,{...t,[n]:o}},{});var hd,gd="dismissableLayer.update",vd="dismissableLayer.pointerDownOutside",bd="dismissableLayer.focusOutside",yd=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wd=e.forwardRef((t,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...c}=t,d=e.useContext(yd),[u,p]=e.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=e.useState({}),g=dd(n,e=>p(e)),v=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=u?v.indexOf(u):-1,E=d.layersWithOutsidePointerEventsDisabled.size>0,x=w>=y,S=function(t,n=globalThis?.document){const r=Aa(t),o=e.useRef(!1),i=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!o.current){let t=function(){xd(vd,r,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",i.current),i.current=t,n.addEventListener("click",i.current,{once:!0})):t()}else n.removeEventListener("click",i.current);o.current=!1},t=window.setTimeout(()=>{n.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",i.current)}},[n,r]),{onPointerDownCapture:()=>o.current=!0}}(e=>{const t=e.target,n=[...d.branches].some(e=>e.contains(t));x&&!n&&(i?.(e),s?.(e),e.defaultPrevented||l?.())},f),T=function(t,n=globalThis?.document){const r=Aa(t),o=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!o.current){xd(bd,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}(e=>{const t=e.target;[...d.branches].some(e=>e.contains(t))||(a?.(e),s?.(e),e.defaultPrevented||l?.())},f);return za(e=>{w===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},f),e.useEffect(()=>{if(u)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(hd=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),Ed(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=hd)}},[u,f,r,d]),e.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),Ed())},[u,d]),e.useEffect(()=>{const e=()=>h({});return document.addEventListener(gd,e),()=>document.removeEventListener(gd,e)},[]),m(md.div,{...c,ref:g,style:{pointerEvents:E?x?"auto":"none":void 0,...t.style},onFocusCapture:sd(t.onFocusCapture,T.onFocusCapture),onBlurCapture:sd(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:sd(t.onPointerDownCapture,S.onPointerDownCapture)})});wd.displayName="DismissableLayer";function Ed(){const e=new CustomEvent(gd);document.dispatchEvent(e)}function xd(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}(o,i):o.dispatchEvent(i)}e.forwardRef((t,n)=>{const r=e.useContext(yd),o=e.useRef(null),i=dd(n,o);return e.useEffect(()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),m(md.div,{...t,ref:i})}).displayName="DismissableLayerBranch";var Sd=t=>{const{present:n,children:r}=t,o=function(t){const[n,r]=e.useState(),o=e.useRef(null),i=e.useRef(t),a=e.useRef("none"),s=t?"mounted":"unmounted",[l,c]=function(t,n){return e.useReducer((e,t)=>n[e][t]??e,t)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=Td(o.current);a.current="mounted"===l?e:"none"},[l]),td(()=>{const e=o.current,n=i.current;if(n!==t){const r=a.current,o=Td(e);if(t)c("MOUNT");else if("none"===o||"none"===e?.display)c("UNMOUNT");else{c(n&&r!==o?"ANIMATION_OUT":"UNMOUNT")}i.current=t}},[t,c]),td(()=>{if(n){let e;const t=n.ownerDocument.defaultView??window,r=r=>{const a=Td(o.current).includes(r.animationName);if(r.target===n&&a&&(c("ANIMATION_END"),!i.current)){const r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},s=e=>{e.target===n&&(a.current=Td(o.current))};return n.addEventListener("animationstart",s),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",s),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{o.current=e?getComputedStyle(e):null,r(e)},[])}}(n),i="function"==typeof r?r({present:o.isPresent}):e.Children.only(r),a=Qc(o.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof r||o.isPresent?e.cloneElement(i,{ref:a}):null};function Td(e){return e?.animationName||"none"}function Od(t){const n=Cd(t),r=e.forwardRef((t,r)=>{const{children:o,...i}=t,a=e.Children.toArray(o),s=a.find(Nd);if(s){const t=s.props.children,o=a.map(n=>n===s?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return m(n,{...i,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,o):null})}return m(n,{...i,ref:r,children:o})});return r.displayName=`${t}.Slot`,r}function Cd(t){const n=e.forwardRef((t,n)=>{const{children:r,...o}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r),i=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{const t=i(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==e.Fragment&&(i.ref=n?Jc(n,t):t),e.cloneElement(r,i)}return e.Children.count(r)>1?e.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}Sd.displayName="Presence";var Pd=Symbol("radix.slottable");function Nd(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===Pd}var kd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const r=Od(`Primitive.${n}`),o=e.forwardRef((e,t)=>{const{asChild:o,...i}=e,a=o?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),m(a,{...i,ref:t})});return o.displayName=`Primitive.${n}`,{...t,[n]:o}},{}),Md=0;function Id(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Dd="Dialog",[Rd,Ad]=function(t,n=[]){let r=[];const o=()=>{const n=r.map(t=>e.createContext(t));return function(r){const o=r?.[t]||n;return e.useMemo(()=>({[`__scope${t}`]:{...r,[t]:o}}),[r,o])}};return o.scopeName=t,[function(n,o){const i=e.createContext(o),a=r.length;r=[...r,o];const s=n=>{const{scope:r,children:o,...s}=n,l=r?.[t]?.[a]||i,c=e.useMemo(()=>s,Object.values(s));return m(l.Provider,{value:c,children:o})};return s.displayName=n+"Provider",[s,function(r,s){const l=s?.[t]?.[a]||i,c=e.useContext(l);if(c)return c;if(void 0!==o)return o;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},ed(o,...n)]}(Dd),[zd,_d]=Rd(Dd),Ld=t=>{const{__scopeDialog:n,children:r,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,l=e.useRef(null),c=e.useRef(null),[d,u]=ad({prop:o,defaultProp:i??!1,onChange:a,caller:Dd});return m(zd,{scope:n,triggerRef:l,contentRef:c,contentId:od(),titleId:od(),descriptionId:od(),open:d,onOpenChange:u,onOpenToggle:e.useCallback(()=>u(e=>!e),[u]),modal:s,children:r})};Ld.displayName=Dd;var $d="DialogTrigger";e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_d($d,n),i=Qc(t,o.triggerRef);return m(kd.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ou(o.open),...r,ref:i,onClick:Kc(e.onClick,o.onOpenToggle)})}).displayName=$d;var jd="DialogPortal",[Fd,Wd]=Rd(jd,{forceMount:void 0}),Bd=t=>{const{__scopeDialog:n,forceMount:r,children:o,container:i}=t,a=_d(jd,n);return m(Fd,{scope:n,forceMount:r,children:e.Children.map(o,e=>m(Sd,{present:r||a.open,children:m(es,{asChild:!0,container:i,children:e})}))})};Bd.displayName=jd;var Hd="DialogOverlay",Vd=e.forwardRef((e,t)=>{const n=Wd(Hd,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=_d(Hd,e.__scopeDialog);return i.modal?m(Sd,{present:r||i.open,children:m(Yd,{...o,ref:t})}):null});Vd.displayName=Hd;var Ud=Od("DialogOverlay.RemoveScroll"),Yd=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_d(Hd,n);return m(Hs,{as:Ud,allowPinchZoom:!0,shards:[o.contentRef],children:m(kd.div,{"data-state":ou(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Gd="DialogContent",qd=e.forwardRef((e,t)=>{const n=Wd(Gd,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=_d(Gd,e.__scopeDialog);return m(Sd,{present:r||i.open,children:i.modal?m(Xd,{...o,ref:t}):m(Kd,{...o,ref:t})})});qd.displayName=Gd;var Xd=e.forwardRef((t,n)=>{const r=_d(Gd,t.__scopeDialog),o=e.useRef(null),i=Qc(n,r.contentRef,o);return e.useEffect(()=>{const e=o.current;if(e)return Ks(e)},[]),m(Zd,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kc(t.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Kc(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:Kc(t.onFocusOutside,e=>e.preventDefault())})}),Kd=e.forwardRef((t,n)=>{const r=_d(Gd,t.__scopeDialog),o=e.useRef(!1),i=e.useRef(!1);return m(Zd,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(o.current||r.triggerRef.current?.focus(),e.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(o.current=!0,"pointerdown"===e.detail.originalEvent.type&&(i.current=!0));const n=e.target,a=r.triggerRef.current?.contains(n);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&i.current&&e.preventDefault()}})}),Zd=e.forwardRef((t,n)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,...s}=t,l=_d(Gd,r),c=e.useRef(null),d=Qc(n,c);return e.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Id()),document.body.insertAdjacentElement("beforeend",e[1]??Id()),Md++,()=>{1===Md&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Md--}},[]),g(h,{children:[m(Ga,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:a,children:m(wd,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ou(l.open),...s,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),g(h,{children:[m(lu,{titleId:l.titleId}),m(cu,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Jd="DialogTitle",Qd=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_d(Jd,n);return m(kd.h2,{id:o.titleId,...r,ref:t})});Qd.displayName=Jd;var eu="DialogDescription",tu=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_d(eu,n);return m(kd.p,{id:o.descriptionId,...r,ref:t})});tu.displayName=eu;var nu="DialogClose",ru=e.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_d(nu,n);return m(kd.button,{type:"button",...r,ref:t,onClick:Kc(e.onClick,()=>o.onOpenChange(!1))})});function ou(e){return e?"open":"closed"}ru.displayName=nu;var iu="DialogTitleWarning",[au,su]=function(t,n){const r=e.createContext(n),o=t=>{const{children:n,...o}=t,i=e.useMemo(()=>o,Object.values(o));return m(r.Provider,{value:i,children:n})};return o.displayName=t+"Provider",[o,function(o){const i=e.useContext(r);if(i)return i;if(void 0!==n)return n;throw new Error(`\`${o}\` must be used within \`${t}\``)}]}(iu,{contentName:Gd,titleName:Jd,docsSlug:"dialog"}),lu=({titleId:t})=>{const n=su(iu),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return e.useEffect(()=>{if(t){document.getElementById(t)||console.error(r)}},[r,t]),null},cu=({contentRef:t,descriptionId:n})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${su("DialogDescriptionWarning").contentName}}.`;return e.useEffect(()=>{const e=t.current?.getAttribute("aria-describedby");if(n&&e){document.getElementById(n)||console.warn(r)}},[r,t,n]),null},du=Ld,uu=Bd,pu=Vd,fu=qd,mu=Qd,hu=ru;function gu(t){return e.createElement(du,Object.assign({"data-slot":"dialog"},t))}function vu(t){var n=S(t,[]);return e.createElement(uu,Object.assign({"data-slot":"dialog-portal"},n))}function bu(t){var{className:n}=t,r=S(t,["className"]);return e.createElement(pu,Object.assign({"data-slot":"dialog-overlay",className:Et("fixed inset-0 z-50 bg-black/50",n)},r))}function yu(t){var{className:n,children:r,showCloseButton:o=!0,container:i}=t,a=S(t,["className","children","showCloseButton","container"]);return e.createElement(vu,{"data-slot":"dialog-portal",container:i},e.createElement(bu,null),e.createElement(fu,Object.assign({"data-slot":"dialog-content",style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",outline:"none"},className:Et("fixed","z-50 grid w-full max-w-lg sm:mx-0 gap-4 p-6",n)},a),r,o&&e.createElement(hu,{"data-slot":"dialog-close",style:{right:"calc(var(--spacing) * 4)",top:"calc(var(--spacing) * 4)",outline:"none"},className:Et("absolute right-4 top-4 rounded opacity-70 transition-opacity","hover:opacity-100 focus:outline-none","focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:pointer-events-none"),"aria-label":"Close"},e.createElement(Kt,{className:"h-4 w-4 pointer-events-none shrink-0",style:{height:"calc(var(--spacing) * 4)",width:"calc(var(--spacing) * 4)"}}))))}function wu(t){var{className:n}=t,r=S(t,["className"]);return e.createElement("div",Object.assign({"data-slot":"dialog-header",className:Et("flex flex-col gap-2 text-left",n)},r))}function Eu(t){var{className:n}=t,r=S(t,["className"]);return e.createElement(mu,Object.assign({"data-slot":"dialog-title",className:Et("text-lg leading-none font-semibold",n)},r))}function xu({title:e,children:n,contentClassName:r,hideCloseButton:o=!1,portalContainer:i,description:a}){const{open:s,setOpen:l}=Fc();return t.createElement(gu,{open:s,onOpenChange:l},t.createElement(yu,{container:i,className:r,showCloseButton:!o},e&&t.createElement(wu,null,t.createElement(Eu,{style:{color:"#494949"}},e||""),t.createElement(tu,{style:{color:"#5e5e5e",fontSize:"12.5px"}},a||"")),n))}const Su=({products:e,contentId:n})=>{const r=Rc().width<430||ma.isMobile;return t.createElement("div",{onWheel:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),className:"grid gap-2 "+(r?"grid-cols-1":"grid-cols-2"),style:{fontSize:13}},e.map(r=>t.createElement(Wc,{key:r.productId,product:r,hideMoreBadge:!0,productLength:e.length,contentId:n})))},{PLAYER_BACK_BASE_URL:Tu}=gt(),Ou=({widgetPlayerOption:e,setCollectionUuid:n,portalContainer:o})=>{const{player:i}=e,[s,l]=a(null),{collection:c}=na(),{isPreview:d}=Qi(),{onSlideChange:u,onCollectionClose:p}=ra(s,l),{setOpen:f,open:m}=Fc();r(()=>{m||(s&&(p(),l(null)),h&&g(null))},[m]);const[h,g]=a();return t.createElement(t.Fragment,null,c&&t.createElement(Gc,Object.assign({collection:c},e,{onThumbnailClick:e=>T(void 0,void 0,void 0,function*(){if(i===$e.POPUP){const t=Ct(),r=Ct();if(n(r),l(Object.assign(Object.assign({},c.contents.find(t=>t.shortsId===e)),{uuid:t})),f(!0),d)return;yield Promise.all([ji({contentId:c.colId,uuid:r,type:wt.COLLECTION,userId:c.userId,isFirstPlay:!Pt(c.colId)}),ji({contentId:e,uuid:t,type:wt.SHORTS,userId:c.userId,isFirstPlay:!Pt(e)})])}else{const t=(e=>{switch(e){case $e.HORIZONTAL:return Fe.HORIZONTAL;case $e.VERTICAL:return Fe.VERTICAL;case $e.GRID:return Fe.PRODUCTS;case $e.TABLET:return Fe.TABLET;default:return Fe.PLATFORM}})(i),n=null==c?void 0:c.contents.findIndex(t=>t.shortsId===e);let r="";n&&n>1&&(r=(null==c?void 0:c.contents[n-1].shortsId)||""),open(`${Tu}/collection/${c.colId}?nextKey=${r}&layout=${t}`)}}),setSelectedProducts:g})),h&&t.createElement(xu,{portalContainer:o,title:"상품 목록",contentClassName:"bg-white rounded p-4 product-dialog-container",description:"상품 정보를 확인해 보세요"},t.createElement(Su,{products:h.productsInfo,contentId:h.shortsId})),c&&s&&t.createElement(xu,{portalContainer:o,hideCloseButton:!0,contentClassName:"w-full max-w-none p-0 mx-0"},t.createElement($c,{collection:c,initialShortsId:s.shortsId,onClosePlayer:()=>T(void 0,void 0,void 0,function*(){p(),f(!1)}),onSlideChange:u})))};var Cu,Pu={exports:{}},Nu={exports:{}},ku={};var Mu,Iu,Du,Ru,Au,zu,_u,Lu,$u,ju,Fu,Wu,Bu,Hu,Vu,Uu={};
27
+ */function ar(t,r=[]){let i=[];const n=()=>{const r=i.map(t=>e.createContext(t));return function(i){const n=i?.[t]||r;return e.useMemo(()=>({[`__scope${t}`]:{...i,[t]:n}}),[i,n])}};return n.scopeName=t,[function(r,n){const s=e.createContext(n),a=i.length;i=[...i,n];const o=r=>{const{scope:i,children:n,...o}=r,l=i?.[t]?.[a]||s,d=e.useMemo(()=>o,Object.values(o));return p(l.Provider,{value:d,children:n})};return o.displayName=r+"Provider",[o,function(i,o){const l=o?.[t]?.[a]||s,d=e.useContext(l);if(d)return d;if(void 0!==n)return n;throw new Error(`\`${i}\` must be used within \`${r}\``)}]},or(n,...r)]}function or(...t){const r=t[0];if(1===t.length)return r;const i=()=>{const i=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const n=i.reduce((e,{useScope:r,scopeName:i})=>({...e,...r(t)[`__scope${i}`]}),{});return e.useMemo(()=>({[`__scope${r.scopeName}`]:n}),[n])}};return i.scopeName=r.scopeName,i}function lr(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function dr(...e){return t=>{let r=!1;const i=e.map(e=>{const i=lr(e,t);return r||"function"!=typeof i||(r=!0),i});if(r)return()=>{for(let t=0;t<i.length;t++){const r=i[t];"function"==typeof r?r():lr(e[t],null)}}}}function cr(...t){return e.useCallback(dr(...t),t)}var ur=e.forwardRef((t,r)=>{const{children:i,...n}=t,s=e.Children.toArray(i),a=s.find(pr);if(a){const t=a.props.children,i=s.map(r=>r===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r);return p(hr,{...n,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return p(hr,{...n,ref:r,children:i})});ur.displayName="Slot";var hr=e.forwardRef((t,r)=>{const{children:i,...n}=t;if(e.isValidElement(i)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i),s=function(e,t){const r={...t};for(const i in t){const n=e[i],s=t[i];/^on[A-Z]/.test(i)?n&&s?r[i]=(...e)=>{s(...e),n(...e)}:n&&(r[i]=n):"style"===i?r[i]={...n,...s}:"className"===i&&(r[i]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}(n,i.props);return i.type!==e.Fragment&&(s.ref=r?dr(r,t):t),e.cloneElement(i,s)}return e.Children.count(i)>1?e.Children.only(null):null});hr.displayName="SlotClone";var fr=({children:e})=>p(m,{children:e});function pr(t){return e.isValidElement(t)&&t.type===fr}function mr(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function gr(...e){return t=>{let r=!1;const i=e.map(e=>{const i=mr(e,t);return r||"function"!=typeof i||(r=!0),i});if(r)return()=>{for(let t=0;t<i.length;t++){const r=i[t];"function"==typeof r?r():mr(e[t],null)}}}}function vr(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),!1===r||!i.defaultPrevented)return t?.(i)}}function yr(t){const r=e.useRef(t);return e.useEffect(()=>{r.current=t}),e.useMemo(()=>(...e)=>r.current?.(...e),[])}function br({prop:t,defaultProp:r,onChange:i=()=>{}}){const[n,s]=function({defaultProp:t,onChange:r}){const i=e.useState(t),[n]=i,s=e.useRef(n),a=yr(r);return e.useEffect(()=>{s.current!==n&&(a(n),s.current=n)},[n,s,a]),i}({defaultProp:r,onChange:i}),a=void 0!==t,o=a?t:n,l=yr(i);return[o,e.useCallback(e=>{if(a){const r="function"==typeof e?e(t):e;r!==t&&l(r)}else s(e)},[a,t,s,l])]}var Er=e.forwardRef((t,r)=>{const{children:i,...n}=t,s=e.Children.toArray(i),a=s.find(Tr);if(a){const t=a.props.children,i=s.map(r=>r===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r);return p(wr,{...n,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return p(wr,{...n,ref:r,children:i})});Er.displayName="Slot";var wr=e.forwardRef((t,r)=>{const{children:i,...n}=t;if(e.isValidElement(i)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i),s=function(e,t){const r={...t};for(const i in t){const n=e[i],s=t[i];/^on[A-Z]/.test(i)?n&&s?r[i]=(...e)=>{s(...e),n(...e)}:n&&(r[i]=n):"style"===i?r[i]={...n,...s}:"className"===i&&(r[i]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}(n,i.props);return i.type!==e.Fragment&&(s.ref=r?gr(r,t):t),e.cloneElement(i,s)}return e.Children.count(i)>1?e.Children.only(null):null});wr.displayName="SlotClone";var Sr=({children:e})=>p(m,{children:e});function Tr(t){return e.isValidElement(t)&&t.type===Sr}var xr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((t,r)=>{const i=e.forwardRef((e,t)=>{const{asChild:i,...n}=e,s=i?Er:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),p(s,{...n,ref:t})});return i.displayName=`Primitive.${r}`,{...t,[r]:i}},{}),Ar=Boolean(globalThis?.document)?e.useLayoutEffect:()=>{};function kr(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Lr(...e){return t=>{let r=!1;const i=e.map(e=>{const i=kr(e,t);return r||"function"!=typeof i||(r=!0),i});if(r)return()=>{for(let t=0;t<i.length;t++){const r=i[t];"function"==typeof r?r():kr(e[t],null)}}}}function Ir(...t){return e.useCallback(Lr(...t),t)}var Rr=e.forwardRef((t,r)=>{const{children:i,...n}=t,s=e.Children.toArray(i),a=s.find(Cr);if(a){const t=a.props.children,i=s.map(r=>r===a?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r);return p(Pr,{...n,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,i):null})}return p(Pr,{...n,ref:r,children:i})});Rr.displayName="Slot";var Pr=e.forwardRef((t,r)=>{const{children:i,...n}=t;if(e.isValidElement(i)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i),s=function(e,t){const r={...t};for(const i in t){const n=e[i],s=t[i];/^on[A-Z]/.test(i)?n&&s?r[i]=(...e)=>{s(...e),n(...e)}:n&&(r[i]=n):"style"===i?r[i]={...n,...s}:"className"===i&&(r[i]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}(n,i.props);return i.type!==e.Fragment&&(s.ref=r?Lr(r,t):t),e.cloneElement(i,s)}return e.Children.count(i)>1?e.Children.only(null):null});Pr.displayName="SlotClone";var Dr=({children:e})=>p(m,{children:e});function Cr(t){return e.isValidElement(t)&&t.type===Dr}var _r=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((t,r)=>{const i=e.forwardRef((e,t)=>{const{asChild:i,...n}=e,s=i?Rr:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),p(s,{...n,ref:t})});return i.displayName=`Primitive.${r}`,{...t,[r]:i}},{});var Or=t=>{const{present:r,children:i}=t,n=function(t){const[r,i]=e.useState(),n=e.useRef({}),s=e.useRef(t),a=e.useRef("none"),o=t?"mounted":"unmounted",[l,d]=function(t,r){return e.useReducer((e,t)=>r[e][t]??e,t)}(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=Mr(n.current);a.current="mounted"===l?e:"none"},[l]),Ar(()=>{const e=n.current,r=s.current;if(r!==t){const i=a.current,n=Mr(e);if(t)d("MOUNT");else if("none"===n||"none"===e?.display)d("UNMOUNT");else{d(r&&i!==n?"ANIMATION_OUT":"UNMOUNT")}s.current=t}},[t,d]),Ar(()=>{if(r){let e;const t=r.ownerDocument.defaultView??window,i=i=>{const a=Mr(n.current).includes(i.animationName);if(i.target===r&&a&&(d("ANIMATION_END"),!s.current)){const i=r.style.animationFillMode;r.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=i)})}},o=e=>{e.target===r&&(a.current=Mr(n.current))};return r.addEventListener("animationstart",o),r.addEventListener("animationcancel",i),r.addEventListener("animationend",i),()=>{t.clearTimeout(e),r.removeEventListener("animationstart",o),r.removeEventListener("animationcancel",i),r.removeEventListener("animationend",i)}}d("ANIMATION_END")},[r,d]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{e&&(n.current=getComputedStyle(e)),i(e)},[])}}(r),s="function"==typeof i?i({present:n.isPresent}):e.Children.only(i),a=Ir(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof i||n.isPresent?e.cloneElement(s,{ref:a}):null};function Mr(e){return e?.animationName||"none"}Or.displayName="Presence";var Nr=Boolean(globalThis?.document)?e.useLayoutEffect:()=>{},Fr=e["useId".toString()]||(()=>{}),$r=0;function Br(t){const[r,i]=e.useState(Fr());return Nr(()=>{i(e=>e??String($r++))},[t]),r?`radix-${r}`:""}var Ur="Collapsible",[zr,Gr]=ar(Ur),[jr,Hr]=zr(Ur),Vr=e.forwardRef((t,r)=>{const{__scopeCollapsible:i,open:n,defaultOpen:s,disabled:a,onOpenChange:o,...l}=t,[d=!1,c]=br({prop:n,defaultProp:s,onChange:o});return p(jr,{scope:i,disabled:a,contentId:Br(),open:d,onOpenToggle:e.useCallback(()=>c(e=>!e),[c]),children:p(_r.div,{"data-state":Qr(d),"data-disabled":a?"":void 0,...l,ref:r})})});Vr.displayName=Ur;var Wr="CollapsibleTrigger",Yr=e.forwardRef((e,t)=>{const{__scopeCollapsible:r,...i}=e,n=Hr(Wr,r);return p(_r.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":Qr(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...i,ref:t,onClick:vr(e.onClick,n.onOpenToggle)})});Yr.displayName=Wr;var Kr="CollapsibleContent",qr=e.forwardRef((e,t)=>{const{forceMount:r,...i}=e,n=Hr(Kr,e.__scopeCollapsible);return p(Or,{present:r||n.open,children:({present:e})=>p(Xr,{...i,ref:t,present:e})})});qr.displayName=Kr;var Xr=e.forwardRef((t,r)=>{const{__scopeCollapsible:i,present:n,children:s,...a}=t,o=Hr(Kr,i),[l,d]=e.useState(n),c=e.useRef(null),u=Ir(r,c),h=e.useRef(0),f=h.current,m=e.useRef(0),g=m.current,v=o.open||l,y=e.useRef(v),b=e.useRef(void 0);return e.useEffect(()=>{const e=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(e)},[]),Ar(()=>{const e=c.current;if(e){b.current=b.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const t=e.getBoundingClientRect();h.current=t.height,m.current=t.width,y.current||(e.style.transitionDuration=b.current.transitionDuration,e.style.animationName=b.current.animationName),d(n)}},[o.open,n]),p(_r.div,{"data-state":Qr(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!v,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:v&&s})});function Qr(e){return e?"open":"closed"}var Zr=Vr,Jr=Yr,ei=qr,ti=e.createContext(void 0);var ri="Accordion",ii=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ni,si,ai]=function(e){const r=e+"CollectionProvider",[i,n]=ar(r),[s,a]=i(r,{collectionRef:{current:null},itemMap:new Map}),o=e=>{const{scope:r,children:i}=e,n=t.useRef(null),a=t.useRef(new Map).current;return p(s,{scope:r,itemMap:a,collectionRef:n,children:i})};o.displayName=r;const l=e+"CollectionSlot",d=t.forwardRef((e,t)=>{const{scope:r,children:i}=e,n=cr(t,a(l,r).collectionRef);return p(ur,{ref:n,children:i})});d.displayName=l;const c=e+"CollectionItemSlot",u="data-radix-collection-item",h=t.forwardRef((e,r)=>{const{scope:i,children:n,...s}=e,o=t.useRef(null),l=cr(r,o),d=a(c,i);return t.useEffect(()=>(d.itemMap.set(o,{ref:o,...s}),()=>{d.itemMap.delete(o)})),p(ur,{[u]:"",ref:l,children:n})});return h.displayName=c,[{Provider:o,Slot:d,ItemSlot:h},function(r){const i=a(e+"CollectionConsumer",r),n=t.useCallback(()=>{const e=i.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${u}]`)),r=Array.from(i.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[i.collectionRef,i.itemMap]);return n},n]}(ri),[oi,li]=ar(ri,[ai,Gr]),di=Gr(),ci=t.forwardRef((e,t)=>{const{type:r,...i}=e,n=i,s=i;return p(ni.Provider,{scope:e.__scopeAccordion,children:"multiple"===r?p(gi,{...s,ref:t}):p(mi,{...n,ref:t})})});ci.displayName=ri;var[ui,hi]=oi(ri),[fi,pi]=oi(ri,{collapsible:!1}),mi=t.forwardRef((e,r)=>{const{value:i,defaultValue:n,onValueChange:s=()=>{},collapsible:a=!1,...o}=e,[l,d]=br({prop:i,defaultProp:n,onChange:s});return p(ui,{scope:e.__scopeAccordion,value:l?[l]:[],onItemOpen:d,onItemClose:t.useCallback(()=>a&&d(""),[a,d]),children:p(fi,{scope:e.__scopeAccordion,collapsible:a,children:p(bi,{...o,ref:r})})})}),gi=t.forwardRef((e,r)=>{const{value:i,defaultValue:n,onValueChange:s=()=>{},...a}=e,[o=[],l]=br({prop:i,defaultProp:n,onChange:s}),d=t.useCallback(e=>l((t=[])=>[...t,e]),[l]),c=t.useCallback(e=>l((t=[])=>t.filter(t=>t!==e)),[l]);return p(ui,{scope:e.__scopeAccordion,value:o,onItemOpen:d,onItemClose:c,children:p(fi,{scope:e.__scopeAccordion,collapsible:!0,children:p(bi,{...a,ref:r})})})}),[vi,yi]=oi(ri),bi=t.forwardRef((r,i)=>{const{__scopeAccordion:n,disabled:s,dir:a,orientation:o="vertical",...l}=r,d=function(...t){return e.useCallback(gr(...t),t)}(t.useRef(null),i),c=si(n),u="ltr"===function(t){const r=e.useContext(ti);return t||r||"ltr"}(a),h=vr(r.onKeyDown,e=>{if(!ii.includes(e.key))return;const t=e.target,r=c().filter(e=>!e.ref.current?.disabled),i=r.findIndex(e=>e.ref.current===t),n=r.length;if(-1===i)return;e.preventDefault();let s=i;const a=n-1,l=()=>{s=i+1,s>a&&(s=0)},d=()=>{s=i-1,s<0&&(s=a)};switch(e.key){case"Home":s=0;break;case"End":s=a;break;case"ArrowRight":"horizontal"===o&&(u?l():d());break;case"ArrowDown":"vertical"===o&&l();break;case"ArrowLeft":"horizontal"===o&&(u?d():l());break;case"ArrowUp":"vertical"===o&&d()}const h=s%n;r[h].ref.current?.focus()});return p(vi,{scope:n,disabled:s,direction:a,orientation:o,children:p(ni.Slot,{scope:n,children:p(xr.div,{...l,"data-orientation":o,ref:d,onKeyDown:s?void 0:h})})})}),Ei="AccordionItem",[wi,Si]=oi(Ei),Ti=t.forwardRef((e,t)=>{const{__scopeAccordion:r,value:i,...n}=e,s=yi(Ei,r),a=hi(Ei,r),o=di(r),l=Br(),d=i&&a.value.includes(i)||!1,c=s.disabled||e.disabled;return p(wi,{scope:r,open:d,disabled:c,triggerId:l,children:p(Zr,{"data-orientation":s.orientation,"data-state":Pi(d),...o,...n,ref:t,disabled:c,open:d,onOpenChange:e=>{e?a.onItemOpen(i):a.onItemClose(i)}})})});Ti.displayName=Ei;var xi="AccordionHeader",Ai=t.forwardRef((e,t)=>{const{__scopeAccordion:r,...i}=e,n=yi(ri,r),s=Si(xi,r);return p(xr.h3,{"data-orientation":n.orientation,"data-state":Pi(s.open),"data-disabled":s.disabled?"":void 0,...i,ref:t})});Ai.displayName=xi;var ki="AccordionTrigger",Li=t.forwardRef((e,t)=>{const{__scopeAccordion:r,...i}=e,n=yi(ri,r),s=Si(ki,r),a=pi(ki,r),o=di(r);return p(ni.ItemSlot,{scope:r,children:p(Jr,{"aria-disabled":s.open&&!a.collapsible||void 0,"data-orientation":n.orientation,id:s.triggerId,...o,...i,ref:t})})});Li.displayName=ki;var Ii="AccordionContent",Ri=t.forwardRef((e,t)=>{const{__scopeAccordion:r,...i}=e,n=yi(ri,r),s=Si(Ii,r),a=di(r);return p(ei,{role:"region","aria-labelledby":s.triggerId,"data-orientation":n.orientation,...a,...i,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function Pi(e){return e?"open":"closed"}Ri.displayName=Ii;var Di=ci,Ci=Ti,_i=Ai,Oi=Li,Mi=Ri;function Ni(t){var r=T(t,[]);return e.createElement(Di,Object.assign({"data-slot":"accordion"},r))}function Fi(t){var{className:r}=t,i=T(t,["className"]);return e.createElement(Ci,Object.assign({"data-slot":"accordion-item",className:wt("border-b last:border-b-0",r)},i))}function $i(t){var{className:r,children:i}=t,n=T(t,["className","children"]);return e.createElement(_i,{className:"flex"},e.createElement(Oi,Object.assign({"data-slot":"accordion-trigger",className:wt("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",r)},n),i,e.createElement(Ut,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})))}function Bi(t){var{className:r,children:i}=t,n=T(t,["className","children"]);return e.createElement(Mi,Object.assign({"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"},n),e.createElement("div",{className:wt("pt-0 pb-4",r)},i))}const Ui=({title:e,content:r})=>t.createElement(Ni,{style:{borderRadius:"0.625rem"},type:"single",collapsible:!0,className:"bg-white px-4",defaultValue:"item"},t.createElement(Fi,{value:"item"},t.createElement($i,{className:""},e),t.createElement(Bi,{className:"text-gray-700"},r))),zi=({logo:e})=>t.createElement("div",{className:"w-full bg-zinc-700 h-[60px] flex"},t.createElement("div",{className:"my-0 mx-auto w-full px-[24px] flex items-center justify-between"},e?t.createElement("div",{className:"h-10"},t.createElement("img",{src:e.thumbPath,alt:e.logoName,width:100,height:100,className:"object-contain w-full h-full"})):t.createElement("div",null),t.createElement("button",{className:"text-white cursor-pointer"},t.createElement(Xt,null)))),Gi=e=>{const{playerSettings:r,shortform:{description:i,productsInfo:n,logo:s,brand:a,title:o},player:l}=e;return t.createElement("div",{className:"w-full h-full bg-[#f4f4f4] overflow-scroll"},t.createElement(zi,{logo:s}),t.createElement("div",{className:" w-full h-full flex justify-between p-10 gap-10"},t.createElement("div",{className:""},t.createElement("div",{className:"flex gap-4 w-full mb-2 h-[125px] flex-col"},a?t.createElement("div",{className:"items-center flex gap-3"},a.thumbPath&&t.createElement("div",{className:"w-16 h-16 bg-white rounded-full border "},t.createElement("img",{src:a.thumbPath,alt:a.brandName,width:100,height:100,className:"object-contain w-full h-full rounded-full"})),t.createElement("div",null,t.createElement("p",null,a.brandName),t.createElement("p",{className:"text-lg font-semibold"},o))):t.createElement("p",{className:"text-xl font-semibold"},o),t.createElement(Qt,null)),t.createElement("div",{className:"w-full pb-10 flex gap-4 justify-center"},t.createElement("div",{className:"flex gap-3"},l),t.createElement("div",{className:"flex flex-col gap-4 justify-end"},t.createElement(ir,{rounded:!0}),t.createElement(nr,{rounded:!0}),t.createElement(sr,{rounded:!0})))),t.createElement("div",{className:"flex flex-col gap-4 max-w-[40%]"},i&&t.createElement(Ui,{title:"숏클립 안내",content:t.createElement("p",{className:"font-medium"},i)}),t.createElement(Ui,{title:"상품 목록",content:t.createElement(t.Fragment,null,t.createElement("div",{className:"max-h-[300px] overflow-y-auto font-medium"},n.map((e,r)=>t.createElement(t.Fragment,null,t.createElement(er,{product:e}),r!==n.length-1&&t.createElement("div",{className:"h-1 w-full border-t my-2"})))),t.createElement("button",{className:"w-full mt-3 border rounded py-2 px-4 cursor-pointer",disabled:!(null==n?void 0:n.length)},"상품 전체 보기"))}),r.comment&&t.createElement(Ui,{title:"댓글",content:t.createElement(tr,null)}))))};function ji(e){return null!==e&&"object"==typeof e&&"constructor"in e&&e.constructor===Object}function Hi(e,t){void 0===e&&(e={}),void 0===t&&(t={}),Object.keys(t).forEach(r=>{void 0===e[r]?e[r]=t[r]:ji(t[r])&&ji(e[r])&&Object.keys(t[r]).length>0&&Hi(e[r],t[r])})}const Vi={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector:()=>null,querySelectorAll:()=>[],getElementById:()=>null,createEvent:()=>({initEvent(){}}),createElement:()=>({children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName:()=>[]}),createElementNS:()=>({}),importNode:()=>null,location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function Wi(){const e="undefined"!=typeof document?document:{};return Hi(e,Vi),e}const Yi={document:Vi,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle:()=>({getPropertyValue:()=>""}),Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia:()=>({}),requestAnimationFrame:e=>"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0),cancelAnimationFrame(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function Ki(){const e="undefined"!=typeof window?window:{};return Hi(e,Yi),e}function qi(e,t){return void 0===t&&(t=0),setTimeout(e,t)}function Xi(){return Date.now()}function Qi(e,t){void 0===t&&(t="x");const r=Ki();let i,n,s;const a=function(e){const t=Ki();let r;return t.getComputedStyle&&(r=t.getComputedStyle(e,null)),!r&&e.currentStyle&&(r=e.currentStyle),r||(r=e.style),r}(e);return r.WebKitCSSMatrix?(n=a.transform||a.webkitTransform,n.split(",").length>6&&(n=n.split(", ").map(e=>e.replace(",",".")).join(", ")),s=new r.WebKitCSSMatrix("none"===n?"":n)):(s=a.MozTransform||a.OTransform||a.MsTransform||a.msTransform||a.transform||a.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),i=s.toString().split(",")),"x"===t&&(n=r.WebKitCSSMatrix?s.m41:16===i.length?parseFloat(i[12]):parseFloat(i[4])),"y"===t&&(n=r.WebKitCSSMatrix?s.m42:16===i.length?parseFloat(i[13]):parseFloat(i[5])),n||0}function Zi(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)}function Ji(e){return"undefined"!=typeof window&&void 0!==window.HTMLElement?e instanceof HTMLElement:e&&(1===e.nodeType||11===e.nodeType)}function en(){const e=Object(arguments.length<=0?void 0:arguments[0]),t=["__proto__","constructor","prototype"];for(let r=1;r<arguments.length;r+=1){const i=r<0||arguments.length<=r?void 0:arguments[r];if(null!=i&&!Ji(i)){const r=Object.keys(Object(i)).filter(e=>t.indexOf(e)<0);for(let t=0,n=r.length;t<n;t+=1){const n=r[t],s=Object.getOwnPropertyDescriptor(i,n);void 0!==s&&s.enumerable&&(Zi(e[n])&&Zi(i[n])?i[n].__swiper__?e[n]=i[n]:en(e[n],i[n]):!Zi(e[n])&&Zi(i[n])?(e[n]={},i[n].__swiper__?e[n]=i[n]:en(e[n],i[n])):e[n]=i[n])}}}return e}function tn(e,t,r){e.style.setProperty(t,r)}function rn(e){let{swiper:t,targetPosition:r,side:i}=e;const n=Ki(),s=-t.translate;let a,o=null;const l=t.params.speed;t.wrapperEl.style.scrollSnapType="none",n.cancelAnimationFrame(t.cssModeFrameID);const d=r>s?"next":"prev",c=(e,t)=>"next"===d&&e>=t||"prev"===d&&e<=t,u=()=>{a=(new Date).getTime(),null===o&&(o=a);const e=Math.max(Math.min((a-o)/l,1),0),d=.5-Math.cos(e*Math.PI)/2;let h=s+d*(r-s);if(c(h,r)&&(h=r),t.wrapperEl.scrollTo({[i]:h}),c(h,r))return t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout(()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[i]:h})}),void n.cancelAnimationFrame(t.cssModeFrameID);t.cssModeFrameID=n.requestAnimationFrame(u)};u()}function nn(e){return e.querySelector(".swiper-slide-transform")||e.shadowRoot&&e.shadowRoot.querySelector(".swiper-slide-transform")||e}function sn(e,t){void 0===t&&(t="");const r=[...e.children];return e instanceof HTMLSlotElement&&r.push(...e.assignedElements()),t?r.filter(e=>e.matches(t)):r}function an(e){try{return void console.warn(e)}catch(e){}}function on(e,t){void 0===t&&(t=[]);const r=document.createElement(e);return r.classList.add(...Array.isArray(t)?t:function(e){return void 0===e&&(e=""),e.trim().split(" ").filter(e=>!!e.trim())}(t)),r}function ln(e,t){return Ki().getComputedStyle(e,null).getPropertyValue(t)}function dn(e){let t,r=e;if(r){for(t=0;null!==(r=r.previousSibling);)1===r.nodeType&&(t+=1);return t}}function cn(e,t,r){const i=Ki();return e["width"===t?"offsetWidth":"offsetHeight"]+parseFloat(i.getComputedStyle(e,null).getPropertyValue("width"===t?"margin-right":"margin-top"))+parseFloat(i.getComputedStyle(e,null).getPropertyValue("width"===t?"margin-left":"margin-bottom"))}function un(e){return(Array.isArray(e)?e:[e]).filter(e=>!!e)}let hn,fn,pn;function mn(){return hn||(hn=function(){const e=Ki(),t=Wi();return{smoothScroll:t.documentElement&&t.documentElement.style&&"scrollBehavior"in t.documentElement.style,touch:!!("ontouchstart"in e||e.DocumentTouch&&t instanceof e.DocumentTouch)}}()),hn}function gn(e){return void 0===e&&(e={}),fn||(fn=function(e){let{userAgent:t}=void 0===e?{}:e;const r=mn(),i=Ki(),n=i.navigator.platform,s=t||i.navigator.userAgent,a={ios:!1,android:!1},o=i.screen.width,l=i.screen.height,d=s.match(/(Android);?[\s\/]+([\d.]+)?/);let c=s.match(/(iPad).*OS\s([\d_]+)/);const u=s.match(/(iPod)(.*OS\s([\d_]+))?/),h=!c&&s.match(/(iPhone\sOS|iOS)\s([\d_]+)/),f="Win32"===n;let p="MacIntel"===n;return!c&&p&&r.touch&&["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"].indexOf(`${o}x${l}`)>=0&&(c=s.match(/(Version)\/([\d.]+)/),c||(c=[0,1,"13_0_0"]),p=!1),d&&!f&&(a.os="android",a.android=!0),(c||h||u)&&(a.os="ios",a.ios=!0),a}(e)),fn}function vn(){return pn||(pn=function(){const e=Ki(),t=gn();let r=!1;function i(){const t=e.navigator.userAgent.toLowerCase();return t.indexOf("safari")>=0&&t.indexOf("chrome")<0&&t.indexOf("android")<0}if(i()){const t=String(e.navigator.userAgent);if(t.includes("Version/")){const[e,i]=t.split("Version/")[1].split(" ")[0].split(".").map(e=>Number(e));r=e<16||16===e&&i<2}}const n=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(e.navigator.userAgent),s=i();return{isSafari:r||s,needPerspectiveFix:r,need3dFix:s||n&&t.ios,isWebView:n}}()),pn}var yn={on(e,t,r){const i=this;if(!i.eventsListeners||i.destroyed)return i;if("function"!=typeof t)return i;const n=r?"unshift":"push";return e.split(" ").forEach(e=>{i.eventsListeners[e]||(i.eventsListeners[e]=[]),i.eventsListeners[e][n](t)}),i},once(e,t,r){const i=this;if(!i.eventsListeners||i.destroyed)return i;if("function"!=typeof t)return i;function n(){i.off(e,n),n.__emitterProxy&&delete n.__emitterProxy;for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];t.apply(i,s)}return n.__emitterProxy=t,i.on(e,n,r)},onAny(e,t){const r=this;if(!r.eventsListeners||r.destroyed)return r;if("function"!=typeof e)return r;const i=t?"unshift":"push";return r.eventsAnyListeners.indexOf(e)<0&&r.eventsAnyListeners[i](e),r},offAny(e){const t=this;if(!t.eventsListeners||t.destroyed)return t;if(!t.eventsAnyListeners)return t;const r=t.eventsAnyListeners.indexOf(e);return r>=0&&t.eventsAnyListeners.splice(r,1),t},off(e,t){const r=this;return!r.eventsListeners||r.destroyed?r:r.eventsListeners?(e.split(" ").forEach(e=>{void 0===t?r.eventsListeners[e]=[]:r.eventsListeners[e]&&r.eventsListeners[e].forEach((i,n)=>{(i===t||i.__emitterProxy&&i.__emitterProxy===t)&&r.eventsListeners[e].splice(n,1)})}),r):r},emit(){const e=this;if(!e.eventsListeners||e.destroyed)return e;if(!e.eventsListeners)return e;let t,r,i;for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];"string"==typeof s[0]||Array.isArray(s[0])?(t=s[0],r=s.slice(1,s.length),i=e):(t=s[0].events,r=s[0].data,i=s[0].context||e),r.unshift(i);return(Array.isArray(t)?t:t.split(" ")).forEach(t=>{e.eventsAnyListeners&&e.eventsAnyListeners.length&&e.eventsAnyListeners.forEach(e=>{e.apply(i,[t,...r])}),e.eventsListeners&&e.eventsListeners[t]&&e.eventsListeners[t].forEach(e=>{e.apply(i,r)})}),e}};const bn=(e,t,r)=>{t&&!e.classList.contains(r)?e.classList.add(r):!t&&e.classList.contains(r)&&e.classList.remove(r)};const En=(e,t,r)=>{t&&!e.classList.contains(r)?e.classList.add(r):!t&&e.classList.contains(r)&&e.classList.remove(r)};const wn=(e,t)=>{if(!e||e.destroyed||!e.params)return;const r=t.closest(e.isElement?"swiper-slide":`.${e.params.slideClass}`);if(r){let t=r.querySelector(`.${e.params.lazyPreloaderClass}`);!t&&e.isElement&&(r.shadowRoot?t=r.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{r.shadowRoot&&(t=r.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`),t&&t.remove())})),t&&t.remove()}},Sn=(e,t)=>{if(!e.slides[t])return;const r=e.slides[t].querySelector('[loading="lazy"]');r&&r.removeAttribute("loading")},Tn=e=>{if(!e||e.destroyed||!e.params)return;let t=e.params.lazyPreloadPrevNext;const r=e.slides.length;if(!r||!t||t<0)return;t=Math.min(t,r);const i="auto"===e.params.slidesPerView?e.slidesPerViewDynamic():Math.ceil(e.params.slidesPerView),n=e.activeIndex;if(e.params.grid&&e.params.grid.rows>1){const r=n,s=[r-t];return s.push(...Array.from({length:t}).map((e,t)=>r+i+t)),void e.slides.forEach((t,r)=>{s.includes(t.column)&&Sn(e,r)})}const s=n+i-1;if(e.params.rewind||e.params.loop)for(let i=n-t;i<=s+t;i+=1){const t=(i%r+r)%r;(t<n||t>s)&&Sn(e,t)}else for(let i=Math.max(n-t,0);i<=Math.min(s+t,r-1);i+=1)i!==n&&(i>s||i<n)&&Sn(e,i)};var xn={updateSize:function(){const e=this;let t,r;const i=e.el;t=void 0!==e.params.width&&null!==e.params.width?e.params.width:i.clientWidth,r=void 0!==e.params.height&&null!==e.params.height?e.params.height:i.clientHeight,0===t&&e.isHorizontal()||0===r&&e.isVertical()||(t=t-parseInt(ln(i,"padding-left")||0,10)-parseInt(ln(i,"padding-right")||0,10),r=r-parseInt(ln(i,"padding-top")||0,10)-parseInt(ln(i,"padding-bottom")||0,10),Number.isNaN(t)&&(t=0),Number.isNaN(r)&&(r=0),Object.assign(e,{width:t,height:r,size:e.isHorizontal()?t:r}))},updateSlides:function(){const e=this;function t(t,r){return parseFloat(t.getPropertyValue(e.getDirectionLabel(r))||0)}const r=e.params,{wrapperEl:i,slidesEl:n,size:s,rtlTranslate:a,wrongRTL:o}=e,l=e.virtual&&r.virtual.enabled,d=l?e.virtual.slides.length:e.slides.length,c=sn(n,`.${e.params.slideClass}, swiper-slide`),u=l?e.virtual.slides.length:c.length;let h=[];const f=[],p=[];let m=r.slidesOffsetBefore;"function"==typeof m&&(m=r.slidesOffsetBefore.call(e));let g=r.slidesOffsetAfter;"function"==typeof g&&(g=r.slidesOffsetAfter.call(e));const v=e.snapGrid.length,y=e.slidesGrid.length;let b=r.spaceBetween,E=-m,w=0,S=0;if(void 0===s)return;"string"==typeof b&&b.indexOf("%")>=0?b=parseFloat(b.replace("%",""))/100*s:"string"==typeof b&&(b=parseFloat(b)),e.virtualSize=-b,c.forEach(e=>{a?e.style.marginLeft="":e.style.marginRight="",e.style.marginBottom="",e.style.marginTop=""}),r.centeredSlides&&r.cssMode&&(tn(i,"--swiper-centered-offset-before",""),tn(i,"--swiper-centered-offset-after",""));const T=r.grid&&r.grid.rows>1&&e.grid;let x;T?e.grid.initSlides(c):e.grid&&e.grid.unsetSlides();const A="auto"===r.slidesPerView&&r.breakpoints&&Object.keys(r.breakpoints).filter(e=>void 0!==r.breakpoints[e].slidesPerView).length>0;for(let i=0;i<u;i+=1){let n;if(x=0,c[i]&&(n=c[i]),T&&e.grid.updateSlide(i,n,c),!c[i]||"none"!==ln(n,"display")){if("auto"===r.slidesPerView){A&&(c[i].style[e.getDirectionLabel("width")]="");const s=getComputedStyle(n),a=n.style.transform,o=n.style.webkitTransform;if(a&&(n.style.transform="none"),o&&(n.style.webkitTransform="none"),r.roundLengths)x=e.isHorizontal()?cn(n,"width"):cn(n,"height");else{const e=t(s,"width"),r=t(s,"padding-left"),i=t(s,"padding-right"),a=t(s,"margin-left"),o=t(s,"margin-right"),l=s.getPropertyValue("box-sizing");if(l&&"border-box"===l)x=e+a+o;else{const{clientWidth:t,offsetWidth:s}=n;x=e+r+i+a+o+(s-t)}}a&&(n.style.transform=a),o&&(n.style.webkitTransform=o),r.roundLengths&&(x=Math.floor(x))}else x=(s-(r.slidesPerView-1)*b)/r.slidesPerView,r.roundLengths&&(x=Math.floor(x)),c[i]&&(c[i].style[e.getDirectionLabel("width")]=`${x}px`);c[i]&&(c[i].swiperSlideSize=x),p.push(x),r.centeredSlides?(E=E+x/2+w/2+b,0===w&&0!==i&&(E=E-s/2-b),0===i&&(E=E-s/2-b),Math.abs(E)<.001&&(E=0),r.roundLengths&&(E=Math.floor(E)),S%r.slidesPerGroup===0&&h.push(E),f.push(E)):(r.roundLengths&&(E=Math.floor(E)),(S-Math.min(e.params.slidesPerGroupSkip,S))%e.params.slidesPerGroup===0&&h.push(E),f.push(E),E=E+x+b),e.virtualSize+=x+b,w=x,S+=1}}if(e.virtualSize=Math.max(e.virtualSize,s)+g,a&&o&&("slide"===r.effect||"coverflow"===r.effect)&&(i.style.width=`${e.virtualSize+b}px`),r.setWrapperSize&&(i.style[e.getDirectionLabel("width")]=`${e.virtualSize+b}px`),T&&e.grid.updateWrapperSize(x,h),!r.centeredSlides){const t=[];for(let i=0;i<h.length;i+=1){let n=h[i];r.roundLengths&&(n=Math.floor(n)),h[i]<=e.virtualSize-s&&t.push(n)}h=t,Math.floor(e.virtualSize-s)-Math.floor(h[h.length-1])>1&&h.push(e.virtualSize-s)}if(l&&r.loop){const t=p[0]+b;if(r.slidesPerGroup>1){const i=Math.ceil((e.virtual.slidesBefore+e.virtual.slidesAfter)/r.slidesPerGroup),n=t*r.slidesPerGroup;for(let e=0;e<i;e+=1)h.push(h[h.length-1]+n)}for(let i=0;i<e.virtual.slidesBefore+e.virtual.slidesAfter;i+=1)1===r.slidesPerGroup&&h.push(h[h.length-1]+t),f.push(f[f.length-1]+t),e.virtualSize+=t}if(0===h.length&&(h=[0]),0!==b){const t=e.isHorizontal()&&a?"marginLeft":e.getDirectionLabel("marginRight");c.filter((e,t)=>!(r.cssMode&&!r.loop)||t!==c.length-1).forEach(e=>{e.style[t]=`${b}px`})}if(r.centeredSlides&&r.centeredSlidesBounds){let e=0;p.forEach(t=>{e+=t+(b||0)}),e-=b;const t=e>s?e-s:0;h=h.map(e=>e<=0?-m:e>t?t+g:e)}if(r.centerInsufficientSlides){let e=0;p.forEach(t=>{e+=t+(b||0)}),e-=b;const t=(r.slidesOffsetBefore||0)+(r.slidesOffsetAfter||0);if(e+t<s){const r=(s-e-t)/2;h.forEach((e,t)=>{h[t]=e-r}),f.forEach((e,t)=>{f[t]=e+r})}}if(Object.assign(e,{slides:c,snapGrid:h,slidesGrid:f,slidesSizesGrid:p}),r.centeredSlides&&r.cssMode&&!r.centeredSlidesBounds){tn(i,"--swiper-centered-offset-before",-h[0]+"px"),tn(i,"--swiper-centered-offset-after",e.size/2-p[p.length-1]/2+"px");const t=-e.snapGrid[0],r=-e.slidesGrid[0];e.snapGrid=e.snapGrid.map(e=>e+t),e.slidesGrid=e.slidesGrid.map(e=>e+r)}if(u!==d&&e.emit("slidesLengthChange"),h.length!==v&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),f.length!==y&&e.emit("slidesGridLengthChange"),r.watchSlidesProgress&&e.updateSlidesOffset(),e.emit("slidesUpdated"),!(l||r.cssMode||"slide"!==r.effect&&"fade"!==r.effect)){const t=`${r.containerModifierClass}backface-hidden`,i=e.el.classList.contains(t);u<=r.maxBackfaceHiddenSlides?i||e.el.classList.add(t):i&&e.el.classList.remove(t)}},updateAutoHeight:function(e){const t=this,r=[],i=t.virtual&&t.params.virtual.enabled;let n,s=0;"number"==typeof e?t.setTransition(e):!0===e&&t.setTransition(t.params.speed);const a=e=>i?t.slides[t.getSlideIndexByData(e)]:t.slides[e];if("auto"!==t.params.slidesPerView&&t.params.slidesPerView>1)if(t.params.centeredSlides)(t.visibleSlides||[]).forEach(e=>{r.push(e)});else for(n=0;n<Math.ceil(t.params.slidesPerView);n+=1){const e=t.activeIndex+n;if(e>t.slides.length&&!i)break;r.push(a(e))}else r.push(a(t.activeIndex));for(n=0;n<r.length;n+=1)if(void 0!==r[n]){const e=r[n].offsetHeight;s=e>s?e:s}(s||0===s)&&(t.wrapperEl.style.height=`${s}px`)},updateSlidesOffset:function(){const e=this,t=e.slides,r=e.isElement?e.isHorizontal()?e.wrapperEl.offsetLeft:e.wrapperEl.offsetTop:0;for(let i=0;i<t.length;i+=1)t[i].swiperSlideOffset=(e.isHorizontal()?t[i].offsetLeft:t[i].offsetTop)-r-e.cssOverflowAdjustment()},updateSlidesProgress:function(e){void 0===e&&(e=this&&this.translate||0);const t=this,r=t.params,{slides:i,rtlTranslate:n,snapGrid:s}=t;if(0===i.length)return;void 0===i[0].swiperSlideOffset&&t.updateSlidesOffset();let a=-e;n&&(a=e),t.visibleSlidesIndexes=[],t.visibleSlides=[];let o=r.spaceBetween;"string"==typeof o&&o.indexOf("%")>=0?o=parseFloat(o.replace("%",""))/100*t.size:"string"==typeof o&&(o=parseFloat(o));for(let e=0;e<i.length;e+=1){const l=i[e];let d=l.swiperSlideOffset;r.cssMode&&r.centeredSlides&&(d-=i[0].swiperSlideOffset);const c=(a+(r.centeredSlides?t.minTranslate():0)-d)/(l.swiperSlideSize+o),u=(a-s[0]+(r.centeredSlides?t.minTranslate():0)-d)/(l.swiperSlideSize+o),h=-(a-d),f=h+t.slidesSizesGrid[e],p=h>=0&&h<=t.size-t.slidesSizesGrid[e],m=h>=0&&h<t.size-1||f>1&&f<=t.size||h<=0&&f>=t.size;m&&(t.visibleSlides.push(l),t.visibleSlidesIndexes.push(e)),bn(l,m,r.slideVisibleClass),bn(l,p,r.slideFullyVisibleClass),l.progress=n?-c:c,l.originalProgress=n?-u:u}},updateProgress:function(e){const t=this;if(void 0===e){const r=t.rtlTranslate?-1:1;e=t&&t.translate&&t.translate*r||0}const r=t.params,i=t.maxTranslate()-t.minTranslate();let{progress:n,isBeginning:s,isEnd:a,progressLoop:o}=t;const l=s,d=a;if(0===i)n=0,s=!0,a=!0;else{n=(e-t.minTranslate())/i;const r=Math.abs(e-t.minTranslate())<1,o=Math.abs(e-t.maxTranslate())<1;s=r||n<=0,a=o||n>=1,r&&(n=0),o&&(n=1)}if(r.loop){const r=t.getSlideIndexByData(0),i=t.getSlideIndexByData(t.slides.length-1),n=t.slidesGrid[r],s=t.slidesGrid[i],a=t.slidesGrid[t.slidesGrid.length-1],l=Math.abs(e);o=l>=n?(l-n)/a:(l+a-s)/a,o>1&&(o-=1)}Object.assign(t,{progress:n,progressLoop:o,isBeginning:s,isEnd:a}),(r.watchSlidesProgress||r.centeredSlides&&r.autoHeight)&&t.updateSlidesProgress(e),s&&!l&&t.emit("reachBeginning toEdge"),a&&!d&&t.emit("reachEnd toEdge"),(l&&!s||d&&!a)&&t.emit("fromEdge"),t.emit("progress",n)},updateSlidesClasses:function(){const e=this,{slides:t,params:r,slidesEl:i,activeIndex:n}=e,s=e.virtual&&r.virtual.enabled,a=e.grid&&r.grid&&r.grid.rows>1,o=e=>sn(i,`.${r.slideClass}${e}, swiper-slide${e}`)[0];let l,d,c;if(s)if(r.loop){let t=n-e.virtual.slidesBefore;t<0&&(t=e.virtual.slides.length+t),t>=e.virtual.slides.length&&(t-=e.virtual.slides.length),l=o(`[data-swiper-slide-index="${t}"]`)}else l=o(`[data-swiper-slide-index="${n}"]`);else a?(l=t.filter(e=>e.column===n)[0],c=t.filter(e=>e.column===n+1)[0],d=t.filter(e=>e.column===n-1)[0]):l=t[n];l&&(a||(c=function(e,t){const r=[];for(;e.nextElementSibling;){const i=e.nextElementSibling;t?i.matches(t)&&r.push(i):r.push(i),e=i}return r}(l,`.${r.slideClass}, swiper-slide`)[0],r.loop&&!c&&(c=t[0]),d=function(e,t){const r=[];for(;e.previousElementSibling;){const i=e.previousElementSibling;t?i.matches(t)&&r.push(i):r.push(i),e=i}return r}(l,`.${r.slideClass}, swiper-slide`)[0],r.loop&&0===!d&&(d=t[t.length-1]))),t.forEach(e=>{En(e,e===l,r.slideActiveClass),En(e,e===c,r.slideNextClass),En(e,e===d,r.slidePrevClass)}),e.emitSlidesClasses()},updateActiveIndex:function(e){const t=this,r=t.rtlTranslate?t.translate:-t.translate,{snapGrid:i,params:n,activeIndex:s,realIndex:a,snapIndex:o}=t;let l,d=e;const c=e=>{let r=e-t.virtual.slidesBefore;return r<0&&(r=t.virtual.slides.length+r),r>=t.virtual.slides.length&&(r-=t.virtual.slides.length),r};if(void 0===d&&(d=function(e){const{slidesGrid:t,params:r}=e,i=e.rtlTranslate?e.translate:-e.translate;let n;for(let e=0;e<t.length;e+=1)void 0!==t[e+1]?i>=t[e]&&i<t[e+1]-(t[e+1]-t[e])/2?n=e:i>=t[e]&&i<t[e+1]&&(n=e+1):i>=t[e]&&(n=e);return r.normalizeSlideIndex&&(n<0||void 0===n)&&(n=0),n}(t)),i.indexOf(r)>=0)l=i.indexOf(r);else{const e=Math.min(n.slidesPerGroupSkip,d);l=e+Math.floor((d-e)/n.slidesPerGroup)}if(l>=i.length&&(l=i.length-1),d===s&&!t.params.loop)return void(l!==o&&(t.snapIndex=l,t.emit("snapIndexChange")));if(d===s&&t.params.loop&&t.virtual&&t.params.virtual.enabled)return void(t.realIndex=c(d));const u=t.grid&&n.grid&&n.grid.rows>1;let h;if(t.virtual&&n.virtual.enabled&&n.loop)h=c(d);else if(u){const e=t.slides.filter(e=>e.column===d)[0];let r=parseInt(e.getAttribute("data-swiper-slide-index"),10);Number.isNaN(r)&&(r=Math.max(t.slides.indexOf(e),0)),h=Math.floor(r/n.grid.rows)}else if(t.slides[d]){const e=t.slides[d].getAttribute("data-swiper-slide-index");h=e?parseInt(e,10):d}else h=d;Object.assign(t,{previousSnapIndex:o,snapIndex:l,previousRealIndex:a,realIndex:h,previousIndex:s,activeIndex:d}),t.initialized&&Tn(t),t.emit("activeIndexChange"),t.emit("snapIndexChange"),(t.initialized||t.params.runCallbacksOnInit)&&(a!==h&&t.emit("realIndexChange"),t.emit("slideChange"))},updateClickedSlide:function(e,t){const r=this,i=r.params;let n=e.closest(`.${i.slideClass}, swiper-slide`);!n&&r.isElement&&t&&t.length>1&&t.includes(e)&&[...t.slice(t.indexOf(e)+1,t.length)].forEach(e=>{!n&&e.matches&&e.matches(`.${i.slideClass}, swiper-slide`)&&(n=e)});let s,a=!1;if(n)for(let e=0;e<r.slides.length;e+=1)if(r.slides[e]===n){a=!0,s=e;break}if(!n||!a)return r.clickedSlide=void 0,void(r.clickedIndex=void 0);r.clickedSlide=n,r.virtual&&r.params.virtual.enabled?r.clickedIndex=parseInt(n.getAttribute("data-swiper-slide-index"),10):r.clickedIndex=s,i.slideToClickedSlide&&void 0!==r.clickedIndex&&r.clickedIndex!==r.activeIndex&&r.slideToClickedSlide()}};var An={getTranslate:function(e){void 0===e&&(e=this.isHorizontal()?"x":"y");const{params:t,rtlTranslate:r,translate:i,wrapperEl:n}=this;if(t.virtualTranslate)return r?-i:i;if(t.cssMode)return i;let s=Qi(n,e);return s+=this.cssOverflowAdjustment(),r&&(s=-s),s||0},setTranslate:function(e,t){const r=this,{rtlTranslate:i,params:n,wrapperEl:s,progress:a}=r;let o,l=0,d=0;r.isHorizontal()?l=i?-e:e:d=e,n.roundLengths&&(l=Math.floor(l),d=Math.floor(d)),r.previousTranslate=r.translate,r.translate=r.isHorizontal()?l:d,n.cssMode?s[r.isHorizontal()?"scrollLeft":"scrollTop"]=r.isHorizontal()?-l:-d:n.virtualTranslate||(r.isHorizontal()?l-=r.cssOverflowAdjustment():d-=r.cssOverflowAdjustment(),s.style.transform=`translate3d(${l}px, ${d}px, 0px)`);const c=r.maxTranslate()-r.minTranslate();o=0===c?0:(e-r.minTranslate())/c,o!==a&&r.updateProgress(e),r.emit("setTranslate",r.translate,t)},minTranslate:function(){return-this.snapGrid[0]},maxTranslate:function(){return-this.snapGrid[this.snapGrid.length-1]},translateTo:function(e,t,r,i,n){void 0===e&&(e=0),void 0===t&&(t=this.params.speed),void 0===r&&(r=!0),void 0===i&&(i=!0);const s=this,{params:a,wrapperEl:o}=s;if(s.animating&&a.preventInteractionOnTransition)return!1;const l=s.minTranslate(),d=s.maxTranslate();let c;if(c=i&&e>l?l:i&&e<d?d:e,s.updateProgress(c),a.cssMode){const e=s.isHorizontal();if(0===t)o[e?"scrollLeft":"scrollTop"]=-c;else{if(!s.support.smoothScroll)return rn({swiper:s,targetPosition:-c,side:e?"left":"top"}),!0;o.scrollTo({[e?"left":"top"]:-c,behavior:"smooth"})}return!0}return 0===t?(s.setTransition(0),s.setTranslate(c),r&&(s.emit("beforeTransitionStart",t,n),s.emit("transitionEnd"))):(s.setTransition(t),s.setTranslate(c),r&&(s.emit("beforeTransitionStart",t,n),s.emit("transitionStart")),s.animating||(s.animating=!0,s.onTranslateToWrapperTransitionEnd||(s.onTranslateToWrapperTransitionEnd=function(e){s&&!s.destroyed&&e.target===this&&(s.wrapperEl.removeEventListener("transitionend",s.onTranslateToWrapperTransitionEnd),s.onTranslateToWrapperTransitionEnd=null,delete s.onTranslateToWrapperTransitionEnd,s.animating=!1,r&&s.emit("transitionEnd"))}),s.wrapperEl.addEventListener("transitionend",s.onTranslateToWrapperTransitionEnd))),!0}};function kn(e){let{swiper:t,runCallbacks:r,direction:i,step:n}=e;const{activeIndex:s,previousIndex:a}=t;let o=i;if(o||(o=s>a?"next":s<a?"prev":"reset"),t.emit(`transition${n}`),r&&s!==a){if("reset"===o)return void t.emit(`slideResetTransition${n}`);t.emit(`slideChangeTransition${n}`),"next"===o?t.emit(`slideNextTransition${n}`):t.emit(`slidePrevTransition${n}`)}}var Ln={setTransition:function(e,t){const r=this;r.params.cssMode||(r.wrapperEl.style.transitionDuration=`${e}ms`,r.wrapperEl.style.transitionDelay=0===e?"0ms":""),r.emit("setTransition",e,t)},transitionStart:function(e,t){void 0===e&&(e=!0);const r=this,{params:i}=r;i.cssMode||(i.autoHeight&&r.updateAutoHeight(),kn({swiper:r,runCallbacks:e,direction:t,step:"Start"}))},transitionEnd:function(e,t){void 0===e&&(e=!0);const r=this,{params:i}=r;r.animating=!1,i.cssMode||(r.setTransition(0),kn({swiper:r,runCallbacks:e,direction:t,step:"End"}))}};var In={slideTo:function(e,t,r,i,n){void 0===e&&(e=0),void 0===r&&(r=!0),"string"==typeof e&&(e=parseInt(e,10));const s=this;let a=e;a<0&&(a=0);const{params:o,snapGrid:l,slidesGrid:d,previousIndex:c,activeIndex:u,rtlTranslate:h,wrapperEl:f,enabled:p}=s;if(!p&&!i&&!n||s.destroyed||s.animating&&o.preventInteractionOnTransition)return!1;void 0===t&&(t=s.params.speed);const m=Math.min(s.params.slidesPerGroupSkip,a);let g=m+Math.floor((a-m)/s.params.slidesPerGroup);g>=l.length&&(g=l.length-1);const v=-l[g];if(o.normalizeSlideIndex)for(let e=0;e<d.length;e+=1){const t=-Math.floor(100*v),r=Math.floor(100*d[e]),i=Math.floor(100*d[e+1]);void 0!==d[e+1]?t>=r&&t<i-(i-r)/2?a=e:t>=r&&t<i&&(a=e+1):t>=r&&(a=e)}if(s.initialized&&a!==u){if(!s.allowSlideNext&&(h?v>s.translate&&v>s.minTranslate():v<s.translate&&v<s.minTranslate()))return!1;if(!s.allowSlidePrev&&v>s.translate&&v>s.maxTranslate()&&(u||0)!==a)return!1}let y;a!==(c||0)&&r&&s.emit("beforeSlideChangeStart"),s.updateProgress(v),y=a>u?"next":a<u?"prev":"reset";const b=s.virtual&&s.params.virtual.enabled;if(!(b&&n)&&(h&&-v===s.translate||!h&&v===s.translate))return s.updateActiveIndex(a),o.autoHeight&&s.updateAutoHeight(),s.updateSlidesClasses(),"slide"!==o.effect&&s.setTranslate(v),"reset"!==y&&(s.transitionStart(r,y),s.transitionEnd(r,y)),!1;if(o.cssMode){const e=s.isHorizontal(),r=h?v:-v;if(0===t)b&&(s.wrapperEl.style.scrollSnapType="none",s._immediateVirtual=!0),b&&!s._cssModeVirtualInitialSet&&s.params.initialSlide>0?(s._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{f[e?"scrollLeft":"scrollTop"]=r})):f[e?"scrollLeft":"scrollTop"]=r,b&&requestAnimationFrame(()=>{s.wrapperEl.style.scrollSnapType="",s._immediateVirtual=!1});else{if(!s.support.smoothScroll)return rn({swiper:s,targetPosition:r,side:e?"left":"top"}),!0;f.scrollTo({[e?"left":"top"]:r,behavior:"smooth"})}return!0}return s.setTransition(t),s.setTranslate(v),s.updateActiveIndex(a),s.updateSlidesClasses(),s.emit("beforeTransitionStart",t,i),s.transitionStart(r,y),0===t?s.transitionEnd(r,y):s.animating||(s.animating=!0,s.onSlideToWrapperTransitionEnd||(s.onSlideToWrapperTransitionEnd=function(e){s&&!s.destroyed&&e.target===this&&(s.wrapperEl.removeEventListener("transitionend",s.onSlideToWrapperTransitionEnd),s.onSlideToWrapperTransitionEnd=null,delete s.onSlideToWrapperTransitionEnd,s.transitionEnd(r,y))}),s.wrapperEl.addEventListener("transitionend",s.onSlideToWrapperTransitionEnd)),!0},slideToLoop:function(e,t,r,i){if(void 0===e&&(e=0),void 0===r&&(r=!0),"string"==typeof e){e=parseInt(e,10)}const n=this;if(n.destroyed)return;void 0===t&&(t=n.params.speed);const s=n.grid&&n.params.grid&&n.params.grid.rows>1;let a=e;if(n.params.loop)if(n.virtual&&n.params.virtual.enabled)a+=n.virtual.slidesBefore;else{let e;if(s){const t=a*n.params.grid.rows;e=n.slides.filter(e=>1*e.getAttribute("data-swiper-slide-index")===t)[0].column}else e=n.getSlideIndexByData(a);const t=s?Math.ceil(n.slides.length/n.params.grid.rows):n.slides.length,{centeredSlides:r}=n.params;let o=n.params.slidesPerView;"auto"===o?o=n.slidesPerViewDynamic():(o=Math.ceil(parseFloat(n.params.slidesPerView,10)),r&&o%2==0&&(o+=1));let l=t-e<o;if(r&&(l=l||e<Math.ceil(o/2)),i&&r&&"auto"!==n.params.slidesPerView&&!s&&(l=!1),l){const i=r?e<n.activeIndex?"prev":"next":e-n.activeIndex-1<n.params.slidesPerView?"next":"prev";n.loopFix({direction:i,slideTo:!0,activeSlideIndex:"next"===i?e+1:e-t+1,slideRealIndex:"next"===i?n.realIndex:void 0})}if(s){const e=a*n.params.grid.rows;a=n.slides.filter(t=>1*t.getAttribute("data-swiper-slide-index")===e)[0].column}else a=n.getSlideIndexByData(a)}return requestAnimationFrame(()=>{n.slideTo(a,t,r,i)}),n},slideNext:function(e,t,r){void 0===t&&(t=!0);const i=this,{enabled:n,params:s,animating:a}=i;if(!n||i.destroyed)return i;void 0===e&&(e=i.params.speed);let o=s.slidesPerGroup;"auto"===s.slidesPerView&&1===s.slidesPerGroup&&s.slidesPerGroupAuto&&(o=Math.max(i.slidesPerViewDynamic("current",!0),1));const l=i.activeIndex<s.slidesPerGroupSkip?1:o,d=i.virtual&&s.virtual.enabled;if(s.loop){if(a&&!d&&s.loopPreventsSliding)return!1;if(i.loopFix({direction:"next"}),i._clientLeft=i.wrapperEl.clientLeft,i.activeIndex===i.slides.length-1&&s.cssMode)return requestAnimationFrame(()=>{i.slideTo(i.activeIndex+l,e,t,r)}),!0}return s.rewind&&i.isEnd?i.slideTo(0,e,t,r):i.slideTo(i.activeIndex+l,e,t,r)},slidePrev:function(e,t,r){void 0===t&&(t=!0);const i=this,{params:n,snapGrid:s,slidesGrid:a,rtlTranslate:o,enabled:l,animating:d}=i;if(!l||i.destroyed)return i;void 0===e&&(e=i.params.speed);const c=i.virtual&&n.virtual.enabled;if(n.loop){if(d&&!c&&n.loopPreventsSliding)return!1;i.loopFix({direction:"prev"}),i._clientLeft=i.wrapperEl.clientLeft}function u(e){return e<0?-Math.floor(Math.abs(e)):Math.floor(e)}const h=u(o?i.translate:-i.translate),f=s.map(e=>u(e));let p=s[f.indexOf(h)-1];if(void 0===p&&n.cssMode){let e;s.forEach((t,r)=>{h>=t&&(e=r)}),void 0!==e&&(p=s[e>0?e-1:e])}let m=0;if(void 0!==p&&(m=a.indexOf(p),m<0&&(m=i.activeIndex-1),"auto"===n.slidesPerView&&1===n.slidesPerGroup&&n.slidesPerGroupAuto&&(m=m-i.slidesPerViewDynamic("previous",!0)+1,m=Math.max(m,0))),n.rewind&&i.isBeginning){const n=i.params.virtual&&i.params.virtual.enabled&&i.virtual?i.virtual.slides.length-1:i.slides.length-1;return i.slideTo(n,e,t,r)}return n.loop&&0===i.activeIndex&&n.cssMode?(requestAnimationFrame(()=>{i.slideTo(m,e,t,r)}),!0):i.slideTo(m,e,t,r)},slideReset:function(e,t,r){void 0===t&&(t=!0);const i=this;if(!i.destroyed)return void 0===e&&(e=i.params.speed),i.slideTo(i.activeIndex,e,t,r)},slideToClosest:function(e,t,r,i){void 0===t&&(t=!0),void 0===i&&(i=.5);const n=this;if(n.destroyed)return;void 0===e&&(e=n.params.speed);let s=n.activeIndex;const a=Math.min(n.params.slidesPerGroupSkip,s),o=a+Math.floor((s-a)/n.params.slidesPerGroup),l=n.rtlTranslate?n.translate:-n.translate;if(l>=n.snapGrid[o]){const e=n.snapGrid[o];l-e>(n.snapGrid[o+1]-e)*i&&(s+=n.params.slidesPerGroup)}else{const e=n.snapGrid[o-1];l-e<=(n.snapGrid[o]-e)*i&&(s-=n.params.slidesPerGroup)}return s=Math.max(s,0),s=Math.min(s,n.slidesGrid.length-1),n.slideTo(s,e,t,r)},slideToClickedSlide:function(){const e=this;if(e.destroyed)return;const{params:t,slidesEl:r}=e,i="auto"===t.slidesPerView?e.slidesPerViewDynamic():t.slidesPerView;let n,s=e.clickedIndex;const a=e.isElement?"swiper-slide":`.${t.slideClass}`;if(t.loop){if(e.animating)return;n=parseInt(e.clickedSlide.getAttribute("data-swiper-slide-index"),10),t.centeredSlides?s<e.loopedSlides-i/2||s>e.slides.length-e.loopedSlides+i/2?(e.loopFix(),s=e.getSlideIndex(sn(r,`${a}[data-swiper-slide-index="${n}"]`)[0]),qi(()=>{e.slideTo(s)})):e.slideTo(s):s>e.slides.length-i?(e.loopFix(),s=e.getSlideIndex(sn(r,`${a}[data-swiper-slide-index="${n}"]`)[0]),qi(()=>{e.slideTo(s)})):e.slideTo(s)}else e.slideTo(s)}};var Rn={loopCreate:function(e){const t=this,{params:r,slidesEl:i}=t;if(!r.loop||t.virtual&&t.params.virtual.enabled)return;const n=()=>{sn(i,`.${r.slideClass}, swiper-slide`).forEach((e,t)=>{e.setAttribute("data-swiper-slide-index",t)})},s=t.grid&&r.grid&&r.grid.rows>1,a=r.slidesPerGroup*(s?r.grid.rows:1),o=t.slides.length%a!==0,l=s&&t.slides.length%r.grid.rows!==0,d=e=>{for(let i=0;i<e;i+=1){const e=t.isElement?on("swiper-slide",[r.slideBlankClass]):on("div",[r.slideClass,r.slideBlankClass]);t.slidesEl.append(e)}};if(o){if(r.loopAddBlankSlides){d(a-t.slides.length%a),t.recalcSlides(),t.updateSlides()}else an("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");n()}else if(l){if(r.loopAddBlankSlides){d(r.grid.rows-t.slides.length%r.grid.rows),t.recalcSlides(),t.updateSlides()}else an("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");n()}else n();t.loopFix({slideRealIndex:e,direction:r.centeredSlides?void 0:"next"})},loopFix:function(e){let{slideRealIndex:t,slideTo:r=!0,direction:i,setTranslate:n,activeSlideIndex:s,byController:a,byMousewheel:o}=void 0===e?{}:e;const l=this;if(!l.params.loop)return;l.emit("beforeLoopFix");const{slides:d,allowSlidePrev:c,allowSlideNext:u,slidesEl:h,params:f}=l,{centeredSlides:p}=f;if(l.allowSlidePrev=!0,l.allowSlideNext=!0,l.virtual&&f.virtual.enabled)return r&&(f.centeredSlides||0!==l.snapIndex?f.centeredSlides&&l.snapIndex<f.slidesPerView?l.slideTo(l.virtual.slides.length+l.snapIndex,0,!1,!0):l.snapIndex===l.snapGrid.length-1&&l.slideTo(l.virtual.slidesBefore,0,!1,!0):l.slideTo(l.virtual.slides.length,0,!1,!0)),l.allowSlidePrev=c,l.allowSlideNext=u,void l.emit("loopFix");let m=f.slidesPerView;"auto"===m?m=l.slidesPerViewDynamic():(m=Math.ceil(parseFloat(f.slidesPerView,10)),p&&m%2==0&&(m+=1));const g=f.slidesPerGroupAuto?m:f.slidesPerGroup;let v=g;v%g!==0&&(v+=g-v%g),v+=f.loopAdditionalSlides,l.loopedSlides=v;const y=l.grid&&f.grid&&f.grid.rows>1;d.length<m+v?an("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):y&&"row"===f.grid.fill&&an("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const b=[],E=[];let w=l.activeIndex;void 0===s?s=l.getSlideIndex(d.filter(e=>e.classList.contains(f.slideActiveClass))[0]):w=s;const S="next"===i||!i,T="prev"===i||!i;let x=0,A=0;const k=y?Math.ceil(d.length/f.grid.rows):d.length,L=(y?d[s].column:s)+(p&&void 0===n?-m/2+.5:0);if(L<v){x=Math.max(v-L,g);for(let e=0;e<v-L;e+=1){const t=e-Math.floor(e/k)*k;if(y){const e=k-t-1;for(let t=d.length-1;t>=0;t-=1)d[t].column===e&&b.push(t)}else b.push(k-t-1)}}else if(L+m>k-v){A=Math.max(L-(k-2*v),g);for(let e=0;e<A;e+=1){const t=e-Math.floor(e/k)*k;y?d.forEach((e,r)=>{e.column===t&&E.push(r)}):E.push(t)}}if(l.__preventObserver__=!0,requestAnimationFrame(()=>{l.__preventObserver__=!1}),T&&b.forEach(e=>{d[e].swiperLoopMoveDOM=!0,h.prepend(d[e]),d[e].swiperLoopMoveDOM=!1}),S&&E.forEach(e=>{d[e].swiperLoopMoveDOM=!0,h.append(d[e]),d[e].swiperLoopMoveDOM=!1}),l.recalcSlides(),"auto"===f.slidesPerView?l.updateSlides():y&&(b.length>0&&T||E.length>0&&S)&&l.slides.forEach((e,t)=>{l.grid.updateSlide(t,e,l.slides)}),f.watchSlidesProgress&&l.updateSlidesOffset(),r)if(b.length>0&&T){if(void 0===t){const e=l.slidesGrid[w],t=l.slidesGrid[w+x]-e;o?l.setTranslate(l.translate-t):(l.slideTo(w+Math.ceil(x),0,!1,!0),n&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-t,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-t))}else if(n){const e=y?b.length/f.grid.rows:b.length;l.slideTo(l.activeIndex+e,0,!1,!0),l.touchEventsData.currentTranslate=l.translate}}else if(E.length>0&&S)if(void 0===t){const e=l.slidesGrid[w],t=l.slidesGrid[w-A]-e;o?l.setTranslate(l.translate-t):(l.slideTo(w-A,0,!1,!0),n&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-t,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-t))}else{const e=y?E.length/f.grid.rows:E.length;l.slideTo(l.activeIndex-e,0,!1,!0)}if(l.allowSlidePrev=c,l.allowSlideNext=u,l.controller&&l.controller.control&&!a){const e={slideRealIndex:t,direction:i,setTranslate:n,activeSlideIndex:s,byController:!0};Array.isArray(l.controller.control)?l.controller.control.forEach(t=>{!t.destroyed&&t.params.loop&&t.loopFix({...e,slideTo:t.params.slidesPerView===f.slidesPerView&&r})}):l.controller.control instanceof l.constructor&&l.controller.control.params.loop&&l.controller.control.loopFix({...e,slideTo:l.controller.control.params.slidesPerView===f.slidesPerView&&r})}l.emit("loopFix")},loopDestroy:function(){const e=this,{params:t,slidesEl:r}=e;if(!t.loop||e.virtual&&e.params.virtual.enabled)return;e.recalcSlides();const i=[];e.slides.forEach(e=>{const t=void 0===e.swiperSlideIndex?1*e.getAttribute("data-swiper-slide-index"):e.swiperSlideIndex;i[t]=e}),e.slides.forEach(e=>{e.removeAttribute("data-swiper-slide-index")}),i.forEach(e=>{r.append(e)}),e.recalcSlides(),e.slideTo(e.realIndex,0)}};function Pn(e,t,r){const i=Ki(),{params:n}=e,s=n.edgeSwipeDetection,a=n.edgeSwipeThreshold;return!s||!(r<=a||r>=i.innerWidth-a)||"prevent"===s&&(t.preventDefault(),!0)}function Dn(e){const t=this,r=Wi();let i=e;i.originalEvent&&(i=i.originalEvent);const n=t.touchEventsData;if("pointerdown"===i.type){if(null!==n.pointerId&&n.pointerId!==i.pointerId)return;n.pointerId=i.pointerId}else"touchstart"===i.type&&1===i.targetTouches.length&&(n.touchId=i.targetTouches[0].identifier);if("touchstart"===i.type)return void Pn(t,i,i.targetTouches[0].pageX);const{params:s,touches:a,enabled:o}=t;if(!o)return;if(!s.simulateTouch&&"mouse"===i.pointerType)return;if(t.animating&&s.preventInteractionOnTransition)return;!t.animating&&s.cssMode&&s.loop&&t.loopFix();let l=i.target;if("wrapper"===s.touchEventsTarget&&!function(e,t){const r=t.contains(e);if(!r&&t instanceof HTMLSlotElement)return[...t.assignedElements()].includes(e);return r}(l,t.wrapperEl))return;if("which"in i&&3===i.which)return;if("button"in i&&i.button>0)return;if(n.isTouched&&n.isMoved)return;const d=!!s.noSwipingClass&&""!==s.noSwipingClass,c=i.composedPath?i.composedPath():i.path;d&&i.target&&i.target.shadowRoot&&c&&(l=c[0]);const u=s.noSwipingSelector?s.noSwipingSelector:`.${s.noSwipingClass}`,h=!(!i.target||!i.target.shadowRoot);if(s.noSwiping&&(h?function(e,t){return void 0===t&&(t=this),function t(r){if(!r||r===Wi()||r===Ki())return null;r.assignedSlot&&(r=r.assignedSlot);const i=r.closest(e);return i||r.getRootNode?i||t(r.getRootNode().host):null}(t)}(u,l):l.closest(u)))return void(t.allowClick=!0);if(s.swipeHandler&&!l.closest(s.swipeHandler))return;a.currentX=i.pageX,a.currentY=i.pageY;const f=a.currentX,p=a.currentY;if(!Pn(t,i,f))return;Object.assign(n,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=f,a.startY=p,n.touchStartTime=Xi(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,s.threshold>0&&(n.allowThresholdMove=!1);let m=!0;l.matches(n.focusableElements)&&(m=!1,"SELECT"===l.nodeName&&(n.isTouched=!1)),r.activeElement&&r.activeElement.matches(n.focusableElements)&&r.activeElement!==l&&("mouse"===i.pointerType||"mouse"!==i.pointerType&&!l.matches(n.focusableElements))&&r.activeElement.blur();const g=m&&t.allowTouchMove&&s.touchStartPreventDefault;!s.touchStartForcePreventDefault&&!g||l.isContentEditable||i.preventDefault(),s.freeMode&&s.freeMode.enabled&&t.freeMode&&t.animating&&!s.cssMode&&t.freeMode.onTouchStart(),t.emit("touchStart",i)}function Cn(e){const t=Wi(),r=this,i=r.touchEventsData,{params:n,touches:s,rtlTranslate:a,enabled:o}=r;if(!o)return;if(!n.simulateTouch&&"mouse"===e.pointerType)return;let l,d=e;if(d.originalEvent&&(d=d.originalEvent),"pointermove"===d.type){if(null!==i.touchId)return;if(d.pointerId!==i.pointerId)return}if("touchmove"===d.type){if(l=[...d.changedTouches].filter(e=>e.identifier===i.touchId)[0],!l||l.identifier!==i.touchId)return}else l=d;if(!i.isTouched)return void(i.startMoving&&i.isScrolling&&r.emit("touchMoveOpposite",d));const c=l.pageX,u=l.pageY;if(d.preventedByNestedSwiper)return s.startX=c,void(s.startY=u);if(!r.allowTouchMove)return d.target.matches(i.focusableElements)||(r.allowClick=!1),void(i.isTouched&&(Object.assign(s,{startX:c,startY:u,currentX:c,currentY:u}),i.touchStartTime=Xi()));if(n.touchReleaseOnEdges&&!n.loop)if(r.isVertical()){if(u<s.startY&&r.translate<=r.maxTranslate()||u>s.startY&&r.translate>=r.minTranslate())return i.isTouched=!1,void(i.isMoved=!1)}else if(c<s.startX&&r.translate<=r.maxTranslate()||c>s.startX&&r.translate>=r.minTranslate())return;if(t.activeElement&&t.activeElement.matches(i.focusableElements)&&t.activeElement!==d.target&&"mouse"!==d.pointerType&&t.activeElement.blur(),t.activeElement&&d.target===t.activeElement&&d.target.matches(i.focusableElements))return i.isMoved=!0,void(r.allowClick=!1);i.allowTouchCallbacks&&r.emit("touchMove",d),s.previousX=s.currentX,s.previousY=s.currentY,s.currentX=c,s.currentY=u;const h=s.currentX-s.startX,f=s.currentY-s.startY;if(r.params.threshold&&Math.sqrt(h**2+f**2)<r.params.threshold)return;if(void 0===i.isScrolling){let e;r.isHorizontal()&&s.currentY===s.startY||r.isVertical()&&s.currentX===s.startX?i.isScrolling=!1:h*h+f*f>=25&&(e=180*Math.atan2(Math.abs(f),Math.abs(h))/Math.PI,i.isScrolling=r.isHorizontal()?e>n.touchAngle:90-e>n.touchAngle)}if(i.isScrolling&&r.emit("touchMoveOpposite",d),void 0===i.startMoving&&(s.currentX===s.startX&&s.currentY===s.startY||(i.startMoving=!0)),i.isScrolling||"touchmove"===d.type&&i.preventTouchMoveFromPointerMove)return void(i.isTouched=!1);if(!i.startMoving)return;r.allowClick=!1,!n.cssMode&&d.cancelable&&d.preventDefault(),n.touchMoveStopPropagation&&!n.nested&&d.stopPropagation();let p=r.isHorizontal()?h:f,m=r.isHorizontal()?s.currentX-s.previousX:s.currentY-s.previousY;n.oneWayMovement&&(p=Math.abs(p)*(a?1:-1),m=Math.abs(m)*(a?1:-1)),s.diff=p,p*=n.touchRatio,a&&(p=-p,m=-m);const g=r.touchesDirection;r.swipeDirection=p>0?"prev":"next",r.touchesDirection=m>0?"prev":"next";const v=r.params.loop&&!n.cssMode,y="next"===r.touchesDirection&&r.allowSlideNext||"prev"===r.touchesDirection&&r.allowSlidePrev;if(!i.isMoved){if(v&&y&&r.loopFix({direction:r.swipeDirection}),i.startTranslate=r.getTranslate(),r.setTransition(0),r.animating){const e=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});r.wrapperEl.dispatchEvent(e)}i.allowMomentumBounce=!1,!n.grabCursor||!0!==r.allowSlideNext&&!0!==r.allowSlidePrev||r.setGrabCursor(!0),r.emit("sliderFirstMove",d)}if((new Date).getTime(),i.isMoved&&i.allowThresholdMove&&g!==r.touchesDirection&&v&&y&&Math.abs(p)>=1)return Object.assign(s,{startX:c,startY:u,currentX:c,currentY:u,startTranslate:i.currentTranslate}),i.loopSwapReset=!0,void(i.startTranslate=i.currentTranslate);r.emit("sliderMove",d),i.isMoved=!0,i.currentTranslate=p+i.startTranslate;let b=!0,E=n.resistanceRatio;if(n.touchReleaseOnEdges&&(E=0),p>0?(v&&y&&i.allowThresholdMove&&i.currentTranslate>(n.centeredSlides?r.minTranslate()-r.slidesSizesGrid[r.activeIndex+1]-("auto"!==n.slidesPerView&&r.slides.length-n.slidesPerView>=2?r.slidesSizesGrid[r.activeIndex+1]+r.params.spaceBetween:0)-r.params.spaceBetween:r.minTranslate())&&r.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),i.currentTranslate>r.minTranslate()&&(b=!1,n.resistance&&(i.currentTranslate=r.minTranslate()-1+(-r.minTranslate()+i.startTranslate+p)**E))):p<0&&(v&&y&&i.allowThresholdMove&&i.currentTranslate<(n.centeredSlides?r.maxTranslate()+r.slidesSizesGrid[r.slidesSizesGrid.length-1]+r.params.spaceBetween+("auto"!==n.slidesPerView&&r.slides.length-n.slidesPerView>=2?r.slidesSizesGrid[r.slidesSizesGrid.length-1]+r.params.spaceBetween:0):r.maxTranslate())&&r.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:r.slides.length-("auto"===n.slidesPerView?r.slidesPerViewDynamic():Math.ceil(parseFloat(n.slidesPerView,10)))}),i.currentTranslate<r.maxTranslate()&&(b=!1,n.resistance&&(i.currentTranslate=r.maxTranslate()+1-(r.maxTranslate()-i.startTranslate-p)**E))),b&&(d.preventedByNestedSwiper=!0),!r.allowSlideNext&&"next"===r.swipeDirection&&i.currentTranslate<i.startTranslate&&(i.currentTranslate=i.startTranslate),!r.allowSlidePrev&&"prev"===r.swipeDirection&&i.currentTranslate>i.startTranslate&&(i.currentTranslate=i.startTranslate),r.allowSlidePrev||r.allowSlideNext||(i.currentTranslate=i.startTranslate),n.threshold>0){if(!(Math.abs(p)>n.threshold||i.allowThresholdMove))return void(i.currentTranslate=i.startTranslate);if(!i.allowThresholdMove)return i.allowThresholdMove=!0,s.startX=s.currentX,s.startY=s.currentY,i.currentTranslate=i.startTranslate,void(s.diff=r.isHorizontal()?s.currentX-s.startX:s.currentY-s.startY)}n.followFinger&&!n.cssMode&&((n.freeMode&&n.freeMode.enabled&&r.freeMode||n.watchSlidesProgress)&&(r.updateActiveIndex(),r.updateSlidesClasses()),n.freeMode&&n.freeMode.enabled&&r.freeMode&&r.freeMode.onTouchMove(),r.updateProgress(i.currentTranslate),r.setTranslate(i.currentTranslate))}function _n(e){const t=this,r=t.touchEventsData;let i,n=e;n.originalEvent&&(n=n.originalEvent);if("touchend"===n.type||"touchcancel"===n.type){if(i=[...n.changedTouches].filter(e=>e.identifier===r.touchId)[0],!i||i.identifier!==r.touchId)return}else{if(null!==r.touchId)return;if(n.pointerId!==r.pointerId)return;i=n}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(n.type)){if(!(["pointercancel","contextmenu"].includes(n.type)&&(t.browser.isSafari||t.browser.isWebView)))return}r.pointerId=null,r.touchId=null;const{params:s,touches:a,rtlTranslate:o,slidesGrid:l,enabled:d}=t;if(!d)return;if(!s.simulateTouch&&"mouse"===n.pointerType)return;if(r.allowTouchCallbacks&&t.emit("touchEnd",n),r.allowTouchCallbacks=!1,!r.isTouched)return r.isMoved&&s.grabCursor&&t.setGrabCursor(!1),r.isMoved=!1,void(r.startMoving=!1);s.grabCursor&&r.isMoved&&r.isTouched&&(!0===t.allowSlideNext||!0===t.allowSlidePrev)&&t.setGrabCursor(!1);const c=Xi(),u=c-r.touchStartTime;if(t.allowClick){const e=n.path||n.composedPath&&n.composedPath();t.updateClickedSlide(e&&e[0]||n.target,e),t.emit("tap click",n),u<300&&c-r.lastClickTime<300&&t.emit("doubleTap doubleClick",n)}if(r.lastClickTime=Xi(),qi(()=>{t.destroyed||(t.allowClick=!0)}),!r.isTouched||!r.isMoved||!t.swipeDirection||0===a.diff&&!r.loopSwapReset||r.currentTranslate===r.startTranslate&&!r.loopSwapReset)return r.isTouched=!1,r.isMoved=!1,void(r.startMoving=!1);let h;if(r.isTouched=!1,r.isMoved=!1,r.startMoving=!1,h=s.followFinger?o?t.translate:-t.translate:-r.currentTranslate,s.cssMode)return;if(s.freeMode&&s.freeMode.enabled)return void t.freeMode.onTouchEnd({currentPos:h});const f=h>=-t.maxTranslate()&&!t.params.loop;let p=0,m=t.slidesSizesGrid[0];for(let e=0;e<l.length;e+=e<s.slidesPerGroupSkip?1:s.slidesPerGroup){const t=e<s.slidesPerGroupSkip-1?1:s.slidesPerGroup;void 0!==l[e+t]?(f||h>=l[e]&&h<l[e+t])&&(p=e,m=l[e+t]-l[e]):(f||h>=l[e])&&(p=e,m=l[l.length-1]-l[l.length-2])}let g=null,v=null;s.rewind&&(t.isBeginning?v=s.virtual&&s.virtual.enabled&&t.virtual?t.virtual.slides.length-1:t.slides.length-1:t.isEnd&&(g=0));const y=(h-l[p])/m,b=p<s.slidesPerGroupSkip-1?1:s.slidesPerGroup;if(u>s.longSwipesMs){if(!s.longSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&(y>=s.longSwipesRatio?t.slideTo(s.rewind&&t.isEnd?g:p+b):t.slideTo(p)),"prev"===t.swipeDirection&&(y>1-s.longSwipesRatio?t.slideTo(p+b):null!==v&&y<0&&Math.abs(y)>s.longSwipesRatio?t.slideTo(v):t.slideTo(p))}else{if(!s.shortSwipes)return void t.slideTo(t.activeIndex);t.navigation&&(n.target===t.navigation.nextEl||n.target===t.navigation.prevEl)?n.target===t.navigation.nextEl?t.slideTo(p+b):t.slideTo(p):("next"===t.swipeDirection&&t.slideTo(null!==g?g:p+b),"prev"===t.swipeDirection&&t.slideTo(null!==v?v:p))}}function On(){const e=this,{params:t,el:r}=e;if(r&&0===r.offsetWidth)return;t.breakpoints&&e.setBreakpoint();const{allowSlideNext:i,allowSlidePrev:n,snapGrid:s}=e,a=e.virtual&&e.params.virtual.enabled;e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),e.updateSlidesClasses();const o=a&&t.loop;!("auto"===t.slidesPerView||t.slidesPerView>1)||!e.isEnd||e.isBeginning||e.params.centeredSlides||o?e.params.loop&&!a?e.slideToLoop(e.realIndex,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0):e.slideTo(e.slides.length-1,0,!1,!0),e.autoplay&&e.autoplay.running&&e.autoplay.paused&&(clearTimeout(e.autoplay.resizeTimeout),e.autoplay.resizeTimeout=setTimeout(()=>{e.autoplay&&e.autoplay.running&&e.autoplay.paused&&e.autoplay.resume()},500)),e.allowSlidePrev=n,e.allowSlideNext=i,e.params.watchOverflow&&s!==e.snapGrid&&e.checkOverflow()}function Mn(e){const t=this;t.enabled&&(t.allowClick||(t.params.preventClicks&&e.preventDefault(),t.params.preventClicksPropagation&&t.animating&&(e.stopPropagation(),e.stopImmediatePropagation())))}function Nn(){const e=this,{wrapperEl:t,rtlTranslate:r,enabled:i}=e;if(!i)return;let n;e.previousTranslate=e.translate,e.isHorizontal()?e.translate=-t.scrollLeft:e.translate=-t.scrollTop,0===e.translate&&(e.translate=0),e.updateActiveIndex(),e.updateSlidesClasses();const s=e.maxTranslate()-e.minTranslate();n=0===s?0:(e.translate-e.minTranslate())/s,n!==e.progress&&e.updateProgress(r?-e.translate:e.translate),e.emit("setTranslate",e.translate,!1)}function Fn(e){const t=this;wn(t,e.target),t.params.cssMode||"auto"!==t.params.slidesPerView&&!t.params.autoHeight||t.update()}function $n(){const e=this;e.documentTouchHandlerProceeded||(e.documentTouchHandlerProceeded=!0,e.params.touchReleaseOnEdges&&(e.el.style.touchAction="auto"))}const Bn=(e,t)=>{const r=Wi(),{params:i,el:n,wrapperEl:s,device:a}=e,o=!!i.nested,l="on"===t?"addEventListener":"removeEventListener",d=t;n&&"string"!=typeof n&&(r[l]("touchstart",e.onDocumentTouchStart,{passive:!1,capture:o}),n[l]("touchstart",e.onTouchStart,{passive:!1}),n[l]("pointerdown",e.onTouchStart,{passive:!1}),r[l]("touchmove",e.onTouchMove,{passive:!1,capture:o}),r[l]("pointermove",e.onTouchMove,{passive:!1,capture:o}),r[l]("touchend",e.onTouchEnd,{passive:!0}),r[l]("pointerup",e.onTouchEnd,{passive:!0}),r[l]("pointercancel",e.onTouchEnd,{passive:!0}),r[l]("touchcancel",e.onTouchEnd,{passive:!0}),r[l]("pointerout",e.onTouchEnd,{passive:!0}),r[l]("pointerleave",e.onTouchEnd,{passive:!0}),r[l]("contextmenu",e.onTouchEnd,{passive:!0}),(i.preventClicks||i.preventClicksPropagation)&&n[l]("click",e.onClick,!0),i.cssMode&&s[l]("scroll",e.onScroll),i.updateOnWindowResize?e[d](a.ios||a.android?"resize orientationchange observerUpdate":"resize observerUpdate",On,!0):e[d]("observerUpdate",On,!0),n[l]("load",e.onLoad,{capture:!0}))};const Un=(e,t)=>e.grid&&t.grid&&t.grid.rows>1;var zn={setBreakpoint:function(){const e=this,{realIndex:t,initialized:r,params:i,el:n}=e,s=i.breakpoints;if(!s||s&&0===Object.keys(s).length)return;const a=e.getBreakpoint(s,e.params.breakpointsBase,e.el);if(!a||e.currentBreakpoint===a)return;const o=(a in s?s[a]:void 0)||e.originalParams,l=Un(e,i),d=Un(e,o),c=e.params.grabCursor,u=o.grabCursor,h=i.enabled;l&&!d?(n.classList.remove(`${i.containerModifierClass}grid`,`${i.containerModifierClass}grid-column`),e.emitContainerClasses()):!l&&d&&(n.classList.add(`${i.containerModifierClass}grid`),(o.grid.fill&&"column"===o.grid.fill||!o.grid.fill&&"column"===i.grid.fill)&&n.classList.add(`${i.containerModifierClass}grid-column`),e.emitContainerClasses()),c&&!u?e.unsetGrabCursor():!c&&u&&e.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(t=>{if(void 0===o[t])return;const r=i[t]&&i[t].enabled,n=o[t]&&o[t].enabled;r&&!n&&e[t].disable(),!r&&n&&e[t].enable()});const f=o.direction&&o.direction!==i.direction,p=i.loop&&(o.slidesPerView!==i.slidesPerView||f),m=i.loop;f&&r&&e.changeDirection(),en(e.params,o);const g=e.params.enabled,v=e.params.loop;Object.assign(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),h&&!g?e.disable():!h&&g&&e.enable(),e.currentBreakpoint=a,e.emit("_beforeBreakpoint",o),r&&(p?(e.loopDestroy(),e.loopCreate(t),e.updateSlides()):!m&&v?(e.loopCreate(t),e.updateSlides()):m&&!v&&e.loopDestroy()),e.emit("breakpoint",o)},getBreakpoint:function(e,t,r){if(void 0===t&&(t="window"),!e||"container"===t&&!r)return;let i=!1;const n=Ki(),s="window"===t?n.innerHeight:r.clientHeight,a=Object.keys(e).map(e=>{if("string"==typeof e&&0===e.indexOf("@")){const t=parseFloat(e.substr(1));return{value:s*t,point:e}}return{value:e,point:e}});a.sort((e,t)=>parseInt(e.value,10)-parseInt(t.value,10));for(let e=0;e<a.length;e+=1){const{point:s,value:o}=a[e];"window"===t?n.matchMedia(`(min-width: ${o}px)`).matches&&(i=s):o<=r.clientWidth&&(i=s)}return i||"max"}};var Gn={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function jn(e,t){return function(r){void 0===r&&(r={});const i=Object.keys(r)[0],n=r[i];"object"==typeof n&&null!==n?(!0===e[i]&&(e[i]={enabled:!0}),"navigation"===i&&e[i]&&e[i].enabled&&!e[i].prevEl&&!e[i].nextEl&&(e[i].auto=!0),["pagination","scrollbar"].indexOf(i)>=0&&e[i]&&e[i].enabled&&!e[i].el&&(e[i].auto=!0),i in e&&"enabled"in n?("object"!=typeof e[i]||"enabled"in e[i]||(e[i].enabled=!0),e[i]||(e[i]={enabled:!1}),en(t,r)):en(t,r)):en(t,r)}}const Hn={eventsEmitter:yn,update:xn,translate:An,transition:Ln,slide:In,loop:Rn,grabCursor:{setGrabCursor:function(e){const t=this;if(!t.params.simulateTouch||t.params.watchOverflow&&t.isLocked||t.params.cssMode)return;const r="container"===t.params.touchEventsTarget?t.el:t.wrapperEl;t.isElement&&(t.__preventObserver__=!0),r.style.cursor="move",r.style.cursor=e?"grabbing":"grab",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1})},unsetGrabCursor:function(){const e=this;e.params.watchOverflow&&e.isLocked||e.params.cssMode||(e.isElement&&(e.__preventObserver__=!0),e["container"===e.params.touchEventsTarget?"el":"wrapperEl"].style.cursor="",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1}))}},events:{attachEvents:function(){const e=this,{params:t}=e;e.onTouchStart=Dn.bind(e),e.onTouchMove=Cn.bind(e),e.onTouchEnd=_n.bind(e),e.onDocumentTouchStart=$n.bind(e),t.cssMode&&(e.onScroll=Nn.bind(e)),e.onClick=Mn.bind(e),e.onLoad=Fn.bind(e),Bn(e,"on")},detachEvents:function(){Bn(this,"off")}},breakpoints:zn,checkOverflow:{checkOverflow:function(){const e=this,{isLocked:t,params:r}=e,{slidesOffsetBefore:i}=r;if(i){const t=e.slides.length-1,r=e.slidesGrid[t]+e.slidesSizesGrid[t]+2*i;e.isLocked=e.size>r}else e.isLocked=1===e.snapGrid.length;!0===r.allowSlideNext&&(e.allowSlideNext=!e.isLocked),!0===r.allowSlidePrev&&(e.allowSlidePrev=!e.isLocked),t&&t!==e.isLocked&&(e.isEnd=!1),t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock")}},classes:{addClasses:function(){const e=this,{classNames:t,params:r,rtl:i,el:n,device:s}=e,a=function(e,t){const r=[];return e.forEach(e=>{"object"==typeof e?Object.keys(e).forEach(i=>{e[i]&&r.push(t+i)}):"string"==typeof e&&r.push(t+e)}),r}(["initialized",r.direction,{"free-mode":e.params.freeMode&&r.freeMode.enabled},{autoheight:r.autoHeight},{rtl:i},{grid:r.grid&&r.grid.rows>1},{"grid-column":r.grid&&r.grid.rows>1&&"column"===r.grid.fill},{android:s.android},{ios:s.ios},{"css-mode":r.cssMode},{centered:r.cssMode&&r.centeredSlides},{"watch-progress":r.watchSlidesProgress}],r.containerModifierClass);t.push(...a),n.classList.add(...t),e.emitContainerClasses()},removeClasses:function(){const{el:e,classNames:t}=this;e&&"string"!=typeof e&&(e.classList.remove(...t),this.emitContainerClasses())}}},Vn={};let Wn=class e{constructor(){let t,r;for(var i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];1===n.length&&n[0].constructor&&"Object"===Object.prototype.toString.call(n[0]).slice(8,-1)?r=n[0]:[t,r]=n,r||(r={}),r=en({},r),t&&!r.el&&(r.el=t);const a=Wi();if(r.el&&"string"==typeof r.el&&a.querySelectorAll(r.el).length>1){const t=[];return a.querySelectorAll(r.el).forEach(i=>{const n=en({},r,{el:i});t.push(new e(n))}),t}const o=this;o.__swiper__=!0,o.support=mn(),o.device=gn({userAgent:r.userAgent}),o.browser=vn(),o.eventsListeners={},o.eventsAnyListeners=[],o.modules=[...o.__modules__],r.modules&&Array.isArray(r.modules)&&o.modules.push(...r.modules);const l={};o.modules.forEach(e=>{e({params:r,swiper:o,extendParams:jn(r,l),on:o.on.bind(o),once:o.once.bind(o),off:o.off.bind(o),emit:o.emit.bind(o)})});const d=en({},Gn,l);return o.params=en({},d,Vn,r),o.originalParams=en({},o.params),o.passedParams=en({},r),o.params&&o.params.on&&Object.keys(o.params.on).forEach(e=>{o.on(e,o.params.on[e])}),o.params&&o.params.onAny&&o.onAny(o.params.onAny),Object.assign(o,{enabled:o.params.enabled,el:t,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal:()=>"horizontal"===o.params.direction,isVertical:()=>"vertical"===o.params.direction,activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:o.params.allowSlideNext,allowSlidePrev:o.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:o.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:o.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),o.emit("_swiper"),o.params.init&&o.init(),o}getDirectionLabel(e){return this.isHorizontal()?e:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[e]}getSlideIndex(e){const{slidesEl:t,params:r}=this,i=dn(sn(t,`.${r.slideClass}, swiper-slide`)[0]);return dn(e)-i}getSlideIndexByData(e){return this.getSlideIndex(this.slides.filter(t=>1*t.getAttribute("data-swiper-slide-index")===e)[0])}recalcSlides(){const{slidesEl:e,params:t}=this;this.slides=sn(e,`.${t.slideClass}, swiper-slide`)}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,t){const r=this;e=Math.min(Math.max(e,0),1);const i=r.minTranslate(),n=(r.maxTranslate()-i)*e+i;r.translateTo(n,void 0===t?0:t),r.updateActiveIndex(),r.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=e.el.className.split(" ").filter(t=>0===t.indexOf("swiper")||0===t.indexOf(e.params.containerModifierClass));e.emit("_containerClasses",t.join(" "))}getSlideClasses(e){const t=this;return t.destroyed?"":e.className.split(" ").filter(e=>0===e.indexOf("swiper-slide")||0===e.indexOf(t.params.slideClass)).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=[];e.slides.forEach(r=>{const i=e.getSlideClasses(r);t.push({slideEl:r,classNames:i}),e.emit("_slideClass",r,i)}),e.emit("_slideClasses",t)}slidesPerViewDynamic(e,t){void 0===e&&(e="current"),void 0===t&&(t=!1);const{params:r,slides:i,slidesGrid:n,slidesSizesGrid:s,size:a,activeIndex:o}=this;let l=1;if("number"==typeof r.slidesPerView)return r.slidesPerView;if(r.centeredSlides){let e,t=i[o]?Math.ceil(i[o].swiperSlideSize):0;for(let r=o+1;r<i.length;r+=1)i[r]&&!e&&(t+=Math.ceil(i[r].swiperSlideSize),l+=1,t>a&&(e=!0));for(let r=o-1;r>=0;r-=1)i[r]&&!e&&(t+=i[r].swiperSlideSize,l+=1,t>a&&(e=!0))}else if("current"===e)for(let e=o+1;e<i.length;e+=1){(t?n[e]+s[e]-n[o]<a:n[e]-n[o]<a)&&(l+=1)}else for(let e=o-1;e>=0;e-=1){n[o]-n[e]<a&&(l+=1)}return l}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:r}=e;function i(){const t=e.rtlTranslate?-1*e.translate:e.translate,r=Math.min(Math.max(t,e.maxTranslate()),e.minTranslate());e.setTranslate(r),e.updateActiveIndex(),e.updateSlidesClasses()}let n;if(r.breakpoints&&e.setBreakpoint(),[...e.el.querySelectorAll('[loading="lazy"]')].forEach(t=>{t.complete&&wn(e,t)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),r.freeMode&&r.freeMode.enabled&&!r.cssMode)i(),r.autoHeight&&e.updateAutoHeight();else{if(("auto"===r.slidesPerView||r.slidesPerView>1)&&e.isEnd&&!r.centeredSlides){const t=e.virtual&&r.virtual.enabled?e.virtual.slides:e.slides;n=e.slideTo(t.length-1,0,!1,!0)}else n=e.slideTo(e.activeIndex,0,!1,!0);n||i()}r.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t){void 0===t&&(t=!0);const r=this,i=r.params.direction;return e||(e="horizontal"===i?"vertical":"horizontal"),e===i||"horizontal"!==e&&"vertical"!==e||(r.el.classList.remove(`${r.params.containerModifierClass}${i}`),r.el.classList.add(`${r.params.containerModifierClass}${e}`),r.emitContainerClasses(),r.params.direction=e,r.slides.forEach(t=>{"vertical"===e?t.style.width="":t.style.height=""}),r.emit("changeDirection"),t&&r.update()),r}changeLanguageDirection(e){const t=this;t.rtl&&"rtl"===e||!t.rtl&&"ltr"===e||(t.rtl="rtl"===e,t.rtlTranslate="horizontal"===t.params.direction&&t.rtl,t.rtl?(t.el.classList.add(`${t.params.containerModifierClass}rtl`),t.el.dir="rtl"):(t.el.classList.remove(`${t.params.containerModifierClass}rtl`),t.el.dir="ltr"),t.update())}mount(e){const t=this;if(t.mounted)return!0;let r=e||t.params.el;if("string"==typeof r&&(r=document.querySelector(r)),!r)return!1;r.swiper=t,r.parentNode&&r.parentNode.host&&r.parentNode.host.nodeName===t.params.swiperElementNodeName.toUpperCase()&&(t.isElement=!0);const i=()=>`.${(t.params.wrapperClass||"").trim().split(" ").join(".")}`;let n=(()=>{if(r&&r.shadowRoot&&r.shadowRoot.querySelector){return r.shadowRoot.querySelector(i())}return sn(r,i())[0]})();return!n&&t.params.createElements&&(n=on("div",t.params.wrapperClass),r.append(n),sn(r,`.${t.params.slideClass}`).forEach(e=>{n.append(e)})),Object.assign(t,{el:r,wrapperEl:n,slidesEl:t.isElement&&!r.parentNode.host.slideSlots?r.parentNode.host:n,hostEl:t.isElement?r.parentNode.host:r,mounted:!0,rtl:"rtl"===r.dir.toLowerCase()||"rtl"===ln(r,"direction"),rtlTranslate:"horizontal"===t.params.direction&&("rtl"===r.dir.toLowerCase()||"rtl"===ln(r,"direction")),wrongRTL:"-webkit-box"===ln(n,"display")}),!0}init(e){const t=this;if(t.initialized)return t;if(!1===t.mount(e))return t;t.emit("beforeInit"),t.params.breakpoints&&t.setBreakpoint(),t.addClasses(),t.updateSize(),t.updateSlides(),t.params.watchOverflow&&t.checkOverflow(),t.params.grabCursor&&t.enabled&&t.setGrabCursor(),t.params.loop&&t.virtual&&t.params.virtual.enabled?t.slideTo(t.params.initialSlide+t.virtual.slidesBefore,0,t.params.runCallbacksOnInit,!1,!0):t.slideTo(t.params.initialSlide,0,t.params.runCallbacksOnInit,!1,!0),t.params.loop&&t.loopCreate(),t.attachEvents();const r=[...t.el.querySelectorAll('[loading="lazy"]')];return t.isElement&&r.push(...t.hostEl.querySelectorAll('[loading="lazy"]')),r.forEach(e=>{e.complete?wn(t,e):e.addEventListener("load",e=>{wn(t,e.target)})}),Tn(t),t.initialized=!0,Tn(t),t.emit("init"),t.emit("afterInit"),t}destroy(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0);const r=this,{params:i,el:n,wrapperEl:s,slides:a}=r;return void 0===r.params||r.destroyed||(r.emit("beforeDestroy"),r.initialized=!1,r.detachEvents(),i.loop&&r.loopDestroy(),t&&(r.removeClasses(),n&&"string"!=typeof n&&n.removeAttribute("style"),s&&s.removeAttribute("style"),a&&a.length&&a.forEach(e=>{e.classList.remove(i.slideVisibleClass,i.slideFullyVisibleClass,i.slideActiveClass,i.slideNextClass,i.slidePrevClass),e.removeAttribute("style"),e.removeAttribute("data-swiper-slide-index")})),r.emit("destroy"),Object.keys(r.eventsListeners).forEach(e=>{r.off(e)}),!1!==e&&(r.el&&"string"!=typeof r.el&&(r.el.swiper=null),function(e){const t=e;Object.keys(t).forEach(e=>{try{t[e]=null}catch(e){}try{delete t[e]}catch(e){}})}(r)),r.destroyed=!0),null}static extendDefaults(e){en(Vn,e)}static get extendedDefaults(){return Vn}static get defaults(){return Gn}static installModule(t){e.prototype.__modules__||(e.prototype.__modules__=[]);const r=e.prototype.__modules__;"function"==typeof t&&r.indexOf(t)<0&&r.push(t)}static use(t){return Array.isArray(t)?(t.forEach(t=>e.installModule(t)),e):(e.installModule(t),e)}};Object.keys(Hn).forEach(e=>{Object.keys(Hn[e]).forEach(t=>{Wn.prototype[t]=Hn[e][t]})}),Wn.use([function(e){let{swiper:t,on:r,emit:i}=e;const n=Ki();let s=null,a=null;const o=()=>{t&&!t.destroyed&&t.initialized&&(i("beforeResize"),i("resize"))},l=()=>{t&&!t.destroyed&&t.initialized&&i("orientationchange")};r("init",()=>{t.params.resizeObserver&&void 0!==n.ResizeObserver?t&&!t.destroyed&&t.initialized&&(s=new ResizeObserver(e=>{a=n.requestAnimationFrame(()=>{const{width:r,height:i}=t;let n=r,s=i;e.forEach(e=>{let{contentBoxSize:r,contentRect:i,target:a}=e;a&&a!==t.el||(n=i?i.width:(r[0]||r).inlineSize,s=i?i.height:(r[0]||r).blockSize)}),n===r&&s===i||o()})}),s.observe(t.el)):(n.addEventListener("resize",o),n.addEventListener("orientationchange",l))}),r("destroy",()=>{a&&n.cancelAnimationFrame(a),s&&s.unobserve&&t.el&&(s.unobserve(t.el),s=null),n.removeEventListener("resize",o),n.removeEventListener("orientationchange",l)})},function(e){let{swiper:t,extendParams:r,on:i,emit:n}=e;const s=[],a=Ki(),o=function(e,r){void 0===r&&(r={});const i=new(a.MutationObserver||a.WebkitMutationObserver)(e=>{if(t.__preventObserver__)return;if(1===e.length)return void n("observerUpdate",e[0]);const r=function(){n("observerUpdate",e[0])};a.requestAnimationFrame?a.requestAnimationFrame(r):a.setTimeout(r,0)});i.observe(e,{attributes:void 0===r.attributes||r.attributes,childList:t.isElement||(void 0===r.childList||r).childList,characterData:void 0===r.characterData||r.characterData}),s.push(i)};r({observer:!1,observeParents:!1,observeSlideChildren:!1}),i("init",()=>{if(t.params.observer){if(t.params.observeParents){const e=function(e){const t=[];let r=e.parentElement;for(;r;)t.push(r),r=r.parentElement;return t}(t.hostEl);for(let t=0;t<e.length;t+=1)o(e[t])}o(t.hostEl,{childList:t.params.observeSlideChildren}),o(t.wrapperEl,{attributes:!1})}}),i("destroy",()=>{s.forEach(e=>{e.disconnect()}),s.splice(0,s.length)})}]);const Yn=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function Kn(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!e.__swiper__}function qn(e,t){const r=["__proto__","constructor","prototype"];Object.keys(t).filter(e=>r.indexOf(e)<0).forEach(r=>{void 0===e[r]?e[r]=t[r]:Kn(t[r])&&Kn(e[r])&&Object.keys(t[r]).length>0?t[r].__swiper__?e[r]=t[r]:qn(e[r],t[r]):e[r]=t[r]})}function Xn(e){return void 0===e&&(e={}),e.navigation&&void 0===e.navigation.nextEl&&void 0===e.navigation.prevEl}function Qn(e){return void 0===e&&(e={}),e.pagination&&void 0===e.pagination.el}function Zn(e){return void 0===e&&(e={}),e.scrollbar&&void 0===e.scrollbar.el}function Jn(e){void 0===e&&(e="");const t=e.split(" ").map(e=>e.trim()).filter(e=>!!e),r=[];return t.forEach(e=>{r.indexOf(e)<0&&r.push(e)}),r.join(" ")}function es(e){return void 0===e&&(e=""),e?e.includes("swiper-wrapper")?e:`swiper-wrapper ${e}`:"swiper-wrapper"}function ts(){return ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ts.apply(this,arguments)}function rs(e){return e.type&&e.type.displayName&&e.type.displayName.includes("SwiperSlide")}function is(e){const r=[];return t.Children.toArray(e).forEach(e=>{rs(e)?r.push(e):e.props&&e.props.children&&is(e.props.children).forEach(e=>r.push(e))}),r}function ns(e){const r=[],i={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return t.Children.toArray(e).forEach(e=>{if(rs(e))r.push(e);else if(e.props&&e.props.slot&&i[e.props.slot])i[e.props.slot].push(e);else if(e.props&&e.props.children){const t=is(e.props.children);t.length>0?t.forEach(e=>r.push(e)):i["container-end"].push(e)}else i["container-end"].push(e)}),{slides:r,slots:i}}function ss(e,t){return"undefined"==typeof window?i(e,t):o(e,t)}const as=l(null),os=l(null),ls=n(function(e,n){let{className:s,tag:o="div",wrapperTag:l="div",children:d,onSwiper:c,...u}=void 0===e?{}:e,h=!1;const[f,p]=a("swiper"),[m,g]=a(null),[v,y]=a(!1),b=r(!1),E=r(null),w=r(null),S=r(null),T=r(null),x=r(null),A=r(null),k=r(null),L=r(null),{params:I,passedParams:R,rest:P,events:D}=function(e,t){void 0===e&&(e={}),void 0===t&&(t=!0);const r={on:{}},i={},n={};qn(r,Gn),r._emitClasses=!0,r.init=!1;const s={},a=Yn.map(e=>e.replace(/_/,"")),o=Object.assign({},e);return Object.keys(o).forEach(o=>{void 0!==e[o]&&(a.indexOf(o)>=0?Kn(e[o])?(r[o]={},n[o]={},qn(r[o],e[o]),qn(n[o],e[o])):(r[o]=e[o],n[o]=e[o]):0===o.search(/on[A-Z]/)&&"function"==typeof e[o]?t?i[`${o[2].toLowerCase()}${o.substr(3)}`]=e[o]:r.on[`${o[2].toLowerCase()}${o.substr(3)}`]=e[o]:s[o]=e[o])}),["navigation","pagination","scrollbar"].forEach(e=>{!0===r[e]&&(r[e]={}),!1===r[e]&&delete r[e]}),{params:r,passedParams:n,rest:s,events:i}}(u),{slides:C,slots:_}=ns(d),O=()=>{y(!v)};Object.assign(I.on,{_containerClasses(e,t){p(t)}});const M=()=>{Object.assign(I.on,D),h=!0;const e={...I};if(delete e.wrapperClass,w.current=new Wn(e),w.current.virtual&&w.current.params.virtual.enabled){w.current.virtual.slides=C;const e={cache:!1,slides:C,renderExternal:g,renderExternalUpdate:!1};qn(w.current.params.virtual,e),qn(w.current.originalParams.virtual,e)}};E.current||M(),w.current&&w.current.on("_beforeBreakpoint",O);return i(()=>()=>{w.current&&w.current.off("_beforeBreakpoint",O)}),i(()=>{!b.current&&w.current&&(w.current.emitSlidesClasses(),b.current=!0)}),ss(()=>{if(n&&(n.current=E.current),E.current)return w.current.destroyed&&M(),function(e,t){let{el:r,nextEl:i,prevEl:n,paginationEl:s,scrollbarEl:a,swiper:o}=e;Xn(t)&&i&&n&&(o.params.navigation.nextEl=i,o.originalParams.navigation.nextEl=i,o.params.navigation.prevEl=n,o.originalParams.navigation.prevEl=n),Qn(t)&&s&&(o.params.pagination.el=s,o.originalParams.pagination.el=s),Zn(t)&&a&&(o.params.scrollbar.el=a,o.originalParams.scrollbar.el=a),o.init(r)}({el:E.current,nextEl:x.current,prevEl:A.current,paginationEl:k.current,scrollbarEl:L.current,swiper:w.current},I),c&&!w.current.destroyed&&c(w.current),()=>{w.current&&!w.current.destroyed&&w.current.destroy(!0,!1)}},[]),ss(()=>{!h&&D&&w.current&&Object.keys(D).forEach(e=>{w.current.on(e,D[e])});const e=function(e,t,r,i,n){const s=[];if(!t)return s;const a=e=>{s.indexOf(e)<0&&s.push(e)};if(r&&i){const e=i.map(n),t=r.map(n);e.join("")!==t.join("")&&a("children"),i.length!==r.length&&a("children")}return Yn.filter(e=>"_"===e[0]).map(e=>e.replace(/_/,"")).forEach(r=>{if(r in e&&r in t)if(Kn(e[r])&&Kn(t[r])){const i=Object.keys(e[r]),n=Object.keys(t[r]);i.length!==n.length?a(r):(i.forEach(i=>{e[r][i]!==t[r][i]&&a(r)}),n.forEach(i=>{e[r][i]!==t[r][i]&&a(r)}))}else e[r]!==t[r]&&a(r)}),s}(R,S.current,C,T.current,e=>e.key);return S.current=R,T.current=C,e.length&&w.current&&!w.current.destroyed&&function(e){let{swiper:t,slides:r,passedParams:i,changedParams:n,nextEl:s,prevEl:a,scrollbarEl:o,paginationEl:l}=e;const d=n.filter(e=>"children"!==e&&"direction"!==e&&"wrapperClass"!==e),{params:c,pagination:u,navigation:h,scrollbar:f,virtual:p,thumbs:m}=t;let g,v,y,b,E,w,S,T;n.includes("thumbs")&&i.thumbs&&i.thumbs.swiper&&!i.thumbs.swiper.destroyed&&c.thumbs&&(!c.thumbs.swiper||c.thumbs.swiper.destroyed)&&(g=!0),n.includes("controller")&&i.controller&&i.controller.control&&c.controller&&!c.controller.control&&(v=!0),n.includes("pagination")&&i.pagination&&(i.pagination.el||l)&&(c.pagination||!1===c.pagination)&&u&&!u.el&&(y=!0),n.includes("scrollbar")&&i.scrollbar&&(i.scrollbar.el||o)&&(c.scrollbar||!1===c.scrollbar)&&f&&!f.el&&(b=!0),n.includes("navigation")&&i.navigation&&(i.navigation.prevEl||a)&&(i.navigation.nextEl||s)&&(c.navigation||!1===c.navigation)&&h&&!h.prevEl&&!h.nextEl&&(E=!0);const x=e=>{t[e]&&(t[e].destroy(),"navigation"===e?(t.isElement&&(t[e].prevEl.remove(),t[e].nextEl.remove()),c[e].prevEl=void 0,c[e].nextEl=void 0,t[e].prevEl=void 0,t[e].nextEl=void 0):(t.isElement&&t[e].el.remove(),c[e].el=void 0,t[e].el=void 0))};n.includes("loop")&&t.isElement&&(c.loop&&!i.loop?w=!0:!c.loop&&i.loop?S=!0:T=!0),d.forEach(e=>{if(Kn(c[e])&&Kn(i[e]))Object.assign(c[e],i[e]),"navigation"!==e&&"pagination"!==e&&"scrollbar"!==e||!("enabled"in i[e])||i[e].enabled||x(e);else{const t=i[e];!0!==t&&!1!==t||"navigation"!==e&&"pagination"!==e&&"scrollbar"!==e?c[e]=i[e]:!1===t&&x(e)}}),d.includes("controller")&&!v&&t.controller&&t.controller.control&&c.controller&&c.controller.control&&(t.controller.control=c.controller.control),n.includes("children")&&r&&p&&c.virtual.enabled?(p.slides=r,p.update(!0)):n.includes("virtual")&&p&&c.virtual.enabled&&(r&&(p.slides=r),p.update(!0)),n.includes("children")&&r&&c.loop&&(T=!0),g&&m.init()&&m.update(!0);v&&(t.controller.control=c.controller.control),y&&(!t.isElement||l&&"string"!=typeof l||(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),t.el.appendChild(l)),l&&(c.pagination.el=l),u.init(),u.render(),u.update()),b&&(!t.isElement||o&&"string"!=typeof o||(o=document.createElement("div"),o.classList.add("swiper-scrollbar"),o.part.add("scrollbar"),t.el.appendChild(o)),o&&(c.scrollbar.el=o),f.init(),f.updateSize(),f.setTranslate()),E&&(t.isElement&&(s&&"string"!=typeof s||(s=document.createElement("div"),s.classList.add("swiper-button-next"),s.innerHTML=t.hostEl.constructor.nextButtonSvg,s.part.add("button-next"),t.el.appendChild(s)),a&&"string"!=typeof a||(a=document.createElement("div"),a.classList.add("swiper-button-prev"),a.innerHTML=t.hostEl.constructor.prevButtonSvg,a.part.add("button-prev"),t.el.appendChild(a))),s&&(c.navigation.nextEl=s),a&&(c.navigation.prevEl=a),h.init(),h.update()),n.includes("allowSlideNext")&&(t.allowSlideNext=i.allowSlideNext),n.includes("allowSlidePrev")&&(t.allowSlidePrev=i.allowSlidePrev),n.includes("direction")&&t.changeDirection(i.direction,!1),(w||T)&&t.loopDestroy(),(S||T)&&t.loopCreate(),t.update()}({swiper:w.current,slides:C,passedParams:R,changedParams:e,nextEl:x.current,prevEl:A.current,scrollbarEl:L.current,paginationEl:k.current}),()=>{D&&w.current&&Object.keys(D).forEach(e=>{w.current.off(e,D[e])})}}),ss(()=>{var e;!(e=w.current)||e.destroyed||!e.params.virtual||e.params.virtual&&!e.params.virtual.enabled||(e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),e.parallax&&e.params.parallax&&e.params.parallax.enabled&&e.parallax.setTranslate())},[m]),t.createElement(o,ts({ref:E,className:Jn(`${f}${s?` ${s}`:""}`)},P),t.createElement(os.Provider,{value:w.current},_["container-start"],t.createElement(l,{className:es(I.wrapperClass)},_["wrapper-start"],I.virtual?function(e,r,i){if(!i)return null;const n=e=>{let t=e;return e<0?t=r.length+e:t>=r.length&&(t-=r.length),t},s=e.isHorizontal()?{[e.rtlTranslate?"right":"left"]:`${i.offset}px`}:{top:`${i.offset}px`},{from:a,to:o}=i,l=e.params.loop?-r.length:0,d=e.params.loop?2*r.length:r.length,c=[];for(let e=l;e<d;e+=1)e>=a&&e<=o&&c.push(r[n(e)]);return c.map((r,i)=>t.cloneElement(r,{swiper:e,style:s,key:r.props.virtualIndex||r.key||`slide-${i}`}))}(w.current,C,m):C.map((e,r)=>t.cloneElement(e,{swiper:w.current,swiperSlideIndex:r})),_["wrapper-end"]),Xn(I)&&t.createElement(t.Fragment,null,t.createElement("div",{ref:A,className:"swiper-button-prev"}),t.createElement("div",{ref:x,className:"swiper-button-next"})),Zn(I)&&t.createElement("div",{ref:L,className:"swiper-scrollbar"}),Qn(I)&&t.createElement("div",{ref:k,className:"swiper-pagination"}),_["container-end"]))});ls.displayName="Swiper";const ds=n(function(e,i){let{tag:n="div",children:s,className:o="",swiper:l,zoom:d,lazy:c,virtualIndex:u,swiperSlideIndex:h,...f}=void 0===e?{}:e;const p=r(null),[m,g]=a("swiper-slide"),[v,y]=a(!1);function b(e,t,r){t===p.current&&g(r)}ss(()=>{if(void 0!==h&&(p.current.swiperSlideIndex=h),i&&(i.current=p.current),p.current&&l){if(!l.destroyed)return l.on("_slideClass",b),()=>{l&&l.off("_slideClass",b)};"swiper-slide"!==m&&g("swiper-slide")}}),ss(()=>{l&&p.current&&!l.destroyed&&g(l.getSlideClasses(p.current))},[l]);const E={isActive:m.indexOf("swiper-slide-active")>=0,isVisible:m.indexOf("swiper-slide-visible")>=0,isPrev:m.indexOf("swiper-slide-prev")>=0,isNext:m.indexOf("swiper-slide-next")>=0},w=()=>"function"==typeof s?s(E):s;return t.createElement(n,ts({ref:p,className:Jn(`${m}${o?` ${o}`:""}`),"data-swiper-slide-index":u,onLoad:()=>{y(!0)}},f),d&&t.createElement(as.Provider,{value:E},t.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":"number"==typeof d?d:void 0},w(),c&&!v&&t.createElement("div",{className:"swiper-lazy-preloader"}))),!d&&t.createElement(as.Provider,{value:E},w(),c&&!v&&t.createElement("div",{className:"swiper-lazy-preloader"})))});function cs(e){let{swiper:t,extendParams:r,on:i,emit:n}=e;const s=Ki();let a;r({mousewheel:{enabled:!1,releaseOnEdges:!1,invert:!1,forceToAxis:!1,sensitivity:1,eventsTarget:"container",thresholdDelta:null,thresholdTime:null,noMousewheelClass:"swiper-no-mousewheel"}}),t.mousewheel={enabled:!1};let o,l=Xi();const d=[];function c(){t.enabled&&(t.mouseEntered=!0)}function u(){t.enabled&&(t.mouseEntered=!1)}function h(e){return!(t.params.mousewheel.thresholdDelta&&e.delta<t.params.mousewheel.thresholdDelta)&&(!(t.params.mousewheel.thresholdTime&&Xi()-l<t.params.mousewheel.thresholdTime)&&(e.delta>=6&&Xi()-l<60||(e.direction<0?t.isEnd&&!t.params.loop||t.animating||(t.slideNext(),n("scroll",e.raw)):t.isBeginning&&!t.params.loop||t.animating||(t.slidePrev(),n("scroll",e.raw)),l=(new s.Date).getTime(),!1)))}function f(e){let r=e,i=!0;if(!t.enabled)return;if(e.target.closest(`.${t.params.mousewheel.noMousewheelClass}`))return;const s=t.params.mousewheel;t.params.cssMode&&r.preventDefault();let l=t.el;"container"!==t.params.mousewheel.eventsTarget&&(l=document.querySelector(t.params.mousewheel.eventsTarget));const c=l&&l.contains(r.target);if(!t.mouseEntered&&!c&&!s.releaseOnEdges)return!0;r.originalEvent&&(r=r.originalEvent);let u=0;const f=t.rtlTranslate?-1:1,p=function(e){let t=0,r=0,i=0,n=0;return"detail"in e&&(r=e.detail),"wheelDelta"in e&&(r=-e.wheelDelta/120),"wheelDeltaY"in e&&(r=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=r,r=0),i=10*t,n=10*r,"deltaY"in e&&(n=e.deltaY),"deltaX"in e&&(i=e.deltaX),e.shiftKey&&!i&&(i=n,n=0),(i||n)&&e.deltaMode&&(1===e.deltaMode?(i*=40,n*=40):(i*=800,n*=800)),i&&!t&&(t=i<1?-1:1),n&&!r&&(r=n<1?-1:1),{spinX:t,spinY:r,pixelX:i,pixelY:n}}(r);if(s.forceToAxis)if(t.isHorizontal()){if(!(Math.abs(p.pixelX)>Math.abs(p.pixelY)))return!0;u=-p.pixelX*f}else{if(!(Math.abs(p.pixelY)>Math.abs(p.pixelX)))return!0;u=-p.pixelY}else u=Math.abs(p.pixelX)>Math.abs(p.pixelY)?-p.pixelX*f:-p.pixelY;if(0===u)return!0;s.invert&&(u=-u);let m=t.getTranslate()+u*s.sensitivity;if(m>=t.minTranslate()&&(m=t.minTranslate()),m<=t.maxTranslate()&&(m=t.maxTranslate()),i=!!t.params.loop||!(m===t.minTranslate()||m===t.maxTranslate()),i&&t.params.nested&&r.stopPropagation(),t.params.freeMode&&t.params.freeMode.enabled){const e={time:Xi(),delta:Math.abs(u),direction:Math.sign(u)},i=o&&e.time<o.time+500&&e.delta<=o.delta&&e.direction===o.direction;if(!i){o=void 0;let l=t.getTranslate()+u*s.sensitivity;const c=t.isBeginning,h=t.isEnd;if(l>=t.minTranslate()&&(l=t.minTranslate()),l<=t.maxTranslate()&&(l=t.maxTranslate()),t.setTransition(0),t.setTranslate(l),t.updateProgress(),t.updateActiveIndex(),t.updateSlidesClasses(),(!c&&t.isBeginning||!h&&t.isEnd)&&t.updateSlidesClasses(),t.params.loop&&t.loopFix({direction:e.direction<0?"next":"prev",byMousewheel:!0}),t.params.freeMode.sticky){clearTimeout(a),a=void 0,d.length>=15&&d.shift();const r=d.length?d[d.length-1]:void 0,i=d[0];if(d.push(e),r&&(e.delta>r.delta||e.direction!==r.direction))d.splice(0);else if(d.length>=15&&e.time-i.time<500&&i.delta-e.delta>=1&&e.delta<=6){const r=u>0?.8:.2;o=e,d.splice(0),a=qi(()=>{!t.destroyed&&t.params&&t.slideToClosest(t.params.speed,!0,void 0,r)},0)}a||(a=qi(()=>{if(t.destroyed||!t.params)return;o=e,d.splice(0),t.slideToClosest(t.params.speed,!0,void 0,.5)},500))}if(i||n("scroll",r),t.params.autoplay&&t.params.autoplayDisableOnInteraction&&t.autoplay.stop(),s.releaseOnEdges&&(l===t.minTranslate()||l===t.maxTranslate()))return!0}}else{const r={time:Xi(),delta:Math.abs(u),direction:Math.sign(u),raw:e};d.length>=2&&d.shift();const i=d.length?d[d.length-1]:void 0;if(d.push(r),i?(r.direction!==i.direction||r.delta>i.delta||r.time>i.time+150)&&h(r):h(r),function(e){const r=t.params.mousewheel;if(e.direction<0){if(t.isEnd&&!t.params.loop&&r.releaseOnEdges)return!0}else if(t.isBeginning&&!t.params.loop&&r.releaseOnEdges)return!0;return!1}(r))return!0}return r.preventDefault?r.preventDefault():r.returnValue=!1,!1}function p(e){let r=t.el;"container"!==t.params.mousewheel.eventsTarget&&(r=document.querySelector(t.params.mousewheel.eventsTarget)),r[e]("mouseenter",c),r[e]("mouseleave",u),r[e]("wheel",f)}function m(){return t.params.cssMode?(t.wrapperEl.removeEventListener("wheel",f),!0):!t.mousewheel.enabled&&(p("addEventListener"),t.mousewheel.enabled=!0,!0)}function g(){return t.params.cssMode?(t.wrapperEl.addEventListener(event,f),!0):!!t.mousewheel.enabled&&(p("removeEventListener"),t.mousewheel.enabled=!1,!0)}i("init",()=>{!t.params.mousewheel.enabled&&t.params.cssMode&&g(),t.params.mousewheel.enabled&&m()}),i("destroy",()=>{t.params.cssMode&&m(),t.mousewheel.enabled&&g()}),Object.assign(t.mousewheel,{enable:m,disable:g})}function us(e){let{swiper:t,extendParams:r,on:i,emit:n}=e;function s(e){let r;return e&&"string"==typeof e&&t.isElement&&(r=t.el.querySelector(e)||t.hostEl.querySelector(e),r)?r:(e&&("string"==typeof e&&(r=[...document.querySelectorAll(e)]),t.params.uniqueNavElements&&"string"==typeof e&&r&&r.length>1&&1===t.el.querySelectorAll(e).length?r=t.el.querySelector(e):r&&1===r.length&&(r=r[0])),e&&!r?e:r)}function a(e,r){const i=t.params.navigation;(e=un(e)).forEach(e=>{e&&(e.classList[r?"add":"remove"](...i.disabledClass.split(" ")),"BUTTON"===e.tagName&&(e.disabled=r),t.params.watchOverflow&&t.enabled&&e.classList[t.isLocked?"add":"remove"](i.lockClass))})}function o(){const{nextEl:e,prevEl:r}=t.navigation;if(t.params.loop)return a(r,!1),void a(e,!1);a(r,t.isBeginning&&!t.params.rewind),a(e,t.isEnd&&!t.params.rewind)}function l(e){e.preventDefault(),(!t.isBeginning||t.params.loop||t.params.rewind)&&(t.slidePrev(),n("navigationPrev"))}function d(e){e.preventDefault(),(!t.isEnd||t.params.loop||t.params.rewind)&&(t.slideNext(),n("navigationNext"))}function c(){const e=t.params.navigation;if(t.params.navigation=function(e,t,r,i){return e.params.createElements&&Object.keys(i).forEach(n=>{if(!r[n]&&!0===r.auto){let s=sn(e.el,`.${i[n]}`)[0];s||(s=on("div",i[n]),s.className=i[n],e.el.append(s)),r[n]=s,t[n]=s}}),r}(t,t.originalParams.navigation,t.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!e.nextEl&&!e.prevEl)return;let r=s(e.nextEl),i=s(e.prevEl);Object.assign(t.navigation,{nextEl:r,prevEl:i}),r=un(r),i=un(i);const n=(r,i)=>{r&&r.addEventListener("click","next"===i?d:l),!t.enabled&&r&&r.classList.add(...e.lockClass.split(" "))};r.forEach(e=>n(e,"next")),i.forEach(e=>n(e,"prev"))}function u(){let{nextEl:e,prevEl:r}=t.navigation;e=un(e),r=un(r);const i=(e,r)=>{e.removeEventListener("click","next"===r?d:l),e.classList.remove(...t.params.navigation.disabledClass.split(" "))};e.forEach(e=>i(e,"next")),r.forEach(e=>i(e,"prev"))}r({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),t.navigation={nextEl:null,prevEl:null},i("init",()=>{!1===t.params.navigation.enabled?h():(c(),o())}),i("toEdge fromEdge lock unlock",()=>{o()}),i("destroy",()=>{u()}),i("enable disable",()=>{let{nextEl:e,prevEl:r}=t.navigation;e=un(e),r=un(r),t.enabled?o():[...e,...r].filter(e=>!!e).forEach(e=>e.classList.add(t.params.navigation.lockClass))}),i("click",(e,r)=>{let{nextEl:i,prevEl:s}=t.navigation;i=un(i),s=un(s);const a=r.target;let o=s.includes(a)||i.includes(a);if(t.isElement&&!o){const e=r.path||r.composedPath&&r.composedPath();e&&(o=e.find(e=>i.includes(e)||s.includes(e)))}if(t.params.navigation.hideOnClick&&!o){if(t.pagination&&t.params.pagination&&t.params.pagination.clickable&&(t.pagination.el===a||t.pagination.el.contains(a)))return;let e;i.length?e=i[0].classList.contains(t.params.navigation.hiddenClass):s.length&&(e=s[0].classList.contains(t.params.navigation.hiddenClass)),n(!0===e?"navigationShow":"navigationHide"),[...i,...s].filter(e=>!!e).forEach(e=>e.classList.toggle(t.params.navigation.hiddenClass))}});const h=()=>{t.el.classList.add(...t.params.navigation.navigationDisabledClass.split(" ")),u()};Object.assign(t.navigation,{enable:()=>{t.el.classList.remove(...t.params.navigation.navigationDisabledClass.split(" ")),c(),o()},disable:h,update:o,init:c,destroy:u})}function hs(e){let t,r,{swiper:i,extendParams:n,on:s,emit:a,params:o}=e;i.autoplay={running:!1,paused:!1,timeLeft:0},n({autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!1,stopOnLastSlide:!1,reverseDirection:!1,pauseOnMouseEnter:!1}});let l,d,c,u,h,f,p,m,g=o&&o.autoplay?o.autoplay.delay:3e3,v=o&&o.autoplay?o.autoplay.delay:3e3,y=(new Date).getTime();function b(e){i&&!i.destroyed&&i.wrapperEl&&e.target===i.wrapperEl&&(i.wrapperEl.removeEventListener("transitionend",b),m||e.detail&&e.detail.bySwiperTouchMove||A())}const E=()=>{if(i.destroyed||!i.autoplay.running)return;i.autoplay.paused?d=!0:d&&(v=l,d=!1);const e=i.autoplay.paused?l:y+v-(new Date).getTime();i.autoplay.timeLeft=e,a("autoplayTimeLeft",e,e/g),r=requestAnimationFrame(()=>{E()})},w=e=>{if(i.destroyed||!i.autoplay.running)return;cancelAnimationFrame(r),E();let n=void 0===e?i.params.autoplay.delay:e;g=i.params.autoplay.delay,v=i.params.autoplay.delay;const s=(()=>{let e;if(e=i.virtual&&i.params.virtual.enabled?i.slides.filter(e=>e.classList.contains("swiper-slide-active"))[0]:i.slides[i.activeIndex],!e)return;return parseInt(e.getAttribute("data-swiper-autoplay"),10)})();!Number.isNaN(s)&&s>0&&void 0===e&&(n=s,g=s,v=s),l=n;const o=i.params.speed,d=()=>{i&&!i.destroyed&&(i.params.autoplay.reverseDirection?!i.isBeginning||i.params.loop||i.params.rewind?(i.slidePrev(o,!0,!0),a("autoplay")):i.params.autoplay.stopOnLastSlide||(i.slideTo(i.slides.length-1,o,!0,!0),a("autoplay")):!i.isEnd||i.params.loop||i.params.rewind?(i.slideNext(o,!0,!0),a("autoplay")):i.params.autoplay.stopOnLastSlide||(i.slideTo(0,o,!0,!0),a("autoplay")),i.params.cssMode&&(y=(new Date).getTime(),requestAnimationFrame(()=>{w()})))};return n>0?(clearTimeout(t),t=setTimeout(()=>{d()},n)):requestAnimationFrame(()=>{d()}),n},S=()=>{y=(new Date).getTime(),i.autoplay.running=!0,w(),a("autoplayStart")},T=()=>{i.autoplay.running=!1,clearTimeout(t),cancelAnimationFrame(r),a("autoplayStop")},x=(e,r)=>{if(i.destroyed||!i.autoplay.running)return;clearTimeout(t),e||(p=!0);const n=()=>{a("autoplayPause"),i.params.autoplay.waitForTransition?i.wrapperEl.addEventListener("transitionend",b):A()};if(i.autoplay.paused=!0,r)return f&&(l=i.params.autoplay.delay),f=!1,void n();const s=l||i.params.autoplay.delay;l=s-((new Date).getTime()-y),i.isEnd&&l<0&&!i.params.loop||(l<0&&(l=0),n())},A=()=>{i.isEnd&&l<0&&!i.params.loop||i.destroyed||!i.autoplay.running||(y=(new Date).getTime(),p?(p=!1,w(l)):w(),i.autoplay.paused=!1,a("autoplayResume"))},k=()=>{if(i.destroyed||!i.autoplay.running)return;const e=Wi();"hidden"===e.visibilityState&&(p=!0,x(!0)),"visible"===e.visibilityState&&A()},L=e=>{"mouse"===e.pointerType&&(p=!0,m=!0,i.animating||i.autoplay.paused||x(!0))},I=e=>{"mouse"===e.pointerType&&(m=!1,i.autoplay.paused&&A())};s("init",()=>{i.params.autoplay.enabled&&(i.params.autoplay.pauseOnMouseEnter&&(i.el.addEventListener("pointerenter",L),i.el.addEventListener("pointerleave",I)),Wi().addEventListener("visibilitychange",k),S())}),s("destroy",()=>{i.el&&"string"!=typeof i.el&&(i.el.removeEventListener("pointerenter",L),i.el.removeEventListener("pointerleave",I)),Wi().removeEventListener("visibilitychange",k),i.autoplay.running&&T()}),s("_freeModeStaticRelease",()=>{(u||p)&&A()}),s("_freeModeNoMomentumRelease",()=>{i.params.autoplay.disableOnInteraction?T():x(!0,!0)}),s("beforeTransitionStart",(e,t,r)=>{!i.destroyed&&i.autoplay.running&&(r||!i.params.autoplay.disableOnInteraction?x(!0,!0):T())}),s("sliderFirstMove",()=>{!i.destroyed&&i.autoplay.running&&(i.params.autoplay.disableOnInteraction?T():(c=!0,u=!1,p=!1,h=setTimeout(()=>{p=!0,u=!0,x(!0)},200)))}),s("touchEnd",()=>{if(!i.destroyed&&i.autoplay.running&&c){if(clearTimeout(h),clearTimeout(t),i.params.autoplay.disableOnInteraction)return u=!1,void(c=!1);u&&i.params.cssMode&&A(),u=!1,c=!1}}),s("slideChange",()=>{!i.destroyed&&i.autoplay.running&&(f=!0)}),Object.assign(i.autoplay,{start:S,stop:T,pause:x,resume:A})}function fs(e){let t,r,i,n,{swiper:s,extendParams:a,on:o}=e;a({grid:{rows:1,fill:"column"}});const l=()=>{let e=s.params.spaceBetween;return"string"==typeof e&&e.indexOf("%")>=0?e=parseFloat(e.replace("%",""))/100*s.size:"string"==typeof e&&(e=parseFloat(e)),e};o("init",()=>{n=s.params.grid&&s.params.grid.rows>1}),o("update",()=>{const{params:e,el:t}=s,r=e.grid&&e.grid.rows>1;n&&!r?(t.classList.remove(`${e.containerModifierClass}grid`,`${e.containerModifierClass}grid-column`),i=1,s.emitContainerClasses()):!n&&r&&(t.classList.add(`${e.containerModifierClass}grid`),"column"===e.grid.fill&&t.classList.add(`${e.containerModifierClass}grid-column`),s.emitContainerClasses()),n=r}),s.grid={initSlides:e=>{const{slidesPerView:n}=s.params,{rows:a,fill:o}=s.params.grid,l=s.virtual&&s.params.virtual.enabled?s.virtual.slides.length:e.length;i=Math.floor(l/a),t=Math.floor(l/a)===l/a?l:Math.ceil(l/a)*a,"auto"!==n&&"row"===o&&(t=Math.max(t,n*a)),r=t/a},unsetSlides:()=>{s.slides&&s.slides.forEach(e=>{e.swiperSlideGridSet&&(e.style.height="",e.style[s.getDirectionLabel("margin-top")]="")})},updateSlide:(e,n,a)=>{const{slidesPerGroup:o}=s.params,d=l(),{rows:c,fill:u}=s.params.grid,h=s.virtual&&s.params.virtual.enabled?s.virtual.slides.length:a.length;let f,p,m;if("row"===u&&o>1){const r=Math.floor(e/(o*c)),i=e-c*o*r,s=0===r?o:Math.min(Math.ceil((h-r*c*o)/c),o);m=Math.floor(i/s),p=i-m*s+r*o,f=p+m*t/c,n.style.order=f}else"column"===u?(p=Math.floor(e/c),m=e-p*c,(p>i||p===i&&m===c-1)&&(m+=1,m>=c&&(m=0,p+=1))):(m=Math.floor(e/r),p=e-m*r);n.row=m,n.column=p,n.style.height=`calc((100% - ${(c-1)*d}px) / ${c})`,n.style[s.getDirectionLabel("margin-top")]=0!==m?d&&`${d}px`:"",n.swiperSlideGridSet=!0},updateWrapperSize:(e,r)=>{const{centeredSlides:i,roundLengths:n}=s.params,a=l(),{rows:o}=s.params.grid;if(s.virtualSize=(e+a)*t,s.virtualSize=Math.ceil(s.virtualSize/o)-a,s.params.cssMode||(s.wrapperEl.style[s.getDirectionLabel("width")]=`${s.virtualSize+a}px`),i){const e=[];for(let t=0;t<r.length;t+=1){let i=r[t];n&&(i=Math.floor(i)),r[t]<s.virtualSize+r[0]&&e.push(i)}r.splice(0,r.length),r.push(...e)}}}}function ps(e){const t=this,{params:r,slidesEl:i}=t;r.loop&&t.loopDestroy();const n=e=>{if("string"==typeof e){const t=document.createElement("div");t.innerHTML=e,i.append(t.children[0]),t.innerHTML=""}else i.append(e)};if("object"==typeof e&&"length"in e)for(let t=0;t<e.length;t+=1)e[t]&&n(e[t]);else n(e);t.recalcSlides(),r.loop&&t.loopCreate(),r.observer&&!t.isElement||t.update()}function ms(e){const t=this,{params:r,activeIndex:i,slidesEl:n}=t;r.loop&&t.loopDestroy();let s=i+1;const a=e=>{if("string"==typeof e){const t=document.createElement("div");t.innerHTML=e,n.prepend(t.children[0]),t.innerHTML=""}else n.prepend(e)};if("object"==typeof e&&"length"in e){for(let t=0;t<e.length;t+=1)e[t]&&a(e[t]);s=i+e.length}else a(e);t.recalcSlides(),r.loop&&t.loopCreate(),r.observer&&!t.isElement||t.update(),t.slideTo(s,0,!1)}function gs(e,t){const r=this,{params:i,activeIndex:n,slidesEl:s}=r;let a=n;i.loop&&(a-=r.loopedSlides,r.loopDestroy(),r.recalcSlides());const o=r.slides.length;if(e<=0)return void r.prependSlide(t);if(e>=o)return void r.appendSlide(t);let l=a>e?a+1:a;const d=[];for(let t=o-1;t>=e;t-=1){const e=r.slides[t];e.remove(),d.unshift(e)}if("object"==typeof t&&"length"in t){for(let e=0;e<t.length;e+=1)t[e]&&s.append(t[e]);l=a>e?a+t.length:a}else s.append(t);for(let e=0;e<d.length;e+=1)s.append(d[e]);r.recalcSlides(),i.loop&&r.loopCreate(),i.observer&&!r.isElement||r.update(),i.loop?r.slideTo(l+r.loopedSlides,0,!1):r.slideTo(l,0,!1)}function vs(e){const t=this,{params:r,activeIndex:i}=t;let n=i;r.loop&&(n-=t.loopedSlides,t.loopDestroy());let s,a=n;if("object"==typeof e&&"length"in e){for(let r=0;r<e.length;r+=1)s=e[r],t.slides[s]&&t.slides[s].remove(),s<a&&(a-=1);a=Math.max(a,0)}else s=e,t.slides[s]&&t.slides[s].remove(),s<a&&(a-=1),a=Math.max(a,0);t.recalcSlides(),r.loop&&t.loopCreate(),r.observer&&!t.isElement||t.update(),r.loop?t.slideTo(a+t.loopedSlides,0,!1):t.slideTo(a,0,!1)}function ys(){const e=this,t=[];for(let r=0;r<e.slides.length;r+=1)t.push(r);e.removeSlide(t)}function bs(e){let{swiper:t}=e;Object.assign(t,{appendSlide:ps.bind(t),prependSlide:ms.bind(t),addSlide:gs.bind(t),removeSlide:vs.bind(t),removeAllSlides:ys.bind(t)})}function Es(e,t){const r=nn(t);return r!==t&&(r.style.backfaceVisibility="hidden",r.style["-webkit-backface-visibility"]="hidden"),r}function ws(e){let{swiper:t,duration:r,transformElements:i,allSlides:n}=e;const{activeIndex:s}=t;if(t.params.virtualTranslate&&0!==r){let e,r=!1;e=n?i:i.filter(e=>{const r=e.classList.contains("swiper-slide-transform")?(e=>{if(!e.parentElement)return t.slides.filter(t=>t.shadowRoot&&t.shadowRoot===e.parentNode)[0];return e.parentElement})(e):e;return t.getSlideIndex(r)===s}),e.forEach(e=>{!function(e,t){t&&e.addEventListener("transitionend",function r(i){i.target===e&&(t.call(e,i),e.removeEventListener("transitionend",r))})}(e,()=>{if(r)return;if(!t||t.destroyed)return;r=!0,t.animating=!1;const e=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});t.wrapperEl.dispatchEvent(e)})})}}function Ss(e,t,r){const i=`swiper-slide-shadow swiper-slide-shadow-${e}`,n=nn(t);let s=n.querySelector(`.${i.split(" ").join(".")}`);return s||(s=on("div",i.split(" ")),n.append(s)),s}function Ts(e){let{swiper:t,extendParams:r,on:i}=e;r({cardsEffect:{slideShadows:!0,rotate:!0,perSlideRotate:2,perSlideOffset:8}});!function(e){const{effect:t,swiper:r,on:i,setTranslate:n,setTransition:s,overwriteParams:a,perspective:o,recreateShadows:l,getEffectParams:d}=e;let c;i("beforeInit",()=>{if(r.params.effect!==t)return;r.classNames.push(`${r.params.containerModifierClass}${t}`),o&&o()&&r.classNames.push(`${r.params.containerModifierClass}3d`);const e=a?a():{};Object.assign(r.params,e),Object.assign(r.originalParams,e)}),i("setTranslate",()=>{r.params.effect===t&&n()}),i("setTransition",(e,i)=>{r.params.effect===t&&s(i)}),i("transitionEnd",()=>{if(r.params.effect===t&&l){if(!d||!d().slideShadows)return;r.slides.forEach(e=>{e.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(e=>e.remove())}),l()}}),i("virtualUpdate",()=>{r.params.effect===t&&(r.slides.length||(c=!0),requestAnimationFrame(()=>{c&&r.slides&&r.slides.length&&(n(),c=!1)}))})}({effect:"cards",swiper:t,on:i,setTranslate:()=>{const{slides:e,activeIndex:r,rtlTranslate:i}=t,n=t.params.cardsEffect,{startTranslate:s,isTouched:a}=t.touchEventsData,o=i?-t.translate:t.translate;for(let l=0;l<e.length;l+=1){const d=e[l],c=d.progress,u=Math.min(Math.max(c,-4),4);let h=d.swiperSlideOffset;t.params.centeredSlides&&!t.params.cssMode&&(t.wrapperEl.style.transform=`translateX(${t.minTranslate()}px)`),t.params.centeredSlides&&t.params.cssMode&&(h-=e[0].swiperSlideOffset);let f=t.params.cssMode?-h-t.translate:-h,p=0;const m=-100*Math.abs(u);let g=1,v=-n.perSlideRotate*u,y=n.perSlideOffset-.75*Math.abs(u);const b=t.virtual&&t.params.virtual.enabled?t.virtual.from+l:l,E=(b===r||b===r-1)&&u>0&&u<1&&(a||t.params.cssMode)&&o<s,w=(b===r||b===r+1)&&u<0&&u>-1&&(a||t.params.cssMode)&&o>s;if(E||w){const e=(1-Math.abs((Math.abs(u)-.5)/.5))**.5;v+=-28*u*e,g+=-.5*e,y+=96*e,p=-25*e*Math.abs(u)+"%"}if(f=u<0?`calc(${f}px ${i?"-":"+"} (${y*Math.abs(u)}%))`:u>0?`calc(${f}px ${i?"-":"+"} (-${y*Math.abs(u)}%))`:`${f}px`,!t.isHorizontal()){const e=p;p=f,f=e}const S=u<0?""+(1+(1-g)*u):""+(1-(1-g)*u),T=`\n translate3d(${f}, ${p}, ${m}px)\n rotateZ(${n.rotate?i?-v:v:0}deg)\n scale(${S})\n `;if(n.slideShadows){let e=d.querySelector(".swiper-slide-shadow");e||(e=Ss("cards",d)),e&&(e.style.opacity=Math.min(Math.max((Math.abs(u)-.5)/.5,0),1))}d.style.zIndex=-Math.abs(Math.round(c))+e.length;Es(0,d).style.transform=T}},setTransition:e=>{const r=t.slides.map(e=>nn(e));r.forEach(t=>{t.style.transitionDuration=`${e}ms`,t.querySelectorAll(".swiper-slide-shadow").forEach(t=>{t.style.transitionDuration=`${e}ms`})}),ws({swiper:t,duration:e,transformElements:r})},perspective:()=>!0,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!t.params.cssMode})})}ds.displayName="SwiperSlide";const xs=({product:e})=>{const[r,i]=a(!1);return t.createElement("a",{href:e.linkPath,target:"_blank"},t.createElement("div",{className:"w-full h-full flex gap-2 flex-col"},t.createElement("div",{className:"w-full max-h-fit aspect-square border mb-2 flex justify-center items-center"},e.thumbPath&&!r?t.createElement(Jt,{product:e,onError:()=>i(!0)}):t.createElement(Zt,null)),t.createElement("div",{className:"justify-center flex flex-col"},e.brand&&t.createElement("p",{className:"max-w-52 break-keep line-clamp-1 text-xs text-gray-500"},e.brand.brandName),t.createElement("p",null,e.productName),t.createElement("div",null,t.createElement("span",{className:"font-semibold text-red-500"},e.discount,"%"," "),t.createElement("span",{className:"font-semibold"},xt(e.sellingPrice),"원")))))},As=({products:e})=>{const n=r(null),[s,o]=a(0),l=r(null);i(()=>{u(),window.addEventListener("resize",()=>{clearInterval(d),d=setTimeout(u,c)})},[]);let d=null;const c=100,u=()=>{l.current&&o(l.current.offsetWidth)};return e&&t.createElement("div",{className:"flex items-center h-full justify-center w-full",ref:l},e.length>3?t.createElement(zt,{size:50,className:"cursor-pointer slide__prev",onClick:()=>{var e;null===(e=n.current)||void 0===e||e.slidePrev()}}):t.createElement("div",{className:"w-[50px]"}),t.createElement(ls,{modules:[us],onSwiper:e=>{n.current=e},style:{width:s},slidesPerView:3,navigation:{prevEl:".slide__prev",nextEl:".slide__next"},spaceBetween:20},e.map(e=>t.createElement(ds,{key:e.productId},t.createElement(xs,{product:e})))),e.length>3?t.createElement(Gt,{onClick:()=>{var e;null===(e=n.current)||void 0===e||e.slideNext()},size:50,className:"cursor-pointer slide__next"}):t.createElement("div",{className:"w-[50px]"}))},ks=e=>{const{player:r,shortform:i}=e;return t.createElement("div",{className:"flex h-full gap-5"},t.createElement("div",{className:"h-full aspect-[9/16]"},r),t.createElement("div",{className:"w-full min-w-44 max-w-[800px] overflow-hidden text-sm"},t.createElement(As,{products:i.productsInfo})))},Ls=({products:e})=>{const i=r(null);return t.createElement("div",{className:"flex items-center flex-col h-full"},e.length>4&&t.createElement(jt,{size:50,className:"cursor-pointer slide__prev"}),t.createElement(ls,{modules:[cs,us],mousewheel:!0,onSwiper:e=>{i.current=e},spaceBetween:10,className:"max-w-full h-[80%]",slidesPerView:4,direction:"vertical",navigation:{prevEl:".slide__prev",nextEl:".slide__next"}},e.map(e=>t.createElement(ds,{key:e.productId},t.createElement(er,{product:e})))),e.length>4&&t.createElement(Ut,{size:50,className:"cursor-pointer slide__next"}))},Is=e=>{const{playerSettings:r,shortform:{productsInfo:i},player:n}=e;return t.createElement("div",{className:"flex h-full w-full gap-5"},t.createElement("div",{className:" h-full "},n),t.createElement("div",{className:"max-w-[800px] overflow-hidden"},t.createElement(Ls,{products:i})))},Rs=({products:e})=>{const i=r(null),n=e.length>6;return t.createElement("div",{className:"flex items-center my-10 h-full text-sm w-full"},n?t.createElement(zt,{onClick:()=>{var e;null===(e=i.current)||void 0===e||e.slidePrev()},size:50,className:"cursor-pointer"}):t.createElement("div",{className:"w-[50px]"}),t.createElement(ls,{onSwiper:e=>{i.current=e},className:"w-[80%] h-[80%]",slidesPerView:3,spaceBetween:20,modules:[fs],grid:{rows:2,fill:"row"}},e.map(e=>t.createElement(ds,{key:e.productId},t.createElement(xs,{product:e})))),n?t.createElement(Gt,{onClick:()=>{var e;null===(e=i.current)||void 0===e||e.slideNext()},size:50,className:"cursor-pointer"}):t.createElement("div",{className:"w-[50px]"}))},Ps=e=>{const{player:r,shortform:{productsInfo:i}}=e;return t.createElement("div",{className:"flex gap-4 w-full h-full min-w-[768px]"},t.createElement("div",{className:"flex-1 w-full"},t.createElement("div",{className:"h-full aspect-[9/16]"},r)),t.createElement("div",{className:"flex-[2] w-full h-full overflow-hidden"},t.createElement(Rs,{products:i})))},Ds=e=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}),Cs=()=>document.visibilityState,_s=()=>{throw Error("useVisibilityChange is a client-only hook")};function Os(){return"visible"===e.useSyncExternalStore(Ds,Cs,_s)}var Ms=(e,t,n=!0)=>{const s=r(e),a=r(null),o=()=>{a.current&&(clearInterval(a.current),a.current=null)},l=c(()=>{a.current||(a.current=setInterval(()=>s.current(),t))},[t]);return i(()=>{s.current=e},[e]),i(()=>(n&&l(),()=>o()),[l,n]),{clear:o,run:l}};const Ns=()=>{const[e,t]=a(0);Ms(()=>{t(e=>e+1)},1e3);return{playtime:e,resetPlaytime:()=>t(0)}};var Fs;!function(e){e.latest="",e.views="pageView",e.likes="like"}(Fs||(Fs={}));let $s=0;const Bs=e=>x(void 0,void 0,void 0,function*(){const{PLAYER_BACK_BASE_URL:t}=gt(),{contentId:r,uuid:i,type:n,userId:s}=e;try{if(3===$s)return;const e=`${t}/statistics/play`,a=Object.assign({contentId:r,uuid:i,type:n,date:At(),userId:+s,playtime:0,isLive:!1},"shorts"===n&&{isFinished:!1,playedOver5Sec:!1});yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(e){console.error(`Error in statisticsApi.join - contentId: ${r}`),Pt(e),$s++}}),Us=e=>{const{PLAYER_BACK_BASE_URL:t}=gt(),{contentId:r,uuid:i,type:n,isFinished:s,playtime:a,userId:o}=e,l=Object.assign({contentId:r,uuid:i,playtime:a,type:n,date:At(),userId:+o,isLive:!1},"shorts"===n&&{isFinished:s,playedOver5Sec:Number(a)>5});fetch(`${t}/statistics/play`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l),keepalive:!0})},zs=e=>x(void 0,void 0,void 0,function*(){const{PLAYER_BACK_BASE_URL:t}=gt(),{contentProductId:r}=e;try{yield fetch(`${t}/statistics/products/${r}/clicks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({date:At()},e))})}catch(e){console.error(`Error in statisticsApi.productClick - contentProductId: ${r}`),Pt(e)}}),Gs=e=>x(void 0,void 0,void 0,function*(){const{STATISTICS_BASE_URL:t}=gt();try{return(yield(yield fetch(`${t}/${e}/likes`)).json()).result||0}catch(t){return console.error(`Error in statisticsApi.getLike - contentId: ${e}`),Pt(t),0}}),js=e=>x(void 0,void 0,void 0,function*(){const{PLAYER_BACK_BASE_URL:t}=gt();try{yield fetch(`${t}/statistics/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contentId:e,isLive:!1,isFirst:!1})})}catch(t){console.error(`Error in statisticsApi.getLike - contentId: ${e}`),Pt(t)}}),Hs=e=>x(void 0,[e],void 0,function*({collectionId:e,nextKey:t,size:r=5}){const{PLAYER_BACK_BASE_URL:i}=gt();try{const n=new URLSearchParams;-1!==r&&n.set("size",String(r)),t&&n.set("nextKey",t);const s=yield fetch(`${i}/commerce/collection/${e}?${n.toString()}`);return s.ok?yield s.json():null}catch(e){return Pt(e),null}}),Vs=(e,...t)=>x(void 0,[e,...t],void 0,function*(e,t=!1){const{API_BASE_URL:r,PLAYER_BACK_BASE_URL:i}=gt();if(t)try{const t=(yield(yield fetch(`${r}/shorts/player/${e}`)).json()).result;if(!t.media)return null;t.file=`${r}/direct/${t.media.objectId}`;const{player:{viewPlayer:{width:i,height:n}}}=t;return Object.assign(Object.assign(Object.assign(Object.assign({layout:t.player.layout},t.player.shoppingPlayer),{aspectRatio:Dt(i,n)}),t),{uuid:kt()})}catch(e){return Pt(e),null}try{const t=yield fetch(`${i}/commerce/short-form/${e}`),r=yield t.json();return r.shortsId?r:null}catch(e){return Pt(e),null}}),Ws=(e,t,r,i)=>x(void 0,void 0,void 0,function*(){const{API_BASE_URL:n}=gt();try{const s=yield fetch(`${n}/live/${e}/list?size=${r||6}&status=${t}${i&&Fs[i]?`&sortBy=${Fs[i]}`:""}`);return s.ok?(yield s.json()).result:(console.error("Error in getLiveWidgetContents "),[])}catch(e){return console.error("Error in getLiveWidgetContents: ",e),[]}}),Ys=e=>{let t;const r=new Set,i=(e,i)=>{const n="function"==typeof e?e(t):e;if(!Object.is(n,t)){const e=t;t=(null!=i?i:"object"!=typeof n||null===n)?n:Object.assign({},t,n),r.forEach(r=>r(t,e))}},n=()=>t,s={setState:i,getState:n,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(i,n,s);return s},Ks=e=>e?Ys(e):Ys,qs=e=>e;function Xs(e,r=qs){const i=t.useSyncExternalStore(e.subscribe,t.useCallback(()=>r(e.getState()),[e,r]),t.useCallback(()=>r(e.getInitialState()),[e,r]));return t.useDebugValue(i),i}const Qs=e=>{const t=Ks(e),r=e=>Xs(t,e);return Object.assign(r,t),r},Zs=e=>e?Qs(e):Qs,Js=Zs(e=>({priceText:"",isPreview:!1,setPriceText:t=>e({priceText:t}),setIsPreview:t=>e({isPreview:t})})),ea=t.createContext(null),ta=({children:e})=>{const r=t.useRef(null);return r.current||(r.current=Ks(e=>({collection:null,setCollection:t=>e({collection:t}),nextKey:"",setNextKey:t=>e({nextKey:t}),isFetching:!1,setIsFetching:t=>e({isFetching:t})}))),t.createElement(ea.Provider,{value:r.current},e)},ra=()=>(e=>{const r=t.useContext(ea);if(!r)throw new Error("Missing CollectionProvider");return Xs(r,e)})(e=>e),ia=(e,t)=>{const{collection:r,setCollection:n,isFetching:s,setIsFetching:a,nextKey:o,setNextKey:l}=ra(),{isPreview:d}=Js(),c=(null==e?void 0:e.media)?e.media.duration.split(":").reduce((e,t,r)=>e+ +t*60**(2-r),0):0;const{resetPlaytime:u,playtime:h}=Ns(),{playtime:f,resetPlaytime:p}=Ns(),m=Os(),g=()=>{if(!r)return;const{colId:t,uuid:i,userId:n}=r,s=Ge,a=Math.floor((new Date).getTime()/1e3);localStorage.setItem(s,a.toString()),d||(Us({contentId:t,uuid:i,type:Et.COLLECTION,userId:n,playtime:f}),e&&Us({contentId:e.shortsId,uuid:e.uuid,type:Et.SHORTS,userId:n,playtime:h,isFinished:h>=c}),p(),u())};i(()=>{m||g()},[m]);return{onSlideChange:i=>x(void 0,void 0,void 0,function*(){if(e&&r&&(yield(e=>x(void 0,void 0,void 0,function*(){var t,i;if(!r)return;const{contents:d,count:c}=r;if((null!=c?c:Number.MAX_SAFE_INTEGER)>d.length&&e>=d.length-5&&!s){a(!0);try{const e=yield Hs({collectionId:r.colId,nextKey:o});if(!e||!(null===(t=e.contents)||void 0===t?void 0:t.length))return;l((null===(i=e.contents.at(-1))||void 0===i?void 0:i.shortsId)||"");const s=new Set(r.contents.map(e=>e.shortsId)),a=e.contents.filter(e=>!s.has(e.shortsId));if(!a.length)return;const d=r.contents.concat(a);n(Object.assign(Object.assign({},r),{contents:d}))}catch(e){console.error(e)}finally{a(!1)}}}))(i),!d)){const{shortsId:n,uuid:s,userId:a}=e;Us({contentId:n,uuid:s,type:Et.SHORTS,playtime:h,isFinished:h>=c,userId:a}),u();const o=kt(),l=r.contents[i];t(Object.assign(Object.assign({},l),{uuid:o})),yield Bs({contentId:l.shortsId,uuid:o,type:Et.SHORTS,userId:l.userId,isFirstPlay:!Lt(l.shortsId)})}}),onCollectionClose:g}},na=e=>{const{collection:i,playerSettings:n,shortform:s,setShortform:a}=e,o=r(null),{onSlideChange:l}=ia(i,s);return t.createElement(t.Fragment,null,t.createElement("div",{className:"self-center flex gap-4 flex-col"},t.createElement(jt,{size:44,onClick:()=>{var e;null===(e=o.current)||void 0===e||e.swiper.slidePrev()}}),t.createElement(Ut,{size:44,onClick:()=>{var e;null===(e=o.current)||void 0===e||e.swiper.slideNext()}})),t.createElement("div",{className:"h-full aspect-[9/16] my-10"},t.createElement(ls,{modules:[cs,bs],mousewheel:!0,loop:!0,direction:"vertical",touchEventsTarget:"container",slidesPerView:1,ref:o,className:"h-full",onSlideChangeTransitionEnd:e=>x(void 0,void 0,void 0,function*(){yield l(e.realIndex)})},i.contents.map(e=>t.createElement(ds,{key:e.shortsId},s.shortsId===e.shortsId&&t.createElement("div",{className:"h-full rounded-xl absolute z-[999] aspect-[9/16] overflow-hidden"},t.createElement(L,{file:Tt(s.media.objectId)})),t.createElement("img",{src:Rt(e.thumbPath),alt:e.title,className:"rounded-xl overflow-hidden h-full bg-black aspect-[9/16] "+(e.media.width>e.media.height?"object-contain":"object-cover")}))))))},sa=e=>{const{collection:i,shortform:n,setShortform:s,playerSettings:a}=e,o=r(null);ia(i,n);return t.createElement("div",{className:"mx-10 flex h-full gap-4"},t.createElement("div",{className:"self-center flex gap-4 flex-col"},t.createElement(jt,{size:44,onClick:()=>{var e;null===(e=o.current)||void 0===e||e.swiper.slidePrev()}}),t.createElement(Ut,{size:44,onClick:()=>{var e;null===(e=o.current)||void 0===e||e.swiper.slideNext()}})),t.createElement("div",{className:"h-full aspect-[9/16]"},t.createElement(ls,{modules:[cs,bs],mousewheel:!0,direction:"vertical",slidesPerView:1,ref:o,className:"h-full",preventClicksPropagation:!1,preventClicks:!1,noSwiping:!0,allowTouchMove:!1,loop:!0},i.contents.map(e=>t.createElement(ds,{key:e.shortsId},t.createElement("div",{className:"flex justify-center gap-3 h-full w-full"},n.shortsId===e.shortsId&&t.createElement("div",{className:"h-full absolute z-[999] w-full"},t.createElement("div",{className:"h-full aspect-[9/16]"},t.createElement(L,{file:Tt(n.media.objectId)}))),t.createElement("div",{className:"h-full aspec[9/16]"},t.createElement("img",{src:"https://"+e.thumbPath,alt:e.title,className:"w-full h-full bg-black "+(e.media.width>e.media.height?"object-contain":"object-cover")}))))))))},aa=()=>t.createElement("div",{className:"inline-block absolute pointer-events-none top-0 z-10 animate-float w-[24px] h-[24px]"},t.createElement(Ht,{className:"fill-red-500 text-transparent w-[24px] h-[24px]"})),oa=({shortsId:e})=>{const{isPreview:r}=Js(),[n,s]=a(r?123:0),[o,l]=a([]);i(()=>{r||x(void 0,void 0,void 0,function*(){try{const t=yield Gs(e);s(t)}catch(e){return console.error(`Error in statistics getLikeInLive: ${e.toString()}`),0}})},[]);return t.createElement("div",{className:"flex justify-center flex-col items-center relative w-[24px] h-[24px]"},t.createElement("button",{onClick:()=>x(void 0,void 0,void 0,function*(){(()=>{const e=Date.now();l(t=>[...t,e]),setTimeout(()=>{l(t=>t.filter(t=>t!==e))},2e3)})(),s(e=>e+1),r||(yield x(void 0,void 0,void 0,function*(){yield js(e)}))}),className:"z-[5] cursor-pointer"},t.createElement(Ht,{className:"text-xl fill-white w-[24px] h-[24px]"})),o.map(e=>t.createElement(aa,{key:e})),t.createElement("span",{className:"break-keep text-[10px]"},xt(n)))};var la,da,ca={},ua={exports:{}},ha=ua.exports;function fa(){return la||(la=1,e=ua,t=ua.exports,function(r,i){var n="function",s="undefined",a="object",o="string",l="major",d="model",c="name",u="type",h="vendor",f="version",p="architecture",m="console",g="mobile",v="tablet",y="smarttv",b="wearable",E="embedded",w="Amazon",S="Apple",T="ASUS",x="BlackBerry",A="Browser",k="Chrome",L="Firefox",I="Google",R="Huawei",P="LG",D="Microsoft",C="Motorola",_="Opera",O="Samsung",M="Sharp",N="Sony",F="Xiaomi",$="Zebra",B="Facebook",U="Chromium OS",z="Mac OS",G=" Browser",j=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},H=function(e,t){return typeof e===o&&-1!==V(t).indexOf(V(e))},V=function(e){return e.toLowerCase()},W=function(e,t){if(typeof e===o)return e=e.replace(/^\s\s*/,""),typeof t===s?e:e.substring(0,500)},Y=function(e,t){for(var r,s,o,l,d,c,u=0;u<t.length&&!d;){var h=t[u],f=t[u+1];for(r=s=0;r<h.length&&!d&&h[r];)if(d=h[r++].exec(e))for(o=0;o<f.length;o++)c=d[++s],typeof(l=f[o])===a&&l.length>0?2===l.length?typeof l[1]==n?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==n||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):i:this[l[0]]=c?l[1].call(this,c,l[2]):i:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):i):this[l]=c||i;u+=2}},K=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(H(t[r][n],e))return"?"===r?i:r}else if(H(t[r],e))return"?"===r?i:r;return t.hasOwnProperty("*")?t["*"]:e},q={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,f],[/opios[\/ ]+([\w\.]+)/i],[f,[c,_+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[c,_+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[c,_]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[c,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[f,[c,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[c,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[c,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[c,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[c,"UC"+A]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[c,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[c,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[c,"Smart Lenovo "+A]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+A],f],[/\bfocus\/([\w\.]+)/i],[f,[c,L+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[c,_+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[c,_+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[c,"MIUI"+G]],[/fxios\/([\w\.-]+)/i],[f,[c,L]],[/\bqihoobrowser\/?([\w\.]*)/i],[f,[c,"360"]],[/\b(qq)\/([\w\.]+)/i],[[c,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1"+G],f],[/samsungbrowser\/([\w\.]+)/i],[f,[c,O+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[f,[c,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[c,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[c,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[c],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[f,c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,B],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[c,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[c,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[c,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[c,k+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,k+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[c,"Android "+A]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[f,K,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[c,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],f],[/(wolvic|librewolf)\/([\w\.]+)/i],[c,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[c,L+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[c,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[c,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,V]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",V]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,V]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[h,O],[u,v]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[d,[h,O],[u,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[d,[h,S],[u,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[h,S],[u,v]],[/(macintosh);/i],[d,[h,S]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[h,M],[u,g]],[/(?:honor)([-\w ]+)[;\)]/i],[d,[h,"Honor"],[u,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[h,R],[u,v]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[h,R],[u,g]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[d,/_/g," "],[h,F],[u,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[h,F],[u,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[h,"OPPO"],[u,g]],[/\b(opd2\d{3}a?) bui/i],[d,[h,"OPPO"],[u,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[h,"Vivo"],[u,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[d,[h,"Realme"],[u,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[h,C],[u,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[h,C],[u,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[h,P],[u,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[h,P],[u,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[h,"Lenovo"],[u,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[h,"Nokia"],[u,g]],[/(pixel c)\b/i],[d,[h,I],[u,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[h,I],[u,g]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[h,N],[u,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[h,N],[u,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[h,"OnePlus"],[u,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[h,w],[u,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[h,w],[u,g]],[/(playbook);[-\w\),; ]+(rim)/i],[d,h,[u,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[h,x],[u,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[h,T],[u,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[h,T],[u,g]],[/(nexus 9)/i],[d,[h,"HTC"],[u,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[d,/_/g," "],[u,g]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[d,[h,"TCL"],[u,v]],[/(itel) ((\w+))/i],[[h,V],d,[u,K,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[h,"Acer"],[u,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[h,"Meizu"],[u,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[d,[h,"Ulefone"],[u,g]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[d,[h,"Energizer"],[u,g]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[d,[h,"Cat"],[u,g]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[d,[h,"Smartfren"],[u,g]],[/droid.+; (a(?:015|06[35]|142p?))/i],[d,[h,"Nothing"],[u,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,d,[u,g]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,d,[u,v]],[/(surface duo)/i],[d,[h,D],[u,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[h,"Fairphone"],[u,g]],[/(u304aa)/i],[d,[h,"AT&T"],[u,g]],[/\bsie-(\w*)/i],[d,[h,"Siemens"],[u,g]],[/\b(rct\w+) b/i],[d,[h,"RCA"],[u,v]],[/\b(venue[\d ]{2,7}) b/i],[d,[h,"Dell"],[u,v]],[/\b(q(?:mv|ta)\w+) b/i],[d,[h,"Verizon"],[u,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[h,"Barnes & Noble"],[u,v]],[/\b(tm\d{3}\w+) b/i],[d,[h,"NuVision"],[u,v]],[/\b(k88) b/i],[d,[h,"ZTE"],[u,v]],[/\b(nx\d{3}j) b/i],[d,[h,"ZTE"],[u,g]],[/\b(gen\d{3}) b.+49h/i],[d,[h,"Swiss"],[u,g]],[/\b(zur\d{3}) b/i],[d,[h,"Swiss"],[u,v]],[/\b((zeki)?tb.*\b) b/i],[d,[h,"Zeki"],[u,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],d,[u,v]],[/\b(ns-?\w{0,9}) b/i],[d,[h,"Insignia"],[u,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[h,"NextBook"],[u,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],d,[u,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],d,[u,g]],[/\b(ph-1) /i],[d,[h,"Essential"],[u,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[h,"Envizen"],[u,v]],[/\b(trio[-\w\. ]+) b/i],[d,[h,"MachSpeed"],[u,v]],[/\btu_(1491) b/i],[d,[h,"Rotor"],[u,v]],[/(shield[\w ]+) b/i],[d,[h,"Nvidia"],[u,v]],[/(sprint) (\w+)/i],[h,d,[u,g]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[h,D],[u,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[h,$],[u,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[h,$],[u,g]],[/smart-tv.+(samsung)/i],[h,[u,y]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[h,O],[u,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,P],[u,y]],[/(apple) ?tv/i],[h,[d,S+" TV"],[u,y]],[/crkey/i],[[d,k+"cast"],[h,I],[u,y]],[/droid.+aft(\w+)( bui|\))/i],[d,[h,w],[u,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[h,M],[u,y]],[/(bravia[\w ]+)( bui|\))/i],[d,[h,N],[u,y]],[/(mitv-\w{5}) bui/i],[d,[h,F],[u,y]],[/Hbbtv.*(technisat) (.*);/i],[h,d,[u,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,W],[d,W],[u,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[u,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,d,[u,m]],[/droid.+; (shield) bui/i],[d,[h,"Nvidia"],[u,m]],[/(playstation [345portablevi]+)/i],[d,[h,N],[u,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[h,D],[u,m]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[d,[h,O],[u,b]],[/((pebble))app/i],[h,d,[u,b]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[h,S],[u,b]],[/droid.+; (glass) \d/i],[d,[h,I],[u,b]],[/droid.+; (wt63?0{2,3})\)/i],[d,[h,$],[u,b]],[/droid.+; (glass) \d/i],[d,[h,I],[u,b]],[/(pico) (4|neo3(?: link|pro)?)/i],[h,d,[u,b]],[/; (quest( \d| pro)?)/i],[d,[h,B],[u,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[u,E]],[/(aeobc)\b/i],[d,[h,w],[u,E]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[d,[u,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[u,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[u,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[u,g]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[c,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[c,f],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[c,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[c,[f,K,q]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,K,q],[c,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,z],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,f],[/\(bb(10);/i],[f,[c,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[c,L+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[c,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[c,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[c,k+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[c,U],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,f],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[c,f]]},Q=function(e,t){if(typeof e===a&&(t=e,e=i),!(this instanceof Q))return new Q(e,t).getResult();var m=typeof r!==s&&r.navigator?r.navigator:i,y=e||(m&&m.userAgent?m.userAgent:""),b=m&&m.userAgentData?m.userAgentData:i,E=t?function(e,t){var r={};for(var i in e)t[i]&&t[i].length%2==0?r[i]=t[i].concat(e[i]):r[i]=e[i];return r}(X,t):X,w=m&&m.userAgent==y;return this.getBrowser=function(){var e={};return e[c]=i,e[f]=i,Y.call(e,y,E.browser),e[l]=function(e){return typeof e===o?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e[f]),w&&m&&m.brave&&typeof m.brave.isBrave==n&&(e[c]="Brave"),e},this.getCPU=function(){var e={};return e[p]=i,Y.call(e,y,E.cpu),e},this.getDevice=function(){var e={};return e[h]=i,e[d]=i,e[u]=i,Y.call(e,y,E.device),w&&!e[u]&&b&&b.mobile&&(e[u]=g),w&&"Macintosh"==e[d]&&m&&typeof m.standalone!==s&&m.maxTouchPoints&&m.maxTouchPoints>2&&(e[d]="iPad",e[u]=v),e},this.getEngine=function(){var e={};return e[c]=i,e[f]=i,Y.call(e,y,E.engine),e},this.getOS=function(){var e={};return e[c]=i,e[f]=i,Y.call(e,y,E.os),w&&!e[c]&&b&&b.platform&&"Unknown"!=b.platform&&(e[c]=b.platform.replace(/chrome os/i,U).replace(/macos/i,z)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return y},this.setUA=function(e){return y=typeof e===o&&e.length>500?W(e,500):e,this},this.setUA(y),this};Q.VERSION="1.0.40",Q.BROWSER=j([c,f,l]),Q.CPU=j([p]),Q.DEVICE=j([d,h,u,m,g,y,v,b,E]),Q.ENGINE=Q.OS=j([c,f]),e.exports&&(t=e.exports=Q),t.UAParser=Q;var Z=typeof r!==s&&(r.jQuery||r.Zepto);if(Z&&!Z.ua){var J=new Q;Z.ua=J.getResult(),Z.ua.get=function(){return J.getUA()},Z.ua.set=function(e){J.setUA(e);var t=J.getResult();for(var r in t)Z.ua[r]=t[r]}}}("object"==typeof window?window:ha)),ua.exports;var e,t}var pa=function(){if(da)return ca;da=1,Object.defineProperty(ca,"__esModule",{value:!0});var e,r=t,i=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=fa(),s=new n,a=s.getBrowser(),o=s.getCPU(),l=s.getDevice(),d=s.getEngine(),c=s.getOS(),u=s.getUA(),h=function(e){return s.setUA(e)},f=function(e){if(e){var t=new n(e);return{UA:t,browser:t.getBrowser(),cpu:t.getCPU(),device:t.getDevice(),engine:t.getEngine(),os:t.getOS(),ua:t.getUA(),setUserAgent:function(e){return t.setUA(e)}}}console.error("No userAgent string was provided")},p=Object.freeze({ClientUAInstance:s,browser:a,cpu:o,device:l,engine:d,os:c,ua:u,setUa:h,parseUserAgent:f});function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),e}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(){return b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},b.apply(this,arguments)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function w(e,t){return w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w(e,t)}function S(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},s=Object.keys(e);for(i=0;i<s.length;i++)r=s[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)r=s[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var i,n,s=[],a=!0,o=!1;try{for(r=r.call(e);!(a=(i=r.next()).done)&&(s.push(i.value),!t||s.length!==t);a=!0);}catch(e){o=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(o)throw n}}return s}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var k="mobile",L="tablet",I="smarttv",R="console",P="wearable",D="embedded",C=void 0,_={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",EdgeChromium:"Edge Chromium",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},O={IOS:"iOS",Android:"Android",WindowsPhone:"Windows Phone",Windows:"Windows",MAC_OS:"Mac OS"},M={isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1},N=function(e){return e||(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none")},F=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},$=function(e){var t=F();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)},B=function(e,t,r,i){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach(function(t){y(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e,{vendor:N(t.vendor),model:N(t.model),os:N(r.name),osVersion:N(r.version),ua:N(i)})},U=function(e){return e.type===k},z=function(e){return e.type===L},G=function(e){var t=e.type;return t===k||t===L},j=function(e){return e.type===I},H=function(e){return e.type===C},V=function(e){return e.type===P},W=function(e){return e.type===R},Y=function(e){return e.type===D},K=function(e){var t=e.vendor;return N(t)},q=function(e){var t=e.model;return N(t)},X=function(e){var t=e.type;return N(t,"browser")},Q=function(e){return e.name===O.Android},Z=function(e){return e.name===O.Windows},J=function(e){return e.name===O.MAC_OS},ee=function(e){return e.name===O.WindowsPhone},te=function(e){return e.name===O.IOS},re=function(e){var t=e.version;return N(t)},ie=function(e){var t=e.name;return N(t)},ne=function(e){return e.name===_.Chrome},se=function(e){return e.name===_.Firefox},ae=function(e){return e.name===_.Chromium},oe=function(e){return e.name===_.Edge},le=function(e){return e.name===_.Yandex},de=function(e){var t=e.name;return t===_.Safari||t===_.MobileSafari},ce=function(e){return e.name===_.MobileSafari},ue=function(e){return e.name===_.Opera},he=function(e){var t=e.name;return t===_.InternetExplorer||t===_.Ie},fe=function(e){return e.name===_.MIUI},pe=function(e){return e.name===_.SamsungBrowser},me=function(e){var t=e.version;return N(t)},ge=function(e){var t=e.major;return N(t)},ve=function(e){var t=e.name;return N(t)},ye=function(e){var t=e.name;return N(t)},be=function(e){var t=e.version;return N(t)},Ee=function(){var e=F(),t=e&&e.userAgent&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)},we=function(e){return"string"==typeof e&&-1!==e.indexOf("Edg/")},Se=function(){var e=F();return e&&(/iPad|iPhone|iPod/.test(e.platform)||"MacIntel"===e.platform&&e.maxTouchPoints>1)&&!window.MSStream},Te=function(){return $("iPad")},xe=function(){return $("iPhone")},Ae=function(){return $("iPod")},ke=function(e){return N(e)};function Le(e){var t=e||p,r=t.device,i=t.browser,n=t.os,s=t.engine,a=t.ua;return{isSmartTV:j(r),isConsole:W(r),isWearable:V(r),isEmbedded:Y(r),isMobileSafari:ce(i)||Te(),isChromium:ae(i),isMobile:G(r)||Te(),isMobileOnly:U(r),isTablet:z(r)||Te(),isBrowser:H(r),isDesktop:H(r),isAndroid:Q(n),isWinPhone:ee(n),isIOS:te(n)||Te(),isChrome:ne(i),isFirefox:se(i),isSafari:de(i),isOpera:ue(i),isIE:he(i),osVersion:re(n),osName:ie(n),fullBrowserVersion:me(i),browserVersion:ge(i),browserName:ve(i),mobileVendor:K(r),mobileModel:q(r),engineName:ye(s),engineVersion:be(s),getUA:ke(a),isEdge:oe(i)||we(a),isYandex:le(i),deviceType:X(r),isIOS13:Se(),isIPad13:Te(),isIPhone13:xe(),isIPod13:Ae(),isElectron:Ee(),isEdgeChromium:we(a),isLegacyEdge:oe(i)&&!we(a),isWindows:Z(n),isMacOs:J(n),isMIUI:fe(i),isSamsungBrowser:pe(i)}}var Ie=j(l),Re=W(l),Pe=V(l),De=Y(l),Ce=ce(a)||Te(),_e=ae(a),Oe=G(l)||Te(),Me=U(l),Ne=z(l)||Te(),Fe=H(l),$e=H(l),Be=Q(c),Ue=ee(c),ze=te(c)||Te(),Ge=ne(a),je=se(a),He=de(a),Ve=ue(a),We=he(a),Ye=re(c),Ke=ie(c),qe=me(a),Xe=ge(a),Qe=ve(a),Ze=K(l),Je=q(l),et=ye(d),tt=be(d),rt=ke(u),it=oe(a)||we(u),nt=le(a),st=X(l),at=Se(),ot=Te(),lt=xe(),dt=Ae(),ct=Ee(),ut=we(u),ht=oe(a)&&!we(u),ft=Z(c),pt=J(c),mt=fe(a),gt=pe(a);function vt(e){var t=e||window.navigator.userAgent;return f(t)}return ca.AndroidView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return Be?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.BrowserTypes=_,ca.BrowserView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return Fe?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.ConsoleView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return Re?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.CustomView=function(e){var t=e.renderWithFragment,n=e.children;e.viewClassName,e.style;var s=e.condition,a=S(e,["renderWithFragment","children","viewClassName","style","condition"]);return s?t?i.createElement(r.Fragment,null,n):i.createElement("div",a,n):null},ca.IEView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return We?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.IOSView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return ze?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.MobileOnlyView=function(e){var t=e.renderWithFragment,n=e.children;e.viewClassName,e.style;var s=S(e,["renderWithFragment","children","viewClassName","style"]);return Me?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.MobileView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return Oe?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.OsTypes=O,ca.SmartTVView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return Ie?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.TabletView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return Ne?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.WearableView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return Pe?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.WinPhoneView=function(e){var t=e.renderWithFragment,n=e.children,s=S(e,["renderWithFragment","children"]);return Ue?t?i.createElement(r.Fragment,null,n):i.createElement("div",s,n):null},ca.browserName=Qe,ca.browserVersion=Xe,ca.deviceDetect=function(e){var t=e?f(e):p,r=t.device,i=t.browser,n=t.engine,s=t.os,a=t.ua,o=function(e){switch(e){case k:return{isMobile:!0};case L:return{isTablet:!0};case I:return{isSmartTV:!0};case R:return{isConsole:!0};case P:return{isWearable:!0};case C:return{isBrowser:!0};case D:return{isEmbedded:!0};default:return M}}(r.type),l=o.isBrowser,d=o.isMobile,c=o.isTablet,u=o.isSmartTV,h=o.isConsole,m=o.isWearable,g=o.isEmbedded;return l?function(e,t,r,i,n){return{isBrowser:e,browserMajorVersion:N(t.major),browserFullVersion:N(t.version),browserName:N(t.name),engineName:N(r.name),engineVersion:N(r.version),osName:N(i.name),osVersion:N(i.version),userAgent:N(n)}}(l,i,n,s,a):u?function(e,t,r,i){return{isSmartTV:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(i)}}(u,n,s,a):h?function(e,t,r,i){return{isConsole:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(i)}}(h,n,s,a):d||c?B(o,r,s,a):m?function(e,t,r,i){return{isWearable:e,engineName:N(t.name),engineVersion:N(t.version),osName:N(r.name),osVersion:N(r.version),userAgent:N(i)}}(m,n,s,a):g?function(e,t,r,i,n){return{isEmbedded:e,vendor:N(t.vendor),model:N(t.model),engineName:N(r.name),engineVersion:N(r.version),osName:N(i.name),osVersion:N(i.version),userAgent:N(n)}}(g,r,n,s,a):void 0},ca.deviceType=st,ca.engineName=et,ca.engineVersion=tt,ca.fullBrowserVersion=qe,ca.getSelectorsByUserAgent=function(e){if(e&&"string"==typeof e){var t=f(e);return Le({device:t.device,browser:t.browser,os:t.os,engine:t.engine,ua:t.ua})}console.error("No valid user agent string was provided")},ca.getUA=rt,ca.isAndroid=Be,ca.isBrowser=Fe,ca.isChrome=Ge,ca.isChromium=_e,ca.isConsole=Re,ca.isDesktop=$e,ca.isEdge=it,ca.isEdgeChromium=ut,ca.isElectron=ct,ca.isEmbedded=De,ca.isFirefox=je,ca.isIE=We,ca.isIOS=ze,ca.isIOS13=at,ca.isIPad13=ot,ca.isIPhone13=lt,ca.isIPod13=dt,ca.isLegacyEdge=ht,ca.isMIUI=mt,ca.isMacOs=pt,ca.isMobile=Oe,ca.isMobileOnly=Me,ca.isMobileSafari=Ce,ca.isOpera=Ve,ca.isSafari=He,ca.isSamsungBrowser=gt,ca.isSmartTV=Ie,ca.isTablet=Ne,ca.isWearable=Pe,ca.isWinPhone=Ue,ca.isWindows=ft,ca.isYandex=nt,ca.mobileModel=Je,ca.mobileVendor=Ze,ca.osName=Ke,ca.osVersion=Ye,ca.parseUserAgent=f,ca.setUserAgent=function(e){return h(e)},ca.useDeviceData=vt,ca.useDeviceSelectors=function(e){var t=vt(e||window.navigator.userAgent);return[Le(t),t]},ca.useMobileOrientation=function(){var e=x(r.useState(function(){var e=window.innerWidth>window.innerHeight?90:0;return{isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"}}),2),t=e[0],i=e[1],n=r.useCallback(function(){var e=window.innerWidth>window.innerHeight?90:0,r={isPortrait:0===e,isLandscape:90===e,orientation:0===e?"portrait":"landscape"};t.orientation!==r.orientation&&i(r)},[t.orientation]);return r.useEffect(function(){return void 0!==("undefined"==typeof window?"undefined":g(window))&&Oe&&(n(),window.addEventListener("load",n,!1),window.addEventListener("resize",n,!1)),function(){window.removeEventListener("resize",n,!1),window.removeEventListener("load",n,!1)}},[n]),t},ca.withOrientationChange=function(e){return function(t){function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(t=function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}(this,E(r).call(this,e))).isEventListenerAdded=!1,t.handleOrientationChange=t.handleOrientationChange.bind(T(t)),t.onOrientationChange=t.onOrientationChange.bind(T(t)),t.onPageLoad=t.onPageLoad.bind(T(t)),t.state={isLandscape:!1,isPortrait:!1},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}(r,t),v(r,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var e=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:0===e,isLandscape:90===e})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){void 0!==("undefined"==typeof window?"undefined":g(window))&&Oe&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return i.createElement(e,b({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}]),r}(i.Component)},ca}();function ma({message:e,duration:r=3e3,visible:n,setVisible:s}){return i(()=>{const e=setTimeout(()=>s(!1),r);return()=>clearTimeout(e)},[n]),n?t.createElement("div",{style:{position:"fixed",top:"1rem",left:"50%",transform:"translateX(-50%)",background:"rgba(0,0,0,0.8)",color:"#fff",padding:"0.75rem 1.25rem",borderRadius:"0.375rem",fontSize:"14px",zIndex:9999,boxShadow:"0 2px 10px rgba(0,0,0,0.2)"}},e):null}const ga=({shortForm:e,shareUrl:r})=>{const i=null!=r?r:window.location.href,[n,s]=a(!1);return t.createElement(t.Fragment,null,t.createElement("button",{onClick:()=>x(void 0,void 0,void 0,function*(){try{s(!0),pa.isMobile&&navigator.share&&e?yield navigator.share({title:e.title,url:i}):(e=>{if(void 0!==navigator.clipboard)navigator.clipboard.writeText(e).then(()=>{});else{const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999);try{document.execCommand("copy")}catch(e){console.error("복사 실패",e)}t.setSelectionRange(0,0),document.body.removeChild(t)}})(i)}catch(e){console.error("Fail to copy on clipboard")}}),className:"cursor-pointer"},t.createElement(Yt,{size:22}),t.createElement(ma,{message:"공유 링크 복사 완료",setVisible:s,visible:n})))},va=({product:e,hideMoreBtn:r,contentId:i})=>{const{isPreview:n,priceText:s}=Js(),[o,l]=a(!1);return t.createElement("div",{style:{height:"80px"},className:"flex gap-2 items-center w-full",onClick:()=>x(void 0,void 0,void 0,function*(){r&&(window.open(e.linkPath,"_blank"),n||(yield zs({contentProductId:e.eventProductId,contentId:i,productId:e.productId})))})},e.thumbPath&&!o?t.createElement(Jt,{product:e,onError:()=>l(!0)}):t.createElement(Zt,null),t.createElement("div",{className:"flex flex-col text-left p-2 w-full justify-center"},e.brand&&t.createElement("span",{className:"break-keep line-clamp-1 text-gray-500",style:{fontSize:"10px"}},e.brand.brandName),t.createElement("div",{className:"text-gray-800 text-ellipsis line-clamp-1 ",style:{fontSize:"12px"}},e.productName),t.createElement("div",{className:"text-red-500 break-keep",style:{fontSize:"12px"}},s?s+" ":"할인가 ",t.createElement("span",{className:"font-semibold break-keep"},xt(e.sellingPrice),"원"))))};function ya(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),!1===r||!i.defaultPrevented)return t?.(i)}}function ba(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Ea(...e){return t=>{let r=!1;const i=e.map(e=>{const i=ba(e,t);return r||"function"!=typeof i||(r=!0),i});if(r)return()=>{for(let t=0;t<i.length;t++){const r=i[t];"function"==typeof r?r():ba(e[t],null)}}}}function wa(...t){return e.useCallback(Ea(...t),t)}function Sa(...t){const r=t[0];if(1===t.length)return r;const i=()=>{const i=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const n=i.reduce((e,{useScope:r,scopeName:i})=>({...e,...r(t)[`__scope${i}`]}),{});return e.useMemo(()=>({[`__scope${r.scopeName}`]:n}),[n])}};return i.scopeName=r.scopeName,i}var Ta=globalThis?.document?e.useLayoutEffect:()=>{},xa=e[" useId ".trim().toString()]||(()=>{}),Aa=0;function ka(t){const[r,i]=e.useState(xa());return Ta(()=>{t||i(e=>e??String(Aa++))},[t]),t||(r?`radix-${r}`:"")}var La=e[" useInsertionEffect ".trim().toString()]||Ta;function Ia({prop:t,defaultProp:r,onChange:i=()=>{},caller:n}){const[s,a,o]=function({defaultProp:t,onChange:r}){const[i,n]=e.useState(t),s=e.useRef(i),a=e.useRef(r);return La(()=>{a.current=r},[r]),e.useEffect(()=>{s.current!==i&&(a.current?.(i),s.current=i)},[i,s]),[i,n,a]}({defaultProp:r,onChange:i}),l=void 0!==t,d=l?t:s;{const r=e.useRef(void 0!==t);e.useEffect(()=>{const e=r.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}r.current=l},[l,n])}const c=e.useCallback(e=>{if(l){const r=function(e){return"function"==typeof e}(e)?e(t):e;r!==t&&o.current?.(r)}else a(e)},[l,t,a,o]);return[d,c]}function Ra(t){const r=Pa(t),i=e.forwardRef((t,i)=>{const{children:n,...s}=t,a=e.Children.toArray(n),o=a.find(Ca);if(o){const t=o.props.children,n=a.map(r=>r===o?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r);return p(r,{...s,ref:i,children:e.isValidElement(t)?e.cloneElement(t,void 0,n):null})}return p(r,{...s,ref:i,children:n})});return i.displayName=`${t}.Slot`,i}function Pa(t){const r=e.forwardRef((t,r)=>{const{children:i,...n}=t;if(e.isValidElement(i)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i),s=function(e,t){const r={...t};for(const i in t){const n=e[i],s=t[i];/^on[A-Z]/.test(i)?n&&s?r[i]=(...e)=>{const t=s(...e);return n(...e),t}:n&&(r[i]=n):"style"===i?r[i]={...n,...s}:"className"===i&&(r[i]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}(n,i.props);return i.type!==e.Fragment&&(s.ref=r?Ea(r,t):t),e.cloneElement(i,s)}return e.Children.count(i)>1?e.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}var Da=Symbol("radix.slottable");function Ca(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===Da}var _a=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const i=Ra(`Primitive.${r}`),n=e.forwardRef((e,t)=>{const{asChild:n,...s}=e,a=n?i:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),p(a,{...s,ref:t})});return n.displayName=`Primitive.${r}`,{...t,[r]:n}},{});function Oa(t){const r=e.useRef(t);return e.useEffect(()=>{r.current=t}),e.useMemo(()=>(...e)=>r.current?.(...e),[])}function Ma(t,r=globalThis?.document){const i=Oa(t);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&i(e)};return r.addEventListener("keydown",e,{capture:!0}),()=>r.removeEventListener("keydown",e,{capture:!0})},[i,r])}var Na,Fa="dismissableLayer.update",$a="dismissableLayer.pointerDownOutside",Ba="dismissableLayer.focusOutside",Ua=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),za=e.forwardRef((t,r)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...d}=t,c=e.useContext(Ua),[u,h]=e.useState(null),f=u?.ownerDocument??globalThis?.document,[,m]=e.useState({}),g=wa(r,e=>h(e)),v=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),E=u?v.indexOf(u):-1,w=c.layersWithOutsidePointerEventsDisabled.size>0,S=E>=b,T=function(t,r=globalThis?.document){const i=Oa(t),n=e.useRef(!1),s=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let t=function(){ja($a,i,n,{discrete:!0})};const n={originalEvent:e};"touch"===e.pointerType?(r.removeEventListener("click",s.current),s.current=t,r.addEventListener("click",s.current,{once:!0})):t()}else r.removeEventListener("click",s.current);n.current=!1},t=window.setTimeout(()=>{r.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),r.removeEventListener("pointerdown",e),r.removeEventListener("click",s.current)}},[r,i]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...c.branches].some(e=>e.contains(t));S&&!r&&(s?.(e),o?.(e),e.defaultPrevented||l?.())},f),x=function(t,r=globalThis?.document){const i=Oa(t),n=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!n.current){ja(Ba,i,{originalEvent:e},{discrete:!1})}};return r.addEventListener("focusin",e),()=>r.removeEventListener("focusin",e)},[r,i]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...c.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||l?.())},f);return Ma(e=>{E===c.layers.size-1&&(n?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},f),e.useEffect(()=>{if(u)return i&&(0===c.layersWithOutsidePointerEventsDisabled.size&&(Na=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Ga(),()=>{i&&1===c.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=Na)}},[u,f,i,c]),e.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Ga())},[u,c]),e.useEffect(()=>{const e=()=>m({});return document.addEventListener(Fa,e),()=>document.removeEventListener(Fa,e)},[]),p(_a.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:ya(t.onFocusCapture,x.onFocusCapture),onBlurCapture:ya(t.onBlurCapture,x.onBlurCapture),onPointerDownCapture:ya(t.onPointerDownCapture,T.onPointerDownCapture)})});za.displayName="DismissableLayer";function Ga(){const e=new CustomEvent(Fa);document.dispatchEvent(e)}function ja(e,t,r,{discrete:i}){const n=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),i?function(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}(n,s):n.dispatchEvent(s)}e.forwardRef((t,r)=>{const i=e.useContext(Ua),n=e.useRef(null),s=wa(r,n);return e.useEffect(()=>{const e=n.current;if(e)return i.branches.add(e),()=>{i.branches.delete(e)}},[i.branches]),p(_a.div,{...t,ref:s})}).displayName="DismissableLayerBranch";var Ha="focusScope.autoFocusOnMount",Va="focusScope.autoFocusOnUnmount",Wa={bubbles:!1,cancelable:!0},Ya=e.forwardRef((t,r)=>{const{loop:i=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=t,[l,d]=e.useState(null),c=Oa(s),u=Oa(a),h=e.useRef(null),f=wa(r,e=>d(e)),m=e.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;e.useEffect(()=>{if(n){let e=function(e){if(m.paused||!l)return;const t=e.target;l.contains(t)?h.current=t:Qa(h.current,{select:!0})},t=function(e){if(m.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Qa(h.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Qa(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const i=new MutationObserver(r);return l&&i.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),i.disconnect()}}},[n,l,m.paused]),e.useEffect(()=>{if(l){Za.add(m);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(Ha,Wa);l.addEventListener(Ha,c),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(Qa(i,{select:t}),document.activeElement!==r)return}((e=Ka(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Qa(l))}return()=>{l.removeEventListener(Ha,c),setTimeout(()=>{const e=new CustomEvent(Va,Wa);l.addEventListener(Va,u),l.dispatchEvent(e),e.defaultPrevented||Qa(t??document.body,{select:!0}),l.removeEventListener(Va,u),Za.remove(m)},0)}}var e},[l,c,u,m]);const g=e.useCallback(e=>{if(!i&&!n)return;if(m.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[n,s]=function(e){const t=Ka(e),r=qa(t,e),i=qa(t.reverse(),e);return[r,i]}(t);n&&s?e.shiftKey||r!==s?e.shiftKey&&r===n&&(e.preventDefault(),i&&Qa(s,{select:!0})):(e.preventDefault(),i&&Qa(n,{select:!0})):r===t&&e.preventDefault()}},[i,n,m.paused]);return p(_a.div,{tabIndex:-1,...o,ref:f,onKeyDown:g})});function Ka(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function qa(e,t){for(const r of e)if(!Xa(r,{upTo:t}))return r}function Xa(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Qa(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Ya.displayName="FocusScope";var Za=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Ja(e,t),e.unshift(t)},remove(t){e=Ja(e,t),e[0]?.resume()}}}();function Ja(e,t){const r=[...e],i=r.indexOf(t);return-1!==i&&r.splice(i,1),r}var eo=e.forwardRef((t,r)=>{const{container:i,...n}=t,[s,a]=e.useState(!1);Ta(()=>a(!0),[]);const o=i||s&&globalThis?.document?.body;return o?y.createPortal(p(_a.div,{...n,ref:r}),o):null});eo.displayName="Portal";var to=t=>{const{present:r,children:i}=t,n=function(t){const[r,i]=e.useState(),n=e.useRef(null),s=e.useRef(t),a=e.useRef("none"),o=t?"mounted":"unmounted",[l,d]=function(t,r){return e.useReducer((e,t)=>r[e][t]??e,t)}(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=ro(n.current);a.current="mounted"===l?e:"none"},[l]),Ta(()=>{const e=n.current,r=s.current;if(r!==t){const i=a.current,n=ro(e);if(t)d("MOUNT");else if("none"===n||"none"===e?.display)d("UNMOUNT");else{d(r&&i!==n?"ANIMATION_OUT":"UNMOUNT")}s.current=t}},[t,d]),Ta(()=>{if(r){let e;const t=r.ownerDocument.defaultView??window,i=i=>{const a=ro(n.current).includes(i.animationName);if(i.target===r&&a&&(d("ANIMATION_END"),!s.current)){const i=r.style.animationFillMode;r.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=i)})}},o=e=>{e.target===r&&(a.current=ro(n.current))};return r.addEventListener("animationstart",o),r.addEventListener("animationcancel",i),r.addEventListener("animationend",i),()=>{t.clearTimeout(e),r.removeEventListener("animationstart",o),r.removeEventListener("animationcancel",i),r.removeEventListener("animationend",i)}}d("ANIMATION_END")},[r,d]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{n.current=e?getComputedStyle(e):null,i(e)},[])}}(r),s="function"==typeof i?i({present:n.isPresent}):e.Children.only(i),a=wa(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof i||n.isPresent?e.cloneElement(s,{ref:a}):null};function ro(e){return e?.animationName||"none"}to.displayName="Presence";var io=0;function no(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var so="right-scroll-bar-position",ao="width-before-scroll-bar";function oo(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var lo="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,co=new WeakMap;function uo(e,t){var r,i,n,s=(r=null,i=function(t){return e.forEach(function(e){return oo(e,t)})},(n=a(function(){return{value:r,callback:i,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0]).callback=i,n.facade);return lo(function(){var t=co.get(s);if(t){var r=new Set(t),i=new Set(e),n=s.current;r.forEach(function(e){i.has(e)||oo(e,null)}),i.forEach(function(e){r.has(e)||oo(e,n)})}co.set(s,e)},[e]),s}function ho(e){return e}var fo=function(t){var r=t.sideCar,i=T(t,["sideCar"]);if(!r)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=r.read();if(!n)throw new Error("Sidecar medium not found");return e.createElement(n,S({},i))};fo.isSideCarExport=!0;var po=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=ho);var r=[],i=!1,n={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var n=t(e,i);return r.push(n),function(){r=r.filter(function(e){return e!==n})}},assignSyncMedium:function(e){for(i=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){i=!0;var t=[];if(r.length){var n=r;r=[],n.forEach(e),t=r}var s=function(){var r=t;t=[],r.forEach(e)},a=function(){return Promise.resolve().then(s)};a(),r={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),r}}}};return n}(null);return t.options=S({async:!0,ssr:!1},e),t}(),mo=function(){},go=e.forwardRef(function(t,r){var i=e.useRef(null),n=e.useState({onScrollCapture:mo,onWheelCapture:mo,onTouchMoveCapture:mo}),s=n[0],a=n[1],o=t.forwardProps,l=t.children,d=t.className,c=t.removeScrollBar,u=t.enabled,h=t.shards,f=t.sideCar,p=t.noRelative,m=t.noIsolation,g=t.inert,v=t.allowPinchZoom,y=t.as,b=void 0===y?"div":y,E=t.gapMode,w=T(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,A=uo([i,r]),k=S(S({},w),s);return e.createElement(e.Fragment,null,u&&e.createElement(x,{sideCar:po,removeScrollBar:c,shards:h,noRelative:p,noIsolation:m,inert:g,setCallbacks:a,allowPinchZoom:!!v,lockRef:i,gapMode:E}),o?e.cloneElement(e.Children.only(l),S(S({},k),{ref:A})):e.createElement(b,S({},k,{className:d,ref:A}),l))});go.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},go.classNames={fullWidth:ao,zeroRight:so};function vo(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var yo=function(){var e=0,t=null;return{add:function(r){var i,n;0==e&&(t=vo())&&(n=r,(i=t).styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},bo=function(){var t,r=(t=yo(),function(r,i){e.useEffect(function(){return t.add(r),function(){t.remove()}},[r&&i])});return function(e){var t=e.styles,i=e.dynamic;return r(t,i),null}},Eo={left:0,top:0,right:0,gap:0},wo=function(e){return parseInt(e||"",10)||0},So=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Eo;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],i=t["padding"===e?"paddingTop":"marginTop"],n=t["padding"===e?"paddingRight":"marginRight"];return[wo(r),wo(i),wo(n)]}(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-r+t[2]-t[0])}},To=bo(),xo="data-scroll-locked",Ao=function(e,t,r,i){var n=e.left,s=e.top,a=e.right,o=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(i,";\n padding-right: ").concat(o,"px ").concat(i,";\n }\n body[").concat(xo,"] {\n overflow: hidden ").concat(i,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(i,";"),"margin"===r&&"\n padding-left: ".concat(n,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(a,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(o,"px ").concat(i,";\n "),"padding"===r&&"padding-right: ".concat(o,"px ").concat(i,";")].filter(Boolean).join(""),"\n }\n \n .").concat(so," {\n right: ").concat(o,"px ").concat(i,";\n }\n \n .").concat(ao," {\n margin-right: ").concat(o,"px ").concat(i,";\n }\n \n .").concat(so," .").concat(so," {\n right: 0 ").concat(i,";\n }\n \n .").concat(ao," .").concat(ao," {\n margin-right: 0 ").concat(i,";\n }\n \n body[").concat(xo,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(o,"px;\n }\n")},ko=function(){var e=parseInt(document.body.getAttribute(xo)||"0",10);return isFinite(e)?e:0},Lo=function(t){var r=t.noRelative,i=t.noImportant,n=t.gapMode,s=void 0===n?"margin":n;e.useEffect(function(){return document.body.setAttribute(xo,(ko()+1).toString()),function(){var e=ko()-1;e<=0?document.body.removeAttribute(xo):document.body.setAttribute(xo,e.toString())}},[]);var a=e.useMemo(function(){return So(s)},[s]);return e.createElement(To,{styles:Ao(a,!r,s,i?"":"!important")})},Io=!1;if("undefined"!=typeof window)try{var Ro=Object.defineProperty({},"passive",{get:function(){return Io=!0,!0}});window.addEventListener("test",Ro,Ro),window.removeEventListener("test",Ro,Ro)}catch(e){Io=!1}var Po=!!Io&&{passive:!1},Do=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},Co=function(e,t){var r=t.ownerDocument,i=t;do{if("undefined"!=typeof ShadowRoot&&i instanceof ShadowRoot&&(i=i.host),_o(e,i)){var n=Oo(e,i);if(n[1]>n[2])return!0}i=i.parentNode}while(i&&i!==r.body);return!1},_o=function(e,t){return"v"===e?function(e){return Do(e,"overflowY")}(t):function(e){return Do(e,"overflowX")}(t)},Oo=function(e,t){return"v"===e?[(r=t).scrollTop,r.scrollHeight,r.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var r},Mo=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},No=function(e){return[e.deltaX,e.deltaY]},Fo=function(e){return e&&"current"in e?e.current:e},$o=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Bo=0,Uo=[];function zo(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Go,jo=(Go=function(t){var r=e.useRef([]),i=e.useRef([0,0]),n=e.useRef(),s=e.useState(Bo++)[0],a=e.useState(bo)[0],o=e.useRef(t);e.useEffect(function(){o.current=t},[t]),e.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var e=function(e,t,r){if(r||2===arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}([t.lockRef.current],(t.shards||[]).map(Fo),!0).filter(Boolean);return e.forEach(function(e){return e.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),e.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=e.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var r,s=Mo(e),a=i.current,l="deltaX"in e?e.deltaX:a[0]-s[0],d="deltaY"in e?e.deltaY:a[1]-s[1],c=e.target,u=Math.abs(l)>Math.abs(d)?"h":"v";if("touches"in e&&"h"===u&&"range"===c.type)return!1;var h=Co(u,c);if(!h)return!0;if(h?r=u:(r="v"===u?"h":"v",h=Co(u,c)),!h)return!1;if(!n.current&&"changedTouches"in e&&(l||d)&&(n.current=r),!r)return!0;var f=n.current||r;return function(e,t,r,i,n){var s=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=s*i,o=r.target,l=t.contains(o),d=!1,c=a>0,u=0,h=0;do{if(!o)break;var f=Oo(e,o),p=f[0],m=f[1]-f[2]-s*p;(p||m)&&_o(e,o)&&(u+=m,h+=p);var g=o.parentNode;o=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&o!==document.body||l&&(t.contains(o)||t===o));return c&&(Math.abs(u)<1||!n)?d=!0:c||!(Math.abs(h)<1)&&n||(d=!0),d}(f,t,e,"h"===f?l:d,!0)},[]),d=e.useCallback(function(e){var t=e;if(Uo.length&&Uo[Uo.length-1]===a){var i="deltaY"in t?No(t):Mo(t),n=r.current.filter(function(e){return e.name===t.type&&(e.target===t.target||t.target===e.shadowParent)&&function(e,t){return e[0]===t[0]&&e[1]===t[1]}(e.delta,i)})[0];if(n&&n.should)t.cancelable&&t.preventDefault();else if(!n){var s=(o.current.shards||[]).map(Fo).filter(Boolean).filter(function(e){return e.contains(t.target)});(s.length>0?l(t,s[0]):!o.current.noIsolation)&&t.cancelable&&t.preventDefault()}}},[]),c=e.useCallback(function(e,t,i,n){var s={name:e,delta:t,target:i,should:n,shadowParent:zo(i)};r.current.push(s),setTimeout(function(){r.current=r.current.filter(function(e){return e!==s})},1)},[]),u=e.useCallback(function(e){i.current=Mo(e),n.current=void 0},[]),h=e.useCallback(function(e){c(e.type,No(e),e.target,l(e,t.lockRef.current))},[]),f=e.useCallback(function(e){c(e.type,Mo(e),e.target,l(e,t.lockRef.current))},[]);e.useEffect(function(){return Uo.push(a),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",d,Po),document.addEventListener("touchmove",d,Po),document.addEventListener("touchstart",u,Po),function(){Uo=Uo.filter(function(e){return e!==a}),document.removeEventListener("wheel",d,Po),document.removeEventListener("touchmove",d,Po),document.removeEventListener("touchstart",u,Po)}},[]);var p=t.removeScrollBar,m=t.inert;return e.createElement(e.Fragment,null,m?e.createElement(a,{styles:$o(s)}):null,p?e.createElement(Lo,{noRelative:t.noRelative,gapMode:t.gapMode}):null)},po.useMedium(Go),fo),Ho=e.forwardRef(function(t,r){return e.createElement(go,S({},t,{ref:r,sideCar:jo}))});Ho.classNames=go.classNames;var Vo=new WeakMap,Wo=new WeakMap,Yo={},Ko=0,qo=function(e){return e&&(e.host||qo(e.parentNode))},Xo=function(e,t,r,i){var n=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=qo(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);Yo[r]||(Yo[r]=new WeakMap);var s=Yo[r],a=[],o=new Set,l=new Set(n),d=function(e){e&&!o.has(e)&&(o.add(e),d(e.parentNode))};n.forEach(d);var c=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(o.has(e))c(e);else try{var t=e.getAttribute(i),n=null!==t&&"false"!==t,l=(Vo.get(e)||0)+1,d=(s.get(e)||0)+1;Vo.set(e,l),s.set(e,d),a.push(e),1===l&&n&&Wo.set(e,!0),1===d&&e.setAttribute(r,"true"),n||e.setAttribute(i,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return c(t),o.clear(),Ko++,function(){a.forEach(function(e){var t=Vo.get(e)-1,n=s.get(e)-1;Vo.set(e,t),s.set(e,n),t||(Wo.has(e)||e.removeAttribute(i),Wo.delete(e)),n||e.removeAttribute(r)}),--Ko||(Vo=new WeakMap,Vo=new WeakMap,Wo=new WeakMap,Yo={})}},Qo=function(e,t,r){void 0===r&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),n=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return n?(i.push.apply(i,Array.from(n.querySelectorAll("[aria-live], script"))),Xo(i,n,r,"aria-hidden")):function(){return null}},Zo="Dialog",[Jo,el]=function(t,r=[]){let i=[];const n=()=>{const r=i.map(t=>e.createContext(t));return function(i){const n=i?.[t]||r;return e.useMemo(()=>({[`__scope${t}`]:{...i,[t]:n}}),[i,n])}};return n.scopeName=t,[function(r,n){const s=e.createContext(n),a=i.length;i=[...i,n];const o=r=>{const{scope:i,children:n,...o}=r,l=i?.[t]?.[a]||s,d=e.useMemo(()=>o,Object.values(o));return p(l.Provider,{value:d,children:n})};return o.displayName=r+"Provider",[o,function(i,o){const l=o?.[t]?.[a]||s,d=e.useContext(l);if(d)return d;if(void 0!==n)return n;throw new Error(`\`${i}\` must be used within \`${r}\``)}]},Sa(n,...r)]}(Zo),[tl,rl]=Jo(Zo),il=t=>{const{__scopeDialog:r,children:i,open:n,defaultOpen:s,onOpenChange:a,modal:o=!0}=t,l=e.useRef(null),d=e.useRef(null),[c,u]=Ia({prop:n,defaultProp:s??!1,onChange:a,caller:Zo});return p(tl,{scope:r,triggerRef:l,contentRef:d,contentId:ka(),titleId:ka(),descriptionId:ka(),open:c,onOpenChange:u,onOpenToggle:e.useCallback(()=>u(e=>!e),[u]),modal:o,children:i})};il.displayName=Zo;var nl="DialogTrigger",sl=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=rl(nl,r),s=wa(t,n.triggerRef);return p(_a.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Al(n.open),...i,ref:s,onClick:ya(e.onClick,n.onOpenToggle)})});sl.displayName=nl;var al="DialogPortal",[ol,ll]=Jo(al,{forceMount:void 0}),dl=t=>{const{__scopeDialog:r,forceMount:i,children:n,container:s}=t,a=rl(al,r);return p(ol,{scope:r,forceMount:i,children:e.Children.map(n,e=>p(to,{present:i||a.open,children:p(eo,{asChild:!0,container:s,children:e})}))})};dl.displayName=al;var cl="DialogOverlay",ul=e.forwardRef((e,t)=>{const r=ll(cl,e.__scopeDialog),{forceMount:i=r.forceMount,...n}=e,s=rl(cl,e.__scopeDialog);return s.modal?p(to,{present:i||s.open,children:p(fl,{...n,ref:t})}):null});ul.displayName=cl;var hl=Ra("DialogOverlay.RemoveScroll"),fl=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=rl(cl,r);return p(Ho,{as:hl,allowPinchZoom:!0,shards:[n.contentRef],children:p(_a.div,{"data-state":Al(n.open),...i,ref:t,style:{pointerEvents:"auto",...i.style}})})}),pl="DialogContent",ml=e.forwardRef((e,t)=>{const r=ll(pl,e.__scopeDialog),{forceMount:i=r.forceMount,...n}=e,s=rl(pl,e.__scopeDialog);return p(to,{present:i||s.open,children:s.modal?p(gl,{...n,ref:t}):p(vl,{...n,ref:t})})});ml.displayName=pl;var gl=e.forwardRef((t,r)=>{const i=rl(pl,t.__scopeDialog),n=e.useRef(null),s=wa(r,i.contentRef,n);return e.useEffect(()=>{const e=n.current;if(e)return Qo(e)},[]),p(yl,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ya(t.onCloseAutoFocus,e=>{e.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:ya(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:ya(t.onFocusOutside,e=>e.preventDefault())})}),vl=e.forwardRef((t,r)=>{const i=rl(pl,t.__scopeDialog),n=e.useRef(!1),s=e.useRef(!1);return p(yl,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(n.current||i.triggerRef.current?.focus(),e.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(n.current=!0,"pointerdown"===e.detail.originalEvent.type&&(s.current=!0));const r=e.target,a=i.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&s.current&&e.preventDefault()}})}),yl=e.forwardRef((t,r)=>{const{__scopeDialog:i,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=t,l=rl(pl,i),d=e.useRef(null),c=wa(r,d);return e.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??no()),document.body.insertAdjacentElement("beforeend",e[1]??no()),io++,()=>{1===io&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),io--}},[]),g(m,{children:[p(Ya,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:p(za,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Al(l.open),...o,ref:c,onDismiss:()=>l.onOpenChange(!1)})}),g(m,{children:[p(Rl,{titleId:l.titleId}),p(Pl,{contentRef:d,descriptionId:l.descriptionId})]})]})}),bl="DialogTitle",El=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=rl(bl,r);return p(_a.h2,{id:n.titleId,...i,ref:t})});El.displayName=bl;var wl="DialogDescription",Sl=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=rl(wl,r);return p(_a.p,{id:n.descriptionId,...i,ref:t})});Sl.displayName=wl;var Tl="DialogClose",xl=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=rl(Tl,r);return p(_a.button,{type:"button",...i,ref:t,onClick:ya(e.onClick,()=>n.onOpenChange(!1))})});function Al(e){return e?"open":"closed"}xl.displayName=Tl;var kl="DialogTitleWarning",[Ll,Il]=function(t,r){const i=e.createContext(r),n=t=>{const{children:r,...n}=t,s=e.useMemo(()=>n,Object.values(n));return p(i.Provider,{value:s,children:r})};return n.displayName=t+"Provider",[n,function(n){const s=e.useContext(i);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]}(kl,{contentName:pl,titleName:bl,docsSlug:"dialog"}),Rl=({titleId:t})=>{const r=Il(kl),i=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return e.useEffect(()=>{if(t){document.getElementById(t)||console.error(i)}},[i,t]),null},Pl=({contentRef:t,descriptionId:r})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Il("DialogDescriptionWarning").contentName}}.`;return e.useEffect(()=>{const e=t.current?.getAttribute("aria-describedby");if(r&&e){document.getElementById(r)||console.warn(i)}},[i,t,r]),null},Dl=il,Cl=sl,_l=dl,Ol=ul,Ml=ml,Nl=El,Fl=Sl,$l=xl;const Bl=t.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Ul=()=>{const e=t.useContext(Bl);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};function zl(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Gl(){return Hl(/^iPad/)||Hl(/^Mac/)&&navigator.maxTouchPoints>1}function jl(){return Hl(/^iPhone/)||Gl()}function Hl(e){return"undefined"!=typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if("undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");const Vl="undefined"!=typeof window?o:i;function Wl(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}const Yl="undefined"!=typeof document&&window.visualViewport;function Kl(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function ql(e){for(Kl(e)&&(e=e.parentElement);e&&!Kl(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Xl=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Ql,Zl=0;function Jl(e={}){let{isDisabled:t}=e;Vl(()=>{if(!t)return Zl++,1===Zl&&jl()&&(Ql=function(){let e,t=0,r=r=>{e=ql(r.target),e===document.documentElement&&e===document.body||(t=r.changedTouches[0].pageY)},i=r=>{if(!e||e===document.documentElement||e===document.body)return void r.preventDefault();let i=r.changedTouches[0].pageY,n=e.scrollTop,s=e.scrollHeight-e.clientHeight;0!==s&&((n<=0&&i>t||n>=s&&i<t)&&r.preventDefault(),t=i)},n=e=>{let t=e.target;rd(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},s=e=>{let t=e.target;rd(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",Yl&&(Yl.height<window.innerHeight?requestAnimationFrame(()=>{td(t)}):Yl.addEventListener("resize",()=>td(t),{once:!0}))}))},a=()=>{window.scrollTo(0,0)},o=window.pageXOffset,l=window.pageYOffset,d=Wl(function(e,t,r){let i=e.style[t];return e.style[t]=r,()=>{e.style[t]=i}}(document.documentElement,"paddingRight",window.innerWidth-document.documentElement.clientWidth+"px"));window.scrollTo(0,0);let c=Wl(ed(document,"touchstart",r,{passive:!1,capture:!0}),ed(document,"touchmove",i,{passive:!1,capture:!0}),ed(document,"touchend",n,{passive:!1,capture:!0}),ed(document,"focus",s,!0),ed(window,"scroll",a));return()=>{d(),c(),window.scrollTo(o,l)}}()),()=>{Zl--,0===Zl&&(null==Ql||Ql())}},[t])}function ed(e,t,r,i){return e.addEventListener(t,r,i),()=>{e.removeEventListener(t,r,i)}}function td(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=ql(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let r=t.getBoundingClientRect().top,i=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=i-r)}e=t.parentElement}}function rd(e){return e instanceof HTMLInputElement&&!Xl.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function id(...t){return e.useCallback(function(...e){return t=>e.forEach(e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t))}(...t),t)}const nd=new WeakMap;function sd(e,t,r=!1){if(!(e&&e instanceof HTMLElement))return;let i={};Object.entries(t).forEach(([t,r])=>{t.startsWith("--")?e.style.setProperty(t,r):(i[t]=e.style[t],e.style[t]=r)}),r||nd.set(e,i)}const ad=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function od(e,t){if(!e)return null;const r=window.getComputedStyle(e),i=r.transform||r.webkitTransform||r.mozTransform;let n=i.match(/^matrix3d\((.+)\)$/);return n?parseFloat(n[1].split(", ")[ad(t)?13:12]):(n=i.match(/^matrix\((.+)\)$/),n?parseFloat(n[1].split(", ")[ad(t)?5:4]):null)}function ld(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}const dd={DURATION:.5,EASE:[.32,.72,0,1]},cd=16,ud="vaul-dragging";function hd(e){const r=t.useRef(e);return t.useEffect(()=>{r.current=e}),t.useMemo(()=>(...e)=>null==r.current?void 0:r.current.call(r,...e),[])}function fd({prop:e,defaultProp:r,onChange:i=()=>{}}){const[n,s]=function({defaultProp:e,onChange:r}){const i=t.useState(e),[n]=i,s=t.useRef(n),a=hd(r);return t.useEffect(()=>{s.current!==n&&(a(n),s.current=n)},[n,s,a]),i}({defaultProp:r,onChange:i}),a=void 0!==e,o=a?e:n,l=hd(i),d=t.useCallback(t=>{if(a){const r="function"==typeof t?t(e):t;r!==e&&l(r)}else s(t)},[a,e,s,l]);return[o,d]}let pd=null;function md({open:e,onOpenChange:r,children:i,onDrag:n,onRelease:s,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:d=.25,scrollLockTimeout:c=100,dismissible:u=!0,handleOnly:h=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:g,modal:v=!0,onClose:y,nested:b,noBodyStyles:E=!1,direction:w="bottom",defaultOpen:S=!1,disablePreventScroll:T=!0,snapToSequentialPoint:x=!1,preventScrollRestoration:A=!1,repositionInputs:k=!0,onAnimationEnd:L,container:I,autoFocus:R=!1}){var P,D;const[C=!1,_]=fd({defaultProp:S,prop:e,onChange:e=>{null==r||r(e),e||b||ce(),setTimeout(()=>{null==L||L(e)},1e3*dd.DURATION),e&&!v&&"undefined"!=typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[O,M]=t.useState(!1),[N,F]=t.useState(!1),[$,B]=t.useState(!1),U=t.useRef(null),z=t.useRef(null),G=t.useRef(null),j=t.useRef(null),H=t.useRef(null),V=t.useRef(!1),W=t.useRef(null),Y=t.useRef(0),K=t.useRef(!1),q=t.useRef(!S),X=t.useRef(0),Q=t.useRef(null),Z=t.useRef((null==(P=Q.current)?void 0:P.getBoundingClientRect().height)||0),J=t.useRef((null==(D=Q.current)?void 0:D.getBoundingClientRect().width)||0),ee=t.useRef(0),te=t.useCallback(e=>{a&&e===ae.length-1&&(z.current=new Date)},[]),{activeSnapPoint:re,activeSnapPointIndex:ie,setActiveSnapPoint:ne,onRelease:se,snapPointsOffset:ae,onDrag:oe,shouldFade:le,getPercentageDragged:de}=function({activeSnapPointProp:e,setActiveSnapPointProp:r,snapPoints:i,drawerRef:n,overlayRef:s,fadeFromIndex:a,onSnapPointChange:o,direction:l="bottom",container:d,snapToSequentialPoint:c}){const[u,h]=fd({prop:e,defaultProp:null==i?void 0:i[0],onChange:r}),[f,p]=t.useState("undefined"!=typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);t.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const m=t.useMemo(()=>u===(null==i?void 0:i[i.length-1])||null,[i,u]),g=t.useMemo(()=>{var e;return null!=(e=null==i?void 0:i.findIndex(e=>e===u))?e:null},[i,u]),v=i&&i.length>0&&(a||0===a)&&!Number.isNaN(a)&&i[a]===u||!i,y=t.useMemo(()=>{const e=d?{width:d.getBoundingClientRect().width,height:d.getBoundingClientRect().height}:"undefined"!=typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var t;return null!=(t=null==i?void 0:i.map(t=>{const r="string"==typeof t;let i=0;if(r&&(i=parseInt(t,10)),ad(l)){const n=r?i:f?t*e.height:0;return f?"bottom"===l?e.height-n:-e.height+n:n}const n=r?i:f?t*e.width:0;return f?"right"===l?e.width-n:-e.width+n:n}))?t:[]},[i,f,d]),b=t.useMemo(()=>null!==g?null==y?void 0:y[g]:null,[y,g]),E=t.useCallback(e=>{var t;const r=null!=(t=null==y?void 0:y.findIndex(t=>t===e))?t:null;o(r),sd(n.current,{transition:`transform ${dd.DURATION}s cubic-bezier(${dd.EASE.join(",")})`,transform:ad(l)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),y&&r!==y.length-1&&void 0!==a&&r!==a&&r<a?sd(s.current,{transition:`opacity ${dd.DURATION}s cubic-bezier(${dd.EASE.join(",")})`,opacity:"0"}):sd(s.current,{transition:`opacity ${dd.DURATION}s cubic-bezier(${dd.EASE.join(",")})`,opacity:"1"}),h(null==i?void 0:i[Math.max(r,0)])},[n.current,i,y,a,s,h]);return t.useEffect(()=>{if(u||e){var t;const r=null!=(t=null==i?void 0:i.findIndex(t=>t===e||t===u))?t:-1;y&&-1!==r&&"number"==typeof y[r]&&E(y[r])}},[u,e,i,y,E]),{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:v,getPercentageDragged:function(e,t){if(!i||"number"!=typeof g||!y||void 0===a)return null;const r=g===a-1;if(g>=a&&t)return 0;if(r&&!t)return 1;if(!v&&!r)return null;const n=r?g+1:g-1,s=r?y[n]-y[n-1]:y[n+1]-y[n],o=e/Math.abs(s);return r?1-o:o},setActiveSnapPoint:h,activeSnapPointIndex:g,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:n}){if(void 0===a)return;const o="bottom"===l||"right"===l?(null!=b?b:0)-e:(null!=b?b:0)+e,d=0===g,u=e>0;if(g===a-1&&sd(s.current,{transition:`opacity ${dd.DURATION}s cubic-bezier(${dd.EASE.join(",")})`}),!c&&r>2&&!u)return void(n?t():E(y[0]));if(!c&&r>2&&u&&y&&i)return void E(y[i.length-1]);const h=null==y?void 0:y.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-o)<Math.abs(e-o)?t:e),f=ad(l)?window.innerHeight:window.innerWidth;if(r>.4&&Math.abs(e)<.4*f){const e=u?1:-1;if(e>0&&m&&i)return void E(y[i.length-1]);if(d&&e<0&&n&&t(),null===g)return;return void E(y[g+e])}E(h)},onDrag:function({draggedDistance:e}){if(null===b)return;const t="bottom"===l||"right"===l?b-e:b+e;("bottom"===l||"right"===l)&&t<y[y.length-1]||("top"===l||"left"===l)&&t>y[y.length-1]||sd(n.current,{transform:ad(l)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:y}}({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:Q,fadeFromIndex:f,overlayRef:U,onSnapPointChange:te,direction:w,container:I,snapToSequentialPoint:x});Jl({isDisabled:!C||N||!v||$||!O||!k||!T});const{restorePositionSetting:ce}=function({isOpen:e,modal:r,nested:i,hasBeenOpened:n,preventScrollRestoration:s,noBodyStyles:a}){const[o,l]=t.useState(()=>"undefined"!=typeof window?window.location.href:""),d=t.useRef(0),c=t.useCallback(()=>{if(zl()&&null===pd&&e&&!a){pd={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:-d.current+"px",left:-e+"px",right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const e=t-window.innerHeight;e&&d.current>=t&&(document.body.style.top=-(d.current+e)+"px")}),300)}},[e]),u=t.useCallback(()=>{if(zl()&&null!==pd&&!a){const e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,pd),window.requestAnimationFrame(()=>{s&&o!==window.location.href?l(window.location.href):window.scrollTo(t,e)}),pd=null}},[o]);return t.useEffect(()=>{function e(){d.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),t.useEffect(()=>{if(r)return()=>{"undefined"!=typeof document&&(document.querySelector("[data-vaul-drawer]")||u())}},[r,u]),t.useEffect(()=>{!i&&n&&(e?(!window.matchMedia("(display-mode: standalone)").matches&&c(),r||window.setTimeout(()=>{u()},500)):u())},[e,n,o,r,i,c,u]),{restorePositionSetting:u}}({isOpen:C,modal:v,nested:null!=b&&b,hasBeenOpened:O,preventScrollRestoration:A,noBodyStyles:E});function ue(){return(window.innerWidth-26)/window.innerWidth}function he(e,t){var r;let i=e;const n=null==(r=window.getSelection())?void 0:r.toString(),s=Q.current?od(Q.current,w):null,a=new Date;if("SELECT"===i.tagName)return!1;if(i.hasAttribute("data-vaul-no-drag")||i.closest("[data-vaul-no-drag]"))return!1;if("right"===w||"left"===w)return!0;if(z.current&&a.getTime()-z.current.getTime()<500)return!1;if(null!==s&&("bottom"===w?s>0:s<0))return!0;if(n&&n.length>0)return!1;if(H.current&&a.getTime()-H.current.getTime()<c&&0===s)return H.current=a,!1;if(t)return H.current=a,!1;for(;i;){if(i.scrollHeight>i.clientHeight){if(0!==i.scrollTop)return H.current=new Date,!1;if("dialog"===i.getAttribute("role"))return!0}i=i.parentNode}return!0}function fe(e){!function(){if(!N||!Q.current)return;Q.current.classList.remove(ud),V.current=!1,F(!1),j.current=new Date}(),null==y||y(),e||_(!1),setTimeout(()=>{a&&ne(a[0])},1e3*dd.DURATION)}function pe(){if(!Q.current)return;const e=document.querySelector("[data-vaul-drawer-wrapper]"),t=od(Q.current,w);sd(Q.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${dd.DURATION}s cubic-bezier(${dd.EASE.join(",")})`}),sd(U.current,{transition:`opacity ${dd.DURATION}s cubic-bezier(${dd.EASE.join(",")})`,opacity:"1"}),o&&t&&t>0&&C&&sd(e,{borderRadius:"8px",overflow:"hidden",...ad(w)?{transform:`scale(${ue()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ue()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${dd.DURATION}s`,transitionTimingFunction:`cubic-bezier(${dd.EASE.join(",")})`},!0)}return t.useEffect(()=>{window.requestAnimationFrame(()=>{q.current=!0})},[]),t.useEffect(()=>{var e;function t(){if(!Q.current||!k)return;if(rd(document.activeElement)||K.current){var e;const t=(null==(e=window.visualViewport)?void 0:e.height)||0,r=window.innerHeight;let i=r-t;const n=Q.current.getBoundingClientRect().height||0,s=n>.8*r;ee.current||(ee.current=n);const o=Q.current.getBoundingClientRect().top;if(Math.abs(X.current-i)>60&&(K.current=!K.current),a&&a.length>0&&ae&&ie){i+=ae[ie]||0}if(X.current=i,n>t||K.current){const e=Q.current.getBoundingClientRect().height;let r=e;e>t&&(r=t-(s?o:26)),Q.current.style.height=g?e-Math.max(i,0)+"px":`${Math.max(r,t-o)}px`}else(function(){const e=navigator.userAgent;return"undefined"!=typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))})()||(Q.current.style.height=`${ee.current}px`);a&&a.length>0&&!K.current?Q.current.style.bottom="0px":Q.current.style.bottom=`${Math.max(i,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[ie,a,ae]),t.useEffect(()=>(C&&(sd(document.documentElement,{scrollBehavior:"auto"}),z.current=new Date),()=>{!function(e,t){if(!(e&&e instanceof HTMLElement))return;let r=nd.get(e);r&&(e.style[t]=r[t])}(document.documentElement,"scrollBehavior")}),[C]),t.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),t.createElement(Dl,{defaultOpen:S,onOpenChange:e=>{(u||e)&&(e?M(!0):fe(!0),_(e))},open:C},t.createElement(Bl.Provider,{value:{activeSnapPoint:re,snapPoints:a,setActiveSnapPoint:ne,drawerRef:Q,overlayRef:U,onOpenChange:r,onPress:function(e){var t,r;(u||a)&&(Q.current&&!Q.current.contains(e.target)||(Z.current=(null==(t=Q.current)?void 0:t.getBoundingClientRect().height)||0,J.current=(null==(r=Q.current)?void 0:r.getBoundingClientRect().width)||0,F(!0),G.current=new Date,jl()&&window.addEventListener("touchend",()=>V.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),Y.current=ad(w)?e.pageY:e.pageX))},onRelease:function(e){if(!N||!Q.current)return;Q.current.classList.remove(ud),V.current=!1,F(!1),j.current=new Date;const t=od(Q.current,w);if(!e||!he(e.target,!1)||!t||Number.isNaN(t))return;if(null===G.current)return;const r=j.current.getTime()-G.current.getTime(),i=Y.current-(ad(w)?e.pageY:e.pageX),n=Math.abs(i)/r;if(n>.05&&(B(!0),setTimeout(()=>{B(!1)},200)),a){return se({draggedDistance:i*("bottom"===w||"right"===w?1:-1),closeDrawer:fe,velocity:n,dismissible:u}),void(null==s||s(e,!0))}if("bottom"===w||"right"===w?i>0:i<0)return pe(),void(null==s||s(e,!0));if(n>.4)return fe(),void(null==s||s(e,!1));var o;const l=Math.min(null!=(o=Q.current.getBoundingClientRect().height)?o:0,window.innerHeight);var c;const h=Math.min(null!=(c=Q.current.getBoundingClientRect().width)?c:0,window.innerWidth),f="left"===w||"right"===w;if(Math.abs(t)>=(f?h:l)*d)return fe(),void(null==s||s(e,!1));null==s||s(e,!0),pe()},onDrag:function(e){if(Q.current&&N){const t="bottom"===w||"right"===w?1:-1,r=(Y.current-(ad(w)?e.pageY:e.pageX))*t,i=r>0,s=a&&!u&&!i;if(s&&0===ie)return;const l=Math.abs(r),d=document.querySelector("[data-vaul-drawer-wrapper]");let c=l/("bottom"===w||"top"===w?Z.current:J.current);const h=de(l,i);if(null!==h&&(c=h),s&&c>=1)return;if(!V.current&&!he(e.target,i))return;if(Q.current.classList.add(ud),V.current=!0,sd(Q.current,{transition:"none"}),sd(U.current,{transition:"none"}),a&&oe({draggedDistance:r}),i&&!a){const e=function(e){return 8*(Math.log(e+1)-2)}(r),i=Math.min(-1*e,0)*t;return void sd(Q.current,{transform:ad(w)?`translate3d(0, ${i}px, 0)`:`translate3d(${i}px, 0, 0)`})}const p=1-c;if((le||f&&ie===f-1)&&(null==n||n(e,c),sd(U.current,{opacity:`${p}`,transition:"none"},!0)),d&&U.current&&o){const e=Math.min(ue()+c*(1-ue()),1),t=8-8*c,r=Math.max(0,14-14*c);sd(d,{borderRadius:`${t}px`,transform:ad(w)?`scale(${e}) translate3d(0, ${r}px, 0)`:`scale(${e}) translate3d(${r}px, 0, 0)`,transition:"none"},!0)}if(!a){const e=l*t;sd(Q.current,{transform:ad(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:u,shouldAnimate:q,handleOnly:h,isOpen:C,isDragging:N,shouldFade:le,closeDrawer:fe,onNestedDrag:function(e,t){if(t<0)return;const r=(window.innerWidth-cd)/window.innerWidth,i=r+t*(1-r),n=t*cd-16;sd(Q.current,{transform:ad(w)?`scale(${i}) translate3d(0, ${n}px, 0)`:`scale(${i}) translate3d(${n}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){const t=e?(window.innerWidth-cd)/window.innerWidth:1,r=e?-16:0;W.current&&window.clearTimeout(W.current),sd(Q.current,{transition:`transform ${dd.DURATION}s cubic-bezier(${dd.EASE.join(",")})`,transform:ad(w)?`scale(${t}) translate3d(0, ${r}px, 0)`:`scale(${t}) translate3d(${r}px, 0, 0)`}),!e&&Q.current&&(W.current=setTimeout(()=>{const e=od(Q.current,w);sd(Q.current,{transition:"none",transform:ad(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){const r=ad(w)?window.innerHeight:window.innerWidth,i=t?(r-cd)/r:1,n=t?-16:0;t&&sd(Q.current,{transition:`transform ${dd.DURATION}s cubic-bezier(${dd.EASE.join(",")})`,transform:ad(w)?`scale(${i}) translate3d(0, ${n}px, 0)`:`scale(${i}) translate3d(${n}px, 0, 0)`})},keyboardIsOpen:K,modal:v,snapPointsOffset:ae,activeSnapPointIndex:ie,direction:w,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:E,container:I,autoFocus:R}},i))}const gd=t.forwardRef(function({...e},r){const{overlayRef:i,snapPoints:n,onRelease:s,shouldFade:a,isOpen:o,modal:l,shouldAnimate:d}=Ul(),c=id(r,i),u=n&&n.length>0;if(!l)return null;const h=t.useCallback(e=>s(e),[s]);return t.createElement(Ol,{onMouseUp:h,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":o&&u?"true":"false","data-vaul-snap-points-overlay":o&&a?"true":"false","data-vaul-animate":(null==d?void 0:d.current)?"true":"false",...e})});gd.displayName="Drawer.Overlay";const vd=t.forwardRef(function({onPointerDownOutside:e,style:r,onOpenAutoFocus:i,...n},s){const{drawerRef:a,onPress:o,onRelease:l,onDrag:d,keyboardIsOpen:c,snapPointsOffset:h,activeSnapPointIndex:f,modal:p,isOpen:m,direction:g,snapPoints:v,container:y,handleOnly:b,shouldAnimate:E,autoFocus:w}=Ul(),[S,T]=t.useState(!1),x=id(s,a),A=t.useRef(null),k=t.useRef(null),L=t.useRef(!1),I=v&&v.length>0;!function(){const{direction:e,isOpen:r,shouldScaleBackground:i,setBackgroundColorOnScale:n,noBodyStyles:s}=Ul(),a=t.useRef(null),o=u(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-26)/window.innerWidth}t.useEffect(()=>{if(r&&i){a.current&&clearTimeout(a.current);const t=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!t)return;n&&!s&&ld(document.body,{background:"black"}),ld(t,{transformOrigin:ad(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${dd.DURATION}s`,transitionTimingFunction:`cubic-bezier(${dd.EASE.join(",")})`});const r=ld(t,{borderRadius:"8px",overflow:"hidden",...ad(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{r(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},1e3*dd.DURATION)}}},[r,i,o])}();function R(e){A.current=null,L.current=!1,l(e)}return t.useEffect(()=>{I&&window.requestAnimationFrame(()=>{T(!0)})},[]),t.createElement(Ml,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":S?"true":"false","data-vaul-snap-points":m&&I?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":(null==E?void 0:E.current)?"true":"false",...n,ref:x,style:h&&h.length>0?{"--snap-point-height":`${h[null!=f?f:0]}px`,...r}:r,onPointerDown:e=>{b||(null==n.onPointerDown||n.onPointerDown.call(n,e),A.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{null==i||i(e),w||e.preventDefault()},onPointerDownOutside:t=>{null==e||e(t),p&&!t.defaultPrevented?c.current&&(c.current=!1):t.preventDefault()},onFocusOutside:e=>{p||e.preventDefault()},onPointerMove:e=>{if(k.current=e,b)return;if(null==n.onPointerMove||n.onPointerMove.call(n,e),!A.current)return;const t=e.pageY-A.current.y,r=e.pageX-A.current.x,i="touch"===e.pointerType?10:2,s=((e,t,r=0)=>{if(L.current)return!0;const i=Math.abs(e.y),n=Math.abs(e.x),s=n>i,a=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*a<0)&&n>=0&&n<=r)return s}else if(!(e.y*a<0)&&i>=0&&i<=r)return!s;return L.current=!0,!0})({x:r,y:t},g,i);s?d(e):(Math.abs(r)>i||Math.abs(t)>i)&&(A.current=null)},onPointerUp:e=>{null==n.onPointerUp||n.onPointerUp.call(n,e),A.current=null,L.current=!1,l(e)},onPointerOut:e=>{null==n.onPointerOut||n.onPointerOut.call(n,e),R(k.current)},onContextMenu:e=>{null==n.onContextMenu||n.onContextMenu.call(n,e),k.current&&R(k.current)}})});vd.displayName="Drawer.Content";const yd=t.forwardRef(function({preventCycle:e=!1,children:r,...i},n){const{closeDrawer:s,isDragging:a,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:d,dismissible:c,handleOnly:u,isOpen:h,onPress:f,onDrag:p}=Ul(),m=t.useRef(null),g=t.useRef(!1);function v(){m.current&&window.clearTimeout(m.current),g.current=!1}return t.createElement("div",{onClick:function(){g.current?v():window.setTimeout(()=>{!function(){if(a||e||g.current)return void v();if(v(),!o||0===o.length)return void(c||s());if(l===o[o.length-1]&&c)return void s();const t=o.findIndex(e=>e===l);if(-1===t)return;const r=o[t+1];d(r)}()},120)},onPointerCancel:v,onPointerDown:e=>{u&&f(e),m.current=window.setTimeout(()=>{g.current=!0},250)},onPointerMove:e=>{u&&p(e)},ref:n,"data-vaul-drawer-visible":h?"true":"false","data-vaul-handle":"","aria-hidden":"true",...i},t.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},r))});yd.displayName="Drawer.Handle";const bd={Root:md,NestedRoot:function({onDrag:e,onOpenChange:r,open:i,...n}){const{onNestedDrag:s,onNestedOpenChange:a,onNestedRelease:o}=Ul();if(!s)throw new Error("Drawer.NestedRoot must be placed in another drawer");return t.createElement(md,{nested:!0,open:i,onClose:()=>{a(!1)},onDrag:(t,r)=>{s(t,r),null==e||e(t,r)},onOpenChange:e=>{e&&a(e),null==r||r(e)},onRelease:o,...n})},Content:vd,Overlay:gd,Trigger:Cl,Portal:function(e){const r=Ul(),{container:i=r.container,...n}=e;return t.createElement(_l,{container:i,...n})},Handle:yd,Close:$l,Title:Nl,Description:Fl};function Ed(t){var r=T(t,[]);return e.createElement(bd.Root,Object.assign({"data-slot":"drawer"},r))}function wd(t){var r=T(t,[]);return e.createElement(bd.Trigger,Object.assign({"data-slot":"drawer-trigger"},r))}function Sd(t){var r=T(t,[]);return e.createElement(bd.Portal,Object.assign({"data-slot":"drawer-portal"},r))}function Td(t){var{className:r}=t,i=T(t,["className"]);return e.createElement(bd.Overlay,Object.assign({"data-slot":"drawer-overlay",className:wt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[999999] bg-black/50",r)},i))}function xd(t){var{className:r,children:i}=t,n=T(t,["className","children"]);return e.createElement(Sd,{"data-slot":"drawer-portal"},e.createElement(Td,null),e.createElement(bd.Content,Object.assign({"data-slot":"drawer-content",className:wt("group/drawer-content bg-background fixed z-[999999] flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",r)},n),e.createElement("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),i))}function Ad(t){var{className:r}=t,i=T(t,["className"]);return e.createElement("div",Object.assign({"data-slot":"drawer-header",className:wt("flex flex-col gap-1.5 p-4",r)},i))}function kd(t){var{className:r}=t,i=T(t,["className"]);return e.createElement(bd.Title,Object.assign({"data-slot":"drawer-title",className:wt("text-foreground font-semibold",r)},i))}const Ld=({children:e,products:r,contentId:i})=>{const{isPreview:n}=Js();return t.createElement(Ed,{direction:"right",fadeFromIndex:0,snapPoints:[1]},t.createElement(wd,{className:"w-full"},e),t.createElement(xd,null,t.createElement(Ad,null,t.createElement(kd,null,"상품 목록")),t.createElement("div",{className:"overflow-y-scroll grid-cols-2 grid items-baseline justify-items-center scrollbar-hide"},r.map(e=>e.linkPath?t.createElement("a",{key:e.productId,className:"p-2 text-gray-800 w-full h-full flex flex-col items-center justify-center no-underline",href:e.linkPath,target:"_blank",onClick:()=>x(void 0,void 0,void 0,function*(){n||(yield zs({contentId:i,contentProductId:e.eventProductId,productId:e.productId}))})},t.createElement(Id,{product:e})):t.createElement(Id,{key:e.productId,product:e})))))},Id=({product:e})=>t.createElement("div",{className:"text-gray-800 w-32"},t.createElement("div",{className:"w-full aspect-square mb-2 border border-[#f4f3f6] rounded "},t.createElement("img",{src:e.thumbPath,alt:e.productName,className:"w-full h-full"})),e.brand&&t.createElement("p",{className:"text-xs text-gray-400 mb-1"},e.brand.brandName),t.createElement("p",{className:"w-full text-[12px] md:text-[15px] mb-1"},e.productName),t.createElement("div",{className:"w-full "},t.createElement("div",{className:"flex"},t.createElement("span",{className:"text-sm text-red-500 mr-2 font-semibold"},e.discount,"%"),t.createElement("span",{className:"font-semibold"},St(e.sellingPrice),"원")))),Rd=({products:e,useDrawer:r,contentId:i})=>{const n=u(()=>(e=>{if(e.length>=3)return e;const t=[...e];for(;t.length<3;)t.push(...e);return t})(e),[e]),s=1===(null==e?void 0:e.length);return(null==e?void 0:e.length)?t.createElement("div",{className:"w-full",style:{height:"80px"}},s?t.createElement("div",{className:"bg-white overflow-hidden rounded-xl w-full",style:{borderRadius:"10px",height:"80px"}},r?t.createElement(Ld,{products:e,contentId:i},t.createElement(va,{product:e[0],productsLength:e.length,contentId:i})):t.createElement(va,{product:e[0],productsLength:e.length,hideMoreBtn:!0,contentId:i})):t.createElement(ls,{nested:!0,modules:[Ts,hs],slidesPerView:1.1,effect:"cards",autoplay:!0,loop:!0,grabCursor:!0,cardsEffect:{rotate:!1},className:"w-full",style:{height:"80px"}},n.map((n,s)=>t.createElement(ds,{key:s+n.productId,className:"bg-white overflow-hidden rounded-xl",style:{borderRadius:"10px",height:"80px"}},r?t.createElement(Ld,{products:e,contentId:i},t.createElement(va,{product:n,productsLength:e.length,contentId:i})):t.createElement(va,{product:n,productsLength:e.length,hideMoreBtn:!0,contentId:i}))))):null},Pd=({shortForm:e,useDrawer:r,isPopup:i,shareUrl:n,handleClose:s})=>{const[o,l]=a(!Boolean(i)),[d,c]=a(!0),{logo:u,productsInfo:h,thumbPath:f,title:p,media:m,brand:g,shortsId:v}=e;return t.createElement("div",{className:"h-full w-full text-sm overflow-hidden text-white relative"},t.createElement("div",{style:{backgroundImage:"linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 50%, rgba(0,0,0,0.4) 100%)",padding:"15px"},className:"absolute h-full flex flex-col w-full z-[1] justify-between inset-0 bg-gradient-to-b from-black/40 via-transparent to-black/40"},t.createElement("div",{className:"flex gap-2 justify-between "},t.createElement("div",{className:"max-w-16"},(null==u?void 0:u.thumbPath)?t.createElement("img",{className:"mb-1",src:u.thumbPath,alt:u.logoName,width:100,height:100}):null),t.createElement("div",{className:"justify-self-end flex gap-2"},t.createElement("div",{className:"cursor-pointer text-white ",onClick:()=>{c(e=>!e)}},d?t.createElement(Vt,{size:20}):t.createElement(Wt,{size:20})),t.createElement("div",{className:"cursor-pointer text-white ",onClick:()=>{l(e=>!e)}},o?t.createElement(qt,{size:20}):t.createElement(Kt,{size:20})),t.createElement("div",{className:"cursor-pointer text-white ",onClick:s},t.createElement(Xt,{size:20})))),t.createElement("div",null,t.createElement("div",{className:"flex justify-between items-end mb-3 gap-3"},t.createElement("div",{className:"w-full"},g&&t.createElement("div",{className:"items-center flex gap-3 mb-2"},t.createElement("div",{className:"w-12 h-12 bg-white rounded-full border overflow-hidden"},t.createElement("img",{src:g.thumbPath,alt:g.brandName,width:100,height:100,className:"object-contain w-full h-full"})),t.createElement("p",{style:{fontSize:"14px",textAlign:"start"}},null==g?void 0:g.brandName)),t.createElement("p",{style:{fontSize:"14px",textAlign:"start"}},p)),t.createElement("div",{className:"flex flex-col items-center",style:{gap:"15px"}},t.createElement(oa,{shortsId:v}),t.createElement("div",{className:"w-[24px] h-[24px] flex items-center justify-center"},t.createElement(ga,{shortForm:e,shareUrl:n})))),h&&t.createElement(Rd,{products:h,useDrawer:r,contentId:e.shortsId}))),t.createElement(L,{file:Tt(null==m?void 0:m.objectId),thumbnail:`${Rt(f)}`,mute:o,isVertical:(null==m?void 0:m.height)>(null==m?void 0:m.width),play:d}))},Dd=({collection:e,playerSettings:r})=>{const[i,n]=a(e.contents[0]);return t.createElement("div",{className:"w-full h-full aspect-[9/16]"},t.createElement(ls,{modules:[cs,bs],loop:!0,mousewheel:!0,direction:"vertical",touchEventsTarget:"container",slidesPerView:1,onSlideChangeTransitionEnd:t=>{const r=e.contents[t.realIndex];n(Object.assign({},r))},className:"h-full"},e.contents.map(e=>t.createElement(ds,{key:e.shortsId,className:"rounded-xl overflow-hidden"},i.shortsId===e.shortsId&&t.createElement("div",{className:"h-full rounded-xl absolute z-[999] w-full"},t.createElement(Pd,{shortForm:i,isPopup:!0})),t.createElement("img",{src:Rt(e.thumbPath),alt:e.title,className:"rounded-xl w-full h-full bg-black "+(e.media.width>e.media.height?"object-contain":"object-cover")})))))},Cd=e=>{const{isMobile:r}=e,[i,n]=a("collection"in e?e.collection.contents[0]:null);if(r){if("shortform"in e)return t.createElement(Pd,{shortForm:e.shortform});if(e.collection)return t.createElement(Dd,{collection:e.collection,playerSettings:e.collection.player.shoppingPlayer})}if("shortform"in e){const{layout:r}=e.shortform.player,i=e.shortform.player.shoppingPlayer;switch(r){case _t.PLATFORM:return t.createElement(Gi,{shortform:e.shortform,playerSettings:i,player:t.createElement("div",{className:"aspect-[9/16] h-full rounded-xl border overflow-hidden"},t.createElement(L,{file:Tt(e.shortform.media.objectId)}))});case _t.HORIZONTAL:return t.createElement(ks,{shortform:e.shortform,playerSettings:i,player:t.createElement(L,{file:Tt(e.shortform.media.objectId)})});case _t.VERTICAL:return t.createElement(Is,{shortform:e.shortform,playerSettings:i,player:t.createElement("div",{className:"aspect-[9/16] h-full"},t.createElement(L,{file:Tt(e.shortform.media.objectId)}))});case _t.GRID:return t.createElement(Ps,{shortform:e.shortform,playerSettings:i,player:t.createElement(L,{file:Tt(e.shortform.media.objectId)})})}}else{if(!e.collection||!i)return null;{const{layout:r}=e.collection.player,s=e.collection.player.shoppingPlayer;switch(r){case _t.PLATFORM:return t.createElement(Gi,{shortform:i,playerSettings:s,player:t.createElement("div",{className:"w-full flex items-center justify-center gap-4",style:{height:"calc(-220px + 100vh)"}},t.createElement(na,{collection:e.collection,playerSettings:s,shortform:i,setShortform:n}))});case _t.HORIZONTAL:return t.createElement(ks,{shortform:i,playerSettings:Object.assign({},s),player:t.createElement("div",{className:"h-full aspect-[9/16]"},t.createElement(sa,{collection:e.collection,playerSettings:s,shortform:i,setShortform:n}))});case _t.VERTICAL:return t.createElement(Is,{playerSettings:Object.assign({},s),shortform:i,player:t.createElement(sa,{collection:e.collection,playerSettings:s,shortform:i,setShortform:n})});case _t.GRID:return t.createElement(Ps,{shortform:i,playerSettings:Object.assign({},s),player:t.createElement(sa,{collection:e.collection,playerSettings:s,shortform:i,setShortform:n})})}}}},_d=e=>t.createElement(Pd,Object.assign({},e));function Od(){const[e,t]=a({width:window.innerWidth,height:window.innerHeight});return i(()=>{const e=()=>t({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}const Md=t.memo(({shortform:e,shareUrl:r,handleClose:i})=>t.createElement(t.Fragment,null,t.createElement("div",{onClick:e=>e.stopPropagation(),className:"overflow-hidden",style:{borderRadius:"10px",overflow:"hidden",width:"100%",height:"100%",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",backgroundImage:`url(${Rt(e.thumbPath)})`}},t.createElement(Pd,{handleClose:i,shortForm:e,useDrawer:!1,isPopup:!0,shareUrl:r})))),Nd=t.memo(({shortform:e})=>t.createElement("div",{onClick:e=>{e.stopPropagation()},style:{width:"100%",height:"100%",borderRadius:"10px",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",backgroundImage:`url(${e.thumbPath.includes("https")?e.thumbPath:`https://${e.thumbPath}`})`}})),Fd=({shortform:e,shareUrl:r,handleClose:i})=>{const{isActive:n}=d(as),s=d(os),a=Od().width<430||pa.isMobile;return t.createElement("div",{className:"flex items-center justify-center w-full h-full select-none",onClick:e=>{i()}},t.createElement("div",{className:"max-h-full flex items-center justify-center",style:{width:"100%",aspectRatio:a?"auto":"9 / 16",height:a?"100dvh":"auto",maxHeight:a?void 0:"90vh",transform:a?void 0:`scale(${n?1:.8})`,transition:"transform 180ms ease"}},n?t.createElement("div",{className:"flex items-center justify-between w-full h-full text-white relative"},t.createElement("div",{className:"cursor-pointer absolute",onClick:e=>{e.stopPropagation(),s.slidePrev()},style:{zIndex:1e5,left:a?"0":"-30px",top:"50%",transform:"translateY(-50%)",width:30,height:30,display:"grid",placeItems:"center",pointerEvents:"auto"}},t.createElement(zt,{size:28})),t.createElement(Md,{shortform:e,shareUrl:r,handleClose:i}),t.createElement("div",{className:"cursor-pointer absolute",style:{zIndex:1e5,right:a?"0":"-30px",top:"50%",transform:"translateY(-50%)",width:30,height:30,display:"grid",placeItems:"center",pointerEvents:"auto"},onClick:e=>{e.stopPropagation(),s.slideNext()}},t.createElement(Gt,{size:28}))):t.createElement(Nd,{shortform:e})))},{PLAYER_BACK_BASE_URL:$d}=gt(),Bd=({collection:e,initialShortsId:i,onSlideChange:n,onClosePlayer:s})=>{var a;const o=u(()=>Math.max(e.contents.findIndex(e=>e.shortsId===i),0),[e.contents,i]),l=e.contents.length,d=Math.max(l,10),c=null!==(a=Od().width)&&void 0!==a?a:0,h=c<430||pa.isMobile,f=h?1:c>=1200?4:c>=900?3:2,p=u(()=>(e=>{const t=[...e];for(;t.length<d;)t.push(...e);return t})(e.contents),[e.contents]),m=r(null);return t.createElement("div",{style:{minHeight:100,minWidth:300},className:"w-full"},t.createElement(ls,{style:{minHeight:100,overflow:"visible"},initialSlide:o,ref:m,lazyPreloadPrevNext:2,className:"w-full",spaceBetween:h?8:c>=1200?24:c>=900?25:16,slidesPerView:f,grabCursor:!0,centeredSlides:1!==f,onSlideChangeTransitionEnd:t=>{const r=t.realIndex%l;null==n||n(r);const i=e.contents[(r+1)%l];var s;s=Tt(i.media.objectId),A||(A=document.createElement("video"),A.muted=!0,A.playsInline=!0,A.preload="metadata",A.loop=!0,A.style.cssText="position:fixed;left:-9999px;top:-9999px;width:1px;height:1px;opacity:0",document.body.appendChild(A)),k!==s&&(A.src=s,A.load(),k=s)},loop:!0,slideToClickedSlide:!0},p.map((r,i)=>t.createElement(ds,{key:i},t.createElement(Fd,{handleClose:s,shortform:r,shareUrl:`${$d}/collection/${e.colId}?start=${r.shortsId}&layout=5`})))))},Ud=({shortform:e,onThumbnailClick:r,iconSize:i,exposeTitle:n,borderLine:s})=>{const a=u(()=>It(s),[s])?{background:"linear-gradient(#fff,#fff) padding-box, conic-gradient(#f58529,#f77737,#fd1d1d,#833ab4,#c13584,#f58529) border-box",border:"3px solid transparent"}:{background:"#fff",border:"3px solid #fff"};return t.createElement("div",{className:"flex flex-col w-full gap-2",onClick:()=>r(e.shortsId)},t.createElement("div",{className:"rounded-full overflow-hidden cursor-pointer",style:Object.assign({width:i,height:i,padding:4},a)},t.createElement("img",{src:Rt(e.thumbPath),alt:"thumbnail",className:"w-full h-full object-cover block rounded-full"})),n&&t.createElement("span",{style:{width:i},className:"text-black overflow-hidden text-[12px] whitespace-nowrap text-center text-clip cursor-default"},e.title))},zd=Zs(e=>({open:!1,setOpen:t=>e({open:t})})),Gd=({product:e,productLength:r,hideMoreBadge:i=!1,contentId:n,lineClamp:s,showMoreBtn:a=!1,openProductPopup:o})=>{const{isPreview:l}=Js();return t.createElement(t.Fragment,null,t.createElement("div",{className:"product-banner border mbus-border",onClick:()=>x(void 0,void 0,void 0,function*(){i&&(window.open(e.linkPath,"_blank"),l||(yield zs({contentProductId:e.eventProductId,contentId:n,productId:e.productId})))})},t.createElement("span",{className:"product-banner__clip","aria-hidden":!0},t.createElement("span",{className:"product-banner__sheen"})),t.createElement("div",{className:"relative",style:{width:"40%",minWidth:"40%"}},t.createElement("img",{style:{borderRadius:"0.625rem"},className:"aspect-square rounded-lg object-cover w-full",src:Rt(e.thumbPath),alt:e.productName}),!i&&t.createElement("p",{className:"absolute text-white rounded-lg",style:{backgroundColor:"#797979",top:-10,right:-10,padding:"2px 4px",fontSize:"10px",borderRadius:"0.625rem"}},"+",r)),t.createElement("div",{style:{position:"relative",zIndex:2,minWidth:0,flex:1,paddingRight:24}},t.createElement("p",{style:{display:"-webkit-box",WebkitLineClamp:s||2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word",fontWeight:600,color:"#494949"}},e.productName)),t.createElement("span",{className:"product-banner__arrow","aria-hidden":!0},"›")),a&&r>1&&t.createElement("div",{onClick:o,className:" flex items-center justify-center border mbus-border cursor-pointer",style:{borderRadius:"0.625rem",padding:"10px",backgroundColor:"#f5f5f5",fontWeight:600}},"+ 더보기 (",r,")"))},jd=({products:e,iconSize:r,contentId:i,setSelectedProducts:n,showMoreBtn:s,hideMoreBadge:a})=>{const{setOpen:o}=zd(),l=()=>{n({productsInfo:e,shortsId:i}),o(!0)};return t.createElement(t.Fragment,null,t.createElement("div",{onClick:()=>x(void 0,void 0,void 0,function*(){1===e.length||s||l()}),className:"flex flex-col gap-2 mt-4 text-gray-800",style:{maxWidth:r||"100%",fontSize:13}},t.createElement(Gd,{showMoreBtn:s,lineClamp:2,product:e[0],contentId:i,productLength:e.length,hideMoreBadge:null!=a?a:1===e.length,openProductPopup:l})))},Hd=({product:e,maxWidth:r="100%",height:i,cardWidth:n})=>t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,borderRadius:8,backgroundColor:"#ffffff",color:"#111827",maxWidth:r,height:i,width:"100%",paddingRight:8}},t.createElement("img",{src:Rt(e.thumbPath),alt:e.productName,style:{height:"100%",aspectRatio:"1 / 1",borderRadius:6,objectFit:"cover",flexShrink:0}}),t.createElement("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center"}},t.createElement("span",{style:{lineHeight:1.25,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:12}},e.productName),t.createElement("span",{style:{lineHeight:1.25,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:11}},"number"==typeof e.sellingPrice&&e.sellingPrice<e.price?"number"==typeof n&&n>=190?t.createElement(t.Fragment,null,t.createElement("span",{style:{color:"#dc2626",fontWeight:600,marginRight:4}},St(e.sellingPrice),"원"),t.createElement("span",{style:{color:"#9ca3af",textDecoration:"line-through"}},St(e.price),"원")):t.createElement("span",{style:{color:"#dc2626",fontWeight:600}},St(e.sellingPrice),"원"):t.createElement("span",{style:{color:"#dc2626",fontWeight:600}},St(e.price),"원")))),Vd=({playUrl:e,poster:r})=>t.createElement("div",{className:"w-full h-full absolute top-0 left-0 z-10 pointer-events-none",style:{backgroundImage:`url(${r})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}},t.createElement("video",{src:e,autoPlay:!0,muted:!0,preload:"auto",playsInline:!0,loop:!0,className:"w-full h-full object-cover"})),Wd=({shortform:e,onThumbnailClick:r,iconSize:i,exposeTitle:n,rounded:s,borderLine:o,titlePosition:l,exposeProductBanner:d,setSelectedProducts:c,iconRatio:h,hoverPlay:f,exposeProductBadge:p})=>{var m;const g=u(()=>It(o),[o]),[v,y]=a(!1),{API_BASE_URL:b}=gt();return t.createElement("div",{className:"relative"},t.createElement("div",{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),onClick:()=>r(e.shortsId),style:Object.assign({width:i,aspectRatio:h},s&&{borderRadius:"10px"}),className:`cursor-pointer p-[3px] ${s&&"rounded-xl"} ${g&&"bg-insta"} relative overflow-hidden`},v&&f&&t.createElement(Vd,{playUrl:`${b}/direct/${e.media.objectId}`,poster:Rt(e.thumbPath)}),t.createElement("img",{style:Object.assign({},s&&{borderRadius:"10px"}),src:Rt(e.thumbPath),alt:"thumbnail",className:`w-full h-full object-cover ${s&&"rounded-xl"}`}),p&&(null===(m=e.productsInfo)||void 0===m?void 0:m.length)>0&&!(f&&v)&&t.createElement("div",{className:"absolute pointer-events-none flex items-center justify-center z-20",style:{left:2,right:2,bottom:10,height:"20%"}},t.createElement("div",{className:"h-full inline-block",style:{width:"95%"}},t.createElement(Hd,{product:e.productsInfo[0],maxWidth:"100%",height:"100%",cardWidth:i})))),n&&!(f&&v&&l===Be.INNER)&&t.createElement("p",{style:Object.assign({width:i,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},l===Be.INNER&&p?{bottom:"22%"}:{}),className:`my-2 ${l===Be.INNER?"absolute bottom-0 left-0 text-white px-2 z-10":""} text-[12px] cursor-default truncate`},e.title),d&&t.createElement(jd,{setSelectedProducts:c,products:e.productsInfo,iconSize:i,contentId:e.shortsId}))},Yd=e=>{const{iconShape:r,collection:i}=e;return r===Ne.MANY?t.createElement(Kd,Object.assign({},e)):t.createElement(qd,Object.assign({},e,{shortform:i.contents[0]}))},Kd=e=>{const{collection:r}=e,{thumbnailAutoPlay:i}=e,{setCollection:n,nextKey:s,setNextKey:a,isFetching:o,setIsFetching:l}=ra();return t.createElement(ls,{freeMode:!0,slidesPerView:"auto",spaceBetween:12,onReachEnd:()=>x(void 0,void 0,void 0,function*(){var e,t,i;if(r&&!(o||(null!==(e=r.count)&&void 0!==e?e:Number.MAX_SAFE_INTEGER)<=r.contents.length)){l(!0);try{const e=yield Hs({collectionId:r.colId,nextKey:s});if(!e||!(null===(t=e.contents)||void 0===t?void 0:t.length))return;a((null===(i=e.contents.at(-1))||void 0===i?void 0:i.shortsId)||"");const o=new Set(r.contents.map(e=>e.shortsId)),l=e.contents.filter(e=>!o.has(e.shortsId));if(!l.length)return;n(Object.assign(Object.assign({},r),{contents:[...r.contents,...l]}))}catch(e){console.error(e)}finally{l(!1)}}}),modules:i?[hs]:[],autoplay:!!i&&{delay:3e3,disableOnInteraction:!1,pauseOnMouseEnter:!0},loop:i||void 0},null==r?void 0:r.contents.map(r=>t.createElement(ds,{key:r.shortsId,className:"!w-auto"},t.createElement(qd,Object.assign({},e,{shortform:r})))))},qd=e=>{const{iconForm:r}=e;return r===Me.INSTA?t.createElement(Ud,Object.assign({},e)):t.createElement(Wd,Object.assign({},e))};function Xd(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),!1===r||!i.defaultPrevented)return t?.(i)}}function Qd(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Zd(...e){return t=>{let r=!1;const i=e.map(e=>{const i=Qd(e,t);return r||"function"!=typeof i||(r=!0),i});if(r)return()=>{for(let t=0;t<i.length;t++){const r=i[t];"function"==typeof r?r():Qd(e[t],null)}}}}function Jd(...t){return e.useCallback(Zd(...t),t)}function ec(...t){const r=t[0];if(1===t.length)return r;const i=()=>{const i=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const n=i.reduce((e,{useScope:r,scopeName:i})=>({...e,...r(t)[`__scope${i}`]}),{});return e.useMemo(()=>({[`__scope${r.scopeName}`]:n}),[n])}};return i.scopeName=r.scopeName,i}var tc=globalThis?.document?e.useLayoutEffect:()=>{},rc=e[" useId ".trim().toString()]||(()=>{}),ic=0;function nc(t){const[r,i]=e.useState(rc());return tc(()=>{t||i(e=>e??String(ic++))},[t]),t||(r?`radix-${r}`:"")}var sc=e[" useInsertionEffect ".trim().toString()]||tc;function ac({prop:t,defaultProp:r,onChange:i=()=>{},caller:n}){const[s,a,o]=function({defaultProp:t,onChange:r}){const[i,n]=e.useState(t),s=e.useRef(i),a=e.useRef(r);return sc(()=>{a.current=r},[r]),e.useEffect(()=>{s.current!==i&&(a.current?.(i),s.current=i)},[i,s]),[i,n,a]}({defaultProp:r,onChange:i}),l=void 0!==t,d=l?t:s;{const r=e.useRef(void 0!==t);e.useEffect(()=>{const e=r.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}r.current=l},[l,n])}const c=e.useCallback(e=>{if(l){const r=function(e){return"function"==typeof e}(e)?e(t):e;r!==t&&o.current?.(r)}else a(e)},[l,t,a,o]);return[d,c]}function oc(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),!1===r||!i.defaultPrevented)return t?.(i)}}function lc(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function dc(...e){return t=>{let r=!1;const i=e.map(e=>{const i=lc(e,t);return r||"function"!=typeof i||(r=!0),i});if(r)return()=>{for(let t=0;t<i.length;t++){const r=i[t];"function"==typeof r?r():lc(e[t],null)}}}}function cc(...t){return e.useCallback(dc(...t),t)}function uc(t){const r=e.forwardRef((t,r)=>{const{children:i,...n}=t;if(e.isValidElement(i)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i),s=function(e,t){const r={...t};for(const i in t){const n=e[i],s=t[i];/^on[A-Z]/.test(i)?n&&s?r[i]=(...e)=>{const t=s(...e);return n(...e),t}:n&&(r[i]=n):"style"===i?r[i]={...n,...s}:"className"===i&&(r[i]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}(n,i.props);return i.type!==e.Fragment&&(s.ref=r?dc(r,t):t),e.cloneElement(i,s)}return e.Children.count(i)>1?e.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}var hc=Symbol("radix.slottable");function fc(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===hc}var pc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const i=function(t){const r=uc(t),i=e.forwardRef((t,i)=>{const{children:n,...s}=t,a=e.Children.toArray(n),o=a.find(fc);if(o){const t=o.props.children,n=a.map(r=>r===o?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r);return p(r,{...s,ref:i,children:e.isValidElement(t)?e.cloneElement(t,void 0,n):null})}return p(r,{...s,ref:i,children:n})});return i.displayName=`${t}.Slot`,i}(`Primitive.${r}`),n=e.forwardRef((e,t)=>{const{asChild:n,...s}=e,a=n?i:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),p(a,{...s,ref:t})});return n.displayName=`Primitive.${r}`,{...t,[r]:n}},{});var mc,gc="dismissableLayer.update",vc="dismissableLayer.pointerDownOutside",yc="dismissableLayer.focusOutside",bc=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ec=e.forwardRef((t,r)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...d}=t,c=e.useContext(bc),[u,h]=e.useState(null),f=u?.ownerDocument??globalThis?.document,[,m]=e.useState({}),g=cc(r,e=>h(e)),v=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),E=u?v.indexOf(u):-1,w=c.layersWithOutsidePointerEventsDisabled.size>0,S=E>=b,T=function(t,r=globalThis?.document){const i=Oa(t),n=e.useRef(!1),s=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let t=function(){Sc(vc,i,n,{discrete:!0})};const n={originalEvent:e};"touch"===e.pointerType?(r.removeEventListener("click",s.current),s.current=t,r.addEventListener("click",s.current,{once:!0})):t()}else r.removeEventListener("click",s.current);n.current=!1},t=window.setTimeout(()=>{r.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),r.removeEventListener("pointerdown",e),r.removeEventListener("click",s.current)}},[r,i]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...c.branches].some(e=>e.contains(t));S&&!r&&(s?.(e),o?.(e),e.defaultPrevented||l?.())},f),x=function(t,r=globalThis?.document){const i=Oa(t),n=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!n.current){Sc(yc,i,{originalEvent:e},{discrete:!1})}};return r.addEventListener("focusin",e),()=>r.removeEventListener("focusin",e)},[r,i]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...c.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||l?.())},f);return Ma(e=>{E===c.layers.size-1&&(n?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},f),e.useEffect(()=>{if(u)return i&&(0===c.layersWithOutsidePointerEventsDisabled.size&&(mc=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),wc(),()=>{i&&1===c.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=mc)}},[u,f,i,c]),e.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),wc())},[u,c]),e.useEffect(()=>{const e=()=>m({});return document.addEventListener(gc,e),()=>document.removeEventListener(gc,e)},[]),p(pc.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:oc(t.onFocusCapture,x.onFocusCapture),onBlurCapture:oc(t.onBlurCapture,x.onBlurCapture),onPointerDownCapture:oc(t.onPointerDownCapture,T.onPointerDownCapture)})});Ec.displayName="DismissableLayer";function wc(){const e=new CustomEvent(gc);document.dispatchEvent(e)}function Sc(e,t,r,{discrete:i}){const n=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),i?function(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}(n,s):n.dispatchEvent(s)}e.forwardRef((t,r)=>{const i=e.useContext(bc),n=e.useRef(null),s=cc(r,n);return e.useEffect(()=>{const e=n.current;if(e)return i.branches.add(e),()=>{i.branches.delete(e)}},[i.branches]),p(pc.div,{...t,ref:s})}).displayName="DismissableLayerBranch";var Tc=t=>{const{present:r,children:i}=t,n=function(t){const[r,i]=e.useState(),n=e.useRef(null),s=e.useRef(t),a=e.useRef("none"),o=t?"mounted":"unmounted",[l,d]=function(t,r){return e.useReducer((e,t)=>r[e][t]??e,t)}(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return e.useEffect(()=>{const e=xc(n.current);a.current="mounted"===l?e:"none"},[l]),tc(()=>{const e=n.current,r=s.current;if(r!==t){const i=a.current,n=xc(e);if(t)d("MOUNT");else if("none"===n||"none"===e?.display)d("UNMOUNT");else{d(r&&i!==n?"ANIMATION_OUT":"UNMOUNT")}s.current=t}},[t,d]),tc(()=>{if(r){let e;const t=r.ownerDocument.defaultView??window,i=i=>{const a=xc(n.current).includes(i.animationName);if(i.target===r&&a&&(d("ANIMATION_END"),!s.current)){const i=r.style.animationFillMode;r.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=i)})}},o=e=>{e.target===r&&(a.current=xc(n.current))};return r.addEventListener("animationstart",o),r.addEventListener("animationcancel",i),r.addEventListener("animationend",i),()=>{t.clearTimeout(e),r.removeEventListener("animationstart",o),r.removeEventListener("animationcancel",i),r.removeEventListener("animationend",i)}}d("ANIMATION_END")},[r,d]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:e.useCallback(e=>{n.current=e?getComputedStyle(e):null,i(e)},[])}}(r),s="function"==typeof i?i({present:n.isPresent}):e.Children.only(i),a=Jd(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof i||n.isPresent?e.cloneElement(s,{ref:a}):null};function xc(e){return e?.animationName||"none"}function Ac(t){const r=kc(t),i=e.forwardRef((t,i)=>{const{children:n,...s}=t,a=e.Children.toArray(n),o=a.find(Ic);if(o){const t=o.props.children,n=a.map(r=>r===o?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r);return p(r,{...s,ref:i,children:e.isValidElement(t)?e.cloneElement(t,void 0,n):null})}return p(r,{...s,ref:i,children:n})});return i.displayName=`${t}.Slot`,i}function kc(t){const r=e.forwardRef((t,r)=>{const{children:i,...n}=t;if(e.isValidElement(i)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i),s=function(e,t){const r={...t};for(const i in t){const n=e[i],s=t[i];/^on[A-Z]/.test(i)?n&&s?r[i]=(...e)=>{const t=s(...e);return n(...e),t}:n&&(r[i]=n):"style"===i?r[i]={...n,...s}:"className"===i&&(r[i]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}(n,i.props);return i.type!==e.Fragment&&(s.ref=r?Zd(r,t):t),e.cloneElement(i,s)}return e.Children.count(i)>1?e.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}Tc.displayName="Presence";var Lc=Symbol("radix.slottable");function Ic(t){return e.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===Lc}var Rc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const i=Ac(`Primitive.${r}`),n=e.forwardRef((e,t)=>{const{asChild:n,...s}=e,a=n?i:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),p(a,{...s,ref:t})});return n.displayName=`Primitive.${r}`,{...t,[r]:n}},{}),Pc=0;function Dc(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Cc="Dialog",[_c,Oc]=function(t,r=[]){let i=[];const n=()=>{const r=i.map(t=>e.createContext(t));return function(i){const n=i?.[t]||r;return e.useMemo(()=>({[`__scope${t}`]:{...i,[t]:n}}),[i,n])}};return n.scopeName=t,[function(r,n){const s=e.createContext(n),a=i.length;i=[...i,n];const o=r=>{const{scope:i,children:n,...o}=r,l=i?.[t]?.[a]||s,d=e.useMemo(()=>o,Object.values(o));return p(l.Provider,{value:d,children:n})};return o.displayName=r+"Provider",[o,function(i,o){const l=o?.[t]?.[a]||s,d=e.useContext(l);if(d)return d;if(void 0!==n)return n;throw new Error(`\`${i}\` must be used within \`${r}\``)}]},ec(n,...r)]}(Cc),[Mc,Nc]=_c(Cc),Fc=t=>{const{__scopeDialog:r,children:i,open:n,defaultOpen:s,onOpenChange:a,modal:o=!0}=t,l=e.useRef(null),d=e.useRef(null),[c,u]=ac({prop:n,defaultProp:s??!1,onChange:a,caller:Cc});return p(Mc,{scope:r,triggerRef:l,contentRef:d,contentId:nc(),titleId:nc(),descriptionId:nc(),open:c,onOpenChange:u,onOpenToggle:e.useCallback(()=>u(e=>!e),[u]),modal:o,children:i})};Fc.displayName=Cc;var $c="DialogTrigger";e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Nc($c,r),s=Jd(t,n.triggerRef);return p(Rc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":nu(n.open),...i,ref:s,onClick:Xd(e.onClick,n.onOpenToggle)})}).displayName=$c;var Bc="DialogPortal",[Uc,zc]=_c(Bc,{forceMount:void 0}),Gc=t=>{const{__scopeDialog:r,forceMount:i,children:n,container:s}=t,a=Nc(Bc,r);return p(Uc,{scope:r,forceMount:i,children:e.Children.map(n,e=>p(Tc,{present:i||a.open,children:p(eo,{asChild:!0,container:s,children:e})}))})};Gc.displayName=Bc;var jc="DialogOverlay",Hc=e.forwardRef((e,t)=>{const r=zc(jc,e.__scopeDialog),{forceMount:i=r.forceMount,...n}=e,s=Nc(jc,e.__scopeDialog);return s.modal?p(Tc,{present:i||s.open,children:p(Wc,{...n,ref:t})}):null});Hc.displayName=jc;var Vc=Ac("DialogOverlay.RemoveScroll"),Wc=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Nc(jc,r);return p(Ho,{as:Vc,allowPinchZoom:!0,shards:[n.contentRef],children:p(Rc.div,{"data-state":nu(n.open),...i,ref:t,style:{pointerEvents:"auto",...i.style}})})}),Yc="DialogContent",Kc=e.forwardRef((e,t)=>{const r=zc(Yc,e.__scopeDialog),{forceMount:i=r.forceMount,...n}=e,s=Nc(Yc,e.__scopeDialog);return p(Tc,{present:i||s.open,children:s.modal?p(qc,{...n,ref:t}):p(Xc,{...n,ref:t})})});Kc.displayName=Yc;var qc=e.forwardRef((t,r)=>{const i=Nc(Yc,t.__scopeDialog),n=e.useRef(null),s=Jd(r,i.contentRef,n);return e.useEffect(()=>{const e=n.current;if(e)return Qo(e)},[]),p(Qc,{...t,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Xd(t.onCloseAutoFocus,e=>{e.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:Xd(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Xd(t.onFocusOutside,e=>e.preventDefault())})}),Xc=e.forwardRef((t,r)=>{const i=Nc(Yc,t.__scopeDialog),n=e.useRef(!1),s=e.useRef(!1);return p(Qc,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(n.current||i.triggerRef.current?.focus(),e.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(n.current=!0,"pointerdown"===e.detail.originalEvent.type&&(s.current=!0));const r=e.target,a=i.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&s.current&&e.preventDefault()}})}),Qc=e.forwardRef((t,r)=>{const{__scopeDialog:i,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=t,l=Nc(Yc,i),d=e.useRef(null),c=Jd(r,d);return e.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Dc()),document.body.insertAdjacentElement("beforeend",e[1]??Dc()),Pc++,()=>{1===Pc&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Pc--}},[]),g(m,{children:[p(Ya,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:p(Ec,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":nu(l.open),...o,ref:c,onDismiss:()=>l.onOpenChange(!1)})}),g(m,{children:[p(lu,{titleId:l.titleId}),p(du,{contentRef:d,descriptionId:l.descriptionId})]})]})}),Zc="DialogTitle",Jc=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Nc(Zc,r);return p(Rc.h2,{id:n.titleId,...i,ref:t})});Jc.displayName=Zc;var eu="DialogDescription",tu=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Nc(eu,r);return p(Rc.p,{id:n.descriptionId,...i,ref:t})});tu.displayName=eu;var ru="DialogClose",iu=e.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Nc(ru,r);return p(Rc.button,{type:"button",...i,ref:t,onClick:Xd(e.onClick,()=>n.onOpenChange(!1))})});function nu(e){return e?"open":"closed"}iu.displayName=ru;var su="DialogTitleWarning",[au,ou]=function(t,r){const i=e.createContext(r),n=t=>{const{children:r,...n}=t,s=e.useMemo(()=>n,Object.values(n));return p(i.Provider,{value:s,children:r})};return n.displayName=t+"Provider",[n,function(n){const s=e.useContext(i);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]}(su,{contentName:Yc,titleName:Zc,docsSlug:"dialog"}),lu=({titleId:t})=>{const r=ou(su),i=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return e.useEffect(()=>{if(t){document.getElementById(t)||console.error(i)}},[i,t]),null},du=({contentRef:t,descriptionId:r})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ou("DialogDescriptionWarning").contentName}}.`;return e.useEffect(()=>{const e=t.current?.getAttribute("aria-describedby");if(r&&e){document.getElementById(r)||console.warn(i)}},[i,t,r]),null},cu=Fc,uu=Gc,hu=Hc,fu=Kc,pu=Jc,mu=iu;function gu(t){return e.createElement(cu,Object.assign({"data-slot":"dialog"},t))}function vu(t){var r=T(t,[]);return e.createElement(uu,Object.assign({"data-slot":"dialog-portal"},r))}function yu(t){var{className:r}=t,i=T(t,["className"]);return e.createElement(hu,Object.assign({"data-slot":"dialog-overlay",className:wt("fixed inset-0 z-50 bg-black/50",r)},i))}function bu(t){var{className:r,children:i,showCloseButton:n=!0,container:s}=t,a=T(t,["className","children","showCloseButton","container"]);return e.createElement(vu,{"data-slot":"dialog-portal",container:s},e.createElement(yu,null),e.createElement(fu,Object.assign({"data-slot":"dialog-content",style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",outline:"none"},className:wt("fixed","z-50 grid w-full max-w-lg sm:mx-0 gap-4 p-6",r)},a),i,n&&e.createElement(mu,{"data-slot":"dialog-close",style:{right:"calc(var(--spacing) * 4)",top:"calc(var(--spacing) * 4)",outline:"none"},className:wt("absolute right-4 top-4 rounded opacity-70 transition-opacity","hover:opacity-100 focus:outline-none","focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:pointer-events-none"),"aria-label":"Close"},e.createElement(Xt,{className:"h-4 w-4 pointer-events-none shrink-0",style:{height:"calc(var(--spacing) * 4)",width:"calc(var(--spacing) * 4)"}}))))}function Eu(t){var{className:r}=t,i=T(t,["className"]);return e.createElement("div",Object.assign({"data-slot":"dialog-header",className:wt("flex flex-col gap-2 text-left",r)},i))}function wu(t){var{className:r}=t,i=T(t,["className"]);return e.createElement(pu,Object.assign({"data-slot":"dialog-title",className:wt("text-lg leading-none font-semibold",r)},i))}function Su({title:e,children:r,contentClassName:i,hideCloseButton:n=!1,portalContainer:s,description:a}){const{open:o,setOpen:l}=zd();return t.createElement(gu,{open:o,onOpenChange:l},t.createElement(bu,{container:s,className:i,showCloseButton:!n},e&&t.createElement(Eu,null,t.createElement(wu,{style:{color:"#494949"}},e||""),t.createElement(tu,{style:{color:"#5e5e5e",fontSize:"12.5px"}},a||"")),r))}const Tu=({products:e,contentId:r})=>{const i=Od().width<430||pa.isMobile;return t.createElement("div",{onWheel:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),className:"grid gap-2 "+(i?"grid-cols-1":"grid-cols-2"),style:{fontSize:13}},e.map(i=>t.createElement(Gd,{key:i.productId,product:i,hideMoreBadge:!0,productLength:e.length,contentId:r})))},{PLAYER_BACK_BASE_URL:xu}=gt(),Au=({widgetPlayerOption:e,setCollectionUuid:r,portalContainer:n})=>{const{player:s}=e,[o,l]=a(null),{collection:d}=ra(),{isPreview:c}=Js(),{onSlideChange:u,onCollectionClose:h}=ia(o,l),{setOpen:f,open:p}=zd();i(()=>{p||(o&&(h(),l(null)),m&&g(null))},[p]);const[m,g]=a();return t.createElement(t.Fragment,null,d&&t.createElement(Yd,Object.assign({collection:d},e,{onThumbnailClick:e=>x(void 0,void 0,void 0,function*(){if(s===$e.POPUP){const t=kt(),i=kt();if(r(i),l(Object.assign(Object.assign({},d.contents.find(t=>t.shortsId===e)),{uuid:t})),f(!0),c)return;yield Promise.all([Bs({contentId:d.colId,uuid:i,type:Et.COLLECTION,userId:d.userId,isFirstPlay:!Lt(d.colId)}),Bs({contentId:e,uuid:t,type:Et.SHORTS,userId:d.userId,isFirstPlay:!Lt(e)})])}else{const t=(e=>{switch(e){case $e.HORIZONTAL:return Ue.HORIZONTAL;case $e.VERTICAL:return Ue.VERTICAL;case $e.GRID:return Ue.PRODUCTS;case $e.TABLET:return Ue.TABLET;default:return Ue.PLATFORM}})(s),r=null==d?void 0:d.contents.findIndex(t=>t.shortsId===e);let i="";r&&r>1&&(i=(null==d?void 0:d.contents[r-1].shortsId)||""),open(`${xu}/collection/${d.colId}?nextKey=${i}&layout=${t}`)}}),setSelectedProducts:g})),m&&t.createElement(Su,{portalContainer:n,title:"상품 목록",contentClassName:"bg-white rounded p-4 product-dialog-container",description:"상품 정보를 확인해 보세요"},t.createElement(Tu,{products:m.productsInfo,contentId:m.shortsId})),d&&o&&t.createElement(Su,{portalContainer:n,hideCloseButton:!0,contentClassName:"w-full max-w-none p-0 mx-0"},t.createElement(Bd,{collection:d,initialShortsId:o.shortsId,onClosePlayer:()=>x(void 0,void 0,void 0,function*(){h(),f(!1)}),onSlideChange:u})))};var ku,Lu={exports:{}},Iu={exports:{}},Ru={};var Pu,Du,Cu,_u,Ou,Mu,Nu,Fu,$u,Bu,Uu,zu,Gu,ju,Hu,Vu={};
28
28
  /** @license React v16.13.1
29
29
  * react-is.development.js
30
30
  *
@@ -32,9 +32,9 @@ var Lt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
32
32
  *
33
33
  * This source code is licensed under the MIT license found in the
34
34
  * LICENSE file in the root directory of this source tree.
35
- */function Yu(){return Iu||(Iu=1,"production"===process.env.NODE_ENV?Nu.exports=function(){if(Cu)return ku;Cu=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function y(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:switch(e=e.type){case l:case c:case r:case i:case o:case u:return e;default:switch(e=e&&e.$$typeof){case s:case d:case m:case f:case a:return e;default:return p}}case n:return p}}}function w(e){return y(e)===c}return ku.AsyncMode=l,ku.ConcurrentMode=c,ku.ContextConsumer=s,ku.ContextProvider=a,ku.Element=t,ku.ForwardRef=d,ku.Fragment=r,ku.Lazy=m,ku.Memo=f,ku.Portal=n,ku.Profiler=i,ku.StrictMode=o,ku.Suspense=u,ku.isAsyncMode=function(e){return w(e)||y(e)===l},ku.isConcurrentMode=w,ku.isContextConsumer=function(e){return y(e)===s},ku.isContextProvider=function(e){return y(e)===a},ku.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},ku.isForwardRef=function(e){return y(e)===d},ku.isFragment=function(e){return y(e)===r},ku.isLazy=function(e){return y(e)===m},ku.isMemo=function(e){return y(e)===f},ku.isPortal=function(e){return y(e)===n},ku.isProfiler=function(e){return y(e)===i},ku.isStrictMode=function(e){return y(e)===o},ku.isSuspense=function(e){return y(e)===u},ku.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===i||e===o||e===u||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===a||e.$$typeof===s||e.$$typeof===d||e.$$typeof===g||e.$$typeof===v||e.$$typeof===b||e.$$typeof===h)},ku.typeOf=y,ku}():Nu.exports=(Mu||(Mu=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function y(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var h=e.type;switch(h){case l:case c:case r:case i:case o:case u:return h;default:var g=h&&h.$$typeof;switch(g){case s:case d:case m:case f:case a:return g;default:return p}}case n:return p}}}var w=l,E=c,x=s,S=a,T=t,O=d,C=r,P=m,N=f,k=n,M=i,I=o,D=u,R=!1;function A(e){return y(e)===c}Uu.AsyncMode=w,Uu.ConcurrentMode=E,Uu.ContextConsumer=x,Uu.ContextProvider=S,Uu.Element=T,Uu.ForwardRef=O,Uu.Fragment=C,Uu.Lazy=P,Uu.Memo=N,Uu.Portal=k,Uu.Profiler=M,Uu.StrictMode=I,Uu.Suspense=D,Uu.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),A(e)||y(e)===l},Uu.isConcurrentMode=A,Uu.isContextConsumer=function(e){return y(e)===s},Uu.isContextProvider=function(e){return y(e)===a},Uu.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Uu.isForwardRef=function(e){return y(e)===d},Uu.isFragment=function(e){return y(e)===r},Uu.isLazy=function(e){return y(e)===m},Uu.isMemo=function(e){return y(e)===f},Uu.isPortal=function(e){return y(e)===n},Uu.isProfiler=function(e){return y(e)===i},Uu.isStrictMode=function(e){return y(e)===o},Uu.isSuspense=function(e){return y(e)===u},Uu.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===i||e===o||e===u||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===a||e.$$typeof===s||e.$$typeof===d||e.$$typeof===g||e.$$typeof===v||e.$$typeof===b||e.$$typeof===h)},Uu.typeOf=y}()),Uu)),Nu.exports}
35
+ */function Wu(){return Du||(Du=1,"production"===process.env.NODE_ENV?Iu.exports=function(){if(ku)return Ru;ku=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,p=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case t:switch(e=e.type){case l:case d:case i:case s:case n:case u:return e;default:switch(e=e&&e.$$typeof){case o:case c:case p:case f:case a:return e;default:return h}}case r:return h}}}function E(e){return b(e)===d}return Ru.AsyncMode=l,Ru.ConcurrentMode=d,Ru.ContextConsumer=o,Ru.ContextProvider=a,Ru.Element=t,Ru.ForwardRef=c,Ru.Fragment=i,Ru.Lazy=p,Ru.Memo=f,Ru.Portal=r,Ru.Profiler=s,Ru.StrictMode=n,Ru.Suspense=u,Ru.isAsyncMode=function(e){return E(e)||b(e)===l},Ru.isConcurrentMode=E,Ru.isContextConsumer=function(e){return b(e)===o},Ru.isContextProvider=function(e){return b(e)===a},Ru.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Ru.isForwardRef=function(e){return b(e)===c},Ru.isFragment=function(e){return b(e)===i},Ru.isLazy=function(e){return b(e)===p},Ru.isMemo=function(e){return b(e)===f},Ru.isPortal=function(e){return b(e)===r},Ru.isProfiler=function(e){return b(e)===s},Ru.isStrictMode=function(e){return b(e)===n},Ru.isSuspense=function(e){return b(e)===u},Ru.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===d||e===s||e===n||e===u||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===a||e.$$typeof===o||e.$$typeof===c||e.$$typeof===g||e.$$typeof===v||e.$$typeof===y||e.$$typeof===m)},Ru.typeOf=b,Ru}():Iu.exports=(Pu||(Pu=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,i=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,p=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case t:var m=e.type;switch(m){case l:case d:case i:case s:case n:case u:return m;default:var g=m&&m.$$typeof;switch(g){case o:case c:case p:case f:case a:return g;default:return h}}case r:return h}}}var E=l,w=d,S=o,T=a,x=t,A=c,k=i,L=p,I=f,R=r,P=s,D=n,C=u,_=!1;function O(e){return b(e)===d}Vu.AsyncMode=E,Vu.ConcurrentMode=w,Vu.ContextConsumer=S,Vu.ContextProvider=T,Vu.Element=x,Vu.ForwardRef=A,Vu.Fragment=k,Vu.Lazy=L,Vu.Memo=I,Vu.Portal=R,Vu.Profiler=P,Vu.StrictMode=D,Vu.Suspense=C,Vu.isAsyncMode=function(e){return _||(_=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),O(e)||b(e)===l},Vu.isConcurrentMode=O,Vu.isContextConsumer=function(e){return b(e)===o},Vu.isContextProvider=function(e){return b(e)===a},Vu.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Vu.isForwardRef=function(e){return b(e)===c},Vu.isFragment=function(e){return b(e)===i},Vu.isLazy=function(e){return b(e)===p},Vu.isMemo=function(e){return b(e)===f},Vu.isPortal=function(e){return b(e)===r},Vu.isProfiler=function(e){return b(e)===s},Vu.isStrictMode=function(e){return b(e)===n},Vu.isSuspense=function(e){return b(e)===u},Vu.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===d||e===s||e===n||e===u||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===a||e.$$typeof===o||e.$$typeof===c||e.$$typeof===g||e.$$typeof===v||e.$$typeof===y||e.$$typeof===m)},Vu.typeOf=b}()),Vu)),Iu.exports}
36
36
  /*
37
37
  object-assign
38
38
  (c) Sindre Sorhus
39
39
  @license MIT
40
- */function Gu(){if(Ru)return Du;Ru=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return Du=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var i,a,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),l=1;l<arguments.length;l++){for(var c in i=Object(arguments[l]))t.call(i,c)&&(s[c]=i[c]);if(e){a=e(i);for(var d=0;d<a.length;d++)n.call(i,a[d])&&(s[a[d]]=i[a[d]])}}return s},Du}function qu(){if(zu)return Au;zu=1;return Au="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Xu(){return Lu?_u:(Lu=1,_u=Function.call.bind(Object.prototype.hasOwnProperty))}function Ku(){if(ju)return $u;ju=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=qu(),n={},r=Xu();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,i,a,s,l){if("production"!==process.env.NODE_ENV)for(var c in o)if(r(o,c)){var d;try{if("function"!=typeof o[c]){var u=Error((s||"React class")+": "+a+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}d=o[c](i,c,s,a,null,t)}catch(e){d=e}if(!d||d instanceof Error||e((s||"React class")+": type specification of "+a+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in n)){n[d.message]=!0;var p=l?l():"";e("Failed "+a+" type: "+d.message+(null!=p?p:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},$u=o}function Zu(){if(Wu)return Fu;Wu=1;var e=Yu(),t=Gu(),n=qu(),r=Xu(),o=Ku(),i=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),Fu=function(s,l){var c="function"==typeof Symbol&&Symbol.iterator;var d="<<anonymous>>",u={array:h("array"),bigint:h("bigint"),bool:h("boolean"),func:h("function"),number:h("number"),object:h("object"),string:h("string"),symbol:h("symbol"),any:m(a),arrayOf:function(e){return m(function(t,r,o,i,a){if("function"!=typeof e)return new f("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s))return new f("Invalid "+i+" `"+a+"` of type `"+b(s)+"` supplied to `"+o+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,o,i,a+"["+l+"]",n);if(c instanceof Error)return c}return null})},element:m(function(e,t,n,r,o){var i=e[t];return s(i)?null:new f("Invalid "+r+" `"+o+"` of type `"+b(i)+"` supplied to `"+n+"`, expected a single ReactElement.")}),elementType:m(function(t,n,r,o,i){var a=t[n];return e.isValidElementType(a)?null:new f("Invalid "+o+" `"+i+"` of type `"+b(a)+"` supplied to `"+r+"`, expected a single ReactElement type.")}),instanceOf:function(e){return m(function(t,n,r,o,i){if(!(t[n]instanceof e)){var a=e.name||d;return new f("Invalid "+o+" `"+i+"` of type `"+(((s=t[n]).constructor&&s.constructor.name?s.constructor.name:d)+"` supplied to `")+r+"`, expected instance of `"+a+"`.")}var s;return null})},node:m(function(e,t,n,r,o){return v(e[t])?null:new f("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return m(function(t,o,i,a,s){if("function"!=typeof e)return new f("Property `"+s+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var l=t[o],c=b(l);if("object"!==c)return new f("Invalid "+a+" `"+s+"` of type `"+c+"` supplied to `"+i+"`, expected an object.");for(var d in l)if(r(l,d)){var u=e(l,d,i,a,s+"."+d,n);if(u instanceof Error)return u}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a;return m(function(t,n,r,o,i){for(var a=t[n],s=0;s<e.length;s++)if(p(a,e[s]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===y(t)?String(t):t});return new f("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+r+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+w(o)+" at index "+t+"."),a}return m(function(t,o,i,a,s){for(var l=[],c=0;c<e.length;c++){var d=(0,e[c])(t,o,i,a,s,n);if(null==d)return null;d.data&&r(d.data,"expectedType")&&l.push(d.data.expectedType)}return new f("Invalid "+a+" `"+s+"` supplied to `"+i+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return m(function(t,r,o,i,a){var s=t[r],l=b(s);if("object"!==l)return new f("Invalid "+i+" `"+a+"` of type `"+l+"` supplied to `"+o+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return g(o,i,a,c,y(d));var u=d(s,c,o,i,a+"."+c,n);if(u)return u}return null})},exact:function(e){return m(function(o,i,a,s,l){var c=o[i],d=b(c);if("object"!==d)return new f("Invalid "+s+" `"+l+"` of type `"+d+"` supplied to `"+a+"`, expected `object`.");var u=t({},o[i],e);for(var p in u){var m=e[p];if(r(e,p)&&"function"!=typeof m)return g(a,s,l,p,y(m));if(!m)return new f("Invalid "+s+" `"+l+"` key `"+p+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var h=m(c,p,a,s,l+"."+p,n);if(h)return h}return null})}};function p(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function f(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function m(e){if("production"!==process.env.NODE_ENV)var t={},r=0;function o(o,a,s,c,u,p,m){if(c=c||d,p=p||s,m!==n){if(l){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=c+":"+s;!t[g]&&r<3&&(i("You are manually calling a React.PropTypes validation function for the `"+p+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[g]=!0,r++)}}return null==a[s]?o?null===a[s]?new f("The "+u+" `"+p+"` is marked as required in `"+c+"`, but its value is `null`."):new f("The "+u+" `"+p+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(a,s,c,u,p)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function h(e){return m(function(t,n,r,o,i,a){var s=t[n];return b(s)!==e?new f("Invalid "+o+" `"+i+"` of type `"+y(s)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null})}function g(e,t,n,r,o){return new f((e||"React class")+": "+t+" type `"+n+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function v(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(v);if(null===e||s(e))return!0;var t=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!v(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!v(o[1]))return!1}return!0;default:return!1}}function b(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function y(e){if(null==e)return""+e;var t=b(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function w(e){var t=y(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return f.prototype=Error.prototype,u.checkPropTypes=o,u.resetWarningCache=o.resetWarningCache,u.PropTypes=u,u},Fu}function Ju(){if(Hu)return Bu;Hu=1;var e=qu();function t(){}function n(){}return n.resetWarningCache=t,Bu=function(){function r(t,n,r,o,i,a){if(a!==e){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function o(){return r}r.isRequired=r;var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i}}function Qu(){if(Vu)return Pu.exports;if(Vu=1,"production"!==process.env.NODE_ENV){var e=Yu();Pu.exports=Zu()(e.isElement,true)}else Pu.exports=Ju()();return Pu.exports}var ep=He(Qu()),tp="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function np(e,t){return e(t={exports:{}},t.exports),t.exports}var rp=np(function(e){!function(t){var n=function(e,t,r){if(!l(t)||d(t)||u(t)||p(t)||s(t))return t;var o,i=0,a=0;if(c(t))for(o=[],a=t.length;i<a;i++)o.push(n(e,t[i],r));else for(var f in o={},t)Object.prototype.hasOwnProperty.call(t,f)&&(o[e(f,r)]=n(e,t[f],r));return o},r=function(e){return f(e)?e:(e=e.replace(/[\-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""})).substr(0,1).toLowerCase()+e.substr(1)},o=function(e){var t=r(e);return t.substr(0,1).toUpperCase()+t.substr(1)},i=function(e,t){return function(e,t){var n=(t=t||{}).separator||"_",r=t.split||/(?=[A-Z])/;return e.split(r).join(n)}(e,t).toLowerCase()},a=Object.prototype.toString,s=function(e){return"function"==typeof e},l=function(e){return e===Object(e)},c=function(e){return"[object Array]"==a.call(e)},d=function(e){return"[object Date]"==a.call(e)},u=function(e){return"[object RegExp]"==a.call(e)},p=function(e){return"[object Boolean]"==a.call(e)},f=function(e){return(e-=0)==e},m=function(e,t){var n=t&&"process"in t?t.process:t;return"function"!=typeof n?e:function(t,r){return n(t,e,r)}},h={camelize:r,decamelize:i,pascalize:o,depascalize:i,camelizeKeys:function(e,t){return n(m(r,t),e)},decamelizeKeys:function(e,t){return n(m(i,t),e,t)},pascalizeKeys:function(e,t){return n(m(o,t),e)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};e.exports?e.exports=h:t.humps=h}(tp)}).decamelize,op=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},ip=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return op(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?op(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()},ap=np(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(this,arguments)}e.exports=t}),sp=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o},lp=l(null);function cp(e){var n=e.children,r=void 0===n?"":n,o=sp(e,["children"]);return"string"!=typeof r&&(r=E(r)),t.createElement("template",ap({},o,{dangerouslySetInnerHTML:{__html:r}}))}function dp(e){var t=e.root,n=e.children;return y(void 0===n?null:n,t)}cp.propTypes={children:ep.oneOfType([ep.string,ep.node])},dp.propTypes={root:ep.object.isRequired,children:ep.node};var up=new Map;var pp=function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"core",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){return e.children};return new Proxy(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{get:function(l,c){var d=rp(c,{separator:"-"}),u="".concat(e,"-").concat(d);return up.has(u)||up.set(u,function(e){var i=o(function(o,i){var l,c,d=o.mode,u=void 0===d?"open":d,p=o.delegatesFocus,f=void 0!==p&&p,m=o.styleSheets,h=void 0===m?[]:m,g=o.ssr,v=void 0!==g&&g,b=o.children,y=sp(o,["mode","delegatesFocus","styleSheets","ssr","children"]),w=(c=n((l=i)&&l.current),r(function(){l&&(l.current=c.current)},[l]),c),E=a(null),x=ip(E,2),S=x[0],T=x[1],O="node_".concat(u).concat(f);return s(function(){if(w.current)try{if("function"==typeof i&&i(w.current),v){var e=w.current.shadowRoot;return void T(e)}var t=w.current.attachShadow({mode:u,delegatesFocus:f});h.length>0&&(t.adoptedStyleSheets=h),T(t)}catch(e){!function(e){var t=e.error,n=e.styleSheets,r=e.root;if("NotSupportedError"!==t.name)throw t;n.length>0&&(r.adoptedStyleSheets=n)}({error:e,styleSheets:h,root:S})}},[i,w,h]),t.createElement(t.Fragment,null,t.createElement(e.tag,ap({key:O,ref:w},y),(S||v)&&t.createElement(lp.Provider,{value:S},v?t.createElement(cp,{shadowroot:u,shadowrootmode:u},e.render({root:S,ssr:v,children:b})):t.createElement(dp,{root:S},e.render({root:S,ssr:v,children:b})))))});return i.propTypes={mode:ep.oneOf(["open","closed"]),delegatesFocus:ep.bool,styleSheets:ep.arrayOf(ep.instanceOf(globalThis.CSSStyleSheet)),ssr:ep.bool,children:ep.node},i}({tag:d,render:i})),up.get(u)}})}();function fp(e){const[o,i]=t.useState(null),a=n(null),{open:s,setOpen:l}=Fc();return r(()=>{a.current&&(a.current.style.display=s?"block":"none")},[s]),t.useLayoutEffect(()=>{const t=document.createElement("div");t.style.position="fixed",t.style.inset="0",t.style.zIndex="214748348",t.style.display="none",document.body.appendChild(t),a.current=t;const n=t.attachShadow({mode:"open"}),r=document.createElement("link");r.rel="stylesheet",r.href=e.cssHref;const o=document.createElement("style");o.innerHTML="\n /* Dialog size override for small viewports */\n .product-dialog-container{ \n max-height: 70vh;\n overflow-y: auto;\n width: 100%;\n max-width: min(82vw, 500px) !important;\n }\n ",n.appendChild(o),n.appendChild(r);const s=document.createElement("div");return n.appendChild(s),i(s),()=>t.remove()},[]),{container:o,setOpen:l}}const mp=e=>{const{collectionId:n,isPreview:o,priceText:i,container:a,cssText:s}=e,{setIsPreview:l,setPriceText:c}=Qi(),{setCollection:d,setNextKey:u,collection:p}=na();r(()=>{i&&c(i);const e=Boolean(o);e&&l(e)},[]),r(()=>{T(void 0,void 0,void 0,function*(){var e;const t=yield Vi({collectionId:n,size:10});if(!t)return;const{contents:r,count:o}=t;(null==r?void 0:r.length)&&u(null===(e=r.at(-1))||void 0===e?void 0:e.shortsId),d(Object.assign(Object.assign({},t),{count:o}))})},[n]);const f=function(e){var t,n,r,o,i,a,s,l,c,d,u,p;const f=null!==(t=e.iconForm)&&void 0!==t?t:ze.INSTA,m={collectionId:e.collectionId,iconForm:f,iconShape:null!==(n=e.iconShape)&&void 0!==n?n:_e.MANY,iconSize:null!==(r=e.iconSize)&&void 0!==r?r:120,borderLine:null!==(o=e.borderLine)&&void 0!==o?o:Le.DAY,exposeTitle:null===(i=e.exposeTitle)||void 0===i||i,player:null!==(a=e.player)&&void 0!==a?a:$e.POPUP,rounded:null===(s=e.rounded)||void 0===s||s,titlePosition:null!==(l=e.titlePosition)&&void 0!==l?l:je.BOTTOM,exposeProductBanner:null!==(c=e.exposeProductBanner)&&void 0!==c&&c,exposeProductBadge:null!==(d=e.exposeProductBadge)&&void 0!==d&&d,priceText:e.priceText||"할인가",hoverPlay:null!==(u=e.hoverPlay)&&void 0!==u&&u,thumbnailAutoPlay:null!==(p=e.thumbnailAutoPlay)&&void 0!==p&&p};return f===ze.YOUTUBE?Object.assign(Object.assign({},m),{iconForm:ze.YOUTUBE,iconRatio:e.iconRatio||"9/16"}):Object.assign(Object.assign({},m),{iconForm:ze.INSTA})}(e),{containerRef:m}=function({collectionId:e,iconSize:n}){const{collection:r,setCollection:o,nextKey:i,setNextKey:a,isFetching:s,setIsFetching:l}=na(),c=t.useRef(null),[d,u]=t.useState(0);return t.useEffect(()=>{if(!c.current)return;const e=new ResizeObserver(e=>{var t,n,r;const o=null!==(r=null===(n=null===(t=e[0])||void 0===t?void 0:t.contentRect)||void 0===n?void 0:n.width)&&void 0!==r?r:0;u(o)});return e.observe(c.current),()=>e.disconnect()},[]),t.useEffect(()=>{var e;if(!r||!r.contents)return;const t=Math.max(1,n+12),c=Math.ceil((d||0)/t)+4,u=null!==(e=r.count)&&void 0!==e?e:Number.MAX_SAFE_INTEGER,p=Math.min(u,c);if(r.contents.length>=p||s)return;console.log(r.contents);let f=!1;return(()=>{T(this,void 0,void 0,function*(){var e,t,n,s,c;try{l(!0);let d=r,u=i||(null===(e=d.contents.at(-1))||void 0===e?void 0:e.shortsId)||void 0;const m=new Set(d.contents.map(e=>e.shortsId));for(;!f&&d.contents.length<p;){const e=Math.max(6,p-d.contents.length),r=yield Vi({collectionId:d.colId,nextKey:u,size:e});if(!r||!(null===(t=r.contents)||void 0===t?void 0:t.length))break;u=null!==(s=null===(n=r.contents.at(-1))||void 0===n?void 0:n.shortsId)&&void 0!==s?s:u;const i=r.contents.filter(e=>!m.has(e.shortsId));if(!i.length)break;if(i.forEach(e=>m.add(e.shortsId)),d=Object.assign(Object.assign({},d),{contents:[...d.contents,...i]}),o(d),a(u||""),d.contents.length>=(null!==(c=d.count)&&void 0!==c?c:Number.MAX_SAFE_INTEGER))break}}finally{l(!1)}})})(),()=>{f=!0}},[null==r?void 0:r.colId,null==r?void 0:r.count,null==r?void 0:r.contents.length,d,n,s,i,o,l,a]),{containerRef:c}}({collectionId:n,iconSize:f.iconSize});return t.createElement(pp.div,null,t.createElement("style",null,s),t.createElement("div",{ref:m},t.createElement(Ou,{widgetPlayerOption:f,setCollectionUuid:e=>{d(Object.assign(Object.assign({},p),{uuid:e}))},portalContainer:a})))},hp=e=>{const[n,o]=a("");r(()=>{T(void 0,void 0,void 0,function*(){function e(e){return T(this,void 0,void 0,function*(){const t=yield fetch(e);if(!t.ok)throw new Error(String(t.status));return t.text()})}let t="";try{t=yield e("https://unpkg.com/@kinxcdn/commerce-player@latest/dist/styles.css")}catch(n){t=yield e("https://mbus-player-sy.s3.ap-northeast-2.amazonaws.com/styles.css")}o(t)}).catch(()=>console.error("Failed to load styles.css"))},[]);const{container:i}=fp({cssHref:"https://unpkg.com/@kinxcdn/commerce-player@latest/dist/styles.css"});return i&&n?t.createElement(ta,null,t.createElement(mp,Object.assign({},e,{container:i,cssText:n}))):null},gp=({portalContainer:e,aspectRatio:n})=>{var o;const{collection:i,setNextKey:s}=na(),[l,c]=a(),{setOpen:d,open:u}=Fc();r(()=>{u||l&&c(null)},[u]);const p=(null!==(o=Rc().width)&&void 0!==o?o:0)<430||ma.isMobile;return t.createElement(t.Fragment,null,t.createElement("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${p?2:5}, 1fr)`}},null==i?void 0:i.contents.map(e=>t.createElement("div",null,t.createElement("div",{className:"overflow-hidden",style:{borderRadius:"0.625rem",aspectRatio:null!=n?n:"9/16"}},t.createElement("video",{loop:!0,className:"w-full h-full object-cover",muted:!0,autoPlay:!0,playsInline:!0,src:St(e.media.objectId),poster:kt(e.thumbPath)})),t.createElement(Bc,{hideMoreBadge:!0,showMoreBtn:!0,products:e.productsInfo,contentId:e.shortsId,setSelectedProducts:c})))),l&&t.createElement(xu,{portalContainer:e,title:"상품 목록",contentClassName:"bg-white rounded p-4 product-dialog-container",description:"연결된 전체 상품 정보를 확인해 보세요"},t.createElement(Su,{products:l.productsInfo,contentId:l.shortsId})))},vp=({collectionId:e,aspectRatio:n,container:o,cssText:i,isPreview:a})=>{const{setCollection:s,setNextKey:l}=na();return r(()=>{T(void 0,void 0,void 0,function*(){var t;const n=yield Vi({collectionId:e,size:-1});if(!n)return;const{contents:r,count:o}=n;(null==r?void 0:r.length)&&l(null===(t=r.at(-1))||void 0===t?void 0:t.shortsId),s(Object.assign(Object.assign({},n),{count:o}))})},[e]),t.createElement(pp.div,null,t.createElement("style",null,i),t.createElement(gp,{portalContainer:o,aspectRatio:n}))},bp=e=>{const[n,o]=a("");r(()=>{T(void 0,void 0,void 0,function*(){function e(e){return T(this,void 0,void 0,function*(){const t=yield fetch(e);if(!t.ok)throw new Error(String(t.status));return t.text()})}let t="";try{t+=(yield e("https://unpkg.com/@kinxcdn/commerce-player@latest/dist/styles.css"))}catch(n){t+=(yield e("https://mbus-player-sy.s3.ap-northeast-2.amazonaws.com/styles.css"))}o(t)}).catch(()=>console.error("Failed to load styles.css"))},[]);const{container:i}=fp({cssHref:"https://unpkg.com/@kinxcdn/commerce-player@latest/dist/styles.css"});return i&&n?t.createElement(ta,null,t.createElement(vp,Object.assign({},e,{container:i,cssText:n}))):null},yp=Ji(e=>({shortform:null,setShortform:t=>e({shortform:t})}));var wp={exports:{}},Ep={};function xp(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=xp(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Sp(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=xp(e))&&(r&&(r+=" "),r+=t);return r}var Tp,Op=Ve(Object.freeze({__proto__:null,clsx:Sp,default:Sp})),Cp={},Pp={};function Np(){if(Tp)return Pp;return Tp=1,Object.defineProperty(Pp,"__esModule",{value:!0}),Pp.dontSetMe=function(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))},Pp.findInArray=function(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]},Pp.int=function(e){return parseInt(e,10)},Pp.isFunction=function(e){return"function"==typeof e||"[object Function]"===Object.prototype.toString.call(e)},Pp.isNum=function(e){return"number"==typeof e&&!isNaN(e)},Pp}var kp,Mp,Ip={};function Dp(){if(Mp)return Cp;Mp=1,Object.defineProperty(Cp,"__esModule",{value:!0}),Cp.addClassName=a,Cp.addEvent=function(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},Cp.addUserSelectStyles=function(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",t.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",e.getElementsByTagName("head")[0].appendChild(t));e.body&&a(e.body,"react-draggable-transparent-selection")},Cp.createCSSTransform=function(e,n){const r=i(e,n,"px");return{[(0,t.browserPrefixToKey)("transform",t.default)]:r}},Cp.createSVGTransform=function(e,t){return i(e,t,"")},Cp.getTouch=function(t,n){return t.targetTouches&&(0,e.findInArray)(t.targetTouches,e=>n===e.identifier)||t.changedTouches&&(0,e.findInArray)(t.changedTouches,e=>n===e.identifier)},Cp.getTouchIdentifier=function(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier},Cp.getTranslation=i,Cp.innerHeight=function(t){let n=t.clientHeight;const r=t.ownerDocument.defaultView.getComputedStyle(t);return n-=(0,e.int)(r.paddingTop),n-=(0,e.int)(r.paddingBottom),n},Cp.innerWidth=function(t){let n=t.clientWidth;const r=t.ownerDocument.defaultView.getComputedStyle(t);return n-=(0,e.int)(r.paddingLeft),n-=(0,e.int)(r.paddingRight),n},Cp.matchesSelector=o,Cp.matchesSelectorAndParentsTo=function(e,t,n){let r=e;do{if(o(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1},Cp.offsetXYFromParent=function(e,t,n){const r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),o=(e.clientX+t.scrollLeft-r.left)/n,i=(e.clientY+t.scrollTop-r.top)/n;return{x:o,y:i}},Cp.outerHeight=function(t){let n=t.clientHeight;const r=t.ownerDocument.defaultView.getComputedStyle(t);return n+=(0,e.int)(r.borderTopWidth),n+=(0,e.int)(r.borderBottomWidth),n},Cp.outerWidth=function(t){let n=t.clientWidth;const r=t.ownerDocument.defaultView.getComputedStyle(t);return n+=(0,e.int)(r.borderLeftWidth),n+=(0,e.int)(r.borderRightWidth),n},Cp.removeClassName=s,Cp.removeEvent=function(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},Cp.removeUserSelectStyles=function(e){if(!e)return;try{if(e.body&&s(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(e){}};var e=Np(),t=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}o.default=e,r&&r.set(e,o);return o}(function(){if(kp)return Ip;kp=1,Object.defineProperty(Ip,"__esModule",{value:!0}),Ip.browserPrefixToKey=n,Ip.browserPrefixToStyle=function(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e},Ip.default=void 0,Ip.getPrefix=t;const e=["Moz","Webkit","O","ms"];function t(){var t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";const o=null===(t=window.document)||void 0===t||null===(t=t.documentElement)||void 0===t?void 0:t.style;if(!o)return"";if(r in o)return"";for(let t=0;t<e.length;t++)if(n(r,e[t])in o)return e[t];return""}function n(e,t){return t?"".concat(t).concat(function(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):"-"===e[r]?n=!0:t+=e[r];return t}(e)):e}return Ip.default=t(),Ip}());function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}let r="";function o(t,n){return r||(r=(0,e.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,e.isFunction)(t[n])})),!!(0,e.isFunction)(t[r])&&t[r](n)}function i(e,t,n){let{x:r,y:o}=e,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){const e="".concat("string"==typeof t.x?t.x:t.x+n),r="".concat("string"==typeof t.y?t.y:t.y+n);i="translate(".concat(e,", ").concat(r,")")+i}return i}function a(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function s(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}return Cp}var Rp,Ap={};function zp(){if(Rp)return Ap;Rp=1,Object.defineProperty(Ap,"__esModule",{value:!0}),Ap.canDragX=function(e){return"both"===e.props.axis||"x"===e.props.axis},Ap.canDragY=function(e){return"both"===e.props.axis||"y"===e.props.axis},Ap.createCoreData=function(t,r,o){const i=!(0,e.isNum)(t.lastX),a=n(t);return i?{node:a,deltaX:0,deltaY:0,lastX:r,lastY:o,x:r,y:o}:{node:a,deltaX:r-t.lastX,deltaY:o-t.lastY,lastX:t.lastX,lastY:t.lastY,x:r,y:o}},Ap.createDraggableData=function(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}},Ap.getBoundPosition=function(r,o,i){if(!r.props.bounds)return[o,i];let{bounds:a}=r.props;a="string"==typeof a?a:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(a);const s=n(r);if("string"==typeof a){const{ownerDocument:n}=s,r=n.defaultView;let o;if(o="parent"===a?s.parentNode:n.querySelector(a),!(o instanceof r.HTMLElement))throw new Error('Bounds selector "'+a+'" could not find an element.');const i=o,l=r.getComputedStyle(s),c=r.getComputedStyle(i);a={left:-s.offsetLeft+(0,e.int)(c.paddingLeft)+(0,e.int)(l.marginLeft),top:-s.offsetTop+(0,e.int)(c.paddingTop)+(0,e.int)(l.marginTop),right:(0,t.innerWidth)(i)-(0,t.outerWidth)(s)-s.offsetLeft+(0,e.int)(c.paddingRight)-(0,e.int)(l.marginRight),bottom:(0,t.innerHeight)(i)-(0,t.outerHeight)(s)-s.offsetTop+(0,e.int)(c.paddingBottom)-(0,e.int)(l.marginBottom)}}(0,e.isNum)(a.right)&&(o=Math.min(o,a.right));(0,e.isNum)(a.bottom)&&(i=Math.min(i,a.bottom));(0,e.isNum)(a.left)&&(o=Math.max(o,a.left));(0,e.isNum)(a.top)&&(i=Math.max(i,a.top));return[o,i]},Ap.getControlPosition=function(e,r,o){const i="number"==typeof r?(0,t.getTouch)(e,r):null;if("number"==typeof r&&!i)return null;const a=n(o),s=o.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,t.offsetXYFromParent)(i||e,s,o.props.scale)},Ap.snapToGrid=function(e,t,n){const r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]};var e=Np(),t=Dp();function n(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}return Ap}var _p,Lp,$p,jp,Fp={},Wp={};function Bp(){if(_p)return Wp;return _p=1,Object.defineProperty(Wp,"__esModule",{value:!0}),Wp.default=function(){},Wp}function Hp(){if(Lp)return Fp;Lp=1,Object.defineProperty(Fp,"__esModule",{value:!0}),Fp.default=void 0;var e=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,n&&n.set(e,r);return r}(t),n=l(Qu()),r=l(b),o=Dp(),i=zp(),a=Np(),s=l(Bp());function l(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function d(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const u={start:"touchstart",move:"touchmove",stop:"touchend"},p={start:"mousedown",move:"mousemove",stop:"mouseup"};let f=p,m=class extends e.Component{constructor(){super(...arguments),d(this,"dragging",!1),d(this,"lastX",NaN),d(this,"lastY",NaN),d(this,"touchIdentifier",null),d(this,"mounted",!1),d(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!(0,o.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,o.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;"touchstart"===e.type&&e.preventDefault();const r=(0,o.getTouchIdentifier)(e);this.touchIdentifier=r;const a=(0,i.getControlPosition)(e,r,this);if(null==a)return;const{x:l,y:c}=a,d=(0,i.createCoreData)(this,l,c);(0,s.default)("DraggableCore: handleDragStart: %j",d),(0,s.default)("calling",this.props.onStart);!1!==this.props.onStart(e,d)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,o.addUserSelectStyles)(n),this.dragging=!0,this.lastX=l,this.lastY=c,(0,o.addEvent)(n,f.move,this.handleDrag),(0,o.addEvent)(n,f.stop,this.handleDragStop))}),d(this,"handleDrag",e=>{const t=(0,i.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=(0,i.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}const o=(0,i.createCoreData)(this,n,r);(0,s.default)("DraggableCore: handleDrag: %j",o);if(!1!==this.props.onDrag(e,o)&&!1!==this.mounted)this.lastX=n,this.lastY=r;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch(e){const t=document.createEvent("MouseEvents");t.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(t)}}),d(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,i.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=(0,i.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}const a=(0,i.createCoreData)(this,n,r);if(!1===this.props.onStop(e,a)||!1===this.mounted)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,o.removeUserSelectStyles)(l.ownerDocument),(0,s.default)("DraggableCore: handleDragStop: %j",a),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,s.default)("DraggableCore: Removing handlers"),(0,o.removeEvent)(l.ownerDocument,f.move,this.handleDrag),(0,o.removeEvent)(l.ownerDocument,f.stop,this.handleDragStop))}),d(this,"onMouseDown",e=>(f=p,this.handleDragStart(e))),d(this,"onMouseUp",e=>(f=p,this.handleDragStop(e))),d(this,"onTouchStart",e=>(f=u,this.handleDragStart(e))),d(this,"onTouchEnd",e=>(f=u,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,o.addEvent)(e,u.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,o.removeEvent)(t,p.move,this.handleDrag),(0,o.removeEvent)(t,u.move,this.handleDrag),(0,o.removeEvent)(t,p.stop,this.handleDragStop),(0,o.removeEvent)(t,u.stop,this.handleDragStop),(0,o.removeEvent)(e,u.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,o.removeUserSelectStyles)(t)}}findDOMNode(){var e,t;return null!==(e=this.props)&&void 0!==e&&e.nodeRef?null===(t=this.props)||void 0===t||null===(t=t.nodeRef)||void 0===t?void 0:t.current:r.default.findDOMNode(this)}render(){return e.cloneElement(e.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return Fp.default=m,d(m,"displayName","DraggableCore"),d(m,"propTypes",{allowAnyClick:n.default.bool,children:n.default.node.isRequired,disabled:n.default.bool,enableUserSelectHack:n.default.bool,offsetParent:function(e,t){if(e[t]&&1!==e[t].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:n.default.arrayOf(n.default.number),handle:n.default.string,cancel:n.default.string,nodeRef:n.default.object,onStart:n.default.func,onDrag:n.default.func,onStop:n.default.func,onMouseDown:n.default.func,scale:n.default.number,className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),d(m,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Fp}function Vp(){return $p||($p=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return c.default}}),e.default=void 0;var n=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,n&&n.set(e,r);return r}(t),r=u(Qu()),o=u(b),i=u(Op),a=Dp(),s=zp(),l=Np(),c=u(Hp()),d=u(Bp());function u(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class h extends n.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:r}=t;return!n||r&&n.x===r.x&&n.y===r.y?null:((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:{...n}})}constructor(e){super(e),m(this,"onDragStart",(e,t)=>{(0,d.default)("Draggable: onDragStart: %j",t);if(!1===this.props.onStart(e,(0,s.createDraggableData)(this,t)))return!1;this.setState({dragging:!0,dragged:!0})}),m(this,"onDrag",(e,t)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",t);const n=(0,s.createDraggableData)(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){const{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;const[o,i]=(0,s.getBoundPosition)(this,r.x,r.y);r.x=o,r.y=i,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(!1===this.props.onDrag(e,n))return!1;this.setState(r)}),m(this,"onDragStop",(e,t)=>{if(!this.state.dragging)return!1;if(!1===this.props.onStop(e,(0,s.createDraggableData)(this,t)))return!1;(0,d.default)("Draggable: onDragStop: %j",t);const n={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){const{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)}),this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},!e.position||e.onDrag||e.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var e,t;return null!==(e=null===(t=this.props)||void 0===t||null===(t=t.nodeRef)||void 0===t?void 0:t.current)&&void 0!==e?e:o.default.findDOMNode(this)}render(){const{axis:e,bounds:t,children:r,defaultPosition:o,defaultClassName:l,defaultClassNameDragging:d,defaultClassNameDragged:u,position:p,positionOffset:m,scale:h,...g}=this.props;let v={},b=null;const y=!Boolean(p)||this.state.dragging,w=p||o,E={x:(0,s.canDragX)(this)&&y?this.state.x:w.x,y:(0,s.canDragY)(this)&&y?this.state.y:w.y};this.state.isElementSVG?b=(0,a.createSVGTransform)(E,m):v=(0,a.createCSSTransform)(E,m);const x=(0,i.default)(r.props.className||"",l,{[d]:this.state.dragging,[u]:this.state.dragged});return n.createElement(c.default,f({},g,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),n.cloneElement(n.Children.only(r),{className:x,style:{...r.props.style,...v},transform:b}))}}e.default=h,m(h,"displayName","Draggable"),m(h,"propTypes",{...c.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),m(h,"defaultProps",{...c.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(Ep)),Ep}var Up=function(){if(jp)return wp.exports;jp=1;const{default:e,DraggableCore:t}=Vp();return wp.exports=e,wp.exports.default=e,wp.exports.DraggableCore=t,wp.exports}(),Yp=He(Up),Gp=function(){return Gp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Gp.apply(this,arguments)},qp={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},Xp={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},Kp={width:"20px",height:"20px",position:"absolute",zIndex:1},Zp={top:Gp(Gp({},qp),{top:"-5px"}),right:Gp(Gp({},Xp),{left:void 0,right:"-5px"}),bottom:Gp(Gp({},qp),{top:void 0,bottom:"-5px"}),left:Gp(Gp({},Xp),{left:"-5px"}),topRight:Gp(Gp({},Kp),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Gp(Gp({},Kp),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Gp(Gp({},Kp),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Gp(Gp({},Kp),{left:"-10px",top:"-10px",cursor:"nw-resize"})},Jp=p(function(e){var t=e.onResizeStart,n=e.direction,r=e.children,o=e.replaceStyles,i=e.className,a=d(function(e){t(e,n)},[t,n]),s=d(function(e){t(e,n)},[t,n]),l=u(function(){return Gp(Gp({position:"absolute",userSelect:"none"},Zp[n]),null!=o?o:{})},[o,n]);return m("div",{className:i||void 0,style:l,onMouseDown:a,onTouchStart:s,children:r})}),Qp=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ef=function(){return ef=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ef.apply(this,arguments)},tf={width:"auto",height:"auto"},nf=function(e,t,n){return Math.max(Math.min(e,n),t)},rf=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},of=function(e,t){return new RegExp(e,"i").test(t)},af=function(e){return Boolean(e.touches&&e.touches.length)},sf=function(e,t,n){void 0===n&&(n=0);var r=t.reduce(function(n,r,o){return Math.abs(r-e)<Math.abs(t[n]-e)?o:n},0),o=Math.abs(t[r]-e);return 0===n||o<n?t[r]:e},lf=function(e){return"auto"===(e=e.toString())||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:"".concat(e,"px")},cf=function(e,t,n,r){if(e&&"string"==typeof e){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%"))return t*(Number(e.replace("%",""))/100);if(e.endsWith("vw"))return n*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return r*(Number(e.replace("vh",""))/100)}return e},df=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],uf="__resizable_base__",pf=function(e){function t(t){var n,r,o,i,a=e.call(this,t)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.delta={width:0,height:0},a.appendBase=function(){if(!a.resizable||!a.window)return null;var e=a.parentNode;if(!e)return null;var t=a.window.document.createElement("div");return t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.transform="scale(0, 0)",t.style.left="0",t.style.flex="0 0 100%",t.classList?t.classList.add(uf):t.className+=uf,e.appendChild(t),t},a.removeBase=function(e){var t=a.parentNode;t&&t.removeChild(e)},a.state={isResizing:!1,width:null!==(r=null===(n=a.propsSize)||void 0===n?void 0:n.width)&&void 0!==r?r:"auto",height:null!==(i=null===(o=a.propsSize)||void 0===o?void 0:o.height)&&void 0!==i?i:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Qp(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||tf},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var n=this.resizable.offsetWidth,r=this.resizable.offsetHeight,o=this.resizable.style.position;"relative"!==o&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:n,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:r,this.resizable.style.position=o}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,n=function(t){var n;if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&(null===(n=e.propsSize[t])||void 0===n?void 0:n.toString().endsWith("%"))){if(e.state[t].toString().endsWith("%"))return e.state[t].toString();var r=e.getParentSize(),o=Number(e.state[t].toString().replace("px",""))/r[t]*100;return"".concat(o,"%")}return lf(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?lf(t.width):n("width"),height:t&&void 0!==t.height&&!this.state.isResizing?lf(t.height):n("height")}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,n=this.parentNode.style.flexWrap;"wrap"!==n&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var r={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=n),this.removeBase(e),r},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable&&this.window){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var n=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==n&&"auto"!==n?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var n,r,o=this.props.boundsByDirection,i=this.state.direction,a=o&&of("left",i),s=o&&of("top",i);if("parent"===this.props.bounds){var l=this.parentNode;l&&(n=a?this.resizableRight-this.parentLeft:l.offsetWidth+(this.parentLeft-this.resizableLeft),r=s?this.resizableBottom-this.parentTop:l.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(n=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,r=s?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(n=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),r=s?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return n&&Number.isFinite(n)&&(e=e&&e<n?e:n),r&&Number.isFinite(r)&&(t=t&&t<r?t:r),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var n,r=this.props.scale||1,o=(n=this.props.resizeRatio||1,Array.isArray(n)?n:[n,n]),i=o[0],a=o[1],s=this.state,l=s.direction,c=s.original,d=this.props,u=d.lockAspectRatio,p=d.lockAspectRatioExtraHeight,f=d.lockAspectRatioExtraWidth,m=c.width,h=c.height,g=p||0,v=f||0;return of("right",l)&&(m=c.width+(e-c.x)*i/r,u&&(h=(m-v)/this.ratio+g)),of("left",l)&&(m=c.width-(e-c.x)*i/r,u&&(h=(m-v)/this.ratio+g)),of("bottom",l)&&(h=c.height+(t-c.y)*a/r,u&&(m=(h-g)*this.ratio+v)),of("top",l)&&(h=c.height-(t-c.y)*a/r,u&&(m=(h-g)*this.ratio+v)),{newWidth:m,newHeight:h}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,n,r){var o=this.props,i=o.lockAspectRatio,a=o.lockAspectRatioExtraHeight,s=o.lockAspectRatioExtraWidth,l=void 0===r.width?10:r.width,c=void 0===n.width||n.width<0?e:n.width,d=void 0===r.height?10:r.height,u=void 0===n.height||n.height<0?t:n.height,p=a||0,f=s||0;if(i){var m=(d-p)*this.ratio+f,h=(u-p)*this.ratio+f,g=(l-f)/this.ratio+p,v=(c-f)/this.ratio+p,b=Math.max(l,m),y=Math.min(c,h),w=Math.max(d,g),E=Math.min(u,v);e=nf(e,b,y),t=nf(t,w,E)}else e=nf(e,l,c),t=nf(t,d,u);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){var e=1/(this.props.scale||1);if("parent"===this.props.bounds){var t=this.parentNode;if(t){var n=t.getBoundingClientRect();this.parentLeft=n.left*e,this.parentTop=n.top*e}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var r=this.props.bounds.getBoundingClientRect();this.targetLeft=r.left*e,this.targetTop=r.top*e}if(this.resizable){var o=this.resizable.getBoundingClientRect(),i=o.left,a=o.top,s=o.right,l=o.bottom;this.resizableLeft=i*e,this.resizableRight=s*e,this.resizableTop=a*e,this.resizableBottom=l*e}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var n,r=0,o=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(r=e.nativeEvent.clientX,o=e.nativeEvent.clientY):e.nativeEvent&&af(e.nativeEvent)&&(r=e.nativeEvent.touches[0].clientX,o=e.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var i=this.window.getComputedStyle(this.resizable);if("auto"!==i.flexBasis){var a=this.parentNode;if(a){var s=this.window.getComputedStyle(a).flexDirection;this.flexDir=s.startsWith("row")?"row":"column",n=i.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var l={original:{x:r,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:ef(ef({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:n};this.setState(l)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&af(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var n=this.props,r=n.maxWidth,o=n.maxHeight,i=n.minWidth,a=n.minHeight,s=af(e)?e.touches[0].clientX:e.clientX,l=af(e)?e.touches[0].clientY:e.clientY,c=this.state,d=c.direction,u=c.original,p=c.width,f=c.height,m=this.getParentSize(),h=function(e,t,n,r,o,i,a){return r=cf(r,e.width,t,n),o=cf(o,e.height,t,n),i=cf(i,e.width,t,n),a=cf(a,e.height,t,n),{maxWidth:void 0===r?void 0:Number(r),maxHeight:void 0===o?void 0:Number(o),minWidth:void 0===i?void 0:Number(i),minHeight:void 0===a?void 0:Number(a)}}(m,this.window.innerWidth,this.window.innerHeight,r,o,i,a);r=h.maxWidth,o=h.maxHeight,i=h.minWidth,a=h.minHeight;var g=this.calculateNewSizeFromDirection(s,l),v=g.newHeight,b=g.newWidth,y=this.calculateNewMaxFromBoundary(r,o);this.props.snap&&this.props.snap.x&&(b=sf(b,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=sf(v,this.props.snap.y,this.props.snapGap));var E=this.calculateNewSizeFromAspectRatio(b,v,{width:y.maxWidth,height:y.maxHeight},{width:i,height:a});if(b=E.newWidth,v=E.newHeight,this.props.grid){var x=rf(b,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),S=rf(v,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),T=this.props.snapGap||0;b=0===T||Math.abs(x-b)<=T?x:b,v=0===T||Math.abs(S-v)<=T?S:v}var O={width:b-u.width,height:v-u.height};if(this.delta=O,p&&"string"==typeof p)if(p.endsWith("%")){var C=b/m.width*100;b="".concat(C,"%")}else if(p.endsWith("vw")){var P=b/this.window.innerWidth*100;b="".concat(P,"vw")}else if(p.endsWith("vh")){var N=b/this.window.innerHeight*100;b="".concat(N,"vh")}if(f&&"string"==typeof f)if(f.endsWith("%")){C=v/m.height*100;v="".concat(C,"%")}else if(f.endsWith("vw")){P=v/this.window.innerWidth*100;v="".concat(P,"vw")}else if(f.endsWith("vh")){N=v/this.window.innerHeight*100;v="".concat(N,"vh")}var k={width:this.createSizeForCssProperty(b,"width"),height:this.createSizeForCssProperty(v,"height")};"row"===this.flexDir?k.flexBasis=k.width:"column"===this.flexDir&&(k.flexBasis=k.height);var M=this.state.width!==k.width,I=this.state.height!==k.height,D=this.state.flexBasis!==k.flexBasis,R=M||I||D;R&&w(function(){t.setState(k)}),this.props.onResize&&R&&this.props.onResize(e,d,this.resizable,O)}},t.prototype.onMouseUp=function(e){var t,n,r=this.state,o=r.isResizing,i=r.direction;r.original,o&&this.resizable&&(this.props.onResizeStop&&this.props.onResizeStop(e,i,this.resizable,this.delta),this.props.size&&this.setState({width:null!==(t=this.props.size.width)&&void 0!==t?t:"auto",height:null!==(n=this.props.size.height)&&void 0!==n?n:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:ef(ef({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(e){var t,n;this.setState({width:null!==(t=e.width)&&void 0!==t?t:"auto",height:null!==(n=e.height)&&void 0!==n?n:"auto"})},t.prototype.renderResizer=function(){var e=this,t=this.props,n=t.enable,r=t.handleStyles,o=t.handleClasses,i=t.handleWrapperStyle,a=t.handleWrapperClass,s=t.handleComponent;if(!n)return null;var l=Object.keys(n).map(function(t){return!1!==n[t]?m(Jp,{direction:t,onResizeStart:e.onResizeStart,replaceStyles:r&&r[t],className:o&&o[t],children:s&&s[t]?s[t]:null},t):null});return m("div",{className:a,style:i,children:l})},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce(function(t,n){return-1!==df.indexOf(n)||(t[n]=e.props[n]),t},{}),n=ef(ef(ef({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(n.flexBasis=this.state.flexBasis);var r=this.props.as||"div";return g(r,ef({style:n,className:this.props.className},t,{ref:function(t){t&&(e.resizable=t)},children:[this.state.isResizing&&m("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(f),ff=function(e,t){return ff=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},ff(e,t)};var mf=function(){return mf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mf.apply(this,arguments)};var hf={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},gf=function(e){function t(t){var n=e.call(this,t)||this;return n.resizingPosition={x:0,y:0},n.offsetFromParent={left:0,top:0},n.resizableElement={current:null},n.originalPosition={x:0,y:0},n.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:t.maxWidth,maxHeight:t.maxHeight},n.onResizeStart=n.onResizeStart.bind(n),n.onResize=n.onResize.bind(n),n.onResizeStop=n.onResizeStop.bind(n),n.onDragStart=n.onDragStart.bind(n),n.onDrag=n.onDrag.bind(n),n.onDragStop=n.onDragStop.bind(n),n.getMaxSizesFromProps=n.getMaxSizesFromProps.bind(n),n}return function(e,t){function n(){this.constructor=e}ff(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var e=this.offsetFromParent,t=e.left,n=e.top,r=this.getDraggablePosition(),o=r.x,i=r.y;this.draggable.setState({x:o-t,y:i-n}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var e=this.draggable.state;return{x:e.x,y:e.y}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){return{maxWidth:void 0===this.props.maxWidth?Number.MAX_SAFE_INTEGER:this.props.maxWidth,maxHeight:void 0===this.props.maxHeight?Number.MAX_SAFE_INTEGER:this.props.maxHeight}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(e){var t=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/t;case"body":return document.body.offsetHeight/t;default:return e.offsetHeight}},t.prototype.getOffsetWidth=function(e){var t=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/t;case"body":return document.body.offsetWidth/t;default:return e.offsetWidth}},t.prototype.onDragStart=function(e,t){this.props.onDragStart&&this.props.onDragStart(e,t);var n=this.getDraggablePosition();if(this.originalPosition=n,this.props.bounds){var r,o=this.getParent(),i=this.props.scale;if("parent"===this.props.bounds)r=o;else{if("body"===this.props.bounds){var a=o.getBoundingClientRect(),s=a.left,l=a.top,c=document.body.getBoundingClientRect(),d=-(s-o.offsetLeft*i-c.left)/i,u=-(l-o.offsetTop*i-c.top)/i,p=(document.body.offsetWidth-this.resizable.size.width*i)/i+d,f=(document.body.offsetHeight-this.resizable.size.height*i)/i+u;return this.setState({bounds:{top:u,right:p,bottom:f,left:d}})}if("window"===this.props.bounds){if(!this.resizable)return;var m=o.getBoundingClientRect(),h=m.left,g=m.top,v=-(h-o.offsetLeft*i)/i,b=-(g-o.offsetTop*i)/i;p=(window.innerWidth-this.resizable.size.width*i)/i+v,f=(window.innerHeight-this.resizable.size.height*i)/i+b;return this.setState({bounds:{top:b,right:p,bottom:f,left:v}})}"string"==typeof this.props.bounds?r=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(r=this.props.bounds)}if(r instanceof HTMLElement&&o instanceof HTMLElement){var y=r.getBoundingClientRect(),w=y.left,E=y.top,x=o.getBoundingClientRect(),S=(w-x.left)/i,T=E-x.top;if(this.resizable){this.updateOffsetFromParent();var O=this.offsetFromParent;this.setState({bounds:{top:T-O.top,right:S+(r.offsetWidth-this.resizable.size.width)-O.left/i,bottom:T+(r.offsetHeight-this.resizable.size.height)-O.top,left:S-O.left/i}})}}}},t.prototype.onDrag=function(e,t){if(this.props.onDrag){var n=this.offsetFromParent,r=n.left,o=n.top;return this.props.dragAxis&&"both"!==this.props.dragAxis?"x"===this.props.dragAxis?this.props.onDrag(e,mf(mf({},t),{x:t.x+r,y:this.originalPosition.y+o,deltaY:0})):"y"===this.props.dragAxis?this.props.onDrag(e,mf(mf({},t),{x:this.originalPosition.x+r,y:t.y+o,deltaX:0})):void 0:this.props.onDrag(e,mf(mf({},t),{x:t.x+r,y:t.y+o}))}},t.prototype.onDragStop=function(e,t){if(this.props.onDragStop){var n=this.offsetFromParent,r=n.left,o=n.top;return this.props.dragAxis&&"both"!==this.props.dragAxis?"x"===this.props.dragAxis?this.props.onDragStop(e,mf(mf({},t),{x:t.x+r,y:this.originalPosition.y+o,deltaY:0})):"y"===this.props.dragAxis?this.props.onDragStop(e,mf(mf({},t),{x:this.originalPosition.x+r,y:t.y+o,deltaX:0})):void 0:this.props.onDragStop(e,mf(mf({},t),{x:t.x+r,y:t.y+o}))}},t.prototype.onResizeStart=function(e,t,n){e.stopPropagation(),this.setState({resizing:!0});var r=this.props.scale,o=this.offsetFromParent,i=this.getDraggablePosition();if(this.resizingPosition={x:i.x+o.left,y:i.y+o.top},this.originalPosition=i,this.props.bounds){var a=this.getParent(),s=void 0;"parent"===this.props.bounds?s=a:"body"===this.props.bounds?s=document.body:"window"===this.props.bounds?s=window:"string"==typeof this.props.bounds?s=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(s=this.props.bounds);var l=this.getSelfElement();if(l instanceof Element&&(s instanceof HTMLElement||s===window)&&a instanceof HTMLElement){var c=this.getMaxSizesFromProps(),d=c.maxWidth,u=c.maxHeight,p=this.getParentSize();if(d&&"string"==typeof d)if(d.endsWith("%")){var f=Number(d.replace("%",""))/100;d=p.width*f}else d.endsWith("px")&&(d=Number(d.replace("px","")));if(u&&"string"==typeof u)if(u.endsWith("%")){f=Number(u.replace("%",""))/100;u=p.height*f}else u.endsWith("px")&&(u=Number(u.replace("px","")));var m=l.getBoundingClientRect(),h=m.left,g=m.top,v="window"===this.props.bounds?{left:0,top:0}:s.getBoundingClientRect(),b=v.left,y=v.top,w=this.getOffsetWidth(s),E=this.getOffsetHeight(s),x=t.toLowerCase().endsWith("left"),S=t.toLowerCase().endsWith("right"),T=t.startsWith("top"),O=t.startsWith("bottom");if((x||T)&&this.resizable){var C=(h-b)/r+this.resizable.size.width;this.setState({maxWidth:C>Number(d)?d:C})}if(S||this.props.lockAspectRatio&&!x&&!T){C=w+(b-h)/r;this.setState({maxWidth:C>Number(d)?d:C})}if((T||x)&&this.resizable){C=(g-y)/r+this.resizable.size.height;this.setState({maxHeight:C>Number(u)?u:C})}if(O||this.props.lockAspectRatio&&!T&&!x){C=E+(y-g)/r;this.setState({maxHeight:C>Number(u)?u:C})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(e,t,n)},t.prototype.onResize=function(e,t,n,r){var o=this,i={x:this.originalPosition.x,y:this.originalPosition.y},a=-r.width,s=-r.height;["top","left","topLeft","bottomLeft","topRight"].includes(t)&&("bottomLeft"===t?i.x+=a:("topRight"===t||(i.x+=a),i.y+=s));var l=this.draggable.state;i.x===l.x&&i.y===l.y||w(function(){o.draggable.setState(i)}),this.updateOffsetFromParent();var c=this.offsetFromParent,d=this.getDraggablePosition().x+c.left,u=this.getDraggablePosition().y+c.top;this.resizingPosition={x:d,y:u},this.props.onResize&&this.props.onResize(e,t,n,r,{x:d,y:u})},t.prototype.onResizeStop=function(e,t,n,r){this.setState({resizing:!1});var o=this.getMaxSizesFromProps(),i=o.maxWidth,a=o.maxHeight;this.setState({maxWidth:i,maxHeight:a}),this.props.onResizeStop&&this.props.onResizeStop(e,t,n,r,this.resizingPosition)},t.prototype.updateSize=function(e){this.resizable&&this.resizable.updateSize({width:e.width,height:e.height})},t.prototype.updatePosition=function(e){this.draggable.setState(e)},t.prototype.updateOffsetFromParent=function(){var e=this.props.scale,t=this.getParent(),n=this.getSelfElement();if(!t||null===n)return{top:0,left:0};var r=t.getBoundingClientRect(),o=r.left,i=r.top,a=n.getBoundingClientRect(),s=this.getDraggablePosition(),l=t.scrollLeft,c=t.scrollTop;this.offsetFromParent={left:a.left-o+l-s.x*e,top:a.top-i+c-s.y*e}},t.prototype.render=function(){var e=this,t=this.props,n=t.disableDragging,r=t.style,o=t.dragHandleClassName,a=t.position,s=t.onMouseDown,l=t.onMouseUp,c=t.dragAxis,d=t.dragGrid,u=t.bounds,p=t.enableUserSelectHack,f=t.cancel,m=t.children;t.onResizeStart,t.onResize,t.onResizeStop,t.onDragStart,t.onDrag,t.onDragStop;var h=t.resizeHandleStyles,g=t.resizeHandleClasses,v=t.resizeHandleComponent,b=t.enableResizing,y=t.resizeGrid,w=t.resizeHandleWrapperClass,E=t.resizeHandleWrapperStyle,x=t.scale,S=t.allowAnyClick,T=t.dragPositionOffset,O=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","bounds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),C=this.props.default?mf({},this.props.default):void 0;delete O.default;var P,N=n||o?{cursor:"auto"}:{cursor:"move"},k=mf(mf(mf({},hf),N),r),M=this.offsetFromParent,I=M.left,D=M.top;a&&(P={x:a.x-I,y:a.y-D});var R,A=this.state.resizing?void 0:P,z=this.state.resizing?"both":c;return i(Yp,{ref:function(t){t&&(e.draggable=t)},handle:o?".".concat(o):void 0,defaultPosition:C,onMouseDown:s,onMouseUp:l,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:z,disabled:n,grid:d,bounds:u?this.state.bounds:void 0,position:A,enableUserSelectHack:p,cancel:f,scale:x,allowAnyClick:S,nodeRef:this.resizableElement,positionOffset:T},i(pf,mf({},O,{ref:function(t){t&&(e.resizable=t,e.resizableElement.current=t.resizable)},defaultSize:C,size:this.props.size,enable:"boolean"==typeof b?(R=b,{bottom:R,bottomLeft:R,bottomRight:R,left:R,right:R,top:R,topLeft:R,topRight:R}):b,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:k,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:y,handleWrapperClass:w,handleWrapperStyle:E,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:h,handleClasses:g,handleComponent:v,scale:this.props.scale}),m))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t}(f);const vf=({shortform:e,setClose:n})=>{const[o,i]=t.useState(!0),[s,l]=a(!0),[c,d]=a(!1),u=t.useRef(null),p=()=>{u.current&&(window.clearTimeout(u.current),u.current=null)},f=(e=1500)=>{p(),u.current=window.setTimeout(()=>d(!1),e)};return r(()=>()=>p(),[]),t.createElement("div",{className:"relative w-full h-full",onClick:()=>{d(!0),f(2e3)},onMouseLeave:()=>f(800),onMouseEnter:()=>c&&f(1500)},t.createElement("div",{className:"absolute inset-0 bg-black",style:{zIndex:1,opacity:c?.4:0,transition:"opacity 300ms ease",pointerEvents:c?"auto":"none"}}),t.createElement("div",{className:"absolute inset-0",style:{zIndex:2,opacity:c?1:0,transition:"opacity 300ms ease",pointerEvents:c?"auto":"none"}},t.createElement("div",{className:"absolute text-white flex gap-2",style:{zIndex:3,top:8,right:8}},t.createElement("button",{className:"cursor-pointer",onClick:e=>{e.stopPropagation(),i(e=>!e)},"aria-label":o?"Unmute":"Mute"},o?t.createElement(Xt,{size:20}):t.createElement(qt,{size:20})),t.createElement("button",{className:"cursor-pointer",onClick:e=>{null==e||e.stopPropagation(),n()},"aria-label":"Close"},t.createElement(Kt,{size:20}))),t.createElement("div",{className:"absolute inset-0 flex items-center justify-center",style:{pointerEvents:"none"}},t.createElement("button",{onClick:e=>{null==e||e.stopPropagation(),l(e=>!e)},"aria-label":s?"Pause":"Play",className:"cursor-pointer text-white p-2 ",style:{pointerEvents:"auto"}},s?t.createElement(Ut,{size:28}):t.createElement(Yt,{size:28})))),t.createElement(Dt,{shortform:e,mute:o,play:s}))},bf=({shortsId:e,type:n})=>{const{shortform:o}=yp(),[i,s]=a(!1),{playtime:l}=Li(),c=()=>{if(!o)return;s(!0);const{shortsId:e,uuid:t,userId:n}=o;Fi({contentId:e,uuid:t,type:wt.SHORTS,playtime:l,userId:n})};return(({shorform:e,playtime:t})=>{r(()=>{if(!e)return;const{shortsId:t,shortsUuid:n,userId:r}=e;ji({contentId:t,uuid:n,type:wt.SHORTS,userId:r,isFirstPlay:!Pt(t)})},[]);const n=zi();r(()=>{if(!e||n)return;const{shortsId:r,uuid:o,userId:i}=e;Fi({contentId:r,uuid:o,type:wt.SHORTS,playtime:t,userId:i})},[n])})({shorform:o,playtime:l}),o&&!i&&t.createElement(gf,{minWidth:240,lockAspectRatio:9/16,style:{zIndex:99999},default:{width:240,height:427,x:window.innerWidth-240-50,y:window.innerHeight-427-50},bounds:"window"},"shopping"===n?t.createElement(kc,{shortForm:o,handleClose:c}):t.createElement(vf,{shortform:o,setClose:c}))},yf=({shortsId:e,type:n,isPreview:o})=>{const{setShortform:i,shortform:s}=yp();r(()=>{if(!e)return;e&&T(void 0,void 0,void 0,function*(){const t=yield Ui(e,o);t&&i(Object.assign(Object.assign({},t),{uuid:Ct()}))})},[e]);const[l,c]=a("");r(()=>{T(void 0,void 0,void 0,function*(){function e(e){return T(this,void 0,void 0,function*(){const t=yield fetch(e);if(!t.ok)throw new Error(String(t.status));return t.text()})}let t="";try{t=yield e("https://unpkg.com/@kinxcdn/commerce-player@latest/dist/styles.css")}catch(n){t=yield e("https://mbus-player-sy.s3.ap-northeast-2.amazonaws.com/styles.css")}c(t)}).catch(()=>console.error("Failed to load styles.css"))},[]);const{container:d}=fp({cssHref:"https://unpkg.com/@kinxcdn/commerce-player@latest/dist/styles.css"});return d&&l&&s&&t.createElement(pp.div,null,t.createElement("style",null,l),t.createElement("div",null,t.createElement(bf,{shortsId:e,type:n})))},wf=Ji(e=>({liveWidget:null,setLiveWidget:t=>e({liveWidget:t}),nextKey:"",setNextKey:t=>e({nextKey:t}),isFetching:!1,setIsFetching:t=>e({isFetching:t})})),Ef=({opacity:e=.4,className:n})=>{const r=Math.max(0,Math.min(1,e));return t.createElement("div",{"aria-hidden":!0,role:"presentation",className:`absolute inset-0 pointer-events-none ${null!=n?n:""}`,style:{backgroundColor:`rgba(0,0,0,${r})`,borderRadius:"inherit"}})},xf=({content:e})=>{const{PLAYER_BASE_URL:n}=gt();return t.createElement("iframe",{src:`${n}/live/${e.eventId}`,className:"w-full h-full block",style:{border:0,display:"block"},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,scrolling:"no",referrerPolicy:"no-referrer-when-downgrade"})},Sf=({content:e,aspectRatio:n="9/16",cursor:r="default",borderRadius:o})=>{var i,s;const{leftTime:l}=(e=>{const{start:t}=e,n=Xe().tz("Asia/Seoul").unix(),[r,o]=a(t-n>0?t-n:0);return _i(()=>{o(r<=0?0:e=>e-1)},1e3),{leftTime:r}})(e),c=null===(s=null===(i=null==e?void 0:e.designInfo)||void 0===i?void 0:i.thumbPath)||void 0===s?void 0:s.preview,d=t.useRef(null),[u,p]=t.useState({primary:24,secondary:14}),[f,m]=t.useState({});t.useEffect(()=>{const e=d.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect(),r=Math.max(0,Math.floor(t.width)),o=Math.max(0,Math.floor(t.height)),[i,a]=n.includes("/")?n.split("/").map(e=>parseFloat(e)):[1,1],s=a/i;let l,c;r>0&&o>0?(l=r,c=Math.round(l*s),c>o&&(c=o,l=Math.round(c/s)),m({width:l,height:c})):m({});const d="number"==typeof l?l:r,u=Math.max(16,Math.round(.08*d)),f=Math.max(12,Math.round(.045*d));p({primary:u,secondary:f})};if(t(),"undefined"!=typeof ResizeObserver){const n=new ResizeObserver(()=>t());return n.observe(e),()=>n.disconnect()}{const e=()=>t();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}},[n]);const{PLAYER_BASE_URL:h}=gt();return t.createElement("div",{className:"w-full h-full flex items-center justify-center",ref:d},t.createElement("div",{className:"relative rounded overflow-hidden",style:{width:f.width?`${f.width}px`:"100%",height:f.height?`${f.height}px`:"100%",borderRadius:`${null!=o?o:10}px`,backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:f.height?void 0:n,backgroundImage:c?`url(${kt(c)})`:void 0,backgroundColor:c?void 0:"black"}},1===e.openStatus?t.createElement(t.Fragment,null,t.createElement(xf,{content:e}),t.createElement("a",{href:`${h}/live/${e.eventId}`,target:"_blank",rel:"noopener noreferrer","aria-label":`${e.eventName} 바로가기`,style:{position:"absolute",inset:0,zIndex:30,display:"block",textDecoration:"none",cursor:"pointer",background:"transparent"}})):t.createElement(t.Fragment,null,t.createElement(Ef,null),t.createElement("div",{className:"text-white flex flex-col items-center justify-center absolute inset-0",style:{zIndex:10,gap:"20px",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",cursor:r,pointerEvents:"none"}},t.createElement("p",{style:{fontSize:`${u.primary}px`}},((e,t)=>{if(e>86400)return Xe.unix(t).tz("Asia/Seoul").format("M월 D일 A h시 mm분");const n=Xe.duration(e,"seconds");return`${n.hours().toString().padStart(2,"0")}:${n.minutes().toString().padStart(2,"0")}:${n.seconds().toString().padStart(2,"0")}`})(l,e.start)),t.createElement("p",{style:{fontSize:`${u.secondary}px`}},"곧 라이브가 시작됩니다!")))))},Tf=e=>{var n,r,o,i;const{content:a,title:s,aspectRatio:l="9/16",card:c,titleFontSize:d,layout:p}=e,f=null!==(n=null==c?void 0:c.layout)&&void 0!==n?n:"slider",m=null!==(r=null==c?void 0:c.sliderPerView)&&void 0!==r?r:3,h=null!==(o=null==c?void 0:c.gridColumns)&&void 0!==o?o:3,g=null!==(i=null==c?void 0:c.gap)&&void 0!==i?i:12,v=null==c?void 0:c.width,b=v?"auto":m,y=u(()=>({fontSize:d?`${d}px`:void 0,fontWeight:600}),[d]);return a&&0!==a.length?t.createElement("div",{className:"flex flex-col w-full",style:{gap:g}},t.createElement("p",{className:"truncate",style:Object.assign(Object.assign({},y),{userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",cursor:"default"})},s||"예정된 라이브"),"slider"===f?t.createElement("div",null,t.createElement(ci,{slidesPerView:b,spaceBetween:g},a.map(n=>{var r,o;return t.createElement(di,{key:n.eventId,style:v?{width:`${v}px`}:void 0},t.createElement("a",{href:`https://player.midibus.im/live/${n.eventId}`,target:"_blank",rel:"noopener noreferrer",className:"flex flex-col",style:{gap:6,textDecoration:"none",cursor:"pointer"}},t.createElement(Sf,{content:n,aspectRatio:l,cursor:"pointer",borderRadius:null==c?void 0:c.borderRadius}),t.createElement("p",{className:"truncate",style:{color:null!==(o=null===(r=e.theme)||void 0===r?void 0:r.textColor)&&void 0!==o?o:"black",fontSize:14,userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"}},n.eventName)))}))):t.createElement("div",{style:{overflowY:"auto"}},t.createElement("div",{style:{display:"grid",gridTemplateColumns:`repeat(${h}, minmax(0, 1fr))`,gap:g}},a.map(n=>{var r,o;return t.createElement("a",{key:n.eventId,href:`https://player.midibus.im/live/${n.eventId}`,target:"_blank",rel:"noopener noreferrer",className:"flex flex-col",style:{gap:6,textDecoration:"none",cursor:"pointer"}},t.createElement(Sf,{content:n,aspectRatio:l,cursor:"pointer",borderRadius:null==c?void 0:c.borderRadius}),t.createElement("p",{className:"truncate",style:{color:null!==(o=null===(r=e.theme)||void 0===r?void 0:r.textColor)&&void 0!==o?o:"black",fontSize:14,userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"}},n.eventName))})))):null};var Of;!function(e){e[e.READY=1]="READY",e[e.STREAMING=2]="STREAMING",e[e.PAUSED=3]="PAUSED"}(Of||(Of={}));const Cf=({content:e})=>{const n=t.useMemo(()=>Xe(e.start).tz("Asia/Seoul").format("M월 D일 A HH:mm"),[e.start]),r=e.eventStatus!==Of.READY;return t.createElement("div",{className:"flex-1 flex flex-col gap-5 items-center justify-center"},t.createElement("p",{style:{fontWeight:"bold",fontSize:"24px"}},e.eventName),!r&&t.createElement("p",null,n),t.createElement("button",{onClick:()=>{window.open(`https://player.midibus.im/live/${e.eventId}`,"_blank")},className:"rounded bg-black text-white cursor-pointer",style:{width:"70%",padding:"10px"}},"라이브 입장하기"))},Pf=e=>{var n,r;const{content:o,aspectRatio:i="9/16",videoAlign:a}=e,s=null===(n=e.card)||void 0===n?void 0:n.borderRadius,l=null===(r=e.card)||void 0===r?void 0:r.width,{PLAYER_BASE_URL:c}=gt();return t.createElement("div",{className:"flex w-full h-full items-center justify-center"},"only"===a?t.createElement("a",{className:"w-full h-full",href:`${c}/live/${o.eventId}`,target:"_blank",rel:"noopener noreferrer",style:l?{width:`${l}px`}:void 0},t.createElement(Sf,{content:o,aspectRatio:i,borderRadius:s,cursor:"pointer"})):"left"===a?t.createElement(t.Fragment,null,t.createElement("div",{className:"flex-1"},t.createElement("a",{href:`${c}/live/${o.eventId}`,target:"_blank",rel:"noopener noreferrer",style:l?{width:`${l}px`}:void 0},t.createElement(Sf,{content:o,aspectRatio:i,borderRadius:s,cursor:"pointer"}))),t.createElement(Cf,{content:o})):t.createElement(t.Fragment,null,t.createElement(Cf,{content:o}),t.createElement("div",{className:"flex-1"},t.createElement("a",{href:`${c}/live/${o.eventId}`,target:"_blank",rel:"noopener noreferrer",style:l?{width:`${l}px`}:void 0},t.createElement(Sf,{content:o,aspectRatio:i,borderRadius:s,cursor:"pointer"})))))},Nf=e=>{var n;const{theme:r,titleFontSize:o,title:i}=e;return t.createElement("div",{className:"w-full h-full flex flex-col",style:{color:null!==(n=null==r?void 0:r.textColor)&&void 0!==n?n:"#252525"}},t.createElement("p",{style:Object.assign(Object.assign({},o&&{fontSize:o}),{fontWeight:"bold",color:null==r?void 0:r.textColor,paddingTop:"10px",paddingBottom:"10px",marginBottom:"30px"})},i," 라이브 제목"),t.createElement("div",{className:"self-center text-center h-full flex flex-col items-center justify-center",style:{minHeight:"200px"}},t.createElement("p",{style:{fontSize:"20px",marginBottom:"10px"}},"예정된 라이브가 없어요."),t.createElement("span",{style:{fontWeight:"lighter"}},"곧 혜택 가득한 라이브로 찾아올게요!")))},kf=e=>{var n,r,o,i;const{widgetType:a,theme:s,layout:l}=e,{liveWidget:c}=wf(),d=null!==(n=null==l?void 0:l.paddingTop)&&void 0!==n?n:0,u=null!==(r=null==l?void 0:l.paddingBottom)&&void 0!==r?r:0,p=null!==(o=null==l?void 0:l.paddingLeft)&&void 0!==o?o:0,f=null!==(i=null==l?void 0:l.paddingRight)&&void 0!==i?i:0;return c&&0!==c.length?t.createElement("div",{className:"w-full h-full",style:{backgroundColor:null==s?void 0:s.backgroundColor,color:null==s?void 0:s.textColor,paddingTop:d,paddingBottom:u,paddingLeft:p,paddingRight:f}},"ONE"===a?t.createElement(Pf,Object.assign({content:c[0]},e)):t.createElement(Tf,Object.assign({content:c},e))):t.createElement(Nf,Object.assign({},e))},Mf=()=>{const[e,t]=a("");return r(()=>{T(void 0,void 0,void 0,function*(){function e(e){return T(this,void 0,void 0,function*(){const t=yield fetch(e);if(!t.ok)throw new Error(String(t.status));return t.text()})}let n="";try{n+=(yield e("https://unpkg.com/@kinxcdn/commerce-player@latest/dist/styles.css"))}catch(t){n+=(yield e("https://mbus-player-sy.s3.ap-northeast-2.amazonaws.com/styles.css"))}t(n)}).catch(()=>console.error("Failed to load styles.css"))},[]),{cssText:e}},If=e=>{const{cssText:n}=Mf(),{setLiveWidget:o,liveWidget:i}=wf(),{userId:a,card:s,includeRepresentative:l}=e;return r(()=>{if(!a)return;if(i&&(null==s?void 0:s.visibleCount)&&i.length>Number(s.visibleCount))return void o(i.slice(0,null==s?void 0:s.visibleCount));T(void 0,void 0,void 0,function*(){const e=yield Yi(a,null==s?void 0:s.visibleCount);e&&o(l?e.slice(0,(null==s?void 0:s.visibleCount)||5):e.slice(1,(null==s?void 0:s.visibleCount)||5))})},[a,null==s?void 0:s.visibleCount]),n?t.createElement(pp.div,{className:"w-full h-full"},t.createElement("style",null,n),t.createElement(kf,Object.assign({},e))):null};export{bp as CollectionShowcase,yf as FloatingPlayer,If as LiveWidget,Dc as PreviewPlayer,Ic as ShoppingPlayer,Dt as ViewPlayer,hp as WidgetPlayer,ht as configure};
40
+ */function Yu(){if(_u)return Cu;_u=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return Cu=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(i,n){for(var s,a,o=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(i),l=1;l<arguments.length;l++){for(var d in s=Object(arguments[l]))t.call(s,d)&&(o[d]=s[d]);if(e){a=e(s);for(var c=0;c<a.length;c++)r.call(s,a[c])&&(o[a[c]]=s[a[c]])}}return o},Cu}function Ku(){if(Mu)return Ou;Mu=1;return Ou="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function qu(){return Fu?Nu:(Fu=1,Nu=Function.call.bind(Object.prototype.hasOwnProperty))}function Xu(){if(Bu)return $u;Bu=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=Ku(),r={},i=qu();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function n(n,s,a,o,l){if("production"!==process.env.NODE_ENV)for(var d in n)if(i(n,d)){var c;try{if("function"!=typeof n[d]){var u=Error((o||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}c=n[d](s,d,o,a,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((o||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in r)){r[c.message]=!0;var h=l?l():"";e("Failed "+a+" type: "+c.message+(null!=h?h:""))}}}return n.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},$u=n}function Qu(){if(zu)return Uu;zu=1;var e=Wu(),t=Yu(),r=Ku(),i=qu(),n=Xu(),s=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(s=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),Uu=function(o,l){var d="function"==typeof Symbol&&Symbol.iterator;var c="<<anonymous>>",u={array:m("array"),bigint:m("bigint"),bool:m("boolean"),func:m("function"),number:m("number"),object:m("object"),string:m("string"),symbol:m("symbol"),any:p(a),arrayOf:function(e){return p(function(t,i,n,s,a){if("function"!=typeof e)return new f("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var o=t[i];if(!Array.isArray(o))return new f("Invalid "+s+" `"+a+"` of type `"+y(o)+"` supplied to `"+n+"`, expected an array.");for(var l=0;l<o.length;l++){var d=e(o,l,n,s,a+"["+l+"]",r);if(d instanceof Error)return d}return null})},element:p(function(e,t,r,i,n){var s=e[t];return o(s)?null:new f("Invalid "+i+" `"+n+"` of type `"+y(s)+"` supplied to `"+r+"`, expected a single ReactElement.")}),elementType:p(function(t,r,i,n,s){var a=t[r];return e.isValidElementType(a)?null:new f("Invalid "+n+" `"+s+"` of type `"+y(a)+"` supplied to `"+i+"`, expected a single ReactElement type.")}),instanceOf:function(e){return p(function(t,r,i,n,s){if(!(t[r]instanceof e)){var a=e.name||c;return new f("Invalid "+n+" `"+s+"` of type `"+(((o=t[r]).constructor&&o.constructor.name?o.constructor.name:c)+"` supplied to `")+i+"`, expected instance of `"+a+"`.")}var o;return null})},node:p(function(e,t,r,i,n){return v(e[t])?null:new f("Invalid "+i+" `"+n+"` supplied to `"+r+"`, expected a ReactNode.")}),objectOf:function(e){return p(function(t,n,s,a,o){if("function"!=typeof e)return new f("Property `"+o+"` of component `"+s+"` has invalid PropType notation inside objectOf.");var l=t[n],d=y(l);if("object"!==d)return new f("Invalid "+a+" `"+o+"` of type `"+d+"` supplied to `"+s+"`, expected an object.");for(var c in l)if(i(l,c)){var u=e(l,c,s,a,o+"."+c,r);if(u instanceof Error)return u}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&s(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a;return p(function(t,r,i,n,s){for(var a=t[r],o=0;o<e.length;o++)if(h(a,e[o]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===b(t)?String(t):t});return new f("Invalid "+n+" `"+s+"` of value `"+String(a)+"` supplied to `"+i+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&s("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+E(n)+" at index "+t+"."),a}return p(function(t,n,s,a,o){for(var l=[],d=0;d<e.length;d++){var c=(0,e[d])(t,n,s,a,o,r);if(null==c)return null;c.data&&i(c.data,"expectedType")&&l.push(c.data.expectedType)}return new f("Invalid "+a+" `"+o+"` supplied to `"+s+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return p(function(t,i,n,s,a){var o=t[i],l=y(o);if("object"!==l)return new f("Invalid "+s+" `"+a+"` of type `"+l+"` supplied to `"+n+"`, expected `object`.");for(var d in e){var c=e[d];if("function"!=typeof c)return g(n,s,a,d,b(c));var u=c(o,d,n,s,a+"."+d,r);if(u)return u}return null})},exact:function(e){return p(function(n,s,a,o,l){var d=n[s],c=y(d);if("object"!==c)return new f("Invalid "+o+" `"+l+"` of type `"+c+"` supplied to `"+a+"`, expected `object`.");var u=t({},n[s],e);for(var h in u){var p=e[h];if(i(e,h)&&"function"!=typeof p)return g(a,o,l,h,b(p));if(!p)return new f("Invalid "+o+" `"+l+"` key `"+h+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(n[s],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=p(d,h,a,o,l+"."+h,r);if(m)return m}return null})}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function f(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function p(e){if("production"!==process.env.NODE_ENV)var t={},i=0;function n(n,a,o,d,u,h,p){if(d=d||c,h=h||o,p!==r){if(l){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=d+":"+o;!t[g]&&i<3&&(s("You are manually calling a React.PropTypes validation function for the `"+h+"` prop on `"+d+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[g]=!0,i++)}}return null==a[o]?n?null===a[o]?new f("The "+u+" `"+h+"` is marked as required in `"+d+"`, but its value is `null`."):new f("The "+u+" `"+h+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(a,o,d,u,h)}var a=n.bind(null,!1);return a.isRequired=n.bind(null,!0),a}function m(e){return p(function(t,r,i,n,s,a){var o=t[r];return y(o)!==e?new f("Invalid "+n+" `"+s+"` of type `"+b(o)+"` supplied to `"+i+"`, expected `"+e+"`.",{expectedType:e}):null})}function g(e,t,r,i,n){return new f((e||"React class")+": "+t+" type `"+r+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+n+"`.")}function v(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(v);if(null===e||o(e))return!0;var t=function(e){var t=e&&(d&&e[d]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(!t)return!1;var r,i=t.call(e);if(t!==e.entries){for(;!(r=i.next()).done;)if(!v(r.value))return!1}else for(;!(r=i.next()).done;){var n=r.value;if(n&&!v(n[1]))return!1}return!0;default:return!1}}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function E(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return f.prototype=Error.prototype,u.checkPropTypes=n,u.resetWarningCache=n.resetWarningCache,u.PropTypes=u,u},Uu}function Zu(){if(ju)return Gu;ju=1;var e=Ku();function t(){}function r(){}return r.resetWarningCache=t,Gu=function(){function i(t,r,i,n,s,a){if(a!==e){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function n(){return i}i.isRequired=i;var s={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:n,element:i,elementType:i,instanceOf:n,node:i,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:r,resetWarningCache:t};return s.PropTypes=s,s}}function Ju(){if(Hu)return Lu.exports;if(Hu=1,"production"!==process.env.NODE_ENV){var e=Wu();Lu.exports=Qu()(e.isElement,true)}else Lu.exports=Zu()();return Lu.exports}var eh=je(Ju()),th="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function rh(e,t){return e(t={exports:{}},t.exports),t.exports}var ih=rh(function(e){!function(t){var r=function(e,t,i){if(!l(t)||c(t)||u(t)||h(t)||o(t))return t;var n,s=0,a=0;if(d(t))for(n=[],a=t.length;s<a;s++)n.push(r(e,t[s],i));else for(var f in n={},t)Object.prototype.hasOwnProperty.call(t,f)&&(n[e(f,i)]=r(e,t[f],i));return n},i=function(e){return f(e)?e:(e=e.replace(/[\-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""})).substr(0,1).toLowerCase()+e.substr(1)},n=function(e){var t=i(e);return t.substr(0,1).toUpperCase()+t.substr(1)},s=function(e,t){return function(e,t){var r=(t=t||{}).separator||"_",i=t.split||/(?=[A-Z])/;return e.split(i).join(r)}(e,t).toLowerCase()},a=Object.prototype.toString,o=function(e){return"function"==typeof e},l=function(e){return e===Object(e)},d=function(e){return"[object Array]"==a.call(e)},c=function(e){return"[object Date]"==a.call(e)},u=function(e){return"[object RegExp]"==a.call(e)},h=function(e){return"[object Boolean]"==a.call(e)},f=function(e){return(e-=0)==e},p=function(e,t){var r=t&&"process"in t?t.process:t;return"function"!=typeof r?e:function(t,i){return r(t,e,i)}},m={camelize:i,decamelize:s,pascalize:n,depascalize:s,camelizeKeys:function(e,t){return r(p(i,t),e)},decamelizeKeys:function(e,t){return r(p(s,t),e,t)},pascalizeKeys:function(e,t){return r(p(n,t),e)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};e.exports?e.exports=m:t.humps=m}(th)}).decamelize,nh=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i},sh=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],i=!0,n=!1,s=void 0;try{for(var a,o=e[Symbol.iterator]();!(i=(a=o.next()).done)&&(r.push(a.value),!t||r.length!==t);i=!0);}catch(e){n=!0,s=e}finally{try{i||null==o.return||o.return()}finally{if(n)throw s}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nh(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?nh(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()},ah=rh(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},t.apply(this,arguments)}e.exports=t}),oh=function(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},s=Object.keys(e);for(i=0;i<s.length;i++)r=s[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)r=s[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n},lh=l(null);function dh(e){var r=e.children,i=void 0===r?"":r,n=oh(e,["children"]);return"string"!=typeof i&&(i=w(i)),t.createElement("template",ah({},n,{dangerouslySetInnerHTML:{__html:i}}))}function ch(e){var t=e.root,r=e.children;return b(void 0===r?null:r,t)}dh.propTypes={children:eh.oneOfType([eh.string,eh.node])},ch.propTypes={root:eh.object.isRequired,children:eh.node};var uh=new Map;var hh=function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"core",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){return e.children};return new Proxy(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{get:function(l,d){var c=ih(d,{separator:"-"}),u="".concat(e,"-").concat(c);return uh.has(u)||uh.set(u,function(e){var s=n(function(n,s){var l,d,c=n.mode,u=void 0===c?"open":c,h=n.delegatesFocus,f=void 0!==h&&h,p=n.styleSheets,m=void 0===p?[]:p,g=n.ssr,v=void 0!==g&&g,y=n.children,b=oh(n,["mode","delegatesFocus","styleSheets","ssr","children"]),E=(d=r((l=s)&&l.current),i(function(){l&&(l.current=d.current)},[l]),d),w=a(null),S=sh(w,2),T=S[0],x=S[1],A="node_".concat(u).concat(f);return o(function(){if(E.current)try{if("function"==typeof s&&s(E.current),v){var e=E.current.shadowRoot;return void x(e)}var t=E.current.attachShadow({mode:u,delegatesFocus:f});m.length>0&&(t.adoptedStyleSheets=m),x(t)}catch(e){!function(e){var t=e.error,r=e.styleSheets,i=e.root;if("NotSupportedError"!==t.name)throw t;r.length>0&&(i.adoptedStyleSheets=r)}({error:e,styleSheets:m,root:T})}},[s,E,m]),t.createElement(t.Fragment,null,t.createElement(e.tag,ah({key:A,ref:E},b),(T||v)&&t.createElement(lh.Provider,{value:T},v?t.createElement(dh,{shadowroot:u,shadowrootmode:u},e.render({root:T,ssr:v,children:y})):t.createElement(ch,{root:T},e.render({root:T,ssr:v,children:y})))))});return s.propTypes={mode:eh.oneOf(["open","closed"]),delegatesFocus:eh.bool,styleSheets:eh.arrayOf(eh.instanceOf(globalThis.CSSStyleSheet)),ssr:eh.bool,children:eh.node},s}({tag:c,render:s})),uh.get(u)}})}();const fh='/*! tailwindcss v4.0.12 | MIT License | https://tailwindcss.com */@layer theme, base, components, utilities;@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(0.637 0.237 25.331);--color-blue-200:oklch(0.882 0.059 254.128);--color-blue-300:oklch(0.809 0.105 251.813);--color-gray-400:oklch(0.707 0.022 261.325);--color-gray-500:oklch(0.551 0.027 264.364);--color-gray-700:oklch(0.373 0.034 259.733);--color-gray-800:oklch(0.278 0.033 256.848);--color-gray-900:oklch(0.21 0.034 264.665);--color-zinc-700:oklch(0.37 0.013 285.805);--color-black:#000;--color-white:#fff;--spacing:0.25rem;--container-sm:24rem;--container-lg:32rem;--text-xs:0.75rem;--text-xs--line-height:1.33333;--text-sm:0.875rem;--text-sm--line-height:1.42857;--text-lg:1.125rem;--text-lg--line-height:1.55556;--text-xl:1.25rem;--text-xl--line-height:1.4;--font-weight-medium:500;--font-weight-semibold:600;--leading-tight:1.25;--ease-in:cubic-bezier(0.4,0,1,1);--ease-in-out:cubic-bezier(0.4,0,0.2,1);--aspect-video:16/9;--default-transition-duration:150ms;--default-transition-timing-function:cubic-bezier(0.4,0,0.2,1);--default-font-family:var(--font-sans);--default-font-feature-settings:var(--font-sans--font-feature-settings);--default-font-variation-settings:var(\n --font-sans--font-variation-settings\n );--default-mono-font-family:var(--font-mono);--default-mono-font-feature-settings:var(\n --font-mono--font-feature-settings\n );--default-mono-font-variation-settings:var(\n --font-mono--font-variation-settings\n );--animate-float:float 2s ease}}@layer base{*,::backdrop,::file-selector-button,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:var(--default-font-feature-settings,normal);-webkit-tap-highlight-color:transparent;font-family:var( --default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji" );font-variation-settings:var( --default-font-variation-settings,normal );line-height:1.5;tab-size:4}body{line-height:inherit}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:var( --default-mono-font-feature-settings,normal );font-family:var( --default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace );font-size:1em;font-variation-settings:var( --default-mono-font-variation-settings,normal )}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}::file-selector-button,button,input,optgroup,select,textarea{font-feature-settings:inherit;background-color:transparent;border-radius:0;color:inherit;font:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{color:color-mix(in oklab,currentColor 50%,transparent);opacity:1}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}::file-selector-button,button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.top-4{top:calc(var(--spacing)*4)}.right-4{right:calc(var(--spacing)*4)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\\[1\\]{z-index:1}.z-\\[5\\]{z-index:5}.z-\\[999\\]{z-index:999}.z-\\[999999\\]{z-index:999999}.container{width:100%;@media (width >= 40rem){max-width:40rem}@media (width >= 48rem){max-width:48rem}@media (width >= 64rem){max-width:64rem}@media (width >= 80rem){max-width:80rem}@media (width >= 96rem){max-width:96rem}}.mx-0{margin-inline:calc(var(--spacing)*0)}.mx-10{margin-inline:calc(var(--spacing)*10)}.mx-auto{margin-inline:auto}.my-0{margin-block:calc(var(--spacing)*0)}.my-2{margin-block:calc(var(--spacing)*2)}.my-10{margin-block:calc(var(--spacing)*10)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-auto{margin-top:auto}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.line-clamp-1{-webkit-line-clamp:1}.line-clamp-1,.line-clamp-2{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-2{-webkit-line-clamp:2}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.table{display:table}.aspect-\\[9\\/16\\]{aspect-ratio:9/16}.aspect-square{aspect-ratio:1/1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-3{height:calc(var(--spacing)*3);width:calc(var(--spacing)*3)}.size-4{height:calc(var(--spacing)*4);width:calc(var(--spacing)*4)}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.h-4{height:calc(var(--spacing)*4)}.h-6{height:calc(var(--spacing)*6)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-\\[24px\\]{height:24px}.h-\\[60px\\]{height:60px}.h-\\[80\\%\\]{height:80%}.h-\\[100px\\]{height:100px}.h-\\[125px\\]{height:125px}.h-\\[500px\\]{height:500px}.h-\\[600px\\]{height:600px}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[150px\\]{max-height:150px}.max-h-\\[300px\\]{max-height:300px}.max-h-fit{max-height:fit-content}.max-h-full{max-height:100%}.\\!w-auto{width:auto!important}.w-4{width:calc(var(--spacing)*4)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-32{width:calc(var(--spacing)*32)}.w-\\[24px\\]{width:24px}.w-\\[50px\\]{width:50px}.w-\\[80\\%\\]{width:80%}.w-\\[100px\\]{width:100px}.w-\\[400px\\]{width:400px}.w-\\[500px\\]{width:500px}.w-\\[1024px\\]{width:1024px}.w-full{width:100%}.max-w-16{max-width:calc(var(--spacing)*16)}.max-w-52{max-width:calc(var(--spacing)*52)}.max-w-\\[40\\%\\]{max-width:40%}.max-w-\\[800px\\]{max-width:800px}.max-w-fit{max-width:fit-content}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-none{max-width:none}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-44{min-width:calc(var(--spacing)*44)}.min-w-\\[768px\\]{min-width:768px}.flex-1{flex:1}.flex-\\[2\\]{flex:2}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.translate-y-0\\.5{--tw-translate-y:calc(var(--spacing)*0.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y)}.animate-float{animation:var(--animate-float)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-items-center{justify-items:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-10{gap:calc(var(--spacing)*10)}.self-center{align-self:center}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap}.overflow-hidden,.truncate{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.rounded{border-radius:.25rem}.rounded-full{border-radius:calc(infinity * 1px)}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-\\[\\#f4f3f6\\]{border-color:#f4f3f6}.bg-\\[\\#0ab060\\]{background-color:#0ab060}.bg-\\[\\#eeeeee\\]{background-color:#eee}.bg-\\[\\#f4f4f4\\]{background-color:#f4f4f4}.bg-\\[rgba\\(0\\,0\\,0\\,\\.3\\)\\]{background-color:rgba(0,0,0,.3)}.bg-background{background-color:var(--background)}.bg-black{background-color:var(--color-black)}.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}.bg-blue-200{background-color:var(--color-blue-200)}.bg-blue-300{background-color:var(--color-blue-300)}.bg-muted{background-color:var(--muted)}.bg-white{background-color:var(--color-white)}.bg-zinc-700{background-color:var(--color-zinc-700)}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-black\\/40{--tw-gradient-from:color-mix(in oklab,var(--color-black) 40%,transparent);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-via) var(--tw-gradient-via-position),var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-black\\/40{--tw-gradient-to:color-mix(in oklab,var(--color-black) 40%,transparent);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.fill-black{fill:var(--color-black)}.fill-red-500{fill:var(--color-red-500)}.fill-white{fill:var(--color-white)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-center{object-position:center}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-10{padding:calc(var(--spacing)*10)}.p-\\[3px\\]{padding:3px}.px-2{padding-inline:calc(var(--spacing)*2)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-\\[24px\\]{padding-inline:24px}.py-2{padding-block:calc(var(--spacing)*2)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-0{padding-top:calc(var(--spacing)*0)}.pr-1{padding-right:calc(var(--spacing)*1)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-10{padding-bottom:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[12px\\]{font-size:12px}.leading-none{--tw-leading:1;line-height:1}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.break-keep{word-break:keep-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.text-black{color:var(--color-black)}.text-foreground{color:var(--foreground)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-muted-foreground{color:var(--muted-foreground)}.text-red-500{color:var(--color-red-500)}.text-transparent{color:transparent}.text-white{color:var(--color-white)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.opacity-50{opacity:50%}.opacity-70{opacity:70%}.shadow,.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,rgba(0,0,0,.1)),0 1px 2px -1px var(--tw-shadow-color,rgba(0,0,0,.1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-ring\\/30{--tw-ring-color:color-mix(in oklab,var(--ring) 30%,transparent)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-\\[color\\,box-shadow\\]{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-all{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-opacity{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-transform{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.duration-200{--tw-duration:200ms;transition-duration:.2s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.duration-200{animation-duration:.2s}.ease-in{animation-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.fade-in{--tw-enter-opacity:0}.group-data-\\[vaul-drawer-direction\\=bottom\\]\\/drawer-content\\:block{&:is(:where(.group\\/drawer-content)[data-vaul-drawer-direction=bottom] *){display:block}}.last\\:border-b-0{&:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}}.hover\\:underline{&:hover{@media (hover:hover){text-decoration-line:underline}}}.hover\\:opacity-100{&:hover{@media (hover:hover){opacity:100%}}}.hover\\:ring-4{&:hover{@media (hover:hover){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentColor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}}.focus\\:ring-2{&:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentColor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\\:ring-ring{&:focus{--tw-ring-color:var(--ring)}}.focus\\:ring-offset-2{&:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}}.focus\\:ring-offset-background{&:focus{--tw-ring-offset-color:var(--background)}}.focus\\:outline-none{&:focus{--tw-outline-style:none;outline-style:none}}.focus-visible\\:border-ring{&:focus-visible{border-color:var(--ring)}}.focus-visible\\:ring-4{&:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentColor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus-visible\\:ring-\\[3px\\]{&:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentColor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus-visible\\:ring-ring\\/50{&:focus-visible{--tw-ring-color:color-mix(in oklab,var(--ring) 50%,transparent)}}.focus-visible\\:outline-hidden{&:focus-visible{--tw-outline-style:none;outline-style:none;@media (forced-colors:active){outline:2px solid transparent;outline-offset:2px}}}.disabled\\:pointer-events-none{&:disabled{pointer-events:none}}.disabled\\:opacity-50{&:disabled{opacity:50%}}.data-\\[disabled\\]\\:opacity-50{&[data-disabled]{opacity:50%}}.data-\\[orientation\\=horizontal\\]\\:h-1\\.5{&[data-orientation=horizontal]{height:calc(var(--spacing)*1.5)}}.data-\\[orientation\\=horizontal\\]\\:h-full{&[data-orientation=horizontal]{height:100%}}.data-\\[orientation\\=horizontal\\]\\:w-full{&[data-orientation=horizontal]{width:100%}}.data-\\[orientation\\=vertical\\]\\:h-full{&[data-orientation=vertical]{height:100%}}.data-\\[orientation\\=vertical\\]\\:min-h-44{&[data-orientation=vertical]{min-height:calc(var(--spacing)*44)}}.data-\\[orientation\\=vertical\\]\\:w-1\\.5{&[data-orientation=vertical]{width:calc(var(--spacing)*1.5)}}.data-\\[orientation\\=vertical\\]\\:w-auto{&[data-orientation=vertical]{width:auto}}.data-\\[orientation\\=vertical\\]\\:w-full{&[data-orientation=vertical]{width:100%}}.data-\\[orientation\\=vertical\\]\\:flex-col{&[data-orientation=vertical]{flex-direction:column}}.data-\\[state\\=closed\\]\\:animate-out{&[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}}.data-\\[state\\=closed\\]\\:fade-out-0{&[data-state=closed]{--tw-exit-opacity:0}}.data-\\[state\\=open\\]\\:animate-in{&[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}}.data-\\[state\\=open\\]\\:fade-in-0{&[data-state=open]{--tw-enter-opacity:0}}.data-\\[vaul-drawer-direction\\=bottom\\]\\:inset-x-0{&[data-vaul-drawer-direction=bottom]{inset-inline:calc(var(--spacing)*0)}}.data-\\[vaul-drawer-direction\\=bottom\\]\\:bottom-0{&[data-vaul-drawer-direction=bottom]{bottom:calc(var(--spacing)*0)}}.data-\\[vaul-drawer-direction\\=bottom\\]\\:mt-24{&[data-vaul-drawer-direction=bottom]{margin-top:calc(var(--spacing)*24)}}.data-\\[vaul-drawer-direction\\=bottom\\]\\:max-h-\\[80vh\\]{&[data-vaul-drawer-direction=bottom]{max-height:80vh}}.data-\\[vaul-drawer-direction\\=bottom\\]\\:rounded-t-lg{&[data-vaul-drawer-direction=bottom]{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}}.data-\\[vaul-drawer-direction\\=bottom\\]\\:border-t{&[data-vaul-drawer-direction=bottom]{border-top-style:var(--tw-border-style);border-top-width:1px}}.data-\\[vaul-drawer-direction\\=left\\]\\:inset-y-0{&[data-vaul-drawer-direction=left]{inset-block:calc(var(--spacing)*0)}}.data-\\[vaul-drawer-direction\\=left\\]\\:left-0{&[data-vaul-drawer-direction=left]{left:calc(var(--spacing)*0)}}.data-\\[vaul-drawer-direction\\=left\\]\\:w-3\\/4{&[data-vaul-drawer-direction=left]{width:75%}}.data-\\[vaul-drawer-direction\\=left\\]\\:border-r{&[data-vaul-drawer-direction=left]{border-right-style:var(--tw-border-style);border-right-width:1px}}.data-\\[vaul-drawer-direction\\=right\\]\\:inset-y-0{&[data-vaul-drawer-direction=right]{inset-block:calc(var(--spacing)*0)}}.data-\\[vaul-drawer-direction\\=right\\]\\:right-0{&[data-vaul-drawer-direction=right]{right:calc(var(--spacing)*0)}}.data-\\[vaul-drawer-direction\\=right\\]\\:w-3\\/4{&[data-vaul-drawer-direction=right]{width:75%}}.data-\\[vaul-drawer-direction\\=right\\]\\:border-l{&[data-vaul-drawer-direction=right]{border-left-style:var(--tw-border-style);border-left-width:1px}}.data-\\[vaul-drawer-direction\\=top\\]\\:inset-x-0{&[data-vaul-drawer-direction=top]{inset-inline:calc(var(--spacing)*0)}}.data-\\[vaul-drawer-direction\\=top\\]\\:top-0{&[data-vaul-drawer-direction=top]{top:calc(var(--spacing)*0)}}.data-\\[vaul-drawer-direction\\=top\\]\\:mb-24{&[data-vaul-drawer-direction=top]{margin-bottom:calc(var(--spacing)*24)}}.data-\\[vaul-drawer-direction\\=top\\]\\:max-h-\\[80vh\\]{&[data-vaul-drawer-direction=top]{max-height:80vh}}.data-\\[vaul-drawer-direction\\=top\\]\\:rounded-b-lg{&[data-vaul-drawer-direction=top]{border-bottom-left-radius:var(--radius);border-bottom-right-radius:var(--radius)}}.data-\\[vaul-drawer-direction\\=top\\]\\:border-b{&[data-vaul-drawer-direction=top]{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}}.data-\\[vaul-drawer-direction\\=left\\]\\:sm\\:max-w-sm,.sm\\:flex-row,.sm\\:justify-end,.sm\\:mx-0{&[data-vaul-drawer-direction=left]{@media (width >= 40rem){max-width:var(--container-sm)}}}.data-\\[vaul-drawer-direction\\=right\\]\\:sm\\:max-w-sm{&[data-vaul-drawer-direction=right]{@media (width >= 40rem){max-width:var(--container-sm)}}}.\\[\\&\\[data-state\\=open\\]\\>svg\\]\\:rotate-180,.md\\:text-\\[15px\\]{&[data-state=open]>svg{rotate:180deg}}}body{--background:oklch(1 0 0);--foreground:oklch(0.145 0 0);--card:oklch(1 0 0);--card-foreground:oklch(0.145 0 0);--popover:oklch(1 0 0);--popover-foreground:oklch(0.145 0 0);--primary:oklch(0.205 0 0);--primary-foreground:oklch(0.985 0 0);--secondary:oklch(0.97 0 0);--secondary-foreground:oklch(0.205 0 0);--muted:oklch(0.97 0 0);--muted-foreground:oklch(0.556 0 0);--accent:oklch(0.97 0 0);--accent-foreground:oklch(0.205 0 0);--destructive:oklch(0.577 0.245 27.325);--destructive-foreground:oklch(0.577 0.245 27.325);--border:oklch(0.922 0 0);--input:oklch(0.922 0 0);--ring:oklch(0.708 0 0);--chart-1:oklch(0.646 0.222 41.116);--chart-2:oklch(0.6 0.118 184.704);--chart-3:oklch(0.398 0.07 227.392);--chart-4:oklch(0.828 0.189 84.429);--chart-5:oklch(0.769 0.188 70.08);--radius:0.625rem;--sidebar:oklch(0.985 0 0);--sidebar-foreground:oklch(0.145 0 0);--sidebar-primary:oklch(0.205 0 0);--sidebar-primary-foreground:oklch(0.985 0 0);--sidebar-accent:oklch(0.97 0 0);--sidebar-accent-foreground:oklch(0.205 0 0);--sidebar-border:oklch(0.922 0 0);--sidebar-ring:oklch(0.708 0 0);outline:none}.dark{--background:oklch(0.145 0 0);--foreground:oklch(0.985 0 0);--card:oklch(0.145 0 0);--card-foreground:oklch(0.985 0 0);--popover:oklch(0.145 0 0);--popover-foreground:oklch(0.985 0 0);--primary:oklch(0.985 0 0);--primary-foreground:oklch(0.205 0 0);--secondary:oklch(0.269 0 0);--secondary-foreground:oklch(0.985 0 0);--muted:oklch(0.269 0 0);--muted-foreground:oklch(0.708 0 0);--accent:oklch(0.269 0 0);--accent-foreground:oklch(0.985 0 0);--destructive:oklch(0.396 0.141 25.723);--destructive-foreground:oklch(0.637 0.237 25.331);--border:oklch(0.269 0 0);--input:oklch(0.269 0 0);--ring:oklch(0.439 0 0);--chart-1:oklch(0.488 0.243 264.376);--chart-2:oklch(0.696 0.17 162.48);--chart-3:oklch(0.769 0.188 70.08);--chart-4:oklch(0.627 0.265 303.9);--chart-5:oklch(0.645 0.246 16.439);--sidebar:oklch(0.205 0 0);--sidebar-foreground:oklch(0.985 0 0);--sidebar-primary:oklch(0.488 0.243 264.376);--sidebar-primary-foreground:oklch(0.985 0 0);--sidebar-accent:oklch(0.269 0 0);--sidebar-accent-foreground:oklch(0.985 0 0);--sidebar-border:oklch(0.269 0 0);--sidebar-ring:oklch(0.439 0 0)}@layer base{*{border-color:var(--border);outline-color:color-mix(in oklab,var(--ring) 50%,transparent)}body{background-color:var(--background);color:var(--foreground)}}html.overflow-hidden{overflow:hidden}.scrollbar-hide::-webkit-scrollbar{display:none}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.bg-insta{background-image:linear-gradient(to top right,#facc15,#ec4899,#9333ea)}.product-banner{align-items:center;background:#fff;border-radius:8px;cursor:pointer;display:flex;gap:8px;position:relative}.product-banner__clip{border-radius:inherit;overflow:hidden}.product-banner__clip,.product-banner__sheen{inset:0;pointer-events:none;position:absolute;z-index:1}.product-banner__sheen{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);transform:translateX(100%);transition:transform .3s ease}.product-banner:hover .product-banner__sheen{transform:translateX(0)}.product-banner__arrow{opacity:0;pointer-events:none;position:absolute;right:8px;top:50%;transform:translate(4px,-50%);transition:transform .3s ease,opacity .3s ease;z-index:2}.product-banner:hover .product-banner__arrow{opacity:1;transform:translateY(-50%)}.product-dialog-container{max-height:70vh;max-width:min(82vw,500px);overflow-y:auto;width:100%}.border{border:1px solid oklch(.922 0 0)}@font-face{font-family:swiper-icons;font-style:normal;font-weight:400;src:url("data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA")}:root{--swiper-theme-color:#007aff}:host{display:block;margin-left:auto;margin-right:auto;position:relative;z-index:1}.swiper{display:block;list-style:none;margin-left:auto;margin-right:auto;overflow:hidden;padding:0;position:relative;z-index:1}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{box-sizing:content-box;display:flex;height:100%;position:relative;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function,initial);width:100%;z-index:1}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{display:block;flex-shrink:0;height:100%;position:relative;transition-property:transform;width:100%}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{-webkit-backface-visibility:hidden;backface-visibility:hidden;transform:translateZ(0)}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-cube-shadow,.swiper-3d .swiper-slide{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{-ms-overflow-style:none;overflow:auto;scrollbar-width:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper:before{content:"";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper:before{height:var(--swiper-centered-offset-after);min-width:1px;width:100%}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top{height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0,0,0,.15)}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(270deg,rgba(0,0,0,.5),transparent)}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(90deg,rgba(0,0,0,.5),transparent)}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(0deg,rgba(0,0,0,.5),transparent)}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(180deg,rgba(0,0,0,.5),transparent)}.swiper-lazy-preloader{border:4px solid var(--swiper-preloader-color,var(--swiper-theme-color));border-radius:50%;border-top:4px solid transparent;box-sizing:border-box;height:42px;left:50%;margin-left:-21px;margin-top:-21px;position:absolute;top:50%;transform-origin:50%;width:42px;z-index:10}.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader,.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader{animation:swiper-preloader-spin 1s linear infinite}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@keyframes swiper-preloader-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.swiper.swiper-cards{overflow:visible}.swiper-cards .swiper-slide{-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden;transform-origin:center bottom}.swiper-grid>.swiper-wrapper{flex-wrap:wrap}.swiper-grid-column>.swiper-wrapper{flex-direction:column;flex-wrap:wrap}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false;initial-value:rotateX(0)}@property --tw-rotate-y{syntax:"*";inherits:false;initial-value:rotateY(0)}@property --tw-rotate-z{syntax:"*";inherits:false;initial-value:rotateZ(0)}@property --tw-skew-x{syntax:"*";inherits:false;initial-value:skewX(0)}@property --tw-skew-y{syntax:"*";inherits:false;initial-value:skewY(0)}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes float{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-200px)}}',ph=fh.trim().length>0,mh="undefined"!=typeof window&&"adoptedStyleSheets"in Document.prototype&&"undefined"!=typeof CSSStyleSheet&&"replaceSync"in CSSStyleSheet.prototype;let gh=null;function vh(e){return gh||(gh=new CSSStyleSheet,gh.replaceSync(e)),gh}function yh(){return ph?fh:function(){const e=[];for(const t of Array.from(document.styleSheets))try{e.push(Array.from(t.cssRules).map(e=>e.cssText).join("\n"))}catch(e){}return e.join("\n")}()}const bh=({extra:e})=>{const r=yh()+(e?"\n"+e:"");return t.createElement("style",null,r)};function Eh(){const[e,n]=t.useState(null),s=r(null),{open:a,setOpen:o}=zd();return i(()=>{s.current&&(s.current.style.display=a?"block":"none")},[a]),t.useLayoutEffect(()=>{const e=document.createElement("div");e.style.position="fixed",e.style.inset="0",e.style.zIndex="214748348",e.style.display="none",document.body.appendChild(e),s.current=e;const t=e.attachShadow({mode:"open"});!function(e){const t=yh();if(mh)e.adoptedStyleSheets=[vh(t)];else{const r=document.createElement("style");r.textContent=t,e.appendChild(r)}}(t);const r=document.createElement("style");r.innerHTML="\n .product-dialog-container{\n max-height: 70vh;\n overflow-y: auto;\n width: 100%;\n max-width: min(82vw, 500px) !important;\n }\n ",t.appendChild(r);const i=document.createElement("div");return t.appendChild(i),n(i),()=>e.remove()},[]),{container:e,setOpen:o}}const wh=e=>{const{collectionId:r,isPreview:n,priceText:s,container:a}=e,{setIsPreview:o,setPriceText:l}=Js(),{setCollection:d,setNextKey:c,collection:u}=ra();i(()=>{s&&l(s);const e=Boolean(n);e&&o(e)},[]),i(()=>{x(void 0,void 0,void 0,function*(){var e;const t=yield Hs({collectionId:r,size:10});if(!t)return;const{contents:i,count:n}=t;(null==i?void 0:i.length)&&c(null===(e=i.at(-1))||void 0===e?void 0:e.shortsId),d(Object.assign(Object.assign({},t),{count:n}))})},[r]);const h=function(e){var t,r,i,n,s,a,o,l,d,c,u,h;const f=null!==(t=e.iconForm)&&void 0!==t?t:Me.INSTA,p={collectionId:e.collectionId,iconForm:f,iconShape:null!==(r=e.iconShape)&&void 0!==r?r:Ne.MANY,iconSize:null!==(i=e.iconSize)&&void 0!==i?i:120,borderLine:null!==(n=e.borderLine)&&void 0!==n?n:Fe.DAY,exposeTitle:null===(s=e.exposeTitle)||void 0===s||s,player:null!==(a=e.player)&&void 0!==a?a:$e.POPUP,rounded:null===(o=e.rounded)||void 0===o||o,titlePosition:null!==(l=e.titlePosition)&&void 0!==l?l:Be.BOTTOM,exposeProductBanner:null!==(d=e.exposeProductBanner)&&void 0!==d&&d,exposeProductBadge:null!==(c=e.exposeProductBadge)&&void 0!==c&&c,priceText:e.priceText||"할인가",hoverPlay:null!==(u=e.hoverPlay)&&void 0!==u&&u,thumbnailAutoPlay:null!==(h=e.thumbnailAutoPlay)&&void 0!==h&&h};return f===Me.YOUTUBE?Object.assign(Object.assign({},p),{iconForm:Me.YOUTUBE,iconRatio:e.iconRatio||"9/16"}):Object.assign(Object.assign({},p),{iconForm:Me.INSTA})}(e),{containerRef:f}=function({collectionId:e,iconSize:r}){const{collection:i,setCollection:n,nextKey:s,setNextKey:a,isFetching:o,setIsFetching:l}=ra(),d=t.useRef(null),[c,u]=t.useState(0);return t.useEffect(()=>{if(!d.current)return;const e=new ResizeObserver(e=>{var t,r,i;const n=null!==(i=null===(r=null===(t=e[0])||void 0===t?void 0:t.contentRect)||void 0===r?void 0:r.width)&&void 0!==i?i:0;u(n)});return e.observe(d.current),()=>e.disconnect()},[]),t.useEffect(()=>{var e;if(!i||!i.contents)return;const t=Math.max(1,r+12),d=Math.ceil((c||0)/t)+4,u=null!==(e=i.count)&&void 0!==e?e:Number.MAX_SAFE_INTEGER,h=Math.min(u,d);if(i.contents.length>=h||o)return;let f=!1;return(()=>{x(this,void 0,void 0,function*(){var e,t,r,o,d;try{l(!0);let c=i,u=s||(null===(e=c.contents.at(-1))||void 0===e?void 0:e.shortsId)||void 0;const p=new Set(c.contents.map(e=>e.shortsId));for(;!f&&c.contents.length<h;){const e=Math.max(6,h-c.contents.length),i=yield Hs({collectionId:c.colId,nextKey:u,size:e});if(!i||!(null===(t=i.contents)||void 0===t?void 0:t.length))break;u=null!==(o=null===(r=i.contents.at(-1))||void 0===r?void 0:r.shortsId)&&void 0!==o?o:u;const s=i.contents.filter(e=>!p.has(e.shortsId));if(!s.length)break;if(s.forEach(e=>p.add(e.shortsId)),c=Object.assign(Object.assign({},c),{contents:[...c.contents,...s]}),n(c),a(u||""),c.contents.length>=(null!==(d=c.count)&&void 0!==d?d:Number.MAX_SAFE_INTEGER))break}}finally{l(!1)}})})(),()=>{f=!0}},[null==i?void 0:i.colId,null==i?void 0:i.count,null==i?void 0:i.contents.length,c,r,o,s,n,l,a]),{containerRef:d}}({collectionId:r,iconSize:h.iconSize});return t.createElement(hh.div,null,t.createElement(bh,null),t.createElement("div",{ref:f},t.createElement(Au,{widgetPlayerOption:h,setCollectionUuid:e=>{d(Object.assign(Object.assign({},u),{uuid:e}))},portalContainer:a})))},Sh=e=>{const{container:r}=Eh();return r?t.createElement(ta,null,t.createElement(wh,Object.assign({},e,{container:r}))):null},Th=({portalContainer:e,aspectRatio:r})=>{var n;const{collection:s,setNextKey:o}=ra(),[l,d]=a(),{setOpen:c,open:u}=zd();i(()=>{u||l&&d(null)},[u]);const h=(null!==(n=Od().width)&&void 0!==n?n:0)<430||pa.isMobile;return t.createElement(t.Fragment,null,t.createElement("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${h?2:5}, 1fr)`}},null==s?void 0:s.contents.map(e=>t.createElement("div",null,t.createElement("div",{className:"overflow-hidden",style:{borderRadius:"0.625rem",aspectRatio:null!=r?r:"9/16"}},t.createElement("video",{loop:!0,className:"w-full h-full object-cover",muted:!0,autoPlay:!0,playsInline:!0,src:Tt(e.media.objectId),poster:Rt(e.thumbPath)})),t.createElement(jd,{hideMoreBadge:!0,showMoreBtn:!0,products:e.productsInfo,contentId:e.shortsId,setSelectedProducts:d})))),l&&t.createElement(Su,{portalContainer:e,title:"상품 목록",contentClassName:"bg-white rounded p-4 product-dialog-container",description:"연결된 전체 상품 정보를 확인해 보세요"},t.createElement(Tu,{products:l.productsInfo,contentId:l.shortsId})))},xh=({collectionId:e,aspectRatio:r,container:n,isPreview:s})=>{const{setCollection:a,setNextKey:o}=ra();return i(()=>{x(void 0,void 0,void 0,function*(){var t;const r=yield Hs({collectionId:e,size:-1});if(!r)return;const{contents:i,count:n}=r;(null==i?void 0:i.length)&&o(null===(t=i.at(-1))||void 0===t?void 0:t.shortsId),a(Object.assign(Object.assign({},r),{count:n}))})},[e]),t.createElement(hh.div,null,t.createElement(bh,null),t.createElement(Th,{portalContainer:n,aspectRatio:r}))},Ah=e=>{const{container:r}=Eh();return r?t.createElement(ta,null,t.createElement(xh,Object.assign({},e,{container:r}))):null},kh=Zs(e=>({shortform:null,setShortform:t=>e({shortform:t})}));var Lh={exports:{}},Ih={};function Rh(e){var t,r,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Rh(e[t]))&&(i&&(i+=" "),i+=r);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function Ph(){for(var e,t,r=0,i="";r<arguments.length;)(e=arguments[r++])&&(t=Rh(e))&&(i&&(i+=" "),i+=t);return i}var Dh,Ch=He(Object.freeze({__proto__:null,clsx:Ph,default:Ph})),_h={},Oh={};function Mh(){if(Dh)return Oh;return Dh=1,Object.defineProperty(Oh,"__esModule",{value:!0}),Oh.dontSetMe=function(e,t,r){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(r," - do not set this, set it on the child."))},Oh.findInArray=function(e,t){for(let r=0,i=e.length;r<i;r++)if(t.apply(t,[e[r],r,e]))return e[r]},Oh.int=function(e){return parseInt(e,10)},Oh.isFunction=function(e){return"function"==typeof e||"[object Function]"===Object.prototype.toString.call(e)},Oh.isNum=function(e){return"number"==typeof e&&!isNaN(e)},Oh}var Nh,Fh,$h={};function Bh(){if(Fh)return _h;Fh=1,Object.defineProperty(_h,"__esModule",{value:!0}),_h.addClassName=a,_h.addEvent=function(e,t,r,i){if(!e)return;const n={capture:!0,...i};e.addEventListener?e.addEventListener(t,r,n):e.attachEvent?e.attachEvent("on"+t,r):e["on"+t]=r},_h.addUserSelectStyles=function(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",t.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",e.getElementsByTagName("head")[0].appendChild(t));e.body&&a(e.body,"react-draggable-transparent-selection")},_h.createCSSTransform=function(e,r){const i=s(e,r,"px");return{[(0,t.browserPrefixToKey)("transform",t.default)]:i}},_h.createSVGTransform=function(e,t){return s(e,t,"")},_h.getTouch=function(t,r){return t.targetTouches&&(0,e.findInArray)(t.targetTouches,e=>r===e.identifier)||t.changedTouches&&(0,e.findInArray)(t.changedTouches,e=>r===e.identifier)},_h.getTouchIdentifier=function(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier},_h.getTranslation=s,_h.innerHeight=function(t){let r=t.clientHeight;const i=t.ownerDocument.defaultView.getComputedStyle(t);return r-=(0,e.int)(i.paddingTop),r-=(0,e.int)(i.paddingBottom),r},_h.innerWidth=function(t){let r=t.clientWidth;const i=t.ownerDocument.defaultView.getComputedStyle(t);return r-=(0,e.int)(i.paddingLeft),r-=(0,e.int)(i.paddingRight),r},_h.matchesSelector=n,_h.matchesSelectorAndParentsTo=function(e,t,r){let i=e;do{if(n(i,t))return!0;if(i===r)return!1;i=i.parentNode}while(i);return!1},_h.offsetXYFromParent=function(e,t,r){const i=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),n=(e.clientX+t.scrollLeft-i.left)/r,s=(e.clientY+t.scrollTop-i.top)/r;return{x:n,y:s}},_h.outerHeight=function(t){let r=t.clientHeight;const i=t.ownerDocument.defaultView.getComputedStyle(t);return r+=(0,e.int)(i.borderTopWidth),r+=(0,e.int)(i.borderBottomWidth),r},_h.outerWidth=function(t){let r=t.clientWidth;const i=t.ownerDocument.defaultView.getComputedStyle(t);return r+=(0,e.int)(i.borderLeftWidth),r+=(0,e.int)(i.borderRightWidth),r},_h.removeClassName=o,_h.removeEvent=function(e,t,r,i){if(!e)return;const n={capture:!0,...i};e.removeEventListener?e.removeEventListener(t,r,n):e.detachEvent?e.detachEvent("on"+t,r):e["on"+t]=null},_h.removeUserSelectStyles=function(e){if(!e)return;try{if(e.body&&o(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(e){}};var e=Mh(),t=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var i=r(t);if(i&&i.has(e))return i.get(e);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=s?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}n.default=e,i&&i.set(e,n);return n}(function(){if(Nh)return $h;Nh=1,Object.defineProperty($h,"__esModule",{value:!0}),$h.browserPrefixToKey=r,$h.browserPrefixToStyle=function(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e},$h.default=void 0,$h.getPrefix=t;const e=["Moz","Webkit","O","ms"];function t(){var t;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";const n=null===(t=window.document)||void 0===t||null===(t=t.documentElement)||void 0===t?void 0:t.style;if(!n)return"";if(i in n)return"";for(let t=0;t<e.length;t++)if(r(i,e[t])in n)return e[t];return""}function r(e,t){return t?"".concat(t).concat(function(e){let t="",r=!0;for(let i=0;i<e.length;i++)r?(t+=e[i].toUpperCase(),r=!1):"-"===e[i]?r=!0:t+=e[i];return t}(e)):e}return $h.default=t(),$h}());function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(r=function(e){return e?i:t})(e)}let i="";function n(t,r){return i||(i=(0,e.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(r){return(0,e.isFunction)(t[r])})),!!(0,e.isFunction)(t[i])&&t[i](r)}function s(e,t,r){let{x:i,y:n}=e,s="translate(".concat(i).concat(r,",").concat(n).concat(r,")");if(t){const e="".concat("string"==typeof t.x?t.x:t.x+r),i="".concat("string"==typeof t.y?t.y:t.y+r);s="translate(".concat(e,", ").concat(i,")")+s}return s}function a(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function o(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}return _h}var Uh,zh={};function Gh(){if(Uh)return zh;Uh=1,Object.defineProperty(zh,"__esModule",{value:!0}),zh.canDragX=function(e){return"both"===e.props.axis||"x"===e.props.axis},zh.canDragY=function(e){return"both"===e.props.axis||"y"===e.props.axis},zh.createCoreData=function(t,i,n){const s=!(0,e.isNum)(t.lastX),a=r(t);return s?{node:a,deltaX:0,deltaY:0,lastX:i,lastY:n,x:i,y:n}:{node:a,deltaX:i-t.lastX,deltaY:n-t.lastY,lastX:t.lastX,lastY:t.lastY,x:i,y:n}},zh.createDraggableData=function(e,t){const r=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/r,y:e.state.y+t.deltaY/r,deltaX:t.deltaX/r,deltaY:t.deltaY/r,lastX:e.state.x,lastY:e.state.y}},zh.getBoundPosition=function(i,n,s){if(!i.props.bounds)return[n,s];let{bounds:a}=i.props;a="string"==typeof a?a:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(a);const o=r(i);if("string"==typeof a){const{ownerDocument:r}=o,i=r.defaultView;let n;if(n="parent"===a?o.parentNode:r.querySelector(a),!(n instanceof i.HTMLElement))throw new Error('Bounds selector "'+a+'" could not find an element.');const s=n,l=i.getComputedStyle(o),d=i.getComputedStyle(s);a={left:-o.offsetLeft+(0,e.int)(d.paddingLeft)+(0,e.int)(l.marginLeft),top:-o.offsetTop+(0,e.int)(d.paddingTop)+(0,e.int)(l.marginTop),right:(0,t.innerWidth)(s)-(0,t.outerWidth)(o)-o.offsetLeft+(0,e.int)(d.paddingRight)-(0,e.int)(l.marginRight),bottom:(0,t.innerHeight)(s)-(0,t.outerHeight)(o)-o.offsetTop+(0,e.int)(d.paddingBottom)-(0,e.int)(l.marginBottom)}}(0,e.isNum)(a.right)&&(n=Math.min(n,a.right));(0,e.isNum)(a.bottom)&&(s=Math.min(s,a.bottom));(0,e.isNum)(a.left)&&(n=Math.max(n,a.left));(0,e.isNum)(a.top)&&(s=Math.max(s,a.top));return[n,s]},zh.getControlPosition=function(e,i,n){const s="number"==typeof i?(0,t.getTouch)(e,i):null;if("number"==typeof i&&!s)return null;const a=r(n),o=n.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,t.offsetXYFromParent)(s||e,o,n.props.scale)},zh.snapToGrid=function(e,t,r){const i=Math.round(t/e[0])*e[0],n=Math.round(r/e[1])*e[1];return[i,n]};var e=Mh(),t=Bh();function r(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}return zh}var jh,Hh,Vh,Wh,Yh={},Kh={};function qh(){if(jh)return Kh;return jh=1,Object.defineProperty(Kh,"__esModule",{value:!0}),Kh.default=function(){},Kh}function Xh(){if(Hh)return Yh;Hh=1,Object.defineProperty(Yh,"__esModule",{value:!0}),Yh.default=void 0;var e=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(i,s,a):i[s]=e[s]}i.default=e,r&&r.set(e,i);return i}(t),r=l(Ju()),i=l(y),n=Bh(),s=Gh(),a=Mh(),o=l(qh());function l(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:t})(e)}function c(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const u={start:"touchstart",move:"touchmove",stop:"touchend"},h={start:"mousedown",move:"mousemove",stop:"mouseup"};let f=h,p=class extends e.Component{constructor(){super(...arguments),c(this,"dragging",!1),c(this,"lastX",NaN),c(this,"lastY",NaN),c(this,"touchIdentifier",null),c(this,"mounted",!1),c(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=t;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,n.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,n.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;"touchstart"===e.type&&e.preventDefault();const i=(0,n.getTouchIdentifier)(e);this.touchIdentifier=i;const a=(0,s.getControlPosition)(e,i,this);if(null==a)return;const{x:l,y:d}=a,c=(0,s.createCoreData)(this,l,d);(0,o.default)("DraggableCore: handleDragStart: %j",c),(0,o.default)("calling",this.props.onStart);!1!==this.props.onStart(e,c)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,n.addUserSelectStyles)(r),this.dragging=!0,this.lastX=l,this.lastY=d,(0,n.addEvent)(r,f.move,this.handleDrag),(0,n.addEvent)(r,f.stop,this.handleDragStop))}),c(this,"handleDrag",e=>{const t=(0,s.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:r,y:i}=t;if(Array.isArray(this.props.grid)){let e=r-this.lastX,t=i-this.lastY;if([e,t]=(0,s.snapToGrid)(this.props.grid,e,t),!e&&!t)return;r=this.lastX+e,i=this.lastY+t}const n=(0,s.createCoreData)(this,r,i);(0,o.default)("DraggableCore: handleDrag: %j",n);if(!1!==this.props.onDrag(e,n)&&!1!==this.mounted)this.lastX=r,this.lastY=i;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch(e){const t=document.createEvent("MouseEvents");t.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(t)}}),c(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,s.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:r,y:i}=t;if(Array.isArray(this.props.grid)){let e=r-this.lastX||0,t=i-this.lastY||0;[e,t]=(0,s.snapToGrid)(this.props.grid,e,t),r=this.lastX+e,i=this.lastY+t}const a=(0,s.createCoreData)(this,r,i);if(!1===this.props.onStop(e,a)||!1===this.mounted)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(l.ownerDocument),(0,o.default)("DraggableCore: handleDragStop: %j",a),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,o.default)("DraggableCore: Removing handlers"),(0,n.removeEvent)(l.ownerDocument,f.move,this.handleDrag),(0,n.removeEvent)(l.ownerDocument,f.stop,this.handleDragStop))}),c(this,"onMouseDown",e=>(f=h,this.handleDragStart(e))),c(this,"onMouseUp",e=>(f=h,this.handleDragStop(e))),c(this,"onTouchStart",e=>(f=u,this.handleDragStart(e))),c(this,"onTouchEnd",e=>(f=u,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,n.addEvent)(e,u.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,n.removeEvent)(t,h.move,this.handleDrag),(0,n.removeEvent)(t,u.move,this.handleDrag),(0,n.removeEvent)(t,h.stop,this.handleDragStop),(0,n.removeEvent)(t,u.stop,this.handleDragStop),(0,n.removeEvent)(e,u.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(t)}}findDOMNode(){var e,t;return null!==(e=this.props)&&void 0!==e&&e.nodeRef?null===(t=this.props)||void 0===t||null===(t=t.nodeRef)||void 0===t?void 0:t.current:i.default.findDOMNode(this)}render(){return e.cloneElement(e.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return Yh.default=p,c(p,"displayName","DraggableCore"),c(p,"propTypes",{allowAnyClick:r.default.bool,children:r.default.node.isRequired,disabled:r.default.bool,enableUserSelectHack:r.default.bool,offsetParent:function(e,t){if(e[t]&&1!==e[t].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:r.default.arrayOf(r.default.number),handle:r.default.string,cancel:r.default.string,nodeRef:r.default.object,onStart:r.default.func,onDrag:r.default.func,onStop:r.default.func,onMouseDown:r.default.func,scale:r.default.number,className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),c(p,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Yh}function Qh(){return Vh||(Vh=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return d.default}}),e.default=void 0;var r=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=h(t);if(r&&r.has(e))return r.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(i,s,a):i[s]=e[s]}i.default=e,r&&r.set(e,i);return i}(t),i=u(Ju()),n=u(y),s=u(Ch),a=Bh(),o=Gh(),l=Mh(),d=u(Xh()),c=u(qh());function u(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(h=function(e){return e?r:t})(e)}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},f.apply(this,arguments)}function p(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class m extends r.Component{static getDerivedStateFromProps(e,t){let{position:r}=e,{prevPropsPosition:i}=t;return!r||i&&r.x===i.x&&r.y===i.y?null:((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:r,prevPropsPosition:i}),{x:r.x,y:r.y,prevPropsPosition:{...r}})}constructor(e){super(e),p(this,"onDragStart",(e,t)=>{(0,c.default)("Draggable: onDragStart: %j",t);if(!1===this.props.onStart(e,(0,o.createDraggableData)(this,t)))return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(e,t)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",t);const r=(0,o.createDraggableData)(this,t),i={x:r.x,y:r.y,slackX:0,slackY:0};if(this.props.bounds){const{x:e,y:t}=i;i.x+=this.state.slackX,i.y+=this.state.slackY;const[n,s]=(0,o.getBoundPosition)(this,i.x,i.y);i.x=n,i.y=s,i.slackX=this.state.slackX+(e-i.x),i.slackY=this.state.slackY+(t-i.y),r.x=i.x,r.y=i.y,r.deltaX=i.x-this.state.x,r.deltaY=i.y-this.state.y}if(!1===this.props.onDrag(e,r))return!1;this.setState(i)}),p(this,"onDragStop",(e,t)=>{if(!this.state.dragging)return!1;if(!1===this.props.onStop(e,(0,o.createDraggableData)(this,t)))return!1;(0,c.default)("Draggable: onDragStop: %j",t);const r={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){const{x:e,y:t}=this.props.position;r.x=e,r.y=t}this.setState(r)}),this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},!e.position||e.onDrag||e.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var e,t;return null!==(e=null===(t=this.props)||void 0===t||null===(t=t.nodeRef)||void 0===t?void 0:t.current)&&void 0!==e?e:n.default.findDOMNode(this)}render(){const{axis:e,bounds:t,children:i,defaultPosition:n,defaultClassName:l,defaultClassNameDragging:c,defaultClassNameDragged:u,position:h,positionOffset:p,scale:m,...g}=this.props;let v={},y=null;const b=!Boolean(h)||this.state.dragging,E=h||n,w={x:(0,o.canDragX)(this)&&b?this.state.x:E.x,y:(0,o.canDragY)(this)&&b?this.state.y:E.y};this.state.isElementSVG?y=(0,a.createSVGTransform)(w,p):v=(0,a.createCSSTransform)(w,p);const S=(0,s.default)(i.props.className||"",l,{[c]:this.state.dragging,[u]:this.state.dragged});return r.createElement(d.default,f({},g,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),r.cloneElement(r.Children.only(i),{className:S,style:{...i.props.style,...v},transform:y}))}}e.default=m,p(m,"displayName","Draggable"),p(m,"propTypes",{...d.default.propTypes,axis:i.default.oneOf(["both","x","y","none"]),bounds:i.default.oneOfType([i.default.shape({left:i.default.number,right:i.default.number,top:i.default.number,bottom:i.default.number}),i.default.string,i.default.oneOf([!1])]),defaultClassName:i.default.string,defaultClassNameDragging:i.default.string,defaultClassNameDragged:i.default.string,defaultPosition:i.default.shape({x:i.default.number,y:i.default.number}),positionOffset:i.default.shape({x:i.default.oneOfType([i.default.number,i.default.string]),y:i.default.oneOfType([i.default.number,i.default.string])}),position:i.default.shape({x:i.default.number,y:i.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),p(m,"defaultProps",{...d.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(Ih)),Ih}var Zh=function(){if(Wh)return Lh.exports;Wh=1;const{default:e,DraggableCore:t}=Qh();return Lh.exports=e,Lh.exports.default=e,Lh.exports.DraggableCore=t,Lh.exports}(),Jh=je(Zh),ef=function(){return ef=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},ef.apply(this,arguments)},tf={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},rf={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},nf={width:"20px",height:"20px",position:"absolute",zIndex:1},sf={top:ef(ef({},tf),{top:"-5px"}),right:ef(ef({},rf),{left:void 0,right:"-5px"}),bottom:ef(ef({},tf),{top:void 0,bottom:"-5px"}),left:ef(ef({},rf),{left:"-5px"}),topRight:ef(ef({},nf),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:ef(ef({},nf),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:ef(ef({},nf),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:ef(ef({},nf),{left:"-10px",top:"-10px",cursor:"nw-resize"})},af=h(function(e){var t=e.onResizeStart,r=e.direction,i=e.children,n=e.replaceStyles,s=e.className,a=c(function(e){t(e,r)},[t,r]),o=c(function(e){t(e,r)},[t,r]),l=u(function(){return ef(ef({position:"absolute",userSelect:"none"},sf[r]),null!=n?n:{})},[n,r]);return p("div",{className:s||void 0,style:l,onMouseDown:a,onTouchStart:o,children:i})}),of=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),lf=function(){return lf=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},lf.apply(this,arguments)},df={width:"auto",height:"auto"},cf=function(e,t,r){return Math.max(Math.min(e,r),t)},uf=function(e,t,r){var i=Math.round(e/t);return i*t+r*(i-1)},hf=function(e,t){return new RegExp(e,"i").test(t)},ff=function(e){return Boolean(e.touches&&e.touches.length)},pf=function(e,t,r){void 0===r&&(r=0);var i=t.reduce(function(r,i,n){return Math.abs(i-e)<Math.abs(t[r]-e)?n:r},0),n=Math.abs(t[i]-e);return 0===r||n<r?t[i]:e},mf=function(e){return"auto"===(e=e.toString())||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:"".concat(e,"px")},gf=function(e,t,r,i){if(e&&"string"==typeof e){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%"))return t*(Number(e.replace("%",""))/100);if(e.endsWith("vw"))return r*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return i*(Number(e.replace("vh",""))/100)}return e},vf=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],yf="__resizable_base__",bf=function(e){function t(t){var r,i,n,s,a=e.call(this,t)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.delta={width:0,height:0},a.appendBase=function(){if(!a.resizable||!a.window)return null;var e=a.parentNode;if(!e)return null;var t=a.window.document.createElement("div");return t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.transform="scale(0, 0)",t.style.left="0",t.style.flex="0 0 100%",t.classList?t.classList.add(yf):t.className+=yf,e.appendChild(t),t},a.removeBase=function(e){var t=a.parentNode;t&&t.removeChild(e)},a.state={isResizing:!1,width:null!==(i=null===(r=a.propsSize)||void 0===r?void 0:r.width)&&void 0!==i?i:"auto",height:null!==(s=null===(n=a.propsSize)||void 0===n?void 0:n.height)&&void 0!==s?s:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return of(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||df},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var r=this.resizable.offsetWidth,i=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:r,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:i,this.resizable.style.position=n}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,r=function(t){var r;if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&(null===(r=e.propsSize[t])||void 0===r?void 0:r.toString().endsWith("%"))){if(e.state[t].toString().endsWith("%"))return e.state[t].toString();var i=e.getParentSize(),n=Number(e.state[t].toString().replace("px",""))/i[t]*100;return"".concat(n,"%")}return mf(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?mf(t.width):r("width"),height:t&&void 0!==t.height&&!this.state.isResizing?mf(t.height):r("height")}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,r=this.parentNode.style.flexWrap;"wrap"!==r&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var i={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=r),this.removeBase(e),i},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable&&this.window){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var r=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==r&&"auto"!==r?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var r,i,n=this.props.boundsByDirection,s=this.state.direction,a=n&&hf("left",s),o=n&&hf("top",s);if("parent"===this.props.bounds){var l=this.parentNode;l&&(r=a?this.resizableRight-this.parentLeft:l.offsetWidth+(this.parentLeft-this.resizableLeft),i=o?this.resizableBottom-this.parentTop:l.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(r=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,i=o?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(r=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),i=o?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return r&&Number.isFinite(r)&&(e=e&&e<r?e:r),i&&Number.isFinite(i)&&(t=t&&t<i?t:i),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var r,i=this.props.scale||1,n=(r=this.props.resizeRatio||1,Array.isArray(r)?r:[r,r]),s=n[0],a=n[1],o=this.state,l=o.direction,d=o.original,c=this.props,u=c.lockAspectRatio,h=c.lockAspectRatioExtraHeight,f=c.lockAspectRatioExtraWidth,p=d.width,m=d.height,g=h||0,v=f||0;return hf("right",l)&&(p=d.width+(e-d.x)*s/i,u&&(m=(p-v)/this.ratio+g)),hf("left",l)&&(p=d.width-(e-d.x)*s/i,u&&(m=(p-v)/this.ratio+g)),hf("bottom",l)&&(m=d.height+(t-d.y)*a/i,u&&(p=(m-g)*this.ratio+v)),hf("top",l)&&(m=d.height-(t-d.y)*a/i,u&&(p=(m-g)*this.ratio+v)),{newWidth:p,newHeight:m}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,r,i){var n=this.props,s=n.lockAspectRatio,a=n.lockAspectRatioExtraHeight,o=n.lockAspectRatioExtraWidth,l=void 0===i.width?10:i.width,d=void 0===r.width||r.width<0?e:r.width,c=void 0===i.height?10:i.height,u=void 0===r.height||r.height<0?t:r.height,h=a||0,f=o||0;if(s){var p=(c-h)*this.ratio+f,m=(u-h)*this.ratio+f,g=(l-f)/this.ratio+h,v=(d-f)/this.ratio+h,y=Math.max(l,p),b=Math.min(d,m),E=Math.max(c,g),w=Math.min(u,v);e=cf(e,y,b),t=cf(t,E,w)}else e=cf(e,l,d),t=cf(t,c,u);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){var e=1/(this.props.scale||1);if("parent"===this.props.bounds){var t=this.parentNode;if(t){var r=t.getBoundingClientRect();this.parentLeft=r.left*e,this.parentTop=r.top*e}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left*e,this.targetTop=i.top*e}if(this.resizable){var n=this.resizable.getBoundingClientRect(),s=n.left,a=n.top,o=n.right,l=n.bottom;this.resizableLeft=s*e,this.resizableRight=o*e,this.resizableTop=a*e,this.resizableBottom=l*e}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var r,i=0,n=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(i=e.nativeEvent.clientX,n=e.nativeEvent.clientY):e.nativeEvent&&ff(e.nativeEvent)&&(i=e.nativeEvent.touches[0].clientX,n=e.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var s=this.window.getComputedStyle(this.resizable);if("auto"!==s.flexBasis){var a=this.parentNode;if(a){var o=this.window.getComputedStyle(a).flexDirection;this.flexDir=o.startsWith("row")?"row":"column",r=s.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var l={original:{x:i,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:lf(lf({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:r};this.setState(l)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&ff(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var r=this.props,i=r.maxWidth,n=r.maxHeight,s=r.minWidth,a=r.minHeight,o=ff(e)?e.touches[0].clientX:e.clientX,l=ff(e)?e.touches[0].clientY:e.clientY,d=this.state,c=d.direction,u=d.original,h=d.width,f=d.height,p=this.getParentSize(),m=function(e,t,r,i,n,s,a){return i=gf(i,e.width,t,r),n=gf(n,e.height,t,r),s=gf(s,e.width,t,r),a=gf(a,e.height,t,r),{maxWidth:void 0===i?void 0:Number(i),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===s?void 0:Number(s),minHeight:void 0===a?void 0:Number(a)}}(p,this.window.innerWidth,this.window.innerHeight,i,n,s,a);i=m.maxWidth,n=m.maxHeight,s=m.minWidth,a=m.minHeight;var g=this.calculateNewSizeFromDirection(o,l),v=g.newHeight,y=g.newWidth,b=this.calculateNewMaxFromBoundary(i,n);this.props.snap&&this.props.snap.x&&(y=pf(y,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=pf(v,this.props.snap.y,this.props.snapGap));var w=this.calculateNewSizeFromAspectRatio(y,v,{width:b.maxWidth,height:b.maxHeight},{width:s,height:a});if(y=w.newWidth,v=w.newHeight,this.props.grid){var S=uf(y,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),T=uf(v,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),x=this.props.snapGap||0;y=0===x||Math.abs(S-y)<=x?S:y,v=0===x||Math.abs(T-v)<=x?T:v}var A={width:y-u.width,height:v-u.height};if(this.delta=A,h&&"string"==typeof h)if(h.endsWith("%")){var k=y/p.width*100;y="".concat(k,"%")}else if(h.endsWith("vw")){var L=y/this.window.innerWidth*100;y="".concat(L,"vw")}else if(h.endsWith("vh")){var I=y/this.window.innerHeight*100;y="".concat(I,"vh")}if(f&&"string"==typeof f)if(f.endsWith("%")){k=v/p.height*100;v="".concat(k,"%")}else if(f.endsWith("vw")){L=v/this.window.innerWidth*100;v="".concat(L,"vw")}else if(f.endsWith("vh")){I=v/this.window.innerHeight*100;v="".concat(I,"vh")}var R={width:this.createSizeForCssProperty(y,"width"),height:this.createSizeForCssProperty(v,"height")};"row"===this.flexDir?R.flexBasis=R.width:"column"===this.flexDir&&(R.flexBasis=R.height);var P=this.state.width!==R.width,D=this.state.height!==R.height,C=this.state.flexBasis!==R.flexBasis,_=P||D||C;_&&E(function(){t.setState(R)}),this.props.onResize&&_&&this.props.onResize(e,c,this.resizable,A)}},t.prototype.onMouseUp=function(e){var t,r,i=this.state,n=i.isResizing,s=i.direction;i.original,n&&this.resizable&&(this.props.onResizeStop&&this.props.onResizeStop(e,s,this.resizable,this.delta),this.props.size&&this.setState({width:null!==(t=this.props.size.width)&&void 0!==t?t:"auto",height:null!==(r=this.props.size.height)&&void 0!==r?r:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:lf(lf({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(e){var t,r;this.setState({width:null!==(t=e.width)&&void 0!==t?t:"auto",height:null!==(r=e.height)&&void 0!==r?r:"auto"})},t.prototype.renderResizer=function(){var e=this,t=this.props,r=t.enable,i=t.handleStyles,n=t.handleClasses,s=t.handleWrapperStyle,a=t.handleWrapperClass,o=t.handleComponent;if(!r)return null;var l=Object.keys(r).map(function(t){return!1!==r[t]?p(af,{direction:t,onResizeStart:e.onResizeStart,replaceStyles:i&&i[t],className:n&&n[t],children:o&&o[t]?o[t]:null},t):null});return p("div",{className:a,style:s,children:l})},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce(function(t,r){return-1!==vf.indexOf(r)||(t[r]=e.props[r]),t},{}),r=lf(lf(lf({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(r.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return g(i,lf({style:r,className:this.props.className},t,{ref:function(t){t&&(e.resizable=t)},children:[this.state.isResizing&&p("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(f),Ef=function(e,t){return Ef=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},Ef(e,t)};var wf=function(){return wf=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},wf.apply(this,arguments)};var Sf={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},Tf=function(e){function t(t){var r=e.call(this,t)||this;return r.resizingPosition={x:0,y:0},r.offsetFromParent={left:0,top:0},r.resizableElement={current:null},r.originalPosition={x:0,y:0},r.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:t.maxWidth,maxHeight:t.maxHeight},r.onResizeStart=r.onResizeStart.bind(r),r.onResize=r.onResize.bind(r),r.onResizeStop=r.onResizeStop.bind(r),r.onDragStart=r.onDragStart.bind(r),r.onDrag=r.onDrag.bind(r),r.onDragStop=r.onDragStop.bind(r),r.getMaxSizesFromProps=r.getMaxSizesFromProps.bind(r),r}return function(e,t){function r(){this.constructor=e}Ef(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var e=this.offsetFromParent,t=e.left,r=e.top,i=this.getDraggablePosition(),n=i.x,s=i.y;this.draggable.setState({x:n-t,y:s-r}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var e=this.draggable.state;return{x:e.x,y:e.y}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){return{maxWidth:void 0===this.props.maxWidth?Number.MAX_SAFE_INTEGER:this.props.maxWidth,maxHeight:void 0===this.props.maxHeight?Number.MAX_SAFE_INTEGER:this.props.maxHeight}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(e){var t=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/t;case"body":return document.body.offsetHeight/t;default:return e.offsetHeight}},t.prototype.getOffsetWidth=function(e){var t=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/t;case"body":return document.body.offsetWidth/t;default:return e.offsetWidth}},t.prototype.onDragStart=function(e,t){this.props.onDragStart&&this.props.onDragStart(e,t);var r=this.getDraggablePosition();if(this.originalPosition=r,this.props.bounds){var i,n=this.getParent(),s=this.props.scale;if("parent"===this.props.bounds)i=n;else{if("body"===this.props.bounds){var a=n.getBoundingClientRect(),o=a.left,l=a.top,d=document.body.getBoundingClientRect(),c=-(o-n.offsetLeft*s-d.left)/s,u=-(l-n.offsetTop*s-d.top)/s,h=(document.body.offsetWidth-this.resizable.size.width*s)/s+c,f=(document.body.offsetHeight-this.resizable.size.height*s)/s+u;return this.setState({bounds:{top:u,right:h,bottom:f,left:c}})}if("window"===this.props.bounds){if(!this.resizable)return;var p=n.getBoundingClientRect(),m=p.left,g=p.top,v=-(m-n.offsetLeft*s)/s,y=-(g-n.offsetTop*s)/s;h=(window.innerWidth-this.resizable.size.width*s)/s+v,f=(window.innerHeight-this.resizable.size.height*s)/s+y;return this.setState({bounds:{top:y,right:h,bottom:f,left:v}})}"string"==typeof this.props.bounds?i=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(i=this.props.bounds)}if(i instanceof HTMLElement&&n instanceof HTMLElement){var b=i.getBoundingClientRect(),E=b.left,w=b.top,S=n.getBoundingClientRect(),T=(E-S.left)/s,x=w-S.top;if(this.resizable){this.updateOffsetFromParent();var A=this.offsetFromParent;this.setState({bounds:{top:x-A.top,right:T+(i.offsetWidth-this.resizable.size.width)-A.left/s,bottom:x+(i.offsetHeight-this.resizable.size.height)-A.top,left:T-A.left/s}})}}}},t.prototype.onDrag=function(e,t){if(this.props.onDrag){var r=this.offsetFromParent,i=r.left,n=r.top;return this.props.dragAxis&&"both"!==this.props.dragAxis?"x"===this.props.dragAxis?this.props.onDrag(e,wf(wf({},t),{x:t.x+i,y:this.originalPosition.y+n,deltaY:0})):"y"===this.props.dragAxis?this.props.onDrag(e,wf(wf({},t),{x:this.originalPosition.x+i,y:t.y+n,deltaX:0})):void 0:this.props.onDrag(e,wf(wf({},t),{x:t.x+i,y:t.y+n}))}},t.prototype.onDragStop=function(e,t){if(this.props.onDragStop){var r=this.offsetFromParent,i=r.left,n=r.top;return this.props.dragAxis&&"both"!==this.props.dragAxis?"x"===this.props.dragAxis?this.props.onDragStop(e,wf(wf({},t),{x:t.x+i,y:this.originalPosition.y+n,deltaY:0})):"y"===this.props.dragAxis?this.props.onDragStop(e,wf(wf({},t),{x:this.originalPosition.x+i,y:t.y+n,deltaX:0})):void 0:this.props.onDragStop(e,wf(wf({},t),{x:t.x+i,y:t.y+n}))}},t.prototype.onResizeStart=function(e,t,r){e.stopPropagation(),this.setState({resizing:!0});var i=this.props.scale,n=this.offsetFromParent,s=this.getDraggablePosition();if(this.resizingPosition={x:s.x+n.left,y:s.y+n.top},this.originalPosition=s,this.props.bounds){var a=this.getParent(),o=void 0;"parent"===this.props.bounds?o=a:"body"===this.props.bounds?o=document.body:"window"===this.props.bounds?o=window:"string"==typeof this.props.bounds?o=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(o=this.props.bounds);var l=this.getSelfElement();if(l instanceof Element&&(o instanceof HTMLElement||o===window)&&a instanceof HTMLElement){var d=this.getMaxSizesFromProps(),c=d.maxWidth,u=d.maxHeight,h=this.getParentSize();if(c&&"string"==typeof c)if(c.endsWith("%")){var f=Number(c.replace("%",""))/100;c=h.width*f}else c.endsWith("px")&&(c=Number(c.replace("px","")));if(u&&"string"==typeof u)if(u.endsWith("%")){f=Number(u.replace("%",""))/100;u=h.height*f}else u.endsWith("px")&&(u=Number(u.replace("px","")));var p=l.getBoundingClientRect(),m=p.left,g=p.top,v="window"===this.props.bounds?{left:0,top:0}:o.getBoundingClientRect(),y=v.left,b=v.top,E=this.getOffsetWidth(o),w=this.getOffsetHeight(o),S=t.toLowerCase().endsWith("left"),T=t.toLowerCase().endsWith("right"),x=t.startsWith("top"),A=t.startsWith("bottom");if((S||x)&&this.resizable){var k=(m-y)/i+this.resizable.size.width;this.setState({maxWidth:k>Number(c)?c:k})}if(T||this.props.lockAspectRatio&&!S&&!x){k=E+(y-m)/i;this.setState({maxWidth:k>Number(c)?c:k})}if((x||S)&&this.resizable){k=(g-b)/i+this.resizable.size.height;this.setState({maxHeight:k>Number(u)?u:k})}if(A||this.props.lockAspectRatio&&!x&&!S){k=w+(b-g)/i;this.setState({maxHeight:k>Number(u)?u:k})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(e,t,r)},t.prototype.onResize=function(e,t,r,i){var n=this,s={x:this.originalPosition.x,y:this.originalPosition.y},a=-i.width,o=-i.height;["top","left","topLeft","bottomLeft","topRight"].includes(t)&&("bottomLeft"===t?s.x+=a:("topRight"===t||(s.x+=a),s.y+=o));var l=this.draggable.state;s.x===l.x&&s.y===l.y||E(function(){n.draggable.setState(s)}),this.updateOffsetFromParent();var d=this.offsetFromParent,c=this.getDraggablePosition().x+d.left,u=this.getDraggablePosition().y+d.top;this.resizingPosition={x:c,y:u},this.props.onResize&&this.props.onResize(e,t,r,i,{x:c,y:u})},t.prototype.onResizeStop=function(e,t,r,i){this.setState({resizing:!1});var n=this.getMaxSizesFromProps(),s=n.maxWidth,a=n.maxHeight;this.setState({maxWidth:s,maxHeight:a}),this.props.onResizeStop&&this.props.onResizeStop(e,t,r,i,this.resizingPosition)},t.prototype.updateSize=function(e){this.resizable&&this.resizable.updateSize({width:e.width,height:e.height})},t.prototype.updatePosition=function(e){this.draggable.setState(e)},t.prototype.updateOffsetFromParent=function(){var e=this.props.scale,t=this.getParent(),r=this.getSelfElement();if(!t||null===r)return{top:0,left:0};var i=t.getBoundingClientRect(),n=i.left,s=i.top,a=r.getBoundingClientRect(),o=this.getDraggablePosition(),l=t.scrollLeft,d=t.scrollTop;this.offsetFromParent={left:a.left-n+l-o.x*e,top:a.top-s+d-o.y*e}},t.prototype.render=function(){var e=this,t=this.props,r=t.disableDragging,i=t.style,n=t.dragHandleClassName,a=t.position,o=t.onMouseDown,l=t.onMouseUp,d=t.dragAxis,c=t.dragGrid,u=t.bounds,h=t.enableUserSelectHack,f=t.cancel,p=t.children;t.onResizeStart,t.onResize,t.onResizeStop,t.onDragStart,t.onDrag,t.onDragStop;var m=t.resizeHandleStyles,g=t.resizeHandleClasses,v=t.resizeHandleComponent,y=t.enableResizing,b=t.resizeGrid,E=t.resizeHandleWrapperClass,w=t.resizeHandleWrapperStyle,S=t.scale,T=t.allowAnyClick,x=t.dragPositionOffset,A=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(t,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","bounds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),k=this.props.default?wf({},this.props.default):void 0;delete A.default;var L,I=r||n?{cursor:"auto"}:{cursor:"move"},R=wf(wf(wf({},Sf),I),i),P=this.offsetFromParent,D=P.left,C=P.top;a&&(L={x:a.x-D,y:a.y-C});var _,O=this.state.resizing?void 0:L,M=this.state.resizing?"both":d;return s(Jh,{ref:function(t){t&&(e.draggable=t)},handle:n?".".concat(n):void 0,defaultPosition:k,onMouseDown:o,onMouseUp:l,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:M,disabled:r,grid:c,bounds:u?this.state.bounds:void 0,position:O,enableUserSelectHack:h,cancel:f,scale:S,allowAnyClick:T,nodeRef:this.resizableElement,positionOffset:x},s(bf,wf({},A,{ref:function(t){t&&(e.resizable=t,e.resizableElement.current=t.resizable)},defaultSize:k,size:this.props.size,enable:"boolean"==typeof y?(_=y,{bottom:_,bottomLeft:_,bottomRight:_,left:_,right:_,top:_,topLeft:_,topRight:_}):y,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:R,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:b,handleWrapperClass:E,handleWrapperStyle:w,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:m,handleClasses:g,handleComponent:v,scale:this.props.scale}),p))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t}(f);const xf=({shortform:e,setClose:r})=>{const[n,s]=t.useState(!0),[o,l]=a(!0),[d,c]=a(!1),u=t.useRef(null),h=()=>{u.current&&(window.clearTimeout(u.current),u.current=null)},f=(e=1500)=>{h(),u.current=window.setTimeout(()=>c(!1),e)};return i(()=>()=>h(),[]),t.createElement("div",{className:"relative w-full h-full",onClick:()=>{c(!0),f(2e3)},onMouseLeave:()=>f(800),onMouseEnter:()=>d&&f(1500)},t.createElement("div",{className:"absolute inset-0 bg-black",style:{zIndex:1,opacity:d?.4:0,transition:"opacity 300ms ease",pointerEvents:d?"auto":"none"}}),t.createElement("div",{className:"absolute inset-0",style:{zIndex:2,opacity:d?1:0,transition:"opacity 300ms ease",pointerEvents:d?"auto":"none"}},t.createElement("div",{className:"absolute text-white flex gap-2",style:{zIndex:3,top:8,right:8}},t.createElement("button",{className:"cursor-pointer",onClick:e=>{e.stopPropagation(),s(e=>!e)},"aria-label":n?"Unmute":"Mute"},n?t.createElement(qt,{size:20}):t.createElement(Kt,{size:20})),t.createElement("button",{className:"cursor-pointer",onClick:e=>{null==e||e.stopPropagation(),r()},"aria-label":"Close"},t.createElement(Xt,{size:20}))),t.createElement("div",{className:"absolute inset-0 flex items-center justify-center",style:{pointerEvents:"none"}},t.createElement("button",{onClick:e=>{null==e||e.stopPropagation(),l(e=>!e)},"aria-label":o?"Pause":"Play",className:"cursor-pointer text-white p-2 ",style:{pointerEvents:"auto"}},o?t.createElement(Vt,{size:28}):t.createElement(Wt,{size:28})))),t.createElement(Ct,{shortform:e,mute:n,play:o}))},Af=({shortsId:e,type:r})=>{const{shortform:n}=kh(),[s,o]=a(!1),{playtime:l}=Ns(),d=()=>{if(!n)return;o(!0);const{shortsId:e,uuid:t,userId:r}=n;Us({contentId:e,uuid:t,type:Et.SHORTS,playtime:l,userId:r})};(({shorform:e,playtime:t})=>{i(()=>{if(!e)return;const{shortsId:t,shortsUuid:r,userId:i}=e;Bs({contentId:t,uuid:r,type:Et.SHORTS,userId:i,isFirstPlay:!Lt(t)})},[]);const r=Os();i(()=>{if(!e||r)return;const{shortsId:i,uuid:n,userId:s}=e;Us({contentId:i,uuid:n,type:Et.SHORTS,playtime:t,userId:s})},[r])})({shorform:n,playtime:l});const{w:c,h:u,left:h,top:f}=(()=>{const e=window.visualViewport;return e?{w:e.width,h:e.height,left:e.offsetLeft,top:e.offsetTop}:{w:window.innerWidth,h:window.innerHeight,left:0,top:0}})();return n&&!s&&t.createElement(Tf,{minWidth:240,lockAspectRatio:9/16,style:{zIndex:99999},default:{width:240,height:427,x:h+c-240-50,y:f+u-427-50},bounds:"window"},"shopping"===r&&n.productsInfo.length>0?t.createElement(Pd,{shortForm:n,handleClose:d}):t.createElement(xf,{shortform:n,setClose:d}))},kf=({shortsId:e,type:r,isPreview:n})=>{const{setShortform:s,shortform:a}=kh();return i(()=>{if(!e)return;e&&x(void 0,void 0,void 0,function*(){const t=yield Vs(e,n);t&&s(Object.assign(Object.assign({},t),{uuid:kt()}))})},[e]),a?t.createElement(hh.div,{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:99999}},t.createElement(bh,null),t.createElement("div",{style:{pointerEvents:"auto"}},t.createElement(Af,{shortsId:e,type:r}))):null},Lf=Zs(e=>({liveWidget:null,setLiveWidget:t=>e({liveWidget:t}),nextKey:"",setNextKey:t=>e({nextKey:t}),isFetching:!1,setIsFetching:t=>e({isFetching:t})})),If=({opacity:e=.4,className:r})=>{const i=Math.max(0,Math.min(1,e));return t.createElement("div",{"aria-hidden":!0,role:"presentation",className:`absolute inset-0 pointer-events-none ${null!=r?r:""}`,style:{backgroundColor:`rgba(0,0,0,${i})`,borderRadius:"inherit"}})},Rf=({content:e})=>{const{PLAYER_BASE_URL:r}=gt();return t.createElement("iframe",{src:`${r}/live/${e.eventId}`,className:"w-full h-full block",style:{border:0,display:"block"},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,scrolling:"no",referrerPolicy:"no-referrer-when-downgrade"})},Pf=(e,r)=>{const[i,n]=t.useState({}),[s,a]=t.useState({primary:20,secondary:12});return t.useEffect(()=>{const t=r.current;if(!t)return;const i=()=>{const r=t.getBoundingClientRect(),i=Math.max(0,Math.floor(r.width)),s=Math.max(0,Math.floor(r.height)),[o,l]=e.includes("/")?e.split("/").map(e=>parseFloat(e)):[1,1],d=l/o;let c,u;i>0&&s>0?(c=i,u=Math.round(c*d),u>s&&(u=s,c=Math.round(u/d)),n({width:c,height:u})):n({});const h="number"==typeof c?c:i,f=Math.max(16,Math.round(.075*h)),p=Math.max(11,Math.round(.042*h));a({primary:f,secondary:p})};if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>i());return e.observe(t),()=>e.disconnect()}{const e=()=>i();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}},[e]),{fontSize:s,boxSize:i}},Df=({content:e,aspectRatio:r="9/16",cursor:i="default",borderRadius:n})=>{var s,o;const{leftTime:l}=(e=>{const{start:t}=e,r=qe().tz("Asia/Seoul").unix(),[i,n]=a(t-r>0?t-r:0);return Ms(()=>{n(i<=0?0:e=>e-1)},1e3),{leftTime:i}})(e),d=null===(o=null===(s=null==e?void 0:e.designInfo)||void 0===s?void 0:s.thumbPath)||void 0===o?void 0:o.preview,c=t.useRef(null),{boxSize:u,fontSize:h}=Pf(r,c),{PLAYER_BASE_URL:f}=gt(),p=Math.floor(Date.now()/1e3),m="number"==typeof e.end&&e.end>0&&e.end<p;return t.createElement("div",{className:"w-full h-full flex items-center justify-center",ref:c},t.createElement("div",{className:"relative rounded overflow-hidden",style:{width:u.width?`${u.width}px`:"100%",height:u.height?`${u.height}px`:"100%",borderRadius:`${null!=n?n:10}px`,backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:u.height?void 0:r,backgroundImage:d?`url(${Rt(d)})`:void 0,backgroundColor:d?void 0:"black"}},1===e.openStatus?t.createElement(t.Fragment,null,t.createElement(Rf,{content:e}),t.createElement("a",{href:`${f}/live/${e.eventId}`,target:"_blank",rel:"noopener noreferrer","aria-label":`${e.eventName} 바로가기`,style:{position:"absolute",inset:0,zIndex:30,display:"block",textDecoration:"none",cursor:"pointer",background:"transparent"}})):m?t.createElement(t.Fragment,null,t.createElement(If,null),t.createElement("div",{className:"text-white flex flex-col items-center justify-center absolute inset-0",style:{zIndex:10,gap:"12px",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",cursor:i,pointerEvents:"none"}},t.createElement("p",{style:{fontSize:`${h.primary}px`,fontWeight:700}},"다시보기"),t.createElement("p",{style:{fontSize:`${h.secondary}px`}},"라이브가 종료되었습니다"))):t.createElement(t.Fragment,null,t.createElement(If,null),t.createElement("div",{className:"text-white flex flex-col items-center justify-center absolute inset-0",style:{zIndex:10,gap:"20px",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",cursor:i,pointerEvents:"none"}},t.createElement("p",{style:{fontSize:`${h.primary}px`}},((e,t)=>{if(e>86400)return qe.unix(t).tz("Asia/Seoul").format("M월 D일 A h시 mm분");const r=qe.duration(e,"seconds");return`${r.hours().toString().padStart(2,"0")}:${r.minutes().toString().padStart(2,"0")}:${r.seconds().toString().padStart(2,"0")}`})(l,e.start)),t.createElement("p",{style:{fontSize:`${h.secondary}px`}},"곧 라이브가 시작됩니다!")))))},Cf=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},_f=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=Of},Of=Number.MAX_SAFE_INTEGER||9007199254740991;let Mf=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),Nf=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.UNKNOWN="unknown",e}({}),Ff=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.STALL_RESOLVED="hlsStallResolved",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({});var $f="manifest",Bf="level",Uf="audioTrack",zf="subtitleTrack",Gf="main",jf="audio",Hf="subtitle";class Vf{constructor(e,t=0,r=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=r}sample(e,t){const r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class Wf{constructor(e,t,r,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Vf(e),this.fast_=new Vf(t),this.defaultTTFB_=i,this.ttfb_=new Vf(e)}update(e,t){const{slow_:r,fast_:i,ttfb_:n}=this;r.halfLife!==e&&(this.slow_=new Vf(e,r.getEstimate(),r.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Vf(t,i.getEstimate(),i.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Vf(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){const r=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(e){const t=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(r,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function Yf(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Kf(){return Kf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Kf.apply(null,arguments)}function qf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Xf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qf(Object(r),!0).forEach(function(t){Yf(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qf(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}class Qf{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const r=`[${e}]:`;this.trace=Zf,this.debug=t.debug.bind(null,r),this.log=t.log.bind(null,r),this.warn=t.warn.bind(null,r),this.info=t.info.bind(null,r),this.error=t.error.bind(null,r)}}const Zf=function(){},Jf={trace:Zf,debug:Zf,log:Zf,warn:Zf,info:Zf,error:Zf};function ep(){return Kf({},Jf)}function tp(e,t,r){return t[e]?t[e].bind(t):function(e,t){const r=self.console[e];return r?r.bind(self.console,`${t?"["+t+"] ":""}[${e}] >`):Zf}(e,r)}const rp=ep();const ip=rp;function np(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function sp(e,t){const r=Object.keys(e),i=Object.keys(t),n=r.length,s=i.length;return!n||!s||n===s&&!r.some(e=>-1===i.indexOf(e))}function ap(e,t=!1){if("undefined"!=typeof TextDecoder){const r=new TextDecoder("utf-8").decode(e);if(t){const e=r.indexOf("\0");return-1!==e?r.substring(0,e):r}return r.replace(/\0/g,"")}const r=e.length;let i,n,s,a="",o=0;for(;o<r;){if(i=e[o++],0===i&&t)return a;if(0!==i&&3!==i)switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:n=e[o++],a+=String.fromCharCode((31&i)<<6|63&n);break;case 14:n=e[o++],s=e[o++],a+=String.fromCharCode((15&i)<<12|(63&n)<<6|63&s)}}return a}function op(e){let t="";for(let r=0;r<e.length;r++){let i=e[r].toString(16);i.length<2&&(i="0"+i),t+=i}return t}function lp(e){return Uint8Array.from(e.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function dp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cp,up={exports:{}};var hp,fp,pp,mp,gp,vp=cp?up.exports:(cp=1,hp=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,fp=/^(?=([^\/?#]*))\1([^]*)$/,pp=/(?:\/|^)\.(?=\/)/g,mp=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,up.exports=gp={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var i=gp.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=gp.normalizePath(i.path),gp.buildURLFromParts(i)}var n=gp.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=gp.normalizePath(n.path),gp.buildURLFromParts(n)):t;var s=gp.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var a=fp.exec(s.path);s.netLoc=a[1],s.path=a[2]}s.netLoc&&!s.path&&(s.path="/");var o={scheme:s.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(o.netLoc=s.netLoc,"/"!==n.path[0]))if(n.path){var l=s.path,d=l.substring(0,l.lastIndexOf("/")+1)+n.path;o.path=gp.normalizePath(d)}else o.path=s.path,n.params||(o.params=s.params,n.query||(o.query=s.query));return null===o.path&&(o.path=r.alwaysNormalize?gp.normalizePath(n.path):n.path),gp.buildURLFromParts(o)},parseURL:function(e){var t=hp.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(pp,"");e.length!==(e=e.replace(mp,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}});class yp{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var bp="audio",Ep="video",wp="audiovideo";class Sp{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof e&&(e={url:e}),this.base=e,function(e,t){const r=kp(e,t);r&&(r.enumerable=!0,Object.defineProperty(e,t,r))}(this,"stats")}setByteRange(e,t){const r=e.split("@",2);let i;i=1===r.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(r[1]),this._byteRange=[i,parseInt(r[0])+i]}get baseurl(){return this.base.url}get byteRange(){return null===this._byteRange?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return null===this._streams&&(this._streams={[bp]:null,[Ep]:null,[wp]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return null!==this._stats}get hasStreams(){return null!==this._streams}get stats(){return null===this._stats&&(this._stats=new yp),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=vp.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[bp]=null,e[Ep]=null,e[wp]=null}}function Tp(e){return"initSegment"!==e.sn}class xp extends Sp{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(Cf(e)&&Cf(t))return t-e}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(null==(e=this._decryptdata)||!e.keyId){const e=Object.keys(t);if(1===e.length){const r=this._decryptdata=t[e[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;const e=Cf(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t;const e=Object.keys(this.levelkeys),r=e.length;if(r>1||1===r&&null!=(t=this.levelkeys[e[0]])&&t.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){Cf(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}get ref(){return Tp(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var r;const i=t[e];!i||null!=(r=this._decryptdata)&&r.keyId||(this._decryptdata=i.getDecryptData(this.sn,t))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,r,i,n,s=!1){const{elementaryStreams:a}=this,o=a[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,n)):a[e]={startPTS:t,endPTS:r,startDTS:i,endDTS:n,partial:s}}}class Ap extends Sp{constructor(e,t,r,i,n){super(r),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const s=e.enumeratedString("BYTERANGE");s&&this.setByteRange(s,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function kp(e,t){const r=Object.getPrototypeOf(e);if(r){const e=Object.getOwnPropertyDescriptor(r,t);return e||kp(r,t)}}const Lp=Math.pow(2,32)-1,Ip=[].push,Rp={video:1,audio:2,id3:3,text:4};function Pp(e){return String.fromCharCode.apply(null,e)}function Dp(e,t){const r=e[t]<<8|e[t+1];return r<0?65536+r:r}function Cp(e,t){const r=Op(e,t);return r<0?4294967296+r:r}function _p(e,t){let r=Cp(e,t);return r*=Math.pow(2,32),r+=Cp(e,t+4),r}function Op(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Mp(e,t){const r=[];if(!t.length)return r;const i=e.byteLength;for(let n=0;n<i;){const s=Cp(e,n),a=s>1?n+s:i;if(Pp(e.subarray(n+4,n+8))===t[0])if(1===t.length)r.push(e.subarray(n+8,a));else{const i=Mp(e.subarray(n+8,a),t.slice(1));i.length&&Ip.apply(r,i)}n=a}return r}function Np(e){const t=[],r=e[0];let i=8;const n=Cp(e,i);i+=4;let s=0,a=0;0===r?(s=Cp(e,i),a=Cp(e,i+4),i+=8):(s=_p(e,i),a=_p(e,i+8),i+=16),i+=2;let o=e.length+a;const l=Dp(e,i);i+=2;for(let r=0;r<l;r++){let r=i;const s=Cp(e,r);r+=4;const a=2147483647&s;if(1===(2147483648&s)>>>31)return ip.warn("SIDX has hierarchical references (not supported)"),null;const l=Cp(e,r);r+=4,t.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/n,start:o,end:o+a-1}}),o+=a,r+=4,i=r}return{earliestPresentationTime:s,timescale:n,version:r,referencesCount:l,references:t}}function Fp(e){const t=[],r=Mp(e,["moov","trak"]);for(let e=0;e<r.length;e++){const i=r[e],n=Mp(i,["tkhd"])[0];if(n){let e=n[0];const r=Cp(n,0===e?12:20),s=Mp(i,["mdia","mdhd"])[0];if(s){e=s[0];const n=Cp(s,0===e?12:20),a=Mp(i,["mdia","hdlr"])[0];if(a){const e=Pp(a.subarray(8,12)),s={soun:bp,vide:Ep}[e],o=$p(Mp(i,["mdia","minf","stbl","stsd"])[0]);s?(t[r]={timescale:n,type:s,stsd:o},t[s]=Xf({timescale:n,id:r},o)):t[r]={timescale:n,type:e,stsd:o}}}}}return Mp(e,["moov","mvex","trex"]).forEach(e=>{const r=Cp(e,4),i=t[r];i&&(i.default={duration:Cp(e,12),flags:Cp(e,20)})}),t}function $p(e){const t=e.subarray(8),r=t.subarray(86),i=Pp(t.subarray(4,8));let n,s=i;const a="enca"===i||"encv"===i;if(a){const e=Mp(t,[i])[0];Mp(e.subarray("enca"===i?28:78),["sinf"]).forEach(e=>{const t=Mp(e,["schm"])[0];if(t){const r=Pp(t.subarray(4,8));if("cbcs"===r||"cenc"===r){const t=Mp(e,["frma"])[0];t&&(s=Pp(t))}}})}const o=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const e=Mp(r,["avcC"])[0];e&&e.length>3&&(s+="."+zp(e[1])+zp(e[2])+zp(e[3]),n=Bp("avc1"===o?"dva1":"dvav",r));break}case"mp4a":{const e=Mp(t,[i])[0],r=Mp(e.subarray(28),["esds"])[0];if(r&&r.length>7){let e=4;if(3!==r[e++])break;e=Up(r,e),e+=2;const t=r[e++];if(128&t&&(e+=2),64&t&&(e+=r[e++]),4!==r[e++])break;e=Up(r,e);const i=r[e++];if(64!==i)break;if(s+="."+zp(i),e+=12,5!==r[e++])break;e=Up(r,e);const n=r[e++];let a=(248&n)>>3;31===a&&(a+=1+((7&n)<<3)+((224&r[e])>>5)),s+="."+a}break}case"hvc1":case"hev1":{const e=Mp(r,["hvcC"])[0];if(e&&e.length>12){const t=e[1],r=["","A","B","C"][t>>6],i=31&t,n=Cp(e,2),a=(32&t)>>5?"H":"L",o=e[12],l=e.subarray(6,12);s+="."+r+i,s+="."+function(e){let t=0;for(let r=0;r<32;r++)t|=(e>>r&1)<<31-r;return t>>>0}(n).toString(16).toUpperCase(),s+="."+a+o;let d="";for(let e=l.length;e--;){const t=l[e];if(t||d){d="."+t.toString(16).toUpperCase()+d}}s+=d}n=Bp("hev1"==o?"dvhe":"dvh1",r);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":s=Bp(s,r)||s;break;case"vp09":{const e=Mp(r,["vpcC"])[0];if(e&&e.length>6){const t=e[4],r=e[5],i=e[6]>>4&15;s+="."+Gp(t)+"."+Gp(r)+"."+Gp(i)}break}case"av01":{const e=Mp(r,["av1C"])[0];if(e&&e.length>2){const t=e[1]>>>5,i=31&e[1],a=e[2]>>>7?"H":"M",o=(64&e[2])>>6,l=(32&e[2])>>5,d=2===t&&o?l?12:10:o?10:8,c=(16&e[2])>>4,u=(8&e[2])>>3,h=(4&e[2])>>2,f=3&e[2],p=1,m=1,g=1,v=0;s+="."+t+"."+Gp(i)+a+"."+Gp(d)+"."+c+"."+u+h+f+"."+Gp(p)+"."+Gp(m)+"."+Gp(g)+"."+v,n=Bp("dav1",r)}break}}return{codec:s,encrypted:a,supplemental:n}}function Bp(e,t){const r=Mp(t,["dvvC"]),i=r.length?r[0]:Mp(t,["dvcC"])[0];if(i){const t=i[2]>>1&127,r=i[2]<<5&32|i[3]>>3&31;return e+"."+Gp(t)+"."+Gp(r)}}function Up(e,t){const r=t+5;for(;128&e[t++]&&t<r;);return t}function zp(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function Gp(e){return(e<10?"0":"")+e}function jp(e,t){Mp(e,["moov","trak"]).forEach(e=>{const r=Mp(e,["mdia","minf","stbl","stsd"])[0];if(!r)return;const i=r.subarray(8);let n=Mp(i,["enca"]);const s=n.length>0;s||(n=Mp(i,["encv"])),n.forEach(e=>{Mp(s?e.subarray(28):e.subarray(78),["sinf"]).forEach(e=>{const r=Hp(e);r&&t(r,s)})})})}function Hp(e){const t=Mp(e,["schm"])[0];if(t){const r=Pp(t.subarray(4,8));if("cbcs"===r||"cenc"===r){const t=Mp(e,["schi","tenc"])[0];if(t)return t}}}function Vp(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Wp(e,t){const r=[],i=t.samples,n=t.timescale,s=t.id;let a=!1;return Mp(i,["moof"]).map(o=>{const l=o.byteOffset-8;Mp(o,["traf"]).map(o=>{const d=Mp(o,["tfdt"]).map(e=>{const t=e[0];let r=Cp(e,4);return 1===t&&(r*=Math.pow(2,32),r+=Cp(e,8)),r/n})[0];return void 0!==d&&(e=d),Mp(o,["tfhd"]).map(d=>{const c=Cp(d,4),u=16777215&Cp(d,0);let h=0;const f=!!(16&u);let p=0;const m=!!(32&u);let g=8;c===s&&(!!(1&u)&&(g+=8),!!(2&u)&&(g+=4),!!(8&u)&&(h=Cp(d,g),g+=4),f&&(p=Cp(d,g),g+=4),m&&(g+=4),"video"===t.type&&(a=Yp(t.codec)),Mp(o,["trun"]).map(s=>{const o=s[0],d=16777215&Cp(s,0),c=!!(1&d);let u=0;const f=!!(4&d),m=!!(256&d);let g=0;const v=!!(512&d);let y=0;const b=!!(1024&d),E=!!(2048&d);let w=0;const S=Cp(s,4);let T=8;c&&(u=Cp(s,T),T+=4),f&&(T+=4);let x=u+l;for(let l=0;l<S;l++){if(m?(g=Cp(s,T),T+=4):g=h,v?(y=Cp(s,T),T+=4):y=p,b&&(T+=4),E&&(w=0===o?Cp(s,T):Op(s,T),T+=4),t.type===Ep){let t=0;for(;t<y;){const s=Cp(i,x);if(x+=4,Kp(a,i[x])){qp(i.subarray(x,x+s),a?2:1,e+w/n,r)}x+=s,t+=s+4}}e+=g/n}}))})})}),r}function Yp(e){if(!e)return!1;const t=e.substring(0,4);return"hvc1"===t||"hev1"===t||"dvh1"===t||"dvhe"===t}function Kp(e,t){if(e){const e=t>>1&63;return 39===e||40===e}return 6===(31&t)}function qp(e,t,r,i){const n=Xp(e);let s=0;s+=t;let a=0,o=0,l=0;for(;s<n.length;){a=0;do{if(s>=n.length)break;l=n[s++],a+=l}while(255===l);o=0;do{if(s>=n.length)break;l=n[s++],o+=l}while(255===l);const e=n.length-s;let t=s;if(o<e)s+=o;else if(o>e){ip.error(`Malformed SEI payload. ${o} is too small, only ${e} bytes left to parse.`);break}if(4===a){if(181===n[t++]){const e=Dp(n,t);if(t+=2,49===e){const e=Cp(n,t);if(t+=4,1195456820===e){const e=n[t++];if(3===e){const s=n[t++],o=64&s,l=o?2+3*(31&s):0,d=new Uint8Array(l);if(o){d[0]=s;for(let e=1;e<l;e++)d[e]=n[t++]}i.push({type:e,payloadType:a,pts:r,bytes:d})}}}}}else if(5===a&&o>16){const e=[];for(let r=0;r<16;r++){const i=n[t++].toString(16);e.push(1==i.length?"0"+i:i),3!==r&&5!==r&&7!==r&&9!==r||e.push("-")}const s=o-16,l=new Uint8Array(s);for(let e=0;e<s;e++)l[e]=n[t++];i.push({payloadType:a,pts:r,uuid:e.join(""),userData:ap(l),userDataBytes:l})}}}function Xp(e){const t=e.byteLength,r=[];let i=1;for(;i<t-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return e;const n=t-r.length,s=new Uint8Array(n);let a=0;for(i=0;i<n;a++,i++)a===r[0]&&(a++,r.shift()),s[i]=e[a];return s}function Qp(e,t,r){if(16!==e.byteLength)throw new RangeError("Invalid system id");let i,n,s;i=0,n=new Uint8Array,s=new Uint8Array;const a=new Uint8Array(4);return r.byteLength>0&&new DataView(a.buffer).setUint32(0,r.byteLength,!1),function(e,...t){const r=t.length;let i=8,n=r;for(;n--;)i+=t[n].byteLength;const s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=255&i,s.set(e,4),n=0,i=8;n<r;n++)s.set(t[n],i),i+=t[n].byteLength;return s}([112,115,115,104],new Uint8Array([0,0,0,0]),e,s,n,a,r)}function Zp(e){const t=e.getUint32(0),r=e.byteOffset,i=e.byteLength;if(i<t)return{offset:r,size:i};if(1886614376!==e.getUint32(4))return{offset:r,size:t};const n=e.getUint32(8)>>>24;if(0!==n&&1!==n)return{offset:r,size:t};const s=e.buffer,a=op(new Uint8Array(s,r+12,16));let o=null,l=null,d=0;if(0===n)d=28;else{const n=e.getUint32(28);if(!n||i<32+16*n)return{offset:r,size:t};o=[];for(let e=0;e<n;e++)o.push(new Uint8Array(s,r+32+16*e,16));d=32+16*n}if(!d)return{offset:r,size:t};const c=e.getUint32(d);return t-32<c?{offset:r,size:t}:(l=new Uint8Array(s,r+d+4,c),{version:n,systemId:a,kids:o,data:l,offset:r,size:t})}const Jp=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),em={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function tm(e,t){const r=em[t];return!!r&&!!r[e.slice(0,4)]}function rm(e,t,r=!0){return!e.split(",").some(e=>!im(e,t,r))}function im(e,t,r=!0){var i;const n=np(r);return null!=(i=null==n?void 0:n.isTypeSupported(nm(e,t)))&&i}function nm(e,t){return`${t}/mp4;codecs=${e}`}function sm(e){if(e){const t=e.substring(0,4);return em.video[t]}return 2}function am(e){const t=Jp();return e.split(",").reduce((e,r)=>{const i=t&&Yp(r)?9:em.video[r];return i?(2*i+e)/(e?3:2):(em.audio[r]+e)/(e?2:1)},0)}const om={};const lm=/flac|opus|mp4a\.40\.34/i;function dm(e,t=!0){return e.replace(lm,e=>function(e,t=!0){if(om[e])return om[e];const r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e];for(let n=0;n<r.length;n++){var i;if(im(r[n],"audio",t))return om[e]=r[n],r[n];if("mp3"===r[n]&&null!=(i=np(t))&&i.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t))}function cm(e,t){if(e&&(e.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e))&&(um(e,"audio")||um(e,"video")))return e;if(t){const r=t.split(",");if(r.length>1){if(e)for(let t=r.length;t--;)if(r[t].substring(0,4)===e.substring(0,4))return r[t];return r[0]}}return t||e}function um(e,t){return tm(e,t)&&im(e,t)}function hm(e){if(e.startsWith("av01.")){const t=e.split("."),r=["0","111","01","01","01","0"];for(let e=t.length;e>4&&e<10;e++)t[e]=r[e-4];return t.join(".")}return e}function fm(e){const t=np(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function pm(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const mm={supported:!1,smooth:!1,powerEfficient:!1},gm={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function vm(e,t){return{supported:!1,configurations:t,decodingInfoResults:[mm],error:e}}function ym(e,t,r,i,n,s){const a=e.videoCodec,o=e.audioCodec?e.audioGroups:null,l=null==s?void 0:s.audioCodec,d=null==s?void 0:s.channels,c=d?parseInt(d):l?1/0:2;let u=null;if(null!=o&&o.length)try{u=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce((e,r)=>{if(r){const i=t.groups[r];if(!i)throw new Error(`Audio track group ${r} not found`);Object.keys(i.channels).forEach(t=>{e[t]=(e[t]||0)+i.channels[t]})}return e},{2:0})}catch(e){return!0}return void 0!==a&&(a.split(",").some(e=>Yp(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(i,30)||"SDR"!==e.videoRange&&e.videoRange!==r||e.bitrate>Math.max(n,8e6))||!!u&&Cf(c)&&Object.keys(u).some(e=>parseInt(e)>c)}function bm(e,t,r,i={}){const n=e.videoCodec;if(!n&&!e.audioCodec||!r)return Promise.resolve(gm);const s=[],a=function(e){var t;const r=null==(t=e.videoCodec)?void 0:t.split(","),i=wm(e),n=e.width||640,s=e.height||480,a=e.frameRate||30,o=e.videoRange.toLowerCase();return r?r.map(e=>{const t={contentType:nm(hm(e),"video"),width:n,height:s,bitrate:i,framerate:a};return"sdr"!==o&&(t.transferFunction=o),t}):[]}(e),o=a.length,l=function(e,t,r){var i;const n=null==(i=e.audioCodec)?void 0:i.split(","),s=wm(e);if(n&&e.audioGroups)return e.audioGroups.reduce((e,i)=>{var a;const o=i?null==(a=t.groups[i])?void 0:a.tracks:null;return o?o.reduce((e,t)=>{if(t.groupId===i){const i=parseFloat(t.channels||"");n.forEach(t=>{const n={contentType:nm(t,"audio"),bitrate:r?Em(t,s):s};i&&(n.channels=""+i),e.push(n)})}return e},e):e},[]);return[]}(e,t,o>0),d=l.length;for(let e=o||1*d||1;e--;){const t={type:"media-source"};if(o&&(t.video=a[e%o]),d){t.audio=l[e%d];const r=t.audio.bitrate;t.video&&r&&(t.video.bitrate-=r)}s.push(t)}if(n){const e=navigator.userAgent;if(n.split(",").some(e=>Yp(e))&&Jp())return Promise.resolve(vm(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),s))}return Promise.all(s.map(e=>{const t=function(e){let t="";const{audio:r,video:i}=e;if(i){t+=`${pm(i.contentType)}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(r){t+=`${i?"_":""}${pm(r.contentType)}_c${r.channels}`}return t}(e);return i[t]||(i[t]=r.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:s,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:s,decodingInfoResults:[],error:e}))}function Em(e,t){if(t<=1)return 1;let r=128e3;return"ec-3"===e?r=768e3:"ac-3"===e&&(r=64e4),Math.min(t/2,r)}function wm(e){return 1e3*Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)/1e3)||1}const Sm=["NONE","TYPE-0","TYPE-1",null];const Tm=["SDR","PQ","HLG"];var xm="",Am="YES",km="v2";function Lm(e){const{canSkipUntil:t,canSkipDateRanges:r,age:i}=e;return t&&i<t/2?r?km:Am:xm}class Im{constructor(e,t,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=r}addDirectives(e){const t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Rm{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const r=null==(t=e.supplemental)?void 0:t.videoCodec;r&&r!==e.videoCodec&&(this.codecSet+=`,${r.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Pm(this._audioGroups,e)}hasSubtitleGroup(e){return Pm(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function Pm(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function Dm(e,t){let r=!1,i=[];if(e&&(r="SDR"!==e,i=[e]),t){i=t.allowedVideoRanges||Tm.slice(0);const e="SDR"!==i.join("")&&!t.videoCodec;r=void 0!==t.preferHDR?t.preferHDR:e&&function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),r||(i=["SDR"])}return{preferHDR:r,allowedVideoRanges:i}}const Cm=(e,t)=>JSON.stringify(e,(e=>{const t=new WeakSet;return(r,i)=>{if(e&&(i=e(r,i)),"object"==typeof i&&null!==i){if(t.has(i))return;t.add(i)}return i}})(t));function _m(e,t){ip.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Om(e){return e.reduce((e,t)=>{let r=e.groups[t.groupId];r||(r=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(t);const i=t.channels||"2";return r.channels[i]=(r.channels[i]||0)+1,r.hasDefault=r.hasDefault||t.default,r.hasAutoSelect=r.hasAutoSelect||t.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Mm(e){if(!e)return e;const{lang:t,assocLang:r,characteristics:i,channels:n,audioCodec:s}=e;return{lang:t,assocLang:r,characteristics:i,channels:n,audioCodec:s}}function Nm(e,t,r){if("attrs"in e){const r=t.indexOf(e);if(-1!==r)return r}for(let i=0;i<t.length;i++){if(Fm(e,t[i],r))return i}return-1}function Fm(e,t,r){const{groupId:i,name:n,lang:s,assocLang:a,default:o}=e,l=e.forced;return(void 0===i||t.groupId===i)&&(void 0===n||t.name===n)&&(void 0===s||function(e,t="--"){if(e.length===t.length)return e===t;return e.startsWith(t)||t.startsWith(e)}(s,t.lang))&&(void 0===s||t.assocLang===a)&&(void 0===o||t.default===o)&&(void 0===l||t.forced===l)&&(!("characteristics"in e)||function(e,t=""){const r=e.split(","),i=t.split(",");return r.length===i.length&&!r.some(e=>-1===i.indexOf(e))}(e.characteristics||"",t.characteristics))&&(void 0===r||r(e,t))}function $m(e,t){const{audioCodec:r,channels:i}=e;return!(void 0!==r&&(t.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==i&&i!==(t.channels||"2"))}function Bm(e,t,r){for(let i=t;i>-1;i--)if(r(e[i]))return i;for(let i=t+1;i<e.length;i++)if(r(e[i]))return i;return-1}function Um(e,t){var r;return!!e&&e!==(null==(r=t.loadLevelObj)?void 0:r.uri)}const zm=function(e,t){let r=0,i=e.length-1,n=null,s=null;for(;r<=i;){n=(r+i)/2|0,s=e[n];const a=t(s);if(a>0)r=n+1;else{if(!(a<0))return s;i=n-1}}return null};function Gm(e,t,r=0,i=0,n=.005){let s=null;if(e){s=t[1+e.sn-t[0].sn]||null;const i=e.endDTS-r;i>0&&i<15e-7&&(r+=15e-7),s&&e.level!==s.level&&s.end<=e.end&&(s=t[2+e.sn-t[0].sn]||null)}else 0===r&&0===t[0].start&&(s=t[0]);if(s&&((!e||e.level===s.level)&&0===jm(r,i,s)||function(e,t,r){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){const i=t.tagList.reduce((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e),r);return e.start<=i}return!1}(s,e,Math.min(n,i))))return s;const a=zm(t,jm.bind(null,r,i));return!a||a===e&&s?s:a}function jm(e=0,t=0,r){if(r.start<=e&&r.start+r.duration>e)return 0;const i=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=e?1:r.start-i>e&&r.start?-1:0}function Hm(e,t,r){const i=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-i>e}function Vm(e,t,r){if(e&&e.startCC<=t&&e.endCC>=t){let i=e.fragments;const{fragmentHint:n}=e;let s;return n&&(i=i.concat(n)),zm(i,e=>e.cc<t?1:e.cc>t?-1:(s=e,e.end<=r?1:e.start>r?-1:0)),s||null}return null}function Wm(e){switch(e.details){case Nf.FRAG_LOAD_TIMEOUT:case Nf.KEY_LOAD_TIMEOUT:case Nf.LEVEL_LOAD_TIMEOUT:case Nf.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ym(e){return e.details.startsWith("key")}function Km(e){return Ym(e)&&!!e.frag&&!e.frag.decryptdata}function qm(e,t){const r=Wm(t);return e.default[(r?"timeout":"error")+"Retry"]}function Xm(e,t){const r="linear"===e.backoff?1:Math.pow(2,t);return Math.min(r*e.retryDelayMs,e.maxRetryDelayMs)}function Qm(e){return Xf(Xf({},e),{errorRetry:null,timeoutRetry:null})}function Zm(e,t,r,i){if(!e)return!1;const n=null==i?void 0:i.code,s=t<e.maxNumRetry&&(function(e){return Jm(e)||!!e&&(e<400||e>499)}(n)||!!r);return e.shouldRetry?e.shouldRetry(e,t,r,i,s):s}function Jm(e){return 0===e&&!1===navigator.onLine}var eg=0,tg=2,rg=3,ig=5,ng=0,sg=1,ag=2,og=4;function lg(e){const t={action:eg,flags:ng};return e&&(t.resolved=!0),t}var dg="NOT_LOADED",cg="APPENDING",ug="PARTIAL",hg="OK";class fg{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Ff.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Ff.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Ff.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Ff.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const r=this.activePartLists[t];if(r)for(let t=r.length;t--;){const i=r[t];if(!i)break;if(i.start<=e&&e<=i.end&&i.loaded)return i}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,r){const{fragments:i}=this,n=Object.keys(i);for(let s=n.length;s--;){const a=i[n[s]];if((null==a?void 0:a.body.type)===t&&(!r||a.buffered)){const t=a.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,r,i,n){this.timeRanges&&(this.timeRanges[e]=t);const s=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(i=>{const a=this.fragments[i];if(!a)return;if(s>=a.body.sn)return;if(!a.buffered&&(!a.loaded||n))return void(a.body.type===r&&this.removeFragment(a.body));const o=a.range[e];o&&(0!==o.time.length?o.time.some(e=>{const r=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return r&&this.removeFragment(a.body),r}):this.removeFragment(a.body))})}detectPartialFragments(e){const t=this.timeRanges;if(!t||"initSegment"===e.frag.sn)return;const r=e.frag,i=mg(r),n=this.fragments[i];if(!n||n.buffered&&r.gap)return;const s=!r.relurl;Object.keys(t).forEach(i=>{const a=r.elementaryStreams[i];if(!a)return;const o=t[i],l=s||!0===a.partial;n.range[i]=this.getBufferedTimes(r,e.part,l,o)}),n.loaded=null,Object.keys(n.range).length?(this.bufferedEnd(n,r),pg(n)||this.removeParts(r.sn-1,r.type)):this.removeFragment(n.body)}bufferedEnd(e,t){e.buffered=!0;(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const r=this.activePartLists[t];r&&(this.activePartLists[t]=gg(r,t=>t.fragment.sn>=e))}fragBuffered(e,t){const r=mg(e);let i=this.fragments[r];!i&&t&&(i=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,e))}getBufferedTimes(e,t,r,i){const n={time:[],partial:r},s=e.start,a=e.end,o=e.minEndPTS||a,l=e.maxStartPTS||s;for(let e=0;e<i.length;e++){const t=i.start(e)-this.bufferPadding,r=i.end(e)+this.bufferPadding;if(l>=t&&o<=r){n.time.push({startPTS:Math.max(s,i.start(e)),endPTS:Math.min(a,i.end(e))});break}if(s<r&&a>t){const t=Math.max(s,i.start(e)),r=Math.min(a,i.end(e));r>t&&(n.partial=!0,n.time.push({startPTS:t,endPTS:r}))}else if(a<=t)break}return n}getPartialFragment(e){let t,r,i,n=null,s=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach(l=>{const d=o[l];d&&pg(d)&&(r=d.body.start-a,i=d.body.end+a,e>=r&&e<=i&&(t=Math.min(e-r,i-e),s<=t&&(n=d.body,s=t)))}),n}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||pg(t))}getState(e){const t=mg(e),r=this.fragments[t];return r?r.buffered?pg(r)?ug:hg:cg:dg}isTimeBuffered(e,t,r){let i,n;for(let s=0;s<r.length;s++){if(i=r.start(s)-this.bufferPadding,n=r.end(s)+this.bufferPadding,e>=i&&t<=n)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if("initSegment"===t.frag.sn||t.frag.bitrateTest)return;const r=t.frag,i=t.part?null:t,n=mg(r);this.fragments[n]={body:r,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:r,part:i,timeRanges:n,type:s}=t;if("initSegment"===r.sn)return;const a=r.type;if(i){let e=this.activePartLists[a];e||(this.activePartLists[a]=e=[]),e.push(i)}this.timeRanges=n;const o=n[s];this.detectEvictedFragments(s,o,a,i)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=mg(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,r=Object.keys(t);if(!e)return r.length>0;for(let i=r.length;i--;){const n=t[r[i]];if((null==n?void 0:n.body.type)===e)return!0}return!1}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,r,i,n){i&&!this.hasGaps||Object.keys(this.fragments).forEach(s=>{const a=this.fragments[s];if(!a)return;const o=a.body;o.type!==r||i&&!o.gap||o.start<t&&o.end>e&&(a.buffered||n)&&this.removeFragment(o)})}removeFragment(e){const t=mg(e);e.clearElementaryStreamInfo();const r=this.activePartLists[e.type];if(r){const t=e.sn;this.activePartLists[e.type]=gg(r,e=>e.fragment.sn!==t)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=null==(e=this.hls)||null==(e=e.latestLevelDetails)?void 0:e.partList;t&&t.forEach(e=>e.clearElementaryStreamInfo())}}function pg(e){var t,r,i;return e.buffered&&!!(e.body.gap||null!=(t=e.range.video)&&t.partial||null!=(r=e.range.audio)&&r.partial||null!=(i=e.range.audiovideo)&&i.partial)}function mg(e){return`${e.type}_${e.level}_${e.sn}`}function gg(e,t){return e.filter(e=>{const r=t(e);return r||e.clearElementaryStreamInfo(),r})}var vg=0,yg=1;class bg{constructor(e,t,r){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=r}decrypt(e,t){switch(this.aesMode){case vg:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case yg:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class Eg{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),r=new Uint32Array(4);for(let e=0;e<4;e++)r[e]=t.getUint32(4*e);return r}initTable(){const e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],n=r[1],s=r[2],a=r[3],o=this.invSubMix,l=o[0],d=o[1],c=o[2],u=o[3],h=new Uint32Array(256);let f=0,p=0,m=0;for(m=0;m<256;m++)h[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let r=p^p<<1^p<<2^p<<3^p<<4;r=r>>>8^255&r^99,e[f]=r,t[r]=f;const o=h[f],m=h[o],g=h[m];let v=257*h[r]^16843008*r;i[f]=v<<24|v>>>8,n[f]=v<<16|v>>>16,s[f]=v<<8|v>>>24,a[f]=v,v=16843009*g^65537*m^257*o^16843008*f,l[r]=v<<24|v>>>8,d[r]=v<<16|v>>>16,c[r]=v<<8|v>>>24,u[r]=v,f?(f=o^h[h[h[g^o]]],p^=h[h[p]]):f=p=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let r=!0,i=0;for(;i<t.length&&r;)r=t[i]===this.key[i],i++;if(r)return;this.key=t;const n=this.keySize=t.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);const s=this.ksRows=4*(n+6+1);let a,o;const l=this.keySchedule=new Uint32Array(s),d=this.invKeySchedule=new Uint32Array(s),c=this.sBox,u=this.rcon,h=this.invSubMix,f=h[0],p=h[1],m=h[2],g=h[3];let v,y;for(a=0;a<s;a++)a<n?v=l[a]=t[a]:(y=v,a%n===0?(y=y<<8|y>>>24,y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[255&y],y^=u[a/n|0]<<24):n>6&&a%n===4&&(y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[255&y]),l[a]=v=(l[a-n]^y)>>>0);for(o=0;o<s;o++)a=s-o,y=3&o?l[a]:l[a-4],d[o]=o<4||a<=4?y:f[c[y>>>24]]^p[c[y>>>16&255]]^m[c[y>>>8&255]]^g[c[255&y]],d[o]=d[o]>>>0}networkToHostOrderSwap(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}decrypt(e,t,r){const i=this.keySize+6,n=this.invKeySchedule,s=this.invSBox,a=this.invSubMix,o=a[0],l=a[1],d=a[2],c=a[3],u=this.uint8ArrayToUint32Array_(r);let h=u[0],f=u[1],p=u[2],m=u[3];const g=new Int32Array(e),v=new Int32Array(g.length);let y,b,E,w,S,T,x,A,k,L,I,R,P,D;const C=this.networkToHostOrderSwap;for(;t<g.length;){for(k=C(g[t]),L=C(g[t+1]),I=C(g[t+2]),R=C(g[t+3]),S=k^n[0],T=R^n[1],x=I^n[2],A=L^n[3],P=4,D=1;D<i;D++)y=o[S>>>24]^l[T>>16&255]^d[x>>8&255]^c[255&A]^n[P],b=o[T>>>24]^l[x>>16&255]^d[A>>8&255]^c[255&S]^n[P+1],E=o[x>>>24]^l[A>>16&255]^d[S>>8&255]^c[255&T]^n[P+2],w=o[A>>>24]^l[S>>16&255]^d[T>>8&255]^c[255&x]^n[P+3],S=y,T=b,x=E,A=w,P+=4;y=s[S>>>24]<<24^s[T>>16&255]<<16^s[x>>8&255]<<8^s[255&A]^n[P],b=s[T>>>24]<<24^s[x>>16&255]<<16^s[A>>8&255]<<8^s[255&S]^n[P+1],E=s[x>>>24]<<24^s[A>>16&255]<<16^s[S>>8&255]<<8^s[255&T]^n[P+2],w=s[A>>>24]<<24^s[S>>16&255]<<16^s[T>>8&255]<<8^s[255&x]^n[P+3],v[t]=C(y^h),v[t+1]=C(w^f),v[t+2]=C(E^p),v[t+3]=C(b^m),h=k,f=L,p=I,m=R,t+=4}return v.buffer}}class wg{constructor(e,t,r){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=r}expandKey(){const e=function(e){switch(e){case vg:return"AES-CBC";case yg:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${e}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}class Sg{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(e){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const r=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?function(e){const t=e.byteLength,r=t&&new DataView(e.buffer).getUint8(t-1);return r?e.slice(0,t-r):e}(r):r}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,r,i){return this.useSoftware?new Promise((n,s)=>{const a=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(a,t,r,i);const o=this.flush();o?n(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,r,i)}softwareDecrypt(e,t,r,i){const{currentIV:n,currentResult:s,remainderData:a}=this;if(i!==vg||16!==t.byteLength)return ip.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(e=Vp(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;n&&(r=n);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Eg),l.expandKey(t);const d=s;return this.currentResult=l.decrypt(o.buffer,0,r),this.currentIV=o.slice(-16).buffer,d||null}webCryptoDecrypt(e,t,r,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,r,i));this.key=t,this.fastAesKey=new wg(this.subtle,t,i)}return this.fastAesKey.expandKey().then(t=>{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new bg(this.subtle,new Uint8Array(r),i).decrypt(e.buffer,t)}).catch(n=>(ip.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,r,i)))}onWebCryptoError(e,t,r,i){const n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r,i);const n=this.flush();if(n)return n.buffer}throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const r=e.length-e.length%16;return r!==e.length&&(t=e.slice(0,r),this.remainderData=e.slice(r)),t}logOnce(e){this.logEnabled&&(ip.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Tg=Math.pow(2,17);class xg{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const r=e.url;if(!r)return Promise.reject(new Lg({type:Mf.NETWORK_ERROR,details:Nf.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(r?"part list":"url")),networkDetails:null}));this.abort();const i=this.config,n=i.fLoader,s=i.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some(e=>"GAP"===e[0]))return void o(kg(e));e.gap=!1}const l=this.loader=n?new n(i):new s(i),d=Ag(e);e.loader=l;const c=Qm(i.fragLoadPolicy.default),u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:Tg};e.stats=l.stats;const h={onSuccess:(t,r,i,n)=>{this.resetLoader(e,l);let s=t.data;i.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),a({frag:e,part:null,payload:s,networkDetails:n})},onError:(t,i,n,s)=>{this.resetLoader(e,l),o(new Lg({type:Mf.NETWORK_ERROR,details:Nf.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Xf({url:r,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:n,stats:s}))},onAbort:(t,r,i)=>{this.resetLoader(e,l),o(new Lg({type:Mf.NETWORK_ERROR,details:Nf.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:i,stats:t}))},onTimeout:(t,r,i)=>{this.resetLoader(e,l),o(new Lg({type:Mf.NETWORK_ERROR,details:Nf.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:i,stats:t}))}};t&&(h.onProgress=(r,i,n,s)=>t({frag:e,part:null,payload:n,networkDetails:s})),l.load(d,u,h)})}loadPart(e,t,r){this.abort();const i=this.config,n=i.fLoader,s=i.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void o(kg(e,t));const l=this.loader=n?new n(i):new s(i),d=Ag(e,t);e.loader=l;const c=Qm(i.fragLoadPolicy.default),u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Tg};t.stats=l.stats,l.load(d,u,{onSuccess:(i,n,s,o)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const d={frag:e,part:t,payload:i.data,networkDetails:o};r(d),a(d)},onError:(r,i,n,s)=>{this.resetLoader(e,l),o(new Lg({type:Mf.NETWORK_ERROR,details:Nf.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Xf({url:d.url,data:void 0},r),error:new Error(`HTTP Error ${r.code} ${r.text}`),networkDetails:n,stats:s}))},onAbort:(r,i,n)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),o(new Lg({type:Mf.NETWORK_ERROR,details:Nf.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:n,stats:r}))},onTimeout:(r,i,n)=>{this.resetLoader(e,l),o(new Lg({type:Mf.NETWORK_ERROR,details:Nf.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:n,stats:r}))}})})}updateStatsFromPart(e,t){const r=e.stats,i=t.stats,n=i.total;if(r.loaded+=i.loaded,n){const i=Math.round(e.duration/t.duration),s=Math.min(Math.round(r.loaded/n),i),a=(i-s)*Math.round(r.loaded/s);r.total=r.loaded+a}else r.total=Math.max(r.loaded,r.total);const s=r.loading,a=i.loading;s.start?s.first+=a.first-a.start:(s.start=a.start,s.first=a.first),s.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Ag(e,t=null){const r=t||e,i={frag:e,part:t,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},n=r.byteRangeStartOffset,s=r.byteRangeEndOffset;if(Cf(n)&&Cf(s)){var a;let t=n,r=s;if("initSegment"===e.sn&&("AES-128"===(o=null==(a=e.decryptdata)?void 0:a.method)||"AES-256"===o)){const e=s-n;e%16&&(r=s+(16-e%16)),0!==n&&(i.resetIV=!0,t=n-16)}i.rangeStart=t,i.rangeEnd=r}var o;return i}function kg(e,t){const r=new Error(`GAP ${e.gap?"tag":"attribute"} found`),i={type:Mf.MEDIA_ERROR,details:Nf.FRAG_GAP,fatal:!1,frag:e,error:r,networkDetails:null};return t&&(i.part=t),(t||e).stats.aborted=!0,new Lg(i)}class Lg extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Ig extends Qf{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class Rg{constructor(e,t,r,i=0,n=-1,s=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=r,this.size=i,this.part=n,this.partial=s}}const Pg={length:0,start:()=>0,end:()=>0};class Dg{static isBuffered(e,t){if(e){const r=Dg.getBuffered(e);for(let e=r.length;e--;)if(t>=r.start(e)&&t<=r.end(e))return!0}return!1}static bufferedRanges(e){if(e){const t=Dg.getBuffered(e);return Dg.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t}static bufferInfo(e,t,r){if(e){const i=Dg.bufferedRanges(e);if(i.length)return Dg.bufferedInfo(i,t,r)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,r){t=Math.max(0,t),e.length>1&&e.sort((e,t)=>e.start-t.start||t.end-e.end);let i=-1,n=[];if(r)for(let s=0;s<e.length;s++){t>=e[s].start&&t<=e[s].end&&(i=s);const a=n.length;if(a){const t=n[a-1].end;e[s].start-t<r?e[s].end>t&&(n[a-1].end=e[s].end):n.push(e[s])}else n.push(e[s])}else n=e;let s,a=0,o=t,l=t;for(let e=0;e<n.length;e++){const d=n[e].start,c=n[e].end;if(-1===i&&t>=d&&t<=c&&(i=e),t+r>=d&&t<c)o=d,l=c,a=l-t;else if(t+r<d){s=d;break}}return{len:a,start:o||0,end:l||0,nextStart:s,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||Pg}catch(e){return ip.log("failed to get media.buffered",e),Pg}}}const Cg=/\{\$([a-zA-Z0-9-_]+)\}/g;function _g(e){return Cg.test(e)}function Og(e,t){if(null!==e.variableList||e.hasVariableRefs){const r=e.variableList;return t.replace(Cg,t=>{const i=t.substring(2,t.length-1),n=null==r?void 0:r[i];return void 0===n?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),t):n})}return t}function Mg(e,t,r){let i,n,s=e.variableList;if(s||(e.variableList=s={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{const e=new self.URL(r).searchParams;if(!e.has(i))throw new Error(`"${i}" does not match any query parameter in URI: "${r}"`);n=e.get(i)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else i=t.NAME,n=t.VALUE;i in s?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):s[i]=n||""}function Ng(e,t,r){const i=t.IMPORT;if(r&&i in r){let t=e.variableList;t||(e.variableList=t={}),t[i]=r[i]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const Fg=/^(\d+)x(\d+)$/,$g=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Bg{constructor(e,t){"string"==typeof e&&(e=Bg.parseAttrList(e,t)),Kf(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>"X-"===e.substring(0,2))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const r=new Uint8Array(t.length/2);for(let e=0;e<t.length/2;e++)r[e]=parseInt(t.slice(2*e,2*e+2),16);return r}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const r=this[e];return r?parseFloat(r):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const r=this[e];return(r?r.split(/[ ,]+/):[]).reduce((e,t)=>(e[t.toLowerCase()]=!0,e),t)}bool(e){return"YES"===this[e]}decimalResolution(e){const t=Fg.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let r;const i={};for($g.lastIndex=0;null!==(r=$g.exec(e));){const n=r[1].trim();let s=r[2];const a=0===s.indexOf('"')&&s.lastIndexOf('"')===s.length-1;let o=!1;if(a)s=s.slice(1,-1);else switch(n){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(t&&(a||o))s=Og(t,s);else if(!o&&!a)switch(n){case"CLOSED-CAPTIONS":if("NONE"===s)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":ip.warn(`${e}: attribute ${n} is missing quotes`)}i[n]=s}return i}}function Ug(e){return"ID"!==e&&"CLASS"!==e&&"CUE"!==e&&"START-DATE"!==e&&"DURATION"!==e&&"END-DATE"!==e&&"END-ON-NEXT"!==e}function zg(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}class Gg{constructor(e,t,r=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(null==t?void 0:t.tagAnchor)||null,this.tagOrder=null!=(i=null==t?void 0:t.tagOrder)?i:r,t){const r=t.attr;for(const t in r)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==r[t]){ip.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=Kf(new Bg({}),r,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=(null==t?void 0:t.endDate)||new Date(this.attr["END-DATE"]);Cf(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return void 0===e?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return null===e||null===e.programDateTime?(ip.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Cf(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&Cf(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}class jg{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let r=t.decryptdata;return r||(t.setKeyFormat(e.keyFormat),r=t.decryptdata),!!r&&e.matches(r)})}get hasProgramDateTime(){return!!this.fragments.length&&Cf(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(-1!==t){for(let r=e.length;r--;)if(e[r].index>t)return e[r].index;return t}}return 0}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Hg(e,t){return e.length===t.length&&!e.some((e,r)=>e!==t[r])}function Vg(e,t){return!e&&!t||!(!e||!t)&&Hg(e,t)}function Wg(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function Yg(e){switch(e){case"AES-128":case"AES-256":return vg;case"AES-256-CTR":return yg;default:throw new Error(`invalid full segment method ${e}`)}}function Kg(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function qg(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}function Xg(e){const t=function(e,t,r){const i=e[t];e[t]=e[r],e[r]=i};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function Qg(e){const t=e.split(":");let r=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),i=e[e.length-1].split(",");if(2===i.length){const t="base64"===i[0],n=i[1];t?(e.splice(-1,1),r=Kg(n)):r=function(e){const t=qg(e).subarray(0,16),r=new Uint8Array(16);return r.set(t,16-t.length),r}(n)}}return r}const Zg="undefined"!=typeof self?self:void 0;var Jg={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ev="org.w3.clearkey",tv="com.apple.streamingkeydelivery",rv="com.microsoft.playready",iv="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function nv(e){switch(e){case tv:return Jg.FAIRPLAY;case rv:return Jg.PLAYREADY;case iv:return Jg.WIDEVINE;case ev:return Jg.CLEARKEY}}function sv(e){switch(e){case Jg.FAIRPLAY:return tv;case Jg.PLAYREADY:return rv;case Jg.WIDEVINE:return iv;case Jg.CLEARKEY:return ev}}function av(e){const{drmSystems:t,widevineLicenseUrl:r}=e,i=t?[Jg.FAIRPLAY,Jg.WIDEVINE,Jg.PLAYREADY,Jg.CLEARKEY].filter(e=>!!t[e]):[];return!i[Jg.WIDEVINE]&&r&&i.push(Jg.WIDEVINE),i}const ov=null!=Zg&&null!=(lv=Zg.navigator)&&lv.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var lv;function dv(e){const t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),r=String.fromCharCode.apply(null,Array.from(t)),i=r.substring(r.indexOf("<"),r.length),n=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(n){const e=n.childNodes[0]?n.childNodes[0].nodeValue:n.getAttribute("VALUE");if(e){const t=Kg(e).subarray(0,16);return Xg(t),t}}return null}let cv={};class uv{static clearKeyUriToKeyIdMap(){cv={}}static setKeyIdForUri(e,t){cv[e]=t}static addKeyIdForUri(e){const t=Object.keys(cv).length%Number.MAX_SAFE_INTEGER,r=new Uint8Array(16);return new DataView(r.buffer,12,4).setUint32(0,t),cv[e]=r,r}constructor(e,t,r,i=[1],n=null,s){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=r,this.keyFormatVersions=i,this.iv=n,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!Wg(e),null!=s&&s.startsWith("0x")&&(this.keyId=new Uint8Array(lp(s)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Hg(e.keyFormatVersions,this.keyFormatVersions)&&Vg(e.iv,this.iv)&&Vg(e.keyId,this.keyId)}isSupported(){if(this.method){if(Wg(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case tv:case iv:case rv:case ev:return-1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Wg(this.method)){let t=this.iv;t||("number"!=typeof e&&(ip.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),t=function(e){const t=new Uint8Array(16);for(let r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}(e));return new uv(this.method,this.uri,"identity",this.keyFormatVersions,t)}if(this.keyId){const e=cv[this.uri];if(e&&!Hg(this.keyId,e)&&uv.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const r=Qg(this.uri);if(r)switch(this.keyFormat){case iv:if(this.pssh=r,!this.keyId){const e=function(e){const t=[];if(e instanceof ArrayBuffer){const r=e.byteLength;let i=0;for(;i+32<r;){const r=Zp(new DataView(e,i));t.push(r),i+=r.size}}return t}(r.buffer);if(e.length){var i;const t=e[0];this.keyId=null!=(i=t.kids)&&i.length?t.kids[0]:null}}this.keyId||(this.keyId=hv(t));break;case rv:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Qp(e,0,r),this.keyId=dv(r);break}default:{let e=r.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e;e=function(e){const t=null==e?void 0:e[iv];if(t)return t.keyId;return null}(t),e||(e=hv(t),e||(e=cv[this.uri])),e&&(this.keyId=e,uv.setKeyIdForUri(this.uri,e))}return this}}function hv(e){const t=null==e?void 0:e[rv];if(t){const e=Qg(t.uri);if(e)return dv(e)}return null}const fv=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,pv=/#EXT-X-MEDIA:(.*)/g,mv=/^#EXT(?:INF|-X-TARGETDURATION):/m,gv=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),vv=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class yv{static findGroup(e,t){for(let r=0;r<e.length;r++){const i=e[r];if(i.id===t)return i}}static resolve(e,t){return vp.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return mv.test(e)}static parseMasterPlaylist(e,t){const r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:_g(e)},i=[];if(fv.lastIndex=0,!e.startsWith("#EXTM3U"))return r.playlistParsingError=new Error("no EXTM3U delimiter"),r;let n;for(;null!=(n=fv.exec(e));)if(n[1]){var s;const e=new Bg(n[1],r),a=Og(r,n[2]),o={attrs:e,bitrate:e.decimalInteger("BANDWIDTH")||e.decimalInteger("AVERAGE-BANDWIDTH"),name:e.NAME,url:yv.resolve(a,t)},l=e.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),Tv(e.CODECS,o);const d=e["SUPPLEMENTAL-CODECS"];d&&(o.supplemental={},Tv(d,o.supplemental)),null!=(s=o.unknownCodecs)&&s.length||i.push(o),r.levels.push(o)}else if(n[3]){const e=n[3],i=n[4];switch(e){case"SESSION-DATA":{const e=new Bg(i,r),t=e["DATA-ID"];t&&(null===r.sessionData&&(r.sessionData={}),r.sessionData[t]=e);break}case"SESSION-KEY":{const e=wv(i,t,r);e.encrypted&&e.isSupported()?(null===r.sessionKeys&&(r.sessionKeys=[]),r.sessionKeys.push(e)):ip.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`);break}case"DEFINE":Mg(r,new Bg(i,r),t);break;case"CONTENT-STEERING":{const e=new Bg(i,r);r.contentSteering={uri:yv.resolve(e["SERVER-URI"],t),pathwayId:e["PATHWAY-ID"]||"."};break}case"START":r.startTimeOffset=Sv(i)}}const a=i.length>0&&i.length<r.levels.length;return r.levels=a?i:r.levels,0===r.levels.length&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,r){let i;const n={},s=r.levels,a={AUDIO:s.map(e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:s.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]};let o=0;for(pv.lastIndex=0;null!==(i=pv.exec(e));){const e=new Bg(i[1],r),s=e.TYPE;if(s){const r=a[s],i=n[s]||[];n[s]=i;const l=e.LANGUAGE,d=e["ASSOC-LANGUAGE"],c=e.CHANNELS,u=e.CHARACTERISTICS,h=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:o++,groupId:e["GROUP-ID"]||"",name:e.NAME||l||"",type:s,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:l,url:e.URI?yv.resolve(e.URI,t):""};if(d&&(f.assocLang=d),c&&(f.channels=c),u&&(f.characteristics=u),h&&(f.instreamId=h),null!=r&&r.length){const e=yv.findGroup(r,f.groupId)||r[0];xv(f,e,"audioCodec"),xv(f,e,"textCodec")}i.push(f)}}return n}static parseLevelPlaylist(e,t,r,i,n,s){var a;const o={url:t},l=new jg(t),d=l.fragments,c=[];let u,h,f,p,m=null,g=0,v=0,y=0,b=0,E=0,w=null,S=new xp(i,o),T=-1,x=!1,A=null;if(gv.lastIndex=0,l.m3u8=e,l.hasVariableRefs=_g(e),"#EXTM3U"!==(null==(a=gv.exec(e))?void 0:a[0]))return l.playlistParsingError=new Error("Missing format identifier #EXTM3U"),l;for(;null!==(u=gv.exec(e));){x&&(x=!1,S=new xp(i,o),S.playlistOffset=y,S.setStart(y),S.sn=g,S.cc=b,E&&(S.bitrate=E),S.level=r,m&&(S.initSegment=m,m.rawProgramDateTime&&(S.rawProgramDateTime=m.rawProgramDateTime,m.rawProgramDateTime=null),A&&(S.setByteRange(A),A=null)));const e=u[1];if(e){S.duration=parseFloat(e);const t=(" "+u[2]).slice(1);S.title=t||null,S.tagList.push(t?["INF",e,t]:["INF",e])}else if(u[3]){if(Cf(S.duration)){S.playlistOffset=y,S.setStart(y),f&&Lv(S,f,l),S.sn=g,S.level=r,S.cc=b,d.push(S);const e=(" "+u[3]).slice(1);S.relurl=Og(l,e),Av(S,w,c),w=S,y+=S.duration,g++,v=0,x=!0}}else{if(u=u[0].match(vv),!u){ip.warn("No matches on slow regex match for level playlist!");continue}for(h=1;h<u.length&&void 0===u[h];h++);const e=(" "+u[h]).slice(1),n=(" "+u[h+1]).slice(1),a=u[h+2]?(" "+u[h+2]).slice(1):null;switch(e){case"BYTERANGE":w?S.setByteRange(n,w):S.setByteRange(n);break;case"PROGRAM-DATE-TIME":S.rawProgramDateTime=n,S.tagList.push(["PROGRAM-DATE-TIME",n]),-1===T&&(T=d.length);break;case"PLAYLIST-TYPE":l.type&&Iv(l,e,u),l.type=n.toUpperCase();break;case"MEDIA-SEQUENCE":0!==l.startSN?Iv(l,e,u):d.length>0&&Rv(l,e,u),g=l.startSN=parseInt(n);break;case"SKIP":{l.skippedSegments&&Iv(l,e,u);const t=new Bg(n,l),r=t.decimalInteger("SKIPPED-SEGMENTS");if(Cf(r)){l.skippedSegments+=r;for(let e=r;e--;)d.push(null);g+=r}const i=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");i&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(i.split("\t")));break}case"TARGETDURATION":0!==l.targetduration&&Iv(l,e,u),l.targetduration=Math.max(parseInt(n),1);break;case"VERSION":null!==l.version&&Iv(l,e,u),l.version=parseInt(n);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":l.live||Iv(l,e,u),l.live=!1;break;case"#":(n||a)&&S.tagList.push(a?[n,a]:[n]);break;case"DISCONTINUITY":b++,S.tagList.push(["DIS"]);break;case"GAP":S.gap=!0,S.tagList.push([e]);break;case"BITRATE":S.tagList.push([e,n]),E=1e3*parseInt(n),Cf(E)?S.bitrate=E:E=0;break;case"DATERANGE":{const e=new Bg(n,l),t=new Gg(e,l.dateRanges[e.ID],l.dateRangeTagCount);l.dateRangeTagCount++,t.isValid||l.skippedSegments?l.dateRanges[t.id]=t:ip.warn(`Ignoring invalid DATERANGE tag: "${n}"`),S.tagList.push(["EXT-X-DATERANGE",n]);break}case"DEFINE":{const e=new Bg(n,l);"IMPORT"in e?Ng(l,e,s):Mg(l,e,t)}break;case"DISCONTINUITY-SEQUENCE":0!==l.startCC?Iv(l,e,u):d.length>0&&Rv(l,e,u),l.startCC=b=parseInt(n);break;case"KEY":{const e=wv(n,t,l);if(e.isSupported()){if("NONE"===e.method){f=void 0;break}f||(f={});const t=f[e.keyFormat];null!=t&&t.matches(e)||(t&&(f=Kf({},f)),f[e.keyFormat]=e)}else ip.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${n}"`);break}case"START":l.startTimeOffset=Sv(n);break;case"MAP":{const e=new Bg(n,l);if(S.duration){const t=new xp(i,o);kv(t,e,r,f),m=t,S.initSegment=m,m.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=m.rawProgramDateTime)}else{const t=S.byteRangeEndOffset;if(t){const e=S.byteRangeStartOffset;A=`${t-e}@${e}`}else A=null;kv(S,e,r,f),m=S,x=!0}m.cc=b;break}case"SERVER-CONTROL":p&&Iv(l,e,u),p=new Bg(n),l.canBlockReload=p.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=p.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&p.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=p.optionalFloat("PART-HOLD-BACK",0),l.holdBack=p.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{l.partTarget&&Iv(l,e,u);const t=new Bg(n);l.partTarget=t.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=l.partList;e||(e=l.partList=[]);const t=v>0?e[e.length-1]:void 0,r=v++,i=new Bg(n,l),s=new Ap(i,S,o,r,t);e.push(s),S.duration+=s.duration;break}case"PRELOAD-HINT":{const e=new Bg(n,l);l.preloadHint=e;break}case"RENDITION-REPORT":{const e=new Bg(n,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(e);break}default:ip.warn(`line parsed but not handled: ${u}`)}}}w&&!w.relurl?(d.pop(),y-=w.duration,l.partList&&(l.fragmentHint=w)):l.partList&&(Av(S,w,c),S.cc=b,l.fragmentHint=S,f&&Lv(S,f,l)),l.targetduration||(l.playlistParsingError=new Error("Missing Target Duration"));const k=d.length,L=d[0],I=d[k-1];if(y+=l.skippedSegments*l.targetduration,y>0&&k&&I){l.averagetargetduration=y/k;const e=I.sn;l.endSN="initSegment"!==e?e:0,l.live||(I.endList=!0),T>0&&(!function(e,t){let r=e[t];for(let i=t;i--;){const t=e[i];if(!t)return;t.programDateTime=r.programDateTime-1e3*t.duration,r=t}}(d,T),L&&c.unshift(L))}return l.fragmentHint&&(y+=l.fragmentHint.duration),l.totalduration=y,c.length&&l.dateRangeTagCount&&L&&bv(c,l),l.endCC=b,l}}function bv(e,t){let r=e.length;if(!r){if(!t.hasProgramDateTime)return;{const i=t.fragments[t.fragments.length-1];e.push(i),r++}}const i=e[r-1],n=t.live?1/0:t.totalduration,s=Object.keys(t.dateRanges);for(let o=s.length;o--;){const l=t.dateRanges[s[o]],d=l.startDate.getTime();l.tagAnchor=i.ref;for(let i=r;i--;){var a;if((null==(a=e[i])?void 0:a.sn)<t.startSN)break;const r=Ev(t,d,e,i,n);if(-1!==r){l.tagAnchor=t.fragments[r].ref;break}}}}function Ev(e,t,r,i,n){const s=r[i];if(s){const o=s.programDateTime;if(t>=o||0===i){var a;if(t<=o+1e3*(((null==(a=r[i+1])?void 0:a.start)||n)-s.start)){const n=r[i].sn-e.startSN;if(n<0)return-1;const s=e.fragments;if(s.length>r.length){for(let a=(r[i+1]||s[s.length-1]).sn-e.startSN;a>n;a--){const e=s[a].programDateTime;if(t>=e&&t<e+1e3*s[a].duration)return a}}return n}}}return-1}function wv(e,t,r){var i,n;const s=new Bg(e,r),a=null!=(i=s.METHOD)?i:"",o=s.URI,l=s.hexadecimalInteger("IV"),d=s.KEYFORMATVERSIONS,c=null!=(n=s.KEYFORMAT)?n:"identity";o&&s.IV&&!l&&ip.error(`Invalid IV: ${s.IV}`);const u=o?yv.resolve(o,t):"",h=(d||"1").split("/").map(Number).filter(Number.isFinite);return new uv(a,u,c,h,l,s.KEYID)}function Sv(e){const t=new Bg(e).decimalFloatingPoint("TIME-OFFSET");return Cf(t)?t:null}function Tv(e,t){let r=(e||"").split(/[ ,]+/).filter(e=>e);["video","audio","text"].forEach(e=>{const i=r.filter(t=>tm(t,e));i.length&&(t[`${e}Codec`]=i.map(e=>e.split("/")[0]).join(","),r=r.filter(e=>-1===i.indexOf(e)))}),t.unknownCodecs=r}function xv(e,t,r){const i=t[r];i&&(e[r]=i)}function Av(e,t,r){e.rawProgramDateTime?r.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function kv(e,t,r,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=r,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function Lv(e,t,r){e.levelkeys=t;const{encryptedFragments:i}=r;i.length&&i[i.length-1].levelkeys===t||!Object.keys(t).some(e=>t[e].isCommonEncryption)||i.push(e)}function Iv(e,t,r){e.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${r[0]})`)}function Rv(e,t,r){e.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${r[0]})`)}function Pv(e,t){const r=t.startPTS;if(Cf(r)){let i,n=0;t.sn>e.sn?(n=r-e.start,i=e):(n=e.start-r,i=t),i.duration!==n&&i.setDuration(n)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration)}else t.setStart(Math.max(e.start-t.duration,0))}function Dv(e,t,r,i,n,s,a){i-r<=0&&(a.warn("Fragment should have a positive duration",t),i=r+t.duration,s=n+t.duration);let o=r,l=i;const d=t.startPTS,c=t.endPTS;if(Cf(d)){const u=Math.abs(d-r);e&&u>e.totalduration?a.warn(`media timestamps and playlist times differ by ${u}s for level ${t.level} ${e.url}`):Cf(t.deltaPTS)?t.deltaPTS=Math.max(u,t.deltaPTS):t.deltaPTS=u,o=Math.max(r,d),r=Math.min(r,d),n=void 0!==t.startDTS?Math.min(n,t.startDTS):n,l=Math.min(i,c),i=Math.max(i,c),s=void 0!==t.endDTS?Math.max(s,t.endDTS):s}const u=r-t.start;0!==t.start&&t.setStart(r),t.setDuration(i-t.start),t.startPTS=r,t.maxStartPTS=o,t.startDTS=n,t.endPTS=i,t.minEndPTS=l,t.endDTS=s;const h=t.sn;if(!e||h<e.startSN||h>e.endSN)return 0;let f;const p=h-e.startSN,m=e.fragments;for(m[p]=t,f=p;f>0;f--)Pv(m[f],m[f-1]);for(f=p;f<m.length-1;f++)Pv(m[f],m[f+1]);return e.fragmentHint&&Pv(m[m.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,u}function Cv(e,t,r){if(e===t)return;let i=null;const n=e.fragments;for(let e=n.length-1;e>=0;e--){const t=n[e].initSegment;if(t){i=t;break}}let s;e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,r){const i=t.skippedSegments,n=Math.max(e.startSN,t.startSN)-t.startSN,s=(e.fragmentHint?1:0)+(i?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,a=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let d=n;d<=s;d++){const n=l[a+d];let s=o[d];if(i&&!s&&n&&(s=t.fragments[d]=n),n&&s){r(n,s,d,o);const i=n.relurl,a=s.relurl;if(i&&zv(i,a))return void(t.playlistParsingError=_v(`media sequence mismatch ${s.sn}:`,e,t,n,s));if(n.cc!==s.cc)return void(t.playlistParsingError=_v(`discontinuity sequence mismatch (${n.cc}!=${s.cc})`,e,t,n,s))}}}(e,t,(e,r,n,a)=>{if((!t.startCC||t.skippedSegments)&&r.cc!==e.cc){const i=e.cc-r.cc;for(let e=n;e<a.length;e++)a[e].cc+=i;t.endCC=a[a.length-1].cc}Cf(e.startPTS)&&Cf(e.endPTS)&&(r.setStart(r.startPTS=e.startPTS),r.startDTS=e.startDTS,r.maxStartPTS=e.maxStartPTS,r.endPTS=e.endPTS,r.endDTS=e.endDTS,r.minEndPTS=e.minEndPTS,r.setDuration(e.endPTS-e.startPTS),r.duration&&(s=r),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(r.elementaryStreams=e.elementaryStreams),r.loader=e.loader,e.hasStats&&(r.stats=e.stats),e.initSegment&&(r.initSegment=e.initSegment,i=e.initSegment)});const a=t.fragments,o=t.fragmentHint?a.concat(t.fragmentHint):a;if(i&&o.forEach(e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)}),t.skippedSegments){if(t.deltaUpdateFailed=a.some(e=>!e),t.deltaUpdateFailed){r.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)a.shift();t.startSN=a[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=function(e,t,r){const{dateRanges:i,recentlyRemovedDateranges:n}=t,s=Kf({},e);n&&n.forEach(e=>{delete s[e]});const a=Object.keys(s).length;if(!a)return i;return Object.keys(i).forEach(e=>{const t=s[e],n=new Gg(i[e].attr,t);n.isValid?(s[e]=n,t||(n.tagOrder+=a)):r.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Cm(i[e].attr)}"`)}),s}(e.dateRanges,t,r));const i=e.fragments.filter(e=>e.rawProgramDateTime);if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<o.length;e++)null===o[e].programDateTime&&Av(o[e],o[e-1],i);bv(i,t)}t.endCC=a[a.length-1].cc}if(!t.startCC){var l;const r=Fv(e,t.startSN-1);t.startCC=null!=(l=null==r?void 0:r.cc)?l:a[0].cc}!function(e,t,r){if(e&&t){let i=0;for(let n=0,s=e.length;n<=s;n++){const s=e[n],a=t[n+i];s&&a&&s.index===a.index&&s.fragment.sn===a.fragment.sn?r(s,a):i--}}}(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),s?Dv(t,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,r):Ov(e,t),a.length&&(t.totalduration=t.edge-a[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const d=t.advancedDateTime;if(t.advanced&&d){const e=t.edge;t.driftStart||(t.driftStartTime=d,t.driftStart=e),t.driftEndTime=d,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}function _v(e,t,r,i,n){return new Error(`${e} ${n.url}\nPlaylist starting @${t.startSN}\n${t.m3u8}\n\nPlaylist starting @${r.startSN}\n${r.m3u8}`)}function Ov(e,t,r=!0){const i=t.startSN+t.skippedSegments-e.startSN,n=e.fragments,s=i>=0;let a=0;if(s&&i<n.length)a=n[i].start;else if(s&&t.startSN===e.endSN+1)a=e.fragmentEnd;else if(s&&r)a=e.fragmentStart+i*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return;a=e.fragmentStart}Mv(t,a)}function Mv(e,t){if(t){const r=e.fragments;for(let i=e.skippedSegments;i<r.length;i++)r[i].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function Nv(e,t=1/0){let r=1e3*e.targetduration;if(e.updated){const i=e.fragments,n=4;if(i.length&&r*n>t){const e=1e3*i[i.length-1].duration;e<r&&(r=e)}}else r/=2;return Math.round(r)}function Fv(e,t,r){if(!e)return null;let i=e.fragments[t-e.startSN];return i||(i=e.fragmentHint,i&&i.sn===t?i:t<e.startSN&&r&&r.sn===t?r:null)}function $v(e,t,r){return e?Bv(e.partList,t,r):null}function Bv(e,t,r){if(e)for(let i=e.length;i--;){const n=e[i];if(n.index===r&&n.fragment.sn===t)return n}return null}function Uv(e){e.forEach((e,t)=>{var r;null==(r=e.details)||r.fragments.forEach(e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)})})}function zv(e,t){return!(e===t||!t)&&Gv(e)!==Gv(t)}function Gv(e){return e.replace(/\?[^?]*$/,"")}function jv(e,t){for(let i=0,n=e.length;i<n;i++){var r;if((null==(r=e[i])?void 0:r.cc)===t)return e[i]}return null}function Hv(e,t){const r=e.start+t;e.startPTS=r,e.setStart(r),e.endPTS=r+e.duration}function Vv(e,t){const r=t.fragments;for(let t=0,i=r.length;t<i;t++)Hv(r[t],e);t.fragmentHint&&Hv(t.fragmentHint,e),t.alignedSliding=!0}function Wv(e,t){if(!function(e,t){return!!(e&&t.startCC<e.endCC&&t.endCC>e.startCC)}(t,e))return;const r=Math.min(t.endCC,e.endCC),i=jv(t.fragments,r),n=jv(e.fragments,r);if(!i||!n)return;ip.log(`Aligning playlist at start of dicontinuity sequence ${r}`);Vv(i.start-n.start,e)}function Yv(e,t){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;const r=e.fragments,i=t.fragments;if(!r.length||!i.length)return;let n,s;const a=Math.min(t.endCC,e.endCC);t.startCC<a&&e.startCC<a&&(n=jv(i,a),s=jv(r,a)),n&&s||(n=i[Math.floor(i.length/2)],s=jv(r,n.cc)||r[Math.floor(r.length/2)]);const o=n.programDateTime,l=s.programDateTime;if(!o||!l)return;Vv((l-o)/1e3-(s.start-n.start),e)}function Kv(e,t,r){qv(e,t,r),e.addEventListener(t,r)}function qv(e,t,r){e.removeEventListener(t,r)}const Xv=function(e){let t="";const r=e.length;for(let i=0;i<r;i++)t+=`[${e.start(i).toFixed(3)}-${e.end(i).toFixed(3)}]`;return t},Qv="STOPPED",Zv="IDLE",Jv="KEY_LOADING",ey="FRAG_LOADING",ty="FRAG_LOADING_WAITING_RETRY",ry="WAITING_TRACK",iy="PARSING",ny="PARSED",sy="ENDED",ay="ERROR",oy="WAITING_INIT_PTS",ly="WAITING_LEVEL";class dy extends Ig{constructor(e,t,r,i,n){super(i,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Qv,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:e,fragCurrent:t,media:r,mediaBuffer:i,state:n}=this,s=r?r.currentTime:0,a=Dg.bufferInfo(i||r,s,e.maxBufferHole),o=!a.len;if(this.log(`Media seeking to ${Cf(s)?s.toFixed(3):s}, state: ${n}, ${o?"out of":"in"} buffer`),this.state===sy)this.resetLoadingState();else if(t){const r=e.maxFragLookUpTolerance,i=t.start-r,n=t.start+t.duration+r;if(o||n<a.start||i>a.end){const e=s>n;(s<i||e)&&(e&&t.loader&&(this.log(`Cancelling fragment load for seek (sn: ${t.sn})`),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(r){this.fragmentTracker.removeFragmentsInRange(s,1/0,this.playlistType,!0);if(s>this.lastCurrentTime&&(this.lastCurrentTime=s),!this.loadingParts){const e=Math.max(a.end,s),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log(`LL-Part loading ON after seeking to ${s.toFixed(2)} with buffer @${e.toFixed(2)}`),this.loadingParts=t)}}this.hls.hasEnoughToStart||(this.log(`Setting ${o?"startPosition":"nextLoadPosition"} to ${s} for seek without enough to start`),this.nextLoadPosition=s,o&&(this.startPosition=s)),o&&this.state===Zv&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new xg(e.config),this.keyLoader=r,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Sg(e.config)}registerListeners(){const{hls:e}=this;e.on(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Ff.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Ff.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Qv)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Qv}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return-1===t&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const r=e.end||0,i=this.config.timelineOffset||0;if(r<=i)return!1;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=Dg.bufferedInfo(n,e.start,0));const s=e.nextStart;if(s&&s>i&&s<t.edge)return!1;if(this.media.currentTime<e.start)return!1;const a=t.partList;if(null!=a&&a.length){const e=a[a.length-1];return Dg.isBuffered(this.media,e.start+e.duration/2)}const o=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(o)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;var t;return e?(null==(t=this.getLevelDetails())?void 0:t.appliedTimelineOffset)||e:0}onMediaAttached(e,t){const r=this.media=this.mediaBuffer=t.media;Kv(r,"seeking",this.onMediaSeeking),Kv(r,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===Qv&&this.startLoad(i.startPosition)}onMediaDetaching(e,t){const r=!!t.transferMedia,i=this.media;if(null!==i){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),qv(i,"seeking",this.onMediaSeeking),qv(i,"ended",this.onMediaEnded),this.keyLoader&&!r&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,r)return this.resetLoadingState(),void this.resetTransmuxer();this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Qv,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,r){this.startFragRequested=!0,this._loadFragForPlayback(e,t,r)}_loadFragForPlayback(e,t,r){this._doFragLoad(e,t,r,e=>{const t=e.frag;if(this.fragContextChanged(t))return this.warn(`${t.type} sn: ${t.sn}${e.part?" part: "+e.part.index:""} of ${this.fragInfo(t,!1,e.part)}) was dropped during download.`),void this.fragmentTracker.removeFragment(t);t.stats.chunkCount++,this._handleFragmentLoadProgress(e)}).then(e=>{if(!e)return;const t=this.state,r=e.frag;this.fragContextChanged(r)?(t===ey||!this.fragCurrent&&t===iy)&&(this.fragmentTracker.removeFragment(r),this.state=Zv):("payload"in e&&(this.log(`Loaded ${r.type} sn: ${r.sn} of ${this.playlistLabel()} ${r.level}`),this.hls.trigger(Ff.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e))}).catch(t=>{this.state!==Qv&&this.state!==ay&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:r}=this;if(r.getState(e)===cg){const t=e.type,i=this.getFwdBufferInfo(this.mediaBuffer,t),n=Math.max(e.duration,i?i.len:this.config.maxBufferLength),s=this.backtrackFragment;(1===(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(n,e.duration))&&r.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?r.removeAllFragments():r.hasParts(e.type)&&(r.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),r.getState(e)===ug&&r.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,r=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:r};this.hls.trigger(Ff.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(e=>{const t=null==e?void 0:e.frag;if(!t||this.fragContextChanged(t)||!this.levels)throw new Error("init load aborted");return e}).then(e=>{const{hls:t}=this,{frag:r,payload:i}=e,n=r.decryptdata;if(i&&i.byteLength>0&&null!=n&&n.key&&n.iv&&Wg(n.method)){const s=self.performance.now();return this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,Yg(n.method)).catch(e=>{throw t.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:r}),e}).then(i=>{const n=self.performance.now();return t.trigger(Ff.FRAG_DECRYPTED,{frag:r,payload:i,stats:{tstart:s,tdecrypt:n}}),e.payload=i,this.completeInitSegmentLoad(e)})}return this.completeInitSegmentLoad(e)}).catch(t=>{this.state!==Qv&&this.state!==ay&&(this.warn(t),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const r=e.frag.stats;this.state!==Qv&&(this.state=Zv),e.frag.data=new Uint8Array(e.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var r,i;const n=e.tracks;if(n&&!t.encrypted&&(null!=(r=n.audio)&&r.encrypted||null!=(i=n.video)&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const e=this.media,r=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${e?"attached mediaKeys: "+e.mediaKeys:"detached"})`);return this.warn(r.message),!e||e.mediaKeys?!1:(this.hls.trigger(Ff.ERROR,{type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_NO_KEYS,fatal:!1,error:r,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const r=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${r?Xv(Dg.getBuffered(r)):"(detached)"})`),Tp(e)){var i;if(e.type!==Hf){const t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e]))return void(this.state=Zv)}const t=null==(i=this.levels)?void 0:i[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=Zv}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:r,part:i,partsLoaded:n}=e,s=!n||0===n.length||n.some(e=>!e),a=new Rg(r.level,r.sn,r.stats.chunkCount+1,0,i?i.index:-1,!s);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,r=null,i){var n;this.fragCurrent=e;const s=t.details;if(!this.levels||!s)throw new Error(`frag load aborted, missing level${s?"":" detail"}s`);let a=null;if(!e.encrypted||null!=(n=e.decryptdata)&&n.key)e.encrypted||(a=this.keyLoader.loadClear(e,s.encryptedFragments,this.startFragRequested),a&&this.log("[eme] blocking frag load until media-keys acquired"));else if(this.log(`Loading key for ${e.sn} of [${s.startSN}-${s.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Jv,this.fragCurrent=e,a=this.keyLoader.load(e).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(Ff.KEY_LOADED,e),this.state===Jv&&(this.state=Zv),e}),this.hls.trigger(Ff.KEY_LOADING,{frag:e}),null===this.fragCurrent)return this.log("context changed in KEY_LOADING"),Promise.resolve(null);const o=this.fragPrevious;if(Tp(e)&&(!o||e.sn!==o.sn)){const r=this.shouldLoadParts(t.details,e.end);r!==this.loadingParts&&(this.log(`LL-Part loading ${r?"ON":"OFF"} loading sn ${null==o?void 0:o.sn}->${e.sn}`),this.loadingParts=r)}if(r=Math.max(e.start,r||0),this.loadingParts&&Tp(e)){const n=s.partList;if(n&&i){r>s.fragmentEnd&&s.fragmentHint&&(e=s.fragmentHint);const o=this.getNextPart(n,e,r);if(o>-1){const l=n[o];let d;return e=this.fragCurrent=l.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${l.index} (${o}/${n.length-1}) of ${this.fragInfo(e,!1,l)}) cc: ${e.cc} [${s.startSN}-${s.endSN}], target: ${parseFloat(r.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=ey,d=a?a.then(r=>!r||this.fragContextChanged(r.frag)?null:this.doFragPartsLoad(e,l,t,i)).catch(e=>this.handleFragLoadError(e)):this.doFragPartsLoad(e,l,t,i).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(Ff.FRAG_LOADING,{frag:e,part:l,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!e.url||this.loadedEndOfParts(n,r))return Promise.resolve(null)}}var l;if(Tp(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${r.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${null==(l=s.partList)?void 0:l.filter(e=>e.loaded).map(e=>`[${e.start}-${e.end}]`)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+s.startSN+"-"+s.endSN+"]"}, target: ${parseFloat(r.toFixed(3))}`),Cf(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ey;const d=this.config.progressive&&e.type!==Hf;let c;return c=d&&a?a.then(t=>!t||this.fragContextChanged(t.frag)?null:this.fragmentLoader.load(e,i)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,d?i:void 0),a]).then(([e])=>(!d&&i&&i(e),e)).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(Ff.FRAG_LOADING,{frag:e,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,r,i){return new Promise((n,s)=>{var a;const o=[],l=null==(a=r.details)?void 0:a.partList,d=t=>{this.fragmentLoader.loadPart(e,t,i).then(i=>{o[t.index]=i;const s=i.part;this.hls.trigger(Ff.FRAG_LOADED,i);const a=$v(r.details,e.sn,t.index+1)||Bv(l,e.sn,t.index+1);if(!a)return n({frag:e,part:s,partsLoaded:o});d(a)}).catch(s)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===Nf.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===Mf.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(Ff.ERROR,t)}else this.hls.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==iy)return void(this.fragCurrent||this.state===Qv||this.state===ay||(this.state=Zv));const{frag:r,part:i,level:n}=t,s=self.performance.now();r.stats.parsing.end=s,i&&(i.stats.parsing.end=s);const a=this.getLevelDetails(),o=a&&r.sn>a.endSN||this.shouldLoadParts(a,r.end);o!==this.loadingParts&&(this.log(`LL-Part loading ${o?"ON":"OFF"} after parsing segment ending @${r.end.toFixed(2)}`),this.loadingParts=o),this.updateLevelTiming(r,i,n,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var r;const n=e.partList[0];if(n.fragment.type===Hf)return!1;if(t>=n.end+((null==(r=e.fragmentHint)?void 0:r.duration)||0)){var i;if((this.hls.hasEnoughToStart?(null==(i=this.media)?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:r}=this,{level:i,sn:n,part:s}=e;if(null==t||!t[i])return this.warn(`Levels object was unset while buffering fragment ${n} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const a=t[i],o=a.details,l=s>-1?$v(o,n,s):null,d=l?l.fragment:Fv(o,n,r);return d?(r&&r!==d&&(d.stats=r.stats),{frag:d,part:l,level:a}):null}bufferFragmentData(e,t,r,i,n){if(this.state!==iy)return;const{data1:s,data2:a}=e;let o=s;if(a&&(o=Vp(s,a)),!o.length)return;const l=this.initPTS[t.cc],d=l?-l.baseTime/l.timescale:void 0,c={type:e.type,frag:t,part:r,chunkMeta:i,offset:d,parent:t.type,data:o};if(this.hls.trigger(Ff.BUFFER_APPENDING,c),e.dropped&&e.independent&&!r){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Dg.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);const r=t.currentTime,i=Dg.bufferInfo(t,r,0),n=e.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),a=Math.max(Math.min(e.start-s,i.end-s),r+s);e.start-a>s&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){var r;const i=this.getLoadPosition();if(!Cf(i))return null;const n=this.lastCurrentTime>i||null!=(r=this.media)&&r.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,n)}getFwdBufferInfoAtPos(e,t,r,i){const n=Dg.bufferInfo(e,t,i);if(0===n.len&&void 0!==n.nextStart){const s=this.fragmentTracker.getBufferedFrag(t,r);if(s&&(n.nextStart<=s.end||s.gap)){const r=Math.max(Math.min(n.nextStart,s.end)-t,i);return Dg.bufferInfo(e,t,r)}}return n}getMaxBufferLength(e){const{config:t}=this;let r;return r=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,Math.min(r,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const r=this.config,i=Math.max(Math.min(e-t,r.maxBufferLength),t),n=Math.max(e-3*t,r.maxMaxBufferLength/2,i);return n>=i&&(r.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),!0)}getAppendedFrag(e,t=Gf){const r=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return r&&"fragment"in r?r.fragment:r}getNextFragment(e,t){const r=t.fragments,i=r.length;if(!i)return null;const{config:n}=this,s=r[0].start,a=n.lowLatencyMode&&!!t.partList;let o=null;if(t.live){const r=n.initialLiveManifestSize;if(i<r)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${r})`),null;if(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<s){var l;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(t);const r=this.hls.startPosition,i=this.hls.liveSyncPosition,n=o?(-1!==r&&r>=s?r:i)||o.start:e;this.log(`Setting startPosition to ${n} to match start frag at live edge. mainStart: ${r} liveSyncPosition: ${i} frag.start: ${null==(l=o)?void 0:l.start}`),this.startPosition=this.nextLoadPosition=n}}else e<=s&&(o=r[0]);if(!o){const r=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,r,t)}let d=this.filterReplacedPrimary(o,t);if(!d&&o){const e=o.sn-t.startSN;d=this.filterReplacedPrimary(r[e+1]||null,t)}return this.mapToInitFragWhenRequired(d)}isLoopLoading(e,t){const r=this.fragmentTracker.getState(e);return(r===hg||r===ug&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,r,i,n){let s=null;if(e.gap&&(s=this.getNextFragment(this.nextLoadPosition,t),s&&!s.gap&&r.nextStart)){const e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,i,0);if(null!==e&&r.len+e.len>=n){const e=s.sn;return this.loopSn!==e&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${e}`),this.loopSn=e),null}}return this.loopSn=void 0,s}get primaryPrefetch(){if(cy(this.config)){var e;if(null==(e=this.hls.interstitialsManager)||null==(e=e.playingItem)?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(cy(this.config)&&e.type!==Hf){const r=this.hls.interstitialsManager,i=null==r?void 0:r.bufferingItem;if(i){const r=i.event;if(r){if(r.appendInPlace||Math.abs(e.start-i.start)>1||0===i.start)return null}else{if(e.end<=i.start&&!1===(null==t?void 0:t.live))return null;if(e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}}const n=null==r?void 0:r.playerQueue;if(n)for(let t=n.length;t--;){const r=n[t].interstitial;if(r.appendInPlace&&e.start>=r.startTime&&e.end<=r.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,r){let i=-1,n=!1,s=!0;for(let a=0,o=e.length;a<o;a++){const o=e[a];if(s=s&&!o.independent,i>-1&&r<o.start)break;const l=o.loaded;l?i=-1:(n||(o.independent||s)&&o.fragment===t)&&(o.fragment!==t&&this.warn(`Need buffer at ${r} but next unloaded part starts at ${o.start}`),i=a),n=l}return i}loadedEndOfParts(e,t){let r;for(let i=e.length;i--;){if(r=e[i],!r.loaded)return!1;if(t>r.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,r=this.fragPrevious;let i=null;if(r){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`),i=function(e,t,r){if(null===t||!Array.isArray(e)||!e.length||!Cf(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;for(let i=0;i<e.length;++i){const n=e[i];if(Hm(t,r,n))return n}return null}(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const n=r.sn+1;if(n>=e.startSN&&n<=e.endSN){const s=t[n-e.startSN];r.cc===s.cc&&(i=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=Vm(e,r.cc,r.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(i=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,r){const{config:i}=this;let{fragPrevious:n}=this,{fragments:s,endSN:a}=r;const{fragmentHint:o}=r,{maxFragLookUpTolerance:l}=i,d=r.partList,c=!!(this.loadingParts&&null!=d&&d.length&&o);let u;if(c&&!this.bitrateTest&&d[d.length-1].fragment.sn===o.sn&&(s=s.concat(o),a=o.sn),e<t){var h;u=Gm(n,s,e,e<this.lastCurrentTime||e>t-l||null!=(h=this.media)&&h.paused||!this.startFragRequested?0:l)}else u=s[s.length-1];if(u){const e=u.sn-r.startSN,t=this.fragmentTracker.getState(u);if((t===hg||t===ug&&u.gap)&&(n=u),n&&u.sn===n.sn&&(!c||d[0].fragment.sn>u.sn||!r.live)){if(u.level===n.level){const t=s[e+1];u=u.sn<a&&this.fragmentTracker.getState(t)!==hg?t:null}}}return u}alignPlaylists(e,t,r){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const n=e.fragmentStart,s=!t,a=e.alignedSliding&&Cf(n);if(s||!a&&!n){!function(e,t){e&&(Wv(t,e),t.alignedSliding||Yv(t,e),t.alignedSliding||t.skippedSegments||Ov(e,t,!1))}(r,e);const n=e.fragmentStart;return this.log(`Live playlist sliding: ${n.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${i}`),n}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let r=this.startPosition;r<t&&(r=-1);const i=this.timelineOffset;if(-1===r){const n=null!==this.startTimeOffset,s=n?this.startTimeOffset:e.startTimeOffset;null!==s&&Cf(s)?(r=t+s,s<0&&(r+=e.edge),r=Math.min(Math.max(t,r),t+e.totalduration),this.log(`Setting startPosition to ${r} for start time offset ${s} found in ${n?"multivariant":"media"} playlist`),this.startPosition=r):e.live?(r=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${r}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=r=0),this.lastCurrentTime=r+i}this.nextLoadPosition=r+i}getLoadPosition(){var e;const{media:t}=this;let r=0;return null!=(e=this.hls)&&e.hasEnoughToStart&&t?r=t.currentTime:this.nextLoadPosition>=0&&(r=this.nextLoadPosition),r}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&Tp(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===ty)||(this.state=Zv)}onFragmentOrKeyLoadError(e,t){var r;if(t.chunkMeta&&!t.frag){const e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;var n;if(this.fragContextChanged(i))return void this.warn(`Frag load error must match current frag to retry ${i.url} > ${null==(n=this.fragCurrent)?void 0:n.url}`);const s=t.details===Nf.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const a=t.errorAction;if(!a)return void(this.state=ay);const{action:o,flags:l,retryCount:d=0,retryConfig:c}=a,u=!!c,h=u&&o===ig,f=u&&!a.resolved&&l===sg,p=null==(r=this.hls.latestLevelDetails)?void 0:r.live;if(!h&&f&&Tp(i)&&!i.endList&&p&&!Km(t))this.resetFragmentErrors(e),this.treatAsGap(i),a.resolved=!0;else if((h||f)&&d<c.maxNumRetry){var m;const r=Jm(null==(m=t.response)?void 0:m.code),n=Xm(c,d);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+n,this.state=ty,a.resolved=!0,r)return this.log("Waiting for connection (offline)"),this.retryDate=1/0,void(t.reason="offline");this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${d+1}/${c.maxNumRetry} in ${n}ms`)}else if(c){if(this.resetFragmentErrors(e),!(d<c.maxNumRetry))return void this.warn(`${t.details} reached or exceeded max retry (${d})`);s||o===rg||(a.resolved=!0)}else this.state=o===tg?ly:ay;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,r=t===1/0;(!t||e>=t||r&&!Jm(0))&&(r&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Zv)}reduceLengthAndFlushBuffer(e){if(this.state===iy||this.state===ny){const t=e.frag,r=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,r),n=i&&i.len>.5;n&&this.reduceMaxBufferLength(i.len,(null==t?void 0:t.duration)||10);const s=!n;return s&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${r} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===jf&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Qv&&(this.state=Zv)}afterBufferFlushed(e,t,r){if(!e)return;const i=Dg.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,r),this.state===sy&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Qv&&(this.state=Zv)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;null!=t&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${-1===e.level?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,r,i){const n=r.details;if(!n)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce((t,s)=>{const a=e.elementaryStreams[s];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${e.sn} ${s} duration reliably (${o})`),t||!1;const l=i?0:Dv(n,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS,this);return this.hls.trigger(Ff.LEVEL_PTS_UPDATED,{details:n,level:r,drift:l,type:s,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t},!1)){var s;const t=null===(null==(s=this.transmuxer)?void 0:s.error);if((0===r.fragmentError||t&&(r.fragmentError<2||e.endList))&&this.treatAsGap(e,r),t){const t=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(t.message),this.hls.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=ny,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(Ff.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===Gf?"level":"track"}fragInfo(e,t=!0,r){var i,n;return`${this.playlistLabel()} ${e.level} (${r?"part":"frag"}:[${(null!=(i=t&&!r?e.startPTS:(r||e).start)?i:NaN).toFixed(3)}-${(null!=(n=t&&!r?e.endPTS:(r||e).end)?n:NaN).toFixed(3)}]${r&&"main"===e.type?"INDEPENDENT="+(r.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;null==(e=this.transmuxer)||e.reset()}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function cy(e){return!!e.interstitialsController&&!1!==e.enableInterstitialPlayback}class uy{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let r;return e.length?(r=1===e.length?e[0]:function(e,t){const r=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return r}(e,t),this.reset(),r):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var hy,fy={exports:{}};var py=(hy||(hy=1,function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,i,s,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new n(i,s||e,a),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function a(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),o.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},o.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,a=new Array(s);n<s;n++)a[n]=i[n].fn;return a},o.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},o.prototype.emit=function(e,t,i,n,s,a){var o=r?r+e:e;if(!this._events[o])return!1;var l,d,c=this._events[o],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,n),!0;case 5:return c.fn.call(c.context,t,i,n,s),!0;case 6:return c.fn.call(c.context,t,i,n,s,a),!0}for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c.fn.apply(c.context,l)}else{var h,f=c.length;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),u){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,i);break;case 4:c[d].fn.call(c[d].context,t,i,n);break;default:if(!l)for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c[d].fn.apply(c[d].context,l)}}return!0},o.prototype.on=function(e,t,r){return s(this,e,t,r,!1)},o.prototype.once=function(e,t,r){return s(this,e,t,r,!0)},o.prototype.removeListener=function(e,t,i,n){var s=r?r+e:e;if(!this._events[s])return this;if(!t)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||n&&!o.once||i&&o.context!==i||a(this,s);else{for(var l=0,d=[],c=o.length;l<c;l++)(o[l].fn!==t||n&&!o[l].once||i&&o[l].context!==i)&&d.push(o[l]);d.length?this._events[s]=1===d.length?d[0]:d:a(this,s)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,e.exports=o}(fy)),fy.exports),my=dp(py);const gy="1.6.15",vy={};function yy(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function by(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Ey(e,t){let r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3],r}function wy(e,t){const r=t;let i=0;for(;by(e,t);){i+=10;i+=Ey(e,t+6),yy(e,t+10)&&(i+=10),t+=i}if(i>0)return e.subarray(r,r+i)}function Sy(e,t){return 255===e[t]&&240==(246&e[t+1])}function Ty(e,t){return 1&e[t+1]?7:9}function xy(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Ay(e,t){return t+1<e.length&&Sy(e,t)}function ky(e,t){if(Ay(e,t)){const r=Ty(e,t);if(t+r>=e.length)return!1;const i=xy(e,t);if(i<=r)return!1;const n=t+i;return n===e.length||Ay(e,n)}return!1}function Ly(e,t,r,i,n){if(!e.samplerate){const s=function(e,t,r,i){const n=t[r+2],s=n>>2&15;if(s>12){const t=new Error(`invalid ADTS sampling index:${s}`);return void e.emit(Ff.ERROR,Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}const a=1+(n>>6&3),o=t[r+3]>>6&3|(1&n)<<2,l="mp4a.40."+a,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][s];let c=s;5!==a&&29!==a||(c-=3);const u=[a<<3|(14&c)>>1,(1&c)<<7|o<<3];return ip.log(`manifest codec:${i}, parsed codec:${l}, channels:${o}, rate:${d} (ADTS object type:${a} sampling index:${s})`),{config:u,samplerate:d,channelCount:o,codec:l,parsedCodec:l,manifestCodec:i}}(t,r,i,n);if(!s)return;Kf(e,s)}}function Iy(e){return 9216e4/e}function Ry(e,t,r,i,n){const s=i+n*Iy(e.samplerate),a=function(e,t){const r=Ty(e,t);if(t+r<=e.length){const i=xy(e,t)-r;if(i>0)return{headerLength:r,frameLength:i}}}(t,r);let o;if(a){const{frameLength:i,headerLength:n}=a,l=n+i,d=Math.max(0,r+l-t.length);d?(o=new Uint8Array(l-n),o.set(t.subarray(r+n,t.length),0)):o=t.subarray(r+n,r+l);const c={unit:o,pts:s};return d||e.samples.push(c),{sample:c,length:l,missing:d}}const l=t.length-r;o=new Uint8Array(l),o.set(t.subarray(r,t.length),0);return{sample:{unit:o,pts:s},length:l,missing:-1}}function Py(e,t){return by(e,t)&&Ey(e,t+6)+10<=e.length-t}function Dy(e,t=0,r=1/0){return function(e,t,r,i){const n=function(e){return e instanceof ArrayBuffer?e:e.buffer}(e);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const a=(u=e,u&&u.buffer instanceof ArrayBuffer&&void 0!==u.byteLength&&void 0!==u.byteOffset?e.byteOffset:0),o=(a+e.byteLength)/s,l=(a+t)/s,d=Math.floor(Math.max(0,Math.min(l,o))),c=Math.floor(Math.min(d+Math.max(r,0),o));var u;return new i(n,d,c-d)}(e,t,r,Uint8Array)}function Cy(e){const t={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(e.size<2)return;if(3!==e.data[0])return void console.log("Ignore frame with unrecognized character encoding");const r=e.data.subarray(1).indexOf(0);if(-1===r)return;const i=ap(Dy(e.data,1,r)),n=e.data[2+r],s=e.data.subarray(3+r).indexOf(0);if(-1===s)return;const a=ap(Dy(e.data,3+r,s));let o;return o="--\x3e"===i?ap(Dy(e.data,4+r+s)):function(e){return e instanceof ArrayBuffer?e:0==e.byteOffset&&e.byteLength==e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}(e.data.subarray(4+r+s)),t.mimeType=i,t.pictureType=n,t.description=a,t.data=o,t}function _y(e){return"PRIV"===e.type?function(e){if(e.size<2)return;const t=ap(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}(e):"W"===e.type[0]?function(e){if("WXXX"===e.type){if(e.size<2)return;let t=1;const r=ap(e.data.subarray(t),!0);t+=r.length+1;const i=ap(e.data.subarray(t));return{key:e.type,info:r,data:i}}const t=ap(e.data);return{key:e.type,info:"",data:t}}(e):"APIC"===e.type?Cy(e):function(e){if(e.size<2)return;if("TXXX"===e.type){let t=1;const r=ap(e.data.subarray(t),!0);t+=r.length+1;const i=ap(e.data.subarray(t));return{key:e.type,info:r,data:i}}const t=ap(e.data.subarray(1));return{key:e.type,info:"",data:t}}(e)}function Oy(e){const t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=Ey(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}}function My(e){let t=0;const r=[];for(;by(e,t);){const i=Ey(e,t+6);e[t+5]>>6&1&&(t+=10),t+=10;const n=t+i;for(;t+10<n;){const i=Oy(e.subarray(t)),n=_y(i);n&&r.push(n),t+=i.size+10}yy(e,t)&&(t+=10)}return r}function Ny(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function Fy(e){if(8===e.data.byteLength){const t=new Uint8Array(e.data),r=1&t[3];let i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}}function $y(e){const t=My(e);for(let e=0;e<t.length;e++){const r=t[e];if(Ny(r))return Fy(r)}}let By=function(e){return e.audioId3="org.id3",e.dateRange="com.apple.quicktime.HLS",e.emsg="https://aomedia.org/emsg/ID3",e.misbklv="urn:misb:KLV:bin:1910.1",e}({});function Uy(e="",t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class zy{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,r,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,r){}demux(e,t){this.cachedData&&(e=Vp(this.cachedData,e),this.cachedData=null);let r,i=wy(e,0),n=i?i.length:0;const s=this._audioTrack,a=this._id3Track,o=i?$y(i):void 0,l=e.length;for((null===this.basePTS||0===this.frameIndex&&Cf(o))&&(this.basePTS=Gy(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:By.audioId3,duration:Number.POSITIVE_INFINITY});n<l;){if(this.canParse(e,n)){const t=this.appendFrame(s,e,n);t?(this.frameIndex++,this.lastPTS=t.sample.pts,n+=t.length,r=n):n=l}else Py(e,n)?(i=wy(e,n),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:By.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,r=n):n++;if(n===l&&r!==l){const t=e.slice(r);this.cachedData?this.cachedData=Vp(this.cachedData,t):this.cachedData=t}}return{audioTrack:s,videoTrack:Uy(),id3Track:a,textTrack:Uy()}}demuxSampleAes(e,t,r){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Uy(),id3Track:this._id3Track,textTrack:Uy()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Gy=(e,t,r)=>{if(Cf(e))return 90*e;return 9e4*t+(r?9e4*r.baseTime/r.timescale:0)};let jy=null;const Hy=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Vy=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Wy=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Yy=[0,1,1,4];function Ky(e,t,r,i,n){if(r+24>t.length)return;const s=qy(t,r);if(s&&r+s.frameLength<=t.length){const a=i+n*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:t.subarray(r,r+s.frameLength),pts:a,dts:a};return e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}function qy(e,t){const r=e[t+1]>>3&3,i=e[t+1]>>1&3,n=e[t+2]>>4&15,s=e[t+2]>>2&3;if(1!==r&&0!==n&&15!==n&&3!==s){const a=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*Hy[14*(3===r?3-i:3===i?3:4)+n-1],d=Vy[3*(3===r?0:2===r?1:2)+s],c=3===o?1:2,u=Wy[r][i],h=Yy[i],f=8*u*h,p=Math.floor(u*l/d+a)*h;if(null===jy){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);jy=e?parseInt(e[1]):0}return!!jy&&jy<=87&&2===i&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:c,frameLength:p,samplesPerFrame:f}}}function Xy(e,t){return!(255!==e[t]||224&~e[t+1]||!(6&e[t+1]))}function Qy(e,t){return t+1<e.length&&Xy(e,t)}function Zy(e,t){if(t+1<e.length&&Xy(e,t)){const r=4,i=qy(e,t);let n=r;null!=i&&i.frameLength&&(n=i.frameLength);const s=t+n;return s===e.length||Qy(e,s)}return!1}const Jy=(e,t)=>{let r=0,i=5;t+=i;const n=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=e[t];const o=Math.min(i,8),l=8-o;s[0]=4278190080>>>24+l<<l,n[0]=(a[0]&s[0])>>l,r=r?r<<o|n[0]:n[0],t+=1,i-=o}return r};class eb extends zy{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,r,i){super.resetInitSegment(e,t,r,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,r){const i=tb(e,t,r,this.basePTS,this.frameIndex);if(-1!==i){return{sample:e.samples[e.samples.length-1],length:i,missing:0}}}static probe(e){if(!e)return!1;const t=wy(e,0);if(!t)return!1;const r=t.length;return 11===e[r]&&119===e[r+1]&&void 0!==$y(t)&&Jy(e,r)<16}}function tb(e,t,r,i,n){if(r+8>t.length)return-1;if(11!==t[r]||119!==t[r+1])return-1;const s=t[r+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],o=63&t[r+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+s];if(r+l>t.length)return-1;const d=t[r+6]>>5;let c=0;2===d?c+=2:(1&d&&1!==d&&(c+=2),4&d&&(c+=2));const u=(t[r+6]<<8|t[r+7])>>12-c&1,h=[2,1,2,3,3,4,4,5][d]+u,f=t[r+5]>>3,p=7&t[r+5],m=new Uint8Array([s<<6|f<<1|p>>2,(3&p)<<6|d<<3|u<<2|o>>4,o<<4&224]),g=i+n*(1536/a*9e4),v=t.subarray(r,r+l);return e.config=m,e.channelCount=h,e.samplerate=a,e.samples.push({unit:v,pts:g}),l}const rb=/\/emsg[-/]ID3/i;function ib(e,t){return Cf(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}class nb{constructor(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new Sg(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,vg)}decryptAacSample(e,t,r){const i=e[t].unit;if(i.length<=16)return;const n=i.subarray(16,i.length-i.length%16),s=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(s).then(n=>{const s=new Uint8Array(n);i.set(s,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,r)}).catch(r)}decryptAacSamples(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,r),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t);let i=0;for(let t=32;t<e.length-16;t+=160,i+=16)r.set(e.subarray(t,t+16),i);return r}getAvcDecryptedUnit(e,t){const r=new Uint8Array(t);let i=0;for(let t=32;t<e.length-16;t+=160,i+=16)e.set(r.subarray(i,i+16),t);return e}decryptAvcSample(e,t,r,i,n){const s=Xp(n.data),a=this.getAvcEncryptedData(s);this.decryptBuffer(a.buffer).then(a=>{n.data=this.getAvcDecryptedUnit(s,a),this.decrypter.isSync()||this.decryptAvcSamples(e,t,r+1,i)}).catch(i)}decryptAvcSamples(e,t,r,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length)return void i();const n=e[t].units;for(;!(r>=n.length);r++){const s=n[r];if(!(s.data.length<=48||1!==s.type&&5!==s.type||(this.decryptAvcSample(e,t,r,i,s),this.decrypter.isSync())))return}}}}class sb{constructor(){this.VideoSample=null}createVideoSample(e,t,r){return{key:e,frame:!1,pts:t,dts:r,units:[],length:0}}getLastNalUnit(e){var t;let r,i=this.VideoSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){const e=i.units;r=e[e.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){const r=t.samples,i=r.length;if(!i)return void t.dropped++;{const t=r[i-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}}parseNALu(e,t,r){const i=t.byteLength;let n=e.naluState||0;const s=n,a=[];let o,l,d,c=0,u=-1,h=0;for(-1===n&&(u=0,h=this.getNALuType(t,0),n=0,c=1);c<i;)if(o=t[c++],n)if(1!==n)if(o)if(1===o){if(l=c-n-1,u>=0){const e={data:t.subarray(u,l),type:h};a.push(e)}else{const r=this.getLastNalUnit(e.samples);r&&(s&&c<=4-s&&r.state&&(r.data=r.data.subarray(0,r.data.byteLength-s)),l>0&&(r.data=Vp(r.data,t.subarray(0,l)),r.state=0))}c<i?(d=this.getNALuType(t,c),u=c,h=d,n=0):n=-1}else n=0;else n=3;else n=o?0:2;else n=o?0:1;if(u>=0&&n>=0){const e={data:t.subarray(u,i),type:h,state:n};a.push(e)}if(0===a.length){const r=this.getLastNalUnit(e.samples);r&&(r.data=Vp(r.data,t))}return e.naluState=n,a}}class ab{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),n=Math.min(4,t);if(0===n)throw new Error("no bytes available");i.set(e.subarray(r,r+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const r=this.word>>>32-t;if(e>32&&ip.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?r<<t|this.readBits(t):r}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class ob extends sb{parsePES(e,t,r,i){const n=this.parseNALu(e,r.data,i);let s,a=this.VideoSample,o=!1;r.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),n.forEach(i=>{var n,l;switch(i.type){case 1:{let t=!1;s=!0;const n=i.data;if(o&&n.length>4){const e=this.readSliceType(n);2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var d;if(t)null!=(d=a)&&d.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),a.frame=!0,a.key=t;break}case 5:s=!0,null!=(n=a)&&n.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),a.key=!0,a.frame=!0;break;case 6:s=!0,qp(i.data,1,r.pts,t.samples);break;case 7:{var c,u;s=!0,o=!0;const t=i.data,r=this.readSPS(t);if(!e.sps||e.width!==r.width||e.height!==r.height||(null==(c=e.pixelRatio)?void 0:c[0])!==r.pixelRatio[0]||(null==(u=e.pixelRatio)?void 0:u[1])!==r.pixelRatio[1]){e.width=r.width,e.height=r.height,e.pixelRatio=r.pixelRatio,e.sps=[t];const i=t.subarray(1,4);let n="avc1.";for(let e=0;e<3;e++){let t=i[e].toString(16);t.length<2&&(t="0"+t),n+=t}e.codec=n}break}case 8:s=!0,e.pps=[i.data];break;case 9:s=!0,e.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts));break;case 12:s=!0;break;default:s=!1}if(a&&s){a.units.push(i)}}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return 31&e[t]}readSliceType(e){const t=new ab(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let r,i=8,n=8;for(let s=0;s<e;s++)0!==n&&(r=t.readEG(),n=(i+r+256)%256),i=0===n?i:n}readSPS(e){const t=new ab(e);let r,i,n,s=0,a=0,o=0,l=0;const d=t.readUByte.bind(t),c=t.readBits.bind(t),u=t.readUEG.bind(t),h=t.readBoolean.bind(t),f=t.skipBits.bind(t),p=t.skipEG.bind(t),m=t.skipUEG.bind(t),g=this.skipScalingList.bind(this);d();const v=d();if(c(5),f(3),d(),m(),100===v||110===v||122===v||244===v||44===v||83===v||86===v||118===v||128===v){const e=u();if(3===e&&f(1),m(),m(),f(1),h())for(i=3!==e?8:12,n=0;n<i;n++)h()&&g(n<6?16:64,t)}m();const y=u();if(0===y)u();else if(1===y)for(f(1),p(),p(),r=u(),n=0;n<r;n++)p();m(),f(1);const b=u(),E=u(),w=c(1);0===w&&f(1),f(1),h()&&(s=u(),a=u(),o=u(),l=u());let S=[1,1];if(h()&&h()){switch(d()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:S=[d()<<8|d(),d()<<8|d()]}}return{width:Math.ceil(16*(b+1)-2*s-2*a),height:(2-w)*(E+1)*16-(w?2:4)*(o+l),pixelRatio:S}}}class lb extends sb{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,r,i){const n=this.parseNALu(e,r.data,i);let s,a=this.VideoSample,o=!1;r.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),n.forEach(i=>{var n,l;switch(i.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),a.frame=!0,s=!0;break;case 16:case 17:case 18:case 21:var d;if(s=!0,o)null!=(d=a)&&d.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:s=!0,null!=(n=a)&&n.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),a.key=!0,a.frame=!0;break;case 39:s=!0,qp(i.data,2,r.pts,t.samples);break;case 32:s=!0,e.vps||("object"!=typeof e.params&&(e.params={}),e.params=Kf(e.params,this.readVPS(i.data)),this.initVPS=i.data),e.vps=[i.data];break;case 33:if(s=!0,o=!0,void 0===e.vps||e.vps[0]===this.initVPS||void 0===e.sps||this.matchSPS(e.sps[0],i.data)||(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const t=this.readSPS(i.data);e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],"object"!=typeof e.params&&(e.params={});for(const r in t.params)e.params[r]=t.params[r]}this.pushParameterSet(e.sps,i.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),a.key=!0;break;case 34:if(s=!0,"object"==typeof e.params){if(!e.pps){e.pps=[];const t=this.readPPS(i.data);for(const r in t)e.params[r]=t[r]}this.pushParameterSet(e.pps,i.data,e.vps)}break;case 35:s=!0,e.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts));break;default:s=!1}if(a&&s){a.units.push(i)}}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,r){(r&&r[0]===this.initVPS||!r&&!e.length)&&e.push(t)}getNALuType(e,t){return(126&e[t])>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let r=0;for(let i=0;i<e.byteLength;i++)i>=2&&3===e[i]&&0===e[i-1]&&0===e[i-2]||(t[r]=e[i],r++);return new Uint8Array(t.buffer,0,r)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new ab(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);return{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}}readSPS(e){const t=new ab(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const r=t.readBits(3);t.readBoolean();const i=t.readBits(2),n=t.readBoolean(),s=t.readBits(5),a=t.readUByte(),o=t.readUByte(),l=t.readUByte(),d=t.readUByte(),c=t.readUByte(),u=t.readUByte(),h=t.readUByte(),f=t.readUByte(),p=t.readUByte(),m=t.readUByte(),g=t.readUByte(),v=[],y=[];for(let e=0;e<r;e++)v.push(t.readBoolean()),y.push(t.readBoolean());if(r>0)for(let e=r;e<8;e++)t.readBits(2);for(let e=0;e<r;e++)v[e]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),y[e]&&t.readUByte();t.readUEG();const b=t.readUEG();3==b&&t.skipBits(1);const E=t.readUEG(),w=t.readUEG(),S=t.readBoolean();let T=0,x=0,A=0,k=0;S&&(T+=t.readUEG(),x+=t.readUEG(),A+=t.readUEG(),k+=t.readUEG());const L=t.readUEG(),I=t.readUEG(),R=t.readUEG();for(let e=t.readBoolean()?0:r;e<=r;e++)t.skipUEG(),t.skipUEG(),t.skipUEG();t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.readBoolean()){if(t.readBoolean())for(let e=0;e<4;e++)for(let r=0;r<(3===e?2:6);r++){if(t.readBoolean()){const r=Math.min(64,1<<4+(e<<1));e>1&&t.readEG();for(let e=0;e<r;e++)t.readEG()}else t.readUEG()}}t.readBoolean(),t.readBoolean();t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const P=t.readUEG();let D=0;for(let e=0;e<P;e++){let r=!1;if(0!==e&&(r=t.readBoolean()),r){e===P&&t.readUEG(),t.readBoolean(),t.readUEG();let r=0;for(let e=0;e<=D;e++){const e=t.readBoolean();let i=!1;e||(i=t.readBoolean()),(e||i)&&r++}D=r}else{const e=t.readUEG(),r=t.readUEG();D=e+r;for(let r=0;r<e;r++)t.readUEG(),t.readBoolean();for(let e=0;e<r;e++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const e=t.readUEG();for(let r=0;r<e;r++){for(let e=0;e<R+4;e++)t.readBits(1);t.readBits(1)}}let C=0,_=1,O=1,M=!0,N=1,F=0;t.readBoolean(),t.readBoolean();let $=!1;if(t.readBoolean()){if(t.readBoolean()){const e=t.readUByte();e>0&&e<16?(_=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],O=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(_=t.readBits(16),O=t.readBits(16))}t.readBoolean()&&t.readBoolean();if(t.readBoolean()){t.readBits(3),t.readBoolean();t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())}t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),$=t.readBoolean(),$&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG());if(t.readBoolean()){N=t.readBits(32),F=t.readBits(32);t.readBoolean()&&t.readUEG();if(t.readBoolean()){const e=t.readBoolean(),i=t.readBoolean();let n=!1;(e||i)&&(n=t.readBoolean(),n&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),n&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let s=0;s<=r;s++){M=t.readBoolean();let r=!1;M||t.readBoolean()?t.readEG():r=t.readBoolean();const s=r?1:t.readUEG()+1;if(e)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),n&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(i)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),n&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),C=t.readUEG())}let B=E,U=w;if(S){let e=1,t=1;1===b?e=t=2:2==b&&(e=2),B=E-e*x-e*T,U=w-t*k-t*A}const z=i?["A","B","C"][i]:"",G=a<<24|o<<16|l<<8|d;let j=0;for(let e=0;e<32;e++)j=(j|(G>>e&1)<<31-e)>>>0;let H=j.toString(16);1===s&&"2"===H&&(H="6");return{codecString:`hvc1.${z}${s}.${H}.${n?"H":"L"}${g}.B0`,params:{general_tier_flag:n,general_profile_idc:s,general_profile_space:i,general_profile_compatibility_flags:[a,o,l,d],general_constraint_indicator_flags:[c,u,h,f,p,m],general_level_idc:g,bit_depth:L+8,bit_depth_luma_minus8:L,bit_depth_chroma_minus8:I,min_spatial_segmentation_idc:C,chroma_format_idc:b,frame_rate:{fixed:M,fps:F/N}},width:B,height:U,pixelRatio:[_,O]}}readPPS(e){const t=new ab(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2);t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const r=t.readBoolean(),i=t.readBoolean();let n=1;return i&&r?n=0:i?n=3:r&&(n=2),{parallelismType:n}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const db=188;class cb{constructor(e,t,r,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=r,this.logger=i,this.videoParser=null}static probe(e,t){const r=cb.syncOffset(e);return r>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${r}`),-1!==r}static syncOffset(e){const t=e.length;let r=Math.min(940,t-db)+1,i=0;for(;i<r;){let n=!1,s=-1,a=0;for(let o=i;o<t;o+=db){if(71!==e[o]||t-o!==db&&71!==e[o+db]){if(a)return-1;break}if(a++,-1===s&&(s=o,0!==s&&(r=Math.min(s+18612,e.length-db)+1)),n||(n=0===ub(e,o)),n&&a>1&&(0===s&&a>2||o+db>r))return s}i++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Rp[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,r,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=cb.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=cb.createTrack("audio",i),this._id3Track=cb.createTrack("id3"),this._txtTrack=cb.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:r}=this;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,r=!1,i=!1){let n;r||(this.sampleAes=null);const s=this._videoTrack,a=this._audioTrack,o=this._id3Track,l=this._txtTrack;let d=s.pid,c=s.pesData,u=a.pid,h=o.pid,f=a.pesData,p=o.pesData,m=null,g=this.pmtParsed,v=this._pmtId,y=e.length;if(this.remainderData&&(y=(e=Vp(this.remainderData,e)).length,this.remainderData=null),y<db&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};const b=Math.max(0,cb.syncOffset(e));y-=(y-b)%db,y<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,y,e.buffer.byteLength-y));let E=0;for(let t=b;t<y;t+=db)if(71===e[t]){const i=!!(64&e[t+1]),y=ub(e,t);let E;if((48&e[t+3])>>4>1){if(E=t+5+e[t+4],E===t+db)continue}else E=t+4;switch(y){case d:i&&(c&&(n=gb(c,this.logger))&&(this.readyVideoParser(s.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(s,l,n,!1)),c={data:[],size:0}),c&&(c.data.push(e.subarray(E,t+db)),c.size+=t+db-E);break;case u:if(i){if(f&&(n=gb(f,this.logger)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,n);break;case"mp3":this.parseMPEGPES(a,n);break;case"ac3":this.parseAC3PES(a,n)}f={data:[],size:0}}f&&(f.data.push(e.subarray(E,t+db)),f.size+=t+db-E);break;case h:i&&(p&&(n=gb(p,this.logger))&&this.parseID3PES(o,n),p={data:[],size:0}),p&&(p.data.push(e.subarray(E,t+db)),p.size+=t+db-E);break;case 0:i&&(E+=e[E]+1),v=this._pmtId=hb(e,E);break;case v:{i&&(E+=e[E]+1);const n=fb(e,E,this.typeSupported,r,this.observer,this.logger);d=n.videoPid,d>0&&(s.pid=d,s.segmentCodec=n.segmentVideoCodec),u=n.audioPid,u>0&&(a.pid=u,a.segmentCodec=n.segmentAudioCodec),h=n.id3Pid,h>0&&(o.pid=h),null===m||g||(this.logger.warn(`MPEG-TS PMT found at ${t} after unknown PID '${m}'. Backtracking to sync byte @${b} to parse all TS packets.`),m=null,t=b-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=y}}else E++;E>0&&pb(this.observer,new Error(`Found ${E} TS packet/s that do not start with 0x47`),void 0,this.logger),s.pesData=c,a.pesData=f,o.pesData=p;const w={audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};return i&&this.extractRemainingSamples(w),w}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:r,id3Track:i,textTrack:n}=e,s=r.pesData,a=t.pesData,o=i.pesData;let l;if(s&&(l=gb(s,this.logger))?(this.readyVideoParser(r.segmentCodec),null!==this.videoParser&&(this.videoParser.parsePES(r,n,l,!0),r.pesData=null)):r.pesData=s,a&&(l=gb(a,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=a&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;o&&(l=gb(o,this.logger))?(this.parseID3PES(i,l),i.pesData=null):i.pesData=o}demuxSampleAes(e,t,r){const i=this.demux(e,r,!0,!this.config.progressive),n=this.sampleAes=new nb(this.observer,this.config,t);return this.decrypt(i,n)}readyVideoParser(e){null===this.videoParser&&("avc"===e?this.videoParser=new ob:"hevc"===e&&(this.videoParser=new lb))}decrypt(e,t){return new Promise(r=>{const{audioTrack:i,videoTrack:n}=e;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{r(e)}):r(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{r(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let r=0;const i=this.aacOverFlow;let n,s,a,o=t.data;if(i){this.aacOverFlow=null;const t=i.missing,n=i.sample.unit.byteLength;if(-1===t)o=Vp(i.sample.unit,o);else{const s=n-t;i.sample.unit.set(o.subarray(0,t),s),e.samples.push(i.sample),r=i.missing}}for(n=r,s=o.length;n<s-1&&!Ay(o,n);n++);if(n!==r){let e;const t=n<s-1;if(e=t?`AAC PES did not start with ADTS header,offset:${n}`:"No ADTS header found in AAC PES",pb(this.observer,new Error(e),t,this.logger),!t)return}if(Ly(e,this.observer,o,n,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!i)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");{const t=Iy(e.samplerate);a=i.sample.pts+t}}let l,d=0;for(;n<s;){if(l=Ry(e,o,n,a,d),n+=l.length,l.missing){this.aacOverFlow=l;break}for(d++;n<s-1&&!Ay(o,n);n++);}}parseMPEGPES(e,t){const r=t.data,i=r.length;let n=0,s=0;const a=t.pts;if(void 0!==a)for(;s<i;)if(Qy(r,s)){const t=Ky(e,r,s,a,n);if(!t)break;s+=t.length,n++}else s++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(e,t){{const r=t.data,i=t.pts;if(void 0===i)return void this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");const n=r.length;let s,a=0,o=0;for(;o<n&&(s=tb(e,r,o,i,a++))>0;)o+=s}}parseID3PES(e,t){if(void 0===t.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");const r=Kf({},t,{type:this._videoTrack?By.emsg:By.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}}function ub(e,t){return((31&e[t+1])<<8)+e[t+2]}function hb(e,t){return(31&e[t+10])<<8|e[t+11]}function fb(e,t,r,i,n,s){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<o;){const o=ub(e,t),l=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!i){mb("ADTS AAC",s);break}case 15:-1===a.audioPid&&(a.audioPid=o);break;case 21:-1===a.id3Pid&&(a.id3Pid=o);break;case 219:if(!i){mb("H.264",s);break}case 27:-1===a.videoPid&&(a.videoPid=o);break;case 3:case 4:r.mpeg||r.mp3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="mp3"):s.log("MPEG audio found, not supported in this browser");break;case 193:if(!i){mb("AC-3",s);break}case 129:r.ac3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===a.audioPid&&l>0){let i=t+5,n=l;for(;n>2;){if(106===e[i])!0!==r.ac3?s.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=o,a.segmentAudioCodec="ac3");const t=e[i+1]+2;i+=t,n-=t}}break;case 194:case 135:return pb(n,new Error("Unsupported EC-3 in M2TS found"),void 0,s),a;case 36:-1===a.videoPid&&(a.videoPid=o,a.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"))}t+=l+5}return a}function pb(e,t,r,i){i.warn(`parsing error: ${t.message}`),e.emit(Ff.ERROR,Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:t,reason:t.message})}function mb(e,t){t.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function gb(e,t){let r,i,n,s,a,o=0;const l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=Vp(l[0],l[1]),l.splice(1,1);r=l[0];if(1===(r[0]<<16)+(r[1]<<8)+r[2]){if(i=(r[4]<<8)+r[5],i&&i>e.size-6)return null;const d=r[7];192&d&&(s=536870912*(14&r[9])+4194304*(255&r[10])+16384*(254&r[11])+128*(255&r[12])+(254&r[13])/2,64&d?(a=536870912*(14&r[14])+4194304*(255&r[15])+16384*(254&r[16])+128*(255&r[17])+(254&r[18])/2,s-a>54e5&&(t.warn(`${Math.round((s-a)/9e4)}s delta between PTS and DTS, align them`),s=a)):a=s),n=r[8];let c=n+9;if(e.size<=c)return null;e.size-=c;const u=new Uint8Array(e.size);for(let e=0,t=l.length;e<t;e++){r=l[e];let t=r.byteLength;if(c){if(c>t){c-=t;continue}r=r.subarray(c),t-=c,c=0}u.set(r,o),o+=t}return i&&(i-=n+3),{data:u,pts:s,dts:a,len:i}}return null}class vb{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const yb=Math.pow(2,32)-1;class bb{static init(){let e;for(e in bb.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},bb.types)bb.types.hasOwnProperty(e)&&(bb.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);bb.HDLR_TYPES={video:t,audio:r};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);bb.STTS=bb.STSC=bb.STCO=n,bb.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),bb.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),bb.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),bb.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);bb.FTYP=bb.box(bb.types.ftyp,s,o,s,a),bb.DINF=bb.box(bb.types.dinf,bb.box(bb.types.dref,i))}static box(e,...t){let r=8,i=t.length;const n=i;for(;i--;)r+=t[i].byteLength;const s=new Uint8Array(r);for(s[0]=r>>24&255,s[1]=r>>16&255,s[2]=r>>8&255,s[3]=255&r,s.set(e,4),i=0,r=8;i<n;i++)s.set(t[i],r),r+=t[i].byteLength;return s}static hdlr(e){return bb.box(bb.types.hdlr,bb.HDLR_TYPES[e])}static mdat(e){return bb.box(bb.types.mdat,e)}static mdhd(e,t){t*=e;const r=Math.floor(t/(yb+1)),i=Math.floor(t%(yb+1));return bb.box(bb.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))}static mdia(e){return bb.box(bb.types.mdia,bb.mdhd(e.timescale||0,e.duration||0),bb.hdlr(e.type),bb.minf(e))}static mfhd(e){return bb.box(bb.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?bb.box(bb.types.minf,bb.box(bb.types.smhd,bb.SMHD),bb.DINF,bb.stbl(e)):bb.box(bb.types.minf,bb.box(bb.types.vmhd,bb.VMHD),bb.DINF,bb.stbl(e))}static moof(e,t,r){return bb.box(bb.types.moof,bb.mfhd(e),bb.traf(r,t))}static moov(e){let t=e.length;const r=[];for(;t--;)r[t]=bb.trak(e[t]);return bb.box.apply(null,[bb.types.moov,bb.mvhd(e[0].timescale||0,e[0].duration||0)].concat(r).concat(bb.mvex(e)))}static mvex(e){let t=e.length;const r=[];for(;t--;)r[t]=bb.trex(e[t]);return bb.box.apply(null,[bb.types.mvex,...r])}static mvhd(e,t){t*=e;const r=Math.floor(t/(yb+1)),i=Math.floor(t%(yb+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return bb.box(bb.types.mvhd,n)}static sdtp(e){const t=e.samples||[],r=new Uint8Array(4+t.length);let i,n;for(i=0;i<t.length;i++)n=t[i].flags,r[i+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return bb.box(bb.types.sdtp,r)}static stbl(e){return bb.box(bb.types.stbl,bb.stsd(e),bb.box(bb.types.stts,bb.STTS),bb.box(bb.types.stsc,bb.STSC),bb.box(bb.types.stsz,bb.STSZ),bb.box(bb.types.stco,bb.STCO))}static avc1(e){let t,r,i,n=[],s=[];for(t=0;t<e.sps.length;t++)r=e.sps[t],i=r.byteLength,n.push(i>>>8&255),n.push(255&i),n=n.concat(Array.prototype.slice.call(r));for(t=0;t<e.pps.length;t++)r=e.pps[t],i=r.byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(r));const a=bb.box(bb.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(s))),o=e.width,l=e.height,d=e.pixelRatio[0],c=e.pixelRatio[1];return bb.box(bb.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,bb.box(bb.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),bb.box(bb.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,c>>24,c>>16&255,c>>8&255,255&c])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return bb.box(bb.types.mp4a,bb.audioStsd(e),bb.box(bb.types.esds,bb.esds(e)))}static mp3(e){return bb.box(bb.types[".mp3"],bb.audioStsd(e))}static ac3(e){return bb.box(bb.types["ac-3"],bb.audioStsd(e),bb.box(bb.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if("audio"===e.type){if("aac"===t)return bb.box(bb.types.stsd,bb.STSD,bb.mp4a(e));if("ac3"===t&&e.config)return bb.box(bb.types.stsd,bb.STSD,bb.ac3(e));if("mp3"===t&&"mp3"===e.codec)return bb.box(bb.types.stsd,bb.STSD,bb.mp3(e))}else{if(!e.pps||!e.sps)throw new Error("video track missing pps or sps");if("avc"===t)return bb.box(bb.types.stsd,bb.STSD,bb.avc1(e));if("hevc"===t&&e.vps)return bb.box(bb.types.stsd,bb.STSD,bb.hvc1(e))}throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,r=(e.duration||0)*(e.timescale||0),i=e.width||0,n=e.height||0,s=Math.floor(r/(yb+1)),a=Math.floor(r%(yb+1));return bb.box(bb.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,n>>8&255,255&n,0,0]))}static traf(e,t){const r=bb.sdtp(e),i=e.id,n=Math.floor(t/(yb+1)),s=Math.floor(t%(yb+1));return bb.box(bb.types.traf,bb.box(bb.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),bb.box(bb.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,s>>24,s>>16&255,s>>8&255,255&s])),bb.trun(e,r.length+16+20+8+16+8+8),r)}static trak(e){return e.duration=e.duration||4294967295,bb.box(bb.types.trak,bb.tkhd(e),bb.mdia(e))}static trex(e){const t=e.id;return bb.box(bb.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const r=e.samples||[],i=r.length,n=12+16*i,s=new Uint8Array(n);let a,o,l,d,c,u;for(t+=8+n,s.set(["video"===e.type?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),a=0;a<i;a++)o=r[a],l=o.duration,d=o.size,c=o.flags,u=o.cts,s.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,61440&c.degradPrio,15&c.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*a);return bb.box(bb.types.trun,s)}static initSegment(e){bb.types||bb.init();const t=bb.moov(e);return Vp(bb.FTYP,t)}static hvc1(e){const t=e.params,r=[e.vps,e.sps,e.pps],i=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),3|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),r.length]);let n=i.length;for(let e=0;e<r.length;e+=1){n+=3;for(let t=0;t<r[e].length;t+=1)n+=2+r[e][t].length}const s=new Uint8Array(n);s.set(i,0),n=i.length;const a=r.length-1;for(let e=0;e<r.length;e+=1){s.set(new Uint8Array([32+e|(e===a?128:0),0,r[e].length]),n),n+=3;for(let t=0;t<r[e].length;t+=1)s.set(new Uint8Array([r[e][t].length>>8,255&r[e][t].length]),n),n+=2,s.set(r[e][t],n),n+=r[e][t].length}const o=bb.box(bb.types.hvcC,s),l=e.width,d=e.height,c=e.pixelRatio[0],u=e.pixelRatio[1];return bb.box(bb.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,d>>8&255,255&d,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,bb.box(bb.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),bb.box(bb.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,u>>24,u>>16&255,u>>8&255,255&u])))}}bb.types=void 0,bb.HDLR_TYPES=void 0,bb.STTS=void 0,bb.STSC=void 0,bb.STCO=void 0,bb.STSZ=void 0,bb.VMHD=void 0,bb.SMHD=void 0,bb.STSD=void 0,bb.FTYP=void 0,bb.DINF=void 0;function Eb(e,t,r=1,i=!1){const n=e*t*r;return i?Math.round(n):n}function wb(e,t=!1){return Eb(e,1e3,1/9e4,t)}function Sb(e){const{baseTime:t,timescale:r,trackId:i}=e;return`${t/r} (${t}/${r}) trackId: ${i}`}let Tb,xb=null,Ab=null;function kb(e,t,r,i){return{duration:t,size:r,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class Lb extends Qf{constructor(e,t,r,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1,null===xb){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);xb=e?parseInt(e[1]):0}if(null===Ab){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Ab=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;t&&e&&e.trackId===t.trackId&&e.baseTime===t.baseTime&&e.timescale===t.timescale||this.log(`Reset initPTS: ${t?Sb(t):t} > ${e?Sb(e):e}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const r=e[0].pts,i=e.reduce((e,i)=>{let n=i.pts,s=n-e;return s<-4294967296&&(t=!0,n=Ib(n,r),s=n-e),s>0?e:n},r);return t&&this.debug("PTS rollover detected"),i}remux(e,t,r,i,n,s,a,o){let l,d,c,u,h,f,p=n,m=n;const g=e.pid>-1,v=t.pid>-1,y=t.samples.length,b=e.samples.length>0,E=a&&y>0||y>1;if((!g||b)&&(!v||E)||this.ISGenerated||a){if(this.ISGenerated){var w,S,T,x;const e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||(null==(w=t.pixelRatio)?void 0:w[0])!==(null==(S=e.pixelRatio)?void 0:S[0])||(null==(T=t.pixelRatio)?void 0:T[1])!==(null==(x=e.pixelRatio)?void 0:x[1]))||!e&&E||null===this.nextAudioTs&&b)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,n,s));const r=this.isVideoContiguous;let i,a=-1;if(E&&(a=function(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!r&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,a>0){this.warn(`Dropped ${a} out of ${y} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(a),t.dropped+=a,m+=(t.samples[0].pts-e)/t.inputTimeScale,i=m}else-1===a&&(this.warn(`No keyframe found out of ${y} video samples`),f=!1);if(this.ISGenerated){if(b&&E){const r=this.getVideoStartPts(t.samples),i=(Ib(e.samples[0].pts,r)-r)/t.inputTimeScale;p+=Math.max(0,i),m+=Math.max(0,-i)}if(b){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,s)),d=this.remuxAudio(e,p,this.isAudioContiguous,s,v||E||o===jf?m:void 0),E){const i=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,s)),l=this.remuxVideo(t,m,r,i)}}else E&&(l=this.remuxVideo(t,m,r,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=i)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(h=Rb(r,n,this._initPTS,this._initDTS)),i.samples.length&&(u=Pb(i,n,this._initPTS))),{audio:d,video:l,initSegment:c,independent:f,text:u,id3:h}}computeInitPts(e,t,r,i){const n=Math.round(r*t);let s=Ib(e,n);if(s<n+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(n-s)/t} ${i}`);s<n+t;)s+=8589934592;return s-n}generateIS(e,t,r,i){const n=e.samples,s=t.samples,a=this.typeSupported,o={},l=this._initPTS;let d,c,u,h=!l||i,f="audio/mp4",p=-1;if(h&&(d=c=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}o.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&a.mpeg?new Uint8Array(0):bb.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(p=e.id,u=e.inputTimeScale,l&&u===l.timescale?h=!1:d=c=this.computeInitPts(n[0].pts,u,r,"audio"))}if(t.sps&&t.pps&&s.length){if(t.timescale=t.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:bb.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(p=t.id,u=t.inputTimeScale,l&&u===l.timescale)h=!1;else{const e=this.getVideoStartPts(s),t=Ib(s[0].dts,e),i=this.computeInitPts(t,u,r,"video"),n=this.computeInitPts(e,u,r,"video");c=Math.min(c,i),d=Math.min(d,n)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(o).length)return this.ISGenerated=!0,h?(l&&this.warn(`Timestamps at playlist time: ${i?"":"~"}${r} ${d/u} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${r} offset: ${d/u} (${d}/${u}) trackId: ${p}`),this._initPTS={baseTime:d,timescale:u,trackId:p},this._initDTS={baseTime:c,timescale:u,trackId:p}):d=u=void 0,{tracks:o,initPTS:d,timescale:u,trackId:p}}remuxVideo(e,t,r,i){const n=e.inputTimeScale,s=e.samples,a=[],o=s.length,l=this._initPTS,d=l.baseTime*n/l.timescale;let c,u,h=this.nextVideoTs,f=8,p=this.videoSampleDuration,m=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,v=!1;if(!r||null===h){const e=d+t*n,i=s[0].pts-Ib(s[0].dts,s[0].pts);xb&&null!==h&&Math.abs(e-i-(h+d))<15e3?r=!0:h=e-i-d}const y=h+d;for(let e=0;e<o;e++){const t=s[e];t.pts=Ib(t.pts,y),t.dts=Ib(t.dts,y),t.dts<s[e>0?e-1:e].dts&&(v=!0)}v&&s.sort(function(e,t){const r=e.dts-t.dts,i=e.pts-t.pts;return r||i}),c=s[0].dts,u=s[s.length-1].dts;const b=u-c,E=b?Math.round(b/(o-1)):p||e.inputTimeScale/30;if(r){const r=c-y,i=r>E,n=r<-1;if((i||n)&&(i?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${wb(r,!0)} ms (${r}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${wb(-r,!0)} ms (${r}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!n||y>=s[0].pts||xb)){c=y;const e=s[0].pts-r;if(i)s[0].dts=c,s[0].pts=e;else{let t=!0;for(let i=0;i<s.length&&!(s[i].dts>e&&t);i++){const e=s[i].pts;if(s[i].dts-=r,s[i].pts-=r,i<s.length-1){const r=s[i+1].pts;t=r<=s[i].pts==r<=e}}}this.log(`Video: Initial PTS/DTS adjusted: ${wb(e,!0)}/${wb(c,!0)}, delta: ${wb(r,!0)} ms`)}}c=Math.max(0,c);let w=0,S=0,T=c;for(let e=0;e<o;e++){const t=s[e],r=t.units,i=r.length;let n=0;for(let e=0;e<i;e++)n+=r[e].data.length;S+=n,w+=i,t.length=n,t.dts<T?(t.dts=T,T+=E/4|0||1):T=t.dts,m=Math.min(t.pts,m),g=Math.max(t.pts,g)}u=s[o-1].dts;const x=S+4*w+8;let A;try{A=new Uint8Array(x)}catch(e){return void this.observer.emit(Ff.ERROR,Ff.ERROR,{type:Mf.MUX_ERROR,details:Nf.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:x,reason:`fail allocating video mdat ${x}`})}const k=new DataView(A.buffer);k.setUint32(0,x),A.set(bb.types.mdat,4);let L=!1,I=Number.POSITIVE_INFINITY,R=Number.POSITIVE_INFINITY,P=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let e=0;e<o;e++){const t=s[e],r=t.units;let l,c=0;for(let e=0,t=r.length;e<t;e++){const t=r[e],i=t.data,n=t.data.byteLength;k.setUint32(f,n),f+=4,A.set(i,f),f+=n,c+=4+n}if(e<o-1)p=s[e+1].dts-t.dts,l=s[e+1].pts-t.pts;else{const r=this.config,a=e>0?t.dts-s[e-1].dts:E;if(l=e>0?t.pts-s[e-1].pts:E,r.stretchShortVideoTrack&&null!==this.nextAudioTs){const e=Math.floor(r.maxBufferHole*n),s=(i?m+i*n:this.nextAudioTs+d)-t.pts;s>e?(p=s-a,p<0?p=a:L=!0,this.log(`It is approximately ${s/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=a}else p=a}const u=Math.round(t.pts-t.dts);I=Math.min(I,p),P=Math.max(P,p),R=Math.min(R,l),D=Math.max(D,l),a.push(kb(t.key,p,c,u))}if(a.length)if(xb){if(xb<70){const e=a[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Ab&&D-R<P-I&&E/P<.025&&0===a[0].cts){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let e=c;for(let t=0,r=a.length;t<r;t++){const i=e+a[t].duration,n=e+a[t].cts;if(t<r-1){const e=i+a[t+1].cts;a[t].duration=e-n}else a[t].duration=t?a[t-1].duration:E;a[t].cts=0,e=i}}p=L||!p?E:p;const C=u+p;this.nextVideoTs=h=C-d,this.videoSampleDuration=p,this.isVideoContiguous=!0;const _={data1:bb.moof(e.sequenceNumber++,c,Kf(e,{samples:a})),data2:A,startPTS:(m-d)/n,endPTS:(g+p-d)/n,startDTS:(c-d)/n,endDTS:h/n,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,_}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(e,t,r,i,n){const s=e.inputTimeScale,a=s/(e.samplerate?e.samplerate:s),o=this.getSamplesPerFrame(e),l=o*a,d=this._initPTS,c="mp3"===e.segmentCodec&&this.typeSupported.mpeg,u=[],h=void 0!==n;let f=e.samples,p=c?0:8,m=this.nextAudioTs||-1;const g=d.baseTime*s/d.timescale,v=g+t*s;if(this.isAudioContiguous=r=r||f.length&&m>0&&(i&&Math.abs(v-(m+g))<9e3||Math.abs(Ib(f[0].pts,v)-(m+g))<20*l),f.forEach(function(e){e.pts=Ib(e.pts,v)}),!r||m<0){const e=f.length;if(f=f.filter(e=>e.pts>=0),e!==f.length&&this.warn(`Removed ${f.length-e} of ${e} samples (initPTS ${g} / ${s})`),!f.length)return;m=0===n?0:i&&!h?Math.max(0,v-g):f[0].pts-g}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let r=0,i=m+g;r<f.length;r++){const n=f[r],a=n.pts,o=a-i,d=Math.abs(1e3*o/s);if(o<=-t*l&&h)0===r&&(this.warn(`Audio frame @ ${(a/s).toFixed(3)}s overlaps marker by ${Math.round(1e3*o/s)} ms.`),this.nextAudioTs=m=a-g,i=a);else if(o>=t*l&&d<1e4&&h){let t=Math.round(o/l);for(i=a-t*l;i<0&&t&&l;)t--,i+=l;0===r&&(this.nextAudioTs=m=i-g),this.warn(`Injecting ${t} audio frames @ ${((i-g)/s).toFixed(3)}s due to ${Math.round(1e3*o/s)} ms gap.`);for(let s=0;s<t;s++){let t=vb.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);t||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),t=n.unit.subarray()),f.splice(r,0,{unit:t,pts:i}),i+=l,r++}}n.pts=i,i+=l}}let y,b=null,E=null,w=0,S=f.length;for(;S--;)w+=f[S].unit.byteLength;for(let t=0,i=f.length;t<i;t++){const i=f[t],n=i.unit;let s=i.pts;if(null!==E){u[t-1].duration=Math.round((s-E)/a)}else{if(r&&"aac"===e.segmentCodec&&(s=m+g),b=s,!(w>0))return;w+=p;try{y=new Uint8Array(w)}catch(e){return void this.observer.emit(Ff.ERROR,Ff.ERROR,{type:Mf.MUX_ERROR,details:Nf.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:w,reason:`fail allocating audio mdat ${w}`})}if(!c){new DataView(y.buffer).setUint32(0,w),y.set(bb.types.mdat,4)}}y.set(n,p);const l=n.byteLength;p+=l,u.push(kb(!0,o,l,0)),E=s}const T=u.length;if(!T)return;const x=u[u.length-1];m=E-g,this.nextAudioTs=m+a*x.duration;const A=c?new Uint8Array(0):bb.moof(e.sequenceNumber++,b/a,Kf({},e,{samples:u}));e.samples=[];const k=(b-g)/s,L=this.nextAudioTs/s,I={data1:A,data2:y,startPTS:k,endPTS:L,startDTS:k,endDTS:L,type:"audio",hasAudio:!0,hasVideo:!1,nb:T};return this.isAudioContiguous=!0,I}}function Ib(e,t){let r;if(null===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}function Rb(e,t,r,i){const n=e.samples.length;if(!n)return;const s=e.inputTimeScale;for(let a=0;a<n;a++){const n=e.samples[a];n.pts=Ib(n.pts-r.baseTime*s/r.timescale,t*s)/s,n.dts=Ib(n.dts-i.baseTime*s/i.timescale,t*s)/s}const a=e.samples;return e.samples=[],{samples:a}}function Pb(e,t,r){const i=e.samples.length;if(!i)return;const n=e.inputTimeScale;for(let s=0;s<i;s++){const i=e.samples[s];i.pts=Ib(i.pts-r.baseTime*n/r.timescale,t*n)/n}e.samples.sort((e,t)=>e.pts-t.pts);const s=e.samples;return e.samples=[],{samples:s}}function Db(e,t,r=!1){return void 0!==(null==e?void 0:e.start)?(e.start+(r?e.duration:0))/e.timescale:t}function Cb(e,t,r){const i=e.codec;if(i&&i.length>4)return i;if(t===bp){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return dm(i,!1)}return r.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"}return r.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1"}try{Tb=self.performance.now.bind(self.performance)}catch(e){Tb=Date.now}const _b=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,r,i){const n=this.videoTrack=Uy("video",1),s=this.audioTrack=Uy("audio",1),a=this.txtTrack=Uy("text",1);if(this.id3Track=Uy("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const o=Fp(e);if(o.video){const{id:e,timescale:t,codec:r,supplemental:i}=o.video;n.id=e,n.timescale=a.timescale=t,n.codec=r,n.supplemental=i}if(o.audio){const{id:e,timescale:t,codec:r}=o.audio;s.id=e,s.timescale=t,s.codec=r}a.id=Rp.text,n.sampleDuration=0,n.duration=s.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let r=0;r<t;){const i=Cp(e,r);if(i>8&&109===e[r+4]&&111===e[r+5]&&111===e[r+6]&&102===e[r+7])return!0;r=i>1?r+i:t}return!1}(e)}demux(e,t){this.timeOffset=t;let r=e;const i=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Vp(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},r=Mp(e,["moof"]);if(r.length<2)return t.remainder=e,t;const i=r[r.length-1];return t.valid=e.slice(0,i.byteOffset-8),t.remainder=e.slice(i.byteOffset-8),t}(r);this.remainderData=t.remainder,i.samples=t.valid||new Uint8Array}else i.samples=r;const s=this.extractID3Track(i,t);return n.samples=Wp(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,r=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return r.samples=Wp(e,t),{videoTrack:t,audioTrack:Uy(),id3Track:i,textTrack:Uy()}}extractID3Track(e,t){const r=this.id3Track;if(e.samples.length){const i=Mp(e.samples,["emsg"]);i&&i.forEach(e=>{const i=function(e){const t=e[0];let r="",i="",n=0,s=0,a=0,o=0,l=0,d=0;if(0===t){for(;"\0"!==Pp(e.subarray(d,d+1));)r+=Pp(e.subarray(d,d+1)),d+=1;for(r+=Pp(e.subarray(d,d+1)),d+=1;"\0"!==Pp(e.subarray(d,d+1));)i+=Pp(e.subarray(d,d+1)),d+=1;i+=Pp(e.subarray(d,d+1)),d+=1,n=Cp(e,12),s=Cp(e,16),o=Cp(e,20),l=Cp(e,24),d=28}else if(1===t){d+=4,n=Cp(e,d),d+=4;const t=Cp(e,d);d+=4;const s=Cp(e,d);for(d+=4,a=2**32*t+s,_f(a)||(a=Number.MAX_SAFE_INTEGER,ip.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Cp(e,d),d+=4,l=Cp(e,d),d+=4;"\0"!==Pp(e.subarray(d,d+1));)r+=Pp(e.subarray(d,d+1)),d+=1;for(r+=Pp(e.subarray(d,d+1)),d+=1;"\0"!==Pp(e.subarray(d,d+1));)i+=Pp(e.subarray(d,d+1)),d+=1;i+=Pp(e.subarray(d,d+1)),d+=1}return{schemeIdUri:r,value:i,timeScale:n,presentationTime:a,presentationTimeDelta:s,eventDuration:o,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(rb.test(i.schemeIdUri)){const e=ib(i,t);let n=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;n<=.001&&(n=Number.POSITIVE_INFINITY);const s=i.payload;r.samples.push({data:s,len:s.byteLength,dts:e,pts:e,type:By.emsg,duration:n})}else if(this.config.enableEmsgKLVMetadata&&i.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const e=ib(i,t);r.samples.push({data:i.payload,len:i.payload.byteLength,dts:e,pts:e,type:By.misbklv,duration:Number.POSITIVE_INFINITY})}})}return r}demuxSampleAes(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}},remux:class extends Qf{constructor(e,t,r,i){super("passthrough-remuxer",i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,r,i){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(e,i),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:r,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const{audio:n,video:s}=this.initData=Fp(e);if(t)!function(e,t){if(!e||!t)return;const r=t.keyId;r&&t.isCommonEncryption&&jp(e,(e,t)=>{const i=e.subarray(8,24);i.some(e=>0!==e)||(ip.log(`[eme] Patching keyId in 'enc${t?"a":"v"}>sinf>>tenc' box: ${op(i)} -> ${op(r)}`),e.set(r,8))})}(e,t);else{const e=n||s;null!=e&&e.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${e.codec}")!`)}n&&(r=Cb(n,bp,this)),s&&(i=Cb(s,Ep,this));const a={};n&&s?a.audiovideo={container:"video/mp4",codec:r+","+i,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:n?a.audio={container:"audio/mp4",codec:r,encrypted:n.encrypted,initSegment:e,id:"audio"}:s?a.video={container:"video/mp4",codec:i,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=a}remux(e,t,r,i,n,s){var a,o;let{initPTS:l,lastEndTime:d}=this;const c={audio:void 0,video:void 0,text:i,id3:r,initSegment:void 0};Cf(d)||(d=this.lastEndTime=n||0);const u=t.samples;if(!u.length)return c;const h={initPTS:void 0,timescale:void 0,trackId:void 0};let f=this.initData;if(null!=(a=f)&&a.length||(this.generateInitSegment(u),f=this.initData),null==(o=f)||!o.length)return this.warn("Failed to generate initSegment."),c;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1);const p=function(e,t,r){const i={},n=Mp(e,["moof","traf"]);for(let e=0;e<n.length;e++){const s=n[e],a=Mp(s,["tfhd"])[0],o=Cp(a,4),l=t[o];if(!l)continue;i[o]||(i[o]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});const d=i[o],c=Mp(s,["tfdt"])[0];if(c){const e=c[0];let t=Cp(c,4);1===e&&(t===Lp?r.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(t*=Lp+1,t+=Cp(c,8))),Cf(t)&&(!Cf(d.start)||t<d.start)&&(d.start=t)}const u=l.default,h=Cp(a,0)|(null==u?void 0:u.flags);let f=(null==u?void 0:u.duration)||0;8&h&&(f=Cp(a,2&h?12:8));const p=Mp(s,["trun"]);let m=d.start||0,g=0,v=f;for(let e=0;e<p.length;e++){const t=p[e],r=Cp(t,4),i=d.sampleCount;d.sampleCount+=r;const n=1&t[3],s=4&t[3],a=1&t[2],o=2&t[2],l=4&t[2],c=8&t[2];let u=8,h=r;for(n&&(u+=4),s&&r&&(1&t[u+1]||void 0!==d.keyFrameIndex||(d.keyFrameIndex=i),u+=4,a?(v=Cp(t,u),u+=4):v=f,o&&(u+=4),c&&(u+=4),m+=v,g+=v,h--);h--;)a?(v=Cp(t,u),u+=4):v=f,o&&(u+=4),l&&(1&t[u+1]||void 0===d.keyFrameIndex&&(d.keyFrameIndex=d.sampleCount-(h+1),d.keyFrameStart=m),u+=4),c&&(u+=4),m+=v,g+=v;!g&&f&&(g+=f*r)}d.duration+=g}if(!Object.keys(i).some(e=>i[e].duration)){let t=1/0,r=0;const n=Mp(e,["sidx"]);for(let e=0;e<n.length;e++){const i=Np(n[e]);if(null!=i&&i.references){t=Math.min(t,i.earliestPresentationTime/i.timescale);const e=i.references.reduce((e,t)=>e+t.info.duration||0,0);r=Math.max(r,e+i.earliestPresentationTime/i.timescale)}}r&&Cf(r)&&Object.keys(i).forEach(e=>{i[e].duration||(i[e].duration=r*i[e].timescale-i[e].start)})}return i}(u,f,this),m=f.audio?p[f.audio.id]:null,g=f.video?p[f.video.id]:null,v=Db(g,1/0),y=Db(m,1/0),b=Db(g,0,!0),E=Db(m,0,!0);let w=n,S=0;const T=m&&(!g||!l&&y<v||l&&l.trackId===f.audio.id),x=T?m:g;if(x){const e=x.timescale,t=x.start-n*e,r=T?f.audio.id:f.video.id;w=x.start/e,S=T?E-y:b-v,!s&&l||!function(e,t,r,i){if(null===e)return!0;const n=Math.max(i,1),s=t-e.baseTime/e.timescale;return Math.abs(s-r)>n}(l,w,n,S)&&e===l.timescale||(l&&this.warn(`Timestamps at playlist time: ${s?"":"~"}${n} ${t/e} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${w-n} (${t}/${e}) trackId: ${r}`),l=null,h.initPTS=t,h.timescale=e,h.trackId=r)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${n}`);l?(h.initPTS=l.baseTime,h.timescale=l.timescale,h.trackId=l.trackId):(h.timescale&&void 0!==h.trackId&&void 0!==h.initPTS||(this.warn("Could not set initPTS"),h.initPTS=w,h.timescale=1,h.trackId=-1),this.initPTS=l={baseTime:h.initPTS,timescale:h.timescale,trackId:h.trackId});const A=w-l.baseTime/l.timescale,k=A+S;S>0?this.lastEndTime=k:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const L=!!f.audio,I=!!f.video;let R="";L&&(R+="audio"),I&&(R+="video");const P={data1:u,startPTS:A,startDTS:A,endPTS:k,endDTS:k,type:R,hasAudio:L,hasVideo:I,nb:1,dropped:0,encrypted:!!f.audio&&f.audio.encrypted||!!f.video&&f.video.encrypted};c.audio=L&&!I?P:void 0,c.video=I?P:void 0;const D=null==g?void 0:g.sampleCount;if(D){const e=g.keyFrameIndex,t=-1!==e;P.nb=D,P.dropped=0===e||this.isVideoContiguous?0:t?e:D,P.independent=t,P.firstKeyFrame=e,t&&g.keyFrameStart&&(P.firstKeyFramePTS=(g.keyFrameStart-l.baseTime)/l.timescale),this.isVideoContiguous||(c.independent=t),this.isVideoContiguous||(this.isVideoContiguous=t),P.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${e}/${D} dropped: ${P.dropped} start: ${P.firstKeyFramePTS||"NA"}`)}return c.initSegment=h,c.id3=Rb(r,n,l,l),i.samples.length&&(c.text=Pb(i,n,l)),c}}},{demux:cb,remux:Lb},{demux:class extends zy{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,r,i){super.resetInitSegment(e,t,r,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const r=wy(e,0);let i=(null==r?void 0:r.length)||0;if(Zy(e,i))return!1;for(let r=e.length;i<r;i++)if(ky(e,i))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return function(e,t){return t+5<e.length}(e,t)&&Sy(e,t)&&xy(e,t)<=e.length-t}(e,t)}appendFrame(e,t,r){Ly(e,this.observer,t,r,e.manifestCodec);const i=Ry(e,t,r,this.basePTS,this.frameIndex);if(i&&0===i.missing)return i}},remux:Lb},{demux:class extends zy{resetInitSegment(e,t,r,i){super.resetInitSegment(e,t,r,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=wy(e,0);let r=(null==t?void 0:t.length)||0;if(t&&11===e[r]&&119===e[r+1]&&void 0!==$y(t)&&Jy(e,r)<=16)return!1;for(let t=e.length;r<t;r++)if(Zy(e,r))return ip.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return Xy(e,t)&&4<=e.length-t}(e,t)}appendFrame(e,t,r){if(null!==this.basePTS)return Ky(e,t,r,this.basePTS,this.frameIndex)}},remux:Lb}];_b.splice(2,0,{demux:eb,remux:Lb});class Ob{constructor(e,t,r,i,n,s){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=r,this.id=n,this.logger=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,r,i){const n=r.transmuxing;n.executeStart=Tb();let s=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:o}=this;i&&(this.currentTransmuxState=i);const{contiguous:l,discontinuity:d,trackSwitch:c,accurateTimeOffset:u,timeOffset:h,initSegmentChange:f}=i||a,{audioCodec:p,videoCodec:m,defaultInitPts:g,duration:v,initSegmentData:y}=o,b=function(e,t){let r=null;e.byteLength>0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(r=t);return r}(s,t);if(b&&Wg(b.method)){const e=this.getDecrypter(),t=Yg(b.method);if(!e.isSync())return this.asyncResult=!0,this.decryptionPromise=e.webCryptoDecrypt(s,b.key.buffer,b.iv.buffer,t).then(e=>{const t=this.push(e,null,r);return this.decryptionPromise=null,t}),this.decryptionPromise;{let i=e.softwareDecrypt(s,b.key.buffer,b.iv.buffer,t);if(r.part>-1){const t=e.flush();i=t?t.buffer:t}if(!i)return n.executeEnd=Tb(),Mb(r);s=new Uint8Array(i)}}const E=this.needsProbing(d,c);if(E){const e=this.configureTransmuxer(s);if(e)return this.logger.warn(`[transmuxer] ${e.message}`),this.observer.emit(Ff.ERROR,Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),n.executeEnd=Tb(),Mb(r)}(d||c||f||E)&&this.resetInitSegment(y,p,m,v,t),(d||f||E)&&this.resetInitialTimestamp(g),l||this.resetContiguity();const w=this.transmux(s,b,h,u,r);this.asyncResult=Nb(w);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,n.executeEnd=Tb(),w}flush(e){const t=e.transmuxing;t.executeStart=Tb();const{decrypter:r,currentTransmuxState:i,decryptionPromise:n}=this;if(n)return this.asyncResult=!0,n.then(()=>this.flush(e));const s=[],{timeOffset:a}=i;if(r){const t=r.flush();t&&s.push(this.push(t.buffer,null,e))}const{demuxer:o,remuxer:l}=this;if(!o||!l){t.executeEnd=Tb();const r=[Mb(e)];return this.asyncResult?Promise.resolve(r):r}const d=o.flush(a);return Nb(d)?(this.asyncResult=!0,d.then(t=>(this.flushRemux(s,t,e),s))):(this.flushRemux(s,d,e),this.asyncResult?Promise.resolve(s):s)}flushRemux(e,t,r){const{audioTrack:i,videoTrack:n,id3Track:s,textTrack:a}=t,{accurateTimeOffset:o,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${r.sn}${r.part>-1?" part: "+r.part:""} of ${this.id===Gf?"level":"track"} ${r.level}`);const d=this.remuxer.remux(i,n,s,a,l,o,!0,this.id);e.push({remuxResult:d,chunkMeta:r}),r.transmuxing.executeEnd=Tb()}resetInitialTimestamp(e){const{demuxer:t,remuxer:r}=this;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,r,i,n){const{demuxer:s,remuxer:a}=this;s&&a&&(s.resetInitSegment(e,t,r,i),a.resetInitSegment(e,t,r,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,r,i,n){let s;return s=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,i,n):this.transmuxUnencrypted(e,r,i,n),s}transmuxUnencrypted(e,t,r,i){const{audioTrack:n,videoTrack:s,id3Track:a,textTrack:o}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,s,a,o,t,r,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,r,i,n){return this.demuxer.demuxSampleAes(e,t,r).then(e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,r,i,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:r,typeSupported:i}=this;let n;for(let t=0,r=_b.length;t<r;t++){var s;if(null!=(s=_b[t].demux)&&s.probe(e,this.logger)){n=_b[t];break}}if(!n)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,o=this.remuxer,l=n.remux,d=n.demux;o&&o instanceof l||(this.remuxer=new l(r,t,i,this.logger)),a&&a instanceof d||(this.demuxer=new d(r,t,i,this.logger),this.probe=d.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Sg(this.config)),e}}const Mb=e=>({remuxResult:{},chunkMeta:e});function Nb(e){return"then"in e&&e.then instanceof Function}class Fb{constructor(e,t,r,i,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=r,this.duration=i,this.defaultInitPts=n||null}}class $b{constructor(e,t,r,i,n,s){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=r,this.trackSwitch=i,this.timeOffset=n,this.initSegmentChange=s}}let Bb=0;class Ub{constructor(e,t,r,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Bb++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=e=>{const t=e.data,r=this.hls;if(r&&null!=t&&t.event&&t.instanceNo===this.instanceNo)switch(t.event){case"init":{var i;const e=null==(i=this.workerContext)?void 0:i.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":r.logger[t.data.logType]&&r.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,r.trigger(t.event,t.data)}},this.onWorkerError=e=>{if(!this.hls)return;const t=new Error(`${e.message} (${e.filename}:${e.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:t})};const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=r,this.onFlush=i;const s=(e,t)=>{(t=t||{}).frag=this.frag||void 0,e===Ff.ERROR&&(t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new my,this.observer.on(Ff.FRAG_DECRYPTED,s),this.observer.on(Ff.ERROR,s);const a=fm(n.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){const r=this.hls.logger;if(n.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{n.workerPath?(r.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=function(e){const t=vy[e];if(t)return t.clientCount++,t;const r=new self.URL(e,self.location.href).href,i={worker:new self.Worker(r),scriptURL:r,clientCount:1};return vy[e]=i,i}(n.workerPath)):(r.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=vy[gy];if(e)return e.clientCount++,e;const t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),r=self.URL.createObjectURL(t),i={worker:new self.Worker(r),objectURL:r,clientCount:1};return vy[gy]=i,i}());const{worker:e}=this.workerContext;e.addEventListener("message",this.onWorkerMessage),e.addEventListener("error",this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:a,id:t,config:Cm(n)})}catch(i){r.warn(`Error setting up "${t}" Web Worker, fallback to inline`,i),this.terminateWorker(),this.error=null,this.transmuxer=new Ob(this.observer,a,n,"",t,e.logger)}return}}this.transmuxer=new Ob(this.observer,a,n,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Bb++;const t=this.hls.config,r=fm(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:r,id:this.id,config:Cm(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),function(e){const t=vy[e||gy];if(t&&1===t.clientCount--){const{worker:r,objectURL:i}=t;delete vy[e||gy],i&&self.URL.revokeObjectURL(i),r.terminate()}}(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,r,i,n,s,a,o,l,d){var c,u;l.transmuxing.start=self.performance.now();const{instanceNo:h,transmuxer:f}=this,p=s?s.start:n.start,m=n.decryptdata,g=this.frag,v=!(g&&n.cc===g.cc),y=!(g&&l.level===g.level),b=g?l.sn-g.sn:-1,E=this.part?l.part-this.part.index:-1,w=0===b&&l.id>1&&l.id===(null==g?void 0:g.stats.chunkCount),S=!y&&(1===b||0===b&&(1===E||w&&E<=0)),T=self.performance.now();(y||b||0===n.stats.parsing.start)&&(n.stats.parsing.start=T),!s||!E&&S||(s.stats.parsing.start=T);const x=!(g&&(null==(c=n.initSegment)?void 0:c.url)===(null==(u=g.initSegment)?void 0:u.url)),A=new $b(v,S,o,y,p,x);if(!S||v||x){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===Gf?"level":"track"}: ${l.level} id: ${l.id}\n discontinuity: ${v}\n trackSwitch: ${y}\n contiguous: ${S}\n accurateTimeOffset: ${o}\n timeOffset: ${p}\n initSegmentChange: ${x}`);const e=new Fb(r,i,t,a,d);this.configureTransmuxer(e)}if(this.frag=n,this.part=s,this.workerContext)this.workerContext.worker.postMessage({instanceNo:h,cmd:"demux",data:e,decryptdata:m,chunkMeta:l,state:A},e instanceof ArrayBuffer?[e]:[]);else if(f){const t=f.push(e,m,l,A);Nb(t)?t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}):this.handleTransmuxComplete(t)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:r}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(r){const t=r.flush(e);Nb(t)?t.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}):this.handleFlushResult(t,e)}}transmuxerError(e,t,r){this.hls&&(this.error=e,this.hls.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:r}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:r}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):r&&r.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}class zb extends Qf{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,r){const i=null==t?void 0:t.renditionReports;if(i){let n=-1;for(let r=0;r<i.length;r++){const s=i[r];let a;try{a=new self.URL(s.URI,t.url).href}catch(e){this.warn(`Could not construct new URL for Rendition Report: ${e}`),a=s.URI||""}if(a===e){n=r;break}a===e.substring(0,a.length)&&(n=r)}if(-1!==n){const e=i[n],s=parseInt(e["LAST-MSN"])||t.lastPartSn;let a=parseInt(e["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const e=Math.min(t.age-t.partTarget,t.targetduration);a>=0&&e>t.partTarget&&(a+=1)}const o=r&&Lm(r);return new Im(s,a>=0?a:void 0,o)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}return e}playlistLoaded(e,t,r){const{details:i,stats:n}=t,s=self.performance.now(),a=n.loading.first?Math.max(0,s-n.loading.first):0;i.advancedDateTime=Date.now()-a;const o=this.hls.config.timelineOffset;if(o!==i.appliedTimelineOffset){const e=Math.max(o||0,0);i.appliedTimelineOffset=e,i.fragments.forEach(t=>{t.setStart(t.playlistOffset+e)})}if(i.live||null!=r&&r.live){const o="levelInfo"in t?t.levelInfo:t.track;if(i.reloaded(r),r&&i.fragments.length>0){Cv(r,i,this);const e=i.playlistParsingError;if(e){this.warn(e);const r=this.hls;if(!r.config.ignorePlaylistParsingErrors){var l;const{networkDetails:s}=t;return void r.trigger(Ff.ERROR,{type:Mf.NETWORK_ERROR,details:Nf.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:e,reason:e.message,level:t.level||void 0,parent:null==(l=i.fragments[0])?void 0:l.type,networkDetails:s,stats:n})}i.playlistParsingError=null}}-1===i.requestScheduled&&(i.requestScheduled=n.loading.start);const d=this.hls.mainForwardBufferInfo,c=d?d.end-d.len:0,u=Nv(i,1e3*(i.edge-c));if(i.requestScheduled+u<s?i.requestScheduled=s:i.requestScheduled+=u,this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),!this.canLoad||!i.live)return;let h,f,p;if(i.canBlockReload&&i.endSN&&i.advanced){const e=this.hls.config.lowLatencyMode,n=i.lastPartSn,a=i.endSN,l=i.lastPartIndex,d=n===a;-1!==l?d?(f=a+1,p=e?0:l):(f=n,p=e?l+1:i.maxPartIndex):f=a+1;const c=i.age,u=c+i.ageHeader;let m=Math.min(u-i.partTarget,1.5*i.targetduration);if(m>0){if(u>3*i.targetduration)this.log(`Playlist last advanced ${c.toFixed(2)}s ago. Omitting segment and part directives.`),f=void 0,p=void 0;else if(null!=r&&r.tuneInGoal&&u-i.partTarget>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${m} with playlist age: ${i.age}`),m=0;else{const e=Math.floor(m/i.targetduration);if(f+=e,void 0!==p){p+=Math.round(m%i.targetduration/i.partTarget)}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${c.toFixed(2)}s goal: ${m} skip sn ${e} to part ${p}`)}i.tuneInGoal=m}if(h=this.getDeliveryDirectives(i,t.deliveryDirectives,f,p),e||!d)return i.requestScheduled=s,void this.loadingPlaylist(o,h)}else(i.canBlockReload||i.canSkipUntil)&&(h=this.getDeliveryDirectives(i,t.deliveryDirectives,f,p));h&&void 0!==f&&i.canBlockReload&&(i.requestScheduled=n.loading.first+Math.max(u-2*a,u/2)),this.scheduleLoading(o,h,i)}else this.clearTimer()}scheduleLoading(e,t,r){const i=r||e.details;if(!i)return void this.loadingPlaylist(e,t);const n=self.performance.now(),s=i.requestScheduled;if(n>=s)return void this.loadingPlaylist(e,t);const a=s-n;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(a)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),a)}getDeliveryDirectives(e,t,r,i){let n=Lm(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,i=t.part,n=xm),new Im(r,i,n)}checkRetry(e){const t=e.details,r=Wm(e),i=e.errorAction,{action:n,retryCount:s=0,retryConfig:a}=i||{},o=!!i&&!!a&&(n===ig||!i.resolved&&n===tg);if(o){var l;if(s>=a.maxNumRetry)return!1;if(r&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=Xm(a,s);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),e),this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,i.resolved=!0}return o}}function Gb(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!jb(e[r].attrs,t[r].attrs))return!1;return!0}function jb(e,t,r){const i=e["STABLE-RENDITION-ID"];return i&&!r?i===t["STABLE-RENDITION-ID"]:!(r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>e[r]!==t[r])}function Hb(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class Vb{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,r){if(null===this.queues||null===this.tracks)return;const i=this.queues[t];i.push(e),1!==i.length||r||this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const r={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(r,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const r={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(r)}})}removeBlockers(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const r=null==(t=e[0])?void 0:t.label;"async-blocker"!==r&&"async-blocker-prepend"!==r||(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(null===this.queues)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(null===this.queues||null===this.tracks)return;const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(t){var r;if(i.onError(t),null===this.queues||null===this.tracks)return;const n=null==(r=this.tracks[e])?void 0:r.buffer;null!=n&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return null===e||null===t?"<destroyed>":`\n${this.list("video")}\n${this.list("audio")}\n${this.list("audiovideo")}}`}list(e){var t,r;return null!=(t=this.queues)&&t[e]||null!=(r=this.tracks)&&r[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const r=null==(t=this.tracks)?void 0:t[e],i=null==r?void 0:r.buffer;return i?`SourceBuffer${i.updating?" updating":""}${r.ended?" ended":""}${r.ending?" ending":""}`:"none"}listOps(e){var t;return(null==(t=this.queues)?void 0:t[e].map(e=>e.label).join(", "))||""}}const Wb=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Yb="HlsJsTrackRemovedError";class Kb extends Error{constructor(e){super(e),this.name=Yb}}function qb(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach(t=>{e.removeChild(t)})}function Xb(e){return"audio"===e?1:0}class Qb{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(Ff.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Ff.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(Ff.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Ff.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Cf(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${r}: ${e[r].height}p@${e[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=r,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const r=t.filter((t,r)=>this.isLevelAllowed(t)&&r<=e);return this.clientRect=null,Qb.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,r){if(null==e||!e.length)return-1;const i=(e,t)=>!t||(e.width!==t.width||e.height!==t.height);let n=e.length-1;const s=Math.max(t,r);for(let t=0;t<e.length;t+=1){const r=e[t];if((r.width>=s||r.height>=s)&&i(r,e[t+1])){n=t;break}}return n}}const Zb={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Jb={HLS:"h"};class eE{constructor(e,t){Array.isArray(e)&&(e=e.map(e=>e instanceof eE?e:new eE(e))),this.value=e,this.params=t}}function tE(e,t,r,i){return new Error(`failed to ${e} "${n=t,Array.isArray(n)?JSON.stringify(n):n instanceof Map?"Map{}":n instanceof Set?"Set{}":"object"==typeof n?JSON.stringify(n):String(n)}" as ${r}`,{cause:i});var n}function rE(e,t,r){return tE("serialize",e,t,r)}class iE{constructor(e){this.description=e}}const nE="Bare Item";function sE(e){if(!1===ArrayBuffer.isView(e))throw rE(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function aE(e){if(function(e){return e<-999999999999999||999999999999999<e}(e))throw rE(e,"Integer");return e.toString()}function oE(e,t){if(e<0)return-oE(-e,t);const r=Math.pow(10,t);if(Math.abs(e*r%1-.5)<Number.EPSILON){const t=Math.floor(e*r);return(t%2==0?t:t+1)/r}return Math.round(e*r)/r}function lE(e){const t=oE(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw rE(e,"Decimal");const r=t.toString();return r.includes(".")?r:`${r}.0`}const dE=/[\x00-\x1f\x7f]+/;function cE(e){const t=(r=e).description||r.toString().slice(7,-1);var r;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw rE(t,"Token");return t}function uE(e){switch(typeof e){case"number":if(!Cf(e))throw rE(e,nE);return Number.isInteger(e)?aE(e):lE(e);case"string":return function(e){if(dE.test(e))throw rE(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return cE(e);case"boolean":return function(e){if("boolean"!=typeof e)throw rE(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${aE(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return sE(e);if(e instanceof iE)return cE(e);default:throw rE(e,nE)}}function hE(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw rE(e,"Key");return e}function fE(e){return null==e?"":Object.entries(e).map(([e,t])=>!0===t?`;${hE(e)}`:`;${hE(e)}=${uE(t)}`).join("")}function pE(e){return e instanceof eE?`${uE(e.value)}${fE(e.params)}`:uE(e)}function mE(e,t={whitespace:!0}){if("object"!=typeof e||null==e)throw rE(e,"Dict");const r=e instanceof Map?e.entries():Object.entries(e),i=(null==t?void 0:t.whitespace)?" ":"";return Array.from(r).map(([e,t])=>{t instanceof eE==!1&&(t=new eE(t));let r=hE(e);var i;return!0===t.value?r+=fE(t.params):(r+="=",Array.isArray(t.value)?r+=`(${(i=t).value.map(pE).join(" ")})${fE(i.params)}`:r+=pE(t)),r}).join(`,${i}`)}function gE(e,t){return mE(e,t)}const vE="CMCD-Object",yE="CMCD-Request",bE="CMCD-Session",EE="CMCD-Status",wE={br:vE,ab:vE,d:vE,ot:vE,tb:vE,tpb:vE,lb:vE,tab:vE,lab:vE,url:vE,pb:yE,bl:yE,tbl:yE,dl:yE,ltc:yE,mtp:yE,nor:yE,nrr:yE,rc:yE,sn:yE,sta:yE,su:yE,ttfb:yE,ttfbb:yE,ttlb:yE,cmsdd:yE,cmsds:yE,smrt:yE,df:yE,cs:yE,ts:yE,cid:bE,pr:bE,sf:bE,sid:bE,st:bE,v:bE,msd:bE,bs:EE,bsd:EE,cdn:EE,rtp:EE,bg:EE,pt:EE,ec:EE,e:EE},SE=yE;function TE(e,t){const r={};if(!e)return r;const i=Object.keys(e),n=t?(s=t,Object.keys(s).reduce((e,t)=>{var r;return null===(r=s[t])||void 0===r||r.forEach(r=>e[r]=t),e},{})):{};var s;return i.reduce((t,r)=>{var i;const s=wE[r]||n[r]||SE;return(null!==(i=t[s])&&void 0!==i?i:t[s]={})[r]=e[r],t},r)}const xE="event";const AE=e=>Math.round(e),kE=(e,t)=>Array.isArray(e)?e.map(e=>kE(e,t)):e instanceof eE&&"string"==typeof e.value?new eE(kE(e.value,t),e.params):(t.baseUrl&&(e=function(e,t){const r=new URL(e),i=new URL(t);if(r.origin!==i.origin)return e;const n=r.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1);for(;n[0]===s[0];)n.shift(),s.shift();for(;s.length;)s.shift(),n.unshift("..");return n.join("/")+r.search+r.hash}(e,t.baseUrl)),1===t.version?encodeURIComponent(e):e),LE=e=>100*AE(e/100),IE={br:AE,d:AE,bl:LE,dl:LE,mtp:LE,nor:(e,t)=>{let r=e;return t.version>=2&&(e instanceof eE&&"string"==typeof e.value?r=new eE([e]):"string"==typeof e&&(r=[e])),kE(r,t)},rtp:LE,tb:AE},RE="request",PE="response",DE=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],CE=["e"],_E=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function OE(e){return _E.test(e)}const ME=["d","dl","nor","ot","rtp","su"];const NE=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];const FE=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function $E(e){return FE.includes(e)||OE(e)}const BE={[PE]:function(e){return DE.includes(e)||ME.includes(e)||NE.includes(e)||OE(e)},[xE]:function(e){return DE.includes(e)||CE.includes(e)||OE(e)},[RE]:function(e){return DE.includes(e)||ME.includes(e)||OE(e)}};function UE(e,t={}){const r={};if(null==e||"object"!=typeof e)return r;const i=t.version||e.v||1,n=t.reportingMode||RE,s=1===i?$E:BE[n];let a=Object.keys(e).filter(s);const o=t.filter;"function"==typeof o&&(a=a.filter(o));const l=n===PE||n===xE;l&&!a.includes("ts")&&a.push("ts"),i>1&&!a.includes("v")&&a.push("v");const d=Kf({},IE,t.formatters),c={version:i,reportingMode:n,baseUrl:t.baseUrl};return a.sort().forEach(t=>{let n=e[t];const s=d[t];if("function"==typeof s&&(n=s(n,c)),"v"===t){if(1===i)return;n=i}"pr"==t&&1===n||(l&&"ts"===t&&!Cf(n)&&(n=Date.now()),function(e){return"number"==typeof e?Cf(e):null!=e&&""!==e&&!1!==e}(n)&&(function(e){return["ot","sf","st","e","sta"].includes(e)}(t)&&"string"==typeof n&&(n=new iE(n)),r[t]=n))}),r}function zE(e,t,r){return Kf(e,function(e,t={}){const r={};if(!e)return r;const i=TE(UE(e,t),null==t?void 0:t.customHeaderMap);return Object.entries(i).reduce((e,[t,r])=>{const i=gE(r,{whitespace:!1});return i&&(e[t]=i),e},r)}(t,r))}function GE(e,t={}){if(!e)return"";const r=function(e,t={}){return e?gE(UE(e,t),{whitespace:!1}):""}(e,t);return encodeURIComponent(r)}const jE=/CMCD=[^&#]+/;function HE(e,t,r){const i=function(e,t={}){return e?`CMCD=${GE(e,t)}`:""}(t,r);if(!i)return e;if(jE.test(e))return e.replace(jE,i);const n=e.includes("?")?"&":"?";return`${e}${n}${i}`}function VE(e,t,r,i){e&&Object.keys(t).forEach(n=>{const s=e.filter(e=>e.groupId===n).map(e=>{const s=Kf({},e);return s.details=void 0,s.attrs=new Bg(s.attrs),s.url=s.attrs.URI=WE(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),s.groupId=s.attrs["GROUP-ID"]=t[n],s.attrs["PATHWAY-ID"]=i,s});e.push(...s)})}function WE(e,t,r,i){const{HOST:n,PARAMS:s,[r]:a}=i;let o;t&&(o=null==a?void 0:a[t],o&&(e=o));const l=new self.URL(e);return n&&!o&&(l.host=n),s&&Object.keys(s).sort().forEach(e=>{e&&l.searchParams.set(e,s[e])}),l.href}class YE extends Qf{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=YE.CDMCleanupPromise?[YE.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=e=>{const{initDataType:t,initData:r}=e,i=`"${e.type}" event: init data type: "${t}"`;if(this.debug(i),null!==r){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=av(this.config));const t=e.map(sv).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(n=>{const s=nv(n);if("sinf"!==t||s!==Jg.FAIRPLAY)return void this.log(`Ignoring "${e.type}" event with init data type: "${t}" for selected key-system ${s}`);let a;try{const e=Pp(new Uint8Array(r)),t=Hp(Kg(JSON.parse(e).sinf));if(!t)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");a=new Uint8Array(t.subarray(8,24))}catch(e){return void this.warn(`${i} Failed to parse sinf: ${e}`)}const o=op(a),{keyIdToKeySessionPromise:l,mediaKeySessions:d}=this;let c=l[o];for(let e=0;e<d.length;e++){const i=d[e],n=i.decryptdata;if(!n.keyId)continue;const s=op(n.keyId);if(Hg(a,n.keyId)||-1!==n.uri.replace(/-/g,"").indexOf(o)){if(c=l[s],!c)continue;if(n.pssh)break;delete l[s],n.pssh=new Uint8Array(r),n.keyId=a,c=l[o]=c.then(()=>this.generateRequestWithPreferredKeySession(i,t,r,"encrypted-event-key-match")),c.catch(e=>this.handleError(e));break}}c||this.handleError(new Error(`Key ID ${o} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(e=>this.handleError(e))}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Ff.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(Ff.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Ff.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(Ff.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:r}=this.config,i=null==t?void 0:t[e];return i?i.licenseUrl:e===Jg.WIDEVINE&&r?r:void 0}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(void 0===t)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,r=null==t?void 0:t[e];if(r)return r.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,r=(e,t,r)=>!!e&&r.indexOf(e)===t,i=t.map(e=>e.audioCodec).filter(r),n=t.map(e=>e.videoCodec).filter(r);return i.length+n.length===0&&n.push("avc1.42e01e"),new Promise((t,r)=>{const s=e=>{const a=e.shift();this.getMediaKeysPromise(a,i,n).then(e=>t({keySystem:a,mediaKeys:e})).catch(t=>{e.length?s(e):r(t instanceof XE?t:new XE({type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};s(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:r}=this.config;if("function"!=typeof r){let e=`Configured requestMediaKeySystemAccess is not a function ${r}`;return null===ov&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return r(e,t)}getMediaKeysPromise(e,t,r){var i;const n=function(e,t,r,i){let n;switch(e){case Jg.FAIRPLAY:n=["cenc","sinf"];break;case Jg.WIDEVINE:case Jg.PLAYREADY:n=["cenc"];break;case Jg.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,r,i){return[{initDataTypes:e,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:t.map(e=>({contentType:`audio/mp4; codecs=${e}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:r.map(e=>({contentType:`video/mp4; codecs=${e}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}(n,t,r,i)}(e,t,r,this.config.drmSystemOptions||{});let s=this.keySystemAccessPromises[e],a=null==(i=s)?void 0:i.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Cm(n)}`),a=this.requestMediaKeySystemAccess(e,n);const t=s=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)}),a.then(r=>{this.log(`Access for key-system "${r.keySystem}" obtained`);const i=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const n=t.mediaKeys=r.createMediaKeys().then(r=>(this.log(`Media-keys created for "${e}"`),t.hasMediaKeys=!0,i.then(t=>t?this.setMediaKeysServerCertificate(r,e,t):r)));return n.catch(t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)}),n})}return a.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:r}){this.log(`Creating key-system session "${t}" keyId: ${op(e.keyId||[])} keyUri: ${e.uri}`);const i=r.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:r,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const r=this.createMediaKeySessionContext(e),i=KE(t),n="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(r,n,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyId ${op(e.decryptdata.keyId||[])}\n } (data length: ${t.byteLength})`),r.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>sv(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:e,mediaKeys:t})=>this.attemptSetMediaKeys(e,t))}selectKeySystem(e){return new Promise((t,r)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:e})=>{const i=sv(e);i?t(i):r(new Error(`Unable to find format for key-system "${e}"`))}).catch(r)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=av(this.config),r=e.map(nv).filter(e=>!!e&&-1!==t.indexOf(e));return this.selectKeySystem(r)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let r=0;r<t.length;r++){const i=qE(e,t[r]);if(i)return i}}loadKey(e){const t=e.keyInfo.decryptdata,r=KE(t),i=this.bannedKeyIds[r];if(i||"internal-error"===this.getKeyStatus(t)){const r=QE(i||"internal-error",t);return this.handleError(r,e.frag),Promise.reject(r)}const n=`(keyId: ${r} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);const s=this.keyIdToKeySessionPromise[r];if(!s){const i=this.getKeySystemForKeyPromise(t).then(({keySystem:r,mediaKeys:i})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(r,i).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:r,mediaKeys:i,decryptdata:t}))))).then(e=>{const r=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(e,"cenc",r,"playlist-key")});return i.catch(t=>this.handleError(t,e.frag)),this.keyIdToKeySessionPromise[r]=i,i}return s.catch(r=>{if(r instanceof XE){const i=Xf({},r.data);"internal-error"===this.getKeyStatus(t)&&(i.decryptdata=t);const n=new XE(i,r.message);this.handleError(n,e.frag)}}),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof XE){t&&(e.data.frag=t);const r=e.data.decryptdata;this.error(`${e.message}${r?` (${op(r.keyId||[])})`:""}`),this.hls.trigger(Ff.ERROR,e.data)}else this.error(e.message),this.hls.trigger(Ff.ERROR,{type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=KE(e),r=this.keyIdToKeySessionPromise[t];if(!r){const t=nv(e.keyFormat),r=t?[t]:av(this.config);return this.attemptKeySystemAccess(r)}return r}getKeySystemSelectionPromise(e){if(e.length||(e=av(this.config)),0===e.length)throw new XE({type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Cm({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(r).then(()=>this.media?this.media.setMediaKeys(t):new Promise((e,r)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return r(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(e).catch(r)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),r.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>-1===r.indexOf(e))})}generateRequestWithPreferredKeySession(e,t,r,i){var n;const s=null==(n=this.config.drmSystems)||null==(n=n[e.keySystem])?void 0:n.generateRequest;if(s)try{const i=s.call(this.hls,t,r,e);if(!i)throw new Error("Invalid response from configured generateRequest filter");t=i.initDataType,r=i.initData?i.initData:null,e.decryptdata.pssh=r?new Uint8Array(r):null}catch(e){if(this.warn(e.message),this.hls&&this.hls.config.debug)throw e}if(null===r)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const a=KE(e.decryptdata),o=e.decryptdata.uri;this.log(`Generating key-session request for "${i}" keyId: ${a} URI: ${o} (init data type: ${t} length: ${r.byteLength})`);const l=new my,d=e._onmessage=t=>{const r=e.mediaKeysSession;if(!r)return void l.emit("error",new Error("invalid state"));const{messageType:i,message:n}=t;this.log(`"${i}" message event for session "${r.sessionId}" message size: ${n.byteLength}`),"license-request"===i||"license-renewal"===i?this.renewLicense(e,n).catch(e=>{l.eventNames().length?l.emit("error",e):this.handleError(e)}):"license-release"===i?e.keySystem===Jg.FAIRPLAY&&this.updateKeySession(e,qg("acknowledged")).then(()=>this.removeSession(e)).catch(e=>this.handleError(e)):this.warn(`unhandled media key message type "${i}"`)},c=(e,t)=>{let r;t.keyStatus=e,e.startsWith("usable")?l.emit("resolved"):"internal-error"===e||"output-restricted"===e||"output-downscaled"===e?r=QE(e,t.decryptdata):"expired"===e?r=new Error(`key expired (keyId: ${a})`):"released"===e?r=new Error("key released"):"status-pending"===e||this.warn(`unhandled key status change "${e}" (keyId: ${a})`),r&&(l.eventNames().length?l.emit("error",r):this.handleError(r))},u=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void l.emit("error",new Error("invalid state"));const r=this.getKeyStatuses(e);if(!Object.keys(r).some(e=>"status-pending"!==r[e]))return;if("expired"===r[a])return this.log(`Expired key ${Cm(r)} in key-session "${e.mediaKeysSession.sessionId}"`),void this.renewKeySession(e);let i=r[a];if(i)c(i,e);else{var n;const t=1e3;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(n=e.keyStatusTimeouts)[a]||(n[a]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const r=this.getKeyStatus(e.decryptdata);if(r&&"status-pending"!==r)return this.log(`No status for keyId ${a} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${r} from other session.`),c(r,e);this.log(`key status for ${a} in key-session "${e.mediaKeysSession.sessionId}" timed out after ${t}ms`),i="internal-error",c(i,e)},t)),this.log(`No status for keyId ${a} (${Cm(r)}).`)}};Kv(e.mediaKeysSession,"message",d),Kv(e.mediaKeysSession,"keystatuseschange",u);const h=new Promise((e,t)=>{l.on("error",t),l.on("resolved",e)});return e.mediaKeysSession.generateRequest(t,r).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${a} URI: ${o}`)}).catch(t=>{throw new XE({type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_NO_SESSION,error:t,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${t}`)}).then(()=>h).catch(t=>(l.removeAllListeners(),this.removeSession(e).then(()=>{throw t}))).then(()=>(l.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((r,i)=>{if("string"==typeof i&&"object"==typeof r){const e=i;i=r,r=e}const n="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);if(e.keySystem===Jg.PLAYREADY&&16===n.length){const e=op(n);t[e]=r,Xg(n)}const s=op(n);"internal-error"===r&&(this.bannedKeyIds[s]=r),this.log(`key status change "${r}" for keyStatuses keyId: ${s} key-session "${e.mediaKeysSession.sessionId}"`),t[s]=r}),t}fetchServerCertificate(e){const t=this.config,r=new(0,t.loader)(t),i=this.getServerCertificateUrl(e);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise((n,s)=>{const a={responseType:"arraybuffer",url:i},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,r,i)=>{n(e.data)},onError:(t,r,n,o)=>{s(new XE({type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:Xf({url:a.url,data:void 0},t)},`"${e}" certificate request failed (${i}). Status: ${t.code} (${t.text})`))},onTimeout:(t,r,n)=>{s(new XE({type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:{url:a.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(e,t,r)=>{s(new Error("aborted"))}};r.load(a,l,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,r){return new Promise((i,n)=>{e.setServerCertificate(r).then(n=>{this.log(`setServerCertificate ${n?"success":"not supported by CDM"} (${r.byteLength}) on "${t}"`),i(e)}).catch(e=>{n(new XE({type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(t=>{throw new XE({type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:t,fatal:!1},t.message)}))}unpackPlayReadyKeyMessage(e,t){const r=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=(new DOMParser).parseFromString(r,"application/xml"),n=i.querySelectorAll("HttpHeader");if(n.length>0){let t;for(let r=0,i=n.length;r<i;r++){var s,a;t=n[r];const i=null==(s=t.querySelector("name"))?void 0:s.textContent,o=null==(a=t.querySelector("value"))?void 0:a.textContent;i&&o&&e.setRequestHeader(i,o)}}const o=i.querySelector("Challenge"),l=null==o?void 0:o.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return qg(atob(l))}setupLicenseXHR(e,t,r,i){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!r.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,r,i)}).catch(s=>{if(!r.decryptdata)throw s;return e.open("POST",t,!0),n.call(this.hls,e,t,r,i)}).then(r=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:r||i}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const r=this.config.keyLoadPolicy.default;return new Promise((i,n)=>{const s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${s}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let t=a.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const r=this.config.licenseResponseCallback;if(r)try{t=r.call(this.hls,a,s,e)}catch(e){this.error(e)}i(t)}else{const o=r.errorRetry,l=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)n(new XE({type:Mf.KEY_SYSTEM_ERROR,details:Nf.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:a,response:{url:s,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${s}). Status: ${a.status} (${a.statusText})`));else{const r=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${r} attempts left`),this.requestLicense(e,t).then(i,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,s,e,t).then(({xhr:t,licenseChallenge:r})=>{e.keySystem==Jg.PLAYREADY&&(r=this.unpackPlayReadyKeyMessage(t,r)),t.send(r)}).catch(n)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const r=t.media;this.media=r,Kv(r,"encrypted",this.onMediaEncrypted),Kv(r,"waitingforkey",this.onWaitingForKey);const i=this.mediaResolved;i?i():this.mediaKeys=r.mediaKeys}onMediaDetached(){const e=this.media;e&&(qv(e,"encrypted",this.onMediaEncrypted),qv(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const r=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,uv.clearKeyUriToKeyIdMap();const n=i.length;YE.CDMCleanupPromise=Promise.all(i.map(e=>this.removeSession(e)).concat((null==r||null==(e=r.setMediaKeys(null))?void 0:e.catch(e=>{this.log(`Could not clear media keys: ${e}`),this.hls&&this.hls.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${e}`)})}))||Promise.resolve())).catch(e=>{this.log(`Could not close sessions and clear media keys: ${e}`),this.hls&&this.hls.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${e}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:r,decryptdata:i}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${op((null==i?void 0:i.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{keyStatusTimeouts:s}=e;s&&Object.keys(s).forEach(e=>self.clearTimeout(s[e]));const{drmSystemOptions:a}=this.config,o=function(e){var t;return!(!e||"persistent-license"!==e.sessionType&&(null==(t=e.sessionTypes)||!t.some(e=>"persistent-license"===e)))}(a)?new Promise((e,r)=>{self.setTimeout(()=>r(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(e).catch(r)}):Promise.resolve();return o.catch(e=>{this.log(`Could not remove session: ${e}`),this.hls&&this.hls.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${e}`)})}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`),this.hls&&this.hls.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${e}`)})})}return Promise.resolve()}}function KE(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return op(e.keyId)}function qE(e,t){return e.keyId&&t.mediaKeysSession.keyStatuses.has(e.keyId)?t.mediaKeysSession.keyStatuses.get(e.keyId):e.matches(t.decryptdata)?t.keyStatus:void 0}YE.CDMCleanupPromise=void 0;class XE extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function QE(e,t){const r="output-restricted"===e,i=r?Nf.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:Nf.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new XE({type:Mf.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:t},r?"HDCP level output restricted":`key status changed to "${e}"`)}function ZE(e,t){let r;try{r=new Event("addtrack")}catch(e){r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)}function JE(e,t){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(r){ip.debug(`[texttrack-utils]: ${r}`);try{const r=new self.TextTrackCue(t.startTime,t.endTime,t.text);r.id=t.id,e.addCue(r)}catch(e){ip.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===r&&(e.mode=r)}function ew(e,t){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues)for(let r=e.cues.length;r--;)t&&e.cues[r].removeEventListener("enter",t),e.removeCue(e.cues[r]);"disabled"===r&&(e.mode=r)}function tw(e,t,r,i){const n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&e.cues.length>0){const n=function(e,t,r){const i=[],n=function(e,t){if(t<=e[0].startTime)return 0;const r=e.length-1;if(t>e[r].endTime)return-1;let i,n=0,s=r;for(;n<=s;)if(i=Math.floor((s+n)/2),t<e[i].startTime)s=i-1;else{if(!(t>e[i].startTime&&n<r))return i;n=i+1}return e[n].startTime-t<t-e[s].startTime?n:s}(e,t);if(n>-1)for(let s=n,a=e.length;s<a;s++){const n=e[s];if(n.startTime>=t&&n.endTime<=r)i.push(n);else if(n.startTime>r)return i}return i}(e.cues,t,r);for(let t=0;t<n.length;t++)i&&!i(n[t])||e.removeCue(n[t])}"disabled"===n&&(e.mode=n)}function rw(e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];"subtitles"!==i.kind&&"captions"!==i.kind||!i.label||t.push(e[r])}return t}function iw(e){let t=5381,r=e.length;for(;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()}const nw=.025;let sw=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});function aw(e,t,r){return`${e.identifier}-${r+1}-${iw(t)}`}class ow{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,null==(e=this.assetListLoader)||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const r=this.playoutLimit;if(e<=0||isNaN(r))return!1;if(0===r)return!0;return((null==(t=this.assetList[e])?void 0:t.startOffset)||0)>r}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return lw(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime;return t-lw(t,e)<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=Cf(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return lw(e,t)}return e}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||!this.startIsAligned||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<nw))}set appendInPlace(e){this.appendInPlaceStarted?this.resetOnResume=!e:this.appendInPlaceDisabled=!e}get timelineStart(){return null!==this._timelineStart?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return t=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?sw.Range:sw.Point}get supplementsPrimary(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}get contentMayVary(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||null!==this.assetListResponse}toString(){return`["${(e=this).identifier}" ${e.cue.pre?"<pre>":e.cue.post?"<post>":""}${e.timelineStart.toFixed(2)}-${e.resumeTime.toFixed(2)}]`;var e}}function lw(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<nw)?t.start:t.start+t.duration}function dw(e,t,r){const i=new self.URL(e,r);return"data:"!==i.protocol&&i.searchParams.set("_HLS_primary_id",t),i}function cw(e,t){for(;null!=(r=e.assetList[++t])&&r.error;)var r;return t}function uw(e){const t=e.timelineStart,r=e.duration||0;return`["${e.identifier}" ${t.toFixed(2)}-${(t+r).toFixed(2)}]`}class hw{constructor(e,t,r,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(Ff.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=r,this.assetItem=i;const s=()=>{this.hasDetails=!0};n.once(Ff.LEVEL_LOADED,s),n.once(Ff.AUDIO_TRACK_LOADED,s),n.once(Ff.SUBTITLE_TRACK_LOADED,s),n.on(Ff.MEDIA_ATTACHING,(e,{media:t})=>{this.removeMediaListeners(),this.mediaAttached=t;this.interstitial.playoutLimit&&(t.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(Ff.BUFFER_APPENDED,()=>{const e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,n.trigger(Ff.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=dw(t,e.config.primarySessionId||"").href}catch(e){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if(null!=(t=this.hls)&&t.bufferedToEnd)return!0;if(!e)return!1;const r=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,n=Dg.bufferInfo(e,i,0);return this.getAssetTime(n.end)>=r-.02}reachedPlayout(e){const t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!(null!=(e=this.hls)&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return(null==(e=this.hls)?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=Dg.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const r=t-this.startOffset;if(r>0&&r<e)return r}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return(null==(e=this.hls)?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const r=e-t;if(Math.abs(r)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,r=this.duration;return Math.min(Math.max(0,e-t),r)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){var e;this.mediaAttached&&(null!=(e=this.hls)&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd))}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),null==(t=this.hls)||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,null==(e=this.hls)||e.detachMedia()}resumeBuffering(){var e;null==(e=this.hls)||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.hls)||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),(null==(e=this.hls)?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,r){var i;null==(i=this.hls)||i.on(e,t)}once(e,t,r){var i;null==(i=this.hls)||i.once(e,t)}off(e,t,r){var i;null==(i=this.hls)||i.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${uw(this.assetItem)} ${null==(e=this.hls)?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}class fw extends Qf{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((r,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,r+1):r,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let r=-1;e.nextEvent?r=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(r=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[r]||(void 0===t&&(t=e.start),r=this.findItemIndexAtTime(t));r>=0&&null!=(n=i[r])&&n.event;){var n;r--}return r}findItemIndexAtTime(e,t){const r=this.items;if(r)for(let i=0;i<r.length;i++){let n=r[i];if(t&&"primary"!==t&&(n=n[t]),e===n.start||e>n.start&&e<n.end)return i}return-1}findJumpRestrictedIndex(e,t){const r=this.items;if(r)for(let i=e;i<=t&&r[i];i++){const e=r[i].event;if(null!=e&&e.restrictions.jump&&!e.appendInPlace)return i}return-1}findEventIndex(e){const t=this.items;if(t)for(let i=t.length;i--;){var r;if((null==(r=t[i].event)?void 0:r.identifier)===e)return i}return-1}findAssetIndex(e,t){const r=e.assetList,i=r.length;if(i>1)for(let e=0;e<i;e++){const n=r[e];if(!n.error){const r=n.timelineStart;if(t===r||t>r&&(t<r+(n.duration||0)||e===i-1))return e}}return 0}get assetIdAtEnd(){var e;const t=null==(e=this.items)||null==(e=e[this.length-1])?void 0:e.event;if(t){const e=t.assetList,r=e[e.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const r=e.main.details,{dateRanges:i}=r,n=this.events,s=this.parseDateRanges(i,{url:r.url},t),a=Object.keys(i),o=n?n.filter(e=>!a.includes(e.identifier)):[];s.length&&s.sort((e,t)=>{const r=e.cue.pre,i=e.cue.post,n=t.cue.pre,s=t.cue.post;if(r&&!n)return-1;if(n&&!r)return 1;if(i&&!s)return 1;if(s&&!i)return-1;if(!(r||n||i||s)){const r=e.startTime,i=t.startTime;if(r!==i)return r-i}return e.dateRange.tagOrder-t.dateRange.tagOrder}),this.events=s,o.forEach(e=>{this.removeEvent(e)}),this.updateSchedule(e,o)}updateSchedule(e,t=[],r=!1){const i=this.events||[];if(i.length||t.length||this.length<2){const n=this.items,s=this.parseSchedule(i,e),a=r||t.length||(null==n?void 0:n.length)!==s.length||s.some((e,t)=>Math.abs(e.playout.start-n[t].playout.start)>.005||Math.abs(e.playout.end-n[t].playout.end)>.005);a&&(this.items=s,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,r){const i=[],n=Object.keys(e);for(let s=0;s<n.length;s++){const a=n[s],o=e[a];if(o.isInterstitial){let e=this.eventMap[a];e?e.setDateRange(o):(e=new ow(o,t),this.eventMap[a]=e,!1===r&&(e.appendInPlace=r)),i.push(e)}}return i}parseSchedule(e,t){const r=[],i=t.main.details,n=i.live?1/0:i.edge;let s=0;if((e=e.filter(e=>!(e.error||e.cue.once&&e.hasPlayed))).length){this.resolveOffsets(e,t);let i=0,o=0;if(e.forEach((t,a)=>{const l=t.cue.pre,d=t.cue.post,c=e[a-1]||null,u=t.appendInPlace,h=d?n:t.startOffset,f=t.duration,p=t.timelineOccupancy===sw.Range?f:0,m=t.resumptionOffset,g=(null==c?void 0:c.startTime)===h,v=h+t.cumulativeDuration;let y=u?v+f:h+m;if(l||!d&&h<=0){const e=o;o+=p,t.timelineStart=v;const i=s;s+=f,r.push({event:t,start:v,end:y,playout:{start:i,end:s},integrated:{start:e,end:o}})}else{if(!(h<=n))return;{if(!g){const n=h-i;if(n>.033){const l=i,d=o;o+=n;const c=s;s+=n;const u={previousEvent:e[a-1]||null,nextEvent:t,start:l,end:l+n,playout:{start:c,end:s},integrated:{start:d,end:o}};r.push(u)}else n>0&&c&&(c.cumulativeDuration+=n,r[r.length-1].end=h)}d&&(y=v),t.timelineStart=v;const n=o;o+=p;const l=s;s+=f,r.push({event:t,start:v,end:y,playout:{start:l,end:s},integrated:{start:n,end:o}})}}const b=t.resumeTime;i=d||b>n?n:b}),i<n){var a;const e=i,t=o,l=n-i;o+=l;const d=s;s+=l,r.push({previousEvent:(null==(a=r[r.length-1])?void 0:a.event)||null,nextEvent:null,start:i,end:e+l,playout:{start:d,end:s},integrated:{start:t,end:o}})}this.setDurations(n,s,o)}else{const e=0;r.push({previousEvent:null,nextEvent:null,start:e,end:n,playout:{start:e,end:n},integrated:{start:e,end:n}}),this.setDurations(n,n,n)}return r}setDurations(e,t,r){this.durations={primary:e,playout:t,integrated:r}}resolveOffsets(e,t){const r=t.main.details,i=r.live?1/0:r.edge;let n=0,s=-1;e.forEach((a,o)=>{const l=a.cue.pre,d=a.cue.post,c=l?0:d?i:a.startTime;this.updateAssetDurations(a);if(s===c?a.cumulativeDuration=n:(n=0,s=c),!d&&a.snapOptions.in&&(a.resumeAnchor=Gm(null,r.fragments,a.startOffset+a.resumptionOffset,0,0)||void 0),a.appendInPlace&&!a.appendInPlaceStarted){this.primaryCanResumeInPlaceAt(a,t)||(a.appendInPlace=!1)}if(!a.appendInPlace&&o+1<e.length){e[o+1].startTime-e[o].resumeTime<.033&&(e[o+1].appendInPlace=!1,e[o+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${a}`))}const u=Cf(a.resumeOffset)?a.resumeOffset:a.duration;n+=u})}primaryCanResumeInPlaceAt(e,t){const r=e.resumeTime,i=e.startTime+e.resumptionOffset;if(Math.abs(r-i)>nw)return this.log(`"${e.identifier}" resumption ${r} not aligned with estimated timeline end ${i}`),!1;return!Object.keys(t).some(i=>{const n=t[i].details,s=n.edge;if(r>=s)return this.log(`"${e.identifier}" resumption ${r} past ${i} playlist end ${s}`),!1;const a=Gm(null,n.fragments,r);if(!a)return this.log(`"${e.identifier}" resumption ${r} does not align with any fragments in ${i} playlist (${n.fragStart}-${n.fragmentEnd})`),!0;const o="audio"===i?.175:0;return!(Math.abs(a.start-r)<nw+o||Math.abs(a.end-r)<nw+o)&&(this.log(`"${e.identifier}" resumption ${r} not aligned with ${i} fragment bounds (${a.start}-${a.end} sn: ${a.sn} cc: ${a.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let r=0,i=!1,n=!1;for(let s=0;s<e.assetList.length;s++){const a=e.assetList[s],o=t+r;a.startOffset=r,a.timelineStart=o,i||(i=null===a.duration),n||(n=!!a.error);r+=a.error?0:a.duration||0}e.duration=i&&!n?Math.max(r,e.duration):r}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function pw(e){return`[${e.event?'"'+e.event.identifier+'"':"primary"}: ${e.start.toFixed(2)}-${e.end.toFixed(2)}]`}class mw{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const r=e.assetListUrl;let i;try{i=dw(r,this.hls.sessionId,e.baseUrl)}catch(t){const i=this.assignAssetListError(e,Nf.ASSET_LIST_LOAD_ERROR,t,r);return void this.hls.trigger(Ff.ERROR,i)}t&&"data:"!==i.protocol&&i.searchParams.set("_HLS_start_offset",""+t);const n=this.hls.config,s=new(0,n.loader)(n),a={responseType:"json",url:i.href},o=n.interstitialAssetListLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(t,r,i,n)=>{const s=t.data,a=null==s?void 0:s.ASSETS;if(!Array.isArray(a)){const t=this.assignAssetListError(e,Nf.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),i.url,r,n);return void this.hls.trigger(Ff.ERROR,t)}e.assetListResponse=s,this.hls.trigger(Ff.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:n})},onError:(t,r,i,n)=>{const s=this.assignAssetListError(e,Nf.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${t.code} ${t.text} (${r.url})`),r.url,n,i);this.hls.trigger(Ff.ERROR,s)},onTimeout:(t,r,i)=>{const n=this.assignAssetListError(e,Nf.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${r.url})`),r.url,t,i);this.hls.trigger(Ff.ERROR,n)}};return s.load(a,l,d),this.hls.trigger(Ff.ASSET_LIST_LOADING,{event:e}),s}assignAssetListError(e,t,r,i,n,s){return e.error=r,{type:Mf.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:r,networkDetails:s,stats:n}}}function gw(e){var t;null==e||null==(t=e.play())||t.catch(()=>{})}function vw(e,t){return`[${e}] Advancing timeline position to ${t}`}class yw{constructor(e){this.buffered=void 0;const t=(t,r,i)=>{if((r>>>=0)>i-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${i})`);return e[r][t]};this.buffered={get length(){return e.length},end:r=>t("end",r,e.length),start:r=>t("start",r,e.length)}}}const bw={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Ew=e=>String.fromCharCode(bw[e]||e),ww=15,Sw=100,Tw={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},xw={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Aw={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},kw={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Lw=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Iw{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const r="function"==typeof t?t():t;ip.log(`${this.time} [${e}] ${r}`)}}}const Rw=function(e){const t=[];for(let r=0;r<e.length;r++)t.push(e[r].toString(16));return t};class Pw{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let r=0;r<t.length;r++){const i=t[r];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class Dw{constructor(){this.uchar=" ",this.penState=new Pw}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class Cw{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Pw,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<Sw;e++)this.chars.push(new Dw);this.logger=e}equals(e){for(let t=0;t<Sw;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Sw;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Sw;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Sw&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Sw)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Ew(e);this.pos>=Sw?this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t<Sw;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let r=0;r<Sw;r++){const i=this.chars[r].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e);this.chars[this.pos].setPenState(this.currPenState)}}class _w{constructor(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<ww;t++)this.rows.push(new Cw(e));this.logger=e}reset(){for(let e=0;e<ww;e++)this.rows[e].clear();this.currRow=14}equals(e){let t=!0;for(let r=0;r<ww;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}copy(e){for(let t=0;t<ww;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<ww;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e);this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+Cm(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<ww;e++)this.rows[e].clear();const e=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const i=r.rows[e].cueStartTime,n=this.logger.time;if(null!==i&&null!==n&&i<n)for(let i=0;i<this.nrRollUpRows;i++)this.rows[t-this.nrRollUpRows+i+1].copy(r.rows[e+i])}}this.currRow=t;const r=this.rows[this.currRow];if(null!==e.indent){const t=e.indent,i=Math.max(t-1,0);r.setCursor(e.indent),e.color=r.chars[i].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Cm(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let r="",i=-1;for(let r=0;r<ww;r++){const n=this.rows[r].getTextString();n&&(i=r+1,e?t.push("Row "+i+": '"+n+"'"):t.push(n.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r}getTextAndFormat(){return this.rows}}class Ow{constructor(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new _w(r),this.nonDisplayedMemory=new _w(r),this.lastOutputScreen=new _w(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const r=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[r]}this.logger.log(2,"MIDROW: "+Cm(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Mw{constructor(e,t,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const i=this.logger=new Iw;this.channels=[null,new Ow(e,t,i),new Ow(e+1,r,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e<t.length;e+=2){const r=127&t[e],i=127&t[e+1];let n=!1,s=null;if(0===r&&0===i)continue;this.logger.log(3,()=>"["+Rw([t[e],t[e+1]])+"] -> ("+Rw([r,i])+")");const a=this.cmdHistory;if(r>=16&&r<=31){if(Fw(r,i,a)){Nw(null,null,a),this.logger.log(3,()=>"Repeated command ("+Rw([r,i])+") is dropped");continue}Nw(r,i,this.cmdHistory),n=this.parseCmd(r,i),n||(n=this.parseMidrow(r,i)),n||(n=this.parsePAC(r,i)),n||(n=this.parseBackgroundAttributes(r,i))}else Nw(null,null,a);if(!n&&(s=this.parseChars(r,i),s)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(s)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}n||s||this.logger.log(2,()=>"Couldn't parse cleaned data "+Rw([r,i])+" orig: "+Rw([t[e],t[e+1]]))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const r=20===e||21===e||23===e?1:2,i=this.channels[r];return 20===e||21===e||28===e||29===e?32===t?i.ccRCL():33===t?i.ccBS():34===t?i.ccAOF():35===t?i.ccAON():36===t?i.ccDER():37===t?i.ccRU(2):38===t?i.ccRU(3):39===t?i.ccRU(4):40===t?i.ccFON():41===t?i.ccRDC():42===t?i.ccTR():43===t?i.ccRTD():44===t?i.ccEDM():45===t?i.ccCR():46===t?i.ccENM():47===t&&i.ccEOC():i.ccTO(t-32),this.currentChannel=r,!0}parseMidrow(e,t){let r=0;if((17===e||25===e)&&t>=32&&t<=47){if(r=17===e?1:2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[r];return!!i&&(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Rw([e,t])+")"),!0)}return!1}parsePAC(e,t){let r;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const i=e<=23?1:2;r=t>=64&&t<=95?1===i?Tw[e]:Aw[e]:1===i?xw[e]:kw[e];const n=this.channels[i];return!!n&&(n.setPAC(this.interpretPAC(r,t)),this.currentChannel=i,!0)}interpretPAC(e,t){let r;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,i.underline=!(1&~r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i}parseChars(e,t){let r,i=null,n=null;if(e>=25?(r=2,n=e-8):(r=1,n=e),n>=17&&n<=19){let e;e=17===n?t+80:18===n?t+112:t+144,this.logger.log(2,()=>"Special char '"+Ew(e)+"' in channel "+r),i=[e]}else e>=32&&e<=127&&(i=0===t?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+Rw(i).join(",")),i}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let r;const i={};16===e||24===e?(r=Math.floor((t-32)/2),i.background=Lw[r],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));const n=e<=23?1:2;return this.channels[n].setBkgData(i),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Nw(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const r=this.channels[t];r&&r.cueSplitAtTime(e)}}}function Nw(e,t,r){r.a=e,r.b=t}function Fw(e,t,r){return r.a===e&&r.b===t}var $w=function(){if(null!=Zg&&Zg.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function r(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const r=t.toLowerCase();return!!~e.indexOf(r)&&r}function i(e){return r(t,e)}function n(e,...t){let r=1;for(;r<arguments.length;r++){const t=arguments[r];for(const r in t)e[r]=t[r]}return e}function s(t,s,a){const o=this,l={enumerable:!0};o.hasBeenReset=!1;let d="",c=!1,u=t,h=s,f=a,p=null,m="",g=!0,v="auto",y="start",b=50,E="middle",w=50,S="middle";Object.defineProperty(o,"id",n({},l,{get:function(){return d},set:function(e){d=""+e}})),Object.defineProperty(o,"pauseOnExit",n({},l,{get:function(){return c},set:function(e){c=!!e}})),Object.defineProperty(o,"startTime",n({},l,{get:function(){return u},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");u=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",n({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",n({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",n({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",n({},l,{get:function(){return m},set:function(t){const i=function(t){return r(e,t)}(t);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");m=i,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",n({},l,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",n({},l,{get:function(){return v},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",n({},l,{get:function(){return y},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",n({},l,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",n({},l,{get:function(){return E},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",n({},l,{get:function(){return w},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");w=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",n({},l,{get:function(){return S},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),o.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class Bw{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Uw(e){function t(e,t,r,i){return 3600*(0|e)+60*(0|t)+(0|r)+parseFloat(i||0)}const r=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?t(r[2],r[3],0,r[4]):t(r[1],r[2],r[3],r[4]):null}class zw{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,r){for(let i=0;i<r.length;++i)if(t===r[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const r=parseFloat(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1}}function Gw(e,t,r,i){const n=i?e.split(i):[e];for(const e in n){if("string"!=typeof n[e])continue;const i=n[e].split(r);if(2!==i.length)continue;t(i[0],i[1])}}const jw=new $w(0,0,""),Hw="middle"===jw.align?"middle":"center";function Vw(e,t,r){const i=e;function n(){const t=Uw(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function s(){e=e.replace(/^\s+/,"")}if(s(),t.startTime=n(),s(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.slice(3),s(),t.endTime=n(),s(),function(e,t){const i=new zw;Gw(e,function(e,t){let n;switch(e){case"region":for(let n=r.length-1;n>=0;n--)if(r[n].id===t){i.set(e,r[n].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":n=t.split(","),i.integer(e,n[0]),i.percent(e,n[0])&&i.set("snapToLines",!1),i.alt(e,n[0],["auto"]),2===n.length&&i.alt("lineAlign",n[1],["start",Hw,"end"]);break;case"position":n=t.split(","),i.percent(e,n[0]),2===n.length&&i.alt("positionAlign",n[1],["start",Hw,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",Hw,"end","left","right"])}},/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");let n=i.get("line","auto");"auto"===n&&-1===jw.line&&(n=-1),t.line=n,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",Hw);let s=i.get("position","auto");"auto"===s&&50===jw.position&&(s="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=s}(e,t)}function Ww(e){return e.replace(/<br(?: \/)?>/gi,"\n")}class Yw{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Bw,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function r(){let e=t.buffer,r=0;for(e=Ww(e);r<e.length&&"\r"!==e[r]&&"\n"!==e[r];)++r;const i=e.slice(0,r);return"\r"===e[r]&&++r,"\n"===e[r]&&++r,t.buffer=e.slice(r),i}function i(e){Gw(e,function(e,t){},/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{let e="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;e=r();const i=e.match(/^()?WEBVTT([ \t].*)?$/);if(null==i||!i[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let n=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(n?n=!1:e=r(),t.state){case"HEADER":/:/.test(e)?i(e):e||(t.state="ID");continue;case"NOTE":e||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(e)){t.state="NOTE";break}if(!e)continue;if(t.cue=new $w(0,0,""),t.state="CUE",-1===e.indexOf("--\x3e")){t.cue.id=e;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Vw(e,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const r=-1!==e.indexOf("--\x3e");if(!e||r&&(n=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=e}continue;case"BADCUE":e||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state||"BADWEBVTT"===e.state)throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const Kw=/\r\n|\n\r|\n|\r/g,qw=function(e,t,r=0){return e.slice(r,r+t.length)===t};function Xw(e,t,r){return iw(e.toString())+iw(t.toString())+iw(r)}function Qw(e,t,r,i,n,s,a){const o=new Yw,l=ap(new Uint8Array(e)).trim().replace(Kw,"\n").split("\n"),d=[],c=t?function(e,t=1){return Eb(e,9e4,1/t)}(t.baseTime,t.timescale):0;let u,h="00:00.000",f=0,p=0,m=!0;o.oncue=function(e){const s=r[i];let a=r.ccOffset;const o=(f-c)/9e4;if(null!=s&&s.new&&(void 0!==p?a=r.ccOffset=s.start:function(e,t,r){let i=e[t],n=e[i.prevCC];if(!n||!n.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;null!=(s=n)&&s.new;){var s;e.ccOffset+=i.start-n.start,i.new=!1,i=n,n=e[i.prevCC]}e.presentationOffset=r}(r,i,o)),o){if(!t)return void(u=new Error("Missing initPTS for VTT MPEGTS"));a=o-r.presentationOffset}const l=e.endTime-e.startTime,h=Ib(9e4*(e.startTime+a-p),9e4*n)/9e4;e.startTime=Math.max(h,0),e.endTime=Math.max(h+l,0);const m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=Xw(e.startTime,e.endTime,m)),e.endTime>0&&d.push(e)},o.onparsingerror=function(e){u=e},o.onflush=function(){u?a(u):s(d)},l.forEach(e=>{if(m){if(qw(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach(e=>{qw(e,"LOCAL:")?h=e.slice(6):qw(e,"MPEGTS:")&&(f=parseInt(e.slice(7)))});try{p=function(e){let t=parseInt(e.slice(-3));const r=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(Cf(t)&&Cf(r)&&Cf(i)&&Cf(n)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*r,t+=6e4*i,t+=36e5*n,t}(h)/1e3}catch(e){u=e}return}""===e&&(m=!1)}o.parse(e+"\n")}),o.flush()}const Zw="stpp.ttml.im1t",Jw=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,eS=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,tS={left:"start",center:"center",right:"end",start:"start",end:"end"};function rS(e,t,r,i){const n=Mp(new Uint8Array(e),["mdat"]);if(0===n.length)return void i(new Error("Could not parse IMSC1 mdat"));const s=n.map(e=>ap(e)),a=function(e,t,r=1,i=!1){return Eb(e,t,1/r,i)}(t.baseTime,1,t.timescale);try{s.forEach(e=>r(function(e,t){const r=(new DOMParser).parseFromString(e,"text/xml"),i=r.getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(n).reduce((e,t)=>(e[t]=i.getAttribute(`ttp:${t}`)||n[t],e),{}),a="preserve"!==i.getAttribute("xml:space"),o=nS(iS(i,"styling","style")),l=nS(iS(i,"layout","region")),d=iS(i,"body","[begin]");return[].map.call(d,e=>{const r=sS(e,a);if(!r||!e.hasAttribute("begin"))return null;const i=lS(e.getAttribute("begin"),s),n=lS(e.getAttribute("dur"),s);let d=lS(e.getAttribute("end"),s);if(null===i)throw oS(e);if(null===d){if(null===n)throw oS(e);d=i+n}const c=new $w(i-t,d-t,r);c.id=Xw(c.startTime,c.endTime,c.text);const u=function(e,t,r){const i="http://www.w3.org/ns/ttml#styling";let n=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;a&&r.hasOwnProperty(a)&&(n=r[a]);return s.reduce((r,s)=>{const a=aS(t,i,s)||aS(e,i,s)||aS(n,i,s);return a&&(r[s]=a),r},{})}(l[e.getAttribute("region")],o[e.getAttribute("style")],o),{textAlign:h}=u;if(h){const e=tS[h];e&&(c.lineAlign=e),c.align=h}return Kf(c,u),c}).filter(e=>null!==e)}(e,a)))}catch(e){i(e)}}function iS(e,t,r){const i=e.getElementsByTagName(t)[0];return i?[].slice.call(i.querySelectorAll(r)):[]}function nS(e){return e.reduce((e,t)=>{const r=t.getAttribute("xml:id");return r&&(e[r]=t),e},{})}function sS(e,t){return[].slice.call(e.childNodes).reduce((e,r,i)=>{var n;return"br"===r.nodeName&&i?e+"\n":null!=(n=r.childNodes)&&n.length?sS(r,t):t?e+r.textContent.trim().replace(/\s+/g," "):e+r.textContent},"")}function aS(e,t,r){return e&&e.hasAttributeNS(t,r)?e.getAttributeNS(t,r):null}function oS(e){return new Error(`Could not parse ttml timestamp ${e}`)}function lS(e,t){if(!e)return null;let r=Uw(e);return null===r&&(Jw.test(e)?r=function(e,t){const r=Jw.exec(e),i=(0|r[4])+(0|r[5])/t.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+i/t.frameRate}(e,t):eS.test(e)&&(r=function(e,t){const r=eS.exec(e),i=Number(r[1]);switch(r[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}(e,t))),r}class dS{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,r){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function cS(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function uS(e,t){return!!e&&e.kind===cS(t)&&Hb(t,e)}function hS(e,t,r,i){return Math.min(t,i)-Math.max(e,r)}const fS=/\s/,pS={newCue(e,t,r,i){const n=[];let s,a,o,l,d;const c=self.VTTCue||self.TextTrackCue;for(let h=0;h<i.rows.length;h++)if(s=i.rows[h],o=!0,l=0,d="",!s.isEmpty()){var u;for(let e=0;e<s.chars.length;e++)fS.test(s.chars[e].uchar)&&o?l++:(d+=s.chars[e].uchar,o=!1);s.cueStartTime=t,t===r&&(r+=1e-4),l>=16?l--:l++;const i=Ww(d.trim()),f=Xw(t,r,i);null!=e&&null!=(u=e.cues)&&u.getCueById(f)||(a=new c(t,r,i),a.id=f,a.line=h+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),n.push(a))}return e&&n.length&&(n.sort((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),n.forEach(t=>JE(e,t))),n}};const mS=/(\d+)-(\d+)\/(\d+)/;class gS{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||vS,this.controller=new self.AbortController,this.stats=new yp}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,r){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const n=function(e,t){const r={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(Kf({},e.headers))};e.rangeEnd&&r.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return r}(e,this.controller.signal),s="arraybuffer"===e.responseType,a=s?"byteLength":"length",{maxTimeToFirstByteMs:o,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=o&&Cf(o)?o:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},t.timeout);(Nb(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(r=>{var n;this.response=this.loader=r;const a=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},l-(a-i.loading.start)),!r.ok){const{status:e,statusText:t}=r;throw new yS(t||"fetch, bad network response",e,r)}i.loading.first=a,i.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=mS.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(Cf(e))return e}const r=e.get("Content-Length");if(r)return parseInt(r)}(r.headers)||i.total;const o=null==(n=this.callbacks)?void 0:n.onProgress;return o&&Cf(t.highWaterMark)?this.loadProgressively(r,i,e,t.highWaterMark,o):s?r.arrayBuffer():"json"===e.responseType?r.json():r.text()}).then(r=>{var n,s;const o=this.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const l=r[a];l&&(i.loaded=i.total=l);const d={url:o.url,data:r,code:o.status},c=null==(n=this.callbacks)?void 0:n.onProgress;c&&!Cf(t.highWaterMark)&&c(i,e,r,o),null==(s=this.callbacks)||s.onSuccess(d,i,e,o)}).catch(t=>{var r;if(self.clearTimeout(this.requestTimeout),i.aborted)return;const n=t&&t.code||0,s=t?t.message:null;null==(r=this.callbacks)||r.onError({code:n,text:s},e,t?t.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,r,i=0,n){const s=new uy,a=e.body.getReader(),o=()=>a.read().then(a=>{if(a.done)return s.dataLength&&n(t,r,s.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const l=a.value,d=l.length;return t.loaded+=d,d<i||s.dataLength?(s.push(l),s.dataLength>=i&&n(t,r,s.flush().buffer,e)):n(t,r,l.buffer,e),o()}).catch(()=>Promise.reject());return o()}}function vS(e,t){return new self.Request(e.url,t)}class yS extends Error{constructor(e,t,r){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=r}}const bS=/^age:\s*[\d.]+\s*$/im;class ES{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new yp,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const r=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(this.loader===r&&!this.stats.aborted)return n(r,t.url)}).catch(e=>{if(this.loader===r&&!this.stats.aborted)return r.open("GET",t.url,!0),n(r,t.url)}).then(()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,t,e)}).catch(e=>{var n;null==(n=this.callbacks)||n.onError({code:r.status,text:e.message},t,r,i)}):this.openAndSendXhr(r,t,e)}openAndSendXhr(e,t,r){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:s}=r.loadPolicy;if(i)for(const t in i)e.setRequestHeader(t,i[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),r.timeout=n&&Cf(n)?n:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:r}=this;if(!e||!t)return;const i=t.readyState,n=this.config;if(!r.aborted&&i>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const i=t.status,l="text"===t.responseType?t.responseText:null;if(i>=200&&i<300){const n=null!=l?l:t.response;if(null!=n){var s,a;r.loading.end=Math.max(self.performance.now(),r.loading.first);const o="arraybuffer"===t.responseType?n.byteLength:n.length;r.loaded=r.total=o,r.bwEstimate=8e3*r.total/(r.loading.end-r.loading.first);const l=null==(s=this.callbacks)?void 0:s.onProgress;l&&l(r,e,n,t);const d={url:t.responseURL,data:n,code:i};return void(null==(a=this.callbacks)||a.onSuccess(d,r,e,t))}}const d=n.loadPolicy.errorRetry;var o;if(Zm(d,r.retry,!1,{url:e.url,data:void 0,code:i}))this.retry(d);else ip.error(`${i} while loading ${e.url}`),null==(o=this.callbacks)||o.onError({code:i,text:t.statusText},e,t,r)}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(Zm(e,this.stats.retry,!0))this.retry(e);else{var t;ip.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:r}=this;this.retryDelay=Xm(e,r.retry),r.retry++,ip.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${r.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&bS.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const wS=Xf(Xf({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:6e7,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:ES,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends Qf{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{var t;const{fragCurrent:r,partCurrent:i,hls:n}=this,{autoLevelEnabled:s,media:a}=n;if(!r||!a)return;const o=performance.now(),l=i?i.stats:r.stats,d=i?i.duration:r.duration,c=o-l.loading.start,u=n.minAutoLevel,h=r.level,f=this._nextAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||h<=u)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!s)return;const p=f>-1&&f!==h,m=!!e||p;if(!m&&(a.paused||!a.playbackRate||!a.readyState))return;const g=n.mainForwardBufferInfo;if(!m&&null===g)return;const v=this.bwEstimator.getEstimateTTFB(),y=Math.abs(a.playbackRate);if(c<=Math.max(v,d/(2*y)*1e3))return;const b=g?g.len/y:0,E=l.loading.first?l.loading.first-l.loading.start:-1,w=l.loaded&&E>-1,S=this.getBwEstimate(),T=n.levels,x=T[h],A=Math.max(l.loaded,Math.round(d*(r.bitrate||x.averageBitrate)/8));let k=w?c-E:c;k<1&&w&&(k=Math.min(c,8*l.loaded/S));const L=w?1e3*l.loaded/k:0,I=v/1e3,R=L?(A-l.loaded)/L:8*A/S+I;if(R<=b)return;const P=L?8*L:S,D=!0===(null==(t=(null==e?void 0:e.details)||this.hls.latestLevelDetails)?void 0:t.live),C=this.hls.config.abrBandWidthUpFactor;let _,O=Number.POSITIVE_INFINITY;for(_=h-1;_>u;_--){const e=T[_].maxBitrate,t=!T[_].details||D;if(O=this.getTimeToLoadFrag(I,P,d*e,t),O<Math.min(b,d+I))break}if(O>=R)return;if(O>10*d)return;w?this.bwEstimator.sample(c-Math.min(v,E),l.loaded):this.bwEstimator.sampleTTFB(c);const M=T[_].maxBitrate;this.getBwEstimate()*C>M&&this.resetEstimator(M);const N=this.findBestLevel(M,u,_,0,b,1,1);N>-1&&(_=N),this.warn(`Fragment ${r.sn}${i?" part "+i.index:""} of level ${h} is loading too slowly;\n Fragment duration: ${r.duration.toFixed(3)}\n Time to underbuffer: ${b.toFixed(3)} s\n Estimated load time for current fragment: ${R.toFixed(3)} s\n Estimated load time for down switch fragment: ${O.toFixed(3)} s\n TTFB estimate: ${0|E} ms\n Current BW estimate: ${Cf(S)?0|S:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${_} @ ${0|M} bps`),n.nextLoadLevel=n.nextAutoLevel=_,this.clearTimer();const F=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===_&&_>0){const e=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${_>0?"and switching down":""}\n Fragment duration: ${r.duration.toFixed(3)} s\n Time to underbuffer: ${e.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,_>u){let t=this.findBestLevel(this.hls.levels[u].bitrate,u,_,0,e,1,1);-1===t&&(t=u),this.hls.nextLoadLevel=this.hls.nextAutoLevel=t,this.resetEstimator(this.hls.levels[t].bitrate)}}};p||R>2*O?F():this.timer=self.setInterval(F,1e3*O),n.trigger(Ff.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:i,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new Wf(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.FRAG_LOADING,this.onFragLoading,this),e.on(Ff.FRAG_LOADED,this.onFragLoaded,this),e.on(Ff.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Ff.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Ff.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(Ff.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.FRAG_LOADING,this.onFragLoading,this),e.off(Ff.FRAG_LOADED,this.onFragLoaded,this),e.off(Ff.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Ff.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Ff.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(Ff.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const r=t.frag;if(!this.ignoreFragment(r)){var i;if(!r.bitrateTest)this.fragCurrent=r,this.partCurrent=null!=(i=t.part)?i:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case Nf.BUFFER_ADD_CODEC_ERROR:case Nf.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Nf.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:r,partCurrent:i}=this;if(e&&r&&e.sn===r.sn&&e.level===r.level){const t=performance.now(),r=i?i.stats:e.stats,n=t-r.loading.start,s=r.loading.first?r.loading.first-r.loading.start:-1;if(r.loaded&&s>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(n-Math.min(e,s),r.loaded)}else this.bwEstimator.sampleTTFB(n)}break}}}getTimeToLoadFrag(e,t,r,i){return e+r/t+(i?e+this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const r=this.hls.config,{loading:i}=t.stats,n=i.end-i.first;Cf(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:r}){const i=r?r.stats:t.stats;if(t.type===Gf&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=r?r.duration:t.duration,n=this.hls.levels[t.level],s=(n.loaded?n.loaded.bytes:0)+i.loaded,a=(n.loaded?n.loaded.duration:0)+e;n.loaded={bytes:s,duration:a},n.realBitrate=Math.round(8*s/a)}if(t.bitrateTest){const e={stats:i,frag:t,part:r,id:t.type};this.onFragBuffered(Ff.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:r,part:i}=t,n=null!=i&&i.stats.loaded?i.stats:r.stats;if(n.aborted)return;if(this.ignoreFragment(r))return;const s=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,n.loaded),n.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Gf||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,r=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,n=this.findBestLevel(r,t,e,0,i,1,1);if(n>-1)return n;const s=this.hls.firstLevel,a=Math.min(Math.max(s,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const i=t&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,i)&&t[e].loadError<=t[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:r}=this;if(r.levels.length<=1)return r.loadLevel;const{maxAutoLevel:i,config:n,minAutoLevel:s}=r,a=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay();let d=n.abrBandWidthFactor,c=n.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(o,s,i,l,0,d,c);if(e>=0)return this.rebufferNotice=-1,e}let u=a?Math.min(a,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){u=(a?Math.min(a,n.maxLoadingDelay):n.maxLoadingDelay)-e,this.info(`bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*u)} ms`),d=c=1}}const h=this.findBestLevel(o,s,i,l,u,d,c);if(this.rebufferNotice!==h&&(this.rebufferNotice=h,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${h}`)),h>-1)return h;const f=r.levels[s],p=r.loadLevelObj;return p&&(null==f?void 0:f.bitrate)<p.bitrate?s:r.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const r=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/r}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,r,i,n,s,a){var o;const l=i+n,d=this.lastLoadedFragLevel,c=-1===d?this.hls.firstLevel:d,{fragCurrent:u,partCurrent:h}=this,{levels:f,allAudioTracks:p,loadLevel:m,config:g}=this.hls;if(1===f.length)return 0;const v=f[c],y=!(null==(o=this.hls.latestLevelDetails)||!o.live),b=-1===m||-1===d;let E,w="SDR",S=(null==v?void 0:v.frameRate)||0;const{audioPreference:T,videoPreference:x}=g,A=this.audioTracksByGroup||(this.audioTracksByGroup=Om(p));let k=-1;if(b){if(-1!==this.firstSelection)return this.firstSelection;const i=this.codecTiers||(this.codecTiers=function(e,t,r,i){return e.slice(r,i+1).reduce((e,r,i)=>{if(!r.codecSet)return e;const n=r.audioGroups;let s=e[r.codecSet];s||(e[r.codecSet]=s={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:i,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),s.minBitrate=Math.min(s.minBitrate,r.bitrate);const a=Math.min(r.height,r.width);return s.minHeight=Math.min(s.minHeight,a),s.minFramerate=Math.min(s.minFramerate,r.frameRate),s.minIndex=Math.min(s.minIndex,i),s.maxScore=Math.max(s.maxScore,r.score),s.fragmentError+=r.fragmentError,s.videoRanges[r.videoRange]=(s.videoRanges[r.videoRange]||0)+1,n&&n.forEach(e=>{if(!e)return;const r=t.groups[e];r&&(s.hasDefaultAudio=s.hasDefaultAudio||t.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(r.channels).forEach(e=>{s.channels[e]=(s.channels[e]||0)+r.channels[e]}))}),e},{})}(f,A,t,r)),n=function(e,t,r,i,n){const s=Object.keys(e),a=null==i?void 0:i.channels,o=null==i?void 0:i.audioCodec,l=null==n?void 0:n.videoCodec,d=a&&2===parseInt(a);let c=!1,u=!1,h=1/0,f=1/0,p=1/0,m=1/0,g=0,v=[];const{preferHDR:y,allowedVideoRanges:b}=Dm(t,n);for(let t=s.length;t--;){const r=e[s[t]];c||(c=r.channels[2]>0),h=Math.min(h,r.minHeight),f=Math.min(f,r.minFramerate),p=Math.min(p,r.minBitrate),b.filter(e=>r.videoRanges[e]>0).length>0&&(u=!0)}h=Cf(h)?h:0,f=Cf(f)?f:0;const E=Math.max(1080,h),w=Math.max(30,f);p=Cf(p)?p:r,r=Math.max(p,r),u||(t=void 0);const S=s.length>1;return{codecSet:s.reduce((t,i)=>{const n=e[i];if(i===t)return t;if(v=u?b.filter(e=>n.videoRanges[e]>0):[],S){if(n.minBitrate>r)return _m(i,`min bitrate of ${n.minBitrate} > current estimate of ${r}`),t;if(!n.hasDefaultAudio)return _m(i,"no renditions with default or auto-select sound found"),t;if(o&&i.indexOf(o.substring(0,4))%5!=0)return _m(i,`audio codec preference "${o}" not found`),t;if(a&&!d){if(!n.channels[a])return _m(i,`no renditions with ${a} channel sound found (channels options: ${Object.keys(n.channels)})`),t}else if((!o||d)&&c&&0===n.channels[2])return _m(i,"no renditions with stereo sound found"),t;if(n.minHeight>E)return _m(i,`min resolution of ${n.minHeight} > maximum of ${E}`),t;if(n.minFramerate>w)return _m(i,`min framerate of ${n.minFramerate} > maximum of ${w}`),t;if(!v.some(e=>n.videoRanges[e]>0))return _m(i,`no variants with VIDEO-RANGE of ${Cm(v)} found`),t;if(l&&i.indexOf(l.substring(0,4))%5!=0)return _m(i,`video codec preference "${l}" not found`),t;if(n.maxScore<g)return _m(i,`max score of ${n.maxScore} < selected max of ${g}`),t}return t&&(am(i)>=am(t)||n.fragmentError>e[t].fragmentError)?t:(m=n.minIndex,g=n.maxScore,i)},void 0),videoRanges:v,preferHDR:y,minFramerate:f,minBitrate:p,minIndex:m}}(i,w,e,T,x),{codecSet:s,videoRanges:a,minFramerate:o,minBitrate:l,minIndex:d,preferHDR:c}=n;k=d,E=s,w=c?a[a.length-1]:a[0],S=o,e=Math.max(e,l),this.log(`picked start tier ${Cm(n)}`)}else E=null==v?void 0:v.codecSet,w=null==v?void 0:v.videoRange;const L=h?h.duration:u?u.duration:0,I=this.bwEstimator.getEstimateTTFB()/1e3,R=[];for(let o=r;o>=t;o--){var P;const t=f[o],u=o>c;if(!t)continue;if(g.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const r=navigator.mediaCapabilities;"function"==typeof(null==r?void 0:r.decodingInfo)&&ym(t,A,w,S,e,T)?(t.supportedPromise=bm(t,A,r,this.supportedCache),t.supportedPromise.then(e=>{if(!this.hls)return;t.supportedResult=e;const r=this.hls.levels,i=r.indexOf(t);e.error?this.warn(`MediaCapabilities decodingInfo error: "${e.error}" for level ${i} ${Cm(e)}`):e.supported?e.decodingInfoResults.some(e=>!1===e.smooth||!1===e.powerEfficient)&&this.log(`MediaCapabilities decodingInfo for level ${i} not smooth or powerEfficient: ${Cm(e)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${i} ${Cm(e)}`),i>-1&&r.length>1&&(this.log(`Removing unsupported level ${i}`),this.hls.removeLevel(i),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))}).catch(e=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${e}`)})):t.supportedResult=gm}if((E&&t.codecSet!==E||w&&t.videoRange!==w||u&&S>t.frameRate||!u&&S>0&&S<t.frameRate||null!=(P=t.supportedResult)&&null!=(P=P.decodingInfoResults)&&P.some(e=>!1===e.smooth))&&(!b||o!==k)){R.push(o);continue}const p=t.details,v=(h?null==p?void 0:p.partTarget:null==p?void 0:p.averagetargetduration)||L;let x;x=u?a*e:s*e;const D=L&&i>=2*L&&0===n?t.averageBitrate:t.maxBitrate,C=this.getTimeToLoadFrag(I,x,D*v,void 0===p);if(x>=D&&(o===d||0===t.loadError&&0===t.fragmentError)&&(C<=I||!Cf(C)||y&&!this.bitrateTestDelay||C<l)){const e=this.forcedAutoLevel;return o===m||-1!==e&&e===m||(R.length&&this.trace(`Skipped level(s) ${R.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${f[R[0]].codecs}" ${f[R[0]].videoRange}; not compatible with "${E}" ${w}`),this.info(`switch candidate:${c}->${o} adjustedbw(${Math.round(x)})-bitrate=${Math.round(x-D)} ttfb:${I.toFixed(1)} avgDuration:${v.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${C.toFixed(1)} firstSelection:${b} codecSet:${t.codecSet} videoRange:${t.videoRange} hls.loadLevel:${m}`)),b&&(this.firstSelection=o),o}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:r}=this.hls;return Math.min(Math.max(e,r),t)}},bufferController:class extends Qf{constructor(e,t){var r;super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=e=>{var t;this.hls&&"open"===(null==(t=this.mediaSource)?void 0:t.readyState)&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{const{media:t,mediaSource:r}=this;e&&this.log("Media source opened"),t&&r&&(r.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(Ff.MEDIA_ATTACHED,{media:t,mediaSource:r}),null!==this.mediaSource&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&this.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=(r=np(e.config.preferManagedMediaSource),"undefined"!=typeof self&&r===self.ManagedMediaSource),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Ff.BUFFER_RESET,this.onBufferReset,this),e.on(Ff.BUFFER_APPENDING,this.onBufferAppending,this),e.on(Ff.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Ff.BUFFER_EOS,this.onBufferEos,this),e.on(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Ff.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Ff.FRAG_PARSED,this.onFragParsed,this),e.on(Ff.FRAG_CHANGED,this.onFragChanged,this),e.on(Ff.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Ff.BUFFER_RESET,this.onBufferReset,this),e.off(Ff.BUFFER_APPENDING,this.onBufferAppending,this),e.off(Ff.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Ff.BUFFER_EOS,this.onBufferEos,this),e.off(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Ff.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Ff.FRAG_PARSED,this.onFragParsed,this),e.off(Ff.FRAG_CHANGED,this.onFragChanged,this),e.off(Ff.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const r={};if(this.operationQueue){const e=this.isUpdating();e||this.operationQueue.removeBlockers();const t=this.isQueued();(e||t)&&this.warn(`Transfering MediaSource with${t?" operations in queue":""}${e?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===t?Kf(r,i.tracks):this.sourceBuffers.forEach(e=>{const[t]=e;t&&(r[t]=Kf({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null}),{media:e,mediaSource:t,tracks:r}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var r;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),null!=(r=this.transferData)&&r.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){const r=this.media=t.media;this.transferData=this.overrides=void 0;const i=np(this.appendSource);if(i){const e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const n=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(n),e)this._objectUrl=r.src,this.attachTransferred();else{const e=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{r.removeAttribute("src");const t=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||t&&n instanceof t,qb(r),function(e,t){const r=self.document.createElement("source");r.type="video/mp4",r.src=t,e.appendChild(r)}(r,e),r.load()}catch(t){r.src=e}else r.src=e}r.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,r;this.log(`${(null==(t=this.transferData)?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${null==(r=e.constructor)?void 0:r.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const r=this.tracks,i=t.tracks,n=i?Object.keys(i):null,s=n?n.length:0,a=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(i&&n&&s){if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})\nrequired tracks: ${Cm(r,(e,t)=>"initSegment"===e?void 0:t)};\ntransfer tracks: ${Cm(i,(e,t)=>"initSegment"===e?void 0:t)}}`),!sp(i,r)){t.mediaSource=null,t.tracks=void 0;const n=e.currentTime,s=this.details,a=Math.max(n,(null==s?void 0:s.fragments[0].start)||0);return a-n>1?void this.log(`attachTransferred: waiting for playback to reach new tracks start time ${n} -> ${a}`):(this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(r)}") start time: ${a} currentTime: ${n}`),this.onMediaDetaching(Ff.MEDIA_DETACHING,{}),this.onMediaAttaching(Ff.MEDIA_ATTACHING,t),void(e.currentTime=a))}this.transferData=void 0,n.forEach(e=>{const t=e,r=i[t];if(r){const e=r.buffer;if(e){const i=this.fragmentTracker,n=r.id;if(i.hasFragments(n)||i.hasParts(n)){const r=Dg.getBuffered(e);i.detectEvictedFragments(t,r,n,null,!0)}const s=Xb(t),a=[t,e];this.sourceBuffers[s]=a,e.updating&&this.operationQueue&&this.operationQueue.prependBlocker(t),this.trackSourceBuffer(t,r)}}}),a(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),a()}get mediaSourceOpenOrEnded(){var e;const t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}onMediaDetaching(e,t){const r=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:n,_objectUrl:s}=this;if(n){if(this.log("media source "+(r?"transferring":"detaching")),r)this.sourceBuffers.forEach(([e])=>{e&&this.removeBuffer(e)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const e="open"===n.readyState;try{const t=n.sourceBuffers;for(let r=t.length;r--;)e&&t[r].abort(),n.removeSourceBuffer(t[r]);e&&n.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}i&&(i.removeEventListener("emptied",this._onMediaEmptied),r||(s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(i.removeAttribute("src"),this.appendSource&&qb(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(Ff.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const r=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),r)try{var i;null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(t){this.warn(`onBufferReset ${e}`,t)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Xb(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Vb(this.tracks)}onBufferCodecs(e,t){var r;const i=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),a=!s&&this.sourceBufferCount&&this.media&&n.some(e=>!i[e]);s||a?this.warn(`Unsupported transition between "${Object.keys(i)}" and "${n}" SourceBuffers`):(n.forEach(e=>{var r,n;const s=t[e],{id:a,codec:o,levelCodec:l,container:d,metadata:c,supplemental:u}=s;let h=i[e];const f=null==(r=this.transferData)||null==(r=r.tracks)?void 0:r[e],p=null!=f&&f.buffer?f:h,m=(null==p?void 0:p.pendingCodec)||(null==p?void 0:p.codec),g=null==p?void 0:p.levelCodec;h||(h=i[e]={buffer:void 0,listeners:[],codec:o,supplemental:u,container:d,levelCodec:l,metadata:c,id:a});const v=cm(m,g),y=null==v?void 0:v.replace(Wb,"$1");let b=cm(o,l);const E=null==(n=b)?void 0:n.replace(Wb,"$1");b&&v&&y!==E&&("audio"===e.slice(0,5)&&(b=dm(b,this.appendSource)),this.log(`switching codec ${m} to ${b}`),b!==(h.pendingCodec||h.codec)&&(h.pendingCodec=b),h.container=d,this.appendChangeType(e,d,b))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&"main"===(null==(r=t.audio)?void 0:r.id)&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks()))}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const r=this.tracks[t];return e[t]={id:r.id,container:r.container,codec:r.codec,levelCodec:r.levelCodec},e},{})}appendChangeType(e,t,r){const i=`${t};codecs=${r}`,n={label:`change-type=${i}`,execute:()=>{const n=this.tracks[e];if(n){const s=n.buffer;null!=s&&s.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),s.changeType(i),n.codec=r,n.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};this.append(n,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const r=e.start,i=r+.05*e.duration;if(!0===(null==(t=this.fragmentTracker.getAppendedFrag(r,Gf))?void 0:t.gap))return;const n={label:"block-audio",execute:()=>{var e;const t=this.tracks.video;(this.lastVideoAppendEnd>i||null!=t&&t.buffer&&Dg.isBuffered(t.buffer,i)||!0===(null==(e=this.fragmentTracker.getAppendedFrag(i,Gf))?void 0:e.gap))&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn("Error executing block-audio operation",e)}};this.blockedAudioAppend={op:n,frag:e},this.append(n,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:r}=this,{data:i,type:n,parent:s,frag:a,part:o,chunkMeta:l,offset:d}=t,c=l.buffering[n],{sn:u,cc:h}=a,f=self.performance.now();c.start=f;const p=a.stats.buffering,m=o?o.stats.buffering:null;0===p.start&&(p.start=f),m&&0===m.start&&(m.start=f);const g=r.audio;let v=!1;"audio"===n&&"audio/mpeg"===(null==g?void 0:g.container)&&(v=!this.lastMpegAudioChunk||1===l.id||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);const y=r.video,b=null==y?void 0:y.buffer;if(b&&"initSegment"!==u){const e=o||a,t=this.blockedAudioAppend;if("audio"!==n||"main"===s||this.blockedAudioAppend||y.ending||y.ended){if("video"===n){const r=e.end;if(t){const e=t.frag.start;(r>e||r<this.lastVideoAppendEnd||Dg.isBuffered(b,e))&&this.unblockAudio()}this.lastVideoAppendEnd=r}}else{const t=e.start+.05*e.duration,r=b.buffered,i=this.currentOp("video");r.length||i?!i&&!Dg.isBuffered(b,t)&&this.lastVideoAppendEnd<t&&this.blockAudio(e):this.blockAudio(e)}}const E=(o||a).start,w={label:`append-${n}`,execute:()=>{var e;c.executeStart=self.performance.now();const t=null==(e=this.tracks[n])?void 0:e.buffer;t&&(v?this.updateTimestampOffset(t,E,.1,n,u,h):void 0!==d&&Cf(d)&&this.updateTimestampOffset(t,d,1e-6,n,u,h)),this.appendExecutor(i,n)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();c.executeEnd=c.end=e,0===p.first&&(p.first=e),m&&0===m.first&&(m.first=e);const t={};this.sourceBuffers.forEach(([e,r])=>{e&&(t[e]=Dg.getBuffered(r))}),this.appendErrors[n]=0,"audio"===n||"video"===n?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(Ff.BUFFER_APPENDED,{type:n,frag:a,part:o,chunkMeta:l,parent:a.type,timeRanges:t})},onError:e=>{var t;const r={type:Mf.MEDIA_ERROR,parent:a.type,details:Nf.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:a,part:o,chunkMeta:l,error:e,err:e,fatal:!1},i=null==(t=this.media)?void 0:t.error;if(e.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==e.name||"quota"in e)r.details=Nf.BUFFER_FULL_ERROR;else if(e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!i)r.errorAction=lg(!0);else if(e.name===Yb&&0===this.sourceBufferCount)r.errorAction=lg(!0);else{const e=++this.appendErrors[n];this.warn(`Failed ${e}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${i||"no media error"})`),(e>=this.hls.config.appendErrorMaxRetry||i)&&(r.fatal=!0)}this.hls.trigger(Ff.ERROR,r)}};this.log(`queuing "${n}" append sn: ${u}${o?" p: "+o.index:""} of ${a.type===Gf?"level":"track"} ${a.level} cc: ${h}`),this.append(w,n,this.isPending(this.tracks[n]))}getFlushOp(e,t,r){return this.log(`queuing "${e}" remove ${t}-${r}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,r)},onStart:()=>{},onComplete:()=>{this.hls.trigger(Ff.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${t}-${r} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,t){const{type:r,startOffset:i,endOffset:n}=t;r?this.append(this.getFlushOp(r,i,n),r):this.sourceBuffers.forEach(([e])=>{e&&this.append(this.getFlushOp(e,i,n),e)})}onFragParsed(e,t){const{frag:r,part:i}=t,n=[],s=i?i.elementaryStreams:r.elementaryStreams;s[wp]?n.push("audiovideo"):(s[bp]&&n.push("audio"),s[Ep]&&n.push("video"));0===n.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${r.type} level: ${r.level} sn: ${r.sn}`),this.blockBuffers(()=>{const e=self.performance.now();r.stats.buffering.end=e,i&&(i.stats.buffering.end=e);const t=i?i.stats:r.stats;this.hls.trigger(Ff.FRAG_BUFFERED,{frag:r,part:i,stats:t,id:r.type})},n).catch(e=>{this.warn(`Fragment buffered callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var r;this.sourceBuffers.forEach(([e])=>{if(e){const r=this.tracks[e];t.type&&t.type!==e||(r.ending=!0,r.ended||(r.ended=!0,this.log(`${e} buffer reached EOS`)))}});const i=!1!==(null==(r=this.overrides)?void 0:r.endOfStream);this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t;return e&&!(null!=(t=this.tracks[e])&&t.ended)})?i?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream(),this.hls.trigger(Ff.BUFFERED_TO_END,void 0)):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)})):(this.tracksEnded(),this.hls.trigger(Ff.BUFFERED_TO_END,void 0)):"video"===t.type&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(null!==e){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===Nf.BUFFER_APPEND_ERROR&&t.frag){var r;const e=null==(r=t.errorAction)?void 0:r.nextAutoLevel;Cf(e)&&e!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:r}=this;if(!r||null===t)return;if(!this.sourceBufferCount)return;const i=e.config,n=r.currentTime,s=t.levelTargetDuration,a=t.live&&null!==i.liveBackBufferLength?i.liveBackBufferLength:i.backBufferLength;if(Cf(a)&&a>=0){const e=Math.max(a,s),t=Math.floor(n/s)*s-e;this.flushBackBuffer(n,s,t)}const o=i.frontBufferFlushThreshold;if(Cf(o)&&o>0){const e=Math.max(i.maxBufferLength,o),t=Math.max(e,s),r=Math.floor(n/s)*s+t;this.flushFrontBuffer(n,s,r)}}flushBackBuffer(e,t,r){this.sourceBuffers.forEach(([e,t])=>{if(t){const n=Dg.getBuffered(t);if(n.length>0&&r>n.start(0)){var i;this.hls.trigger(Ff.BACK_BUFFER_REACHED,{bufferEnd:r});const t=this.tracks[e];if(null!=(i=this.details)&&i.live)this.hls.trigger(Ff.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(null!=t&&t.ended)return void this.log(`Cannot flush ${e} back buffer while SourceBuffer is in ended state`);this.hls.trigger(Ff.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:e})}}})}flushFrontBuffer(e,t,r){this.sourceBuffers.forEach(([t,i])=>{if(i){const n=Dg.getBuffered(i),s=n.length;if(s<2)return;const a=n.start(s-1),o=n.end(s-1);if(r>a||e>=a&&e<=o)return;this.hls.trigger(Ff.BUFFER_FLUSHING,{startOffset:a,endOffset:1/0,type:t})}})}getDurationAndRange(){var e;const{details:t,mediaSource:r}=this;if(!t||!this.media||"open"!==(null==r?void 0:r.readyState))return null;const i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&r.setLiveSeekableRange){const e=Math.max(0,t.fragmentStart);return{duration:1/0,start:e,end:Math.max(e,i)}}return{duration:1/0}}const n=null==(e=this.overrides)?void 0:e.duration;if(n)return Cf(n)?{duration:n}:null;const s=this.media.duration;return i>(Cf(r.duration)?r.duration:0)&&i>s||!Cf(s)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:r}){const i=this.mediaSource;this.media&&i&&"open"===i.readyState&&(i.duration!==e&&(Cf(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),void 0!==t&&void 0!==r&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${r}.`),i.setLiveSeekableRange(t,r)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:r}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Cm(r)}`),this.tracksReady){var i;const e=null==(i=this.transferData)?void 0:i.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,r])=>{if(t){const i=this.tracks[t];e[t]={buffer:r,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(Ff.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([e])=>{this.executeNext(e)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:r}=this;if(!r)throw new Error("createSourceBuffers called when mediaSource was null");for(const n in e){const s=n,a=e[s];if(this.isPending(a)){const e=this.getTrackCodec(a,s),n=`${a.container};codecs=${e}`;a.codec=e,this.log(`creating sourceBuffer(${n})${this.currentOp(s)?" Queued":""} ${Cm(a)}`);try{const e=r.addSourceBuffer(n),i=Xb(s),o=[s,e];t[i]=o,a.buffer=e}catch(e){var i;return this.error(`error while trying to add sourceBuffer: ${e.message}`),this.shiftAndExecuteNext(s),null==(i=this.operationQueue)||i.removeBlockers(),delete this.tracks[s],void this.hls.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:s,mimeType:n,parent:a.id})}this.trackSourceBuffer(s,a)}}this.bufferCreated()}getTrackCodec(e,t){const r=e.supplemental;let i=e.codec;r&&("video"===t||"audiovideo"===t)&&rm(r,"video")&&(i=function(e,t){const r=[];if(e){const t=e.split(",");for(let e=0;e<t.length;e++)tm(t[e],"video")||r.push(t[e])}return t&&r.push(t),r.join(",")}(i,r));const n=cm(i,e.levelCodec);return n?"audio"===t.slice(0,5)?dm(n,this.appendSource):n:""}trackSourceBuffer(e,t){const r=t.buffer;if(!r)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:r,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(e,t)=>{const r=t.removedRanges;null!=r&&r.length&&this.hls.trigger(Ff.BUFFER_FLUSHED,{type:e})})}get mediaSrc(){var e,t;const r=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==r?void 0:r.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const r=this.currentOp(e);r&&(r.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var r;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(r=this.mediaSource)?void 0:r.readyState}`);this.error(`${i}`,t),this.hls.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const n=this.currentOp(e);n&&n.onError(i)}updateTimestampOffset(e,t,r,i,n,s){const a=t-e.timestampOffset;Math.abs(a)>=r&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${n} cc: ${s})`),e.timestampOffset=t)}removeExecutor(e,t,r){const{media:i,mediaSource:n}=this,s=this.tracks[e],a=null==s?void 0:s.buffer;if(!i||!n||!a)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void this.shiftAndExecuteNext(e);const o=Cf(i.duration)?i.duration:1/0,l=Cf(n.duration)?n.duration:1/0,d=Math.max(0,t),c=Math.min(r,o,l);c>d&&(!s.ending||s.ended)?(s.ended=!1,this.log(`Removing [${d},${c}] from the ${e} SourceBuffer`),a.remove(d,c)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const r=this.tracks[t],i=null==r?void 0:r.buffer;if(!i)throw new Kb(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);r.ending=!1,r.ended=!1,i.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(e=>{this.warn(`SourceBuffer blocked callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(e){this.warn(`Callback run without blocking ${this.operationQueue} ${e}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:r}=this,i=t.map(e=>this.appendBlocker(e));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(t=>{r===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(e=>{var t;const r=null==(t=this.tracks[e])?void 0:t.buffer;r&&!r.updating&&this.shiftAndExecuteNext(e)})}append(e,t,r){this.operationQueue&&this.operationQueue.append(e,t,r)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,r){const i=this.tracks[e];if(!i)return;const n=i.buffer;if(!n)return;const s=r.bind(this,e);i.listeners.push({event:t,listener:s}),n.addEventListener(t,s)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const r=t.buffer;r&&(t.listeners.forEach(e=>{r.removeEventListener(e.event,e.listener)}),t.listeners.length=0)}},capLevelController:Qb,errorController:class extends Qf{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(Ff.ERROR,this.onError,this),e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Ff.ERROR,this.onError,this),e.off(Ff.ERROR,this.onErrorOut,this),e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===Gf?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,r=t.currentLevel;return null!=(e=t.loadLevelObj)&&e.details||-1===r?t.loadLevel:r}variantHasKey(e,t){if(e){var r;if(null!=(r=e.details)&&r.hasKey(t))return!0;const i=e.audioGroups;if(i){return this.hls.allAudioTracks.filter(e=>i.indexOf(e.groupId)>=0).some(e=>{var r;return null==(r=e.details)?void 0:r.hasKey(t)})}}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var r;if(t.fatal)return;const i=this.hls,n=t.context;switch(t.details){case Nf.FRAG_LOAD_ERROR:case Nf.FRAG_LOAD_TIMEOUT:case Nf.KEY_LOAD_ERROR:case Nf.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case Nf.FRAG_PARSING_ERROR:if(null!=(r=t.frag)&&r.gap)return void(t.errorAction=lg());case Nf.FRAG_GAP:case Nf.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=tg);case Nf.LEVEL_EMPTY_ERROR:case Nf.LEVEL_PARSING_ERROR:{var s;const e=t.parent===Gf?t.level:i.loadLevel;t.details===Nf.LEVEL_EMPTY_ERROR&&null!=(s=t.context)&&null!=(s=s.levelDetails)&&s.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case Nf.LEVEL_LOAD_ERROR:case Nf.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level)));case Nf.AUDIO_TRACK_LOAD_ERROR:case Nf.AUDIO_TRACK_LOAD_TIMEOUT:case Nf.SUBTITLE_LOAD_ERROR:case Nf.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const e=i.loadLevelObj;if(e&&(n.type===Uf&&e.hasAudioGroup(n.groupId)||n.type===zf&&e.hasSubtitleGroup(n.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=tg,void(t.errorAction.flags=sg)}return;case Nf.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:return void(t.errorAction={action:tg,flags:ag});case Nf.KEY_SYSTEM_SESSION_UPDATE_FAILED:case Nf.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case Nf.KEY_SYSTEM_NO_SESSION:return void(t.errorAction={action:tg,flags:og});case Nf.BUFFER_ADD_CODEC_ERROR:case Nf.REMUX_ALLOC_ERROR:case Nf.BUFFER_APPEND_ERROR:var a;if(!t.errorAction)t.errorAction=this.getLevelSwitchAction(t,null!=(a=t.level)?a:i.loadLevel);return;case Nf.INTERNAL_EXCEPTION:case Nf.BUFFER_APPENDING_ERROR:case Nf.BUFFER_FULL_ERROR:case Nf.LEVEL_SWITCH_ERROR:case Nf.BUFFER_STALLED_ERROR:case Nf.BUFFER_SEEK_OVER_HOLE:case Nf.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=lg())}t.type===Mf.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=lg())}getPlaylistRetryOrSwitchAction(e,t){const r=qm(this.hls.config.playlistLoadPolicy,e),i=this.playlistError++;if(Zm(r,i,Wm(e),e.response))return{action:ig,flags:ng,retryConfig:r,retryCount:i};const n=this.getLevelSwitchAction(e,t);return r&&(n.retryConfig=r,n.retryCount=i),n}getFragRetryOrSwitchAction(e){const t=this.hls,r=this.getVariantLevelIndex(e.frag),i=t.levels[r],{fragLoadPolicy:n,keyLoadPolicy:s}=t.config,a=qm(Ym(e)?s:n,e),o=t.levels.reduce((e,t)=>e+t.fragmentError,0);if(i&&(e.details!==Nf.FRAG_GAP&&i.fragmentError++,!Km(e))){if(Zm(a,o,Wm(e),e.response))return{action:ig,flags:ng,retryConfig:a,retryCount:o}}const l=this.getLevelSwitchAction(e,r);return a&&(l.retryConfig=a,l.retryCount=o),l}getLevelSwitchAction(e,t){const r=this.hls;null==t&&(t=r.loadLevel);const i=this.hls.levels[t];if(i){var n,s;const t=e.details;i.loadError++,t===Nf.BUFFER_APPEND_ERROR&&i.fragmentError++;let l=-1;const{levels:d,loadLevel:c,minAutoLevel:u,maxAutoLevel:h}=r;r.autoLevelEnabled||r.config.preserveManualLevelOnError||(r.loadLevel=-1);const f=null==(n=e.frag)?void 0:n.type,p=(f===jf&&t===Nf.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===Nf.BUFFER_ADD_CODEC_ERROR||t===Nf.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:e})=>i.audioCodec!==e),m="video"===e.sourceBufferName&&(t===Nf.BUFFER_ADD_CODEC_ERROR||t===Nf.BUFFER_APPEND_ERROR)&&d.some(({codecSet:e,audioCodec:t})=>i.codecSet!==e&&i.audioCodec===t),{type:g,groupId:v}=null!=(s=e.context)?s:{};for(let r=d.length;r--;){const n=(r+c)%d.length;if(n!==c&&n>=u&&n<=h&&0===d[n].loadError){var a,o;const r=d[n];if(t===Nf.FRAG_GAP&&f===Gf&&e.frag){const t=d[n].details;if(t){const r=Gm(e.frag,t.fragments,e.frag.start);if(null!=r&&r.gap)continue}}else{if(g===Uf&&r.hasAudioGroup(v)||g===zf&&r.hasSubtitleGroup(v))continue;if(f===jf&&null!=(a=i.audioGroups)&&a.some(e=>r.hasAudioGroup(e))||f===Hf&&null!=(o=i.subtitleGroups)&&o.some(e=>r.hasSubtitleGroup(e))||p&&i.audioCodec===r.audioCodec||m&&i.codecSet===r.codecSet||!p&&i.codecSet!==r.codecSet)continue}l=n;break}}if(l>-1&&r.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:tg,flags:ng,nextAutoLevel:l}}return{action:tg,flags:sg}}onErrorOut(e,t){var r;switch(null==(r=t.errorAction)?void 0:r.action){case eg:break;case tg:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===Nf.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,r=e.errorAction;if(!r)return;const{flags:i}=r,n=r.nextAutoLevel;switch(i){case ng:this.switchLevel(e,n);break;case ag:{const i=this.getVariantLevelIndex(e.frag),n=t.levels[i],s=null==n?void 0:n.attrs["HDCP-LEVEL"];if(r.hdcpLevel=s,"NONE"===s)this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(s){t.maxHdcpLevel=Sm[Sm.indexOf(s)-1],r.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case og:{const t=e.decryptdata;if(t){const i=this.hls.levels,n=i.length;for(let r=n;r--;){var s,a;if(this.variantHasKey(i[r],t))this.log(`Banned key found in level ${r} (${i[r].bitrate}bps) or audio group "${null==(s=i[r].audioGroups)?void 0:s.join(",")}" (${null==(a=e.frag)?void 0:a.type} fragment) ${op(t.keyId||[])}`),i[r].fragmentError++,i[r].loadError++,this.log(`Removing level ${r} with key error (${e.error})`),this.hls.removeLevel(r)}const o=e.frag;if(this.hls.levels.length<n)r.resolved=!0;else if(o&&o.type!==Gf){const e=o.decryptdata;e&&!t.matches(e)&&(r.resolved=!0)}}break}}r.resolved||this.switchLevel(e,n)}switchLevel(e,t){if(void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===Nf.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&"audiovideo"!==e.sourceBufferName)){const t=pm(e.mimeType),r=this.hls.levels;for(let i=r.length;i--;)r[i][`${e.sourceBufferName}Codec`]===t&&(this.log(`Removing level ${i} for ${e.details} ("${t}" not supported)`),this.hls.removeLevel(i))}}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const r=this.hls.config;if(r.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,r){const i=performance.now();if(t){if(this.lastTime){const e=i-this.lastTime,n=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,a=1e3*n/e,o=this.hls;if(o.trigger(Ff.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:r}),a>0&&n>o.config.fpsDroppedMonitoringThreshold*s){let e=o.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=e)&&(e-=1,o.trigger(Ff.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:o.currentLevel}),o.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ov,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:pS,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends dy{constructor(e,t,r){super(e,t,r,"subtitle-stream-controller",Hf),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Ff.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Ff.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Ff.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Ff.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Ff.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Ff.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Ff.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Ff.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=Zv,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:r,success:i}=t;if(this.fragContextChanged(r)||(Tp(r)&&(this.fragPrevious=r),this.state=Zv),!i)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let s;const a=r.start;for(let e=0;e<n.length;e++)if(a>=n[e].start&&a<=n[e].end){s=n[e];break}const o=r.start+r.duration;s?s.end=o:(s={start:a,end:o},n.push(s)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:r,endOffset:i}=t;if(0===r&&i!==Number.POSITIVE_INFINITY){const e=i-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach(t=>{for(let r=0;r<t.length;)if(t[r].end<=e)t.shift();else{if(!(t[r].start<e))break;t[r].start=e,r++}}),this.fragmentTracker.removeFragmentsInRange(r,e,Hf)}}onError(e,t){const r=t.frag;(null==r?void 0:r.type)===Hf&&(t.details===Nf.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Qv&&(this.state=Zv))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){this.levels&&Gb(this.levels,t)?this.levels=t.map(e=>new Rm(e)):(this.tracksBuffered=[],this.levels=t.map(e=>{const t=new Rm(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Hf),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var r;if(this.currentTrackId=t.id,null==(r=this.levels)||!r.length||-1===this.currentTrackId)return void this.clearInterval();const i=this.levels[this.currentTrackId];null!=i&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==Qv&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var r;const{currentTrackId:i,levels:n}=this,{details:s,id:a}=t;if(!n)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const o=n[a];if(a>=n.length||!o)return;this.log(`Subtitle track ${a} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(s.live||null!=(r=o.details)&&r.live){if(s.deltaUpdateFailed)return;const e=this.mainDetails;if(!e)return void(this.startFragRequested=!1);const t=e.fragments[0];var d;if(o.details)l=this.alignPlaylists(s,o.details,null==(d=this.levelLastLoaded)?void 0:d.details),0===l&&t&&(l=t.start,Mv(s,l));else s.hasProgramDateTime&&e.hasProgramDateTime?(Yv(s,e),l=s.fragmentStart):t&&(l=t.start,Mv(s,l));e&&!this.startFragRequested&&this.setStartPosition(e,l)}if(o.details=s,this.levelLastLoaded=o,a===i&&(this.hls.trigger(Ff.SUBTITLE_TRACK_UPDATED,{details:s,id:a,groupId:t.groupId}),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===Zv)){Gm(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:r}=e,i=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&r&&r.byteLength>0&&null!=i&&i.key&&i.iv&&Wg(i.method)){const e=performance.now();this.decrypter.decrypt(new Uint8Array(r),i.key.buffer,i.iv.buffer,Yg(i.method)).catch(e=>{throw n.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e}).then(r=>{const i=performance.now();n.trigger(Ff.FRAG_DECRYPTED,{frag:t,payload:r,stats:{tstart:e,tdecrypt:i}})}).catch(e=>{this.warn(`${e.name}: ${e.message}`),this.state=Zv})}}doTick(){if(this.media){if(this.state===Zv){const{currentTrackId:e,levels:t}=this,r=null==t?void 0:t[e];if(!r||!t.length||!r.details)return;if(this.waitForLive(r))return;const{config:i}=this,n=this.getLoadPosition(),s=Dg.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,i.maxBufferHole),{end:a,len:o}=s,l=r.details;if(o>this.hls.maxBufferLength+l.levelTargetDuration)return;const d=l.fragments,c=d.length,u=l.edge;let h=null;const f=this.fragPrevious;if(a<u){const e=i.maxFragLookUpTolerance,t=a>u-e?0:e;h=Gm(f,d,Math.max(d[0].start,a),t),!h&&f&&f.start<d[0].start&&(h=d[0])}else h=d[c-1];if(h=this.filterReplacedPrimary(h,r.details),!h)return;const p=d[h.sn-l.startSN-1];if(p&&p.cc===h.cc&&this.fragmentTracker.getState(p)===dg&&(h=p),this.fragmentTracker.getState(h)===dg){const e=this.mapToInitFragWhenRequired(h);e&&this.loadFragment(e,r,a)}}}else this.state=Zv}loadFragment(e,t,r){Tp(e)?super.loadFragment(e,t,r):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new yw(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends zb{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=rw(this.media.textTracks);for(let r=0;r<t.length;r++)if("hidden"===t[r].mode)e=t[r];else if("showing"===t[r].mode){e=t[r];break}const r=this.findTrackForTextTrack(e);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Ff.LEVEL_LOADING,this.onLevelLoading,this),e.on(Ff.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Ff.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Ff.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Ff.LEVEL_LOADING,this.onLevelLoading,this),e.off(Ff.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Ff.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Ff.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const r=this.media;if(!r)return;const i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||r.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;rw(r.textTracks).forEach(e=>{ew(e)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:r,groupId:i,details:n}=t,s=this.tracksInGroup[r];if(!s||s.groupId!==i)return void this.warn(`Subtitle track with id:${r} and group:${i} not found in active group ${null==s?void 0:s.groupId}`);const a=s.details;s.details=t.details,this.log(`Subtitle track ${r} "${s.name}" lang:${s.lang} group:${i} loaded [${n.startSN}-${n.endSN}]`),r===this.trackId&&this.playlistLoaded(r,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const r=t.subtitleGroups||null,i=this.groupIds;let n=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&r.some(e=>-1===(null==i?void 0:i.indexOf(e)))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter(e=>!r||-1!==r.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!n&&t){this.selectDefaultTrack=!1;const r=Nm(t,e);if(r>-1)n=e[r];else{const e=Nm(t,this.tracks);n=this.tracks[e]}}let i=this.findTrackId(n);-1===i&&n&&(i=this.findTrackId(null));const s={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==r?void 0:r.join(",")}" group-id`),this.hls.trigger(Ff.SUBTITLE_TRACKS_UPDATED,s),-1!==i&&-1===this.trackId&&this.setSubtitleTrack(i)}}findTrackId(e){const t=this.tracksInGroup,r=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const n=t[i];if((!r||n.default)&&(r||e)&&(!e||Fm(n,e)))return i}if(e){for(let r=0;r<t.length;r++){const i=t[r];if(jb(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const i=t[r];if(jb(e.attrs,i.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let r=0;r<t.length;r++){if(Hb(t[r],e))return r}}return-1}onError(e,t){!t.fatal&&t.context&&(t.context.type!==zf||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(-1===e.id)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const r=this.currentTrack;if(r&&Fm(e,r))return r;const i=Nm(e,this.tracksInGroup);if(i>-1){const e=this.tracksInGroup[i];return this.setSubtitleTrack(i),e}if(r)return null;{const r=Nm(e,t);if(r>-1)return t[r]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const r=e.id,i=e.groupId,n=this.getUrlWithDirectives(e.url,t),s=e.details,a=null==s?void 0:s.age;this.log(`Loading subtitle ${r} "${e.name}" lang:${e.lang} group:${i}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${a&&s.live?" age "+a.toFixed(1)+(s.type&&" "+s.type||""):""} ${n}`),this.hls.trigger(Ff.SUBTITLE_TRACK_LOADING,{url:n,id:r,groupId:i,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=rw(e.textTracks),r=this.currentTrack;let i;if(r&&(i=t.filter(e=>Hb(r,e))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(t).forEach(e=>{"disabled"!==e.mode&&e!==i&&(e.mode="disabled")}),i){const e=this.subtitleDisplay?"showing":"hidden";i.mode!==e&&(i.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!Cf(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.selectDefaultTrack=!1;const r=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i)return void this.hls.trigger(Ff.SUBTITLE_TRACK_SWITCH,{id:e});const n=!!i.details&&!i.details.live;if(e===this.trackId&&i===r&&n)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:s,groupId:a="",name:o,type:l,url:d}=i;this.hls.trigger(Ff.SUBTITLE_TRACK_SWITCH,{id:s,groupId:a,name:o,type:l,url:d});const c=this.switchParams(i.url,null==r?void 0:r.details,i.details);this.loadPlaylist(c)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Ff.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Ff.FRAG_LOADING,this.onFragLoading,this),e.on(Ff.FRAG_LOADED,this.onFragLoaded,this),e.on(Ff.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(Ff.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(Ff.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Ff.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Ff.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Ff.FRAG_LOADING,this.onFragLoading,this),e.off(Ff.FRAG_LOADED,this.onFragLoaded,this),e.off(Ff.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(Ff.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(Ff.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Ff.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new dS(this,"textTrack1"),t=new dS(this,"textTrack2"),r=new dS(this,"textTrack3"),i=new dS(this,"textTrack4");this.cea608Parser1=new Mw(1,e,t),this.cea608Parser2=new Mw(3,r,i)}addCues(e,t,r,i,n){let s=!1;for(let e=n.length;e--;){const i=n[e],a=hS(i[0],i[1],t,r);if(a>=0&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],r),s=!0,a/(r-t)>.5))return}if(s||n.push([t,r]),this.config.renderTextTracksNatively){const n=this.captionsTracks[e];this.Cues.newCue(n,t,r,i)}else{const n=this.Cues.newCue(null,t,r,i);this.hls.trigger(Ff.CUES_PARSED,{type:"captions",cues:n,track:e})}}onInitPtsFound(e,{frag:t,id:r,initPTS:i,timescale:n,trackId:s}){const{unparsedVttFrags:a}=this;r===Gf&&(this.initPTS[t.cc]={baseTime:i,timescale:n,trackId:s}),a.length&&(this.unparsedVttFrags=[],a.forEach(e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(Ff.FRAG_LOADED,e):this.hls.trigger(Ff.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:r}=this;if(r)for(let i=0;i<r.textTracks.length;i++){const n=r.textTracks[i];if(uS(n,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:r,media:i}=this,{label:n,languageCode:s}=t[e],a=this.getExistingTrack(n,s);if(a)r[e]=a,ew(r[e]),ZE(r[e],i);else{const t=this.createTextTrack("captions",n,s);t&&(t[e]=!0,r[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const r={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(Ff.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,r){const i=this.media;if(i)return i.addTextTrack(e,t,r)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const r=!!t.transferMedia;if(this.media=null,r)return;const{captionsTracks:i}=this;Object.keys(i).forEach(e=>{ew(i[e]),delete i[e]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;e<t.length;e++)ew(t[e])}onSubtitleTracksUpdated(e,t){const r=t.subtitleTracks||[],i=r.some(e=>e.textCodec===Zw);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Gb(this.tracks,r))return void(this.tracks=r);if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){const e=this.media,t=e?rw(e.textTracks):null;if(this.tracks.forEach((e,r)=>{let i;if(t){let r=null;for(let i=0;i<t.length;i++)if(t[i]&&uS(t[i],e)){r=t[i],t[i]=null;break}r&&(i=r)}if(i)ew(i);else{const t=cS(e);i=this.createTextTrack(t,e.name,e.lang),i&&(i.mode="disabled")}i&&this.textTracks.push(i)}),null!=t&&t.length){const e=t.filter(e=>null!==e).map(e=>e.label);e.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(Ff.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const r=`textTrack${t[1]}`,i=this.captionsProperties[r];i&&(i.label=e.name,e.lang&&(i.languageCode=e.lang),i.media=e)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Gf){var r,i;const{cea608Parser1:e,cea608Parser2:n,lastSn:s}=this,{cc:a,sn:o}=t.frag,l=null!=(r=null==(i=t.part)?void 0:i.index)?r:-1;e&&n&&(o!==s+1||o===s&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),n.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:r,payload:i}=t;if(r.type===Hf)if(i.byteLength){const e=r.decryptdata,n="stats"in t;if(null==e||!e.encrypted||n){const e=this.tracks[r.level],n=this.vttCCs;n[r.cc]||(n[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),e&&e.textCodec===Zw?this._parseIMSC1(r,i):this._parseVTTs(t)}}else this.hls.trigger(Ff.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const r=this.hls;rS(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),r.trigger(Ff.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{r.logger.log(`Failed to parse IMSC1: ${t}`),r.trigger(Ff.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t;const{frag:r,payload:i}=e,{initPTS:n,unparsedVttFrags:s}=this,a=n.length-1;if(!n[r.cc]&&-1===a)return void s.push(e);const o=this.hls;Qw(null!=(t=r.initSegment)&&t.data?Vp(r.initSegment.data,new Uint8Array(i)).buffer:i,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,e=>{this._appendCues(e,r.level),o.trigger(Ff.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},t=>{const n="Missing initPTS for VTT MPEGTS"===t.message;n?s.push(e):this._fallbackToIMSC1(r,i),o.logger.log(`Failed to parse VTT cue: ${t}`),n&&a>r.cc||o.trigger(Ff.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:t})})}_fallbackToIMSC1(e,t){const r=this.tracks[e.level];r.textCodec||rS(t,this.initPTS[e.cc],()=>{r.textCodec=Zw,this._parseIMSC1(e,t)},()=>{r.textCodec="wvtt"})}_appendCues(e,t){const r=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||"disabled"===r.mode)return;e.forEach(e=>JE(r,e))}else{const i=this.tracks[t];if(!i)return;const n=i.default?"default":"subtitles"+t;r.trigger(Ff.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:r}=t;r.type===Hf&&this.onFragLoaded(Ff.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:r,samples:i}=t;if(r.type!==Gf||"NONE"!==this.closedCaptionsForLevel(r))for(let e=0;e<i.length;e++){const t=i[e].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();const r=this.extractCea608Data(t);this.cea608Parser1.addData(i[e].pts,r[0]),this.cea608Parser2.addData(i[e].pts,r[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:r,endOffsetSubtitles:i,type:n}){const{media:s}=this;if(s&&!(s.currentTime<r)){if(!n||"video"===n){const{captionsTracks:e}=this;Object.keys(e).forEach(i=>tw(e[i],t,r))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==i){const{textTracks:e}=this;Object.keys(e).forEach(r=>tw(e[r],t,i))}}}extractCea608Data(e){const t=[[],[]],r=31&e[0];let i=2;for(let n=0;n<r;n++){const r=e[i++],n=127&e[i++],s=127&e[i++];if(0===n&&0===s)continue;if(!!(4&r)){const e=3&r;0!==e&&1!==e||(t[e].push(n),t[e].push(s))}}return t}},audioStreamController:class extends dy{constructor(e,t,r){super(e,t,r,"audio-stream-controller",jf),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Ff.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(Ff.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Ff.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Ff.BUFFER_RESET,this.onBufferReset,this),e.on(Ff.BUFFER_CREATED,this.onBufferCreated,this),e.on(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Ff.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Ff.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Ff.FRAG_LOADING,this.onFragLoading,this),e.on(Ff.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Ff.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(Ff.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Ff.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Ff.BUFFER_RESET,this.onBufferReset,this),e.off(Ff.BUFFER_CREATED,this.onBufferCreated,this),e.off(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Ff.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Ff.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Ff.FRAG_LOADING,this.onFragLoading,this),e.off(Ff.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:r,initPTS:i,timescale:n,trackId:s}){if(r===Gf){const e=t.cc,r=this.fragCurrent;if(this.initPTS[e]={baseTime:i,timescale:n,trackId:s},this.log(`InitPTS for cc: ${e} found from main: ${i/n} (${i}/${n}) trackId: ${s}`),this.mainAnchor=t,this.state===oy){const r=this.waitingData;(!r&&!this.loadingParts||r&&r.frag.cc!==e)&&this.syncWithAnchor(t,null==r?void 0:r.frag)}else!this.hls.hasEnoughToStart&&r&&r.cc!==e?(r.abortRequests(),this.syncWithAnchor(t,r)):this.state===Zv&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var r;const i=(null==(r=this.mainFragLoading)?void 0:r.frag)||null;if(t&&(null==i?void 0:i.cc)===t.cc)return;const n=(i||e).cc,s=Vm(this.getLevelDetails(),n,this.getLoadPosition());s&&(this.log(`Syncing with main frag at ${s.start} cc ${s.cc}`),this.startFragRequested=!1,this.nextLoadPosition=s.start,this.resetLoadingState(),this.state===Zv&&this.doTickIdle())}startLoad(e,t){if(!this.levels)return this.startPosition=e,void(this.state=Qv);const r=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),r>0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${r.toFixed(3)}`),e=r,this.state=Zv):this.state=ry,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Zv:this.doTickIdle();break;case ry:{const{levels:e,trackId:t}=this,r=null==e?void 0:e[t],i=null==r?void 0:r.details;if(i&&!this.waitForLive(r)){if(this.waitForCdnTuneIn(i))break;this.state=oy}break}case ty:this.checkRetryDate();break;case oy:{const e=this.waitingData;if(e){const{frag:t,part:r,cache:i,complete:n}=e,s=this.mainAnchor;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.state=ey;const e={frag:t,part:r,payload:i.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),n&&super._handleFragmentLoadComplete(e)}else s&&s.cc!==e.frag.cc&&this.syncWithAnchor(s,e.frag)}else this.state=Zv}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:r,media:i,trackId:n}=this,s=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!s.startFragPrefetch)||null==r||!r[n])return;const a=r[n],o=a.details;if(!o||this.waitForLive(a)||this.waitForCdnTuneIn(o))return this.state=ry,void(this.startFragRequested=!1);const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,bp,jf));const d=this.getFwdBufferInfo(l,jf);if(null===d)return;if(!this.switchingTrack&&this._streamEnded(d,o))return t.trigger(Ff.BUFFER_EOS,{type:"audio"}),void(this.state=sy);const c=d.len,u=t.maxBufferLength,h=o.fragments,f=h[0].start,p=this.getLoadPosition(),m=this.flushing?p:d.end;if(this.switchingTrack&&i){const e=p;o.PTSKnown&&e<f&&(d.end>f||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=f+.05)}if(c>=u&&!this.switchingTrack&&m<h[h.length-1].start)return;let g=this.getNextFragment(m,o);if(g&&this.isLoopLoading(g,m)&&(g=this.getNextFragmentLoopLoading(g,o,d,Gf,u)),!g)return void(this.bufferFlushed=!0);let v=(null==(e=this.mainFragLoading)?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&v&&Tp(g)&&!g.endList&&(!o.live||!this.loadingParts&&m<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(v)===hg&&(this.mainFragLoading=v=null),v&&Tp(v))){if(g.start>v.end){const e=this.fragmentTracker.getFragAtPos(m,Gf);e&&e.end>v.end&&(v=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(g.start>v.end)return}this.loadFragment(g,a,m)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(e=>new Rm(e))}onAudioTrackSwitching(e,t){const r=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),r?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==Qv&&(this.setInterval(100),this.state=Zv,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const r=this.cachedTrackLoadedData;r&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(Ff.AUDIO_TRACK_LOADED,r))}onAudioTrackLoaded(e,t){var r;const{levels:i}=this,{details:n,id:s,groupId:a,track:o}=t;if(!i)return void this.warn(`Audio tracks reset while loading track ${s} "${o.name}" of "${a}"`);const l=this.mainDetails;if(!l||n.endCC>l.endCC||l.expired)return this.cachedTrackLoadedData=t,void(this.state!==Qv&&(this.state=ry));this.cachedTrackLoadedData=null,this.log(`Audio track ${s} "${o.name}" of "${a}" loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const d=i[s];let c=0;if(n.live||null!=(r=d.details)&&r.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;var u;if(d.details)c=this.alignPlaylists(n,d.details,null==(u=this.levelLastLoaded)?void 0:u.details);n.alignedSliding||(Wv(n,l),n.alignedSliding||Yv(n,l),c=n.fragmentStart)}d.details=n,this.levelLastLoaded=d,this.startFragRequested||this.setStartPosition(l,c),this.hls.trigger(Ff.AUDIO_TRACK_UPDATED,{details:n,id:s,groupId:t.groupId}),this.state!==ry||this.waitForCdnTuneIn(n)||(this.state=Zv),this.tick()}_handleFragmentLoadProgress(e){var t;const r=e.frag,{part:i,payload:n}=e,{config:s,trackId:a,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const l=o[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);const c=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let u=this.transmuxer;u||(u=this.transmuxer=new Ub(this.hls,jf,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const h=this.initPTS[r.cc],f=null==(t=r.initSegment)?void 0:t.data;if(void 0!==h){const e=!1,t=i?i.index:-1,s=-1!==t,a=new Rg(r.level,r.sn,r.stats.chunkCount,n.byteLength,t,s);u.push(n,f,c,"",r,i,d.totalduration,e,a,h)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${d.startSN} ,${d.endSN}],track ${a}`);const{cache:e}=this.waitingData=this.waitingData||{frag:r,part:i,cache:new uy,complete:!1};e.push(new Uint8Array(n)),this.state!==Qv&&(this.state=oy)}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===Gf&&Tp(t.frag)&&(this.mainFragLoading=t,this.state===Zv&&this.tick())}onFragBuffered(e,t){const{frag:r,part:i}=t;if(r.type===jf)if(this.fragContextChanged(r))this.warn(`Fragment ${r.sn}${i?" p: "+i.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if(Tp(r)){this.fragPrevious=r;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(Ff.AUDIO_TRACK_SWITCHED,Xf({},e)))}this.fragBufferedComplete(r,i),this.media&&this.tick()}else this.audioOnly||r.type!==Gf||r.elementaryStreams.video||r.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}onError(e,t){var r;if(t.fatal)this.state=ay;else switch(t.details){case Nf.FRAG_GAP:case Nf.FRAG_PARSING_ERROR:case Nf.FRAG_DECRYPT_ERROR:case Nf.FRAG_LOAD_ERROR:case Nf.FRAG_LOAD_TIMEOUT:case Nf.KEY_LOAD_ERROR:case Nf.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(jf,t);break;case Nf.AUDIO_TRACK_LOAD_ERROR:case Nf.AUDIO_TRACK_LOAD_TIMEOUT:case Nf.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==ry||(null==(r=t.context)?void 0:r.type)!==Uf||(this.state=Zv);break;case Nf.BUFFER_ADD_CODEC_ERROR:case Nf.BUFFER_APPEND_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case Nf.BUFFER_FULL_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Nf.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==Ep&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Ep){this.flushing=!1,this.bufferFlushed=!0,this.state===sy&&(this.state=Zv);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,jf),this.tick())}}_handleTransmuxComplete(e){var t;const r="audio",{hls:i}=this,{remuxResult:n,chunkMeta:s}=e,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:l,level:d}=a,{details:c}=d,{audio:u,text:h,id3:f,initSegment:p}=n;if(!this.fragContextChanged(o)&&c){if(this.state=iy,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),null!=p&&p.tracks){const e=o.initSegment||o;if(this.unhandledEncryptionError(p,o))return;this._bufferInitSegment(d,p.tracks,e,s),i.trigger(Ff.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:r,tracks:p.tracks})}if(u){const{startPTS:e,endPTS:t,startDTS:r,endDTS:i}=u;l&&(l.elementaryStreams[bp]={startPTS:e,endPTS:t,startDTS:r,endDTS:i}),o.setElementaryStreamInfo(bp,e,t,r,i),this.bufferFragmentData(u,o,l,s)}if(null!=f&&null!=(t=f.samples)&&t.length){const e=Kf({id:r,frag:o,details:c},f);i.trigger(Ff.FRAG_PARSING_METADATA,e)}if(h){const e=Kf({id:r,frag:o,details:c},h);i.trigger(Ff.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(e,t,r,i){if(this.state!==iy)return;if(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio)return;const n=t.audio;n.id=jf;const s=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${s}/${n.codec}]`),s&&1===s.split(",").length&&(n.levelCodec=s),this.hls.trigger(Ff.BUFFER_CODECS,t);const a=n.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:r,part:null,chunkMeta:i,parent:r.type,data:a};this.hls.trigger(Ff.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,r){const i=this.fragmentTracker.getState(e);var n;if(this.switchingTrack||i===dg||i===ug)if(Tp(e))if(null!=(n=t.details)&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=oy;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&Yv(t.details,r)}else super.loadFragment(e,t,r);else this._loadInitSegment(e,t);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:r,assocLang:i,characteristics:n,audioCodec:s,channels:a}=this.bufferedTrack;Fm({name:t,lang:r,assocLang:i,characteristics:n,audioCodec:s,channels:a},e,$m)||(Um(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(Ff.AUDIO_TRACK_SWITCHED,Xf({},e))}},audioTrackController:class extends zb{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Ff.LEVEL_LOADING,this.onLevelLoading,this),e.on(Ff.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Ff.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Ff.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Ff.LEVEL_LOADING,this.onLevelLoading,this),e.off(Ff.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Ff.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Ff.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:r,groupId:i,details:n}=t,s=this.tracksInGroup[r];if(!s||s.groupId!==i)return void this.warn(`Audio track with id:${r} and group:${i} not found in active group ${null==s?void 0:s.groupId}`);const a=s.details;s.details=t.details,this.log(`Audio track ${r} "${s.name}" lang:${s.lang} group:${i} loaded [${n.startSN}-${n.endSN}]`),r===this.trackId&&this.playlistLoaded(r,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const r=t.audioGroups||null,i=this.groupIds;let n=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&r.some(e=>-1===(null==i?void 0:i.indexOf(e)))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter(e=>!r||-1!==r.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!n&&t){const r=Nm(t,e,$m);if(r>-1)n=e[r];else{const e=Nm(t,this.tracks);n=this.tracks[e]}}let i=this.findTrackId(n);-1===i&&n&&(i=this.findTrackId(null));const a={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==r?void 0:r.join(",")}`),this.hls.trigger(Ff.AUDIO_TRACKS_UPDATED,a);const o=this.trackId;if(-1!==i&&-1===o)this.setAudioTrack(i);else if(e.length&&-1===o){var s;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(s=this.groupIds)?void 0:s.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){!t.fatal&&t.context&&(t.context.type!==Uf||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const i=this.currentTrack;if(i&&Fm(e,i,$m))return i;const n=Nm(e,this.tracksInGroup,$m);if(n>-1){const e=this.tracksInGroup[n];return this.setAudioTrack(n),e}if(i){let i=t.loadLevel;-1===i&&(i=t.firstAutoLevel);const n=function(e,t,r,i,n){const s=t[i],a=t.reduce((e,t,r)=>{const i=t.uri;return(e[i]||(e[i]=[])).push(r),e},{})[s.uri];a.length>1&&(i=Math.max.apply(Math,a));const o=s.videoRange,l=s.frameRate,d=s.codecSet.substring(0,4),c=Bm(t,i,t=>{if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;const i=t.audioGroups,s=r.filter(e=>!i||-1!==i.indexOf(e.groupId));return Nm(e,s,n)>-1});return c>-1?c:Bm(t,i,t=>{const i=t.audioGroups,s=r.filter(e=>!i||-1!==i.indexOf(e.groupId));return Nm(e,s,n)>-1})}(e,t.levels,r,i,$m);if(-1===n)return null;t.nextLoadLevel=n}if(e.channels||e.audioCodec){const t=Nm(e,r);if(t>-1)return r[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.selectDefaultTrack=!1;const r=this.currentTrack,i=t[e],n=i.details&&!i.details.live;if(e===this.trackId&&i===r&&n)return;if(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(Ff.AUDIO_TRACK_SWITCHING,Xf({},i)),n)return;const s=this.switchParams(i.url,null==r?void 0:r.details,i.details);this.loadPlaylist(s)}findTrackId(e){const t=this.tracksInGroup;for(let r=0;r<t.length;r++){const i=t[r];if((!this.selectDefaultTrack||i.default)&&(!e||Fm(e,i,$m)))return r}if(e){const{name:r,lang:i,assocLang:n,characteristics:s,audioCodec:a,channels:o}=e;for(let e=0;e<t.length;e++){if(Fm({name:r,lang:i,assocLang:n,characteristics:s,audioCodec:a,channels:o},t[e],$m))return e}for(let r=0;r<t.length;r++){const i=t[r];if(jb(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const i=t[r];if(jb(e.attrs,i.attrs,["LANGUAGE"]))return r}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Um(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const r=e.id,i=e.groupId,n=this.getUrlWithDirectives(e.url,t),s=e.details,a=null==s?void 0:s.age;this.log(`Loading audio-track ${r} "${e.name}" lang:${e.lang} group:${i}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${a&&s.live?" age "+a.toFixed(1)+(s.type&&" "+s.type||""):""} ${n}`),this.hls.trigger(Ff.AUDIO_TRACK_LOADING,{url:n,id:r,groupId:i,deliveryDirectives:t||null,track:e})}},emeController:YE,cmcdController:class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:Zb.MANIFEST,su:!this.initialized})}catch(e){this.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const{frag:t,part:r}=e,i=this.hls.levels[t.level],n=this.getObjectType(t),s={d:1e3*(r||t).duration,ot:n};n!==Zb.VIDEO&&n!==Zb.AUDIO&&n!=Zb.MUXED||(s.br=i.bitrate/1e3,s.tb=this.getTopBandwidth(n)/1e3,s.bl=this.getBufferLength(n));const a=r?this.getNextPart(r):this.getNextFrag(t);null!=a&&a.url&&a.url!==t.url&&(s.nor=a.url),this.apply(e,s)}catch(e){this.hls.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:r}=t;null!=r&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||e.sessionId,this.cid=r.contentId,this.useHeaders=!0===r.useHeaders,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Ff.MEDIA_DETACHED,this.onMediaDetached,this),e.on(Ff.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Ff.MEDIA_DETACHED,this.onMediaDetached,this),e.off(Ff.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var r,i;this.audioBuffer=null==(r=t.tracks.audio)?void 0:r.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer}createData(){var e;return{v:1,sf:Jb.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Kf(t,this.createData());const r=t.ot===Zb.INIT||t.ot===Zb.VIDEO||t.ot===Zb.MUXED;this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((e,r)=>(i.includes(r)&&(e[r]=t[r]),e),{}));const n={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),zE(e.headers,t,n)):e.url=HE(e.url,t,n)}getNextFrag(e){var t;const r=null==(t=this.hls.levels[e.level])?void 0:t.details;if(r){const t=e.sn-r.startSN;return r.fragments[t+1]}}getNextPart(e){var t;const{index:r,fragment:i}=e,n=null==(t=this.hls.levels[i.level])||null==(t=t.details)?void 0:t.partList;if(n){const{sn:e}=i;for(let t=n.length-1;t>=0;t--){const i=n[t];if(i.index===r&&i.fragment.sn===e)return n[t+1]}}}getObjectType(e){const{type:t}=e;return"subtitle"===t?Zb.TIMED_TEXT:"initSegment"===e.sn?Zb.INIT:"audio"===t?Zb.AUDIO:"main"===t?this.hls.audioTracks.length?Zb.VIDEO:Zb.MUXED:void 0}getTopBandwidth(e){let t,r=0;const i=this.hls;if(e===Zb.AUDIO)t=i.audioTracks;else{const e=i.maxAutoLevel,r=e>-1?e+1:i.levels.length;t=i.levels.slice(0,r)}return t.forEach(e=>{e.bitrate>r&&(r=e.bitrate)}),r>0?r:NaN}getBufferLength(e){const t=this.media,r=e===Zb.AUDIO?this.audioBuffer:this.videoBuffer;if(!r||!t)return NaN;return 1e3*Dg.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,r=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new r(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,r,i){t(e),this.loader.load(e,r,i)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,r=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new r(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,r,i){t(e),this.loader.load(e,r,i)}}}},contentSteeringController:class extends Qf{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Ff.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Ff.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(t=>t!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:r}=t;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:r}=t;if((null==r?void 0:r.action)===tg&&r.flags===sg){const e=this.levels;let i=this._pathwayPriority,n=this.pathwayId;if(t.context){const{groupId:r,pathwayId:i,type:s}=t.context;r&&e?n=this.getPathwayForGroupId(r,s,n):i&&(n=i)}n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),!i&&e&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),r.resolved=this.pathwayId!==n),t.details!==Nf.BUFFER_APPEND_ERROR||t.fatal?r.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${n} levels: ${e?e.length:e} priorities: ${Cm(i)} penalized: ${Cm(this.penalizedPathways)}`):r.resolved=!0}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const r=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),t=this.getLevelsForPathway(r),this.pathwayId=r}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){let t;this._pathwayPriority=e;const r=this.penalizedPathways,i=performance.now();Object.keys(r).forEach(e=>{i-r[e]>3e5&&delete r[e]});for(let i=0;i<e.length;i++){const n=e[i];if(n in r)continue;if(n===this.pathwayId)return;const s=this.hls.nextLoadLevel,a=this.hls.levels[s];if(t=this.getLevelsForPathway(n),t.length>0){this.log(`Setting Pathway to "${n}"`),this.pathwayId=n,Uv(t),this.hls.trigger(Ff.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[s];a&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(e,t,r){const i=this.getLevelsForPathway(r).concat(this.levels||[]);for(let r=0;r<i.length;r++)if(t===Uf&&i[r].hasAudioGroup(e)||t===zf&&i[r].hasSubtitleGroup(e))return i[r].pathwayId;return r}clonePathways(e){const t=this.levels;if(!t)return;const r={},i={};e.forEach(e=>{const{ID:n,"BASE-ID":s,"URI-REPLACEMENT":a}=e;if(t.some(e=>e.pathwayId===n))return;const o=this.getLevelsForPathway(s).map(e=>{const t=new Bg(e.attrs);t["PATHWAY-ID"]=n;const s=t.AUDIO&&`${t.AUDIO}_clone_${n}`,o=t.SUBTITLES&&`${t.SUBTITLES}_clone_${n}`;s&&(r[t.AUDIO]=s,t.AUDIO=s),o&&(i[t.SUBTITLES]=o,t.SUBTITLES=o);const l=WE(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),d=new Rm({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)d.addGroupId("audio",`${e.audioGroups[t]}_clone_${n}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)d.addGroupId("text",`${e.subtitleGroups[t]}_clone_${n}`);return d});t.push(...o),VE(this.audioTracks,r,a,n),VE(this.subtitleTracks,i,a,n)})}loadSteeringManifest(e){const t=this.hls.config,r=t.loader;let i;this.loader&&this.loader.destroy(),this.loader=new r(t);try{i=new self.URL(e)}catch(t){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${e}`)}if("data:"!==i.protocol){const e=0|(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate);i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+e)}const n={responseType:"json",url:i.href},s=t.steeringManifestLoadPolicy.default,a=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(e,t,r,n)=>{this.log(`Loaded steering manifest: "${i}"`);const s=e.data;if(1!==(null==s?void 0:s.VERSION))return void this.log(`Steering VERSION ${s.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=s.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=s;if(a)try{this.uri=new self.URL(a,i).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||r.url),o&&this.clonePathways(o);const d={steeringManifest:s,url:i.toString()};this.hls.trigger(Ff.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,r,i)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let n=1e3*this.timeToLoad;if(429===e.code){const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(n=1e3*parseFloat(t))}return void this.log(`Steering manifest ${t.url} rate limited`)}this.scheduleRefresh(this.uri||t.url,n)},onTimeout:(e,t,r)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(n,o,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var t;const r=null==(t=this.hls)?void 0:t.media;!r||r.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)},t)}},interstitialsController:class extends Qf{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled||!this.schedule)return;const t=e-this.timelinePos;if(Math.abs(t)<1/7056e5)return;const r=t<=-.01;this.timelinePos=e,this.bufferedPos=e;const i=this.playingItem;if(!i)return void this.checkBuffer();if(r){this.schedule.resetErrorsInRange(e,e-t)&&this.updateSchedule(!0)}if(this.checkBuffer(),r&&e<i.start||e>=i.end){var n;const t=this.findItemIndex(i);let s=this.schedule.findItemIndexAtTime(e);if(-1===s&&(s=t+(r?-1:1),this.log(`seeked ${r?"back ":""}to position not covered by schedule ${e} (resolving from ${t} to ${s})`)),!this.isInterstitial(i)&&null!=(n=this.media)&&n.paused&&(this.shouldPlay=!1),!r&&s>t){const e=this.schedule.findJumpRestrictedIndex(t+1,s);if(e>t)return void this.setSchedulePosition(e)}return void this.setSchedulePosition(s)}const s=this.playingAsset;if(!s){if(this.playingLastItem&&this.isInterstitial(i)){const t=i.event.assetList[0];t&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(e,t))}return}const a=s.timelineStart,o=s.duration||0;var l;(r&&e<a||e>=a+o)&&(null!=(l=i.event)&&l.appendInPlace&&(this.clearAssetPlayers(i.event,i),this.flushFrontBuffer(e)),this.setScheduleToAssetAtTime(e,s))},this.onTimeupdate=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled)return;if(!(e>this.timelinePos))return;this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();const t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}const r=this.playingAsset;if(!r)return;e>=r.timelineStart+(r.duration||0)&&this.setScheduleToAssetAtTime(e,r)},this.onScheduleUpdate=(e,t)=>{const r=this.schedule;if(!r)return;const i=this.playingItem,n=r.events||[],s=r.items||[],a=r.durations,o=e.map(e=>e.identifier),l=!(!n.length&&!o.length);(l||t)&&this.log(`INTERSTITIALS_UPDATED (${n.length}): ${n}\nSchedule: ${s.map(e=>pw(e))} pos: ${this.timelinePos}`),o.length&&this.log(`Removed events ${o}`);let d=null,c=null;i&&(d=this.updateItem(i,this.timelinePos),this.itemsMatch(i,d)?this.playingItem=d:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const u=this.bufferingItem;if(u&&(c=this.updateItem(u,this.bufferedPos),this.itemsMatch(u,c)?this.bufferingItem=c:u.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(u.event,null))),e.forEach(e=>{e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,null)})}),this.playerQueue.forEach(e=>{if(e.interstitial.appendInPlace){const t=e.assetItem.timelineStart,r=e.timelineOffset-t;if(r)try{e.timelineOffset=t}catch(i){Math.abs(r)>nw&&this.warn(`${i} ("${e.assetId}" ${e.timelineOffset}->${t})`)}}}),l||t){if(this.hls.trigger(Ff.INTERSTITIALS_UPDATED,{events:n.slice(0),schedule:s.slice(0),durations:a,removedIds:o}),this.isInterstitial(i)&&o.includes(i.event.identifier))return this.warn(`Interstitial "${i.event.identifier}" removed while playing`),void this.primaryFallback(i.event);i&&this.trimInPlace(d,i),u&&c!==d&&this.trimInPlace(c,u),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new mw(e),this.schedule=new fw(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Ff.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Ff.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(Ff.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Ff.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(Ff.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(Ff.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(Ff.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Ff.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Ff.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(Ff.MEDIA_ENDED,this.onMediaEnded,this),e.on(Ff.ERROR,this.onError,this),e.on(Ff.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Ff.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Ff.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(Ff.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Ff.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(Ff.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(Ff.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(Ff.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Ff.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Ff.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Ff.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(Ff.MEDIA_ENDED,this.onMediaEnded,this),e.off(Ff.ERROR,this.onError,this),e.off(Ff.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;null==(e=this.getBufferingPlayer())||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.getBufferingPlayer())||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){qv(e,"play",this.onPlay),qv(e,"pause",this.onPause),qv(e,"seeking",this.onSeeking),qv(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const r=this.media=t.media;Kv(r,"seeking",this.onSeeking),Kv(r,"timeupdate",this.onTimeupdate),Kv(r,"play",this.onPlay),Kv(r,"pause",this.onPause)}onMediaAttached(e,t){const r=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,null===r)this.checkStart();else if(!i){this.clearScheduleState();const e=this.findItemIndex(r);this.setSchedulePosition(e)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const r=!!t.transferMedia,i=this.media;if(this.media=null,!r&&(i&&this.removeMediaListeners(i),this.detachedData)){const e=this.getBufferingPlayer();e&&(this.log(`Removing schedule state for detachedData and ${e}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,r=t=>t?e.getAssetPlayer(t.identifier):t,i=(t,i,s,a,o)=>{if(t){let l=t[i].start;const d=t.event;if(d){if("playout"===i||d.timelineOccupancy!==sw.Point){const e=r(s);(null==e?void 0:e.interstitial)===d&&(l+=e.assetItem.startOffset+e[o])}}else{l+=("bufferedPos"===a?n():e[a])-t.start}return l}return 0},n=()=>{const t=e.bufferedPos;return t===Number.MAX_VALUE?s("primary"):Math.max(t,0)},s=t=>{var r,i;return null!=(r=e.primaryDetails)&&r.live?e.primaryDetails.edge:(null==(i=e.schedule)?void 0:i.durations[t])||0},a=(t,n)=>{var s,a;const o=e.effectivePlayingItem;if(null!=o&&null!=(s=o.event)&&s.restrictions.skip||!e.schedule)return;e.log(`seek to ${t} "${n}"`);const l=e.effectivePlayingItem,d=e.schedule.findItemIndexAtTime(t,n),c=null==(a=e.schedule.items)?void 0:a[d],u=e.getBufferingPlayer(),h=null==u?void 0:u.interstitial,f=null==h?void 0:h.appendInPlace,p=l&&e.itemsMatch(l,c);if(l&&(f||p)){const s=r(e.playingAsset),a=(null==s?void 0:s.media)||e.primaryMedia;if(a){const r="primary"===n?a.currentTime:i(l,n,e.playingAsset,"timelinePos","currentTime"),o=t-r,d=(f?r:a.currentTime)+o;if(d>=0&&(!s||f||d<=s.duration))return void(a.currentTime=d)}}if(c){let r=t;if("primary"!==n){const e=t-c[n].start;r=c.start+e}const i=!e.isInterstitial(c);if(e.isInterstitial(l)&&!l.event.appendInPlace||!i&&!c.event.appendInPlace){if(l){const s=e.findItemIndex(l);if(d>s){const t=e.schedule.findJumpRestrictedIndex(s+1,d);if(t>s)return void e.setSchedulePosition(t)}let a=0;if(i)e.timelinePos=r,e.checkBuffer();else{const e=c.event.assetList,r=t-(c[n]||c).start;for(let t=e.length;t--;){const i=e[t];if(i.duration&&r>=i.startOffset&&r<i.startOffset+i.duration){a=t;break}}}e.setSchedulePosition(d,a)}}else{const t=e.media||(f?null==u?void 0:u.media:null);t&&(t.currentTime=r)}}},o=()=>{const r=e.effectivePlayingItem;if(e.isInterstitial(r))return r;const i=t();return e.isInterstitial(i)?i:null},l={get bufferedEnd(){const r=t(),n=e.bufferingItem;var s;return n&&n===r&&(i(n,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-n.playout.start||(null==(s=e.bufferingAsset)?void 0:s.startOffset))||0},get currentTime(){const t=o(),r=e.effectivePlayingItem;return r&&r===t?i(r,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-r.playout.start:0},set currentTime(t){const r=o(),i=e.effectivePlayingItem;i&&i===r&&a(t+i.playout.start,"playout")},get duration(){const e=o();return e?e.playout.end-e.playout.start:0},get assetPlayers(){var t;const r=null==(t=o())?void 0:t.event.assetList;return r?r.map(t=>e.getAssetPlayer(t.identifier)):[]},get playingIndex(){var t;const r=null==(t=o())?void 0:t.event;return r&&e.effectivePlayingAsset?r.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return o()}};return this.manager={get events(){var t;return(null==(t=e.schedule)||null==(t=t.events)?void 0:t.slice(0))||[]},get schedule(){var t;return(null==(t=e.schedule)||null==(t=t.items)?void 0:t.slice(0))||[]},get interstitialPlayer(){return o()?l:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const r=t();return e.findItemIndex(r)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return n()},get currentTime(){const t=e.timelinePos;return t>0?t:0},set currentTime(e){a(e,"primary")},get duration(){return s("primary")},get seekableStart(){var t;return(null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(e){a(e,"integrated")},get duration(){return s("integrated")},get seekableStart(){var t;return((t,r)=>{var i;if(0!==t&&"primary"!==r&&null!=(i=e.schedule)&&i.length){var n;const i=e.schedule.findItemIndexAtTime(t),s=null==(n=e.schedule.items)?void 0:n[i];if(s)return t+(s[r].start-s.start)}return t})((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"integrated")}},skip:()=>{const t=e.effectivePlayingItem,r=null==t?void 0:t.event;if(r&&!r.restrictions.skip){const i=e.findItemIndex(t);if(r.appendInPlace){const e=t.playout.start+t.event.duration;a(e+.001,"playout")}else e.advanceAfterAssetEnded(r,i,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,r=null==(e=this.schedule)?void 0:e.items;return!!(this.playbackStarted&&t&&r)&&this.findItemIndex(t)===r.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var e,t;if(null===this.mediaSelection)return;const r=this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&!r.event.appendInPlace)return;let i=this.media;!i&&null!=(e=this.bufferingItem)&&null!=(e=e.event)&&e.appendInPlace&&(i=this.primaryMedia);const n=null==(t=i)?void 0:t.currentTime;return void 0!==n&&Cf(n)?n:void 0}get primaryMedia(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}isInterstitial(e){return!(null==e||!e.event)}retreiveMediaSource(e,t){const r=this.getAssetPlayer(e);r&&this.transferMediaFromPlayer(r,t)}transferMediaFromPlayer(e,t){const r=e.interstitial.appendInPlace,i=e.media;if(r&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i)return void(this.detachedData={media:i});const r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Cm(r)}`),this.detachedData=r}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var r,i;if(e.media===t)return;let n=null;const s=this.hls,a=e!==s,o=a&&e.interstitial.appendInPlace,l=null==(r=this.detachedData)?void 0:r.mediaSource;let d;if(s.media)o&&(n=s.transferMedia(),this.detachedData=n),d="Primary";else if(l){const e=this.getBufferingPlayer();e?(n=e.transferMedia(),d=`${e}`):d="detached MediaSource"}else d="detached media";if(!n)if(l)n=this.detachedData,this.log(`using detachedData: MediaSource ${Cm(n)}`);else if(!this.detachedData||s.media===t){const e=this.playerQueue;e.length>1&&e.forEach(e=>{if(a&&e.interstitial.appendInPlace!==o){const t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${t}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}const c=n&&"mediaSource"in n&&"closed"!==(null==(i=n.mediaSource)?void 0:i.readyState),u=c&&n?n:t;this.log(`${c?"transfering MediaSource":"attaching media"} to ${a?e:"Primary"} from ${d} (media.currentTime: ${t.currentTime})`);const h=this.schedule;if(u===n&&h){const t=a&&e.assetId===h.assetIdAtEnd;u.overrides={duration:h.duration,endOfStream:!a||t,cueRemoval:!a}}e.attachMedia(u)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=null==e?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;-1===this.bufferedPos&&(this.bufferedPos=0);const r=this.timelinePos,i=this.effectivePlayingItem;if(-1===r){const r=this.hls.startPosition;if(this.log(vw("checkStart",r)),this.timelinePos=r,t.length&&t[0].cue.pre){const r=e.findEventIndex(t[0].identifier);this.setSchedulePosition(r)}else if(r>=0||!this.primaryLive){const t=this.timelinePos=r>0?r:0,i=e.findItemIndexAtTime(t);this.setSchedulePosition(i)}}else if(i&&!this.playingItem){const t=e.findItemIndex(i);this.setSchedulePosition(t)}}advanceAssetBuffering(e,t){const r=e.event,i=r.findAssetIndex(t),n=cw(r,i);if(r.isAssetPastPlayoutLimit(n)){if(this.schedule){var s;const t=null==(s=this.schedule.items)?void 0:s[this.findItemIndex(e)+1];t&&this.bufferedToItem(t)}}else this.bufferedToEvent(e,n)}advanceAfterAssetEnded(e,t,r){const i=cw(e,r);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){const r=this.schedule.items;if(r){const i=t+1;if(i>=r.length)return void this.setSchedulePosition(-1);const n=e.resumeTime;this.timelinePos<n&&(this.log(vw("advanceAfterAssetEnded",n)),this.timelinePos=n,e.appendInPlace&&this.advanceInPlace(n),this.checkBuffer(this.bufferedPos<n)),this.setSchedulePosition(i)}}}else{if(e.appendInPlace){const t=e.assetList[i];t&&this.advanceInPlace(t.timelineStart)}this.setSchedulePosition(t,i)}}setScheduleToAssetAtTime(e,t){const r=this.schedule;if(!r)return;const i=t.parentIdentifier,n=r.getEvent(i);if(n){const t=r.findEventIndex(i),s=r.findAssetIndex(n,e);this.advanceAfterAssetEnded(n,t,s-1)}}setSchedulePosition(e,t){var r;const i=null==(r=this.schedule)?void 0:r.items;if(!i||this.playbackDisabled)return;const n=e>=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n?pw(n):n}) pos: ${this.timelinePos}`);const s=this.waitingItem||this.playingItem,a=this.playingLastItem;if(this.isInterstitial(s)){const r=s.event,d=this.playingAsset,c=null==d?void 0:d.identifier,u=c?this.getAssetPlayer(c):null;if(u&&c&&(!this.eventItemsMatch(s,n)||void 0!==t&&c!==r.assetList[t].identifier)){var o;const t=r.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${t+1}/${r.assetList.length} ${uw(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(Ff.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:t,event:r,schedule:i.slice(0),scheduleIndex:e,player:u}),s!==this.playingItem)return void(this.itemsMatch(s,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(r,this.findItemIndex(this.playingItem),t));this.retreiveMediaSource(c,n),!u.media||null!=(o=this.detachedData)&&o.mediaSource||u.detachMedia()}if(!this.eventItemsMatch(s,n)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${r} ${pw(s)}`),r.hasPlayed=!0,this.hls.trigger(Ff.INTERSTITIAL_ENDED,{event:r,schedule:i.slice(0),scheduleIndex:e}),r.cue.once)){var l;this.updateSchedule();const e=null==(l=this.schedule)?void 0:l.items;if(n&&e){const r=this.findItemIndex(n);this.advanceSchedule(r,e,t,s,a)}return}}this.advanceSchedule(e,i,t,s,a)}advanceSchedule(e,t,r,i,n){const s=this.schedule;if(!s)return;const a=t[e]||null,o=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(t=>{const r=t.interstitial,i=s.findEventIndex(r.identifier);(i<e||i>e+1)&&this.clearInterstitial(r,a)}),this.isInterstitial(a)){this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);const n=a.event;if(void 0===r){const t=cw(n,(r=s.findAssetIndex(n,this.timelinePos))-1);if(n.isAssetPastPlayoutLimit(t)||n.appendInPlace&&this.timelinePos===a.end)return void this.advanceAfterAssetEnded(n,e,r);r=t}const l=this.waitingItem;this.assetsBuffered(a,o)||this.setBufferingItem(a);let d=this.preloadAssets(n,r);if(this.eventItemsMatch(a,l||i)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${pw(a)} ${n.appendInPlace?"append in place":""}`),this.hls.trigger(Ff.INTERSTITIAL_STARTED,{event:n,schedule:t.slice(0),scheduleIndex:e})),!n.assetListLoaded)return void this.log(`Waiting for ASSET-LIST to complete loading ${n}`);if(n.assetListLoader&&(n.assetListLoader.destroy(),n.assetListLoader=void 0),!o)return void this.log(`Waiting for attachMedia to start Interstitial ${n}`);this.waitingItem=this.endedItem=null,this.playingItem=a;const c=n.assetList[r];if(!c)return void this.advanceAfterAssetEnded(n,e,r||0);if(d||(d=this.getAssetPlayer(c.identifier)),null===d||d.destroyed){const e=n.assetList.length;this.warn(`asset ${r+1}/${e} player destroyed ${n}`),d=this.createAssetPlayer(n,c,r),d.loadSource()}if(!this.eventItemsMatch(a,this.bufferingItem)&&n.appendInPlace&&this.isAssetBuffered(c))return;this.startAssetPlayer(d,r,t,e,o),this.shouldPlay&&gw(d.media)}else a?(this.resumePrimary(a,e,i),this.shouldPlay&&gw(this.hls.media)):n&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(s.durations.primary,null))}get playbackDisabled(){return!1===this.hls.config.enableInterstitialPlayback}get primaryDetails(){var e;return null==(e=this.mediaSelection)?void 0:e.main.details}get primaryLive(){var e;return!(null==(e=this.primaryDetails)||!e.live)}resumePrimary(e,t,r){var i,n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${pw(e)}`),null==(i=this.detachedData)||!i.mediaSource){let r=this.timelinePos;(r<e.start||r>=e.end)&&(r=this.getPrimaryResumption(e,t),this.log(vw("resumePrimary",r)),this.timelinePos=r),this.attachPrimary(r,e)}if(!r)return;const s=null==(n=this.schedule)?void 0:n.items;s&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${pw(e)}`),this.hls.trigger(Ff.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const r=e.start;if(this.primaryLive){const e=this.primaryDetails;if(0===t)return this.hls.startPosition;if(e&&(r<e.fragmentStart||r>e.edge))return this.hls.liveSyncPosition||-1}return r}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);if(null!=t&&t.hls)return t.hls.bufferedToEnd;return Dg.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,r){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,i),r&&this.startLoadingPrimaryAt(e,r)),r||(this.log(vw("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,r))}startLoadingPrimaryAt(e,t){var r;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs(((null==(r=i.mainForwardBufferInfo)?void 0:r.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),null==(e=this.schedule)||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(Ff.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(Ff.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(-1===t.level||!this.schedule)return;const r=this.hls.levels[t.level];if(!r.details)return;const i=Xf(Xf({},this.mediaSelection||this.altSelection),{},{main:r});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const r=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i)return void(this.altSelection=Xf(Xf({},this.altSelection),{},{audio:r}));const n=Xf(Xf({},i),{},{audio:r});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const r=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i)return void(this.altSelection=Xf(Xf({},this.altSelection),{},{subtitles:r}));const n=Xf(Xf({},i),{},{subtitles:r});this.mediaSelection=n}onAudioTrackSwitching(e,t){const r=Mm(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setAudioOption(t)||e.setAudioOption(r)))}onSubtitleTrackSwitch(e,t){const r=Mm(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setSubtitleOption(t)||-1!==t.id&&e.setSubtitleOption(r)))}onBufferCodecs(e,t){const r=t.tracks;r&&(this.requiredTracks=r)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const r=this.playingItem;if(r&&!this.itemsMatch(r,this.bufferingItem)&&!this.isInterstitial(r)){const e=this.timelinePos;this.bufferedPos=e,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let e=0;e<t.length;e++){const i=t[e];if(i.cue.post){var r;const e=this.schedule.findEventIndex(i.identifier),t=null==(r=this.schedule.items)?void 0:r[e];this.isInterstitial(t)&&this.eventItemsMatch(t,this.bufferingItem)&&this.bufferedToItem(t,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}else this.shouldPlay=!1}updateItem(e,t){var r;const i=null==(r=this.schedule)?void 0:r.items;if(e&&i){return i[this.findItemIndex(e,t)]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((t,r)=>{e.event.isAssetPastPlayoutLimit(r)&&this.clearAssetPlayer(t.identifier,null)});const r=e.end+.25,i=Dg.bufferInfo(this.primaryMedia,r,0);if(i.end>r||(i.nextStart||0)>r){this.log(`trim buffered interstitial ${pw(e)} (was ${pw(t)})`);const i=!0;this.attachPrimary(r,null,i),this.flushFrontBuffer(r)}}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var r;return!!t&&(e===t||e.event.identifier===(null==(r=t.event)?void 0:r.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const r=this.mediaSelection;r&&(null==(t=this.schedule)||t.updateSchedule(r,[],e))}checkBuffer(e){var t;const r=null==(t=this.schedule)?void 0:t.items;if(!r)return;const i=Dg.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,r,e)}updateBufferedPos(e,t,r){const i=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(1===t.length&&this.itemsMatch(t[0],n))return void(this.bufferedPos=e);const s=this.playingItem,a=this.findItemIndex(s);let o=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var l;const r=this.findItemIndex(n),i=Math.min(r+1,t.length-1),s=t[i];if((-1===o&&n&&e>=n.end||null!=(l=s.event)&&l.appendInPlace&&e+.01>=s.start)&&(o=i),this.isInterstitial(n)){const e=n.event;if(i-a>1&&!1===e.appendInPlace)return;if(0===e.assetList.length&&e.assetListLoader)return}if(this.bufferedPos=e,o>r&&o>a)this.bufferedToItem(s);else{const t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&s.start<t.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(s)&&this.preloadAssets(s.event,0)}}else r&&s&&!this.itemsMatch(s,n)&&(o===a?this.bufferedToItem(s):o===a+1&&this.bufferedToItem(t[o]))}assetsBuffered(e,t){return 0!==e.event.assetList.length&&!e.event.assetList.some(e=>{const r=this.getAssetPlayer(e.identifier);return!(null!=r&&r.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,r=this.schedule;if(!this.itemsMatch(e,t)&&r){const{items:i,events:n}=r;if(!i||!n)return t;const s=this.isInterstitial(e),a=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const o=a?a.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${pw(e)}`+(t?` (${o.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(s){const t=r.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((e,r)=>{const i=this.getAssetPlayer(e.identifier);i&&(r===t&&i.loadSource(),i.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(e=>e.pauseBuffering());this.hls.trigger(Ff.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const r=this.setBufferingItem(e);if(!this.playbackDisabled)if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==r){this.bufferingAsset=null;const t=this.detachedData;if(t)if(t.mediaSource){const t=!0;this.attachPrimary(e.start,e,t)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}preloadPrimary(e){const t=this.findItemIndex(e),r=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(r)}bufferedToEvent(e,t){const r=e.event,i=0===r.assetList.length&&!r.assetListLoader,n=r.cue.once;if(i||!n){const e=this.preloadAssets(r,t);if(null!=e&&e.interstitial.appendInPlace){const t=this.primaryMedia;t&&this.bufferAssetPlayer(e,t)}}}preloadAssets(e,t){const r=e.assetUrl,i=e.assetList.length,n=0===i&&!e.assetListLoader,s=e.cue.once;if(n){const n=e.timelineStart;if(e.appendInPlace){var a;const t=this.playingItem;this.isInterstitial(t)||(null==t||null==(a=t.nextEvent)?void 0:a.identifier)!==e.identifier||this.flushFrontBuffer(n+.25)}let s,o=0;if(!this.playingItem&&this.primaryLive&&(o=this.hls.startPosition,-1===o&&(o=this.hls.liveSyncPosition||0)),o&&!e.cue.pre&&!e.cue.post){const e=o-n;e>0&&(s=Math.round(1e3*e)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${r?1:i} ${e}${s?` live-start: ${o} start-offset: ${s}`:""}`),r)return this.createAsset(e,0,0,n,e.duration,r);const l=this.assetListLoader.loadAssetList(e,s);l&&(e.assetListLoader=l)}else if(!s&&i){for(let r=t;r<i;r++){const t=e.assetList[r],i=this.getAssetPlayerQueueIndex(t.identifier);-1!==i&&!this.playerQueue[i].destroyed||t.error||this.createAssetPlayer(e,t,r)}const r=e.assetList[t];if(r){const e=this.getAssetPlayer(r.identifier);return e&&e.loadSource(),e}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`);Object.keys(t).forEach(t=>{this.hls.trigger(Ff.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let r=0;r<t.length;r++)if(e===t[r].assetId)return r;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t)for(let r=0;r<e.length;r++)if(e[r].media===t)return e[r];return null}createAsset(e,t,r,i,n,s){const a={parentIdentifier:e.identifier,identifier:aw(e,s,t),duration:n,startOffset:r,timelineStart:i,uri:s};return this.createAssetPlayer(e,a,t)}createAssetPlayer(e,t,r){const i=this.hls,n=i.userConfig;let s=n.videoPreference;const a=i.loadLevelObj||i.levels[i.currentLevel];(s||a)&&(s=Kf({},s),a.videoCodec&&(s.videoCodec=a.videoCodec),a.videoRange&&(s.allowedVideoRanges=[a.videoRange]));const o=i.audioTracks[i.audioTrack],l=i.subtitleTracks[i.subtitleTrack];let d=0;if(this.primaryLive||e.appendInPlace){const e=this.timelinePos-t.timelineStart;if(e>1){const r=t.duration;r&&e<r&&(d=e)}}const c=t.identifier,u=Xf(Xf({},n),{},{maxMaxBufferLength:Math.min(180,i.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:c,abrEwmaDefaultEstimate:i.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:o||n.audioPreference,subtitlePreference:l||n.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(u.timelineOffset=t.timelineStart));const h=u.cmcd;null!=h&&h.sessionId&&h.contentId&&(u.cmcd=Kf({},h,{contentId:iw(t.uri)})),this.getAssetPlayer(c)&&this.warn(`Duplicate date range identifier ${e} and asset ${c}`);const f=new hw(this.HlsPlayerClass,u,e,t);this.playerQueue.push(f),e.assetList[r]=t;let p=!0;const m=i=>{if(i.live){var n;const t=new Error(`Interstitials MUST be VOD assets ${e}`),i={fatal:!0,type:Mf.OTHER_ERROR,details:Nf.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},s=(null==(n=this.schedule)?void 0:n.findEventIndex(e.identifier))||-1;return void this.handleAssetItemError(i,e,s,r,t.message)}const s=i.edge-i.fragmentStart,a=t.duration;(p||null===a||s>a)&&(p=!1,this.log(`Interstitial asset "${c}" duration change ${a} > ${s}`),t.duration=s,this.updateSchedule())};f.on(Ff.LEVEL_UPDATED,(e,{details:t})=>m(t)),f.on(Ff.LEVEL_PTS_UPDATED,(e,{details:t})=>m(t)),f.on(Ff.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const g=(e,t)=>{const r=this.getAssetPlayer(c);if(r&&t.tracks){r.off(Ff.BUFFER_CODECS,g),r.tracks=t.tracks;const e=this.primaryMedia;this.bufferingAsset===r.assetItem&&e&&!r.media&&this.bufferAssetPlayer(r,e)}};f.on(Ff.BUFFER_CODECS,g);f.on(Ff.BUFFERED_TO_END,()=>{var r;const i=this.getAssetPlayer(c);if(this.log(`buffered to end of asset ${i}`),!i||!this.schedule)return;const n=this.schedule.findEventIndex(e.identifier),s=null==(r=this.schedule.items)?void 0:r[n];this.isInterstitial(s)&&this.advanceAssetBuffering(s,t)});const v=t=>()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;this.shouldPlay=!0;const r=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,r,t)};return f.once(Ff.MEDIA_ENDED,v(r)),f.once(Ff.PLAYOUT_LIMIT_REACHED,v(1/0)),f.on(Ff.ERROR,(t,i)=>{if(!this.schedule)return;const n=this.getAssetPlayer(c);if(i.details===Nf.BUFFER_STALLED_ERROR)return null!=n&&n.appendInPlace?void this.handleInPlaceStall(e):(this.onTimeupdate(),void this.checkBuffer(!0));this.handleAssetItemError(i,e,this.schedule.findEventIndex(e.identifier),r,`Asset player error ${i.error} ${e}`)}),f.on(Ff.DESTROYING,()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;const t=new Error(`Asset player destroyed unexpectedly ${c}`),i={fatal:!0,type:Mf.OTHER_ERROR,details:Nf.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(i,e,this.schedule.findEventIndex(e.identifier),r,t.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${uw(t)}`),this.hls.trigger(Ff.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:r,event:e,player:f}),f}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(-1!==t){this.log(`reset asset player "${e}" after error`);const r=this.playerQueue[t];this.transferMediaFromPlayer(r,null),r.resetDetails()}}clearAssetPlayer(e,t){const r=this.getAssetPlayerQueueIndex(e);if(-1!==r){const e=this.playerQueue[r];this.log(`clear ${e} toSegment: ${t?pw(t):t}`),this.transferMediaFromPlayer(e,t),this.playerQueue.splice(r,1),e.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,r,i,n){const{interstitial:s,assetItem:a,assetId:o}=e,l=s.assetList.length,d=this.playingAsset;this.endedAsset=null,this.playingAsset=a,d&&d.identifier===o||(d&&(this.clearAssetPlayer(d.identifier,r[i]),delete d.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${l} ${uw(a)}`),this.hls.trigger(Ff.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:t,event:s,schedule:r.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,n)}bufferAssetPlayer(e,t){var r,i;if(!this.schedule)return;const{interstitial:n,assetItem:s}=e,a=this.schedule.findEventIndex(n.identifier),o=null==(r=this.schedule.items)?void 0:r[a];if(!o)return;e.loadSource(),this.setBufferingItem(o),this.bufferingAsset=s;const l=this.getBufferingPlayer();if(l===e)return;const d=n.appendInPlace;if(d&&!1===(null==l?void 0:l.interstitial.appendInPlace))return;const c=(null==l?void 0:l.tracks)||(null==(i=this.detachedData)?void 0:i.tracks)||this.requiredTracks;if(d&&s!==this.playingAsset){if(!e.tracks)return void this.log(`Waiting for track info before buffering ${e}`);if(c&&!sp(c,e.tracks)){const t=new Error(`Asset ${uw(s)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(c)}')`),r={fatal:!0,type:Mf.OTHER_ERROR,details:Nf.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},i=n.findAssetIndex(s);return void this.handleAssetItemError(r,n,a,i,t.message)}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,r=this.primaryMedia;if(!t||!r)return;const i=r.currentTime,n=t.findAssetIndex(e,i),s=e.assetList[n];if(s){const a=this.getAssetPlayer(s.identifier);if(a){const o=a.currentTime||i-s.timelineStart,l=a.duration-o;if(this.warn(`Stalled at ${o} of ${o+l} in ${a} ${e} (media.currentTime: ${i})`),o&&(l/r.playbackRate<.5||a.bufferedInPlaceToEnd(r))&&a.hls){const r=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,r,n)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,r,i,n){if(e.details===Nf.BUFFER_STALLED_ERROR)return;const s=t.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${s?uw(s):s} ${e.error}`),!this.schedule)return;const a=(null==s?void 0:s.identifier)||"",o=this.getAssetPlayerQueueIndex(a),l=this.playerQueue[o]||null,d=this.schedule.items,c=Kf({},e,{fatal:!1,errorAction:lg(!0),asset:s,assetListIndex:i,event:t,schedule:d,scheduleIndex:r,player:l});if(this.hls.trigger(Ff.INTERSTITIAL_ASSET_ERROR,c),!e.fatal)return;const u=this.playingAsset,h=this.bufferingAsset,f=new Error(n);if(s&&(this.clearAssetPlayer(a,null),s.error=f),t.assetList.some(e=>!e.error))for(let e=i;e<t.assetList.length;e++)this.resetAssetPlayer(t.assetList[e].identifier);else t.error=f;this.updateSchedule(!0),t.error?this.primaryFallback(t):u&&u.identifier===a?this.advanceAfterAssetEnded(t,r,i):h&&h.identifier===a&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,h)}primaryFallback(e){const t=e.timelineStart,r=this.effectivePlayingItem;let i=this.timelinePos;if(r){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${i} playing: ${pw(r)} error: ${e.error}`),-1===i&&(i=this.hls.startPosition);const n=this.updateItem(r,i);this.itemsMatch(r,n)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(-1===i)return void this.checkStart();if(!this.schedule)return;const n=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(n)}onAssetListLoaded(e,t){var r,i;const n=t.event,s=n.identifier,a=t.assetListResponse.ASSETS;if(null==(r=this.schedule)||!r.hasEvent(s))return;const o=n.timelineStart,l=n.duration;let d=0;a.forEach((e,t)=>{const r=parseFloat(e.DURATION);this.createAsset(n,t,d,o+d,r,e.URI),d+=r}),n.duration=d,this.log(`Loaded asset-list with duration: ${d} (was: ${l}) ${n}`);const c=this.waitingItem,u=(null==c?void 0:c.event.identifier)===s;this.updateSchedule();const h=null==(i=this.bufferingItem)?void 0:i.event;if(u){var f;const e=this.schedule.findEventIndex(s),t=null==(f=this.schedule.items)?void 0:f[e];if(t){if(!this.playingItem&&this.timelinePos>t.end){if(this.schedule.findItemIndexAtTime(this.timelinePos)!==e)return n.error=new Error(`Interstitial ${a.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${n}`),this.log(n.error.message),this.updateSchedule(!0),void this.primaryFallback(n)}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if((null==h?void 0:h.identifier)===s){const e=n.assetList[0];if(e){const t=this.getAssetPlayer(e.identifier);if(h.appendInPlace){const e=this.primaryMedia;t&&e&&this.bufferAssetPlayer(t,e)}else t&&t.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case Nf.ASSET_LIST_PARSING_ERROR:case Nf.ASSET_LIST_LOAD_ERROR:case Nf.ASSET_LIST_LOAD_TIMEOUT:{const e=t.interstitial;e&&(this.updateSchedule(!0),this.primaryFallback(e));break}case Nf.BUFFER_STALLED_ERROR:{const e=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(e)&&e.event.appendInPlace)return void this.handleInPlaceStall(e.event);this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}});function SS(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(SS):Object.keys(e).reduce((t,r)=>(t[r]=SS(e[r]),t),{}):e}function TS(e,t){const r=e.loader;if(r!==gS&&r!==ES)t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=gS,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}}class xS extends Ig{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;null!=(e=this.media)&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{var e;this.hls&&(this.ended=(null==(e=this.media)?void 0:e.currentTime)||1,this.hls.trigger(Ff.MEDIA_ENDED,{stalled:!1}))},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Ff.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Ff.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(100),this.mediaSource=t.mediaSource;const r=this.media=t.media;Kv(r,"playing",this.onMediaPlaying),Kv(r,"waiting",this.onMediaWaiting),Kv(r,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:r}=this;r&&(qv(r,"playing",this.onMediaPlaying),qv(r,"waiting",this.onMediaWaiting),qv(r,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(null==(e=this.media)||!e.readyState||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var r,i;const n=null==(r=this.hls)?void 0:r.config;if(!n)return;const s=this.media;if(!s)return;const{seeking:a}=s,o=this.seeking&&!a,l=!this.seeking&&a,d=s.paused&&!a||s.ended||0===s.playbackRate;if(this.seeking=a,e!==t)return t&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!d&&e>t&&this.nudgeOnVideoHole(e,t)),void(0===this.waiting&&this.stallResolved(e));if(l||o)return void(o&&this.stallResolved(e));if(d)return this.nudgeRetry=0,this.stallResolved(e),void(!this.ended&&s.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(Ff.MEDIA_ENDED,{stalled:!1})));if(!Dg.getBuffered(s).length)return void(this.nudgeRetry=0);const c=Dg.bufferInfo(s,e,0),u=c.nextStart||0,h=this.fragmentTracker;if(a&&h&&this.hls){const t=AS(this.hls.inFlightFragments,e),r=c.len>2,i=!u||t||u-e>2&&!h.getPartialFragment(e);if(r||i)return;this.moved=!1}const f=null==(i=this.hls)?void 0:i.latestLevelDetails;if(!this.moved&&null!==this.stalled&&h){if(!(c.len>0)&&!u)return;const t=Math.max(u,c.start||0)-e,r=!(null==f||!f.live)?2*f.targetduration:2,i=LS(e,h);if(t>0&&(t<=r||i))return void(s.paused||this._trySkipBufferHole(i))}const p=n.detectStallWithCurrentTimeMs,m=self.performance.now(),g=this.waiting;let v=this.stalled;if(null===v){if(!(g>0&&m-g<p))return void(this.stalled=m);v=this.stalled=g}const y=m-v;if(!a&&(y>=p||g)&&this.hls){var b;if("ended"===(null==(b=this.mediaSource)?void 0:b.readyState)&&(null==f||!f.live)&&Math.abs(e-((null==f?void 0:f.edge)||0))<1){if(this.ended)return;return this.ended=e||1,void this.hls.trigger(Ff.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(c),!this.media||!this.hls)return}const E=Dg.bufferInfo(s,e,n.maxBufferHole);this._tryFixBufferStall(E,y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const r=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(r)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(Ff.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var r;const i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(r=this.buffered.audio)&&r.length&&i&&i.length>1&&e>i.end(0)){const r=Dg.bufferedInfo(Dg.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){const r=Dg.timeRangesToArray(i),n=Dg.bufferedInfo(r,t,0).bufferedIndex;if(n>-1&&n<r.length-1){const t=Dg.bufferedInfo(r,e,0).bufferedIndex,i=r[n].end,s=r[n+1].start;if((-1===t||t>n)&&s-i<1&&e-i<2){const r=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${i} -> ${s} buffered index: ${t}`);this.warn(r.message),this.media.currentTime+=1e-6;let n=LS(e,this.fragmentTracker);n&&"fragment"in n?n=n.fragment:n||(n=void 0);const a=Dg.bufferInfo(this.media,e,0);this.hls.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:r,reason:r.message,frag:n,buffer:a.len,bufferInfo:a})}}}}}_tryFixBufferStall(e,t,r){var i,n;const{fragmentTracker:s,media:a}=this,o=null==(i=this.hls)?void 0:i.config;if(!a||!s||!o)return;const l=null==(n=this.hls)?void 0:n.latestLevelDetails,d=LS(r,s);if(d||null!=l&&l.live&&r<l.fragmentStart){if(this._trySkipBufferHole(d)||!this.media)return}const c=e.buffered,u=this.adjacentTraversal(e,r);(c&&c.length>1&&e.len>o.maxBufferHole||e.nextStart&&(e.nextStart-r<o.maxBufferHole||u))&&(t>1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const r=this.fragmentTracker,i=e.nextStart;if(r&&i){const e=r.getFragAtPos(t,Gf),n=r.getFragAtPos(i,Gf);if(e&&n)return n.sn-e.sn<2}return!1}_reportStall(e){const{hls:t,media:r,stallReported:i,stalled:n}=this;if(!i&&null!==n&&r&&t){this.stallReported=!0;const i=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${Cm(e)})`);this.warn(i.message),t.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:r,media:i}=this,n=null==(t=this.hls)?void 0:t.config;if(!i||!r||!n)return 0;const s=i.currentTime,a=Dg.bufferInfo(i,s,0),o=s<a.start?a.start:a.nextStart;if(o&&this.hls){const t=a.len<=n.maxBufferHole,d=a.len>0&&a.len<1&&i.readyState<3,c=o-s;if(c>0&&(t||d)){if(c>n.maxBufferHole){let t=!1;if(0===s){const e=r.getAppendedFrag(0,Gf);e&&o<e.end&&(t=!0)}if(!t&&e){var l;if(null==(l=this.hls.loadLevelObj)||!l.details)return 0;if(AS(this.hls.inFlightFragments,o))return 0;let t=!1,i=e.end;for(;i<o;){const e=LS(i,r);if(!e){t=!0;break}i+=e.duration}if(t)return 0}}const t=Math.max(o+.05,s+.1);if(this.warn(`skipping hole, adjusting currentTime from ${s} to ${t}`),this.moved=!0,i.currentTime=t,null==e||!e.gap){const r=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${t}`),i={type:Mf.MEDIA_ERROR,details:Nf.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:r,reason:r.message,buffer:a.len,bufferInfo:a};e&&("fragment"in e?i.part=e:i.frag=e),this.hls.trigger(Ff.ERROR,i)}return t}}return 0}_tryNudgeBuffer(e){const{hls:t,media:r,nudgeRetry:i}=this,n=null==t?void 0:t.config;if(!r||!n)return 0;const s=r.currentTime;if(this.nudgeRetry++,i<n.nudgeMaxRetry){const a=s+(i+1)*n.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${s} to ${a}`);this.warn(o.message),r.currentTime=a,t.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1,buffer:e.len,bufferInfo:e})}else{const r=new Error(`Playhead still not moving while enough data buffered @${s} after ${n.nudgeMaxRetry} nudges`);this.error(r.message),t.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.BUFFER_STALLED_ERROR,error:r,fatal:!0,buffer:e.len,bufferInfo:e})}}}function AS(e,t){const r=kS(e.main);if(r&&r.start<=t)return r;const i=kS(e.audio);return i&&i.start<=t?i:null}function kS(e){if(!e)return null;switch(e.state){case Zv:case Qv:case sy:case ay:return null}return e.frag}function LS(e,t){return t.getAppendedFrag(e,Gf)||t.getPartialFragment(e)}function IS(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function RS(e,t,r,i,n){let s=new e(t,r,"");try{s.value=i,n&&(s.type=n)}catch(a){s=new e(t,r,Cm(n?Xf({type:n},i):i))}return s}const PS=(()=>{const e=IS();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class DS{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(Ff.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Ff.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Ff.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(Ff.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(Ff.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Ff.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Ff.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var r;this.media=t.media,!1===(null==(r=t.overrides)?void 0:r.cueRemoval)&&(this.removeCues=!1)}onMediaAttached(){var e;const t=null==(e=this.hls)?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null;!!t.transferMedia||(this.id3Track&&(this.removeCues&&ew(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const r=e[t];if("metadata"===r.kind&&"id3"===r.label)return ZE(r,this.media),r}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:r,enableID3MetadataCues:i}=this.hls.config;if(!r&&!i)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=IS();if(s)for(let e=0;e<n.length;e++){const t=n[e].type;if(t===By.emsg&&!r||!i)continue;const a=My(n[e].data),o=n[e].pts;let l=o+n[e].duration;l>PS&&(l=PS);l-o<=0&&(l=o+.25);for(let e=0;e<a.length;e++){const r=a[e];if(!Ny(r)){this.updateId3CueEnds(o,t);const e=RS(s,o,l,r,t);e&&this.id3Track.addCue(e)}}}}updateId3CueEnds(e,t){var r;const i=null==(r=this.id3Track)?void 0:r.cues;if(i)for(let r=i.length;r--;){const n=i[r];n.type===t&&n.startTime<e&&n.endTime===PS&&(n.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:r,type:i}){const{id3Track:n,hls:s}=this;if(!s)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:o}}=s;if(n&&(a||o)){let e;e="audio"===i?e=>e.type===By.audioId3&&o:"video"===i?e=>e.type===By.emsg&&a:e=>e.type===By.audioId3&&o||e.type===By.emsg&&a,tw(n,t,r,e)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:r,timelineOffset:i,enableDateRangeMetadataCues:n,interstitialsController:s}=this.hls.config;if(!n)return;const a=IS();if(r&&i&&!s){const{fragmentStart:t,fragmentEnd:i}=e;let n=this.assetCue;n?(n.startTime=t,n.endTime=i):a&&(n=this.assetCue=RS(a,t,i,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),n&&(n.id=r,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(n),n.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:o}=this,{dateRanges:l}=e,d=Object.keys(l);let c=this.dateRangeCuesAppended;var u;if(o&&t)if(null!=(u=o.cues)&&u.length){const e=Object.keys(c).filter(e=>!d.includes(e));for(let t=e.length;t--;){var h;const r=e[t],i=null==(h=c[r])?void 0:h.cues;delete c[r],i&&Object.keys(i).forEach(e=>{const t=i[e];if(t){t.removeEventListener("enter",this.onEventCueEnter);try{o.removeCue(t)}catch(e){}}})}}else c=this.dateRangeCuesAppended={};const f=e.fragments[e.fragments.length-1];if(0!==d.length&&Cf(null==f?void 0:f.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let e=0;e<d.length;e++){const t=d[e],r=l[t],i=r.startTime,n=c[t],o=(null==n?void 0:n.cues)||{};let u=(null==n?void 0:n.durationKnown)||!1,h=PS;const{duration:f,endDate:p}=r;if(p&&null!==f)h=i+f,u=!0;else if(r.endOnNext&&!u){const e=d.reduce((e,t)=>{if(t!==r.id){const i=l[t];if(i.class===r.class&&i.startDate>r.startDate&&(!e||r.startDate<e.startDate))return i}return e},null);e&&(h=e.startTime,u=!0)}const m=Object.keys(r.attr);for(let e=0;e<m.length;e++){const l=m[e];if(!Ug(l))continue;const d=o[l];if(d)!u||null!=n&&n.durationKnown?Math.abs(d.startTime-i)>.01&&(d.startTime=i,d.endTime=h):d.endTime=h;else if(a){let e=r.attr[l];zg(l)&&(e=lp(e));const n=RS(a,i,h,{key:l,data:e},By.dateRange);n&&(n.id=t,this.id3Track.addCue(n),o[l]=n,s&&("X-ASSET-LIST"!==l&&"X-ASSET-URL"!==l||n.addEventListener("enter",this.onEventCueEnter)))}}c[t]={cues:o,dateRange:r,durationKnown:u}}}}}class CS{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;const r=this.computeLatency();if(null===r)return;this._latency=r;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:n}=this.config;if(!i||1===n||!t.live)return;const s=this.targetLatency;if(null===s)return;const a=r-s;if(a<Math.min(this.maxLatency,s+t.targetduration)&&a>.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,n)),r=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20,i=Math.min(t,Math.max(1,r));this.changeMediaPlaybackRate(e,i)}else 1!==e.playbackRate&&0!==e.playbackRate&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return(null==(e=this.hls)?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(void 0!==e.liveMaxLatencyDuration)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(null===e||null===this.hls)return null;const{holdBack:t,partHoldBack:r,targetduration:i}=e,{liveSyncDuration:n,liveSyncDurationCount:s,lowLatencyMode:a}=this.config,o=this.hls.userConfig;let l=a&&r||t;(this._targetLatencyUpdated||o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==n?n:s*i);const d=i;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,d)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t)return null;const r=this.levelDetails;if(null===r)return null;const i=r.edge,n=e-t-this.edgeStalled,s=i-r.totalduration,a=i-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(s,n),a)}get drift(){const e=this.levelDetails;return null===e?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const r=e.buffered.length;return(r?e.buffered.end(r-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Ff.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(Ff.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Ff.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Ff.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var r;t.details===Nf.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(r=this.levelDetails)&&r.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var r,i;e.playbackRate!==t&&(null==(r=this.hls)||r.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${null==(i=this.targetLatency)?void 0:i.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}class _S extends zb{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Ff.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Ff.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Ff.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Ff.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const r=this.hls.config.preferManagedMediaSource,i=[],n={},s={};let a=!1,o=!1,l=!1;t.levels.forEach(e=>{const t=e.attrs;let{audioCodec:d,videoCodec:c}=e;d&&(e.audioCodec=d=dm(d,r)||void 0),c&&(c=e.videoCodec=function(e){const t=e.split(",");for(let e=0;e<t.length;e++){const r=t[e].split(".");r.length>2&&"avc1"===r[0]&&(t[e]=`avc1.${parseInt(r[1]).toString(16)}${("000"+parseInt(r[2]).toString(16)).slice(-4)}`)}return t.join(",")}(c));const{width:u,height:h,unknownCodecs:f}=e,p=(null==f?void 0:f.length)||0;if(a||(a=!(!u||!h)),o||(o=!!c),l||(l=!!d),p||d&&!this.isAudioSupported(d)||c&&!this.isVideoSupported(c))return void this.log(`Some or all CODECS not supported "${t.CODECS}"`);const{CODECS:m,"FRAME-RATE":g,"HDCP-LEVEL":v,"PATHWAY-ID":y,RESOLUTION:b,"VIDEO-RANGE":E}=t,w=`${`${y||"."}-`}${e.bitrate}-${b}-${g}-${m}-${E}-${v}`;if(n[w])if(n[w].uri===e.url||e.attrs["PATHWAY-ID"])n[w].addGroupId("audio",t.AUDIO),n[w].addGroupId("text",t.SUBTITLES);else{const t=s[w]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const r=this.createLevel(e);n[w]=r,i.push(r)}else{const t=this.createLevel(e);n[w]=t,s[w]=1,i.push(t)}}),this.filterAndSortMediaOptions(i,t,a,o,l)}createLevel(e){const t=new Rm(e),r=e.supplemental;if(null!=r&&r.videoCodec&&!this.isVideoSupported(r.videoCodec)){const e=new Error(`SUPPLEMENTAL-CODECS not supported "${r.videoCodec}"`);this.log(e.message),t.supportedResult=vm(e,[])}return t}isAudioSupported(e){return rm(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return rm(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,r,i,n){var s;let a=[],o=[],l=e;const d=(null==(s=t.stats)?void 0:s.parsing)||{};if((r||i)&&n&&(l=l.filter(({videoCodec:e,videoRange:t,width:r,height:i})=>{return(!!e||!(!r||!i))&&(!!(n=t)&&Tm.indexOf(n)>-1);var n})),0===l.length)return Promise.resolve().then(()=>{if(this.hls){let e="no level with compatible codecs found in manifest",r=e;t.levels.length&&(r=`one or more CODECS in variant not supported: ${Cm(t.levels.map(e=>e.attrs.CODECS).filter((e,t,r)=>r.indexOf(e)===t))}`,this.warn(r),e+=` (${r})`);const i=new Error(e);this.hls.trigger(Ff.ERROR,{type:Mf.MEDIA_ERROR,details:Nf.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:i,reason:r})}}),void(d.end=performance.now());t.audioTracks&&(a=t.audioTracks.filter(e=>!e.audioCodec||this.isAudioSupported(e.audioCodec)),OS(a)),t.subtitles&&(o=t.subtitles,OS(o));const c=l.slice(0);l.sort((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Tm.indexOf(e.videoRange)-Tm.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const r=sm(e.videoCodec),i=sm(t.videoCodec);if(r!==i)return i-r}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const r=am(e.codecSet),i=am(t.codecSet);if(r!==i)return i-r}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0});let u=c[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==c.length))for(let e=0;e<c.length;e++)if(c[e].pathwayId===l[0].pathwayId){u=c[e];break}this._levels=l;for(let e=0;e<l.length;e++)if(l[e]===u){var h;this._firstLevel=e;const t=u.bitrate,r=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${t}`),void 0===(null==(h=this.hls.userConfig)?void 0:h.abrEwmaDefaultEstimate)){const e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>r&&r===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const f=n&&!i,p=this.hls.config,m=!(!p.audioStreamController||!p.audioTrackController),g={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:i,altAudio:m&&!f&&a.some(e=>!!e.url)};d.end=performance.now(),this.hls.trigger(Ff.MANIFEST_PARSED,g)}get levels(){return 0===this._levels.length?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const r=new Error("invalid level idx"),i=e<0;if(this.hls.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.LEVEL_SWITCH_ERROR,level:e,fatal:i,error:r,reason:r.message}),i)return;e=Math.min(e,t.length-1)}const r=this.currentLevelIndex,i=this.currentLevel,n=i?i.attrs["PATHWAY-ID"]:void 0,s=t[e],a=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,r===e&&i&&n===a)return;this.log(`Switching to level ${e} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${a?" with Pathway "+a:""} from level ${r}${n?" with Pathway "+n:""}`);const o={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(Ff.LEVEL_SWITCHING,o);const l=s.details;if(!l||l.live){const e=this.switchParams(s.uri,null==i?void 0:i.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),r=e.filter(e=>-1!==t.indexOf(e));if(e.length<1)return void this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);this.steering.pathwayPriority=r}}onError(e,t){!t.fatal&&t.context&&t.context.type===Bf&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===Gf){const e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;const r=this._levels[t.level];null!=r&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var r;const{level:i,details:n}=t,s=t.levelInfo;var a;if(!s)return this.warn(`Invalid level index ${i}`),void(null!=(a=t.deliveryDirectives)&&a.skip&&(n.deltaUpdateFailed=!0));if(s===this.currentLevel||t.withoutMultiVariant){0===s.fragmentError&&(s.loadError=0);let e=s.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(i,t,e)}else null!=(r=t.deliveryDirectives)&&r.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const r=this.getUrlWithDirectives(e.uri,t),i=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],s=e.details,a=null==s?void 0:s.age;this.log(`Loading level index ${i}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${n?" Pathway "+n:""}${a&&s.live?" age "+a.toFixed(1)+(s.type&&" "+s.type||""):""} ${r}`),this.hls.trigger(Ff.LEVEL_LOADING,{url:r,level:i,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(1===this._levels.length)return;const r=this._levels.filter((t,r)=>r!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1));Uv(r),this._levels=r,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const i=r.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(Ff.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(Ff.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}}function OS(e){const t={};e.forEach(e=>{const r=e.groupId||"";e.id=t[r]=t[r]||0,t[r]++})}function MS(){return self.SourceBuffer||self.WebKitSourceBuffer}function NS(){if(!np())return!1;const e=MS();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class FS extends dy{constructor(e,t,r){super(e,t,r,"stream-controller",Gf),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const e=this.media,t=e?e.currentTime:null;if(null===t||!Cf(t))return;if(this.log(`Media seeked to ${t.toFixed(3)}`),!this.getBufferedFrag(t))return;const r=this.getFwdBufferInfoAtPos(e,t,Gf,0);null!==r&&0!==r.len?this.tick():this.warn(`Main forward buffer length at ${t} on "seeked" event ${r?r.len:"empty"})`)},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Ff.LEVEL_LOADING,this.onLevelLoading,this),e.on(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Ff.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(Ff.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Ff.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(Ff.BUFFER_CREATED,this.onBufferCreated,this),e.on(Ff.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Ff.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(Ff.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Ff.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Ff.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(Ff.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Ff.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(Ff.BUFFER_CREATED,this.onBufferCreated,this),e.off(Ff.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Ff.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:r,hls:i}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=i.startLevel;-1===e&&(i.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this._hasEnoughToStart=!!t}r>0&&-1===e&&!t&&(this.log(`Override startPosition with lastCurrentTime @${r.toFixed(3)}`),e=r),this.state=Zv,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Qv}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case ly:{const{levels:e,level:t}=this,r=null==e?void 0:e[t],i=null==r?void 0:r.details;if(i&&(!i.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(i))break;this.state=Zv;break}if(this.hls.nextLoadLevel!==this.level){this.state=Zv;break}break}case ty:this.checkRetryDate()}this.state===Zv&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),null!=(e=this.media)&&e.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:r,media:i}=this;if(null===t||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(null==r||!r[n])return;const s=r[n],a=this.getMainFwdBufferInfo();if(null===a)return;const o=this.getLevelDetails();if(o&&this._streamEnded(a,o)){const e={};return 2===this.altAudio&&(e.type="video"),this.hls.trigger(Ff.BUFFER_EOS,e),void(this.state=sy)}if(!this.buffering)return;e.loadLevel!==n&&-1===e.manualLevel&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const l=s.details;if(!l||this.state===ly||this.waitForLive(s))return this.level=n,this.state=ly,void(this.startFragRequested=!1);const d=a.len,c=this.getMaxBufferLength(s.maxBitrate);if(d>=c)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const u=this.backtrackFragment?this.backtrackFragment.start:a.end;let h=this.getNextFragment(u,l);if(this.couldBacktrack&&!this.fragPrevious&&h&&Tp(h)&&this.fragmentTracker.getState(h)!==hg){var f;const e=(null!=(f=this.backtrackFragment)?f:h).sn-l.startSN,t=l.fragments[e-1];t&&h.cc===t.cc&&(h=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(h&&this.isLoopLoading(h,u)){if(!h.gap){const e=this.audioOnly&&!this.altAudio?bp:Ep,t=(e===Ep?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,Gf)}h=this.getNextFragmentLoopLoading(h,l,a,Gf,c)}h&&(!h.initSegment||h.initSegment.data||this.bitrateTest||(h=h.initSegment),this.loadFragment(h,s,u))}loadFragment(e,t,r){const i=this.fragmentTracker.getState(e);i===dg||i===ug?Tp(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,r):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Gf)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let r;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const n=this.getLevelDetails();if(null!=n&&n.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*n.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],i=this.fragLastKbps;r=i&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*i)+1:0}else r=0;const s=this.getBufferedFrag(t.currentTime+r);if(s){const e=this.followingBufferedFrag(s);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,r=e.duration,i=Math.max(s.end,t+Math.min(Math.max(r-this.config.maxFragLookUpTolerance,r*(this.couldBacktrack?.5:.125)),r*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(i,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Jv:case ey:case ty:case iy:case ny:this.state=Zv}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,2===this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const r=t.media;Kv(r,"playing",this.onMediaPlaying),Kv(r,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:r}=this;r&&(qv(r,"playing",this.onMediaPlaying),qv(r,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t);!!t.transferMedia||(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(Ff.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let r=!1,i=!1;for(let e=0;e<t.levels.length;e++){const n=t.levels[e].audioCodec;n&&(r=r||-1!==n.indexOf("mp4a.40.2"),i=i||-1!==n.indexOf("mp4a.40.5"))}this.audioCodecSwitch=r&&i&&!function(){var e;const t=MS();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:r}=this;if(!r||this.state!==Zv)return;const i=t.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=ly)}onLevelLoaded(e,t){var r;const{levels:i,startFragRequested:n}=this,s=t.level,a=t.details,o=a.totalduration;if(!i)return void this.warn(`Levels were reset while loading level ${s}`);this.log(`Level ${s} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const l=t.levelInfo,d=this.fragCurrent;!d||this.state!==ey&&this.state!==ty||d.level!==t.level&&d.loader&&this.abortCurrentFrag();let c=0;if(a.live||null!=(r=l.details)&&r.live){var u;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;c=this.alignPlaylists(a,l.details,null==(u=this.levelLastLoaded)?void 0:u.details)}if(l.details=a,this.levelLastLoaded=l,n||this.setStartPosition(a,c),this.hls.trigger(Ff.LEVEL_UPDATED,{details:a,level:s}),this.state===ly){if(this.waitForCdnTuneIn(a))return;this.state=Zv}n&&a.live&&this.synchronizeToLiveEdge(a),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:r}=this;if(!r)return;const i=this.hls.liveSyncPosition,n=this.getLoadPosition(),s=e.fragmentStart,a=e.edge,o=n>=s-t.maxFragLookUpTolerance&&n<=a;if(null!==i&&r.duration>i&&(n<i||!o)){const s=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!o&&r.readyState<4||n<a-s)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),r.readyState))if(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${i.toFixed(3)}`),"buffered"===this.config.liveSyncMode){var l;const e=Dg.bufferInfo(r,i,0);if(null==(l=e.buffered)||!l.length)return void(r.currentTime=i);if(e.start<=n)return void(r.currentTime=i);const{nextStart:t}=Dg.bufferedInfo(e.buffered,n,0);t&&(r.currentTime=t)}else r.currentTime=i}}_handleFragmentLoadProgress(e){var t;const r=e.frag,{part:i,payload:n}=e,{levels:s}=this;if(!s)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const a=s[r.level];if(!a)return void this.warn(`Level ${r.level} not found on progress`);const o=a.details;if(!o)return this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),void this.fragmentTracker.removeFragment(r);const l=a.videoCodec,d=o.PTSKnown||!o.live,c=null==(t=r.initSegment)?void 0:t.data,u=this._getAudioCodec(a),h=this.transmuxer=this.transmuxer||new Ub(this.hls,Gf,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,p=-1!==f,m=new Rg(r.level,r.sn,r.stats.chunkCount,n.byteLength,f,p),g=this.initPTS[r.cc];h.push(n,c,u,l,r,i,o.totalduration,d,m,g)}onAudioTrackSwitching(e,t){const r=this.hls,i=0!==this.altAudio;if(Um(t.url,r))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(i)return this.altAudio=0,this.fragmentTracker.removeAllFragments(),r.once(Ff.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(Ff.AUDIO_TRACK_SWITCHED,t)}),void r.trigger(Ff.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});r.trigger(Ff.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const r=Um(t.url,this.hls);if(r){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=r?2:0,this.tick()}onBufferCreated(e,t){const r=t.tracks;let i,n,s=!1;for(const e in r){const t=r[e];if("main"===t.id){if(n=e,i=t,"video"===e){const t=r[e];t&&(this.videoBuffer=t.buffer)}}else s=!0}s&&i?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:r,part:i}=t,n=r.type===Gf;if(n){if(this.fragContextChanged(r))return this.warn(`Fragment ${r.sn}${i?" p: "+i.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===ny&&(this.state=Zv));const e=i?i.stats:r.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),Tp(r)&&(this.fragPrevious=r),this.fragBufferedComplete(r,i)}const s=this.media;s&&(!this._hasEnoughToStart&&Dg.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var r;if(t.fatal)this.state=ay;else switch(t.details){case Nf.FRAG_GAP:case Nf.FRAG_PARSING_ERROR:case Nf.FRAG_DECRYPT_ERROR:case Nf.FRAG_LOAD_ERROR:case Nf.FRAG_LOAD_TIMEOUT:case Nf.KEY_LOAD_ERROR:case Nf.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Gf,t);break;case Nf.LEVEL_LOAD_ERROR:case Nf.LEVEL_LOAD_TIMEOUT:case Nf.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==ly||(null==(r=t.context)?void 0:r.type)!==Bf||(this.state=Zv);break;case Nf.BUFFER_ADD_CODEC_ERROR:case Nf.BUFFER_APPEND_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case Nf.BUFFER_FULL_ERROR:if("main"!==t.parent)return;if(this.reduceLengthAndFlushBuffer(t)){!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case Nf.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onFragLoadEmergencyAborted(){this.state=Zv,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==bp||!this.altAudio){const e=(t===Ep?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,t,Gf),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let r=this.startPosition;if(r>=0&&t<r){if(e.seeking)return void this.log(`could not seek to ${r}, already seeking at ${t}`);const i=this.timelineOffset;i&&r&&(r+=i);const n=this.getLevelDetails(),s=Dg.getBuffered(e),a=s.length?s.start(0):0,o=a-r,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||o>0&&(o<l||this.loadingParts&&o<2*((null==n?void 0:n.partTarget)||0)))&&(this.log(`adjusting start position by ${o} to match buffer start`),r+=o,this.startPosition=r),t<r&&(this.log(`seek to target start position ${r} from current time ${t} buffer start ${a}`),e.currentTime=r)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(e=>{const{hls:r}=this,i=null==e?void 0:e.frag;if(!i||this.fragContextChanged(i))return;t.fragmentError=0,this.state=Zv,this.startFragRequested=!1,this.bitrateTest=!1;const n=i.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(Ff.FRAG_LOADED,e),i.bitrateTest=!1}).catch(t=>{this.state!==Qv&&this.state!==ay&&(this.warn(t),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:r}=this,{remuxResult:i,chunkMeta:n}=e,s=this.getCurrentContext(n);if(!s)return void this.resetWhenMissingContext(n);const{frag:a,part:o,level:l}=s,{video:d,text:c,id3:u,initSegment:h}=i,{details:f}=l,p=this.altAudio?void 0:i.audio;if(this.fragContextChanged(a))this.fragmentTracker.removeFragment(a);else{if(this.state=iy,h){const e=h.tracks;if(e){const i=a.initSegment||a;if(this.unhandledEncryptionError(h,a))return;this._bufferInitSegment(l,e,i,n),r.trigger(Ff.FRAG_PARSING_INIT_SEGMENT,{frag:i,id:t,tracks:e})}const i=h.initPTS,s=h.timescale,o=this.initPTS[a.cc];if(Cf(i)&&(!o||o.baseTime!==i||o.timescale!==s)){const e=h.trackId;this.initPTS[a.cc]={baseTime:i,timescale:s,trackId:e},r.trigger(Ff.INIT_PTS_FOUND,{frag:a,id:t,initPTS:i,timescale:s,trackId:e})}}if(d&&f){p&&"audiovideo"===d.type&&this.logMuxedErr(a);const e=f.fragments[a.sn-1-f.startSN],t=a.sn===f.startSN,r=!e||a.cc>e.cc;if(!1!==i.independent){const{startPTS:e,endPTS:i,startDTS:s,endDTS:l}=d;if(o)o.elementaryStreams[d.type]={startPTS:e,endPTS:i,startDTS:s,endDTS:l};else if(d.firstKeyFrame&&d.independent&&1===n.id&&!r&&(this.couldBacktrack=!0),d.dropped&&d.independent){const n=this.getMainFwdBufferInfo(),s=(n?n.end:this.getLoadPosition())+this.config.maxBufferHole,o=d.firstKeyFramePTS?d.firstKeyFramePTS:e;if(!t&&s<o-this.config.maxBufferHole&&!r)return void this.backtrack(a);r&&(a.gap=!0),a.setElementaryStreamInfo(d.type,a.start,i,a.start,l,!0)}else t&&e-(f.appliedTimelineOffset||0)>2&&(a.gap=!0);a.setElementaryStreamInfo(d.type,e,i,s,l),this.backtrackFragment&&(this.backtrackFragment=a),this.bufferFragmentData(d,a,o,n,t||r)}else{if(!t&&!r)return void this.backtrack(a);a.gap=!0}}if(p){const{startPTS:e,endPTS:t,startDTS:r,endDTS:i}=p;o&&(o.elementaryStreams[bp]={startPTS:e,endPTS:t,startDTS:r,endDTS:i}),a.setElementaryStreamInfo(bp,e,t,r,i),this.bufferFragmentData(p,a,o,n)}if(f&&null!=u&&u.samples.length){const e={id:t,frag:a,details:f,samples:u.samples};r.trigger(Ff.FRAG_PARSING_METADATA,e)}if(f&&c){const e={id:t,frag:a,details:f,samples:c.samples};r.trigger(Ff.FRAG_PARSING_USERDATA,e)}}}logMuxedErr(e){this.warn(`${Tp(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,r,i){if(this.state!==iy)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(r));const{audio:n,video:s,audiovideo:a}=t;if(n){const r=e.audioCodec;let i=cm(n.codec,r);"mp4a"===i&&(i="mp4a.40.5");const s=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){i&&(i=-1!==i.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const e=n.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===s.indexOf("firefox")&&(i="mp4a.40.5")}i&&-1!==i.indexOf("mp4a.40.5")&&-1!==s.indexOf("android")&&"audio/mpeg"!==n.container&&(i="mp4a.40.2",this.log(`Android: force audio codec to ${i}`)),r&&r!==i&&this.log(`Swapping manifest audio codec "${r}" for "${i}"`),n.levelCodec=i,n.id=Gf,this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${i||""}/${r||""}/${n.codec}]`),delete t.audiovideo}if(s){s.levelCodec=e.videoCodec,s.id=Gf;const r=s.codec;if(4===(null==r?void 0:r.length))switch(r){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e"}this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${e.videoCodec||""}/${r}]${s.codec!==r?" parsed-corrected="+s.codec:""}${s.supplemental?" supplemental="+s.supplemental:""}`),delete t.audiovideo}a&&(this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),delete t.video,delete t.audio);const o=Object.keys(t);if(o.length){if(this.hls.trigger(Ff.BUFFER_CODECS,t),!this.hls)return;o.forEach(e=>{const n=t[e].initSegment;null!=n&&n.byteLength&&this.hls.trigger(Ff.BUFFER_APPENDING,{type:e,data:n,frag:r,part:null,chunkMeta:i,parent:r.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&2===this.altAudio?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Gf)}get maxBufferLength(){const{levels:e,level:t}=this,r=null==e?void 0:e[t];return r?this.getMaxBufferLength(r.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Zv}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const r=e.currentTime;if(Dg.isBuffered(e,r)?t=this.getAppendedFrag(r):Dg.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,r=t.level;e&&t.sn===e.sn&&e.level===r||(this.fragPlaying=t,this.hls.trigger(Ff.FRAG_CHANGED,{frag:t}),e&&e.level===r||this.hls.trigger(Ff.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return Cf(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(Cf(t)){const e=this.getLevelDetails(),r=this.currentFrag||(e?Gm(null,e.fragments,t):null);if(r){const e=r.programDateTime;if(null!==e){const i=e+1e3*(t-r.start);return new Date(i)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class $S extends Qf{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const r in this.keyIdToKeyInfo){const i=this.keyIdToKeyInfo[r].loader;if(i){var t;if(e&&e!==(null==(t=i.context)?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=Nf.KEY_LOAD_ERROR,r,i,n){return new Lg({type:Mf.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:r,networkDetails:i})}loadClear(e,t,r){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let i=0,n=t.length;i<n;i++){const s=t[i];if(e.cc<=s.cc&&(!Tp(e)||!Tp(s)||e.sn<s.sn)||!r&&i==n-1)return this.emeController.selectKeySystemFormat(s).then(e=>{if(!this.emeController)return;s.setKeyFormat(e);const t=nv(e);return t?this.emeController.getKeySystemAccess([t]):void 0})}if(this.config.requireKeySystemAccessOnStart){const e=av(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var r,i;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const r=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,Nf.KEY_LOAD_ERROR,r))}const s=n.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,Nf.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));const a=BS(n);let o=this.keyIdToKeyInfo[a];if(null!=(r=o)&&r.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if(this.emeController&&null!=(i=o)&&i.keyLoadPromise){switch(this.emeController.getKeyStatus(o.decryptdata)){case"usable":case"usable-in-future":return o.keyLoadPromise.then(t=>{const{keyInfo:r}=t;return n.key=r.decryptdata.key,{frag:e,keyInfo:r}})}}switch(this.log(`${this.keyIdToKeyInfo[a]?"Rel":"L"}oading${n.keyId?" keyId: "+op(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`),o=this.keyIdToKeyInfo[a]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===n.keyFormat?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,Nf.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const r={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var i;if(!e.decryptdata.keyId&&null!=(i=t.initSegment)&&i.data){const r=function(e){const t=[];return jp(e,e=>t.push(e.subarray(8,24))),t}(t.initSegment.data);if(r.length){let t=r[0];t.some(e=>0!==e)?(this.log(`Using keyId found in init segment ${op(t)}`),uv.setKeyIdForUri(e.decryptdata.uri,t)):(t=uv.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${op(t)}`)),e.decryptdata.keyId=t}}if(!e.decryptdata.keyId&&!Tp(t))return Promise.resolve(r);const n=this.emeController.loadKey(r);return(e.keyLoadPromise=n.then(t=>(e.mediaKeySessionContext=t,r))).catch(r=>{throw e.keyLoadPromise=null,"data"in r&&(r.data.frag=t),r})}return Promise.resolve(r)}loadKeyHTTP(e,t){const r=this.config,i=new(0,r.loader)(r);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((n,s)=>{const a={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},o=r.keyLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,r,i)=>{const{frag:a,keyInfo:o}=r,l=BS(o.decryptdata);if(!a.decryptdata||o!==this.keyIdToKeyInfo[l])return s(this.createKeyLoadError(a,Nf.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),i));o.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,o.loader=null,n({frag:a,keyInfo:o})},onError:(e,r,i,n)=>{this.resetLoader(r),s(this.createKeyLoadError(t,Nf.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),i,Xf({url:a.url,data:void 0},e)))},onTimeout:(e,r,i)=>{this.resetLoader(r),s(this.createKeyLoadError(t,Nf.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),i))},onAbort:(e,r,i)=>{this.resetLoader(r),s(this.createKeyLoadError(t,Nf.INTERNAL_ABORTED,new Error("key loading aborted"),i))}};i.load(a,l,d)})}resetLoader(e){const{frag:t,keyInfo:r,url:i}=e,n=r.loader;t.keyLoader===n&&(t.keyLoader=null,r.loader=null);const s=BS(r.decryptdata)||i;delete this.keyIdToKeyInfo[s],n&&n.destroy()}}function BS(e){if(e.keyFormat!==tv){const t=e.keyId;if(t)return op(t)}return e.uri}function US(e){const{type:t}=e;switch(t){case Uf:return jf;case zf:return Hf;default:return Gf}}function zS(e,t){let r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r}class GS{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Ff.LEVEL_LOADING,this.onLevelLoading,this),e.on(Ff.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(Ff.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(Ff.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Ff.LEVEL_LOADING,this.onLevelLoading,this),e.off(Ff.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(Ff.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(Ff.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,r=t.pLoader,i=t.loader,n=new(r||i)(t);return this.loaders[e.type]=n,n}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:r}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:$f,url:r,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:r,level:i,pathwayId:n,url:s,deliveryDirectives:a,levelInfo:o}=t;this.load({id:r,level:i,pathwayId:n,responseType:"text",type:Bf,url:s,deliveryDirectives:a,levelOrTrack:o})}onAudioTrackLoading(e,t){const{id:r,groupId:i,url:n,deliveryDirectives:s,track:a}=t;this.load({id:r,groupId:i,level:null,responseType:"text",type:Uf,url:n,deliveryDirectives:s,levelOrTrack:a})}onSubtitleTrackLoading(e,t){const{id:r,groupId:i,url:n,deliveryDirectives:s,track:a}=t;this.load({id:r,groupId:i,level:null,responseType:"text",type:zf,url:n,deliveryDirectives:s,levelOrTrack:a})}onLevelsUpdated(e,t){const r=this.loaders[Bf];if(r){const e=r.context;e&&!t.levels.some(t=>t===e.levelOrTrack)&&(r.abort(),delete this.loaders[Bf])}}load(e){var t;const r=this.hls.config;let i,n=this.getInternalLoader(e);if(n){const t=this.hls.logger,r=n.context;if(r&&r.levelOrTrack===e.levelOrTrack&&(r.url===e.url||r.deliveryDirectives&&!e.deliveryDirectives))return void(r.url===e.url?t.log(`[playlist-loader]: ignore ${e.url} ongoing request`):t.log(`[playlist-loader]: ignore ${e.url} in favor of ${r.url}`));t.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}if(i=e.type===$f?r.manifestLoadPolicy.default:Kf({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),Cf(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===Bf&&null!==e.level?t=this.hls.levels[e.level].details:e.type===Uf&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===zf&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,r=t.targetduration;if(e&&r){const t=1e3*Math.max(3*e,.8*r);i=Kf({},i,{maxTimeToFirstByteMs:Math.min(t,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,i.maxTimeToFirstByteMs)})}}}const s=i.errorRetry||i.timeoutRetry||{},a={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0},o={onSuccess:(e,t,r,i)=>{const n=this.getInternalLoader(r);this.resetInternalLoader(r.type);const s=e.data;t.parsing.start=performance.now(),yv.isMediaPlaylist(s)||r.type!==$f?this.handleTrackOrLevelPlaylist(e,t,r,i||null,n):this.handleMasterPlaylist(e,t,r,i)},onError:(e,t,r,i)=>{this.handleNetworkError(t,r,!1,e,i)},onTimeout:(e,t,r)=>{this.handleNetworkError(t,r,!0,void 0,e)}};n.load(e,a,o)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:r}=this.hls;(e||r)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,r,i){const n=this.hls,s=e.data,a=zS(e,r),o=yv.parseMasterPlaylist(s,a);if(o.playlistParsingError)return t.parsing.end=performance.now(),void this.handleManifestParsingError(e,r,o.playlistParsingError,i,t);const{contentSteering:l,levels:d,sessionData:c,sessionKeys:u,startTimeOffset:h,variableList:f}=o;this.variableList=f,d.forEach(e=>{const{unknownCodecs:t}=e;if(t){const{preferManagedMediaSource:r}=this.hls.config;let{audioCodec:i,videoCodec:n}=e;for(let s=t.length;s--;){const a=t[s];rm(a,"audio",r)?(e.audioCodec=i=i?`${i},${a}`:a,em.audio[i.substring(0,4)]=2,t.splice(s,1)):rm(a,"video",r)&&(e.videoCodec=n=n?`${n},${a}`:a,em.video[n.substring(0,4)]=2,t.splice(s,1))}}});const{AUDIO:p=[],SUBTITLES:m,"CLOSED-CAPTIONS":g}=yv.parseMasterPlaylistMedia(s,a,o);if(p.length){p.some(e=>!e.url)||!d[0].audioCodec||d[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Bg({}),bitrate:0,url:""}))}n.trigger(Ff.MANIFEST_LOADED,{levels:d,audioTracks:p,subtitles:m,captions:g,contentSteering:l,url:a,stats:t,networkDetails:i,sessionData:c,sessionKeys:u,startTimeOffset:h,variableList:f})}handleTrackOrLevelPlaylist(e,t,r,i,n){const s=this.hls,{id:a,level:o,type:l}=r,d=zS(e,r),c=Cf(o)?o:Cf(a)?a:0,u=US(r),h=yv.parseLevelPlaylist(e.data,d,c,u,0,this.variableList);if(l===$f){const e={attrs:new Bg({}),bitrate:0,details:h,name:"",url:d};h.requestScheduled=t.loading.start+Nv(h,0),s.trigger(Ff.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),r.levelDetails=h,this.handlePlaylistLoaded(h,e,t,r,i,n)}handleManifestParsingError(e,t,r,i,n){this.hls.trigger(Ff.ERROR,{type:Mf.NETWORK_ERROR,details:Nf.MANIFEST_PARSING_ERROR,fatal:t.type===$f,url:e.url,err:r,error:r,reason:r.message,response:e,context:t,networkDetails:i,stats:n})}handleNetworkError(e,t,r=!1,i,n){let s=`A network ${r?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===Bf?s+=`: ${e.level} id: ${e.id}`:e.type!==Uf&&e.type!==zf||(s+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(s);this.hls.logger.warn(`[playlist-loader]: ${s}`);let o=Nf.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case $f:o=r?Nf.MANIFEST_LOAD_TIMEOUT:Nf.MANIFEST_LOAD_ERROR,l=!0;break;case Bf:o=r?Nf.LEVEL_LOAD_TIMEOUT:Nf.LEVEL_LOAD_ERROR,l=!1;break;case Uf:o=r?Nf.AUDIO_TRACK_LOAD_TIMEOUT:Nf.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case zf:o=r?Nf.SUBTITLE_TRACK_LOAD_TIMEOUT:Nf.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);const c={type:Mf.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:d,context:e,error:a,networkDetails:t,stats:n};if(i){const r=(null==t?void 0:t.url)||e.url;c.response=Xf({url:r,data:void 0},i)}this.hls.trigger(Ff.ERROR,c)}handlePlaylistLoaded(e,t,r,i,n,s){const a=this.hls,{type:o,level:l,levelOrTrack:d,id:c,groupId:u,deliveryDirectives:h}=i,f=zS(t,i),p=US(i);let m="number"==typeof i.level&&p===Gf?l:void 0;const g=e.playlistParsingError;if(g){if(this.hls.logger.warn(`${g} ${e.url}`),!a.config.ignorePlaylistParsingErrors)return void a.trigger(Ff.ERROR,{type:Mf.NETWORK_ERROR,details:Nf.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:g,reason:g.message,response:t,context:i,level:m,parent:p,networkDetails:n,stats:r});e.playlistParsingError=null}if(!e.fragments.length){const s=e.playlistParsingError=new Error("No Segments found in Playlist");return void a.trigger(Ff.ERROR,{type:Mf.NETWORK_ERROR,details:Nf.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:s,reason:s.message,response:t,context:i,level:m,parent:p,networkDetails:n,stats:r})}switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),s.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case $f:case Bf:if(m)if(d){if(d!==a.levels[m]){const e=a.levels.indexOf(d);e>-1&&(m=e)}}else m=0;a.trigger(Ff.LEVEL_LOADED,{details:e,levelInfo:d||a.levels[0],level:m||0,id:c||0,stats:r,networkDetails:n,deliveryDirectives:h,withoutMultiVariant:o===$f});break;case Uf:a.trigger(Ff.AUDIO_TRACK_LOADED,{details:e,track:d,id:c||0,groupId:u||"",stats:r,networkDetails:n,deliveryDirectives:h});break;case zf:a.trigger(Ff.SUBTITLE_TRACK_LOADED,{details:e,track:d,id:c||0,groupId:u||"",stats:r,networkDetails:n,deliveryDirectives:h})}}}class jS{static get version(){return gy}static isMSESupported(){return NS()}static isSupported(){return function(){if(!NS())return!1;const e=np();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>e.isTypeSupported(nm(t,"video")))||["mp4a.40.2","fLaC"].some(t=>e.isTypeSupported(nm(t,"audio"))))}()}static getMediaSource(){return np()}static get Events(){return Ff}static get MetadataSchema(){return By}static get ErrorTypes(){return Mf}static get ErrorDetails(){return Nf}static get DefaultConfig(){return jS.defaultConfig?jS.defaultConfig:wS}static set DefaultConfig(e){jS.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new my,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=function(e,t,r){const i=ep();if("object"==typeof console&&!0===e||"object"==typeof e){const n=["debug","log","info","warn","error"];n.forEach(t=>{i[t]=tp(t,e,r)});try{i.log(`Debug logs enabled for "${t}" in hls.js version 1.6.15`)}catch(e){return ep()}n.forEach(t=>{rp[t]=tp(t,e)})}else Kf(rp,i);return i}(e.debug||!1,"Hls instance",e.assetPlayerId),r=this.config=function(e,t,r){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=SS(e),n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(e=>{const s=`${"level"===e?"playlist":e}LoadPolicy`,a=void 0===t[s],o=[];n.forEach(r=>{const n=`${e}Loading${r}`,l=t[n];if(void 0!==l&&a){o.push(n);const e=i[s].default;switch(t[s]={default:e},r){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}}),o.length&&r.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${s}": ${Cm(t[s])}`)}),Xf(Xf({},i),t)}(jS.DefaultConfig,e,t);this.userConfig=e,r.progressive&&TS(r,t);const{abrController:i,bufferController:n,capLevelController:s,errorController:a,fpsController:o}=r,l=new a(this),d=this.abrController=new i(this),c=new fg(this),u=r.interstitialsController,h=u?this.interstitialsController=new u(this,jS):null,f=this.bufferController=new n(this,c),p=this.capLevelController=new s(this),m=new o(this),g=new GS(this),v=r.contentSteeringController,y=v?new v(this):null,b=this.levelController=new _S(this,y),E=new DS(this),w=new $S(this.config,this.logger),S=this.streamController=new FS(this,c,w),T=this.gapController=new xS(this,c);p.setStreamController(S),m.setStreamController(S);const x=[g,b,S];h&&x.splice(1,0,h),y&&x.splice(1,0,y),this.networkControllers=x;const A=[d,f,T,p,m,E,c];this.audioTrackController=this.createController(r.audioTrackController,x);const k=r.audioStreamController;k&&x.push(this.audioStreamController=new k(this,c,w)),this.subtitleTrackController=this.createController(r.subtitleTrackController,x);const L=r.subtitleStreamController;L&&x.push(this.subtititleStreamController=new L(this,c,w)),this.createController(r.timelineController,A),w.emeController=this.emeController=this.createController(r.emeController,A),this.cmcdController=this.createController(r.cmcdController,A),this.latencyController=this.createController(CS,A),this.coreComponents=A,x.push(l);const I=l.onErrorOut;"function"==typeof I&&this.on(Ff.ERROR,I,l),this.on(Ff.MANIFEST_LOADED,g.onManifestLoaded,g)}createController(e,t){if(e){const r=new e(this);return t&&t.push(r),r}return null}on(e,t,r=this){this._emitter.on(e,t,r)}once(e,t,r=this){this._emitter.once(e,t,r)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,r=this,i){this._emitter.off(e,t,r,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,r){return this._emitter.emit(e,t,r)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const r=e===Ff.ERROR;this.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.INTERNAL_EXCEPTION,fatal:r,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(Ff.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const t=new Error(`attachMedia failed: invalid argument (${e})`);return void this.trigger(Ff.ERROR,{type:Mf.OTHER_ERROR,details:Nf.ATTACH_MEDIA_ERROR,fatal:!0,error:t})}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,r=t?e.media:e,i=t?e:{media:r};this._media=r,this.trigger(Ff.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia"),this.trigger(Ff.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(Ff.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,r=this._url,i=this._url=vp.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),t&&r&&(r!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(Ff.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let r=0;r<this.networkControllers.length&&(this.networkControllers[r].startLoad(e,t),this.started&&this.networkControllers);r++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Gf]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[jf]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Hf]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=null==e?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();const r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?r:3&r|8).toString(16)});return r}}}()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return Sm.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const r=e.length;for(let i=0;i<r;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:r}=this;let i;if(i=-1===t&&null!=e&&e.length?e.length-1:t,r)for(let t=i;t--;){const i=e[t].attrs["HDCP-LEVEL"];if(i&&i<=r)return t}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return(null==(t=this.subtitleTrackController)?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!(null==(e=this.bufferController)||!e.bufferedToEnd)}get interstitialsManager(){var e;return(null==(e=this.interstitialsController)?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){return bm(e,Om(t),navigator.mediaCapabilities)}}jS.defaultConfig=void 0;const HS=({file:e,startTime:n,poster:s,autoplay:o=!0,active:l=!0,visible:d=!0,muted:h=!0})=>{const f=r(null),{isReady:p,prewarm:m,setLowestResolution:g,startBufferBasedUpshift:v}=(({file:e,videoRef:t,autoplay:n=!0,startTime:s,enabled:o=!0,onReady:l,onError:d})=>{const h=r(null),f=r(null),p=r(0),m=r(0),g=r(!1),v=r(!1),[y,b]=a("idle"),[E,w]=a(0),[S,T]=a(!1),[A,k]=a([]),[L,I]=a("auto"),R=()=>{null!=f.current&&(clearTimeout(f.current),f.current=null)},P=(e=1e3)=>{if(null!=f.current)return;const t=p.current;if(t>=5)return b("error"),R(),void(null==d||d(new Error("Max retry reached")));const r=Math.min(15e3,e*Math.pow(2,Math.min(t,4)));b("loading"),console.log(`[HLS] schedule retry #${t+1} in ${r}ms`),f.current=window.setTimeout(()=>{f.current=null,p.current+=1,console.log(`[HLS] retryCount => ${p.current}`),w(e=>e+1)},r)};i(()=>{p.current=0,m.current=0,v.current=!1,T(!1),w(0),b(e?"loading":"idle"),R()},[e]);const D=c(()=>x(void 0,void 0,void 0,function*(){if(e)try{yield fetch(e,{method:"HEAD",mode:"cors",credentials:"omit"})}catch(e){}}),[e]);i(()=>{var r;const i=t.current;if(!i||!e||!o)return void(e&&!o&&(v.current=!1,T(!1),b("idle")));let s=()=>{};try{null===(r=h.current)||void 0===r||r.destroy()}catch(e){}if(h.current=null,v.current=!1,T(!1),b("loading"),jS.isSupported()){g.current=!1;const t=new jS({lowLatencyMode:!1,backBufferLength:0,maxBufferLength:2,maxMaxBufferLength:4,maxBufferSize:2e6,maxBufferHole:.5,startFragPrefetch:!0,capLevelToPlayerSize:!0});h.current=t;const r=()=>{const e=(t.levels||[]).map((e,t)=>{const r=e.height,i=e.width,n=e.bitrate,s=e.name;return{id:t,height:r,width:i,bitrate:n,name:s,label:s||(r?`${r}p`:`Level ${t}`)}});k(e);const r=t.currentLevel;I(null==r||r<0?"auto":r)},a=()=>{v.current||(v.current=!0,T(!0),b("ready"),p.current=0,R(),null==l||l(),n&&i.play().catch(()=>{}))};t.on(jS.Events.MANIFEST_PARSED,()=>{r(),n||_()}),t.on(jS.Events.FRAG_BUFFERED,a),t.on(jS.Events.BUFFER_APPENDED,a),t.on(jS.Events.LEVEL_SWITCHED,(e,t)=>{const r=null==t?void 0:t.level;I(null==r||r<0?"auto":r)}),t.on(jS.Events.ERROR,(e,r)=>{var i,n,s,a,o;const l=500===(null!==(a=null!==(n=null===(i=null==r?void 0:r.response)||void 0===i?void 0:i.code)&&void 0!==n?n:null===(s=null==r?void 0:r.response)||void 0===s?void 0:s.status)&&void 0!==a?a:null===(o=null==r?void 0:r.response)||void 0===o?void 0:o.statusCode);if(r.type!==jS.ErrorTypes.NETWORK_ERROR||r.fatal){if(r.fatal){if(r.type===jS.ErrorTypes.MEDIA_ERROR){if(m.current+=1,m.current<=2){try{t.recoverMediaError()}catch(e){}return void b("loading")}try{t.destroy()}catch(e){}return h.current=null,v.current=!1,T(!1),void P()}if(l){console.warn("[HLS] fatal 500 response - no retry");try{t.destroy()}catch(e){}return h.current=null,v.current=!1,T(!1),R(),b("error"),void(null==d||d(new Error("HTTP 500")))}try{t.destroy()}catch(e){}return h.current=null,v.current=!1,T(!1),void P()}}else{if(l){console.warn("[HLS] 500 response detected - no retry"),b("error");try{t.destroy()}catch(e){}return h.current=null,R(),void(null==d||d(new Error("HTTP 500")))}try{if(p.current>=5){b("error");try{t.destroy()}catch(e){}return h.current=null,void(null==d||d(new Error("Max retry reached")))}p.current+=1,console.log(`[HLS] non-fatal network retry => ${p.current}`),t.startLoad()}catch(e){}}}),t.attachMedia(i),t.loadSource(e),s=()=>{try{t.destroy()}catch(e){}h.current=null}}else if(i.canPlayType("application/vnd.apple.mpegURL")){g.current=!0,i.src!==e&&(i.src=e);const t=()=>{v.current||(v.current=!0,T(!0),b("ready"),p.current=0,R(),null==l||l(),n&&i.play().catch(()=>{}))},r=()=>{if(v.current=!1,T(!1),p.current>=5)return b("error"),void(null==d||d(new Error("Max retry reached")));P()};i.addEventListener("loadedmetadata",t),i.addEventListener("error",r),n&&i.play().catch(()=>{}),s=()=>{i.removeEventListener("loadedmetadata",t),i.removeEventListener("error",r)}}else b("error"),null==d||d(new Error("HLS not supported"));return()=>{s(),R()}},[e,E,n,l,d,t,o]),i(()=>{if(!S)return;if(null==s||s<=0)return;const e=t.current;if(e)try{Math.abs(e.currentTime-s)>.5&&(e.currentTime=s)}catch(e){}},[S,s,t]),i(()=>{const e=t.current;if(!e)return;const r=()=>b("ready"),i=()=>b("ready"),n=()=>{"error"!==y&&b("loading")},s=()=>b("loading"),a=()=>{b("error"),null==d||d()};return e.addEventListener("playing",r),e.addEventListener("canplay",i),e.addEventListener("waiting",n),e.addEventListener("stalled",s),e.addEventListener("error",a),()=>{e.removeEventListener("playing",r),e.removeEventListener("canplay",i),e.removeEventListener("waiting",n),e.removeEventListener("stalled",s),e.removeEventListener("error",a)}},[y,d,t]);const C=c(()=>{const e=h.current;e&&!g.current&&(console.log("Set auto resolution"),e.nextLevel=-1,I("auto"))},[]),_=c(()=>{var e,t;const r=h.current;if(!r)return;const i=r.levels||[];if(i.length){let n=0;for(let r=1;r<i.length;r++)(null!==(e=i[r].height)&&void 0!==e?e:99999)<(null!==(t=i[n].height)&&void 0!==t?t:99999)&&(n=r);r.currentLevel=n}},[]),O=c((e=2)=>{const r=h.current,i=t.current;if(!r||!i||g.current)return()=>{};let n=!1;const s=()=>{if(!n)if(r.autoLevelEnabled)n=!0;else try{i.buffered.length>0&&i.buffered.end(0)-i.currentTime>=e&&(r.nextLevel=-1,I("auto"),n=!0)}catch(e){}};return r.on(jS.Events.FRAG_BUFFERED,s),()=>{r.off(jS.Events.FRAG_BUFFERED,s)}},[t]);return{playbackStatus:y,isReady:S,qualities:A,currentLevel:L,isAutoQuality:u(()=>"auto"===L,[L]),canSetResolution:!g.current&&jS.isSupported(),setResolution:e=>{const t=h.current;if(!t||g.current)return;if("string"==typeof e&&"auto"===e.toLowerCase())return t.currentLevel=-1,void I("auto");const r="number"==typeof e?e:parseInt(e,10);if(!Number.isFinite(r)){const r=A.find(t=>t.label.toLowerCase()===String(e).toLowerCase());return void(r&&(t.currentLevel=r.id,I(r.id)))}const i=[...A].filter(e=>e.height).sort((e,t)=>(t.height||0)-(e.height||0)),n=i.find(e=>(e.height||0)<=r)||i[i.length-1];n&&(t.currentLevel=n.id,I(n.id))},setAutoResolution:C,prewarm:D,setLowestResolution:_,startBufferBasedUpshift:O}})({file:e,videoRef:f,autoplay:o,startTime:n,enabled:o||l});return i(()=>{m()},[m]),t.useEffect(()=>{var e,t;const r=f.current;if(r)if(l)null===(e=r.play)||void 0===e||e.call(r).catch(()=>{});else try{null===(t=r.pause)||void 0===t||t.call(r)}catch(e){}},[l,p]),i(()=>{if(!l)return;g();return v(2)},[l,g,v]),t.createElement("video",{ref:f,playsInline:!0,autoPlay:o,muted:h,poster:Rt(s||""),preload:"metadata",className:"w-full h-full object-cover object-center bg-black",style:{opacity:d&&p?1:0,transition:"opacity 200ms ease-in-out"}})},VS=({view:e})=>t.createElement("div",{className:"absolute",style:{top:8,left:8,borderRadius:"4px",color:"white",overflow:"hidden",fontSize:11}},t.createElement("span",{style:{backgroundColor:"rgba(62,213,69,0.71)",color:"white",padding:4,paddingLeft:9,paddingRight:9,display:"inline-block",lineHeight:1}},"다시보기"),t.createElement("span",{style:{backgroundColor:"rgba(58,58,58,0.52)",color:"white",padding:4,paddingLeft:9,paddingRight:9,display:"inline-block",lineHeight:1}},e," 시청")),WS=({content:e,aspectRatio:r="9/16",cursor:i="default",borderRadius:n,playback:s="hover"})=>{var a,o,l,d,c;const u=t.useRef(null),[h,f]=t.useState(!1),p=t.useRef(null),[m,g]=t.useState(!1),[v,y]=t.useState(!0),[b,E]=t.useState(!1),{boxSize:w}=Pf(r,u),S=e.thumbPath||(null===(o=null===(a=null==e?void 0:e.designInfo)||void 0===a?void 0:a.thumbPath)||void 0===o?void 0:o.preview),T=3===e.status,{API_BASE_URL:x,PLAYER_BASE_URL:A}=gt(),k=`${x}/hls/${null===(l=e.replay)||void 0===l?void 0:l.objectId}`;t.useEffect(()=>{const e=u.current;if(!e)return;const t=new IntersectionObserver(e=>{const t=e[0];E(t.isIntersecting&&t.intersectionRatio>=.5)},{root:null,threshold:[0,.5,1]});return t.observe(e),()=>t.disconnect()},[s]),t.useEffect(()=>{var e;if("undefined"!=typeof window&&window.matchMedia)try{const t=window.matchMedia("(pointer: fine)"),r=()=>y(t.matches);return r(),null===(e=t.addEventListener)||void 0===e||e.call(t,"change",r),()=>{var e;return null===(e=t.removeEventListener)||void 0===e?void 0:e.call(t,"change",r)}}catch(e){}},[s]);const L=()=>{null!=p.current&&(clearTimeout(p.current),p.current=null)},I=()=>{g(!0),L(),f(!1)};t.useEffect(()=>{const e=()=>g(!1);return window.addEventListener("mouseup",e),window.addEventListener("touchend",e),window.addEventListener("pointerup",e),()=>{window.removeEventListener("mouseup",e),window.removeEventListener("touchend",e),window.removeEventListener("pointerup",e)}},[s]);const R="hover"===s&&v,P=Boolean(k&&("autoplay"===s&&b||R&&h));return t.createElement("div",{className:"w-full h-full flex flex-col items-center justify-center",ref:u,onMouseEnter:()=>{"hover"===s&&v&&(m||(L(),p.current=window.setTimeout(()=>{f(!0)},150)))},onMouseLeave:()=>{L(),f(!1)},onMouseDown:I,onTouchStart:I},t.createElement("div",{className:"relative rounded overflow-hidden",style:{width:w.width?`${w.width}px`:"100%",height:w.height?`${w.height}px`:"100%",borderRadius:`${null!=n?n:10}px`,backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:w.height?void 0:r,backgroundImage:S?`url(${Rt(S)})`:void 0,backgroundColor:S?void 0:"black"}},T?t.createElement("iframe",{src:`${A}/live/${e.eventId}`,className:"w-full h-full"}):t.createElement(t.Fragment,null,t.createElement("div",{className:"absolute inset-0 w-full h-full object-cover",style:{pointerEvents:"none"}},t.createElement(HS,{file:k,poster:S,autoplay:"autoplay"===s,active:"autoplay"===s&&b||R&&h,visible:P,muted:!0})),!P&&t.createElement(If,null),t.createElement(VS,{view:null!==(c=null===(d=e.statistics)||void 0===d?void 0:d.pageView)&&void 0!==c?c:0}))))},YS=e=>{var r,i,n,s;const{content:a,title:o,aspectRatio:l="9/16",card:d,titleFontSize:c}=e,h=null!==(r=null==d?void 0:d.layout)&&void 0!==r?r:"slider",f=null!==(i=null==d?void 0:d.sliderPerView)&&void 0!==i?i:3,p=null!==(n=null==d?void 0:d.gridColumns)&&void 0!==n?n:3,m=null!==(s=null==d?void 0:d.gap)&&void 0!==s?s:12,g=null==d?void 0:d.width,v=g?"auto":f,y=u(()=>({fontSize:c?`${c}px`:void 0,fontWeight:600}),[c]),{PLAYER_BASE_URL:b}=gt(),E=u(()=>"past"===e.liveType?a.filter(e=>{var t,r;return 1===e.openStatus||Boolean(null===(t=e.replay)||void 0===t?void 0:t.objectId)&&Boolean(null===(r=e.replay)||void 0===r?void 0:r.isReplayOpen)}):a,[a,e.liveType]);return a&&0!==a.length?t.createElement("div",{className:"flex flex-col w-full",style:{gap:m}},t.createElement("p",{className:"truncate",style:Object.assign(Object.assign({},y),{userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",cursor:"default"})},o||("past"===e.liveType?"지난 라이브":"예정된 라이브")),"slider"===h?t.createElement("div",null,t.createElement(ls,{key:`${v}-${null!=g?g:""}-${m}`,slidesPerView:v,spaceBetween:m},E.map(r=>{var i,n;return t.createElement(ds,{key:r.eventId,style:g?{width:`${g}px`}:void 0},t.createElement("a",{href:`${b}/live/${r.eventId}`,target:"_blank",rel:"noopener noreferrer",className:"flex flex-col",style:{gap:6,textDecoration:"none",cursor:"pointer"}},"past"===e.liveType?t.createElement(WS,{content:r,aspectRatio:l,cursor:"pointer",borderRadius:null==d?void 0:d.borderRadius,playback:e.playback}):t.createElement(Df,{content:r,aspectRatio:l,cursor:"pointer",borderRadius:null==d?void 0:d.borderRadius}),t.createElement("p",{className:"truncate",style:{color:null!==(n=null===(i=e.theme)||void 0===i?void 0:i.textColor)&&void 0!==n?n:"black",fontSize:14,userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"}},r.eventName)))}))):t.createElement("div",{style:{overflowY:"auto"}},t.createElement("div",{style:{display:"grid",gridTemplateColumns:g?`repeat(auto-fill, ${g}px)`:`repeat(${p}, minmax(0, 1fr))`,gap:m}},E.map(r=>{var i,n;return t.createElement("a",{key:r.eventId,href:`${b}/live/${r.eventId}`,target:"_blank",rel:"noopener noreferrer",className:"flex flex-col",style:{gap:6,textDecoration:"none",cursor:"pointer"}},"past"===e.liveType?t.createElement(WS,{content:r,aspectRatio:l,cursor:"pointer",borderRadius:null==d?void 0:d.borderRadius,playback:e.playback}):t.createElement(Df,{content:r,aspectRatio:l,cursor:"pointer",borderRadius:null==d?void 0:d.borderRadius}),t.createElement("p",{className:"truncate",style:{color:null!==(n=null===(i=e.theme)||void 0===i?void 0:i.textColor)&&void 0!==n?n:"black",fontSize:14,userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"}},r.eventName))})))):null};var KS;!function(e){e[e.READY=1]="READY",e[e.STREAMING=2]="STREAMING",e[e.PAUSED=3]="PAUSED"}(KS||(KS={}));const qS=({content:e})=>{const r=t.useMemo(()=>qe(e.start).tz("Asia/Seoul").format("M월 D일 A HH:mm"),[e.start]),i=e.eventStatus!==KS.READY;return t.createElement("div",{className:"flex-1 flex flex-col gap-5 items-center justify-center"},t.createElement("p",{style:{fontWeight:"bold",fontSize:"24px"}},e.eventName),!i&&t.createElement("p",null,r),t.createElement("button",{onClick:()=>{window.open(`https://player.midibus.im/live/${e.eventId}`,"_blank")},className:"rounded bg-black text-white cursor-pointer",style:{width:"70%",padding:"10px"}},"라이브 입장하기"))},XS=e=>{var r,i;const{content:n,aspectRatio:s="9/16",videoAlign:a}=e,o=null===(r=e.card)||void 0===r?void 0:r.borderRadius,l=null===(i=e.card)||void 0===i?void 0:i.width,{PLAYER_BASE_URL:d}=gt();return t.createElement("div",{className:"flex w-full h-full items-center justify-center"},"only"===a?t.createElement("a",{className:"w-full h-full",href:`${d}/live/${n.eventId}`,target:"_blank",rel:"noopener noreferrer",style:l?{width:`${l}px`}:void 0},t.createElement(Df,{content:n,aspectRatio:s,borderRadius:o,cursor:"pointer"})):"left"===a?t.createElement(t.Fragment,null,t.createElement("div",{className:"flex-1"},t.createElement("a",{href:`${d}/live/${n.eventId}`,target:"_blank",rel:"noopener noreferrer",style:l?{width:`${l}px`}:void 0},t.createElement(Df,{content:n,aspectRatio:s,borderRadius:o,cursor:"pointer"}))),t.createElement(qS,{content:n})):t.createElement(t.Fragment,null,t.createElement(qS,{content:n}),t.createElement("div",{className:"flex-1"},t.createElement("a",{href:`${d}/live/${n.eventId}`,target:"_blank",rel:"noopener noreferrer",style:l?{width:`${l}px`}:void 0},t.createElement(Df,{content:n,aspectRatio:s,borderRadius:o,cursor:"pointer"})))))},QS=e=>{var r;const{theme:i,titleFontSize:n,title:s}=e;return t.createElement("div",{className:"w-full h-full flex flex-col",style:{color:null!==(r=null==i?void 0:i.textColor)&&void 0!==r?r:"#252525"}},t.createElement("p",{style:Object.assign(Object.assign({},n&&{fontSize:n}),{fontWeight:"bold",color:null==i?void 0:i.textColor,paddingTop:"10px",paddingBottom:"10px",marginBottom:"30px"})},s||("past"===e.liveType?"지난 라이브":"예정된 라이브")),t.createElement("div",{className:"self-center text-center h-full flex flex-col items-center justify-center",style:{minHeight:"200px"}},t.createElement("p",{style:{fontSize:"20px",marginBottom:"10px"}},"past"===e.liveType?"지난 라이브가 없어요.":"예정된 라이브가 없어요."),t.createElement("span",{style:{fontWeight:"lighter"}},"past"===e.liveType?"다른 콘텐츠도 확인해 보세요.":"곧 혜택 가득한 라이브로 찾아올게요!")))},ZS=e=>{var r,i,n,s;const{widgetType:a,theme:o,layout:l}=e,{liveWidget:d}=Lf(),c=null!==(r=null==l?void 0:l.paddingTop)&&void 0!==r?r:0,u=null!==(i=null==l?void 0:l.paddingBottom)&&void 0!==i?i:0,h=null!==(n=null==l?void 0:l.paddingLeft)&&void 0!==n?n:0,f=null!==(s=null==l?void 0:l.paddingRight)&&void 0!==s?s:0;return d&&0!==d.length?t.createElement("div",{className:"w-full h-full",style:{backgroundColor:null==o?void 0:o.backgroundColor,color:null==o?void 0:o.textColor,paddingTop:c,paddingBottom:u,paddingLeft:h,paddingRight:f}},"ONE"===a&&"past"!==e.liveType?t.createElement(XS,Object.assign({content:d[0]},e)):t.createElement(YS,Object.assign({content:d},e))):t.createElement(QS,Object.assign({},e))},JS=e=>{const{setLiveWidget:r,liveWidget:n}=Lf(),{userId:s,card:a,includeRepresentative:o,liveType:l}=e;return i(()=>{if(!s)return;if(n&&(null==a?void 0:a.visibleCount)&&n.length>Number(a.visibleCount))return void r(n.slice(0,null==a?void 0:a.visibleCount));const t=()=>x(void 0,void 0,void 0,function*(){const t=(null==a?void 0:a.visibleCount)||6,i=yield Ws(s,"FINISHED",t,e.sorting);if(!i)return;let n;if(o){const e=yield Ws(s,"UPCOMING",1);if(e&&0!==e.length){const r=Math.max(0,t-1);n=[e[0],...i.slice(0,r)]}else n=i.slice(0,t)}else n=i.slice(0,t);yield Promise.all(n.map(e=>x(void 0,void 0,void 0,function*(){const t=yield((e,t)=>x(void 0,void 0,void 0,function*(){const{STATISTICS_BASE_URL:r}=gt(),i=`${r}/replay/${e}/${t}/summary`,n=yield fetch(i);if(404!==n.status){if(!n.ok){const e=yield n.text().catch(()=>"");return console.error(`[ReplayStatistics] ${n.status} ${n.statusText} ${e}`),{pageView:0,like:0}}return n.json()}}))(s,e.eventId);e.statistics=t}))),r(n)});x(void 0,void 0,void 0,function*(){"past"===l?yield t():yield x(void 0,void 0,void 0,function*(){const e=yield Ws(s,"UPCOMING",(null==a?void 0:a.visibleCount)||6);e&&r(o?e.slice(0,(null==a?void 0:a.visibleCount)||6):e.slice(1,(null==a?void 0:a.visibleCount)+1||7))})})},[s,null==a?void 0:a.visibleCount,l,e.sorting,o]),t.createElement(hh.div,{className:"w-full h-full"},t.createElement(bh,null),t.createElement(ZS,Object.assign({},e)))};export{Ah as CollectionShowcase,kf as FloatingPlayer,JS as LiveWidget,_d as PreviewPlayer,Cd as ShoppingPlayer,Ct as ViewPlayer,Sh as WidgetPlayer,mt as configure};