@squadx_dev/brix-client-library 1.51.2 → 1.51.4
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/chunk/{Bf1fTf3c.es.js → BOY213m5.es.js} +326 -306
- package/dist/chunk/{Bf1fTf3c.es.js.map → BOY213m5.es.js.map} +1 -1
- package/dist/chunk/{DxOkfzEv.cjs.js → Cdqd-vpy.cjs.js} +18 -17
- package/dist/chunk/Cdqd-vpy.cjs.js.map +1 -0
- package/dist/chunk/{3t-Ysz2w.es.js → CyI1rJfJ.es.js} +3 -3
- package/dist/chunk/{3t-Ysz2w.es.js.map → CyI1rJfJ.es.js.map} +1 -1
- package/dist/chunk/{DP9VDW2W.cjs.js → DkZ1BWlw.cjs.js} +2 -2
- package/dist/chunk/{DP9VDW2W.cjs.js.map → DkZ1BWlw.cjs.js.map} +1 -1
- package/dist/component/PlayerUser/PlayerUser.d.ts +1 -1
- package/dist/component/index.cjs.js +1 -1
- package/dist/component/index.es.js +1 -1
- package/dist/umd/index.umd.js +45 -44
- package/package.json +1 -1
- package/dist/chunk/DxOkfzEv.cjs.js.map +0 -1
|
@@ -16,17 +16,17 @@ object-assign
|
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/var pu;function Im(){return pu||(pu=1,function(i){process.env.NODE_ENV!=="production"&&function(){var e=fe,t=Qd(),s=60103,r=60106;i.Fragment=60107;var n=60108,a=60114,o=60109,l=60110,u=60112,d=60113,f=60120,g=60115,v=60116,y=60121,E=60122,b=60117,w=60129,F=60131;if(typeof Symbol=="function"&&Symbol.for){var k=Symbol.for;s=k("react.element"),r=k("react.portal"),i.Fragment=k("react.fragment"),n=k("react.strict_mode"),a=k("react.profiler"),o=k("react.provider"),l=k("react.context"),u=k("react.forward_ref"),d=k("react.suspense"),f=k("react.suspense_list"),g=k("react.memo"),v=k("react.lazy"),y=k("react.block"),E=k("react.server.block"),b=k("react.fundamental"),k("react.scope"),k("react.opaque.id"),w=k("react.debug_trace_mode"),k("react.offscreen"),F=k("react.legacy_hidden")}var U=typeof Symbol=="function"&&Symbol.iterator,N="@@iterator";function te(W){if(W===null||typeof W!="object")return null;var Ee=U&&W[U]||W[N];return typeof Ee=="function"?Ee:null}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function re(W){{for(var Ee=arguments.length,Ce=new Array(Ee>1?Ee-1:0),Ie=1;Ie<Ee;Ie++)Ce[Ie-1]=arguments[Ie];Q("error",W,Ce)}}function Q(W,Ee,Ce){{var Ie=j.ReactDebugCurrentFrame,lt=Ie.getStackAddendum();lt!==""&&(Ee+="%s",Ce=Ce.concat([lt]));var Fe=Ce.map(function(tt){return""+tt});Fe.unshift("Warning: "+Ee),Function.prototype.apply.call(console[W],console,Fe)}}var le=!1;function se(W){return!!(typeof W=="string"||typeof W=="function"||W===i.Fragment||W===a||W===w||W===n||W===d||W===f||W===F||le||typeof W=="object"&&W!==null&&(W.$$typeof===v||W.$$typeof===g||W.$$typeof===o||W.$$typeof===l||W.$$typeof===u||W.$$typeof===b||W.$$typeof===y||W[0]===E))}function pe(W,Ee,Ce){var Ie=Ee.displayName||Ee.name||"";return W.displayName||(Ie!==""?Ce+"("+Ie+")":Ce)}function de(W){return W.displayName||"Context"}function be(W){if(W==null)return null;if(typeof W.tag=="number"&&re("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof W=="function")return W.displayName||W.name||null;if(typeof W=="string")return W;switch(W){case i.Fragment:return"Fragment";case r:return"Portal";case a:return"Profiler";case n:return"StrictMode";case d:return"Suspense";case f:return"SuspenseList"}if(typeof W=="object")switch(W.$$typeof){case l:var Ee=W;return de(Ee)+".Consumer";case o:var Ce=W;return de(Ce._context)+".Provider";case u:return pe(W,W.render,"ForwardRef");case g:return be(W.type);case y:return be(W._render);case v:{var Ie=W,lt=Ie._payload,Fe=Ie._init;try{return be(Fe(lt))}catch{return null}}}return null}var Le=0,ue,he,we,me,ye,Ve,$e;function
|
|
20
|
-
`+
|
|
19
|
+
*/var pu;function Im(){return pu||(pu=1,function(i){process.env.NODE_ENV!=="production"&&function(){var e=fe,t=Qd(),s=60103,r=60106;i.Fragment=60107;var n=60108,a=60114,o=60109,l=60110,u=60112,d=60113,f=60120,g=60115,v=60116,y=60121,E=60122,b=60117,w=60129,F=60131;if(typeof Symbol=="function"&&Symbol.for){var k=Symbol.for;s=k("react.element"),r=k("react.portal"),i.Fragment=k("react.fragment"),n=k("react.strict_mode"),a=k("react.profiler"),o=k("react.provider"),l=k("react.context"),u=k("react.forward_ref"),d=k("react.suspense"),f=k("react.suspense_list"),g=k("react.memo"),v=k("react.lazy"),y=k("react.block"),E=k("react.server.block"),b=k("react.fundamental"),k("react.scope"),k("react.opaque.id"),w=k("react.debug_trace_mode"),k("react.offscreen"),F=k("react.legacy_hidden")}var U=typeof Symbol=="function"&&Symbol.iterator,N="@@iterator";function te(W){if(W===null||typeof W!="object")return null;var Ee=U&&W[U]||W[N];return typeof Ee=="function"?Ee:null}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function re(W){{for(var Ee=arguments.length,Ce=new Array(Ee>1?Ee-1:0),Ie=1;Ie<Ee;Ie++)Ce[Ie-1]=arguments[Ie];Q("error",W,Ce)}}function Q(W,Ee,Ce){{var Ie=j.ReactDebugCurrentFrame,lt=Ie.getStackAddendum();lt!==""&&(Ee+="%s",Ce=Ce.concat([lt]));var Fe=Ce.map(function(tt){return""+tt});Fe.unshift("Warning: "+Ee),Function.prototype.apply.call(console[W],console,Fe)}}var le=!1;function se(W){return!!(typeof W=="string"||typeof W=="function"||W===i.Fragment||W===a||W===w||W===n||W===d||W===f||W===F||le||typeof W=="object"&&W!==null&&(W.$$typeof===v||W.$$typeof===g||W.$$typeof===o||W.$$typeof===l||W.$$typeof===u||W.$$typeof===b||W.$$typeof===y||W[0]===E))}function pe(W,Ee,Ce){var Ie=Ee.displayName||Ee.name||"";return W.displayName||(Ie!==""?Ce+"("+Ie+")":Ce)}function de(W){return W.displayName||"Context"}function be(W){if(W==null)return null;if(typeof W.tag=="number"&&re("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof W=="function")return W.displayName||W.name||null;if(typeof W=="string")return W;switch(W){case i.Fragment:return"Fragment";case r:return"Portal";case a:return"Profiler";case n:return"StrictMode";case d:return"Suspense";case f:return"SuspenseList"}if(typeof W=="object")switch(W.$$typeof){case l:var Ee=W;return de(Ee)+".Consumer";case o:var Ce=W;return de(Ce._context)+".Provider";case u:return pe(W,W.render,"ForwardRef");case g:return be(W.type);case y:return be(W._render);case v:{var Ie=W,lt=Ie._payload,Fe=Ie._init;try{return be(Fe(lt))}catch{return null}}}return null}var Le=0,ue,he,we,me,ye,Ve,$e;function Je(){}Je.__reactDisabledLog=!0;function st(){{if(Le===0){ue=console.log,he=console.info,we=console.warn,me=console.error,ye=console.group,Ve=console.groupCollapsed,$e=console.groupEnd;var W={configurable:!0,enumerable:!0,value:Je,writable:!0};Object.defineProperties(console,{info:W,log:W,warn:W,error:W,group:W,groupCollapsed:W,groupEnd:W})}Le++}}function rt(){{if(Le--,Le===0){var W={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:t({},W,{value:ue}),info:t({},W,{value:he}),warn:t({},W,{value:we}),error:t({},W,{value:me}),group:t({},W,{value:ye}),groupCollapsed:t({},W,{value:Ve}),groupEnd:t({},W,{value:$e})})}Le<0&&re("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ze=j.ReactCurrentDispatcher,Xe;function dt(W,Ee,Ce){{if(Xe===void 0)try{throw Error()}catch(lt){var Ie=lt.stack.trim().match(/\n( *(at )?)/);Xe=Ie&&Ie[1]||""}return`
|
|
20
|
+
`+Xe+W}}var Rt=!1,ps;{var Be=typeof WeakMap=="function"?WeakMap:Map;ps=new Be}function as(W,Ee){if(!W||Rt)return"";{var Ce=ps.get(W);if(Ce!==void 0)return Ce}var Ie;Rt=!0;var lt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Fe;Fe=Ze.current,Ze.current=null,st();try{if(Ee){var tt=function(){throw Error()};if(Object.defineProperty(tt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(tt,[])}catch(As){Ie=As}Reflect.construct(W,[],tt)}else{try{tt.call()}catch(As){Ie=As}W.call(tt.prototype)}}else{try{throw Error()}catch(As){Ie=As}W()}}catch(As){if(As&&Ie&&typeof As.stack=="string"){for(var et=As.stack.split(`
|
|
21
21
|
`),$t=Ie.stack.split(`
|
|
22
|
-
`),xt=
|
|
23
|
-
`+
|
|
22
|
+
`),xt=et.length-1,Et=$t.length-1;xt>=1&&Et>=0&&et[xt]!==$t[Et];)Et--;for(;xt>=1&&Et>=0;xt--,Et--)if(et[xt]!==$t[Et]){if(xt!==1||Et!==1)do if(xt--,Et--,Et<0||et[xt]!==$t[Et]){var ws=`
|
|
23
|
+
`+et[xt].replace(" at new "," at ");return typeof W=="function"&&ps.set(W,ws),ws}while(xt>=1&&Et>=0);break}}}finally{Rt=!1,Ze.current=Fe,rt(),Error.prepareStackTrace=lt}var Ei=W?W.displayName||W.name:"",$n=Ei?dt(Ei):"";return typeof W=="function"&&ps.set(W,$n),$n}function os(W,Ee,Ce){return as(W,!1)}function cr(W){var Ee=W.prototype;return!!(Ee&&Ee.isReactComponent)}function Ds(W,Ee,Ce){if(W==null)return"";if(typeof W=="function")return as(W,cr(W));if(typeof W=="string")return dt(W);switch(W){case d:return dt("Suspense");case f:return dt("SuspenseList")}if(typeof W=="object")switch(W.$$typeof){case u:return os(W.render);case g:return Ds(W.type,Ee,Ce);case y:return os(W._render);case v:{var Ie=W,lt=Ie._payload,Fe=Ie._init;try{return Ds(Fe(lt),Ee,Ce)}catch{}}}return""}var Gi={},Vi=j.ReactDebugCurrentFrame;function ls(W){if(W){var Ee=W._owner,Ce=Ds(W.type,W._source,Ee?Ee.type:null);Vi.setExtraStackFrame(Ce)}else Vi.setExtraStackFrame(null)}function ur(W,Ee,Ce,Ie,lt){{var Fe=Function.call.bind(Object.prototype.hasOwnProperty);for(var tt in W)if(Fe(W,tt)){var et=void 0;try{if(typeof W[tt]!="function"){var $t=Error((Ie||"React class")+": "+Ce+" type `"+tt+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof W[tt]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw $t.name="Invariant Violation",$t}et=W[tt](Ee,tt,Ie,Ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(xt){et=xt}et&&!(et instanceof Error)&&(ls(lt),re("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Ie||"React class",Ce,tt,typeof et),ls(null)),et instanceof Error&&!(et.message in Gi)&&(Gi[et.message]=!0,ls(lt),re("Failed %s type: %s",Ce,et.message),ls(null))}}}var Ms=j.ReactCurrentOwner,Fs=Object.prototype.hasOwnProperty,Os={key:!0,ref:!0,__self:!0,__source:!0},Me,Tt,si;si={};function Mn(W){if(Fs.call(W,"ref")){var Ee=Object.getOwnPropertyDescriptor(W,"ref").get;if(Ee&&Ee.isReactWarning)return!1}return W.ref!==void 0}function hr(W){if(Fs.call(W,"key")){var Ee=Object.getOwnPropertyDescriptor(W,"key").get;if(Ee&&Ee.isReactWarning)return!1}return W.key!==void 0}function Fn(W,Ee){if(typeof W.ref=="string"&&Ms.current&&Ee&&Ms.current.stateNode!==Ee){var Ce=be(Ms.current.type);si[Ce]||(re('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',be(Ms.current.type),W.ref),si[Ce]=!0)}}function On(W,Ee){{var Ce=function(){Me||(Me=!0,re("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Ee))};Ce.isReactWarning=!0,Object.defineProperty(W,"key",{get:Ce,configurable:!0})}}function no(W,Ee){{var Ce=function(){Tt||(Tt=!0,re("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Ee))};Ce.isReactWarning=!0,Object.defineProperty(W,"ref",{get:Ce,configurable:!0})}}var gs=function(W,Ee,Ce,Ie,lt,Fe,tt){var et={$$typeof:s,type:W,key:Ee,ref:Ce,props:tt,_owner:Fe};return et._store={},Object.defineProperty(et._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(et,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Ie}),Object.defineProperty(et,"_source",{configurable:!1,enumerable:!1,writable:!1,value:lt}),Object.freeze&&(Object.freeze(et.props),Object.freeze(et)),et};function ii(W,Ee,Ce,Ie,lt){{var Fe,tt={},et=null,$t=null;Ce!==void 0&&(et=""+Ce),hr(Ee)&&(et=""+Ee.key),Mn(Ee)&&($t=Ee.ref,Fn(Ee,lt));for(Fe in Ee)Fs.call(Ee,Fe)&&!Os.hasOwnProperty(Fe)&&(tt[Fe]=Ee[Fe]);if(W&&W.defaultProps){var xt=W.defaultProps;for(Fe in xt)tt[Fe]===void 0&&(tt[Fe]=xt[Fe])}if(et||$t){var Et=typeof W=="function"?W.displayName||W.name||"Unknown":W;et&&On(tt,Et),$t&&no(tt,Et)}return gs(W,et,$t,lt,Ie,Ms.current,tt)}}var dr=j.ReactCurrentOwner,Kr=j.ReactDebugCurrentFrame;function Si(W){if(W){var Ee=W._owner,Ce=Ds(W.type,W._source,Ee?Ee.type:null);Kr.setExtraStackFrame(Ce)}else Kr.setExtraStackFrame(null)}var zr;zr=!1;function fr(W){return typeof W=="object"&&W!==null&&W.$$typeof===s}function Wr(){{if(dr.current){var W=be(dr.current.type);if(W)return`
|
|
24
24
|
|
|
25
25
|
Check the render method of \``+W+"`."}return""}}function pr(W){return""}var Hi={};function gr(W){{var Ee=Wr();if(!Ee){var Ce=typeof W=="string"?W:W.displayName||W.name;Ce&&(Ee=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+Ce+">.")}return Ee}}function Nn(W,Ee){{if(!W._store||W._store.validated||W.key!=null)return;W._store.validated=!0;var Ce=gr(Ee);if(Hi[Ce])return;Hi[Ce]=!0;var Ie="";W&&W._owner&&W._owner!==dr.current&&(Ie=" It was passed a child from "+be(W._owner.type)+"."),Si(W),re('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Ce,Ie),Si(null)}}function Bn(W,Ee){{if(typeof W!="object")return;if(Array.isArray(W))for(var Ce=0;Ce<W.length;Ce++){var Ie=W[Ce];fr(Ie)&&Nn(Ie,Ee)}else if(fr(W))W._store&&(W._store.validated=!0);else if(W){var lt=te(W);if(typeof lt=="function"&<!==W.entries)for(var Fe=lt.call(W),tt;!(tt=Fe.next()).done;)fr(tt.value)&&Nn(tt.value,Ee)}}}function ao(W){{var Ee=W.type;if(Ee==null||typeof Ee=="string")return;var Ce;if(typeof Ee=="function")Ce=Ee.propTypes;else if(typeof Ee=="object"&&(Ee.$$typeof===u||Ee.$$typeof===g))Ce=Ee.propTypes;else return;if(Ce){var Ie=be(Ee);ur(Ce,W.props,"prop",Ie,W)}else if(Ee.PropTypes!==void 0&&!zr){zr=!0;var lt=be(Ee);re("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",lt||"Unknown")}typeof Ee.getDefaultProps=="function"&&!Ee.getDefaultProps.isReactClassApproved&&re("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function oo(W){{for(var Ee=Object.keys(W.props),Ce=0;Ce<Ee.length;Ce++){var Ie=Ee[Ce];if(Ie!=="children"&&Ie!=="key"){Si(W),re("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ie),Si(null);break}}W.ref!==null&&(Si(W),re("Invalid attribute `ref` supplied to `React.Fragment`."),Si(null))}}function Ae(W,Ee,Ce,Ie,lt,Fe){{var tt=se(W);if(!tt){var Ze="";(W===void 0||typeof W=="object"&&W!==null&&Object.keys(W).length===0)&&(Ze+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var $t=pr();$t?Ze+=$t:Ze+=Wr();var xt;W===null?xt="null":Array.isArray(W)?xt="array":W!==void 0&&W.$$typeof===s?(xt="<"+(be(W.type)||"Unknown")+" />",Ze=" Did you accidentally export a JSX literal instead of a component?"):xt=typeof W,re("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",xt,Ze)}var Et=ii(W,Ee,Ce,lt,Fe);if(Et==null)return Et;if(tt){var ws=Ee.children;if(ws!==void 0)if(Ie)if(Array.isArray(ws)){for(var Ei=0;Ei<ws.length;Ei++)Bn(ws[Ei],W);Object.freeze&&Object.freeze(ws)}else re("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Bn(ws,W)}return W===i.Fragment?oo(Et):ao(Et),Et}}function Rt(W,Ee,Ce){return Ae(W,Ee,Ce,!0)}function ri(W,Ee,Ce){return Ae(W,Ee,Ce,!1)}var Ts=ri,Dt=Rt;i.jsx=Ts,i.jsxs=Dt}()}(Eo)),Eo}process.env.NODE_ENV==="production"?ml.exports=_m():ml.exports=Im();var Ne=ml.exports;const km="_root_1qxmy_1",Pm="_progress_1qxmy_8",Dm="_pop_1qxmy_1",Mm="_play_button_1qxmy_25",Fm="_pause_button_1qxmy_26",Om="_play_icon_1qxmy_47",Nm="_mute_button_1qxmy_58",Bm="_sound_off_icon_1qxmy_78",$m="_sound_on_icon_1qxmy_82",Um="_error_1qxmy_86",Us={root:km,progress:Pm,pop:Dm,play_button:Mm,pause_button:Fm,play_icon:Om,mute_button:Nm,sound_off_icon:Bm,sound_on_icon:$m,error:Um},Jd=i=>{let e=i.httpHandler;return{setHttpHandler(t){e=t},httpHandler(){return e},updateHttpClientConfig(t,s){e.updateHttpClientConfig(t,s)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Zd=i=>({httpHandler:i.httpHandler()});var gu;(function(i){i.HEADER="header",i.QUERY="query"})(gu||(gu={}));var mu;(function(i){i.HEADER="header",i.QUERY="query"})(mu||(mu={}));var En;(function(i){i.HTTP="http",i.HTTPS="https"})(En||(En={}));var _a;(function(i){i.MD5="md5",i.CRC32="crc32",i.CRC32C="crc32c",i.SHA1="sha1",i.SHA256="sha256"})(_a||(_a={}));var vu;(function(i){i[i.HEADER=0]="HEADER",i[i.TRAILER=1]="TRAILER"})(vu||(vu={}));const vl="__smithy_context";var yu;(function(i){i.PROFILE="profile",i.SSO_SESSION="sso-session",i.SERVICES="services"})(yu||(yu={}));var xu;(function(i){i.HTTP_0_9="http/0.9",i.HTTP_1_0="http/1.0",i.TDS_8_0="tds/8.0"})(xu||(xu={}));class ns{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const t=new ns({...e,headers:{...e.headers}});return t.query&&(t.query=Gm(t.query)),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&typeof t.query=="object"&&typeof t.headers=="object"}clone(){return ns.clone(this)}}function Gm(i){return Object.keys(i).reduce((e,t)=>{const s=i[t];return{...e,[t]:Array.isArray(s)?[...s]:s}},{})}class Ia{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return typeof t.statusCode=="number"&&typeof t.headers=="object"}}const Vm=i=>e=>async t=>{if(!ns.isInstance(t.request))return e(t);const{request:s}=t,{handlerProtocol:r=""}=i.requestHandler.metadata||{};if(r.indexOf("h2")>=0&&!s.headers[":authority"])delete s.headers.host,s.headers[":authority"]=s.hostname+(s.port?":"+s.port:"");else if(!s.headers.host){let n=s.hostname;s.port!=null&&(n+=`:${s.port}`),s.headers.host=n}return e(t)},Hm={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},ef=i=>({applyToStack:e=>{e.add(Vm(i),Hm)}}),jm=()=>(i,e)=>async t=>{var s,r;try{const n=await i(t),{clientName:a,commandName:o,logger:l,dynamoDbDocumentClientOptions:u={}}=e,{overrideInputFilterSensitiveLog:d,overrideOutputFilterSensitiveLog:f}=u,g=d??e.inputFilterSensitiveLog,v=f??e.outputFilterSensitiveLog,{$metadata:y,...E}=n.output;return(s=l==null?void 0:l.info)==null||s.call(l,{clientName:a,commandName:o,input:g(t.input),output:v(E),metadata:y}),n}catch(n){const{clientName:a,commandName:o,logger:l,dynamoDbDocumentClientOptions:u={}}=e,{overrideInputFilterSensitiveLog:d}=u,f=d??e.inputFilterSensitiveLog;throw(r=l==null?void 0:l.error)==null||r.call(l,{clientName:a,commandName:o,input:f(t.input),error:n,metadata:n.$metadata}),n}},Km={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},tf=i=>({applyToStack:e=>{e.add(jm(),Km)}}),Su="X-Amzn-Trace-Id",zm="AWS_LAMBDA_FUNCTION_NAME",Wm="_X_AMZN_TRACE_ID",qm=i=>e=>async t=>{const{request:s}=t;if(!ns.isInstance(s)||i.runtime!=="node"||s.headers.hasOwnProperty(Su))return e(t);const r=process.env[zm],n=process.env[Wm],a=o=>typeof o=="string"&&o.length>0;return a(r)&&a(n)&&(s.headers[Su]=n),e({...t,request:s})},Ym={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},sf=i=>({applyToStack:e=>{e.add(qm(i),Ym)}});function rf(i){return{...i,customUserAgent:typeof i.customUserAgent=="string"?[[i.customUserAgent]]:i.customUserAgent}}const Xm=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),nf=i=>Xm.test(i)||i.startsWith("[")&&i.endsWith("]"),Qm=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),jl=(i,e=!1)=>{if(!e)return Qm.test(i);const t=i.split(".");for(const s of t)if(!jl(s))return!1;return!0},bn={},Tn="endpoints";function $i(i){return typeof i!="object"||i==null?i:"ref"in i?`$${$i(i.ref)}`:"fn"in i?`${i.fn}(${(i.argv||[]).map($i).join(", ")})`:JSON.stringify(i,null,2)}class ds extends Error{constructor(e){super(e),this.name="EndpointError"}}const Jm=(i,e)=>i===e,Zm=i=>{const e=i.split("."),t=[];for(const s of e){const r=s.indexOf("[");if(r!==-1){if(s.indexOf("]")!==s.length-1)throw new ds(`Path: '${i}' does not end with ']'`);const n=s.slice(r+1,-1);if(Number.isNaN(parseInt(n)))throw new ds(`Invalid array index: '${n}' in path: '${i}'`);r!==0&&t.push(s.slice(0,r)),t.push(n)}else t.push(s)}return t},af=(i,e)=>Zm(e).reduce((t,s)=>{if(typeof t!="object")throw new ds(`Index '${s}' in '${e}' not found in '${JSON.stringify(i)}'`);return Array.isArray(t)?t[parseInt(s)]:t[s]},i),e0=i=>i!=null,t0=i=>!i,bo={[En.HTTP]:80,[En.HTTPS]:443},s0=i=>{const e=(()=>{try{if(i instanceof URL)return i;if(typeof i=="object"&&"hostname"in i){const{hostname:g,port:v,protocol:y="",path:E="",query:b={}}=i,w=new URL(`${y}//${g}${v?`:${v}`:""}${E}`);return w.search=Object.entries(b).map(([F,k])=>`${F}=${k}`).join("&"),w}return new URL(i)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(i)} as a whatwg URL.`),null;const t=e.href,{host:s,hostname:r,pathname:n,protocol:a,search:o}=e;if(o)return null;const l=a.slice(0,-1);if(!Object.values(En).includes(l))return null;const u=nf(r),d=t.includes(`${s}:${bo[l]}`)||typeof i=="string"&&i.includes(`${s}:${bo[l]}`),f=`${s}${d?`:${bo[l]}`:""}`;return{scheme:l,authority:f,path:n,normalizedPath:n.endsWith("/")?n:`${n}/`,isIp:u}},i0=(i,e)=>i===e,r0=(i,e,t,s)=>e>=t||i.length<t?null:s?i.substring(i.length-t,i.length-e):i.substring(e,t),n0=i=>encodeURIComponent(i).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),a0={booleanEquals:Jm,getAttr:af,isSet:e0,isValidHostLabel:jl,not:t0,parseURL:s0,stringEquals:i0,substring:r0,uriEncode:n0},of=(i,e)=>{const t=[],s={...e.endpointParams,...e.referenceRecord};let r=0;for(;r<i.length;){const n=i.indexOf("{",r);if(n===-1){t.push(i.slice(r));break}t.push(i.slice(r,n));const a=i.indexOf("}",n);if(a===-1){t.push(i.slice(n));break}i[n+1]==="{"&&i[a+1]==="}"&&(t.push(i.slice(n+1,a)),r=a+2);const o=i.substring(n+1,a);if(o.includes("#")){const[l,u]=o.split("#");t.push(af(s[l],u))}else t.push(s[o]);r=a+1}return t.join("")},o0=({ref:i},e)=>({...e.endpointParams,...e.referenceRecord})[i],Ja=(i,e,t)=>{if(typeof i=="string")return of(i,t);if(i.fn)return lf(i,t);if(i.ref)return o0(i,t);throw new ds(`'${e}': ${String(i)} is not a string, function or reference.`)},lf=({fn:i,argv:e},t)=>{const s=e.map(n=>["boolean","number"].includes(typeof n)?n:Ja(n,"arg",t)),r=i.split(".");return r[0]in bn&&r[1]!=null?bn[r[0]][r[1]](...s):a0[i](...s)},l0=({assign:i,...e},t)=>{var r,n;if(i&&i in t.referenceRecord)throw new ds(`'${i}' is already defined in Reference Record.`);const s=lf(e,t);return(n=(r=t.logger)==null?void 0:r.debug)==null||n.call(r,`${Tn} evaluateCondition: ${$i(e)} = ${$i(s)}`),{result:s===""?!0:!!s,...i!=null&&{toAssign:{name:i,value:s}}}},Kl=(i=[],e)=>{var s,r;const t={};for(const n of i){const{result:a,toAssign:o}=l0(n,{...e,referenceRecord:{...e.referenceRecord,...t}});if(!a)return{result:a};o&&(t[o.name]=o.value,(r=(s=e.logger)==null?void 0:s.debug)==null||r.call(s,`${Tn} assign: ${o.name} := ${$i(o.value)}`))}return{result:!0,referenceRecord:t}},c0=(i,e)=>Object.entries(i).reduce((t,[s,r])=>({...t,[s]:r.map(n=>{const a=Ja(n,"Header value entry",e);if(typeof a!="string")throw new ds(`Header '${s}' value '${a}' is not a string`);return a})}),{}),cf=(i,e)=>{if(Array.isArray(i))return i.map(t=>cf(t,e));switch(typeof i){case"string":return of(i,e);case"object":if(i===null)throw new ds(`Unexpected endpoint property: ${i}`);return uf(i,e);case"boolean":return i;default:throw new ds(`Unexpected endpoint property type: ${typeof i}`)}},uf=(i,e)=>Object.entries(i).reduce((t,[s,r])=>({...t,[s]:cf(r,e)}),{}),u0=(i,e)=>{const t=Ja(i,"Endpoint URL",e);if(typeof t=="string")try{return new URL(t)}catch(s){throw console.error(`Failed to construct URL with ${t}`,s),s}throw new ds(`Endpoint URL must be a string, got ${typeof t}`)},h0=(i,e)=>{var d,f;const{conditions:t,endpoint:s}=i,{result:r,referenceRecord:n}=Kl(t,e);if(!r)return;const a={...e,referenceRecord:{...e.referenceRecord,...n}},{url:o,properties:l,headers:u}=s;return(f=(d=e.logger)==null?void 0:d.debug)==null||f.call(d,`${Tn} Resolving endpoint from template: ${$i(s)}`),{...u!=null&&{headers:c0(u,a)},...l!=null&&{properties:uf(l,a)},url:u0(o,a)}},d0=(i,e)=>{const{conditions:t,error:s}=i,{result:r,referenceRecord:n}=Kl(t,e);if(r)throw new ds(Ja(s,"Error",{...e,referenceRecord:{...e.referenceRecord,...n}}))},f0=(i,e)=>{const{conditions:t,rules:s}=i,{result:r,referenceRecord:n}=Kl(t,e);if(r)return hf(s,{...e,referenceRecord:{...e.referenceRecord,...n}})},hf=(i,e)=>{for(const t of i)if(t.type==="endpoint"){const s=h0(t,e);if(s)return s}else if(t.type==="error")d0(t,e);else if(t.type==="tree"){const s=f0(t,e);if(s)return s}else throw new ds(`Unknown endpoint rule: ${t}`);throw new ds("Rules evaluation failed")},df=(i,e)=>{var u,d,f,g,v;const{endpointParams:t,logger:s}=e,{parameters:r,rules:n}=i;(d=(u=e.logger)==null?void 0:u.debug)==null||d.call(u,`${Tn} Initial EndpointParams: ${$i(t)}`);const a=Object.entries(r).filter(([,y])=>y.default!=null).map(([y,E])=>[y,E.default]);if(a.length>0)for(const[y,E]of a)t[y]=t[y]??E;const o=Object.entries(r).filter(([,y])=>y.required).map(([y])=>y);for(const y of o)if(t[y]==null)throw new ds(`Missing required parameter: '${y}'`);const l=hf(n,{endpointParams:t,logger:s,referenceRecord:{}});if((f=e.endpointParams)!=null&&f.Endpoint)try{const y=new URL(e.endpointParams.Endpoint),{protocol:E,port:b}=y;l.url.protocol=E,l.url.port=b}catch{}return(v=(g=e.logger)==null?void 0:g.debug)==null||v.call(g,`${Tn} Resolved endpoint: ${$i(l)}`),l},ff=(i,e=!1)=>{if(e){for(const t of i.split("."))if(!ff(t))return!1;return!0}return!(!jl(i)||i.length<3||i.length>63||i!==i.toLowerCase()||nf(i))},Eu=":",p0="/",g0=i=>{const e=i.split(Eu);if(e.length<6)return null;const[t,s,r,n,a,...o]=e;if(t!=="arn"||s===""||r===""||o.join(Eu)==="")return null;const l=o.map(u=>u.split(p0)).flat();return{partition:s,service:r,region:n,accountId:a,resourceId:l}},m0=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],v0="1.1",y0={partitions:m0,version:v0};let x0=y0;const S0=i=>{const{partitions:e}=x0;for(const s of e){const{regions:r,outputs:n}=s;for(const[a,o]of Object.entries(r))if(a===i)return{...n,...o}}for(const s of e){const{regionRegex:r,outputs:n}=s;if(new RegExp(r).test(i))return{...n}}const t=e.find(s=>s.id==="aws");if(!t)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...t.outputs}},zl={isVirtualHostableS3Bucket:ff,parseArn:g0,partition:S0};bn.aws=zl;const bu="user-agent",To="x-amz-user-agent",Tu=" ",wo="/",E0=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,b0=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,wu="-",T0=i=>(e,t)=>async s=>{var f,g;const{request:r}=s;if(!ns.isInstance(r))return e(s);const{headers:n}=r,a=((f=t==null?void 0:t.userAgent)==null?void 0:f.map(Ao))||[],o=(await i.defaultUserAgentProvider()).map(Ao),l=((g=i==null?void 0:i.customUserAgent)==null?void 0:g.map(Ao))||[],u=[].concat([...o,...a,...l]).join(Tu),d=[...o.filter(v=>v.startsWith("aws-sdk-")),...l].join(Tu);return i.runtime!=="browser"?(d&&(n[To]=n[To]?`${n[bu]} ${d}`:d),n[bu]=u):n[To]=u,e({...s,request:r})},Ao=i=>{var a;const e=i[0].split(wo).map(o=>o.replace(E0,wu)).join(wo),t=(a=i[1])==null?void 0:a.replace(b0,wu),s=e.indexOf(wo),r=e.substring(0,s);let n=e.substring(s+1);return r==="api"&&(n=n.toLowerCase()),[r,n,t].filter(o=>o&&o.length>0).reduce((o,l,u)=>{switch(u){case 0:return l;case 1:return`${o}/${l}`;default:return`${o}#${l}`}},"")},w0={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},pf=i=>({applyToStack:e=>{e.add(T0(i),w0)}});var Au;(function(i){i.ENV="env",i.CONFIG="shared config entry"})(Au||(Au={}));const gf=!1,mf=!1,Dn=i=>i[vl]||(i[vl]={}),yi=i=>{if(typeof i=="function")return i;const e=Promise.resolve(i);return()=>e},vf=i=>typeof i=="string"&&(i.startsWith("fips-")||i.endsWith("-fips")),Lu=i=>vf(i)?["fips-aws-global","aws-fips"].includes(i)?"us-east-1":i.replace(/fips-(dkr-|prod-)?|-fips/,""):i,yf=i=>{const{region:e,useFipsEndpoint:t}=i;if(!e)throw new Error("Region is missing");return{...i,region:async()=>{if(typeof e=="string")return Lu(e);const s=await e();return Lu(s)},useFipsEndpoint:async()=>{const s=typeof e=="string"?e:await e();return vf(s)?!0:typeof t!="function"?Promise.resolve(!!t):t()}}};function A0(i){const e=new Map;for(const t of i)e.set(t.schemeId,t);return e}const L0=(i,e)=>(t,s)=>async r=>{var u;const n=i.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(i,s,r.input)),a=A0(i.httpAuthSchemes),o=Dn(s),l=[];for(const d of n){const f=a.get(d.schemeId);if(!f){l.push(`HttpAuthScheme \`${d.schemeId}\` was not enabled for this service.`);continue}const g=f.identityProvider(await e.identityProviderConfigProvider(i));if(!g){l.push(`HttpAuthScheme \`${d.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:v={},signingProperties:y={}}=((u=d.propertiesExtractor)==null?void 0:u.call(d,i,s))||{};d.identityProperties=Object.assign(d.identityProperties||{},v),d.signingProperties=Object.assign(d.signingProperties||{},y),o.selectedHttpAuthScheme={httpAuthOption:d,identity:await g(d.identityProperties),signer:f.signer};break}if(!o.selectedHttpAuthScheme)throw new Error(l.join(`
|
|
27
|
+
Check the top-level render call using <`+Ce+">.")}return Ee}}function Nn(W,Ee){{if(!W._store||W._store.validated||W.key!=null)return;W._store.validated=!0;var Ce=gr(Ee);if(Hi[Ce])return;Hi[Ce]=!0;var Ie="";W&&W._owner&&W._owner!==dr.current&&(Ie=" It was passed a child from "+be(W._owner.type)+"."),Si(W),re('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Ce,Ie),Si(null)}}function Bn(W,Ee){{if(typeof W!="object")return;if(Array.isArray(W))for(var Ce=0;Ce<W.length;Ce++){var Ie=W[Ce];fr(Ie)&&Nn(Ie,Ee)}else if(fr(W))W._store&&(W._store.validated=!0);else if(W){var lt=te(W);if(typeof lt=="function"&<!==W.entries)for(var Fe=lt.call(W),tt;!(tt=Fe.next()).done;)fr(tt.value)&&Nn(tt.value,Ee)}}}function ao(W){{var Ee=W.type;if(Ee==null||typeof Ee=="string")return;var Ce;if(typeof Ee=="function")Ce=Ee.propTypes;else if(typeof Ee=="object"&&(Ee.$$typeof===u||Ee.$$typeof===g))Ce=Ee.propTypes;else return;if(Ce){var Ie=be(Ee);ur(Ce,W.props,"prop",Ie,W)}else if(Ee.PropTypes!==void 0&&!zr){zr=!0;var lt=be(Ee);re("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",lt||"Unknown")}typeof Ee.getDefaultProps=="function"&&!Ee.getDefaultProps.isReactClassApproved&&re("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function oo(W){{for(var Ee=Object.keys(W.props),Ce=0;Ce<Ee.length;Ce++){var Ie=Ee[Ce];if(Ie!=="children"&&Ie!=="key"){Si(W),re("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ie),Si(null);break}}W.ref!==null&&(Si(W),re("Invalid attribute `ref` supplied to `React.Fragment`."),Si(null))}}function Ae(W,Ee,Ce,Ie,lt,Fe){{var tt=se(W);if(!tt){var et="";(W===void 0||typeof W=="object"&&W!==null&&Object.keys(W).length===0)&&(et+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var $t=pr();$t?et+=$t:et+=Wr();var xt;W===null?xt="null":Array.isArray(W)?xt="array":W!==void 0&&W.$$typeof===s?(xt="<"+(be(W.type)||"Unknown")+" />",et=" Did you accidentally export a JSX literal instead of a component?"):xt=typeof W,re("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",xt,et)}var Et=ii(W,Ee,Ce,lt,Fe);if(Et==null)return Et;if(tt){var ws=Ee.children;if(ws!==void 0)if(Ie)if(Array.isArray(ws)){for(var Ei=0;Ei<ws.length;Ei++)Bn(ws[Ei],W);Object.freeze&&Object.freeze(ws)}else re("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Bn(ws,W)}return W===i.Fragment?oo(Et):ao(Et),Et}}function _t(W,Ee,Ce){return Ae(W,Ee,Ce,!0)}function ri(W,Ee,Ce){return Ae(W,Ee,Ce,!1)}var Ts=ri,Dt=_t;i.jsx=Ts,i.jsxs=Dt}()}(Eo)),Eo}process.env.NODE_ENV==="production"?ml.exports=_m():ml.exports=Im();var Ne=ml.exports;const km="_root_1qxmy_1",Pm="_progress_1qxmy_8",Dm="_pop_1qxmy_1",Mm="_play_button_1qxmy_25",Fm="_pause_button_1qxmy_26",Om="_play_icon_1qxmy_47",Nm="_mute_button_1qxmy_58",Bm="_sound_off_icon_1qxmy_78",$m="_sound_on_icon_1qxmy_82",Um="_error_1qxmy_86",Us={root:km,progress:Pm,pop:Dm,play_button:Mm,pause_button:Fm,play_icon:Om,mute_button:Nm,sound_off_icon:Bm,sound_on_icon:$m,error:Um},Jd=i=>{let e=i.httpHandler;return{setHttpHandler(t){e=t},httpHandler(){return e},updateHttpClientConfig(t,s){e.updateHttpClientConfig(t,s)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Zd=i=>({httpHandler:i.httpHandler()});var gu;(function(i){i.HEADER="header",i.QUERY="query"})(gu||(gu={}));var mu;(function(i){i.HEADER="header",i.QUERY="query"})(mu||(mu={}));var En;(function(i){i.HTTP="http",i.HTTPS="https"})(En||(En={}));var _a;(function(i){i.MD5="md5",i.CRC32="crc32",i.CRC32C="crc32c",i.SHA1="sha1",i.SHA256="sha256"})(_a||(_a={}));var vu;(function(i){i[i.HEADER=0]="HEADER",i[i.TRAILER=1]="TRAILER"})(vu||(vu={}));const vl="__smithy_context";var yu;(function(i){i.PROFILE="profile",i.SSO_SESSION="sso-session",i.SERVICES="services"})(yu||(yu={}));var xu;(function(i){i.HTTP_0_9="http/0.9",i.HTTP_1_0="http/1.0",i.TDS_8_0="tds/8.0"})(xu||(xu={}));class ns{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const t=new ns({...e,headers:{...e.headers}});return t.query&&(t.query=Gm(t.query)),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&typeof t.query=="object"&&typeof t.headers=="object"}clone(){return ns.clone(this)}}function Gm(i){return Object.keys(i).reduce((e,t)=>{const s=i[t];return{...e,[t]:Array.isArray(s)?[...s]:s}},{})}class Ia{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return typeof t.statusCode=="number"&&typeof t.headers=="object"}}const Vm=i=>e=>async t=>{if(!ns.isInstance(t.request))return e(t);const{request:s}=t,{handlerProtocol:r=""}=i.requestHandler.metadata||{};if(r.indexOf("h2")>=0&&!s.headers[":authority"])delete s.headers.host,s.headers[":authority"]=s.hostname+(s.port?":"+s.port:"");else if(!s.headers.host){let n=s.hostname;s.port!=null&&(n+=`:${s.port}`),s.headers.host=n}return e(t)},Hm={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},ef=i=>({applyToStack:e=>{e.add(Vm(i),Hm)}}),jm=()=>(i,e)=>async t=>{var s,r;try{const n=await i(t),{clientName:a,commandName:o,logger:l,dynamoDbDocumentClientOptions:u={}}=e,{overrideInputFilterSensitiveLog:d,overrideOutputFilterSensitiveLog:f}=u,g=d??e.inputFilterSensitiveLog,v=f??e.outputFilterSensitiveLog,{$metadata:y,...E}=n.output;return(s=l==null?void 0:l.info)==null||s.call(l,{clientName:a,commandName:o,input:g(t.input),output:v(E),metadata:y}),n}catch(n){const{clientName:a,commandName:o,logger:l,dynamoDbDocumentClientOptions:u={}}=e,{overrideInputFilterSensitiveLog:d}=u,f=d??e.inputFilterSensitiveLog;throw(r=l==null?void 0:l.error)==null||r.call(l,{clientName:a,commandName:o,input:f(t.input),error:n,metadata:n.$metadata}),n}},Km={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},tf=i=>({applyToStack:e=>{e.add(jm(),Km)}}),Su="X-Amzn-Trace-Id",zm="AWS_LAMBDA_FUNCTION_NAME",Wm="_X_AMZN_TRACE_ID",qm=i=>e=>async t=>{const{request:s}=t;if(!ns.isInstance(s)||i.runtime!=="node"||s.headers.hasOwnProperty(Su))return e(t);const r=process.env[zm],n=process.env[Wm],a=o=>typeof o=="string"&&o.length>0;return a(r)&&a(n)&&(s.headers[Su]=n),e({...t,request:s})},Ym={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},sf=i=>({applyToStack:e=>{e.add(qm(i),Ym)}});function rf(i){return{...i,customUserAgent:typeof i.customUserAgent=="string"?[[i.customUserAgent]]:i.customUserAgent}}const Xm=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),nf=i=>Xm.test(i)||i.startsWith("[")&&i.endsWith("]"),Qm=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),jl=(i,e=!1)=>{if(!e)return Qm.test(i);const t=i.split(".");for(const s of t)if(!jl(s))return!1;return!0},bn={},Tn="endpoints";function $i(i){return typeof i!="object"||i==null?i:"ref"in i?`$${$i(i.ref)}`:"fn"in i?`${i.fn}(${(i.argv||[]).map($i).join(", ")})`:JSON.stringify(i,null,2)}class ds extends Error{constructor(e){super(e),this.name="EndpointError"}}const Jm=(i,e)=>i===e,Zm=i=>{const e=i.split("."),t=[];for(const s of e){const r=s.indexOf("[");if(r!==-1){if(s.indexOf("]")!==s.length-1)throw new ds(`Path: '${i}' does not end with ']'`);const n=s.slice(r+1,-1);if(Number.isNaN(parseInt(n)))throw new ds(`Invalid array index: '${n}' in path: '${i}'`);r!==0&&t.push(s.slice(0,r)),t.push(n)}else t.push(s)}return t},af=(i,e)=>Zm(e).reduce((t,s)=>{if(typeof t!="object")throw new ds(`Index '${s}' in '${e}' not found in '${JSON.stringify(i)}'`);return Array.isArray(t)?t[parseInt(s)]:t[s]},i),e0=i=>i!=null,t0=i=>!i,bo={[En.HTTP]:80,[En.HTTPS]:443},s0=i=>{const e=(()=>{try{if(i instanceof URL)return i;if(typeof i=="object"&&"hostname"in i){const{hostname:g,port:v,protocol:y="",path:E="",query:b={}}=i,w=new URL(`${y}//${g}${v?`:${v}`:""}${E}`);return w.search=Object.entries(b).map(([F,k])=>`${F}=${k}`).join("&"),w}return new URL(i)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(i)} as a whatwg URL.`),null;const t=e.href,{host:s,hostname:r,pathname:n,protocol:a,search:o}=e;if(o)return null;const l=a.slice(0,-1);if(!Object.values(En).includes(l))return null;const u=nf(r),d=t.includes(`${s}:${bo[l]}`)||typeof i=="string"&&i.includes(`${s}:${bo[l]}`),f=`${s}${d?`:${bo[l]}`:""}`;return{scheme:l,authority:f,path:n,normalizedPath:n.endsWith("/")?n:`${n}/`,isIp:u}},i0=(i,e)=>i===e,r0=(i,e,t,s)=>e>=t||i.length<t?null:s?i.substring(i.length-t,i.length-e):i.substring(e,t),n0=i=>encodeURIComponent(i).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),a0={booleanEquals:Jm,getAttr:af,isSet:e0,isValidHostLabel:jl,not:t0,parseURL:s0,stringEquals:i0,substring:r0,uriEncode:n0},of=(i,e)=>{const t=[],s={...e.endpointParams,...e.referenceRecord};let r=0;for(;r<i.length;){const n=i.indexOf("{",r);if(n===-1){t.push(i.slice(r));break}t.push(i.slice(r,n));const a=i.indexOf("}",n);if(a===-1){t.push(i.slice(n));break}i[n+1]==="{"&&i[a+1]==="}"&&(t.push(i.slice(n+1,a)),r=a+2);const o=i.substring(n+1,a);if(o.includes("#")){const[l,u]=o.split("#");t.push(af(s[l],u))}else t.push(s[o]);r=a+1}return t.join("")},o0=({ref:i},e)=>({...e.endpointParams,...e.referenceRecord})[i],Ja=(i,e,t)=>{if(typeof i=="string")return of(i,t);if(i.fn)return lf(i,t);if(i.ref)return o0(i,t);throw new ds(`'${e}': ${String(i)} is not a string, function or reference.`)},lf=({fn:i,argv:e},t)=>{const s=e.map(n=>["boolean","number"].includes(typeof n)?n:Ja(n,"arg",t)),r=i.split(".");return r[0]in bn&&r[1]!=null?bn[r[0]][r[1]](...s):a0[i](...s)},l0=({assign:i,...e},t)=>{var r,n;if(i&&i in t.referenceRecord)throw new ds(`'${i}' is already defined in Reference Record.`);const s=lf(e,t);return(n=(r=t.logger)==null?void 0:r.debug)==null||n.call(r,`${Tn} evaluateCondition: ${$i(e)} = ${$i(s)}`),{result:s===""?!0:!!s,...i!=null&&{toAssign:{name:i,value:s}}}},Kl=(i=[],e)=>{var s,r;const t={};for(const n of i){const{result:a,toAssign:o}=l0(n,{...e,referenceRecord:{...e.referenceRecord,...t}});if(!a)return{result:a};o&&(t[o.name]=o.value,(r=(s=e.logger)==null?void 0:s.debug)==null||r.call(s,`${Tn} assign: ${o.name} := ${$i(o.value)}`))}return{result:!0,referenceRecord:t}},c0=(i,e)=>Object.entries(i).reduce((t,[s,r])=>({...t,[s]:r.map(n=>{const a=Ja(n,"Header value entry",e);if(typeof a!="string")throw new ds(`Header '${s}' value '${a}' is not a string`);return a})}),{}),cf=(i,e)=>{if(Array.isArray(i))return i.map(t=>cf(t,e));switch(typeof i){case"string":return of(i,e);case"object":if(i===null)throw new ds(`Unexpected endpoint property: ${i}`);return uf(i,e);case"boolean":return i;default:throw new ds(`Unexpected endpoint property type: ${typeof i}`)}},uf=(i,e)=>Object.entries(i).reduce((t,[s,r])=>({...t,[s]:cf(r,e)}),{}),u0=(i,e)=>{const t=Ja(i,"Endpoint URL",e);if(typeof t=="string")try{return new URL(t)}catch(s){throw console.error(`Failed to construct URL with ${t}`,s),s}throw new ds(`Endpoint URL must be a string, got ${typeof t}`)},h0=(i,e)=>{var d,f;const{conditions:t,endpoint:s}=i,{result:r,referenceRecord:n}=Kl(t,e);if(!r)return;const a={...e,referenceRecord:{...e.referenceRecord,...n}},{url:o,properties:l,headers:u}=s;return(f=(d=e.logger)==null?void 0:d.debug)==null||f.call(d,`${Tn} Resolving endpoint from template: ${$i(s)}`),{...u!=null&&{headers:c0(u,a)},...l!=null&&{properties:uf(l,a)},url:u0(o,a)}},d0=(i,e)=>{const{conditions:t,error:s}=i,{result:r,referenceRecord:n}=Kl(t,e);if(r)throw new ds(Ja(s,"Error",{...e,referenceRecord:{...e.referenceRecord,...n}}))},f0=(i,e)=>{const{conditions:t,rules:s}=i,{result:r,referenceRecord:n}=Kl(t,e);if(r)return hf(s,{...e,referenceRecord:{...e.referenceRecord,...n}})},hf=(i,e)=>{for(const t of i)if(t.type==="endpoint"){const s=h0(t,e);if(s)return s}else if(t.type==="error")d0(t,e);else if(t.type==="tree"){const s=f0(t,e);if(s)return s}else throw new ds(`Unknown endpoint rule: ${t}`);throw new ds("Rules evaluation failed")},df=(i,e)=>{var u,d,f,g,v;const{endpointParams:t,logger:s}=e,{parameters:r,rules:n}=i;(d=(u=e.logger)==null?void 0:u.debug)==null||d.call(u,`${Tn} Initial EndpointParams: ${$i(t)}`);const a=Object.entries(r).filter(([,y])=>y.default!=null).map(([y,E])=>[y,E.default]);if(a.length>0)for(const[y,E]of a)t[y]=t[y]??E;const o=Object.entries(r).filter(([,y])=>y.required).map(([y])=>y);for(const y of o)if(t[y]==null)throw new ds(`Missing required parameter: '${y}'`);const l=hf(n,{endpointParams:t,logger:s,referenceRecord:{}});if((f=e.endpointParams)!=null&&f.Endpoint)try{const y=new URL(e.endpointParams.Endpoint),{protocol:E,port:b}=y;l.url.protocol=E,l.url.port=b}catch{}return(v=(g=e.logger)==null?void 0:g.debug)==null||v.call(g,`${Tn} Resolved endpoint: ${$i(l)}`),l},ff=(i,e=!1)=>{if(e){for(const t of i.split("."))if(!ff(t))return!1;return!0}return!(!jl(i)||i.length<3||i.length>63||i!==i.toLowerCase()||nf(i))},Eu=":",p0="/",g0=i=>{const e=i.split(Eu);if(e.length<6)return null;const[t,s,r,n,a,...o]=e;if(t!=="arn"||s===""||r===""||o.join(Eu)==="")return null;const l=o.map(u=>u.split(p0)).flat();return{partition:s,service:r,region:n,accountId:a,resourceId:l}},m0=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],v0="1.1",y0={partitions:m0,version:v0};let x0=y0;const S0=i=>{const{partitions:e}=x0;for(const s of e){const{regions:r,outputs:n}=s;for(const[a,o]of Object.entries(r))if(a===i)return{...n,...o}}for(const s of e){const{regionRegex:r,outputs:n}=s;if(new RegExp(r).test(i))return{...n}}const t=e.find(s=>s.id==="aws");if(!t)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...t.outputs}},zl={isVirtualHostableS3Bucket:ff,parseArn:g0,partition:S0};bn.aws=zl;const bu="user-agent",To="x-amz-user-agent",Tu=" ",wo="/",E0=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,b0=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,wu="-",T0=i=>(e,t)=>async s=>{var f,g;const{request:r}=s;if(!ns.isInstance(r))return e(s);const{headers:n}=r,a=((f=t==null?void 0:t.userAgent)==null?void 0:f.map(Ao))||[],o=(await i.defaultUserAgentProvider()).map(Ao),l=((g=i==null?void 0:i.customUserAgent)==null?void 0:g.map(Ao))||[],u=[].concat([...o,...a,...l]).join(Tu),d=[...o.filter(v=>v.startsWith("aws-sdk-")),...l].join(Tu);return i.runtime!=="browser"?(d&&(n[To]=n[To]?`${n[bu]} ${d}`:d),n[bu]=u):n[To]=u,e({...s,request:r})},Ao=i=>{var a;const e=i[0].split(wo).map(o=>o.replace(E0,wu)).join(wo),t=(a=i[1])==null?void 0:a.replace(b0,wu),s=e.indexOf(wo),r=e.substring(0,s);let n=e.substring(s+1);return r==="api"&&(n=n.toLowerCase()),[r,n,t].filter(o=>o&&o.length>0).reduce((o,l,u)=>{switch(u){case 0:return l;case 1:return`${o}/${l}`;default:return`${o}#${l}`}},"")},w0={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},pf=i=>({applyToStack:e=>{e.add(T0(i),w0)}});var Au;(function(i){i.ENV="env",i.CONFIG="shared config entry"})(Au||(Au={}));const gf=!1,mf=!1,Dn=i=>i[vl]||(i[vl]={}),yi=i=>{if(typeof i=="function")return i;const e=Promise.resolve(i);return()=>e},vf=i=>typeof i=="string"&&(i.startsWith("fips-")||i.endsWith("-fips")),Lu=i=>vf(i)?["fips-aws-global","aws-fips"].includes(i)?"us-east-1":i.replace(/fips-(dkr-|prod-)?|-fips/,""):i,yf=i=>{const{region:e,useFipsEndpoint:t}=i;if(!e)throw new Error("Region is missing");return{...i,region:async()=>{if(typeof e=="string")return Lu(e);const s=await e();return Lu(s)},useFipsEndpoint:async()=>{const s=typeof e=="string"?e:await e();return vf(s)?!0:typeof t!="function"?Promise.resolve(!!t):t()}}};function A0(i){const e=new Map;for(const t of i)e.set(t.schemeId,t);return e}const L0=(i,e)=>(t,s)=>async r=>{var u;const n=i.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(i,s,r.input)),a=A0(i.httpAuthSchemes),o=Dn(s),l=[];for(const d of n){const f=a.get(d.schemeId);if(!f){l.push(`HttpAuthScheme \`${d.schemeId}\` was not enabled for this service.`);continue}const g=f.identityProvider(await e.identityProviderConfigProvider(i));if(!g){l.push(`HttpAuthScheme \`${d.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:v={},signingProperties:y={}}=((u=d.propertiesExtractor)==null?void 0:u.call(d,i,s))||{};d.identityProperties=Object.assign(d.identityProperties||{},v),d.signingProperties=Object.assign(d.signingProperties||{},y),o.selectedHttpAuthScheme={httpAuthOption:d,identity:await g(d.identityProperties),signer:f.signer};break}if(!o.selectedHttpAuthScheme)throw new Error(l.join(`
|
|
28
28
|
`));return t(r)},C0=async i=>{const e=(i==null?void 0:i.Bucket)||"";if(typeof i.Bucket=="string"&&(i.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),P0(e)){if(i.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!k0(e)||e.indexOf(".")!==-1&&!String(i.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(i.ForcePathStyle=!0);return i.DisableMultiRegionAccessPoints&&(i.disableMultiRegionAccessPoints=!0,i.DisableMRAP=!0),i},R0=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,_0=/(\d+\.){3}\d+/,I0=/\.\./,k0=i=>R0.test(i)&&!_0.test(i)&&!I0.test(i),P0=i=>{const[e,t,s,,,r]=i.split(":"),n=e==="arn"&&i.split(":").length>=6,a=!!(n&&t&&s&&r);if(n&&!a)throw new Error(`Invalid ARN: ${i} was an invalid ARN.`);return a},D0=(i,e,t)=>{const s=async()=>{const r=t[i]??t[e];return typeof r=="function"?r():r};return i==="credentialScope"||e==="CredentialScope"?async()=>{const r=typeof t.credentials=="function"?await t.credentials():t.credentials;return(r==null?void 0:r.credentialScope)??(r==null?void 0:r.CredentialScope)}:i==="accountId"||e==="AccountId"?async()=>{const r=typeof t.credentials=="function"?await t.credentials():t.credentials;return(r==null?void 0:r.accountId)??(r==null?void 0:r.AccountId)}:i==="endpoint"||e==="endpoint"?async()=>{const r=await s();if(r&&typeof r=="object"){if("url"in r)return r.url.href;if("hostname"in r){const{protocol:n,hostname:a,port:o,path:l}=r;return`${n}//${a}${o?":"+o:""}${l}`}}return r}:s},M0=async i=>{};function F0(i){const e={};if(i=i.replace(/^\?/,""),i)for(const t of i.split("&")){let[s,r=null]=t.split("=");s=decodeURIComponent(s),r&&(r=decodeURIComponent(r)),s in e?Array.isArray(e[s])?e[s].push(r):e[s]=[e[s],r]:e[s]=r}return e}const wn=i=>{if(typeof i=="string")return wn(new URL(i));const{hostname:e,pathname:t,port:s,protocol:r,search:n}=i;let a;return n&&(a=F0(n)),{hostname:e,port:s?parseInt(s):void 0,protocol:r,path:t,query:a}},xf=i=>typeof i=="object"?"url"in i?wn(i.url):i:wn(i),O0=async(i,e,t,s)=>{if(!t.endpoint){const a=await M0(t.serviceId||"");a&&(t.endpoint=()=>Promise.resolve(xf(a)))}const r=await N0(i,e,t);if(typeof t.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return t.endpointProvider(r,s)},N0=async(i,e,t)=>{var n;const s={},r=((n=e==null?void 0:e.getEndpointParameterInstructions)==null?void 0:n.call(e))||{};for(const[a,o]of Object.entries(r))switch(o.type){case"staticContextParams":s[a]=o.value;break;case"contextParams":s[a]=i[o.name];break;case"clientContextParams":case"builtInParams":s[a]=await D0(o.name,a,t)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return Object.keys(r).length===0&&Object.assign(s,t),String(t.serviceId).toLowerCase()==="s3"&&await C0(s),s},B0=({config:i,instructions:e})=>(t,s)=>async r=>{var o,l,u;const n=await O0(r.input,{getEndpointParameterInstructions(){return e}},{...i},s);s.endpointV2=n,s.authSchemes=(o=n.properties)==null?void 0:o.authSchemes;const a=(l=s.authSchemes)==null?void 0:l[0];if(a){s.signing_region=a.signingRegion,s.signing_service=a.signingName;const d=Dn(s),f=(u=d==null?void 0:d.selectedHttpAuthScheme)==null?void 0:u.httpAuthOption;f&&(f.signingProperties=Object.assign(f.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return t({...r})},$0=(i,e)=>t=>async s=>{const{response:r}=await t(s);try{const n=await e(r,i);return{response:r,output:n}}catch(n){if(Object.defineProperty(n,"$response",{value:r}),!("$metadata"in n)){const a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";n.message+=`
|
|
29
|
-
`+a,typeof n.$responseBodyText<"u"&&n.$response&&(n.$response.body=n.$responseBodyText)}throw n}},U0=(i,e)=>(t,s)=>async r=>{var o;const n=(o=s.endpointV2)!=null&&o.url&&i.urlParser?async()=>i.urlParser(s.endpointV2.url):i.endpoint;if(!n)throw new Error("No valid endpoint provider available.");const a=await e(r.input,{...i,endpoint:n});return t({...r,request:a})},G0={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Wl={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Sf(i,e,t){return{applyToStack:s=>{s.add($0(i,t),G0),s.add(U0(i,e),Wl)}}}const Ef={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Wl.name},bf=(i,e)=>({applyToStack:t=>{t.addRelativeTo(B0({config:i,instructions:e}),Ef)}}),Tf=i=>{const e=i.tls??!0,{endpoint:t}=i,s=t!=null?async()=>xf(await yi(t)()):void 0;return{...i,endpoint:s,tls:e,isCustomEndpoint:!!t,useDualstackEndpoint:yi(i.useDualstackEndpoint??!1),useFipsEndpoint:yi(i.useFipsEndpoint??!1)}},V0={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Ef.name},wf=(i,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t})=>({applyToStack:s=>{s.addRelativeTo(L0(i,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t}),V0)}});Wl.name;const H0=i=>e=>{throw e},j0=(i,e)=>{},K0=i=>(e,t)=>async s=>{if(!ns.isInstance(s.request))return e(s);const n=Dn(t).selectedHttpAuthScheme;if(!n)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:a={}},identity:o,signer:l}=n,u=await e({...s,request:await l.sign(s.request,o,a)}).catch((l.errorHandler||H0)(a));return(l.successHandler||j0)(u.response,a),u};var Nr;(function(i){i.STANDARD="standard",i.ADAPTIVE="adaptive"})(Nr||(Nr={}));const An=3,Af=Nr.STANDARD,z0=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],W0=["TimeoutError","RequestTimeout","RequestTimeoutException"],q0=[500,502,503,504],Y0=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],X0=i=>{var e;return(e=i.$metadata)==null?void 0:e.clockSkewCorrected},Lf=i=>{var e,t;return((e=i.$metadata)==null?void 0:e.httpStatusCode)===429||z0.includes(i.name)||((t=i.$retryable)==null?void 0:t.throttling)==!0},Cf=i=>{var e;return X0(i)||W0.includes(i.name)||Y0.includes((i==null?void 0:i.code)||"")||q0.includes(((e=i.$metadata)==null?void 0:e.httpStatusCode)||0)},Q0=i=>{var e;if(((e=i.$metadata)==null?void 0:e.httpStatusCode)!==void 0){const t=i.$metadata.httpStatusCode;return 500<=t&&t<=599&&!Cf(i)}return!1};class J0{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=(e==null?void 0:e.beta)??.7,this.minCapacity=(e==null?void 0:e.minCapacity)??1,this.minFillRate=(e==null?void 0:e.minFillRate)??.5,this.scaleConstant=(e==null?void 0:e.scaleConstant)??.4,this.smooth=(e==null?void 0:e.smooth)??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(s=>setTimeout(s,t))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),Lf(e)){const r=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=r,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(r),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const s=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(s)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){const s=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(s*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const yl=100,Rf=20*1e3,Z0=500,Cu=500,ev=5,tv=10,sv=1,iv="amz-sdk-invocation-id",rv="amz-sdk-request",nv=()=>{let i=yl;return{computeNextBackoffDelay:s=>Math.floor(Math.min(Rf,Math.random()*2**s*i)),setDelayBase:s=>{i=s}}},Ru=({retryDelay:i,retryCount:e,retryCost:t})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(Rf,i),getRetryCost:()=>t});class _f{constructor(e){this.maxAttempts=e,this.mode=Nr.STANDARD,this.capacity=Cu,this.retryBackoffStrategy=nv(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return Ru({retryDelay:yl,retryCount:0})}async refreshRetryTokenForRetry(e,t){const s=await this.getMaxAttempts();if(this.shouldRetry(e,t,s)){const r=t.errorType;this.retryBackoffStrategy.setDelayBase(r==="THROTTLING"?Z0:yl);const n=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),a=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,n):n,o=this.getCapacityCost(r);return this.capacity-=o,Ru({retryDelay:a,retryCount:e.getRetryCount()+1,retryCost:o})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(Cu,this.capacity+(e.getRetryCost()??sv))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${An}`),An}}shouldRetry(e,t,s){return e.getRetryCount()+1<s&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return e==="TRANSIENT"?tv:ev}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class av{constructor(e,t){this.maxAttemptsProvider=e,this.mode=Nr.ADAPTIVE;const{rateLimiter:s}=t??{};this.rateLimiter=s??new J0,this.standardRetryStrategy=new _f(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}let qn;const ov=new Uint8Array(16);function lv(){if(!qn&&(qn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!qn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qn(ov)}const Gt=[];for(let i=0;i<256;++i)Gt.push((i+256).toString(16).slice(1));function cv(i,e=0){return Gt[i[e+0]]+Gt[i[e+1]]+Gt[i[e+2]]+Gt[i[e+3]]+"-"+Gt[i[e+4]]+Gt[i[e+5]]+"-"+Gt[i[e+6]]+Gt[i[e+7]]+"-"+Gt[i[e+8]]+Gt[i[e+9]]+"-"+Gt[i[e+10]]+Gt[i[e+11]]+Gt[i[e+12]]+Gt[i[e+13]]+Gt[i[e+14]]+Gt[i[e+15]]}const uv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_u={randomUUID:uv};function hv(i,e,t){if(_u.randomUUID&&!e&&!i)return _u.randomUUID();i=i||{};const s=i.random||(i.rng||lv)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,cv(s)}const dv=i=>i instanceof Error?i:i instanceof Object?Object.assign(new Error,i):typeof i=="string"?new Error(i):new Error(`AWS SDK error wrapper for ${i}`),If=i=>{const{retryStrategy:e}=i,t=yi(i.maxAttempts??An);return{...i,maxAttempts:t,retryStrategy:async()=>e||(await yi(i.retryMode)()===Nr.ADAPTIVE?new av(t):new _f(t))}};class ql{trace(){}debug(){}info(){}warn(){}error(){}}const qi=(i,e)=>{const t=[];if(i&&t.push(i),e)for(const s of e)t.push(s);return t},Pi=(i,e)=>`${i||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,ka=()=>{let i=[],e=[],t=!1;const s=new Set,r=f=>f.sort((g,v)=>Iu[v.step]-Iu[g.step]||ku[v.priority||"normal"]-ku[g.priority||"normal"]),n=f=>{let g=!1;const v=y=>{const E=qi(y.name,y.aliases);if(E.includes(f)){g=!0;for(const b of E)s.delete(b);return!1}return!0};return i=i.filter(v),e=e.filter(v),g},a=f=>{let g=!1;const v=y=>{if(y.middleware===f){g=!0;for(const E of qi(y.name,y.aliases))s.delete(E);return!1}return!0};return i=i.filter(v),e=e.filter(v),g},o=f=>{var g;return i.forEach(v=>{f.add(v.middleware,{...v})}),e.forEach(v=>{f.addRelativeTo(v.middleware,{...v})}),(g=f.identifyOnResolve)==null||g.call(f,d.identifyOnResolve()),f},l=f=>{const g=[];return f.before.forEach(v=>{v.before.length===0&&v.after.length===0?g.push(v):g.push(...l(v))}),g.push(f),f.after.reverse().forEach(v=>{v.before.length===0&&v.after.length===0?g.push(v):g.push(...l(v))}),g},u=(f=!1)=>{const g=[],v=[],y={};return i.forEach(b=>{const w={...b,before:[],after:[]};for(const F of qi(w.name,w.aliases))y[F]=w;g.push(w)}),e.forEach(b=>{const w={...b,before:[],after:[]};for(const F of qi(w.name,w.aliases))y[F]=w;v.push(w)}),v.forEach(b=>{if(b.toMiddleware){const w=y[b.toMiddleware];if(w===void 0){if(f)return;throw new Error(`${b.toMiddleware} is not found when adding ${Pi(b.name,b.aliases)} middleware ${b.relation} ${b.toMiddleware}`)}b.relation==="after"&&w.after.push(b),b.relation==="before"&&w.before.push(b)}}),r(g).map(l).reduce((b,w)=>(b.push(...w),b),[])},d={add:(f,g={})=>{const{name:v,override:y,aliases:E}=g,b={step:"initialize",priority:"normal",middleware:f,...g},w=qi(v,E);if(w.length>0){if(w.some(F=>s.has(F))){if(!y)throw new Error(`Duplicate middleware name '${Pi(v,E)}'`);for(const F of w){const k=i.findIndex(N=>{var te;return N.name===F||((te=N.aliases)==null?void 0:te.some(j=>j===F))});if(k===-1)continue;const U=i[k];if(U.step!==b.step||b.priority!==U.priority)throw new Error(`"${Pi(U.name,U.aliases)}" middleware with ${U.priority} priority in ${U.step} step cannot be overridden by "${Pi(v,E)}" middleware with ${b.priority} priority in ${b.step} step.`);i.splice(k,1)}}for(const F of w)s.add(F)}i.push(b)},addRelativeTo:(f,g)=>{const{name:v,override:y,aliases:E}=g,b={middleware:f,...g},w=qi(v,E);if(w.length>0){if(w.some(F=>s.has(F))){if(!y)throw new Error(`Duplicate middleware name '${Pi(v,E)}'`);for(const F of w){const k=e.findIndex(N=>{var te;return N.name===F||((te=N.aliases)==null?void 0:te.some(j=>j===F))});if(k===-1)continue;const U=e[k];if(U.toMiddleware!==b.toMiddleware||U.relation!==b.relation)throw new Error(`"${Pi(U.name,U.aliases)}" middleware ${U.relation} "${U.toMiddleware}" middleware cannot be overridden by "${Pi(v,E)}" middleware ${b.relation} "${b.toMiddleware}" middleware.`);e.splice(k,1)}}for(const F of w)s.add(F)}e.push(b)},clone:()=>o(ka()),use:f=>{f.applyToStack(d)},remove:f=>typeof f=="string"?n(f):a(f),removeByTag:f=>{let g=!1;const v=y=>{const{tags:E,name:b,aliases:w}=y;if(E&&E.includes(f)){const F=qi(b,w);for(const k of F)s.delete(k);return g=!0,!1}return!0};return i=i.filter(v),e=e.filter(v),g},concat:f=>{var v;const g=o(ka());return g.use(f),g.identifyOnResolve(t||g.identifyOnResolve()||(((v=f.identifyOnResolve)==null?void 0:v.call(f))??!1)),g},applyToStack:o,identify:()=>u(!0).map(f=>{const g=f.step??f.relation+" "+f.toMiddleware;return Pi(f.name,f.aliases)+" - "+g}),identifyOnResolve(f){return typeof f=="boolean"&&(t=f),t},resolve:(f,g)=>{for(const v of u().map(y=>y.middleware).reverse())f=v(f,g);return t&&console.log(d.identify()),f}};return d},Iu={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},ku={high:3,normal:2,low:1};class kf{constructor(e){this.middlewareStack=ka(),this.config=e}send(e,t,s){const r=typeof t!="function"?t:void 0,n=typeof t=="function"?t:s,a=e.resolveMiddleware(this.middlewareStack,this.config,r);if(n)a(e).then(o=>n(null,o.output),o=>n(o)).catch(()=>{});else return a(e).then(o=>o.output)}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}const Ui={},Vr=new Array(64);for(let i=0,e=65,t=90;i+e<=t;i++){const s=String.fromCharCode(i+e);Ui[s]=i,Vr[i]=s}for(let i=0,e=97,t=122;i+e<=t;i++){const s=String.fromCharCode(i+e),r=i+26;Ui[s]=r,Vr[r]=s}for(let i=0;i<10;i++){Ui[i.toString(10)]=i+52;const e=i.toString(10),t=i+52;Ui[e]=t,Vr[t]=e}Ui["+"]=62;Vr[62]="+";Ui["/"]=63;Vr[63]="/";const Mr=6,fn=8,fv=63,Za=i=>{let e=i.length/4*3;i.slice(-2)==="=="?e-=2:i.slice(-1)==="="&&e--;const t=new ArrayBuffer(e),s=new DataView(t);for(let r=0;r<i.length;r+=4){let n=0,a=0;for(let u=r,d=r+3;u<=d;u++)if(i[u]!=="="){if(!(i[u]in Ui))throw new TypeError(`Invalid character ${i[u]} in base64 string.`);n|=Ui[i[u]]<<(d-u)*Mr,a+=Mr}else n>>=Mr;const o=r/4*3;n>>=a%fn;const l=Math.floor(a/fn);for(let u=0;u<l;u++){const d=(l-u-1)*fn;s.setUint8(o+u,(n&255<<d)>>d)}}return new Uint8Array(t)},nr=i=>new TextEncoder().encode(i),pn=i=>typeof i=="string"?nr(i):ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(i),Yl=i=>{if(typeof i=="string")return i;if(typeof i!="object"||typeof i.byteOffset!="number"||typeof i.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(i)};function Xl(i){let e;typeof i=="string"?e=nr(i):e=i;const t=typeof e=="object"&&typeof e.length=="number",s=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!t&&!s)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let r="";for(let n=0;n<e.length;n+=3){let a=0,o=0;for(let u=n,d=Math.min(n+3,e.length);u<d;u++)a|=e[u]<<(d-u-1)*fn,o+=fn;const l=Math.ceil(o/Mr);a<<=l*Mr-o;for(let u=1;u<=l;u++){const d=(l-u)*Mr;r+=Vr[(a&fv<<d)>>d]}r+="==".slice(0,4-l)}return r}function pv(i,e="utf-8"){return e==="base64"?Xl(i):Yl(i)}function gv(i,e){return e==="base64"?tr.mutate(Za(i)):tr.mutate(nr(i))}class tr extends Uint8Array{static fromString(e,t="utf-8"){switch(typeof e){case"string":return gv(e,t);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,tr.prototype),e}transformToString(e="utf-8"){return pv(this,e)}}const Ni=i=>encodeURIComponent(i).replace(/[!'()*]/g,mv),mv=i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`;function vv(i){const e=[];for(let t of Object.keys(i).sort()){const s=i[t];if(t=Ni(t),Array.isArray(s))for(let r=0,n=s.length;r<n;r++)e.push(`${t}=${Ni(s[r])}`);else{let r=t;(s||typeof s=="string")&&(r+=`=${Ni(s)}`),e.push(r)}}return e.join("&")}function yv(i=0){return new Promise((e,t)=>{i&&setTimeout(()=>{const s=new Error(`Request did not complete within ${i} ms`);s.name="TimeoutError",t(s)},i)})}const Lo={supported:void 0};class eo{static create(e){return typeof(e==null?void 0:e.handle)=="function"?e:new eo(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(t=>t||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),Lo.supported===void 0&&(Lo.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:t}={}){this.config||(this.config=await this.configProvider);const s=this.config.requestTimeout,r=this.config.keepAlive===!0,n=this.config.credentials;if(t!=null&&t.aborted){const w=new Error("Request aborted");return w.name="AbortError",Promise.reject(w)}let a=e.path;const o=vv(e.query||{});o&&(a+=`?${o}`),e.fragment&&(a+=`#${e.fragment}`);let l="";if(e.username!=null||e.password!=null){const w=e.username??"",F=e.password??"";l=`${w}:${F}@`}const{port:u,method:d}=e,f=`${e.protocol}//${l}${e.hostname}${u?`:${u}`:""}${a}`,g=d==="GET"||d==="HEAD"?void 0:e.body,v={body:g,headers:new Headers(e.headers),method:d,credentials:n};g&&(v.duplex="half"),typeof AbortController<"u"&&(v.signal=t),Lo.supported&&(v.keepalive=r);let y=()=>{};const E=new Request(f,v),b=[fetch(E).then(w=>{const F=w.headers,k={};for(const N of F.entries())k[N[0]]=N[1];return w.body!=null?{response:new Ia({headers:k,reason:w.statusText,statusCode:w.status,body:w.body})}:w.blob().then(N=>({response:new Ia({headers:k,reason:w.statusText,statusCode:w.status,body:N})}))}),yv(s)];return t&&b.push(new Promise((w,F)=>{const k=()=>{const U=new Error("Request aborted");U.name="AbortError",F(U)};if(typeof t.addEventListener=="function"){const U=t;U.addEventListener("abort",k,{once:!0}),y=()=>U.removeEventListener("abort",k)}else t.onabort=k})),Promise.race(b).finally(y)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(s=>(s[e]=t,s))}httpHandlerConfigs(){return this.config??{}}}const Pf=i=>typeof Blob=="function"&&i instanceof Blob?xv(i):Sv(i);async function xv(i){const e=await Ev(i),t=Za(e);return new Uint8Array(t)}async function Sv(i){const e=[],t=i.getReader();let s=!1,r=0;for(;!s;){const{done:o,value:l}=await t.read();l&&(e.push(l),r+=l.length),s=o}const n=new Uint8Array(r);let a=0;for(const o of e)n.set(o,a),a+=o.length;return n}function Ev(i){return new Promise((e,t)=>{const s=new FileReader;s.onloadend=()=>{if(s.readyState!==2)return t(new Error("Reader aborted too early"));const r=s.result??"",n=r.indexOf(","),a=n>-1?n+1:r.length;e(r.substring(a))},s.onabort=()=>t(new Error("Read aborted")),s.onerror=()=>t(s.error),s.readAsDataURL(i)})}const Df={},xl={};for(let i=0;i<256;i++){let e=i.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Df[i]=e,xl[e]=i}function Mf(i){if(i.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const e=new Uint8Array(i.length/2);for(let t=0;t<i.length;t+=2){const s=i.slice(t,t+2).toLowerCase();if(s in xl)e[t/2]=xl[s];else throw new Error(`Cannot decode unrecognized sequence ${s} as hexadecimal`)}return e}function hs(i){let e="";for(let t=0;t<i.byteLength;t++)e+=Df[i[t]];return e}const bv=async(i=new Uint8Array,e)=>{if(i instanceof Uint8Array)return tr.mutate(i);if(!i)return tr.mutate(new Uint8Array);const t=e.streamCollector(i);return tr.mutate(await t)};class Ql{constructor(){this.middlewareStack=ka()}static classBuilder(){return new Tv}resolveMiddlewareWithContext(e,t,s,{middlewareFn:r,clientName:n,commandName:a,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,smithyContext:u,additionalContext:d,CommandCtor:f}){for(const b of r.bind(this)(f,e,t,s))this.middlewareStack.use(b);const g=e.concat(this.middlewareStack),{logger:v}=t,y={logger:v,clientName:n,commandName:a,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,[vl]:{commandInstance:this,...u},...d},{requestHandler:E}=t;return g.resolve(b=>E.handle(b.request,s||{}),y)}}class Tv{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,s={}){return this._smithyContext={service:e,operation:t,...s},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=s=>s,t=s=>s){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let t;return t=class extends Ql{static getEndpointParameterInstructions(){return e._ep}constructor(...[s]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=s??{},e._init(this)}resolveMiddleware(s,r,n){return this.resolveMiddlewareWithContext(s,r,n,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}class to extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,to.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const jt=(i,e={})=>{Object.entries(e).filter(([,s])=>s!==void 0).forEach(([s,r])=>{(i[s]==null||i[s]==="")&&(i[s]=r)});const t=i.message||i.Message||"UnknownError";return i.message=t,delete i.Message,i},wv=({output:i,parsedBody:e,exceptionCtor:t,errorCode:s})=>{const r=Av(i),n=r.httpStatusCode?r.httpStatusCode+"":void 0,a=new t({name:(e==null?void 0:e.code)||(e==null?void 0:e.Code)||s||n||"UnknownError",$fault:"client",$metadata:r});throw jt(a,e)},Ff=i=>({output:e,parsedBody:t,errorCode:s})=>{wv({output:e,parsedBody:t,exceptionCtor:i,errorCode:s})},Av=i=>({httpStatusCode:i.statusCode,requestId:i.headers["x-amzn-requestid"]??i.headers["x-amzn-request-id"]??i.headers["x-amz-request-id"],extendedRequestId:i.headers["x-amz-id-2"],cfId:i.headers["x-amz-cf-id"]}),Of=i=>{switch(i){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},Lv=i=>{const e=[];for(const t in _a){const s=_a[t];i[s]!==void 0&&e.push({algorithmId:()=>s,checksumConstructor:()=>i[s]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(t){this._checksumAlgorithms.push(t)},checksumAlgorithms(){return this._checksumAlgorithms}}},Cv=i=>{const e={};return i.checksumAlgorithms().forEach(t=>{e[t.algorithmId()]=t.checksumConstructor()}),e},Rv=i=>{let e=i.retryStrategy;return{setRetryStrategy(t){e=t},retryStrategy(){return e}}},_v=i=>{const e={};return e.retryStrategy=i.retryStrategy(),e},Nf=i=>({...Lv(i),...Rv(i)}),Bf=i=>({...Cv(i),..._v(i)}),Sl=function(){const i=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),t=new e;return Object.setPrototypeOf(t,i.prototype),t};Sl.prototype=Object.create(String.prototype,{constructor:{value:Sl,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(Sl,String);const $f=(i,e)=>{const t={};for(const s in e)Iv(t,i,e,s);return t},Iv=(i,e,t,s)=>{if(e!==null){let a=t[s];typeof a=="function"&&(a=[,a]);const[o=kv,l=Pv,u=s]=a;(typeof o=="function"&&o(e[u])||typeof o!="function"&&o)&&(i[s]=l(e[u]));return}let[r,n]=t[s];if(typeof n=="function"){let a;const o=r===void 0&&(a=n())!=null,l=typeof r=="function"&&!!r(void 0)||typeof r!="function"&&!!r;o?i[s]=a:l&&(i[s]=n())}else{const a=r===void 0&&n!=null,o=typeof r=="function"&&!!r(n)||typeof r!="function"&&!!r;(a||o)&&(i[s]=n)}},kv=i=>i!=null,Pv=i=>i,kt=i=>{if(i==null)return{};if(Array.isArray(i))return i.filter(e=>e!=null).map(kt);if(typeof i=="object"){const e={};for(const t of Object.keys(i))i[t]!=null&&(e[t]=kt(i[t]));return e}return i},Dv=i=>(i==null?void 0:i.body)instanceof ReadableStream,Mv=i=>(e,t)=>async s=>{var a;let r=await i.retryStrategy();const n=await i.maxAttempts();if(Fv(r)){r=r;let o=await r.acquireInitialRetryToken(t.partition_id),l=new Error,u=0,d=0;const{request:f}=s,g=ns.isInstance(f);for(g&&(f.headers[iv]=hv());;)try{g&&(f.headers[rv]=`attempt=${u+1}; max=${n}`);const{response:v,output:y}=await e(s);return r.recordSuccess(o),y.$metadata.attempts=u+1,y.$metadata.totalRetryDelay=d,{response:v,output:y}}catch(v){const y=Ov(v);if(l=dv(v),g&&Dv(f))throw(a=t.logger instanceof ql?console:t.logger)==null||a.warn("An error was encountered in a non-retryable streaming request."),l;try{o=await r.refreshRetryTokenForRetry(o,y)}catch{throw l.$metadata||(l.$metadata={}),l.$metadata.attempts=u+1,l.$metadata.totalRetryDelay=d,l}u=o.getRetryCount();const E=o.getRetryDelay();d+=E,await new Promise(b=>setTimeout(b,E))}}else return r=r,r!=null&&r.mode&&(t.userAgent=[...t.userAgent||[],["cfg/retry-mode",r.mode]]),r.retry(e,s)},Fv=i=>typeof i.acquireInitialRetryToken<"u"&&typeof i.refreshRetryTokenForRetry<"u"&&typeof i.recordSuccess<"u",Ov=i=>{const e={error:i,errorType:Nv(i)},t=Bv(i.$response);return t&&(e.retryAfterHint=t),e},Nv=i=>Lf(i)?"THROTTLING":Cf(i)?"TRANSIENT":Q0(i)?"SERVER_ERROR":"CLIENT_ERROR",Uf={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Gf=i=>({applyToStack:e=>{e.add(Mv(i),Uf)}}),Bv=i=>{if(!Ia.isInstance(i))return;const e=Object.keys(i.headers).find(n=>n.toLowerCase()==="retry-after");if(!e)return;const t=i.headers[e],s=Number(t);return Number.isNaN(s)?new Date(t):new Date(s*1e3)},$v={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:Uf.name},Vf=i=>({applyToStack:e=>{e.addRelativeTo(K0(),$v)}});class Hf{constructor(e){this.authSchemes=new Map;for(const[t,s]of Object.entries(e))s!==void 0&&this.authSchemes.set(t,s)}getIdentityProvider(e){return this.authSchemes.get(e)}}class Uv{async sign(e,t,s){return e}}const Gv=i=>e=>jf(e)&&e.expiration.getTime()-Date.now()<i,Vv=3e5,Hv=Gv(Vv),jf=i=>i.expiration!==void 0,jv=(i,e,t)=>{if(i===void 0)return;const s=typeof i!="function"?async()=>Promise.resolve(i):i;let r,n,a,o=!1;const l=async u=>{n||(n=s(u));try{r=await n,a=!0,o=!1}finally{n=void 0}return r};return e===void 0?async u=>((!a||u!=null&&u.forceRefresh)&&(r=await l(u)),r):async u=>((!a||u!=null&&u.forceRefresh)&&(r=await l(u)),o?r:t(r)?(e(r)&&await l(u),r):(o=!0,r))},Yn=i=>{if(typeof i=="function")return i;const e=Promise.resolve(i);return()=>e},Kv=i=>({...i,eventStreamMarshaller:i.eventStreamSerdeProvider(i)}),Pu="content-length";function zv(i){return e=>async t=>{const s=t.request;if(ns.isInstance(s)){const{body:r,headers:n}=s;if(r&&Object.keys(n).map(a=>a.toLowerCase()).indexOf(Pu)===-1)try{const a=i(r);s.headers={...s.headers,[Pu]:String(a)}}catch{}}return e({...t,request:s})}}const Wv={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Kf=i=>({applyToStack:e=>{e.add(zv(i.bodyLengthChecker),Wv)}}),Du=i=>{var e,t;return Ia.isInstance(i)?((e=i.headers)==null?void 0:e.date)??((t=i.headers)==null?void 0:t.Date):void 0},zf=i=>new Date(Date.now()+i),qv=(i,e)=>Math.abs(zf(e).getTime()-i)>=3e5,Mu=(i,e)=>{const t=Date.parse(i);return qv(t,e)?t-Date.now():e},gn=(i,e)=>{if(!e)throw new Error(`Property \`${i}\` is not resolved for AWS SDK SigV4Auth`);return e},Yv=async i=>{var u,d,f;const e=gn("context",i.context),t=gn("config",i.config),s=(f=(d=(u=e.endpointV2)==null?void 0:u.properties)==null?void 0:d.authSchemes)==null?void 0:f[0],n=await gn("signer",t.signer)(s),a=i==null?void 0:i.signingRegion,o=i==null?void 0:i.signingRegionSet,l=i==null?void 0:i.signingName;return{config:t,signer:n,signingRegion:a,signingRegionSet:o,signingName:l}};class Wf{async sign(e,t,s){var f;if(!ns.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const r=await Yv(s),{config:n,signer:a}=r;let{signingRegion:o,signingName:l}=r;const u=s.context;if(((f=u==null?void 0:u.authSchemes)==null?void 0:f.length)??!1){const[g,v]=u.authSchemes;(g==null?void 0:g.name)==="sigv4a"&&(v==null?void 0:v.name)==="sigv4"&&(o=(v==null?void 0:v.signingRegion)??o,l=(v==null?void 0:v.signingName)??l)}return await a.sign(e,{signingDate:zf(n.systemClockOffset),signingRegion:o,signingService:l})}errorHandler(e){return t=>{const s=t.ServerTime??Du(t.$response);if(s){const r=gn("config",e.config),n=r.systemClockOffset;r.systemClockOffset=Mu(s,r.systemClockOffset),r.systemClockOffset!==n&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const s=Du(e);if(s){const r=gn("config",t.config);r.systemClockOffset=Mu(s,r.systemClockOffset)}}}class Jl extends Error{constructor(e,t=!0){var n;let s,r=!0;typeof t=="boolean"?(s=void 0,r=t):t!=null&&typeof t=="object"&&(s=t.logger,r=t.tryNextLink??!0),super(e),this.name="ProviderError",this.tryNextLink=r,Object.setPrototypeOf(this,Jl.prototype),(n=s==null?void 0:s.debug)==null||n.call(s,`@smithy/property-provider ${r?"->":"(!)"} ${e}`)}static from(e,t=!0){return Object.assign(new this(e.message,t),e)}}class Hr extends Jl{constructor(e,t=!0){super(e,t),this.name="CredentialsProviderError",Object.setPrototypeOf(this,Hr.prototype)}}const Xv=(i,e,t)=>{let s,r,n,a=!1;const o=async()=>{r||(r=i());try{s=await r,n=!0,a=!1}finally{r=void 0}return s};return async l=>((!n||l!=null&&l.forceRefresh)&&(s=await o()),s)},Qv="X-Amz-Algorithm",Jv="X-Amz-Credential",qf="X-Amz-Date",Zv="X-Amz-SignedHeaders",ey="X-Amz-Expires",Yf="X-Amz-Signature",Xf="X-Amz-Security-Token",Qf="authorization",Jf=qf.toLowerCase(),ty="date",sy=[Qf,Jf,ty],iy=Yf.toLowerCase(),El="x-amz-content-sha256",ry=Xf.toLowerCase(),ny={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},ay=/^proxy-/,oy=/^sec-/,Co="AWS4-HMAC-SHA256",ly="AWS4-HMAC-SHA256-PAYLOAD",cy="UNSIGNED-PAYLOAD",uy=50,Zf="aws4_request",hy=60*60*24*7,Xn={},Ro=[],_o=(i,e,t)=>`${i}/${e}/${t}/${Zf}`,dy=async(i,e,t,s,r)=>{const n=await Fu(i,e.secretAccessKey,e.accessKeyId),a=`${t}:${s}:${r}:${hs(n)}:${e.sessionToken}`;if(a in Xn)return Xn[a];for(Ro.push(a);Ro.length>uy;)delete Xn[Ro.shift()];let o=`AWS4${e.secretAccessKey}`;for(const l of[t,s,r,Zf])o=await Fu(i,o,l);return Xn[a]=o},Fu=(i,e,t)=>{const s=new i(e);return s.update(pn(t)),s.digest()},Ou=({headers:i},e,t)=>{const s={};for(const r of Object.keys(i).sort()){if(i[r]==null)continue;const n=r.toLowerCase();(n in ny||e!=null&&e.has(n)||ay.test(n)||oy.test(n))&&(!t||t&&!t.has(n))||(s[n]=i[r].trim().replace(/\s+/g," "))}return s},fy=({query:i={}})=>{const e=[],t={};for(const s of Object.keys(i).sort()){if(s.toLowerCase()===iy)continue;e.push(s);const r=i[s];typeof r=="string"?t[s]=`${Ni(s)}=${Ni(r)}`:Array.isArray(r)&&(t[s]=r.slice(0).reduce((n,a)=>n.concat([`${Ni(s)}=${Ni(a)}`]),[]).sort().join("&"))}return e.map(s=>t[s]).filter(s=>s).join("&")},py=i=>typeof ArrayBuffer=="function"&&i instanceof ArrayBuffer||Object.prototype.toString.call(i)==="[object ArrayBuffer]",Io=async({headers:i,body:e},t)=>{for(const s of Object.keys(i))if(s.toLowerCase()===El)return i[s];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||py(e)){const s=new t;return s.update(pn(e)),hs(await s.digest())}return cy};class gy{format(e){const t=[];for(const n of Object.keys(e)){const a=nr(n);t.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[n]))}const s=new Uint8Array(t.reduce((n,a)=>n+a.byteLength,0));let r=0;for(const n of t)s.set(n,r),r+=n.byteLength;return s}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const s=new DataView(new ArrayBuffer(5));return s.setUint8(0,4),s.setInt32(1,e.value,!1),new Uint8Array(s.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const a=new Uint8Array(n.buffer);return a.set(e.value,3),a;case"string":const o=nr(e.value),l=new DataView(new ArrayBuffer(3+o.byteLength));l.setUint8(0,7),l.setUint16(1,o.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(o,3),u;case"timestamp":const d=new Uint8Array(9);return d[0]=8,d.set(vy.fromNumber(e.value.valueOf()).bytes,1),d;case"uuid":if(!my.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const f=new Uint8Array(17);return f[0]=9,f.set(Mf(e.value.replace(/\-/g,"")),1),f}}}var Nu;(function(i){i[i.boolTrue=0]="boolTrue",i[i.boolFalse=1]="boolFalse",i[i.byte=2]="byte",i[i.short=3]="short",i[i.integer=4]="integer",i[i.long=5]="long",i[i.byteArray=6]="byteArray",i[i.string=7]="string",i[i.timestamp=8]="timestamp",i[i.uuid=9]="uuid"})(Nu||(Nu={}));const my=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let vy=class ep{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let s=7,r=Math.abs(Math.round(e));s>-1&&r>0;s--,r/=256)t[s]=r;return e<0&&Bu(t),new ep(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&Bu(e),parseInt(hs(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function Bu(i){for(let e=0;e<8;e++)i[e]^=255;for(let e=7;e>-1&&(i[e]++,i[e]===0);e--);}const yy=(i,e)=>{i=i.toLowerCase();for(const t of Object.keys(e))if(i===t.toLowerCase())return!0;return!1},xy=(i,e={})=>{var r;const{headers:t,query:s={}}=ns.clone(i);for(const n of Object.keys(t)){const a=n.toLowerCase();a.slice(0,6)==="x-amz-"&&!((r=e.unhoistableHeaders)!=null&&r.has(a))&&(s[n]=t[n],delete t[n])}return{...i,headers:t,query:s}},$u=i=>{i=ns.clone(i);for(const e of Object.keys(i.headers))sy.indexOf(e.toLowerCase())>-1&&delete i.headers[e];return i},Sy=i=>Ey(i).toISOString().replace(/\.\d{3}Z$/,"Z"),Ey=i=>typeof i=="number"?new Date(i*1e3):typeof i=="string"?Number(i)?new Date(Number(i)*1e3):new Date(i):i;class Uu{constructor({applyChecksum:e,credentials:t,region:s,service:r,sha256:n,uriEscapePath:a=!0}){this.headerFormatter=new gy,this.service=r,this.sha256=n,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=yi(s),this.credentialProvider=yi(t)}async presign(e,t={}){const{signingDate:s=new Date,expiresIn:r=3600,unsignableHeaders:n,unhoistableHeaders:a,signableHeaders:o,signingRegion:l,signingService:u}=t,d=await this.credentialProvider();this.validateResolvedCredentials(d);const f=l??await this.regionProvider(),{longDate:g,shortDate:v}=Qn(s);if(r>hy)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const y=_o(v,f,u??this.service),E=xy($u(e),{unhoistableHeaders:a});d.sessionToken&&(E.query[Xf]=d.sessionToken),E.query[Qv]=Co,E.query[Jv]=`${d.accessKeyId}/${y}`,E.query[qf]=g,E.query[ey]=r.toString(10);const b=Ou(E,n,o);return E.query[Zv]=Gu(b),E.query[Yf]=await this.getSignature(g,y,this.getSigningKey(d,f,v,u),this.createCanonicalRequest(E,b,await Io(e,this.sha256))),E}async sign(e,t){return typeof e=="string"?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:s=new Date,priorSignature:r,signingRegion:n,signingService:a}){const o=n??await this.regionProvider(),{shortDate:l,longDate:u}=Qn(s),d=_o(l,o,a??this.service),f=await Io({headers:{},body:t},this.sha256),g=new this.sha256;g.update(e);const v=hs(await g.digest()),y=[ly,u,d,r,v,f].join(`
|
|
29
|
+
`+a,typeof n.$responseBodyText<"u"&&n.$response&&(n.$response.body=n.$responseBodyText)}throw n}},U0=(i,e)=>(t,s)=>async r=>{var o;const n=(o=s.endpointV2)!=null&&o.url&&i.urlParser?async()=>i.urlParser(s.endpointV2.url):i.endpoint;if(!n)throw new Error("No valid endpoint provider available.");const a=await e(r.input,{...i,endpoint:n});return t({...r,request:a})},G0={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Wl={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Sf(i,e,t){return{applyToStack:s=>{s.add($0(i,t),G0),s.add(U0(i,e),Wl)}}}const Ef={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Wl.name},bf=(i,e)=>({applyToStack:t=>{t.addRelativeTo(B0({config:i,instructions:e}),Ef)}}),Tf=i=>{const e=i.tls??!0,{endpoint:t}=i,s=t!=null?async()=>xf(await yi(t)()):void 0;return{...i,endpoint:s,tls:e,isCustomEndpoint:!!t,useDualstackEndpoint:yi(i.useDualstackEndpoint??!1),useFipsEndpoint:yi(i.useFipsEndpoint??!1)}},V0={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Ef.name},wf=(i,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t})=>({applyToStack:s=>{s.addRelativeTo(L0(i,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t}),V0)}});Wl.name;const H0=i=>e=>{throw e},j0=(i,e)=>{},K0=i=>(e,t)=>async s=>{if(!ns.isInstance(s.request))return e(s);const n=Dn(t).selectedHttpAuthScheme;if(!n)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:a={}},identity:o,signer:l}=n,u=await e({...s,request:await l.sign(s.request,o,a)}).catch((l.errorHandler||H0)(a));return(l.successHandler||j0)(u.response,a),u};var Nr;(function(i){i.STANDARD="standard",i.ADAPTIVE="adaptive"})(Nr||(Nr={}));const An=3,Af=Nr.STANDARD,z0=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],W0=["TimeoutError","RequestTimeout","RequestTimeoutException"],q0=[500,502,503,504],Y0=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],X0=i=>{var e;return(e=i.$metadata)==null?void 0:e.clockSkewCorrected},Lf=i=>{var e,t;return((e=i.$metadata)==null?void 0:e.httpStatusCode)===429||z0.includes(i.name)||((t=i.$retryable)==null?void 0:t.throttling)==!0},Cf=i=>{var e;return X0(i)||W0.includes(i.name)||Y0.includes((i==null?void 0:i.code)||"")||q0.includes(((e=i.$metadata)==null?void 0:e.httpStatusCode)||0)},Q0=i=>{var e;if(((e=i.$metadata)==null?void 0:e.httpStatusCode)!==void 0){const t=i.$metadata.httpStatusCode;return 500<=t&&t<=599&&!Cf(i)}return!1};class J0{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=(e==null?void 0:e.beta)??.7,this.minCapacity=(e==null?void 0:e.minCapacity)??1,this.minFillRate=(e==null?void 0:e.minFillRate)??.5,this.scaleConstant=(e==null?void 0:e.scaleConstant)??.4,this.smooth=(e==null?void 0:e.smooth)??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(s=>setTimeout(s,t))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),Lf(e)){const r=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=r,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(r),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const s=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(s)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){const s=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(s*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const yl=100,Rf=20*1e3,Z0=500,Cu=500,ev=5,tv=10,sv=1,iv="amz-sdk-invocation-id",rv="amz-sdk-request",nv=()=>{let i=yl;return{computeNextBackoffDelay:s=>Math.floor(Math.min(Rf,Math.random()*2**s*i)),setDelayBase:s=>{i=s}}},Ru=({retryDelay:i,retryCount:e,retryCost:t})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(Rf,i),getRetryCost:()=>t});class _f{constructor(e){this.maxAttempts=e,this.mode=Nr.STANDARD,this.capacity=Cu,this.retryBackoffStrategy=nv(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return Ru({retryDelay:yl,retryCount:0})}async refreshRetryTokenForRetry(e,t){const s=await this.getMaxAttempts();if(this.shouldRetry(e,t,s)){const r=t.errorType;this.retryBackoffStrategy.setDelayBase(r==="THROTTLING"?Z0:yl);const n=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),a=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,n):n,o=this.getCapacityCost(r);return this.capacity-=o,Ru({retryDelay:a,retryCount:e.getRetryCount()+1,retryCost:o})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(Cu,this.capacity+(e.getRetryCost()??sv))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${An}`),An}}shouldRetry(e,t,s){return e.getRetryCount()+1<s&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return e==="TRANSIENT"?tv:ev}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class av{constructor(e,t){this.maxAttemptsProvider=e,this.mode=Nr.ADAPTIVE;const{rateLimiter:s}=t??{};this.rateLimiter=s??new J0,this.standardRetryStrategy=new _f(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}let qn;const ov=new Uint8Array(16);function lv(){if(!qn&&(qn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!qn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qn(ov)}const Gt=[];for(let i=0;i<256;++i)Gt.push((i+256).toString(16).slice(1));function cv(i,e=0){return Gt[i[e+0]]+Gt[i[e+1]]+Gt[i[e+2]]+Gt[i[e+3]]+"-"+Gt[i[e+4]]+Gt[i[e+5]]+"-"+Gt[i[e+6]]+Gt[i[e+7]]+"-"+Gt[i[e+8]]+Gt[i[e+9]]+"-"+Gt[i[e+10]]+Gt[i[e+11]]+Gt[i[e+12]]+Gt[i[e+13]]+Gt[i[e+14]]+Gt[i[e+15]]}const uv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_u={randomUUID:uv};function hv(i,e,t){if(_u.randomUUID&&!e&&!i)return _u.randomUUID();i=i||{};const s=i.random||(i.rng||lv)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,cv(s)}const dv=i=>i instanceof Error?i:i instanceof Object?Object.assign(new Error,i):typeof i=="string"?new Error(i):new Error(`AWS SDK error wrapper for ${i}`),If=i=>{const{retryStrategy:e}=i,t=yi(i.maxAttempts??An);return{...i,maxAttempts:t,retryStrategy:async()=>e||(await yi(i.retryMode)()===Nr.ADAPTIVE?new av(t):new _f(t))}};class ql{trace(){}debug(){}info(){}warn(){}error(){}}const qi=(i,e)=>{const t=[];if(i&&t.push(i),e)for(const s of e)t.push(s);return t},Pi=(i,e)=>`${i||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,ka=()=>{let i=[],e=[],t=!1;const s=new Set,r=f=>f.sort((g,v)=>Iu[v.step]-Iu[g.step]||ku[v.priority||"normal"]-ku[g.priority||"normal"]),n=f=>{let g=!1;const v=y=>{const E=qi(y.name,y.aliases);if(E.includes(f)){g=!0;for(const b of E)s.delete(b);return!1}return!0};return i=i.filter(v),e=e.filter(v),g},a=f=>{let g=!1;const v=y=>{if(y.middleware===f){g=!0;for(const E of qi(y.name,y.aliases))s.delete(E);return!1}return!0};return i=i.filter(v),e=e.filter(v),g},o=f=>{var g;return i.forEach(v=>{f.add(v.middleware,{...v})}),e.forEach(v=>{f.addRelativeTo(v.middleware,{...v})}),(g=f.identifyOnResolve)==null||g.call(f,d.identifyOnResolve()),f},l=f=>{const g=[];return f.before.forEach(v=>{v.before.length===0&&v.after.length===0?g.push(v):g.push(...l(v))}),g.push(f),f.after.reverse().forEach(v=>{v.before.length===0&&v.after.length===0?g.push(v):g.push(...l(v))}),g},u=(f=!1)=>{const g=[],v=[],y={};return i.forEach(b=>{const w={...b,before:[],after:[]};for(const F of qi(w.name,w.aliases))y[F]=w;g.push(w)}),e.forEach(b=>{const w={...b,before:[],after:[]};for(const F of qi(w.name,w.aliases))y[F]=w;v.push(w)}),v.forEach(b=>{if(b.toMiddleware){const w=y[b.toMiddleware];if(w===void 0){if(f)return;throw new Error(`${b.toMiddleware} is not found when adding ${Pi(b.name,b.aliases)} middleware ${b.relation} ${b.toMiddleware}`)}b.relation==="after"&&w.after.push(b),b.relation==="before"&&w.before.push(b)}}),r(g).map(l).reduce((b,w)=>(b.push(...w),b),[])},d={add:(f,g={})=>{const{name:v,override:y,aliases:E}=g,b={step:"initialize",priority:"normal",middleware:f,...g},w=qi(v,E);if(w.length>0){if(w.some(F=>s.has(F))){if(!y)throw new Error(`Duplicate middleware name '${Pi(v,E)}'`);for(const F of w){const k=i.findIndex(N=>{var te;return N.name===F||((te=N.aliases)==null?void 0:te.some(j=>j===F))});if(k===-1)continue;const U=i[k];if(U.step!==b.step||b.priority!==U.priority)throw new Error(`"${Pi(U.name,U.aliases)}" middleware with ${U.priority} priority in ${U.step} step cannot be overridden by "${Pi(v,E)}" middleware with ${b.priority} priority in ${b.step} step.`);i.splice(k,1)}}for(const F of w)s.add(F)}i.push(b)},addRelativeTo:(f,g)=>{const{name:v,override:y,aliases:E}=g,b={middleware:f,...g},w=qi(v,E);if(w.length>0){if(w.some(F=>s.has(F))){if(!y)throw new Error(`Duplicate middleware name '${Pi(v,E)}'`);for(const F of w){const k=e.findIndex(N=>{var te;return N.name===F||((te=N.aliases)==null?void 0:te.some(j=>j===F))});if(k===-1)continue;const U=e[k];if(U.toMiddleware!==b.toMiddleware||U.relation!==b.relation)throw new Error(`"${Pi(U.name,U.aliases)}" middleware ${U.relation} "${U.toMiddleware}" middleware cannot be overridden by "${Pi(v,E)}" middleware ${b.relation} "${b.toMiddleware}" middleware.`);e.splice(k,1)}}for(const F of w)s.add(F)}e.push(b)},clone:()=>o(ka()),use:f=>{f.applyToStack(d)},remove:f=>typeof f=="string"?n(f):a(f),removeByTag:f=>{let g=!1;const v=y=>{const{tags:E,name:b,aliases:w}=y;if(E&&E.includes(f)){const F=qi(b,w);for(const k of F)s.delete(k);return g=!0,!1}return!0};return i=i.filter(v),e=e.filter(v),g},concat:f=>{var v;const g=o(ka());return g.use(f),g.identifyOnResolve(t||g.identifyOnResolve()||(((v=f.identifyOnResolve)==null?void 0:v.call(f))??!1)),g},applyToStack:o,identify:()=>u(!0).map(f=>{const g=f.step??f.relation+" "+f.toMiddleware;return Pi(f.name,f.aliases)+" - "+g}),identifyOnResolve(f){return typeof f=="boolean"&&(t=f),t},resolve:(f,g)=>{for(const v of u().map(y=>y.middleware).reverse())f=v(f,g);return t&&console.log(d.identify()),f}};return d},Iu={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},ku={high:3,normal:2,low:1};class kf{constructor(e){this.middlewareStack=ka(),this.config=e}send(e,t,s){const r=typeof t!="function"?t:void 0,n=typeof t=="function"?t:s,a=e.resolveMiddleware(this.middlewareStack,this.config,r);if(n)a(e).then(o=>n(null,o.output),o=>n(o)).catch(()=>{});else return a(e).then(o=>o.output)}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}const Ui={},Vr=new Array(64);for(let i=0,e=65,t=90;i+e<=t;i++){const s=String.fromCharCode(i+e);Ui[s]=i,Vr[i]=s}for(let i=0,e=97,t=122;i+e<=t;i++){const s=String.fromCharCode(i+e),r=i+26;Ui[s]=r,Vr[r]=s}for(let i=0;i<10;i++){Ui[i.toString(10)]=i+52;const e=i.toString(10),t=i+52;Ui[e]=t,Vr[t]=e}Ui["+"]=62;Vr[62]="+";Ui["/"]=63;Vr[63]="/";const Mr=6,fn=8,fv=63,Za=i=>{let e=i.length/4*3;i.slice(-2)==="=="?e-=2:i.slice(-1)==="="&&e--;const t=new ArrayBuffer(e),s=new DataView(t);for(let r=0;r<i.length;r+=4){let n=0,a=0;for(let u=r,d=r+3;u<=d;u++)if(i[u]!=="="){if(!(i[u]in Ui))throw new TypeError(`Invalid character ${i[u]} in base64 string.`);n|=Ui[i[u]]<<(d-u)*Mr,a+=Mr}else n>>=Mr;const o=r/4*3;n>>=a%fn;const l=Math.floor(a/fn);for(let u=0;u<l;u++){const d=(l-u-1)*fn;s.setUint8(o+u,(n&255<<d)>>d)}}return new Uint8Array(t)},nr=i=>new TextEncoder().encode(i),pn=i=>typeof i=="string"?nr(i):ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(i),Yl=i=>{if(typeof i=="string")return i;if(typeof i!="object"||typeof i.byteOffset!="number"||typeof i.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(i)};function Xl(i){let e;typeof i=="string"?e=nr(i):e=i;const t=typeof e=="object"&&typeof e.length=="number",s=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!t&&!s)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let r="";for(let n=0;n<e.length;n+=3){let a=0,o=0;for(let u=n,d=Math.min(n+3,e.length);u<d;u++)a|=e[u]<<(d-u-1)*fn,o+=fn;const l=Math.ceil(o/Mr);a<<=l*Mr-o;for(let u=1;u<=l;u++){const d=(l-u)*Mr;r+=Vr[(a&fv<<d)>>d]}r+="==".slice(0,4-l)}return r}function pv(i,e="utf-8"){return e==="base64"?Xl(i):Yl(i)}function gv(i,e){return e==="base64"?tr.mutate(Za(i)):tr.mutate(nr(i))}class tr extends Uint8Array{static fromString(e,t="utf-8"){switch(typeof e){case"string":return gv(e,t);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,tr.prototype),e}transformToString(e="utf-8"){return pv(this,e)}}const Ni=i=>encodeURIComponent(i).replace(/[!'()*]/g,mv),mv=i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`;function vv(i){const e=[];for(let t of Object.keys(i).sort()){const s=i[t];if(t=Ni(t),Array.isArray(s))for(let r=0,n=s.length;r<n;r++)e.push(`${t}=${Ni(s[r])}`);else{let r=t;(s||typeof s=="string")&&(r+=`=${Ni(s)}`),e.push(r)}}return e.join("&")}function yv(i=0){return new Promise((e,t)=>{i&&setTimeout(()=>{const s=new Error(`Request did not complete within ${i} ms`);s.name="TimeoutError",t(s)},i)})}const Lo={supported:void 0};class eo{static create(e){return typeof(e==null?void 0:e.handle)=="function"?e:new eo(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(t=>t||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),Lo.supported===void 0&&(Lo.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:t}={}){this.config||(this.config=await this.configProvider);const s=this.config.requestTimeout,r=this.config.keepAlive===!0,n=this.config.credentials;if(t!=null&&t.aborted){const w=new Error("Request aborted");return w.name="AbortError",Promise.reject(w)}let a=e.path;const o=vv(e.query||{});o&&(a+=`?${o}`),e.fragment&&(a+=`#${e.fragment}`);let l="";if(e.username!=null||e.password!=null){const w=e.username??"",F=e.password??"";l=`${w}:${F}@`}const{port:u,method:d}=e,f=`${e.protocol}//${l}${e.hostname}${u?`:${u}`:""}${a}`,g=d==="GET"||d==="HEAD"?void 0:e.body,v={body:g,headers:new Headers(e.headers),method:d,credentials:n};g&&(v.duplex="half"),typeof AbortController<"u"&&(v.signal=t),Lo.supported&&(v.keepalive=r);let y=()=>{};const E=new Request(f,v),b=[fetch(E).then(w=>{const F=w.headers,k={};for(const N of F.entries())k[N[0]]=N[1];return w.body!=null?{response:new Ia({headers:k,reason:w.statusText,statusCode:w.status,body:w.body})}:w.blob().then(N=>({response:new Ia({headers:k,reason:w.statusText,statusCode:w.status,body:N})}))}),yv(s)];return t&&b.push(new Promise((w,F)=>{const k=()=>{const U=new Error("Request aborted");U.name="AbortError",F(U)};if(typeof t.addEventListener=="function"){const U=t;U.addEventListener("abort",k,{once:!0}),y=()=>U.removeEventListener("abort",k)}else t.onabort=k})),Promise.race(b).finally(y)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(s=>(s[e]=t,s))}httpHandlerConfigs(){return this.config??{}}}const Pf=i=>typeof Blob=="function"&&i instanceof Blob?xv(i):Sv(i);async function xv(i){const e=await Ev(i),t=Za(e);return new Uint8Array(t)}async function Sv(i){const e=[],t=i.getReader();let s=!1,r=0;for(;!s;){const{done:o,value:l}=await t.read();l&&(e.push(l),r+=l.length),s=o}const n=new Uint8Array(r);let a=0;for(const o of e)n.set(o,a),a+=o.length;return n}function Ev(i){return new Promise((e,t)=>{const s=new FileReader;s.onloadend=()=>{if(s.readyState!==2)return t(new Error("Reader aborted too early"));const r=s.result??"",n=r.indexOf(","),a=n>-1?n+1:r.length;e(r.substring(a))},s.onabort=()=>t(new Error("Read aborted")),s.onerror=()=>t(s.error),s.readAsDataURL(i)})}const Df={},xl={};for(let i=0;i<256;i++){let e=i.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Df[i]=e,xl[e]=i}function Mf(i){if(i.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const e=new Uint8Array(i.length/2);for(let t=0;t<i.length;t+=2){const s=i.slice(t,t+2).toLowerCase();if(s in xl)e[t/2]=xl[s];else throw new Error(`Cannot decode unrecognized sequence ${s} as hexadecimal`)}return e}function hs(i){let e="";for(let t=0;t<i.byteLength;t++)e+=Df[i[t]];return e}const bv=async(i=new Uint8Array,e)=>{if(i instanceof Uint8Array)return tr.mutate(i);if(!i)return tr.mutate(new Uint8Array);const t=e.streamCollector(i);return tr.mutate(await t)};class Ql{constructor(){this.middlewareStack=ka()}static classBuilder(){return new Tv}resolveMiddlewareWithContext(e,t,s,{middlewareFn:r,clientName:n,commandName:a,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,smithyContext:u,additionalContext:d,CommandCtor:f}){for(const b of r.bind(this)(f,e,t,s))this.middlewareStack.use(b);const g=e.concat(this.middlewareStack),{logger:v}=t,y={logger:v,clientName:n,commandName:a,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,[vl]:{commandInstance:this,...u},...d},{requestHandler:E}=t;return g.resolve(b=>E.handle(b.request,s||{}),y)}}class Tv{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,s={}){return this._smithyContext={service:e,operation:t,...s},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=s=>s,t=s=>s){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let t;return t=class extends Ql{static getEndpointParameterInstructions(){return e._ep}constructor(...[s]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=s??{},e._init(this)}resolveMiddleware(s,r,n){return this.resolveMiddlewareWithContext(s,r,n,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}class to extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,to.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const jt=(i,e={})=>{Object.entries(e).filter(([,s])=>s!==void 0).forEach(([s,r])=>{(i[s]==null||i[s]==="")&&(i[s]=r)});const t=i.message||i.Message||"UnknownError";return i.message=t,delete i.Message,i},wv=({output:i,parsedBody:e,exceptionCtor:t,errorCode:s})=>{const r=Av(i),n=r.httpStatusCode?r.httpStatusCode+"":void 0,a=new t({name:(e==null?void 0:e.code)||(e==null?void 0:e.Code)||s||n||"UnknownError",$fault:"client",$metadata:r});throw jt(a,e)},Ff=i=>({output:e,parsedBody:t,errorCode:s})=>{wv({output:e,parsedBody:t,exceptionCtor:i,errorCode:s})},Av=i=>({httpStatusCode:i.statusCode,requestId:i.headers["x-amzn-requestid"]??i.headers["x-amzn-request-id"]??i.headers["x-amz-request-id"],extendedRequestId:i.headers["x-amz-id-2"],cfId:i.headers["x-amz-cf-id"]}),Of=i=>{switch(i){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},Lv=i=>{const e=[];for(const t in _a){const s=_a[t];i[s]!==void 0&&e.push({algorithmId:()=>s,checksumConstructor:()=>i[s]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(t){this._checksumAlgorithms.push(t)},checksumAlgorithms(){return this._checksumAlgorithms}}},Cv=i=>{const e={};return i.checksumAlgorithms().forEach(t=>{e[t.algorithmId()]=t.checksumConstructor()}),e},Rv=i=>{let e=i.retryStrategy;return{setRetryStrategy(t){e=t},retryStrategy(){return e}}},_v=i=>{const e={};return e.retryStrategy=i.retryStrategy(),e},Nf=i=>({...Lv(i),...Rv(i)}),Bf=i=>({...Cv(i),..._v(i)}),Sl=function(){const i=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),t=new e;return Object.setPrototypeOf(t,i.prototype),t};Sl.prototype=Object.create(String.prototype,{constructor:{value:Sl,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(Sl,String);const $f=(i,e)=>{const t={};for(const s in e)Iv(t,i,e,s);return t},Iv=(i,e,t,s)=>{if(e!==null){let a=t[s];typeof a=="function"&&(a=[,a]);const[o=kv,l=Pv,u=s]=a;(typeof o=="function"&&o(e[u])||typeof o!="function"&&o)&&(i[s]=l(e[u]));return}let[r,n]=t[s];if(typeof n=="function"){let a;const o=r===void 0&&(a=n())!=null,l=typeof r=="function"&&!!r(void 0)||typeof r!="function"&&!!r;o?i[s]=a:l&&(i[s]=n())}else{const a=r===void 0&&n!=null,o=typeof r=="function"&&!!r(n)||typeof r!="function"&&!!r;(a||o)&&(i[s]=n)}},kv=i=>i!=null,Pv=i=>i,Pt=i=>{if(i==null)return{};if(Array.isArray(i))return i.filter(e=>e!=null).map(Pt);if(typeof i=="object"){const e={};for(const t of Object.keys(i))i[t]!=null&&(e[t]=Pt(i[t]));return e}return i},Dv=i=>(i==null?void 0:i.body)instanceof ReadableStream,Mv=i=>(e,t)=>async s=>{var a;let r=await i.retryStrategy();const n=await i.maxAttempts();if(Fv(r)){r=r;let o=await r.acquireInitialRetryToken(t.partition_id),l=new Error,u=0,d=0;const{request:f}=s,g=ns.isInstance(f);for(g&&(f.headers[iv]=hv());;)try{g&&(f.headers[rv]=`attempt=${u+1}; max=${n}`);const{response:v,output:y}=await e(s);return r.recordSuccess(o),y.$metadata.attempts=u+1,y.$metadata.totalRetryDelay=d,{response:v,output:y}}catch(v){const y=Ov(v);if(l=dv(v),g&&Dv(f))throw(a=t.logger instanceof ql?console:t.logger)==null||a.warn("An error was encountered in a non-retryable streaming request."),l;try{o=await r.refreshRetryTokenForRetry(o,y)}catch{throw l.$metadata||(l.$metadata={}),l.$metadata.attempts=u+1,l.$metadata.totalRetryDelay=d,l}u=o.getRetryCount();const E=o.getRetryDelay();d+=E,await new Promise(b=>setTimeout(b,E))}}else return r=r,r!=null&&r.mode&&(t.userAgent=[...t.userAgent||[],["cfg/retry-mode",r.mode]]),r.retry(e,s)},Fv=i=>typeof i.acquireInitialRetryToken<"u"&&typeof i.refreshRetryTokenForRetry<"u"&&typeof i.recordSuccess<"u",Ov=i=>{const e={error:i,errorType:Nv(i)},t=Bv(i.$response);return t&&(e.retryAfterHint=t),e},Nv=i=>Lf(i)?"THROTTLING":Cf(i)?"TRANSIENT":Q0(i)?"SERVER_ERROR":"CLIENT_ERROR",Uf={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Gf=i=>({applyToStack:e=>{e.add(Mv(i),Uf)}}),Bv=i=>{if(!Ia.isInstance(i))return;const e=Object.keys(i.headers).find(n=>n.toLowerCase()==="retry-after");if(!e)return;const t=i.headers[e],s=Number(t);return Number.isNaN(s)?new Date(t):new Date(s*1e3)},$v={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:Uf.name},Vf=i=>({applyToStack:e=>{e.addRelativeTo(K0(),$v)}});class Hf{constructor(e){this.authSchemes=new Map;for(const[t,s]of Object.entries(e))s!==void 0&&this.authSchemes.set(t,s)}getIdentityProvider(e){return this.authSchemes.get(e)}}class Uv{async sign(e,t,s){return e}}const Gv=i=>e=>jf(e)&&e.expiration.getTime()-Date.now()<i,Vv=3e5,Hv=Gv(Vv),jf=i=>i.expiration!==void 0,jv=(i,e,t)=>{if(i===void 0)return;const s=typeof i!="function"?async()=>Promise.resolve(i):i;let r,n,a,o=!1;const l=async u=>{n||(n=s(u));try{r=await n,a=!0,o=!1}finally{n=void 0}return r};return e===void 0?async u=>((!a||u!=null&&u.forceRefresh)&&(r=await l(u)),r):async u=>((!a||u!=null&&u.forceRefresh)&&(r=await l(u)),o?r:t(r)?(e(r)&&await l(u),r):(o=!0,r))},Yn=i=>{if(typeof i=="function")return i;const e=Promise.resolve(i);return()=>e},Kv=i=>({...i,eventStreamMarshaller:i.eventStreamSerdeProvider(i)}),Pu="content-length";function zv(i){return e=>async t=>{const s=t.request;if(ns.isInstance(s)){const{body:r,headers:n}=s;if(r&&Object.keys(n).map(a=>a.toLowerCase()).indexOf(Pu)===-1)try{const a=i(r);s.headers={...s.headers,[Pu]:String(a)}}catch{}}return e({...t,request:s})}}const Wv={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Kf=i=>({applyToStack:e=>{e.add(zv(i.bodyLengthChecker),Wv)}}),Du=i=>{var e,t;return Ia.isInstance(i)?((e=i.headers)==null?void 0:e.date)??((t=i.headers)==null?void 0:t.Date):void 0},zf=i=>new Date(Date.now()+i),qv=(i,e)=>Math.abs(zf(e).getTime()-i)>=3e5,Mu=(i,e)=>{const t=Date.parse(i);return qv(t,e)?t-Date.now():e},gn=(i,e)=>{if(!e)throw new Error(`Property \`${i}\` is not resolved for AWS SDK SigV4Auth`);return e},Yv=async i=>{var u,d,f;const e=gn("context",i.context),t=gn("config",i.config),s=(f=(d=(u=e.endpointV2)==null?void 0:u.properties)==null?void 0:d.authSchemes)==null?void 0:f[0],n=await gn("signer",t.signer)(s),a=i==null?void 0:i.signingRegion,o=i==null?void 0:i.signingRegionSet,l=i==null?void 0:i.signingName;return{config:t,signer:n,signingRegion:a,signingRegionSet:o,signingName:l}};class Wf{async sign(e,t,s){var f;if(!ns.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const r=await Yv(s),{config:n,signer:a}=r;let{signingRegion:o,signingName:l}=r;const u=s.context;if(((f=u==null?void 0:u.authSchemes)==null?void 0:f.length)??!1){const[g,v]=u.authSchemes;(g==null?void 0:g.name)==="sigv4a"&&(v==null?void 0:v.name)==="sigv4"&&(o=(v==null?void 0:v.signingRegion)??o,l=(v==null?void 0:v.signingName)??l)}return await a.sign(e,{signingDate:zf(n.systemClockOffset),signingRegion:o,signingService:l})}errorHandler(e){return t=>{const s=t.ServerTime??Du(t.$response);if(s){const r=gn("config",e.config),n=r.systemClockOffset;r.systemClockOffset=Mu(s,r.systemClockOffset),r.systemClockOffset!==n&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const s=Du(e);if(s){const r=gn("config",t.config);r.systemClockOffset=Mu(s,r.systemClockOffset)}}}class Jl extends Error{constructor(e,t=!0){var n;let s,r=!0;typeof t=="boolean"?(s=void 0,r=t):t!=null&&typeof t=="object"&&(s=t.logger,r=t.tryNextLink??!0),super(e),this.name="ProviderError",this.tryNextLink=r,Object.setPrototypeOf(this,Jl.prototype),(n=s==null?void 0:s.debug)==null||n.call(s,`@smithy/property-provider ${r?"->":"(!)"} ${e}`)}static from(e,t=!0){return Object.assign(new this(e.message,t),e)}}class Hr extends Jl{constructor(e,t=!0){super(e,t),this.name="CredentialsProviderError",Object.setPrototypeOf(this,Hr.prototype)}}const Xv=(i,e,t)=>{let s,r,n,a=!1;const o=async()=>{r||(r=i());try{s=await r,n=!0,a=!1}finally{r=void 0}return s};return async l=>((!n||l!=null&&l.forceRefresh)&&(s=await o()),s)},Qv="X-Amz-Algorithm",Jv="X-Amz-Credential",qf="X-Amz-Date",Zv="X-Amz-SignedHeaders",ey="X-Amz-Expires",Yf="X-Amz-Signature",Xf="X-Amz-Security-Token",Qf="authorization",Jf=qf.toLowerCase(),ty="date",sy=[Qf,Jf,ty],iy=Yf.toLowerCase(),El="x-amz-content-sha256",ry=Xf.toLowerCase(),ny={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},ay=/^proxy-/,oy=/^sec-/,Co="AWS4-HMAC-SHA256",ly="AWS4-HMAC-SHA256-PAYLOAD",cy="UNSIGNED-PAYLOAD",uy=50,Zf="aws4_request",hy=60*60*24*7,Xn={},Ro=[],_o=(i,e,t)=>`${i}/${e}/${t}/${Zf}`,dy=async(i,e,t,s,r)=>{const n=await Fu(i,e.secretAccessKey,e.accessKeyId),a=`${t}:${s}:${r}:${hs(n)}:${e.sessionToken}`;if(a in Xn)return Xn[a];for(Ro.push(a);Ro.length>uy;)delete Xn[Ro.shift()];let o=`AWS4${e.secretAccessKey}`;for(const l of[t,s,r,Zf])o=await Fu(i,o,l);return Xn[a]=o},Fu=(i,e,t)=>{const s=new i(e);return s.update(pn(t)),s.digest()},Ou=({headers:i},e,t)=>{const s={};for(const r of Object.keys(i).sort()){if(i[r]==null)continue;const n=r.toLowerCase();(n in ny||e!=null&&e.has(n)||ay.test(n)||oy.test(n))&&(!t||t&&!t.has(n))||(s[n]=i[r].trim().replace(/\s+/g," "))}return s},fy=({query:i={}})=>{const e=[],t={};for(const s of Object.keys(i).sort()){if(s.toLowerCase()===iy)continue;e.push(s);const r=i[s];typeof r=="string"?t[s]=`${Ni(s)}=${Ni(r)}`:Array.isArray(r)&&(t[s]=r.slice(0).reduce((n,a)=>n.concat([`${Ni(s)}=${Ni(a)}`]),[]).sort().join("&"))}return e.map(s=>t[s]).filter(s=>s).join("&")},py=i=>typeof ArrayBuffer=="function"&&i instanceof ArrayBuffer||Object.prototype.toString.call(i)==="[object ArrayBuffer]",Io=async({headers:i,body:e},t)=>{for(const s of Object.keys(i))if(s.toLowerCase()===El)return i[s];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||py(e)){const s=new t;return s.update(pn(e)),hs(await s.digest())}return cy};class gy{format(e){const t=[];for(const n of Object.keys(e)){const a=nr(n);t.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[n]))}const s=new Uint8Array(t.reduce((n,a)=>n+a.byteLength,0));let r=0;for(const n of t)s.set(n,r),r+=n.byteLength;return s}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const s=new DataView(new ArrayBuffer(5));return s.setUint8(0,4),s.setInt32(1,e.value,!1),new Uint8Array(s.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const a=new Uint8Array(n.buffer);return a.set(e.value,3),a;case"string":const o=nr(e.value),l=new DataView(new ArrayBuffer(3+o.byteLength));l.setUint8(0,7),l.setUint16(1,o.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(o,3),u;case"timestamp":const d=new Uint8Array(9);return d[0]=8,d.set(vy.fromNumber(e.value.valueOf()).bytes,1),d;case"uuid":if(!my.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const f=new Uint8Array(17);return f[0]=9,f.set(Mf(e.value.replace(/\-/g,"")),1),f}}}var Nu;(function(i){i[i.boolTrue=0]="boolTrue",i[i.boolFalse=1]="boolFalse",i[i.byte=2]="byte",i[i.short=3]="short",i[i.integer=4]="integer",i[i.long=5]="long",i[i.byteArray=6]="byteArray",i[i.string=7]="string",i[i.timestamp=8]="timestamp",i[i.uuid=9]="uuid"})(Nu||(Nu={}));const my=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let vy=class ep{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let s=7,r=Math.abs(Math.round(e));s>-1&&r>0;s--,r/=256)t[s]=r;return e<0&&Bu(t),new ep(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&Bu(e),parseInt(hs(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function Bu(i){for(let e=0;e<8;e++)i[e]^=255;for(let e=7;e>-1&&(i[e]++,i[e]===0);e--);}const yy=(i,e)=>{i=i.toLowerCase();for(const t of Object.keys(e))if(i===t.toLowerCase())return!0;return!1},xy=(i,e={})=>{var r;const{headers:t,query:s={}}=ns.clone(i);for(const n of Object.keys(t)){const a=n.toLowerCase();a.slice(0,6)==="x-amz-"&&!((r=e.unhoistableHeaders)!=null&&r.has(a))&&(s[n]=t[n],delete t[n])}return{...i,headers:t,query:s}},$u=i=>{i=ns.clone(i);for(const e of Object.keys(i.headers))sy.indexOf(e.toLowerCase())>-1&&delete i.headers[e];return i},Sy=i=>Ey(i).toISOString().replace(/\.\d{3}Z$/,"Z"),Ey=i=>typeof i=="number"?new Date(i*1e3):typeof i=="string"?Number(i)?new Date(Number(i)*1e3):new Date(i):i;class Uu{constructor({applyChecksum:e,credentials:t,region:s,service:r,sha256:n,uriEscapePath:a=!0}){this.headerFormatter=new gy,this.service=r,this.sha256=n,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=yi(s),this.credentialProvider=yi(t)}async presign(e,t={}){const{signingDate:s=new Date,expiresIn:r=3600,unsignableHeaders:n,unhoistableHeaders:a,signableHeaders:o,signingRegion:l,signingService:u}=t,d=await this.credentialProvider();this.validateResolvedCredentials(d);const f=l??await this.regionProvider(),{longDate:g,shortDate:v}=Qn(s);if(r>hy)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const y=_o(v,f,u??this.service),E=xy($u(e),{unhoistableHeaders:a});d.sessionToken&&(E.query[Xf]=d.sessionToken),E.query[Qv]=Co,E.query[Jv]=`${d.accessKeyId}/${y}`,E.query[qf]=g,E.query[ey]=r.toString(10);const b=Ou(E,n,o);return E.query[Zv]=Gu(b),E.query[Yf]=await this.getSignature(g,y,this.getSigningKey(d,f,v,u),this.createCanonicalRequest(E,b,await Io(e,this.sha256))),E}async sign(e,t){return typeof e=="string"?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:s=new Date,priorSignature:r,signingRegion:n,signingService:a}){const o=n??await this.regionProvider(),{shortDate:l,longDate:u}=Qn(s),d=_o(l,o,a??this.service),f=await Io({headers:{},body:t},this.sha256),g=new this.sha256;g.update(e);const v=hs(await g.digest()),y=[ly,u,d,r,v,f].join(`
|
|
30
30
|
`);return this.signString(y,{signingDate:s,signingRegion:o,signingService:a})}async signMessage(e,{signingDate:t=new Date,signingRegion:s,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:s,signingService:r,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:t=new Date,signingRegion:s,signingService:r}={}){const n=await this.credentialProvider();this.validateResolvedCredentials(n);const a=s??await this.regionProvider(),{shortDate:o}=Qn(t),l=new this.sha256(await this.getSigningKey(n,a,o,r));return l.update(pn(e)),hs(await l.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:s,unsignableHeaders:r,signingRegion:n,signingService:a}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const l=n??await this.regionProvider(),u=$u(e),{longDate:d,shortDate:f}=Qn(t),g=_o(f,l,a??this.service);u.headers[Jf]=d,o.sessionToken&&(u.headers[ry]=o.sessionToken);const v=await Io(u,this.sha256);!yy(El,u.headers)&&this.applyChecksum&&(u.headers[El]=v);const y=Ou(u,r,s),E=await this.getSignature(d,g,this.getSigningKey(o,l,f,a),this.createCanonicalRequest(u,y,v));return u.headers[Qf]=`${Co} Credential=${o.accessKeyId}/${g}, SignedHeaders=${Gu(y)}, Signature=${E}`,u}createCanonicalRequest(e,t,s){const r=Object.keys(t).sort();return`${e.method}
|
|
31
31
|
${this.getCanonicalPath(e)}
|
|
32
32
|
${fy(e)}
|
|
@@ -37,31 +37,32 @@ ${r.join(";")}
|
|
|
37
37
|
${s}`}async createStringToSign(e,t,s){const r=new this.sha256;r.update(pn(s));const n=await r.digest();return`${Co}
|
|
38
38
|
${e}
|
|
39
39
|
${t}
|
|
40
|
-
${hs(n)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))(n==null?void 0:n.length)!==0&&n!=="."&&(n===".."?t.pop():t.push(n));const s=`${e!=null&&e.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&(e!=null&&e.endsWith("/"))?"/":""}`;return Ni(s).replace(/%2F/g,"/")}return e}async getSignature(e,t,s,r){const n=await this.createStringToSign(e,t,r),a=new this.sha256(await s);return a.update(pn(n)),hs(await a.digest())}getSigningKey(e,t,s,r){return dy(this.sha256,e,s,t,r||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}}const Qn=i=>{const e=Sy(i).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Gu=i=>Object.keys(i).sort().join(";"),tp=i=>{let e;i.credentials&&(e=jv(i.credentials,Hv,jf)),e||(i.credentialDefaultProvider?e=Yn(i.credentialDefaultProvider(Object.assign({},i,{parentClientConfig:i}))):e=async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:t=!0,systemClockOffset:s=i.systemClockOffset||0,sha256:r}=i;let n;return i.signer?n=Yn(i.signer):i.regionInfoProvider?n=()=>Yn(i.region)().then(async a=>[await i.regionInfoProvider(a,{useFipsEndpoint:await i.useFipsEndpoint(),useDualstackEndpoint:await i.useDualstackEndpoint()})||{},a]).then(([a,o])=>{const{signingRegion:l,signingService:u}=a;i.signingRegion=i.signingRegion||l||o,i.signingName=i.signingName||u||i.serviceId;const d={...i,credentials:e,region:i.signingRegion,service:i.signingName,sha256:r,uriEscapePath:t},f=i.signerConstructor||Uu;return new f(d)}):n=async a=>{a=Object.assign({},{name:"sigv4",signingName:i.signingName||i.defaultSigningName,signingRegion:await Yn(i.region)(),properties:{}},a);const o=a.signingRegion,l=a.signingName;i.signingRegion=i.signingRegion||o,i.signingName=i.signingName||l||i.serviceId;const u={...i,credentials:e,region:i.signingRegion,service:i.signingName,sha256:r,uriEscapePath:t},d=i.signerConstructor||Uu;return new d(u)},{...i,systemClockOffset:s,signingEscapePath:t,credentials:e,signer:n}},by=(i,e)=>bv(i,e).then(t=>e.utf8Encoder(t)),Zl=(i,e)=>by(i,e).then(t=>{if(t.length)try{return JSON.parse(t)}catch(s){throw(s==null?void 0:s.name)==="SyntaxError"&&Object.defineProperty(s,"$responseBodyText",{value:t}),s}return{}}),sp=async(i,e)=>{const t=await Zl(i,e);return t.message=t.message??t.Message,t},ip=(i,e)=>{const t=(n,a)=>Object.keys(n).find(o=>o.toLowerCase()===a.toLowerCase()),s=n=>{let a=n;return typeof a=="number"&&(a=a.toString()),a.indexOf(",")>=0&&(a=a.split(",")[0]),a.indexOf(":")>=0&&(a=a.split(":")[0]),a.indexOf("#")>=0&&(a=a.split("#")[1]),a},r=t(i.headers,"x-amzn-errortype");if(r!==void 0)return s(i.headers[r]);if(e.code!==void 0)return s(e.code);if(e.__type!==void 0)return s(e.__type)},Ty=async(i,e,t)=>({operation:Dn(e).operation,region:await yi(i.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function wy(i){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"kinesis",region:i.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const Ay=i=>{const e=[];switch(i.operation){default:e.push(wy(i))}return e},Ly=i=>({...tp(i)}),Cy=i=>({...i,useDualstackEndpoint:i.useDualstackEndpoint??!1,useFipsEndpoint:i.useFipsEndpoint??!1,defaultSigningName:"kinesis"}),Ry={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},_y="@aws-sdk/client-kinesis",Iy="AWS SDK for JavaScript Kinesis Client for Node.js, Browser and React Native",ky="3.637.0",Py={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-kinesis","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo kinesis","test:e2e":"jest --config jest.config.e2e.js"},Dy="./dist-cjs/index.js",My="./dist-types/index.d.ts",Fy="./dist-es/index.js",Oy=!1,Ny={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.637.0","@aws-sdk/client-sts":"3.637.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.637.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.637.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.637.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/eventstream-serde-browser":"^3.0.6","@smithy/eventstream-serde-config-resolver":"^3.0.3","@smithy/eventstream-serde-node":"^3.0.5","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.1.2",tslib:"^2.6.2"},By={"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},$y={node:">=16.0.0"},Uy={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},Gy=["dist-*/**"],Vy={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},Hy="Apache-2.0",jy={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},Ky="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-kinesis",zy={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-kinesis"},Wy={name:_y,description:Iy,version:ky,scripts:Py,main:Dy,types:My,module:Fy,sideEffects:Oy,dependencies:Ny,devDependencies:By,engines:$y,typesVersions:Uy,files:Gy,author:Vy,license:Hy,browser:jy,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:Ky,repository:zy},qy=i=>new TextEncoder().encode(i);var Yy=typeof Buffer<"u"&&Buffer.from?function(i){return Buffer.from(i,"utf8")}:qy;function Ln(i){return i instanceof Uint8Array?i:typeof i=="string"?Yy(i):ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(i)}function bl(i){return typeof i=="string"?i.length===0:i.byteLength===0}function Xy(i){if(!Uint32Array.from){for(var e=new Uint32Array(i.length),t=0;t<i.length;)e[t]=i[t],t+=1;return e}return Uint32Array.from(i)}var rp={name:"SHA-256"},Vu={name:"HMAC",hash:rp},Qy=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const Jy={};function ya(){return typeof window<"u"?window:typeof self<"u"?self:Jy}var Zy=function(){function i(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return i.prototype.update=function(e){if(!bl(e)){var t=Ln(e),s=new Uint8Array(this.toHash.byteLength+t.byteLength);s.set(this.toHash,0),s.set(t,this.toHash.byteLength),this.toHash=s}},i.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return ya().crypto.subtle.sign(Vu,t,e.toHash).then(function(s){return new Uint8Array(s)})}):bl(this.toHash)?Promise.resolve(Qy):Promise.resolve().then(function(){return ya().crypto.subtle.digest(rp,e.toHash)}).then(function(t){return Promise.resolve(new Uint8Array(t))})},i.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(t,s){ya().crypto.subtle.importKey("raw",Ln(e.secret),Vu,!1,["sign"]).then(t,s)}),this.key.catch(function(){}))},i}();function ex(i,e,t,s){function r(n){return n instanceof t?n:new t(function(a){a(n)})}return new(t||(t=Promise))(function(n,a){function o(d){try{u(s.next(d))}catch(f){a(f)}}function l(d){try{u(s.throw(d))}catch(f){a(f)}}function u(d){d.done?n(d.value):r(d.value).then(o,l)}u((s=s.apply(i,e||[])).next())})}function tx(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,r,n,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(d){return l([u,d])}}function l(u){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(t=0)),t;)try{if(s=1,r&&(n=u[0]&2?r.return:u[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,u[1])).done)return n;switch(r=0,n&&(u=[u[0]&2,n.value]),u[0]){case 0:case 1:n=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!n||u[1]>n[0]&&u[1]<n[3])){t.label=u[1];break}if(u[0]===6&&t.label<n[1]){t.label=n[1],n=u;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(u);break}n[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(i,t)}catch(d){u=[6,d],r=0}finally{s=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function sx(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],s=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&s>=i.length&&(i=void 0),{value:i&&i[s++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var Ss=64,ix=32,rx=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),nx=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],ax=Math.pow(2,53)-1,xa=function(){function i(){this.state=Int32Array.from(nx),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return i.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,s=e.byteLength;if(this.bytesHashed+=s,this.bytesHashed*8>ax)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;s>0;)this.buffer[this.bufferLength++]=e[t++],s--,this.bufferLength===Ss&&(this.hashBuffer(),this.bufferLength=0)},i.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),s=this.bufferLength;if(t.setUint8(this.bufferLength++,128),s%Ss>=Ss-8){for(var r=this.bufferLength;r<Ss;r++)t.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(var r=this.bufferLength;r<Ss-8;r++)t.setUint8(r,0);t.setUint32(Ss-8,Math.floor(e/4294967296),!0),t.setUint32(Ss-4,e),this.hashBuffer(),this.finished=!0}for(var n=new Uint8Array(ix),r=0;r<8;r++)n[r*4]=this.state[r]>>>24&255,n[r*4+1]=this.state[r]>>>16&255,n[r*4+2]=this.state[r]>>>8&255,n[r*4+3]=this.state[r]>>>0&255;return n},i.prototype.hashBuffer=function(){for(var e=this,t=e.buffer,s=e.state,r=s[0],n=s[1],a=s[2],o=s[3],l=s[4],u=s[5],d=s[6],f=s[7],g=0;g<Ss;g++){if(g<16)this.temp[g]=(t[g*4]&255)<<24|(t[g*4+1]&255)<<16|(t[g*4+2]&255)<<8|t[g*4+3]&255;else{var v=this.temp[g-2],y=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10;v=this.temp[g-15];var E=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3;this.temp[g]=(y+this.temp[g-7]|0)+(E+this.temp[g-16]|0)}var b=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&u^~l&d)|0)+(f+(rx[g]+this.temp[g]|0)|0)|0,w=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&n^r&a^n&a)|0;f=d,d=u,u=l,l=o+b|0,o=a,a=n,n=r,r=b+w|0}s[0]+=r,s[1]+=n,s[2]+=a,s[3]+=o,s[4]+=l,s[5]+=u,s[6]+=d,s[7]+=f},i}(),ox=function(){function i(e){this.secret=e,this.hash=new xa,this.reset()}return i.prototype.update=function(e){if(!(bl(e)||this.error))try{this.hash.update(Ln(e))}catch(t){this.error=t}},i.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},i.prototype.digest=function(){return ex(this,void 0,void 0,function(){return tx(this,function(e){return[2,this.digestSync()]})})},i.prototype.reset=function(){if(this.hash=new xa,this.secret){this.outer=new xa;var e=lx(this.secret),t=new Uint8Array(Ss);t.set(e);for(var s=0;s<Ss;s++)e[s]^=54,t[s]^=92;this.hash.update(e),this.outer.update(t);for(var s=0;s<e.byteLength;s++)e[s]=0}},i}();function lx(i){var e=Ln(i);if(e.byteLength>Ss){var t=new xa;t.update(e),e=t.digest()}var s=new Uint8Array(Ss);return s.set(e),s}var cx=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function ux(i){if(hx(i)&&typeof i.crypto.subtle=="object"){var e=i.crypto.subtle;return dx(e)}return!1}function hx(i){if(typeof i=="object"&&typeof i.crypto=="object"){var e=i.crypto.getRandomValues;return typeof e=="function"}return!1}function dx(i){return i&&cx.every(function(e){return typeof i[e]=="function"})}var np=function(){function i(e){ux(ya())?this.hash=new Zy(e):this.hash=new ox(e)}return i.prototype.update=function(e,t){this.hash.update(Ln(e))},i.prototype.digest=function(){return this.hash.digest()},i.prototype.reset=function(){this.hash.reset()},i}();const fx={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},ap={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},At={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Xt={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Mi={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class ge{static getFirstMatch(e,t){const s=t.match(e);return s&&s.length>0&&s[1]||""}static getSecondMatch(e,t){const s=t.match(e);return s&&s.length>1&&s[2]||""}static matchAndReturnConst(e,t,s){if(e.test(t))return s}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map(s=>parseInt(s,10)||0);if(t.push(0),t[0]===10)switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map(s=>parseInt(s,10)||0);if(t.push(0),!(t[0]===1&&t[1]<5)){if(t[0]===1&&t[1]<6)return"Cupcake";if(t[0]===1&&t[1]>=6)return"Donut";if(t[0]===2&&t[1]<2)return"Eclair";if(t[0]===2&&t[1]===2)return"Froyo";if(t[0]===2&&t[1]>2)return"Gingerbread";if(t[0]===3)return"Honeycomb";if(t[0]===4&&t[1]<1)return"Ice Cream Sandwich";if(t[0]===4&&t[1]<4)return"Jelly Bean";if(t[0]===4&&t[1]>=4)return"KitKat";if(t[0]===5)return"Lollipop";if(t[0]===6)return"Marshmallow";if(t[0]===7)return"Nougat";if(t[0]===8)return"Oreo";if(t[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,s=!1){const r=ge.getVersionPrecision(e),n=ge.getVersionPrecision(t);let a=Math.max(r,n),o=0;const l=ge.map([e,t],u=>{const d=a-ge.getVersionPrecision(u),f=u+new Array(d+1).join(".0");return ge.map(f.split("."),g=>new Array(20-g.length).join("0")+g).reverse()});for(s&&(o=a-Math.min(r,n)),a-=1;a>=o;){if(l[0][a]>l[1][a])return 1;if(l[0][a]===l[1][a]){if(a===o)return 0;a-=1}else if(l[0][a]<l[1][a])return-1}}static map(e,t){const s=[];let r;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)s.push(t(e[r]));return s}static find(e,t){let s,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(s=0,r=e.length;s<r;s+=1){const n=e[s];if(t(n,s))return n}}static assign(e,...t){const s=e;let r,n;if(Object.assign)return Object.assign(e,...t);for(r=0,n=t.length;r<n;r+=1){const a=t[r];typeof a=="object"&&a!==null&&Object.keys(a).forEach(l=>{s[l]=a[l]})}return e}static getBrowserAlias(e){return fx[e]}static getBrowserTypeByAlias(e){return ap[e]||""}}const gt=/version\/(\d+(\.?_?\d+)+)/i,px=[{test:[/googlebot/i],describe(i){const e={name:"Googlebot"},t=ge.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/opera/i],describe(i){const e={name:"Opera"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/opr\/|opios/i],describe(i){const e={name:"Opera"},t=ge.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/SamsungBrowser/i],describe(i){const e={name:"Samsung Internet for Android"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/Whale/i],describe(i){const e={name:"NAVER Whale Browser"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/MZBrowser/i],describe(i){const e={name:"MZ Browser"},t=ge.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/focus/i],describe(i){const e={name:"Focus"},t=ge.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/swing/i],describe(i){const e={name:"Swing"},t=ge.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/coast/i],describe(i){const e={name:"Opera Coast"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(i){const e={name:"Opera Touch"},t=ge.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/yabrowser/i],describe(i){const e={name:"Yandex Browser"},t=ge.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/ucbrowser/i],describe(i){const e={name:"UC Browser"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/Maxthon|mxios/i],describe(i){const e={name:"Maxthon"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/epiphany/i],describe(i){const e={name:"Epiphany"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/puffin/i],describe(i){const e={name:"Puffin"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/sleipnir/i],describe(i){const e={name:"Sleipnir"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/k-meleon/i],describe(i){const e={name:"K-Meleon"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/micromessenger/i],describe(i){const e={name:"WeChat"},t=ge.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/qqbrowser/i],describe(i){const e={name:/qqbrowserlite/i.test(i)?"QQ Browser Lite":"QQ Browser"},t=ge.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/msie|trident/i],describe(i){const e={name:"Internet Explorer"},t=ge.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/\sedg\//i],describe(i){const e={name:"Microsoft Edge"},t=ge.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/edg([ea]|ios)/i],describe(i){const e={name:"Microsoft Edge"},t=ge.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/vivaldi/i],describe(i){const e={name:"Vivaldi"},t=ge.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/seamonkey/i],describe(i){const e={name:"SeaMonkey"},t=ge.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/sailfish/i],describe(i){const e={name:"Sailfish"},t=ge.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,i);return t&&(e.version=t),e}},{test:[/silk/i],describe(i){const e={name:"Amazon Silk"},t=ge.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/phantom/i],describe(i){const e={name:"PhantomJS"},t=ge.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/slimerjs/i],describe(i){const e={name:"SlimerJS"},t=ge.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(i){const e={name:"BlackBerry"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/(web|hpw)[o0]s/i],describe(i){const e={name:"WebOS Browser"},t=ge.getFirstMatch(gt,i)||ge.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/bada/i],describe(i){const e={name:"Bada"},t=ge.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/tizen/i],describe(i){const e={name:"Tizen"},t=ge.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/qupzilla/i],describe(i){const e={name:"QupZilla"},t=ge.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/firefox|iceweasel|fxios/i],describe(i){const e={name:"Firefox"},t=ge.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/electron/i],describe(i){const e={name:"Electron"},t=ge.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/MiuiBrowser/i],describe(i){const e={name:"Miui"},t=ge.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/chromium/i],describe(i){const e={name:"Chromium"},t=ge.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/chrome|crios|crmo/i],describe(i){const e={name:"Chrome"},t=ge.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/GSA/i],describe(i){const e={name:"Google Search"},t=ge.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test(i){const e=!i.test(/like android/i),t=i.test(/android/i);return e&&t},describe(i){const e={name:"Android Browser"},t=ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/playstation 4/i],describe(i){const e={name:"PlayStation 4"},t=ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/safari|applewebkit/i],describe(i){const e={name:"Safari"},t=ge.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/.*/i],describe(i){const e=/^(.*)\/(.*) /,t=/^(.*)\/(.*)[ \t]\((.*)/,r=i.search("\\(")!==-1?t:e;return{name:ge.getFirstMatch(r,i),version:ge.getSecondMatch(r,i)}}}],gx=[{test:[/Roku\/DVP/],describe(i){const e=ge.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,i);return{name:Xt.Roku,version:e}}},{test:[/windows phone/i],describe(i){const e=ge.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,i);return{name:Xt.WindowsPhone,version:e}}},{test:[/windows /i],describe(i){const e=ge.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,i),t=ge.getWindowsVersionName(e);return{name:Xt.Windows,version:e,versionName:t}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(i){const e={name:Xt.iOS},t=ge.getSecondMatch(/(Version\/)(\d[\d.]+)/,i);return t&&(e.version=t),e}},{test:[/macintosh/i],describe(i){const e=ge.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,i).replace(/[_\s]/g,"."),t=ge.getMacOSVersionName(e),s={name:Xt.MacOS,version:e};return t&&(s.versionName=t),s}},{test:[/(ipod|iphone|ipad)/i],describe(i){const e=ge.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,i).replace(/[_\s]/g,".");return{name:Xt.iOS,version:e}}},{test(i){const e=!i.test(/like android/i),t=i.test(/android/i);return e&&t},describe(i){const e=ge.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,i),t=ge.getAndroidVersionName(e),s={name:Xt.Android,version:e};return t&&(s.versionName=t),s}},{test:[/(web|hpw)[o0]s/i],describe(i){const e=ge.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,i),t={name:Xt.WebOS};return e&&e.length&&(t.version=e),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(i){const e=ge.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,i)||ge.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,i)||ge.getFirstMatch(/\bbb(\d+)/i,i);return{name:Xt.BlackBerry,version:e}}},{test:[/bada/i],describe(i){const e=ge.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,i);return{name:Xt.Bada,version:e}}},{test:[/tizen/i],describe(i){const e=ge.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,i);return{name:Xt.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Xt.Linux}}},{test:[/CrOS/],describe(){return{name:Xt.ChromeOS}}},{test:[/PlayStation 4/],describe(i){const e=ge.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,i);return{name:Xt.PlayStation4,version:e}}}],mx=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(i){const e=ge.getFirstMatch(/(can-l01)/i,i)&&"Nova",t={type:At.mobile,vendor:"Huawei"};return e&&(t.model=e),t}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:At.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:At.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:At.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:At.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:At.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:At.tablet}}},{test(i){const e=i.test(/ipod|iphone/i),t=i.test(/like (ipod|iphone)/i);return e&&!t},describe(i){const e=ge.getFirstMatch(/(ipod|iphone)/i,i);return{type:At.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:At.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:At.mobile}}},{test(i){return i.getBrowserName(!0)==="blackberry"},describe(){return{type:At.mobile,vendor:"BlackBerry"}}},{test(i){return i.getBrowserName(!0)==="bada"},describe(){return{type:At.mobile}}},{test(i){return i.getBrowserName()==="windows phone"},describe(){return{type:At.mobile,vendor:"Microsoft"}}},{test(i){const e=Number(String(i.getOSVersion()).split(".")[0]);return i.getOSName(!0)==="android"&&e>=3},describe(){return{type:At.tablet}}},{test(i){return i.getOSName(!0)==="android"},describe(){return{type:At.mobile}}},{test(i){return i.getOSName(!0)==="macos"},describe(){return{type:At.desktop,vendor:"Apple"}}},{test(i){return i.getOSName(!0)==="windows"},describe(){return{type:At.desktop}}},{test(i){return i.getOSName(!0)==="linux"},describe(){return{type:At.desktop}}},{test(i){return i.getOSName(!0)==="playstation 4"},describe(){return{type:At.tv}}},{test(i){return i.getOSName(!0)==="roku"},describe(){return{type:At.tv}}}],vx=[{test(i){return i.getBrowserName(!0)==="microsoft edge"},describe(i){if(/\sedg\//i.test(i))return{name:Mi.Blink};const t=ge.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,i);return{name:Mi.EdgeHTML,version:t}}},{test:[/trident/i],describe(i){const e={name:Mi.Trident},t=ge.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test(i){return i.test(/presto/i)},describe(i){const e={name:Mi.Presto},t=ge.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test(i){const e=i.test(/gecko/i),t=i.test(/like gecko/i);return e&&!t},describe(i){const e={name:Mi.Gecko},t=ge.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Mi.Blink}}},{test:[/(apple)?webkit/i],describe(i){const e={name:Mi.WebKit},t=ge.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}}];class Hu{constructor(e,t=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},t!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=ge.find(px,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=ge.find(gx,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=ge.find(mx,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=ge.find(vx,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return ge.assign({},this.parsedResult)}satisfies(e){const t={};let s=0;const r={};let n=0;if(Object.keys(e).forEach(o=>{const l=e[o];typeof l=="string"?(r[o]=l,n+=1):typeof l=="object"&&(t[o]=l,s+=1)}),s>0){const o=Object.keys(t),l=ge.find(o,d=>this.isOS(d));if(l){const d=this.satisfies(t[l]);if(d!==void 0)return d}const u=ge.find(o,d=>this.isPlatform(d));if(u){const d=this.satisfies(t[u]);if(d!==void 0)return d}}if(n>0){const o=Object.keys(r),l=ge.find(o,u=>this.isBrowser(u,!0));if(l!==void 0)return this.compareVersion(r[l])}}isBrowser(e,t=!1){const s=this.getBrowserName().toLowerCase();let r=e.toLowerCase();const n=ge.getBrowserTypeByAlias(r);return t&&n&&(r=n.toLowerCase()),r===s}compareVersion(e){let t=[0],s=e,r=!1;const n=this.getBrowserVersion();if(typeof n=="string")return e[0]===">"||e[0]==="<"?(s=e.substr(1),e[1]==="="?(r=!0,s=e.substr(2)):t=[],e[0]===">"?t.push(1):t.push(-1)):e[0]==="="?s=e.substr(1):e[0]==="~"&&(r=!0,s=e.substr(1)),t.indexOf(ge.compareVersions(n,s,r))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(t=>this.is(t))}}/*!
|
|
40
|
+
${hs(n)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))(n==null?void 0:n.length)!==0&&n!=="."&&(n===".."?t.pop():t.push(n));const s=`${e!=null&&e.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&(e!=null&&e.endsWith("/"))?"/":""}`;return Ni(s).replace(/%2F/g,"/")}return e}async getSignature(e,t,s,r){const n=await this.createStringToSign(e,t,r),a=new this.sha256(await s);return a.update(pn(n)),hs(await a.digest())}getSigningKey(e,t,s,r){return dy(this.sha256,e,s,t,r||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}}const Qn=i=>{const e=Sy(i).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Gu=i=>Object.keys(i).sort().join(";"),tp=i=>{let e;i.credentials&&(e=jv(i.credentials,Hv,jf)),e||(i.credentialDefaultProvider?e=Yn(i.credentialDefaultProvider(Object.assign({},i,{parentClientConfig:i}))):e=async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:t=!0,systemClockOffset:s=i.systemClockOffset||0,sha256:r}=i;let n;return i.signer?n=Yn(i.signer):i.regionInfoProvider?n=()=>Yn(i.region)().then(async a=>[await i.regionInfoProvider(a,{useFipsEndpoint:await i.useFipsEndpoint(),useDualstackEndpoint:await i.useDualstackEndpoint()})||{},a]).then(([a,o])=>{const{signingRegion:l,signingService:u}=a;i.signingRegion=i.signingRegion||l||o,i.signingName=i.signingName||u||i.serviceId;const d={...i,credentials:e,region:i.signingRegion,service:i.signingName,sha256:r,uriEscapePath:t},f=i.signerConstructor||Uu;return new f(d)}):n=async a=>{a=Object.assign({},{name:"sigv4",signingName:i.signingName||i.defaultSigningName,signingRegion:await Yn(i.region)(),properties:{}},a);const o=a.signingRegion,l=a.signingName;i.signingRegion=i.signingRegion||o,i.signingName=i.signingName||l||i.serviceId;const u={...i,credentials:e,region:i.signingRegion,service:i.signingName,sha256:r,uriEscapePath:t},d=i.signerConstructor||Uu;return new d(u)},{...i,systemClockOffset:s,signingEscapePath:t,credentials:e,signer:n}},by=(i,e)=>bv(i,e).then(t=>e.utf8Encoder(t)),Zl=(i,e)=>by(i,e).then(t=>{if(t.length)try{return JSON.parse(t)}catch(s){throw(s==null?void 0:s.name)==="SyntaxError"&&Object.defineProperty(s,"$responseBodyText",{value:t}),s}return{}}),sp=async(i,e)=>{const t=await Zl(i,e);return t.message=t.message??t.Message,t},ip=(i,e)=>{const t=(n,a)=>Object.keys(n).find(o=>o.toLowerCase()===a.toLowerCase()),s=n=>{let a=n;return typeof a=="number"&&(a=a.toString()),a.indexOf(",")>=0&&(a=a.split(",")[0]),a.indexOf(":")>=0&&(a=a.split(":")[0]),a.indexOf("#")>=0&&(a=a.split("#")[1]),a},r=t(i.headers,"x-amzn-errortype");if(r!==void 0)return s(i.headers[r]);if(e.code!==void 0)return s(e.code);if(e.__type!==void 0)return s(e.__type)},Ty=async(i,e,t)=>({operation:Dn(e).operation,region:await yi(i.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function wy(i){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"kinesis",region:i.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const Ay=i=>{const e=[];switch(i.operation){default:e.push(wy(i))}return e},Ly=i=>({...tp(i)}),Cy=i=>({...i,useDualstackEndpoint:i.useDualstackEndpoint??!1,useFipsEndpoint:i.useFipsEndpoint??!1,defaultSigningName:"kinesis"}),Ry={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},_y="@aws-sdk/client-kinesis",Iy="AWS SDK for JavaScript Kinesis Client for Node.js, Browser and React Native",ky="3.637.0",Py={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-kinesis","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo kinesis","test:e2e":"jest --config jest.config.e2e.js"},Dy="./dist-cjs/index.js",My="./dist-types/index.d.ts",Fy="./dist-es/index.js",Oy=!1,Ny={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.637.0","@aws-sdk/client-sts":"3.637.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.637.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.637.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.637.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/eventstream-serde-browser":"^3.0.6","@smithy/eventstream-serde-config-resolver":"^3.0.3","@smithy/eventstream-serde-node":"^3.0.5","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.1.2",tslib:"^2.6.2"},By={"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},$y={node:">=16.0.0"},Uy={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},Gy=["dist-*/**"],Vy={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},Hy="Apache-2.0",jy={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},Ky="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-kinesis",zy={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-kinesis"},Wy={name:_y,description:Iy,version:ky,scripts:Py,main:Dy,types:My,module:Fy,sideEffects:Oy,dependencies:Ny,devDependencies:By,engines:$y,typesVersions:Uy,files:Gy,author:Vy,license:Hy,browser:jy,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:Ky,repository:zy},qy=i=>new TextEncoder().encode(i);var Yy=typeof Buffer<"u"&&Buffer.from?function(i){return Buffer.from(i,"utf8")}:qy;function Ln(i){return i instanceof Uint8Array?i:typeof i=="string"?Yy(i):ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(i)}function bl(i){return typeof i=="string"?i.length===0:i.byteLength===0}function Xy(i){if(!Uint32Array.from){for(var e=new Uint32Array(i.length),t=0;t<i.length;)e[t]=i[t],t+=1;return e}return Uint32Array.from(i)}var rp={name:"SHA-256"},Vu={name:"HMAC",hash:rp},Qy=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const Jy={};function ya(){return typeof window<"u"?window:typeof self<"u"?self:Jy}var Zy=function(){function i(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return i.prototype.update=function(e){if(!bl(e)){var t=Ln(e),s=new Uint8Array(this.toHash.byteLength+t.byteLength);s.set(this.toHash,0),s.set(t,this.toHash.byteLength),this.toHash=s}},i.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return ya().crypto.subtle.sign(Vu,t,e.toHash).then(function(s){return new Uint8Array(s)})}):bl(this.toHash)?Promise.resolve(Qy):Promise.resolve().then(function(){return ya().crypto.subtle.digest(rp,e.toHash)}).then(function(t){return Promise.resolve(new Uint8Array(t))})},i.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(t,s){ya().crypto.subtle.importKey("raw",Ln(e.secret),Vu,!1,["sign"]).then(t,s)}),this.key.catch(function(){}))},i}();function ex(i,e,t,s){function r(n){return n instanceof t?n:new t(function(a){a(n)})}return new(t||(t=Promise))(function(n,a){function o(d){try{u(s.next(d))}catch(f){a(f)}}function l(d){try{u(s.throw(d))}catch(f){a(f)}}function u(d){d.done?n(d.value):r(d.value).then(o,l)}u((s=s.apply(i,e||[])).next())})}function tx(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,r,n,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(d){return l([u,d])}}function l(u){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(t=0)),t;)try{if(s=1,r&&(n=u[0]&2?r.return:u[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,u[1])).done)return n;switch(r=0,n&&(u=[u[0]&2,n.value]),u[0]){case 0:case 1:n=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!n||u[1]>n[0]&&u[1]<n[3])){t.label=u[1];break}if(u[0]===6&&t.label<n[1]){t.label=n[1],n=u;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(u);break}n[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(i,t)}catch(d){u=[6,d],r=0}finally{s=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function sx(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],s=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&s>=i.length&&(i=void 0),{value:i&&i[s++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var Ss=64,ix=32,rx=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),nx=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],ax=Math.pow(2,53)-1,xa=function(){function i(){this.state=Int32Array.from(nx),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return i.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,s=e.byteLength;if(this.bytesHashed+=s,this.bytesHashed*8>ax)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;s>0;)this.buffer[this.bufferLength++]=e[t++],s--,this.bufferLength===Ss&&(this.hashBuffer(),this.bufferLength=0)},i.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),s=this.bufferLength;if(t.setUint8(this.bufferLength++,128),s%Ss>=Ss-8){for(var r=this.bufferLength;r<Ss;r++)t.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(var r=this.bufferLength;r<Ss-8;r++)t.setUint8(r,0);t.setUint32(Ss-8,Math.floor(e/4294967296),!0),t.setUint32(Ss-4,e),this.hashBuffer(),this.finished=!0}for(var n=new Uint8Array(ix),r=0;r<8;r++)n[r*4]=this.state[r]>>>24&255,n[r*4+1]=this.state[r]>>>16&255,n[r*4+2]=this.state[r]>>>8&255,n[r*4+3]=this.state[r]>>>0&255;return n},i.prototype.hashBuffer=function(){for(var e=this,t=e.buffer,s=e.state,r=s[0],n=s[1],a=s[2],o=s[3],l=s[4],u=s[5],d=s[6],f=s[7],g=0;g<Ss;g++){if(g<16)this.temp[g]=(t[g*4]&255)<<24|(t[g*4+1]&255)<<16|(t[g*4+2]&255)<<8|t[g*4+3]&255;else{var v=this.temp[g-2],y=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10;v=this.temp[g-15];var E=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3;this.temp[g]=(y+this.temp[g-7]|0)+(E+this.temp[g-16]|0)}var b=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&u^~l&d)|0)+(f+(rx[g]+this.temp[g]|0)|0)|0,w=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&n^r&a^n&a)|0;f=d,d=u,u=l,l=o+b|0,o=a,a=n,n=r,r=b+w|0}s[0]+=r,s[1]+=n,s[2]+=a,s[3]+=o,s[4]+=l,s[5]+=u,s[6]+=d,s[7]+=f},i}(),ox=function(){function i(e){this.secret=e,this.hash=new xa,this.reset()}return i.prototype.update=function(e){if(!(bl(e)||this.error))try{this.hash.update(Ln(e))}catch(t){this.error=t}},i.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},i.prototype.digest=function(){return ex(this,void 0,void 0,function(){return tx(this,function(e){return[2,this.digestSync()]})})},i.prototype.reset=function(){if(this.hash=new xa,this.secret){this.outer=new xa;var e=lx(this.secret),t=new Uint8Array(Ss);t.set(e);for(var s=0;s<Ss;s++)e[s]^=54,t[s]^=92;this.hash.update(e),this.outer.update(t);for(var s=0;s<e.byteLength;s++)e[s]=0}},i}();function lx(i){var e=Ln(i);if(e.byteLength>Ss){var t=new xa;t.update(e),e=t.digest()}var s=new Uint8Array(Ss);return s.set(e),s}var cx=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function ux(i){if(hx(i)&&typeof i.crypto.subtle=="object"){var e=i.crypto.subtle;return dx(e)}return!1}function hx(i){if(typeof i=="object"&&typeof i.crypto=="object"){var e=i.crypto.getRandomValues;return typeof e=="function"}return!1}function dx(i){return i&&cx.every(function(e){return typeof i[e]=="function"})}var np=function(){function i(e){ux(ya())?this.hash=new Zy(e):this.hash=new ox(e)}return i.prototype.update=function(e,t){this.hash.update(Ln(e))},i.prototype.digest=function(){return this.hash.digest()},i.prototype.reset=function(){this.hash.reset()},i}();const fx={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},ap={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},At={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Xt={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Mi={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class ge{static getFirstMatch(e,t){const s=t.match(e);return s&&s.length>0&&s[1]||""}static getSecondMatch(e,t){const s=t.match(e);return s&&s.length>1&&s[2]||""}static matchAndReturnConst(e,t,s){if(e.test(t))return s}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map(s=>parseInt(s,10)||0);if(t.push(0),t[0]===10)switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map(s=>parseInt(s,10)||0);if(t.push(0),!(t[0]===1&&t[1]<5)){if(t[0]===1&&t[1]<6)return"Cupcake";if(t[0]===1&&t[1]>=6)return"Donut";if(t[0]===2&&t[1]<2)return"Eclair";if(t[0]===2&&t[1]===2)return"Froyo";if(t[0]===2&&t[1]>2)return"Gingerbread";if(t[0]===3)return"Honeycomb";if(t[0]===4&&t[1]<1)return"Ice Cream Sandwich";if(t[0]===4&&t[1]<4)return"Jelly Bean";if(t[0]===4&&t[1]>=4)return"KitKat";if(t[0]===5)return"Lollipop";if(t[0]===6)return"Marshmallow";if(t[0]===7)return"Nougat";if(t[0]===8)return"Oreo";if(t[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,s=!1){const r=ge.getVersionPrecision(e),n=ge.getVersionPrecision(t);let a=Math.max(r,n),o=0;const l=ge.map([e,t],u=>{const d=a-ge.getVersionPrecision(u),f=u+new Array(d+1).join(".0");return ge.map(f.split("."),g=>new Array(20-g.length).join("0")+g).reverse()});for(s&&(o=a-Math.min(r,n)),a-=1;a>=o;){if(l[0][a]>l[1][a])return 1;if(l[0][a]===l[1][a]){if(a===o)return 0;a-=1}else if(l[0][a]<l[1][a])return-1}}static map(e,t){const s=[];let r;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)s.push(t(e[r]));return s}static find(e,t){let s,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(s=0,r=e.length;s<r;s+=1){const n=e[s];if(t(n,s))return n}}static assign(e,...t){const s=e;let r,n;if(Object.assign)return Object.assign(e,...t);for(r=0,n=t.length;r<n;r+=1){const a=t[r];typeof a=="object"&&a!==null&&Object.keys(a).forEach(l=>{s[l]=a[l]})}return e}static getBrowserAlias(e){return fx[e]}static getBrowserTypeByAlias(e){return ap[e]||""}}const mt=/version\/(\d+(\.?_?\d+)+)/i,px=[{test:[/googlebot/i],describe(i){const e={name:"Googlebot"},t=ge.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/opera/i],describe(i){const e={name:"Opera"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/opr\/|opios/i],describe(i){const e={name:"Opera"},t=ge.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/SamsungBrowser/i],describe(i){const e={name:"Samsung Internet for Android"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/Whale/i],describe(i){const e={name:"NAVER Whale Browser"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/MZBrowser/i],describe(i){const e={name:"MZ Browser"},t=ge.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/focus/i],describe(i){const e={name:"Focus"},t=ge.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/swing/i],describe(i){const e={name:"Swing"},t=ge.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/coast/i],describe(i){const e={name:"Opera Coast"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(i){const e={name:"Opera Touch"},t=ge.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/yabrowser/i],describe(i){const e={name:"Yandex Browser"},t=ge.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/ucbrowser/i],describe(i){const e={name:"UC Browser"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/Maxthon|mxios/i],describe(i){const e={name:"Maxthon"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/epiphany/i],describe(i){const e={name:"Epiphany"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/puffin/i],describe(i){const e={name:"Puffin"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/sleipnir/i],describe(i){const e={name:"Sleipnir"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/k-meleon/i],describe(i){const e={name:"K-Meleon"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/micromessenger/i],describe(i){const e={name:"WeChat"},t=ge.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/qqbrowser/i],describe(i){const e={name:/qqbrowserlite/i.test(i)?"QQ Browser Lite":"QQ Browser"},t=ge.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/msie|trident/i],describe(i){const e={name:"Internet Explorer"},t=ge.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/\sedg\//i],describe(i){const e={name:"Microsoft Edge"},t=ge.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/edg([ea]|ios)/i],describe(i){const e={name:"Microsoft Edge"},t=ge.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/vivaldi/i],describe(i){const e={name:"Vivaldi"},t=ge.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/seamonkey/i],describe(i){const e={name:"SeaMonkey"},t=ge.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/sailfish/i],describe(i){const e={name:"Sailfish"},t=ge.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,i);return t&&(e.version=t),e}},{test:[/silk/i],describe(i){const e={name:"Amazon Silk"},t=ge.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/phantom/i],describe(i){const e={name:"PhantomJS"},t=ge.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/slimerjs/i],describe(i){const e={name:"SlimerJS"},t=ge.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(i){const e={name:"BlackBerry"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/(web|hpw)[o0]s/i],describe(i){const e={name:"WebOS Browser"},t=ge.getFirstMatch(mt,i)||ge.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/bada/i],describe(i){const e={name:"Bada"},t=ge.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/tizen/i],describe(i){const e={name:"Tizen"},t=ge.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/qupzilla/i],describe(i){const e={name:"QupZilla"},t=ge.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/firefox|iceweasel|fxios/i],describe(i){const e={name:"Firefox"},t=ge.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/electron/i],describe(i){const e={name:"Electron"},t=ge.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/MiuiBrowser/i],describe(i){const e={name:"Miui"},t=ge.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/chromium/i],describe(i){const e={name:"Chromium"},t=ge.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,i)||ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/chrome|crios|crmo/i],describe(i){const e={name:"Chrome"},t=ge.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/GSA/i],describe(i){const e={name:"Google Search"},t=ge.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test(i){const e=!i.test(/like android/i),t=i.test(/android/i);return e&&t},describe(i){const e={name:"Android Browser"},t=ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/playstation 4/i],describe(i){const e={name:"PlayStation 4"},t=ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/safari|applewebkit/i],describe(i){const e={name:"Safari"},t=ge.getFirstMatch(mt,i);return t&&(e.version=t),e}},{test:[/.*/i],describe(i){const e=/^(.*)\/(.*) /,t=/^(.*)\/(.*)[ \t]\((.*)/,r=i.search("\\(")!==-1?t:e;return{name:ge.getFirstMatch(r,i),version:ge.getSecondMatch(r,i)}}}],gx=[{test:[/Roku\/DVP/],describe(i){const e=ge.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,i);return{name:Xt.Roku,version:e}}},{test:[/windows phone/i],describe(i){const e=ge.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,i);return{name:Xt.WindowsPhone,version:e}}},{test:[/windows /i],describe(i){const e=ge.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,i),t=ge.getWindowsVersionName(e);return{name:Xt.Windows,version:e,versionName:t}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(i){const e={name:Xt.iOS},t=ge.getSecondMatch(/(Version\/)(\d[\d.]+)/,i);return t&&(e.version=t),e}},{test:[/macintosh/i],describe(i){const e=ge.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,i).replace(/[_\s]/g,"."),t=ge.getMacOSVersionName(e),s={name:Xt.MacOS,version:e};return t&&(s.versionName=t),s}},{test:[/(ipod|iphone|ipad)/i],describe(i){const e=ge.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,i).replace(/[_\s]/g,".");return{name:Xt.iOS,version:e}}},{test(i){const e=!i.test(/like android/i),t=i.test(/android/i);return e&&t},describe(i){const e=ge.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,i),t=ge.getAndroidVersionName(e),s={name:Xt.Android,version:e};return t&&(s.versionName=t),s}},{test:[/(web|hpw)[o0]s/i],describe(i){const e=ge.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,i),t={name:Xt.WebOS};return e&&e.length&&(t.version=e),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(i){const e=ge.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,i)||ge.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,i)||ge.getFirstMatch(/\bbb(\d+)/i,i);return{name:Xt.BlackBerry,version:e}}},{test:[/bada/i],describe(i){const e=ge.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,i);return{name:Xt.Bada,version:e}}},{test:[/tizen/i],describe(i){const e=ge.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,i);return{name:Xt.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Xt.Linux}}},{test:[/CrOS/],describe(){return{name:Xt.ChromeOS}}},{test:[/PlayStation 4/],describe(i){const e=ge.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,i);return{name:Xt.PlayStation4,version:e}}}],mx=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(i){const e=ge.getFirstMatch(/(can-l01)/i,i)&&"Nova",t={type:At.mobile,vendor:"Huawei"};return e&&(t.model=e),t}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:At.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:At.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:At.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:At.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:At.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:At.tablet}}},{test(i){const e=i.test(/ipod|iphone/i),t=i.test(/like (ipod|iphone)/i);return e&&!t},describe(i){const e=ge.getFirstMatch(/(ipod|iphone)/i,i);return{type:At.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:At.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:At.mobile}}},{test(i){return i.getBrowserName(!0)==="blackberry"},describe(){return{type:At.mobile,vendor:"BlackBerry"}}},{test(i){return i.getBrowserName(!0)==="bada"},describe(){return{type:At.mobile}}},{test(i){return i.getBrowserName()==="windows phone"},describe(){return{type:At.mobile,vendor:"Microsoft"}}},{test(i){const e=Number(String(i.getOSVersion()).split(".")[0]);return i.getOSName(!0)==="android"&&e>=3},describe(){return{type:At.tablet}}},{test(i){return i.getOSName(!0)==="android"},describe(){return{type:At.mobile}}},{test(i){return i.getOSName(!0)==="macos"},describe(){return{type:At.desktop,vendor:"Apple"}}},{test(i){return i.getOSName(!0)==="windows"},describe(){return{type:At.desktop}}},{test(i){return i.getOSName(!0)==="linux"},describe(){return{type:At.desktop}}},{test(i){return i.getOSName(!0)==="playstation 4"},describe(){return{type:At.tv}}},{test(i){return i.getOSName(!0)==="roku"},describe(){return{type:At.tv}}}],vx=[{test(i){return i.getBrowserName(!0)==="microsoft edge"},describe(i){if(/\sedg\//i.test(i))return{name:Mi.Blink};const t=ge.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,i);return{name:Mi.EdgeHTML,version:t}}},{test:[/trident/i],describe(i){const e={name:Mi.Trident},t=ge.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test(i){return i.test(/presto/i)},describe(i){const e={name:Mi.Presto},t=ge.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test(i){const e=i.test(/gecko/i),t=i.test(/like gecko/i);return e&&!t},describe(i){const e={name:Mi.Gecko},t=ge.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Mi.Blink}}},{test:[/(apple)?webkit/i],describe(i){const e={name:Mi.WebKit},t=ge.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}}];class Hu{constructor(e,t=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},t!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=ge.find(px,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=ge.find(gx,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=ge.find(mx,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=ge.find(vx,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return ge.assign({},this.parsedResult)}satisfies(e){const t={};let s=0;const r={};let n=0;if(Object.keys(e).forEach(o=>{const l=e[o];typeof l=="string"?(r[o]=l,n+=1):typeof l=="object"&&(t[o]=l,s+=1)}),s>0){const o=Object.keys(t),l=ge.find(o,d=>this.isOS(d));if(l){const d=this.satisfies(t[l]);if(d!==void 0)return d}const u=ge.find(o,d=>this.isPlatform(d));if(u){const d=this.satisfies(t[u]);if(d!==void 0)return d}}if(n>0){const o=Object.keys(r),l=ge.find(o,u=>this.isBrowser(u,!0));if(l!==void 0)return this.compareVersion(r[l])}}isBrowser(e,t=!1){const s=this.getBrowserName().toLowerCase();let r=e.toLowerCase();const n=ge.getBrowserTypeByAlias(r);return t&&n&&(r=n.toLowerCase()),r===s}compareVersion(e){let t=[0],s=e,r=!1;const n=this.getBrowserVersion();if(typeof n=="string")return e[0]===">"||e[0]==="<"?(s=e.substr(1),e[1]==="="?(r=!0,s=e.substr(2)):t=[],e[0]===">"?t.push(1):t.push(-1)):e[0]==="="?s=e.substr(1):e[0]==="~"&&(r=!0,s=e.substr(1)),t.indexOf(ge.compareVersions(n,s,r))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(t=>this.is(t))}}/*!
|
|
41
41
|
* Bowser - a browser detector
|
|
42
42
|
* https://github.com/lancedikson/bowser
|
|
43
43
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
44
44
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
45
|
-
*/class op{static getParser(e,t=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Hu(e,t)}static parse(e){return new Hu(e).getResult()}static get BROWSER_MAP(){return ap}static get ENGINE_MAP(){return Mi}static get OS_MAP(){return Xt}static get PLATFORMS_MAP(){return At}}const lp=({serviceId:i,clientVersion:e})=>async()=>{var r,n,a,o,l;const t=typeof window<"u"&&((r=window==null?void 0:window.navigator)!=null&&r.userAgent)?op.parse(window.navigator.userAgent):void 0,s=[["aws-sdk-js",e],["ua","2.0"],[`os/${((n=t==null?void 0:t.os)==null?void 0:n.name)||"other"}`,(a=t==null?void 0:t.os)==null?void 0:a.version],["lang/js"],["md/browser",`${((o=t==null?void 0:t.browser)==null?void 0:o.name)??"unknown"}_${((l=t==null?void 0:t.browser)==null?void 0:l.version)??"unknown"}`]];return i&&s.push([`api/${i}`,e]),s};var cp=function(){function i(){this.checksum=4294967295}return i.prototype.update=function(e){var t,s;try{for(var r=sx(e),n=r.next();!n.done;n=r.next()){var a=n.value;this.checksum=this.checksum>>>8^xx[(this.checksum^a)&255]}}catch(o){t={error:o}}finally{try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(t)throw t.error}}return this},i.prototype.digest=function(){return(this.checksum^4294967295)>>>0},i}(),yx=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],xx=Xy(yx);class mn{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let s=7,r=Math.abs(Math.round(e));s>-1&&r>0;s--,r/=256)t[s]=r;return e<0&&ju(t),new mn(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&ju(e),parseInt(hs(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function ju(i){for(let e=0;e<8;e++)i[e]^=255;for(let e=7;e>-1&&(i[e]++,i[e]===0);e--);}class Sx{constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){const t=[];for(const n of Object.keys(e)){const a=this.fromUtf8(n);t.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[n]))}const s=new Uint8Array(t.reduce((n,a)=>n+a.byteLength,0));let r=0;for(const n of t)s.set(n,r),r+=n.byteLength;return s}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const s=new DataView(new ArrayBuffer(5));return s.setUint8(0,4),s.setInt32(1,e.value,!1),new Uint8Array(s.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const a=new Uint8Array(n.buffer);return a.set(e.value,3),a;case"string":const o=this.fromUtf8(e.value),l=new DataView(new ArrayBuffer(3+o.byteLength));l.setUint8(0,7),l.setUint16(1,o.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(o,3),u;case"timestamp":const d=new Uint8Array(9);return d[0]=8,d.set(mn.fromNumber(e.value.valueOf()).bytes,1),d;case"uuid":if(!_x.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const f=new Uint8Array(17);return f[0]=9,f.set(Mf(e.value.replace(/\-/g,"")),1),f}}parse(e){const t={};let s=0;for(;s<e.byteLength;){const r=e.getUint8(s++),n=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+s,r));switch(s+=r,e.getUint8(s++)){case 0:t[n]={type:zu,value:!0};break;case 1:t[n]={type:zu,value:!1};break;case 2:t[n]={type:Ex,value:e.getInt8(s++)};break;case 3:t[n]={type:bx,value:e.getInt16(s,!1)},s+=2;break;case 4:t[n]={type:Tx,value:e.getInt32(s,!1)},s+=4;break;case 5:t[n]={type:wx,value:new mn(new Uint8Array(e.buffer,e.byteOffset+s,8))},s+=8;break;case 6:const a=e.getUint16(s,!1);s+=2,t[n]={type:Ax,value:new Uint8Array(e.buffer,e.byteOffset+s,a)},s+=a;break;case 7:const o=e.getUint16(s,!1);s+=2,t[n]={type:Lx,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+s,o))},s+=o;break;case 8:t[n]={type:Cx,value:new Date(new mn(new Uint8Array(e.buffer,e.byteOffset+s,8)).valueOf())},s+=8;break;case 9:const l=new Uint8Array(e.buffer,e.byteOffset+s,16);s+=16,t[n]={type:Rx,value:`${hs(l.subarray(0,4))}-${hs(l.subarray(4,6))}-${hs(l.subarray(6,8))}-${hs(l.subarray(8,10))}-${hs(l.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}}var Ku;(function(i){i[i.boolTrue=0]="boolTrue",i[i.boolFalse=1]="boolFalse",i[i.byte=2]="byte",i[i.short=3]="short",i[i.integer=4]="integer",i[i.long=5]="long",i[i.byteArray=6]="byteArray",i[i.string=7]="string",i[i.timestamp=8]="timestamp",i[i.uuid=9]="uuid"})(Ku||(Ku={}));const zu="boolean",Ex="byte",bx="short",Tx="integer",wx="long",Ax="binary",Lx="string",Cx="timestamp",Rx="uuid",_x=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,up=4,Fi=up*2,Xi=4,Ix=Fi+Xi*2;function kx({byteLength:i,byteOffset:e,buffer:t}){if(i<Ix)throw new Error("Provided message too short to accommodate event stream message overhead");const s=new DataView(t,e,i),r=s.getUint32(0,!1);if(i!==r)throw new Error("Reported message length does not match received message length");const n=s.getUint32(up,!1),a=s.getUint32(Fi,!1),o=s.getUint32(i-Xi,!1),l=new cp().update(new Uint8Array(t,e,Fi));if(a!==l.digest())throw new Error(`The prelude checksum specified in the message (${a}) does not match the calculated CRC32 checksum (${l.digest()})`);if(l.update(new Uint8Array(t,e+Fi,i-(Fi+Xi))),o!==l.digest())throw new Error(`The message checksum (${l.digest()}) did not match the expected value of ${o}`);return{headers:new DataView(t,e+Fi+Xi,n),body:new Uint8Array(t,e+Fi+Xi+n,r-n-(Fi+Xi+Xi))}}class Px{constructor(e,t){this.headerMarshaller=new Sx(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){const s=this.headerMarshaller.format(e),r=s.byteLength+t.byteLength+16,n=new Uint8Array(r),a=new DataView(n.buffer,n.byteOffset,n.byteLength),o=new cp;return a.setUint32(0,r,!1),a.setUint32(4,s.byteLength,!1),a.setUint32(8,o.update(n.subarray(0,8)).digest(),!1),n.set(s,12),n.set(t,s.byteLength+12),a.setUint32(r-4,o.update(n.subarray(8,r-4)).digest(),!1),n}decode(e){const{headers:t,body:s}=kx(e);return{headers:this.headerMarshaller.parse(t),body:s}}formatHeaders(e){return this.headerMarshaller.format(e)}}class Dx{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream)yield this.options.decoder.decode(e)}}class Mx{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}}class Fx{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=await this.options.deserializer(e);t!==void 0&&(yield t)}}}class Ox{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream)yield this.options.serializer(e)}}function Nx(i){let e=0,t=0,s=null,r=null;const n=o=>{if(typeof o!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+o);e=o,t=4,s=new Uint8Array(o),new DataView(s.buffer).setUint32(0,o,!1)},a=async function*(){const o=i[Symbol.asyncIterator]();for(;;){const{value:l,done:u}=await o.next();if(u){if(e)if(e===t)yield s;else throw new Error("Truncated event message received.");else return;return}const d=l.length;let f=0;for(;f<d;){if(!s){const v=d-f;r||(r=new Uint8Array(4));const y=Math.min(4-t,v);if(r.set(l.slice(f,f+y),t),t+=y,f+=y,t<4)break;n(new DataView(r.buffer).getUint32(0,!1)),r=null}const g=Math.min(e-t,d-f);s.set(l.slice(f,f+g),t),t+=g,f+=g,e&&e===t&&(yield s,s=null,e=0,t=0)}}};return{[Symbol.asyncIterator]:a}}function Bx(i,e){return async function(t){const{value:s}=t.headers[":message-type"];if(s==="error"){const r=new Error(t.headers[":error-message"].value||"UnknownError");throw r.name=t.headers[":error-code"].value,r}else if(s==="exception"){const r=t.headers[":exception-type"].value,n={[r]:t},a=await i(n);if(a.$unknown){const o=new Error(e(t.body));throw o.name=r,o}throw a[r]}else if(s==="event"){const r={[t.headers[":event-type"].value]:t},n=await i(r);return n.$unknown?void 0:n}else throw Error(`Unrecognizable event type: ${t.headers[":event-type"].value}`)}}let $x=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new Px(e,t),this.utfEncoder=e}deserialize(e,t){const s=Nx(e);return new Fx({messageStream:new Dx({inputStream:s,decoder:this.eventStreamCodec}),deserializer:Bx(t,this.utfEncoder)})}serialize(e,t){return new Mx({messageStream:new Ox({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};const Ux=i=>({[Symbol.asyncIterator]:async function*(){const e=i.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)return;yield s}}finally{e.releaseLock()}}}),Gx=i=>{const e=i[Symbol.asyncIterator]();return new ReadableStream({async pull(t){const{done:s,value:r}=await e.next();if(s)return t.close();t.enqueue(r)}})};class Vx{constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new $x({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){const s=Hx(e)?Ux(e):e;return this.universalMarshaller.deserialize(s,t)}serialize(e,t){const s=this.universalMarshaller.serialize(e,t);return typeof ReadableStream=="function"?Gx(s):s}}const Hx=i=>typeof ReadableStream=="function"&&i instanceof ReadableStream,jx=i=>new Vx(i),hp=i=>()=>Promise.reject(i),Wu=typeof TextEncoder=="function"?new TextEncoder:null,dp=i=>{if(typeof i=="string"){if(Wu)return Wu.encode(i).byteLength;let e=i.length;for(let t=e-1;t>=0;t--){const s=i.charCodeAt(t);s>127&&s<=2047?e++:s>2047&&s<=65535&&(e+=2),s>=56320&&s<=57343&&t--}return e}else{if(typeof i.byteLength=="number")return i.byteLength;if(typeof i.size=="number")return i.size}throw new Error(`Body Length computation failed for ${i}`)},fp="required",Oe="type",ct="rules",ot="conditions",We="fn",qe="argv",pt="ref",vn="assign",Ks="url",zs="properties",Ws="headers",Kx=!0,sr="isSet",Ji="stringEquals",ko="aws.parseArn",Zi="arn",Qt="booleanEquals",is="endpoint",ut="tree",ft="error",Tr={[fp]:!1,[Oe]:"String"},qu={[fp]:!0,default:!1,[Oe]:"Boolean"},Po={[We]:"not",[qe]:[{[We]:sr,[qe]:[{[pt]:"Endpoint"}]}]},pp={[pt]:"Endpoint"},Jn={[We]:sr,[qe]:[{[pt]:"Region"}]},Zn={[We]:"aws.partition",[qe]:[{[pt]:"Region"}],[vn]:"PartitionResult"},Do={[We]:"not",[qe]:[{[We]:Ji,[qe]:[{[We]:"getAttr",[qe]:[{[pt]:"PartitionResult"},"name"]},"aws-iso"]}]},ec={[We]:"getAttr",[qe]:[{[pt]:"PartitionResult"},"name"]},Mo={[We]:"not",[qe]:[{[We]:Ji,[qe]:[ec,"aws-iso-b"]}]},Pa={[We]:"getAttr",[qe]:[{[pt]:"PartitionResult"},"supportsFIPS"]},ys={},gp={[ft]:"FIPS is enabled but this partition does not support FIPS",[Oe]:ft},mp={[ft]:"DualStack is enabled but this partition does not support DualStack",[Oe]:ft},Fo={[ft]:"Invalid ARN: Failed to parse ARN.",[Oe]:ft},Yu={[We]:Qt,[qe]:[!0,{[We]:"getAttr",[qe]:[{[pt]:"PartitionResult"},"supportsDualStack"]}]},Xu=[{[pt]:"StreamARN"}],zx=[{[We]:sr,[qe]:[pp]}],Oo=[{[ot]:[{[We]:"isValidHostLabel",[qe]:[{[We]:"getAttr",[qe]:[{[pt]:Zi},"accountId"]},!1]}],[ct]:[{[ot]:[{[We]:"isValidHostLabel",[qe]:[{[We]:"getAttr",[qe]:[{[pt]:Zi},"region"]},!1]}],[ct]:[{[ot]:[{[We]:Ji,[qe]:[{[We]:"getAttr",[qe]:[{[pt]:Zi},"service"]},"kinesis"]}],[ct]:[{[ot]:[{[We]:"getAttr",[qe]:[{[pt]:Zi},"resourceId[0]"],[vn]:"arnType"},{[We]:"not",[qe]:[{[We]:Ji,[qe]:[{[pt]:"arnType"},""]}]}],[ct]:[{[ot]:[{[We]:Ji,[qe]:[{[pt]:"arnType"},"stream"]}],[ct]:[{[ot]:[{[We]:Ji,[qe]:[ec,"{arn#partition}"]}],[ct]:[{[ot]:[{[We]:sr,[qe]:[{[pt]:"OperationType"}]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[{[pt]:"UseFIPS"},!0]},{[We]:Qt,[qe]:[{[pt]:"UseDualStack"},!0]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[Pa,!0]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[{[We]:"getAttr",[qe]:[{[pt]:"PartitionResult"},"supportsDualStack"]},!0]}],[ct]:[{[is]:{[Ks]:"https://{arn#accountId}.{OperationType}-kinesis-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[zs]:{},[Ws]:{}},[Oe]:is}],[Oe]:ut},{[ft]:"DualStack is enabled, but this partition does not support DualStack.",[Oe]:ft}],[Oe]:ut},{[ft]:"FIPS is enabled, but this partition does not support FIPS.",[Oe]:ft}],[Oe]:ut},{[ot]:[{[We]:Qt,[qe]:[{[pt]:"UseFIPS"},!0]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[Pa,!0]}],[ct]:[{[is]:{[Ks]:"https://{arn#accountId}.{OperationType}-kinesis-fips.{Region}.{PartitionResult#dnsSuffix}",[zs]:{},[Ws]:{}},[Oe]:is}],[Oe]:ut},gp],[Oe]:ut},{[ot]:[{[We]:Qt,[qe]:[{[pt]:"UseDualStack"},!0]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[{[We]:"getAttr",[qe]:[{[pt]:"PartitionResult"},"supportsDualStack"]},!0]}],[ct]:[{[is]:{[Ks]:"https://{arn#accountId}.{OperationType}-kinesis.{Region}.{PartitionResult#dualStackDnsSuffix}",[zs]:{},[Ws]:{}},[Oe]:is}],[Oe]:ut},mp],[Oe]:ut},{[is]:{[Ks]:"https://{arn#accountId}.{OperationType}-kinesis.{Region}.{PartitionResult#dnsSuffix}",[zs]:{},[Ws]:{}},[Oe]:is}],[Oe]:ut},{[ft]:"Operation Type is not set. Please contact service team for resolution.",[Oe]:ft}],[Oe]:ut},{[ft]:"Partition: {arn#partition} from ARN doesn't match with partition name: {PartitionResult#name}.",[Oe]:ft}],[Oe]:ut},{[ft]:"Invalid ARN: Kinesis ARNs don't support `{arnType}` arn types.",[Oe]:ft}],[Oe]:ut},{[ft]:"Invalid ARN: No ARN type specified",[Oe]:ft}],[Oe]:ut},{[ft]:"Invalid ARN: The ARN was not for the Kinesis service, found: {arn#service}.",[Oe]:ft}],[Oe]:ut},{[ft]:"Invalid ARN: Invalid region.",[Oe]:ft}],[Oe]:ut},{[ft]:"Invalid ARN: Invalid account id.",[Oe]:ft}],Wx=[{[We]:Qt,[qe]:[{[pt]:"UseFIPS"},!0]},{[We]:Qt,[qe]:[{[pt]:"UseDualStack"},!0]}],qx=[{[We]:Qt,[qe]:[Pa,!0]}],Qu=[{[We]:Qt,[qe]:[{[pt]:"UseFIPS"},!0]}],Ju=[{[We]:Qt,[qe]:[{[pt]:"UseDualStack"},!0]}],Zu=[{[pt]:"ConsumerARN"}],eh=[{[pt]:"ResourceARN"}],Yx={version:"1.0",parameters:{Region:Tr,UseDualStack:qu,UseFIPS:qu,Endpoint:Tr,StreamARN:Tr,OperationType:Tr,ConsumerARN:Tr,ResourceARN:Tr},[ct]:[{[ot]:[{[We]:sr,[qe]:Xu},Po,Jn,Zn,Do,Mo],[ct]:[{[ot]:[{[We]:ko,[qe]:Xu,[vn]:Zi}],[ct]:Oo,[Oe]:ut},Fo],[Oe]:ut},{[ot]:[{[We]:sr,[qe]:Zu},Po,Jn,Zn,Do,Mo],[ct]:[{[ot]:[{[We]:ko,[qe]:Zu,[vn]:Zi}],[ct]:Oo,[Oe]:ut},Fo],[Oe]:ut},{[ot]:[{[We]:sr,[qe]:eh},Po,Jn,Zn,Do,Mo],[ct]:[{[ot]:[{[We]:ko,[qe]:eh,[vn]:Zi}],[ct]:Oo,[Oe]:ut},Fo],[Oe]:ut},{[ot]:zx,[ct]:[{[ot]:Qu,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Oe]:ft},{[ot]:Ju,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Oe]:ft},{endpoint:{[Ks]:pp,[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut},{[ot]:[Jn],[ct]:[{[ot]:[Zn],[ct]:[{[ot]:Wx,[ct]:[{[ot]:[{[We]:Qt,[qe]:[Kx,Pa]},Yu],[ct]:[{endpoint:{[Ks]:"https://kinesis-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Oe]:ft}],[Oe]:ut},{[ot]:Qu,[ct]:[{[ot]:qx,[ct]:[{[ot]:[{[We]:Ji,[qe]:[ec,"aws-us-gov"]}],endpoint:{[Ks]:"https://kinesis.{Region}.amazonaws.com",[zs]:ys,[Ws]:ys},[Oe]:is},{endpoint:{[Ks]:"https://kinesis-fips.{Region}.{PartitionResult#dnsSuffix}",[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut},gp],[Oe]:ut},{[ot]:Ju,[ct]:[{[ot]:[Yu],[ct]:[{endpoint:{[Ks]:"https://kinesis.{Region}.{PartitionResult#dualStackDnsSuffix}",[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut},mp],[Oe]:ut},{endpoint:{[Ks]:"https://kinesis.{Region}.{PartitionResult#dnsSuffix}",[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut}],[Oe]:ut},{error:"Invalid Configuration: Missing Region",[Oe]:ft}]},Xx=Yx,Qx=(i,e={})=>df(Xx,{endpointParams:i,logger:e.logger});bn.aws=zl;const Jx=i=>({apiVersion:"2013-12-02",base64Decoder:(i==null?void 0:i.base64Decoder)??Za,base64Encoder:(i==null?void 0:i.base64Encoder)??Xl,disableHostPrefix:(i==null?void 0:i.disableHostPrefix)??!1,endpointProvider:(i==null?void 0:i.endpointProvider)??Qx,extensions:(i==null?void 0:i.extensions)??[],httpAuthSchemeProvider:(i==null?void 0:i.httpAuthSchemeProvider)??Ay,httpAuthSchemes:(i==null?void 0:i.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Wf}],logger:(i==null?void 0:i.logger)??new ql,serviceId:(i==null?void 0:i.serviceId)??"Kinesis",urlParser:(i==null?void 0:i.urlParser)??wn,utf8Decoder:(i==null?void 0:i.utf8Decoder)??nr,utf8Encoder:(i==null?void 0:i.utf8Encoder)??Yl}),Zx=["in-region","cross-region","mobile","standard","legacy"],vp=({defaultsMode:i}={})=>Xv(async()=>{const e=typeof i=="function"?await i():i;switch(e==null?void 0:e.toLowerCase()){case"auto":return Promise.resolve(eS()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e==null?void 0:e.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Zx.join(", ")}, got ${e}`)}}),eS=()=>{var t,s;const i=typeof window<"u"&&((t=window==null?void 0:window.navigator)!=null&&t.userAgent)?op.parse(window.navigator.userAgent):void 0,e=(s=i==null?void 0:i.platform)==null?void 0:s.type;return e==="tablet"||e==="mobile"},tS=i=>{const e=vp(i),t=()=>e().then(Of),s=Jx(i);return{...s,...i,runtime:"browser",defaultsMode:e,bodyLengthChecker:(i==null?void 0:i.bodyLengthChecker)??dp,credentialDefaultProvider:(i==null?void 0:i.credentialDefaultProvider)??(r=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(i==null?void 0:i.defaultUserAgentProvider)??lp({serviceId:s.serviceId,clientVersion:Wy.version}),eventStreamSerdeProvider:(i==null?void 0:i.eventStreamSerdeProvider)??jx,maxAttempts:(i==null?void 0:i.maxAttempts)??An,region:(i==null?void 0:i.region)??hp("Region is missing"),requestHandler:eo.create((i==null?void 0:i.requestHandler)??t),retryMode:(i==null?void 0:i.retryMode)??(async()=>(await t()).retryMode||Af),sha256:(i==null?void 0:i.sha256)??np,streamCollector:(i==null?void 0:i.streamCollector)??Pf,useDualstackEndpoint:(i==null?void 0:i.useDualstackEndpoint)??(()=>Promise.resolve(gf)),useFipsEndpoint:(i==null?void 0:i.useFipsEndpoint)??(()=>Promise.resolve(mf))}},yp=i=>{let e=async()=>{if(i.region===void 0)throw new Error("Region is missing from runtimeConfig");const t=i.region;return typeof t=="string"?t:t()};return{setRegion(t){e=t},region(){return e}}},xp=i=>({region:i.region()}),sS=i=>{const e=i.httpAuthSchemes;let t=i.httpAuthSchemeProvider,s=i.credentials;return{setHttpAuthScheme(r){const n=e.findIndex(a=>a.schemeId===r.schemeId);n===-1?e.push(r):e.splice(n,1,r)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(r){t=r},httpAuthSchemeProvider(){return t},setCredentials(r){s=r},credentials(){return s}}},iS=i=>({httpAuthSchemes:i.httpAuthSchemes(),httpAuthSchemeProvider:i.httpAuthSchemeProvider(),credentials:i.credentials()}),ea=i=>i,rS=(i,e)=>{const t={...ea(yp(i)),...ea(Nf(i)),...ea(Jd(i)),...ea(sS(i))};return e.forEach(s=>s.configure(t)),{...i,...xp(t),...Bf(t),...Zd(t),...iS(t)}};class nS extends kf{constructor(...[e]){const t=tS(e||{}),s=Cy(t),r=rf(s),n=If(r),a=yf(n),o=a,l=Tf(o),u=Kv(l),d=Ly(u),f=rS(d,(e==null?void 0:e.extensions)||[]);super(f),this.config=f,this.middlewareStack.use(pf(this.config)),this.middlewareStack.use(Gf(this.config)),this.middlewareStack.use(Kf(this.config)),this.middlewareStack.use(ef(this.config)),this.middlewareStack.use(tf(this.config)),this.middlewareStack.use(sf(this.config)),this.middlewareStack.use(wf(this.config,{httpAuthSchemeParametersProvider:Ty,identityProviderConfigProvider:async g=>new Hf({"aws.auth#sigv4":g.credentials})})),this.middlewareStack.use(Vf(this.config))}destroy(){super.destroy()}}class Bt extends to{constructor(e){super(e),Object.setPrototypeOf(this,Bt.prototype)}}class tc extends Bt{constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,tc.prototype)}}class sc extends Bt{constructor(e){super({name:"InvalidArgumentException",$fault:"client",...e}),this.name="InvalidArgumentException",this.$fault="client",Object.setPrototypeOf(this,sc.prototype)}}class ic extends Bt{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ic.prototype)}}class rc extends Bt{constructor(e){super({name:"ResourceInUseException",$fault:"client",...e}),this.name="ResourceInUseException",this.$fault="client",Object.setPrototypeOf(this,rc.prototype)}}class nc extends Bt{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,nc.prototype)}}class ac extends Bt{constructor(e){super({name:"ExpiredIteratorException",$fault:"client",...e}),this.name="ExpiredIteratorException",this.$fault="client",Object.setPrototypeOf(this,ac.prototype)}}class oc extends Bt{constructor(e){super({name:"ExpiredNextTokenException",$fault:"client",...e}),this.name="ExpiredNextTokenException",this.$fault="client",Object.setPrototypeOf(this,oc.prototype)}}class lc extends Bt{constructor(e){super({name:"KMSAccessDeniedException",$fault:"client",...e}),this.name="KMSAccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,lc.prototype)}}class cc extends Bt{constructor(e){super({name:"KMSDisabledException",$fault:"client",...e}),this.name="KMSDisabledException",this.$fault="client",Object.setPrototypeOf(this,cc.prototype)}}class uc extends Bt{constructor(e){super({name:"KMSInvalidStateException",$fault:"client",...e}),this.name="KMSInvalidStateException",this.$fault="client",Object.setPrototypeOf(this,uc.prototype)}}class hc extends Bt{constructor(e){super({name:"KMSNotFoundException",$fault:"client",...e}),this.name="KMSNotFoundException",this.$fault="client",Object.setPrototypeOf(this,hc.prototype)}}class dc extends Bt{constructor(e){super({name:"KMSOptInRequired",$fault:"client",...e}),this.name="KMSOptInRequired",this.$fault="client",Object.setPrototypeOf(this,dc.prototype)}}class fc extends Bt{constructor(e){super({name:"KMSThrottlingException",$fault:"client",...e}),this.name="KMSThrottlingException",this.$fault="client",Object.setPrototypeOf(this,fc.prototype)}}class pc extends Bt{constructor(e){super({name:"ProvisionedThroughputExceededException",$fault:"client",...e}),this.name="ProvisionedThroughputExceededException",this.$fault="client",Object.setPrototypeOf(this,pc.prototype)}}class gc extends Bt{constructor(e){super({name:"ValidationException",$fault:"client",...e}),this.name="ValidationException",this.$fault="client",Object.setPrototypeOf(this,gc.prototype)}}var th;(function(i){i.visit=(e,t)=>e.SubscribeToShardEvent!==void 0?t.SubscribeToShardEvent(e.SubscribeToShardEvent):e.ResourceNotFoundException!==void 0?t.ResourceNotFoundException(e.ResourceNotFoundException):e.ResourceInUseException!==void 0?t.ResourceInUseException(e.ResourceInUseException):e.KMSDisabledException!==void 0?t.KMSDisabledException(e.KMSDisabledException):e.KMSInvalidStateException!==void 0?t.KMSInvalidStateException(e.KMSInvalidStateException):e.KMSAccessDeniedException!==void 0?t.KMSAccessDeniedException(e.KMSAccessDeniedException):e.KMSNotFoundException!==void 0?t.KMSNotFoundException(e.KMSNotFoundException):e.KMSOptInRequired!==void 0?t.KMSOptInRequired(e.KMSOptInRequired):e.KMSThrottlingException!==void 0?t.KMSThrottlingException(e.KMSThrottlingException):e.InternalFailureException!==void 0?t.InternalFailureException(e.InternalFailureException):t._(e.$unknown[0],e.$unknown[1])})(th||(th={}));const aS=async(i,e)=>{const t=CS("PutRecord");let s;return s=JSON.stringify(wS(i,e)),LS(e,t,"/",void 0,s)},oS=async(i,e)=>{if(i.statusCode>=300)return lS(i,e);const t=await Zl(i.body,e);let s={};return s=kt(t),{$metadata:qt(i),...s}},lS=async(i,e)=>{const t={...i,body:await sp(i.body,e)},s=ip(i,t.body);switch(s){case"AccessDeniedException":case"com.amazonaws.kinesis#AccessDeniedException":throw await cS(t);case"InvalidArgumentException":case"com.amazonaws.kinesis#InvalidArgumentException":throw await dS(t);case"LimitExceededException":case"com.amazonaws.kinesis#LimitExceededException":throw await xS(t);case"ResourceInUseException":case"com.amazonaws.kinesis#ResourceInUseException":throw await ES(t);case"ResourceNotFoundException":case"com.amazonaws.kinesis#ResourceNotFoundException":throw await bS(t);case"ExpiredIteratorException":case"com.amazonaws.kinesis#ExpiredIteratorException":throw await uS(t);case"KMSAccessDeniedException":case"com.amazonaws.kinesis#KMSAccessDeniedException":throw await fS(t);case"KMSDisabledException":case"com.amazonaws.kinesis#KMSDisabledException":throw await pS(t);case"KMSInvalidStateException":case"com.amazonaws.kinesis#KMSInvalidStateException":throw await gS(t);case"KMSNotFoundException":case"com.amazonaws.kinesis#KMSNotFoundException":throw await mS(t);case"KMSOptInRequired":case"com.amazonaws.kinesis#KMSOptInRequired":throw await vS(t);case"KMSThrottlingException":case"com.amazonaws.kinesis#KMSThrottlingException":throw await yS(t);case"ProvisionedThroughputExceededException":case"com.amazonaws.kinesis#ProvisionedThroughputExceededException":throw await SS(t);case"ExpiredNextTokenException":case"com.amazonaws.kinesis#ExpiredNextTokenException":throw await hS(t);case"ValidationException":case"com.amazonaws.kinesis#ValidationException":throw await TS(t);default:const r=t.body;return AS({output:i,parsedBody:r,errorCode:s})}},cS=async(i,e)=>{const t=i.body,s=kt(t),r=new tc({$metadata:qt(i),...s});return jt(r,t)},uS=async(i,e)=>{const t=i.body,s=kt(t),r=new ac({$metadata:qt(i),...s});return jt(r,t)},hS=async(i,e)=>{const t=i.body,s=kt(t),r=new oc({$metadata:qt(i),...s});return jt(r,t)},dS=async(i,e)=>{const t=i.body,s=kt(t),r=new sc({$metadata:qt(i),...s});return jt(r,t)},fS=async(i,e)=>{const t=i.body,s=kt(t),r=new lc({$metadata:qt(i),...s});return jt(r,t)},pS=async(i,e)=>{const t=i.body,s=kt(t),r=new cc({$metadata:qt(i),...s});return jt(r,t)},gS=async(i,e)=>{const t=i.body,s=kt(t),r=new uc({$metadata:qt(i),...s});return jt(r,t)},mS=async(i,e)=>{const t=i.body,s=kt(t),r=new hc({$metadata:qt(i),...s});return jt(r,t)},vS=async(i,e)=>{const t=i.body,s=kt(t),r=new dc({$metadata:qt(i),...s});return jt(r,t)},yS=async(i,e)=>{const t=i.body,s=kt(t),r=new fc({$metadata:qt(i),...s});return jt(r,t)},xS=async(i,e)=>{const t=i.body,s=kt(t),r=new ic({$metadata:qt(i),...s});return jt(r,t)},SS=async(i,e)=>{const t=i.body,s=kt(t),r=new pc({$metadata:qt(i),...s});return jt(r,t)},ES=async(i,e)=>{const t=i.body,s=kt(t),r=new rc({$metadata:qt(i),...s});return jt(r,t)},bS=async(i,e)=>{const t=i.body,s=kt(t),r=new nc({$metadata:qt(i),...s});return jt(r,t)},TS=async(i,e)=>{const t=i.body,s=kt(t),r=new gc({$metadata:qt(i),...s});return jt(r,t)},wS=(i,e)=>$f(i,{Data:e.base64Encoder,ExplicitHashKey:[],PartitionKey:[],SequenceNumberForOrdering:[],StreamARN:[],StreamName:[]}),qt=i=>({httpStatusCode:i.statusCode,requestId:i.headers["x-amzn-requestid"]??i.headers["x-amzn-request-id"]??i.headers["x-amz-request-id"],extendedRequestId:i.headers["x-amz-id-2"],cfId:i.headers["x-amz-cf-id"]}),AS=Ff(Bt),LS=async(i,e,t,s,r)=>{const{hostname:n,protocol:a="https",port:o,path:l}=await i.endpoint(),u={protocol:a,hostname:n,port:o,method:"POST",path:l.endsWith("/")?l.slice(0,-1)+t:l+t,headers:e};return r!==void 0&&(u.body=r),new ns(u)};function CS(i){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`Kinesis_20131202.${i}`}}class RS extends Ql.classBuilder().ep({...Ry,OperationType:{type:"staticContextParams",value:"data"},StreamARN:{type:"contextParams",name:"StreamARN"}}).m(function(e,t,s,r){return[Sf(s,this.serialize,this.deserialize),bf(s,e.getEndpointParameterInstructions())]}).s("Kinesis_20131202","PutRecord",{}).n("KinesisClient","PutRecordCommand").f(void 0,void 0).ser(aS).de(oS).build(){}function Sp(i){return Promise.all(Object.keys(i).reduce((e,t)=>{const s=i[t];return typeof s=="string"?e.push([t,s]):e.push(s().then(r=>[t,r])),e},[])).then(e=>e.reduce((t,[s,r])=>(t[s]=r,t),{}))}function _S(i){return async()=>{var o,l,u;(o=i.logger)==null||o.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");const{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:t}=await Promise.resolve().then(()=>require("./DP9VDW2W.cjs.js")),{Credentials:{AccessKeyId:s=IS(i.logger),Expiration:r,SecretKey:n=PS(i.logger),SessionToken:a}=kS(i.logger)}=await(i.client??new t(Object.assign({},i.clientConfig??{},{region:((l=i.clientConfig)==null?void 0:l.region)??((u=i.parentClientConfig)==null?void 0:u.region)}))).send(new e({CustomRoleArn:i.customRoleArn,IdentityId:i.identityId,Logins:i.logins?await Sp(i.logins):void 0}));return{identityId:i.identityId,accessKeyId:s,secretAccessKey:n,sessionToken:a,expiration:r}}}function IS(i){throw new Hr("Response from Amazon Cognito contained no access key ID",{logger:i})}function kS(i){throw new Hr("Response from Amazon Cognito contained no credentials",{logger:i})}function PS(i){throw new Hr("Response from Amazon Cognito contained no secret key",{logger:i})}const No="IdentityIds";class DS{constructor(e="aws:cognito-identity-ids"){this.dbName=e}getItem(e){return this.withObjectStore("readonly",t=>{const s=t.get(e);return new Promise(r=>{s.onerror=()=>r(null),s.onsuccess=()=>r(s.result?s.result.value:null)})}).catch(()=>null)}removeItem(e){return this.withObjectStore("readwrite",t=>{const s=t.delete(e);return new Promise((r,n)=>{s.onerror=()=>n(s.error),s.onsuccess=()=>r()})})}setItem(e,t){return this.withObjectStore("readwrite",s=>{const r=s.put({id:e,value:t});return new Promise((n,a)=>{r.onerror=()=>a(r.error),r.onsuccess=()=>n()})})}getDb(){const e=self.indexedDB.open(this.dbName,1);return new Promise((t,s)=>{e.onsuccess=()=>{t(e.result)},e.onerror=()=>{s(e.error)},e.onblocked=()=>{s(new Error("Unable to access DB"))},e.onupgradeneeded=()=>{const r=e.result;r.onerror=()=>{s(new Error("Failed to create object store"))},r.createObjectStore(No,{keyPath:"id"})}})}withObjectStore(e,t){return this.getDb().then(s=>{const r=s.transaction(No,e);return r.oncomplete=()=>s.close(),new Promise((n,a)=>{r.onerror=()=>a(r.error),n(t(r.objectStore(No)))}).catch(n=>{throw s.close(),n})})}}class MS{constructor(e={}){this.store=e}getItem(e){return e in this.store?this.store[e]:null}removeItem(e){delete this.store[e]}setItem(e,t){this.store[e]=t}}const FS=new MS;function OS(){return typeof self=="object"&&self.indexedDB?new DS:typeof window=="object"&&window.localStorage?window.localStorage:FS}function NS({accountId:i,cache:e=OS(),client:t,clientConfig:s,customRoleArn:r,identityPoolId:n,logins:a,userIdentifier:o=!a||Object.keys(a).length===0?"ANONYMOUS":void 0,logger:l,parentClientConfig:u}){l==null||l.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");const d=o?`aws:cognito-identity-credentials:${n}:${o}`:void 0;let f=async()=>{const{GetIdCommand:g,CognitoIdentityClient:v}=await Promise.resolve().then(()=>require("./DP9VDW2W.cjs.js")),y=t??new v(Object.assign({},s??{},{region:(s==null?void 0:s.region)??(u==null?void 0:u.region)}));let E=d&&await e.getItem(d);if(!E){const{IdentityId:b=BS(l)}=await y.send(new g({AccountId:i,IdentityPoolId:n,Logins:a?await Sp(a):void 0}));E=b,d&&Promise.resolve(e.setItem(d,E)).catch(()=>{})}return f=_S({client:y,customRoleArn:r,logins:a,identityId:E}),f()};return()=>f().catch(async g=>{throw d&&Promise.resolve(e.removeItem(d)).catch(()=>{}),g})}function BS(i){throw new Hr("Response from Amazon Cognito contained no identity ID",{logger:i})}const $S=async(i,e,t)=>({operation:Dn(e).operation,region:await yi(i.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function US(i){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:i.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function ta(i){return{schemeId:"smithy.api#noAuth"}}const GS=i=>{const e=[];switch(i.operation){case"GetCredentialsForIdentity":{e.push(ta());break}case"GetId":{e.push(ta());break}case"GetOpenIdToken":{e.push(ta());break}case"UnlinkIdentity":{e.push(ta());break}default:e.push(US(i))}return e},VS=i=>({...tp(i)}),HS=i=>({...i,useDualstackEndpoint:i.useDualstackEndpoint??!1,useFipsEndpoint:i.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),jS={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},KS="@aws-sdk/client-cognito-identity",zS="AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",WS="3.637.0",qS={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo cognito-identity","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js"},YS="./dist-cjs/index.js",XS="./dist-types/index.d.ts",QS="./dist-es/index.js",JS=!1,ZS={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.637.0","@aws-sdk/client-sts":"3.637.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.637.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.637.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.637.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},e1={"@aws-sdk/client-iam":"3.637.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},t1={node:">=16.0.0"},s1={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},i1=["dist-*/**"],r1={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},n1="Apache-2.0",a1={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},o1="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity",l1={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity"},c1={name:KS,description:zS,version:WS,scripts:qS,main:YS,types:XS,module:QS,sideEffects:JS,dependencies:ZS,devDependencies:e1,engines:t1,typesVersions:s1,files:i1,author:r1,license:n1,browser:a1,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:o1,repository:l1},Ep="required",Ys="fn",Xs="argv",jr="ref",sh=!0,ih="isSet",Cn="booleanEquals",wr="error",on="endpoint",hi="tree",mc="PartitionResult",rh={[Ep]:!1,type:"String"},nh={[Ep]:!0,default:!1,type:"Boolean"},ah={[jr]:"Endpoint"},bp={[Ys]:Cn,[Xs]:[{[jr]:"UseFIPS"},!0]},Tp={[Ys]:Cn,[Xs]:[{[jr]:"UseDualStack"},!0]},Gs={},oh={[Ys]:"getAttr",[Xs]:[{[jr]:mc},"supportsFIPS"]},lh={[Ys]:Cn,[Xs]:[!0,{[Ys]:"getAttr",[Xs]:[{[jr]:mc},"supportsDualStack"]}]},ch=[bp],uh=[Tp],hh=[{[jr]:"Region"}],u1={version:"1.0",parameters:{Region:rh,UseDualStack:nh,UseFIPS:nh,Endpoint:rh},rules:[{conditions:[{[Ys]:ih,[Xs]:[ah]}],rules:[{conditions:ch,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:wr},{conditions:uh,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:wr},{endpoint:{url:ah,properties:Gs,headers:Gs},type:on}],type:hi},{conditions:[{[Ys]:ih,[Xs]:hh}],rules:[{conditions:[{[Ys]:"aws.partition",[Xs]:hh,assign:mc}],rules:[{conditions:[bp,Tp],rules:[{conditions:[{[Ys]:Cn,[Xs]:[sh,oh]},lh],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Gs,headers:Gs},type:on}],type:hi},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:wr}],type:hi},{conditions:ch,rules:[{conditions:[{[Ys]:Cn,[Xs]:[oh,sh]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Gs,headers:Gs},type:on}],type:hi},{error:"FIPS is enabled but this partition does not support FIPS",type:wr}],type:hi},{conditions:uh,rules:[{conditions:[lh],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Gs,headers:Gs},type:on}],type:hi},{error:"DualStack is enabled but this partition does not support DualStack",type:wr}],type:hi},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:Gs,headers:Gs},type:on}],type:hi}],type:hi},{error:"Invalid Configuration: Missing Region",type:wr}]},h1=u1,d1=(i,e={})=>df(h1,{endpointParams:i,logger:e.logger});bn.aws=zl;const f1=i=>({apiVersion:"2014-06-30",base64Decoder:(i==null?void 0:i.base64Decoder)??Za,base64Encoder:(i==null?void 0:i.base64Encoder)??Xl,disableHostPrefix:(i==null?void 0:i.disableHostPrefix)??!1,endpointProvider:(i==null?void 0:i.endpointProvider)??d1,extensions:(i==null?void 0:i.extensions)??[],httpAuthSchemeProvider:(i==null?void 0:i.httpAuthSchemeProvider)??GS,httpAuthSchemes:(i==null?void 0:i.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Wf},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Uv}],logger:(i==null?void 0:i.logger)??new ql,serviceId:(i==null?void 0:i.serviceId)??"Cognito Identity",urlParser:(i==null?void 0:i.urlParser)??wn,utf8Decoder:(i==null?void 0:i.utf8Decoder)??nr,utf8Encoder:(i==null?void 0:i.utf8Encoder)??Yl}),p1=i=>{const e=vp(i),t=()=>e().then(Of),s=f1(i);return{...s,...i,runtime:"browser",defaultsMode:e,bodyLengthChecker:(i==null?void 0:i.bodyLengthChecker)??dp,credentialDefaultProvider:(i==null?void 0:i.credentialDefaultProvider)??(r=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(i==null?void 0:i.defaultUserAgentProvider)??lp({serviceId:s.serviceId,clientVersion:c1.version}),maxAttempts:(i==null?void 0:i.maxAttempts)??An,region:(i==null?void 0:i.region)??hp("Region is missing"),requestHandler:eo.create((i==null?void 0:i.requestHandler)??t),retryMode:(i==null?void 0:i.retryMode)??(async()=>(await t()).retryMode||Af),sha256:(i==null?void 0:i.sha256)??np,streamCollector:(i==null?void 0:i.streamCollector)??Pf,useDualstackEndpoint:(i==null?void 0:i.useDualstackEndpoint)??(()=>Promise.resolve(gf)),useFipsEndpoint:(i==null?void 0:i.useFipsEndpoint)??(()=>Promise.resolve(mf))}},g1=i=>{const e=i.httpAuthSchemes;let t=i.httpAuthSchemeProvider,s=i.credentials;return{setHttpAuthScheme(r){const n=e.findIndex(a=>a.schemeId===r.schemeId);n===-1?e.push(r):e.splice(n,1,r)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(r){t=r},httpAuthSchemeProvider(){return t},setCredentials(r){s=r},credentials(){return s}}},m1=i=>({httpAuthSchemes:i.httpAuthSchemes(),httpAuthSchemeProvider:i.httpAuthSchemeProvider(),credentials:i.credentials()}),sa=i=>i,v1=(i,e)=>{const t={...sa(yp(i)),...sa(Nf(i)),...sa(Jd(i)),...sa(g1(i))};return e.forEach(s=>s.configure(t)),{...i,...xp(t),...Bf(t),...Zd(t),...m1(t)}};class wp extends kf{constructor(...[e]){const t=p1(e||{}),s=HS(t),r=rf(s),n=If(r),a=yf(n),o=a,l=Tf(o),u=VS(l),d=v1(u,(e==null?void 0:e.extensions)||[]);super(d),this.config=d,this.middlewareStack.use(pf(this.config)),this.middlewareStack.use(Gf(this.config)),this.middlewareStack.use(Kf(this.config)),this.middlewareStack.use(ef(this.config)),this.middlewareStack.use(tf(this.config)),this.middlewareStack.use(sf(this.config)),this.middlewareStack.use(wf(this.config,{httpAuthSchemeParametersProvider:$S,identityProviderConfigProvider:async f=>new Hf({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(Vf(this.config))}destroy(){super.destroy()}}const dh={prod:{identityPoolId:"ap-northeast-2:719e14e9-badd-4b73-9496-39303c66cd62",streamName:"brixCloud_analysis_prod"},stage:{identityPoolId:"ap-northeast-2:1df47bbd-2ed8-4edd-9e1d-0474bc52f0af",streamName:"brixCloud_analysis_stage"},dev:{identityPoolId:"ap-northeast-2:1df47bbd-2ed8-4edd-9e1d-0474bc52f0af",streamName:"brixCloud_analysis_dev"}};class y1{constructor({identityPoolId:e,streamName:t}){this.data={ua:{s:17,a:6,g:2,o:this.getOS(),b:this.getBrowser()},ts:{tt:0,wt:0,ws:0},di:{},ii:{p:1}},this.loopId=null;const s=new URLSearchParams(window.location.search);this.client=new nS({region:"ap-northeast-2",credentials:NS({client:new wp({region:"ap-northeast-2"}),identityPoolId:e})}),this.streamName=t,this.data.um={s:s.get("utm_source")??void 0}}send(e){const t=JSON.stringify(e??this.data),s=new RS({Data:new TextEncoder().encode(t),PartitionKey:"partitionKey-"+Math.random(),StreamName:this.streamName});this.client.send(s)}sleep(e){return new Promise(t=>setTimeout(t,e))}interval(e,t){return new Promise(s=>{this.loopId=setInterval(()=>{t(e),s()},e)})}timeout(e,t){return new Promise(s=>{this.loopId=setTimeout(()=>{t(e),s()},e)})}getOS(){const e=window.navigator.userAgent.toLowerCase();let t="기타";return e.indexOf("windows")>=0?t="Windows":e.indexOf("iphone")>=0||e.indexOf("ipad")>=0||e.indexOf("ipod")>=0?t="iOS":e.indexOf("mac")>=0?t="macOS":e.indexOf("android")>=0?t="Android":e.indexOf("linux")>=0&&(t="Linux"),["Windows","macOS","iOS","Android","Linux","기타"].indexOf(t)}getBrowser(){const e=window.navigator.userAgent.toLowerCase();let t="기타";return e.indexOf("edg")>=0?t="Edge":e.indexOf("chrome")>=0?t="Chrome":e.indexOf("safari")>=0?t="Safari":e.indexOf("firefox")>=0?t="Firefox":e.indexOf("trident")>=0&&(t="Internet Explorer"),["Chrome","Safari","Firefox","Internet Explorer","Edge","기타"].indexOf(t)}init(){this.data.ii.p=1}async start(){var t;if(!this.data.ty)return;if(this.loopId&&(clearTimeout(this.loopId),clearInterval(this.loopId)),this.data.ts.wt=new Date().getTime(),this.data.ty==="c"&&!this.data.di.iv){await this.sleep(500),this.stop(),this.init(),this.start();return}(t=window==null?void 0:window.__brix_console)==null||t.call(window,"entryTime",new Date(this.data.ts.wt).toLocaleString());const e=s=>{var n,a;s>1e3&&(this.data.ii.p=0),this.data.ii.i=s;const r=new Date().getTime();this.data.ts.tt=r,this.data.ts.ws=+((r-this.data.ts.wt)/1e3).toFixed(0),(n=window==null?void 0:window.__brix_console)==null||n.call(window,"watchingTime",this.data.ts.ws),(a=window==null?void 0:window.__brix_console)==null||a.call(window,"viewCount",{current:this.data.ii.p}),this.send()};await this.timeout(1e3,e),await this.timeout(3e3,e),await this.timeout(6e3,e),await this.interval(1e4,e)}stop(){this.loopId&&(clearTimeout(this.loopId),clearInterval(this.loopId))}sendAnalyze({like:e,comment:t,product:s,share:r,banner:n}){var o,l,u,d,f;const a={...this.data};e&&(a.cc={lk:e},(o=window==null?void 0:window.__brix_console)==null||o.call(window,"likeCount",{current:e})),t&&(a.cc={c:1},(l=window==null?void 0:window.__brix_console)==null||l.call(window,"commentCount",1)),r&&(a.cc={s:1},(u=window==null?void 0:window.__brix_console)==null||u.call(window,"shareCount",1)),s&&(a.pc={ip:s,tp:this.data.ts.wt},(d=window==null?void 0:window.__brix_console)==null||d.call(window,"productCount",1)),n&&(a.bc={ib:n,tb:this.data.ts.wt},(f=window==null?void 0:window.__brix_console)==null||f.call(window,"bannerCount",1)),this.send(a)}setUser(e,t){var s,r;this.data.di.iu=e,this.data.di.tu=t===0?"g":"m",(s=window==null?void 0:window.__brix_console)==null||s.call(window,"userId",e),(r=window==null?void 0:window.__brix_console)==null||r.call(window,"authType",t===0?"비회원":"회원"),this.stop(),this.init(),this.start()}setId(e){var t;this.data.ty&&(this.data.ty==="b"?(this.data.di.ib=e,delete this.data.di.is,delete this.data.di.icc,delete this.data.di.iugc):this.data.ty==="s"?(this.data.di.is=e,this.data.ii.s="vod",delete this.data.di.ib,delete this.data.di.icc,delete this.data.di.iugc):this.data.ty==="c"?(this.data.di.icc=e,this.data.ii.s="vod",delete this.data.di.ib,delete this.data.di.is,delete this.data.di.iugc):this.data.ty==="u"?(this.data.di.iugc=e,this.data.ii.s="vod",delete this.data.di.ib,delete this.data.di.is,delete this.data.di.icc):this.data.ty==="l"&&(this.data.di.il=e,this.data.ii.s="vod"),(t=window==null?void 0:window.__brix_console)==null||t.call(window,"id",e),this.stop(),this.init(),this.start())}setClientId(e){var t;this.data.di.ic=e,(t=window==null?void 0:window.__brix_console)==null||t.call(window,"clientId",e)}setStatus(e){this.data.ii.s=e,e==="cancel"&&this.stop()}setType(e){e==="broadcast"?this.data.ty="b":e==="shorts"?this.data.ty="s":e==="channel"?this.data.ty="c":e==="library"?this.data.ty="l":e==="ugc"&&(this.data.ty="u")}setChannelVodId(e){this.data.di.iv=e,this.init()}setChannelScheduleId(e){this.data.di.ics=e}getAPIQuery(){const e=new Date().getTime(),t=+((e-this.data.ts.wt)/1e3).toFixed(0),s={tt:e,ws:t,wt:this.data.ts.wt,p:this.data.ii.p,s:this.data.ii.s};return this.data.ty==="c"?{...s,vodId:this.data.di.iv,ics:this.data.di.ics}:s}}const x1=fe.createContext(null);function S1({kinesis:i,children:e}){return Ne.jsx(x1.Provider,{value:i??null,children:e})}function E1({element:i,eventName:e,handler:t}){const s=fe.useRef();fe.useEffect(()=>{s.current=t},[t]),fe.useEffect(()=>{if(!(i&&i.addEventListener))return;const r=n=>{s.current&&s.current(n)};return i.addEventListener(e,r),()=>{i.removeEventListener(e,r)}},[e,i])}function fh(i=!1){const[e,t]=fe.useState(i);return[e,()=>t(r=>!r)]}function b1({onClick:i,onDoubleClick:e,time:t=250}){const s=fe.useRef(),r=fe.useRef(0),n=()=>{s.current&&(clearTimeout(s.current),s.current=void 0)};return fe.useCallback(o=>{r.current+=1,n(),s.current=setTimeout(()=>{r.current===1?i==null||i(o):r.current===2&&(e==null||e(o)),r.current=0},t)},[i,e,t])}function T1(i,e=500){const[t,s]=fe.useState(i);return fe.useEffect(()=>{let r;const n=()=>{s(i)};return(()=>{clearTimeout(r),r=setTimeout(n,e)})(),()=>clearTimeout(r)},[t,i,e]),[t,s]}function w1({ref:i,...e}){const[t,s]=fe.useState(!1);return fe.useEffect(()=>{const r=i==null?void 0:i.current;if(!r||!window.IntersectionObserver)return;const n=new IntersectionObserver(a=>{if(a.length>0){const o=a[0];s(o.isIntersecting)}},e);return n.observe(r),()=>{n.unobserve(r),n.disconnect()}},[]),t}fe.createContext(null);fe.forwardRef(function({overlayElement:e,onExit:t},s){const[r,n]=fe.useState(!1),a=fe.useCallback(()=>n(!1),[]);return fe.useImperativeHandle(s,()=>({close:a}),[a]),fe.useEffect(()=>{requestAnimationFrame(()=>{n(!0)})},[]),Ne.jsx(e,{isOpen:r,close:a,exit:t})});const A1={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,e){console&&console[i]&&console[i].apply(console,e)}};class Da{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||A1,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,s,r){return r&&!this.debug?null:(typeof e[0]=="string"&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Da(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Da(this.logger,e)}}var Qs=new Da;let so=class{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const r=this.observers[s].get(t)||0;this.observers[s].set(t,r+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r<t;r++)s[r-1]=arguments[r];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(a=>{let[o,l]=a;for(let u=0;u<l;u++)o(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[o,l]=a;for(let u=0;u<l;u++)o.apply(o,[e,...s])})}};const ln=()=>{let i,e;const t=new Promise((s,r)=>{i=s,e=r});return t.resolve=i,t.reject=e,t},ph=i=>i==null?"":""+i,L1=(i,e,t)=>{i.forEach(s=>{e[s]&&(t[s]=e[s])})},C1=/###/g,gh=i=>i&&i.indexOf("###")>-1?i.replace(C1,"."):i,mh=i=>!i||typeof i=="string",yn=(i,e,t)=>{const s=typeof e!="string"?e:e.split(".");let r=0;for(;r<s.length-1;){if(mh(i))return{};const n=gh(s[r]);!i[n]&&t&&(i[n]=new t),Object.prototype.hasOwnProperty.call(i,n)?i=i[n]:i={},++r}return mh(i)?{}:{obj:i,k:gh(s[r])}},vh=(i,e,t)=>{const{obj:s,k:r}=yn(i,e,Object);if(s!==void 0||e.length===1){s[r]=t;return}let n=e[e.length-1],a=e.slice(0,e.length-1),o=yn(i,a,Object);for(;o.obj===void 0&&a.length;)n=`${a[a.length-1]}.${n}`,a=a.slice(0,a.length-1),o=yn(i,a,Object),o&&o.obj&&typeof o.obj[`${o.k}.${n}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${n}`]=t},R1=(i,e,t,s)=>{const{obj:r,k:n}=yn(i,e,Object);r[n]=r[n]||[],r[n].push(t)},Ma=(i,e)=>{const{obj:t,k:s}=yn(i,e);if(t)return t[s]},_1=(i,e,t)=>{const s=Ma(i,t);return s!==void 0?s:Ma(e,t)},Ap=(i,e,t)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in i?typeof i[s]=="string"||i[s]instanceof String||typeof e[s]=="string"||e[s]instanceof String?t&&(i[s]=e[s]):Ap(i[s],e[s],t):i[s]=e[s]);return i},Ar=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var I1={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const k1=i=>typeof i=="string"?i.replace(/[&<>"'\/]/g,e=>I1[e]):i;class P1{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const D1=[" ",",","?","!",";"],M1=new P1(20),F1=(i,e,t)=>{e=e||"",t=t||"";const s=D1.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(s.length===0)return!0;const r=M1.getRegExp(`(${s.map(a=>a==="?"?"\\?":a).join("|")})`);let n=!r.test(i);if(!n){const a=i.indexOf(t);a>0&&!r.test(i.substring(0,a))&&(n=!0)}return n},Tl=function(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!i)return;if(i[e])return i[e];const s=e.split(t);let r=i;for(let n=0;n<s.length;){if(!r||typeof r!="object")return;let a,o="";for(let l=n;l<s.length;++l)if(l!==n&&(o+=t),o+=s[l],a=r[o],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<s.length-1)continue;n+=l-n+1;break}r=a}return r},Fa=i=>i&&i.indexOf("_")>0?i.replace("_","-"):i;class yh extends so{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const n=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],s&&(Array.isArray(s)?o.push(...s):typeof s=="string"&&n?o.push(...s.split(n)):o.push(s)));const l=Ma(this.data,o);return!l&&!t&&!s&&e.indexOf(".")>-1&&(e=o[0],t=o[1],s=o.slice(2).join(".")),l||!a||typeof s!="string"?l:Tl(this.data&&this.data[e]&&this.data[e][t],s,n)}addResource(e,t,s,r){let n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=[e,t];s&&(o=o.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(o=e.split("."),r=t,t=o[1]),this.addNamespaces(t),vh(this.data,o,r),n.silent||this.emit("added",e,t,s,r)}addResources(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const n in s)(typeof s[n]=="string"||Array.isArray(s[n]))&&this.addResource(e,t,n,s[n],{silent:!0});r.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,r,n){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),r=s,s=t,t=o[1]),this.addNamespaces(t);let l=Ma(this.data,o)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),r?Ap(l,s,n):l={...l,...s},vh(this.data,o,l),a.silent||this.emit("added",e,t,s)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var Lp={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,e,t,s,r){return i.forEach(n=>{this.processors[n]&&(e=this.processors[n].process(e,t,s,r))}),e}};const xh={};class Oa extends so{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),L1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Qs.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const s=this.resolve(e,t);return s&&s.res!==void 0}extractFromKey(e,t){let s=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const a=s&&e.indexOf(s)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!F1(e,s,r);if(a&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:n};const u=e.split(s);(s!==r||s===r&&this.options.ns.indexOf(u[0])>-1)&&(n=u.shift()),e=u.join(r)}return typeof n=="string"&&(n=[n]),{key:e,namespaces:n}}translate(e,t,s){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,n=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:a,namespaces:o}=this.extractFromKey(e[e.length-1],t),l=o[o.length-1],u=t.lng||this.language,d=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const U=t.nsSeparator||this.options.nsSeparator;return r?{res:`${l}${U}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${U}${a}`}return r?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:a}const f=this.resolve(e,t);let g=f&&f.res;const v=f&&f.usedKey||a,y=f&&f.exactUsedKey||a,E=Object.prototype.toString.apply(g),b=["[object Number]","[object Function]","[object RegExp]"],w=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,F=!this.i18nFormat||this.i18nFormat.handleAsObject;if(F&&g&&(typeof g!="string"&&typeof g!="boolean"&&typeof g!="number")&&b.indexOf(E)<0&&!(typeof w=="string"&&Array.isArray(g))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const U=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,g,{...t,ns:o}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(f.res=U,f.usedParams=this.getUsedParamsDetails(t),f):U}if(n){const U=Array.isArray(g),N=U?[]:{},te=U?y:v;for(const j in g)if(Object.prototype.hasOwnProperty.call(g,j)){const re=`${te}${n}${j}`;N[j]=this.translate(re,{...t,joinArrays:!1,ns:o}),N[j]===re&&(N[j]=g[j])}g=N}}else if(F&&typeof w=="string"&&Array.isArray(g))g=g.join(w),g&&(g=this.extendTranslation(g,e,t,s));else{let U=!1,N=!1;const te=t.count!==void 0&&typeof t.count!="string",j=Oa.hasDefaultValue(t),re=te?this.pluralResolver.getSuffix(u,t.count,t):"",Q=t.ordinal&&te?this.pluralResolver.getSuffix(u,t.count,{ordinal:!1}):"",le=te&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),se=le&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${re}`]||t[`defaultValue${Q}`]||t.defaultValue;!this.isValidLookup(g)&&j&&(U=!0,g=se),this.isValidLookup(g)||(N=!0,g=a);const de=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:g,be=j&&se!==g&&this.options.updateMissing;if(N||U||be){if(this.logger.log(be?"updateKey":"missingKey",u,l,a,be?se:g),n){const we=this.resolve(a,{...t,keySeparator:!1});we&&we.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Le=[];const ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(let we=0;we<ue.length;we++)Le.push(ue[we]);else this.options.saveMissingTo==="all"?Le=this.languageUtils.toResolveHierarchy(t.lng||this.language):Le.push(t.lng||this.language);const he=(we,me,ye)=>{const Ve=j&&ye!==g?ye:de;this.options.missingKeyHandler?this.options.missingKeyHandler(we,l,me,Ve,be,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(we,l,me,Ve,be,t),this.emit("missingKey",we,l,me,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&te?Le.forEach(we=>{const me=this.pluralResolver.getSuffixes(we,t);le&&t[`defaultValue${this.options.pluralSeparator}zero`]&&me.indexOf(`${this.options.pluralSeparator}zero`)<0&&me.push(`${this.options.pluralSeparator}zero`),me.forEach(ye=>{he([we],a+ye,t[`defaultValue${ye}`]||se)})}):he(Le,a,se))}g=this.extendTranslation(g,e,t,f,s),N&&g===a&&this.options.appendNamespaceToMissingKey&&(g=`${l}:${a}`),(N||U)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,U?g:void 0):g=this.options.parseMissingKeyHandler(g))}return r?(f.res=g,f.usedParams=this.getUsedParamsDetails(t),f):g}extendTranslation(e,t,s,r,n){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const u=typeof e=="string"&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const g=e.match(this.interpolator.nestingRegexp);d=g&&g.length}let f=s.replace&&typeof s.replace!="string"?s.replace:s;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),e=this.interpolator.interpolate(e,f,s.lng||this.language||r.usedLng,s),u){const g=e.match(this.interpolator.nestingRegexp),v=g&&g.length;d<v&&(s.nest=!1)}!s.lng&&this.options.compatibilityAPI!=="v1"&&r&&r.res&&(s.lng=this.language||r.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var g=arguments.length,v=new Array(g),y=0;y<g;y++)v[y]=arguments[y];return n&&n[0]===v[0]&&!s.context?(a.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${t[0]}`),null):a.translate(...v,t)},s)),s.interpolation&&this.interpolator.reset()}const o=s.postProcess||this.options.postProcess,l=typeof o=="string"?[o]:o;return e!=null&&l&&l.length&&s.applyPostProcessor!==!1&&(e=Lp.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s,r,n,a,o;return typeof e=="string"&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(s))return;const u=this.extractFromKey(l,t),d=u.key;r=d;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const g=t.count!==void 0&&typeof t.count!="string",v=g&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),y=t.context!==void 0&&(typeof t.context=="string"||typeof t.context=="number")&&t.context!=="",E=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);f.forEach(b=>{this.isValidLookup(s)||(o=b,!xh[`${E[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(o)&&(xh[`${E[0]}-${b}`]=!0,this.logger.warn(`key "${r}" for languages "${E.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),E.forEach(w=>{if(this.isValidLookup(s))return;a=w;const F=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(F,d,w,b,t);else{let U;g&&(U=this.pluralResolver.getSuffix(w,t.count,t));const N=`${this.options.pluralSeparator}zero`,te=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(F.push(d+U),t.ordinal&&U.indexOf(te)===0&&F.push(d+U.replace(te,this.options.pluralSeparator)),v&&F.push(d+N)),y){const j=`${d}${this.options.contextSeparator}${t.context}`;F.push(j),g&&(F.push(j+U),t.ordinal&&U.indexOf(te)===0&&F.push(j+U.replace(te,this.options.pluralSeparator)),v&&F.push(j+N))}}let k;for(;k=F.pop();)this.isValidLookup(s)||(n=k,s=this.getResource(w,b,k,t))}))})}),{res:s,usedKey:r,exactUsedKey:n,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,s,r):this.resourceStore.getResource(e,t,s,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&typeof e.replace!="string";let r=s?e.replace:e;if(s&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!s){r={...r};for(const n of t)delete r[n]}return r}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,t.length)&&e[s]!==void 0)return!0;return!1}}const Bo=i=>i.charAt(0).toUpperCase()+i.slice(1);class Sh{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Qs.create("languageUtils")}getScriptPartFromCode(e){if(e=Fa(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=Fa(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const t=["hans","hant","latn","cyrl","cans","mong","arab"];let s=e.split("-");return this.options.lowerCaseLng?s=s.map(r=>r.toLowerCase()):s.length===2?(s[0]=s[0].toLowerCase(),s[1]=s[1].toUpperCase(),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=Bo(s[1].toLowerCase()))):s.length===3&&(s[0]=s[0].toLowerCase(),s[1].length===2&&(s[1]=s[1].toUpperCase()),s[0]!=="sgn"&&s[2].length===2&&(s[2]=s[2].toUpperCase()),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=Bo(s[1].toLowerCase())),t.indexOf(s[2].toLowerCase())>-1&&(s[2]=Bo(s[2].toLowerCase()))),s.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(s=>{if(t)return;const r=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(s=>{if(t)return;const r=this.getLanguagePartFromCode(s);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(n=>{if(n===r)return n;if(!(n.indexOf("-")<0&&r.indexOf("-")<0)&&(n.indexOf("-")>0&&r.indexOf("-")<0&&n.substring(0,n.indexOf("-"))===r||n.indexOf(r)===0&&r.length>1))return n})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),typeof e=="string"&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],n=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):typeof e=="string"&&n(this.formatLanguageCode(e)),s.forEach(a=>{r.indexOf(a)<0&&n(this.formatLanguageCode(a))}),r}}let O1=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],N1={1:i=>+(i>1),2:i=>+(i!=1),3:i=>0,4:i=>i%10==1&&i%100!=11?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2,5:i=>i==0?0:i==1?1:i==2?2:i%100>=3&&i%100<=10?3:i%100>=11?4:5,6:i=>i==1?0:i>=2&&i<=4?1:2,7:i=>i==1?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2,8:i=>i==1?0:i==2?1:i!=8&&i!=11?2:3,9:i=>+(i>=2),10:i=>i==1?0:i==2?1:i<7?2:i<11?3:4,11:i=>i==1||i==11?0:i==2||i==12?1:i>2&&i<20?2:3,12:i=>+(i%10!=1||i%100==11),13:i=>+(i!==0),14:i=>i==1?0:i==2?1:i==3?2:3,15:i=>i%10==1&&i%100!=11?0:i%10>=2&&(i%100<10||i%100>=20)?1:2,16:i=>i%10==1&&i%100!=11?0:i!==0?1:2,17:i=>i==1||i%10==1&&i%100!=11?0:1,18:i=>i==0?0:i==1?1:2,19:i=>i==1?0:i==0||i%100>1&&i%100<11?1:i%100>10&&i%100<20?2:3,20:i=>i==1?0:i==0||i%100>0&&i%100<20?1:2,21:i=>i%100==1?1:i%100==2?2:i%100==3||i%100==4?3:0,22:i=>i==1?0:i==2?1:(i<0||i>10)&&i%10==0?2:3};const B1=["v1","v2","v3"],$1=["v4"],Eh={zero:0,one:1,two:2,few:3,many:4,other:5},U1=()=>{const i={};return O1.forEach(e=>{e.lngs.forEach(t=>{i[t]={numbers:e.nr,plurals:N1[e.fc]}})}),i};class G1{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Qs.create("pluralResolver"),(!this.options.compatibilityJSON||$1.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=U1(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{const s=Fa(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:s,type:r});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];const a=new Intl.PluralRules(s,{type:r});return this.pluralRulesCache[n]=a,a}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(e,t);return this.shouldUseIntlApi()?s&&s.resolvedOptions().pluralCategories.length>1:s&&s.numbers.length>1}getPluralFormsOfKey(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,s).map(r=>`${t}${r}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(e,t);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort((r,n)=>Eh[r]-Eh[n]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):s.numbers.map(r=>this.getSuffix(e,r,t)):[]}getSuffix(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,s);return r?this.shouldUseIntlApi()?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:this.getSuffixRetroCompatible(r,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const s=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let r=e.numbers[s];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(r===2?r="plural":r===1&&(r=""));const n=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return this.options.compatibilityJSON==="v1"?r===1?"":typeof r=="number"?`_plural_${r.toString()}`:n():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?n():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}shouldUseIntlApi(){return!B1.includes(this.options.compatibilityJSON)}}const bh=function(i,e,t){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,n=_1(i,e,t);return!n&&r&&typeof t=="string"&&(n=Tl(i,t,s),n===void 0&&(n=Tl(e,t,s))),n},$o=i=>i.replace(/\$/g,"$$$$");class V1{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Qs.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(t=>t),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:s,useRawValueToEscape:r,prefix:n,prefixEscaped:a,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:d,unescapePrefix:f,nestingPrefix:g,nestingPrefixEscaped:v,nestingSuffix:y,nestingSuffixEscaped:E,nestingOptionsSeparator:b,maxReplaces:w,alwaysFormat:F}=e.interpolation;this.escape=t!==void 0?t:k1,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=n?Ar(n):a||"{{",this.suffix=o?Ar(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=g?Ar(g):v||Ar("$t("),this.nestingSuffix=y?Ar(y):E||Ar(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=w||1e3,this.alwaysFormat=F!==void 0?F:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,s)=>t&&t.source===s?(t.lastIndex=0,t):new RegExp(s,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,s,r){let n,a,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=v=>{if(v.indexOf(this.formatSeparator)<0){const w=bh(t,l,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(w,void 0,s,{...r,...t,interpolationkey:v}):w}const y=v.split(this.formatSeparator),E=y.shift().trim(),b=y.join(this.formatSeparator).trim();return this.format(bh(t,l,E,this.options.keySeparator,this.options.ignoreJSONStructure),b,s,{...r,...t,interpolationkey:E})};this.resetRegExp();const d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>$o(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?$o(this.escape(v)):$o(v)}].forEach(v=>{for(o=0;n=v.regex.exec(e);){const y=n[1].trim();if(a=u(y),a===void 0)if(typeof d=="function"){const b=d(e,n,r);a=typeof b=="string"?b:""}else if(r&&Object.prototype.hasOwnProperty.call(r,y))a="";else if(f){a=n[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=ph(a));const E=v.safeValue(a);if(e=e.replace(n[0],E),f?(v.regex.lastIndex+=a.length,v.regex.lastIndex-=n[0].length):v.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,n,a;const o=(l,u)=>{const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const f=l.split(new RegExp(`${d}[ ]*{`));let g=`{${f[1]}`;l=f[0],g=this.interpolate(g,a);const v=g.match(/'/g),y=g.match(/"/g);(v&&v.length%2===0&&!y||y.length%2!==0)&&(g=g.replace(/'/g,'"'));try{a=JSON.parse(g),u&&(a={...u,...a})}catch(E){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,E),`${l}${d}${g}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];a={...s},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const d=r[1].split(this.formatSeparator).map(f=>f.trim());r[1]=d.shift(),l=d,u=!0}if(n=t(o.call(this,r[1].trim(),a),a),n&&r[0]===e&&typeof n!="string")return n;typeof n!="string"&&(n=ph(n)),n||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),n=""),u&&(n=l.reduce((d,f)=>this.format(d,f,s.lng,{...s,interpolationkey:r[1].trim()}),n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}const H1=i=>{let e=i.toLowerCase().trim();const t={};if(i.indexOf("(")>-1){const s=i.split("(");e=s[0].toLowerCase().trim();const r=s[1].substring(0,s[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(a=>{if(a){const[o,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),d=o.trim();t[d]||(t[d]=u),u==="false"&&(t[d]=!1),u==="true"&&(t[d]=!0),isNaN(u)||(t[d]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},Lr=i=>{const e={};return(t,s,r)=>{let n=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(n={...n,[r.interpolationkey]:void 0});const a=s+JSON.stringify(n);let o=e[a];return o||(o=i(Fa(s),r),e[a]=o),o(t)}};class j1{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Qs.create("formatter"),this.options=e,this.formats={number:Lr((t,s)=>{const r=new Intl.NumberFormat(t,{...s});return n=>r.format(n)}),currency:Lr((t,s)=>{const r=new Intl.NumberFormat(t,{...s,style:"currency"});return n=>r.format(n)}),datetime:Lr((t,s)=>{const r=new Intl.DateTimeFormat(t,{...s});return n=>r.format(n)}),relativetime:Lr((t,s)=>{const r=new Intl.RelativeTimeFormat(t,{...s});return n=>r.format(n,s.range||"day")}),list:Lr((t,s)=>{const r=new Intl.ListFormat(t,{...s});return n=>r.format(n)})},this.init(e)}init(e){const s=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=s.formatSeparator?s.formatSeparator:s.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Lr(t)}format(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(o=>o.indexOf(")")>-1)){const o=n.findIndex(l=>l.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,o)].join(this.formatSeparator)}return n.reduce((o,l)=>{const{formatName:u,formatOptions:d}=H1(l);if(this.formats[u]){let f=o;try{const g=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},v=g.locale||g.lng||r.locale||r.lng||s;f=this.formats[u](o,v,{...d,...r,...g})}catch(g){this.logger.warn(g)}return f}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}const K1=(i,e)=>{i.pending[e]!==void 0&&(delete i.pending[e],i.pendingCount--)};class z1 extends so{constructor(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=r,this.logger=Qs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(s,r.backend,r)}queueLoad(e,t,s,r){const n={},a={},o={},l={};return e.forEach(u=>{let d=!0;t.forEach(f=>{const g=`${u}|${f}`;!s.reload&&this.store.hasResourceBundle(u,f)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?a[g]===void 0&&(a[g]=!0):(this.state[g]=1,d=!1,a[g]===void 0&&(a[g]=!0),n[g]===void 0&&(n[g]=!0),l[f]===void 0&&(l[f]=!0)))}),d||(o[u]=!0)}),(Object.keys(n).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(n),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,s){const r=e.split("|"),n=r[0],a=r[1];t&&this.emit("failedLoading",n,a,t),!t&&s&&this.store.addResourceBundle(n,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const o={};this.queue.forEach(l=>{R1(l.loaded,[n],a),K1(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const d=l.loaded[u];d.length&&d.forEach(f=>{o[u][f]===void 0&&(o[u][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:s,tried:r,wait:n,callback:a});return}this.readingCalls++;const o=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&d&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,s,r+1,n*2,a)},n);return}a(u,d)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(d=>o(null,d)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof t=="string"&&(t=[t]);const n=this.queueLoad(e,t,s,r);if(!n.toLoad.length)return n.pending.length||r(),null;n.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const s=e.split("|"),r=s[0],n=s[1];this.read(r,n,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${n} for language ${r} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${n} for language ${r}`,o),this.loaded(e,a,o)})}saveMissing(e,t,s,r,n){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:n},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(e,t,s,r,l):d=u(e,t,s,r),d&&typeof d.then=="function"?d.then(f=>o(null,f)).catch(o):o(null,d)}catch(d){o(d)}else u(e,t,s,r,o,l)}!e||!e[0]||this.store.addResource(e[0],t,s,r)}}}const Th=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let e={};if(typeof i[1]=="object"&&(e=i[1]),typeof i[1]=="string"&&(e.defaultValue=i[1]),typeof i[2]=="string"&&(e.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const t=i[3]||i[2];Object.keys(t).forEach(s=>{e[s]=t[s]})}return e},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),wh=i=>(typeof i.ns=="string"&&(i.ns=[i.ns]),typeof i.fallbackLng=="string"&&(i.fallbackLng=[i.fallbackLng]),typeof i.fallbackNS=="string"&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs&&i.supportedLngs.indexOf("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),i),ia=()=>{},W1=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(t=>{typeof i[t]=="function"&&(i[t]=i[t].bind(i))})};class Rn extends so{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=wh(e),this.services={},this.logger=Qs,this.modules={external:[]},W1(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(s=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(typeof t.ns=="string"?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=Th();this.options={...r,...this.options,...wh(t)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const n=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?Qs.init(n(this.modules.logger),this.options):Qs.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=j1);const f=new Sh(this.options);this.store=new yh(this.options.resources,this.options);const g=this.services;g.logger=Qs,g.resourceStore=this.store,g.languageUtils=f,g.pluralResolver=new G1(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(g.formatter=n(d),g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new V1(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new z1(n(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",function(v){for(var y=arguments.length,E=new Array(y>1?y-1:0),b=1;b<y;b++)E[b-1]=arguments[b];e.emit(v,...E)}),this.modules.languageDetector&&(g.languageDetector=n(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=n(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new Oa(this.services,this.options),this.translator.on("*",function(v){for(var y=arguments.length,E=new Array(y>1?y-1:0),b=1;b<y;b++)E[b-1]=arguments[b];e.emit(v,...E)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,s||(s=ia),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=function(){return e.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return e.store[d](...arguments),e}});const l=ln(),u=()=>{const d=(f,g)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(g),s(f,g)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ia;const r=typeof e=="string"?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&r.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const n=[],a=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(u=>{u!=="cimode"&&n.indexOf(u)<0&&n.push(u)})};r?a(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(o=>a(o)),this.services.backendConnector.load(n,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(o)})}else s(null)}reloadResources(e,t,s){const r=ln();return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=ia),this.services.backendConnector.reload(e,t,n=>{r.resolve(),s(n)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Lp.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t<this.languages.length;t++){const s=this.languages[t];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}changeLanguage(e,t){var s=this;this.isLanguageChangingTo=e;const r=ln();this.emit("languageChanging",e);const n=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(n(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,r.resolve(function(){return s.t(...arguments)}),t&&t(l,function(){return s.t(...arguments)})},o=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||n(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{a(d,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,t,s){var r=this;const n=function(a,o){let l;if(typeof o!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),f=2;f<u;f++)d[f-2]=arguments[f];l=r.options.overloadTranslationOptionHandler([a,o].concat(d))}else l={...o};l.lng=l.lng||n.lng,l.lngs=l.lngs||n.lngs,l.ns=l.ns||n.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||s||n.keyPrefix);const g=r.options.keySeparator||".";let v;return l.keyPrefix&&Array.isArray(a)?v=a.map(y=>`${l.keyPrefix}${g}${y}`):v=l.keyPrefix?`${l.keyPrefix}${g}${a}`:a,r.t(v,l)};return typeof e=="string"?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=s,n}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!r||a(n,e)))}loadNamespaces(e,t){const s=ln();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{s.resolve(),t&&t(r)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=ln();typeof e=="string"&&(e=[e]);const r=this.options.preload||[],n=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return n.length?(this.options.preload=r.concat(n),this.loadResources(a=>{s.resolve(),t&&t(a)}),s):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services&&this.services.languageUtils||new Sh(Th());return t.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new Rn(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ia;const s=e.forkResourceStore;s&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},n=new Rn(r);return(e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(o=>{n[o]=this[o]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},s&&(n.store=new yh(this.store.data,r),n.services.resourceStore=n.store),n.translator=new Oa(n.services,r),n.translator.on("*",function(o){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];n.emit(o,...u)}),n.init(r,t),n.translator.options=r,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Kt=Rn.createInstance();Kt.createInstance=Rn.createInstance;Kt.createInstance;Kt.dir;Kt.init;Kt.loadResources;Kt.reloadResources;Kt.use;Kt.changeLanguage;Kt.getFixedT;Kt.t;Kt.exists;Kt.setDefaultNamespace;Kt.hasLoadedNamespace;Kt.loadNamespaces;Kt.loadLanguages;function q1(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function _n(i){"@babel/helpers - typeof";return _n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_n(i)}function Y1(i,e){if(_n(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e);if(_n(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function X1(i){var e=Y1(i,"string");return _n(e)=="symbol"?e:e+""}function Q1(i,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(i,X1(s.key),s)}}function J1(i,e,t){return e&&Q1(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}var Cp=[],Z1=Cp.forEach,eE=Cp.slice;function tE(i){return Z1.call(eE.call(arguments,1),function(e){if(e)for(var t in e)i[t]===void 0&&(i[t]=e[t])}),i}var Ah=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,sE=function(e,t,s){var r=s||{};r.path=r.path||"/";var n=encodeURIComponent(t),a="".concat(e,"=").concat(n);if(r.maxAge>0){var o=r.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(o))}if(r.domain){if(!Ah.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(r.domain)}if(r.path){if(!Ah.test(r.path))throw new TypeError("option path is invalid");a+="; Path=".concat(r.path)}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite){var l=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(l){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},Lh={create:function(e,t,s,r){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};s&&(n.expires=new Date,n.expires.setTime(n.expires.getTime()+s*60*1e3)),r&&(n.domain=r),document.cookie=sE(e,encodeURIComponent(t),n)},read:function(e){for(var t="".concat(e,"="),s=document.cookie.split(";"),r=0;r<s.length;r++){for(var n=s[r];n.charAt(0)===" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return n.substring(t.length,n.length)}return null},remove:function(e){this.create(e,"",-1)}},iE={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&typeof document<"u"){var s=Lh.read(e.lookupCookie);s&&(t=s)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&typeof document<"u"&&Lh.create(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},rE={name:"querystring",lookup:function(e){var t;if(typeof window<"u"){var s=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=s.substring(1),n=r.split("&"),a=0;a<n.length;a++){var o=n[a].indexOf("=");if(o>0){var l=n[a].substring(0,o);l===e.lookupQuerystring&&(t=n[a].substring(o+1))}}}return t}},cn=null,Ch=function(){if(cn!==null)return cn;try{cn=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{cn=!1}return cn},nE={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&Ch()){var s=window.localStorage.getItem(e.lookupLocalStorage);s&&(t=s)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&Ch()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},un=null,Rh=function(){if(un!==null)return un;try{un=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{un=!1}return un},aE={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&Rh()){var s=window.sessionStorage.getItem(e.lookupSessionStorage);s&&(t=s)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&Rh()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},oE={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var s=0;s<navigator.languages.length;s++)t.push(navigator.languages[s]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},lE={name:"htmlTag",lookup:function(e){var t,s=e.htmlTag||(typeof document<"u"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(t=s.getAttribute("lang")),t}},cE={name:"path",lookup:function(e){var t;if(typeof window<"u"){var s=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(s instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof s[e.lookupFromPathIndex]!="string")return;t=s[e.lookupFromPathIndex].replace("/","")}else t=s[0].replace("/","")}return t}},uE={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,s=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(s)return s[t]}};function hE(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var Rp=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};q1(this,i),this.type="languageDetector",this.detectors={},this.init(e,t)}return J1(i,[{key:"init",value:function(t){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=tE(s,this.options||{},hE()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(n){return n.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(iE),this.addDetector(rE),this.addDetector(nE),this.addDetector(aE),this.addDetector(oE),this.addDetector(lE),this.addDetector(cE),this.addDetector(uE)}},{key:"addDetector",value:function(t){return this.detectors[t.name]=t,this}},{key:"detect",value:function(t){var s=this;t||(t=this.options.order);var r=[];return t.forEach(function(n){if(s.detectors[n]){var a=s.detectors[n].lookup(s.options);a&&typeof a=="string"&&(a=[a]),a&&(r=r.concat(a))}}),r=r.map(function(n){return s.options.convertDetectedLanguage(n)}),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}},{key:"cacheUserLanguage",value:function(t,s){var r=this;s||(s=this.options.caches),s&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||s.forEach(function(n){r.detectors[n]&&r.detectors[n].cacheUserLanguage(t,r.options)}))}}]),i}();Rp.type="languageDetector";const dE={en:{translation:{chapter:"chapter",close:"close",soldout:"soldeout",currency:"USD",more:"more",entrace:"entrance",comments:"comments",reply:"reply",send:"send",cancel1:"cancel",participate:"participate",participated:"participated",announcement:"announcement",login:"login",notice:"notice",report:"report",edit:"edit",benefit:"benefit",notification:"notification",setting:"setting",event:"event",term:"term",back:"back",quiz:"quiz",answer:"answer",confirm:"confirm",recent:"recent",small:"small",medium:"medium",large:"large",chat:"chat",background:"background",bold:"bold",share:"share",video:"video",fullscreen:"full screen",quality:"quality",auto:"auto",size:"size",delete:"delete",rehearsal:"rehearsal",live:"live",relive:"relive",converting:"converting",cancel:"cancel",ready:"ready",purchase_verification:"Purchase verification",live_comments:"Live comments",adult_verification:"Adult verification",change_view_mode:"Change view mode",enter_broadcast:"Enter broadcast",featured_products:"Featured products",view_reply:"View {{count}} replies",sentence:{"No Results Found":"No Results Found","people has joined":" and {{count}} people has joined","has joined":"has joined","Chat is paused":"Chat is paused","Chat is available":"Chat is available","Chat is unavailable":"Chat is unavailable","Chat messages cannot be sent":"Chat messages cannot be sent","Please enter number":"Please enter number","Please enter answer":"Please enter answer","Participation completed":"Participation completed","Stream Starting Soon":"Stream Starting Soon","Please enter your name":"Please enter your name","Please enter your nickname":"Please enter your nickname","Please enter your phonenumber":"Please enter your phonenumber","Consent for Personal Information":"Consent for Personal Information (Required)","Please enter the information":"To participate, please enter the information below","Reply has been raised":`Reply has been raised.
|
|
45
|
+
*/class op{static getParser(e,t=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Hu(e,t)}static parse(e){return new Hu(e).getResult()}static get BROWSER_MAP(){return ap}static get ENGINE_MAP(){return Mi}static get OS_MAP(){return Xt}static get PLATFORMS_MAP(){return At}}const lp=({serviceId:i,clientVersion:e})=>async()=>{var r,n,a,o,l;const t=typeof window<"u"&&((r=window==null?void 0:window.navigator)!=null&&r.userAgent)?op.parse(window.navigator.userAgent):void 0,s=[["aws-sdk-js",e],["ua","2.0"],[`os/${((n=t==null?void 0:t.os)==null?void 0:n.name)||"other"}`,(a=t==null?void 0:t.os)==null?void 0:a.version],["lang/js"],["md/browser",`${((o=t==null?void 0:t.browser)==null?void 0:o.name)??"unknown"}_${((l=t==null?void 0:t.browser)==null?void 0:l.version)??"unknown"}`]];return i&&s.push([`api/${i}`,e]),s};var cp=function(){function i(){this.checksum=4294967295}return i.prototype.update=function(e){var t,s;try{for(var r=sx(e),n=r.next();!n.done;n=r.next()){var a=n.value;this.checksum=this.checksum>>>8^xx[(this.checksum^a)&255]}}catch(o){t={error:o}}finally{try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(t)throw t.error}}return this},i.prototype.digest=function(){return(this.checksum^4294967295)>>>0},i}(),yx=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],xx=Xy(yx);class mn{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let s=7,r=Math.abs(Math.round(e));s>-1&&r>0;s--,r/=256)t[s]=r;return e<0&&ju(t),new mn(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&ju(e),parseInt(hs(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function ju(i){for(let e=0;e<8;e++)i[e]^=255;for(let e=7;e>-1&&(i[e]++,i[e]===0);e--);}class Sx{constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){const t=[];for(const n of Object.keys(e)){const a=this.fromUtf8(n);t.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[n]))}const s=new Uint8Array(t.reduce((n,a)=>n+a.byteLength,0));let r=0;for(const n of t)s.set(n,r),r+=n.byteLength;return s}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const s=new DataView(new ArrayBuffer(5));return s.setUint8(0,4),s.setInt32(1,e.value,!1),new Uint8Array(s.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const a=new Uint8Array(n.buffer);return a.set(e.value,3),a;case"string":const o=this.fromUtf8(e.value),l=new DataView(new ArrayBuffer(3+o.byteLength));l.setUint8(0,7),l.setUint16(1,o.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(o,3),u;case"timestamp":const d=new Uint8Array(9);return d[0]=8,d.set(mn.fromNumber(e.value.valueOf()).bytes,1),d;case"uuid":if(!_x.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const f=new Uint8Array(17);return f[0]=9,f.set(Mf(e.value.replace(/\-/g,"")),1),f}}parse(e){const t={};let s=0;for(;s<e.byteLength;){const r=e.getUint8(s++),n=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+s,r));switch(s+=r,e.getUint8(s++)){case 0:t[n]={type:zu,value:!0};break;case 1:t[n]={type:zu,value:!1};break;case 2:t[n]={type:Ex,value:e.getInt8(s++)};break;case 3:t[n]={type:bx,value:e.getInt16(s,!1)},s+=2;break;case 4:t[n]={type:Tx,value:e.getInt32(s,!1)},s+=4;break;case 5:t[n]={type:wx,value:new mn(new Uint8Array(e.buffer,e.byteOffset+s,8))},s+=8;break;case 6:const a=e.getUint16(s,!1);s+=2,t[n]={type:Ax,value:new Uint8Array(e.buffer,e.byteOffset+s,a)},s+=a;break;case 7:const o=e.getUint16(s,!1);s+=2,t[n]={type:Lx,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+s,o))},s+=o;break;case 8:t[n]={type:Cx,value:new Date(new mn(new Uint8Array(e.buffer,e.byteOffset+s,8)).valueOf())},s+=8;break;case 9:const l=new Uint8Array(e.buffer,e.byteOffset+s,16);s+=16,t[n]={type:Rx,value:`${hs(l.subarray(0,4))}-${hs(l.subarray(4,6))}-${hs(l.subarray(6,8))}-${hs(l.subarray(8,10))}-${hs(l.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}}var Ku;(function(i){i[i.boolTrue=0]="boolTrue",i[i.boolFalse=1]="boolFalse",i[i.byte=2]="byte",i[i.short=3]="short",i[i.integer=4]="integer",i[i.long=5]="long",i[i.byteArray=6]="byteArray",i[i.string=7]="string",i[i.timestamp=8]="timestamp",i[i.uuid=9]="uuid"})(Ku||(Ku={}));const zu="boolean",Ex="byte",bx="short",Tx="integer",wx="long",Ax="binary",Lx="string",Cx="timestamp",Rx="uuid",_x=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,up=4,Fi=up*2,Xi=4,Ix=Fi+Xi*2;function kx({byteLength:i,byteOffset:e,buffer:t}){if(i<Ix)throw new Error("Provided message too short to accommodate event stream message overhead");const s=new DataView(t,e,i),r=s.getUint32(0,!1);if(i!==r)throw new Error("Reported message length does not match received message length");const n=s.getUint32(up,!1),a=s.getUint32(Fi,!1),o=s.getUint32(i-Xi,!1),l=new cp().update(new Uint8Array(t,e,Fi));if(a!==l.digest())throw new Error(`The prelude checksum specified in the message (${a}) does not match the calculated CRC32 checksum (${l.digest()})`);if(l.update(new Uint8Array(t,e+Fi,i-(Fi+Xi))),o!==l.digest())throw new Error(`The message checksum (${l.digest()}) did not match the expected value of ${o}`);return{headers:new DataView(t,e+Fi+Xi,n),body:new Uint8Array(t,e+Fi+Xi+n,r-n-(Fi+Xi+Xi))}}class Px{constructor(e,t){this.headerMarshaller=new Sx(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){const s=this.headerMarshaller.format(e),r=s.byteLength+t.byteLength+16,n=new Uint8Array(r),a=new DataView(n.buffer,n.byteOffset,n.byteLength),o=new cp;return a.setUint32(0,r,!1),a.setUint32(4,s.byteLength,!1),a.setUint32(8,o.update(n.subarray(0,8)).digest(),!1),n.set(s,12),n.set(t,s.byteLength+12),a.setUint32(r-4,o.update(n.subarray(8,r-4)).digest(),!1),n}decode(e){const{headers:t,body:s}=kx(e);return{headers:this.headerMarshaller.parse(t),body:s}}formatHeaders(e){return this.headerMarshaller.format(e)}}class Dx{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream)yield this.options.decoder.decode(e)}}class Mx{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}}class Fx{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=await this.options.deserializer(e);t!==void 0&&(yield t)}}}class Ox{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream)yield this.options.serializer(e)}}function Nx(i){let e=0,t=0,s=null,r=null;const n=o=>{if(typeof o!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+o);e=o,t=4,s=new Uint8Array(o),new DataView(s.buffer).setUint32(0,o,!1)},a=async function*(){const o=i[Symbol.asyncIterator]();for(;;){const{value:l,done:u}=await o.next();if(u){if(e)if(e===t)yield s;else throw new Error("Truncated event message received.");else return;return}const d=l.length;let f=0;for(;f<d;){if(!s){const v=d-f;r||(r=new Uint8Array(4));const y=Math.min(4-t,v);if(r.set(l.slice(f,f+y),t),t+=y,f+=y,t<4)break;n(new DataView(r.buffer).getUint32(0,!1)),r=null}const g=Math.min(e-t,d-f);s.set(l.slice(f,f+g),t),t+=g,f+=g,e&&e===t&&(yield s,s=null,e=0,t=0)}}};return{[Symbol.asyncIterator]:a}}function Bx(i,e){return async function(t){const{value:s}=t.headers[":message-type"];if(s==="error"){const r=new Error(t.headers[":error-message"].value||"UnknownError");throw r.name=t.headers[":error-code"].value,r}else if(s==="exception"){const r=t.headers[":exception-type"].value,n={[r]:t},a=await i(n);if(a.$unknown){const o=new Error(e(t.body));throw o.name=r,o}throw a[r]}else if(s==="event"){const r={[t.headers[":event-type"].value]:t},n=await i(r);return n.$unknown?void 0:n}else throw Error(`Unrecognizable event type: ${t.headers[":event-type"].value}`)}}let $x=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new Px(e,t),this.utfEncoder=e}deserialize(e,t){const s=Nx(e);return new Fx({messageStream:new Dx({inputStream:s,decoder:this.eventStreamCodec}),deserializer:Bx(t,this.utfEncoder)})}serialize(e,t){return new Mx({messageStream:new Ox({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};const Ux=i=>({[Symbol.asyncIterator]:async function*(){const e=i.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)return;yield s}}finally{e.releaseLock()}}}),Gx=i=>{const e=i[Symbol.asyncIterator]();return new ReadableStream({async pull(t){const{done:s,value:r}=await e.next();if(s)return t.close();t.enqueue(r)}})};class Vx{constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new $x({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){const s=Hx(e)?Ux(e):e;return this.universalMarshaller.deserialize(s,t)}serialize(e,t){const s=this.universalMarshaller.serialize(e,t);return typeof ReadableStream=="function"?Gx(s):s}}const Hx=i=>typeof ReadableStream=="function"&&i instanceof ReadableStream,jx=i=>new Vx(i),hp=i=>()=>Promise.reject(i),Wu=typeof TextEncoder=="function"?new TextEncoder:null,dp=i=>{if(typeof i=="string"){if(Wu)return Wu.encode(i).byteLength;let e=i.length;for(let t=e-1;t>=0;t--){const s=i.charCodeAt(t);s>127&&s<=2047?e++:s>2047&&s<=65535&&(e+=2),s>=56320&&s<=57343&&t--}return e}else{if(typeof i.byteLength=="number")return i.byteLength;if(typeof i.size=="number")return i.size}throw new Error(`Body Length computation failed for ${i}`)},fp="required",Oe="type",ct="rules",ot="conditions",We="fn",qe="argv",gt="ref",vn="assign",Ks="url",zs="properties",Ws="headers",Kx=!0,sr="isSet",Ji="stringEquals",ko="aws.parseArn",Zi="arn",Qt="booleanEquals",is="endpoint",ut="tree",pt="error",Tr={[fp]:!1,[Oe]:"String"},qu={[fp]:!0,default:!1,[Oe]:"Boolean"},Po={[We]:"not",[qe]:[{[We]:sr,[qe]:[{[gt]:"Endpoint"}]}]},pp={[gt]:"Endpoint"},Jn={[We]:sr,[qe]:[{[gt]:"Region"}]},Zn={[We]:"aws.partition",[qe]:[{[gt]:"Region"}],[vn]:"PartitionResult"},Do={[We]:"not",[qe]:[{[We]:Ji,[qe]:[{[We]:"getAttr",[qe]:[{[gt]:"PartitionResult"},"name"]},"aws-iso"]}]},ec={[We]:"getAttr",[qe]:[{[gt]:"PartitionResult"},"name"]},Mo={[We]:"not",[qe]:[{[We]:Ji,[qe]:[ec,"aws-iso-b"]}]},Pa={[We]:"getAttr",[qe]:[{[gt]:"PartitionResult"},"supportsFIPS"]},ys={},gp={[pt]:"FIPS is enabled but this partition does not support FIPS",[Oe]:pt},mp={[pt]:"DualStack is enabled but this partition does not support DualStack",[Oe]:pt},Fo={[pt]:"Invalid ARN: Failed to parse ARN.",[Oe]:pt},Yu={[We]:Qt,[qe]:[!0,{[We]:"getAttr",[qe]:[{[gt]:"PartitionResult"},"supportsDualStack"]}]},Xu=[{[gt]:"StreamARN"}],zx=[{[We]:sr,[qe]:[pp]}],Oo=[{[ot]:[{[We]:"isValidHostLabel",[qe]:[{[We]:"getAttr",[qe]:[{[gt]:Zi},"accountId"]},!1]}],[ct]:[{[ot]:[{[We]:"isValidHostLabel",[qe]:[{[We]:"getAttr",[qe]:[{[gt]:Zi},"region"]},!1]}],[ct]:[{[ot]:[{[We]:Ji,[qe]:[{[We]:"getAttr",[qe]:[{[gt]:Zi},"service"]},"kinesis"]}],[ct]:[{[ot]:[{[We]:"getAttr",[qe]:[{[gt]:Zi},"resourceId[0]"],[vn]:"arnType"},{[We]:"not",[qe]:[{[We]:Ji,[qe]:[{[gt]:"arnType"},""]}]}],[ct]:[{[ot]:[{[We]:Ji,[qe]:[{[gt]:"arnType"},"stream"]}],[ct]:[{[ot]:[{[We]:Ji,[qe]:[ec,"{arn#partition}"]}],[ct]:[{[ot]:[{[We]:sr,[qe]:[{[gt]:"OperationType"}]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[{[gt]:"UseFIPS"},!0]},{[We]:Qt,[qe]:[{[gt]:"UseDualStack"},!0]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[Pa,!0]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[{[We]:"getAttr",[qe]:[{[gt]:"PartitionResult"},"supportsDualStack"]},!0]}],[ct]:[{[is]:{[Ks]:"https://{arn#accountId}.{OperationType}-kinesis-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[zs]:{},[Ws]:{}},[Oe]:is}],[Oe]:ut},{[pt]:"DualStack is enabled, but this partition does not support DualStack.",[Oe]:pt}],[Oe]:ut},{[pt]:"FIPS is enabled, but this partition does not support FIPS.",[Oe]:pt}],[Oe]:ut},{[ot]:[{[We]:Qt,[qe]:[{[gt]:"UseFIPS"},!0]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[Pa,!0]}],[ct]:[{[is]:{[Ks]:"https://{arn#accountId}.{OperationType}-kinesis-fips.{Region}.{PartitionResult#dnsSuffix}",[zs]:{},[Ws]:{}},[Oe]:is}],[Oe]:ut},gp],[Oe]:ut},{[ot]:[{[We]:Qt,[qe]:[{[gt]:"UseDualStack"},!0]}],[ct]:[{[ot]:[{[We]:Qt,[qe]:[{[We]:"getAttr",[qe]:[{[gt]:"PartitionResult"},"supportsDualStack"]},!0]}],[ct]:[{[is]:{[Ks]:"https://{arn#accountId}.{OperationType}-kinesis.{Region}.{PartitionResult#dualStackDnsSuffix}",[zs]:{},[Ws]:{}},[Oe]:is}],[Oe]:ut},mp],[Oe]:ut},{[is]:{[Ks]:"https://{arn#accountId}.{OperationType}-kinesis.{Region}.{PartitionResult#dnsSuffix}",[zs]:{},[Ws]:{}},[Oe]:is}],[Oe]:ut},{[pt]:"Operation Type is not set. Please contact service team for resolution.",[Oe]:pt}],[Oe]:ut},{[pt]:"Partition: {arn#partition} from ARN doesn't match with partition name: {PartitionResult#name}.",[Oe]:pt}],[Oe]:ut},{[pt]:"Invalid ARN: Kinesis ARNs don't support `{arnType}` arn types.",[Oe]:pt}],[Oe]:ut},{[pt]:"Invalid ARN: No ARN type specified",[Oe]:pt}],[Oe]:ut},{[pt]:"Invalid ARN: The ARN was not for the Kinesis service, found: {arn#service}.",[Oe]:pt}],[Oe]:ut},{[pt]:"Invalid ARN: Invalid region.",[Oe]:pt}],[Oe]:ut},{[pt]:"Invalid ARN: Invalid account id.",[Oe]:pt}],Wx=[{[We]:Qt,[qe]:[{[gt]:"UseFIPS"},!0]},{[We]:Qt,[qe]:[{[gt]:"UseDualStack"},!0]}],qx=[{[We]:Qt,[qe]:[Pa,!0]}],Qu=[{[We]:Qt,[qe]:[{[gt]:"UseFIPS"},!0]}],Ju=[{[We]:Qt,[qe]:[{[gt]:"UseDualStack"},!0]}],Zu=[{[gt]:"ConsumerARN"}],eh=[{[gt]:"ResourceARN"}],Yx={version:"1.0",parameters:{Region:Tr,UseDualStack:qu,UseFIPS:qu,Endpoint:Tr,StreamARN:Tr,OperationType:Tr,ConsumerARN:Tr,ResourceARN:Tr},[ct]:[{[ot]:[{[We]:sr,[qe]:Xu},Po,Jn,Zn,Do,Mo],[ct]:[{[ot]:[{[We]:ko,[qe]:Xu,[vn]:Zi}],[ct]:Oo,[Oe]:ut},Fo],[Oe]:ut},{[ot]:[{[We]:sr,[qe]:Zu},Po,Jn,Zn,Do,Mo],[ct]:[{[ot]:[{[We]:ko,[qe]:Zu,[vn]:Zi}],[ct]:Oo,[Oe]:ut},Fo],[Oe]:ut},{[ot]:[{[We]:sr,[qe]:eh},Po,Jn,Zn,Do,Mo],[ct]:[{[ot]:[{[We]:ko,[qe]:eh,[vn]:Zi}],[ct]:Oo,[Oe]:ut},Fo],[Oe]:ut},{[ot]:zx,[ct]:[{[ot]:Qu,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Oe]:pt},{[ot]:Ju,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Oe]:pt},{endpoint:{[Ks]:pp,[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut},{[ot]:[Jn],[ct]:[{[ot]:[Zn],[ct]:[{[ot]:Wx,[ct]:[{[ot]:[{[We]:Qt,[qe]:[Kx,Pa]},Yu],[ct]:[{endpoint:{[Ks]:"https://kinesis-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Oe]:pt}],[Oe]:ut},{[ot]:Qu,[ct]:[{[ot]:qx,[ct]:[{[ot]:[{[We]:Ji,[qe]:[ec,"aws-us-gov"]}],endpoint:{[Ks]:"https://kinesis.{Region}.amazonaws.com",[zs]:ys,[Ws]:ys},[Oe]:is},{endpoint:{[Ks]:"https://kinesis-fips.{Region}.{PartitionResult#dnsSuffix}",[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut},gp],[Oe]:ut},{[ot]:Ju,[ct]:[{[ot]:[Yu],[ct]:[{endpoint:{[Ks]:"https://kinesis.{Region}.{PartitionResult#dualStackDnsSuffix}",[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut},mp],[Oe]:ut},{endpoint:{[Ks]:"https://kinesis.{Region}.{PartitionResult#dnsSuffix}",[zs]:ys,[Ws]:ys},[Oe]:is}],[Oe]:ut}],[Oe]:ut},{error:"Invalid Configuration: Missing Region",[Oe]:pt}]},Xx=Yx,Qx=(i,e={})=>df(Xx,{endpointParams:i,logger:e.logger});bn.aws=zl;const Jx=i=>({apiVersion:"2013-12-02",base64Decoder:(i==null?void 0:i.base64Decoder)??Za,base64Encoder:(i==null?void 0:i.base64Encoder)??Xl,disableHostPrefix:(i==null?void 0:i.disableHostPrefix)??!1,endpointProvider:(i==null?void 0:i.endpointProvider)??Qx,extensions:(i==null?void 0:i.extensions)??[],httpAuthSchemeProvider:(i==null?void 0:i.httpAuthSchemeProvider)??Ay,httpAuthSchemes:(i==null?void 0:i.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Wf}],logger:(i==null?void 0:i.logger)??new ql,serviceId:(i==null?void 0:i.serviceId)??"Kinesis",urlParser:(i==null?void 0:i.urlParser)??wn,utf8Decoder:(i==null?void 0:i.utf8Decoder)??nr,utf8Encoder:(i==null?void 0:i.utf8Encoder)??Yl}),Zx=["in-region","cross-region","mobile","standard","legacy"],vp=({defaultsMode:i}={})=>Xv(async()=>{const e=typeof i=="function"?await i():i;switch(e==null?void 0:e.toLowerCase()){case"auto":return Promise.resolve(eS()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e==null?void 0:e.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Zx.join(", ")}, got ${e}`)}}),eS=()=>{var t,s;const i=typeof window<"u"&&((t=window==null?void 0:window.navigator)!=null&&t.userAgent)?op.parse(window.navigator.userAgent):void 0,e=(s=i==null?void 0:i.platform)==null?void 0:s.type;return e==="tablet"||e==="mobile"},tS=i=>{const e=vp(i),t=()=>e().then(Of),s=Jx(i);return{...s,...i,runtime:"browser",defaultsMode:e,bodyLengthChecker:(i==null?void 0:i.bodyLengthChecker)??dp,credentialDefaultProvider:(i==null?void 0:i.credentialDefaultProvider)??(r=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(i==null?void 0:i.defaultUserAgentProvider)??lp({serviceId:s.serviceId,clientVersion:Wy.version}),eventStreamSerdeProvider:(i==null?void 0:i.eventStreamSerdeProvider)??jx,maxAttempts:(i==null?void 0:i.maxAttempts)??An,region:(i==null?void 0:i.region)??hp("Region is missing"),requestHandler:eo.create((i==null?void 0:i.requestHandler)??t),retryMode:(i==null?void 0:i.retryMode)??(async()=>(await t()).retryMode||Af),sha256:(i==null?void 0:i.sha256)??np,streamCollector:(i==null?void 0:i.streamCollector)??Pf,useDualstackEndpoint:(i==null?void 0:i.useDualstackEndpoint)??(()=>Promise.resolve(gf)),useFipsEndpoint:(i==null?void 0:i.useFipsEndpoint)??(()=>Promise.resolve(mf))}},yp=i=>{let e=async()=>{if(i.region===void 0)throw new Error("Region is missing from runtimeConfig");const t=i.region;return typeof t=="string"?t:t()};return{setRegion(t){e=t},region(){return e}}},xp=i=>({region:i.region()}),sS=i=>{const e=i.httpAuthSchemes;let t=i.httpAuthSchemeProvider,s=i.credentials;return{setHttpAuthScheme(r){const n=e.findIndex(a=>a.schemeId===r.schemeId);n===-1?e.push(r):e.splice(n,1,r)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(r){t=r},httpAuthSchemeProvider(){return t},setCredentials(r){s=r},credentials(){return s}}},iS=i=>({httpAuthSchemes:i.httpAuthSchemes(),httpAuthSchemeProvider:i.httpAuthSchemeProvider(),credentials:i.credentials()}),ea=i=>i,rS=(i,e)=>{const t={...ea(yp(i)),...ea(Nf(i)),...ea(Jd(i)),...ea(sS(i))};return e.forEach(s=>s.configure(t)),{...i,...xp(t),...Bf(t),...Zd(t),...iS(t)}};class nS extends kf{constructor(...[e]){const t=tS(e||{}),s=Cy(t),r=rf(s),n=If(r),a=yf(n),o=a,l=Tf(o),u=Kv(l),d=Ly(u),f=rS(d,(e==null?void 0:e.extensions)||[]);super(f),this.config=f,this.middlewareStack.use(pf(this.config)),this.middlewareStack.use(Gf(this.config)),this.middlewareStack.use(Kf(this.config)),this.middlewareStack.use(ef(this.config)),this.middlewareStack.use(tf(this.config)),this.middlewareStack.use(sf(this.config)),this.middlewareStack.use(wf(this.config,{httpAuthSchemeParametersProvider:Ty,identityProviderConfigProvider:async g=>new Hf({"aws.auth#sigv4":g.credentials})})),this.middlewareStack.use(Vf(this.config))}destroy(){super.destroy()}}class Bt extends to{constructor(e){super(e),Object.setPrototypeOf(this,Bt.prototype)}}class tc extends Bt{constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,tc.prototype)}}class sc extends Bt{constructor(e){super({name:"InvalidArgumentException",$fault:"client",...e}),this.name="InvalidArgumentException",this.$fault="client",Object.setPrototypeOf(this,sc.prototype)}}class ic extends Bt{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ic.prototype)}}class rc extends Bt{constructor(e){super({name:"ResourceInUseException",$fault:"client",...e}),this.name="ResourceInUseException",this.$fault="client",Object.setPrototypeOf(this,rc.prototype)}}class nc extends Bt{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,nc.prototype)}}class ac extends Bt{constructor(e){super({name:"ExpiredIteratorException",$fault:"client",...e}),this.name="ExpiredIteratorException",this.$fault="client",Object.setPrototypeOf(this,ac.prototype)}}class oc extends Bt{constructor(e){super({name:"ExpiredNextTokenException",$fault:"client",...e}),this.name="ExpiredNextTokenException",this.$fault="client",Object.setPrototypeOf(this,oc.prototype)}}class lc extends Bt{constructor(e){super({name:"KMSAccessDeniedException",$fault:"client",...e}),this.name="KMSAccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,lc.prototype)}}class cc extends Bt{constructor(e){super({name:"KMSDisabledException",$fault:"client",...e}),this.name="KMSDisabledException",this.$fault="client",Object.setPrototypeOf(this,cc.prototype)}}class uc extends Bt{constructor(e){super({name:"KMSInvalidStateException",$fault:"client",...e}),this.name="KMSInvalidStateException",this.$fault="client",Object.setPrototypeOf(this,uc.prototype)}}class hc extends Bt{constructor(e){super({name:"KMSNotFoundException",$fault:"client",...e}),this.name="KMSNotFoundException",this.$fault="client",Object.setPrototypeOf(this,hc.prototype)}}class dc extends Bt{constructor(e){super({name:"KMSOptInRequired",$fault:"client",...e}),this.name="KMSOptInRequired",this.$fault="client",Object.setPrototypeOf(this,dc.prototype)}}class fc extends Bt{constructor(e){super({name:"KMSThrottlingException",$fault:"client",...e}),this.name="KMSThrottlingException",this.$fault="client",Object.setPrototypeOf(this,fc.prototype)}}class pc extends Bt{constructor(e){super({name:"ProvisionedThroughputExceededException",$fault:"client",...e}),this.name="ProvisionedThroughputExceededException",this.$fault="client",Object.setPrototypeOf(this,pc.prototype)}}class gc extends Bt{constructor(e){super({name:"ValidationException",$fault:"client",...e}),this.name="ValidationException",this.$fault="client",Object.setPrototypeOf(this,gc.prototype)}}var th;(function(i){i.visit=(e,t)=>e.SubscribeToShardEvent!==void 0?t.SubscribeToShardEvent(e.SubscribeToShardEvent):e.ResourceNotFoundException!==void 0?t.ResourceNotFoundException(e.ResourceNotFoundException):e.ResourceInUseException!==void 0?t.ResourceInUseException(e.ResourceInUseException):e.KMSDisabledException!==void 0?t.KMSDisabledException(e.KMSDisabledException):e.KMSInvalidStateException!==void 0?t.KMSInvalidStateException(e.KMSInvalidStateException):e.KMSAccessDeniedException!==void 0?t.KMSAccessDeniedException(e.KMSAccessDeniedException):e.KMSNotFoundException!==void 0?t.KMSNotFoundException(e.KMSNotFoundException):e.KMSOptInRequired!==void 0?t.KMSOptInRequired(e.KMSOptInRequired):e.KMSThrottlingException!==void 0?t.KMSThrottlingException(e.KMSThrottlingException):e.InternalFailureException!==void 0?t.InternalFailureException(e.InternalFailureException):t._(e.$unknown[0],e.$unknown[1])})(th||(th={}));const aS=async(i,e)=>{const t=CS("PutRecord");let s;return s=JSON.stringify(wS(i,e)),LS(e,t,"/",void 0,s)},oS=async(i,e)=>{if(i.statusCode>=300)return lS(i,e);const t=await Zl(i.body,e);let s={};return s=Pt(t),{$metadata:qt(i),...s}},lS=async(i,e)=>{const t={...i,body:await sp(i.body,e)},s=ip(i,t.body);switch(s){case"AccessDeniedException":case"com.amazonaws.kinesis#AccessDeniedException":throw await cS(t);case"InvalidArgumentException":case"com.amazonaws.kinesis#InvalidArgumentException":throw await dS(t);case"LimitExceededException":case"com.amazonaws.kinesis#LimitExceededException":throw await xS(t);case"ResourceInUseException":case"com.amazonaws.kinesis#ResourceInUseException":throw await ES(t);case"ResourceNotFoundException":case"com.amazonaws.kinesis#ResourceNotFoundException":throw await bS(t);case"ExpiredIteratorException":case"com.amazonaws.kinesis#ExpiredIteratorException":throw await uS(t);case"KMSAccessDeniedException":case"com.amazonaws.kinesis#KMSAccessDeniedException":throw await fS(t);case"KMSDisabledException":case"com.amazonaws.kinesis#KMSDisabledException":throw await pS(t);case"KMSInvalidStateException":case"com.amazonaws.kinesis#KMSInvalidStateException":throw await gS(t);case"KMSNotFoundException":case"com.amazonaws.kinesis#KMSNotFoundException":throw await mS(t);case"KMSOptInRequired":case"com.amazonaws.kinesis#KMSOptInRequired":throw await vS(t);case"KMSThrottlingException":case"com.amazonaws.kinesis#KMSThrottlingException":throw await yS(t);case"ProvisionedThroughputExceededException":case"com.amazonaws.kinesis#ProvisionedThroughputExceededException":throw await SS(t);case"ExpiredNextTokenException":case"com.amazonaws.kinesis#ExpiredNextTokenException":throw await hS(t);case"ValidationException":case"com.amazonaws.kinesis#ValidationException":throw await TS(t);default:const r=t.body;return AS({output:i,parsedBody:r,errorCode:s})}},cS=async(i,e)=>{const t=i.body,s=Pt(t),r=new tc({$metadata:qt(i),...s});return jt(r,t)},uS=async(i,e)=>{const t=i.body,s=Pt(t),r=new ac({$metadata:qt(i),...s});return jt(r,t)},hS=async(i,e)=>{const t=i.body,s=Pt(t),r=new oc({$metadata:qt(i),...s});return jt(r,t)},dS=async(i,e)=>{const t=i.body,s=Pt(t),r=new sc({$metadata:qt(i),...s});return jt(r,t)},fS=async(i,e)=>{const t=i.body,s=Pt(t),r=new lc({$metadata:qt(i),...s});return jt(r,t)},pS=async(i,e)=>{const t=i.body,s=Pt(t),r=new cc({$metadata:qt(i),...s});return jt(r,t)},gS=async(i,e)=>{const t=i.body,s=Pt(t),r=new uc({$metadata:qt(i),...s});return jt(r,t)},mS=async(i,e)=>{const t=i.body,s=Pt(t),r=new hc({$metadata:qt(i),...s});return jt(r,t)},vS=async(i,e)=>{const t=i.body,s=Pt(t),r=new dc({$metadata:qt(i),...s});return jt(r,t)},yS=async(i,e)=>{const t=i.body,s=Pt(t),r=new fc({$metadata:qt(i),...s});return jt(r,t)},xS=async(i,e)=>{const t=i.body,s=Pt(t),r=new ic({$metadata:qt(i),...s});return jt(r,t)},SS=async(i,e)=>{const t=i.body,s=Pt(t),r=new pc({$metadata:qt(i),...s});return jt(r,t)},ES=async(i,e)=>{const t=i.body,s=Pt(t),r=new rc({$metadata:qt(i),...s});return jt(r,t)},bS=async(i,e)=>{const t=i.body,s=Pt(t),r=new nc({$metadata:qt(i),...s});return jt(r,t)},TS=async(i,e)=>{const t=i.body,s=Pt(t),r=new gc({$metadata:qt(i),...s});return jt(r,t)},wS=(i,e)=>$f(i,{Data:e.base64Encoder,ExplicitHashKey:[],PartitionKey:[],SequenceNumberForOrdering:[],StreamARN:[],StreamName:[]}),qt=i=>({httpStatusCode:i.statusCode,requestId:i.headers["x-amzn-requestid"]??i.headers["x-amzn-request-id"]??i.headers["x-amz-request-id"],extendedRequestId:i.headers["x-amz-id-2"],cfId:i.headers["x-amz-cf-id"]}),AS=Ff(Bt),LS=async(i,e,t,s,r)=>{const{hostname:n,protocol:a="https",port:o,path:l}=await i.endpoint(),u={protocol:a,hostname:n,port:o,method:"POST",path:l.endsWith("/")?l.slice(0,-1)+t:l+t,headers:e};return r!==void 0&&(u.body=r),new ns(u)};function CS(i){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`Kinesis_20131202.${i}`}}class RS extends Ql.classBuilder().ep({...Ry,OperationType:{type:"staticContextParams",value:"data"},StreamARN:{type:"contextParams",name:"StreamARN"}}).m(function(e,t,s,r){return[Sf(s,this.serialize,this.deserialize),bf(s,e.getEndpointParameterInstructions())]}).s("Kinesis_20131202","PutRecord",{}).n("KinesisClient","PutRecordCommand").f(void 0,void 0).ser(aS).de(oS).build(){}function Sp(i){return Promise.all(Object.keys(i).reduce((e,t)=>{const s=i[t];return typeof s=="string"?e.push([t,s]):e.push(s().then(r=>[t,r])),e},[])).then(e=>e.reduce((t,[s,r])=>(t[s]=r,t),{}))}function _S(i){return async()=>{var o,l,u;(o=i.logger)==null||o.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");const{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:t}=await Promise.resolve().then(()=>require("./DkZ1BWlw.cjs.js")),{Credentials:{AccessKeyId:s=IS(i.logger),Expiration:r,SecretKey:n=PS(i.logger),SessionToken:a}=kS(i.logger)}=await(i.client??new t(Object.assign({},i.clientConfig??{},{region:((l=i.clientConfig)==null?void 0:l.region)??((u=i.parentClientConfig)==null?void 0:u.region)}))).send(new e({CustomRoleArn:i.customRoleArn,IdentityId:i.identityId,Logins:i.logins?await Sp(i.logins):void 0}));return{identityId:i.identityId,accessKeyId:s,secretAccessKey:n,sessionToken:a,expiration:r}}}function IS(i){throw new Hr("Response from Amazon Cognito contained no access key ID",{logger:i})}function kS(i){throw new Hr("Response from Amazon Cognito contained no credentials",{logger:i})}function PS(i){throw new Hr("Response from Amazon Cognito contained no secret key",{logger:i})}const No="IdentityIds";class DS{constructor(e="aws:cognito-identity-ids"){this.dbName=e}getItem(e){return this.withObjectStore("readonly",t=>{const s=t.get(e);return new Promise(r=>{s.onerror=()=>r(null),s.onsuccess=()=>r(s.result?s.result.value:null)})}).catch(()=>null)}removeItem(e){return this.withObjectStore("readwrite",t=>{const s=t.delete(e);return new Promise((r,n)=>{s.onerror=()=>n(s.error),s.onsuccess=()=>r()})})}setItem(e,t){return this.withObjectStore("readwrite",s=>{const r=s.put({id:e,value:t});return new Promise((n,a)=>{r.onerror=()=>a(r.error),r.onsuccess=()=>n()})})}getDb(){const e=self.indexedDB.open(this.dbName,1);return new Promise((t,s)=>{e.onsuccess=()=>{t(e.result)},e.onerror=()=>{s(e.error)},e.onblocked=()=>{s(new Error("Unable to access DB"))},e.onupgradeneeded=()=>{const r=e.result;r.onerror=()=>{s(new Error("Failed to create object store"))},r.createObjectStore(No,{keyPath:"id"})}})}withObjectStore(e,t){return this.getDb().then(s=>{const r=s.transaction(No,e);return r.oncomplete=()=>s.close(),new Promise((n,a)=>{r.onerror=()=>a(r.error),n(t(r.objectStore(No)))}).catch(n=>{throw s.close(),n})})}}class MS{constructor(e={}){this.store=e}getItem(e){return e in this.store?this.store[e]:null}removeItem(e){delete this.store[e]}setItem(e,t){this.store[e]=t}}const FS=new MS;function OS(){return typeof self=="object"&&self.indexedDB?new DS:typeof window=="object"&&window.localStorage?window.localStorage:FS}function NS({accountId:i,cache:e=OS(),client:t,clientConfig:s,customRoleArn:r,identityPoolId:n,logins:a,userIdentifier:o=!a||Object.keys(a).length===0?"ANONYMOUS":void 0,logger:l,parentClientConfig:u}){l==null||l.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");const d=o?`aws:cognito-identity-credentials:${n}:${o}`:void 0;let f=async()=>{const{GetIdCommand:g,CognitoIdentityClient:v}=await Promise.resolve().then(()=>require("./DkZ1BWlw.cjs.js")),y=t??new v(Object.assign({},s??{},{region:(s==null?void 0:s.region)??(u==null?void 0:u.region)}));let E=d&&await e.getItem(d);if(!E){const{IdentityId:b=BS(l)}=await y.send(new g({AccountId:i,IdentityPoolId:n,Logins:a?await Sp(a):void 0}));E=b,d&&Promise.resolve(e.setItem(d,E)).catch(()=>{})}return f=_S({client:y,customRoleArn:r,logins:a,identityId:E}),f()};return()=>f().catch(async g=>{throw d&&Promise.resolve(e.removeItem(d)).catch(()=>{}),g})}function BS(i){throw new Hr("Response from Amazon Cognito contained no identity ID",{logger:i})}const $S=async(i,e,t)=>({operation:Dn(e).operation,region:await yi(i.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function US(i){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:i.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function ta(i){return{schemeId:"smithy.api#noAuth"}}const GS=i=>{const e=[];switch(i.operation){case"GetCredentialsForIdentity":{e.push(ta());break}case"GetId":{e.push(ta());break}case"GetOpenIdToken":{e.push(ta());break}case"UnlinkIdentity":{e.push(ta());break}default:e.push(US(i))}return e},VS=i=>({...tp(i)}),HS=i=>({...i,useDualstackEndpoint:i.useDualstackEndpoint??!1,useFipsEndpoint:i.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),jS={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},KS="@aws-sdk/client-cognito-identity",zS="AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",WS="3.637.0",qS={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo cognito-identity","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js"},YS="./dist-cjs/index.js",XS="./dist-types/index.d.ts",QS="./dist-es/index.js",JS=!1,ZS={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.637.0","@aws-sdk/client-sts":"3.637.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.637.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.637.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.637.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},e1={"@aws-sdk/client-iam":"3.637.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},t1={node:">=16.0.0"},s1={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},i1=["dist-*/**"],r1={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},n1="Apache-2.0",a1={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},o1="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity",l1={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity"},c1={name:KS,description:zS,version:WS,scripts:qS,main:YS,types:XS,module:QS,sideEffects:JS,dependencies:ZS,devDependencies:e1,engines:t1,typesVersions:s1,files:i1,author:r1,license:n1,browser:a1,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:o1,repository:l1},Ep="required",Ys="fn",Xs="argv",jr="ref",sh=!0,ih="isSet",Cn="booleanEquals",wr="error",on="endpoint",hi="tree",mc="PartitionResult",rh={[Ep]:!1,type:"String"},nh={[Ep]:!0,default:!1,type:"Boolean"},ah={[jr]:"Endpoint"},bp={[Ys]:Cn,[Xs]:[{[jr]:"UseFIPS"},!0]},Tp={[Ys]:Cn,[Xs]:[{[jr]:"UseDualStack"},!0]},Gs={},oh={[Ys]:"getAttr",[Xs]:[{[jr]:mc},"supportsFIPS"]},lh={[Ys]:Cn,[Xs]:[!0,{[Ys]:"getAttr",[Xs]:[{[jr]:mc},"supportsDualStack"]}]},ch=[bp],uh=[Tp],hh=[{[jr]:"Region"}],u1={version:"1.0",parameters:{Region:rh,UseDualStack:nh,UseFIPS:nh,Endpoint:rh},rules:[{conditions:[{[Ys]:ih,[Xs]:[ah]}],rules:[{conditions:ch,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:wr},{conditions:uh,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:wr},{endpoint:{url:ah,properties:Gs,headers:Gs},type:on}],type:hi},{conditions:[{[Ys]:ih,[Xs]:hh}],rules:[{conditions:[{[Ys]:"aws.partition",[Xs]:hh,assign:mc}],rules:[{conditions:[bp,Tp],rules:[{conditions:[{[Ys]:Cn,[Xs]:[sh,oh]},lh],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Gs,headers:Gs},type:on}],type:hi},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:wr}],type:hi},{conditions:ch,rules:[{conditions:[{[Ys]:Cn,[Xs]:[oh,sh]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Gs,headers:Gs},type:on}],type:hi},{error:"FIPS is enabled but this partition does not support FIPS",type:wr}],type:hi},{conditions:uh,rules:[{conditions:[lh],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Gs,headers:Gs},type:on}],type:hi},{error:"DualStack is enabled but this partition does not support DualStack",type:wr}],type:hi},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:Gs,headers:Gs},type:on}],type:hi}],type:hi},{error:"Invalid Configuration: Missing Region",type:wr}]},h1=u1,d1=(i,e={})=>df(h1,{endpointParams:i,logger:e.logger});bn.aws=zl;const f1=i=>({apiVersion:"2014-06-30",base64Decoder:(i==null?void 0:i.base64Decoder)??Za,base64Encoder:(i==null?void 0:i.base64Encoder)??Xl,disableHostPrefix:(i==null?void 0:i.disableHostPrefix)??!1,endpointProvider:(i==null?void 0:i.endpointProvider)??d1,extensions:(i==null?void 0:i.extensions)??[],httpAuthSchemeProvider:(i==null?void 0:i.httpAuthSchemeProvider)??GS,httpAuthSchemes:(i==null?void 0:i.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Wf},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Uv}],logger:(i==null?void 0:i.logger)??new ql,serviceId:(i==null?void 0:i.serviceId)??"Cognito Identity",urlParser:(i==null?void 0:i.urlParser)??wn,utf8Decoder:(i==null?void 0:i.utf8Decoder)??nr,utf8Encoder:(i==null?void 0:i.utf8Encoder)??Yl}),p1=i=>{const e=vp(i),t=()=>e().then(Of),s=f1(i);return{...s,...i,runtime:"browser",defaultsMode:e,bodyLengthChecker:(i==null?void 0:i.bodyLengthChecker)??dp,credentialDefaultProvider:(i==null?void 0:i.credentialDefaultProvider)??(r=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(i==null?void 0:i.defaultUserAgentProvider)??lp({serviceId:s.serviceId,clientVersion:c1.version}),maxAttempts:(i==null?void 0:i.maxAttempts)??An,region:(i==null?void 0:i.region)??hp("Region is missing"),requestHandler:eo.create((i==null?void 0:i.requestHandler)??t),retryMode:(i==null?void 0:i.retryMode)??(async()=>(await t()).retryMode||Af),sha256:(i==null?void 0:i.sha256)??np,streamCollector:(i==null?void 0:i.streamCollector)??Pf,useDualstackEndpoint:(i==null?void 0:i.useDualstackEndpoint)??(()=>Promise.resolve(gf)),useFipsEndpoint:(i==null?void 0:i.useFipsEndpoint)??(()=>Promise.resolve(mf))}},g1=i=>{const e=i.httpAuthSchemes;let t=i.httpAuthSchemeProvider,s=i.credentials;return{setHttpAuthScheme(r){const n=e.findIndex(a=>a.schemeId===r.schemeId);n===-1?e.push(r):e.splice(n,1,r)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(r){t=r},httpAuthSchemeProvider(){return t},setCredentials(r){s=r},credentials(){return s}}},m1=i=>({httpAuthSchemes:i.httpAuthSchemes(),httpAuthSchemeProvider:i.httpAuthSchemeProvider(),credentials:i.credentials()}),sa=i=>i,v1=(i,e)=>{const t={...sa(yp(i)),...sa(Nf(i)),...sa(Jd(i)),...sa(g1(i))};return e.forEach(s=>s.configure(t)),{...i,...xp(t),...Bf(t),...Zd(t),...m1(t)}};class wp extends kf{constructor(...[e]){const t=p1(e||{}),s=HS(t),r=rf(s),n=If(r),a=yf(n),o=a,l=Tf(o),u=VS(l),d=v1(u,(e==null?void 0:e.extensions)||[]);super(d),this.config=d,this.middlewareStack.use(pf(this.config)),this.middlewareStack.use(Gf(this.config)),this.middlewareStack.use(Kf(this.config)),this.middlewareStack.use(ef(this.config)),this.middlewareStack.use(tf(this.config)),this.middlewareStack.use(sf(this.config)),this.middlewareStack.use(wf(this.config,{httpAuthSchemeParametersProvider:$S,identityProviderConfigProvider:async f=>new Hf({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(Vf(this.config))}destroy(){super.destroy()}}const dh={prod:{identityPoolId:"ap-northeast-2:719e14e9-badd-4b73-9496-39303c66cd62",streamName:"brixCloud_analysis_prod"},stage:{identityPoolId:"ap-northeast-2:1df47bbd-2ed8-4edd-9e1d-0474bc52f0af",streamName:"brixCloud_analysis_stage"},dev:{identityPoolId:"ap-northeast-2:1df47bbd-2ed8-4edd-9e1d-0474bc52f0af",streamName:"brixCloud_analysis_dev"}};class y1{constructor({identityPoolId:e,streamName:t}){this.data={ua:{s:17,a:6,g:2,o:this.getOS(),b:this.getBrowser()},ts:{tt:0,wt:0,ws:0},di:{},ii:{p:1}},this.loopId=null;const s=new URLSearchParams(window.location.search);this.client=new nS({region:"ap-northeast-2",credentials:NS({client:new wp({region:"ap-northeast-2"}),identityPoolId:e})}),this.streamName=t,this.data.um={s:s.get("utm_source")??void 0}}send(e){const t=JSON.stringify(e??this.data),s=new RS({Data:new TextEncoder().encode(t),PartitionKey:"partitionKey-"+Math.random(),StreamName:this.streamName});this.client.send(s)}sleep(e){return new Promise(t=>setTimeout(t,e))}interval(e,t){return new Promise(s=>{this.loopId=setInterval(()=>{t(e),s()},e)})}timeout(e,t){return new Promise(s=>{this.loopId=setTimeout(()=>{t(e),s()},e)})}getOS(){const e=window.navigator.userAgent.toLowerCase();let t="기타";return e.indexOf("windows")>=0?t="Windows":e.indexOf("iphone")>=0||e.indexOf("ipad")>=0||e.indexOf("ipod")>=0?t="iOS":e.indexOf("mac")>=0?t="macOS":e.indexOf("android")>=0?t="Android":e.indexOf("linux")>=0&&(t="Linux"),["Windows","macOS","iOS","Android","Linux","기타"].indexOf(t)}getBrowser(){const e=window.navigator.userAgent.toLowerCase();let t="기타";return e.indexOf("edg")>=0?t="Edge":e.indexOf("chrome")>=0?t="Chrome":e.indexOf("safari")>=0?t="Safari":e.indexOf("firefox")>=0?t="Firefox":e.indexOf("trident")>=0&&(t="Internet Explorer"),["Chrome","Safari","Firefox","Internet Explorer","Edge","기타"].indexOf(t)}init(){this.data.ii.p=1}async start(){var t;if(!this.data.ty)return;if(this.loopId&&(clearTimeout(this.loopId),clearInterval(this.loopId)),this.data.ts.wt=new Date().getTime(),this.data.ty==="c"&&!this.data.di.iv){await this.sleep(500),this.stop(),this.init(),this.start();return}(t=window==null?void 0:window.__brix_console)==null||t.call(window,"entryTime",new Date(this.data.ts.wt).toLocaleString());const e=s=>{var n,a;s>1e3&&(this.data.ii.p=0),this.data.ii.i=s;const r=new Date().getTime();this.data.ts.tt=r,this.data.ts.ws=+((r-this.data.ts.wt)/1e3).toFixed(0),(n=window==null?void 0:window.__brix_console)==null||n.call(window,"watchingTime",this.data.ts.ws),(a=window==null?void 0:window.__brix_console)==null||a.call(window,"viewCount",{current:this.data.ii.p}),this.send()};await this.timeout(1e3,e),await this.timeout(3e3,e),await this.timeout(6e3,e),await this.interval(1e4,e)}stop(){this.loopId&&(clearTimeout(this.loopId),clearInterval(this.loopId))}sendAnalyze({like:e,comment:t,product:s,share:r,banner:n}){var o,l,u,d,f;const a={...this.data};e&&(a.cc={lk:e},(o=window==null?void 0:window.__brix_console)==null||o.call(window,"likeCount",{current:e})),t&&(a.cc={c:1},(l=window==null?void 0:window.__brix_console)==null||l.call(window,"commentCount",1)),r&&(a.cc={s:1},(u=window==null?void 0:window.__brix_console)==null||u.call(window,"shareCount",1)),s&&(a.pc={ip:s,tp:this.data.ts.wt},(d=window==null?void 0:window.__brix_console)==null||d.call(window,"productCount",1)),n&&(a.bc={ib:n,tb:this.data.ts.wt},(f=window==null?void 0:window.__brix_console)==null||f.call(window,"bannerCount",1)),this.send(a)}setUser(e,t){var s,r;this.data.di.iu=e,this.data.di.tu=t===0?"g":"m",(s=window==null?void 0:window.__brix_console)==null||s.call(window,"userId",e),(r=window==null?void 0:window.__brix_console)==null||r.call(window,"authType",t===0?"비회원":"회원"),this.stop(),this.init(),this.start()}setId(e){var t,s;this.data.ty&&(this.data.ty==="b"?(this.data.di.ib=e,delete this.data.di.is,delete this.data.di.icc,delete this.data.di.iugc):this.data.ty==="s"?(this.data.di.is=e,this.data.ii.s="vod",delete this.data.di.ib,delete this.data.di.icc,delete this.data.di.iugc):this.data.ty==="c"?(this.data.di.icc=e,this.data.ii.s="vod",delete this.data.di.ib,delete this.data.di.is,delete this.data.di.iugc):this.data.ty==="u"?(this.data.di.iugc=e,this.data.ii.s="vod",delete this.data.di.ib,delete this.data.di.is,delete this.data.di.icc):this.data.ty==="l"&&(this.data.di.il=e,this.data.ii.s="vod"),(t=window==null?void 0:window.__brix_console)==null||t.call(window,"id",e),(s=this.data.di)!=null&&s.iu&&(this.stop(),this.init(),this.start()))}setClientId(e){var t;this.data.di.ic=e,(t=window==null?void 0:window.__brix_console)==null||t.call(window,"clientId",e)}setStatus(e){this.data.ii.s=e,e==="cancel"&&this.stop()}setType(e){e==="broadcast"?this.data.ty="b":e==="shorts"?this.data.ty="s":e==="channel"?this.data.ty="c":e==="library"?this.data.ty="l":e==="ugc"&&(this.data.ty="u")}setChannelVodId(e){this.data.di.iv=e,this.init()}setChannelScheduleId(e){this.data.di.ics=e}getAPIQuery(){const e=new Date().getTime(),t=+((e-this.data.ts.wt)/1e3).toFixed(0),s={tt:e,ws:t,wt:this.data.ts.wt,p:this.data.ii.p,s:this.data.ii.s};return this.data.ty==="c"?{...s,vodId:this.data.di.iv,ics:this.data.di.ics}:s}}const x1=fe.createContext(null);function S1({kinesis:i,children:e}){return Ne.jsx(x1.Provider,{value:i??null,children:e})}function E1({element:i,eventName:e,handler:t}){const s=fe.useRef();fe.useEffect(()=>{s.current=t},[t]),fe.useEffect(()=>{if(!(i&&i.addEventListener))return;const r=n=>{s.current&&s.current(n)};return i.addEventListener(e,r),()=>{i.removeEventListener(e,r)}},[e,i])}function fh(i=!1){const[e,t]=fe.useState(i);return[e,()=>t(r=>!r)]}function b1({onClick:i,onDoubleClick:e,time:t=250}){const s=fe.useRef(),r=fe.useRef(0),n=()=>{s.current&&(clearTimeout(s.current),s.current=void 0)};return fe.useCallback(o=>{r.current+=1,n(),s.current=setTimeout(()=>{r.current===1?i==null||i(o):r.current===2&&(e==null||e(o)),r.current=0},t)},[i,e,t])}function T1(i,e=500){const[t,s]=fe.useState(i);return fe.useEffect(()=>{let r;const n=()=>{s(i)};return(()=>{clearTimeout(r),r=setTimeout(n,e)})(),()=>clearTimeout(r)},[t,i,e]),[t,s]}function w1({ref:i,...e}){const[t,s]=fe.useState(!1);return fe.useEffect(()=>{const r=i==null?void 0:i.current;if(!r||!window.IntersectionObserver)return;const n=new IntersectionObserver(a=>{if(a.length>0){const o=a[0];s(o.isIntersecting)}},e);return n.observe(r),()=>{n.unobserve(r),n.disconnect()}},[]),t}fe.createContext(null);fe.forwardRef(function({overlayElement:e,onExit:t},s){const[r,n]=fe.useState(!1),a=fe.useCallback(()=>n(!1),[]);return fe.useImperativeHandle(s,()=>({close:a}),[a]),fe.useEffect(()=>{requestAnimationFrame(()=>{n(!0)})},[]),Ne.jsx(e,{isOpen:r,close:a,exit:t})});const A1={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,e){console&&console[i]&&console[i].apply(console,e)}};class Da{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||A1,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,s,r){return r&&!this.debug?null:(typeof e[0]=="string"&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Da(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Da(this.logger,e)}}var Qs=new Da;let so=class{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const r=this.observers[s].get(t)||0;this.observers[s].set(t,r+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r<t;r++)s[r-1]=arguments[r];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(a=>{let[o,l]=a;for(let u=0;u<l;u++)o(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[o,l]=a;for(let u=0;u<l;u++)o.apply(o,[e,...s])})}};const ln=()=>{let i,e;const t=new Promise((s,r)=>{i=s,e=r});return t.resolve=i,t.reject=e,t},ph=i=>i==null?"":""+i,L1=(i,e,t)=>{i.forEach(s=>{e[s]&&(t[s]=e[s])})},C1=/###/g,gh=i=>i&&i.indexOf("###")>-1?i.replace(C1,"."):i,mh=i=>!i||typeof i=="string",yn=(i,e,t)=>{const s=typeof e!="string"?e:e.split(".");let r=0;for(;r<s.length-1;){if(mh(i))return{};const n=gh(s[r]);!i[n]&&t&&(i[n]=new t),Object.prototype.hasOwnProperty.call(i,n)?i=i[n]:i={},++r}return mh(i)?{}:{obj:i,k:gh(s[r])}},vh=(i,e,t)=>{const{obj:s,k:r}=yn(i,e,Object);if(s!==void 0||e.length===1){s[r]=t;return}let n=e[e.length-1],a=e.slice(0,e.length-1),o=yn(i,a,Object);for(;o.obj===void 0&&a.length;)n=`${a[a.length-1]}.${n}`,a=a.slice(0,a.length-1),o=yn(i,a,Object),o&&o.obj&&typeof o.obj[`${o.k}.${n}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${n}`]=t},R1=(i,e,t,s)=>{const{obj:r,k:n}=yn(i,e,Object);r[n]=r[n]||[],r[n].push(t)},Ma=(i,e)=>{const{obj:t,k:s}=yn(i,e);if(t)return t[s]},_1=(i,e,t)=>{const s=Ma(i,t);return s!==void 0?s:Ma(e,t)},Ap=(i,e,t)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in i?typeof i[s]=="string"||i[s]instanceof String||typeof e[s]=="string"||e[s]instanceof String?t&&(i[s]=e[s]):Ap(i[s],e[s],t):i[s]=e[s]);return i},Ar=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var I1={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const k1=i=>typeof i=="string"?i.replace(/[&<>"'\/]/g,e=>I1[e]):i;class P1{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const D1=[" ",",","?","!",";"],M1=new P1(20),F1=(i,e,t)=>{e=e||"",t=t||"";const s=D1.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(s.length===0)return!0;const r=M1.getRegExp(`(${s.map(a=>a==="?"?"\\?":a).join("|")})`);let n=!r.test(i);if(!n){const a=i.indexOf(t);a>0&&!r.test(i.substring(0,a))&&(n=!0)}return n},Tl=function(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!i)return;if(i[e])return i[e];const s=e.split(t);let r=i;for(let n=0;n<s.length;){if(!r||typeof r!="object")return;let a,o="";for(let l=n;l<s.length;++l)if(l!==n&&(o+=t),o+=s[l],a=r[o],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<s.length-1)continue;n+=l-n+1;break}r=a}return r},Fa=i=>i&&i.indexOf("_")>0?i.replace("_","-"):i;class yh extends so{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const n=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],s&&(Array.isArray(s)?o.push(...s):typeof s=="string"&&n?o.push(...s.split(n)):o.push(s)));const l=Ma(this.data,o);return!l&&!t&&!s&&e.indexOf(".")>-1&&(e=o[0],t=o[1],s=o.slice(2).join(".")),l||!a||typeof s!="string"?l:Tl(this.data&&this.data[e]&&this.data[e][t],s,n)}addResource(e,t,s,r){let n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=[e,t];s&&(o=o.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(o=e.split("."),r=t,t=o[1]),this.addNamespaces(t),vh(this.data,o,r),n.silent||this.emit("added",e,t,s,r)}addResources(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const n in s)(typeof s[n]=="string"||Array.isArray(s[n]))&&this.addResource(e,t,n,s[n],{silent:!0});r.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,r,n){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),r=s,s=t,t=o[1]),this.addNamespaces(t);let l=Ma(this.data,o)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),r?Ap(l,s,n):l={...l,...s},vh(this.data,o,l),a.silent||this.emit("added",e,t,s)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var Lp={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,e,t,s,r){return i.forEach(n=>{this.processors[n]&&(e=this.processors[n].process(e,t,s,r))}),e}};const xh={};class Oa extends so{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),L1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Qs.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const s=this.resolve(e,t);return s&&s.res!==void 0}extractFromKey(e,t){let s=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const a=s&&e.indexOf(s)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!F1(e,s,r);if(a&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:n};const u=e.split(s);(s!==r||s===r&&this.options.ns.indexOf(u[0])>-1)&&(n=u.shift()),e=u.join(r)}return typeof n=="string"&&(n=[n]),{key:e,namespaces:n}}translate(e,t,s){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,n=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:a,namespaces:o}=this.extractFromKey(e[e.length-1],t),l=o[o.length-1],u=t.lng||this.language,d=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const U=t.nsSeparator||this.options.nsSeparator;return r?{res:`${l}${U}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${U}${a}`}return r?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:a}const f=this.resolve(e,t);let g=f&&f.res;const v=f&&f.usedKey||a,y=f&&f.exactUsedKey||a,E=Object.prototype.toString.apply(g),b=["[object Number]","[object Function]","[object RegExp]"],w=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,F=!this.i18nFormat||this.i18nFormat.handleAsObject;if(F&&g&&(typeof g!="string"&&typeof g!="boolean"&&typeof g!="number")&&b.indexOf(E)<0&&!(typeof w=="string"&&Array.isArray(g))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const U=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,g,{...t,ns:o}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(f.res=U,f.usedParams=this.getUsedParamsDetails(t),f):U}if(n){const U=Array.isArray(g),N=U?[]:{},te=U?y:v;for(const j in g)if(Object.prototype.hasOwnProperty.call(g,j)){const re=`${te}${n}${j}`;N[j]=this.translate(re,{...t,joinArrays:!1,ns:o}),N[j]===re&&(N[j]=g[j])}g=N}}else if(F&&typeof w=="string"&&Array.isArray(g))g=g.join(w),g&&(g=this.extendTranslation(g,e,t,s));else{let U=!1,N=!1;const te=t.count!==void 0&&typeof t.count!="string",j=Oa.hasDefaultValue(t),re=te?this.pluralResolver.getSuffix(u,t.count,t):"",Q=t.ordinal&&te?this.pluralResolver.getSuffix(u,t.count,{ordinal:!1}):"",le=te&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),se=le&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${re}`]||t[`defaultValue${Q}`]||t.defaultValue;!this.isValidLookup(g)&&j&&(U=!0,g=se),this.isValidLookup(g)||(N=!0,g=a);const de=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:g,be=j&&se!==g&&this.options.updateMissing;if(N||U||be){if(this.logger.log(be?"updateKey":"missingKey",u,l,a,be?se:g),n){const we=this.resolve(a,{...t,keySeparator:!1});we&&we.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Le=[];const ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(let we=0;we<ue.length;we++)Le.push(ue[we]);else this.options.saveMissingTo==="all"?Le=this.languageUtils.toResolveHierarchy(t.lng||this.language):Le.push(t.lng||this.language);const he=(we,me,ye)=>{const Ve=j&&ye!==g?ye:de;this.options.missingKeyHandler?this.options.missingKeyHandler(we,l,me,Ve,be,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(we,l,me,Ve,be,t),this.emit("missingKey",we,l,me,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&te?Le.forEach(we=>{const me=this.pluralResolver.getSuffixes(we,t);le&&t[`defaultValue${this.options.pluralSeparator}zero`]&&me.indexOf(`${this.options.pluralSeparator}zero`)<0&&me.push(`${this.options.pluralSeparator}zero`),me.forEach(ye=>{he([we],a+ye,t[`defaultValue${ye}`]||se)})}):he(Le,a,se))}g=this.extendTranslation(g,e,t,f,s),N&&g===a&&this.options.appendNamespaceToMissingKey&&(g=`${l}:${a}`),(N||U)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,U?g:void 0):g=this.options.parseMissingKeyHandler(g))}return r?(f.res=g,f.usedParams=this.getUsedParamsDetails(t),f):g}extendTranslation(e,t,s,r,n){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const u=typeof e=="string"&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const g=e.match(this.interpolator.nestingRegexp);d=g&&g.length}let f=s.replace&&typeof s.replace!="string"?s.replace:s;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),e=this.interpolator.interpolate(e,f,s.lng||this.language||r.usedLng,s),u){const g=e.match(this.interpolator.nestingRegexp),v=g&&g.length;d<v&&(s.nest=!1)}!s.lng&&this.options.compatibilityAPI!=="v1"&&r&&r.res&&(s.lng=this.language||r.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var g=arguments.length,v=new Array(g),y=0;y<g;y++)v[y]=arguments[y];return n&&n[0]===v[0]&&!s.context?(a.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${t[0]}`),null):a.translate(...v,t)},s)),s.interpolation&&this.interpolator.reset()}const o=s.postProcess||this.options.postProcess,l=typeof o=="string"?[o]:o;return e!=null&&l&&l.length&&s.applyPostProcessor!==!1&&(e=Lp.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s,r,n,a,o;return typeof e=="string"&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(s))return;const u=this.extractFromKey(l,t),d=u.key;r=d;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const g=t.count!==void 0&&typeof t.count!="string",v=g&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),y=t.context!==void 0&&(typeof t.context=="string"||typeof t.context=="number")&&t.context!=="",E=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);f.forEach(b=>{this.isValidLookup(s)||(o=b,!xh[`${E[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(o)&&(xh[`${E[0]}-${b}`]=!0,this.logger.warn(`key "${r}" for languages "${E.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),E.forEach(w=>{if(this.isValidLookup(s))return;a=w;const F=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(F,d,w,b,t);else{let U;g&&(U=this.pluralResolver.getSuffix(w,t.count,t));const N=`${this.options.pluralSeparator}zero`,te=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(F.push(d+U),t.ordinal&&U.indexOf(te)===0&&F.push(d+U.replace(te,this.options.pluralSeparator)),v&&F.push(d+N)),y){const j=`${d}${this.options.contextSeparator}${t.context}`;F.push(j),g&&(F.push(j+U),t.ordinal&&U.indexOf(te)===0&&F.push(j+U.replace(te,this.options.pluralSeparator)),v&&F.push(j+N))}}let k;for(;k=F.pop();)this.isValidLookup(s)||(n=k,s=this.getResource(w,b,k,t))}))})}),{res:s,usedKey:r,exactUsedKey:n,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,s,r):this.resourceStore.getResource(e,t,s,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&typeof e.replace!="string";let r=s?e.replace:e;if(s&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!s){r={...r};for(const n of t)delete r[n]}return r}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,t.length)&&e[s]!==void 0)return!0;return!1}}const Bo=i=>i.charAt(0).toUpperCase()+i.slice(1);class Sh{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Qs.create("languageUtils")}getScriptPartFromCode(e){if(e=Fa(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=Fa(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const t=["hans","hant","latn","cyrl","cans","mong","arab"];let s=e.split("-");return this.options.lowerCaseLng?s=s.map(r=>r.toLowerCase()):s.length===2?(s[0]=s[0].toLowerCase(),s[1]=s[1].toUpperCase(),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=Bo(s[1].toLowerCase()))):s.length===3&&(s[0]=s[0].toLowerCase(),s[1].length===2&&(s[1]=s[1].toUpperCase()),s[0]!=="sgn"&&s[2].length===2&&(s[2]=s[2].toUpperCase()),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=Bo(s[1].toLowerCase())),t.indexOf(s[2].toLowerCase())>-1&&(s[2]=Bo(s[2].toLowerCase()))),s.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(s=>{if(t)return;const r=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(s=>{if(t)return;const r=this.getLanguagePartFromCode(s);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(n=>{if(n===r)return n;if(!(n.indexOf("-")<0&&r.indexOf("-")<0)&&(n.indexOf("-")>0&&r.indexOf("-")<0&&n.substring(0,n.indexOf("-"))===r||n.indexOf(r)===0&&r.length>1))return n})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),typeof e=="string"&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],n=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):typeof e=="string"&&n(this.formatLanguageCode(e)),s.forEach(a=>{r.indexOf(a)<0&&n(this.formatLanguageCode(a))}),r}}let O1=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],N1={1:i=>+(i>1),2:i=>+(i!=1),3:i=>0,4:i=>i%10==1&&i%100!=11?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2,5:i=>i==0?0:i==1?1:i==2?2:i%100>=3&&i%100<=10?3:i%100>=11?4:5,6:i=>i==1?0:i>=2&&i<=4?1:2,7:i=>i==1?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2,8:i=>i==1?0:i==2?1:i!=8&&i!=11?2:3,9:i=>+(i>=2),10:i=>i==1?0:i==2?1:i<7?2:i<11?3:4,11:i=>i==1||i==11?0:i==2||i==12?1:i>2&&i<20?2:3,12:i=>+(i%10!=1||i%100==11),13:i=>+(i!==0),14:i=>i==1?0:i==2?1:i==3?2:3,15:i=>i%10==1&&i%100!=11?0:i%10>=2&&(i%100<10||i%100>=20)?1:2,16:i=>i%10==1&&i%100!=11?0:i!==0?1:2,17:i=>i==1||i%10==1&&i%100!=11?0:1,18:i=>i==0?0:i==1?1:2,19:i=>i==1?0:i==0||i%100>1&&i%100<11?1:i%100>10&&i%100<20?2:3,20:i=>i==1?0:i==0||i%100>0&&i%100<20?1:2,21:i=>i%100==1?1:i%100==2?2:i%100==3||i%100==4?3:0,22:i=>i==1?0:i==2?1:(i<0||i>10)&&i%10==0?2:3};const B1=["v1","v2","v3"],$1=["v4"],Eh={zero:0,one:1,two:2,few:3,many:4,other:5},U1=()=>{const i={};return O1.forEach(e=>{e.lngs.forEach(t=>{i[t]={numbers:e.nr,plurals:N1[e.fc]}})}),i};class G1{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Qs.create("pluralResolver"),(!this.options.compatibilityJSON||$1.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=U1(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{const s=Fa(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:s,type:r});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];const a=new Intl.PluralRules(s,{type:r});return this.pluralRulesCache[n]=a,a}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(e,t);return this.shouldUseIntlApi()?s&&s.resolvedOptions().pluralCategories.length>1:s&&s.numbers.length>1}getPluralFormsOfKey(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,s).map(r=>`${t}${r}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(e,t);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort((r,n)=>Eh[r]-Eh[n]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):s.numbers.map(r=>this.getSuffix(e,r,t)):[]}getSuffix(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,s);return r?this.shouldUseIntlApi()?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:this.getSuffixRetroCompatible(r,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const s=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let r=e.numbers[s];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(r===2?r="plural":r===1&&(r=""));const n=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return this.options.compatibilityJSON==="v1"?r===1?"":typeof r=="number"?`_plural_${r.toString()}`:n():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?n():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}shouldUseIntlApi(){return!B1.includes(this.options.compatibilityJSON)}}const bh=function(i,e,t){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,n=_1(i,e,t);return!n&&r&&typeof t=="string"&&(n=Tl(i,t,s),n===void 0&&(n=Tl(e,t,s))),n},$o=i=>i.replace(/\$/g,"$$$$");class V1{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Qs.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(t=>t),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:s,useRawValueToEscape:r,prefix:n,prefixEscaped:a,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:d,unescapePrefix:f,nestingPrefix:g,nestingPrefixEscaped:v,nestingSuffix:y,nestingSuffixEscaped:E,nestingOptionsSeparator:b,maxReplaces:w,alwaysFormat:F}=e.interpolation;this.escape=t!==void 0?t:k1,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=n?Ar(n):a||"{{",this.suffix=o?Ar(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=g?Ar(g):v||Ar("$t("),this.nestingSuffix=y?Ar(y):E||Ar(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=w||1e3,this.alwaysFormat=F!==void 0?F:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,s)=>t&&t.source===s?(t.lastIndex=0,t):new RegExp(s,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,s,r){let n,a,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=v=>{if(v.indexOf(this.formatSeparator)<0){const w=bh(t,l,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(w,void 0,s,{...r,...t,interpolationkey:v}):w}const y=v.split(this.formatSeparator),E=y.shift().trim(),b=y.join(this.formatSeparator).trim();return this.format(bh(t,l,E,this.options.keySeparator,this.options.ignoreJSONStructure),b,s,{...r,...t,interpolationkey:E})};this.resetRegExp();const d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>$o(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?$o(this.escape(v)):$o(v)}].forEach(v=>{for(o=0;n=v.regex.exec(e);){const y=n[1].trim();if(a=u(y),a===void 0)if(typeof d=="function"){const b=d(e,n,r);a=typeof b=="string"?b:""}else if(r&&Object.prototype.hasOwnProperty.call(r,y))a="";else if(f){a=n[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=ph(a));const E=v.safeValue(a);if(e=e.replace(n[0],E),f?(v.regex.lastIndex+=a.length,v.regex.lastIndex-=n[0].length):v.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,n,a;const o=(l,u)=>{const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const f=l.split(new RegExp(`${d}[ ]*{`));let g=`{${f[1]}`;l=f[0],g=this.interpolate(g,a);const v=g.match(/'/g),y=g.match(/"/g);(v&&v.length%2===0&&!y||y.length%2!==0)&&(g=g.replace(/'/g,'"'));try{a=JSON.parse(g),u&&(a={...u,...a})}catch(E){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,E),`${l}${d}${g}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];a={...s},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const d=r[1].split(this.formatSeparator).map(f=>f.trim());r[1]=d.shift(),l=d,u=!0}if(n=t(o.call(this,r[1].trim(),a),a),n&&r[0]===e&&typeof n!="string")return n;typeof n!="string"&&(n=ph(n)),n||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),n=""),u&&(n=l.reduce((d,f)=>this.format(d,f,s.lng,{...s,interpolationkey:r[1].trim()}),n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}const H1=i=>{let e=i.toLowerCase().trim();const t={};if(i.indexOf("(")>-1){const s=i.split("(");e=s[0].toLowerCase().trim();const r=s[1].substring(0,s[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(a=>{if(a){const[o,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),d=o.trim();t[d]||(t[d]=u),u==="false"&&(t[d]=!1),u==="true"&&(t[d]=!0),isNaN(u)||(t[d]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},Lr=i=>{const e={};return(t,s,r)=>{let n=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(n={...n,[r.interpolationkey]:void 0});const a=s+JSON.stringify(n);let o=e[a];return o||(o=i(Fa(s),r),e[a]=o),o(t)}};class j1{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Qs.create("formatter"),this.options=e,this.formats={number:Lr((t,s)=>{const r=new Intl.NumberFormat(t,{...s});return n=>r.format(n)}),currency:Lr((t,s)=>{const r=new Intl.NumberFormat(t,{...s,style:"currency"});return n=>r.format(n)}),datetime:Lr((t,s)=>{const r=new Intl.DateTimeFormat(t,{...s});return n=>r.format(n)}),relativetime:Lr((t,s)=>{const r=new Intl.RelativeTimeFormat(t,{...s});return n=>r.format(n,s.range||"day")}),list:Lr((t,s)=>{const r=new Intl.ListFormat(t,{...s});return n=>r.format(n)})},this.init(e)}init(e){const s=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=s.formatSeparator?s.formatSeparator:s.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Lr(t)}format(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(o=>o.indexOf(")")>-1)){const o=n.findIndex(l=>l.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,o)].join(this.formatSeparator)}return n.reduce((o,l)=>{const{formatName:u,formatOptions:d}=H1(l);if(this.formats[u]){let f=o;try{const g=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},v=g.locale||g.lng||r.locale||r.lng||s;f=this.formats[u](o,v,{...d,...r,...g})}catch(g){this.logger.warn(g)}return f}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}const K1=(i,e)=>{i.pending[e]!==void 0&&(delete i.pending[e],i.pendingCount--)};class z1 extends so{constructor(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=r,this.logger=Qs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(s,r.backend,r)}queueLoad(e,t,s,r){const n={},a={},o={},l={};return e.forEach(u=>{let d=!0;t.forEach(f=>{const g=`${u}|${f}`;!s.reload&&this.store.hasResourceBundle(u,f)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?a[g]===void 0&&(a[g]=!0):(this.state[g]=1,d=!1,a[g]===void 0&&(a[g]=!0),n[g]===void 0&&(n[g]=!0),l[f]===void 0&&(l[f]=!0)))}),d||(o[u]=!0)}),(Object.keys(n).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(n),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,s){const r=e.split("|"),n=r[0],a=r[1];t&&this.emit("failedLoading",n,a,t),!t&&s&&this.store.addResourceBundle(n,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const o={};this.queue.forEach(l=>{R1(l.loaded,[n],a),K1(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const d=l.loaded[u];d.length&&d.forEach(f=>{o[u][f]===void 0&&(o[u][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,t,s){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:s,tried:r,wait:n,callback:a});return}this.readingCalls++;const o=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&d&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,s,r+1,n*2,a)},n);return}a(u,d)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(d=>o(null,d)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof t=="string"&&(t=[t]);const n=this.queueLoad(e,t,s,r);if(!n.toLoad.length)return n.pending.length||r(),null;n.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const s=e.split("|"),r=s[0],n=s[1];this.read(r,n,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${n} for language ${r} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${n} for language ${r}`,o),this.loaded(e,a,o)})}saveMissing(e,t,s,r,n){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:n},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(e,t,s,r,l):d=u(e,t,s,r),d&&typeof d.then=="function"?d.then(f=>o(null,f)).catch(o):o(null,d)}catch(d){o(d)}else u(e,t,s,r,o,l)}!e||!e[0]||this.store.addResource(e[0],t,s,r)}}}const Th=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let e={};if(typeof i[1]=="object"&&(e=i[1]),typeof i[1]=="string"&&(e.defaultValue=i[1]),typeof i[2]=="string"&&(e.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const t=i[3]||i[2];Object.keys(t).forEach(s=>{e[s]=t[s]})}return e},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),wh=i=>(typeof i.ns=="string"&&(i.ns=[i.ns]),typeof i.fallbackLng=="string"&&(i.fallbackLng=[i.fallbackLng]),typeof i.fallbackNS=="string"&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs&&i.supportedLngs.indexOf("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),i),ia=()=>{},W1=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(t=>{typeof i[t]=="function"&&(i[t]=i[t].bind(i))})};class Rn extends so{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=wh(e),this.services={},this.logger=Qs,this.modules={external:[]},W1(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(s=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(typeof t.ns=="string"?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=Th();this.options={...r,...this.options,...wh(t)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const n=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?Qs.init(n(this.modules.logger),this.options):Qs.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=j1);const f=new Sh(this.options);this.store=new yh(this.options.resources,this.options);const g=this.services;g.logger=Qs,g.resourceStore=this.store,g.languageUtils=f,g.pluralResolver=new G1(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(g.formatter=n(d),g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new V1(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new z1(n(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",function(v){for(var y=arguments.length,E=new Array(y>1?y-1:0),b=1;b<y;b++)E[b-1]=arguments[b];e.emit(v,...E)}),this.modules.languageDetector&&(g.languageDetector=n(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=n(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new Oa(this.services,this.options),this.translator.on("*",function(v){for(var y=arguments.length,E=new Array(y>1?y-1:0),b=1;b<y;b++)E[b-1]=arguments[b];e.emit(v,...E)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,s||(s=ia),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=function(){return e.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return e.store[d](...arguments),e}});const l=ln(),u=()=>{const d=(f,g)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(g),s(f,g)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ia;const r=typeof e=="string"?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&r.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const n=[],a=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(u=>{u!=="cimode"&&n.indexOf(u)<0&&n.push(u)})};r?a(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(o=>a(o)),this.services.backendConnector.load(n,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(o)})}else s(null)}reloadResources(e,t,s){const r=ln();return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=ia),this.services.backendConnector.reload(e,t,n=>{r.resolve(),s(n)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Lp.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t<this.languages.length;t++){const s=this.languages[t];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}changeLanguage(e,t){var s=this;this.isLanguageChangingTo=e;const r=ln();this.emit("languageChanging",e);const n=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(n(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,r.resolve(function(){return s.t(...arguments)}),t&&t(l,function(){return s.t(...arguments)})},o=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||n(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{a(d,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,t,s){var r=this;const n=function(a,o){let l;if(typeof o!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),f=2;f<u;f++)d[f-2]=arguments[f];l=r.options.overloadTranslationOptionHandler([a,o].concat(d))}else l={...o};l.lng=l.lng||n.lng,l.lngs=l.lngs||n.lngs,l.ns=l.ns||n.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||s||n.keyPrefix);const g=r.options.keySeparator||".";let v;return l.keyPrefix&&Array.isArray(a)?v=a.map(y=>`${l.keyPrefix}${g}${y}`):v=l.keyPrefix?`${l.keyPrefix}${g}${a}`:a,r.t(v,l)};return typeof e=="string"?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=s,n}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!r||a(n,e)))}loadNamespaces(e,t){const s=ln();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{s.resolve(),t&&t(r)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=ln();typeof e=="string"&&(e=[e]);const r=this.options.preload||[],n=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return n.length?(this.options.preload=r.concat(n),this.loadResources(a=>{s.resolve(),t&&t(a)}),s):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services&&this.services.languageUtils||new Sh(Th());return t.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new Rn(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ia;const s=e.forkResourceStore;s&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},n=new Rn(r);return(e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(o=>{n[o]=this[o]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},s&&(n.store=new yh(this.store.data,r),n.services.resourceStore=n.store),n.translator=new Oa(n.services,r),n.translator.on("*",function(o){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];n.emit(o,...u)}),n.init(r,t),n.translator.options=r,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Kt=Rn.createInstance();Kt.createInstance=Rn.createInstance;Kt.createInstance;Kt.dir;Kt.init;Kt.loadResources;Kt.reloadResources;Kt.use;Kt.changeLanguage;Kt.getFixedT;Kt.t;Kt.exists;Kt.setDefaultNamespace;Kt.hasLoadedNamespace;Kt.loadNamespaces;Kt.loadLanguages;function q1(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function _n(i){"@babel/helpers - typeof";return _n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_n(i)}function Y1(i,e){if(_n(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e);if(_n(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function X1(i){var e=Y1(i,"string");return _n(e)=="symbol"?e:e+""}function Q1(i,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(i,X1(s.key),s)}}function J1(i,e,t){return e&&Q1(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}var Cp=[],Z1=Cp.forEach,eE=Cp.slice;function tE(i){return Z1.call(eE.call(arguments,1),function(e){if(e)for(var t in e)i[t]===void 0&&(i[t]=e[t])}),i}var Ah=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,sE=function(e,t,s){var r=s||{};r.path=r.path||"/";var n=encodeURIComponent(t),a="".concat(e,"=").concat(n);if(r.maxAge>0){var o=r.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(o))}if(r.domain){if(!Ah.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(r.domain)}if(r.path){if(!Ah.test(r.path))throw new TypeError("option path is invalid");a+="; Path=".concat(r.path)}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite){var l=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(l){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},Lh={create:function(e,t,s,r){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};s&&(n.expires=new Date,n.expires.setTime(n.expires.getTime()+s*60*1e3)),r&&(n.domain=r),document.cookie=sE(e,encodeURIComponent(t),n)},read:function(e){for(var t="".concat(e,"="),s=document.cookie.split(";"),r=0;r<s.length;r++){for(var n=s[r];n.charAt(0)===" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return n.substring(t.length,n.length)}return null},remove:function(e){this.create(e,"",-1)}},iE={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&typeof document<"u"){var s=Lh.read(e.lookupCookie);s&&(t=s)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&typeof document<"u"&&Lh.create(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},rE={name:"querystring",lookup:function(e){var t;if(typeof window<"u"){var s=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=s.substring(1),n=r.split("&"),a=0;a<n.length;a++){var o=n[a].indexOf("=");if(o>0){var l=n[a].substring(0,o);l===e.lookupQuerystring&&(t=n[a].substring(o+1))}}}return t}},cn=null,Ch=function(){if(cn!==null)return cn;try{cn=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{cn=!1}return cn},nE={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&Ch()){var s=window.localStorage.getItem(e.lookupLocalStorage);s&&(t=s)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&Ch()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},un=null,Rh=function(){if(un!==null)return un;try{un=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{un=!1}return un},aE={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&Rh()){var s=window.sessionStorage.getItem(e.lookupSessionStorage);s&&(t=s)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&Rh()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},oE={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var s=0;s<navigator.languages.length;s++)t.push(navigator.languages[s]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},lE={name:"htmlTag",lookup:function(e){var t,s=e.htmlTag||(typeof document<"u"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(t=s.getAttribute("lang")),t}},cE={name:"path",lookup:function(e){var t;if(typeof window<"u"){var s=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(s instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof s[e.lookupFromPathIndex]!="string")return;t=s[e.lookupFromPathIndex].replace("/","")}else t=s[0].replace("/","")}return t}},uE={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,s=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(s)return s[t]}};function hE(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var Rp=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};q1(this,i),this.type="languageDetector",this.detectors={},this.init(e,t)}return J1(i,[{key:"init",value:function(t){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=tE(s,this.options||{},hE()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(n){return n.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(iE),this.addDetector(rE),this.addDetector(nE),this.addDetector(aE),this.addDetector(oE),this.addDetector(lE),this.addDetector(cE),this.addDetector(uE)}},{key:"addDetector",value:function(t){return this.detectors[t.name]=t,this}},{key:"detect",value:function(t){var s=this;t||(t=this.options.order);var r=[];return t.forEach(function(n){if(s.detectors[n]){var a=s.detectors[n].lookup(s.options);a&&typeof a=="string"&&(a=[a]),a&&(r=r.concat(a))}}),r=r.map(function(n){return s.options.convertDetectedLanguage(n)}),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}},{key:"cacheUserLanguage",value:function(t,s){var r=this;s||(s=this.options.caches),s&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||s.forEach(function(n){r.detectors[n]&&r.detectors[n].cacheUserLanguage(t,r.options)}))}}]),i}();Rp.type="languageDetector";const dE={en:{translation:{chapter:"chapter",close:"close",soldout:"soldeout",currency:"USD",more:"more",entrace:"entrance",comments:"comments",reply:"reply",send:"send",cancel1:"cancel",participate:"participate",participated:"participated",announcement:"announcement",login:"login",notice:"notice",report:"report",edit:"edit",benefit:"benefit",notification:"notification",setting:"setting",event:"event",term:"term",back:"back",quiz:"quiz",answer:"answer",confirm:"confirm",recent:"recent",small:"small",medium:"medium",large:"large",chat:"chat",background:"background",bold:"bold",share:"share",video:"video",fullscreen:"full screen",quality:"quality",auto:"auto",size:"size",delete:"delete",rehearsal:"rehearsal",live:"live",relive:"relive",converting:"converting",cancel:"cancel",ready:"ready",purchase_verification:"Purchase verification",live_comments:"Live comments",adult_verification:"Adult verification",change_view_mode:"Change view mode",enter_broadcast:"Enter broadcast",featured_products:"Featured products",view_reply:"View {{count}} replies",sentence:{"No Results Found":"No Results Found","people has joined":" and {{count}} people has joined","has joined":"has joined","Chat is paused":"Chat is paused","Chat is available":"Chat is available","Chat is unavailable":"Chat is unavailable","Chat messages cannot be sent":"Chat messages cannot be sent","Please enter number":"Please enter number","Please enter answer":"Please enter answer","Participation completed":"Participation completed","Stream Starting Soon":"Stream Starting Soon","It will be temporarily restricted for smooth chat":"It will be temporarily restricted for smooth chat","The video cannot be played.":"The video cannot be played.","This content requires a login. Please try again.":"This content requires a login. Please try again.","Please enter your name":"Please enter your name","Please enter your nickname":"Please enter your nickname","Please enter your phonenumber":"Please enter your phonenumber","Consent for Personal Information":"Consent for Personal Information (Required)","Please enter the information":"To participate, please enter the information below","Reply has been raised":`Reply has been raised.
|
|
46
46
|
You can check again through the menu at the bottom right`,"Please press unmute button":"Please press unmute button","The broadcast cannot be found":"The broadcast cannot be found","Enter your four-digit entry code":"Enter your four-digit entry code","The entry code does not match":"The entry code does not match","adult verification are required":"This broadcast is not available for viewers under the age of 19. Login and adult verification are required","Data charges may apply":"Data charges may apply in 3G/5G/LTE environments","Link has been copied":"Link has been copied","The report has been completed":"The report has been completed","No permission to report":"No permission to report. please sign up","Are you sure you want to submit":"Are you sure you want to submit?","We announce the results":"We announce the results of {{event}}","Enter your purchase number or order number":`Enter your purchase number or order number
|
|
47
|
-
Please look forward to the announcement of the winners!`}}},ko:{translation:{chapter:"챕터",close:"닫기",soldout:"품절",currency:"원",more:"더보기",entrace:"입장",comments:"댓글",reply:"답글",send:"전송",cancel1:"취소",participate:"참여하기",participated:"참여완료",announcement:"결과발표",login:"로그인",notice:"안내",report:"신고",edit:"수정",benefit:"방송 혜택",notification:"알림",setting:"설정",event:"이벤트",term:"약관",back:"뒤로가기",quiz:"퀴즈",answer:"정답",confirm:"확인",recent:"최신",small:"작게",medium:"보통",large:"크게",chat:"채팅",background:"배경",bold:"볼드",share:"공유",video:"영상",fullscreen:"전체화면",quality:"화질",auto:"자동",size:"크기",delete:"삭제",rehearsal:"리허설",live:"live",relive:"재방송",converting:"변환중",cancel:"방송취소",ready:"방송예정",purchase_verification:"구매인증",live_comments:"라이브 답글",adult_verification:"성인인증",change_view_mode:"시청모드 변경",enter_broadcast:"방송 입장",featured_products:"개의 상품",view_reply:"답글보기 {{count}}개",sentence:{"No Results Found":"내용이 없습니다.","people has joined":"님외 {{count}}명이 입장하였습니다.","has joined":"님이 입장하였습니다.","Chat is pause":"채팅이 일시 정지되었습니다.","Chat is available":"채팅 이용이 가능합니다.","Chat is unavailable":"채팅 이용이 어렵습니다.","Chat messages cannot be sent":"채팅을 전송할 수 없습니다.","Please enter number":"번호를 입력하세요.","Please enter answer":"답안을 입력하세요.","Participation completed":"참여완료 되었습니다.","Stream Starting Soon":"곧 라이브가 시작됩니다.","Please enter your name":"이름을 입력해주세요.","Please enter your nickname":"닉네임을 입력해주세요.","Please enter your phonenumber":"전화번호를 입력해주세요.","Consent for Personal Information":"개인정보 수집및 이용동의(필수)","Please enter the information"
|
|
47
|
+
Please look forward to the announcement of the winners!`}}},ko:{translation:{chapter:"챕터",close:"닫기",soldout:"품절",currency:"원",more:"더보기",entrace:"입장",comments:"댓글",reply:"답글",send:"전송",cancel1:"취소",participate:"참여하기",participated:"참여완료",announcement:"결과발표",login:"로그인",notice:"안내",report:"신고",edit:"수정",benefit:"방송 혜택",notification:"알림",setting:"설정",event:"이벤트",term:"약관",back:"뒤로가기",quiz:"퀴즈",answer:"정답",confirm:"확인",recent:"최신",small:"작게",medium:"보통",large:"크게",chat:"채팅",background:"배경",bold:"볼드",share:"공유",video:"영상",fullscreen:"전체화면",quality:"화질",auto:"자동",size:"크기",delete:"삭제",rehearsal:"리허설",live:"live",relive:"재방송",converting:"변환중",cancel:"방송취소",ready:"방송예정",purchase_verification:"구매인증",live_comments:"라이브 답글",adult_verification:"성인인증",change_view_mode:"시청모드 변경",enter_broadcast:"방송 입장",featured_products:"개의 상품",view_reply:"답글보기 {{count}}개",sentence:{"No Results Found":"내용이 없습니다.","people has joined":"님외 {{count}}명이 입장하였습니다.","has joined":"님이 입장하였습니다.","Chat is pause":"채팅이 일시 정지되었습니다.","Chat is available":"채팅 이용이 가능합니다.","Chat is unavailable":"채팅 이용이 어렵습니다.","Chat messages cannot be sent":"채팅을 전송할 수 없습니다.","Please enter number":"번호를 입력하세요.","Please enter answer":"답안을 입력하세요.","Participation completed":"참여완료 되었습니다.","Stream Starting Soon":"곧 라이브가 시작됩니다.","It will be temporarily restricted for smooth chat":"원활한 채팅을 위해 잠시 제한됩니다.","The video cannot be played":"동영상을 재생할 수 없습니다.","This content requires a login. Please try again":"이 콘텐츠는 로그인이 필요합니다. 다시 시도해 주세요.","Please enter your name":"이름을 입력해주세요.","Please enter your nickname":"닉네임을 입력해주세요.","Please enter your phonenumber":"전화번호를 입력해주세요.","Consent for Personal Information":"개인정보 수집및 이용동의(필수)","Please enter the information":`원활한 소통과 서비스 제공을 위해 아래 정보를 입력해주세요.
|
|
48
|
+
입력하신 개인정보는 서비스 운영 및 원활한 소통을 위해서만 사용되며 안전하게 보호됩니다.`,"Reply has been raised":`라이브 답글이 달렸어요.
|
|
48
49
|
우측 하단 메뉴를 통해 다시 확인할 수 있습니다.`,"Please press unmute button":"소리를 켜려면 누르세요.","The broadcast cannot be found":"방송을 찾을수 없습니다.","Enter your four-digit entry code":"입장코드 네 자리를 입력하세요.","The entry code does not match":"입장코드가 일치하지 않습니다.","adult verification are required":`만 19세 미만 시청불가 방송입니다.
|
|
49
50
|
로그인 및 성인인증이 필요합니다.`,"Data charges may apply":"3G/5G/LTE 환경에서는 데이터 요금이 발생할 수 있습니다.","Link has been copied":"링크가 복사 되었습니다.","The report has been completed":"신고가 완료되었습니다.","No permission to report":"신고 권한이 없습니다. 로그인 하세요.","Are you sure you want to submit":"위의 내용을 신고하시겠습니까?","We announce the results":`"{{event}}"의
|
|
50
51
|
결과를 발표합니다.`,"Enter your purchase number or order number":`구매번호 혹은 주문번호를 입력하세요.
|
|
51
|
-
당첨자 발표를 기대해주세요!`}}}};Kt.use(Rp).init({resources:dE,detection:{order:["navigator","localStorage"]},fallbackLng:"ko",debug:!1,interpolation:{escapeValue:!1}});const fE="_root_1u2x2_1",pE="_primary_1u2x2_28",gE="_icon_1u2x2_45",Uo={root:fE,primary:pE,icon:gE};fe.forwardRef(({primary:i=!1,icon:e=!1,className:t,...s},r)=>Ne.jsx("button",{ref:r,className:(e?`${Uo.icon}`:`${Uo.root} ${i?Uo.primary:""}`)+` ${t||""}`,...s}));const mE="_root_40kkk_2",vE="_pip_40kkk_10",yE="_mute_40kkk_16",xE="_unmute_40kkk_22",SE="_share_40kkk_28",EE="_setting_40kkk_34",bE="_close_40kkk_40",TE="_wish_40kkk_46",wE="_coupon_40kkk_53",AE="_like_40kkk_59",LE="_notice_40kkk_65",CE="_chat_40kkk_71",RE="_comment_40kkk_77",_E="_product_40kkk_83",IE="_event_40kkk_89",kE="_alarm_on_40kkk_95",PE="_alarm_off_40kkk_101",DE="_purchase_40kkk_108",ME="_close_pane_40kkk_114",FE="_close_pane_B_40kkk_120",OE="_back_40kkk_126",NE="_backward_40kkk_133",BE="_pause_40kkk_139",$E="_play_40kkk_145",UE="_forward_40kkk_151",GE="_left_40kkk_158",VE="_right_40kkk_164",HE="_converting_40kkk_171",jE="_cancel_40kkk_177",KE="_sm_view_40kkk_184",zE="_sm_like_40kkk_190",WE="_sm_countdown_40kkk_196",qE="_sm_countdown_black_40kkk_202",YE="_sm_question_40kkk_208",XE="_sm_comment_40kkk_214",QE="_sm_more_40kkk_220",JE="_sm_fix_40kkk_226",ZE="_sm_bag_40kkk_232",eb="_wish_on_40kkk_238",tb="_wish_off_40kkk_244",sb="_chapter_shorts_40kkk_250",ib="_like_shorts_40kkk_256",rb="_comment_shorts_40kkk_262",nb="_share_shorts_40kkk_268",ab="_more_product_shorts_40kkk_274",ob="_close_drawer_shorts_40kkk_280",_h={root:mE,pip:vE,mute:yE,unmute:xE,share:SE,setting:EE,close:bE,wish:TE,coupon:wE,like:AE,notice:LE,chat:CE,comment:RE,product:_E,event:IE,alarm_on:kE,alarm_off:PE,purchase:DE,close_pane:ME,close_pane_B:FE,back:OE,backward:NE,pause:BE,play:$E,forward:UE,left:GE,right:VE,converting:HE,cancel:jE,sm_view:KE,sm_like:zE,sm_countdown:WE,sm_countdown_black:qE,sm_question:YE,sm_comment:XE,sm_more:QE,sm_fix:JE,sm_bag:ZE,wish_on:eb,wish_off:tb,chapter_shorts:sb,like_shorts:ib,comment_shorts:rb,share_shorts:nb,more_product_shorts:ab,close_drawer_shorts:ob};var _p={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ih=fe.createContext&&fe.createContext(_p),lb=["attr","size","title"];function cb(i,e){if(i==null)return{};var t=ub(i,e),s,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r<n.length;r++)s=n[r],!(e.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(i,s)&&(t[s]=i[s])}return t}function ub(i,e){if(i==null)return{};var t={};for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(e.indexOf(s)>=0)continue;t[s]=i[s]}return t}function Na(){return Na=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Na.apply(this,arguments)}function kh(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function Ba(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kh(Object(t),!0).forEach(function(s){hb(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):kh(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function hb(i,e,t){return e=db(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function db(i){var e=fb(i,"string");return typeof e=="symbol"?e:e+""}function fb(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Ip(i){return i&&i.map((e,t)=>fe.createElement(e.tag,Ba({key:t},e.attr),Ip(e.child)))}function xi(i){return e=>fe.createElement(pb,Na({attr:Ba({},i.attr)},e),Ip(i.child))}function pb(i){var e=t=>{var{attr:s,size:r,title:n}=i,a=cb(i,lb),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),fe.createElement("svg",Na({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,s,a,{className:l,style:Ba(Ba({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&fe.createElement("title",null,n),i.children)};return Ih!==void 0?fe.createElement(Ih.Consumer,null,t=>e(t)):e(_p)}function gb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"circle",attr:{cx:"256",cy:"256",r:"208",fill:"none",strokeMiterlimit:"10",strokeWidth:"32"},child:[]},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"m108.92 108.92 294.16 294.16"},child:[]}]})(i)}function mb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M328 112 184 256l144 144"},child:[]}]})(i)}function vb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368 144 144m224 0L144 368"},child:[]}]})(i)}function yb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"circle",attr:{cx:"256",cy:"256",r:"48"},child:[]},{tag:"circle",attr:{cx:"416",cy:"256",r:"48"},child:[]},{tag:"circle",attr:{cx:"96",cy:"256",r:"48"},child:[]}]})(i)}function xb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M133 440a35.37 35.37 0 0 1-17.5-4.67c-12-6.8-19.46-20-19.46-34.33V111c0-14.37 7.46-27.53 19.46-34.33a35.13 35.13 0 0 1 35.77.45l247.85 148.36a36 36 0 0 1 0 61l-247.89 148.4A35.5 35.5 0 0 1 133 440z"},child:[]}]})(i)}function Sb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M232 416a23.88 23.88 0 0 1-14.2-4.68 8.27 8.27 0 0 1-.66-.51L125.76 336H56a24 24 0 0 1-24-24V200a24 24 0 0 1 24-24h69.75l91.37-74.81a8.27 8.27 0 0 1 .66-.51A24 24 0 0 1 256 120v272a24 24 0 0 1-24 24zm-106.18-80zm-.27-159.86zM320 336a16 16 0 0 1-14.29-23.19c9.49-18.87 14.3-38 14.3-56.81 0-19.38-4.66-37.94-14.25-56.73a16 16 0 0 1 28.5-14.54C346.19 208.12 352 231.44 352 256c0 23.86-6 47.81-17.7 71.19A16 16 0 0 1 320 336z"},child:[]},{tag:"path",attr:{d:"M368 384a16 16 0 0 1-13.86-24C373.05 327.09 384 299.51 384 256c0-44.17-10.93-71.56-29.82-103.94a16 16 0 0 1 27.64-16.12C402.92 172.11 416 204.81 416 256c0 50.43-13.06 83.29-34.13 120a16 16 0 0 1-13.87 8z"},child:[]},{tag:"path",attr:{d:"M416 432a16 16 0 0 1-13.39-24.74C429.85 365.47 448 323.76 448 256c0-66.5-18.18-108.62-45.49-151.39a16 16 0 1 1 27-17.22C459.81 134.89 480 181.74 480 256c0 64.75-14.66 113.63-50.6 168.74A16 16 0 0 1 416 432z"},child:[]}]})(i)}function Eb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M416 432 64 80"},child:[]},{tag:"path",attr:{d:"M243.33 98.86a23.89 23.89 0 0 0-25.55 1.82l-.66.51-28.52 23.35a8 8 0 0 0-.59 11.85l54.33 54.33a8 8 0 0 0 13.66-5.66v-64.49a24.51 24.51 0 0 0-12.67-21.71zm8 236.43L96.69 180.69A16 16 0 0 0 85.38 176H56a24 24 0 0 0-24 24v112a24 24 0 0 0 24 24h69.76l92 75.31a23.9 23.9 0 0 0 25.87 1.69A24.51 24.51 0 0 0 256 391.45v-44.86a16 16 0 0 0-4.67-11.3zM352 256c0-24.56-5.81-47.87-17.75-71.27a16 16 0 1 0-28.5 14.55C315.34 218.06 320 236.62 320 256q0 4-.31 8.13a8 8 0 0 0 2.32 6.25l14.36 14.36a8 8 0 0 0 13.55-4.31A146 146 0 0 0 352 256zm64 0c0-51.18-13.08-83.89-34.18-120.06a16 16 0 0 0-27.64 16.12C373.07 184.44 384 211.83 384 256c0 23.83-3.29 42.88-9.37 60.65a8 8 0 0 0 1.9 8.26L389 337.4a8 8 0 0 0 13.13-2.79C411 311.76 416 287.26 416 256z"},child:[]},{tag:"path",attr:{d:"M480 256c0-74.25-20.19-121.11-50.51-168.61a16 16 0 1 0-27 17.22C429.82 147.38 448 189.5 448 256c0 46.19-8.43 80.27-22.43 110.53a8 8 0 0 0 1.59 9l11.92 11.92a8 8 0 0 0 12.92-2.16C471.6 344.9 480 305 480 256z"},child:[]}]})(i)}function bb(i){return xi({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"m13.498.795.149-.149a1.207 1.207 0 1 1 1.707 1.708l-.149.148a1.5 1.5 0 0 1-.059 2.059L4.854 14.854a.5.5 0 0 1-.233.131l-4 1a.5.5 0 0 1-.606-.606l1-4a.5.5 0 0 1 .131-.232l9.642-9.642a.5.5 0 0 0-.642.056L6.854 4.854a.5.5 0 1 1-.708-.708L9.44.854A1.5 1.5 0 0 1 11.5.796a1.5 1.5 0 0 1 1.998-.001m-.644.766a.5.5 0 0 0-.707 0L1.95 11.756l-.764 3.057 3.057-.764L14.44 3.854a.5.5 0 0 0 0-.708z"},child:[]}]})(i)}function Tb(i){return xi({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576zm6.787-8.201L1.591 6.602l4.339 2.76z"},child:[]}]})(i)}const Ph={IoVolumeHigh:Sb,IoVolumeMute:Eb,IoPlay:xb,IoCloseOutline:vb,IoChevronBack:mb,IoEllipsisHorizontal:yb,IoBanOutline:gb,BsSend:Tb,BsPen:bb};function Go({className:i,name:e,...t}){if(e in Ph){const s=Ph[e];return Ne.jsx(s,{className:i})}else return Ne.jsx("i",{className:[_h.root,_h[e],i].join(" "),...t})}const wb="_root_3o9nv_1",Ab="_video_3o9nv_9",Lb="_poster_3o9nv_17",Cb="_origin_ratio_3o9nv_26",Rb="_layer_3o9nv_33",_b="_shadow_3o9nv_39",Ib="_forward_animation_3o9nv_61",kb="_forward_3o9nv_61",Pb="_backward_animation_3o9nv_65",Db="_backward_3o9nv_65",Mb="_indicator_3o9nv_69",Fb="_indicator_right_3o9nv_76",Ob="_indicator_left_3o9nv_81",Nb="_progress_3o9nv_87",Bb="_time_3o9nv_95",$b="_button_3o9nv_108",Ub="_playbackrate_3o9nv_129",Gb="_play_toggle_3o9nv_140",Vb="_chapter_toggle_3o9nv_147",Hb="_chapter_wrap_3o9nv_156",bt={root:wb,video:Ab,poster:Lb,origin_ratio:Cb,layer:Rb,shadow:_b,forward_animation:Ib,forward:kb,backward_animation:Pb,backward:Db,indicator:Mb,indicator_right:Fb,indicator_left:Ob,progress:Nb,time:Bb,button:$b,playbackrate:Ub,play_toggle:Gb,chapter_toggle:Vb,chapter_wrap:Hb};function jb(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var kp={exports:{}};(function(i,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,u,d){if(d=d||{},l=l.trim(),u=u.trim(),!u){if(!d.alwaysNormalize)return l;var f=o.parseURL(l);if(!f)throw new Error("Error trying to parse base URL.");return f.path=o.normalizePath(f.path),o.buildURLFromParts(f)}var g=o.parseURL(u);if(!g)throw new Error("Error trying to parse relative URL.");if(g.scheme)return d.alwaysNormalize?(g.path=o.normalizePath(g.path),o.buildURLFromParts(g)):u;var v=o.parseURL(l);if(!v)throw new Error("Error trying to parse base URL.");if(!v.netLoc&&v.path&&v.path[0]!=="/"){var y=r.exec(v.path);v.netLoc=y[1],v.path=y[2]}v.netLoc&&!v.path&&(v.path="/");var E={scheme:v.scheme,netLoc:g.netLoc,path:null,params:g.params,query:g.query,fragment:g.fragment};if(!g.netLoc&&(E.netLoc=v.netLoc,g.path[0]!=="/"))if(!g.path)E.path=v.path,g.params||(E.params=v.params,g.query||(E.query=v.query));else{var b=v.path,w=b.substring(0,b.lastIndexOf("/")+1)+g.path;E.path=o.normalizePath(w)}return E.path===null&&(E.path=d.alwaysNormalize?o.normalizePath(g.path):g.path),o.buildURLFromParts(E)},parseURL:function(l){var u=s.exec(l);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(n,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};i.exports=o})()})(kp);var vc=kp.exports;function Dh(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function Nt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dh(Object(t),!0).forEach(function(s){Wb(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Dh(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function Kb(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function zb(i){var e=Kb(i,"string");return typeof e=="symbol"?e:String(e)}function Wb(i,e,t){return e=zb(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ct(){return Ct=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Ct.apply(this,arguments)}const _e=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)},qb=Number.isSafeInteger||function(i){return typeof i=="number"&&Math.abs(i)<=Yb},Yb=Number.MAX_SAFE_INTEGER||9007199254740991;let C=function(i){return i.MEDIA_ATTACHING="hlsMediaAttaching",i.MEDIA_ATTACHED="hlsMediaAttached",i.MEDIA_DETACHING="hlsMediaDetaching",i.MEDIA_DETACHED="hlsMediaDetached",i.BUFFER_RESET="hlsBufferReset",i.BUFFER_CODECS="hlsBufferCodecs",i.BUFFER_CREATED="hlsBufferCreated",i.BUFFER_APPENDING="hlsBufferAppending",i.BUFFER_APPENDED="hlsBufferAppended",i.BUFFER_EOS="hlsBufferEos",i.BUFFER_FLUSHING="hlsBufferFlushing",i.BUFFER_FLUSHED="hlsBufferFlushed",i.MANIFEST_LOADING="hlsManifestLoading",i.MANIFEST_LOADED="hlsManifestLoaded",i.MANIFEST_PARSED="hlsManifestParsed",i.LEVEL_SWITCHING="hlsLevelSwitching",i.LEVEL_SWITCHED="hlsLevelSwitched",i.LEVEL_LOADING="hlsLevelLoading",i.LEVEL_LOADED="hlsLevelLoaded",i.LEVEL_UPDATED="hlsLevelUpdated",i.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",i.LEVELS_UPDATED="hlsLevelsUpdated",i.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",i.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",i.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",i.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",i.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",i.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",i.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",i.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",i.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",i.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",i.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",i.CUES_PARSED="hlsCuesParsed",i.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",i.INIT_PTS_FOUND="hlsInitPtsFound",i.FRAG_LOADING="hlsFragLoading",i.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",i.FRAG_LOADED="hlsFragLoaded",i.FRAG_DECRYPTED="hlsFragDecrypted",i.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",i.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",i.FRAG_PARSING_METADATA="hlsFragParsingMetadata",i.FRAG_PARSED="hlsFragParsed",i.FRAG_BUFFERED="hlsFragBuffered",i.FRAG_CHANGED="hlsFragChanged",i.FPS_DROP="hlsFpsDrop",i.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",i.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",i.ERROR="hlsError",i.DESTROYING="hlsDestroying",i.KEY_LOADING="hlsKeyLoading",i.KEY_LOADED="hlsKeyLoaded",i.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",i.BACK_BUFFER_REACHED="hlsBackBufferReached",i.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",i}({}),je=function(i){return i.NETWORK_ERROR="networkError",i.MEDIA_ERROR="mediaError",i.KEY_SYSTEM_ERROR="keySystemError",i.MUX_ERROR="muxError",i.OTHER_ERROR="otherError",i}({}),ce=function(i){return i.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",i.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",i.KEY_SYSTEM_NO_SESSION="keySystemNoSession",i.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",i.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",i.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",i.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",i.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",i.MANIFEST_LOAD_ERROR="manifestLoadError",i.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",i.MANIFEST_PARSING_ERROR="manifestParsingError",i.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",i.LEVEL_EMPTY_ERROR="levelEmptyError",i.LEVEL_LOAD_ERROR="levelLoadError",i.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",i.LEVEL_PARSING_ERROR="levelParsingError",i.LEVEL_SWITCH_ERROR="levelSwitchError",i.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",i.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",i.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",i.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",i.FRAG_LOAD_ERROR="fragLoadError",i.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",i.FRAG_DECRYPT_ERROR="fragDecryptError",i.FRAG_PARSING_ERROR="fragParsingError",i.FRAG_GAP="fragGap",i.REMUX_ALLOC_ERROR="remuxAllocError",i.KEY_LOAD_ERROR="keyLoadError",i.KEY_LOAD_TIMEOUT="keyLoadTimeOut",i.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",i.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",i.BUFFER_APPEND_ERROR="bufferAppendError",i.BUFFER_APPENDING_ERROR="bufferAppendingError",i.BUFFER_STALLED_ERROR="bufferStalledError",i.BUFFER_FULL_ERROR="bufferFullError",i.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",i.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",i.INTERNAL_EXCEPTION="internalException",i.INTERNAL_ABORTED="aborted",i.UNKNOWN="unknown",i}({});const Qi=function(){},wl={trace:Qi,debug:Qi,log:Qi,warn:Qi,info:Qi,error:Qi};let xn=wl;function Xb(i){const e=self.console[i];return e?e.bind(self.console,`[${i}] >`):Qi}function Qb(i,...e){e.forEach(function(t){xn[t]=i[t]?i[t].bind(i):Xb(t)})}function Jb(i,e){if(typeof console=="object"&&i===!0||typeof i=="object"){Qb(i,"debug","log","info","warn","error");try{xn.log(`Debug logs enabled for "${e}" in hls.js version 1.5.8`)}catch{xn=wl}}else xn=wl}const ie=xn,Zb=/^(\d+)x(\d+)$/,Mh=/(.+?)=(".*?"|.*?)(?:,|$)/g;class St{constructor(e){typeof e=="string"&&(e=St.parseAttrList(e)),Ct(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}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=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)s[r]=parseInt(t.slice(r*2,r*2+2),16);return s}else 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 s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Zb.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const s={},r='"';for(Mh.lastIndex=0;(t=Mh.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const a=t[1].trim();s[a]=n}return s}}function eT(i){return i!=="ID"&&i!=="CLASS"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function tT(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"}class Pp{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){ie.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=Ct(new St({}),s,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=new Date(this.attr["END-DATE"]);_e(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(_e(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 isValid(){return!!this.id&&!this._badValueForSameId&&_e(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class io{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 ht={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Dp{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[ht.AUDIO]:null,[ht.VIDEO]:null,[ht.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const s=e.split("@",2);let r;s.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(s[1]),this._byteRange=[r,parseInt(s[0])+r]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=vc.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Vo extends Dp{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=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.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new io,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 decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const s=Object.keys(this.levelkeys);if(s.length===1)return this._decryptdata=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!_e(this.programDateTime))return null;const e=_e(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),s=t.length;if(s>1||s===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,r,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:s,startDTS:r,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[ht.AUDIO]=null,e[ht.VIDEO]=null,e[ht.AUDIOVIDEO]=null}}class sT extends Dp{constructor(e,t,s,r,n){super(s),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.stats=new io,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=r;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,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)}}const iT=10;class rT{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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 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.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?_e(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||iT}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function yc(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function nT(i){const e=Al(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function aT(i){const e=function(s,r,n){const a=s[r];s[r]=s[n],s[n]=a};e(i,0,3),e(i,1,2),e(i,4,5),e(i,6,7)}function oT(i){const e=i.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),r=s[s.length-1].split(",");if(r.length===2){const n=r[0]==="base64",a=r[1];n?(s.splice(-1,1),t=yc(a)):t=nT(a)}}return t}function Al(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}const Br=typeof self<"u"?self:void 0;var yt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},rs={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Fh(i){switch(i){case rs.FAIRPLAY:return yt.FAIRPLAY;case rs.PLAYREADY:return yt.PLAYREADY;case rs.WIDEVINE:return yt.WIDEVINE;case rs.CLEARKEY:return yt.CLEARKEY}}var Mp={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function lT(i){if(i===Mp.WIDEVINE)return yt.WIDEVINE}function Oh(i){switch(i){case yt.FAIRPLAY:return rs.FAIRPLAY;case yt.PLAYREADY:return rs.PLAYREADY;case yt.WIDEVINE:return rs.WIDEVINE;case yt.CLEARKEY:return rs.CLEARKEY}}function Ho(i){const{drmSystems:e,widevineLicenseUrl:t}=i,s=e?[yt.FAIRPLAY,yt.WIDEVINE,yt.PLAYREADY,yt.CLEARKEY].filter(r=>!!e[r]):[];return!s[yt.WIDEVINE]&&t&&s.push(yt.WIDEVINE),s}const Fp=function(i){return Br!=null&&(i=Br.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function cT(i,e,t,s){let r;switch(i){case yt.FAIRPLAY:r=["cenc","sinf"];break;case yt.WIDEVINE:case yt.PLAYREADY:r=["cenc"];break;case yt.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return uT(r,e,t,s)}function uT(i,e,t,s){return[{initDataTypes:i,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function ir(i,e,t){return Uint8Array.prototype.slice?i.slice(e,t):new Uint8Array(Array.prototype.slice.call(i,e,t))}const xc=(i,e)=>e+10<=i.length&&i[e]===73&&i[e+1]===68&&i[e+2]===51&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128,Op=(i,e)=>e+10<=i.length&&i[e]===51&&i[e+1]===68&&i[e+2]===73&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128,In=(i,e)=>{const t=e;let s=0;for(;xc(i,e);){s+=10;const r=ro(i,e+6);s+=r,Op(i,e+10)&&(s+=10),e+=s}if(s>0)return i.subarray(t,t+s)},ro=(i,e)=>{let t=0;return t=(i[e]&127)<<21,t|=(i[e+1]&127)<<14,t|=(i[e+2]&127)<<7,t|=i[e+3]&127,t},hT=(i,e)=>xc(i,e)&&ro(i,e+6)+10<=i.length-e,Sc=i=>{const e=Bp(i);for(let t=0;t<e.length;t++){const s=e[t];if(Np(s))return vT(s)}},Np=i=>i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp",dT=i=>{const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=ro(i,4),s=10;return{type:e,size:t,data:i.subarray(s,s+t)}},Bp=i=>{let e=0;const t=[];for(;xc(i,e);){const s=ro(i,e+6);e+=10;const r=e+s;for(;e+8<r;){const n=dT(i.subarray(e)),a=fT(n);a&&t.push(a),e+=n.size+10}Op(i,e)&&(e+=10)}return t},fT=i=>i.type==="PRIV"?pT(i):i.type[0]==="W"?mT(i):gT(i),pT=i=>{if(i.size<2)return;const e=ei(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}},gT=i=>{if(i.size<2)return;if(i.type==="TXXX"){let t=1;const s=ei(i.data.subarray(t),!0);t+=s.length+1;const r=ei(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=ei(i.data.subarray(1));return{key:i.type,data:e}},mT=i=>{if(i.type==="WXXX"){if(i.size<2)return;let t=1;const s=ei(i.data.subarray(t),!0);t+=s.length+1;const r=ei(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=ei(i.data);return{key:i.type,data:e}},vT=i=>{if(i.data.byteLength===8){const e=new Uint8Array(i.data),t=e[3]&1;let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,t&&(s+=4772185884e-2),Math.round(s)}},ei=(i,e=!1)=>{const t=yT();if(t){const u=t.decode(i);if(e){const d=u.indexOf("\0");return d!==-1?u.substring(0,d):u}return u.replace(/\0/g,"")}const s=i.length;let r,n,a,o="",l=0;for(;l<s;){if(r=i[l++],r===0&&e)return o;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:n=i[l++],o+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=i[l++],a=i[l++],o+=String.fromCharCode((r&15)<<12|(n&63)<<6|(a&63)<<0);break}}return o};let jo;function yT(){if(!navigator.userAgent.includes("PlayStation 4"))return!jo&&typeof self.TextDecoder<"u"&&(jo=new self.TextDecoder("utf-8")),jo}const js={hexDump:function(i){let e="";for(let t=0;t<i.length;t++){let s=i[t].toString(16);s.length<2&&(s="0"+s),e+=s}return e}},$a=Math.pow(2,32)-1,xT=[].push,$p={video:1,audio:2,id3:3,text:4};function It(i){return String.fromCharCode.apply(null,i)}function Up(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function Ge(i,e){const t=Gp(i,e);return t<0?4294967296+t:t}function Nh(i,e){let t=Ge(i,e);return t*=Math.pow(2,32),t+=Ge(i,e+4),t}function Gp(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function Ko(i,e,t){i[e]=t>>24,i[e+1]=t>>16&255,i[e+2]=t>>8&255,i[e+3]=t&255}function ST(i){const e=i.byteLength;for(let t=0;t<e;){const s=Ge(i,t);if(s>8&&i[t+4]===109&&i[t+5]===111&&i[t+6]===111&&i[t+7]===102)return!0;t=s>1?t+s:e}return!1}function Qe(i,e){const t=[];if(!e.length)return t;const s=i.byteLength;for(let r=0;r<s;){const n=Ge(i,r),a=It(i.subarray(r+4,r+8)),o=n>1?r+n:s;if(a===e[0])if(e.length===1)t.push(i.subarray(r+8,o));else{const l=Qe(i.subarray(r+8,o),e.slice(1));l.length&&xT.apply(t,l)}r=o}return t}function ET(i){const e=[],t=i[0];let s=8;const r=Ge(i,s);s+=4;let n=0,a=0;t===0?(n=Ge(i,s),a=Ge(i,s+4),s+=8):(n=Nh(i,s),a=Nh(i,s+8),s+=16),s+=2;let o=i.length+a;const l=Up(i,s);s+=2;for(let u=0;u<l;u++){let d=s;const f=Ge(i,d);d+=4;const g=f&2147483647;if((f&2147483648)>>>31===1)return ie.warn("SIDX has hierarchical references (not supported)"),null;const y=Ge(i,d);d+=4,e.push({referenceSize:g,subsegmentDuration:y,info:{duration:y/r,start:o,end:o+g-1}}),o+=g,d+=4,s=d}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:l,references:e}}function Vp(i){const e=[],t=Qe(i,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],a=Qe(n,["tkhd"])[0];if(a){let o=a[0];const l=Ge(a,o===0?12:20),u=Qe(n,["mdia","mdhd"])[0];if(u){o=u[0];const d=Ge(u,o===0?12:20),f=Qe(n,["mdia","hdlr"])[0];if(f){const g=It(f.subarray(8,12)),v={soun:ht.AUDIO,vide:ht.VIDEO}[g];if(v){const y=Qe(n,["mdia","minf","stbl","stsd"])[0],E=bT(y);e[l]={timescale:d,type:v},e[v]=Nt({timescale:d,id:l},E)}}}}}return Qe(i,["moov","mvex","trex"]).forEach(r=>{const n=Ge(r,4),a=e[n];a&&(a.default={duration:Ge(r,12),flags:Ge(r,20)})}),e}function bT(i){const e=i.subarray(8),t=e.subarray(86),s=It(e.subarray(4,8));let r=s;const n=s==="enca"||s==="encv";if(n){const o=Qe(e,[s])[0].subarray(s==="enca"?28:78);Qe(o,["sinf"]).forEach(u=>{const d=Qe(u,["schm"])[0];if(d){const f=It(d.subarray(4,8));if(f==="cbcs"||f==="cenc"){const g=Qe(u,["frma"])[0];g&&(r=It(g))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const a=Qe(t,["avcC"])[0];r+="."+ra(a[1])+ra(a[2])+ra(a[3]);break}case"mp4a":{const a=Qe(e,[s])[0],o=Qe(a.subarray(28),["esds"])[0];if(o&&o.length>12){let l=4;if(o[l++]!==3)break;l=zo(o,l),l+=2;const u=o[l++];if(u&128&&(l+=2),u&64&&(l+=o[l++]),o[l++]!==4)break;l=zo(o,l);const d=o[l++];if(d===64)r+="."+ra(d);else break;if(l+=12,o[l++]!==5)break;l=zo(o,l);const f=o[l++];let g=(f&248)>>3;g===31&&(g+=1+((f&7)<<3)+((o[l]&224)>>5)),r+="."+g}break}case"hvc1":case"hev1":{const a=Qe(t,["hvcC"])[0],o=a[1],l=["","A","B","C"][o>>6],u=o&31,d=Ge(a,2),f=(o&32)>>5?"H":"L",g=a[12],v=a.subarray(6,12);r+="."+l+u,r+="."+d.toString(16).toUpperCase(),r+="."+f+g;let y="";for(let E=v.length;E--;){const b=v[E];(b||y)&&(y="."+b.toString(16).toUpperCase()+y)}r+=y;break}case"dvh1":case"dvhe":{const a=Qe(t,["dvcC"])[0],o=a[2]>>1&127,l=a[2]<<5&32|a[3]>>3&31;r+="."+Vs(o)+"."+Vs(l);break}case"vp09":{const a=Qe(t,["vpcC"])[0],o=a[4],l=a[5],u=a[6]>>4&15;r+="."+Vs(o)+"."+Vs(l)+"."+Vs(u);break}case"av01":{const a=Qe(t,["av1C"])[0],o=a[1]>>>5,l=a[1]&31,u=a[2]>>>7?"H":"M",d=(a[2]&64)>>6,f=(a[2]&32)>>5,g=o===2&&d?f?12:10:d?10:8,v=(a[2]&16)>>4,y=(a[2]&8)>>3,E=(a[2]&4)>>2,b=a[2]&3;r+="."+o+"."+Vs(l)+u+"."+Vs(g)+"."+v+"."+y+E+b+"."+Vs(1)+"."+Vs(1)+"."+Vs(1)+"."+0;break}}return{codec:r,encrypted:n}}function zo(i,e){const t=e+5;for(;i[e++]&128&&e<t;);return e}function ra(i){return("0"+i.toString(16).toUpperCase()).slice(-2)}function Vs(i){return(i<10?"0":"")+i}function TT(i,e){if(!i||!e)return i;const t=e.keyId;return t&&e.isCommonEncryption&&Qe(i,["moov","trak"]).forEach(r=>{const a=Qe(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=Qe(a,["enca"]);const l=o.length>0;l||(o=Qe(a,["encv"])),o.forEach(u=>{const d=l?u.subarray(28):u.subarray(78);Qe(d,["sinf"]).forEach(g=>{const v=Hp(g);if(v){const y=v.subarray(8,24);y.some(E=>E!==0)||(ie.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${js.hexDump(y)} -> ${js.hexDump(t)}`),v.set(t,8))}})})}),i}function Hp(i){const e=Qe(i,["schm"])[0];if(e){const t=It(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Qe(i,["schi","tenc"])[0]}return ie.error("[eme] missing 'schm' box"),null}function wT(i,e){return Qe(e,["moof","traf"]).reduce((t,s)=>{const r=Qe(s,["tfdt"])[0],n=r[0],a=Qe(s,["tfhd"]).reduce((o,l)=>{const u=Ge(l,4),d=i[u];if(d){let f=Ge(r,4);if(n===1){if(f===$a)return ie.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;f*=$a+1,f+=Ge(r,8)}const g=d.timescale||9e4,v=f/g;if(_e(v)&&(o===null||v<o))return v}return o},null);return a!==null&&_e(a)&&(t===null||a<t)?a:t},null)}function AT(i,e){let t=0,s=0,r=0;const n=Qe(i,["moof","traf"]);for(let a=0;a<n.length;a++){const o=n[a],l=Qe(o,["tfhd"])[0],u=Ge(l,4),d=e[u];if(!d)continue;const f=d.default,g=Ge(l,0)|(f==null?void 0:f.flags);let v=f==null?void 0:f.duration;g&8&&(g&2?v=Ge(l,12):v=Ge(l,8));const y=d.timescale||9e4,E=Qe(o,["trun"]);for(let b=0;b<E.length;b++){if(t=LT(E[b]),!t&&v){const w=Ge(E[b],4);t=v*w}d.type===ht.VIDEO?s+=t/y:d.type===ht.AUDIO&&(r+=t/y)}}if(s===0&&r===0){let a=1/0,o=0,l=0;const u=Qe(i,["sidx"]);for(let d=0;d<u.length;d++){const f=ET(u[d]);if(f!=null&&f.references){a=Math.min(a,f.earliestPresentationTime/f.timescale);const g=f.references.reduce((v,y)=>v+y.info.duration||0,0);o=Math.max(o,g+f.earliestPresentationTime/f.timescale),l=o-a}}if(l&&_e(l))return l}return s||r}function LT(i){const e=Ge(i,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let s=0;const r=Ge(i,4);for(let n=0;n<r;n++){if(e&256){const a=Ge(i,t);s+=a,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return s}function CT(i,e,t){Qe(e,["moof","traf"]).forEach(s=>{Qe(s,["tfhd"]).forEach(r=>{const n=Ge(r,4),a=i[n];if(!a)return;const o=a.timescale||9e4;Qe(s,["tfdt"]).forEach(l=>{const u=l[0],d=t*o;if(d){let f=Ge(l,4);if(u===0)f-=d,f=Math.max(f,0),Ko(l,4,f);else{f*=Math.pow(2,32),f+=Ge(l,8),f-=d,f=Math.max(f,0);const g=Math.floor(f/($a+1)),v=Math.floor(f%($a+1));Ko(l,4,g),Ko(l,8,v)}}})})})}function RT(i){const e={valid:null,remainder:null},t=Qe(i,["moof"]);if(t.length<2)return e.remainder=i,e;const s=t[t.length-1];return e.valid=ir(i,0,s.byteOffset-8),e.remainder=ir(i,s.byteOffset-8),e}function bs(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function Bh(i,e){const t=[],s=e.samples,r=e.timescale,n=e.id;let a=!1;return Qe(s,["moof"]).map(l=>{const u=l.byteOffset-8;Qe(l,["traf"]).map(f=>{const g=Qe(f,["tfdt"]).map(v=>{const y=v[0];let E=Ge(v,4);return y===1&&(E*=Math.pow(2,32),E+=Ge(v,8)),E/r})[0];return g!==void 0&&(i=g),Qe(f,["tfhd"]).map(v=>{const y=Ge(v,4),E=Ge(v,0)&16777215,b=(E&1)!==0,w=(E&2)!==0,F=(E&8)!==0;let k=0;const U=(E&16)!==0;let N=0;const te=(E&32)!==0;let j=8;y===n&&(b&&(j+=8),w&&(j+=4),F&&(k=Ge(v,j),j+=4),U&&(N=Ge(v,j),j+=4),te&&(j+=4),e.type==="video"&&(a=_T(e.codec)),Qe(f,["trun"]).map(re=>{const Q=re[0],le=Ge(re,0)&16777215,se=(le&1)!==0;let pe=0;const de=(le&4)!==0,be=(le&256)!==0;let Le=0;const ue=(le&512)!==0;let he=0;const we=(le&1024)!==0,me=(le&2048)!==0;let ye=0;const Ve=Ge(re,4);let $e=8;se&&(pe=Ge(re,$e),$e+=4),de&&($e+=4);let Xe=pe+u;for(let st=0;st<Ve;st++){if(be?(Le=Ge(re,$e),$e+=4):Le=k,ue?(he=Ge(re,$e),$e+=4):he=N,we&&($e+=4),me&&(Q===0?ye=Ge(re,$e):ye=Gp(re,$e),$e+=4),e.type===ht.VIDEO){let et=0;for(;et<he;){const rt=Ge(s,Xe);if(Xe+=4,IT(a,s[Xe])){const Je=s.subarray(Xe,Xe+rt);jp(Je,a?2:1,i+ye/r,t)}Xe+=rt,et+=rt+4}}i+=Le/r}}))})})}),t}function _T(i){if(!i)return!1;const e=i.indexOf("."),t=e<0?i:i.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function IT(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function jp(i,e,t,s){const r=Kp(i);let n=0;n+=e;let a=0,o=0,l=0;for(;n<r.length;){a=0;do{if(n>=r.length)break;l=r[n++],a+=l}while(l===255);o=0;do{if(n>=r.length)break;l=r[n++],o+=l}while(l===255);const u=r.length-n;let d=n;if(o<u)n+=o;else if(o>u){ie.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(a===4){if(r[d++]===181){const g=Up(r,d);if(d+=2,g===49){const v=Ge(r,d);if(d+=4,v===1195456820){const y=r[d++];if(y===3){const E=r[d++],b=31&E,w=64&E,F=w?2+b*3:0,k=new Uint8Array(F);if(w){k[0]=E;for(let U=1;U<F;U++)k[U]=r[d++]}s.push({type:y,payloadType:a,pts:t,bytes:k})}}}}}else if(a===5&&o>16){const f=[];for(let y=0;y<16;y++){const E=r[d++].toString(16);f.push(E.length==1?"0"+E:E),(y===3||y===5||y===7||y===9)&&f.push("-")}const g=o-16,v=new Uint8Array(g);for(let y=0;y<g;y++)v[y]=r[d++];s.push({payloadType:a,pts:t,uuid:f.join(""),userData:ei(v),userDataBytes:v})}}}function Kp(i){const e=i.byteLength,t=[];let s=1;for(;s<e-2;)i[s]===0&&i[s+1]===0&&i[s+2]===3?(t.push(s+2),s+=2):s++;if(t.length===0)return i;const r=e-t.length,n=new Uint8Array(r);let a=0;for(s=0;s<r;a++,s++)a===t[0]&&(a++,t.shift()),n[s]=i[a];return n}function kT(i){const e=i[0];let t="",s="",r=0,n=0,a=0,o=0,l=0,u=0;if(e===0){for(;It(i.subarray(u,u+1))!=="\0";)t+=It(i.subarray(u,u+1)),u+=1;for(t+=It(i.subarray(u,u+1)),u+=1;It(i.subarray(u,u+1))!=="\0";)s+=It(i.subarray(u,u+1)),u+=1;s+=It(i.subarray(u,u+1)),u+=1,r=Ge(i,12),n=Ge(i,16),o=Ge(i,20),l=Ge(i,24),u=28}else if(e===1){u+=4,r=Ge(i,u),u+=4;const f=Ge(i,u);u+=4;const g=Ge(i,u);for(u+=4,a=2**32*f+g,qb(a)||(a=Number.MAX_SAFE_INTEGER,ie.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ge(i,u),u+=4,l=Ge(i,u),u+=4;It(i.subarray(u,u+1))!=="\0";)t+=It(i.subarray(u,u+1)),u+=1;for(t+=It(i.subarray(u,u+1)),u+=1;It(i.subarray(u,u+1))!=="\0";)s+=It(i.subarray(u,u+1)),u+=1;s+=It(i.subarray(u,u+1)),u+=1}const d=i.subarray(u,i.byteLength);return{schemeIdUri:t,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:l,payload:d}}function PT(i,...e){const t=e.length;let s=8,r=t;for(;r--;)s+=e[r].byteLength;const n=new Uint8Array(s);for(n[0]=s>>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=s&255,n.set(i,4),r=0,s=8;r<t;r++)n.set(e[r],s),s+=e[r].byteLength;return n}function DT(i,e,t){if(i.byteLength!==16)throw new RangeError("Invalid system id");let s,r;s=0,r=new Uint8Array;let n;s>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),PT([112,115,115,104],new Uint8Array([s,0,0,0]),i,n,r,a,t||new Uint8Array)}function MT(i){if(!(i instanceof ArrayBuffer)||i.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(i),s=t.getUint32(0);if(i.byteLength!==s&&s>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=js.hexDump(new Uint8Array(i,12,16));const n=t.getUint32(28);if(e.version===0){if(s-32<n)return null;e.data=new Uint8Array(i,32,n)}else if(e.version===1){e.kids=[];for(let a=0;a<n;a++)e.kids.push(new Uint8Array(i,32+a*16,16))}return e}let na={};class kn{static clearKeyUriToKeyIdMap(){na={}}constructor(e,t,s,r=[1],n=null){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=s,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case rs.FAIRPLAY:case rs.WIDEVINE:case rs.PLAYREADY:case rs.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&ie.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const s=FT(e);return new kn(this.method,this.uri,"identity",this.keyFormatVersions,s)}const t=oT(this.uri);if(t)switch(this.keyFormat){case rs.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case rs.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=DT(s,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),a=n.substring(n.indexOf("<"),n.length),u=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("KID")[0];if(u){const d=u.childNodes[0]?u.childNodes[0].nodeValue:u.getAttribute("VALUE");if(d){const f=yc(d).subarray(0,16);aT(f),this.keyId=f}}break}default:{let s=t.subarray(0,16);if(s.length!==16){const r=new Uint8Array(16);r.set(s,16-s.length),s=r}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=na[this.uri];if(!s){const r=Object.keys(na).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,r),na[this.uri]=s}this.keyId=s}return this}}function FT(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const zp=/\{\$([a-zA-Z0-9-_]+)\}/g;function $h(i){return zp.test(i)}function ss(i,e,t){if(i.variableList!==null||i.hasVariableRefs)for(let s=t.length;s--;){const r=t[s],n=e[r];n&&(e[r]=Ll(i,n))}}function Ll(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(zp,s=>{const r=s.substring(2,s.length-1),n=t==null?void 0:t[r];return n===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),s):n})}return e}function Uh(i,e,t){let s=i.variableList;s||(i.variableList=s={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(r))n=a.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(a){i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else r=e.NAME,n=e.VALUE;r in s?i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):s[r]=n||""}function OT(i,e,t){const s=e.IMPORT;if(t&&s in t){let r=i.variableList;r||(i.variableList=r={}),r[s]=t[s]}else i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function ar(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function NT(i){return typeof self<"u"&&i===self.ManagedMediaSource}const Ua={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,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 BT(i,e){const t=Ua[e];return!!t&&!!t[i.slice(0,4)]}function Wo(i,e,t=!0){return!i.split(",").some(s=>!Wp(s,e,t))}function Wp(i,e,t=!0){var s;const r=ar(t);return(s=r==null?void 0:r.isTypeSupported(Pn(i,e)))!=null?s:!1}function Pn(i,e){return`${e}/mp4;codecs="${i}"`}function Gh(i){if(i){const e=i.substring(0,4);return Ua.video[e]}return 2}function Ga(i){return i.split(",").reduce((e,t)=>{const s=Ua.video[t];return s?(s*2+e)/(e?3:2):(Ua.audio[t]+e)/(e?2:1)},0)}const qo={};function $T(i,e=!0){if(qo[i])return qo[i];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[i];for(let s=0;s<t.length;s++)if(Wp(t[s],"audio",e))return qo[i]=t[s],t[s];return i}const UT=/flac|opus/i;function Va(i,e=!0){return i.replace(UT,t=>$T(t.toLowerCase(),e))}function Vh(i,e){return i&&i!=="mp4a"?i:e&&e.split(",")[0]}function GT(i){const e=i.split(".");if(e.length>2){let t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4),t}return i}const Hh=/#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,jh=/#EXT-X-MEDIA:(.*)/g,VT=/^#EXT(?:INF|-X-TARGETDURATION):/m,Kh=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),HT=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(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 Js{static findGroup(e,t){for(let s=0;s<e.length;s++){const r=e[s];if(r.id===t)return r}}static resolve(e,t){return vc.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return VT.test(e)}static parseMasterPlaylist(e,t){const s=$h(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},n=[];Hh.lastIndex=0;let a;for(;(a=Hh.exec(e))!=null;)if(a[1]){var o;const u=new St(a[1]);ss(r,u,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const d=Ll(r,a[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Js.resolve(d,t)},g=u.decimalResolution("RESOLUTION");g&&(f.width=g.width,f.height=g.height),jT(u.CODECS,f),(o=f.unknownCodecs)!=null&&o.length||n.push(f),r.levels.push(f)}else if(a[3]){const u=a[3],d=a[4];switch(u){case"SESSION-DATA":{const f=new St(d);ss(r,f,["DATA-ID","LANGUAGE","VALUE","URI"]);const g=f["DATA-ID"];g&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[g]=f);break}case"SESSION-KEY":{const f=zh(d,t,r);f.encrypted&&f.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(f)):ie.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${d}"`);break}case"DEFINE":{{const f=new St(d);ss(r,f,["NAME","VALUE","QUERYPARAM"]),Uh(r,f,t)}break}case"CONTENT-STEERING":{const f=new St(d);ss(r,f,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:Js.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Wh(d);break}}}const l=n.length>0&&n.length<r.levels.length;return r.levels=l?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,s){let r;const n={},a=s.levels,o={AUDIO:a.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:a.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(jh.lastIndex=0;(r=jh.exec(e))!==null;){const u=new St(r[1]),d=u.TYPE;if(d){const f=o[d],g=n[d]||[];n[d]=g,ss(s,u,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const v=u.LANGUAGE,y=u["ASSOC-LANGUAGE"],E=u.CHANNELS,b=u.CHARACTERISTICS,w=u["INSTREAM-ID"],F={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||v||"",type:d,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:v,url:u.URI?Js.resolve(u.URI,t):""};if(y&&(F.assocLang=y),E&&(F.channels=E),b&&(F.characteristics=b),w&&(F.instreamId=w),f!=null&&f.length){const k=Js.findGroup(f,F.groupId)||f[0];qh(F,k,"audioCodec"),qh(F,k,"textCodec")}g.push(F)}}return n}static parseLevelPlaylist(e,t,s,r,n,a){const o=new rT(t),l=o.fragments;let u=null,d=0,f=0,g=0,v=0,y=null,E=new Vo(r,t),b,w,F,k=-1,U=!1,N=null;for(Kh.lastIndex=0,o.m3u8=e,o.hasVariableRefs=$h(e);(b=Kh.exec(e))!==null;){U&&(U=!1,E=new Vo(r,t),E.start=g,E.sn=d,E.cc=v,E.level=s,u&&(E.initSegment=u,E.rawProgramDateTime=u.rawProgramDateTime,u.rawProgramDateTime=null,N&&(E.setByteRange(N),N=null)));const Q=b[1];if(Q){E.duration=parseFloat(Q);const le=(" "+b[2]).slice(1);E.title=le||null,E.tagList.push(le?["INF",Q,le]:["INF",Q])}else if(b[3]){if(_e(E.duration)){E.start=g,F&&Qh(E,F,o),E.sn=d,E.level=s,E.cc=v,l.push(E);const le=(" "+b[3]).slice(1);E.relurl=Ll(o,le),Yh(E,y),y=E,g+=E.duration,d++,f=0,U=!0}}else if(b[4]){const le=(" "+b[4]).slice(1);y?E.setByteRange(le,y):E.setByteRange(le)}else if(b[5])E.rawProgramDateTime=(" "+b[5]).slice(1),E.tagList.push(["PROGRAM-DATE-TIME",E.rawProgramDateTime]),k===-1&&(k=l.length);else{if(b=b[0].match(HT),!b){ie.warn("No matches on slow regex match for level playlist!");continue}for(w=1;w<b.length&&!(typeof b[w]<"u");w++);const le=(" "+b[w]).slice(1),se=(" "+b[w+1]).slice(1),pe=b[w+2]?(" "+b[w+2]).slice(1):"";switch(le){case"PLAYLIST-TYPE":o.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":d=o.startSN=parseInt(se);break;case"SKIP":{const de=new St(se);ss(o,de,["RECENTLY-REMOVED-DATERANGES"]);const be=de.decimalInteger("SKIPPED-SEGMENTS");if(_e(be)){o.skippedSegments=be;for(let ue=be;ue--;)l.unshift(null);d+=be}const Le=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(o.recentlyRemovedDateranges=Le.split(" "));break}case"TARGETDURATION":o.targetduration=Math.max(parseInt(se),1);break;case"VERSION":o.version=parseInt(se);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":(se||pe)&&E.tagList.push(pe?[se,pe]:[se]);break;case"DISCONTINUITY":v++,E.tagList.push(["DIS"]);break;case"GAP":E.gap=!0,E.tagList.push([le]);break;case"BITRATE":E.tagList.push([le,se]);break;case"DATERANGE":{const de=new St(se);ss(o,de,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),ss(o,de,de.clientAttrs);const be=new Pp(de,o.dateRanges[de.ID]);be.isValid||o.skippedSegments?o.dateRanges[be.id]=be:ie.warn(`Ignoring invalid DATERANGE tag: "${se}"`),E.tagList.push(["EXT-X-DATERANGE",se]);break}case"DEFINE":{{const de=new St(se);ss(o,de,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in de?OT(o,de,a):Uh(o,de,t)}break}case"DISCONTINUITY-SEQUENCE":v=parseInt(se);break;case"KEY":{const de=zh(se,t,o);if(de.isSupported()){if(de.method==="NONE"){F=void 0;break}F||(F={}),F[de.keyFormat]&&(F=Ct({},F)),F[de.keyFormat]=de}else ie.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${se}"`);break}case"START":o.startTimeOffset=Wh(se);break;case"MAP":{const de=new St(se);if(ss(o,de,["BYTERANGE","URI"]),E.duration){const be=new Vo(r,t);Xh(be,de,s,F),u=be,E.initSegment=u,u.rawProgramDateTime&&!E.rawProgramDateTime&&(E.rawProgramDateTime=u.rawProgramDateTime)}else{const be=E.byteRangeEndOffset;if(be){const Le=E.byteRangeStartOffset;N=`${be-Le}@${Le}`}else N=null;Xh(E,de,s,F),u=E,U=!0}break}case"SERVER-CONTROL":{const de=new St(se);o.canBlockReload=de.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=de.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&de.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=de.optionalFloat("PART-HOLD-BACK",0),o.holdBack=de.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const de=new St(se);o.partTarget=de.decimalFloatingPoint("PART-TARGET");break}case"PART":{let de=o.partList;de||(de=o.partList=[]);const be=f>0?de[de.length-1]:void 0,Le=f++,ue=new St(se);ss(o,ue,["BYTERANGE","URI"]);const he=new sT(ue,E,t,Le,be);de.push(he),E.duration+=he.duration;break}case"PRELOAD-HINT":{const de=new St(se);ss(o,de,["URI"]),o.preloadHint=de;break}case"RENDITION-REPORT":{const de=new St(se);ss(o,de,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(de);break}default:ie.warn(`line parsed but not handled: ${b}`);break}}}y&&!y.relurl?(l.pop(),g-=y.duration,o.partList&&(o.fragmentHint=y)):o.partList&&(Yh(E,y),E.cc=v,o.fragmentHint=E,F&&Qh(E,F,o));const te=l.length,j=l[0],re=l[te-1];if(g+=o.skippedSegments*o.targetduration,g>0&&te&&re){o.averagetargetduration=g/te;const Q=re.sn;o.endSN=Q!=="initSegment"?Q:0,o.live||(re.endList=!0),j&&(o.startCC=j.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(g+=o.fragmentHint.duration),o.totalduration=g,o.endCC=v,k>0&&KT(l,k),o}}function zh(i,e,t){var s,r;const n=new St(i);ss(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=(s=n.METHOD)!=null?s:"",o=n.URI,l=n.hexadecimalInteger("IV"),u=n.KEYFORMATVERSIONS,d=(r=n.KEYFORMAT)!=null?r:"identity";o&&n.IV&&!l&&ie.error(`Invalid IV: ${n.IV}`);const f=o?Js.resolve(o,e):"",g=(u||"1").split("/").map(Number).filter(Number.isFinite);return new kn(a,f,d,g,l)}function Wh(i){const t=new St(i).decimalFloatingPoint("TIME-OFFSET");return _e(t)?t:null}function jT(i,e){let t=(i||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const r=t.filter(n=>BT(n,s));r.length&&(e[`${s}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function qh(i,e,t){const s=e[t];s&&(i[t]=s)}function KT(i,e){let t=i[e];for(let s=e;s--;){const r=i[s];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function Yh(i,e){i.rawProgramDateTime?i.programDateTime=Date.parse(i.rawProgramDateTime):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime),_e(i.programDateTime)||(i.programDateTime=null,i.rawProgramDateTime=null)}function Xh(i,e,t,s){i.relurl=e.URI,e.BYTERANGE&&i.setByteRange(e.BYTERANGE),i.level=t,i.sn="initSegment",s&&(i.levelkeys=s),i.initSegment=null}function Qh(i,e,t){i.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&s.push(i)}var it={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},He={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Jh(i){const{type:e}=i;switch(e){case it.AUDIO_TRACK:return He.AUDIO;case it.SUBTITLE_TRACK:return He.SUBTITLE;default:return He.MAIN}}function Yo(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class zT{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(C.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(C.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,r=t.loader,n=s||r,a=new n(t);return this.loaders[e.type]=a,a}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:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:it.MANIFEST,url:s,deliveryDirectives:null})}onLevelLoading(e,t){const{id:s,level:r,pathwayId:n,url:a,deliveryDirectives:o}=t;this.load({id:s,level:r,pathwayId:n,responseType:"text",type:it.LEVEL,url:a,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:it.AUDIO_TRACK,url:n,deliveryDirectives:a})}onSubtitleTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:it.SUBTITLE_TRACK,url:n,deliveryDirectives:a})}load(e){var t;const s=this.hls.config;let r=this.getInternalLoader(e);if(r){const u=r.context;if(u&&u.url===e.url&&u.level===e.level){ie.trace("[playlist-loader]: playlist request ongoing");return}ie.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===it.MANIFEST?n=s.manifestLoadPolicy.default:n=Ct({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),_e((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===it.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===it.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===it.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const d=u.partTarget,f=u.targetduration;if(d&&f){const g=Math.max(d*3,f*.8)*1e3;n=Ct({},n,{maxTimeToFirstByteMs:Math.min(g,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(g,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(u,d,f,g)=>{const v=this.getInternalLoader(f);this.resetInternalLoader(f.type);const y=u.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),g||null,d);return}d.parsing.start=performance.now(),Js.isMediaPlaylist(y)?this.handleTrackOrLevelPlaylist(u,d,f,g||null,v):this.handleMasterPlaylist(u,d,f,g)},onError:(u,d,f,g)=>{this.handleNetworkError(d,f,!1,u,g)},onTimeout:(u,d,f)=>{this.handleNetworkError(d,f,!0,void 0,u)}};r.load(e,o,l)}handleMasterPlaylist(e,t,s,r){const n=this.hls,a=e.data,o=Yo(e,s),l=Js.parseMasterPlaylist(a,o);if(l.playlistParsingError){this.handleManifestParsingError(e,s,l.playlistParsingError,r,t);return}const{contentSteering:u,levels:d,sessionData:f,sessionKeys:g,startTimeOffset:v,variableList:y}=l;this.variableList=y;const{AUDIO:E=[],SUBTITLES:b,"CLOSED-CAPTIONS":w}=Js.parseMasterPlaylistMedia(a,o,l);E.length&&!E.some(k=>!k.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(ie.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new St({}),bitrate:0,url:""})),n.trigger(C.MANIFEST_LOADED,{levels:d,audioTracks:E,subtitles:b,captions:w,contentSteering:u,url:o,stats:t,networkDetails:r,sessionData:f,sessionKeys:g,startTimeOffset:v,variableList:y})}handleTrackOrLevelPlaylist(e,t,s,r,n){const a=this.hls,{id:o,level:l,type:u}=s,d=Yo(e,s),f=0,g=_e(l)?l:_e(o)?o:0,v=Jh(s),y=Js.parseLevelPlaylist(e.data,d,g,v,f,this.variableList);if(u===it.MANIFEST){const E={attrs:new St({}),bitrate:0,details:y,name:"",url:d};a.trigger(C.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:d,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=y,this.handlePlaylistLoaded(y,e,t,s,r,n)}handleManifestParsingError(e,t,s,r,n){this.hls.trigger(C.ERROR,{type:je.NETWORK_ERROR,details:ce.MANIFEST_PARSING_ERROR,fatal:t.type===it.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,s=!1,r,n){let a=`A network ${s?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===it.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===it.AUDIO_TRACK||e.type===it.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);ie.warn(`[playlist-loader]: ${a}`);let l=ce.UNKNOWN,u=!1;const d=this.getInternalLoader(e);switch(e.type){case it.MANIFEST:l=s?ce.MANIFEST_LOAD_TIMEOUT:ce.MANIFEST_LOAD_ERROR,u=!0;break;case it.LEVEL:l=s?ce.LEVEL_LOAD_TIMEOUT:ce.LEVEL_LOAD_ERROR,u=!1;break;case it.AUDIO_TRACK:l=s?ce.AUDIO_TRACK_LOAD_TIMEOUT:ce.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case it.SUBTITLE_TRACK:l=s?ce.SUBTITLE_TRACK_LOAD_TIMEOUT:ce.SUBTITLE_LOAD_ERROR,u=!1;break}d&&this.resetInternalLoader(e.type);const f={type:je.NETWORK_ERROR,details:l,fatal:u,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:n};if(r){const g=(t==null?void 0:t.url)||e.url;f.response=Nt({url:g,data:void 0},r)}this.hls.trigger(C.ERROR,f)}handlePlaylistLoaded(e,t,s,r,n,a){const o=this.hls,{type:l,level:u,id:d,groupId:f,deliveryDirectives:g}=r,v=Yo(t,r),y=Jh(r),E=typeof r.level=="number"&&y===He.MAIN?u:void 0;if(!e.fragments.length){const w=new Error("No Segments found in Playlist");o.trigger(C.ERROR,{type:je.NETWORK_ERROR,details:ce.LEVEL_EMPTY_ERROR,fatal:!1,url:v,error:w,reason:w.message,response:t,context:r,level:E,parent:y,networkDetails:n,stats:s});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const b=e.playlistParsingError;if(b){o.trigger(C.ERROR,{type:je.NETWORK_ERROR,details:ce.LEVEL_PARSING_ERROR,fatal:!1,url:v,error:b,reason:b.message,response:t,context:r,level:E,parent:y,networkDetails:n,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case it.MANIFEST:case it.LEVEL:o.trigger(C.LEVEL_LOADED,{details:e,level:E||0,id:d||0,stats:s,networkDetails:n,deliveryDirectives:g});break;case it.AUDIO_TRACK:o.trigger(C.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:f||"",stats:s,networkDetails:n,deliveryDirectives:g});break;case it.SUBTITLE_TRACK:o.trigger(C.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:f||"",stats:s,networkDetails:n,deliveryDirectives:g});break}}}function qp(i,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=i,e.dispatchEvent(t)}function Yp(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues&&!i.cues.getCueById(e.id))try{if(i.addCue(e),!i.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){ie.debug(`[texttrack-utils]: ${s}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,i.addCue(r)}catch(r){ie.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(i.mode=t)}function Dr(i){const e=i.mode;if(e==="disabled"&&(i.mode="hidden"),i.cues)for(let t=i.cues.length;t--;)i.removeCue(i.cues[t]);e==="disabled"&&(i.mode=e)}function Cl(i,e,t,s){const r=i.mode;if(r==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const n=qT(i.cues,e,t);for(let a=0;a<n.length;a++)(!s||s(n[a]))&&i.removeCue(n[a])}r==="disabled"&&(i.mode=r)}function WT(i,e){if(e<i[0].startTime)return 0;const t=i.length-1;if(e>i[t].endTime)return-1;let s=0,r=t;for(;s<=r;){const n=Math.floor((r+s)/2);if(e<i[n].startTime)r=n-1;else if(e>i[n].startTime&&s<t)s=n+1;else return n}return i[s].startTime-e<e-i[r].startTime?s:r}function qT(i,e,t){const s=[],r=WT(i,e);if(r>-1)for(let n=r,a=i.length;n<a;n++){const o=i[n];if(o.startTime>=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function Sa(i){const e=[];for(let t=0;t<i.length;t++){const s=i[t];(s.kind==="subtitles"||s.kind==="captions")&&s.label&&e.push(i[t])}return e}var ks={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const YT=.25;function Rl(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Zh(i,e,t,s,r){let n=new i(e,t,"");try{n.value=s,r&&(n.type=r)}catch{n=new i(e,t,JSON.stringify(r?Nt({type:r},s):s))}return n}const aa=(()=>{const i=Rl();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Xo(i,e){return i.getTime()/1e3-e}function XT(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class QT{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Dr(this.id3Track),this.id3Track=null,this.media=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 s=e[t];if(s.kind==="metadata"&&s.label==="id3")return qp(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:r}}}=this;if(!s&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Rl();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===ks.emsg&&!s||!r)continue;const u=Bp(n[o].data);if(u){const d=n[o].pts;let f=d+n[o].duration;f>aa&&(f=aa),f-d<=0&&(f=d+YT);for(let v=0;v<u.length;v++){const y=u[v];if(!Np(y)){this.updateId3CueEnds(d,l);const E=Zh(a,d,f,y,l);E&&this.id3Track.addCue(E)}}}}}updateId3CueEnds(e,t){var s;const r=(s=this.id3Track)==null?void 0:s.cues;if(r)for(let n=r.length;n--;){const a=r[n];a.type===t&&a.startTime<e&&a.endTime===aa&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:s,type:r}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(n&&(o||l)){let u;r==="audio"?u=d=>d.type===ks.audioId3&&l:r==="video"?u=d=>d.type===ks.emsg&&o:u=d=>d.type===ks.audioId3&&l||d.type===ks.emsg&&o,Cl(n,t,s,u)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:s,id3Track:r}=this,{dateRanges:n}=t,a=Object.keys(n);if(r){const d=Object.keys(s).filter(f=>!a.includes(f));for(let f=d.length;f--;){const g=d[f];Object.keys(s[g].cues).forEach(v=>{r.removeCue(s[g].cues[v])}),delete s[g]}}const o=t.fragments[t.fragments.length-1];if(a.length===0||!_e(o==null?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=o.programDateTime/1e3-o.start,u=Rl();for(let d=0;d<a.length;d++){const f=a[d],g=n[f],v=Xo(g.startDate,l),y=s[f],E=(y==null?void 0:y.cues)||{};let b=(y==null?void 0:y.durationKnown)||!1,w=aa;const F=g.endDate;if(F)w=Xo(F,l),b=!0;else if(g.endOnNext&&!b){const U=a.reduce((N,te)=>{if(te!==g.id){const j=n[te];if(j.class===g.class&&j.startDate>g.startDate&&(!N||g.startDate<N.startDate))return j}return N},null);U&&(w=Xo(U.startDate,l),b=!0)}const k=Object.keys(g.attr);for(let U=0;U<k.length;U++){const N=k[U];if(!eT(N))continue;const te=E[N];if(te)b&&!y.durationKnown&&(te.endTime=w);else if(u){let j=g.attr[N];tT(N)&&(j=XT(j));const re=Zh(u,v,w,{key:N,data:j},ks.dateRange);re&&(re.id=f,this.id3Track.addCue(re),E[N]=re)}}s[f]={cues:E,dateRange:g,durationKnown:b}}}}class JT{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:s,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let u=o&&s||t;(l.liveSyncDuration||l.liveSyncDurationCount||u===0)&&(u=n!==void 0?n:a*r);const d=r;return u+Math.min(this.stallCount*1,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,s=this.levelDetails;if(e===null||t===null||s===null)return null;const r=s.edge,n=e-t-this.edgeStalled,a=r-s.totalduration,o=r-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,n),o)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(C.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(C.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(C.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(C.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var s;t.details===ce.BUFFER_STALLED_ERROR&&(this.stallCount++,(s=this.levelDetails)!=null&&s.live&&ie.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!t.live)return;const a=this.targetLatency;if(a===null)return;const o=s-a,l=Math.min(this.maxLatency,a+t.targetduration);if(o<l&&o>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,n)),f=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(d,Math.max(1,f))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const _l=["NONE","TYPE-0","TYPE-1",null];function ZT(i){return _l.indexOf(i)>-1}const Ha=["SDR","PQ","HLG"];function ew(i){return!!i&&Ha.indexOf(i)>-1}var Ea={No:"",Yes:"YES",v2:"v2"};function ed(i){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=i,r=s<e/2;return e&&r?t?Ea.v2:Ea.Yes:Ea.No}class td{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class $r{constructor(e){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.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(t=>!!t).map(t=>t.substring(0,4)).join(","),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 sd(this._audioGroups,e)}hasSubtitleGroup(e){return sd(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.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(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function sd(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function Qo(i,e){const t=e.startPTS;if(_e(t)){let s=0,r;e.sn>i.sn?(s=t-i.start,r=i):(s=i.start-t,r=e),r.duration!==s&&(r.duration=s)}else e.sn>i.sn?i.cc===e.cc&&i.minEndPTS?e.start=i.start+(i.minEndPTS-i.start):e.start=i.start+i.duration:e.start=Math.max(i.start-e.duration,0)}function Xp(i,e,t,s,r,n){s-t<=0&&(ie.warn("Fragment should have a positive duration",e),s=t+e.duration,n=r+e.duration);let o=t,l=s;const u=e.startPTS,d=e.endPTS;if(_e(u)){const b=Math.abs(u-t);_e(e.deltaPTS)?e.deltaPTS=Math.max(b,e.deltaPTS):e.deltaPTS=b,o=Math.max(t,u),t=Math.min(t,u),r=Math.min(r,e.startDTS),l=Math.min(s,d),s=Math.max(s,d),n=Math.max(n,e.endDTS)}const f=t-e.start;e.start!==0&&(e.start=t),e.duration=s-e.start,e.startPTS=t,e.maxStartPTS=o,e.startDTS=r,e.endPTS=s,e.minEndPTS=l,e.endDTS=n;const g=e.sn;if(!i||g<i.startSN||g>i.endSN)return 0;let v;const y=g-i.startSN,E=i.fragments;for(E[y]=e,v=y;v>0;v--)Qo(E[v],E[v-1]);for(v=y;v<E.length-1;v++)Qo(E[v],E[v+1]);return i.fragmentHint&&Qo(E[E.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,f}function tw(i,e){let t=null;const s=i.fragments;for(let l=s.length-1;l>=0;l--){const u=s[l].initSegment;if(u){t=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let r=0,n;if(rw(i,e,(l,u)=>{l.relurl&&(r=l.cc-u.cc),_e(l.startPTS)&&_e(l.endPTS)&&(u.start=u.startPTS=l.startPTS,u.startDTS=l.startDTS,u.maxStartPTS=l.maxStartPTS,u.endPTS=l.endPTS,u.endDTS=l.endDTS,u.minEndPTS=l.minEndPTS,u.duration=l.endPTS-l.startPTS,u.duration&&(n=u),e.PTSKnown=e.alignedSliding=!0),u.elementaryStreams=l.elementaryStreams,u.loader=l.loader,u.stats=l.stats,l.initSegment&&(u.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(u=>{var d;u&&(!u.initSegment||u.initSegment.relurl===((d=t)==null?void 0:d.relurl))&&(u.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){ie.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=sw(i.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const a=e.fragments;if(r){ie.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<a.length;l++)a[l].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),iw(i.partList,e.partList,(l,u)=>{u.elementaryStreams=l.elementaryStreams,u.stats=l.stats}),n?Xp(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):Qp(i,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const l=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=l),e.driftEndTime=o,e.driftEnd=l}else e.driftEndTime=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime}function sw(i,e,t){const s=Ct({},i);return t&&t.forEach(r=>{delete s[r]}),Object.keys(e).forEach(r=>{const n=new Pp(e[r].attr,s[r]);n.isValid?s[r]=n:ie.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),s}function iw(i,e,t){if(i&&e){let s=0;for(let r=0,n=i.length;r<=n;r++){const a=i[r],o=e[r+s];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):s--}}}function rw(i,e,t){const s=e.skippedSegments,r=Math.max(i.startSN,e.startSN)-e.startSN,n=(i.fragmentHint?1:0)+(s?e.endSN:Math.min(i.endSN,e.endSN))-e.startSN,a=e.startSN-i.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;for(let u=r;u<=n;u++){const d=l[a+u];let f=o[u];s&&!f&&u<s&&(f=e.fragments[u]=d),d&&f&&t(d,f)}}function Qp(i,e){const t=e.startSN+e.skippedSegments-i.startSN,s=i.fragments;t<0||t>=s.length||Il(e,s[t].start)}function Il(i,e){if(e){const t=i.fragments;for(let s=i.skippedSegments;s<t.length;s++)t[s].start+=e;i.fragmentHint&&(i.fragmentHint.start+=e)}}function nw(i,e=1/0){let t=1e3*i.targetduration;if(i.updated){const s=i.fragments;if(s.length&&t*4>e){const n=s[s.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function aw(i,e,t){if(!(i!=null&&i.details))return null;const s=i.details;let r=s.fragments[e-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===e)?r:e<s.startSN&&t&&t.sn===e?t:null}function id(i,e,t){var s;return i!=null&&i.details?Jp((s=i.details)==null?void 0:s.partList,e,t):null}function Jp(i,e,t){if(i)for(let s=i.length;s--;){const r=i[s];if(r.index===t&&r.fragment.sn===e)return r}return null}function Zp(i){i.forEach((e,t)=>{const{details:s}=e;s!=null&&s.fragments&&s.fragments.forEach(r=>{r.level=t})})}function ja(i){switch(i.details){case ce.FRAG_LOAD_TIMEOUT:case ce.KEY_LOAD_TIMEOUT:case ce.LEVEL_LOAD_TIMEOUT:case ce.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function rd(i,e){const t=ja(e);return i.default[`${t?"timeout":"error"}Retry`]}function Ec(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function nd(i){return Nt(Nt({},i),{errorRetry:null,timeoutRetry:null})}function Ka(i,e,t,s){if(!i)return!1;const r=s==null?void 0:s.code,n=e<i.maxNumRetry&&(ow(r)||!!t);return i.shouldRetry?i.shouldRetry(i,e,t,s,n):n}function ow(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}const eg={search:function(i,e){let t=0,s=i.length-1,r=null,n=null;for(;t<=s;){r=(t+s)/2|0,n=i[r];const a=e(n);if(a>0)t=r+1;else if(a<0)s=r-1;else return n}return null}};function lw(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!_e(e))return null;const s=i[0].programDateTime;if(e<(s||0))return null;const r=i[i.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<i.length;++n){const a=i[n];if(cw(e,t,a))return a}return null}function za(i,e,t=0,s=0){let r=null;if(i){r=e[i.sn-e[0].sn+1]||null;const a=i.endDTS-t;a>0&&a<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&(!i||i.level===r.level)&&kl(t,s,r)===0)return r;const n=eg.search(e,kl.bind(null,t,s));return n&&(n!==i||!r)?n:r}function kl(i=0,e=0,t){if(t.start<=i&&t.start+t.duration>i)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=i?1:t.start-s>i&&t.start?-1:0}function cw(i,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>i}function uw(i,e){return eg.search(i,t=>t.cc<e?1:t.cc>e?-1:0)}var Ht={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},_s={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class hw{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=ie.log.bind(ie,"[info]:"),this.warn=ie.warn.bind(ie,"[warning]:"),this.error=ie.error.bind(ie,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(C.ERROR,this.onError,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(C.ERROR,this.onError,this),e.off(C.ERROR,this.onErrorOut,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===He.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var s,r;if(t.fatal)return;const n=this.hls,a=t.context;switch(t.details){case ce.FRAG_LOAD_ERROR:case ce.FRAG_LOAD_TIMEOUT:case ce.KEY_LOAD_ERROR:case ce.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case ce.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction={action:Ht.DoNothing,flags:_s.None};return}case ce.FRAG_GAP:case ce.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ht.SendAlternateToPenaltyBox;return}case ce.LEVEL_EMPTY_ERROR:case ce.LEVEL_PARSING_ERROR:{var o,l;const u=t.parent===He.MAIN?t.level:n.loadLevel;t.details===ce.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(l=o.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,u):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,u))}return;case ce.LEVEL_LOAD_ERROR:case ce.LEVEL_LOAD_TIMEOUT:typeof(a==null?void 0:a.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level));return;case ce.AUDIO_TRACK_LOAD_ERROR:case ce.AUDIO_TRACK_LOAD_TIMEOUT:case ce.SUBTITLE_LOAD_ERROR:case ce.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){const u=n.levels[n.loadLevel];if(u&&(a.type===it.AUDIO_TRACK&&u.hasAudioGroup(a.groupId)||a.type===it.SUBTITLE_TRACK&&u.hasSubtitleGroup(a.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=Ht.SendAlternateToPenaltyBox,t.errorAction.flags=_s.MoveAllAlternatesMatchingHost;return}}return;case ce.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=n.levels[n.loadLevel],d=u==null?void 0:u.attrs["HDCP-LEVEL"];d?t.errorAction={action:Ht.SendAlternateToPenaltyBox,flags:_s.MoveAllAlternatesMatchingHDCP,hdcpLevel:d}:this.keySystemError(t)}return;case ce.BUFFER_ADD_CODEC_ERROR:case ce.REMUX_ALLOC_ERROR:case ce.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case ce.INTERNAL_EXCEPTION:case ce.BUFFER_APPENDING_ERROR:case ce.BUFFER_FULL_ERROR:case ce.LEVEL_SWITCH_ERROR:case ce.BUFFER_STALLED_ERROR:case ce.BUFFER_SEEK_OVER_HOLE:case ce.BUFFER_NUDGE_ON_STALL:t.errorAction={action:Ht.DoNothing,flags:_s.None};return}t.type===je.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,r=rd(s.config.playlistLoadPolicy,e),n=this.playlistError++;if(Ka(r,n,ja(e),e.response))return{action:Ht.RetryRequest,flags:_s.None,retryConfig:r,retryCount:n};const o=this.getLevelSwitchAction(e,t);return r&&(o.retryConfig=r,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),r=t.levels[s],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=rd(e.details.startsWith("key")?a:n,e),l=t.levels.reduce((d,f)=>d+f.fragmentError,0);if(r&&(e.details!==ce.FRAG_GAP&&r.fragmentError++,Ka(o,l,ja(e),e.response)))return{action:Ht.RetryRequest,flags:_s.None,retryConfig:o,retryCount:l};const u=this.getLevelSwitchAction(e,s);return o&&(u.retryConfig=o,u.retryCount=l),u}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const r=this.hls.levels[t];if(r){var n,a;const u=e.details;r.loadError++,u===ce.BUFFER_APPEND_ERROR&&r.fragmentError++;let d=-1;const{levels:f,loadLevel:g,minAutoLevel:v,maxAutoLevel:y}=s;s.autoLevelEnabled||(s.loadLevel=-1);const E=(n=e.frag)==null?void 0:n.type,w=(E===He.AUDIO&&u===ce.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===ce.BUFFER_ADD_CODEC_ERROR||u===ce.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:te})=>r.audioCodec!==te),k=e.sourceBufferName==="video"&&(u===ce.BUFFER_ADD_CODEC_ERROR||u===ce.BUFFER_APPEND_ERROR)&&f.some(({codecSet:te,audioCodec:j})=>r.codecSet!==te&&r.audioCodec===j),{type:U,groupId:N}=(a=e.context)!=null?a:{};for(let te=f.length;te--;){const j=(te+g)%f.length;if(j!==g&&j>=v&&j<=y&&f[j].loadError===0){var o,l;const re=f[j];if(u===ce.FRAG_GAP&&e.frag){const Q=f[j].details;if(Q){const le=za(e.frag,Q.fragments,e.frag.start);if(le!=null&&le.gap)continue}}else{if(U===it.AUDIO_TRACK&&re.hasAudioGroup(N)||U===it.SUBTITLE_TRACK&&re.hasSubtitleGroup(N))continue;if(E===He.AUDIO&&(o=r.audioGroups)!=null&&o.some(Q=>re.hasAudioGroup(Q))||E===He.SUBTITLE&&(l=r.subtitleGroups)!=null&&l.some(Q=>re.hasSubtitleGroup(Q))||w&&r.audioCodec===re.audioCodec||!w&&r.audioCodec!==re.audioCodec||k&&r.codecSet===re.codecSet)continue}d=j;break}}if(d>-1&&s.loadLevel!==d)return e.levelRetry=!0,this.playlistError=0,{action:Ht.SendAlternateToPenaltyBox,flags:_s.None,nextAutoLevel:d}}return{action:Ht.SendAlternateToPenaltyBox,flags:_s.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case Ht.DoNothing:break;case Ht.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==ce.FRAG_GAP?t.fatal=!0:/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());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:r,hdcpLevel:n,nextAutoLevel:a}=s;switch(r){case _s.None:this.switchLevel(e,a);break;case _s.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=_l[_l.indexOf(n)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}s.resolved||this.switchLevel(e,a)}switchLevel(e,t){t!==void 0&&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)}}class bc{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=ie.log.bind(ie,`${t}:`),this.warn=ie.warn.bind(ie,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const r=t==null?void 0:t.renditionReports;if(r){let n=-1;for(let a=0;a<r.length;a++){const o=r[a];let l;try{l=new self.URL(o.URI,t.url).href}catch(u){ie.warn(`Could not construct new URL for Rendition Report: ${u}`),l=o.URI||""}if(l===e){n=a;break}else l===e.substring(0,l.length)&&(n=a)}if(n!==-1){const a=r[n],o=parseInt(a["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=parseInt(a["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const d=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&d>t.partTarget&&(l+=1)}const u=s&&ed(s);return new td(o,l>=0?l:void 0,u)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,s){const{details:r,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;if(r.advancedDateTime=Date.now()-o,r.live||s!=null&&s.live){if(r.reloaded(s),s&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),s&&r.fragments.length>0&&tw(s,r),!this.canLoad||!r.live)return;let l,u,d;if(r.canBlockReload&&r.endSN&&r.advanced){const b=this.hls.config.lowLatencyMode,w=r.lastPartSn,F=r.endSN,k=r.lastPartIndex,U=k!==-1,N=w===F,te=b?0:k;U?(u=N?F+1:w,d=N?te:k+1):u=F+1;const j=r.age,re=j+r.ageHeader;let Q=Math.min(re-r.partTarget,r.targetduration*1.5);if(Q>0){if(s&&Q>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${Q} with playlist age: ${r.age}`),Q=0;else{const le=Math.floor(Q/r.targetduration);if(u+=le,d!==void 0){const se=Math.round(Q%r.targetduration/r.partTarget);d+=se}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${j.toFixed(2)}s goal: ${Q} skip sn ${le} to part ${d}`)}r.tuneInGoal=Q}if(l=this.getDeliveryDirectives(r,t.deliveryDirectives,u,d),b||!N){this.loadPlaylist(l);return}}else(r.canBlockReload||r.canSkipUntil)&&(l=this.getDeliveryDirectives(r,t.deliveryDirectives,u,d));const f=this.hls.mainForwardBufferInfo,g=f?f.end-f.len:0,v=(r.edge-g)*1e3,y=nw(r,v);r.updated&&a>this.requestScheduled+y&&(this.requestScheduled=n.loading.start),u!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+y-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+y<a?this.requestScheduled=a:this.requestScheduled-a<=0&&(this.requestScheduled+=y);let E=this.requestScheduled-a;E=Math.max(0,E),this.log(`reload live playlist ${e} in ${Math.round(E)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),E)}else this.clearTimer()}getDeliveryDirectives(e,t,s,r){let n=ed(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,r=t.part,n=Ea.No),new td(s,r,n)}checkRetry(e){const t=e.details,s=ja(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=r||{},l=!!r&&!!o&&(n===Ht.RetryRequest||!r.resolved&&n===Ht.SendAlternateToPenaltyBox);if(l){var u;if(this.requestScheduled=-1,a>=o.maxNumRetry)return!1;if(s&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const d=Ec(o,a);this.timer=self.setTimeout(()=>this.loadPlaylist(),d),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${d}ms`)}e.levelRetry=!0,r.resolved=!0}return l}}class Cr{constructor(e,t=0,s=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_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*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 dw{constructor(e,t,s,r=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_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Cr(e),this.fast_=new Cr(t),this.defaultTTFB_=r,this.ttfb_=new Cr(e)}update(e,t){const{slow_:s,fast_:r,ttfb_:n}=this;s.halfLife!==e&&(this.slow_=new Cr(e,s.getEstimate(),s.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Cr(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Cr(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,r=e/1e3,n=s/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,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_}destroy(){}}const tg={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},ad={};function fw(i,e,t,s,r,n){const a=i.audioCodec?i.audioGroups:null,o=n==null?void 0:n.audioCodec,l=n==null?void 0:n.channels,u=l?parseInt(l):o?1/0:2;let d=null;if(a!=null&&a.length)try{a.length===1&&a[0]?d=e.groups[a[0]].channels:d=a.reduce((f,g)=>{if(g){const v=e.groups[g];if(!v)throw new Error(`Audio track group ${g} not found`);Object.keys(v.channels).forEach(y=>{f[y]=(f[y]||0)+v.channels[y]})}return f},{2:0})}catch{return!0}return i.videoCodec!==void 0&&(i.width>1920&&i.height>1088||i.height>1920&&i.width>1088||i.frameRate>Math.max(s,30)||i.videoRange!=="SDR"&&i.videoRange!==t||i.bitrate>Math.max(r,8e6))||!!d&&_e(u)&&Object.keys(d).some(f=>parseInt(f)>u)}function pw(i,e,t){const s=i.videoCodec,r=i.audioCodec;if(!s||!r||!t)return Promise.resolve(tg);const n={width:i.width,height:i.height,bitrate:Math.ceil(Math.max(i.bitrate*.9,i.averageBitrate)),framerate:i.frameRate||30},a=i.videoRange;a!=="SDR"&&(n.transferFunction=a.toLowerCase());const o=s.split(",").map(l=>({type:"media-source",video:Nt(Nt({},n),{},{contentType:Pn(l,"video")})}));return r&&i.audioGroups&&i.audioGroups.forEach(l=>{var u;l&&((u=e.groups[l])==null||u.tracks.forEach(d=>{if(d.groupId===l){const f=d.channels||"",g=parseFloat(f);_e(g)&&g>2&&o.push.apply(o,r.split(",").map(v=>({type:"media-source",audio:{contentType:Pn(v,"audio"),channels:""+g}})))}}))}),Promise.all(o.map(l=>{const u=gw(l);return ad[u]||(ad[u]=t.decodingInfo(l))})).then(l=>({supported:!l.some(u=>!u.supported),configurations:o,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:o,decodingInfoResults:[],error:l}))}function gw(i){const{audio:e,video:t}=i,s=t||e;if(s){const r=s.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}function mw(){if(typeof matchMedia=="function"){const i=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(i.media!==e.media)return i.matches===!0}return!1}function vw(i,e){let t=!1,s=[];return i&&(t=i!=="SDR",s=[i]),e&&(s=e.allowedVideoRanges||Ha.slice(0),t=e.preferHDR!==void 0?e.preferHDR:mw(),t?s=s.filter(r=>r!=="SDR"):s=["SDR"]),{preferHDR:t,allowedVideoRanges:s}}function yw(i,e,t,s,r){const n=Object.keys(i),a=s==null?void 0:s.channels,o=s==null?void 0:s.audioCodec,l=a&&parseInt(a)===2;let u=!0,d=!1,f=1/0,g=1/0,v=1/0,y=0,E=[];const{preferHDR:b,allowedVideoRanges:w}=vw(e,r);for(let N=n.length;N--;){const te=i[n[N]];u=te.channels[2]>0,f=Math.min(f,te.minHeight),g=Math.min(g,te.minFramerate),v=Math.min(v,te.minBitrate);const j=w.filter(re=>te.videoRanges[re]>0);j.length>0&&(d=!0,E=j)}f=_e(f)?f:0,g=_e(g)?g:0;const F=Math.max(1080,f),k=Math.max(30,g);return v=_e(v)?v:t,t=Math.max(v,t),d||(e=void 0,E=[]),{codecSet:n.reduce((N,te)=>{const j=i[te];if(te===N)return N;if(j.minBitrate>t)return di(te,`min bitrate of ${j.minBitrate} > current estimate of ${t}`),N;if(!j.hasDefaultAudio)return di(te,"no renditions with default or auto-select sound found"),N;if(o&&te.indexOf(o.substring(0,4))%5!==0)return di(te,`audio codec preference "${o}" not found`),N;if(a&&!l){if(!j.channels[a])return di(te,`no renditions with ${a} channel sound found (channels options: ${Object.keys(j.channels)})`),N}else if((!o||l)&&u&&j.channels[2]===0)return di(te,"no renditions with stereo sound found"),N;return j.minHeight>F?(di(te,`min resolution of ${j.minHeight} > maximum of ${F}`),N):j.minFramerate>k?(di(te,`min framerate of ${j.minFramerate} > maximum of ${k}`),N):E.some(re=>j.videoRanges[re]>0)?j.maxScore<y?(di(te,`max score of ${j.maxScore} < selected max of ${y}`),N):N&&(Ga(te)>=Ga(N)||j.fragmentError>i[N].fragmentError)?N:(y=j.maxScore,te):(di(te,`no variants with VIDEO-RANGE of ${JSON.stringify(E)} found`),N)},void 0),videoRanges:E,preferHDR:b,minFramerate:g,minBitrate:v}}function di(i,e){ie.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function xw(i){return i.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const r=t.channels||"2";return s.channels[r]=(s.channels[r]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Sw(i,e,t,s){return i.slice(t,s+1).reduce((r,n)=>{if(!n.codecSet)return r;const a=n.audioGroups;let o=r[n.codecSet];o||(r[n.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,n.bitrate);const l=Math.min(n.height,n.width);return o.minHeight=Math.min(o.minHeight,l),o.minFramerate=Math.min(o.minFramerate,n.frameRate),o.maxScore=Math.max(o.maxScore,n.score),o.fragmentError+=n.fragmentError,o.videoRanges[n.videoRange]=(o.videoRanges[n.videoRange]||0)+1,a&&a.forEach(u=>{if(!u)return;const d=e.groups[u];d&&(o.hasDefaultAudio=o.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(f=>{o.channels[f]=(o.channels[f]||0)+d.channels[f]}))}),r},{})}function Zs(i,e,t){if("attrs"in i){const s=e.indexOf(i);if(s!==-1)return s}for(let s=0;s<e.length;s++){const r=e[s];if(Fr(i,r,t))return s}return-1}function Fr(i,e,t){const{groupId:s,name:r,lang:n,assocLang:a,characteristics:o,default:l}=i,u=i.forced;return(s===void 0||e.groupId===s)&&(r===void 0||e.name===r)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===a)&&(l===void 0||e.default===l)&&(u===void 0||e.forced===u)&&(o===void 0||Ew(o,e.characteristics))&&(t===void 0||t(i,e))}function Ew(i,e=""){const t=i.split(","),s=e.split(",");return t.length===s.length&&!t.some(r=>s.indexOf(r)===-1)}function Rr(i,e){const{audioCodec:t,channels:s}=i;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function bw(i,e,t,s,r){const n=e[s],o=e.reduce((g,v,y)=>{const E=v.uri;return(g[E]||(g[E]=[])).push(y),g},{})[n.uri];o.length>1&&(s=Math.max.apply(Math,o));const l=n.videoRange,u=n.frameRate,d=n.codecSet.substring(0,4),f=od(e,s,g=>{if(g.videoRange!==l||g.frameRate!==u||g.codecSet.substring(0,4)!==d)return!1;const v=g.audioGroups,y=t.filter(E=>!v||v.indexOf(E.groupId)!==-1);return Zs(i,y,r)>-1});return f>-1?f:od(e,s,g=>{const v=g.audioGroups,y=t.filter(E=>!v||v.indexOf(E.groupId)!==-1);return Zs(i,y,r)>-1})}function od(i,e,t){for(let s=e;s;s--)if(t(i[s]))return s;for(let s=e+1;s<i.length;s++)if(t(i[s]))return s;return-1}class Tw{constructor(e){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.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:s,hls:r}=this,{autoLevelEnabled:n,media:a}=r;if(!t||!a)return;const o=performance.now(),l=s?s.stats:t.stats,u=s?s.duration:t.duration,d=o-l.loading.start,f=r.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||a.paused||!a.playbackRate||!a.readyState)return;const g=r.mainForwardBufferInfo;if(g===null)return;const v=this.bwEstimator.getEstimateTTFB(),y=Math.abs(a.playbackRate);if(d<=Math.max(v,1e3*(u/(y*2))))return;const E=g.len/y,b=l.loading.first?l.loading.first-l.loading.start:-1,w=l.loaded&&b>-1,F=this.getBwEstimate(),k=r.levels,U=k[t.level],N=l.total||Math.max(l.loaded,Math.round(u*U.averageBitrate/8));let te=w?d-b:d;te<1&&w&&(te=Math.min(d,l.loaded*8/F));const j=w?l.loaded*1e3/te:0,re=j?(N-l.loaded)/j:N*8/F+v/1e3;if(re<=E)return;const Q=j?j*8:F;let le=Number.POSITIVE_INFINITY,se;for(se=t.level-1;se>f;se--){const de=k[se].maxBitrate;if(le=this.getTimeToLoadFrag(v/1e3,Q,u*de,!k[se].details),le<E)break}if(le>=re||le>u*10)return;r.nextLoadLevel=r.nextAutoLevel=se,w?this.bwEstimator.sample(d-Math.min(v,b),l.loaded):this.bwEstimator.sampleTTFB(d);const pe=k[se].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>pe&&this.resetEstimator(pe),this.clearTimer(),ie.warn(`[abr] Fragment ${t.sn}${s?" part "+s.index:""} of level ${t.level} is loading too slowly;
|
|
52
|
+
당첨자 발표를 기대해주세요!`}}}};Kt.use(Rp).init({resources:dE,detection:{order:["navigator","localStorage"]},fallbackLng:"ko",debug:!1,interpolation:{escapeValue:!1}});const fE="_root_1u2x2_1",pE="_primary_1u2x2_28",gE="_icon_1u2x2_45",Uo={root:fE,primary:pE,icon:gE};fe.forwardRef(({primary:i=!1,icon:e=!1,className:t,...s},r)=>Ne.jsx("button",{ref:r,className:(e?`${Uo.icon}`:`${Uo.root} ${i?Uo.primary:""}`)+` ${t||""}`,...s}));const mE="_root_40kkk_2",vE="_pip_40kkk_10",yE="_mute_40kkk_16",xE="_unmute_40kkk_22",SE="_share_40kkk_28",EE="_setting_40kkk_34",bE="_close_40kkk_40",TE="_wish_40kkk_46",wE="_coupon_40kkk_53",AE="_like_40kkk_59",LE="_notice_40kkk_65",CE="_chat_40kkk_71",RE="_comment_40kkk_77",_E="_product_40kkk_83",IE="_event_40kkk_89",kE="_alarm_on_40kkk_95",PE="_alarm_off_40kkk_101",DE="_purchase_40kkk_108",ME="_close_pane_40kkk_114",FE="_close_pane_B_40kkk_120",OE="_back_40kkk_126",NE="_backward_40kkk_133",BE="_pause_40kkk_139",$E="_play_40kkk_145",UE="_forward_40kkk_151",GE="_left_40kkk_158",VE="_right_40kkk_164",HE="_converting_40kkk_171",jE="_cancel_40kkk_177",KE="_sm_view_40kkk_184",zE="_sm_like_40kkk_190",WE="_sm_countdown_40kkk_196",qE="_sm_countdown_black_40kkk_202",YE="_sm_question_40kkk_208",XE="_sm_comment_40kkk_214",QE="_sm_more_40kkk_220",JE="_sm_fix_40kkk_226",ZE="_sm_bag_40kkk_232",eb="_wish_on_40kkk_238",tb="_wish_off_40kkk_244",sb="_chapter_shorts_40kkk_250",ib="_like_shorts_40kkk_256",rb="_comment_shorts_40kkk_262",nb="_share_shorts_40kkk_268",ab="_more_product_shorts_40kkk_274",ob="_close_drawer_shorts_40kkk_280",_h={root:mE,pip:vE,mute:yE,unmute:xE,share:SE,setting:EE,close:bE,wish:TE,coupon:wE,like:AE,notice:LE,chat:CE,comment:RE,product:_E,event:IE,alarm_on:kE,alarm_off:PE,purchase:DE,close_pane:ME,close_pane_B:FE,back:OE,backward:NE,pause:BE,play:$E,forward:UE,left:GE,right:VE,converting:HE,cancel:jE,sm_view:KE,sm_like:zE,sm_countdown:WE,sm_countdown_black:qE,sm_question:YE,sm_comment:XE,sm_more:QE,sm_fix:JE,sm_bag:ZE,wish_on:eb,wish_off:tb,chapter_shorts:sb,like_shorts:ib,comment_shorts:rb,share_shorts:nb,more_product_shorts:ab,close_drawer_shorts:ob};var _p={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ih=fe.createContext&&fe.createContext(_p),lb=["attr","size","title"];function cb(i,e){if(i==null)return{};var t=ub(i,e),s,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r<n.length;r++)s=n[r],!(e.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(i,s)&&(t[s]=i[s])}return t}function ub(i,e){if(i==null)return{};var t={};for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(e.indexOf(s)>=0)continue;t[s]=i[s]}return t}function Na(){return Na=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Na.apply(this,arguments)}function kh(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function Ba(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kh(Object(t),!0).forEach(function(s){hb(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):kh(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function hb(i,e,t){return e=db(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function db(i){var e=fb(i,"string");return typeof e=="symbol"?e:e+""}function fb(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Ip(i){return i&&i.map((e,t)=>fe.createElement(e.tag,Ba({key:t},e.attr),Ip(e.child)))}function xi(i){return e=>fe.createElement(pb,Na({attr:Ba({},i.attr)},e),Ip(i.child))}function pb(i){var e=t=>{var{attr:s,size:r,title:n}=i,a=cb(i,lb),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),fe.createElement("svg",Na({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,s,a,{className:l,style:Ba(Ba({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&fe.createElement("title",null,n),i.children)};return Ih!==void 0?fe.createElement(Ih.Consumer,null,t=>e(t)):e(_p)}function gb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"circle",attr:{cx:"256",cy:"256",r:"208",fill:"none",strokeMiterlimit:"10",strokeWidth:"32"},child:[]},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"m108.92 108.92 294.16 294.16"},child:[]}]})(i)}function mb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M328 112 184 256l144 144"},child:[]}]})(i)}function vb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368 144 144m224 0L144 368"},child:[]}]})(i)}function yb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"circle",attr:{cx:"256",cy:"256",r:"48"},child:[]},{tag:"circle",attr:{cx:"416",cy:"256",r:"48"},child:[]},{tag:"circle",attr:{cx:"96",cy:"256",r:"48"},child:[]}]})(i)}function xb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M133 440a35.37 35.37 0 0 1-17.5-4.67c-12-6.8-19.46-20-19.46-34.33V111c0-14.37 7.46-27.53 19.46-34.33a35.13 35.13 0 0 1 35.77.45l247.85 148.36a36 36 0 0 1 0 61l-247.89 148.4A35.5 35.5 0 0 1 133 440z"},child:[]}]})(i)}function Sb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M232 416a23.88 23.88 0 0 1-14.2-4.68 8.27 8.27 0 0 1-.66-.51L125.76 336H56a24 24 0 0 1-24-24V200a24 24 0 0 1 24-24h69.75l91.37-74.81a8.27 8.27 0 0 1 .66-.51A24 24 0 0 1 256 120v272a24 24 0 0 1-24 24zm-106.18-80zm-.27-159.86zM320 336a16 16 0 0 1-14.29-23.19c9.49-18.87 14.3-38 14.3-56.81 0-19.38-4.66-37.94-14.25-56.73a16 16 0 0 1 28.5-14.54C346.19 208.12 352 231.44 352 256c0 23.86-6 47.81-17.7 71.19A16 16 0 0 1 320 336z"},child:[]},{tag:"path",attr:{d:"M368 384a16 16 0 0 1-13.86-24C373.05 327.09 384 299.51 384 256c0-44.17-10.93-71.56-29.82-103.94a16 16 0 0 1 27.64-16.12C402.92 172.11 416 204.81 416 256c0 50.43-13.06 83.29-34.13 120a16 16 0 0 1-13.87 8z"},child:[]},{tag:"path",attr:{d:"M416 432a16 16 0 0 1-13.39-24.74C429.85 365.47 448 323.76 448 256c0-66.5-18.18-108.62-45.49-151.39a16 16 0 1 1 27-17.22C459.81 134.89 480 181.74 480 256c0 64.75-14.66 113.63-50.6 168.74A16 16 0 0 1 416 432z"},child:[]}]})(i)}function Eb(i){return xi({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M416 432 64 80"},child:[]},{tag:"path",attr:{d:"M243.33 98.86a23.89 23.89 0 0 0-25.55 1.82l-.66.51-28.52 23.35a8 8 0 0 0-.59 11.85l54.33 54.33a8 8 0 0 0 13.66-5.66v-64.49a24.51 24.51 0 0 0-12.67-21.71zm8 236.43L96.69 180.69A16 16 0 0 0 85.38 176H56a24 24 0 0 0-24 24v112a24 24 0 0 0 24 24h69.76l92 75.31a23.9 23.9 0 0 0 25.87 1.69A24.51 24.51 0 0 0 256 391.45v-44.86a16 16 0 0 0-4.67-11.3zM352 256c0-24.56-5.81-47.87-17.75-71.27a16 16 0 1 0-28.5 14.55C315.34 218.06 320 236.62 320 256q0 4-.31 8.13a8 8 0 0 0 2.32 6.25l14.36 14.36a8 8 0 0 0 13.55-4.31A146 146 0 0 0 352 256zm64 0c0-51.18-13.08-83.89-34.18-120.06a16 16 0 0 0-27.64 16.12C373.07 184.44 384 211.83 384 256c0 23.83-3.29 42.88-9.37 60.65a8 8 0 0 0 1.9 8.26L389 337.4a8 8 0 0 0 13.13-2.79C411 311.76 416 287.26 416 256z"},child:[]},{tag:"path",attr:{d:"M480 256c0-74.25-20.19-121.11-50.51-168.61a16 16 0 1 0-27 17.22C429.82 147.38 448 189.5 448 256c0 46.19-8.43 80.27-22.43 110.53a8 8 0 0 0 1.59 9l11.92 11.92a8 8 0 0 0 12.92-2.16C471.6 344.9 480 305 480 256z"},child:[]}]})(i)}function bb(i){return xi({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"m13.498.795.149-.149a1.207 1.207 0 1 1 1.707 1.708l-.149.148a1.5 1.5 0 0 1-.059 2.059L4.854 14.854a.5.5 0 0 1-.233.131l-4 1a.5.5 0 0 1-.606-.606l1-4a.5.5 0 0 1 .131-.232l9.642-9.642a.5.5 0 0 0-.642.056L6.854 4.854a.5.5 0 1 1-.708-.708L9.44.854A1.5 1.5 0 0 1 11.5.796a1.5 1.5 0 0 1 1.998-.001m-.644.766a.5.5 0 0 0-.707 0L1.95 11.756l-.764 3.057 3.057-.764L14.44 3.854a.5.5 0 0 0 0-.708z"},child:[]}]})(i)}function Tb(i){return xi({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576zm6.787-8.201L1.591 6.602l4.339 2.76z"},child:[]}]})(i)}const Ph={IoVolumeHigh:Sb,IoVolumeMute:Eb,IoPlay:xb,IoCloseOutline:vb,IoChevronBack:mb,IoEllipsisHorizontal:yb,IoBanOutline:gb,BsSend:Tb,BsPen:bb};function Go({className:i,name:e,...t}){if(e in Ph){const s=Ph[e];return Ne.jsx(s,{className:i})}else return Ne.jsx("i",{className:[_h.root,_h[e],i].join(" "),...t})}const wb="_root_3o9nv_1",Ab="_video_3o9nv_9",Lb="_poster_3o9nv_17",Cb="_origin_ratio_3o9nv_26",Rb="_layer_3o9nv_33",_b="_shadow_3o9nv_39",Ib="_forward_animation_3o9nv_61",kb="_forward_3o9nv_61",Pb="_backward_animation_3o9nv_65",Db="_backward_3o9nv_65",Mb="_indicator_3o9nv_69",Fb="_indicator_right_3o9nv_76",Ob="_indicator_left_3o9nv_81",Nb="_progress_3o9nv_87",Bb="_time_3o9nv_95",$b="_button_3o9nv_108",Ub="_playbackrate_3o9nv_129",Gb="_play_toggle_3o9nv_140",Vb="_chapter_toggle_3o9nv_147",Hb="_chapter_wrap_3o9nv_156",bt={root:wb,video:Ab,poster:Lb,origin_ratio:Cb,layer:Rb,shadow:_b,forward_animation:Ib,forward:kb,backward_animation:Pb,backward:Db,indicator:Mb,indicator_right:Fb,indicator_left:Ob,progress:Nb,time:Bb,button:$b,playbackrate:Ub,play_toggle:Gb,chapter_toggle:Vb,chapter_wrap:Hb};function jb(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var kp={exports:{}};(function(i,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,u,d){if(d=d||{},l=l.trim(),u=u.trim(),!u){if(!d.alwaysNormalize)return l;var f=o.parseURL(l);if(!f)throw new Error("Error trying to parse base URL.");return f.path=o.normalizePath(f.path),o.buildURLFromParts(f)}var g=o.parseURL(u);if(!g)throw new Error("Error trying to parse relative URL.");if(g.scheme)return d.alwaysNormalize?(g.path=o.normalizePath(g.path),o.buildURLFromParts(g)):u;var v=o.parseURL(l);if(!v)throw new Error("Error trying to parse base URL.");if(!v.netLoc&&v.path&&v.path[0]!=="/"){var y=r.exec(v.path);v.netLoc=y[1],v.path=y[2]}v.netLoc&&!v.path&&(v.path="/");var E={scheme:v.scheme,netLoc:g.netLoc,path:null,params:g.params,query:g.query,fragment:g.fragment};if(!g.netLoc&&(E.netLoc=v.netLoc,g.path[0]!=="/"))if(!g.path)E.path=v.path,g.params||(E.params=v.params,g.query||(E.query=v.query));else{var b=v.path,w=b.substring(0,b.lastIndexOf("/")+1)+g.path;E.path=o.normalizePath(w)}return E.path===null&&(E.path=d.alwaysNormalize?o.normalizePath(g.path):g.path),o.buildURLFromParts(E)},parseURL:function(l){var u=s.exec(l);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(n,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};i.exports=o})()})(kp);var vc=kp.exports;function Dh(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function Nt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dh(Object(t),!0).forEach(function(s){Wb(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Dh(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function Kb(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function zb(i){var e=Kb(i,"string");return typeof e=="symbol"?e:String(e)}function Wb(i,e,t){return e=zb(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ct(){return Ct=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Ct.apply(this,arguments)}const _e=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)},qb=Number.isSafeInteger||function(i){return typeof i=="number"&&Math.abs(i)<=Yb},Yb=Number.MAX_SAFE_INTEGER||9007199254740991;let C=function(i){return i.MEDIA_ATTACHING="hlsMediaAttaching",i.MEDIA_ATTACHED="hlsMediaAttached",i.MEDIA_DETACHING="hlsMediaDetaching",i.MEDIA_DETACHED="hlsMediaDetached",i.BUFFER_RESET="hlsBufferReset",i.BUFFER_CODECS="hlsBufferCodecs",i.BUFFER_CREATED="hlsBufferCreated",i.BUFFER_APPENDING="hlsBufferAppending",i.BUFFER_APPENDED="hlsBufferAppended",i.BUFFER_EOS="hlsBufferEos",i.BUFFER_FLUSHING="hlsBufferFlushing",i.BUFFER_FLUSHED="hlsBufferFlushed",i.MANIFEST_LOADING="hlsManifestLoading",i.MANIFEST_LOADED="hlsManifestLoaded",i.MANIFEST_PARSED="hlsManifestParsed",i.LEVEL_SWITCHING="hlsLevelSwitching",i.LEVEL_SWITCHED="hlsLevelSwitched",i.LEVEL_LOADING="hlsLevelLoading",i.LEVEL_LOADED="hlsLevelLoaded",i.LEVEL_UPDATED="hlsLevelUpdated",i.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",i.LEVELS_UPDATED="hlsLevelsUpdated",i.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",i.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",i.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",i.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",i.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",i.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",i.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",i.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",i.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",i.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",i.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",i.CUES_PARSED="hlsCuesParsed",i.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",i.INIT_PTS_FOUND="hlsInitPtsFound",i.FRAG_LOADING="hlsFragLoading",i.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",i.FRAG_LOADED="hlsFragLoaded",i.FRAG_DECRYPTED="hlsFragDecrypted",i.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",i.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",i.FRAG_PARSING_METADATA="hlsFragParsingMetadata",i.FRAG_PARSED="hlsFragParsed",i.FRAG_BUFFERED="hlsFragBuffered",i.FRAG_CHANGED="hlsFragChanged",i.FPS_DROP="hlsFpsDrop",i.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",i.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",i.ERROR="hlsError",i.DESTROYING="hlsDestroying",i.KEY_LOADING="hlsKeyLoading",i.KEY_LOADED="hlsKeyLoaded",i.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",i.BACK_BUFFER_REACHED="hlsBackBufferReached",i.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",i}({}),je=function(i){return i.NETWORK_ERROR="networkError",i.MEDIA_ERROR="mediaError",i.KEY_SYSTEM_ERROR="keySystemError",i.MUX_ERROR="muxError",i.OTHER_ERROR="otherError",i}({}),ce=function(i){return i.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",i.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",i.KEY_SYSTEM_NO_SESSION="keySystemNoSession",i.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",i.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",i.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",i.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",i.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",i.MANIFEST_LOAD_ERROR="manifestLoadError",i.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",i.MANIFEST_PARSING_ERROR="manifestParsingError",i.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",i.LEVEL_EMPTY_ERROR="levelEmptyError",i.LEVEL_LOAD_ERROR="levelLoadError",i.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",i.LEVEL_PARSING_ERROR="levelParsingError",i.LEVEL_SWITCH_ERROR="levelSwitchError",i.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",i.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",i.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",i.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",i.FRAG_LOAD_ERROR="fragLoadError",i.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",i.FRAG_DECRYPT_ERROR="fragDecryptError",i.FRAG_PARSING_ERROR="fragParsingError",i.FRAG_GAP="fragGap",i.REMUX_ALLOC_ERROR="remuxAllocError",i.KEY_LOAD_ERROR="keyLoadError",i.KEY_LOAD_TIMEOUT="keyLoadTimeOut",i.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",i.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",i.BUFFER_APPEND_ERROR="bufferAppendError",i.BUFFER_APPENDING_ERROR="bufferAppendingError",i.BUFFER_STALLED_ERROR="bufferStalledError",i.BUFFER_FULL_ERROR="bufferFullError",i.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",i.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",i.INTERNAL_EXCEPTION="internalException",i.INTERNAL_ABORTED="aborted",i.UNKNOWN="unknown",i}({});const Qi=function(){},wl={trace:Qi,debug:Qi,log:Qi,warn:Qi,info:Qi,error:Qi};let xn=wl;function Xb(i){const e=self.console[i];return e?e.bind(self.console,`[${i}] >`):Qi}function Qb(i,...e){e.forEach(function(t){xn[t]=i[t]?i[t].bind(i):Xb(t)})}function Jb(i,e){if(typeof console=="object"&&i===!0||typeof i=="object"){Qb(i,"debug","log","info","warn","error");try{xn.log(`Debug logs enabled for "${e}" in hls.js version 1.5.8`)}catch{xn=wl}}else xn=wl}const ie=xn,Zb=/^(\d+)x(\d+)$/,Mh=/(.+?)=(".*?"|.*?)(?:,|$)/g;class St{constructor(e){typeof e=="string"&&(e=St.parseAttrList(e)),Ct(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}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=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)s[r]=parseInt(t.slice(r*2,r*2+2),16);return s}else 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 s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Zb.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const s={},r='"';for(Mh.lastIndex=0;(t=Mh.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const a=t[1].trim();s[a]=n}return s}}function eT(i){return i!=="ID"&&i!=="CLASS"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function tT(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"}class Pp{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){ie.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=Ct(new St({}),s,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=new Date(this.attr["END-DATE"]);_e(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(_e(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 isValid(){return!!this.id&&!this._badValueForSameId&&_e(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class io{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 ht={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Dp{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[ht.AUDIO]:null,[ht.VIDEO]:null,[ht.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const s=e.split("@",2);let r;s.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(s[1]),this._byteRange=[r,parseInt(s[0])+r]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=vc.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Vo extends Dp{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=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.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new io,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 decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const s=Object.keys(this.levelkeys);if(s.length===1)return this._decryptdata=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!_e(this.programDateTime))return null;const e=_e(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),s=t.length;if(s>1||s===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,r,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:s,startDTS:r,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[ht.AUDIO]=null,e[ht.VIDEO]=null,e[ht.AUDIOVIDEO]=null}}class sT extends Dp{constructor(e,t,s,r,n){super(s),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.stats=new io,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=r;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,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)}}const iT=10;class rT{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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 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.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?_e(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||iT}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function yc(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function nT(i){const e=Al(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function aT(i){const e=function(s,r,n){const a=s[r];s[r]=s[n],s[n]=a};e(i,0,3),e(i,1,2),e(i,4,5),e(i,6,7)}function oT(i){const e=i.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),r=s[s.length-1].split(",");if(r.length===2){const n=r[0]==="base64",a=r[1];n?(s.splice(-1,1),t=yc(a)):t=nT(a)}}return t}function Al(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}const Br=typeof self<"u"?self:void 0;var yt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},rs={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Fh(i){switch(i){case rs.FAIRPLAY:return yt.FAIRPLAY;case rs.PLAYREADY:return yt.PLAYREADY;case rs.WIDEVINE:return yt.WIDEVINE;case rs.CLEARKEY:return yt.CLEARKEY}}var Mp={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function lT(i){if(i===Mp.WIDEVINE)return yt.WIDEVINE}function Oh(i){switch(i){case yt.FAIRPLAY:return rs.FAIRPLAY;case yt.PLAYREADY:return rs.PLAYREADY;case yt.WIDEVINE:return rs.WIDEVINE;case yt.CLEARKEY:return rs.CLEARKEY}}function Ho(i){const{drmSystems:e,widevineLicenseUrl:t}=i,s=e?[yt.FAIRPLAY,yt.WIDEVINE,yt.PLAYREADY,yt.CLEARKEY].filter(r=>!!e[r]):[];return!s[yt.WIDEVINE]&&t&&s.push(yt.WIDEVINE),s}const Fp=function(i){return Br!=null&&(i=Br.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function cT(i,e,t,s){let r;switch(i){case yt.FAIRPLAY:r=["cenc","sinf"];break;case yt.WIDEVINE:case yt.PLAYREADY:r=["cenc"];break;case yt.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return uT(r,e,t,s)}function uT(i,e,t,s){return[{initDataTypes:i,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function ir(i,e,t){return Uint8Array.prototype.slice?i.slice(e,t):new Uint8Array(Array.prototype.slice.call(i,e,t))}const xc=(i,e)=>e+10<=i.length&&i[e]===73&&i[e+1]===68&&i[e+2]===51&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128,Op=(i,e)=>e+10<=i.length&&i[e]===51&&i[e+1]===68&&i[e+2]===73&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128,In=(i,e)=>{const t=e;let s=0;for(;xc(i,e);){s+=10;const r=ro(i,e+6);s+=r,Op(i,e+10)&&(s+=10),e+=s}if(s>0)return i.subarray(t,t+s)},ro=(i,e)=>{let t=0;return t=(i[e]&127)<<21,t|=(i[e+1]&127)<<14,t|=(i[e+2]&127)<<7,t|=i[e+3]&127,t},hT=(i,e)=>xc(i,e)&&ro(i,e+6)+10<=i.length-e,Sc=i=>{const e=Bp(i);for(let t=0;t<e.length;t++){const s=e[t];if(Np(s))return vT(s)}},Np=i=>i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp",dT=i=>{const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=ro(i,4),s=10;return{type:e,size:t,data:i.subarray(s,s+t)}},Bp=i=>{let e=0;const t=[];for(;xc(i,e);){const s=ro(i,e+6);e+=10;const r=e+s;for(;e+8<r;){const n=dT(i.subarray(e)),a=fT(n);a&&t.push(a),e+=n.size+10}Op(i,e)&&(e+=10)}return t},fT=i=>i.type==="PRIV"?pT(i):i.type[0]==="W"?mT(i):gT(i),pT=i=>{if(i.size<2)return;const e=ei(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}},gT=i=>{if(i.size<2)return;if(i.type==="TXXX"){let t=1;const s=ei(i.data.subarray(t),!0);t+=s.length+1;const r=ei(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=ei(i.data.subarray(1));return{key:i.type,data:e}},mT=i=>{if(i.type==="WXXX"){if(i.size<2)return;let t=1;const s=ei(i.data.subarray(t),!0);t+=s.length+1;const r=ei(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=ei(i.data);return{key:i.type,data:e}},vT=i=>{if(i.data.byteLength===8){const e=new Uint8Array(i.data),t=e[3]&1;let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,t&&(s+=4772185884e-2),Math.round(s)}},ei=(i,e=!1)=>{const t=yT();if(t){const u=t.decode(i);if(e){const d=u.indexOf("\0");return d!==-1?u.substring(0,d):u}return u.replace(/\0/g,"")}const s=i.length;let r,n,a,o="",l=0;for(;l<s;){if(r=i[l++],r===0&&e)return o;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:n=i[l++],o+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=i[l++],a=i[l++],o+=String.fromCharCode((r&15)<<12|(n&63)<<6|(a&63)<<0);break}}return o};let jo;function yT(){if(!navigator.userAgent.includes("PlayStation 4"))return!jo&&typeof self.TextDecoder<"u"&&(jo=new self.TextDecoder("utf-8")),jo}const js={hexDump:function(i){let e="";for(let t=0;t<i.length;t++){let s=i[t].toString(16);s.length<2&&(s="0"+s),e+=s}return e}},$a=Math.pow(2,32)-1,xT=[].push,$p={video:1,audio:2,id3:3,text:4};function kt(i){return String.fromCharCode.apply(null,i)}function Up(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function Ge(i,e){const t=Gp(i,e);return t<0?4294967296+t:t}function Nh(i,e){let t=Ge(i,e);return t*=Math.pow(2,32),t+=Ge(i,e+4),t}function Gp(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function Ko(i,e,t){i[e]=t>>24,i[e+1]=t>>16&255,i[e+2]=t>>8&255,i[e+3]=t&255}function ST(i){const e=i.byteLength;for(let t=0;t<e;){const s=Ge(i,t);if(s>8&&i[t+4]===109&&i[t+5]===111&&i[t+6]===111&&i[t+7]===102)return!0;t=s>1?t+s:e}return!1}function Qe(i,e){const t=[];if(!e.length)return t;const s=i.byteLength;for(let r=0;r<s;){const n=Ge(i,r),a=kt(i.subarray(r+4,r+8)),o=n>1?r+n:s;if(a===e[0])if(e.length===1)t.push(i.subarray(r+8,o));else{const l=Qe(i.subarray(r+8,o),e.slice(1));l.length&&xT.apply(t,l)}r=o}return t}function ET(i){const e=[],t=i[0];let s=8;const r=Ge(i,s);s+=4;let n=0,a=0;t===0?(n=Ge(i,s),a=Ge(i,s+4),s+=8):(n=Nh(i,s),a=Nh(i,s+8),s+=16),s+=2;let o=i.length+a;const l=Up(i,s);s+=2;for(let u=0;u<l;u++){let d=s;const f=Ge(i,d);d+=4;const g=f&2147483647;if((f&2147483648)>>>31===1)return ie.warn("SIDX has hierarchical references (not supported)"),null;const y=Ge(i,d);d+=4,e.push({referenceSize:g,subsegmentDuration:y,info:{duration:y/r,start:o,end:o+g-1}}),o+=g,d+=4,s=d}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:l,references:e}}function Vp(i){const e=[],t=Qe(i,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],a=Qe(n,["tkhd"])[0];if(a){let o=a[0];const l=Ge(a,o===0?12:20),u=Qe(n,["mdia","mdhd"])[0];if(u){o=u[0];const d=Ge(u,o===0?12:20),f=Qe(n,["mdia","hdlr"])[0];if(f){const g=kt(f.subarray(8,12)),v={soun:ht.AUDIO,vide:ht.VIDEO}[g];if(v){const y=Qe(n,["mdia","minf","stbl","stsd"])[0],E=bT(y);e[l]={timescale:d,type:v},e[v]=Nt({timescale:d,id:l},E)}}}}}return Qe(i,["moov","mvex","trex"]).forEach(r=>{const n=Ge(r,4),a=e[n];a&&(a.default={duration:Ge(r,12),flags:Ge(r,20)})}),e}function bT(i){const e=i.subarray(8),t=e.subarray(86),s=kt(e.subarray(4,8));let r=s;const n=s==="enca"||s==="encv";if(n){const o=Qe(e,[s])[0].subarray(s==="enca"?28:78);Qe(o,["sinf"]).forEach(u=>{const d=Qe(u,["schm"])[0];if(d){const f=kt(d.subarray(4,8));if(f==="cbcs"||f==="cenc"){const g=Qe(u,["frma"])[0];g&&(r=kt(g))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const a=Qe(t,["avcC"])[0];r+="."+ra(a[1])+ra(a[2])+ra(a[3]);break}case"mp4a":{const a=Qe(e,[s])[0],o=Qe(a.subarray(28),["esds"])[0];if(o&&o.length>12){let l=4;if(o[l++]!==3)break;l=zo(o,l),l+=2;const u=o[l++];if(u&128&&(l+=2),u&64&&(l+=o[l++]),o[l++]!==4)break;l=zo(o,l);const d=o[l++];if(d===64)r+="."+ra(d);else break;if(l+=12,o[l++]!==5)break;l=zo(o,l);const f=o[l++];let g=(f&248)>>3;g===31&&(g+=1+((f&7)<<3)+((o[l]&224)>>5)),r+="."+g}break}case"hvc1":case"hev1":{const a=Qe(t,["hvcC"])[0],o=a[1],l=["","A","B","C"][o>>6],u=o&31,d=Ge(a,2),f=(o&32)>>5?"H":"L",g=a[12],v=a.subarray(6,12);r+="."+l+u,r+="."+d.toString(16).toUpperCase(),r+="."+f+g;let y="";for(let E=v.length;E--;){const b=v[E];(b||y)&&(y="."+b.toString(16).toUpperCase()+y)}r+=y;break}case"dvh1":case"dvhe":{const a=Qe(t,["dvcC"])[0],o=a[2]>>1&127,l=a[2]<<5&32|a[3]>>3&31;r+="."+Vs(o)+"."+Vs(l);break}case"vp09":{const a=Qe(t,["vpcC"])[0],o=a[4],l=a[5],u=a[6]>>4&15;r+="."+Vs(o)+"."+Vs(l)+"."+Vs(u);break}case"av01":{const a=Qe(t,["av1C"])[0],o=a[1]>>>5,l=a[1]&31,u=a[2]>>>7?"H":"M",d=(a[2]&64)>>6,f=(a[2]&32)>>5,g=o===2&&d?f?12:10:d?10:8,v=(a[2]&16)>>4,y=(a[2]&8)>>3,E=(a[2]&4)>>2,b=a[2]&3;r+="."+o+"."+Vs(l)+u+"."+Vs(g)+"."+v+"."+y+E+b+"."+Vs(1)+"."+Vs(1)+"."+Vs(1)+"."+0;break}}return{codec:r,encrypted:n}}function zo(i,e){const t=e+5;for(;i[e++]&128&&e<t;);return e}function ra(i){return("0"+i.toString(16).toUpperCase()).slice(-2)}function Vs(i){return(i<10?"0":"")+i}function TT(i,e){if(!i||!e)return i;const t=e.keyId;return t&&e.isCommonEncryption&&Qe(i,["moov","trak"]).forEach(r=>{const a=Qe(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=Qe(a,["enca"]);const l=o.length>0;l||(o=Qe(a,["encv"])),o.forEach(u=>{const d=l?u.subarray(28):u.subarray(78);Qe(d,["sinf"]).forEach(g=>{const v=Hp(g);if(v){const y=v.subarray(8,24);y.some(E=>E!==0)||(ie.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${js.hexDump(y)} -> ${js.hexDump(t)}`),v.set(t,8))}})})}),i}function Hp(i){const e=Qe(i,["schm"])[0];if(e){const t=kt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Qe(i,["schi","tenc"])[0]}return ie.error("[eme] missing 'schm' box"),null}function wT(i,e){return Qe(e,["moof","traf"]).reduce((t,s)=>{const r=Qe(s,["tfdt"])[0],n=r[0],a=Qe(s,["tfhd"]).reduce((o,l)=>{const u=Ge(l,4),d=i[u];if(d){let f=Ge(r,4);if(n===1){if(f===$a)return ie.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;f*=$a+1,f+=Ge(r,8)}const g=d.timescale||9e4,v=f/g;if(_e(v)&&(o===null||v<o))return v}return o},null);return a!==null&&_e(a)&&(t===null||a<t)?a:t},null)}function AT(i,e){let t=0,s=0,r=0;const n=Qe(i,["moof","traf"]);for(let a=0;a<n.length;a++){const o=n[a],l=Qe(o,["tfhd"])[0],u=Ge(l,4),d=e[u];if(!d)continue;const f=d.default,g=Ge(l,0)|(f==null?void 0:f.flags);let v=f==null?void 0:f.duration;g&8&&(g&2?v=Ge(l,12):v=Ge(l,8));const y=d.timescale||9e4,E=Qe(o,["trun"]);for(let b=0;b<E.length;b++){if(t=LT(E[b]),!t&&v){const w=Ge(E[b],4);t=v*w}d.type===ht.VIDEO?s+=t/y:d.type===ht.AUDIO&&(r+=t/y)}}if(s===0&&r===0){let a=1/0,o=0,l=0;const u=Qe(i,["sidx"]);for(let d=0;d<u.length;d++){const f=ET(u[d]);if(f!=null&&f.references){a=Math.min(a,f.earliestPresentationTime/f.timescale);const g=f.references.reduce((v,y)=>v+y.info.duration||0,0);o=Math.max(o,g+f.earliestPresentationTime/f.timescale),l=o-a}}if(l&&_e(l))return l}return s||r}function LT(i){const e=Ge(i,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let s=0;const r=Ge(i,4);for(let n=0;n<r;n++){if(e&256){const a=Ge(i,t);s+=a,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return s}function CT(i,e,t){Qe(e,["moof","traf"]).forEach(s=>{Qe(s,["tfhd"]).forEach(r=>{const n=Ge(r,4),a=i[n];if(!a)return;const o=a.timescale||9e4;Qe(s,["tfdt"]).forEach(l=>{const u=l[0],d=t*o;if(d){let f=Ge(l,4);if(u===0)f-=d,f=Math.max(f,0),Ko(l,4,f);else{f*=Math.pow(2,32),f+=Ge(l,8),f-=d,f=Math.max(f,0);const g=Math.floor(f/($a+1)),v=Math.floor(f%($a+1));Ko(l,4,g),Ko(l,8,v)}}})})})}function RT(i){const e={valid:null,remainder:null},t=Qe(i,["moof"]);if(t.length<2)return e.remainder=i,e;const s=t[t.length-1];return e.valid=ir(i,0,s.byteOffset-8),e.remainder=ir(i,s.byteOffset-8),e}function bs(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function Bh(i,e){const t=[],s=e.samples,r=e.timescale,n=e.id;let a=!1;return Qe(s,["moof"]).map(l=>{const u=l.byteOffset-8;Qe(l,["traf"]).map(f=>{const g=Qe(f,["tfdt"]).map(v=>{const y=v[0];let E=Ge(v,4);return y===1&&(E*=Math.pow(2,32),E+=Ge(v,8)),E/r})[0];return g!==void 0&&(i=g),Qe(f,["tfhd"]).map(v=>{const y=Ge(v,4),E=Ge(v,0)&16777215,b=(E&1)!==0,w=(E&2)!==0,F=(E&8)!==0;let k=0;const U=(E&16)!==0;let N=0;const te=(E&32)!==0;let j=8;y===n&&(b&&(j+=8),w&&(j+=4),F&&(k=Ge(v,j),j+=4),U&&(N=Ge(v,j),j+=4),te&&(j+=4),e.type==="video"&&(a=_T(e.codec)),Qe(f,["trun"]).map(re=>{const Q=re[0],le=Ge(re,0)&16777215,se=(le&1)!==0;let pe=0;const de=(le&4)!==0,be=(le&256)!==0;let Le=0;const ue=(le&512)!==0;let he=0;const we=(le&1024)!==0,me=(le&2048)!==0;let ye=0;const Ve=Ge(re,4);let $e=8;se&&(pe=Ge(re,$e),$e+=4),de&&($e+=4);let Je=pe+u;for(let st=0;st<Ve;st++){if(be?(Le=Ge(re,$e),$e+=4):Le=k,ue?(he=Ge(re,$e),$e+=4):he=N,we&&($e+=4),me&&(Q===0?ye=Ge(re,$e):ye=Gp(re,$e),$e+=4),e.type===ht.VIDEO){let rt=0;for(;rt<he;){const Ze=Ge(s,Je);if(Je+=4,IT(a,s[Je])){const Xe=s.subarray(Je,Je+Ze);jp(Xe,a?2:1,i+ye/r,t)}Je+=Ze,rt+=Ze+4}}i+=Le/r}}))})})}),t}function _T(i){if(!i)return!1;const e=i.indexOf("."),t=e<0?i:i.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function IT(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function jp(i,e,t,s){const r=Kp(i);let n=0;n+=e;let a=0,o=0,l=0;for(;n<r.length;){a=0;do{if(n>=r.length)break;l=r[n++],a+=l}while(l===255);o=0;do{if(n>=r.length)break;l=r[n++],o+=l}while(l===255);const u=r.length-n;let d=n;if(o<u)n+=o;else if(o>u){ie.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(a===4){if(r[d++]===181){const g=Up(r,d);if(d+=2,g===49){const v=Ge(r,d);if(d+=4,v===1195456820){const y=r[d++];if(y===3){const E=r[d++],b=31&E,w=64&E,F=w?2+b*3:0,k=new Uint8Array(F);if(w){k[0]=E;for(let U=1;U<F;U++)k[U]=r[d++]}s.push({type:y,payloadType:a,pts:t,bytes:k})}}}}}else if(a===5&&o>16){const f=[];for(let y=0;y<16;y++){const E=r[d++].toString(16);f.push(E.length==1?"0"+E:E),(y===3||y===5||y===7||y===9)&&f.push("-")}const g=o-16,v=new Uint8Array(g);for(let y=0;y<g;y++)v[y]=r[d++];s.push({payloadType:a,pts:t,uuid:f.join(""),userData:ei(v),userDataBytes:v})}}}function Kp(i){const e=i.byteLength,t=[];let s=1;for(;s<e-2;)i[s]===0&&i[s+1]===0&&i[s+2]===3?(t.push(s+2),s+=2):s++;if(t.length===0)return i;const r=e-t.length,n=new Uint8Array(r);let a=0;for(s=0;s<r;a++,s++)a===t[0]&&(a++,t.shift()),n[s]=i[a];return n}function kT(i){const e=i[0];let t="",s="",r=0,n=0,a=0,o=0,l=0,u=0;if(e===0){for(;kt(i.subarray(u,u+1))!=="\0";)t+=kt(i.subarray(u,u+1)),u+=1;for(t+=kt(i.subarray(u,u+1)),u+=1;kt(i.subarray(u,u+1))!=="\0";)s+=kt(i.subarray(u,u+1)),u+=1;s+=kt(i.subarray(u,u+1)),u+=1,r=Ge(i,12),n=Ge(i,16),o=Ge(i,20),l=Ge(i,24),u=28}else if(e===1){u+=4,r=Ge(i,u),u+=4;const f=Ge(i,u);u+=4;const g=Ge(i,u);for(u+=4,a=2**32*f+g,qb(a)||(a=Number.MAX_SAFE_INTEGER,ie.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ge(i,u),u+=4,l=Ge(i,u),u+=4;kt(i.subarray(u,u+1))!=="\0";)t+=kt(i.subarray(u,u+1)),u+=1;for(t+=kt(i.subarray(u,u+1)),u+=1;kt(i.subarray(u,u+1))!=="\0";)s+=kt(i.subarray(u,u+1)),u+=1;s+=kt(i.subarray(u,u+1)),u+=1}const d=i.subarray(u,i.byteLength);return{schemeIdUri:t,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:l,payload:d}}function PT(i,...e){const t=e.length;let s=8,r=t;for(;r--;)s+=e[r].byteLength;const n=new Uint8Array(s);for(n[0]=s>>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=s&255,n.set(i,4),r=0,s=8;r<t;r++)n.set(e[r],s),s+=e[r].byteLength;return n}function DT(i,e,t){if(i.byteLength!==16)throw new RangeError("Invalid system id");let s,r;s=0,r=new Uint8Array;let n;s>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),PT([112,115,115,104],new Uint8Array([s,0,0,0]),i,n,r,a,t||new Uint8Array)}function MT(i){if(!(i instanceof ArrayBuffer)||i.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(i),s=t.getUint32(0);if(i.byteLength!==s&&s>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=js.hexDump(new Uint8Array(i,12,16));const n=t.getUint32(28);if(e.version===0){if(s-32<n)return null;e.data=new Uint8Array(i,32,n)}else if(e.version===1){e.kids=[];for(let a=0;a<n;a++)e.kids.push(new Uint8Array(i,32+a*16,16))}return e}let na={};class kn{static clearKeyUriToKeyIdMap(){na={}}constructor(e,t,s,r=[1],n=null){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=s,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case rs.FAIRPLAY:case rs.WIDEVINE:case rs.PLAYREADY:case rs.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&ie.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const s=FT(e);return new kn(this.method,this.uri,"identity",this.keyFormatVersions,s)}const t=oT(this.uri);if(t)switch(this.keyFormat){case rs.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case rs.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=DT(s,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),a=n.substring(n.indexOf("<"),n.length),u=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("KID")[0];if(u){const d=u.childNodes[0]?u.childNodes[0].nodeValue:u.getAttribute("VALUE");if(d){const f=yc(d).subarray(0,16);aT(f),this.keyId=f}}break}default:{let s=t.subarray(0,16);if(s.length!==16){const r=new Uint8Array(16);r.set(s,16-s.length),s=r}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=na[this.uri];if(!s){const r=Object.keys(na).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,r),na[this.uri]=s}this.keyId=s}return this}}function FT(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const zp=/\{\$([a-zA-Z0-9-_]+)\}/g;function $h(i){return zp.test(i)}function ss(i,e,t){if(i.variableList!==null||i.hasVariableRefs)for(let s=t.length;s--;){const r=t[s],n=e[r];n&&(e[r]=Ll(i,n))}}function Ll(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(zp,s=>{const r=s.substring(2,s.length-1),n=t==null?void 0:t[r];return n===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),s):n})}return e}function Uh(i,e,t){let s=i.variableList;s||(i.variableList=s={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(r))n=a.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(a){i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else r=e.NAME,n=e.VALUE;r in s?i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):s[r]=n||""}function OT(i,e,t){const s=e.IMPORT;if(t&&s in t){let r=i.variableList;r||(i.variableList=r={}),r[s]=t[s]}else i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function ar(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function NT(i){return typeof self<"u"&&i===self.ManagedMediaSource}const Ua={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,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 BT(i,e){const t=Ua[e];return!!t&&!!t[i.slice(0,4)]}function Wo(i,e,t=!0){return!i.split(",").some(s=>!Wp(s,e,t))}function Wp(i,e,t=!0){var s;const r=ar(t);return(s=r==null?void 0:r.isTypeSupported(Pn(i,e)))!=null?s:!1}function Pn(i,e){return`${e}/mp4;codecs="${i}"`}function Gh(i){if(i){const e=i.substring(0,4);return Ua.video[e]}return 2}function Ga(i){return i.split(",").reduce((e,t)=>{const s=Ua.video[t];return s?(s*2+e)/(e?3:2):(Ua.audio[t]+e)/(e?2:1)},0)}const qo={};function $T(i,e=!0){if(qo[i])return qo[i];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[i];for(let s=0;s<t.length;s++)if(Wp(t[s],"audio",e))return qo[i]=t[s],t[s];return i}const UT=/flac|opus/i;function Va(i,e=!0){return i.replace(UT,t=>$T(t.toLowerCase(),e))}function Vh(i,e){return i&&i!=="mp4a"?i:e&&e.split(",")[0]}function GT(i){const e=i.split(".");if(e.length>2){let t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4),t}return i}const Hh=/#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,jh=/#EXT-X-MEDIA:(.*)/g,VT=/^#EXT(?:INF|-X-TARGETDURATION):/m,Kh=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),HT=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(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 Js{static findGroup(e,t){for(let s=0;s<e.length;s++){const r=e[s];if(r.id===t)return r}}static resolve(e,t){return vc.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return VT.test(e)}static parseMasterPlaylist(e,t){const s=$h(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},n=[];Hh.lastIndex=0;let a;for(;(a=Hh.exec(e))!=null;)if(a[1]){var o;const u=new St(a[1]);ss(r,u,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const d=Ll(r,a[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Js.resolve(d,t)},g=u.decimalResolution("RESOLUTION");g&&(f.width=g.width,f.height=g.height),jT(u.CODECS,f),(o=f.unknownCodecs)!=null&&o.length||n.push(f),r.levels.push(f)}else if(a[3]){const u=a[3],d=a[4];switch(u){case"SESSION-DATA":{const f=new St(d);ss(r,f,["DATA-ID","LANGUAGE","VALUE","URI"]);const g=f["DATA-ID"];g&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[g]=f);break}case"SESSION-KEY":{const f=zh(d,t,r);f.encrypted&&f.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(f)):ie.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${d}"`);break}case"DEFINE":{{const f=new St(d);ss(r,f,["NAME","VALUE","QUERYPARAM"]),Uh(r,f,t)}break}case"CONTENT-STEERING":{const f=new St(d);ss(r,f,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:Js.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Wh(d);break}}}const l=n.length>0&&n.length<r.levels.length;return r.levels=l?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,s){let r;const n={},a=s.levels,o={AUDIO:a.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:a.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(jh.lastIndex=0;(r=jh.exec(e))!==null;){const u=new St(r[1]),d=u.TYPE;if(d){const f=o[d],g=n[d]||[];n[d]=g,ss(s,u,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const v=u.LANGUAGE,y=u["ASSOC-LANGUAGE"],E=u.CHANNELS,b=u.CHARACTERISTICS,w=u["INSTREAM-ID"],F={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||v||"",type:d,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:v,url:u.URI?Js.resolve(u.URI,t):""};if(y&&(F.assocLang=y),E&&(F.channels=E),b&&(F.characteristics=b),w&&(F.instreamId=w),f!=null&&f.length){const k=Js.findGroup(f,F.groupId)||f[0];qh(F,k,"audioCodec"),qh(F,k,"textCodec")}g.push(F)}}return n}static parseLevelPlaylist(e,t,s,r,n,a){const o=new rT(t),l=o.fragments;let u=null,d=0,f=0,g=0,v=0,y=null,E=new Vo(r,t),b,w,F,k=-1,U=!1,N=null;for(Kh.lastIndex=0,o.m3u8=e,o.hasVariableRefs=$h(e);(b=Kh.exec(e))!==null;){U&&(U=!1,E=new Vo(r,t),E.start=g,E.sn=d,E.cc=v,E.level=s,u&&(E.initSegment=u,E.rawProgramDateTime=u.rawProgramDateTime,u.rawProgramDateTime=null,N&&(E.setByteRange(N),N=null)));const Q=b[1];if(Q){E.duration=parseFloat(Q);const le=(" "+b[2]).slice(1);E.title=le||null,E.tagList.push(le?["INF",Q,le]:["INF",Q])}else if(b[3]){if(_e(E.duration)){E.start=g,F&&Qh(E,F,o),E.sn=d,E.level=s,E.cc=v,l.push(E);const le=(" "+b[3]).slice(1);E.relurl=Ll(o,le),Yh(E,y),y=E,g+=E.duration,d++,f=0,U=!0}}else if(b[4]){const le=(" "+b[4]).slice(1);y?E.setByteRange(le,y):E.setByteRange(le)}else if(b[5])E.rawProgramDateTime=(" "+b[5]).slice(1),E.tagList.push(["PROGRAM-DATE-TIME",E.rawProgramDateTime]),k===-1&&(k=l.length);else{if(b=b[0].match(HT),!b){ie.warn("No matches on slow regex match for level playlist!");continue}for(w=1;w<b.length&&!(typeof b[w]<"u");w++);const le=(" "+b[w]).slice(1),se=(" "+b[w+1]).slice(1),pe=b[w+2]?(" "+b[w+2]).slice(1):"";switch(le){case"PLAYLIST-TYPE":o.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":d=o.startSN=parseInt(se);break;case"SKIP":{const de=new St(se);ss(o,de,["RECENTLY-REMOVED-DATERANGES"]);const be=de.decimalInteger("SKIPPED-SEGMENTS");if(_e(be)){o.skippedSegments=be;for(let ue=be;ue--;)l.unshift(null);d+=be}const Le=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(o.recentlyRemovedDateranges=Le.split(" "));break}case"TARGETDURATION":o.targetduration=Math.max(parseInt(se),1);break;case"VERSION":o.version=parseInt(se);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":(se||pe)&&E.tagList.push(pe?[se,pe]:[se]);break;case"DISCONTINUITY":v++,E.tagList.push(["DIS"]);break;case"GAP":E.gap=!0,E.tagList.push([le]);break;case"BITRATE":E.tagList.push([le,se]);break;case"DATERANGE":{const de=new St(se);ss(o,de,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),ss(o,de,de.clientAttrs);const be=new Pp(de,o.dateRanges[de.ID]);be.isValid||o.skippedSegments?o.dateRanges[be.id]=be:ie.warn(`Ignoring invalid DATERANGE tag: "${se}"`),E.tagList.push(["EXT-X-DATERANGE",se]);break}case"DEFINE":{{const de=new St(se);ss(o,de,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in de?OT(o,de,a):Uh(o,de,t)}break}case"DISCONTINUITY-SEQUENCE":v=parseInt(se);break;case"KEY":{const de=zh(se,t,o);if(de.isSupported()){if(de.method==="NONE"){F=void 0;break}F||(F={}),F[de.keyFormat]&&(F=Ct({},F)),F[de.keyFormat]=de}else ie.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${se}"`);break}case"START":o.startTimeOffset=Wh(se);break;case"MAP":{const de=new St(se);if(ss(o,de,["BYTERANGE","URI"]),E.duration){const be=new Vo(r,t);Xh(be,de,s,F),u=be,E.initSegment=u,u.rawProgramDateTime&&!E.rawProgramDateTime&&(E.rawProgramDateTime=u.rawProgramDateTime)}else{const be=E.byteRangeEndOffset;if(be){const Le=E.byteRangeStartOffset;N=`${be-Le}@${Le}`}else N=null;Xh(E,de,s,F),u=E,U=!0}break}case"SERVER-CONTROL":{const de=new St(se);o.canBlockReload=de.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=de.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&de.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=de.optionalFloat("PART-HOLD-BACK",0),o.holdBack=de.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const de=new St(se);o.partTarget=de.decimalFloatingPoint("PART-TARGET");break}case"PART":{let de=o.partList;de||(de=o.partList=[]);const be=f>0?de[de.length-1]:void 0,Le=f++,ue=new St(se);ss(o,ue,["BYTERANGE","URI"]);const he=new sT(ue,E,t,Le,be);de.push(he),E.duration+=he.duration;break}case"PRELOAD-HINT":{const de=new St(se);ss(o,de,["URI"]),o.preloadHint=de;break}case"RENDITION-REPORT":{const de=new St(se);ss(o,de,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(de);break}default:ie.warn(`line parsed but not handled: ${b}`);break}}}y&&!y.relurl?(l.pop(),g-=y.duration,o.partList&&(o.fragmentHint=y)):o.partList&&(Yh(E,y),E.cc=v,o.fragmentHint=E,F&&Qh(E,F,o));const te=l.length,j=l[0],re=l[te-1];if(g+=o.skippedSegments*o.targetduration,g>0&&te&&re){o.averagetargetduration=g/te;const Q=re.sn;o.endSN=Q!=="initSegment"?Q:0,o.live||(re.endList=!0),j&&(o.startCC=j.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(g+=o.fragmentHint.duration),o.totalduration=g,o.endCC=v,k>0&&KT(l,k),o}}function zh(i,e,t){var s,r;const n=new St(i);ss(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=(s=n.METHOD)!=null?s:"",o=n.URI,l=n.hexadecimalInteger("IV"),u=n.KEYFORMATVERSIONS,d=(r=n.KEYFORMAT)!=null?r:"identity";o&&n.IV&&!l&&ie.error(`Invalid IV: ${n.IV}`);const f=o?Js.resolve(o,e):"",g=(u||"1").split("/").map(Number).filter(Number.isFinite);return new kn(a,f,d,g,l)}function Wh(i){const t=new St(i).decimalFloatingPoint("TIME-OFFSET");return _e(t)?t:null}function jT(i,e){let t=(i||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const r=t.filter(n=>BT(n,s));r.length&&(e[`${s}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function qh(i,e,t){const s=e[t];s&&(i[t]=s)}function KT(i,e){let t=i[e];for(let s=e;s--;){const r=i[s];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function Yh(i,e){i.rawProgramDateTime?i.programDateTime=Date.parse(i.rawProgramDateTime):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime),_e(i.programDateTime)||(i.programDateTime=null,i.rawProgramDateTime=null)}function Xh(i,e,t,s){i.relurl=e.URI,e.BYTERANGE&&i.setByteRange(e.BYTERANGE),i.level=t,i.sn="initSegment",s&&(i.levelkeys=s),i.initSegment=null}function Qh(i,e,t){i.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&s.push(i)}var it={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},He={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Jh(i){const{type:e}=i;switch(e){case it.AUDIO_TRACK:return He.AUDIO;case it.SUBTITLE_TRACK:return He.SUBTITLE;default:return He.MAIN}}function Yo(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class zT{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(C.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(C.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,r=t.loader,n=s||r,a=new n(t);return this.loaders[e.type]=a,a}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:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:it.MANIFEST,url:s,deliveryDirectives:null})}onLevelLoading(e,t){const{id:s,level:r,pathwayId:n,url:a,deliveryDirectives:o}=t;this.load({id:s,level:r,pathwayId:n,responseType:"text",type:it.LEVEL,url:a,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:it.AUDIO_TRACK,url:n,deliveryDirectives:a})}onSubtitleTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:it.SUBTITLE_TRACK,url:n,deliveryDirectives:a})}load(e){var t;const s=this.hls.config;let r=this.getInternalLoader(e);if(r){const u=r.context;if(u&&u.url===e.url&&u.level===e.level){ie.trace("[playlist-loader]: playlist request ongoing");return}ie.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===it.MANIFEST?n=s.manifestLoadPolicy.default:n=Ct({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),_e((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===it.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===it.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===it.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const d=u.partTarget,f=u.targetduration;if(d&&f){const g=Math.max(d*3,f*.8)*1e3;n=Ct({},n,{maxTimeToFirstByteMs:Math.min(g,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(g,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(u,d,f,g)=>{const v=this.getInternalLoader(f);this.resetInternalLoader(f.type);const y=u.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),g||null,d);return}d.parsing.start=performance.now(),Js.isMediaPlaylist(y)?this.handleTrackOrLevelPlaylist(u,d,f,g||null,v):this.handleMasterPlaylist(u,d,f,g)},onError:(u,d,f,g)=>{this.handleNetworkError(d,f,!1,u,g)},onTimeout:(u,d,f)=>{this.handleNetworkError(d,f,!0,void 0,u)}};r.load(e,o,l)}handleMasterPlaylist(e,t,s,r){const n=this.hls,a=e.data,o=Yo(e,s),l=Js.parseMasterPlaylist(a,o);if(l.playlistParsingError){this.handleManifestParsingError(e,s,l.playlistParsingError,r,t);return}const{contentSteering:u,levels:d,sessionData:f,sessionKeys:g,startTimeOffset:v,variableList:y}=l;this.variableList=y;const{AUDIO:E=[],SUBTITLES:b,"CLOSED-CAPTIONS":w}=Js.parseMasterPlaylistMedia(a,o,l);E.length&&!E.some(k=>!k.url)&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(ie.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new St({}),bitrate:0,url:""})),n.trigger(C.MANIFEST_LOADED,{levels:d,audioTracks:E,subtitles:b,captions:w,contentSteering:u,url:o,stats:t,networkDetails:r,sessionData:f,sessionKeys:g,startTimeOffset:v,variableList:y})}handleTrackOrLevelPlaylist(e,t,s,r,n){const a=this.hls,{id:o,level:l,type:u}=s,d=Yo(e,s),f=0,g=_e(l)?l:_e(o)?o:0,v=Jh(s),y=Js.parseLevelPlaylist(e.data,d,g,v,f,this.variableList);if(u===it.MANIFEST){const E={attrs:new St({}),bitrate:0,details:y,name:"",url:d};a.trigger(C.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:d,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=y,this.handlePlaylistLoaded(y,e,t,s,r,n)}handleManifestParsingError(e,t,s,r,n){this.hls.trigger(C.ERROR,{type:je.NETWORK_ERROR,details:ce.MANIFEST_PARSING_ERROR,fatal:t.type===it.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,s=!1,r,n){let a=`A network ${s?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===it.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===it.AUDIO_TRACK||e.type===it.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);ie.warn(`[playlist-loader]: ${a}`);let l=ce.UNKNOWN,u=!1;const d=this.getInternalLoader(e);switch(e.type){case it.MANIFEST:l=s?ce.MANIFEST_LOAD_TIMEOUT:ce.MANIFEST_LOAD_ERROR,u=!0;break;case it.LEVEL:l=s?ce.LEVEL_LOAD_TIMEOUT:ce.LEVEL_LOAD_ERROR,u=!1;break;case it.AUDIO_TRACK:l=s?ce.AUDIO_TRACK_LOAD_TIMEOUT:ce.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case it.SUBTITLE_TRACK:l=s?ce.SUBTITLE_TRACK_LOAD_TIMEOUT:ce.SUBTITLE_LOAD_ERROR,u=!1;break}d&&this.resetInternalLoader(e.type);const f={type:je.NETWORK_ERROR,details:l,fatal:u,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:n};if(r){const g=(t==null?void 0:t.url)||e.url;f.response=Nt({url:g,data:void 0},r)}this.hls.trigger(C.ERROR,f)}handlePlaylistLoaded(e,t,s,r,n,a){const o=this.hls,{type:l,level:u,id:d,groupId:f,deliveryDirectives:g}=r,v=Yo(t,r),y=Jh(r),E=typeof r.level=="number"&&y===He.MAIN?u:void 0;if(!e.fragments.length){const w=new Error("No Segments found in Playlist");o.trigger(C.ERROR,{type:je.NETWORK_ERROR,details:ce.LEVEL_EMPTY_ERROR,fatal:!1,url:v,error:w,reason:w.message,response:t,context:r,level:E,parent:y,networkDetails:n,stats:s});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const b=e.playlistParsingError;if(b){o.trigger(C.ERROR,{type:je.NETWORK_ERROR,details:ce.LEVEL_PARSING_ERROR,fatal:!1,url:v,error:b,reason:b.message,response:t,context:r,level:E,parent:y,networkDetails:n,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case it.MANIFEST:case it.LEVEL:o.trigger(C.LEVEL_LOADED,{details:e,level:E||0,id:d||0,stats:s,networkDetails:n,deliveryDirectives:g});break;case it.AUDIO_TRACK:o.trigger(C.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:f||"",stats:s,networkDetails:n,deliveryDirectives:g});break;case it.SUBTITLE_TRACK:o.trigger(C.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:f||"",stats:s,networkDetails:n,deliveryDirectives:g});break}}}function qp(i,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=i,e.dispatchEvent(t)}function Yp(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues&&!i.cues.getCueById(e.id))try{if(i.addCue(e),!i.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){ie.debug(`[texttrack-utils]: ${s}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,i.addCue(r)}catch(r){ie.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(i.mode=t)}function Dr(i){const e=i.mode;if(e==="disabled"&&(i.mode="hidden"),i.cues)for(let t=i.cues.length;t--;)i.removeCue(i.cues[t]);e==="disabled"&&(i.mode=e)}function Cl(i,e,t,s){const r=i.mode;if(r==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const n=qT(i.cues,e,t);for(let a=0;a<n.length;a++)(!s||s(n[a]))&&i.removeCue(n[a])}r==="disabled"&&(i.mode=r)}function WT(i,e){if(e<i[0].startTime)return 0;const t=i.length-1;if(e>i[t].endTime)return-1;let s=0,r=t;for(;s<=r;){const n=Math.floor((r+s)/2);if(e<i[n].startTime)r=n-1;else if(e>i[n].startTime&&s<t)s=n+1;else return n}return i[s].startTime-e<e-i[r].startTime?s:r}function qT(i,e,t){const s=[],r=WT(i,e);if(r>-1)for(let n=r,a=i.length;n<a;n++){const o=i[n];if(o.startTime>=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function Sa(i){const e=[];for(let t=0;t<i.length;t++){const s=i[t];(s.kind==="subtitles"||s.kind==="captions")&&s.label&&e.push(i[t])}return e}var ks={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const YT=.25;function Rl(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Zh(i,e,t,s,r){let n=new i(e,t,"");try{n.value=s,r&&(n.type=r)}catch{n=new i(e,t,JSON.stringify(r?Nt({type:r},s):s))}return n}const aa=(()=>{const i=Rl();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Xo(i,e){return i.getTime()/1e3-e}function XT(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class QT{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Dr(this.id3Track),this.id3Track=null,this.media=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 s=e[t];if(s.kind==="metadata"&&s.label==="id3")return qp(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:r}}}=this;if(!s&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Rl();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===ks.emsg&&!s||!r)continue;const u=Bp(n[o].data);if(u){const d=n[o].pts;let f=d+n[o].duration;f>aa&&(f=aa),f-d<=0&&(f=d+YT);for(let v=0;v<u.length;v++){const y=u[v];if(!Np(y)){this.updateId3CueEnds(d,l);const E=Zh(a,d,f,y,l);E&&this.id3Track.addCue(E)}}}}}updateId3CueEnds(e,t){var s;const r=(s=this.id3Track)==null?void 0:s.cues;if(r)for(let n=r.length;n--;){const a=r[n];a.type===t&&a.startTime<e&&a.endTime===aa&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:s,type:r}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(n&&(o||l)){let u;r==="audio"?u=d=>d.type===ks.audioId3&&l:r==="video"?u=d=>d.type===ks.emsg&&o:u=d=>d.type===ks.audioId3&&l||d.type===ks.emsg&&o,Cl(n,t,s,u)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:s,id3Track:r}=this,{dateRanges:n}=t,a=Object.keys(n);if(r){const d=Object.keys(s).filter(f=>!a.includes(f));for(let f=d.length;f--;){const g=d[f];Object.keys(s[g].cues).forEach(v=>{r.removeCue(s[g].cues[v])}),delete s[g]}}const o=t.fragments[t.fragments.length-1];if(a.length===0||!_e(o==null?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=o.programDateTime/1e3-o.start,u=Rl();for(let d=0;d<a.length;d++){const f=a[d],g=n[f],v=Xo(g.startDate,l),y=s[f],E=(y==null?void 0:y.cues)||{};let b=(y==null?void 0:y.durationKnown)||!1,w=aa;const F=g.endDate;if(F)w=Xo(F,l),b=!0;else if(g.endOnNext&&!b){const U=a.reduce((N,te)=>{if(te!==g.id){const j=n[te];if(j.class===g.class&&j.startDate>g.startDate&&(!N||g.startDate<N.startDate))return j}return N},null);U&&(w=Xo(U.startDate,l),b=!0)}const k=Object.keys(g.attr);for(let U=0;U<k.length;U++){const N=k[U];if(!eT(N))continue;const te=E[N];if(te)b&&!y.durationKnown&&(te.endTime=w);else if(u){let j=g.attr[N];tT(N)&&(j=XT(j));const re=Zh(u,v,w,{key:N,data:j},ks.dateRange);re&&(re.id=f,this.id3Track.addCue(re),E[N]=re)}}s[f]={cues:E,dateRange:g,durationKnown:b}}}}class JT{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:s,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let u=o&&s||t;(l.liveSyncDuration||l.liveSyncDurationCount||u===0)&&(u=n!==void 0?n:a*r);const d=r;return u+Math.min(this.stallCount*1,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,s=this.levelDetails;if(e===null||t===null||s===null)return null;const r=s.edge,n=e-t-this.edgeStalled,a=r-s.totalduration,o=r-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,n),o)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(C.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(C.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(C.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(C.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var s;t.details===ce.BUFFER_STALLED_ERROR&&(this.stallCount++,(s=this.levelDetails)!=null&&s.live&&ie.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!t.live)return;const a=this.targetLatency;if(a===null)return;const o=s-a,l=Math.min(this.maxLatency,a+t.targetduration);if(o<l&&o>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,n)),f=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(d,Math.max(1,f))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const _l=["NONE","TYPE-0","TYPE-1",null];function ZT(i){return _l.indexOf(i)>-1}const Ha=["SDR","PQ","HLG"];function ew(i){return!!i&&Ha.indexOf(i)>-1}var Ea={No:"",Yes:"YES",v2:"v2"};function ed(i){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=i,r=s<e/2;return e&&r?t?Ea.v2:Ea.Yes:Ea.No}class td{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class $r{constructor(e){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.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(t=>!!t).map(t=>t.substring(0,4)).join(","),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 sd(this._audioGroups,e)}hasSubtitleGroup(e){return sd(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.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(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function sd(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function Qo(i,e){const t=e.startPTS;if(_e(t)){let s=0,r;e.sn>i.sn?(s=t-i.start,r=i):(s=i.start-t,r=e),r.duration!==s&&(r.duration=s)}else e.sn>i.sn?i.cc===e.cc&&i.minEndPTS?e.start=i.start+(i.minEndPTS-i.start):e.start=i.start+i.duration:e.start=Math.max(i.start-e.duration,0)}function Xp(i,e,t,s,r,n){s-t<=0&&(ie.warn("Fragment should have a positive duration",e),s=t+e.duration,n=r+e.duration);let o=t,l=s;const u=e.startPTS,d=e.endPTS;if(_e(u)){const b=Math.abs(u-t);_e(e.deltaPTS)?e.deltaPTS=Math.max(b,e.deltaPTS):e.deltaPTS=b,o=Math.max(t,u),t=Math.min(t,u),r=Math.min(r,e.startDTS),l=Math.min(s,d),s=Math.max(s,d),n=Math.max(n,e.endDTS)}const f=t-e.start;e.start!==0&&(e.start=t),e.duration=s-e.start,e.startPTS=t,e.maxStartPTS=o,e.startDTS=r,e.endPTS=s,e.minEndPTS=l,e.endDTS=n;const g=e.sn;if(!i||g<i.startSN||g>i.endSN)return 0;let v;const y=g-i.startSN,E=i.fragments;for(E[y]=e,v=y;v>0;v--)Qo(E[v],E[v-1]);for(v=y;v<E.length-1;v++)Qo(E[v],E[v+1]);return i.fragmentHint&&Qo(E[E.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,f}function tw(i,e){let t=null;const s=i.fragments;for(let l=s.length-1;l>=0;l--){const u=s[l].initSegment;if(u){t=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let r=0,n;if(rw(i,e,(l,u)=>{l.relurl&&(r=l.cc-u.cc),_e(l.startPTS)&&_e(l.endPTS)&&(u.start=u.startPTS=l.startPTS,u.startDTS=l.startDTS,u.maxStartPTS=l.maxStartPTS,u.endPTS=l.endPTS,u.endDTS=l.endDTS,u.minEndPTS=l.minEndPTS,u.duration=l.endPTS-l.startPTS,u.duration&&(n=u),e.PTSKnown=e.alignedSliding=!0),u.elementaryStreams=l.elementaryStreams,u.loader=l.loader,u.stats=l.stats,l.initSegment&&(u.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(u=>{var d;u&&(!u.initSegment||u.initSegment.relurl===((d=t)==null?void 0:d.relurl))&&(u.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){ie.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=sw(i.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const a=e.fragments;if(r){ie.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<a.length;l++)a[l].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),iw(i.partList,e.partList,(l,u)=>{u.elementaryStreams=l.elementaryStreams,u.stats=l.stats}),n?Xp(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):Qp(i,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const l=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=l),e.driftEndTime=o,e.driftEnd=l}else e.driftEndTime=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime}function sw(i,e,t){const s=Ct({},i);return t&&t.forEach(r=>{delete s[r]}),Object.keys(e).forEach(r=>{const n=new Pp(e[r].attr,s[r]);n.isValid?s[r]=n:ie.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),s}function iw(i,e,t){if(i&&e){let s=0;for(let r=0,n=i.length;r<=n;r++){const a=i[r],o=e[r+s];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):s--}}}function rw(i,e,t){const s=e.skippedSegments,r=Math.max(i.startSN,e.startSN)-e.startSN,n=(i.fragmentHint?1:0)+(s?e.endSN:Math.min(i.endSN,e.endSN))-e.startSN,a=e.startSN-i.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;for(let u=r;u<=n;u++){const d=l[a+u];let f=o[u];s&&!f&&u<s&&(f=e.fragments[u]=d),d&&f&&t(d,f)}}function Qp(i,e){const t=e.startSN+e.skippedSegments-i.startSN,s=i.fragments;t<0||t>=s.length||Il(e,s[t].start)}function Il(i,e){if(e){const t=i.fragments;for(let s=i.skippedSegments;s<t.length;s++)t[s].start+=e;i.fragmentHint&&(i.fragmentHint.start+=e)}}function nw(i,e=1/0){let t=1e3*i.targetduration;if(i.updated){const s=i.fragments;if(s.length&&t*4>e){const n=s[s.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function aw(i,e,t){if(!(i!=null&&i.details))return null;const s=i.details;let r=s.fragments[e-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===e)?r:e<s.startSN&&t&&t.sn===e?t:null}function id(i,e,t){var s;return i!=null&&i.details?Jp((s=i.details)==null?void 0:s.partList,e,t):null}function Jp(i,e,t){if(i)for(let s=i.length;s--;){const r=i[s];if(r.index===t&&r.fragment.sn===e)return r}return null}function Zp(i){i.forEach((e,t)=>{const{details:s}=e;s!=null&&s.fragments&&s.fragments.forEach(r=>{r.level=t})})}function ja(i){switch(i.details){case ce.FRAG_LOAD_TIMEOUT:case ce.KEY_LOAD_TIMEOUT:case ce.LEVEL_LOAD_TIMEOUT:case ce.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function rd(i,e){const t=ja(e);return i.default[`${t?"timeout":"error"}Retry`]}function Ec(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function nd(i){return Nt(Nt({},i),{errorRetry:null,timeoutRetry:null})}function Ka(i,e,t,s){if(!i)return!1;const r=s==null?void 0:s.code,n=e<i.maxNumRetry&&(ow(r)||!!t);return i.shouldRetry?i.shouldRetry(i,e,t,s,n):n}function ow(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}const eg={search:function(i,e){let t=0,s=i.length-1,r=null,n=null;for(;t<=s;){r=(t+s)/2|0,n=i[r];const a=e(n);if(a>0)t=r+1;else if(a<0)s=r-1;else return n}return null}};function lw(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!_e(e))return null;const s=i[0].programDateTime;if(e<(s||0))return null;const r=i[i.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<i.length;++n){const a=i[n];if(cw(e,t,a))return a}return null}function za(i,e,t=0,s=0){let r=null;if(i){r=e[i.sn-e[0].sn+1]||null;const a=i.endDTS-t;a>0&&a<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&(!i||i.level===r.level)&&kl(t,s,r)===0)return r;const n=eg.search(e,kl.bind(null,t,s));return n&&(n!==i||!r)?n:r}function kl(i=0,e=0,t){if(t.start<=i&&t.start+t.duration>i)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=i?1:t.start-s>i&&t.start?-1:0}function cw(i,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>i}function uw(i,e){return eg.search(i,t=>t.cc<e?1:t.cc>e?-1:0)}var Ht={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},_s={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class hw{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=ie.log.bind(ie,"[info]:"),this.warn=ie.warn.bind(ie,"[warning]:"),this.error=ie.error.bind(ie,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(C.ERROR,this.onError,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(C.ERROR,this.onError,this),e.off(C.ERROR,this.onErrorOut,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===He.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var s,r;if(t.fatal)return;const n=this.hls,a=t.context;switch(t.details){case ce.FRAG_LOAD_ERROR:case ce.FRAG_LOAD_TIMEOUT:case ce.KEY_LOAD_ERROR:case ce.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case ce.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction={action:Ht.DoNothing,flags:_s.None};return}case ce.FRAG_GAP:case ce.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ht.SendAlternateToPenaltyBox;return}case ce.LEVEL_EMPTY_ERROR:case ce.LEVEL_PARSING_ERROR:{var o,l;const u=t.parent===He.MAIN?t.level:n.loadLevel;t.details===ce.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(l=o.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,u):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,u))}return;case ce.LEVEL_LOAD_ERROR:case ce.LEVEL_LOAD_TIMEOUT:typeof(a==null?void 0:a.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level));return;case ce.AUDIO_TRACK_LOAD_ERROR:case ce.AUDIO_TRACK_LOAD_TIMEOUT:case ce.SUBTITLE_LOAD_ERROR:case ce.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){const u=n.levels[n.loadLevel];if(u&&(a.type===it.AUDIO_TRACK&&u.hasAudioGroup(a.groupId)||a.type===it.SUBTITLE_TRACK&&u.hasSubtitleGroup(a.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=Ht.SendAlternateToPenaltyBox,t.errorAction.flags=_s.MoveAllAlternatesMatchingHost;return}}return;case ce.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=n.levels[n.loadLevel],d=u==null?void 0:u.attrs["HDCP-LEVEL"];d?t.errorAction={action:Ht.SendAlternateToPenaltyBox,flags:_s.MoveAllAlternatesMatchingHDCP,hdcpLevel:d}:this.keySystemError(t)}return;case ce.BUFFER_ADD_CODEC_ERROR:case ce.REMUX_ALLOC_ERROR:case ce.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case ce.INTERNAL_EXCEPTION:case ce.BUFFER_APPENDING_ERROR:case ce.BUFFER_FULL_ERROR:case ce.LEVEL_SWITCH_ERROR:case ce.BUFFER_STALLED_ERROR:case ce.BUFFER_SEEK_OVER_HOLE:case ce.BUFFER_NUDGE_ON_STALL:t.errorAction={action:Ht.DoNothing,flags:_s.None};return}t.type===je.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,r=rd(s.config.playlistLoadPolicy,e),n=this.playlistError++;if(Ka(r,n,ja(e),e.response))return{action:Ht.RetryRequest,flags:_s.None,retryConfig:r,retryCount:n};const o=this.getLevelSwitchAction(e,t);return r&&(o.retryConfig=r,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),r=t.levels[s],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=rd(e.details.startsWith("key")?a:n,e),l=t.levels.reduce((d,f)=>d+f.fragmentError,0);if(r&&(e.details!==ce.FRAG_GAP&&r.fragmentError++,Ka(o,l,ja(e),e.response)))return{action:Ht.RetryRequest,flags:_s.None,retryConfig:o,retryCount:l};const u=this.getLevelSwitchAction(e,s);return o&&(u.retryConfig=o,u.retryCount=l),u}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const r=this.hls.levels[t];if(r){var n,a;const u=e.details;r.loadError++,u===ce.BUFFER_APPEND_ERROR&&r.fragmentError++;let d=-1;const{levels:f,loadLevel:g,minAutoLevel:v,maxAutoLevel:y}=s;s.autoLevelEnabled||(s.loadLevel=-1);const E=(n=e.frag)==null?void 0:n.type,w=(E===He.AUDIO&&u===ce.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===ce.BUFFER_ADD_CODEC_ERROR||u===ce.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:te})=>r.audioCodec!==te),k=e.sourceBufferName==="video"&&(u===ce.BUFFER_ADD_CODEC_ERROR||u===ce.BUFFER_APPEND_ERROR)&&f.some(({codecSet:te,audioCodec:j})=>r.codecSet!==te&&r.audioCodec===j),{type:U,groupId:N}=(a=e.context)!=null?a:{};for(let te=f.length;te--;){const j=(te+g)%f.length;if(j!==g&&j>=v&&j<=y&&f[j].loadError===0){var o,l;const re=f[j];if(u===ce.FRAG_GAP&&e.frag){const Q=f[j].details;if(Q){const le=za(e.frag,Q.fragments,e.frag.start);if(le!=null&&le.gap)continue}}else{if(U===it.AUDIO_TRACK&&re.hasAudioGroup(N)||U===it.SUBTITLE_TRACK&&re.hasSubtitleGroup(N))continue;if(E===He.AUDIO&&(o=r.audioGroups)!=null&&o.some(Q=>re.hasAudioGroup(Q))||E===He.SUBTITLE&&(l=r.subtitleGroups)!=null&&l.some(Q=>re.hasSubtitleGroup(Q))||w&&r.audioCodec===re.audioCodec||!w&&r.audioCodec!==re.audioCodec||k&&r.codecSet===re.codecSet)continue}d=j;break}}if(d>-1&&s.loadLevel!==d)return e.levelRetry=!0,this.playlistError=0,{action:Ht.SendAlternateToPenaltyBox,flags:_s.None,nextAutoLevel:d}}return{action:Ht.SendAlternateToPenaltyBox,flags:_s.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case Ht.DoNothing:break;case Ht.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==ce.FRAG_GAP?t.fatal=!0:/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());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:r,hdcpLevel:n,nextAutoLevel:a}=s;switch(r){case _s.None:this.switchLevel(e,a);break;case _s.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=_l[_l.indexOf(n)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}s.resolved||this.switchLevel(e,a)}switchLevel(e,t){t!==void 0&&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)}}class bc{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=ie.log.bind(ie,`${t}:`),this.warn=ie.warn.bind(ie,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const r=t==null?void 0:t.renditionReports;if(r){let n=-1;for(let a=0;a<r.length;a++){const o=r[a];let l;try{l=new self.URL(o.URI,t.url).href}catch(u){ie.warn(`Could not construct new URL for Rendition Report: ${u}`),l=o.URI||""}if(l===e){n=a;break}else l===e.substring(0,l.length)&&(n=a)}if(n!==-1){const a=r[n],o=parseInt(a["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=parseInt(a["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const d=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&d>t.partTarget&&(l+=1)}const u=s&&ed(s);return new td(o,l>=0?l:void 0,u)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,s){const{details:r,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;if(r.advancedDateTime=Date.now()-o,r.live||s!=null&&s.live){if(r.reloaded(s),s&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),s&&r.fragments.length>0&&tw(s,r),!this.canLoad||!r.live)return;let l,u,d;if(r.canBlockReload&&r.endSN&&r.advanced){const b=this.hls.config.lowLatencyMode,w=r.lastPartSn,F=r.endSN,k=r.lastPartIndex,U=k!==-1,N=w===F,te=b?0:k;U?(u=N?F+1:w,d=N?te:k+1):u=F+1;const j=r.age,re=j+r.ageHeader;let Q=Math.min(re-r.partTarget,r.targetduration*1.5);if(Q>0){if(s&&Q>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${Q} with playlist age: ${r.age}`),Q=0;else{const le=Math.floor(Q/r.targetduration);if(u+=le,d!==void 0){const se=Math.round(Q%r.targetduration/r.partTarget);d+=se}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${j.toFixed(2)}s goal: ${Q} skip sn ${le} to part ${d}`)}r.tuneInGoal=Q}if(l=this.getDeliveryDirectives(r,t.deliveryDirectives,u,d),b||!N){this.loadPlaylist(l);return}}else(r.canBlockReload||r.canSkipUntil)&&(l=this.getDeliveryDirectives(r,t.deliveryDirectives,u,d));const f=this.hls.mainForwardBufferInfo,g=f?f.end-f.len:0,v=(r.edge-g)*1e3,y=nw(r,v);r.updated&&a>this.requestScheduled+y&&(this.requestScheduled=n.loading.start),u!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+y-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+y<a?this.requestScheduled=a:this.requestScheduled-a<=0&&(this.requestScheduled+=y);let E=this.requestScheduled-a;E=Math.max(0,E),this.log(`reload live playlist ${e} in ${Math.round(E)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),E)}else this.clearTimer()}getDeliveryDirectives(e,t,s,r){let n=ed(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,r=t.part,n=Ea.No),new td(s,r,n)}checkRetry(e){const t=e.details,s=ja(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=r||{},l=!!r&&!!o&&(n===Ht.RetryRequest||!r.resolved&&n===Ht.SendAlternateToPenaltyBox);if(l){var u;if(this.requestScheduled=-1,a>=o.maxNumRetry)return!1;if(s&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const d=Ec(o,a);this.timer=self.setTimeout(()=>this.loadPlaylist(),d),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${d}ms`)}e.levelRetry=!0,r.resolved=!0}return l}}class Cr{constructor(e,t=0,s=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_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*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 dw{constructor(e,t,s,r=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_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Cr(e),this.fast_=new Cr(t),this.defaultTTFB_=r,this.ttfb_=new Cr(e)}update(e,t){const{slow_:s,fast_:r,ttfb_:n}=this;s.halfLife!==e&&(this.slow_=new Cr(e,s.getEstimate(),s.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Cr(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Cr(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,r=e/1e3,n=s/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,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_}destroy(){}}const tg={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},ad={};function fw(i,e,t,s,r,n){const a=i.audioCodec?i.audioGroups:null,o=n==null?void 0:n.audioCodec,l=n==null?void 0:n.channels,u=l?parseInt(l):o?1/0:2;let d=null;if(a!=null&&a.length)try{a.length===1&&a[0]?d=e.groups[a[0]].channels:d=a.reduce((f,g)=>{if(g){const v=e.groups[g];if(!v)throw new Error(`Audio track group ${g} not found`);Object.keys(v.channels).forEach(y=>{f[y]=(f[y]||0)+v.channels[y]})}return f},{2:0})}catch{return!0}return i.videoCodec!==void 0&&(i.width>1920&&i.height>1088||i.height>1920&&i.width>1088||i.frameRate>Math.max(s,30)||i.videoRange!=="SDR"&&i.videoRange!==t||i.bitrate>Math.max(r,8e6))||!!d&&_e(u)&&Object.keys(d).some(f=>parseInt(f)>u)}function pw(i,e,t){const s=i.videoCodec,r=i.audioCodec;if(!s||!r||!t)return Promise.resolve(tg);const n={width:i.width,height:i.height,bitrate:Math.ceil(Math.max(i.bitrate*.9,i.averageBitrate)),framerate:i.frameRate||30},a=i.videoRange;a!=="SDR"&&(n.transferFunction=a.toLowerCase());const o=s.split(",").map(l=>({type:"media-source",video:Nt(Nt({},n),{},{contentType:Pn(l,"video")})}));return r&&i.audioGroups&&i.audioGroups.forEach(l=>{var u;l&&((u=e.groups[l])==null||u.tracks.forEach(d=>{if(d.groupId===l){const f=d.channels||"",g=parseFloat(f);_e(g)&&g>2&&o.push.apply(o,r.split(",").map(v=>({type:"media-source",audio:{contentType:Pn(v,"audio"),channels:""+g}})))}}))}),Promise.all(o.map(l=>{const u=gw(l);return ad[u]||(ad[u]=t.decodingInfo(l))})).then(l=>({supported:!l.some(u=>!u.supported),configurations:o,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:o,decodingInfoResults:[],error:l}))}function gw(i){const{audio:e,video:t}=i,s=t||e;if(s){const r=s.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}function mw(){if(typeof matchMedia=="function"){const i=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(i.media!==e.media)return i.matches===!0}return!1}function vw(i,e){let t=!1,s=[];return i&&(t=i!=="SDR",s=[i]),e&&(s=e.allowedVideoRanges||Ha.slice(0),t=e.preferHDR!==void 0?e.preferHDR:mw(),t?s=s.filter(r=>r!=="SDR"):s=["SDR"]),{preferHDR:t,allowedVideoRanges:s}}function yw(i,e,t,s,r){const n=Object.keys(i),a=s==null?void 0:s.channels,o=s==null?void 0:s.audioCodec,l=a&&parseInt(a)===2;let u=!0,d=!1,f=1/0,g=1/0,v=1/0,y=0,E=[];const{preferHDR:b,allowedVideoRanges:w}=vw(e,r);for(let N=n.length;N--;){const te=i[n[N]];u=te.channels[2]>0,f=Math.min(f,te.minHeight),g=Math.min(g,te.minFramerate),v=Math.min(v,te.minBitrate);const j=w.filter(re=>te.videoRanges[re]>0);j.length>0&&(d=!0,E=j)}f=_e(f)?f:0,g=_e(g)?g:0;const F=Math.max(1080,f),k=Math.max(30,g);return v=_e(v)?v:t,t=Math.max(v,t),d||(e=void 0,E=[]),{codecSet:n.reduce((N,te)=>{const j=i[te];if(te===N)return N;if(j.minBitrate>t)return di(te,`min bitrate of ${j.minBitrate} > current estimate of ${t}`),N;if(!j.hasDefaultAudio)return di(te,"no renditions with default or auto-select sound found"),N;if(o&&te.indexOf(o.substring(0,4))%5!==0)return di(te,`audio codec preference "${o}" not found`),N;if(a&&!l){if(!j.channels[a])return di(te,`no renditions with ${a} channel sound found (channels options: ${Object.keys(j.channels)})`),N}else if((!o||l)&&u&&j.channels[2]===0)return di(te,"no renditions with stereo sound found"),N;return j.minHeight>F?(di(te,`min resolution of ${j.minHeight} > maximum of ${F}`),N):j.minFramerate>k?(di(te,`min framerate of ${j.minFramerate} > maximum of ${k}`),N):E.some(re=>j.videoRanges[re]>0)?j.maxScore<y?(di(te,`max score of ${j.maxScore} < selected max of ${y}`),N):N&&(Ga(te)>=Ga(N)||j.fragmentError>i[N].fragmentError)?N:(y=j.maxScore,te):(di(te,`no variants with VIDEO-RANGE of ${JSON.stringify(E)} found`),N)},void 0),videoRanges:E,preferHDR:b,minFramerate:g,minBitrate:v}}function di(i,e){ie.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function xw(i){return i.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const r=t.channels||"2";return s.channels[r]=(s.channels[r]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Sw(i,e,t,s){return i.slice(t,s+1).reduce((r,n)=>{if(!n.codecSet)return r;const a=n.audioGroups;let o=r[n.codecSet];o||(r[n.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,n.bitrate);const l=Math.min(n.height,n.width);return o.minHeight=Math.min(o.minHeight,l),o.minFramerate=Math.min(o.minFramerate,n.frameRate),o.maxScore=Math.max(o.maxScore,n.score),o.fragmentError+=n.fragmentError,o.videoRanges[n.videoRange]=(o.videoRanges[n.videoRange]||0)+1,a&&a.forEach(u=>{if(!u)return;const d=e.groups[u];d&&(o.hasDefaultAudio=o.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(f=>{o.channels[f]=(o.channels[f]||0)+d.channels[f]}))}),r},{})}function Zs(i,e,t){if("attrs"in i){const s=e.indexOf(i);if(s!==-1)return s}for(let s=0;s<e.length;s++){const r=e[s];if(Fr(i,r,t))return s}return-1}function Fr(i,e,t){const{groupId:s,name:r,lang:n,assocLang:a,characteristics:o,default:l}=i,u=i.forced;return(s===void 0||e.groupId===s)&&(r===void 0||e.name===r)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===a)&&(l===void 0||e.default===l)&&(u===void 0||e.forced===u)&&(o===void 0||Ew(o,e.characteristics))&&(t===void 0||t(i,e))}function Ew(i,e=""){const t=i.split(","),s=e.split(",");return t.length===s.length&&!t.some(r=>s.indexOf(r)===-1)}function Rr(i,e){const{audioCodec:t,channels:s}=i;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function bw(i,e,t,s,r){const n=e[s],o=e.reduce((g,v,y)=>{const E=v.uri;return(g[E]||(g[E]=[])).push(y),g},{})[n.uri];o.length>1&&(s=Math.max.apply(Math,o));const l=n.videoRange,u=n.frameRate,d=n.codecSet.substring(0,4),f=od(e,s,g=>{if(g.videoRange!==l||g.frameRate!==u||g.codecSet.substring(0,4)!==d)return!1;const v=g.audioGroups,y=t.filter(E=>!v||v.indexOf(E.groupId)!==-1);return Zs(i,y,r)>-1});return f>-1?f:od(e,s,g=>{const v=g.audioGroups,y=t.filter(E=>!v||v.indexOf(E.groupId)!==-1);return Zs(i,y,r)>-1})}function od(i,e,t){for(let s=e;s;s--)if(t(i[s]))return s;for(let s=e+1;s<i.length;s++)if(t(i[s]))return s;return-1}class Tw{constructor(e){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.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:s,hls:r}=this,{autoLevelEnabled:n,media:a}=r;if(!t||!a)return;const o=performance.now(),l=s?s.stats:t.stats,u=s?s.duration:t.duration,d=o-l.loading.start,f=r.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||a.paused||!a.playbackRate||!a.readyState)return;const g=r.mainForwardBufferInfo;if(g===null)return;const v=this.bwEstimator.getEstimateTTFB(),y=Math.abs(a.playbackRate);if(d<=Math.max(v,1e3*(u/(y*2))))return;const E=g.len/y,b=l.loading.first?l.loading.first-l.loading.start:-1,w=l.loaded&&b>-1,F=this.getBwEstimate(),k=r.levels,U=k[t.level],N=l.total||Math.max(l.loaded,Math.round(u*U.averageBitrate/8));let te=w?d-b:d;te<1&&w&&(te=Math.min(d,l.loaded*8/F));const j=w?l.loaded*1e3/te:0,re=j?(N-l.loaded)/j:N*8/F+v/1e3;if(re<=E)return;const Q=j?j*8:F;let le=Number.POSITIVE_INFINITY,se;for(se=t.level-1;se>f;se--){const de=k[se].maxBitrate;if(le=this.getTimeToLoadFrag(v/1e3,Q,u*de,!k[se].details),le<E)break}if(le>=re||le>u*10)return;r.nextLoadLevel=r.nextAutoLevel=se,w?this.bwEstimator.sample(d-Math.min(v,b),l.loaded):this.bwEstimator.sampleTTFB(d);const pe=k[se].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>pe&&this.resetEstimator(pe),this.clearTimer(),ie.warn(`[abr] Fragment ${t.sn}${s?" part "+s.index:""} of level ${t.level} is loading too slowly;
|
|
52
53
|
Time to underbuffer: ${E.toFixed(3)} s
|
|
53
54
|
Estimated load time for current fragment: ${re.toFixed(3)} s
|
|
54
55
|
Estimated load time for down switch fragment: ${le.toFixed(3)} s
|
|
55
56
|
TTFB estimate: ${b|0} ms
|
|
56
57
|
Current BW estimate: ${_e(F)?F|0:"Unknown"} bps
|
|
57
58
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
58
|
-
Switching to level ${se} @ ${pe|0} bps`),r.trigger(C.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:s,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(ie.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 dw(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.FRAG_LOADING,this.onFragLoading,this),e.on(C.FRAG_LOADED,this.onFragLoaded,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(C.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.FRAG_LOADING,this.onFragLoading,this),e.off(C.FRAG_LOADED,this.onFragLoaded,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(C.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,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 s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var r;this.fragCurrent=s,this.partCurrent=(r=t.part)!=null?r: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 ce.BUFFER_ADD_CODEC_ERROR:case ce.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case ce.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:r,partCurrent:n}=this;if(s&&r&&s.sn===r.sn&&s.level===r.level){const a=performance.now(),o=n?n.stats:s.stats,l=a-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(f,u),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,s,r){const n=e+s/t,a=r?this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const s=this.hls.config,{loading:r}=t.stats,n=r.end-r.start;_e(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:s}){const r=s?s.stats:t.stats;if(t.type===He.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=s?s.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+r.loaded,l=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(t.bitrateTest){const n={stats:r,frag:t,part:s,id:t.type};this.onFragBuffered(C.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:s.stats;if(n.aborted||this.ignoreFragment(s))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==He.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(s,t,e,0,r,1,1);if(n>-1)return n;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return ie.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=s&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this,{maxAutoLevel:r,config:n,minAutoLevel:a}=s,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),u=this.getStarvationDelay();let d=n.abrBandWidthFactor,f=n.abrBandWidthUpFactor;if(u){const b=this.findBestLevel(l,a,r,u,0,d,f);if(b>=0)return b}let g=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!u){const b=this.bitrateTestDelay;b&&(g=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-b,ie.info(`[abr] bitrate test took ${Math.round(1e3*b)}ms, set first fragment max fetchDuration to ${Math.round(1e3*g)} ms`),d=f=1)}const v=this.findBestLevel(l,a,r,u,g,d,f);if(ie.info(`[abr] ${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${v}`),v>-1)return v;const y=s.levels[a],E=s.levels[s.loadLevel];return(y==null?void 0:y.bitrate)<(E==null?void 0:E.bitrate)?a:s.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const s=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/s}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,s,r,n,a,o){var l;const u=r+n,d=this.lastLoadedFragLevel,f=d===-1?this.hls.firstLevel:d,{fragCurrent:g,partCurrent:v}=this,{levels:y,allAudioTracks:E,loadLevel:b,config:w}=this.hls;if(y.length===1)return 0;const F=y[f],k=!!(F!=null&&(l=F.details)!=null&&l.live),U=b===-1||d===-1;let N,te="SDR",j=(F==null?void 0:F.frameRate)||0;const{audioPreference:re,videoPreference:Q}=w,le=this.audioTracksByGroup||(this.audioTracksByGroup=xw(E));if(U){if(this.firstSelection!==-1)return this.firstSelection;const Le=this.codecTiers||(this.codecTiers=Sw(y,le,t,s)),ue=yw(Le,te,e,re,Q),{codecSet:he,videoRanges:we,minFramerate:me,minBitrate:ye,preferHDR:Ve}=ue;N=he,te=Ve?we[we.length-1]:we[0],j=me,e=Math.max(e,ye),ie.log(`[abr] picked start tier ${JSON.stringify(ue)}`)}else N=F==null?void 0:F.codecSet,te=F==null?void 0:F.videoRange;const se=v?v.duration:g?g.duration:0,pe=this.bwEstimator.getEstimateTTFB()/1e3,de=[];for(let Le=s;Le>=t;Le--){var be;const ue=y[Le],he=Le>f;if(!ue)continue;if(w.useMediaCapabilities&&!ue.supportedResult&&!ue.supportedPromise){const st=navigator.mediaCapabilities;typeof(st==null?void 0:st.decodingInfo)=="function"&&fw(ue,le,te,j,e,re)?(ue.supportedPromise=pw(ue,le,st),ue.supportedPromise.then(et=>{if(!this.hls)return;ue.supportedResult=et;const rt=this.hls.levels,Je=rt.indexOf(ue);et.error?ie.warn(`[abr] MediaCapabilities decodingInfo error: "${et.error}" for level ${Je} ${JSON.stringify(et)}`):et.supported||(ie.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${Je} ${JSON.stringify(et)}`),Je>-1&&rt.length>1&&(ie.log(`[abr] Removing unsupported level ${Je}`),this.hls.removeLevel(Je)))})):ue.supportedResult=tg}if(N&&ue.codecSet!==N||te&&ue.videoRange!==te||he&&j>ue.frameRate||!he&&j>0&&j<ue.frameRate||ue.supportedResult&&!((be=ue.supportedResult.decodingInfoResults)!=null&&be[0].smooth)){de.push(Le);continue}const we=ue.details,me=(v?we==null?void 0:we.partTarget:we==null?void 0:we.averagetargetduration)||se;let ye;he?ye=o*e:ye=a*e;const Ve=se&&r>=se*2&&n===0?y[Le].averageBitrate:y[Le].maxBitrate,$e=this.getTimeToLoadFrag(pe,ye,Ve*me,we===void 0);if(ye>=Ve&&(Le===d||ue.loadError===0&&ue.fragmentError===0)&&($e<=pe||!_e($e)||k&&!this.bitrateTestDelay||$e<u)){const st=this.forcedAutoLevel;return Le!==b&&(st===-1||st!==b)&&(de.length&&ie.trace(`[abr] Skipped level(s) ${de.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${y[de[0]].codecs}" ${y[de[0]].videoRange}; not compatible with "${F.codecs}" ${te}`),ie.info(`[abr] switch candidate:${f}->${Le} adjustedbw(${Math.round(ye)})-bitrate=${Math.round(ye-Ve)} ttfb:${pe.toFixed(1)} avgDuration:${me.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${$e.toFixed(1)} firstSelection:${U} codecSet:${N} videoRange:${te} hls.loadLevel:${b}`)),U&&(this.firstSelection=Le),Le}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls,r=Math.min(Math.max(e,s),t);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}}class ww{constructor(){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?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var Ot={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Aw{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.on(C.BUFFER_APPENDED,this.onBufferAppended,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.BUFFER_APPENDED,this.onBufferAppended,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const s=this.activePartLists[t];if(s)for(let r=s.length;r--;){const n=s[r];if(!n)break;const a=n.end;if(n.start<=e&&a!==null&&e<=a)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:s}=this,r=Object.keys(s);for(let n=r.length;n--;){const a=s[r[n]];if((a==null?void 0:a.body.type)===t&&a.buffered){const o=a.body;if(o.start<=e&&e<=o.end)return o}}return null}detectEvictedFragments(e,t,s,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o||n>=o.body.sn)return;if(!o.buffered&&!o.loaded){o.body.type===s&&this.removeFragment(o.body);return}const l=o.range[e];l&&l.time.some(u=>{const d=!this.isTimeBuffered(u.startPTS,u.endPTS,t);return d&&this.removeFragment(o.body),d})})}detectPartialFragments(e){const t=this.timeRanges,{frag:s,part:r}=e;if(!t||s.sn==="initSegment")return;const n=_r(s),a=this.fragments[n];if(!a||a.buffered&&s.gap)return;const o=!s.relurl;Object.keys(t).forEach(l=>{const u=s.elementaryStreams[l];if(!u)return;const d=t[l],f=o||u.partial===!0;a.range[l]=this.getBufferedTimes(s,r,f,d)}),a.loaded=null,Object.keys(a.range).length?(a.buffered=!0,(a.body.endList=s.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),oa(a)||this.removeParts(s.sn-1,s.type)):this.removeFragment(a.body)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=s.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const s=_r(e);let r=this.fragments[s];!r&&t&&(r=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,s,r){const n={time:[],partial:s},a=e.start,o=e.end,l=e.minEndPTS||o,u=e.maxStartPTS||a;for(let d=0;d<r.length;d++){const f=r.start(d)-this.bufferPadding,g=r.end(d)+this.bufferPadding;if(u>=f&&l<=g){n.time.push({startPTS:Math.max(a,r.start(d)),endPTS:Math.min(o,r.end(d))});break}else if(a<g&&o>f){const v=Math.max(a,r.start(d)),y=Math.min(o,r.end(d));y>v&&(n.partial=!0,n.time.push({startPTS:v,endPTS:y}))}else if(o<=f)break}return n}getPartialFragment(e){let t=null,s,r,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(u=>{const d=l[u];d&&oa(d)&&(r=d.body.start-o,n=d.body.end+o,e>=r&&e<=n&&(s=Math.min(e-r,n-e),a<=s&&(t=d.body,a=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||oa(t))}getState(e){const t=_r(e),s=this.fragments[t];return s?s.buffered?oa(s)?Ot.PARTIAL:Ot.OK:Ot.APPENDING:Ot.NOT_LOADED}isTimeBuffered(e,t,s){let r,n;for(let a=0;a<s.length;a++){if(r=s.start(a)-this.bufferPadding,n=s.end(a)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:s,part:r}=t;if(s.sn==="initSegment"||s.bitrateTest)return;const n=r?null:t,a=_r(s);this.fragments[a]={body:s,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:r,timeRanges:n}=t;if(s.sn==="initSegment")return;const a=s.type;if(r){let o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(r)}this.timeRanges=n,Object.keys(n).forEach(o=>{const l=n[o];this.detectEvictedFragments(o,l,a,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=_r(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==s||r&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=_r(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const r=e.sn;this.activePartLists[e.type]=s.filter(n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function oa(i){var e,t,s;return i.buffered&&(i.body.gap||((e=i.range.video)==null?void 0:e.partial)||((t=i.range.audio)==null?void 0:t.partial)||((s=i.range.audiovideo)==null?void 0:s.partial))}function _r(i){return`${i.type}_${i.level}_${i.sn}`}const Lw={length:0,start:()=>0,end:()=>0};class mt{static isBuffered(e,t){try{if(e){const s=mt.getBuffered(e);for(let r=0;r<s.length;r++)if(t>=s.start(r)&&t<=s.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,s){try{if(e){const r=mt.getBuffered(e),n=[];let a;for(a=0;a<r.length;a++)n.push({start:r.start(a),end:r.end(a)});return this.bufferedInfo(n,t,s)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,s){t=Math.max(0,t),e.sort(function(u,d){const f=u.start-d.start;return f||d.end-u.end});let r=[];if(s)for(let u=0;u<e.length;u++){const d=r.length;if(d){const f=r[d-1].end;e[u].start-f<s?e[u].end>f&&(r[d-1].end=e[u].end):r.push(e[u])}else r.push(e[u])}else r=e;let n=0,a,o=t,l=t;for(let u=0;u<r.length;u++){const d=r[u].start,f=r[u].end;if(t+s>=d&&t<f)o=d,l=f,n=l-t;else if(t+s<d){a=d;break}}return{len:n,start:o||0,end:l||0,nextStart:a}}static getBuffered(e){try{return e.buffered}catch(t){return ie.log("failed to get media.buffered",t),Lw}}}class Tc{constructor(e,t,s,r=0,n=-1,a=!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=la(),this.buffering={audio:la(),video:la(),audiovideo:la()},this.level=e,this.sn=t,this.id=s,this.size=r,this.part=n,this.partial=a}}function la(){return{start:0,executeStart:0,executeEnd:0,end:0}}function ba(i,e){for(let s=0,r=i.length;s<r;s++){var t;if(((t=i[s])==null?void 0:t.cc)===e)return i[s]}return null}function Cw(i,e,t){return!!(e&&(t.endCC>t.startCC||i&&i.cc<t.startCC))}function Rw(i,e){const t=i.fragments,s=e.fragments;if(!s.length||!t.length){ie.log("No fragments to align");return}const r=ba(t,s[0].cc);if(!r||r&&!r.startPTS){ie.log("No frag in previous level to align on");return}return r}function ld(i,e){if(i){const t=i.start+e;i.start=i.startPTS=t,i.endPTS=t+i.duration}}function sg(i,e){const t=e.fragments;for(let s=0,r=t.length;s<r;s++)ld(t[s],i);e.fragmentHint&&ld(e.fragmentHint,i),e.alignedSliding=!0}function _w(i,e,t){e&&(Iw(i,t,e),!t.alignedSliding&&e&&Wa(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&Qp(e,t))}function Iw(i,e,t){if(Cw(i,t,e)){const s=Rw(t,e);s&&_e(s.start)&&(ie.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),sg(s.start,e))}}function Wa(i,e){if(!i.hasProgramDateTime||!e.hasProgramDateTime)return;const t=i.fragments,s=e.fragments;if(!t.length||!s.length)return;let r,n;const a=Math.min(e.endCC,i.endCC);e.startCC<a&&i.startCC<a&&(r=ba(s,a),n=ba(t,a)),(!r||!n)&&(r=s[Math.floor(s.length/2)],n=ba(t,r.cc)||t[Math.floor(t.length/2)]);const o=r.programDateTime,l=n.programDateTime;if(!o||!l)return;const u=(l-o)/1e3-(n.start-r.start);sg(u,i)}const cd=Math.pow(2,17);class kw{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 s=e.url;if(!s)return Promise.reject(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(v=>v[0]==="GAP")){l(hd(e));return}else e.gap=!1;const u=this.loader=e.loader=n?new n(r):new a(r),d=ud(e),f=nd(r.fragLoadPolicy.default),g={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:cd};e.stats=u.stats,u.load(d,g,{onSuccess:(v,y,E,b)=>{this.resetLoader(e,u);let w=v.data;E.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(w.slice(0,16)),w=w.slice(16)),o({frag:e,part:null,payload:w,networkDetails:b})},onError:(v,y,E,b)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Nt({url:s,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:E,stats:b}))},onAbort:(v,y,E)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:E,stats:v}))},onTimeout:(v,y,E)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:E,stats:v}))},onProgress:(v,y,E,b)=>{t&&t({frag:e,part:null,payload:E,networkDetails:b})}})})}loadPart(e,t,s){this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(hd(e,t));return}const u=this.loader=e.loader=n?new n(r):new a(r),d=ud(e,t),f=nd(r.fragLoadPolicy.default),g={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:cd};t.stats=u.stats,u.load(d,g,{onSuccess:(v,y,E,b)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const w={frag:e,part:t,payload:v.data,networkDetails:b};s(w),o(w)},onError:(v,y,E,b)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Nt({url:d.url,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:E,stats:b}))},onAbort:(v,y,E)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:E,stats:v}))},onTimeout:(v,y,E)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:E,stats:v}))}})})}updateStatsFromPart(e,t){const s=e.stats,r=t.stats,n=r.total;if(s.loaded+=r.loaded,n){const l=Math.round(e.duration/t.duration),u=Math.min(Math.round(s.loaded/n),l),f=(l-u)*Math.round(s.loaded/u);s.total=s.loaded+f}else s.total=Math.max(s.loaded,s.total);const a=s.loading,o=r.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function ud(i,e=null){const t=e||i,s={frag:i,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(_e(r)&&_e(n)){var a;let o=r,l=n;if(i.sn==="initSegment"&&((a=i.decryptdata)==null?void 0:a.method)==="AES-128"){const u=n-r;u%16&&(l=n+(16-u%16)),r!==0&&(s.resetIV=!0,o=r-16)}s.rangeStart=o,s.rangeEnd=l}return s}function hd(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),s={type:je.MEDIA_ERROR,details:ce.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(s.part=e),(e||i).stats.aborted=!0,new gi(s)}class gi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Pw{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Dw{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function Mw(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?ir(i,0,e-t):i}class Fw{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),s=new Uint32Array(4);for(let r=0;r<4;r++)s[r]=t.getUint32(r*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,r=s[0],n=s[1],a=s[2],o=s[3],l=this.invSubMix,u=l[0],d=l[1],f=l[2],g=l[3],v=new Uint32Array(256);let y=0,E=0,b=0;for(b=0;b<256;b++)b<128?v[b]=b<<1:v[b]=b<<1^283;for(b=0;b<256;b++){let w=E^E<<1^E<<2^E<<3^E<<4;w=w>>>8^w&255^99,e[y]=w,t[w]=y;const F=v[y],k=v[F],U=v[k];let N=v[w]*257^w*16843008;r[y]=N<<24|N>>>8,n[y]=N<<16|N>>>16,a[y]=N<<8|N>>>24,o[y]=N,N=U*16843009^k*65537^F*257^y*16843008,u[w]=N<<24|N>>>8,d[w]=N<<16|N>>>16,f[w]=N<<8|N>>>24,g[w]=N,y?(y=F^v[v[v[U^F]]],E^=v[v[E]]):y=E=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,r=0;for(;r<t.length&&s;)s=t[r]===this.key[r],r++;if(s)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const a=this.ksRows=(n+6+1)*4;let o,l;const u=this.keySchedule=new Uint32Array(a),d=this.invKeySchedule=new Uint32Array(a),f=this.sBox,g=this.rcon,v=this.invSubMix,y=v[0],E=v[1],b=v[2],w=v[3];let F,k;for(o=0;o<a;o++){if(o<n){F=u[o]=t[o];continue}k=F,o%n===0?(k=k<<8|k>>>24,k=f[k>>>24]<<24|f[k>>>16&255]<<16|f[k>>>8&255]<<8|f[k&255],k^=g[o/n|0]<<24):n>6&&o%n===4&&(k=f[k>>>24]<<24|f[k>>>16&255]<<16|f[k>>>8&255]<<8|f[k&255]),u[o]=F=(u[o-n]^k)>>>0}for(l=0;l<a;l++)o=a-l,l&3?k=u[o]:k=u[o-4],l<4||o<=4?d[l]=k:d[l]=y[f[k>>>24]]^E[f[k>>>16&255]]^b[f[k>>>8&255]]^w[f[k&255]],d[l]=d[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,s){const r=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],u=o[1],d=o[2],f=o[3],g=this.uint8ArrayToUint32Array_(s);let v=g[0],y=g[1],E=g[2],b=g[3];const w=new Int32Array(e),F=new Int32Array(w.length);let k,U,N,te,j,re,Q,le,se,pe,de,be,Le,ue;const he=this.networkToHostOrderSwap;for(;t<w.length;){for(se=he(w[t]),pe=he(w[t+1]),de=he(w[t+2]),be=he(w[t+3]),j=se^n[0],re=be^n[1],Q=de^n[2],le=pe^n[3],Le=4,ue=1;ue<r;ue++)k=l[j>>>24]^u[re>>16&255]^d[Q>>8&255]^f[le&255]^n[Le],U=l[re>>>24]^u[Q>>16&255]^d[le>>8&255]^f[j&255]^n[Le+1],N=l[Q>>>24]^u[le>>16&255]^d[j>>8&255]^f[re&255]^n[Le+2],te=l[le>>>24]^u[j>>16&255]^d[re>>8&255]^f[Q&255]^n[Le+3],j=k,re=U,Q=N,le=te,Le=Le+4;k=a[j>>>24]<<24^a[re>>16&255]<<16^a[Q>>8&255]<<8^a[le&255]^n[Le],U=a[re>>>24]<<24^a[Q>>16&255]<<16^a[le>>8&255]<<8^a[j&255]^n[Le+1],N=a[Q>>>24]<<24^a[le>>16&255]<<16^a[j>>8&255]<<8^a[re&255]^n[Le+2],te=a[le>>>24]<<24^a[j>>16&255]<<16^a[re>>8&255]<<8^a[Q&255]^n[Le+3],F[t]=he(k^v),F[t+1]=he(te^y),F[t+2]=he(N^E),F[t+3]=he(U^b),v=se,y=pe,E=de,b=be,t=t+4}return F.buffer}}const Ow=16;class wc{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.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}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 s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Mw(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,s){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,s);const a=this.flush();a?r(a.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s)}softwareDecrypt(e,t,s){const{currentIV:r,currentResult:n,remainderData:a}=this;this.logOnce("JS AES decrypt"),a&&(e=bs(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;r&&(s=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Fw),l.expandKey(t);const u=n;return this.currentResult=l.decrypt(o.buffer,0,s),this.currentIV=ir(o,-16).buffer,u||null}webCryptoDecrypt(e,t,s){const r=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new Dw(r,t)),this.fastAesKey.expandKey().then(n=>r?(this.logOnce("WebCrypto AES decrypt"),new Pw(r,new Uint8Array(s)).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(ie.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,s)))}onWebCryptoError(e,t,s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%Ow;return s!==e.length&&(t=ir(e,0,s),this.remainderData=ir(e,s)),t}logOnce(e){this.logEnabled&&(ie.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Nw={toString:function(i){let e="";const t=i.length;for(let s=0;s<t;s++)e+=`[${i.start(s).toFixed(3)}-${i.end(s).toFixed(3)}]`;return e}},ve={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Ac extends ww{constructor(e,t,s,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=ve.STOPPED,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.loadedmetadata=!1,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.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=ie.log.bind(ie,`${r}:`),this.warn=ie.warn.bind(ie,`${r}:`),this.hls=e,this.fragmentLoader=new kw(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new wc(e.config),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ve.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const s=t.partList;if(s!=null&&s.length){const n=s[s.length-1];return mt.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const s=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),s.addEventListener("seeking",this.onvseeking),s.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===ve.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:s,mediaBuffer:r,state:n}=this,a=s?s.currentTime:0,o=mt.bufferInfo(r||s,a,e.maxBufferHole);if(this.log(`media seeking to ${_e(a)?a.toFixed(3):a}, state: ${n}`),this.state===ve.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,u=t.start-l,d=t.start+t.duration+l;if(!o.len||d<o.start||u>o.end){const f=a>d;(a<u||f)&&(f&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}s&&(this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0),this.lastCurrentTime=a),!this.loadedmetadata&&!o.len&&(this.nextLoadPosition=this.startPosition=a),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=ve.STOPPED,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,s){this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,s,r).then(n=>{if(!n)return;const a=this.state;if(this.fragContextChanged(e)){(a===ve.FRAG_LOADING||!this.fragCurrent&&a===ve.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=ve.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(C.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===ve.STOPPED||this.state===ve.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===Ot.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength);this.reduceMaxBufferLength(o)&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===Ot.PARTIAL&&s.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)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:s};this.hls.trigger(C.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{if(!s||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:r}=this,{payload:n}=s,a=e.decryptdata;if(n&&n.byteLength>0&&a!=null&&a.key&&a.iv&&a.method==="AES-128"){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer).catch(l=>{throw r.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const u=self.performance.now();return r.trigger(C.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:o,tdecrypt:u}}),s.payload=l,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===ve.STOPPED||this.state===ve.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state=ve.IDLE,e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var s,r,n,a;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===He.MAIN?"level":"track"} ${e.level} (frag:[${((s=e.startPTS)!=null?s:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${o?Nw.toString(mt.getBuffered(o)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==He.SUBTITLE){const d=e.elementaryStreams;if(!Object.keys(d).some(f=>!!d[f])){this.state=ve.IDLE;return}}const u=(l=this.levels)==null?void 0:l[e.level];u!=null&&u.fragmentError&&(this.log(`Resetting level fragment error count of ${u.fragmentError} on frag buffered`),u.fragmentError=0)}this.state=ve.IDLE,o&&(!this.loadedmetadata&&e.type==He.MAIN&&o.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((a=this.fragPrevious)==null?void 0:a.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:r,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new Tc(s.level,s.sn,s.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,r){var n;const a=t==null?void 0:t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=ve.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(C.KEY_LOADED,d),this.state===ve.KEY_LOADING&&(this.state=ve.IDLE),d}),this.hls.trigger(C.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(e,a.encryptedFragments),s=Math.max(e.start,s||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const d=a.partList;if(d&&r){s>e.end&&a.fragmentHint&&(e=a.fragmentHint);const f=this.getNextPart(d,e,s);if(f>-1){const g=d[f];this.log(`Loading part sn: ${e.sn} p: ${g.index} cc: ${e.cc} of playlist [${a.startSN}-${a.endSN}] parts [0-${f}-${d.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=g.start+g.duration,this.state=ve.FRAG_LOADING;let v;return o?v=o.then(y=>!y||this.fragContextChanged(y.frag)?null:this.doFragPartsLoad(e,g,t,r)).catch(y=>this.handleFragLoadError(y)):v=this.doFragPartsLoad(e,g,t,r).catch(y=>this.handleFragLoadError(y)),this.hls.trigger(C.FRAG_LOADING,{frag:e,part:g,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):v}else if(!e.url||this.loadedEndOfParts(d,s))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${a?"of ["+a.startSN+"-"+a.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),_e(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ve.FRAG_LOADING;const l=this.config.progressive;let u;return l&&o?u=o.then(d=>!d||this.fragContextChanged(d==null?void 0:d.frag)?null:this.fragmentLoader.load(e,r)).catch(d=>this.handleFragLoadError(d)):u=Promise.all([this.fragmentLoader.load(e,l?r:void 0),o]).then(([d])=>(!l&&d&&r&&r(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(C.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):u}doFragPartsLoad(e,t,s,r){return new Promise((n,a)=>{var o;const l=[],u=(o=s.details)==null?void 0:o.partList,d=f=>{this.fragmentLoader.loadPart(e,f,r).then(g=>{l[f.index]=g;const v=g.part;this.hls.trigger(C.FRAG_LOADED,g);const y=id(s,e.sn,f.index+1)||Jp(u,e.sn,f.index+1);if(y)d(y);else return n({frag:e,part:v,partsLoaded:l})}).catch(a)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===ce.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(C.ERROR,t)}else this.hls.trigger(C.ERROR,{type:je.OTHER_ERROR,details:ce.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==ve.PARSING){!this.fragCurrent&&this.state!==ve.STOPPED&&this.state!==ve.ERROR&&(this.state=ve.IDLE);return}const{frag:s,part:r,level:n}=t,a=self.performance.now();s.stats.parsing.end=a,r&&(r.stats.parsing.end=a),this.updateLevelTiming(s,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:r,sn:n,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const o=t[r],l=a>-1?id(o,n,a):null,u=l?l.fragment:aw(o,n,s);return u?(s&&s!==u&&(u.stats=s.stats),{frag:u,part:l,level:o}):null}bufferFragmentData(e,t,s,r,n){var a;if(!e||this.state!==ve.PARSING)return;const{data1:o,data2:l}=e;let u=o;if(o&&l&&(u=bs(o,l)),!((a=u)!=null&&a.length))return;const d={type:e.type,frag:t,part:s,chunkMeta:r,parent:t.type,data:u};if(this.hls.trigger(C.BUFFER_APPENDING,d),e.dropped&&e.independent&&!s){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!mt.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,r=mt.bufferInfo(t,s,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,r.end-a),s+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const s=this.getLoadPosition();return _e(s)?this.getFwdBufferInfoAtPos(e,s,t):null}getFwdBufferInfoAtPos(e,t,s){const{config:{maxBufferHole:r}}=this,n=mt.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,s);if(a&&n.nextStart<a.end)return mt.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,s=e||t.maxBufferLength;return t.maxMaxBufferLength>=s?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=He.MAIN){const s=this.fragmentTracker.getAppendedFrag(e,He.MAIN);return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,r=s.length;if(!r)return null;const{config:n}=this,a=s[0].start;let o;if(t.live){const l=n.initialLiveManifestSize;if(r<l)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a)&&(o=this.getInitialLiveFragment(t,s),this.startPosition=this.nextLoadPosition=o?this.hls.liveSyncPosition||o.start:e)}else e<=a&&(o=s[0]);if(!o){const l=n.lowLatencyMode?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(o)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===Ot.OK||s===Ot.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,r,n){const a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,a&&e&&!e.gap&&s.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,r);if(l!==null&&s.len+l.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let r=-1,n=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const u=e[o];if(a=a&&!u.independent,r>-1&&s<u.start)break;const d=u.loaded;d?r=-1:(n||u.independent||a)&&u.fragment===t&&(r=o),n=d}return r}loadedEndOfParts(e,t){const s=e[e.length-1];return s&&t>s.start&&s.loaded}getInitialLiveFragment(e,t){const s=this.fragPrevious;let r=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),r=lw(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=s.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];s.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=uw(t,s.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,s){const{config:r}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=s;const{fragmentHint:l}=s,u=r.maxFragLookUpTolerance,d=s.partList,f=!!(r.lowLatencyMode&&d!=null&&d.length&&l);f&&l&&!this.bitrateTest&&(a=a.concat(l),o=l.sn);let g;if(e<t){const v=e>t-u?0:u;g=za(n,a,e,v)}else g=a[a.length-1];if(g){const v=g.sn-s.startSN,y=this.fragmentTracker.getState(g);if((y===Ot.OK||y===Ot.PARTIAL&&g.gap)&&(n=g),n&&g.sn===n.sn&&(!f||d[0].fragment.sn>g.sn)&&n&&g.level===n.level){const b=a[v+1];g.sn<o&&this.fragmentTracker.getState(b)!==Ot.OK?g=b:g=null}}return g}synchronizeToLiveEdge(e){const{config:t,media:s}=this;if(!s)return;const r=this.hls.liveSyncPosition,n=s.currentTime,a=e.fragments[0].start,o=e.edge,l=n>=a-t.maxFragLookUpTolerance&&n<=o;if(r!==null&&s.duration>r&&(n<r||!l)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&s.readyState<4||n<o-u)&&(this.loadedmetadata||(this.nextLoadPosition=r),s.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r.toFixed(3)}`),s.currentTime=r))}}alignPlaylists(e,t,s){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,a=!t,o=e.alignedSliding&&_e(n);if(a||!o&&!n){const{fragPrevious:l}=this;_w(l,s,e);const u=e.fragments[0].start;return this.log(`Live playlist sliding: ${u.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${r}`),u}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;if(s<t&&(s=-1),s===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&_e(n)?(s=t+n,n<0&&(s+=e.totalduration),s=Math.min(Math.max(t,s),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${s}`),this.startPosition=s):e.live?s=this.hls.liveSyncPosition||t:this.startPosition=s=0,this.lastCurrentTime=s}this.nextLoadPosition=s}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==ve.FRAG_LOADING_WAITING_RETRY)&&(this.state=ve.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const d=this.getCurrentContext(t.chunkMeta);d&&(t.frag=d.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var r;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===ce.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(s,!0);const a=t.errorAction,{action:o,retryCount:l=0,retryConfig:u}=a||{};if(a&&o===Ht.RetryRequest&&u){this.resetStartWhenNotLoaded(this.levelLastLoaded);const d=Ec(u,l);this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${l+1}/${u.maxNumRetry} in ${d}ms`),a.resolved=!0,this.retryDate=self.performance.now()+d,this.state=ve.FRAG_LOADING_WAITING_RETRY}else if(u&&a)if(this.resetFragmentErrors(e),l<u.maxNumRetry)!n&&o!==Ht.RemoveAlternatePermanently&&(a.resolved=!0);else{ie.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(a==null?void 0:a.action)===Ht.SendAlternateToPenaltyBox?this.state=ve.WAITING_LEVEL:this.state=ve.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===ve.PARSING||this.state===ve.PARSED){const t=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,t),r=s&&s.len>.5;r&&this.reduceMaxBufferLength(s.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===He.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==ve.STOPPED&&(this.state=ve.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const r=mt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,s),this.state===ve.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=ve.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,r){var n;const a=s.details;if(!a){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,u)=>{const d=e.elementaryStreams[u];if(d){const f=d.endPTS-d.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${f})`),l||!1;const g=r?0:Xp(a,e,d.startPTS,d.endPTS,d.startDTS,d.endDTS);return this.hls.trigger(C.LEVEL_PTS_UPDATED,{details:a,level:s,drift:g,type:u,frag:e,start:d.startPTS,end:d.endPTS}),!0}return l},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(s.fragmentError===0&&(s.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=ve.PARSED,this.hls.trigger(C.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class ig{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=Bw(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function Bw(i,e){const t=new Uint8Array(e);let s=0;for(let r=0;r<i.length;r++){const n=i[r];t.set(n,s),s+=n.length}return t}function $w(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Uw(){const i=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(i);return{worker:new self.Worker(e),objectURL:e}}function Gw(i){const e=new self.URL(i,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function qs(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Lc{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,s,r){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,s){}demux(e,t){this.cachedData&&(e=bs(this.cachedData,e),this.cachedData=null);let s=In(e,0),r=s?s.length:0,n;const a=this._audioTrack,o=this._id3Track,l=s?Sc(s):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&_e(l))&&(this.basePTS=Vw(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:ks.audioId3,duration:Number.POSITIVE_INFINITY});r<u;){if(this.canParse(e,r)){const d=this.appendFrame(a,e,r);d?(this.frameIndex++,this.lastPTS=d.sample.pts,r+=d.length,n=r):r=u}else hT(e,r)?(s=In(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:ks.audioId3,duration:Number.POSITIVE_INFINITY}),r+=s.length,n=r):r++;if(r===u&&n!==u){const d=ir(e,n);this.cachedData?this.cachedData=bs(this.cachedData,d):this.cachedData=d}}return{audioTrack:a,videoTrack:qs(),id3Track:o,textTrack:qs()}}demuxSampleAes(e,t,s){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:qs(),id3Track:this._id3Track,textTrack:qs()}}destroy(){}}const Vw=(i,e,t)=>{if(_e(i))return i*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};function Hw(i,e,t,s){let r,n,a,o;const l=navigator.userAgent.toLowerCase(),u=s,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const f=(e[t+2]&60)>>>2;if(f>d.length-1){const g=new Error(`invalid ADTS sampling index:${f}`);i.emit(C.ERROR,C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!0,error:g,reason:g.message});return}return a=(e[t+2]&1)<<2,a|=(e[t+3]&192)>>>6,ie.log(`manifest codec:${s}, ADTS type:${r}, samplingIndex:${f}`),/firefox/i.test(l)?f>=6?(r=5,o=new Array(4),n=f-3):(r=2,o=new Array(2),n=f):l.indexOf("android")!==-1?(r=2,o=new Array(2),n=f):(r=5,o=new Array(4),s&&(s.indexOf("mp4a.40.29")!==-1||s.indexOf("mp4a.40.5")!==-1)||!s&&f>=6?n=f-3:((s&&s.indexOf("mp4a.40.2")!==-1&&(f>=6&&a===1||/vivaldi/i.test(l))||!s&&a===1)&&(r=2,o=new Array(2)),n=f)),o[0]=r<<3,o[0]|=(f&14)>>1,o[1]|=(f&1)<<7,o[1]|=a<<3,r===5&&(o[1]|=(n&14)>>1,o[2]=(n&1)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:d[f],channelCount:a,codec:"mp4a.40."+r,manifestCodec:u}}function rg(i,e){return i[e]===255&&(i[e+1]&246)===240}function ng(i,e){return i[e+1]&1?7:9}function Cc(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function jw(i,e){return e+5<i.length}function qa(i,e){return e+1<i.length&&rg(i,e)}function Kw(i,e){return jw(i,e)&&rg(i,e)&&Cc(i,e)<=i.length-e}function zw(i,e){if(qa(i,e)){const t=ng(i,e);if(e+t>=i.length)return!1;const s=Cc(i,e);if(s<=t)return!1;const r=e+s;return r===i.length||qa(i,r)}return!1}function ag(i,e,t,s,r){if(!i.samplerate){const n=Hw(e,t,s,r);if(!n)return;i.config=n.config,i.samplerate=n.samplerate,i.channelCount=n.channelCount,i.codec=n.codec,i.manifestCodec=n.manifestCodec,ie.log(`parsed codec:${i.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function og(i){return 1024*9e4/i}function Ww(i,e){const t=ng(i,e);if(e+t<=i.length){const s=Cc(i,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function lg(i,e,t,s,r){const n=og(i.samplerate),a=s+r*n,o=Ww(e,t);let l;if(o){const{frameLength:f,headerLength:g}=o,v=g+f,y=Math.max(0,t+v-e.length);y?(l=new Uint8Array(v-g),l.set(e.subarray(t+g,e.length),0)):l=e.subarray(t+g,t+v);const E={unit:l,pts:a};return y||i.samples.push(E),{sample:E,length:v,missing:y}}const u=e.length-t;return l=new Uint8Array(u),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:u,missing:-1}}let ca=null;const qw=[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],Yw=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Xw=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Qw=[0,1,1,4];function cg(i,e,t,s,r){if(t+24>e.length)return;const n=ug(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=s+r*a,l={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return i.config=[],i.channelCount=n.channelCount,i.samplerate=n.sampleRate,i.samples.push(l),{sample:l,length:n.frameLength,missing:0}}}function ug(i,e){const t=i[e+1]>>3&3,s=i[e+1]>>1&3,r=i[e+2]>>4&15,n=i[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const a=i[e+2]>>1&1,o=i[e+3]>>6,l=t===3?3-s:s===3?3:4,u=qw[l*14+r-1]*1e3,f=Yw[(t===3?0:t===2?1:2)*3+n],g=o===3?1:2,v=Xw[t][s],y=Qw[s],E=v*8*y,b=Math.floor(v*u/f+a)*y;if(ca===null){const k=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ca=k?parseInt(k[1]):0}return!!ca&&ca<=87&&s===2&&u>=224e3&&o===0&&(i[e+3]=i[e+3]|128),{sampleRate:f,channelCount:g,frameLength:b,samplesPerFrame:E}}}function Rc(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function hg(i,e){return e+1<i.length&&Rc(i,e)}function Jw(i,e){return Rc(i,e)&&4<=i.length-e}function dg(i,e){if(e+1<i.length&&Rc(i,e)){const s=ug(i,e);let r=4;s!=null&&s.frameLength&&(r=s.frameLength);const n=e+r;return n===i.length||hg(i,n)}return!1}class Zw extends Lc{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=In(e,0);let s=(t==null?void 0:t.length)||0;if(dg(e,s))return!1;for(let r=e.length;s<r;s++)if(zw(e,s))return ie.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Kw(e,t)}appendFrame(e,t,s){ag(e,this.observer,t,s,e.manifestCodec);const r=lg(e,t,s,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const eA=/\/emsg[-/]ID3/i;class tA{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,s,r){const n=this.videoTrack=qs("video",1),a=this.audioTrack=qs("audio",1),o=this.txtTrack=qs("text",1);if(this.id3Track=qs("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=Vp(e);if(l.video){const{id:u,timescale:d,codec:f}=l.video;n.id=u,n.timescale=o.timescale=d,n.codec=f}if(l.audio){const{id:u,timescale:d,codec:f}=l.audio;a.id=u,a.timescale=d,a.codec=f}o.id=$p.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return ST(e)}demux(e,t){this.timeOffset=t;let s=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=bs(this.remainderData,e));const o=RT(s);this.remainderData=o.remainder,r.samples=o.valid||new Uint8Array}else r.samples=s;const a=this.extractID3Track(r,t);return n.samples=Bh(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,s=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return s.samples=Bh(e,t),{videoTrack:t,audioTrack:qs(),id3Track:r,textTrack:qs()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const r=Qe(e.samples,["emsg"]);r&&r.forEach(n=>{const a=kT(n);if(eA.test(a.schemeIdUri)){const o=_e(a.presentationTime)?a.presentationTime/a.timeScale:t+a.presentationTimeDelta/a.timeScale;let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const u=a.payload;s.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:ks.emsg,duration:l})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const fg=(i,e)=>{let t=0,s=5;e+=s;const r=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=i[e];const o=Math.min(s,8),l=8-o;n[0]=4278190080>>>24+l<<l,r[0]=(a[0]&n[0])>>l,t=t?t<<o|r[0]:r[0],e+=1,s-=o}return t};class sA extends Lc{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,s){const r=pg(e,t,s,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=In(e,0);if(!t)return!1;const s=t.length;return e[s]===11&&e[s+1]===119&&Sc(t)!==void 0&&fg(e,s)<16}}function pg(i,e,t,s,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const o=[48e3,44100,32e3][n],l=e[t+4]&63,d=[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][l*3+n]*2;if(t+d>e.length)return-1;const f=e[t+6]>>5;let g=0;f===2?g+=2:(f&1&&f!==1&&(g+=2),f&4&&(g+=2));const v=(e[t+6]<<8|e[t+7])>>12-g&1,E=[2,1,2,3,3,4,4,5][f]+v,b=e[t+5]>>3,w=e[t+5]&7,F=new Uint8Array([n<<6|b<<1|w>>2,(w&3)<<6|f<<3|v<<2|l>>4,l<<4&224]),k=1536/o*9e4,U=s+r*k,N=e.subarray(t,t+d);return i.config=F,i.channelCount=E,i.samplerate=o,i.samples.push({unit:N,pts:U}),d}class iA{constructor(){this.VideoSample=null}createVideoSample(e,t,s,r){return{key:e,frame:!1,pts:t,dts:s,units:[],debug:r,length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,r;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const n=s.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,r=s.length;if(r){const n=s[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&ie.log(e.pts+"/"+e.dts+":"+e.debug)}}class dd{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,s=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(s,s+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>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 s=this.word>>>32-t;if(e>32&&ie.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<<t|this.readBits(t):s}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 this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,s=8,r;for(let n=0;n<e;n++)s!==0&&(r=this.readEG(),s=(t+r+256)%256),t=s===0?t:s}readSPS(){let e=0,t=0,s=0,r=0,n,a,o;const l=this.readUByte.bind(this),u=this.readBits.bind(this),d=this.readUEG.bind(this),f=this.readBoolean.bind(this),g=this.skipBits.bind(this),v=this.skipEG.bind(this),y=this.skipUEG.bind(this),E=this.skipScalingList.bind(this);l();const b=l();if(u(5),g(3),l(),y(),b===100||b===110||b===122||b===244||b===44||b===83||b===86||b===118||b===128){const te=d();if(te===3&&g(1),y(),y(),g(1),f())for(a=te!==3?8:12,o=0;o<a;o++)f()&&(o<6?E(16):E(64))}y();const w=d();if(w===0)d();else if(w===1)for(g(1),v(),v(),n=d(),o=0;o<n;o++)v();y(),g(1);const F=d(),k=d(),U=u(1);U===0&&g(1),g(1),f()&&(e=d(),t=d(),s=d(),r=d());let N=[1,1];if(f()&&f())switch(l()){case 1:N=[1,1];break;case 2:N=[12,11];break;case 3:N=[10,11];break;case 4:N=[16,11];break;case 5:N=[40,33];break;case 6:N=[24,11];break;case 7:N=[20,11];break;case 8:N=[32,11];break;case 9:N=[80,33];break;case 10:N=[18,11];break;case 11:N=[15,11];break;case 12:N=[64,33];break;case 13:N=[160,99];break;case 14:N=[4,3];break;case 15:N=[3,2];break;case 16:N=[2,1];break;case 255:{N=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((F+1)*16-e*2-t*2),height:(2-U)*(k+1)*16-(U?2:4)*(s+r),pixelRatio:N}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class rA extends iA{parseAVCPES(e,t,s,r,n){const a=this.parseAVCNALu(e,s.data);let o=this.VideoSample,l,u=!1;s.data=null,o&&a.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts,"")),a.forEach(d=>{var f;switch(d.type){case 1:{let E=!1;l=!0;const b=d.data;if(u&&b.length>4){const w=new dd(b).readSliceType();(w===2||w===4||w===7||w===9)&&(E=!0)}if(E){var g;(g=o)!=null&&g.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts,"")),o.frame=!0,o.key=E;break}case 5:l=!0,(f=o)!=null&&f.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts,"")),o.key=!0,o.frame=!0;break;case 6:{l=!0,jp(d.data,1,s.pts,t.samples);break}case 7:{var v,y;l=!0,u=!0;const E=d.data,w=new dd(E).readSPS();if(!e.sps||e.width!==w.width||e.height!==w.height||((v=e.pixelRatio)==null?void 0:v[0])!==w.pixelRatio[0]||((y=e.pixelRatio)==null?void 0:y[1])!==w.pixelRatio[1]){e.width=w.width,e.height=w.height,e.pixelRatio=w.pixelRatio,e.sps=[E],e.duration=n;const F=E.subarray(1,4);let k="avc1.";for(let U=0;U<3;U++){let N=F[U].toString(16);N.length<2&&(N="0"+N),k+=N}e.codec=k}break}case 8:l=!0,e.pps=[d.data];break;case 9:l=!0,e.audFound=!0,o&&this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts,"");break;case 12:l=!0;break;default:l=!1,o&&(o.debug+="unknown NAL "+d.type+" ");break}o&&l&&o.units.push(d)}),r&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}parseAVCNALu(e,t){const s=t.byteLength;let r=e.naluState||0;const n=r,a=[];let o=0,l,u,d,f=-1,g=0;for(r===-1&&(f=0,g=t[0]&31,r=0,o=1);o<s;){if(l=t[o++],!r){r=l?0:1;continue}if(r===1){r=l?0:2;continue}if(!l)r=3;else if(l===1){if(u=o-r-1,f>=0){const v={data:t.subarray(f,u),type:g};a.push(v)}else{const v=this.getLastNalUnit(e.samples);v&&(n&&o<=4-n&&v.state&&(v.data=v.data.subarray(0,v.data.byteLength-n)),u>0&&(v.data=bs(v.data,t.subarray(0,u)),v.state=0))}o<s?(d=t[o]&31,f=o,g=d,r=0):r=-1}else r=0}if(f>=0&&r>=0){const v={data:t.subarray(f,s),type:g,state:r};a.push(v)}if(a.length===0){const v=this.getLastNalUnit(e.samples);v&&(v.data=bs(v.data,t))}return e.naluState=r,a}}class nA{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new wc(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,s){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);r.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)})}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)s.set(e.subarray(n,n+16),r);return s}getAvcDecryptedUnit(e,t){const s=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(s.subarray(r,r+16),n);return e}decryptAvcSample(e,t,s,r,n){const a=Kp(n.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{n.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,r)})}decryptAvcSamples(e,t,s,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(s>=n.length);s++){const a=n[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,s,r,a),!this.decrypter.isSync()))return}}}}const Ft=188;class Oi{constructor(e,t,s){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._duration=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=s,this.videoParser=new rA}static probe(e){const t=Oi.syncOffset(e);return t>0&&ie.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let s=Math.min(Ft*5,t-Ft)+1,r=0;for(;r<s;){let n=!1,a=-1,o=0;for(let l=r;l<t;l+=Ft)if(e[l]===71&&(t-l===Ft||e[l+Ft]===71)){if(o++,a===-1&&(a=l,a!==0&&(s=Math.min(a+Ft*99,e.length-Ft)+1)),n||(n=Pl(e,l)===0),n&&o>1&&(a===0&&o>2||l+Ft>s))return a}else{if(o)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:$p[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Oi.createTrack("video"),this._audioTrack=Oi.createTrack("audio",r),this._id3Track=Oi.createTrack("id3"),this._txtTrack=Oi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s,this._duration=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,r=!1){s||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,u=this._txtTrack;let d=a.pid,f=a.pesData,g=o.pid,v=l.pid,y=o.pesData,E=l.pesData,b=null,w=this.pmtParsed,F=this._pmtId,k=e.length;if(this.remainderData&&(e=bs(this.remainderData,e),k=e.length,this.remainderData=null),k<Ft&&!r)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:u};const U=Math.max(0,Oi.syncOffset(e));k-=(k-U)%Ft,k<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,k,e.buffer.byteLength-k));let N=0;for(let j=U;j<k;j+=Ft)if(e[j]===71){const re=!!(e[j+1]&64),Q=Pl(e,j),le=(e[j+3]&48)>>4;let se;if(le>1){if(se=j+5+e[j+4],se===j+Ft)continue}else se=j+4;switch(Q){case d:re&&(f&&(n=Ir(f))&&this.videoParser.parseAVCPES(a,u,n,!1,this._duration),f={data:[],size:0}),f&&(f.data.push(e.subarray(se,j+Ft)),f.size+=j+Ft-se);break;case g:if(re){if(y&&(n=Ir(y)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n);break}y={data:[],size:0}}y&&(y.data.push(e.subarray(se,j+Ft)),y.size+=j+Ft-se);break;case v:re&&(E&&(n=Ir(E))&&this.parseID3PES(l,n),E={data:[],size:0}),E&&(E.data.push(e.subarray(se,j+Ft)),E.size+=j+Ft-se);break;case 0:re&&(se+=e[se]+1),F=this._pmtId=aA(e,se);break;case F:{re&&(se+=e[se]+1);const pe=oA(e,se,this.typeSupported,s);d=pe.videoPid,d>0&&(a.pid=d,a.segmentCodec=pe.segmentVideoCodec),g=pe.audioPid,g>0&&(o.pid=g,o.segmentCodec=pe.segmentAudioCodec),v=pe.id3Pid,v>0&&(l.pid=v),b!==null&&!w&&(ie.warn(`MPEG-TS PMT found at ${j} after unknown PID '${b}'. Backtracking to sync byte @${U} to parse all TS packets.`),b=null,j=U-188),w=this.pmtParsed=!0;break}case 17:case 8191:break;default:b=Q;break}}else N++;if(N>0){const j=new Error(`Found ${N} TS packet/s that do not start with 0x47`);this.observer.emit(C.ERROR,C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:j,reason:j.message})}a.pesData=f,o.pesData=y,l.pesData=E;const te={audioTrack:o,videoTrack:a,id3Track:l,textTrack:u};return r&&this.extractRemainingSamples(te),te}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={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:s,id3Track:r,textTrack:n}=e,a=s.pesData,o=t.pesData,l=r.pesData;let u;if(a&&(u=Ir(a))?(this.videoParser.parseAVCPES(s,n,u,!0,this._duration),s.pesData=null):s.pesData=a,o&&(u=Ir(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,u);break;case"mp3":this.parseMPEGPES(t,u);break;case"ac3":this.parseAC3PES(t,u);break}t.pesData=null}else o!=null&&o.size&&ie.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(u=Ir(l))?(this.parseID3PES(r,u),r.pesData=null):r.pesData=l}demuxSampleAes(e,t,s){const r=this.demux(e,s,!0,!this.config.progressive),n=this.sampleAes=new nA(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(s=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{s(e)}):s(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{s(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let s=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const f=r.missing,g=r.sample.unit.byteLength;if(f===-1)n=bs(r.sample.unit,n);else{const v=g-f;r.sample.unit.set(n.subarray(0,f),v),e.samples.push(r.sample),s=r.missing}}let a,o;for(a=s,o=n.length;a<o-1&&!qa(n,a);a++);if(a!==s){let f;const g=a<o-1;g?f=`AAC PES did not start with ADTS header,offset:${a}`:f="No ADTS header found in AAC PES";const v=new Error(f);if(ie.warn(`parsing error: ${f}`),this.observer.emit(C.ERROR,C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,levelRetry:g,error:v,reason:f}),!g)return}ag(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(r){const f=og(e.samplerate);l=r.sample.pts+f}else{ie.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,d;for(;a<o;)if(d=lg(e,n,a,l,u),a+=d.length,d.missing){this.aacOverFlow=d;break}else for(u++;a<o-1&&!qa(n,a);a++);}parseMPEGPES(e,t){const s=t.data,r=s.length;let n=0,a=0;const o=t.pts;if(o===void 0){ie.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<r;)if(hg(s,a)){const l=cg(e,s,a,o,n);if(l)a+=l.length,n++;else break}else a++}parseAC3PES(e,t){{const s=t.data,r=t.pts;if(r===void 0){ie.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=s.length;let a=0,o=0,l;for(;o<n&&(l=pg(e,s,o,r,a++))>0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){ie.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=Ct({},t,{type:this._videoTrack?ks.emsg:ks.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Pl(i,e){return((i[e+1]&31)<<8)+i[e+2]}function aA(i,e){return(i[e+10]&31)<<8|i[e+11]}function oA(i,e,t,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=(i[e+1]&15)<<8|i[e+2],a=e+3+n-4,o=(i[e+10]&15)<<8|i[e+11];for(e+=12+o;e<a;){const l=Pl(i,e),u=(i[e+3]&15)<<8|i[e+4];switch(i[e]){case 207:if(!s){Jo("ADTS AAC");break}case 15:r.audioPid===-1&&(r.audioPid=l);break;case 21:r.id3Pid===-1&&(r.id3Pid=l);break;case 219:if(!s){Jo("H.264");break}case 27:r.videoPid===-1&&(r.videoPid=l,r.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?ie.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=l,r.segmentAudioCodec="mp3");break;case 193:if(!s){Jo("AC-3");break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=l,r.segmentAudioCodec="ac3"):ie.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&u>0){let d=e+5,f=u;for(;f>2;){switch(i[d]){case 106:t.ac3!==!0?ie.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=l,r.segmentAudioCodec="ac3");break}const v=i[d+1]+2;d+=v,f-=v}}break;case 194:case 135:ie.warn("Unsupported EC-3 in M2TS found");break;case 36:ie.warn("Unsupported HEVC in M2TS found");break}e+=u+5}return r}function Jo(i){ie.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function Ir(i){let e=0,t,s,r,n,a;const o=i.data;if(!i||i.size===0)return null;for(;o[0].length<19&&o.length>1;)o[0]=bs(o[0],o[1]),o.splice(1,1);if(t=o[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(s=(t[4]<<8)+t[5],s&&s>i.size-6)return null;const u=t[7];u&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,u&64?(a=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-a>60*9e4&&(ie.warn(`${Math.round((n-a)/9e4)}s delta between PTS and DTS, align them`),n=a)):a=n),r=t[8];let d=r+9;if(i.size<=d)return null;i.size-=d;const f=new Uint8Array(i.size);for(let g=0,v=o.length;g<v;g++){t=o[g];let y=t.byteLength;if(d)if(d>y){d-=y;continue}else t=t.subarray(d),y-=d,d=0;f.set(t,e),e+=y}return s&&(s-=r+3),{data:f,pts:n,dts:a,len:s}}return null}class lA extends Lc{resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=In(e,0);let s=(t==null?void 0:t.length)||0;if(t&&e[s]===11&&e[s+1]===119&&Sc(t)!==void 0&&fg(e,s)<=16)return!1;for(let r=e.length;s<r;s++)if(dg(e,s))return ie.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Jw(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return cg(e,t,s,this.basePTS,this.frameIndex)}}class fd{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)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(t===6)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]);break;default:if(t===1)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(t===2)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(t===3)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]);break}}}const Di=Math.pow(2,32)-1;class oe{static init(){oe.types={avc1:[],avcC:[],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:[]};let e;for(e in oe.types)oe.types.hasOwnProperty(e)&&(oe.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]),s=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]);oe.HDLR_TYPES={video:t,audio:s};const r=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]);oe.STTS=oe.STSC=oe.STCO=n,oe.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),oe.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),oe.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),oe.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);oe.FTYP=oe.box(oe.types.ftyp,a,l,a,o),oe.DINF=oe.box(oe.types.dinf,oe.box(oe.types.dref,r))}static box(e,...t){let s=8,r=t.length;const n=r;for(;r--;)s+=t[r].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=s&255,a.set(e,4),r=0,s=8;r<n;r++)a.set(t[r],s),s+=t[r].byteLength;return a}static hdlr(e){return oe.box(oe.types.hdlr,oe.HDLR_TYPES[e])}static mdat(e){return oe.box(oe.types.mdat,e)}static mdhd(e,t){t*=e;const s=Math.floor(t/(Di+1)),r=Math.floor(t%(Di+1));return oe.box(oe.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,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return oe.box(oe.types.mdia,oe.mdhd(e.timescale,e.duration),oe.hdlr(e.type),oe.minf(e))}static mfhd(e){return oe.box(oe.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?oe.box(oe.types.minf,oe.box(oe.types.smhd,oe.SMHD),oe.DINF,oe.stbl(e)):oe.box(oe.types.minf,oe.box(oe.types.vmhd,oe.VMHD),oe.DINF,oe.stbl(e))}static moof(e,t,s){return oe.box(oe.types.moof,oe.mfhd(e),oe.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=oe.trak(e[t]);return oe.box.apply(null,[oe.types.moov,oe.mvhd(e[0].timescale,e[0].duration)].concat(s).concat(oe.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=oe.trex(e[t]);return oe.box.apply(null,[oe.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(Di+1)),r=Math.floor(t%(Di+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,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,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 oe.box(oe.types.mvhd,n)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,s[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return oe.box(oe.types.sdtp,s)}static stbl(e){return oe.box(oe.types.stbl,oe.stsd(e),oe.box(oe.types.stts,oe.STTS),oe.box(oe.types.stsc,oe.STSC),oe.box(oe.types.stsz,oe.STSZ),oe.box(oe.types.stco,oe.STCO))}static avc1(e){let t=[],s=[],r,n,a;for(r=0;r<e.sps.length;r++)n=e.sps[r],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],a=n.byteLength,s.push(a>>>8&255),s.push(a&255),s=s.concat(Array.prototype.slice.call(n));const o=oe.box(oe.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,u=e.height,d=e.pixelRatio[0],f=e.pixelRatio[1];return oe.box(oe.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,l>>8&255,l&255,u>>8&255,u&255,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,oe.box(oe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),oe.box(oe.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,f>>24,f>>16&255,f>>8&255,f&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return oe.box(oe.types.mp4a,oe.audioStsd(e),oe.box(oe.types.esds,oe.esds(e)))}static mp3(e){return oe.box(oe.types[".mp3"],oe.audioStsd(e))}static ac3(e){return oe.box(oe.types["ac-3"],oe.audioStsd(e),oe.box(oe.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?oe.box(oe.types.stsd,oe.STSD,oe.mp3(e)):e.segmentCodec==="ac3"?oe.box(oe.types.stsd,oe.STSD,oe.ac3(e)):oe.box(oe.types.stsd,oe.STSD,oe.mp4a(e)):oe.box(oe.types.stsd,oe.STSD,oe.avc1(e))}static tkhd(e){const t=e.id,s=e.duration*e.timescale,r=e.width,n=e.height,a=Math.floor(s/(Di+1)),o=Math.floor(s%(Di+1));return oe.box(oe.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,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,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,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const s=oe.sdtp(e),r=e.id,n=Math.floor(t/(Di+1)),a=Math.floor(t%(Di+1));return oe.box(oe.types.traf,oe.box(oe.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),oe.box(oe.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),oe.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,oe.box(oe.types.trak,oe.tkhd(e),oe.mdia(e))}static trex(e){const t=e.id;return oe.box(oe.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],r=s.length,n=12+16*r,a=new Uint8Array(n);let o,l,u,d,f,g;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<r;o++)l=s[o],u=l.duration,d=l.size,f=l.flags,g=l.cts,a.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,g>>>24&255,g>>>16&255,g>>>8&255,g&255],12+16*o);return oe.box(oe.types.trun,a)}static initSegment(e){oe.types||oe.init();const t=oe.moov(e);return bs(oe.FTYP,t)}}oe.types=void 0;oe.HDLR_TYPES=void 0;oe.STTS=void 0;oe.STSC=void 0;oe.STCO=void 0;oe.STSZ=void 0;oe.VMHD=void 0;oe.SMHD=void 0;oe.STSD=void 0;oe.FTYP=void 0;oe.DINF=void 0;const gg=9e4;function _c(i,e,t=1,s=!1){const r=i*e*t;return s?Math.round(r):r}function cA(i,e,t=1,s=!1){return _c(i,e,1/t,s)}function hn(i,e=!1){return _c(i,1e3,1/gg,e)}function uA(i,e=1){return _c(i,gg,1/e)}const hA=10*1e3,pd=1024,dA=1152,fA=1536;let kr=null,Zo=null;class Ta{constructor(e,t,s,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,kr===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);kr=a?parseInt(a[1]):0}if(Zo===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);Zo=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){ie.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){ie.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){ie.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e.reduce((r,n)=>{const a=n.pts-r;return a<-4294967296?(t=!0,Es(r,n.pts)):a>0?r:n.pts},e[0].pts);return t&&ie.debug("PTS rollover detected"),s}remux(e,t,s,r,n,a,o,l){let u,d,f,g,v,y,E=n,b=n;const w=e.pid>-1,F=t.pid>-1,k=t.samples.length,U=e.samples.length>0,N=o&&k>0||k>1;if((!w||U)&&(!F||N)||this.ISGenerated||o){if(this.ISGenerated){var j,re,Q,le;const be=this.videoTrackConfig;be&&(t.width!==be.width||t.height!==be.height||((j=t.pixelRatio)==null?void 0:j[0])!==((re=be.pixelRatio)==null?void 0:re[0])||((Q=t.pixelRatio)==null?void 0:Q[1])!==((le=be.pixelRatio)==null?void 0:le[1]))&&this.resetInitSegment()}else f=this.generateIS(e,t,n,a);const se=this.isVideoContiguous;let pe=-1,de;if(N&&(pe=pA(t.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(y=!0,pe>0){ie.warn(`[mp4-remuxer]: Dropped ${pe} out of ${k} video samples due to a missing keyframe`);const be=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(pe),t.dropped+=pe,b+=(t.samples[0].pts-be)/t.inputTimeScale,de=b}else pe===-1&&(ie.warn(`[mp4-remuxer]: No keyframe found out of ${k} video samples`),y=!1);if(this.ISGenerated){if(U&&N){const be=this.getVideoStartPts(t.samples),ue=(Es(e.samples[0].pts,be)-be)/t.inputTimeScale;E+=Math.max(0,ue),b+=Math.max(0,-ue)}if(U){if(e.samplerate||(ie.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,n,a)),d=this.remuxAudio(e,E,this.isAudioContiguous,a,F||N||l===He.AUDIO?b:void 0),N){const be=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(ie.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),f=this.generateIS(e,t,n,a)),u=this.remuxVideo(t,b,se,be)}}else N&&(u=this.remuxVideo(t,b,se,0));u&&(u.firstKeyFrame=pe,u.independent=pe!==-1,u.firstKeyFramePTS=de)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(v=mg(s,n,this._initPTS,this._initDTS)),r.samples.length&&(g=vg(r,n,this._initPTS))),{audio:d,video:u,initSegment:f,independent:y,text:g,id3:v}}generateIS(e,t,s,r){const n=e.samples,a=t.samples,o=this.typeSupported,l={},u=this._initPTS;let d=!u||r,f="audio/mp4",g,v,y;if(d&&(g=v=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):oe.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(y=e.inputTimeScale,!u||y!==u.timescale?g=v=n[0].pts-Math.round(y*s):d=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:oe.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(y=t.inputTimeScale,!u||y!==u.timescale){const E=this.getVideoStartPts(a),b=Math.round(y*s);v=Math.min(v,Es(a[0].dts,E)-b),g=Math.min(g,E-b)}else d=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:g,timescale:y},this._initDTS={baseTime:v,timescale:y}):g=y=void 0,{tracks:l,initPTS:g,timescale:y}}remuxVideo(e,t,s,r){const n=e.inputTimeScale,a=e.samples,o=[],l=a.length,u=this._initPTS;let d=this.nextAvcDts,f=8,g=this.videoSampleDuration,v,y,E=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,w=!1;if(!s||d===null){const me=t*n,ye=a[0].pts-Es(a[0].dts,a[0].pts);kr&&d!==null&&Math.abs(me-ye-d)<15e3?s=!0:d=me-ye}const F=u.baseTime*n/u.timescale;for(let me=0;me<l;me++){const ye=a[me];ye.pts=Es(ye.pts-F,d),ye.dts=Es(ye.dts-F,d),ye.dts<a[me>0?me-1:me].dts&&(w=!0)}w&&a.sort(function(me,ye){const Ve=me.dts-ye.dts,$e=me.pts-ye.pts;return Ve||$e}),v=a[0].dts,y=a[a.length-1].dts;const k=y-v,U=k?Math.round(k/(l-1)):g||e.inputTimeScale/30;if(s){const me=v-d,ye=me>U,Ve=me<-1;if((ye||Ve)&&(ye?ie.warn(`AVC: ${hn(me,!0)} ms (${me}dts) hole between fragments detected at ${t.toFixed(3)}`):ie.warn(`AVC: ${hn(-me,!0)} ms (${me}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Ve||d>=a[0].pts||kr)){v=d;const $e=a[0].pts-me;if(ye)a[0].dts=v,a[0].pts=$e;else for(let Xe=0;Xe<a.length&&!(a[Xe].dts>$e);Xe++)a[Xe].dts-=me,a[Xe].pts-=me;ie.log(`Video: Initial PTS/DTS adjusted: ${hn($e,!0)}/${hn(v,!0)}, delta: ${hn(me,!0)} ms`)}}v=Math.max(0,v);let N=0,te=0,j=v;for(let me=0;me<l;me++){const ye=a[me],Ve=ye.units,$e=Ve.length;let Xe=0;for(let st=0;st<$e;st++)Xe+=Ve[st].data.length;te+=Xe,N+=$e,ye.length=Xe,ye.dts<j?(ye.dts=j,j+=U/4|0||1):j=ye.dts,E=Math.min(ye.pts,E),b=Math.max(ye.pts,b)}y=a[l-1].dts;const re=te+4*N+8;let Q;try{Q=new Uint8Array(re)}catch(me){this.observer.emit(C.ERROR,C.ERROR,{type:je.MUX_ERROR,details:ce.REMUX_ALLOC_ERROR,fatal:!1,error:me,bytes:re,reason:`fail allocating video mdat ${re}`});return}const le=new DataView(Q.buffer);le.setUint32(0,re),Q.set(oe.types.mdat,4);let se=!1,pe=Number.POSITIVE_INFINITY,de=Number.POSITIVE_INFINITY,be=Number.NEGATIVE_INFINITY,Le=Number.NEGATIVE_INFINITY;for(let me=0;me<l;me++){const ye=a[me],Ve=ye.units;let $e=0;for(let et=0,rt=Ve.length;et<rt;et++){const Je=Ve[et],vt=Je.data,Pt=Je.data.byteLength;le.setUint32(f,Pt),f+=4,Q.set(vt,f),f+=Pt,$e+=4+Pt}let Xe;if(me<l-1)g=a[me+1].dts-ye.dts,Xe=a[me+1].pts-ye.pts;else{const et=this.config,rt=me>0?ye.dts-a[me-1].dts:U;if(Xe=me>0?ye.pts-a[me-1].pts:U,et.stretchShortVideoTrack&&this.nextAudioPts!==null){const Je=Math.floor(et.maxBufferHole*n),vt=(r?E+r*n:this.nextAudioPts)-ye.pts;vt>Je?(g=vt-rt,g<0?g=rt:se=!0,ie.log(`[mp4-remuxer]: It is approximately ${vt/90} ms to the next segment; using duration ${g/90} ms for the last video frame.`)):g=rt}else g=rt}const st=Math.round(ye.pts-ye.dts);pe=Math.min(pe,g),be=Math.max(be,g),de=Math.min(de,Xe),Le=Math.max(Le,Xe),o.push(new gd(ye.key,g,$e,st))}if(o.length){if(kr){if(kr<70){const me=o[0].flags;me.dependsOn=2,me.isNonSync=0}}else if(Zo&&Le-de<be-pe&&U/be<.025&&o[0].cts===0){ie.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let me=v;for(let ye=0,Ve=o.length;ye<Ve;ye++){const $e=me+o[ye].duration,Xe=me+o[ye].cts;if(ye<Ve-1){const st=$e+o[ye+1].cts;o[ye].duration=st-Xe}else o[ye].duration=ye?o[ye-1].duration:U;o[ye].cts=0,me=$e}}}g=se||!g?U:g,this.nextAvcDts=d=y+g,this.videoSampleDuration=g,this.isVideoContiguous=!0;const we={data1:oe.moof(e.sequenceNumber++,v,Ct({},e,{samples:o})),data2:Q,startPTS:E/n,endPTS:(b+g)/n,startDTS:v/n,endDTS:d/n,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,we}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return dA;case"ac3":return fA;default:return pd}}remuxAudio(e,t,s,r,n){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,u=this.getSamplesPerFrame(e),d=u*l,f=this._initPTS,g=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,v=[],y=n!==void 0;let E=e.samples,b=g?0:8,w=this.nextAudioPts||-1;const F=t*a,k=f.baseTime*a/f.timescale;if(this.isAudioContiguous=s=s||E.length&&w>0&&(r&&Math.abs(F-w)<9e3||Math.abs(Es(E[0].pts-k,F)-w)<20*d),E.forEach(function(ue){ue.pts=Es(ue.pts-k,F)}),!s||w<0){if(E=E.filter(ue=>ue.pts>=0),!E.length)return;n===0?w=0:r&&!y?w=Math.max(0,F):w=E[0].pts}if(e.segmentCodec==="aac"){const ue=this.config.maxAudioFramesDrift;for(let he=0,we=w;he<E.length;he++){const me=E[he],ye=me.pts,Ve=ye-we,$e=Math.abs(1e3*Ve/a);if(Ve<=-ue*d&&y)he===0&&(ie.warn(`Audio frame @ ${(ye/a).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Ve/a)} ms.`),this.nextAudioPts=w=we=ye);else if(Ve>=ue*d&&$e<hA&&y){let Xe=Math.round(Ve/d);we=ye-Xe*d,we<0&&(Xe--,we+=d),he===0&&(this.nextAudioPts=w=we),ie.warn(`[mp4-remuxer]: Injecting ${Xe} audio frame @ ${(we/a).toFixed(3)}s due to ${Math.round(1e3*Ve/a)} ms gap.`);for(let st=0;st<Xe;st++){const et=Math.max(we,0);let rt=fd.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);rt||(ie.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),rt=me.unit.subarray()),E.splice(he,0,{unit:rt,pts:et}),we+=d,he++}}me.pts=we,we+=d}}let U=null,N=null,te,j=0,re=E.length;for(;re--;)j+=E[re].unit.byteLength;for(let ue=0,he=E.length;ue<he;ue++){const we=E[ue],me=we.unit;let ye=we.pts;if(N!==null){const $e=v[ue-1];$e.duration=Math.round((ye-N)/l)}else if(s&&e.segmentCodec==="aac"&&(ye=w),U=ye,j>0){j+=b;try{te=new Uint8Array(j)}catch($e){this.observer.emit(C.ERROR,C.ERROR,{type:je.MUX_ERROR,details:ce.REMUX_ALLOC_ERROR,fatal:!1,error:$e,bytes:j,reason:`fail allocating audio mdat ${j}`});return}g||(new DataView(te.buffer).setUint32(0,j),te.set(oe.types.mdat,4))}else return;te.set(me,b);const Ve=me.byteLength;b+=Ve,v.push(new gd(!0,u,Ve,0)),N=ye}const Q=v.length;if(!Q)return;const le=v[v.length-1];this.nextAudioPts=w=N+l*le.duration;const se=g?new Uint8Array(0):oe.moof(e.sequenceNumber++,U/l,Ct({},e,{samples:v}));e.samples=[];const pe=U/a,de=w/a,Le={data1:se,data2:te,startPTS:pe,endPTS:de,startDTS:pe,endDTS:de,type:"audio",hasAudio:!0,hasVideo:!1,nb:Q};return this.isAudioContiguous=!0,Le}remuxEmptyAudio(e,t,s,r){const n=e.inputTimeScale,a=e.samplerate?e.samplerate:n,o=n/a,l=this.nextAudioPts,u=this._initDTS,d=u.baseTime*9e4/u.timescale,f=(l!==null?l:r.startDTS*n)+d,g=r.endDTS*n+d,v=o*pd,y=Math.ceil((g-f)/v),E=fd.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(ie.warn("[mp4-remuxer]: remux empty Audio"),!E){ie.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const b=[];for(let w=0;w<y;w++){const F=f+w*v;b.push({unit:E,pts:F,dts:F})}return e.samples=b,this.remuxAudio(e,t,s,!1)}}function Es(i,e){let t;if(e===null)return i;for(e<i?t=-8589934592:t=8589934592;Math.abs(i-e)>4294967296;)i+=t;return i}function pA(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function mg(i,e,t,s){const r=i.samples.length;if(!r)return;const n=i.inputTimeScale;for(let o=0;o<r;o++){const l=i.samples[o];l.pts=Es(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=Es(l.dts-s.baseTime*n/s.timescale,e*n)/n}const a=i.samples;return i.samples=[],{samples:a}}function vg(i,e,t){const s=i.samples.length;if(!s)return;const r=i.inputTimeScale;for(let a=0;a<s;a++){const o=i.samples[a];o.pts=Es(o.pts-t.baseTime*r/t.timescale,e*r)/r}i.samples.sort((a,o)=>a.pts-o.pts);const n=i.samples;return i.samples=[],{samples:n}}class gd{constructor(e,t,s,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=s,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class gA{constructor(){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}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,s,r){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(TT(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=Vp(e);r.audio&&(t=md(r.audio,ht.AUDIO)),r.video&&(s=md(r.video,ht.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+s,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:s,initSegment:e,id:"main"}:ie.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,s,r,n,a){var o,l;let{initPTS:u,lastEndTime:d}=this;const f={audio:void 0,video:void 0,text:r,id3:s,initSegment:void 0};_e(d)||(d=this.lastEndTime=n||0);const g=t.samples;if(!(g!=null&&g.length))return f;const v={initPTS:void 0,timescale:1};let y=this.initData;if((o=y)!=null&&o.length||(this.generateInitSegment(g),y=this.initData),!((l=y)!=null&&l.length))return ie.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1);const E=AT(g,y),b=wT(y,g),w=b===null?n:b;(mA(u,w,n,E)||v.timescale!==u.timescale&&a)&&(v.initPTS=w-n,u&&u.timescale===1&&ie.warn(`Adjusting initPTS by ${v.initPTS-u.baseTime}`),this.initPTS=u={baseTime:v.initPTS,timescale:1});const F=e?w-u.baseTime/u.timescale:d,k=F+E;CT(y,g,u.baseTime/u.timescale),E>0?this.lastEndTime=k:(ie.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const U=!!y.audio,N=!!y.video;let te="";U&&(te+="audio"),N&&(te+="video");const j={data1:g,startPTS:F,startDTS:F,endPTS:k,endDTS:k,type:te,hasAudio:U,hasVideo:N,nb:1,dropped:0};return f.audio=j.type==="audio"?j:void 0,f.video=j.type!=="audio"?j:void 0,f.initSegment=v,f.id3=mg(s,n,u,u),r.samples.length&&(f.text=vg(r,n,u)),f}}function mA(i,e,t,s){if(i===null)return!0;const r=Math.max(s,1),n=e-i.baseTime/i.timescale;return Math.abs(n-t)>r}function md(i,e){const t=i==null?void 0:i.codec;if(t&&t.length>4)return t;if(e===ht.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return Va(t,!1);const s="mp4a.40.5";return ie.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${s}"`),s}return ie.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let mi;try{mi=self.performance.now.bind(self.performance)}catch{ie.debug("Unable to use Performance API on this environment"),mi=Br==null?void 0:Br.Date.now}const wa=[{demux:tA,remux:gA},{demux:Oi,remux:Ta},{demux:Zw,remux:Ta},{demux:lA,remux:Ta}];wa.splice(2,0,{demux:sA,remux:Ta});class vd{constructor(e,t,s,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=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=s,this.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,r){const n=s.transmuxing;n.executeStart=mi();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;r&&(this.currentTransmuxState=r);const{contiguous:u,discontinuity:d,trackSwitch:f,accurateTimeOffset:g,timeOffset:v,initSegmentChange:y}=r||o,{audioCodec:E,videoCodec:b,defaultInitPts:w,duration:F,initSegmentData:k}=l,U=vA(a,t);if(U&&U.method==="AES-128"){const re=this.getDecrypter();if(re.isSync()){let Q=re.softwareDecrypt(a,U.key.buffer,U.iv.buffer);if(s.part>-1&&(Q=re.flush()),!Q)return n.executeEnd=mi(),el(s);a=new Uint8Array(Q)}else return this.decryptionPromise=re.webCryptoDecrypt(a,U.key.buffer,U.iv.buffer).then(Q=>{const le=this.push(Q,null,s);return this.decryptionPromise=null,le}),this.decryptionPromise}const N=this.needsProbing(d,f);if(N){const re=this.configureTransmuxer(a);if(re)return ie.warn(`[transmuxer] ${re.message}`),this.observer.emit(C.ERROR,C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:re,reason:re.message}),n.executeEnd=mi(),el(s)}(d||f||y||N)&&this.resetInitSegment(k,E,b,F,t),(d||y||N)&&this.resetInitialTimestamp(w),u||this.resetContiguity();const te=this.transmux(a,U,v,g,s),j=this.currentTransmuxState;return j.contiguous=!0,j.discontinuity=!1,j.trackSwitch=!1,n.executeEnd=mi(),te}flush(e){const t=e.transmuxing;t.executeStart=mi();const{decrypter:s,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const a=[],{timeOffset:o}=r;if(s){const f=s.flush();f&&a.push(this.push(f,null,e))}const{demuxer:l,remuxer:u}=this;if(!l||!u)return t.executeEnd=mi(),[el(e)];const d=l.flush(o);return Aa(d)?d.then(f=>(this.flushRemux(a,f,e),a)):(this.flushRemux(a,d,e),a)}flushRemux(e,t,s){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:u}=this.currentTransmuxState;ie.log(`[transmuxer.ts]: Flushed fragment ${s.sn}${s.part>-1?" p: "+s.part:""} of level ${s.level}`);const d=this.remuxer.remux(r,n,a,o,u,l,!0,this.id);e.push({remuxResult:d,chunkMeta:s}),s.transmuxing.executeEnd=mi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,r,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,s,r),o.resetInitSegment(e,t,s,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,r,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,s,r,n):a=this.transmuxUnencrypted(e,s,r,n),a}transmuxUnencrypted(e,t,s,r){const{audioTrack:n,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,o,l,t,s,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,s,r,n){return this.demuxer.demuxSampleAes(e,t,s).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,s,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:r,vendor:n}=this;let a;for(let g=0,v=wa.length;g<v;g++){var o;if((o=wa[g].demux)!=null&&o.probe(e)){a=wa[g];break}}if(!a)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,u=this.remuxer,d=a.remux,f=a.demux;(!u||!(u instanceof d))&&(this.remuxer=new d(s,t,r,n)),(!l||!(l instanceof f))&&(this.demuxer=new f(s,t,r),this.probe=f.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new wc(this.config)),e}}function vA(i,e){let t=null;return i.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const el=i=>({remuxResult:{},chunkMeta:i});function Aa(i){return"then"in i&&i.then instanceof Function}class yA{constructor(e,t,s,r,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=s,this.duration=r,this.defaultInitPts=n||null}}class xA{constructor(e,t,s,r,n,a){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=s,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}}var yg={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function r(l,u,d){this.fn=l,this.context=u,this.once=d||!1}function n(l,u,d,f,g){if(typeof d!="function")throw new TypeError("The listener must be a function");var v=new r(d,f||l,g),y=t?t+u:u;return l._events[y]?l._events[y].fn?l._events[y]=[l._events[y],v]:l._events[y].push(v):(l._events[y]=v,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new s:delete l._events[u]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},o.prototype.listeners=function(u){var d=t?t+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var g=0,v=f.length,y=new Array(v);g<v;g++)y[g]=f[g].fn;return y},o.prototype.listenerCount=function(u){var d=t?t+u:u,f=this._events[d];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,d,f,g,v,y){var E=t?t+u:u;if(!this._events[E])return!1;var b=this._events[E],w=arguments.length,F,k;if(b.fn){switch(b.once&&this.removeListener(u,b.fn,void 0,!0),w){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,d),!0;case 3:return b.fn.call(b.context,d,f),!0;case 4:return b.fn.call(b.context,d,f,g),!0;case 5:return b.fn.call(b.context,d,f,g,v),!0;case 6:return b.fn.call(b.context,d,f,g,v,y),!0}for(k=1,F=new Array(w-1);k<w;k++)F[k-1]=arguments[k];b.fn.apply(b.context,F)}else{var U=b.length,N;for(k=0;k<U;k++)switch(b[k].once&&this.removeListener(u,b[k].fn,void 0,!0),w){case 1:b[k].fn.call(b[k].context);break;case 2:b[k].fn.call(b[k].context,d);break;case 3:b[k].fn.call(b[k].context,d,f);break;case 4:b[k].fn.call(b[k].context,d,f,g);break;default:if(!F)for(N=1,F=new Array(w-1);N<w;N++)F[N-1]=arguments[N];b[k].fn.apply(b[k].context,F)}}return!0},o.prototype.on=function(u,d,f){return n(this,u,d,f,!1)},o.prototype.once=function(u,d,f){return n(this,u,d,f,!0)},o.prototype.removeListener=function(u,d,f,g){var v=t?t+u:u;if(!this._events[v])return this;if(!d)return a(this,v),this;var y=this._events[v];if(y.fn)y.fn===d&&(!g||y.once)&&(!f||y.context===f)&&a(this,v);else{for(var E=0,b=[],w=y.length;E<w;E++)(y[E].fn!==d||g&&!y[E].once||f&&y[E].context!==f)&&b.push(y[E]);b.length?this._events[v]=b.length===1?b[0]:b:a(this,v)}return this},o.prototype.removeAllListeners=function(u){var d;return u?(d=t?t+u:u,this._events[d]&&a(this,d)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,i.exports=o})(yg);var SA=yg.exports,Ic=jb(SA);class xg{constructor(e,t,s,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=s,this.onFlush=r;const a=(d,f)=>{f=f||{},f.frag=this.frag,f.id=this.id,d===C.ERROR&&(this.error=f.error),this.hls.trigger(d,f)};this.observer=new Ic,this.observer.on(C.FRAG_DECRYPTED,a),this.observer.on(C.ERROR,a);const o=ar(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')},u=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||$w())){try{n.workerPath?(ie.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=Gw(n.workerPath)):(ie.log(`injecting Web Worker for "${t}"`),this.workerContext=Uw()),this.onwmsg=g=>this.onWorkerMessage(g);const{worker:f}=this.workerContext;f.addEventListener("message",this.onwmsg),f.onerror=g=>{const v=new Error(`${g.message} (${g.filename}:${g.lineno})`);n.enableWorker=!1,ie.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(C.ERROR,{type:je.OTHER_ERROR,details:ce.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:v})},f.postMessage({cmd:"init",typeSupported:l,vendor:u,id:t,config:JSON.stringify(n)})}catch(f){ie.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.resetWorker(),this.error=null,this.transmuxer=new vd(this.observer,l,n,u,t)}return}this.transmuxer=new vd(this.observer,l,n,u,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,s,r,n,a,o,l,u,d){var f,g;u.transmuxing.start=self.performance.now();const{transmuxer:v}=this,y=a?a.start:n.start,E=n.decryptdata,b=this.frag,w=!(b&&n.cc===b.cc),F=!(b&&u.level===b.level),k=b?u.sn-b.sn:-1,U=this.part?u.part-this.part.index:-1,N=k===0&&u.id>1&&u.id===(b==null?void 0:b.stats.chunkCount),te=!F&&(k===1||k===0&&(U===1||N&&U<=0)),j=self.performance.now();(F||k||n.stats.parsing.start===0)&&(n.stats.parsing.start=j),a&&(U||!te)&&(a.stats.parsing.start=j);const re=!(b&&((f=n.initSegment)==null?void 0:f.url)===((g=b.initSegment)==null?void 0:g.url)),Q=new xA(w,te,l,F,y,re);if(!te||w||re){ie.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${u.sn} p: ${u.part} level: ${u.level} id: ${u.id}
|
|
59
|
+
Switching to level ${se} @ ${pe|0} bps`),r.trigger(C.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:s,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(ie.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 dw(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.FRAG_LOADING,this.onFragLoading,this),e.on(C.FRAG_LOADED,this.onFragLoaded,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(C.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.FRAG_LOADING,this.onFragLoading,this),e.off(C.FRAG_LOADED,this.onFragLoaded,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(C.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,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 s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var r;this.fragCurrent=s,this.partCurrent=(r=t.part)!=null?r: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 ce.BUFFER_ADD_CODEC_ERROR:case ce.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case ce.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:r,partCurrent:n}=this;if(s&&r&&s.sn===r.sn&&s.level===r.level){const a=performance.now(),o=n?n.stats:s.stats,l=a-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(f,u),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,s,r){const n=e+s/t,a=r?this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const s=this.hls.config,{loading:r}=t.stats,n=r.end-r.start;_e(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:s}){const r=s?s.stats:t.stats;if(t.type===He.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=s?s.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+r.loaded,l=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(t.bitrateTest){const n={stats:r,frag:t,part:s,id:t.type};this.onFragBuffered(C.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:s.stats;if(n.aborted||this.ignoreFragment(s))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==He.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(s,t,e,0,r,1,1);if(n>-1)return n;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return ie.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=s&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this,{maxAutoLevel:r,config:n,minAutoLevel:a}=s,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),u=this.getStarvationDelay();let d=n.abrBandWidthFactor,f=n.abrBandWidthUpFactor;if(u){const b=this.findBestLevel(l,a,r,u,0,d,f);if(b>=0)return b}let g=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!u){const b=this.bitrateTestDelay;b&&(g=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-b,ie.info(`[abr] bitrate test took ${Math.round(1e3*b)}ms, set first fragment max fetchDuration to ${Math.round(1e3*g)} ms`),d=f=1)}const v=this.findBestLevel(l,a,r,u,g,d,f);if(ie.info(`[abr] ${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${v}`),v>-1)return v;const y=s.levels[a],E=s.levels[s.loadLevel];return(y==null?void 0:y.bitrate)<(E==null?void 0:E.bitrate)?a:s.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const s=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/s}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,s,r,n,a,o){var l;const u=r+n,d=this.lastLoadedFragLevel,f=d===-1?this.hls.firstLevel:d,{fragCurrent:g,partCurrent:v}=this,{levels:y,allAudioTracks:E,loadLevel:b,config:w}=this.hls;if(y.length===1)return 0;const F=y[f],k=!!(F!=null&&(l=F.details)!=null&&l.live),U=b===-1||d===-1;let N,te="SDR",j=(F==null?void 0:F.frameRate)||0;const{audioPreference:re,videoPreference:Q}=w,le=this.audioTracksByGroup||(this.audioTracksByGroup=xw(E));if(U){if(this.firstSelection!==-1)return this.firstSelection;const Le=this.codecTiers||(this.codecTiers=Sw(y,le,t,s)),ue=yw(Le,te,e,re,Q),{codecSet:he,videoRanges:we,minFramerate:me,minBitrate:ye,preferHDR:Ve}=ue;N=he,te=Ve?we[we.length-1]:we[0],j=me,e=Math.max(e,ye),ie.log(`[abr] picked start tier ${JSON.stringify(ue)}`)}else N=F==null?void 0:F.codecSet,te=F==null?void 0:F.videoRange;const se=v?v.duration:g?g.duration:0,pe=this.bwEstimator.getEstimateTTFB()/1e3,de=[];for(let Le=s;Le>=t;Le--){var be;const ue=y[Le],he=Le>f;if(!ue)continue;if(w.useMediaCapabilities&&!ue.supportedResult&&!ue.supportedPromise){const st=navigator.mediaCapabilities;typeof(st==null?void 0:st.decodingInfo)=="function"&&fw(ue,le,te,j,e,re)?(ue.supportedPromise=pw(ue,le,st),ue.supportedPromise.then(rt=>{if(!this.hls)return;ue.supportedResult=rt;const Ze=this.hls.levels,Xe=Ze.indexOf(ue);rt.error?ie.warn(`[abr] MediaCapabilities decodingInfo error: "${rt.error}" for level ${Xe} ${JSON.stringify(rt)}`):rt.supported||(ie.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${Xe} ${JSON.stringify(rt)}`),Xe>-1&&Ze.length>1&&(ie.log(`[abr] Removing unsupported level ${Xe}`),this.hls.removeLevel(Xe)))})):ue.supportedResult=tg}if(N&&ue.codecSet!==N||te&&ue.videoRange!==te||he&&j>ue.frameRate||!he&&j>0&&j<ue.frameRate||ue.supportedResult&&!((be=ue.supportedResult.decodingInfoResults)!=null&&be[0].smooth)){de.push(Le);continue}const we=ue.details,me=(v?we==null?void 0:we.partTarget:we==null?void 0:we.averagetargetduration)||se;let ye;he?ye=o*e:ye=a*e;const Ve=se&&r>=se*2&&n===0?y[Le].averageBitrate:y[Le].maxBitrate,$e=this.getTimeToLoadFrag(pe,ye,Ve*me,we===void 0);if(ye>=Ve&&(Le===d||ue.loadError===0&&ue.fragmentError===0)&&($e<=pe||!_e($e)||k&&!this.bitrateTestDelay||$e<u)){const st=this.forcedAutoLevel;return Le!==b&&(st===-1||st!==b)&&(de.length&&ie.trace(`[abr] Skipped level(s) ${de.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${y[de[0]].codecs}" ${y[de[0]].videoRange}; not compatible with "${F.codecs}" ${te}`),ie.info(`[abr] switch candidate:${f}->${Le} adjustedbw(${Math.round(ye)})-bitrate=${Math.round(ye-Ve)} ttfb:${pe.toFixed(1)} avgDuration:${me.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${$e.toFixed(1)} firstSelection:${U} codecSet:${N} videoRange:${te} hls.loadLevel:${b}`)),U&&(this.firstSelection=Le),Le}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls,r=Math.min(Math.max(e,s),t);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}}class ww{constructor(){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?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var Ot={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Aw{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.on(C.BUFFER_APPENDED,this.onBufferAppended,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.BUFFER_APPENDED,this.onBufferAppended,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const s=this.activePartLists[t];if(s)for(let r=s.length;r--;){const n=s[r];if(!n)break;const a=n.end;if(n.start<=e&&a!==null&&e<=a)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:s}=this,r=Object.keys(s);for(let n=r.length;n--;){const a=s[r[n]];if((a==null?void 0:a.body.type)===t&&a.buffered){const o=a.body;if(o.start<=e&&e<=o.end)return o}}return null}detectEvictedFragments(e,t,s,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o||n>=o.body.sn)return;if(!o.buffered&&!o.loaded){o.body.type===s&&this.removeFragment(o.body);return}const l=o.range[e];l&&l.time.some(u=>{const d=!this.isTimeBuffered(u.startPTS,u.endPTS,t);return d&&this.removeFragment(o.body),d})})}detectPartialFragments(e){const t=this.timeRanges,{frag:s,part:r}=e;if(!t||s.sn==="initSegment")return;const n=_r(s),a=this.fragments[n];if(!a||a.buffered&&s.gap)return;const o=!s.relurl;Object.keys(t).forEach(l=>{const u=s.elementaryStreams[l];if(!u)return;const d=t[l],f=o||u.partial===!0;a.range[l]=this.getBufferedTimes(s,r,f,d)}),a.loaded=null,Object.keys(a.range).length?(a.buffered=!0,(a.body.endList=s.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),oa(a)||this.removeParts(s.sn-1,s.type)):this.removeFragment(a.body)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=s.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const s=_r(e);let r=this.fragments[s];!r&&t&&(r=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,s,r){const n={time:[],partial:s},a=e.start,o=e.end,l=e.minEndPTS||o,u=e.maxStartPTS||a;for(let d=0;d<r.length;d++){const f=r.start(d)-this.bufferPadding,g=r.end(d)+this.bufferPadding;if(u>=f&&l<=g){n.time.push({startPTS:Math.max(a,r.start(d)),endPTS:Math.min(o,r.end(d))});break}else if(a<g&&o>f){const v=Math.max(a,r.start(d)),y=Math.min(o,r.end(d));y>v&&(n.partial=!0,n.time.push({startPTS:v,endPTS:y}))}else if(o<=f)break}return n}getPartialFragment(e){let t=null,s,r,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(u=>{const d=l[u];d&&oa(d)&&(r=d.body.start-o,n=d.body.end+o,e>=r&&e<=n&&(s=Math.min(e-r,n-e),a<=s&&(t=d.body,a=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||oa(t))}getState(e){const t=_r(e),s=this.fragments[t];return s?s.buffered?oa(s)?Ot.PARTIAL:Ot.OK:Ot.APPENDING:Ot.NOT_LOADED}isTimeBuffered(e,t,s){let r,n;for(let a=0;a<s.length;a++){if(r=s.start(a)-this.bufferPadding,n=s.end(a)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:s,part:r}=t;if(s.sn==="initSegment"||s.bitrateTest)return;const n=r?null:t,a=_r(s);this.fragments[a]={body:s,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:r,timeRanges:n}=t;if(s.sn==="initSegment")return;const a=s.type;if(r){let o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(r)}this.timeRanges=n,Object.keys(n).forEach(o=>{const l=n[o];this.detectEvictedFragments(o,l,a,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=_r(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==s||r&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=_r(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const r=e.sn;this.activePartLists[e.type]=s.filter(n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function oa(i){var e,t,s;return i.buffered&&(i.body.gap||((e=i.range.video)==null?void 0:e.partial)||((t=i.range.audio)==null?void 0:t.partial)||((s=i.range.audiovideo)==null?void 0:s.partial))}function _r(i){return`${i.type}_${i.level}_${i.sn}`}const Lw={length:0,start:()=>0,end:()=>0};class vt{static isBuffered(e,t){try{if(e){const s=vt.getBuffered(e);for(let r=0;r<s.length;r++)if(t>=s.start(r)&&t<=s.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,s){try{if(e){const r=vt.getBuffered(e),n=[];let a;for(a=0;a<r.length;a++)n.push({start:r.start(a),end:r.end(a)});return this.bufferedInfo(n,t,s)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,s){t=Math.max(0,t),e.sort(function(u,d){const f=u.start-d.start;return f||d.end-u.end});let r=[];if(s)for(let u=0;u<e.length;u++){const d=r.length;if(d){const f=r[d-1].end;e[u].start-f<s?e[u].end>f&&(r[d-1].end=e[u].end):r.push(e[u])}else r.push(e[u])}else r=e;let n=0,a,o=t,l=t;for(let u=0;u<r.length;u++){const d=r[u].start,f=r[u].end;if(t+s>=d&&t<f)o=d,l=f,n=l-t;else if(t+s<d){a=d;break}}return{len:n,start:o||0,end:l||0,nextStart:a}}static getBuffered(e){try{return e.buffered}catch(t){return ie.log("failed to get media.buffered",t),Lw}}}class Tc{constructor(e,t,s,r=0,n=-1,a=!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=la(),this.buffering={audio:la(),video:la(),audiovideo:la()},this.level=e,this.sn=t,this.id=s,this.size=r,this.part=n,this.partial=a}}function la(){return{start:0,executeStart:0,executeEnd:0,end:0}}function ba(i,e){for(let s=0,r=i.length;s<r;s++){var t;if(((t=i[s])==null?void 0:t.cc)===e)return i[s]}return null}function Cw(i,e,t){return!!(e&&(t.endCC>t.startCC||i&&i.cc<t.startCC))}function Rw(i,e){const t=i.fragments,s=e.fragments;if(!s.length||!t.length){ie.log("No fragments to align");return}const r=ba(t,s[0].cc);if(!r||r&&!r.startPTS){ie.log("No frag in previous level to align on");return}return r}function ld(i,e){if(i){const t=i.start+e;i.start=i.startPTS=t,i.endPTS=t+i.duration}}function sg(i,e){const t=e.fragments;for(let s=0,r=t.length;s<r;s++)ld(t[s],i);e.fragmentHint&&ld(e.fragmentHint,i),e.alignedSliding=!0}function _w(i,e,t){e&&(Iw(i,t,e),!t.alignedSliding&&e&&Wa(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&Qp(e,t))}function Iw(i,e,t){if(Cw(i,t,e)){const s=Rw(t,e);s&&_e(s.start)&&(ie.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),sg(s.start,e))}}function Wa(i,e){if(!i.hasProgramDateTime||!e.hasProgramDateTime)return;const t=i.fragments,s=e.fragments;if(!t.length||!s.length)return;let r,n;const a=Math.min(e.endCC,i.endCC);e.startCC<a&&i.startCC<a&&(r=ba(s,a),n=ba(t,a)),(!r||!n)&&(r=s[Math.floor(s.length/2)],n=ba(t,r.cc)||t[Math.floor(t.length/2)]);const o=r.programDateTime,l=n.programDateTime;if(!o||!l)return;const u=(l-o)/1e3-(n.start-r.start);sg(u,i)}const cd=Math.pow(2,17);class kw{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 s=e.url;if(!s)return Promise.reject(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(v=>v[0]==="GAP")){l(hd(e));return}else e.gap=!1;const u=this.loader=e.loader=n?new n(r):new a(r),d=ud(e),f=nd(r.fragLoadPolicy.default),g={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:cd};e.stats=u.stats,u.load(d,g,{onSuccess:(v,y,E,b)=>{this.resetLoader(e,u);let w=v.data;E.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(w.slice(0,16)),w=w.slice(16)),o({frag:e,part:null,payload:w,networkDetails:b})},onError:(v,y,E,b)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Nt({url:s,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:E,stats:b}))},onAbort:(v,y,E)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:E,stats:v}))},onTimeout:(v,y,E)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:E,stats:v}))},onProgress:(v,y,E,b)=>{t&&t({frag:e,part:null,payload:E,networkDetails:b})}})})}loadPart(e,t,s){this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(hd(e,t));return}const u=this.loader=e.loader=n?new n(r):new a(r),d=ud(e,t),f=nd(r.fragLoadPolicy.default),g={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:cd};t.stats=u.stats,u.load(d,g,{onSuccess:(v,y,E,b)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const w={frag:e,part:t,payload:v.data,networkDetails:b};s(w),o(w)},onError:(v,y,E,b)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Nt({url:d.url,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:E,stats:b}))},onAbort:(v,y,E)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:E,stats:v}))},onTimeout:(v,y,E)=>{this.resetLoader(e,u),l(new gi({type:je.NETWORK_ERROR,details:ce.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:E,stats:v}))}})})}updateStatsFromPart(e,t){const s=e.stats,r=t.stats,n=r.total;if(s.loaded+=r.loaded,n){const l=Math.round(e.duration/t.duration),u=Math.min(Math.round(s.loaded/n),l),f=(l-u)*Math.round(s.loaded/u);s.total=s.loaded+f}else s.total=Math.max(s.loaded,s.total);const a=s.loading,o=r.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function ud(i,e=null){const t=e||i,s={frag:i,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(_e(r)&&_e(n)){var a;let o=r,l=n;if(i.sn==="initSegment"&&((a=i.decryptdata)==null?void 0:a.method)==="AES-128"){const u=n-r;u%16&&(l=n+(16-u%16)),r!==0&&(s.resetIV=!0,o=r-16)}s.rangeStart=o,s.rangeEnd=l}return s}function hd(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),s={type:je.MEDIA_ERROR,details:ce.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(s.part=e),(e||i).stats.aborted=!0,new gi(s)}class gi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Pw{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Dw{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function Mw(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?ir(i,0,e-t):i}class Fw{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),s=new Uint32Array(4);for(let r=0;r<4;r++)s[r]=t.getUint32(r*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,r=s[0],n=s[1],a=s[2],o=s[3],l=this.invSubMix,u=l[0],d=l[1],f=l[2],g=l[3],v=new Uint32Array(256);let y=0,E=0,b=0;for(b=0;b<256;b++)b<128?v[b]=b<<1:v[b]=b<<1^283;for(b=0;b<256;b++){let w=E^E<<1^E<<2^E<<3^E<<4;w=w>>>8^w&255^99,e[y]=w,t[w]=y;const F=v[y],k=v[F],U=v[k];let N=v[w]*257^w*16843008;r[y]=N<<24|N>>>8,n[y]=N<<16|N>>>16,a[y]=N<<8|N>>>24,o[y]=N,N=U*16843009^k*65537^F*257^y*16843008,u[w]=N<<24|N>>>8,d[w]=N<<16|N>>>16,f[w]=N<<8|N>>>24,g[w]=N,y?(y=F^v[v[v[U^F]]],E^=v[v[E]]):y=E=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,r=0;for(;r<t.length&&s;)s=t[r]===this.key[r],r++;if(s)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const a=this.ksRows=(n+6+1)*4;let o,l;const u=this.keySchedule=new Uint32Array(a),d=this.invKeySchedule=new Uint32Array(a),f=this.sBox,g=this.rcon,v=this.invSubMix,y=v[0],E=v[1],b=v[2],w=v[3];let F,k;for(o=0;o<a;o++){if(o<n){F=u[o]=t[o];continue}k=F,o%n===0?(k=k<<8|k>>>24,k=f[k>>>24]<<24|f[k>>>16&255]<<16|f[k>>>8&255]<<8|f[k&255],k^=g[o/n|0]<<24):n>6&&o%n===4&&(k=f[k>>>24]<<24|f[k>>>16&255]<<16|f[k>>>8&255]<<8|f[k&255]),u[o]=F=(u[o-n]^k)>>>0}for(l=0;l<a;l++)o=a-l,l&3?k=u[o]:k=u[o-4],l<4||o<=4?d[l]=k:d[l]=y[f[k>>>24]]^E[f[k>>>16&255]]^b[f[k>>>8&255]]^w[f[k&255]],d[l]=d[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,s){const r=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],u=o[1],d=o[2],f=o[3],g=this.uint8ArrayToUint32Array_(s);let v=g[0],y=g[1],E=g[2],b=g[3];const w=new Int32Array(e),F=new Int32Array(w.length);let k,U,N,te,j,re,Q,le,se,pe,de,be,Le,ue;const he=this.networkToHostOrderSwap;for(;t<w.length;){for(se=he(w[t]),pe=he(w[t+1]),de=he(w[t+2]),be=he(w[t+3]),j=se^n[0],re=be^n[1],Q=de^n[2],le=pe^n[3],Le=4,ue=1;ue<r;ue++)k=l[j>>>24]^u[re>>16&255]^d[Q>>8&255]^f[le&255]^n[Le],U=l[re>>>24]^u[Q>>16&255]^d[le>>8&255]^f[j&255]^n[Le+1],N=l[Q>>>24]^u[le>>16&255]^d[j>>8&255]^f[re&255]^n[Le+2],te=l[le>>>24]^u[j>>16&255]^d[re>>8&255]^f[Q&255]^n[Le+3],j=k,re=U,Q=N,le=te,Le=Le+4;k=a[j>>>24]<<24^a[re>>16&255]<<16^a[Q>>8&255]<<8^a[le&255]^n[Le],U=a[re>>>24]<<24^a[Q>>16&255]<<16^a[le>>8&255]<<8^a[j&255]^n[Le+1],N=a[Q>>>24]<<24^a[le>>16&255]<<16^a[j>>8&255]<<8^a[re&255]^n[Le+2],te=a[le>>>24]<<24^a[j>>16&255]<<16^a[re>>8&255]<<8^a[Q&255]^n[Le+3],F[t]=he(k^v),F[t+1]=he(te^y),F[t+2]=he(N^E),F[t+3]=he(U^b),v=se,y=pe,E=de,b=be,t=t+4}return F.buffer}}const Ow=16;class wc{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.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}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 s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Mw(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,s){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,s);const a=this.flush();a?r(a.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s)}softwareDecrypt(e,t,s){const{currentIV:r,currentResult:n,remainderData:a}=this;this.logOnce("JS AES decrypt"),a&&(e=bs(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;r&&(s=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Fw),l.expandKey(t);const u=n;return this.currentResult=l.decrypt(o.buffer,0,s),this.currentIV=ir(o,-16).buffer,u||null}webCryptoDecrypt(e,t,s){const r=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new Dw(r,t)),this.fastAesKey.expandKey().then(n=>r?(this.logOnce("WebCrypto AES decrypt"),new Pw(r,new Uint8Array(s)).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(ie.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,s)))}onWebCryptoError(e,t,s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%Ow;return s!==e.length&&(t=ir(e,0,s),this.remainderData=ir(e,s)),t}logOnce(e){this.logEnabled&&(ie.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Nw={toString:function(i){let e="";const t=i.length;for(let s=0;s<t;s++)e+=`[${i.start(s).toFixed(3)}-${i.end(s).toFixed(3)}]`;return e}},ve={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Ac extends ww{constructor(e,t,s,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=ve.STOPPED,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.loadedmetadata=!1,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.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=ie.log.bind(ie,`${r}:`),this.warn=ie.warn.bind(ie,`${r}:`),this.hls=e,this.fragmentLoader=new kw(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new wc(e.config),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ve.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const s=t.partList;if(s!=null&&s.length){const n=s[s.length-1];return vt.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const s=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),s.addEventListener("seeking",this.onvseeking),s.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===ve.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:s,mediaBuffer:r,state:n}=this,a=s?s.currentTime:0,o=vt.bufferInfo(r||s,a,e.maxBufferHole);if(this.log(`media seeking to ${_e(a)?a.toFixed(3):a}, state: ${n}`),this.state===ve.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,u=t.start-l,d=t.start+t.duration+l;if(!o.len||d<o.start||u>o.end){const f=a>d;(a<u||f)&&(f&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}s&&(this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0),this.lastCurrentTime=a),!this.loadedmetadata&&!o.len&&(this.nextLoadPosition=this.startPosition=a),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=ve.STOPPED,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,s){this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,s,r).then(n=>{if(!n)return;const a=this.state;if(this.fragContextChanged(e)){(a===ve.FRAG_LOADING||!this.fragCurrent&&a===ve.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=ve.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(C.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===ve.STOPPED||this.state===ve.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===Ot.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength);this.reduceMaxBufferLength(o)&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===Ot.PARTIAL&&s.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)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:s};this.hls.trigger(C.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{if(!s||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:r}=this,{payload:n}=s,a=e.decryptdata;if(n&&n.byteLength>0&&a!=null&&a.key&&a.iv&&a.method==="AES-128"){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer).catch(l=>{throw r.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const u=self.performance.now();return r.trigger(C.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:o,tdecrypt:u}}),s.payload=l,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===ve.STOPPED||this.state===ve.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state=ve.IDLE,e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var s,r,n,a;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===He.MAIN?"level":"track"} ${e.level} (frag:[${((s=e.startPTS)!=null?s:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${o?Nw.toString(vt.getBuffered(o)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==He.SUBTITLE){const d=e.elementaryStreams;if(!Object.keys(d).some(f=>!!d[f])){this.state=ve.IDLE;return}}const u=(l=this.levels)==null?void 0:l[e.level];u!=null&&u.fragmentError&&(this.log(`Resetting level fragment error count of ${u.fragmentError} on frag buffered`),u.fragmentError=0)}this.state=ve.IDLE,o&&(!this.loadedmetadata&&e.type==He.MAIN&&o.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((a=this.fragPrevious)==null?void 0:a.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:r,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new Tc(s.level,s.sn,s.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,r){var n;const a=t==null?void 0:t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=ve.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(C.KEY_LOADED,d),this.state===ve.KEY_LOADING&&(this.state=ve.IDLE),d}),this.hls.trigger(C.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(e,a.encryptedFragments),s=Math.max(e.start,s||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const d=a.partList;if(d&&r){s>e.end&&a.fragmentHint&&(e=a.fragmentHint);const f=this.getNextPart(d,e,s);if(f>-1){const g=d[f];this.log(`Loading part sn: ${e.sn} p: ${g.index} cc: ${e.cc} of playlist [${a.startSN}-${a.endSN}] parts [0-${f}-${d.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=g.start+g.duration,this.state=ve.FRAG_LOADING;let v;return o?v=o.then(y=>!y||this.fragContextChanged(y.frag)?null:this.doFragPartsLoad(e,g,t,r)).catch(y=>this.handleFragLoadError(y)):v=this.doFragPartsLoad(e,g,t,r).catch(y=>this.handleFragLoadError(y)),this.hls.trigger(C.FRAG_LOADING,{frag:e,part:g,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):v}else if(!e.url||this.loadedEndOfParts(d,s))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${a?"of ["+a.startSN+"-"+a.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),_e(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ve.FRAG_LOADING;const l=this.config.progressive;let u;return l&&o?u=o.then(d=>!d||this.fragContextChanged(d==null?void 0:d.frag)?null:this.fragmentLoader.load(e,r)).catch(d=>this.handleFragLoadError(d)):u=Promise.all([this.fragmentLoader.load(e,l?r:void 0),o]).then(([d])=>(!l&&d&&r&&r(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(C.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):u}doFragPartsLoad(e,t,s,r){return new Promise((n,a)=>{var o;const l=[],u=(o=s.details)==null?void 0:o.partList,d=f=>{this.fragmentLoader.loadPart(e,f,r).then(g=>{l[f.index]=g;const v=g.part;this.hls.trigger(C.FRAG_LOADED,g);const y=id(s,e.sn,f.index+1)||Jp(u,e.sn,f.index+1);if(y)d(y);else return n({frag:e,part:v,partsLoaded:l})}).catch(a)};d(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===ce.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(C.ERROR,t)}else this.hls.trigger(C.ERROR,{type:je.OTHER_ERROR,details:ce.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==ve.PARSING){!this.fragCurrent&&this.state!==ve.STOPPED&&this.state!==ve.ERROR&&(this.state=ve.IDLE);return}const{frag:s,part:r,level:n}=t,a=self.performance.now();s.stats.parsing.end=a,r&&(r.stats.parsing.end=a),this.updateLevelTiming(s,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:r,sn:n,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const o=t[r],l=a>-1?id(o,n,a):null,u=l?l.fragment:aw(o,n,s);return u?(s&&s!==u&&(u.stats=s.stats),{frag:u,part:l,level:o}):null}bufferFragmentData(e,t,s,r,n){var a;if(!e||this.state!==ve.PARSING)return;const{data1:o,data2:l}=e;let u=o;if(o&&l&&(u=bs(o,l)),!((a=u)!=null&&a.length))return;const d={type:e.type,frag:t,part:s,chunkMeta:r,parent:t.type,data:u};if(this.hls.trigger(C.BUFFER_APPENDING,d),e.dropped&&e.independent&&!s){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!vt.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,r=vt.bufferInfo(t,s,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,r.end-a),s+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const s=this.getLoadPosition();return _e(s)?this.getFwdBufferInfoAtPos(e,s,t):null}getFwdBufferInfoAtPos(e,t,s){const{config:{maxBufferHole:r}}=this,n=vt.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,s);if(a&&n.nextStart<a.end)return vt.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,s=e||t.maxBufferLength;return t.maxMaxBufferLength>=s?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=He.MAIN){const s=this.fragmentTracker.getAppendedFrag(e,He.MAIN);return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,r=s.length;if(!r)return null;const{config:n}=this,a=s[0].start;let o;if(t.live){const l=n.initialLiveManifestSize;if(r<l)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a)&&(o=this.getInitialLiveFragment(t,s),this.startPosition=this.nextLoadPosition=o?this.hls.liveSyncPosition||o.start:e)}else e<=a&&(o=s[0]);if(!o){const l=n.lowLatencyMode?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(o)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===Ot.OK||s===Ot.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,r,n){const a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,a&&e&&!e.gap&&s.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,r);if(l!==null&&s.len+l.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let r=-1,n=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const u=e[o];if(a=a&&!u.independent,r>-1&&s<u.start)break;const d=u.loaded;d?r=-1:(n||u.independent||a)&&u.fragment===t&&(r=o),n=d}return r}loadedEndOfParts(e,t){const s=e[e.length-1];return s&&t>s.start&&s.loaded}getInitialLiveFragment(e,t){const s=this.fragPrevious;let r=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),r=lw(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=s.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];s.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=uw(t,s.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,s){const{config:r}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=s;const{fragmentHint:l}=s,u=r.maxFragLookUpTolerance,d=s.partList,f=!!(r.lowLatencyMode&&d!=null&&d.length&&l);f&&l&&!this.bitrateTest&&(a=a.concat(l),o=l.sn);let g;if(e<t){const v=e>t-u?0:u;g=za(n,a,e,v)}else g=a[a.length-1];if(g){const v=g.sn-s.startSN,y=this.fragmentTracker.getState(g);if((y===Ot.OK||y===Ot.PARTIAL&&g.gap)&&(n=g),n&&g.sn===n.sn&&(!f||d[0].fragment.sn>g.sn)&&n&&g.level===n.level){const b=a[v+1];g.sn<o&&this.fragmentTracker.getState(b)!==Ot.OK?g=b:g=null}}return g}synchronizeToLiveEdge(e){const{config:t,media:s}=this;if(!s)return;const r=this.hls.liveSyncPosition,n=s.currentTime,a=e.fragments[0].start,o=e.edge,l=n>=a-t.maxFragLookUpTolerance&&n<=o;if(r!==null&&s.duration>r&&(n<r||!l)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&s.readyState<4||n<o-u)&&(this.loadedmetadata||(this.nextLoadPosition=r),s.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r.toFixed(3)}`),s.currentTime=r))}}alignPlaylists(e,t,s){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,a=!t,o=e.alignedSliding&&_e(n);if(a||!o&&!n){const{fragPrevious:l}=this;_w(l,s,e);const u=e.fragments[0].start;return this.log(`Live playlist sliding: ${u.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${r}`),u}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;if(s<t&&(s=-1),s===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&_e(n)?(s=t+n,n<0&&(s+=e.totalduration),s=Math.min(Math.max(t,s),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${s}`),this.startPosition=s):e.live?s=this.hls.liveSyncPosition||t:this.startPosition=s=0,this.lastCurrentTime=s}this.nextLoadPosition=s}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==ve.FRAG_LOADING_WAITING_RETRY)&&(this.state=ve.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const d=this.getCurrentContext(t.chunkMeta);d&&(t.frag=d.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var r;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===ce.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(s,!0);const a=t.errorAction,{action:o,retryCount:l=0,retryConfig:u}=a||{};if(a&&o===Ht.RetryRequest&&u){this.resetStartWhenNotLoaded(this.levelLastLoaded);const d=Ec(u,l);this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${l+1}/${u.maxNumRetry} in ${d}ms`),a.resolved=!0,this.retryDate=self.performance.now()+d,this.state=ve.FRAG_LOADING_WAITING_RETRY}else if(u&&a)if(this.resetFragmentErrors(e),l<u.maxNumRetry)!n&&o!==Ht.RemoveAlternatePermanently&&(a.resolved=!0);else{ie.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(a==null?void 0:a.action)===Ht.SendAlternateToPenaltyBox?this.state=ve.WAITING_LEVEL:this.state=ve.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===ve.PARSING||this.state===ve.PARSED){const t=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,t),r=s&&s.len>.5;r&&this.reduceMaxBufferLength(s.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===He.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==ve.STOPPED&&(this.state=ve.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const r=vt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,s),this.state===ve.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=ve.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,r){var n;const a=s.details;if(!a){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,u)=>{const d=e.elementaryStreams[u];if(d){const f=d.endPTS-d.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${f})`),l||!1;const g=r?0:Xp(a,e,d.startPTS,d.endPTS,d.startDTS,d.endDTS);return this.hls.trigger(C.LEVEL_PTS_UPDATED,{details:a,level:s,drift:g,type:u,frag:e,start:d.startPTS,end:d.endPTS}),!0}return l},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(s.fragmentError===0&&(s.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=ve.PARSED,this.hls.trigger(C.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class ig{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=Bw(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function Bw(i,e){const t=new Uint8Array(e);let s=0;for(let r=0;r<i.length;r++){const n=i[r];t.set(n,s),s+=n.length}return t}function $w(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Uw(){const i=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(i);return{worker:new self.Worker(e),objectURL:e}}function Gw(i){const e=new self.URL(i,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function qs(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Lc{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,s,r){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,s){}demux(e,t){this.cachedData&&(e=bs(this.cachedData,e),this.cachedData=null);let s=In(e,0),r=s?s.length:0,n;const a=this._audioTrack,o=this._id3Track,l=s?Sc(s):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&_e(l))&&(this.basePTS=Vw(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:ks.audioId3,duration:Number.POSITIVE_INFINITY});r<u;){if(this.canParse(e,r)){const d=this.appendFrame(a,e,r);d?(this.frameIndex++,this.lastPTS=d.sample.pts,r+=d.length,n=r):r=u}else hT(e,r)?(s=In(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:ks.audioId3,duration:Number.POSITIVE_INFINITY}),r+=s.length,n=r):r++;if(r===u&&n!==u){const d=ir(e,n);this.cachedData?this.cachedData=bs(this.cachedData,d):this.cachedData=d}}return{audioTrack:a,videoTrack:qs(),id3Track:o,textTrack:qs()}}demuxSampleAes(e,t,s){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:qs(),id3Track:this._id3Track,textTrack:qs()}}destroy(){}}const Vw=(i,e,t)=>{if(_e(i))return i*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};function Hw(i,e,t,s){let r,n,a,o;const l=navigator.userAgent.toLowerCase(),u=s,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const f=(e[t+2]&60)>>>2;if(f>d.length-1){const g=new Error(`invalid ADTS sampling index:${f}`);i.emit(C.ERROR,C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!0,error:g,reason:g.message});return}return a=(e[t+2]&1)<<2,a|=(e[t+3]&192)>>>6,ie.log(`manifest codec:${s}, ADTS type:${r}, samplingIndex:${f}`),/firefox/i.test(l)?f>=6?(r=5,o=new Array(4),n=f-3):(r=2,o=new Array(2),n=f):l.indexOf("android")!==-1?(r=2,o=new Array(2),n=f):(r=5,o=new Array(4),s&&(s.indexOf("mp4a.40.29")!==-1||s.indexOf("mp4a.40.5")!==-1)||!s&&f>=6?n=f-3:((s&&s.indexOf("mp4a.40.2")!==-1&&(f>=6&&a===1||/vivaldi/i.test(l))||!s&&a===1)&&(r=2,o=new Array(2)),n=f)),o[0]=r<<3,o[0]|=(f&14)>>1,o[1]|=(f&1)<<7,o[1]|=a<<3,r===5&&(o[1]|=(n&14)>>1,o[2]=(n&1)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:d[f],channelCount:a,codec:"mp4a.40."+r,manifestCodec:u}}function rg(i,e){return i[e]===255&&(i[e+1]&246)===240}function ng(i,e){return i[e+1]&1?7:9}function Cc(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function jw(i,e){return e+5<i.length}function qa(i,e){return e+1<i.length&&rg(i,e)}function Kw(i,e){return jw(i,e)&&rg(i,e)&&Cc(i,e)<=i.length-e}function zw(i,e){if(qa(i,e)){const t=ng(i,e);if(e+t>=i.length)return!1;const s=Cc(i,e);if(s<=t)return!1;const r=e+s;return r===i.length||qa(i,r)}return!1}function ag(i,e,t,s,r){if(!i.samplerate){const n=Hw(e,t,s,r);if(!n)return;i.config=n.config,i.samplerate=n.samplerate,i.channelCount=n.channelCount,i.codec=n.codec,i.manifestCodec=n.manifestCodec,ie.log(`parsed codec:${i.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function og(i){return 1024*9e4/i}function Ww(i,e){const t=ng(i,e);if(e+t<=i.length){const s=Cc(i,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function lg(i,e,t,s,r){const n=og(i.samplerate),a=s+r*n,o=Ww(e,t);let l;if(o){const{frameLength:f,headerLength:g}=o,v=g+f,y=Math.max(0,t+v-e.length);y?(l=new Uint8Array(v-g),l.set(e.subarray(t+g,e.length),0)):l=e.subarray(t+g,t+v);const E={unit:l,pts:a};return y||i.samples.push(E),{sample:E,length:v,missing:y}}const u=e.length-t;return l=new Uint8Array(u),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:u,missing:-1}}let ca=null;const qw=[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],Yw=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Xw=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Qw=[0,1,1,4];function cg(i,e,t,s,r){if(t+24>e.length)return;const n=ug(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=s+r*a,l={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return i.config=[],i.channelCount=n.channelCount,i.samplerate=n.sampleRate,i.samples.push(l),{sample:l,length:n.frameLength,missing:0}}}function ug(i,e){const t=i[e+1]>>3&3,s=i[e+1]>>1&3,r=i[e+2]>>4&15,n=i[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const a=i[e+2]>>1&1,o=i[e+3]>>6,l=t===3?3-s:s===3?3:4,u=qw[l*14+r-1]*1e3,f=Yw[(t===3?0:t===2?1:2)*3+n],g=o===3?1:2,v=Xw[t][s],y=Qw[s],E=v*8*y,b=Math.floor(v*u/f+a)*y;if(ca===null){const k=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ca=k?parseInt(k[1]):0}return!!ca&&ca<=87&&s===2&&u>=224e3&&o===0&&(i[e+3]=i[e+3]|128),{sampleRate:f,channelCount:g,frameLength:b,samplesPerFrame:E}}}function Rc(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function hg(i,e){return e+1<i.length&&Rc(i,e)}function Jw(i,e){return Rc(i,e)&&4<=i.length-e}function dg(i,e){if(e+1<i.length&&Rc(i,e)){const s=ug(i,e);let r=4;s!=null&&s.frameLength&&(r=s.frameLength);const n=e+r;return n===i.length||hg(i,n)}return!1}class Zw extends Lc{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=In(e,0);let s=(t==null?void 0:t.length)||0;if(dg(e,s))return!1;for(let r=e.length;s<r;s++)if(zw(e,s))return ie.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Kw(e,t)}appendFrame(e,t,s){ag(e,this.observer,t,s,e.manifestCodec);const r=lg(e,t,s,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const eA=/\/emsg[-/]ID3/i;class tA{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,s,r){const n=this.videoTrack=qs("video",1),a=this.audioTrack=qs("audio",1),o=this.txtTrack=qs("text",1);if(this.id3Track=qs("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=Vp(e);if(l.video){const{id:u,timescale:d,codec:f}=l.video;n.id=u,n.timescale=o.timescale=d,n.codec=f}if(l.audio){const{id:u,timescale:d,codec:f}=l.audio;a.id=u,a.timescale=d,a.codec=f}o.id=$p.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return ST(e)}demux(e,t){this.timeOffset=t;let s=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=bs(this.remainderData,e));const o=RT(s);this.remainderData=o.remainder,r.samples=o.valid||new Uint8Array}else r.samples=s;const a=this.extractID3Track(r,t);return n.samples=Bh(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,s=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return s.samples=Bh(e,t),{videoTrack:t,audioTrack:qs(),id3Track:r,textTrack:qs()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const r=Qe(e.samples,["emsg"]);r&&r.forEach(n=>{const a=kT(n);if(eA.test(a.schemeIdUri)){const o=_e(a.presentationTime)?a.presentationTime/a.timeScale:t+a.presentationTimeDelta/a.timeScale;let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const u=a.payload;s.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:ks.emsg,duration:l})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const fg=(i,e)=>{let t=0,s=5;e+=s;const r=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=i[e];const o=Math.min(s,8),l=8-o;n[0]=4278190080>>>24+l<<l,r[0]=(a[0]&n[0])>>l,t=t?t<<o|r[0]:r[0],e+=1,s-=o}return t};class sA extends Lc{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,s){const r=pg(e,t,s,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=In(e,0);if(!t)return!1;const s=t.length;return e[s]===11&&e[s+1]===119&&Sc(t)!==void 0&&fg(e,s)<16}}function pg(i,e,t,s,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const o=[48e3,44100,32e3][n],l=e[t+4]&63,d=[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][l*3+n]*2;if(t+d>e.length)return-1;const f=e[t+6]>>5;let g=0;f===2?g+=2:(f&1&&f!==1&&(g+=2),f&4&&(g+=2));const v=(e[t+6]<<8|e[t+7])>>12-g&1,E=[2,1,2,3,3,4,4,5][f]+v,b=e[t+5]>>3,w=e[t+5]&7,F=new Uint8Array([n<<6|b<<1|w>>2,(w&3)<<6|f<<3|v<<2|l>>4,l<<4&224]),k=1536/o*9e4,U=s+r*k,N=e.subarray(t,t+d);return i.config=F,i.channelCount=E,i.samplerate=o,i.samples.push({unit:N,pts:U}),d}class iA{constructor(){this.VideoSample=null}createVideoSample(e,t,s,r){return{key:e,frame:!1,pts:t,dts:s,units:[],debug:r,length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,r;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const n=s.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,r=s.length;if(r){const n=s[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&ie.log(e.pts+"/"+e.dts+":"+e.debug)}}class dd{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,s=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(s,s+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>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 s=this.word>>>32-t;if(e>32&&ie.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<<t|this.readBits(t):s}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 this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,s=8,r;for(let n=0;n<e;n++)s!==0&&(r=this.readEG(),s=(t+r+256)%256),t=s===0?t:s}readSPS(){let e=0,t=0,s=0,r=0,n,a,o;const l=this.readUByte.bind(this),u=this.readBits.bind(this),d=this.readUEG.bind(this),f=this.readBoolean.bind(this),g=this.skipBits.bind(this),v=this.skipEG.bind(this),y=this.skipUEG.bind(this),E=this.skipScalingList.bind(this);l();const b=l();if(u(5),g(3),l(),y(),b===100||b===110||b===122||b===244||b===44||b===83||b===86||b===118||b===128){const te=d();if(te===3&&g(1),y(),y(),g(1),f())for(a=te!==3?8:12,o=0;o<a;o++)f()&&(o<6?E(16):E(64))}y();const w=d();if(w===0)d();else if(w===1)for(g(1),v(),v(),n=d(),o=0;o<n;o++)v();y(),g(1);const F=d(),k=d(),U=u(1);U===0&&g(1),g(1),f()&&(e=d(),t=d(),s=d(),r=d());let N=[1,1];if(f()&&f())switch(l()){case 1:N=[1,1];break;case 2:N=[12,11];break;case 3:N=[10,11];break;case 4:N=[16,11];break;case 5:N=[40,33];break;case 6:N=[24,11];break;case 7:N=[20,11];break;case 8:N=[32,11];break;case 9:N=[80,33];break;case 10:N=[18,11];break;case 11:N=[15,11];break;case 12:N=[64,33];break;case 13:N=[160,99];break;case 14:N=[4,3];break;case 15:N=[3,2];break;case 16:N=[2,1];break;case 255:{N=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((F+1)*16-e*2-t*2),height:(2-U)*(k+1)*16-(U?2:4)*(s+r),pixelRatio:N}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class rA extends iA{parseAVCPES(e,t,s,r,n){const a=this.parseAVCNALu(e,s.data);let o=this.VideoSample,l,u=!1;s.data=null,o&&a.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts,"")),a.forEach(d=>{var f;switch(d.type){case 1:{let E=!1;l=!0;const b=d.data;if(u&&b.length>4){const w=new dd(b).readSliceType();(w===2||w===4||w===7||w===9)&&(E=!0)}if(E){var g;(g=o)!=null&&g.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts,"")),o.frame=!0,o.key=E;break}case 5:l=!0,(f=o)!=null&&f.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts,"")),o.key=!0,o.frame=!0;break;case 6:{l=!0,jp(d.data,1,s.pts,t.samples);break}case 7:{var v,y;l=!0,u=!0;const E=d.data,w=new dd(E).readSPS();if(!e.sps||e.width!==w.width||e.height!==w.height||((v=e.pixelRatio)==null?void 0:v[0])!==w.pixelRatio[0]||((y=e.pixelRatio)==null?void 0:y[1])!==w.pixelRatio[1]){e.width=w.width,e.height=w.height,e.pixelRatio=w.pixelRatio,e.sps=[E],e.duration=n;const F=E.subarray(1,4);let k="avc1.";for(let U=0;U<3;U++){let N=F[U].toString(16);N.length<2&&(N="0"+N),k+=N}e.codec=k}break}case 8:l=!0,e.pps=[d.data];break;case 9:l=!0,e.audFound=!0,o&&this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts,"");break;case 12:l=!0;break;default:l=!1,o&&(o.debug+="unknown NAL "+d.type+" ");break}o&&l&&o.units.push(d)}),r&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}parseAVCNALu(e,t){const s=t.byteLength;let r=e.naluState||0;const n=r,a=[];let o=0,l,u,d,f=-1,g=0;for(r===-1&&(f=0,g=t[0]&31,r=0,o=1);o<s;){if(l=t[o++],!r){r=l?0:1;continue}if(r===1){r=l?0:2;continue}if(!l)r=3;else if(l===1){if(u=o-r-1,f>=0){const v={data:t.subarray(f,u),type:g};a.push(v)}else{const v=this.getLastNalUnit(e.samples);v&&(n&&o<=4-n&&v.state&&(v.data=v.data.subarray(0,v.data.byteLength-n)),u>0&&(v.data=bs(v.data,t.subarray(0,u)),v.state=0))}o<s?(d=t[o]&31,f=o,g=d,r=0):r=-1}else r=0}if(f>=0&&r>=0){const v={data:t.subarray(f,s),type:g,state:r};a.push(v)}if(a.length===0){const v=this.getLastNalUnit(e.samples);v&&(v.data=bs(v.data,t))}return e.naluState=r,a}}class nA{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new wc(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,s){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);r.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)})}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)s.set(e.subarray(n,n+16),r);return s}getAvcDecryptedUnit(e,t){const s=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(s.subarray(r,r+16),n);return e}decryptAvcSample(e,t,s,r,n){const a=Kp(n.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{n.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,r)})}decryptAvcSamples(e,t,s,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(s>=n.length);s++){const a=n[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,s,r,a),!this.decrypter.isSync()))return}}}}const Ft=188;class Oi{constructor(e,t,s){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._duration=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=s,this.videoParser=new rA}static probe(e){const t=Oi.syncOffset(e);return t>0&&ie.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let s=Math.min(Ft*5,t-Ft)+1,r=0;for(;r<s;){let n=!1,a=-1,o=0;for(let l=r;l<t;l+=Ft)if(e[l]===71&&(t-l===Ft||e[l+Ft]===71)){if(o++,a===-1&&(a=l,a!==0&&(s=Math.min(a+Ft*99,e.length-Ft)+1)),n||(n=Pl(e,l)===0),n&&o>1&&(a===0&&o>2||l+Ft>s))return a}else{if(o)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:$p[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Oi.createTrack("video"),this._audioTrack=Oi.createTrack("audio",r),this._id3Track=Oi.createTrack("id3"),this._txtTrack=Oi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s,this._duration=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,r=!1){s||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,u=this._txtTrack;let d=a.pid,f=a.pesData,g=o.pid,v=l.pid,y=o.pesData,E=l.pesData,b=null,w=this.pmtParsed,F=this._pmtId,k=e.length;if(this.remainderData&&(e=bs(this.remainderData,e),k=e.length,this.remainderData=null),k<Ft&&!r)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:u};const U=Math.max(0,Oi.syncOffset(e));k-=(k-U)%Ft,k<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,k,e.buffer.byteLength-k));let N=0;for(let j=U;j<k;j+=Ft)if(e[j]===71){const re=!!(e[j+1]&64),Q=Pl(e,j),le=(e[j+3]&48)>>4;let se;if(le>1){if(se=j+5+e[j+4],se===j+Ft)continue}else se=j+4;switch(Q){case d:re&&(f&&(n=Ir(f))&&this.videoParser.parseAVCPES(a,u,n,!1,this._duration),f={data:[],size:0}),f&&(f.data.push(e.subarray(se,j+Ft)),f.size+=j+Ft-se);break;case g:if(re){if(y&&(n=Ir(y)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n);break}y={data:[],size:0}}y&&(y.data.push(e.subarray(se,j+Ft)),y.size+=j+Ft-se);break;case v:re&&(E&&(n=Ir(E))&&this.parseID3PES(l,n),E={data:[],size:0}),E&&(E.data.push(e.subarray(se,j+Ft)),E.size+=j+Ft-se);break;case 0:re&&(se+=e[se]+1),F=this._pmtId=aA(e,se);break;case F:{re&&(se+=e[se]+1);const pe=oA(e,se,this.typeSupported,s);d=pe.videoPid,d>0&&(a.pid=d,a.segmentCodec=pe.segmentVideoCodec),g=pe.audioPid,g>0&&(o.pid=g,o.segmentCodec=pe.segmentAudioCodec),v=pe.id3Pid,v>0&&(l.pid=v),b!==null&&!w&&(ie.warn(`MPEG-TS PMT found at ${j} after unknown PID '${b}'. Backtracking to sync byte @${U} to parse all TS packets.`),b=null,j=U-188),w=this.pmtParsed=!0;break}case 17:case 8191:break;default:b=Q;break}}else N++;if(N>0){const j=new Error(`Found ${N} TS packet/s that do not start with 0x47`);this.observer.emit(C.ERROR,C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:j,reason:j.message})}a.pesData=f,o.pesData=y,l.pesData=E;const te={audioTrack:o,videoTrack:a,id3Track:l,textTrack:u};return r&&this.extractRemainingSamples(te),te}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={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:s,id3Track:r,textTrack:n}=e,a=s.pesData,o=t.pesData,l=r.pesData;let u;if(a&&(u=Ir(a))?(this.videoParser.parseAVCPES(s,n,u,!0,this._duration),s.pesData=null):s.pesData=a,o&&(u=Ir(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,u);break;case"mp3":this.parseMPEGPES(t,u);break;case"ac3":this.parseAC3PES(t,u);break}t.pesData=null}else o!=null&&o.size&&ie.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(u=Ir(l))?(this.parseID3PES(r,u),r.pesData=null):r.pesData=l}demuxSampleAes(e,t,s){const r=this.demux(e,s,!0,!this.config.progressive),n=this.sampleAes=new nA(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(s=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{s(e)}):s(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{s(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let s=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const f=r.missing,g=r.sample.unit.byteLength;if(f===-1)n=bs(r.sample.unit,n);else{const v=g-f;r.sample.unit.set(n.subarray(0,f),v),e.samples.push(r.sample),s=r.missing}}let a,o;for(a=s,o=n.length;a<o-1&&!qa(n,a);a++);if(a!==s){let f;const g=a<o-1;g?f=`AAC PES did not start with ADTS header,offset:${a}`:f="No ADTS header found in AAC PES";const v=new Error(f);if(ie.warn(`parsing error: ${f}`),this.observer.emit(C.ERROR,C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,levelRetry:g,error:v,reason:f}),!g)return}ag(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(r){const f=og(e.samplerate);l=r.sample.pts+f}else{ie.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,d;for(;a<o;)if(d=lg(e,n,a,l,u),a+=d.length,d.missing){this.aacOverFlow=d;break}else for(u++;a<o-1&&!qa(n,a);a++);}parseMPEGPES(e,t){const s=t.data,r=s.length;let n=0,a=0;const o=t.pts;if(o===void 0){ie.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<r;)if(hg(s,a)){const l=cg(e,s,a,o,n);if(l)a+=l.length,n++;else break}else a++}parseAC3PES(e,t){{const s=t.data,r=t.pts;if(r===void 0){ie.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=s.length;let a=0,o=0,l;for(;o<n&&(l=pg(e,s,o,r,a++))>0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){ie.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=Ct({},t,{type:this._videoTrack?ks.emsg:ks.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Pl(i,e){return((i[e+1]&31)<<8)+i[e+2]}function aA(i,e){return(i[e+10]&31)<<8|i[e+11]}function oA(i,e,t,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=(i[e+1]&15)<<8|i[e+2],a=e+3+n-4,o=(i[e+10]&15)<<8|i[e+11];for(e+=12+o;e<a;){const l=Pl(i,e),u=(i[e+3]&15)<<8|i[e+4];switch(i[e]){case 207:if(!s){Jo("ADTS AAC");break}case 15:r.audioPid===-1&&(r.audioPid=l);break;case 21:r.id3Pid===-1&&(r.id3Pid=l);break;case 219:if(!s){Jo("H.264");break}case 27:r.videoPid===-1&&(r.videoPid=l,r.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?ie.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=l,r.segmentAudioCodec="mp3");break;case 193:if(!s){Jo("AC-3");break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=l,r.segmentAudioCodec="ac3"):ie.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&u>0){let d=e+5,f=u;for(;f>2;){switch(i[d]){case 106:t.ac3!==!0?ie.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=l,r.segmentAudioCodec="ac3");break}const v=i[d+1]+2;d+=v,f-=v}}break;case 194:case 135:ie.warn("Unsupported EC-3 in M2TS found");break;case 36:ie.warn("Unsupported HEVC in M2TS found");break}e+=u+5}return r}function Jo(i){ie.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function Ir(i){let e=0,t,s,r,n,a;const o=i.data;if(!i||i.size===0)return null;for(;o[0].length<19&&o.length>1;)o[0]=bs(o[0],o[1]),o.splice(1,1);if(t=o[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(s=(t[4]<<8)+t[5],s&&s>i.size-6)return null;const u=t[7];u&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,u&64?(a=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-a>60*9e4&&(ie.warn(`${Math.round((n-a)/9e4)}s delta between PTS and DTS, align them`),n=a)):a=n),r=t[8];let d=r+9;if(i.size<=d)return null;i.size-=d;const f=new Uint8Array(i.size);for(let g=0,v=o.length;g<v;g++){t=o[g];let y=t.byteLength;if(d)if(d>y){d-=y;continue}else t=t.subarray(d),y-=d,d=0;f.set(t,e),e+=y}return s&&(s-=r+3),{data:f,pts:n,dts:a,len:s}}return null}class lA extends Lc{resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=In(e,0);let s=(t==null?void 0:t.length)||0;if(t&&e[s]===11&&e[s+1]===119&&Sc(t)!==void 0&&fg(e,s)<=16)return!1;for(let r=e.length;s<r;s++)if(dg(e,s))return ie.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Jw(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return cg(e,t,s,this.basePTS,this.frameIndex)}}class fd{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)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(t===6)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]);break;default:if(t===1)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(t===2)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(t===3)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]);break}}}const Di=Math.pow(2,32)-1;class oe{static init(){oe.types={avc1:[],avcC:[],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:[]};let e;for(e in oe.types)oe.types.hasOwnProperty(e)&&(oe.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]),s=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]);oe.HDLR_TYPES={video:t,audio:s};const r=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]);oe.STTS=oe.STSC=oe.STCO=n,oe.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),oe.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),oe.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),oe.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);oe.FTYP=oe.box(oe.types.ftyp,a,l,a,o),oe.DINF=oe.box(oe.types.dinf,oe.box(oe.types.dref,r))}static box(e,...t){let s=8,r=t.length;const n=r;for(;r--;)s+=t[r].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=s&255,a.set(e,4),r=0,s=8;r<n;r++)a.set(t[r],s),s+=t[r].byteLength;return a}static hdlr(e){return oe.box(oe.types.hdlr,oe.HDLR_TYPES[e])}static mdat(e){return oe.box(oe.types.mdat,e)}static mdhd(e,t){t*=e;const s=Math.floor(t/(Di+1)),r=Math.floor(t%(Di+1));return oe.box(oe.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,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return oe.box(oe.types.mdia,oe.mdhd(e.timescale,e.duration),oe.hdlr(e.type),oe.minf(e))}static mfhd(e){return oe.box(oe.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?oe.box(oe.types.minf,oe.box(oe.types.smhd,oe.SMHD),oe.DINF,oe.stbl(e)):oe.box(oe.types.minf,oe.box(oe.types.vmhd,oe.VMHD),oe.DINF,oe.stbl(e))}static moof(e,t,s){return oe.box(oe.types.moof,oe.mfhd(e),oe.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=oe.trak(e[t]);return oe.box.apply(null,[oe.types.moov,oe.mvhd(e[0].timescale,e[0].duration)].concat(s).concat(oe.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=oe.trex(e[t]);return oe.box.apply(null,[oe.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(Di+1)),r=Math.floor(t%(Di+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,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,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 oe.box(oe.types.mvhd,n)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,s[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return oe.box(oe.types.sdtp,s)}static stbl(e){return oe.box(oe.types.stbl,oe.stsd(e),oe.box(oe.types.stts,oe.STTS),oe.box(oe.types.stsc,oe.STSC),oe.box(oe.types.stsz,oe.STSZ),oe.box(oe.types.stco,oe.STCO))}static avc1(e){let t=[],s=[],r,n,a;for(r=0;r<e.sps.length;r++)n=e.sps[r],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],a=n.byteLength,s.push(a>>>8&255),s.push(a&255),s=s.concat(Array.prototype.slice.call(n));const o=oe.box(oe.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,u=e.height,d=e.pixelRatio[0],f=e.pixelRatio[1];return oe.box(oe.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,l>>8&255,l&255,u>>8&255,u&255,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,oe.box(oe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),oe.box(oe.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,f>>24,f>>16&255,f>>8&255,f&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return oe.box(oe.types.mp4a,oe.audioStsd(e),oe.box(oe.types.esds,oe.esds(e)))}static mp3(e){return oe.box(oe.types[".mp3"],oe.audioStsd(e))}static ac3(e){return oe.box(oe.types["ac-3"],oe.audioStsd(e),oe.box(oe.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?oe.box(oe.types.stsd,oe.STSD,oe.mp3(e)):e.segmentCodec==="ac3"?oe.box(oe.types.stsd,oe.STSD,oe.ac3(e)):oe.box(oe.types.stsd,oe.STSD,oe.mp4a(e)):oe.box(oe.types.stsd,oe.STSD,oe.avc1(e))}static tkhd(e){const t=e.id,s=e.duration*e.timescale,r=e.width,n=e.height,a=Math.floor(s/(Di+1)),o=Math.floor(s%(Di+1));return oe.box(oe.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,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,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,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const s=oe.sdtp(e),r=e.id,n=Math.floor(t/(Di+1)),a=Math.floor(t%(Di+1));return oe.box(oe.types.traf,oe.box(oe.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),oe.box(oe.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),oe.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,oe.box(oe.types.trak,oe.tkhd(e),oe.mdia(e))}static trex(e){const t=e.id;return oe.box(oe.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],r=s.length,n=12+16*r,a=new Uint8Array(n);let o,l,u,d,f,g;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<r;o++)l=s[o],u=l.duration,d=l.size,f=l.flags,g=l.cts,a.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,g>>>24&255,g>>>16&255,g>>>8&255,g&255],12+16*o);return oe.box(oe.types.trun,a)}static initSegment(e){oe.types||oe.init();const t=oe.moov(e);return bs(oe.FTYP,t)}}oe.types=void 0;oe.HDLR_TYPES=void 0;oe.STTS=void 0;oe.STSC=void 0;oe.STCO=void 0;oe.STSZ=void 0;oe.VMHD=void 0;oe.SMHD=void 0;oe.STSD=void 0;oe.FTYP=void 0;oe.DINF=void 0;const gg=9e4;function _c(i,e,t=1,s=!1){const r=i*e*t;return s?Math.round(r):r}function cA(i,e,t=1,s=!1){return _c(i,e,1/t,s)}function hn(i,e=!1){return _c(i,1e3,1/gg,e)}function uA(i,e=1){return _c(i,gg,1/e)}const hA=10*1e3,pd=1024,dA=1152,fA=1536;let kr=null,Zo=null;class Ta{constructor(e,t,s,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,kr===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);kr=a?parseInt(a[1]):0}if(Zo===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);Zo=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){ie.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){ie.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){ie.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e.reduce((r,n)=>{const a=n.pts-r;return a<-4294967296?(t=!0,Es(r,n.pts)):a>0?r:n.pts},e[0].pts);return t&&ie.debug("PTS rollover detected"),s}remux(e,t,s,r,n,a,o,l){let u,d,f,g,v,y,E=n,b=n;const w=e.pid>-1,F=t.pid>-1,k=t.samples.length,U=e.samples.length>0,N=o&&k>0||k>1;if((!w||U)&&(!F||N)||this.ISGenerated||o){if(this.ISGenerated){var j,re,Q,le;const be=this.videoTrackConfig;be&&(t.width!==be.width||t.height!==be.height||((j=t.pixelRatio)==null?void 0:j[0])!==((re=be.pixelRatio)==null?void 0:re[0])||((Q=t.pixelRatio)==null?void 0:Q[1])!==((le=be.pixelRatio)==null?void 0:le[1]))&&this.resetInitSegment()}else f=this.generateIS(e,t,n,a);const se=this.isVideoContiguous;let pe=-1,de;if(N&&(pe=pA(t.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(y=!0,pe>0){ie.warn(`[mp4-remuxer]: Dropped ${pe} out of ${k} video samples due to a missing keyframe`);const be=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(pe),t.dropped+=pe,b+=(t.samples[0].pts-be)/t.inputTimeScale,de=b}else pe===-1&&(ie.warn(`[mp4-remuxer]: No keyframe found out of ${k} video samples`),y=!1);if(this.ISGenerated){if(U&&N){const be=this.getVideoStartPts(t.samples),ue=(Es(e.samples[0].pts,be)-be)/t.inputTimeScale;E+=Math.max(0,ue),b+=Math.max(0,-ue)}if(U){if(e.samplerate||(ie.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,n,a)),d=this.remuxAudio(e,E,this.isAudioContiguous,a,F||N||l===He.AUDIO?b:void 0),N){const be=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(ie.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),f=this.generateIS(e,t,n,a)),u=this.remuxVideo(t,b,se,be)}}else N&&(u=this.remuxVideo(t,b,se,0));u&&(u.firstKeyFrame=pe,u.independent=pe!==-1,u.firstKeyFramePTS=de)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(v=mg(s,n,this._initPTS,this._initDTS)),r.samples.length&&(g=vg(r,n,this._initPTS))),{audio:d,video:u,initSegment:f,independent:y,text:g,id3:v}}generateIS(e,t,s,r){const n=e.samples,a=t.samples,o=this.typeSupported,l={},u=this._initPTS;let d=!u||r,f="audio/mp4",g,v,y;if(d&&(g=v=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):oe.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(y=e.inputTimeScale,!u||y!==u.timescale?g=v=n[0].pts-Math.round(y*s):d=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:oe.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(y=t.inputTimeScale,!u||y!==u.timescale){const E=this.getVideoStartPts(a),b=Math.round(y*s);v=Math.min(v,Es(a[0].dts,E)-b),g=Math.min(g,E-b)}else d=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:g,timescale:y},this._initDTS={baseTime:v,timescale:y}):g=y=void 0,{tracks:l,initPTS:g,timescale:y}}remuxVideo(e,t,s,r){const n=e.inputTimeScale,a=e.samples,o=[],l=a.length,u=this._initPTS;let d=this.nextAvcDts,f=8,g=this.videoSampleDuration,v,y,E=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,w=!1;if(!s||d===null){const me=t*n,ye=a[0].pts-Es(a[0].dts,a[0].pts);kr&&d!==null&&Math.abs(me-ye-d)<15e3?s=!0:d=me-ye}const F=u.baseTime*n/u.timescale;for(let me=0;me<l;me++){const ye=a[me];ye.pts=Es(ye.pts-F,d),ye.dts=Es(ye.dts-F,d),ye.dts<a[me>0?me-1:me].dts&&(w=!0)}w&&a.sort(function(me,ye){const Ve=me.dts-ye.dts,$e=me.pts-ye.pts;return Ve||$e}),v=a[0].dts,y=a[a.length-1].dts;const k=y-v,U=k?Math.round(k/(l-1)):g||e.inputTimeScale/30;if(s){const me=v-d,ye=me>U,Ve=me<-1;if((ye||Ve)&&(ye?ie.warn(`AVC: ${hn(me,!0)} ms (${me}dts) hole between fragments detected at ${t.toFixed(3)}`):ie.warn(`AVC: ${hn(-me,!0)} ms (${me}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Ve||d>=a[0].pts||kr)){v=d;const $e=a[0].pts-me;if(ye)a[0].dts=v,a[0].pts=$e;else for(let Je=0;Je<a.length&&!(a[Je].dts>$e);Je++)a[Je].dts-=me,a[Je].pts-=me;ie.log(`Video: Initial PTS/DTS adjusted: ${hn($e,!0)}/${hn(v,!0)}, delta: ${hn(me,!0)} ms`)}}v=Math.max(0,v);let N=0,te=0,j=v;for(let me=0;me<l;me++){const ye=a[me],Ve=ye.units,$e=Ve.length;let Je=0;for(let st=0;st<$e;st++)Je+=Ve[st].data.length;te+=Je,N+=$e,ye.length=Je,ye.dts<j?(ye.dts=j,j+=U/4|0||1):j=ye.dts,E=Math.min(ye.pts,E),b=Math.max(ye.pts,b)}y=a[l-1].dts;const re=te+4*N+8;let Q;try{Q=new Uint8Array(re)}catch(me){this.observer.emit(C.ERROR,C.ERROR,{type:je.MUX_ERROR,details:ce.REMUX_ALLOC_ERROR,fatal:!1,error:me,bytes:re,reason:`fail allocating video mdat ${re}`});return}const le=new DataView(Q.buffer);le.setUint32(0,re),Q.set(oe.types.mdat,4);let se=!1,pe=Number.POSITIVE_INFINITY,de=Number.POSITIVE_INFINITY,be=Number.NEGATIVE_INFINITY,Le=Number.NEGATIVE_INFINITY;for(let me=0;me<l;me++){const ye=a[me],Ve=ye.units;let $e=0;for(let rt=0,Ze=Ve.length;rt<Ze;rt++){const Xe=Ve[rt],dt=Xe.data,Rt=Xe.data.byteLength;le.setUint32(f,Rt),f+=4,Q.set(dt,f),f+=Rt,$e+=4+Rt}let Je;if(me<l-1)g=a[me+1].dts-ye.dts,Je=a[me+1].pts-ye.pts;else{const rt=this.config,Ze=me>0?ye.dts-a[me-1].dts:U;if(Je=me>0?ye.pts-a[me-1].pts:U,rt.stretchShortVideoTrack&&this.nextAudioPts!==null){const Xe=Math.floor(rt.maxBufferHole*n),dt=(r?E+r*n:this.nextAudioPts)-ye.pts;dt>Xe?(g=dt-Ze,g<0?g=Ze:se=!0,ie.log(`[mp4-remuxer]: It is approximately ${dt/90} ms to the next segment; using duration ${g/90} ms for the last video frame.`)):g=Ze}else g=Ze}const st=Math.round(ye.pts-ye.dts);pe=Math.min(pe,g),be=Math.max(be,g),de=Math.min(de,Je),Le=Math.max(Le,Je),o.push(new gd(ye.key,g,$e,st))}if(o.length){if(kr){if(kr<70){const me=o[0].flags;me.dependsOn=2,me.isNonSync=0}}else if(Zo&&Le-de<be-pe&&U/be<.025&&o[0].cts===0){ie.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let me=v;for(let ye=0,Ve=o.length;ye<Ve;ye++){const $e=me+o[ye].duration,Je=me+o[ye].cts;if(ye<Ve-1){const st=$e+o[ye+1].cts;o[ye].duration=st-Je}else o[ye].duration=ye?o[ye-1].duration:U;o[ye].cts=0,me=$e}}}g=se||!g?U:g,this.nextAvcDts=d=y+g,this.videoSampleDuration=g,this.isVideoContiguous=!0;const we={data1:oe.moof(e.sequenceNumber++,v,Ct({},e,{samples:o})),data2:Q,startPTS:E/n,endPTS:(b+g)/n,startDTS:v/n,endDTS:d/n,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,we}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return dA;case"ac3":return fA;default:return pd}}remuxAudio(e,t,s,r,n){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,u=this.getSamplesPerFrame(e),d=u*l,f=this._initPTS,g=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,v=[],y=n!==void 0;let E=e.samples,b=g?0:8,w=this.nextAudioPts||-1;const F=t*a,k=f.baseTime*a/f.timescale;if(this.isAudioContiguous=s=s||E.length&&w>0&&(r&&Math.abs(F-w)<9e3||Math.abs(Es(E[0].pts-k,F)-w)<20*d),E.forEach(function(ue){ue.pts=Es(ue.pts-k,F)}),!s||w<0){if(E=E.filter(ue=>ue.pts>=0),!E.length)return;n===0?w=0:r&&!y?w=Math.max(0,F):w=E[0].pts}if(e.segmentCodec==="aac"){const ue=this.config.maxAudioFramesDrift;for(let he=0,we=w;he<E.length;he++){const me=E[he],ye=me.pts,Ve=ye-we,$e=Math.abs(1e3*Ve/a);if(Ve<=-ue*d&&y)he===0&&(ie.warn(`Audio frame @ ${(ye/a).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Ve/a)} ms.`),this.nextAudioPts=w=we=ye);else if(Ve>=ue*d&&$e<hA&&y){let Je=Math.round(Ve/d);we=ye-Je*d,we<0&&(Je--,we+=d),he===0&&(this.nextAudioPts=w=we),ie.warn(`[mp4-remuxer]: Injecting ${Je} audio frame @ ${(we/a).toFixed(3)}s due to ${Math.round(1e3*Ve/a)} ms gap.`);for(let st=0;st<Je;st++){const rt=Math.max(we,0);let Ze=fd.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);Ze||(ie.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ze=me.unit.subarray()),E.splice(he,0,{unit:Ze,pts:rt}),we+=d,he++}}me.pts=we,we+=d}}let U=null,N=null,te,j=0,re=E.length;for(;re--;)j+=E[re].unit.byteLength;for(let ue=0,he=E.length;ue<he;ue++){const we=E[ue],me=we.unit;let ye=we.pts;if(N!==null){const $e=v[ue-1];$e.duration=Math.round((ye-N)/l)}else if(s&&e.segmentCodec==="aac"&&(ye=w),U=ye,j>0){j+=b;try{te=new Uint8Array(j)}catch($e){this.observer.emit(C.ERROR,C.ERROR,{type:je.MUX_ERROR,details:ce.REMUX_ALLOC_ERROR,fatal:!1,error:$e,bytes:j,reason:`fail allocating audio mdat ${j}`});return}g||(new DataView(te.buffer).setUint32(0,j),te.set(oe.types.mdat,4))}else return;te.set(me,b);const Ve=me.byteLength;b+=Ve,v.push(new gd(!0,u,Ve,0)),N=ye}const Q=v.length;if(!Q)return;const le=v[v.length-1];this.nextAudioPts=w=N+l*le.duration;const se=g?new Uint8Array(0):oe.moof(e.sequenceNumber++,U/l,Ct({},e,{samples:v}));e.samples=[];const pe=U/a,de=w/a,Le={data1:se,data2:te,startPTS:pe,endPTS:de,startDTS:pe,endDTS:de,type:"audio",hasAudio:!0,hasVideo:!1,nb:Q};return this.isAudioContiguous=!0,Le}remuxEmptyAudio(e,t,s,r){const n=e.inputTimeScale,a=e.samplerate?e.samplerate:n,o=n/a,l=this.nextAudioPts,u=this._initDTS,d=u.baseTime*9e4/u.timescale,f=(l!==null?l:r.startDTS*n)+d,g=r.endDTS*n+d,v=o*pd,y=Math.ceil((g-f)/v),E=fd.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(ie.warn("[mp4-remuxer]: remux empty Audio"),!E){ie.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const b=[];for(let w=0;w<y;w++){const F=f+w*v;b.push({unit:E,pts:F,dts:F})}return e.samples=b,this.remuxAudio(e,t,s,!1)}}function Es(i,e){let t;if(e===null)return i;for(e<i?t=-8589934592:t=8589934592;Math.abs(i-e)>4294967296;)i+=t;return i}function pA(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function mg(i,e,t,s){const r=i.samples.length;if(!r)return;const n=i.inputTimeScale;for(let o=0;o<r;o++){const l=i.samples[o];l.pts=Es(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=Es(l.dts-s.baseTime*n/s.timescale,e*n)/n}const a=i.samples;return i.samples=[],{samples:a}}function vg(i,e,t){const s=i.samples.length;if(!s)return;const r=i.inputTimeScale;for(let a=0;a<s;a++){const o=i.samples[a];o.pts=Es(o.pts-t.baseTime*r/t.timescale,e*r)/r}i.samples.sort((a,o)=>a.pts-o.pts);const n=i.samples;return i.samples=[],{samples:n}}class gd{constructor(e,t,s,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=s,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class gA{constructor(){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}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,s,r){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(TT(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=Vp(e);r.audio&&(t=md(r.audio,ht.AUDIO)),r.video&&(s=md(r.video,ht.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+s,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:s,initSegment:e,id:"main"}:ie.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,s,r,n,a){var o,l;let{initPTS:u,lastEndTime:d}=this;const f={audio:void 0,video:void 0,text:r,id3:s,initSegment:void 0};_e(d)||(d=this.lastEndTime=n||0);const g=t.samples;if(!(g!=null&&g.length))return f;const v={initPTS:void 0,timescale:1};let y=this.initData;if((o=y)!=null&&o.length||(this.generateInitSegment(g),y=this.initData),!((l=y)!=null&&l.length))return ie.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1);const E=AT(g,y),b=wT(y,g),w=b===null?n:b;(mA(u,w,n,E)||v.timescale!==u.timescale&&a)&&(v.initPTS=w-n,u&&u.timescale===1&&ie.warn(`Adjusting initPTS by ${v.initPTS-u.baseTime}`),this.initPTS=u={baseTime:v.initPTS,timescale:1});const F=e?w-u.baseTime/u.timescale:d,k=F+E;CT(y,g,u.baseTime/u.timescale),E>0?this.lastEndTime=k:(ie.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const U=!!y.audio,N=!!y.video;let te="";U&&(te+="audio"),N&&(te+="video");const j={data1:g,startPTS:F,startDTS:F,endPTS:k,endDTS:k,type:te,hasAudio:U,hasVideo:N,nb:1,dropped:0};return f.audio=j.type==="audio"?j:void 0,f.video=j.type!=="audio"?j:void 0,f.initSegment=v,f.id3=mg(s,n,u,u),r.samples.length&&(f.text=vg(r,n,u)),f}}function mA(i,e,t,s){if(i===null)return!0;const r=Math.max(s,1),n=e-i.baseTime/i.timescale;return Math.abs(n-t)>r}function md(i,e){const t=i==null?void 0:i.codec;if(t&&t.length>4)return t;if(e===ht.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return Va(t,!1);const s="mp4a.40.5";return ie.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${s}"`),s}return ie.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let mi;try{mi=self.performance.now.bind(self.performance)}catch{ie.debug("Unable to use Performance API on this environment"),mi=Br==null?void 0:Br.Date.now}const wa=[{demux:tA,remux:gA},{demux:Oi,remux:Ta},{demux:Zw,remux:Ta},{demux:lA,remux:Ta}];wa.splice(2,0,{demux:sA,remux:Ta});class vd{constructor(e,t,s,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=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=s,this.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,r){const n=s.transmuxing;n.executeStart=mi();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;r&&(this.currentTransmuxState=r);const{contiguous:u,discontinuity:d,trackSwitch:f,accurateTimeOffset:g,timeOffset:v,initSegmentChange:y}=r||o,{audioCodec:E,videoCodec:b,defaultInitPts:w,duration:F,initSegmentData:k}=l,U=vA(a,t);if(U&&U.method==="AES-128"){const re=this.getDecrypter();if(re.isSync()){let Q=re.softwareDecrypt(a,U.key.buffer,U.iv.buffer);if(s.part>-1&&(Q=re.flush()),!Q)return n.executeEnd=mi(),el(s);a=new Uint8Array(Q)}else return this.decryptionPromise=re.webCryptoDecrypt(a,U.key.buffer,U.iv.buffer).then(Q=>{const le=this.push(Q,null,s);return this.decryptionPromise=null,le}),this.decryptionPromise}const N=this.needsProbing(d,f);if(N){const re=this.configureTransmuxer(a);if(re)return ie.warn(`[transmuxer] ${re.message}`),this.observer.emit(C.ERROR,C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:re,reason:re.message}),n.executeEnd=mi(),el(s)}(d||f||y||N)&&this.resetInitSegment(k,E,b,F,t),(d||y||N)&&this.resetInitialTimestamp(w),u||this.resetContiguity();const te=this.transmux(a,U,v,g,s),j=this.currentTransmuxState;return j.contiguous=!0,j.discontinuity=!1,j.trackSwitch=!1,n.executeEnd=mi(),te}flush(e){const t=e.transmuxing;t.executeStart=mi();const{decrypter:s,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const a=[],{timeOffset:o}=r;if(s){const f=s.flush();f&&a.push(this.push(f,null,e))}const{demuxer:l,remuxer:u}=this;if(!l||!u)return t.executeEnd=mi(),[el(e)];const d=l.flush(o);return Aa(d)?d.then(f=>(this.flushRemux(a,f,e),a)):(this.flushRemux(a,d,e),a)}flushRemux(e,t,s){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:u}=this.currentTransmuxState;ie.log(`[transmuxer.ts]: Flushed fragment ${s.sn}${s.part>-1?" p: "+s.part:""} of level ${s.level}`);const d=this.remuxer.remux(r,n,a,o,u,l,!0,this.id);e.push({remuxResult:d,chunkMeta:s}),s.transmuxing.executeEnd=mi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,r,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,s,r),o.resetInitSegment(e,t,s,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,r,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,s,r,n):a=this.transmuxUnencrypted(e,s,r,n),a}transmuxUnencrypted(e,t,s,r){const{audioTrack:n,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,o,l,t,s,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,s,r,n){return this.demuxer.demuxSampleAes(e,t,s).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,s,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:r,vendor:n}=this;let a;for(let g=0,v=wa.length;g<v;g++){var o;if((o=wa[g].demux)!=null&&o.probe(e)){a=wa[g];break}}if(!a)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,u=this.remuxer,d=a.remux,f=a.demux;(!u||!(u instanceof d))&&(this.remuxer=new d(s,t,r,n)),(!l||!(l instanceof f))&&(this.demuxer=new f(s,t,r),this.probe=f.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new wc(this.config)),e}}function vA(i,e){let t=null;return i.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const el=i=>({remuxResult:{},chunkMeta:i});function Aa(i){return"then"in i&&i.then instanceof Function}class yA{constructor(e,t,s,r,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=s,this.duration=r,this.defaultInitPts=n||null}}class xA{constructor(e,t,s,r,n,a){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=s,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}}var yg={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function r(l,u,d){this.fn=l,this.context=u,this.once=d||!1}function n(l,u,d,f,g){if(typeof d!="function")throw new TypeError("The listener must be a function");var v=new r(d,f||l,g),y=t?t+u:u;return l._events[y]?l._events[y].fn?l._events[y]=[l._events[y],v]:l._events[y].push(v):(l._events[y]=v,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new s:delete l._events[u]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},o.prototype.listeners=function(u){var d=t?t+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var g=0,v=f.length,y=new Array(v);g<v;g++)y[g]=f[g].fn;return y},o.prototype.listenerCount=function(u){var d=t?t+u:u,f=this._events[d];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,d,f,g,v,y){var E=t?t+u:u;if(!this._events[E])return!1;var b=this._events[E],w=arguments.length,F,k;if(b.fn){switch(b.once&&this.removeListener(u,b.fn,void 0,!0),w){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,d),!0;case 3:return b.fn.call(b.context,d,f),!0;case 4:return b.fn.call(b.context,d,f,g),!0;case 5:return b.fn.call(b.context,d,f,g,v),!0;case 6:return b.fn.call(b.context,d,f,g,v,y),!0}for(k=1,F=new Array(w-1);k<w;k++)F[k-1]=arguments[k];b.fn.apply(b.context,F)}else{var U=b.length,N;for(k=0;k<U;k++)switch(b[k].once&&this.removeListener(u,b[k].fn,void 0,!0),w){case 1:b[k].fn.call(b[k].context);break;case 2:b[k].fn.call(b[k].context,d);break;case 3:b[k].fn.call(b[k].context,d,f);break;case 4:b[k].fn.call(b[k].context,d,f,g);break;default:if(!F)for(N=1,F=new Array(w-1);N<w;N++)F[N-1]=arguments[N];b[k].fn.apply(b[k].context,F)}}return!0},o.prototype.on=function(u,d,f){return n(this,u,d,f,!1)},o.prototype.once=function(u,d,f){return n(this,u,d,f,!0)},o.prototype.removeListener=function(u,d,f,g){var v=t?t+u:u;if(!this._events[v])return this;if(!d)return a(this,v),this;var y=this._events[v];if(y.fn)y.fn===d&&(!g||y.once)&&(!f||y.context===f)&&a(this,v);else{for(var E=0,b=[],w=y.length;E<w;E++)(y[E].fn!==d||g&&!y[E].once||f&&y[E].context!==f)&&b.push(y[E]);b.length?this._events[v]=b.length===1?b[0]:b:a(this,v)}return this},o.prototype.removeAllListeners=function(u){var d;return u?(d=t?t+u:u,this._events[d]&&a(this,d)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,i.exports=o})(yg);var SA=yg.exports,Ic=jb(SA);class xg{constructor(e,t,s,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=s,this.onFlush=r;const a=(d,f)=>{f=f||{},f.frag=this.frag,f.id=this.id,d===C.ERROR&&(this.error=f.error),this.hls.trigger(d,f)};this.observer=new Ic,this.observer.on(C.FRAG_DECRYPTED,a),this.observer.on(C.ERROR,a);const o=ar(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')},u=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||$w())){try{n.workerPath?(ie.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=Gw(n.workerPath)):(ie.log(`injecting Web Worker for "${t}"`),this.workerContext=Uw()),this.onwmsg=g=>this.onWorkerMessage(g);const{worker:f}=this.workerContext;f.addEventListener("message",this.onwmsg),f.onerror=g=>{const v=new Error(`${g.message} (${g.filename}:${g.lineno})`);n.enableWorker=!1,ie.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(C.ERROR,{type:je.OTHER_ERROR,details:ce.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:v})},f.postMessage({cmd:"init",typeSupported:l,vendor:u,id:t,config:JSON.stringify(n)})}catch(f){ie.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.resetWorker(),this.error=null,this.transmuxer=new vd(this.observer,l,n,u,t)}return}this.transmuxer=new vd(this.observer,l,n,u,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,s,r,n,a,o,l,u,d){var f,g;u.transmuxing.start=self.performance.now();const{transmuxer:v}=this,y=a?a.start:n.start,E=n.decryptdata,b=this.frag,w=!(b&&n.cc===b.cc),F=!(b&&u.level===b.level),k=b?u.sn-b.sn:-1,U=this.part?u.part-this.part.index:-1,N=k===0&&u.id>1&&u.id===(b==null?void 0:b.stats.chunkCount),te=!F&&(k===1||k===0&&(U===1||N&&U<=0)),j=self.performance.now();(F||k||n.stats.parsing.start===0)&&(n.stats.parsing.start=j),a&&(U||!te)&&(a.stats.parsing.start=j);const re=!(b&&((f=n.initSegment)==null?void 0:f.url)===((g=b.initSegment)==null?void 0:g.url)),Q=new xA(w,te,l,F,y,re);if(!te||w||re){ie.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${u.sn} p: ${u.part} level: ${u.level} id: ${u.id}
|
|
59
60
|
discontinuity: ${w}
|
|
60
61
|
trackSwitch: ${F}
|
|
61
62
|
contiguous: ${te}
|
|
62
63
|
accurateTimeOffset: ${l}
|
|
63
64
|
timeOffset: ${y}
|
|
64
|
-
initSegmentChange: ${re}`);const le=new yA(s,r,t,o,d);this.configureTransmuxer(le)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:E,chunkMeta:u,state:Q},e instanceof ArrayBuffer?[e]:[]);else if(v){const le=v.push(e,E,u,Q);Aa(le)?(v.async=!0,le.then(se=>{this.handleTransmuxComplete(se)}).catch(se=>{this.transmuxerError(se,u,"transmuxer-interface push error")})):(v.async=!1,this.handleTransmuxComplete(le))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let s=t.flush(e);Aa(s)||t.async?(Aa(s)||(s=Promise.resolve(s)),s.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(s,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,s=this.hls;switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":ie[t.data.logType]&&ie[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,s.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Sg(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!Ur(i[t].attrs,e[t].attrs))return!1;return!0}function Ur(i,e,t){const s=i["STABLE-RENDITION-ID"];return s&&!t?s===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>i[r]!==e[r])}function Dl(i,e){return e.label.toLowerCase()===i.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(i.lang||"").toLowerCase())}const yd=100;class EA extends Ac{constructor(e,t,s){super(e,t,s,"[audio-stream-controller]",He.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-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.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(C.ERROR,this.onError,this),e.on(C.BUFFER_RESET,this.onBufferReset,this),e.on(C.BUFFER_CREATED,this.onBufferCreated,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(C.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(C.ERROR,this.onError,this),e.off(C.BUFFER_RESET,this.onBufferReset,this),e.off(C.BUFFER_CREATED,this.onBufferCreated,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(C.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n}){if(s==="main"){const a=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${a} found from main: ${r}`),this.videoTrackCC=a,this.state===ve.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=ve.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(yd),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=ve.IDLE):(this.loadedmetadata=!1,this.state=ve.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case ve.IDLE:this.doTickIdle();break;case ve.WAITING_TRACK:{var e;const{levels:s,trackId:r}=this,n=s==null||(e=s[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=ve.WAITING_INIT_PTS}break}case ve.FRAG_LOADING_WAITING_RETRY:{var t;const s=performance.now(),r=this.retryDate;if(!r||s>=r||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:a}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[a])||null),this.state=ve.IDLE}break}case ve.WAITING_INIT_PTS:{const s=this.waitingData;if(s){const{frag:r,part:n,cache:a,complete:o}=s;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=ve.FRAG_LOADING;const l=a.flush(),u={frag:r,part:n,payload:l,networkDetails:null};this._handleFragmentLoadProgress(u),o&&super._handleFragmentLoadComplete(u)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),u=mt.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);kl(u.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${u.end} is needed`),this.clearWaitingFragment())}}else this.state=ve.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=ve.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:s,trackId:r}=this,n=e.config;if(!s&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[r]))return;const a=t[r],o=a.details;if(!o||o.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(o)){this.state=ve.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,ht.AUDIO,He.AUDIO));const u=this.getFwdBufferInfo(l,He.AUDIO);if(u===null)return;const{bufferedTrack:d,switchingTrack:f}=this;if(!f&&this._streamEnded(u,o)){e.trigger(C.BUFFER_EOS,{type:"audio"}),this.state=ve.ENDED;return}const g=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,He.MAIN),v=u.len,y=this.getMaxBufferLength(g==null?void 0:g.len),E=o.fragments,b=E[0].start;let w=this.flushing?this.getLoadPosition():u.end;if(f&&s){const N=this.getLoadPosition();d&&!Ur(f.attrs,d.attrs)&&(w=N),o.PTSKnown&&N<b&&(u.end>b||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=b+.05)}if(v>=y&&!f&&w<E[E.length-1].start)return;let F=this.getNextFragment(w,o),k=!1;if(F&&this.isLoopLoading(F,w)&&(k=!!F.gap,F=this.getNextFragmentLoopLoading(F,o,u,He.MAIN,y)),!F){this.bufferFlushed=!0;return}const U=g&&F.start>g.end+o.targetduration;if(U||!(g!=null&&g.len)&&u.len){const N=this.getAppendedFrag(F.start,He.MAIN);if(N===null||(k||(k=!!N.gap||!!U&&g.len===0),U&&!k||k&&u.nextStart&&u.nextStart<N.end))return}this.loadFragment(F,a,w)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new $r(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),s?this.setInterval(yd):this.resetTransmuxer(),s?(this.switchingTrack=t,this.state=ve.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=ve.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(C.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var s;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:a}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${a}`);return}this.log(`Audio track ${a} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const o=r[a];let l=0;if(n.live||(s=o.details)!=null&&s.live){this.checkLiveUpdate(n);const d=this.mainDetails;if(n.deltaUpdateFailed||!d)return;if(!o.details&&n.hasProgramDateTime&&d.hasProgramDateTime)Wa(n,d),l=n.fragments[0].start;else{var u;l=this.alignPlaylists(n,o.details,(u=this.levelLastLoaded)==null?void 0:u.details)}}o.details=n,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,l),this.state===ve.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=ve.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:r,payload:n}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const u=l[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const d=u.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const f=a.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let g=this.transmuxer;g||(g=this.transmuxer=new xg(this.hls,He.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const v=this.initPTS[s.cc],y=(t=s.initSegment)==null?void 0:t.data;if(v!==void 0){const b=r?r.index:-1,w=b!==-1,F=new Tc(s.level,s.sn,s.stats.chunkCount,n.byteLength,b,w);g.push(n,y,f,"",s,r,d.totalduration,!1,F,v)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:E}=this.waitingData=this.waitingData||{frag:s,part:r,cache:new ig,complete:!1};E.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=ve.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:s,part:r}=t;if(s.type!==He.AUDIO){if(!this.loadedmetadata&&s.type===He.MAIN){const n=this.videoBuffer||this.media;n&&mt.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(s.sn!=="initSegment"){this.fragPrevious=s;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(C.AUDIO_TRACK_SWITCHED,Nt({},n)))}this.fragBufferedComplete(s,r)}onError(e,t){var s;if(t.fatal){this.state=ve.ERROR;return}switch(t.details){case ce.FRAG_GAP:case ce.FRAG_PARSING_ERROR:case ce.FRAG_DECRYPT_ERROR:case ce.FRAG_LOAD_ERROR:case ce.FRAG_LOAD_TIMEOUT:case ce.KEY_LOAD_ERROR:case ce.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(He.AUDIO,t);break;case ce.AUDIO_TRACK_LOAD_ERROR:case ce.AUDIO_TRACK_LOAD_TIMEOUT:case ce.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ve.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===it.AUDIO_TRACK&&(this.state=ve.IDLE);break;case ce.BUFFER_APPEND_ERROR:case ce.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===ce.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case ce.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==ht.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==ht.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===ve.ENDED&&(this.state=ve.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,He.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const s="audio",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:u,level:d}=o,{details:f}=d,{audio:g,text:v,id3:y,initSegment:E}=n;if(this.fragContextChanged(l)||!f){this.fragmentTracker.removeFragment(l);return}if(this.state=ve.PARSING,this.switchingTrack&&g&&this.completeAudioSwitch(this.switchingTrack),E!=null&&E.tracks){const b=l.initSegment||l;this._bufferInitSegment(d,E.tracks,b,a),r.trigger(C.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:s,tracks:E.tracks})}if(g){const{startPTS:b,endPTS:w,startDTS:F,endDTS:k}=g;u&&(u.elementaryStreams[ht.AUDIO]={startPTS:b,endPTS:w,startDTS:F,endDTS:k}),l.setElementaryStreamInfo(ht.AUDIO,b,w,F,k),this.bufferFragmentData(g,l,u,a)}if(y!=null&&(t=y.samples)!=null&&t.length){const b=Ct({id:s,frag:l,details:f},y);r.trigger(C.FRAG_PARSING_METADATA,b)}if(v){const b=Ct({id:s,frag:l,details:f},v);r.trigger(C.FRAG_PARSING_USERDATA,b)}}_bufferInitSegment(e,t,s,r){if(this.state!==ve.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(C.BUFFER_CODECS,t);const o=n.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:s,part:null,chunkMeta:r,parent:s.type,data:o};this.hls.trigger(C.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===Ot.NOT_LOADED||r===Ot.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&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=ve.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragments[0].start!==t.details.fragments[0].start&&Wa(t.details,a)}else this.startFragRequested=!0,super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:s}=this,r=s==null?void 0:s.attrs,n=e.attrs;t&&r&&(r.CHANNELS!==n.CHANNELS||s.name!==e.name||s.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(C.AUDIO_TRACK_SWITCHED,Nt({},e))}}class bA extends bc{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(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(C.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(C.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:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Audio track with id:${s} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}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 s=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||(r==null?void 0:r.length)!==(s==null?void 0:s.length)||s!=null&&s.some(o=>(r==null?void 0:r.indexOf(o))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(g=>!s||s.indexOf(g.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(g=>g.default)&&(this.selectDefaultTrack=!1),o.forEach((g,v)=>{g.id=v});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!n&&l){const g=Zs(l,o,Rr);if(g>-1)n=o[g];else{const v=Zs(l,this.tracks);n=this.tracks[v]}}let u=this.findTrackId(n);u===-1&&n&&(u=this.findTrackId(null));const d={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s==null?void 0:s.join(",")}`),this.hls.trigger(C.AUDIO_TRACKS_UPDATED,d);const f=this.trackId;if(u!==-1&&f===-1)this.setAudioTrack(u);else if(o.length&&f===-1){var a;const g=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(g.message),this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:g})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===it.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,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 s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const r=this.currentTrack;if(r&&Fr(e,r,Rr))return r;const n=Zs(e,this.tracksInGroup,Rr);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(r){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=bw(e,t.levels,s,a,Rr);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Zs(e,s);if(a>-1)return s[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const s=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===s&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(C.AUDIO_TRACK_SWITCHING,Nt({},r)),n))return;const a=this.switchParams(r.url,s==null?void 0:s.details,r.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const r=t[s];if(!(this.selectDefaultTrack&&!r.default)&&(!e||Fr(e,r,Rr)))return s}if(e){const{name:s,lang:r,assocLang:n,characteristics:a,audioCodec:o,channels:l}=e;for(let u=0;u<t.length;u++){const d=t[u];if(Fr({name:s,lang:r,assocLang:n,characteristics:a,audioCodec:o,channels:l},d,Rr))return u}for(let u=0;u<t.length;u++){const d=t[u];if(Ur(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const d=t[u];if(Ur(e.attrs,d.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const s=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}this.log(`loading audio-track playlist ${s} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(C.AUDIO_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:e||null})}}}const xd=500;class TA extends Ac{constructor(e,t,s){super(e,t,s,"[subtitle-stream-controller]",He.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.ERROR,this.onError,this),e.on(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(C.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(C.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.ERROR,this.onError,this),e.off(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(C.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(C.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=ve.IDLE,this.setInterval(xd),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:s,success:r}=t;if(this.fragPrevious=s,this.state=ve.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=s.start;for(let u=0;u<n.length;u++)if(o>=n[u].start&&o<=n[u].end){a=n[u];break}const l=s.start+s.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null)}onBufferFlushing(e,t){const{startOffset:s,endOffset:r}=t;if(s===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=n){a.shift();continue}else if(a[o].start<n)a[o].start=n;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(s,n,He.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===He.MAIN){var s;(s=this.media)!=null&&s.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const s=t.frag;(s==null?void 0:s.type)===He.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==ve.STOPPED&&(this.state=ve.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Sg(this.levels,t)){this.levels=t.map(s=>new $r(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const r=new $r(s);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,He.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(xd)}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:r,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=n[r];if(o>=n.length||o!==r||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(a.live||(s=l.details)!=null&&s.live){const f=this.mainDetails;if(a.deltaUpdateFailed||!f)return;const g=f.fragments[0];if(!l.details)a.hasProgramDateTime&&f.hasProgramDateTime?(Wa(a,f),u=a.fragments[0].start):g&&(u=g.start,Il(a,u));else{var d;u=this.alignPlaylists(a,l.details,(d=this.levelLastLoaded)==null?void 0:d.details),u===0&&g&&(u=g.start,Il(a,u))}}l.details=a,this.levelLastLoaded=l,!this.startFragRequested&&(this.mainDetails||!a.live)&&this.setStartPosition(this.mainDetails||a,u),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===ve.IDLE&&(za(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const a=performance.now();this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer).catch(o=>{throw n.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(C.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=ve.IDLE})}}doTick(){if(!this.media){this.state=ve.IDLE;return}if(this.state===ve.IDLE){const{currentTrackId:e,levels:t}=this,s=t==null?void 0:t[e];if(!s||!t.length||!s.details)return;const{config:r}=this,n=this.getLoadPosition(),a=mt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:o,len:l}=a,u=this.getFwdBufferInfo(this.media,He.MAIN),d=s.details,f=this.getMaxBufferLength(u==null?void 0:u.len)+d.levelTargetDuration;if(l>f)return;const g=d.fragments,v=g.length,y=d.edge;let E=null;const b=this.fragPrevious;if(o<y){const w=r.maxFragLookUpTolerance,F=o>y-w?0:w;E=za(b,g,Math.max(g[0].start,o),F),!E&&b&&b.start<g[0].start&&(E=g[0])}else E=g[v-1];if(!E)return;if(E=this.mapToInitFragWhenRequired(E),E.sn!=="initSegment"){const w=E.sn-d.startSN,F=g[w-1];F&&F.cc===E.cc&&this.fragmentTracker.getState(F)===Ot.NOT_LOADED&&(E=F)}this.fragmentTracker.getState(E)===Ot.NOT_LOADED&&this.loadFragment(E,s,o)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,s){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,s))}get mediaBufferTimeRanges(){return new wA(this.tracksBuffered[this.currentTrackId]||[])}}class wA{constructor(e){this.buffered=void 0;const t=(s,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}class AA extends bc{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.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=Sa(this.media.textTracks);for(let n=0;n<s.length;n++)if(s[n].mode==="hidden")t=s[n];else if(s[n].mode==="showing"){t=s[n];break}const r=this.findTrackForTextTrack(t);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(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(C.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(C.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(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Sa(this.media.textTracks).forEach(t=>{Dr(t)}),this.subtitleTrack=-1,this.media=null}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:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${s} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}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 s=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||(r==null?void 0:r.length)!==(s==null?void 0:s.length)||s!=null&&s.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(d=>!s||s.indexOf(d.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(d=>d.default)&&(this.selectDefaultTrack=!1),a.forEach((d,f)=>{d.id=f});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const d=Zs(o,a);if(d>-1)n=a[d];else{const f=Zs(o,this.tracks);n=this.tracks[f]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const u={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s==null?void 0:s.join(",")}" group-id`),this.hls.trigger(C.SUBTITLE_TRACKS_UPDATED,u),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(s&&!n.default||!s&&!e)&&(!e||Fr(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Ur(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Ur(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const r=t[s];if(Dl(r,e))return s}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===it.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&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){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const s=this.currentTrack;if(s&&Fr(e,s))return s;const r=Zs(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(s)return null;{const n=Zs(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const s=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}this.log(`Loading subtitle playlist for id ${s}`),this.hls.trigger(C.SUBTITLE_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Sa(e.textTracks),s=this.currentTrack;let r;if(s&&(r=t.filter(n=>Dl(s,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!_e(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const s=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(C.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===s&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:o="",name:l,type:u,url:d}=r;this.hls.trigger(C.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:u,url:d});const f=this.switchParams(r.url,s==null?void 0:s.details,r.details);this.loadPlaylist(f)}}class LA{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,s){const r=this.queues[t];r.push(e),r.length===1&&!s&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const s=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),s}executeNext(e){const t=this.queues[e];if(t.length){const s=t[0];try{s.execute()}catch(r){ie.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${r}`),s.onError(r);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Sd=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class CA{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=s=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:s,mediaSource:r}=this;this.log("Media source opened"),s&&(s.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(C.MEDIA_ATTACHED,{media:s,mediaSource:r})),r&&r.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:r}=this;s!==r&&ie.error(`Media element src was set while attaching MediaSource (${r} > ${s})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=NT(ar(e.config.preferManagedMediaSource)),this.log=ie.log.bind(ie,t),this.warn=ie.warn.bind(ie,t),this.error=ie.error.bind(ie,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.BUFFER_RESET,this.onBufferReset,this),e.on(C.BUFFER_APPENDING,this.onBufferAppending,this),e.on(C.BUFFER_CODECS,this.onBufferCodecs,this),e.on(C.BUFFER_EOS,this.onBufferEos,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(C.FRAG_PARSED,this.onFragParsed,this),e.on(C.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.BUFFER_RESET,this.onBufferReset,this),e.off(C.BUFFER_APPENDING,this.onBufferAppending,this),e.off(C.BUFFER_CODECS,this.onBufferCodecs,this),e.off(C.BUFFER_EOS,this.onBufferEos,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(C.FRAG_PARSED,this.onFragParsed,this),e.off(C.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new LA(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const s=this.media=t.media,r=ar(this.appendSource);if(s&&r){var n;const a=this.mediaSource=new r;this.log(`created media source: ${(n=a.constructor)==null?void 0:n.name}`),a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(a.addEventListener("startstreaming",this._onStartStreaming),a.addEventListener("endstreaming",this._onEndStreaming));const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&a instanceof l,Ed(s),RA(s,o),s.load()}catch{s.src=o}else s.src=o;s.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:s}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){this.warn(`onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(e.removeAttribute("src"),this.appendSource&&Ed(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(C.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var s;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(r){this.warn(`onBufferReset ${e}`,r)}}onBufferCodecs(e,t){const s=this.getSourceBufferTypes().length,r=Object.keys(t);if(r.forEach(a=>{if(s){const l=this.tracks[a];if(l&&typeof l.buffer.changeType=="function"){var o;const{id:u,codec:d,levelCodec:f,container:g,metadata:v}=t[a],y=Vh(l.codec,l.levelCodec),E=y==null?void 0:y.replace(Sd,"$1");let b=Vh(d,f);const w=(o=b)==null?void 0:o.replace(Sd,"$1");if(b&&E!==w){a.slice(0,5)==="audio"&&(b=Va(b,this.appendSource));const F=`${g};codecs=${b}`;this.appendChangeType(a,F),this.log(`switching codec ${y} to ${b}`),this.tracks[a]={buffer:l.buffer,codec:d,container:g,levelCodec:f,metadata:v,id:u}}}}else this.pendingTracks[a]=t[a]}),s)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${r.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:s}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),s.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};s.append(r,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:s,operationQueue:r,tracks:n}=this,{data:a,type:o,frag:l,part:u,chunkMeta:d}=t,f=d.buffering[o],g=self.performance.now();f.start=g;const v=l.stats.buffering,y=u?u.stats.buffering:null;v.start===0&&(v.start=g),y&&y.start===0&&(y.start=g);const E=n.audio;let b=!1;o==="audio"&&(E==null?void 0:E.container)==="audio/mpeg"&&(b=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const w=l.start,F={execute:()=>{if(f.executeStart=self.performance.now(),b){const k=this.sourceBuffer[o];if(k){const U=w-k.timestampOffset;Math.abs(U)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${w} (delta: ${U}) sn: ${l.sn})`),k.timestampOffset=w)}}this.appendExecutor(a,o)},onStart:()=>{},onComplete:()=>{const k=self.performance.now();f.executeEnd=f.end=k,v.first===0&&(v.first=k),y&&y.first===0&&(y.first=k);const{sourceBuffer:U}=this,N={};for(const te in U)N[te]=mt.getBuffered(U[te]);this.appendErrors[o]=0,o==="audio"||o==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(C.BUFFER_APPENDED,{type:o,frag:l,part:u,chunkMeta:d,parent:l.type,timeRanges:N})},onError:k=>{const U={type:je.MEDIA_ERROR,parent:l.type,details:ce.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:l,part:u,chunkMeta:d,error:k,err:k,fatal:!1};if(k.code===DOMException.QUOTA_EXCEEDED_ERR)U.details=ce.BUFFER_FULL_ERROR;else{const N=++this.appendErrors[o];U.details=ce.BUFFER_APPEND_ERROR,this.warn(`Failed ${N}/${s.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),N>=s.config.appendErrorMaxRetry&&(U.fatal=!0)}s.trigger(C.ERROR,U)}};r.append(F,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:s}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(C.BUFFER_FLUSHED,{type:n})},onError:a=>{this.warn(`Failed to remove from ${n} SourceBuffer`,a)}});t.type?s.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{s.append(r(n),n)})}onFragParsed(e,t){const{frag:s,part:r}=t,n=[],a=r?r.elementaryStreams:s.elementaryStreams;a[ht.AUDIOVIDEO]?n.push("audiovideo"):(a[ht.AUDIO]&&n.push("audio"),a[ht.VIDEO]&&n.push("video"));const o=()=>{const l=self.performance.now();s.stats.buffering.end=l,r&&(r.stats.buffering.end=l);const u=r?r.stats:s.stats;this.hls.trigger(C.FRAG_BUFFERED,{frag:s,part:r,stats:u,id:s.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const a=this.sourceBuffer[n];return a&&(!t.type||t.type===n)&&(a.ending=!0,a.ended||(a.ended=!0,this.log(`${n} sourceBuffer now EOS`))),r&&!!(!a||a.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const a=this.sourceBuffer[n];a&&(a.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,a=s.currentTime,o=t.levelTargetDuration,l=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(_e(l)&&l>0){const u=Math.max(l,o),d=Math.floor(a/o)*o-u;this.flushBackBuffer(a,o,d)}if(_e(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const u=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),d=Math.max(u,o),f=Math.floor(a/o)*o+d;this.flushFrontBuffer(a,o,f)}}flushBackBuffer(e,t,s){const{details:r,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(o=>{const l=n[o];if(l){const u=mt.getBuffered(l);if(u.length>0&&s>u.start(0)){if(this.hls.trigger(C.BACK_BUFFER_REACHED,{bufferEnd:s}),r!=null&&r.live)this.hls.trigger(C.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(l.ended&&u.end(u.length-1)-e<t*2){this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(C.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:o})}}})}flushFrontBuffer(e,t,s){const{sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(a=>{const o=r[a];if(o){const l=mt.getBuffered(o),u=l.length;if(u<2)return;const d=l.start(u-1),f=l.end(u-1);if(s>d||e>=d&&e<=f)return;if(o.ended&&e-f<2*t){this.log(`Cannot flush ${a} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(C.BUFFER_FLUSHING,{startOffset:d,endOffset:1/0,type:a})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:s,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,a=s.duration,o=_e(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(r.duration=1/0,this.updateSeekableRange(e)):(n>o&&n>a||!_e(a))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,s=e.fragments;if(s.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,s[0].start),a=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${a}.`),t.setLiveSeekableRange(n,a)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:s}=this,r=Object.keys(s).length;if(r&&(!e||r===2||"audiovideo"in s)){this.createSourceBuffers(s),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(C.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(a=>{t.executeNext(a)});else{const a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:s}=this;if(!s)throw Error("createSourceBuffers called when mediaSource was null");for(const n in e)if(!t[n]){var r;const a=e[n];if(!a)throw Error(`source buffer exists for track ${n}, however track does not`);let o=((r=a.levelCodec)==null?void 0:r.indexOf(","))===-1?a.levelCodec:a.codec;o&&n.slice(0,5)==="audio"&&(o=Va(o,this.appendSource));const l=`${a.container};codecs=${o}`;this.log(`creating sourceBuffer(${l})`);try{const u=t[n]=s.addSourceBuffer(l),d=n;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(d,"bufferedchange",(f,g)=>{const v=g.removedRanges;v!=null&&v.length&&this.hls.trigger(C.BUFFER_FLUSHED,{type:n})}),this.tracks[n]={buffer:u,codec:o,container:a.container,levelCodec:a.levelCodec,metadata:a.metadata,id:a.id}}catch(u){this.error(`error while trying to add sourceBuffer: ${u.message}`),this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:n,mimeType:l})}}}get mediaSrc(){var e;const t=((e=this.media)==null?void 0:e.firstChild)||this.media;return t==null?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:s}=this;s.current(e).onComplete(),s.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var s;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${r}`,t),this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(r)}removeExecutor(e,t,s){const{media:r,mediaSource:n,operationQueue:a,sourceBuffer:o}=this,l=o[e];if(!r||!n||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),a.shiftAndExecuteNext(e);return}const u=_e(r.duration)?r.duration:1/0,d=_e(n.duration)?n.duration:1/0,f=Math.max(0,t),g=Math.min(s,u,d);g>f&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${f},${g}] from the ${e} SourceBuffer`),l.remove(f,g)):a.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.sourceBuffer[t];if(!s){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}s.ended=!1,s.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:s}=this,r=t.map(n=>s.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const a=this.sourceBuffer[n];a!=null&&a.updating||s.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,s){const r=this.sourceBuffer[e];if(!r)return;const n=s.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(s=>{t.removeEventListener(s.event,s.listener)})}}function Ed(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function RA(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}const bd={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},Eg=function(e){let t=e;return bd.hasOwnProperty(e)&&(t=bd[e]),String.fromCharCode(t)},Is=15,fi=100,_A={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},IA={17:2,18:4,21:6,22:8,23:10,19:13,20:15},kA={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},PA={25:2,26:4,29:6,30:8,31:10,27:13,28:15},DA=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class MA{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;ie.log(`${this.time} [${e}] ${s}`)}}}const Yi=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class bg{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 s=0;s<t.length;s++){const r=t[s];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!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 FA{constructor(){this.uchar=" ",this.penState=new bg}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 OA{constructor(e){this.chars=[],this.pos=0,this.currPenState=new bg,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<fi;t++)this.chars.push(new FA);this.logger=e}equals(e){for(let t=0;t<fi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<fi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<fi;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>fi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=fi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s<t+1;s++)this.chars[s].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=Eg(e);if(this.pos>=fi){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<fi;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 s=0;s<fi;s++){const r=this.chars[s].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class tl{constructor(e){this.rows=[],this.currRow=Is-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Is;t++)this.rows.push(new OA(e));this.logger=e}reset(){for(let e=0;e<Is;e++)this.rows[e].clear();this.currRow=Is-1}equals(e){let t=!0;for(let s=0;s<Is;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<Is;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Is;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 = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Is;o++)this.rows[o].clear();const n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[n].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(a.rows[n+u])}}this.currRow=t;const s=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);s.setCursor(e.indent),e.color=s.chars[a].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}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 s="",r=-1;for(let n=0;n<Is;n++){const a=this.rows[n].getTextString();a&&(r=n+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?s="["+t.join(" | ")+"]":s=t.join(`
|
|
65
|
+
initSegmentChange: ${re}`);const le=new yA(s,r,t,o,d);this.configureTransmuxer(le)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:E,chunkMeta:u,state:Q},e instanceof ArrayBuffer?[e]:[]);else if(v){const le=v.push(e,E,u,Q);Aa(le)?(v.async=!0,le.then(se=>{this.handleTransmuxComplete(se)}).catch(se=>{this.transmuxerError(se,u,"transmuxer-interface push error")})):(v.async=!1,this.handleTransmuxComplete(le))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let s=t.flush(e);Aa(s)||t.async?(Aa(s)||(s=Promise.resolve(s)),s.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(s,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,s=this.hls;switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":ie[t.data.logType]&&ie[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,s.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Sg(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!Ur(i[t].attrs,e[t].attrs))return!1;return!0}function Ur(i,e,t){const s=i["STABLE-RENDITION-ID"];return s&&!t?s===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>i[r]!==e[r])}function Dl(i,e){return e.label.toLowerCase()===i.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(i.lang||"").toLowerCase())}const yd=100;class EA extends Ac{constructor(e,t,s){super(e,t,s,"[audio-stream-controller]",He.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-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.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(C.ERROR,this.onError,this),e.on(C.BUFFER_RESET,this.onBufferReset,this),e.on(C.BUFFER_CREATED,this.onBufferCreated,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(C.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(C.ERROR,this.onError,this),e.off(C.BUFFER_RESET,this.onBufferReset,this),e.off(C.BUFFER_CREATED,this.onBufferCreated,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(C.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n}){if(s==="main"){const a=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${a} found from main: ${r}`),this.videoTrackCC=a,this.state===ve.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=ve.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(yd),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=ve.IDLE):(this.loadedmetadata=!1,this.state=ve.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case ve.IDLE:this.doTickIdle();break;case ve.WAITING_TRACK:{var e;const{levels:s,trackId:r}=this,n=s==null||(e=s[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=ve.WAITING_INIT_PTS}break}case ve.FRAG_LOADING_WAITING_RETRY:{var t;const s=performance.now(),r=this.retryDate;if(!r||s>=r||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:a}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[a])||null),this.state=ve.IDLE}break}case ve.WAITING_INIT_PTS:{const s=this.waitingData;if(s){const{frag:r,part:n,cache:a,complete:o}=s;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=ve.FRAG_LOADING;const l=a.flush(),u={frag:r,part:n,payload:l,networkDetails:null};this._handleFragmentLoadProgress(u),o&&super._handleFragmentLoadComplete(u)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),u=vt.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);kl(u.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${u.end} is needed`),this.clearWaitingFragment())}}else this.state=ve.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=ve.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:s,trackId:r}=this,n=e.config;if(!s&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[r]))return;const a=t[r],o=a.details;if(!o||o.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(o)){this.state=ve.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,ht.AUDIO,He.AUDIO));const u=this.getFwdBufferInfo(l,He.AUDIO);if(u===null)return;const{bufferedTrack:d,switchingTrack:f}=this;if(!f&&this._streamEnded(u,o)){e.trigger(C.BUFFER_EOS,{type:"audio"}),this.state=ve.ENDED;return}const g=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,He.MAIN),v=u.len,y=this.getMaxBufferLength(g==null?void 0:g.len),E=o.fragments,b=E[0].start;let w=this.flushing?this.getLoadPosition():u.end;if(f&&s){const N=this.getLoadPosition();d&&!Ur(f.attrs,d.attrs)&&(w=N),o.PTSKnown&&N<b&&(u.end>b||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=b+.05)}if(v>=y&&!f&&w<E[E.length-1].start)return;let F=this.getNextFragment(w,o),k=!1;if(F&&this.isLoopLoading(F,w)&&(k=!!F.gap,F=this.getNextFragmentLoopLoading(F,o,u,He.MAIN,y)),!F){this.bufferFlushed=!0;return}const U=g&&F.start>g.end+o.targetduration;if(U||!(g!=null&&g.len)&&u.len){const N=this.getAppendedFrag(F.start,He.MAIN);if(N===null||(k||(k=!!N.gap||!!U&&g.len===0),U&&!k||k&&u.nextStart&&u.nextStart<N.end))return}this.loadFragment(F,a,w)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new $r(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),s?this.setInterval(yd):this.resetTransmuxer(),s?(this.switchingTrack=t,this.state=ve.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=ve.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(C.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var s;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:a}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${a}`);return}this.log(`Audio track ${a} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const o=r[a];let l=0;if(n.live||(s=o.details)!=null&&s.live){this.checkLiveUpdate(n);const d=this.mainDetails;if(n.deltaUpdateFailed||!d)return;if(!o.details&&n.hasProgramDateTime&&d.hasProgramDateTime)Wa(n,d),l=n.fragments[0].start;else{var u;l=this.alignPlaylists(n,o.details,(u=this.levelLastLoaded)==null?void 0:u.details)}}o.details=n,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,l),this.state===ve.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=ve.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:r,payload:n}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const u=l[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const d=u.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const f=a.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let g=this.transmuxer;g||(g=this.transmuxer=new xg(this.hls,He.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const v=this.initPTS[s.cc],y=(t=s.initSegment)==null?void 0:t.data;if(v!==void 0){const b=r?r.index:-1,w=b!==-1,F=new Tc(s.level,s.sn,s.stats.chunkCount,n.byteLength,b,w);g.push(n,y,f,"",s,r,d.totalduration,!1,F,v)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:E}=this.waitingData=this.waitingData||{frag:s,part:r,cache:new ig,complete:!1};E.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=ve.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:s,part:r}=t;if(s.type!==He.AUDIO){if(!this.loadedmetadata&&s.type===He.MAIN){const n=this.videoBuffer||this.media;n&&vt.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(s.sn!=="initSegment"){this.fragPrevious=s;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(C.AUDIO_TRACK_SWITCHED,Nt({},n)))}this.fragBufferedComplete(s,r)}onError(e,t){var s;if(t.fatal){this.state=ve.ERROR;return}switch(t.details){case ce.FRAG_GAP:case ce.FRAG_PARSING_ERROR:case ce.FRAG_DECRYPT_ERROR:case ce.FRAG_LOAD_ERROR:case ce.FRAG_LOAD_TIMEOUT:case ce.KEY_LOAD_ERROR:case ce.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(He.AUDIO,t);break;case ce.AUDIO_TRACK_LOAD_ERROR:case ce.AUDIO_TRACK_LOAD_TIMEOUT:case ce.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ve.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===it.AUDIO_TRACK&&(this.state=ve.IDLE);break;case ce.BUFFER_APPEND_ERROR:case ce.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===ce.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case ce.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==ht.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==ht.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===ve.ENDED&&(this.state=ve.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,He.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const s="audio",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:u,level:d}=o,{details:f}=d,{audio:g,text:v,id3:y,initSegment:E}=n;if(this.fragContextChanged(l)||!f){this.fragmentTracker.removeFragment(l);return}if(this.state=ve.PARSING,this.switchingTrack&&g&&this.completeAudioSwitch(this.switchingTrack),E!=null&&E.tracks){const b=l.initSegment||l;this._bufferInitSegment(d,E.tracks,b,a),r.trigger(C.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:s,tracks:E.tracks})}if(g){const{startPTS:b,endPTS:w,startDTS:F,endDTS:k}=g;u&&(u.elementaryStreams[ht.AUDIO]={startPTS:b,endPTS:w,startDTS:F,endDTS:k}),l.setElementaryStreamInfo(ht.AUDIO,b,w,F,k),this.bufferFragmentData(g,l,u,a)}if(y!=null&&(t=y.samples)!=null&&t.length){const b=Ct({id:s,frag:l,details:f},y);r.trigger(C.FRAG_PARSING_METADATA,b)}if(v){const b=Ct({id:s,frag:l,details:f},v);r.trigger(C.FRAG_PARSING_USERDATA,b)}}_bufferInitSegment(e,t,s,r){if(this.state!==ve.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(C.BUFFER_CODECS,t);const o=n.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:s,part:null,chunkMeta:r,parent:s.type,data:o};this.hls.trigger(C.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===Ot.NOT_LOADED||r===Ot.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&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=ve.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragments[0].start!==t.details.fragments[0].start&&Wa(t.details,a)}else this.startFragRequested=!0,super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:s}=this,r=s==null?void 0:s.attrs,n=e.attrs;t&&r&&(r.CHANNELS!==n.CHANNELS||s.name!==e.name||s.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(C.AUDIO_TRACK_SWITCHED,Nt({},e))}}class bA extends bc{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(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(C.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(C.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:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Audio track with id:${s} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}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 s=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||(r==null?void 0:r.length)!==(s==null?void 0:s.length)||s!=null&&s.some(o=>(r==null?void 0:r.indexOf(o))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(g=>!s||s.indexOf(g.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(g=>g.default)&&(this.selectDefaultTrack=!1),o.forEach((g,v)=>{g.id=v});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!n&&l){const g=Zs(l,o,Rr);if(g>-1)n=o[g];else{const v=Zs(l,this.tracks);n=this.tracks[v]}}let u=this.findTrackId(n);u===-1&&n&&(u=this.findTrackId(null));const d={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s==null?void 0:s.join(",")}`),this.hls.trigger(C.AUDIO_TRACKS_UPDATED,d);const f=this.trackId;if(u!==-1&&f===-1)this.setAudioTrack(u);else if(o.length&&f===-1){var a;const g=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(g.message),this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:g})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===it.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,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 s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const r=this.currentTrack;if(r&&Fr(e,r,Rr))return r;const n=Zs(e,this.tracksInGroup,Rr);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(r){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=bw(e,t.levels,s,a,Rr);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Zs(e,s);if(a>-1)return s[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const s=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===s&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(C.AUDIO_TRACK_SWITCHING,Nt({},r)),n))return;const a=this.switchParams(r.url,s==null?void 0:s.details,r.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const r=t[s];if(!(this.selectDefaultTrack&&!r.default)&&(!e||Fr(e,r,Rr)))return s}if(e){const{name:s,lang:r,assocLang:n,characteristics:a,audioCodec:o,channels:l}=e;for(let u=0;u<t.length;u++){const d=t[u];if(Fr({name:s,lang:r,assocLang:n,characteristics:a,audioCodec:o,channels:l},d,Rr))return u}for(let u=0;u<t.length;u++){const d=t[u];if(Ur(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const d=t[u];if(Ur(e.attrs,d.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const s=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}this.log(`loading audio-track playlist ${s} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(C.AUDIO_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:e||null})}}}const xd=500;class TA extends Ac{constructor(e,t,s){super(e,t,s,"[subtitle-stream-controller]",He.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.ERROR,this.onError,this),e.on(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(C.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(C.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.ERROR,this.onError,this),e.off(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(C.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(C.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=ve.IDLE,this.setInterval(xd),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:s,success:r}=t;if(this.fragPrevious=s,this.state=ve.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=s.start;for(let u=0;u<n.length;u++)if(o>=n[u].start&&o<=n[u].end){a=n[u];break}const l=s.start+s.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null)}onBufferFlushing(e,t){const{startOffset:s,endOffset:r}=t;if(s===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=n){a.shift();continue}else if(a[o].start<n)a[o].start=n;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(s,n,He.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===He.MAIN){var s;(s=this.media)!=null&&s.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const s=t.frag;(s==null?void 0:s.type)===He.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==ve.STOPPED&&(this.state=ve.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Sg(this.levels,t)){this.levels=t.map(s=>new $r(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const r=new $r(s);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,He.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(xd)}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:r,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=n[r];if(o>=n.length||o!==r||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(a.live||(s=l.details)!=null&&s.live){const f=this.mainDetails;if(a.deltaUpdateFailed||!f)return;const g=f.fragments[0];if(!l.details)a.hasProgramDateTime&&f.hasProgramDateTime?(Wa(a,f),u=a.fragments[0].start):g&&(u=g.start,Il(a,u));else{var d;u=this.alignPlaylists(a,l.details,(d=this.levelLastLoaded)==null?void 0:d.details),u===0&&g&&(u=g.start,Il(a,u))}}l.details=a,this.levelLastLoaded=l,!this.startFragRequested&&(this.mainDetails||!a.live)&&this.setStartPosition(this.mainDetails||a,u),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===ve.IDLE&&(za(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const a=performance.now();this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer).catch(o=>{throw n.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(C.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=ve.IDLE})}}doTick(){if(!this.media){this.state=ve.IDLE;return}if(this.state===ve.IDLE){const{currentTrackId:e,levels:t}=this,s=t==null?void 0:t[e];if(!s||!t.length||!s.details)return;const{config:r}=this,n=this.getLoadPosition(),a=vt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:o,len:l}=a,u=this.getFwdBufferInfo(this.media,He.MAIN),d=s.details,f=this.getMaxBufferLength(u==null?void 0:u.len)+d.levelTargetDuration;if(l>f)return;const g=d.fragments,v=g.length,y=d.edge;let E=null;const b=this.fragPrevious;if(o<y){const w=r.maxFragLookUpTolerance,F=o>y-w?0:w;E=za(b,g,Math.max(g[0].start,o),F),!E&&b&&b.start<g[0].start&&(E=g[0])}else E=g[v-1];if(!E)return;if(E=this.mapToInitFragWhenRequired(E),E.sn!=="initSegment"){const w=E.sn-d.startSN,F=g[w-1];F&&F.cc===E.cc&&this.fragmentTracker.getState(F)===Ot.NOT_LOADED&&(E=F)}this.fragmentTracker.getState(E)===Ot.NOT_LOADED&&this.loadFragment(E,s,o)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,s){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,s))}get mediaBufferTimeRanges(){return new wA(this.tracksBuffered[this.currentTrackId]||[])}}class wA{constructor(e){this.buffered=void 0;const t=(s,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}class AA extends bc{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.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=Sa(this.media.textTracks);for(let n=0;n<s.length;n++)if(s[n].mode==="hidden")t=s[n];else if(s[n].mode==="showing"){t=s[n];break}const r=this.findTrackForTextTrack(t);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(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(C.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(C.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(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Sa(this.media.textTracks).forEach(t=>{Dr(t)}),this.subtitleTrack=-1,this.media=null}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:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${s} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}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 s=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||(r==null?void 0:r.length)!==(s==null?void 0:s.length)||s!=null&&s.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(d=>!s||s.indexOf(d.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(d=>d.default)&&(this.selectDefaultTrack=!1),a.forEach((d,f)=>{d.id=f});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const d=Zs(o,a);if(d>-1)n=a[d];else{const f=Zs(o,this.tracks);n=this.tracks[f]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const u={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s==null?void 0:s.join(",")}" group-id`),this.hls.trigger(C.SUBTITLE_TRACKS_UPDATED,u),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(s&&!n.default||!s&&!e)&&(!e||Fr(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Ur(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Ur(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const r=t[s];if(Dl(r,e))return s}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===it.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&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){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const s=this.currentTrack;if(s&&Fr(e,s))return s;const r=Zs(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(s)return null;{const n=Zs(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const s=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}this.log(`Loading subtitle playlist for id ${s}`),this.hls.trigger(C.SUBTITLE_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Sa(e.textTracks),s=this.currentTrack;let r;if(s&&(r=t.filter(n=>Dl(s,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!_e(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const s=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(C.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===s&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:o="",name:l,type:u,url:d}=r;this.hls.trigger(C.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:u,url:d});const f=this.switchParams(r.url,s==null?void 0:s.details,r.details);this.loadPlaylist(f)}}class LA{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,s){const r=this.queues[t];r.push(e),r.length===1&&!s&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const s=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),s}executeNext(e){const t=this.queues[e];if(t.length){const s=t[0];try{s.execute()}catch(r){ie.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${r}`),s.onError(r);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Sd=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class CA{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=s=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:s,mediaSource:r}=this;this.log("Media source opened"),s&&(s.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(C.MEDIA_ATTACHED,{media:s,mediaSource:r})),r&&r.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:r}=this;s!==r&&ie.error(`Media element src was set while attaching MediaSource (${r} > ${s})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=NT(ar(e.config.preferManagedMediaSource)),this.log=ie.log.bind(ie,t),this.warn=ie.warn.bind(ie,t),this.error=ie.error.bind(ie,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.BUFFER_RESET,this.onBufferReset,this),e.on(C.BUFFER_APPENDING,this.onBufferAppending,this),e.on(C.BUFFER_CODECS,this.onBufferCodecs,this),e.on(C.BUFFER_EOS,this.onBufferEos,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(C.FRAG_PARSED,this.onFragParsed,this),e.on(C.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.BUFFER_RESET,this.onBufferReset,this),e.off(C.BUFFER_APPENDING,this.onBufferAppending,this),e.off(C.BUFFER_CODECS,this.onBufferCodecs,this),e.off(C.BUFFER_EOS,this.onBufferEos,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(C.FRAG_PARSED,this.onFragParsed,this),e.off(C.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new LA(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const s=this.media=t.media,r=ar(this.appendSource);if(s&&r){var n;const a=this.mediaSource=new r;this.log(`created media source: ${(n=a.constructor)==null?void 0:n.name}`),a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(a.addEventListener("startstreaming",this._onStartStreaming),a.addEventListener("endstreaming",this._onEndStreaming));const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&a instanceof l,Ed(s),RA(s,o),s.load()}catch{s.src=o}else s.src=o;s.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:s}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){this.warn(`onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(e.removeAttribute("src"),this.appendSource&&Ed(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(C.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var s;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(r){this.warn(`onBufferReset ${e}`,r)}}onBufferCodecs(e,t){const s=this.getSourceBufferTypes().length,r=Object.keys(t);if(r.forEach(a=>{if(s){const l=this.tracks[a];if(l&&typeof l.buffer.changeType=="function"){var o;const{id:u,codec:d,levelCodec:f,container:g,metadata:v}=t[a],y=Vh(l.codec,l.levelCodec),E=y==null?void 0:y.replace(Sd,"$1");let b=Vh(d,f);const w=(o=b)==null?void 0:o.replace(Sd,"$1");if(b&&E!==w){a.slice(0,5)==="audio"&&(b=Va(b,this.appendSource));const F=`${g};codecs=${b}`;this.appendChangeType(a,F),this.log(`switching codec ${y} to ${b}`),this.tracks[a]={buffer:l.buffer,codec:d,container:g,levelCodec:f,metadata:v,id:u}}}}else this.pendingTracks[a]=t[a]}),s)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${r.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:s}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),s.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};s.append(r,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:s,operationQueue:r,tracks:n}=this,{data:a,type:o,frag:l,part:u,chunkMeta:d}=t,f=d.buffering[o],g=self.performance.now();f.start=g;const v=l.stats.buffering,y=u?u.stats.buffering:null;v.start===0&&(v.start=g),y&&y.start===0&&(y.start=g);const E=n.audio;let b=!1;o==="audio"&&(E==null?void 0:E.container)==="audio/mpeg"&&(b=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const w=l.start,F={execute:()=>{if(f.executeStart=self.performance.now(),b){const k=this.sourceBuffer[o];if(k){const U=w-k.timestampOffset;Math.abs(U)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${w} (delta: ${U}) sn: ${l.sn})`),k.timestampOffset=w)}}this.appendExecutor(a,o)},onStart:()=>{},onComplete:()=>{const k=self.performance.now();f.executeEnd=f.end=k,v.first===0&&(v.first=k),y&&y.first===0&&(y.first=k);const{sourceBuffer:U}=this,N={};for(const te in U)N[te]=vt.getBuffered(U[te]);this.appendErrors[o]=0,o==="audio"||o==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(C.BUFFER_APPENDED,{type:o,frag:l,part:u,chunkMeta:d,parent:l.type,timeRanges:N})},onError:k=>{const U={type:je.MEDIA_ERROR,parent:l.type,details:ce.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:l,part:u,chunkMeta:d,error:k,err:k,fatal:!1};if(k.code===DOMException.QUOTA_EXCEEDED_ERR)U.details=ce.BUFFER_FULL_ERROR;else{const N=++this.appendErrors[o];U.details=ce.BUFFER_APPEND_ERROR,this.warn(`Failed ${N}/${s.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),N>=s.config.appendErrorMaxRetry&&(U.fatal=!0)}s.trigger(C.ERROR,U)}};r.append(F,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:s}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(C.BUFFER_FLUSHED,{type:n})},onError:a=>{this.warn(`Failed to remove from ${n} SourceBuffer`,a)}});t.type?s.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{s.append(r(n),n)})}onFragParsed(e,t){const{frag:s,part:r}=t,n=[],a=r?r.elementaryStreams:s.elementaryStreams;a[ht.AUDIOVIDEO]?n.push("audiovideo"):(a[ht.AUDIO]&&n.push("audio"),a[ht.VIDEO]&&n.push("video"));const o=()=>{const l=self.performance.now();s.stats.buffering.end=l,r&&(r.stats.buffering.end=l);const u=r?r.stats:s.stats;this.hls.trigger(C.FRAG_BUFFERED,{frag:s,part:r,stats:u,id:s.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const a=this.sourceBuffer[n];return a&&(!t.type||t.type===n)&&(a.ending=!0,a.ended||(a.ended=!0,this.log(`${n} sourceBuffer now EOS`))),r&&!!(!a||a.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const a=this.sourceBuffer[n];a&&(a.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,a=s.currentTime,o=t.levelTargetDuration,l=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(_e(l)&&l>0){const u=Math.max(l,o),d=Math.floor(a/o)*o-u;this.flushBackBuffer(a,o,d)}if(_e(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const u=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),d=Math.max(u,o),f=Math.floor(a/o)*o+d;this.flushFrontBuffer(a,o,f)}}flushBackBuffer(e,t,s){const{details:r,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(o=>{const l=n[o];if(l){const u=vt.getBuffered(l);if(u.length>0&&s>u.start(0)){if(this.hls.trigger(C.BACK_BUFFER_REACHED,{bufferEnd:s}),r!=null&&r.live)this.hls.trigger(C.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(l.ended&&u.end(u.length-1)-e<t*2){this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(C.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:o})}}})}flushFrontBuffer(e,t,s){const{sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(a=>{const o=r[a];if(o){const l=vt.getBuffered(o),u=l.length;if(u<2)return;const d=l.start(u-1),f=l.end(u-1);if(s>d||e>=d&&e<=f)return;if(o.ended&&e-f<2*t){this.log(`Cannot flush ${a} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(C.BUFFER_FLUSHING,{startOffset:d,endOffset:1/0,type:a})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:s,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,a=s.duration,o=_e(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(r.duration=1/0,this.updateSeekableRange(e)):(n>o&&n>a||!_e(a))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,s=e.fragments;if(s.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,s[0].start),a=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${a}.`),t.setLiveSeekableRange(n,a)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:s}=this,r=Object.keys(s).length;if(r&&(!e||r===2||"audiovideo"in s)){this.createSourceBuffers(s),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(C.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(a=>{t.executeNext(a)});else{const a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:s}=this;if(!s)throw Error("createSourceBuffers called when mediaSource was null");for(const n in e)if(!t[n]){var r;const a=e[n];if(!a)throw Error(`source buffer exists for track ${n}, however track does not`);let o=((r=a.levelCodec)==null?void 0:r.indexOf(","))===-1?a.levelCodec:a.codec;o&&n.slice(0,5)==="audio"&&(o=Va(o,this.appendSource));const l=`${a.container};codecs=${o}`;this.log(`creating sourceBuffer(${l})`);try{const u=t[n]=s.addSourceBuffer(l),d=n;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(d,"bufferedchange",(f,g)=>{const v=g.removedRanges;v!=null&&v.length&&this.hls.trigger(C.BUFFER_FLUSHED,{type:n})}),this.tracks[n]={buffer:u,codec:o,container:a.container,levelCodec:a.levelCodec,metadata:a.metadata,id:a.id}}catch(u){this.error(`error while trying to add sourceBuffer: ${u.message}`),this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:n,mimeType:l})}}}get mediaSrc(){var e;const t=((e=this.media)==null?void 0:e.firstChild)||this.media;return t==null?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:s}=this;s.current(e).onComplete(),s.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var s;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${r}`,t),this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(r)}removeExecutor(e,t,s){const{media:r,mediaSource:n,operationQueue:a,sourceBuffer:o}=this,l=o[e];if(!r||!n||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),a.shiftAndExecuteNext(e);return}const u=_e(r.duration)?r.duration:1/0,d=_e(n.duration)?n.duration:1/0,f=Math.max(0,t),g=Math.min(s,u,d);g>f&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${f},${g}] from the ${e} SourceBuffer`),l.remove(f,g)):a.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.sourceBuffer[t];if(!s){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}s.ended=!1,s.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:s}=this,r=t.map(n=>s.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const a=this.sourceBuffer[n];a!=null&&a.updating||s.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,s){const r=this.sourceBuffer[e];if(!r)return;const n=s.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(s=>{t.removeEventListener(s.event,s.listener)})}}function Ed(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function RA(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}const bd={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},Eg=function(e){let t=e;return bd.hasOwnProperty(e)&&(t=bd[e]),String.fromCharCode(t)},Is=15,fi=100,_A={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},IA={17:2,18:4,21:6,22:8,23:10,19:13,20:15},kA={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},PA={25:2,26:4,29:6,30:8,31:10,27:13,28:15},DA=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class MA{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;ie.log(`${this.time} [${e}] ${s}`)}}}const Yi=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class bg{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 s=0;s<t.length;s++){const r=t[s];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!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 FA{constructor(){this.uchar=" ",this.penState=new bg}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 OA{constructor(e){this.chars=[],this.pos=0,this.currPenState=new bg,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<fi;t++)this.chars.push(new FA);this.logger=e}equals(e){for(let t=0;t<fi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<fi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<fi;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>fi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=fi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s<t+1;s++)this.chars[s].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=Eg(e);if(this.pos>=fi){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<fi;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 s=0;s<fi;s++){const r=this.chars[s].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class tl{constructor(e){this.rows=[],this.currRow=Is-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Is;t++)this.rows.push(new OA(e));this.logger=e}reset(){for(let e=0;e<Is;e++)this.rows[e].clear();this.currRow=Is-1}equals(e){let t=!0;for(let s=0;s<Is;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<Is;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Is;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 = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Is;o++)this.rows[o].clear();const n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[n].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(a.rows[n+u])}}this.currRow=t;const s=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);s.setCursor(e.indent),e.color=s.chars[a].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}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 s="",r=-1;for(let n=0;n<Is;n++){const a=this.rows[n].getTextString();a&&(r=n+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?s="["+t.join(" | ")+"]":s=t.join(`
|
|
65
66
|
`)),s}getTextAndFormat(){return this.rows}}class Td{constructor(e,t,s){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 tl(s),this.nonDisplayedMemory=new tl(s),this.lastOutputScreen=new tl(s),this.currRollUpRow=this.displayedMemory.rows[Is-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Is-1],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),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(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"),this.mode!=="MODE_TEXT"&&(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"),this.mode==="MODE_POP-ON"){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 s=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[s]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t: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.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 wd{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Ld(),this.logger=void 0;const r=this.logger=new MA;this.channels=[null,new Td(e,t,r),new Td(e+1,s,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let s,r,n,a=!1;this.logger.time=e;for(let o=0;o<t.length;o+=2)if(r=t[o]&127,n=t[o+1]&127,!(r===0&&n===0)){if(this.logger.log(3,"["+Yi([t[o],t[o+1]])+"] -> ("+Yi([r,n])+")"),s=this.parseCmd(r,n),s||(s=this.parseMidrow(r,n)),s||(s=this.parsePAC(r,n)),s||(s=this.parseBackgroundAttributes(r,n)),!s&&(a=this.parseChars(r,n),a)){const l=this.currentChannel;l&&l>0?this.channels[l].insertChars(a):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!s&&!a&&this.logger.log(2,"Couldn't parse cleaned data "+Yi([r,n])+" orig: "+Yi([t[o],t[o+1]]))}}parseCmd(e,t){const{cmdHistory:s}=this,r=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(r||n))return!1;if(Ad(e,t,s))return Pr(null,null,s),this.logger.log(3,"Repeated command ("+Yi([e,t])+") is dropped"),!0;const a=e===20||e===21||e===23?1:2,o=this.channels[a];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),Pr(e,t,s),this.currentChannel=a,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[s];return r?(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Yi([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let s;const r=this.cmdHistory,n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,a=(e===16||e===24)&&t>=64&&t<=95;if(!(n||a))return!1;if(Ad(e,t,r))return Pr(null,null,r),!0;const o=e<=23?1:2;t>=64&&t<=95?s=o===1?_A[e]:kA[e]:s=o===1?IA[e]:PA[e];const l=this.channels[o];return l?(l.setPAC(this.interpretPAC(s,t)),Pr(e,t,r),this.currentChannel=o,!0):!1}interpretPAC(e,t){let s;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,r.underline=(s&1)===1,s<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((s-16)/2)*4,r}parseChars(e,t){let s,r=null,n=null;if(e>=25?(s=2,n=e-8):(s=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,"Special char '"+Eg(a)+"' in channel "+s),r=[a]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);if(r){const a=Yi(r);this.logger.log(3,"Char codes = "+a.join(",")),Pr(e,t,this.cmdHistory)}return r}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(s||r))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=DA[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(a),Pr(e,t,this.cmdHistory),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}this.cmdHistory=Ld()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const s=this.channels[t];s&&s.cueSplitAtTime(e)}}}function Pr(i,e,t){t.a=i,t.b=e}function Ad(i,e,t){return t.a===i&&t.b===e}function Ld(){return{a:null,b:null}}class ua{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(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var kc=function(){if(Br!=null&&Br.VTTCue)return self.VTTCue;const i=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const u=l.toLowerCase();return~o.indexOf(u)?u:!1}function s(o){return t(i,o)}function r(o){return t(e,o)}function n(o,...l){let u=1;for(;u<arguments.length;u++){const d=arguments[u];for(const f in d)o[f]=d[f]}return o}function a(o,l,u){const d=this,f={enumerable:!0};d.hasBeenReset=!1;let g="",v=!1,y=o,E=l,b=u,w=null,F="",k=!0,U="auto",N="start",te=50,j="middle",re=50,Q="middle";Object.defineProperty(d,"id",n({},f,{get:function(){return g},set:function(le){g=""+le}})),Object.defineProperty(d,"pauseOnExit",n({},f,{get:function(){return v},set:function(le){v=!!le}})),Object.defineProperty(d,"startTime",n({},f,{get:function(){return y},set:function(le){if(typeof le!="number")throw new TypeError("Start time must be set to a number.");y=le,this.hasBeenReset=!0}})),Object.defineProperty(d,"endTime",n({},f,{get:function(){return E},set:function(le){if(typeof le!="number")throw new TypeError("End time must be set to a number.");E=le,this.hasBeenReset=!0}})),Object.defineProperty(d,"text",n({},f,{get:function(){return b},set:function(le){b=""+le,this.hasBeenReset=!0}})),Object.defineProperty(d,"region",n({},f,{get:function(){return w},set:function(le){w=le,this.hasBeenReset=!0}})),Object.defineProperty(d,"vertical",n({},f,{get:function(){return F},set:function(le){const se=s(le);if(se===!1)throw new SyntaxError("An invalid or illegal string was specified.");F=se,this.hasBeenReset=!0}})),Object.defineProperty(d,"snapToLines",n({},f,{get:function(){return k},set:function(le){k=!!le,this.hasBeenReset=!0}})),Object.defineProperty(d,"line",n({},f,{get:function(){return U},set:function(le){if(typeof le!="number"&&le!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");U=le,this.hasBeenReset=!0}})),Object.defineProperty(d,"lineAlign",n({},f,{get:function(){return N},set:function(le){const se=r(le);if(!se)throw new SyntaxError("An invalid or illegal string was specified.");N=se,this.hasBeenReset=!0}})),Object.defineProperty(d,"position",n({},f,{get:function(){return te},set:function(le){if(le<0||le>100)throw new Error("Position must be between 0 and 100.");te=le,this.hasBeenReset=!0}})),Object.defineProperty(d,"positionAlign",n({},f,{get:function(){return j},set:function(le){const se=r(le);if(!se)throw new SyntaxError("An invalid or illegal string was specified.");j=se,this.hasBeenReset=!0}})),Object.defineProperty(d,"size",n({},f,{get:function(){return re},set:function(le){if(le<0||le>100)throw new Error("Size must be between 0 and 100.");re=le,this.hasBeenReset=!0}})),Object.defineProperty(d,"align",n({},f,{get:function(){return Q},set:function(le){const se=r(le);if(!se)throw new SyntaxError("An invalid or illegal string was specified.");Q=se,this.hasBeenReset=!0}})),d.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class NA{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Tg(i){function e(s,r,n,a){return(s|0)*3600+(r|0)*60+(n|0)+parseFloat(a||0)}const t=i.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class BA{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let r=0;r<s.length;++r)if(t===s[r]){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 s=parseFloat(t);if(s>=0&&s<=100)return this.set(e,s),!0}return!1}}function wg(i,e,t,s){const r=s?i.split(s):[i];for(const n in r){if(typeof r[n]!="string")continue;const a=r[n].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const Ml=new kc(0,0,""),ha=Ml.align==="middle"?"middle":"center";function $A(i,e,t){const s=i;function r(){const o=Tg(i);if(o===null)throw new Error("Malformed timestamp: "+s);return i=i.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){const u=new BA;wg(o,function(g,v){let y;switch(g){case"region":for(let E=t.length-1;E>=0;E--)if(t[E].id===v){u.set(g,t[E].region);break}break;case"vertical":u.alt(g,v,["rl","lr"]);break;case"line":y=v.split(","),u.integer(g,y[0]),u.percent(g,y[0])&&u.set("snapToLines",!1),u.alt(g,y[0],["auto"]),y.length===2&&u.alt("lineAlign",y[1],["start",ha,"end"]);break;case"position":y=v.split(","),u.percent(g,y[0]),y.length===2&&u.alt("positionAlign",y[1],["start",ha,"end","line-left","line-right","auto"]);break;case"size":u.percent(g,v);break;case"align":u.alt(g,v,["start",ha,"end","left","right"]);break}},/:/,/\s/),l.region=u.get("region",null),l.vertical=u.get("vertical","");let d=u.get("line","auto");d==="auto"&&Ml.line===-1&&(d=-1),l.line=d,l.lineAlign=u.get("lineAlign","start"),l.snapToLines=u.get("snapToLines",!0),l.size=u.get("size",100),l.align=u.get("align",ha);let f=u.get("position","auto");f==="auto"&&Ml.position===50&&(f=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=f}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),i.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);i=i.slice(3),a(),e.endTime=r(),a(),n(i,e)}function Ag(i){return i.replace(/<br(?: \/)?>/gi,`
|
|
66
67
|
`)}class UA{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new NA,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function s(){let n=t.buffer,a=0;for(n=Ag(n);a<n.length&&n[a]!=="\r"&&n[a]!==`
|
|
67
68
|
`;)++a;const o=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===`
|
|
@@ -73,14 +74,14 @@ Please look forward to the announcement of the winners!`}}},ko:{translation:{cha
|
|
|
73
74
|
`),u=[],d=e?uA(e.baseTime,e.timescale):0;let f="00:00.000",g=0,v=0,y,E=!0;o.oncue=function(b){const w=t[s];let F=t.ccOffset;const k=(g-d)/9e4;if(w!=null&&w.new&&(v!==void 0?F=t.ccOffset=w.start:HA(t,s,k)),k){if(!e){y=new Error("Missing initPTS for VTT MPEGTS");return}F=k-t.presentationOffset}const U=b.endTime-b.startTime,N=Es((b.startTime+F-v)*9e4,r*9e4)/9e4;b.startTime=Math.max(N,0),b.endTime=Math.max(N+U,0);const te=b.text.trim();b.text=decodeURIComponent(encodeURIComponent(te)),b.id||(b.id=Pc(b.startTime,b.endTime,te)),b.endTime>0&&u.push(b)},o.onparsingerror=function(b){y=b},o.onflush=function(){if(y){a(y);return}n(u)},l.forEach(b=>{if(E)if(sl(b,"X-TIMESTAMP-MAP=")){E=!1,b.slice(16).split(",").forEach(w=>{sl(w,"LOCAL:")?f=w.slice(6):sl(w,"MPEGTS:")&&(g=parseInt(w.slice(7)))});try{v=VA(f)/1e3}catch(w){y=w}return}else b===""&&(E=!1);o.parse(b+`
|
|
74
75
|
`)}),o.flush()}const rl="stpp.ttml.im1t",Lg=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Cg=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,KA={left:"start",center:"center",right:"end",start:"start",end:"end"};function Cd(i,e,t,s){const r=Qe(new Uint8Array(i),["mdat"]);if(r.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(o=>ei(o)),a=cA(e.baseTime,1,e.timescale);try{n.forEach(o=>t(zA(o,a)))}catch(o){s(o)}}function zA(i,e){const r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((f,g)=>(f[g]=r.getAttribute(`ttp:${g}`)||n[g],f),{}),o=r.getAttribute("xml:space")!=="preserve",l=Rd(nl(r,"styling","style")),u=Rd(nl(r,"layout","region")),d=nl(r,"body","[begin]");return[].map.call(d,f=>{const g=Rg(f,o);if(!g||!f.hasAttribute("begin"))return null;const v=ol(f.getAttribute("begin"),a),y=ol(f.getAttribute("dur"),a);let E=ol(f.getAttribute("end"),a);if(v===null)throw _d(f);if(E===null){if(y===null)throw _d(f);E=v+y}const b=new kc(v-e,E-e,g);b.id=Pc(b.startTime,b.endTime,b.text);const w=u[f.getAttribute("region")],F=l[f.getAttribute("style")],k=WA(w,F,l),{textAlign:U}=k;if(U){const N=KA[U];N&&(b.lineAlign=N),b.align=U}return Ct(b,k),b}).filter(f=>f!==null)}function nl(i,e,t){const s=i.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function Rd(i){return i.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function Rg(i,e){return[].slice.call(i.childNodes).reduce((t,s,r)=>{var n;return s.nodeName==="br"&&r?t+`
|
|
75
76
|
`:(n=s.childNodes)!=null&&n.length?Rg(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function WA(i,e,t){const s="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=i!=null&&i.hasAttribute("style")?i.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(r=t[a]),n.reduce((o,l)=>{const u=al(e,s,l)||al(i,s,l)||al(r,s,l);return u&&(o[l]=u),o},{})}function al(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function _d(i){return new Error(`Could not parse ttml timestamp ${i}`)}function ol(i,e){if(!i)return null;let t=Tg(i);return t===null&&(Lg.test(i)?t=qA(i,e):Cg.test(i)&&(t=YA(i,e))),t}function qA(i,e){const t=Lg.exec(i),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function YA(i,e){const t=Cg.exec(i),s=Number(t[1]);switch(t[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}class XA{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=kd(),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(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(C.FRAG_LOADING,this.onFragLoading,this),e.on(C.FRAG_LOADED,this.onFragLoaded,this),e.on(C.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(C.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(C.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(C.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(C.FRAG_LOADING,this.onFragLoading,this),e.off(C.FRAG_LOADED,this.onFragLoaded,this),e.off(C.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(C.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(C.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(C.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new ua(this,"textTrack1"),t=new ua(this,"textTrack2"),s=new ua(this,"textTrack3"),r=new ua(this,"textTrack4");this.cea608Parser1=new wd(1,e,t),this.cea608Parser2=new wd(3,s,r)}}addCues(e,t,s,r,n){let a=!1;for(let o=n.length;o--;){const l=n[o],u=QA(l[0],l[1],t,s);if(u>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],s),a=!0,u/(s-t)>.5))return}if(a||n.push([t,s]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,s,r)}else{const o=this.Cues.newCue(null,t,s,r);this.hls.trigger(C.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n}){const{unparsedVttFrags:a}=this;s==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),a.length&&(this.unparsedVttFrags=[],a.forEach(o=>{this.onFragLoaded(C.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:s}=this;if(s)for(let r=0;r<s.textTracks.length;r++){const n=s.textTracks[r];if(Id(n,{name:e,lang:t,attrs:{}}))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:s,media:r}=this,{label:n,languageCode:a}=t[e],o=this.getExistingTrack(n,a);if(o)s[e]=o,Dr(s[e]),qp(s[e],r);else{const l=this.createTextTrack("captions",n,a);l&&(l[e]=!0,s[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const s=t.label,r={_id:e,label:s,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(C.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,s){const r=this.media;if(r)return r.addTextTrack(e,t,s)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{Dr(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=kd(),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 s=0;s<t.length;s++)Dr(t[s])}onSubtitleTracksUpdated(e,t){const s=t.subtitleTracks||[],r=s.some(n=>n.textCodec===rl);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Sg(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const a=this.media,o=a?Sa(a.textTracks):null;if(this.tracks.forEach((l,u)=>{let d;if(o){let f=null;for(let g=0;g<o.length;g++)if(o[g]&&Id(o[g],l)){f=o[g],o[g]=null;break}f&&(d=f)}if(d)Dr(d);else{const f=_g(l);d=this.createTextTrack(f,l.name,l.lang),d&&(d.mode="disabled")}d&&this.textTracks.push(d)}),o!=null&&o.length){const l=o.filter(u=>u!==null).map(u=>u.label);l.length&&ie.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(C.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const r=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!r)return;const n=`textTrack${r[1]}`,a=this.captionsProperties[n];a&&(a.label=s.name,s.lang&&(a.languageCode=s.lang),a.media=s)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){this.initCea608Parsers();const{cea608Parser1:s,cea608Parser2:r,lastCc:n,lastSn:a,lastPartIndex:o}=this;if(!(!this.enabled||!s||!r)&&t.frag.type===He.MAIN){var l,u;const{cc:d,sn:f}=t.frag,g=(l=t==null||(u=t.part)==null?void 0:u.index)!=null?l:-1;f===a+1||f===a&&g===o+1||d===n||(s.reset(),r.reset()),this.lastCc=d,this.lastSn=f,this.lastPartIndex=g}}onFragLoaded(e,t){const{frag:s,payload:r}=t;if(s.type===He.SUBTITLE)if(r.byteLength){const n=s.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[s.level],l=this.vttCCs;l[s.cc]||(l[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),o&&o.textCodec===rl?this._parseIMSC1(s,r):this._parseVTTs(t)}}else this.hls.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;Cd(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),s.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{ie.log(`Failed to parse IMSC1: ${r}`),s.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:s,payload:r}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[s.cc]&&o===-1){a.push(e);return}const l=this.hls,u=(t=s.initSegment)!=null&&t.data?bs(s.initSegment.data,new Uint8Array(r)):r;jA(u,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,d=>{this._appendCues(d,s.level),l.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},d=>{const f=d.message==="Missing initPTS for VTT MPEGTS";f?a.push(e):this._fallbackToIMSC1(s,r),ie.log(`Failed to parse VTT cue: ${d}`),!(f&&o>s.cc)&&l.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:d})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||Cd(t,this.initPTS[e.cc],()=>{s.textCodec=rl,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>Yp(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;s.trigger(C.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===He.SUBTITLE&&this.onFragLoaded(C.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:s,cea608Parser2:r}=this;if(!this.enabled||!s||!r)return;const{frag:n,samples:a}=t;if(!(n.type===He.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let o=0;o<a.length;o++){const l=a[o].bytes;if(l){const u=this.extractCea608Data(l);s.addData(a[o].pts,u[0]),r.addData(a[o].pts,u[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:s,endOffsetSubtitles:r,type:n}){const{media:a}=this;if(!(!a||a.currentTime<s)){if(!n||n==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(l=>Cl(o[l],t,s))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>Cl(o[l],t,r))}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let r=2;for(let n=0;n<s;n++){const a=e[r++],o=127&e[r++],l=127&e[r++];if(o===0&&l===0)continue;if((4&a)!==0){const d=3&a;(d===0||d===1)&&(t[d].push(o),t[d].push(l))}}return t}}function _g(i){return i.characteristics&&/transcribes-spoken-dialog/gi.test(i.characteristics)&&/describes-music-and-sound/gi.test(i.characteristics)?"captions":"subtitles"}function Id(i,e){return!!i&&i.kind===_g(e)&&Dl(e,i)}function QA(i,e,t,s){return Math.min(e,s)-Math.max(i,t)}function kd(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Dc{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(C.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.BUFFER_CODECS,this.onBufferCodecs,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(C.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.BUFFER_CODECS,this.onBufferCodecs,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.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 s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&_e(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&ie.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=s,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 s=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,Dc.getMaxLevelByMediaSize(s,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 s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.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{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;const r=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let n=e.length-1;const a=Math.max(t,s);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&r(l,e[o+1])){n=o;break}}return n}}class JA{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(C.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,s){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,a=s-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,u=this.hls;if(u.trigger(C.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:s}),l>0&&a>u.config.fpsDroppedMonitoringThreshold*o){let d=u.currentLevel;ie.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=d)&&(d=d-1,u.trigger(C.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:u.currentLevel}),u.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=s,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)}}const da="[eme]";class Or{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Or.CDMCleanupPromise?[Or.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=ie.debug.bind(ie,da),this.log=ie.log.bind(ie,da),this.warn=ie.warn.bind(ie,da),this.error=ie.error.bind(ie,da),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(C.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(C.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(C.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(C.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===yt.WIDEVINE&&s)return s;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(a,o,l)=>!!a&&l.indexOf(a)===o,r=t.map(a=>a.audioCodec).filter(s),n=t.map(a=>a.videoCodec).filter(s);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const l=u=>{const d=u.shift();this.getMediaKeysPromise(d,r,n).then(f=>a({keySystem:d,mediaKeys:f})).catch(f=>{u.length?l(u):f instanceof xs?o(f):o(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${s}`;return Fp===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return s(e,t)}getMediaKeysPromise(e,t,s){const r=cT(e,t,s,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let a=n==null?void 0:n.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),a=this.requestMediaKeySystemAccess(e,r);const o=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),a.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const u=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=l.createMediaKeys().then(d=>(this.log(`Media-keys created for "${e}"`),u.then(f=>f?this.setMediaKeysServerCertificate(d,e,f):d))),o.mediaKeys.catch(d=>{this.error(`Failed to create media-keys for "${e}"}: ${d}`)}),o.mediaKeys})}return a.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${js.hexDump(e.keyId||[])}`);const r=s.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(s,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return js.hexDump(e.keyId)}updateKeySession(e,t){var s;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${js.hexDump(((s=e.decryptdata)==null?void 0:s.keyId)||[])}
|
|
76
|
-
} (data length: ${t&&t.byteLength})`),r.update(t)}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){return new Promise((t,s)=>{const r=Ho(this.config),n=e.map(Fh).filter(a=>!!a&&r.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:a})=>{const o=Oh(a);o?t(o):s(new Error(`Unable to find format for key-system "${a}"`))}).catch(s)})}loadKey(e){const t=e.keyInfo.decryptdata,s=this.getKeyIdString(t),r=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[s];return n||(n=this.keyIdToKeySessionPromise[s]=this.getKeySystemForKeyPromise(t).then(({keySystem:a,mediaKeys:o})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(a,o).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:a,mediaKeys:o,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),n.catch(a=>this.handleError(a))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof xs?this.hls.trigger(C.ERROR,e.data):this.hls.trigger(C.ERROR,{type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[t];if(!s){const r=Fh(e.keyFormat),n=r?[r]:Ho(this.config);return this.attemptKeySystemAccess(n)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=Ho(this.config)),e.length===0)throw new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:s}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),s===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[yt.FAIRPLAY]){const d=It(new Uint8Array(s));try{const f=yc(JSON.parse(d).sinf),g=Hp(new Uint8Array(f));if(!g)return;r=g.subarray(8,24),n=yt.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const d=MT(s);if(d===null)return;d.version===0&&d.systemId===Mp.WIDEVINE&&d.data&&(r=d.data.subarray(8,24)),n=lT(d.systemId)}if(!n||!r)return;const a=js.hexDump(r),{keyIdToKeySessionPromise:o,mediaKeySessions:l}=this;let u=o[a];for(let d=0;d<l.length;d++){const f=l[d],g=f.decryptdata;if(g.pssh||!g.keyId)continue;const v=js.hexDump(g.keyId);if(a===v||g.uri.replace(/-/g,"").indexOf(a)!==-1){u=o[v],delete o[v],g.pssh=new Uint8Array(s),g.keyId=r,u=o[a]=u.then(()=>this.generateRequestWithPreferredKeySession(f,t,s,"encrypted-event-key-match"));break}}u||(u=o[a]=this.getKeySystemSelectionPromise([n]).then(({keySystem:d,mediaKeys:f})=>{var g;this.throwIfDestroyed();const v=new kn("ISO-23001-7",a,(g=Oh(d))!=null?g:"");return v.pssh=new Uint8Array(s),v.keyId=r,this.attemptSetMediaKeys(d,f).then(()=>{this.throwIfDestroyed();const y=this.createMediaKeySessionContext({decryptdata:v,keySystem:d,mediaKeys:f});return this.generateRequestWithPreferredKeySession(y,t,s,"encrypted-event-no-match")})})),u.catch(d=>this.handleError(d))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(s).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>s.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,s,r){var n,a;const o=(n=this.config.drmSystems)==null||(a=n[e.keySystem])==null?void 0:a.generateRequest;if(o)try{const y=o.call(this.hls,t,s,e);if(!y)throw new Error("Invalid response from configured generateRequest filter");t=y.initDataType,s=e.decryptdata.pssh=y.initData?new Uint8Array(y.initData):null}catch(y){var l;if(this.warn(y.message),(l=this.hls)!=null&&l.config.debug)throw y}if(s===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const u=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${u} (init data type: ${t} length: ${s?s.byteLength:null})`);const d=new Ic,f=e._onmessage=y=>{const E=e.mediaKeysSession;if(!E){d.emit("error",new Error("invalid state"));return}const{messageType:b,message:w}=y;this.log(`"${b}" message event for session "${E.sessionId}" message size: ${w.byteLength}`),b==="license-request"||b==="license-renewal"?this.renewLicense(e,w).catch(F=>{this.handleError(F),d.emit("error",F)}):b==="license-release"?e.keySystem===yt.FAIRPLAY&&(this.updateKeySession(e,Al("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${b}"`)},g=e._onkeystatuseschange=y=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const b=e.keyStatus;d.emit("keyStatus",b),b==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",f),e.mediaKeysSession.addEventListener("keystatuseschange",g);const v=new Promise((y,E)=>{d.on("error",E),d.on("keyStatus",b=>{b.startsWith("usable")?y():b==="output-restricted"?E(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):b==="internal-error"?E(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${b}"`)):b==="expired"?E(new Error("key expired while generating request")):this.warn(`unhandled key status change "${b}"`)})});return e.mediaKeysSession.generateRequest(t,s).then(()=>{var y;this.log(`Request generated for key-session "${(y=e.mediaKeysSession)==null?void 0:y.sessionId}" keyId: ${u}`)}).catch(y=>{throw new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_SESSION,error:y,fatal:!1},`Error generating key-session request: ${y}`)}).then(()=>v).catch(y=>{throw d.removeAllListeners(),this.removeSession(e),y}).then(()=>(d.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,s)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${js.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${js.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,s=t.loader,r=new s(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:n},u=t.certLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(g,v,y,E)=>{a(g.data)},onError:(g,v,y,E)=>{o(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:Nt({url:l.url,data:void 0},g)},`"${e}" certificate request failed (${n}). Status: ${g.code} (${g.text})`))},onTimeout:(g,v,y)=>{o(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(g,v,y)=>{o(new Error("aborted"))}};r.load(l,d,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((r,n)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s==null?void 0:s.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(r=>{throw new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(s,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let d;for(let f=0,g=n.length;f<g;f++){var a,o;d=n[f];const v=(a=d.querySelector("name"))==null?void 0:a.textContent,y=(o=d.querySelector("value"))==null?void 0:o.textContent;v&&y&&e.setRequestHeader(v,y)}}const l=r.querySelector("Challenge"),u=l==null?void 0:l.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return Al(atob(u))}setupLicenseXHR(e,t,s,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,s,r)}).catch(a=>{if(!s.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,s,r)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const a=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const u=this.config.licenseResponseCallback;if(u)try{l=u.call(this.hls,o,a,e)}catch(d){this.error(d)}r(l)}else{const l=s.errorRetry,u=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)n(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const d=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${d} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:u})=>{e.keySystem==yt.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(l,u)),l.send(u)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,s.addEventListener("encrypted",this.onMediaEncrypted),s.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},kn.clearKeyUriToKeyIdMap();const s=t.length;Or.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}`)}))).then(()=>{s&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}Or.CDMCleanupPromise=void 0;class xs 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}}var Wt;(function(i){i.MANIFEST="m",i.AUDIO="a",i.VIDEO="v",i.MUXED="av",i.INIT="i",i.CAPTION="c",i.TIMED_TEXT="tt",i.KEY="k",i.OTHER="o"})(Wt||(Wt={}));var Fl;(function(i){i.DASH="d",i.HLS="h",i.SMOOTH="s",i.OTHER="o"})(Fl||(Fl={}));var er;(function(i){i.OBJECT="CMCD-Object",i.REQUEST="CMCD-Request",i.SESSION="CMCD-Session",i.STATUS="CMCD-Status"})(er||(er={}));const ZA={[er.OBJECT]:["br","d","ot","tb"],[er.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[er.SESSION]:["cid","pr","sf","sid","st","v"],[er.STATUS]:["bs","rtp"]};class Gr{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(s=>s instanceof Gr?s:new Gr(s))),this.value=e,this.params=t}}class Ig{constructor(e){this.description=void 0,this.description=e}}const eL="Dict";function tL(i){return Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":typeof i=="object"?JSON.stringify(i):String(i)}function sL(i,e,t,s){return new Error(`failed to ${i} "${tL(e)}" as ${t}`,{cause:s})}const Pd="Bare Item",iL="Boolean",rL="Byte Sequence",nL="Decimal",aL="Integer";function oL(i){return i<-999999999999999||999999999999999<i}const lL=/[\x00-\x1f\x7f]+/,cL="Token",uL="Key";function ti(i,e,t){return sL("serialize",i,e,t)}function hL(i){if(typeof i!="boolean")throw ti(i,iL);return i?"?1":"?0"}function dL(i){return btoa(String.fromCharCode(...i))}function fL(i){if(ArrayBuffer.isView(i)===!1)throw ti(i,rL);return`:${dL(i)}:`}function kg(i){if(oL(i))throw ti(i,aL);return i.toString()}function pL(i){return`@${kg(i.getTime()/1e3)}`}function Pg(i,e){if(i<0)return-Pg(-i,e);const t=Math.pow(10,e);if(Math.abs(i*t%1-.5)<Number.EPSILON){const r=Math.floor(i*t);return(r%2===0?r:r+1)/t}else return Math.round(i*t)/t}function gL(i){const e=Pg(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ti(i,nL);const t=e.toString();return t.includes(".")?t:`${t}.0`}const mL="String";function vL(i){if(lL.test(i))throw ti(i,mL);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function yL(i){return i.description||i.toString().slice(7,-1)}function Dd(i){const e=yL(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ti(e,cL);return e}function Ol(i){switch(typeof i){case"number":if(!_e(i))throw ti(i,Pd);return Number.isInteger(i)?kg(i):gL(i);case"string":return vL(i);case"symbol":return Dd(i);case"boolean":return hL(i);case"object":if(i instanceof Date)return pL(i);if(i instanceof Uint8Array)return fL(i);if(i instanceof Ig)return Dd(i);default:throw ti(i,Pd)}}function Nl(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw ti(i,uL);return i}function Mc(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${Nl(e)}`:`;${Nl(e)}=${Ol(t)}`).join("")}function Dg(i){return i instanceof Gr?`${Ol(i.value)}${Mc(i.params)}`:Ol(i)}function xL(i){return`(${i.value.map(Dg).join(" ")})${Mc(i.params)}`}function SL(i,e={whitespace:!0}){if(typeof i!="object")throw ti(i,eL);const t=i instanceof Map?i.entries():Object.entries(i),s=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Gr||(n=new Gr(n));let a=Nl(r);return n.value===!0?a+=Mc(n.params):(a+="=",Array.isArray(n.value)?a+=xL(n):a+=Dg(n)),a}).join(`,${s}`)}function EL(i,e){return SL(i,e)}const bL=i=>i==="ot"||i==="sf"||i==="st",TL=i=>typeof i=="number"?_e(i):i!=null&&i!==""&&i!==!1;function wL(i,e){const t=new URL(i),s=new URL(e);if(t.origin!==s.origin)return i;const r=t.pathname.split("/").slice(1),n=s.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")}function AL(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}const La=i=>Math.round(i),LL=(i,e)=>(e!=null&&e.baseUrl&&(i=wL(i,e.baseUrl)),encodeURIComponent(i)),fa=i=>La(i/100)*100,CL={br:La,d:La,bl:fa,dl:fa,mtp:fa,nor:LL,rtp:fa,tb:La};function RL(i,e){const t={};if(i==null||typeof i!="object")return t;const s=Object.keys(i).sort(),r=Ct({},CL,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return s.forEach(a=>{if(n!=null&&n(a))return;let o=i[a];const l=r[a];l&&(o=l(o,e)),!(a==="v"&&o===1)&&(a=="pr"&&o===1||TL(o)&&(bL(a)&&typeof o=="string"&&(o=new Ig(o)),t[a]=o))}),t}function Mg(i,e={}){return i?EL(RL(i,e),Ct({whitespace:!1},e)):""}function _L(i,e={}){if(!i)return{};const t=Object.entries(i),s=Object.entries(ZA).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),r=t.reduce((n,a)=>{var o,l;const[u,d]=a,f=((o=s.find(g=>g[1].includes(u)))==null?void 0:o[0])||er.REQUEST;return(l=n[f])!=null||(n[f]={}),n[f][u]=d,n},{});return Object.entries(r).reduce((n,[a,o])=>(n[a]=Mg(o,e),n),{})}function IL(i,e,t){return Ct(i,_L(e,t))}const kL="CMCD";function PL(i,e={}){if(!i)return"";const t=Mg(i,e);return`${kL}=${encodeURIComponent(t)}`}const Md=/CMCD=[^&#]+/;function DL(i,e,t){const s=PL(e,t);if(!s)return i;if(Md.test(i))return i.replace(Md,s);const r=i.includes("?")?"&":"?";return`${i}${r}${s}`}class ML{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=r=>{try{this.apply(r,{ot:Wt.MANIFEST,su:!this.initialized})}catch(n){ie.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,a=this.hls.levels[n.level],o=this.getObjectType(n),l={d:n.duration*1e3,ot:o};(o===Wt.VIDEO||o===Wt.AUDIO||o==Wt.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(r,l)}catch(n){ie.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||AL(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHED,this.onMediaDetached,this),e.on(C.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHED,this.onMediaDetached,this),e.off(C.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=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 s,r;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:Fl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ct(t,this.createData());const s=t.ot===Wt.INIT||t.ot===Wt.VIDEO||t.ot===Wt.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((n,a)=>(r.includes(a)&&(n[a]=t[a]),n),{})),this.useHeaders?(e.headers||(e.headers={}),IL(e.headers,t)):e.url=DL(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Wt.TIMED_TEXT;if(e.sn==="initSegment")return Wt.INIT;if(t==="audio")return Wt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Wt.VIDEO:Wt.MUXED}getTopBandwidth(e){let t=0,s;const r=this.hls;if(e===Wt.AUDIO)s=r.audioTracks;else{const n=r.maxAutoLevel,a=n>-1?n+1:r.levels.length;s=r.levels.slice(0,a)}for(const n of s)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,s=e===Wt.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:mt.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}}const FL=3e5;class OL{constructor(e){this.hls=void 0,this.log=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.log=ie.log.bind(ie,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(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(s=>s!==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:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if((s==null?void 0:s.action)===Ht.SendAlternateToPenaltyBox&&s.flags===_s.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this.pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:u}=t.context;o&&r?a=this.getPathwayForGroupId(o,u,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&r&&(n=r.reduce((o,l)=>(o.indexOf(l.pathwayId)===-1&&o.push(l.pathwayId),o),[])),n&&n.length>1&&(this.updatePathwayPriority(n),s.resolved=this.pathwayId!==a),s.resolved||ie.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${r&&r.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const s=this.penalizedPathways,r=performance.now();Object.keys(s).forEach(n=>{r-s[n]>FL&&delete s[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in s)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Zp(t),this.hls.trigger(C.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];l&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){const r=this.getLevelsForPathway(s).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===it.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===it.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return s}clonePathways(e){const t=this.levels;if(!t)return;const s={},r={};e.forEach(n=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(d=>d.pathwayId===a))return;const u=this.getLevelsForPathway(o).map(d=>{const f=new St(d.attrs);f["PATHWAY-ID"]=a;const g=f.AUDIO&&`${f.AUDIO}_clone_${a}`,v=f.SUBTITLES&&`${f.SUBTITLES}_clone_${a}`;g&&(s[f.AUDIO]=g,f.AUDIO=g),v&&(r[f.SUBTITLES]=v,f.SUBTITLES=v);const y=Fg(d.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),E=new $r({attrs:f,audioCodec:d.audioCodec,bitrate:d.bitrate,height:d.height,name:d.name,url:y,videoCodec:d.videoCodec,width:d.width});if(d.audioGroups)for(let b=1;b<d.audioGroups.length;b++)E.addGroupId("audio",`${d.audioGroups[b]}_clone_${a}`);if(d.subtitleGroups)for(let b=1;b<d.subtitleGroups.length;b++)E.addGroupId("text",`${d.subtitleGroups[b]}_clone_${a}`);return E});t.push(...u),Fd(this.audioTracks,s,l,a),Fd(this.subtitleTracks,r,l,a)})}loadSteeringManifest(e){const t=this.hls.config,s=t.loader;this.loader&&this.loader.destroy(),this.loader=new s(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const d=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+d)}const n={responseType:"json",url:r.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(d,f,g,v)=>{this.log(`Loaded steering manifest: "${r}"`);const y=d.data;if(y.VERSION!==1){this.log(`Steering VERSION ${y.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=y.TTL;const{"RELOAD-URI":E,"PATHWAY-CLONES":b,"PATHWAY-PRIORITY":w}=y;if(E)try{this.uri=new self.URL(E,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${E}`);return}this.scheduleRefresh(this.uri||g.url),b&&this.clonePathways(b);const F={steeringManifest:y,url:r.toString()};this.hls.trigger(C.STEERING_MANIFEST_LOADED,F),w&&this.updatePathwayPriority(w)},onError:(d,f,g,v)=>{if(this.log(`Error loading steering manifest: ${d.code} ${d.text} (${f.url})`),this.stopLoad(),d.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let y=this.timeToLoad*1e3;if(d.code===429){const E=this.loader;if(typeof(E==null?void 0:E.getResponseHeader)=="function"){const b=E.getResponseHeader("Retry-After");b&&(y=parseFloat(b)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,y)},onTimeout:(d,f,g)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,l,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const r=(s=this.hls)==null?void 0:s.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Fd(i,e,t,s){i&&Object.keys(e).forEach(r=>{const n=i.filter(a=>a.groupId===r).map(a=>{const o=Ct({},a);return o.details=void 0,o.attrs=new St(o.attrs),o.url=o.attrs.URI=Fg(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[r],o.attrs["PATHWAY-ID"]=s,o});i.push(...n)})}function Fg(i,e,t,s){const{HOST:r,PARAMS:n,[t]:a}=s;let o;e&&(o=a==null?void 0:a[e],o&&(i=o));const l=new self.URL(i);return r&&!o&&(l.host=r),n&&Object.keys(n).sort().forEach(u=>{u&&l.searchParams.set(u,n[u])}),l.href}const NL=/^age:\s*[\d.]+\s*$/im;class Og{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 io,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){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=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!this.stats.aborted)return n(s,t.url)}).catch(a=>(s.open("GET",t.url,!0),n(s,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(a=>{this.callbacks.onError({code:s.status,text:a.message},t,s,r)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=s.loadPolicy;if(r)for(const o in r)e.setRequestHeader(o,r[o]);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),s.timeout=n&&_e(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!s.aborted&&r>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.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-(s.loading.first-s.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const a=t.status,o=t.responseType!=="text";if(a>=200&&a<300&&(o&&t.response||t.responseText!==null)){s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=o?t.response:t.responseText,u=t.responseType==="arraybuffer"?l.byteLength:l.length;if(s.loaded=s.total=u,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first),!this.callbacks)return;const d=this.callbacks.onProgress;if(d&&d(s,e,l,t),!this.callbacks)return;const f={url:t.responseURL,data:l,code:a};this.callbacks.onSuccess(f,s,e,t)}else{const l=n.loadPolicy.errorRetry,u=s.retry,d={url:e.url,data:void 0,code:a};Ka(l,u,!1,d)?this.retry(l):(ie.error(`${a} while loading ${e.url}`),this.callbacks.onError({code:a,text:t.statusText},e,t,s))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,s=this.stats.retry;if(Ka(t,s,!0))this.retry(t);else{var r;ie.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=Ec(e,s.retry),s.retry++,ie.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${s.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&&NL.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}}function BL(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const $L=/(\d+)-(\d+)\/(\d+)/;class Od{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||HL,this.controller=new self.AbortController,this.stats=new io}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(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=UL(e,this.controller.signal),a=s.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:u,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=u&&_e(u)?u:d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(f=>{this.response=this.loader=f;const g=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(r,e,this.response)},d-(g-r.loading.start)),!f.ok){const{status:v,statusText:y}=f;throw new jL(y||"fetch, bad network response",v,f)}return r.loading.first=g,r.total=VL(f.headers)||r.total,a&&_e(t.highWaterMark)?this.loadProgressively(f,r,e,t.highWaterMark,a):o?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{const g=this.response;if(!g)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const v=f[l];v&&(r.loaded=r.total=v);const y={url:g.url,data:f,code:g.status};a&&!_e(t.highWaterMark)&&a(r,e,f,g),s.onSuccess(y,r,e,g)}).catch(f=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const g=f&&f.code||0,v=f?f.message:null;s.onError({code:g,text:v},e,f?f.details:null,r)})}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,s,r=0,n){const a=new ig,o=e.body.getReader(),l=()=>o.read().then(u=>{if(u.done)return a.dataLength&&n(t,s,a.flush(),e),Promise.resolve(new ArrayBuffer(0));const d=u.value,f=d.length;return t.loaded+=f,f<r||a.dataLength?(a.push(d),a.dataLength>=r&&n(t,s,a.flush(),e)):n(t,s,d,e),l()}).catch(()=>Promise.reject());return l()}}function UL(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ct({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function GL(i){const e=$L.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function VL(i){const e=i.get("Content-Range");if(e){const s=GL(e);if(_e(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function HL(i,e){return new self.Request(i.url,e)}class jL extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const KL=/\s/,zL={newCue(i,e,t,s){const r=[];let n,a,o,l,u;const d=self.VTTCue||self.TextTrackCue;for(let g=0;g<s.rows.length;g++)if(n=s.rows[g],o=!0,l=0,u="",!n.isEmpty()){var f;for(let E=0;E<n.chars.length;E++)KL.test(n.chars[E].uchar)&&o?l++:(u+=n.chars[E].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const v=Ag(u.trim()),y=Pc(e,t,v);i!=null&&(f=i.cues)!=null&&f.getCueById(y)||(a=new d(e,t,v),a.id=y,a.line=g+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),r.push(a))}return i&&r.length&&(r.sort((g,v)=>g.line==="auto"||v.line==="auto"?0:g.line>8&&v.line>8?v.line-g.line:g.line-v.line),r.forEach(g=>Yp(i,g))),r}},WL={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Ng=Nt(Nt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,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,loader:Og,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Tw,bufferController:CA,capLevelController:Dc,errorController:hw,fpsController:JA,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:Fp,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:WL},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}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},qL()),{},{subtitleStreamController:TA,subtitleTrackController:AA,timelineController:XA,audioStreamController:EA,audioTrackController:bA,emeController:Or,cmcdController:ML,contentSteeringController:OL});function qL(){return{cueHandler:zL,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function YL(i,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Bl(i),s=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(n=>{const a=`${n==="level"?"playlist":n}LoadPolicy`,o=e[a]===void 0,l=[];r.forEach(u=>{const d=`${n}Loading${u}`,f=e[d];if(f!==void 0&&o){l.push(d);const g=t[a].default;switch(e[a]={default:g},u){case"TimeOut":g.maxLoadTimeMs=f,g.maxTimeToFirstByteMs=f;break;case"MaxRetry":g.errorRetry.maxNumRetry=f,g.timeoutRetry.maxNumRetry=f;break;case"RetryDelay":g.errorRetry.retryDelayMs=f,g.timeoutRetry.retryDelayMs=f;break;case"MaxRetryTimeout":g.errorRetry.maxRetryDelayMs=f,g.timeoutRetry.maxRetryDelayMs=f;break}}}),l.length&&ie.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(e[a])}`)}),Nt(Nt({},t),e)}function Bl(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(Bl):Object.keys(i).reduce((e,t)=>(e[t]=Bl(i[t]),e),{}):i}function XL(i){const e=i.loader;e!==Od&&e!==Og?(ie.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):BL()&&(i.loader=Od,i.progressive=!0,i.enableSoftwareAES=!0,ie.log("[config]: Progressive streaming enabled, using FetchLoader"))}let ll;class QL extends bc{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(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.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 s=this.hls.config.preferManagedMediaSource,r=[],n={},a={};let o=!1,l=!1,u=!1;t.levels.forEach(d=>{var f,g;const v=d.attrs;let{audioCodec:y,videoCodec:E}=d;((f=y)==null?void 0:f.indexOf("mp4a.40.34"))!==-1&&(ll||(ll=/chrome|firefox/i.test(navigator.userAgent)),ll&&(d.audioCodec=y=void 0)),y&&(d.audioCodec=y=Va(y,s)),((g=E)==null?void 0:g.indexOf("avc1"))===0&&(E=d.videoCodec=GT(E));const{width:b,height:w,unknownCodecs:F}=d;if(o||(o=!!(b&&w)),l||(l=!!E),u||(u=!!y),F!=null&&F.length||y&&!Wo(y,"audio",s)||E&&!Wo(E,"video",s))return;const{CODECS:k,"FRAME-RATE":U,"HDCP-LEVEL":N,"PATHWAY-ID":te,RESOLUTION:j,"VIDEO-RANGE":re}=v,le=`${`${te||"."}-`}${d.bitrate}-${j}-${U}-${k}-${re}-${N}`;if(n[le])if(n[le].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const se=a[le]+=1;d.attrs["PATHWAY-ID"]=new Array(se+1).join(".");const pe=new $r(d);n[le]=pe,r.push(pe)}else n[le].addGroupId("audio",v.AUDIO),n[le].addGroupId("text",v.SUBTITLES);else{const se=new $r(d);n[le]=se,a[le]=1,r.push(se)}}),this.filterAndSortMediaOptions(r,t,o,l,u)}filterAndSortMediaOptions(e,t,s,r,n){let a=[],o=[],l=e;if((s||r)&&n&&(l=l.filter(({videoCodec:y,videoRange:E,width:b,height:w})=>(!!y||!!(b&&w))&&ew(E))),l.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const y=new Error("no level with compatible codecs found in manifest");this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:y,reason:y.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:y}=this.hls.config;a=t.audioTracks.filter(E=>!E.audioCodec||Wo(E.audioCodec,"audio",y)),Nd(a)}t.subtitles&&(o=t.subtitles,Nd(o));const u=l.slice(0);l.sort((y,E)=>{if(y.attrs["HDCP-LEVEL"]!==E.attrs["HDCP-LEVEL"])return(y.attrs["HDCP-LEVEL"]||"")>(E.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&y.height!==E.height)return y.height-E.height;if(y.frameRate!==E.frameRate)return y.frameRate-E.frameRate;if(y.videoRange!==E.videoRange)return Ha.indexOf(y.videoRange)-Ha.indexOf(E.videoRange);if(y.videoCodec!==E.videoCodec){const b=Gh(y.videoCodec),w=Gh(E.videoCodec);if(b!==w)return w-b}if(y.uri===E.uri&&y.codecSet!==E.codecSet){const b=Ga(y.codecSet),w=Ga(E.codecSet);if(b!==w)return w-b}return y.averageBitrate!==E.averageBitrate?y.averageBitrate-E.averageBitrate:0});let d=u[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==u.length)){for(let y=0;y<u.length;y++)if(u[y].pathwayId===l[0].pathwayId){d=u[y];break}}this._levels=l;for(let y=0;y<l.length;y++)if(l[y]===d){var f;this._firstLevel=y;const E=d.bitrate,b=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${E}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const w=Math.min(E,this.hls.config.abrEwmaDefaultEstimateMax);w>b&&b===Ng.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=w)}break}const g=n&&!r,v={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:!g&&a.some(y=>!!y.url)};this.hls.trigger(C.MANIFEST_PARSED,v),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const d=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(C.ERROR,{type:je.OTHER_ERROR,details:ce.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:d,reason:d.message}),f)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,s===e&&a.details&&r&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${s}${n?" with Pathway "+n:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(C.LEVEL_SWITCHING,l);const u=a.details;if(!u||u.live){const d=this.switchParams(a.uri,r==null?void 0:r.details,u);this.loadPlaylist(d)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===it.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===He.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(n=>!!s[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var s;const{level:r,details:n}=t,a=this._levels[r];if(!a){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(r,t,a.details)):(s=t.deliveryDirectives)!=null&&s.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,s=this.currentLevel;if(s&&this.shouldLoadPlaylist(s)){let r=s.uri;if(e)try{r=e.addDirectives(r)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}const n=s.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${r}`),this.clearTimer(),this.hls.trigger(C.LEVEL_LOADING,{url:r,level:t,pathwayId:s.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const s=this._levels.filter((r,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(a=>a.level=-1)),!1));Zp(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(C.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(C.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Nd(i){const e={};i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}class JL{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[s].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=ce.KEY_LOAD_ERROR,s,r,n){return new gi({type:je.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:s,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:s,cc:r}=e;for(let n=0;n<t.length;n++){const a=t[n];if(r<=a.cc&&(s==="initSegment"||a.sn==="initSegment"||s<a.sn)){this.emeController.selectKeySystemFormat(a).then(o=>{a.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const u=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,ce.KEY_LOAD_ERROR,u))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,ce.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((s=o)!=null&&s.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((r=o)!=null&&r.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(u=>(n.key=u.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[a]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,ce.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(s);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,s))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,r=s.loader,n=new r(s);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=s.keyLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(g,v,y,E)=>{const{frag:b,keyInfo:w,url:F}=y;if(!b.decryptdata||w!==this.keyUriToKeyInfo[F])return o(this.createKeyLoadError(b,ce.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),E));w.decryptdata.key=b.decryptdata.key=new Uint8Array(g.data),b.keyLoader=null,w.loader=null,a({frag:b,keyInfo:w})},onError:(g,v,y,E)=>{this.resetLoader(v),o(this.createKeyLoadError(t,ce.KEY_LOAD_ERROR,new Error(`HTTP Error ${g.code} loading key ${g.text}`),y,Nt({url:l.url,data:void 0},g)))},onTimeout:(g,v,y)=>{this.resetLoader(v),o(this.createKeyLoadError(t,ce.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),y))},onAbort:(g,v,y)=>{this.resetLoader(v),o(this.createKeyLoadError(t,ce.INTERNAL_ABORTED,new Error("key loading aborted"),y))}};n.load(l,d,f)})}resetLoader(e){const{frag:t,keyInfo:s,url:r}=e,n=s.loader;t.keyLoader===n&&(t.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function Bg(){return self.SourceBuffer||self.WebKitSourceBuffer}function $g(){if(!ar())return!1;const e=Bg();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function ZL(){if(!$g())return!1;const i=ar();return typeof(i==null?void 0:i.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Pn(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Pn(e,"audio"))))}function eC(){var i;const e=Bg();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const tC=250,Ca=2,sC=.1,iC=.05;class rC{constructor(e,t,s,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=s,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:s,media:r,stalled:n}=this;if(r===null)return;const{currentTime:a,seeking:o}=r,l=this.seeking&&!o,u=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),n!==null){if(this.stallReported){const b=self.performance.now()-n;ie.warn(`playback not stuck anymore @${a}, after ${Math.round(b)}ms`),this.stallReported=!1}this.stalled=null}return}if(u||l){this.stalled=null;return}if(r.paused&&!o||r.ended||r.playbackRate===0||!mt.getBuffered(r).length){this.nudgeRetry=0;return}const d=mt.bufferInfo(r,a,0),f=d.nextStart||0;if(o){const b=d.len>Ca,w=!f||t&&t.start<=a||f-a>Ca&&!this.fragmentTracker.getPartialFragment(a);if(b||w)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g;if(!(d.len>0)&&!f)return;const w=Math.max(f,d.start||0)-a,F=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,U=(F==null||(g=F.details)==null?void 0:g.live)?F.details.targetduration*2:Ca,N=this.fragmentTracker.getPartialFragment(a);if(w>0&&(w<=U||N)){r.paused||this._trySkipBufferHole(N);return}}const v=self.performance.now();if(n===null){this.stalled=v;return}const y=v-n;if(!o&&y>=tC&&(this._reportStall(d),!this.media))return;const E=mt.bufferInfo(r,a,s.maxBufferHole);this._tryFixBufferStall(E,y)}_tryFixBufferStall(e,t){const{config:s,fragmentTracker:r,media:n}=this;if(n===null)return;const a=n.currentTime,o=r.getPartialFragment(a);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>s.maxBufferHole||e.nextStart&&e.nextStart-a<s.maxBufferHole)&&t>s.highBufferWatchdogPeriod*1e3&&(ie.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:s,stallReported:r}=this;if(!r&&s){this.stallReported=!0;const n=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${JSON.stringify(e)})`);ie.warn(n.message),t.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:s,media:r}=this;if(r===null)return 0;const n=r.currentTime,a=mt.bufferInfo(r,n,0),o=n<a.start?a.start:a.nextStart;if(o){const l=a.len<=t.maxBufferHole,u=a.len>0&&a.len<1&&r.readyState<3,d=o-n;if(d>0&&(l||u)){if(d>t.maxBufferHole){const{fragmentTracker:g}=this;let v=!1;if(n===0){const y=g.getAppendedFrag(0,He.MAIN);y&&o<y.end&&(v=!0)}if(!v){const y=e||g.getAppendedFrag(n,He.MAIN);if(y){let E=!1,b=y.end;for(;b<o;){const w=g.getPartialFragment(b);if(w)b+=w.duration;else{E=!0;break}}if(E)return 0}}}const f=Math.max(o+iC,n+sC);if(ie.warn(`skipping hole, adjusting currentTime from ${n} to ${f}`),this.moved=!0,this.stalled=null,r.currentTime=f,e&&!e.gap){const g=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${f}`);s.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:g,reason:g.message,frag:e})}return f}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:s,nudgeRetry:r}=this;if(s===null)return;const n=s.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const a=n+(r+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);ie.warn(o.message),s.currentTime=a,t.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{const a=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);ie.error(a.message),t.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_STALLED_ERROR,error:a,fatal:!0})}}}const nC=100;class aC extends Ac{constructor(e,t,s){super(e,t,s,"[stream-controller]",He.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(C.ERROR,this.onError,this),e.on(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(C.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(C.BUFFER_CREATED,this.onBufferCreated,this),e.on(C.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(C.ERROR,this.onError,this),e.off(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(C.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(C.BUFFER_CREATED,this.onBufferCreated,this),e.off(C.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:s}=this;if(this.stopLoad(),this.setInterval(nC),this.level=-1,!this.startFragRequested){let r=s.startLevel;r===-1&&(s.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=s.firstAutoLevel),s.nextLoadLevel=r,this.level=s.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=ve.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=ve.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case ve.WAITING_LEVEL:{const{levels:t,level:s}=this,r=t==null?void 0:t[s],n=r==null?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=ve.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=ve.IDLE;break}break}case ve.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),s=this.retryDate;if(!s||t>=s||(e=this.media)!=null&&e.seeking){const{levels:r,level:n}=this,a=r==null?void 0:r[n];this.resetStartWhenNotLoaded(a||null),this.state=ve.IDLE}}break}this.state===ve.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(s!=null&&s[n]))return;const a=s[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const E={};this.altAudio&&(E.type="video"),this.hls.trigger(C.BUFFER_EOS,E),this.state=ve.ENDED;return}e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const u=a.details;if(!u||this.state===ve.WAITING_LEVEL||u.live&&this.levelLastLoaded!==a){this.level=n,this.state=ve.WAITING_LEVEL;return}const d=o.len,f=this.getMaxBufferLength(a.maxBitrate);if(d>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const g=this.backtrackFragment?this.backtrackFragment.start:o.end;let v=this.getNextFragment(g,u);if(this.couldBacktrack&&!this.fragPrevious&&v&&v.sn!=="initSegment"&&this.fragmentTracker.getState(v)!==Ot.OK){var y;const b=((y=this.backtrackFragment)!=null?y:v).sn-u.startSN,w=u.fragments[b-1];w&&v.cc===w.cc&&(v=w,this.fragmentTracker.removeFragment(w))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(v&&this.isLoopLoading(v,g)){if(!v.gap){const b=this.audioOnly&&!this.altAudio?ht.AUDIO:ht.VIDEO,w=(b===ht.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;w&&this.afterBufferFlushed(w,b,He.MAIN)}v=this.getNextFragmentLoopLoading(v,u,o,He.MAIN,f)}v&&(v.initSegment&&!v.initSegment.data&&!this.bitrateTest&&(v=v.initSegment),this.loadFragment(v,a,g))}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===Ot.NOT_LOADED||r===Ot.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):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)):(this.startFragRequested=!0,super.loadFragment(e,t,s)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,He.MAIN)}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(t!=null&&t.readyState){let s;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<n.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,l=e[o],u=this.fragLastKbps;u&&this.fragCurrent?s=this.fragCurrent.duration*l.maxBitrate/(1e3*u)+1:s=0}else s=0;const a=this.getBufferedFrag(t.currentTime+s);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const l=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,d=Math.max(a.end,l+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,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 ve.KEY_LOADING:case ve.FRAG_LOADING:case ve.FRAG_LOADING_WAITING_RETRY:case ve.PARSING:case ve.PARSED:this.state=ve.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const s=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),s.addEventListener("playing",this.onvplaying),s.addEventListener("seeked",this.onvseeked),this.gapController=new rC(this.config,s,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;_e(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const s=this.getMainFwdBufferInfo();if(s===null||s.len===0){this.warn(`Main forward buffer length on "seeked" event ${s?s.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(C.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let s=!1,r=!1;t.levels.forEach(n=>{const a=n.audioCodec;a&&(s=s||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=s&&r&&!eC(),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:s}=this;if(!s||this.state!==ve.IDLE)return;const r=s[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=ve.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:r}=this,n=t.level,a=t.details,o=a.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const l=r[n],u=this.fragCurrent;u&&(this.state===ve.FRAG_LOADING||this.state===ve.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let d=0;if(a.live||(s=l.details)!=null&&s.live){var f;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;d=this.alignPlaylists(a,l.details,(f=this.levelLastLoaded)==null?void 0:f.details)}if(l.details=a,this.levelLastLoaded=l,this.hls.trigger(C.LEVEL_UPDATED,{details:a,level:n}),this.state===ve.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=ve.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:r,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const o=a[s.level],l=o.details;if(!l){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const u=o.videoCodec,d=l.PTSKnown||!l.live,f=(t=s.initSegment)==null?void 0:t.data,g=this._getAudioCodec(o),v=this.transmuxer=this.transmuxer||new xg(this.hls,He.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),y=r?r.index:-1,E=y!==-1,b=new Tc(s.level,s.sn,s.stats.chunkCount,n.byteLength,y,E),w=this.initPTS[s.cc];v.push(n,f,g,u,s,r,l.totalduration,d,b,w)}onAudioTrackSwitching(e,t){const s=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;s&&(n.trigger(C.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(C.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=t.id,r=!!this.hls.audioTracks[s].url;if(r){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()}onBufferCreated(e,t){const s=t.tracks;let r,n,a=!1;for(const o in s){const l=s[o];if(l.id==="main"){if(n=o,r=l,o==="video"){const u=s[o];u&&(this.videoBuffer=u.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:r}=t;if(s&&s.type!==He.MAIN)return;if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===ve.PARSED&&(this.state=ve.IDLE);return}const n=r?r.stats:s.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),s.sn!=="initSegment"&&(this.fragPrevious=s),this.fragBufferedComplete(s,r)}onError(e,t){var s;if(t.fatal){this.state=ve.ERROR;return}switch(t.details){case ce.FRAG_GAP:case ce.FRAG_PARSING_ERROR:case ce.FRAG_DECRYPT_ERROR:case ce.FRAG_LOAD_ERROR:case ce.FRAG_LOAD_TIMEOUT:case ce.KEY_LOAD_ERROR:case ce.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(He.MAIN,t);break;case ce.LEVEL_LOAD_ERROR:case ce.LEVEL_LOAD_TIMEOUT:case ce.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ve.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===it.LEVEL&&(this.state=ve.IDLE);break;case ce.BUFFER_APPEND_ERROR:case ce.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===ce.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case ce.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!mt.getBuffered(e).length){const s=this.state!==ve.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,s)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=ve.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==ht.AUDIO||this.audioOnly&&!this.altAudio){const s=(t===ht.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(s,t,He.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t<s){if(e.seeking){this.log(`could not seek to ${s}, already seeking at ${t}`);return}const r=mt.getBuffered(e),a=(r.length?r.start(0):0)-s;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),s+=a,this.startPosition=s),this.log(`seek to target start position ${s} from current time ${t}`),e.currentTime=s}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(s=>{const{hls:r}=this;if(!s||this.fragContextChanged(e))return;t.fragmentError=0,this.state=ve.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(C.FRAG_LOADED,s),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const s="main",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:u,level:d}=o,{video:f,text:g,id3:v,initSegment:y}=n,{details:E}=d,b=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=ve.PARSING,y){if(y!=null&&y.tracks){const k=l.initSegment||l;this._bufferInitSegment(d,y.tracks,k,a),r.trigger(C.FRAG_PARSING_INIT_SEGMENT,{frag:k,id:s,tracks:y.tracks})}const w=y.initPTS,F=y.timescale;_e(w)&&(this.initPTS[l.cc]={baseTime:w,timescale:F},r.trigger(C.INIT_PTS_FOUND,{frag:l,id:s,initPTS:w,timescale:F}))}if(f&&E&&l.sn!=="initSegment"){const w=E.fragments[l.sn-1-E.startSN],F=l.sn===E.startSN,k=!w||l.cc>w.cc;if(n.independent!==!1){const{startPTS:U,endPTS:N,startDTS:te,endDTS:j}=f;if(u)u.elementaryStreams[f.type]={startPTS:U,endPTS:N,startDTS:te,endDTS:j};else if(f.firstKeyFrame&&f.independent&&a.id===1&&!k&&(this.couldBacktrack=!0),f.dropped&&f.independent){const re=this.getMainFwdBufferInfo(),Q=(re?re.end:this.getLoadPosition())+this.config.maxBufferHole,le=f.firstKeyFramePTS?f.firstKeyFramePTS:U;if(!F&&Q<le-this.config.maxBufferHole&&!k){this.backtrack(l);return}else k&&(l.gap=!0);l.setElementaryStreamInfo(f.type,l.start,N,l.start,j,!0)}else F&&U>Ca&&(l.gap=!0);l.setElementaryStreamInfo(f.type,U,N,te,j),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(f,l,u,a,F||k)}else if(F||k)l.gap=!0;else{this.backtrack(l);return}}if(b){const{startPTS:w,endPTS:F,startDTS:k,endDTS:U}=b;u&&(u.elementaryStreams[ht.AUDIO]={startPTS:w,endPTS:F,startDTS:k,endDTS:U}),l.setElementaryStreamInfo(ht.AUDIO,w,F,k,U),this.bufferFragmentData(b,l,u,a)}if(E&&v!=null&&(t=v.samples)!=null&&t.length){const w={id:s,frag:l,details:E,samples:v.samples};r.trigger(C.FRAG_PARSING_METADATA,w)}if(E&&g){const w={id:s,frag:l,details:E,samples:g.samples};r.trigger(C.FRAG_PARSING_USERDATA,w)}}_bufferInitSegment(e,t,s,r){if(this.state!==ve.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:a,audiovideo:o}=t;if(n){let l=e.audioCodec;const u=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),n.metadata.channelCount!==1&&u.indexOf("firefox")===-1&&(l="mp4a.40.5")),l&&l.indexOf("mp4a.40.5")!==-1&&u.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),n.levelCodec=l,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${n.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id="main",this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(C.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const d=t[l].initSegment;d!=null&&d.byteLength&&this.hls.trigger(C.BUFFER_APPENDING,{type:l,data:d,frag:s,part:null,chunkMeta:r,parent:s.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,He.MAIN)}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=ve.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(mt.isBuffered(e,s)?t=this.getAppendedFrag(s):mt.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(C.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(C.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,s=this.currentFrag;if(s&&_e(t)&&_e(s.programDateTime)){const r=s.programDateTime+(t-s.start)*1e3;return new Date(r)}}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 Ps{static get version(){return"1.5.8"}static isMSESupported(){return $g()}static isSupported(){return ZL()}static getMediaSource(){return ar()}static get Events(){return C}static get ErrorTypes(){return je}static get ErrorDetails(){return ce}static get DefaultConfig(){return Ps.defaultConfig?Ps.defaultConfig:Ng}static set DefaultConfig(e){Ps.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Ic,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,Jb(e.debug||!1,"Hls instance");const t=this.config=YL(Ps.DefaultConfig,e);this.userConfig=e,t.progressive&&XL(t);const{abrController:s,bufferController:r,capLevelController:n,errorController:a,fpsController:o}=t,l=new a(this),u=this.abrController=new s(this),d=this.bufferController=new r(this),f=this.capLevelController=new n(this),g=new o(this),v=new zT(this),y=new QT(this),E=t.contentSteeringController,b=E?new E(this):null,w=this.levelController=new QL(this,b),F=new Aw(this),k=new JL(this.config),U=this.streamController=new aC(this,F,k);f.setStreamController(U),g.setStreamController(U);const N=[v,w,U];b&&N.splice(1,0,b),this.networkControllers=N;const te=[u,d,f,g,y,F];this.audioTrackController=this.createController(t.audioTrackController,N);const j=t.audioStreamController;j&&N.push(new j(this,F,k)),this.subtitleTrackController=this.createController(t.subtitleTrackController,N);const re=t.subtitleStreamController;re&&N.push(new re(this,F,k)),this.createController(t.timelineController,te),k.emeController=this.emeController=this.createController(t.emeController,te),this.cmcdController=this.createController(t.cmcdController,te),this.latencyController=this.createController(JT,te),this.coreComponents=te,N.push(l);const Q=l.onErrorOut;typeof Q=="function"&&this.on(C.ERROR,Q,l)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,r){this._emitter.off(e,t,s,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(ie.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const r=e===C.ERROR;this.trigger(C.ERROR,{type:je.OTHER_ERROR,details:ce.INTERNAL_EXCEPTION,fatal:r,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){ie.log("destroy"),this.trigger(C.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){ie.log("attachMedia"),this._media=e,this.trigger(C.MEDIA_ATTACHING,{media:e})}detachMedia(){ie.log("detachMedia"),this.trigger(C.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,s=this.url,r=this.url=vc.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,ie.log(`loadSource:${r}`),t&&s&&(s!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(C.MANIFEST_LOADING,{url:e})}startLoad(e=-1){ie.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){ie.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){ie.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){ie.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){ie.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){ie.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){ie.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){ie.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){ie.log(`set startLevel:${e}`),e!==-1&&(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 ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(ie.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){ZT(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let r=0;r<s;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,s)for(let n=r;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=s)return n}return r}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()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||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:!1}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}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}Ps.defaultConfig=void 0;function oC({src:i,quality:e,initialTime:t,timeOffsetStart:s,timeOffsetEnd:r,timeUpdateEvent:n=!1,debug:a,onSync:o,onInit:l,onDestroy:u}){const[d,f]=fe.useState(),[g,v]=fe.useState(!1),[y,E]=fe.useState(1),[b,w]=fe.useState(!1),[F,k]=fe.useState(!1),[U,N]=fe.useState(),[te,j]=fe.useState({originDurationTime:0,originCurrentTime:0,progress:0,currentTime:0,durationTime:0}),re=fe.useRef(null),Q=fe.useRef();E1({element:re.current,eventName:"timeupdate",handler:n&&b?()=>{if(!re.current)return;const ue=re.current,he=ue.currentTime,we=ue.duration===1/0&&ue.buffered.length>0?ue.buffered.end(0):ue.duration,me=he-(s??0),ye=(r??we)-(s??0);j({originCurrentTime:he,originDurationTime:we,currentTime:me,durationTime:ye,progress:me/ye*100})}:void 0});const le=()=>{if(!re.current)return;const ue=re.current;ue.paused?ue.play().catch(()=>{N(!0)}):ue.pause()},se=()=>{if(!re.current)return;const ue=re.current,he=ue.currentTime+10;typeof r=="number"&&r<he?ue.currentTime=r:ue.currentTime=he},pe=()=>{if(!re.current)return;const ue=re.current,he=ue.currentTime-10;typeof s=="number"&&s>he?ue.currentTime=s:ue.currentTime=he},de=()=>{if(!re.current)return;const ue=re.current;ue.playbackRate===2?ue.playbackRate=1:ue.playbackRate+=.5},be=ue=>{if(!re.current)return;const he=re.current;he.currentTime=(s??0)+ue},Le=fe.useCallback(ue=>{const he=re.current;he&&(w(!1),Ps.isSupported()?(d==null||d.stopLoad(),d==null||d.loadSource(ue)):he.canPlayType("application/vnd.apple.mpegurl")&&(he.src=ue))},[d]);return fe.useEffect(()=>{Q.current=o},[o]),fe.useEffect(()=>{if(!re.current||!i)return;const ue=re.current;let he;if(Ps.isSupported()){const Je={debug:!1,enableWorker:!0,lowLatencyMode:!0,backBufferLength:90,highBufferWatchdogPeriod:1,maxMaxBufferLength:8};he=new Ps(Je),he.attachMedia(ue),he.loadSource(i),f(he)}else ue.canPlayType("application/vnd.apple.mpegurl")&&(ue.src=i);const we=()=>{var Pt,ps,Be,as;const Je=ue.duration,vt=((Be=(ps=(Pt=he==null?void 0:he.levels)==null?void 0:Pt[0])==null?void 0:ps.details)==null?void 0:Be.live)||Je===1/0;v(vt),(as=Q.current)==null||as.call(Q,!0),Je!==1/0&&j(os=>({...os,durationTime:Math.floor(Je)})),t&&(ue.currentTime=t),s&&!vt&&(ue.currentTime=s),ue.play().catch(()=>{N(!0)})},me=()=>{k(!1)},ye=()=>{typeof r=="number"&&ue.currentTime>=r&&typeof s=="number"&&(ue.currentTime=s),k(!0),N(!1)},Ve=()=>{ue.pause()},$e=()=>{w(!0)},Xe=()=>{E(ue.playbackRate)},st=({detail:Je})=>{he&&(he.currentLevel=Je.quality)},et=()=>{var Pt,ps,Be,as,os,cr,Ds,Gi,Vi,ls,ur,Ms;const Je=ue.currentTime,vt=ue.duration;if((ps=(Pt=he==null?void 0:he.levels[he.currentLevel])==null?void 0:Pt.details)!=null&&ps.live)(Be=Q==null?void 0:Q.current)==null||Be.call(Q,vt-Je<10);else if(vt===1/0&&ue.buffered.length>0){const Fs=ue.buffered.end(0);(as=Q==null?void 0:Q.current)==null||as.call(Q,Fs-Je<10)}if(typeof r=="number"&&Je>=r&&(ue.currentTime=r,ue.pause()),a){const Fs=ue.buffered.length>0?ue.buffered.end(0):0,Os=((cr=(os=he==null?void 0:he.levels[he.currentLevel])==null?void 0:os.details)==null?void 0:cr.live)||vt===1/0,Me={isSupported:Ps.isSupported(),version:Ps.version,live:Os,currentLevel:((Ds=he==null?void 0:he.levels[he.currentLevel])==null?void 0:Ds.width)||"auto",firstLevel:((Gi=he==null?void 0:he.levels[he.firstLevel])==null?void 0:Gi.width)||"auto",latency:(Vi=he==null?void 0:he.latency)==null?void 0:Vi.toFixed(2),targetLatency:he==null?void 0:he.targetLatency,currentTime:Je,durationTime:vt,bufferedEnd:Fs,sync:Os?(ur=(ls=he==null?void 0:he.levels[he.currentLevel])==null?void 0:ls.details)!=null&&ur.live?Fs-Je<5:vt-Je<5:"not live"};(Ms=window==null?void 0:window.__brix_console)==null||Ms.call(window,"hls",Me)}},rt=Je=>{console.log(Je)};return document.addEventListener("__BP_VIDEO_QUALITY",st),ue.addEventListener("progress",et),ue.addEventListener("loadedmetadata",we),ue.addEventListener("pause",me),ue.addEventListener("play",ye),ue.addEventListener("ratechange",Xe),ue.addEventListener("canplay",$e),ue.addEventListener("ended",Ve),ue.addEventListener("error",rt),l==null||l(ue,he),()=>{document.removeEventListener("__BP_VIDEO_QUALITY",st),ue.removeEventListener("progress",et),ue.removeEventListener("loadedmetadata",we),ue.removeEventListener("pause",me),ue.removeEventListener("play",ye),ue.removeEventListener("ratechange",Xe),ue.removeEventListener("canplay",$e),ue.removeEventListener("ended",Ve),ue.removeEventListener("error",rt),he==null||he.stopLoad(),he==null||he.destroy(),u==null||u()}},[i,a,s,t,r,l,u]),fe.useEffect(()=>{!b||typeof e>"u"||document.dispatchEvent(new CustomEvent("__BP_VIDEO_QUALITY",{detail:{quality:e}}))},[b,e]),{ref:re,play:F,live:g,error:U,time:te,hls:d,playbackRate:y,canPlay:b,handlePlayToggle:le,handleBackward:pe,handleForward:se,handlePlaybackRate:de,handleSeektime:be,handleChangeSource:Le}}const lC="_root_yg3vm_2",cC="_progress_wrap_yg3vm_14",uC="_rail_yg3vm_22",hC="_progress_yg3vm_14",dC="_handle_yg3vm_38",dn={root:lC,progress_wrap:cC,rail:uC,progress:hC,handle:dC};function Ug({handle:i,progress:e,className:t,onChangeProgress:s}){const r=fe.useRef(null),[n,a]=fe.useState(!1),o=fe.useCallback((v,y)=>{if(!r.current)return;const E=r.current.parentElement,b=(y-E.getBoundingClientRect().left)/E.offsetWidth,w=Math.max(0,Math.min(100,b*100));r.current.style.width=`${w}%`,s==null||s(v,w)},[s]),l=v=>{o(v,v.clientX)},u=v=>{o(v,v.clientX),a(!0)},d=v=>{n&&o(v,v.clientX)},f=()=>{a(!1)},g=v=>{o(v,v.targetTouches[0].clientX)};return Ne.jsx("div",{className:`${dn.root} ${t||""}`,onMouseUp:f,onMouseLeave:f,children:Ne.jsxs("div",{className:dn.progress_wrap,onClick:l,onMouseDown:u,onMouseMove:d,onTouchMove:g,children:[Ne.jsx("div",{className:dn.rail}),Ne.jsx("div",{className:`${dn.progress} ${i?dn.handle:""}`,ref:r,style:{width:`${e}%`}})]})})}const fC="_root_nvyal_1",pC={root:fC};function Bd(i,e=!1){const t=Math.floor(+i/3600),s=Math.floor((+i-t*3600)/60),r=(+i-t*3600-s*60).toFixed(0),n=t.toString().padStart(2,"0"),a=s.toString().padStart(2,"0"),o=r.padStart(2,"0");return e||t>0?`${n}:${a}:${o}`:`${a}:${o}`}function gC(i){const e=i.split(":").map(Number);let t=0;if(e.length===3){const[s,r,n]=e;t=s*3600+r*60+n}else if(e.length===2){const[s,r]=e;t=s*60+r}else t=+i;return t}function $d(i,e){let t="",s="",r="";if(e){const[n,...a]=e.split("?");s=a.join("&"),r=n}for(const n in i)Object.prototype.hasOwnProperty.call(i,n)&&i[n]!==void 0&&(t+=`${n}=${encodeURIComponent(i[n])}&`);return t+=s?`&${s}`:"",t.length>0&&t.endsWith("&")&&(t=t.slice(0,-1)),r?`${r}?${t}`:t}function mC({currentTime:i=0,durationTime:e=0,className:t}){return Ne.jsxs("div",{className:`${pC.root} ${t||""}`,children:[Ne.jsx("div",{children:Bd(i)}),Ne.jsx("div",{children:Bd(e)})]})}var $l={exports:{}};(function(i,e){typeof navigator<"u"&&function(t,s){i.exports=s()}(Cm,function(){var t="http://www.w3.org/2000/svg",s="",r=!1,n=-999999,a=function(h){r=!!h},o=function(){return r},l=function(h){s=h},u=function(){return s};function d(c){return document.createElement(c)}function f(c,h){var p,m=c.length,S;for(p=0;p<m;p+=1){S=c[p].prototype;for(var x in S)Object.prototype.hasOwnProperty.call(S,x)&&(h.prototype[x]=S[x])}}function g(c){function h(){}return h.prototype=c,h}var v=function(){function c(h){this.audios=[],this.audioFactory=h,this._volume=1,this._isMuted=!1}return c.prototype={addAudio:function(p){this.audios.push(p)},pause:function(){var p,m=this.audios.length;for(p=0;p<m;p+=1)this.audios[p].pause()},resume:function(){var p,m=this.audios.length;for(p=0;p<m;p+=1)this.audios[p].resume()},setRate:function(p){var m,S=this.audios.length;for(m=0;m<S;m+=1)this.audios[m].setRate(p)},createAudio:function(p){return this.audioFactory?this.audioFactory(p):window.Howl?new window.Howl({src:[p]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(p){this.audioFactory=p},setVolume:function(p){this._volume=p,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var p,m=this.audios.length;for(p=0;p<m;p+=1)this.audios[p].volume(this._volume*(this._isMuted?0:1))}},function(){return new c}}(),y=function(){function c(p,m){var S=0,x=[],A;switch(p){case"int16":case"uint8c":A=1;break;default:A=1.1;break}for(S=0;S<m;S+=1)x.push(A);return x}function h(p,m){return p==="float32"?new Float32Array(m):p==="int16"?new Int16Array(m):p==="uint8c"?new Uint8ClampedArray(m):c(p,m)}return typeof Uint8ClampedArray=="function"&&typeof Float32Array=="function"?h:c}();function E(c){return Array.apply(null,{length:c})}var b=!0,w=null,F="",k=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),U=Math.pow,N=Math.sqrt,te=Math.floor,j=Math.min,re=150,Q=Math.PI/180,le=.5519;function se(c,h,p,m){this.type=c,this.currentTime=h,this.totalTime=p,this.direction=m<0?-1:1}function pe(c,h){this.type=c,this.direction=h<0?-1:1}function de(c,h,p,m){this.type=c,this.currentLoop=p,this.totalLoops=h,this.direction=m<0?-1:1}function be(c,h,p){this.type=c,this.firstFrame=h,this.totalFrames=p}function Le(c,h){this.type=c,this.target=h}function ue(c,h){this.type="renderFrameError",this.nativeError=c,this.currentTime=h}function he(c){this.type="configError",this.nativeError=c}var we=function(){var c=0;return function(){return c+=1,F+"__lottie_element_"+c}}();function me(c,h,p){var m,S,x,A,D,L,B,V;switch(A=Math.floor(c*6),D=c*6-A,L=p*(1-h),B=p*(1-D*h),V=p*(1-(1-D)*h),A%6){case 0:m=p,S=V,x=L;break;case 1:m=B,S=p,x=L;break;case 2:m=L,S=p,x=V;break;case 3:m=L,S=B,x=p;break;case 4:m=V,S=L,x=p;break;case 5:m=p,S=L,x=B;break}return[m,S,x]}function ye(c,h,p){var m=Math.max(c,h,p),S=Math.min(c,h,p),x=m-S,A,D=m===0?0:x/m,L=m/255;switch(m){case S:A=0;break;case c:A=h-p+x*(h<p?6:0),A/=6*x;break;case h:A=p-c+x*2,A/=6*x;break;case p:A=c-h+x*4,A/=6*x;break}return[A,D,L]}function Ve(c,h){var p=ye(c[0]*255,c[1]*255,c[2]*255);return p[1]+=h,p[1]>1?p[1]=1:p[1]<=0&&(p[1]=0),me(p[0],p[1],p[2])}function $e(c,h){var p=ye(c[0]*255,c[1]*255,c[2]*255);return p[2]+=h,p[2]>1?p[2]=1:p[2]<0&&(p[2]=0),me(p[0],p[1],p[2])}function Xe(c,h){var p=ye(c[0]*255,c[1]*255,c[2]*255);return p[0]+=h/360,p[0]>1?p[0]-=1:p[0]<0&&(p[0]+=1),me(p[0],p[1],p[2])}(function(){var c=[],h,p;for(h=0;h<256;h+=1)p=h.toString(16),c[h]=p.length===1?"0"+p:p;return function(m,S,x){return m<0&&(m=0),S<0&&(S=0),x<0&&(x=0),"#"+c[m]+c[S]+c[x]}})();var st=function(h){b=!!h},et=function(){return b},rt=function(h){w=h},Je=function(){return w},vt=function(h){re=h},Pt=function(){return re},ps=function(h){F=h};function Be(c){return document.createElementNS(t,c)}function as(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?as=function(p){return typeof p}:as=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},as(c)}var os=function(){var c=1,h=[],p,m,S={onmessage:function(){},postMessage:function(H){p({data:H})}},x={postMessage:function(H){S.onmessage({data:H})}};function A(I){if(window.Worker&&window.Blob&&o()){var H=new Blob(["var _workerSelf = self; self.onmessage = ",I.toString()],{type:"text/javascript"}),q=URL.createObjectURL(H);return new Worker(q)}return p=I,S}function D(){m||(m=A(function(H){function q(){function J(xe,M){var z,T,R=xe.length,ne,X,Re,Ue;for(T=0;T<R;T+=1)if(z=xe[T],"ks"in z&&!z.completed){if(z.completed=!0,z.hasMask){var ze=z.masksProperties;for(X=ze.length,ne=0;ne<X;ne+=1)if(ze[ne].pt.k.i)$(ze[ne].pt.k);else for(Ue=ze[ne].pt.k.length,Re=0;Re<Ue;Re+=1)ze[ne].pt.k[Re].s&&$(ze[ne].pt.k[Re].s[0]),ze[ne].pt.k[Re].e&&$(ze[ne].pt.k[Re].e[0])}z.ty===0?(z.layers=_(z.refId,M),J(z.layers,M)):z.ty===4?P(z.shapes):z.ty===5&&Ye(z)}}function G(xe,M){if(xe){var z=0,T=xe.length;for(z=0;z<T;z+=1)xe[z].t===1&&(xe[z].data.layers=_(xe[z].data.refId,M),J(xe[z].data.layers,M))}}function O(xe,M){for(var z=0,T=M.length;z<T;){if(M[z].id===xe)return M[z];z+=1}return null}function _(xe,M){var z=O(xe,M);return z?z.layers.__used?JSON.parse(JSON.stringify(z.layers)):(z.layers.__used=!0,z.layers):null}function P(xe){var M,z=xe.length,T,R;for(M=z-1;M>=0;M-=1)if(xe[M].ty==="sh")if(xe[M].ks.k.i)$(xe[M].ks.k);else for(R=xe[M].ks.k.length,T=0;T<R;T+=1)xe[M].ks.k[T].s&&$(xe[M].ks.k[T].s[0]),xe[M].ks.k[T].e&&$(xe[M].ks.k[T].e[0]);else xe[M].ty==="gr"&&P(xe[M].it)}function $(xe){var M,z=xe.i.length;for(M=0;M<z;M+=1)xe.i[M][0]+=xe.v[M][0],xe.i[M][1]+=xe.v[M][1],xe.o[M][0]+=xe.v[M][0],xe.o[M][1]+=xe.v[M][1]}function Y(xe,M){var z=M?M.split("."):[100,100,100];return xe[0]>z[0]?!0:z[0]>xe[0]?!1:xe[1]>z[1]?!0:z[1]>xe[1]?!1:xe[2]>z[2]?!0:z[2]>xe[2]?!1:null}var Z=function(){var xe=[4,4,14];function M(T){var R=T.t.d;T.t.d={k:[{s:R,t:0}]}}function z(T){var R,ne=T.length;for(R=0;R<ne;R+=1)T[R].ty===5&&M(T[R])}return function(T){if(Y(xe,T.v)&&(z(T.layers),T.assets)){var R,ne=T.assets.length;for(R=0;R<ne;R+=1)T.assets[R].layers&&z(T.assets[R].layers)}}}(),ae=function(){var xe=[4,7,99];return function(M){if(M.chars&&!Y(xe,M.v)){var z,T=M.chars.length;for(z=0;z<T;z+=1){var R=M.chars[z];R.data&&R.data.shapes&&(P(R.data.shapes),R.data.ip=0,R.data.op=99999,R.data.st=0,R.data.sr=1,R.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},M.chars[z].t||(R.data.shapes.push({ty:"no"}),R.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}}(),Se=function(){var xe=[5,7,15];function M(T){var R=T.t.p;typeof R.a=="number"&&(R.a={a:0,k:R.a}),typeof R.p=="number"&&(R.p={a:0,k:R.p}),typeof R.r=="number"&&(R.r={a:0,k:R.r})}function z(T){var R,ne=T.length;for(R=0;R<ne;R+=1)T[R].ty===5&&M(T[R])}return function(T){if(Y(xe,T.v)&&(z(T.layers),T.assets)){var R,ne=T.assets.length;for(R=0;R<ne;R+=1)T.assets[R].layers&&z(T.assets[R].layers)}}}(),Ke=function(){var xe=[4,1,9];function M(T){var R,ne=T.length,X,Re;for(R=0;R<ne;R+=1)if(T[R].ty==="gr")M(T[R].it);else if(T[R].ty==="fl"||T[R].ty==="st")if(T[R].c.k&&T[R].c.k[0].i)for(Re=T[R].c.k.length,X=0;X<Re;X+=1)T[R].c.k[X].s&&(T[R].c.k[X].s[0]/=255,T[R].c.k[X].s[1]/=255,T[R].c.k[X].s[2]/=255,T[R].c.k[X].s[3]/=255),T[R].c.k[X].e&&(T[R].c.k[X].e[0]/=255,T[R].c.k[X].e[1]/=255,T[R].c.k[X].e[2]/=255,T[R].c.k[X].e[3]/=255);else T[R].c.k[0]/=255,T[R].c.k[1]/=255,T[R].c.k[2]/=255,T[R].c.k[3]/=255}function z(T){var R,ne=T.length;for(R=0;R<ne;R+=1)T[R].ty===4&&M(T[R].shapes)}return function(T){if(Y(xe,T.v)&&(z(T.layers),T.assets)){var R,ne=T.assets.length;for(R=0;R<ne;R+=1)T.assets[R].layers&&z(T.assets[R].layers)}}}(),De=function(){var xe=[4,4,18];function M(T){var R,ne=T.length,X,Re;for(R=ne-1;R>=0;R-=1)if(T[R].ty==="sh")if(T[R].ks.k.i)T[R].ks.k.c=T[R].closed;else for(Re=T[R].ks.k.length,X=0;X<Re;X+=1)T[R].ks.k[X].s&&(T[R].ks.k[X].s[0].c=T[R].closed),T[R].ks.k[X].e&&(T[R].ks.k[X].e[0].c=T[R].closed);else T[R].ty==="gr"&&M(T[R].it)}function z(T){var R,ne,X=T.length,Re,Ue,ze,nt;for(ne=0;ne<X;ne+=1){if(R=T[ne],R.hasMask){var at=R.masksProperties;for(Ue=at.length,Re=0;Re<Ue;Re+=1)if(at[Re].pt.k.i)at[Re].pt.k.c=at[Re].cl;else for(nt=at[Re].pt.k.length,ze=0;ze<nt;ze+=1)at[Re].pt.k[ze].s&&(at[Re].pt.k[ze].s[0].c=at[Re].cl),at[Re].pt.k[ze].e&&(at[Re].pt.k[ze].e[0].c=at[Re].cl)}R.ty===4&&M(R.shapes)}}return function(T){if(Y(xe,T.v)&&(z(T.layers),T.assets)){var R,ne=T.assets.length;for(R=0;R<ne;R+=1)T.assets[R].layers&&z(T.assets[R].layers)}}}();function Te(xe){xe.__complete||(Ke(xe),Z(xe),ae(xe),Se(xe),De(xe),J(xe.layers,xe.assets),G(xe.chars,xe.assets),xe.__complete=!0)}function Ye(xe){xe.t.a.length===0&&"m"in xe.t.p}var ke={};return ke.completeData=Te,ke.checkColors=Ke,ke.checkChars=ae,ke.checkPathProperties=Se,ke.checkShapes=De,ke.completeLayers=J,ke}if(x.dataManager||(x.dataManager=q()),x.assetLoader||(x.assetLoader=function(){function J(O){var _=O.getResponseHeader("content-type");return _&&O.responseType==="json"&&_.indexOf("json")!==-1||O.response&&as(O.response)==="object"?O.response:O.response&&typeof O.response=="string"?JSON.parse(O.response):O.responseText?JSON.parse(O.responseText):null}function G(O,_,P,$){var Y,Z=new XMLHttpRequest;try{Z.responseType="json"}catch{}Z.onreadystatechange=function(){if(Z.readyState===4)if(Z.status===200)Y=J(Z),P(Y);else try{Y=J(Z),P(Y)}catch(ae){$&&$(ae)}};try{Z.open(["G","E","T"].join(""),O,!0)}catch{Z.open(["G","E","T"].join(""),_+"/"+O,!0)}Z.send()}return{load:G}}()),H.data.type==="loadAnimation")x.assetLoader.load(H.data.path,H.data.fullPath,function(J){x.dataManager.completeData(J),x.postMessage({id:H.data.id,payload:J,status:"success"})},function(){x.postMessage({id:H.data.id,status:"error"})});else if(H.data.type==="complete"){var K=H.data.animation;x.dataManager.completeData(K),x.postMessage({id:H.data.id,payload:K,status:"success"})}else H.data.type==="loadData"&&x.assetLoader.load(H.data.path,H.data.fullPath,function(J){x.postMessage({id:H.data.id,payload:J,status:"success"})},function(){x.postMessage({id:H.data.id,status:"error"})})}),m.onmessage=function(I){var H=I.data,q=H.id,K=h[q];h[q]=null,H.status==="success"?K.onComplete(H.payload):K.onError&&K.onError()})}function L(I,H){c+=1;var q="processId_"+c;return h[q]={onComplete:I,onError:H},q}function B(I,H,q){D();var K=L(H,q);m.postMessage({type:"loadAnimation",path:I,fullPath:window.location.origin+window.location.pathname,id:K})}function V(I,H,q){D();var K=L(H,q);m.postMessage({type:"loadData",path:I,fullPath:window.location.origin+window.location.pathname,id:K})}function ee(I,H,q){D();var K=L(H,q);m.postMessage({type:"complete",animation:I,id:K})}return{loadAnimation:B,loadData:V,completeAnimation:ee}}(),cr=function(){var c=function(){var G=d("canvas");G.width=1,G.height=1;var O=G.getContext("2d");return O.fillStyle="rgba(0,0,0,0)",O.fillRect(0,0,1,1),G}();function h(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function p(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function m(G,O,_){var P="";if(G.e)P=G.p;else if(O){var $=G.p;$.indexOf("images/")!==-1&&($=$.split("/")[1]),P=O+$}else P=_,P+=G.u?G.u:"",P+=G.p;return P}function S(G){var O=0,_=setInterval((function(){var P=G.getBBox();(P.width||O>500)&&(this._imageLoaded(),clearInterval(_)),O+=1}).bind(this),50)}function x(G){var O=m(G,this.assetsPath,this.path),_=Be("image");k?this.testImageLoaded(_):_.addEventListener("load",this._imageLoaded,!1),_.addEventListener("error",(function(){P.img=c,this._imageLoaded()}).bind(this),!1),_.setAttributeNS("http://www.w3.org/1999/xlink","href",O),this._elementHelper.append?this._elementHelper.append(_):this._elementHelper.appendChild(_);var P={img:_,assetData:G};return P}function A(G){var O=m(G,this.assetsPath,this.path),_=d("img");_.crossOrigin="anonymous",_.addEventListener("load",this._imageLoaded,!1),_.addEventListener("error",(function(){P.img=c,this._imageLoaded()}).bind(this),!1),_.src=O;var P={img:_,assetData:G};return P}function D(G){var O={assetData:G},_=m(G,this.assetsPath,this.path);return os.loadData(_,(function(P){O.img=P,this._footageLoaded()}).bind(this),(function(){O.img={},this._footageLoaded()}).bind(this)),O}function L(G,O){this.imagesLoadedCb=O;var _,P=G.length;for(_=0;_<P;_+=1)G[_].layers||(!G[_].t||G[_].t==="seq"?(this.totalImages+=1,this.images.push(this._createImageData(G[_]))):G[_].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(G[_]))))}function B(G){this.path=G||""}function V(G){this.assetsPath=G||""}function ee(G){for(var O=0,_=this.images.length;O<_;){if(this.images[O].assetData===G)return this.images[O].img;O+=1}return null}function I(){this.imagesLoadedCb=null,this.images.length=0}function H(){return this.totalImages===this.loadedAssets}function q(){return this.totalFootages===this.loadedFootagesCount}function K(G,O){G==="svg"?(this._elementHelper=O,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function J(){this._imageLoaded=h.bind(this),this._footageLoaded=p.bind(this),this.testImageLoaded=S.bind(this),this.createFootageData=D.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return J.prototype={loadAssets:L,setAssetsPath:V,setPath:B,loadedImages:H,loadedFootages:q,destroy:I,getAsset:ee,createImgData:A,createImageData:x,imageLoaded:h,footageLoaded:p,setCacheType:K},J}();function Ds(){}Ds.prototype={triggerEvent:function(h,p){if(this._cbs[h])for(var m=this._cbs[h],S=0;S<m.length;S+=1)m[S](p)},addEventListener:function(h,p){return this._cbs[h]||(this._cbs[h]=[]),this._cbs[h].push(p),(function(){this.removeEventListener(h,p)}).bind(this)},removeEventListener:function(h,p){if(!p)this._cbs[h]=null;else if(this._cbs[h]){for(var m=0,S=this._cbs[h].length;m<S;)this._cbs[h][m]===p&&(this._cbs[h].splice(m,1),m-=1,S-=1),m+=1;this._cbs[h].length||(this._cbs[h]=null)}}};var Gi=function(){function c(h){for(var p=h.split(`\r
|
|
77
|
-
`),m={},S,x=0,A=0;A<p.length;A+=1)S=p[A].split(":"),S.length===2&&(m[S[0]]=S[1].trim(),x+=1);if(x===0)throw new Error;return m}return function(h){for(var p=[],m=0;m<h.length;m+=1){var S=h[m],x={time:S.tm,duration:S.dr};try{x.payload=JSON.parse(h[m].cm)}catch{try{x.payload=c(h[m].cm)}catch{x.payload={name:h[m].cm}}}p.push(x)}return p}}(),Vi=function(){function c(h){this.compositions.push(h)}return function(){function h(p){for(var m=0,S=this.compositions.length;m<S;){if(this.compositions[m].data&&this.compositions[m].data.nm===p)return this.compositions[m].prepareFrame&&this.compositions[m].data.xt&&this.compositions[m].prepareFrame(this.currentFrame),this.compositions[m].compInterface;m+=1}return null}return h.compositions=[],h.currentFrame=0,h.registerComposition=c,h}}(),ls={},ur=function(h,p){ls[h]=p};function Ms(c){return ls[c]}function Fs(){if(ls.canvas)return"canvas";for(var c in ls)if(ls[c])return c;return""}function Os(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Os=function(p){return typeof p}:Os=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},Os(c)}var Me=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=we(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=et(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=Vi(),this.imagePreloader=new cr,this.audioController=v(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new se("drawnFrame",0,0,0),this.expressionsPlugin=Je()};f([Ds],Me),Me.prototype.setParams=function(c){(c.wrapper||c.container)&&(this.wrapper=c.wrapper||c.container);var h="svg";c.animType?h=c.animType:c.renderer&&(h=c.renderer);var p=Ms(h);this.renderer=new p(this,c.rendererSettings),this.imagePreloader.setCacheType(h,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=h,c.loop===""||c.loop===null||c.loop===void 0||c.loop===!0?this.loop=!0:c.loop===!1?this.loop=!1:this.loop=parseInt(c.loop,10),this.autoplay="autoplay"in c?c.autoplay:!0,this.name=c.name?c.name:"",this.autoloadSegments=Object.prototype.hasOwnProperty.call(c,"autoloadSegments")?c.autoloadSegments:!0,this.assetsPath=c.assetsPath,this.initialSegment=c.initialSegment,c.audioFactory&&this.audioController.setAudioFactory(c.audioFactory),c.animationData?this.setupAnimation(c.animationData):c.path&&(c.path.lastIndexOf("\\")!==-1?this.path=c.path.substr(0,c.path.lastIndexOf("\\")+1):this.path=c.path.substr(0,c.path.lastIndexOf("/")+1),this.fileName=c.path.substr(c.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),os.loadAnimation(c.path,this.configAnimation,this.onSetupError))},Me.prototype.onSetupError=function(){this.trigger("data_failed")},Me.prototype.setupAnimation=function(c){os.completeAnimation(c,this.configAnimation)},Me.prototype.setData=function(c,h){h&&Os(h)!=="object"&&(h=JSON.parse(h));var p={wrapper:c,animationData:h},m=c.attributes;p.path=m.getNamedItem("data-animation-path")?m.getNamedItem("data-animation-path").value:m.getNamedItem("data-bm-path")?m.getNamedItem("data-bm-path").value:m.getNamedItem("bm-path")?m.getNamedItem("bm-path").value:"",p.animType=m.getNamedItem("data-anim-type")?m.getNamedItem("data-anim-type").value:m.getNamedItem("data-bm-type")?m.getNamedItem("data-bm-type").value:m.getNamedItem("bm-type")?m.getNamedItem("bm-type").value:m.getNamedItem("data-bm-renderer")?m.getNamedItem("data-bm-renderer").value:m.getNamedItem("bm-renderer")?m.getNamedItem("bm-renderer").value:Fs()||"canvas";var S=m.getNamedItem("data-anim-loop")?m.getNamedItem("data-anim-loop").value:m.getNamedItem("data-bm-loop")?m.getNamedItem("data-bm-loop").value:m.getNamedItem("bm-loop")?m.getNamedItem("bm-loop").value:"";S==="false"?p.loop=!1:S==="true"?p.loop=!0:S!==""&&(p.loop=parseInt(S,10));var x=m.getNamedItem("data-anim-autoplay")?m.getNamedItem("data-anim-autoplay").value:m.getNamedItem("data-bm-autoplay")?m.getNamedItem("data-bm-autoplay").value:m.getNamedItem("bm-autoplay")?m.getNamedItem("bm-autoplay").value:!0;p.autoplay=x!=="false",p.name=m.getNamedItem("data-name")?m.getNamedItem("data-name").value:m.getNamedItem("data-bm-name")?m.getNamedItem("data-bm-name").value:m.getNamedItem("bm-name")?m.getNamedItem("bm-name").value:"";var A=m.getNamedItem("data-anim-prerender")?m.getNamedItem("data-anim-prerender").value:m.getNamedItem("data-bm-prerender")?m.getNamedItem("data-bm-prerender").value:m.getNamedItem("bm-prerender")?m.getNamedItem("bm-prerender").value:"";A==="false"&&(p.prerender=!1),p.path?this.setParams(p):this.trigger("destroy")},Me.prototype.includeLayers=function(c){c.op>this.animationData.op&&(this.animationData.op=c.op,this.totalFrames=Math.floor(c.op-this.animationData.ip));var h=this.animationData.layers,p,m=h.length,S=c.layers,x,A=S.length;for(x=0;x<A;x+=1)for(p=0;p<m;){if(h[p].id===S[x].id){h[p]=S[x];break}p+=1}if((c.chars||c.fonts)&&(this.renderer.globalData.fontManager.addChars(c.chars),this.renderer.globalData.fontManager.addFonts(c.fonts,this.renderer.globalData.defs)),c.assets)for(m=c.assets.length,p=0;p<m;p+=1)this.animationData.assets.push(c.assets[p]);this.animationData.__complete=!1,os.completeAnimation(this.animationData,this.onSegmentComplete)},Me.prototype.onSegmentComplete=function(c){this.animationData=c;var h=Je();h&&h.initExpressions(this),this.loadNextSegment()},Me.prototype.loadNextSegment=function(){var c=this.animationData.segments;if(!c||c.length===0||!this.autoloadSegments){this.trigger("data_ready"),this.timeCompleted=this.totalFrames;return}var h=c.shift();this.timeCompleted=h.time*this.frameRate;var p=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,os.loadData(p,this.includeLayers.bind(this),(function(){this.trigger("data_failed")}).bind(this))},Me.prototype.loadSegments=function(){var c=this.animationData.segments;c||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},Me.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},Me.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},Me.prototype.configAnimation=function(c){if(this.renderer)try{this.animationData=c,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(c),c.assets||(c.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(c.assets),this.markers=Gi(c.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(h){this.triggerConfigError(h)}},Me.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},Me.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||this.renderer.rendererType!=="canvas")&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var c=Je();c&&c.initExpressions(this),this.renderer.initItems(),setTimeout((function(){this.trigger("DOMLoaded")}).bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},Me.prototype.resize=function(c,h){var p=typeof c=="number"?c:void 0,m=typeof h=="number"?h:void 0;this.renderer.updateContainerSize(p,m)},Me.prototype.setSubframe=function(c){this.isSubframeEnabled=!!c},Me.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},Me.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(c){this.triggerRenderFrameError(c)}},Me.prototype.play=function(c){c&&this.name!==c||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},Me.prototype.pause=function(c){c&&this.name!==c||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},Me.prototype.togglePause=function(c){c&&this.name!==c||(this.isPaused===!0?this.play():this.pause())},Me.prototype.stop=function(c){c&&this.name!==c||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},Me.prototype.getMarkerData=function(c){for(var h,p=0;p<this.markers.length;p+=1)if(h=this.markers[p],h.payload&&h.payload.name===c)return h;return null},Me.prototype.goToAndStop=function(c,h,p){if(!(p&&this.name!==p)){var m=Number(c);if(isNaN(m)){var S=this.getMarkerData(c);S&&this.goToAndStop(S.time,!0)}else h?this.setCurrentRawFrameValue(c):this.setCurrentRawFrameValue(c*this.frameModifier);this.pause()}},Me.prototype.goToAndPlay=function(c,h,p){if(!(p&&this.name!==p)){var m=Number(c);if(isNaN(m)){var S=this.getMarkerData(c);S&&(S.duration?this.playSegments([S.time,S.time+S.duration],!0):this.goToAndStop(S.time,!0))}else this.goToAndStop(m,h,p);this.play()}},Me.prototype.advanceTime=function(c){if(!(this.isPaused===!0||this.isLoaded===!1)){var h=this.currentRawFrame+c*this.frameModifier,p=!1;h>=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(h>this.totalFrames?h%this.totalFrames:0)||(p=!0,h=this.totalFrames-1):h>=this.totalFrames?(this.playCount+=1,this.checkSegments(h%this.totalFrames)||(this.setCurrentRawFrameValue(h%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(h):h<0?this.checkSegments(h%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+h%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(p=!0,h=0)):this.setCurrentRawFrameValue(h),p&&(this.setCurrentRawFrameValue(h),this.pause(),this.trigger("complete"))}},Me.prototype.adjustSegment=function(c,h){this.playCount=0,c[1]<c[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=c[0]-c[1],this.timeCompleted=this.totalFrames,this.firstFrame=c[1],this.setCurrentRawFrameValue(this.totalFrames-.001-h)):c[1]>c[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=c[1]-c[0],this.timeCompleted=this.totalFrames,this.firstFrame=c[0],this.setCurrentRawFrameValue(.001+h)),this.trigger("segmentStart")},Me.prototype.setSegment=function(c,h){var p=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<c?p=c:this.currentRawFrame+this.firstFrame>h&&(p=h-c)),this.firstFrame=c,this.totalFrames=h-c,this.timeCompleted=this.totalFrames,p!==-1&&this.goToAndStop(p,!0)},Me.prototype.playSegments=function(c,h){if(h&&(this.segments.length=0),Os(c[0])==="object"){var p,m=c.length;for(p=0;p<m;p+=1)this.segments.push(c[p])}else this.segments.push(c);this.segments.length&&h&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},Me.prototype.resetSegments=function(c){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),c&&this.checkSegments(0)},Me.prototype.checkSegments=function(c){return this.segments.length?(this.adjustSegment(this.segments.shift(),c),!0):!1},Me.prototype.destroy=function(c){c&&this.name!==c||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)},Me.prototype.setCurrentRawFrameValue=function(c){this.currentRawFrame=c,this.gotoFrame()},Me.prototype.setSpeed=function(c){this.playSpeed=c,this.updaFrameModifier()},Me.prototype.setDirection=function(c){this.playDirection=c<0?-1:1,this.updaFrameModifier()},Me.prototype.setLoop=function(c){this.loop=c},Me.prototype.setVolume=function(c,h){h&&this.name!==h||this.audioController.setVolume(c)},Me.prototype.getVolume=function(){return this.audioController.getVolume()},Me.prototype.mute=function(c){c&&this.name!==c||this.audioController.mute()},Me.prototype.unmute=function(c){c&&this.name!==c||this.audioController.unmute()},Me.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},Me.prototype.getPath=function(){return this.path},Me.prototype.getAssetsPath=function(c){var h="";if(c.e)h=c.p;else if(this.assetsPath){var p=c.p;p.indexOf("images/")!==-1&&(p=p.split("/")[1]),h=this.assetsPath+p}else h=this.path,h+=c.u?c.u:"",h+=c.p;return h},Me.prototype.getAssetData=function(c){for(var h=0,p=this.assets.length;h<p;){if(c===this.assets[h].id)return this.assets[h];h+=1}return null},Me.prototype.hide=function(){this.renderer.hide()},Me.prototype.show=function(){this.renderer.show()},Me.prototype.getDuration=function(c){return c?this.totalFrames:this.totalFrames/this.frameRate},Me.prototype.updateDocumentData=function(c,h,p){try{var m=this.renderer.getElementByPath(c);m.updateDocumentData(h,p)}catch{}},Me.prototype.trigger=function(c){if(this._cbs&&this._cbs[c])switch(c){case"enterFrame":this.triggerEvent(c,new se(c,this.currentFrame,this.totalFrames,this.frameModifier));break;case"drawnFrame":this.drawnFrameEvent.currentTime=this.currentFrame,this.drawnFrameEvent.totalTime=this.totalFrames,this.drawnFrameEvent.direction=this.frameModifier,this.triggerEvent(c,this.drawnFrameEvent);break;case"loopComplete":this.triggerEvent(c,new de(c,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(c,new pe(c,this.frameMult));break;case"segmentStart":this.triggerEvent(c,new be(c,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(c,new Le(c,this));break;default:this.triggerEvent(c)}c==="enterFrame"&&this.onEnterFrame&&this.onEnterFrame.call(this,new se(c,this.currentFrame,this.totalFrames,this.frameMult)),c==="loopComplete"&&this.onLoopComplete&&this.onLoopComplete.call(this,new de(c,this.loop,this.playCount,this.frameMult)),c==="complete"&&this.onComplete&&this.onComplete.call(this,new pe(c,this.frameMult)),c==="segmentStart"&&this.onSegmentStart&&this.onSegmentStart.call(this,new be(c,this.firstFrame,this.totalFrames)),c==="destroy"&&this.onDestroy&&this.onDestroy.call(this,new Le(c,this))},Me.prototype.triggerRenderFrameError=function(c){var h=new ue(c,this.currentFrame);this.triggerEvent("error",h),this.onError&&this.onError.call(this,h)},Me.prototype.triggerConfigError=function(c){var h=new he(c,this.currentFrame);this.triggerEvent("error",h),this.onError&&this.onError.call(this,h)};var Tt=function(){var c={},h=[],p=0,m=0,S=0,x=!0,A=!1;function D(M){for(var z=0,T=M.target;z<m;)h[z].animation===T&&(h.splice(z,1),z-=1,m-=1,T.isPaused||ee()),z+=1}function L(M,z){if(!M)return null;for(var T=0;T<m;){if(h[T].elem===M&&h[T].elem!==null)return h[T].animation;T+=1}var R=new Me;return I(R,M),R.setData(M,z),R}function B(){var M,z=h.length,T=[];for(M=0;M<z;M+=1)T.push(h[M].animation);return T}function V(){S+=1,Ke()}function ee(){S-=1}function I(M,z){M.addEventListener("destroy",D),M.addEventListener("_active",V),M.addEventListener("_idle",ee),h.push({elem:z,animation:M}),m+=1}function H(M){var z=new Me;return I(z,null),z.setParams(M),z}function q(M,z){var T;for(T=0;T<m;T+=1)h[T].animation.setSpeed(M,z)}function K(M,z){var T;for(T=0;T<m;T+=1)h[T].animation.setDirection(M,z)}function J(M){var z;for(z=0;z<m;z+=1)h[z].animation.play(M)}function G(M){var z=M-p,T;for(T=0;T<m;T+=1)h[T].animation.advanceTime(z);p=M,S&&!A?window.requestAnimationFrame(G):x=!0}function O(M){p=M,window.requestAnimationFrame(G)}function _(M){var z;for(z=0;z<m;z+=1)h[z].animation.pause(M)}function P(M,z,T){var R;for(R=0;R<m;R+=1)h[R].animation.goToAndStop(M,z,T)}function $(M){var z;for(z=0;z<m;z+=1)h[z].animation.stop(M)}function Y(M){var z;for(z=0;z<m;z+=1)h[z].animation.togglePause(M)}function Z(M){var z;for(z=m-1;z>=0;z-=1)h[z].animation.destroy(M)}function ae(M,z,T){var R=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),ne,X=R.length;for(ne=0;ne<X;ne+=1)T&&R[ne].setAttribute("data-bm-type",T),L(R[ne],M);if(z&&X===0){T||(T="svg");var Re=document.getElementsByTagName("body")[0];Re.innerText="";var Ue=d("div");Ue.style.width="100%",Ue.style.height="100%",Ue.setAttribute("data-bm-type",T),Re.appendChild(Ue),L(Ue,M)}}function Se(){var M;for(M=0;M<m;M+=1)h[M].animation.resize()}function Ke(){!A&&S&&x&&(window.requestAnimationFrame(O),x=!1)}function De(){A=!0}function Te(){A=!1,Ke()}function Ye(M,z){var T;for(T=0;T<m;T+=1)h[T].animation.setVolume(M,z)}function ke(M){var z;for(z=0;z<m;z+=1)h[z].animation.mute(M)}function xe(M){var z;for(z=0;z<m;z+=1)h[z].animation.unmute(M)}return c.registerAnimation=L,c.loadAnimation=H,c.setSpeed=q,c.setDirection=K,c.play=J,c.pause=_,c.stop=$,c.togglePause=Y,c.searchAnimations=ae,c.resize=Se,c.goToAndStop=P,c.destroy=Z,c.freeze=De,c.unfreeze=Te,c.setVolume=Ye,c.mute=ke,c.unmute=xe,c.getRegisteredAnimations=B,c}(),si=function(){var c={};c.getBezierEasing=p;var h={};function p(O,_,P,$,Y){var Z=Y||("bez_"+O+"_"+_+"_"+P+"_"+$).replace(/\./g,"p");if(h[Z])return h[Z];var ae=new G([O,_,P,$]);return h[Z]=ae,ae}var m=4,S=.001,x=1e-7,A=10,D=11,L=1/(D-1),B=typeof Float32Array=="function";function V(O,_){return 1-3*_+3*O}function ee(O,_){return 3*_-6*O}function I(O){return 3*O}function H(O,_,P){return((V(_,P)*O+ee(_,P))*O+I(_))*O}function q(O,_,P){return 3*V(_,P)*O*O+2*ee(_,P)*O+I(_)}function K(O,_,P,$,Y){var Z,ae,Se=0;do ae=_+(P-_)/2,Z=H(ae,$,Y)-O,Z>0?P=ae:_=ae;while(Math.abs(Z)>x&&++Se<A);return ae}function J(O,_,P,$){for(var Y=0;Y<m;++Y){var Z=q(_,P,$);if(Z===0)return _;var ae=H(_,P,$)-O;_-=ae/Z}return _}function G(O){this._p=O,this._mSampleValues=B?new Float32Array(D):new Array(D),this._precomputed=!1,this.get=this.get.bind(this)}return G.prototype={get:function(_){var P=this._p[0],$=this._p[1],Y=this._p[2],Z=this._p[3];return this._precomputed||this._precompute(),P===$&&Y===Z?_:_===0?0:_===1?1:H(this._getTForX(_),$,Z)},_precompute:function(){var _=this._p[0],P=this._p[1],$=this._p[2],Y=this._p[3];this._precomputed=!0,(_!==P||$!==Y)&&this._calcSampleValues()},_calcSampleValues:function(){for(var _=this._p[0],P=this._p[2],$=0;$<D;++$)this._mSampleValues[$]=H($*L,_,P)},_getTForX:function(_){for(var P=this._p[0],$=this._p[2],Y=this._mSampleValues,Z=0,ae=1,Se=D-1;ae!==Se&&Y[ae]<=_;++ae)Z+=L;--ae;var Ke=(_-Y[ae])/(Y[ae+1]-Y[ae]),De=Z+Ke*L,Te=q(De,P,$);return Te>=S?J(_,De,P,$):Te===0?De:K(_,Z,Z+L,P,$)}},c}(),Mn=function(){function c(h){return h.concat(E(h.length))}return{double:c}}(),hr=function(){return function(c,h,p){var m=0,S=c,x=E(S),A={newElement:D,release:L};function D(){var B;return m?(m-=1,B=x[m]):B=h(),B}function L(B){m===S&&(x=Mn.double(x),S*=2),p&&p(B),x[m]=B,m+=1}return A}}(),Fn=function(){function c(){return{addedLength:0,percents:y("float32",Pt()),lengths:y("float32",Pt())}}return hr(8,c)}(),On=function(){function c(){return{lengths:[],totalLength:0}}function h(p){var m,S=p.lengths.length;for(m=0;m<S;m+=1)Fn.release(p.lengths[m]);p.lengths.length=0}return hr(8,c,h)}();function no(){var c=Math;function h(I,H,q,K,J,G){var O=I*K+H*J+q*G-J*K-G*I-q*H;return O>-.001&&O<.001}function p(I,H,q,K,J,G,O,_,P){if(q===0&&G===0&&P===0)return h(I,H,K,J,O,_);var $=c.sqrt(c.pow(K-I,2)+c.pow(J-H,2)+c.pow(G-q,2)),Y=c.sqrt(c.pow(O-I,2)+c.pow(_-H,2)+c.pow(P-q,2)),Z=c.sqrt(c.pow(O-K,2)+c.pow(_-J,2)+c.pow(P-G,2)),ae;return $>Y?$>Z?ae=$-Y-Z:ae=Z-Y-$:Z>Y?ae=Z-Y-$:ae=Y-$-Z,ae>-1e-4&&ae<1e-4}var m=function(){return function(I,H,q,K){var J=Pt(),G,O,_,P,$,Y=0,Z,ae=[],Se=[],Ke=Fn.newElement();for(_=q.length,G=0;G<J;G+=1){for($=G/(J-1),Z=0,O=0;O<_;O+=1)P=U(1-$,3)*I[O]+3*U(1-$,2)*$*q[O]+3*(1-$)*U($,2)*K[O]+U($,3)*H[O],ae[O]=P,Se[O]!==null&&(Z+=U(ae[O]-Se[O],2)),Se[O]=ae[O];Z&&(Z=N(Z),Y+=Z),Ke.percents[G]=$,Ke.lengths[G]=Y}return Ke.addedLength=Y,Ke}}();function S(I){var H=On.newElement(),q=I.c,K=I.v,J=I.o,G=I.i,O,_=I._length,P=H.lengths,$=0;for(O=0;O<_-1;O+=1)P[O]=m(K[O],K[O+1],J[O],G[O+1]),$+=P[O].addedLength;return q&&_&&(P[O]=m(K[O],K[0],J[O],G[0]),$+=P[O].addedLength),H.totalLength=$,H}function x(I){this.segmentLength=0,this.points=new Array(I)}function A(I,H){this.partialLength=I,this.point=H}var D=function(){var I={};return function(H,q,K,J){var G=(H[0]+"_"+H[1]+"_"+q[0]+"_"+q[1]+"_"+K[0]+"_"+K[1]+"_"+J[0]+"_"+J[1]).replace(/\./g,"p");if(!I[G]){var O=Pt(),_,P,$,Y,Z,ae=0,Se,Ke,De=null;H.length===2&&(H[0]!==q[0]||H[1]!==q[1])&&h(H[0],H[1],q[0],q[1],H[0]+K[0],H[1]+K[1])&&h(H[0],H[1],q[0],q[1],q[0]+J[0],q[1]+J[1])&&(O=2);var Te=new x(O);for($=K.length,_=0;_<O;_+=1){for(Ke=E($),Z=_/(O-1),Se=0,P=0;P<$;P+=1)Y=U(1-Z,3)*H[P]+3*U(1-Z,2)*Z*(H[P]+K[P])+3*(1-Z)*U(Z,2)*(q[P]+J[P])+U(Z,3)*q[P],Ke[P]=Y,De!==null&&(Se+=U(Ke[P]-De[P],2));Se=N(Se),ae+=Se,Te.points[_]=new A(Se,Ke),De=Ke}Te.segmentLength=ae,I[G]=Te}return I[G]}}();function L(I,H){var q=H.percents,K=H.lengths,J=q.length,G=te((J-1)*I),O=I*H.addedLength,_=0;if(G===J-1||G===0||O===K[G])return q[G];for(var P=K[G]>O?-1:1,$=!0;$;)if(K[G]<=O&&K[G+1]>O?(_=(O-K[G])/(K[G+1]-K[G]),$=!1):G+=P,G<0||G>=J-1){if(G===J-1)return q[G];$=!1}return q[G]+(q[G+1]-q[G])*_}function B(I,H,q,K,J,G){var O=L(J,G),_=1-O,P=c.round((_*_*_*I[0]+(O*_*_+_*O*_+_*_*O)*q[0]+(O*O*_+_*O*O+O*_*O)*K[0]+O*O*O*H[0])*1e3)/1e3,$=c.round((_*_*_*I[1]+(O*_*_+_*O*_+_*_*O)*q[1]+(O*O*_+_*O*O+O*_*O)*K[1]+O*O*O*H[1])*1e3)/1e3;return[P,$]}var V=y("float32",8);function ee(I,H,q,K,J,G,O){J<0?J=0:J>1&&(J=1);var _=L(J,O);G=G>1?1:G;var P=L(G,O),$,Y=I.length,Z=1-_,ae=1-P,Se=Z*Z*Z,Ke=_*Z*Z*3,De=_*_*Z*3,Te=_*_*_,Ye=Z*Z*ae,ke=_*Z*ae+Z*_*ae+Z*Z*P,xe=_*_*ae+Z*_*P+_*Z*P,M=_*_*P,z=Z*ae*ae,T=_*ae*ae+Z*P*ae+Z*ae*P,R=_*P*ae+Z*P*P+_*ae*P,ne=_*P*P,X=ae*ae*ae,Re=P*ae*ae+ae*P*ae+ae*ae*P,Ue=P*P*ae+ae*P*P+P*ae*P,ze=P*P*P;for($=0;$<Y;$+=1)V[$*4]=c.round((Se*I[$]+Ke*q[$]+De*K[$]+Te*H[$])*1e3)/1e3,V[$*4+1]=c.round((Ye*I[$]+ke*q[$]+xe*K[$]+M*H[$])*1e3)/1e3,V[$*4+2]=c.round((z*I[$]+T*q[$]+R*K[$]+ne*H[$])*1e3)/1e3,V[$*4+3]=c.round((X*I[$]+Re*q[$]+Ue*K[$]+ze*H[$])*1e3)/1e3;return V}return{getSegmentsLength:S,getNewSegment:ee,getPointInSegment:B,buildBezierData:D,pointOnLine2D:h,pointOnLine3D:p}}var gs=no(),ii=n,dr=Math.abs;function Kr(c,h){var p=this.offsetTime,m;this.propType==="multidimensional"&&(m=y("float32",this.pv.length));for(var S=h.lastIndex,x=S,A=this.keyframes.length-1,D=!0,L,B,V;D;){if(L=this.keyframes[x],B=this.keyframes[x+1],x===A-1&&c>=B.t-p){L.h&&(L=B),S=0;break}if(B.t-p>c){S=x;break}x<A-1?x+=1:(S=0,D=!1)}V=this.keyframesMetadata[x]||{};var ee,I,H,q,K,J,G=B.t-p,O=L.t-p,_;if(L.to){V.bezierData||(V.bezierData=gs.buildBezierData(L.s,B.s||L.e,L.to,L.ti));var P=V.bezierData;if(c>=G||c<O){var $=c>=G?P.points.length-1:0;for(I=P.points[$].point.length,ee=0;ee<I;ee+=1)m[ee]=P.points[$].point[ee]}else{V.__fnct?J=V.__fnct:(J=si.getBezierEasing(L.o.x,L.o.y,L.i.x,L.i.y,L.n).get,V.__fnct=J),H=J((c-O)/(G-O));var Y=P.segmentLength*H,Z,ae=h.lastFrame<c&&h._lastKeyframeIndex===x?h._lastAddedLength:0;for(K=h.lastFrame<c&&h._lastKeyframeIndex===x?h._lastPoint:0,D=!0,q=P.points.length;D;){if(ae+=P.points[K].partialLength,Y===0||H===0||K===P.points.length-1){for(I=P.points[K].point.length,ee=0;ee<I;ee+=1)m[ee]=P.points[K].point[ee];break}else if(Y>=ae&&Y<ae+P.points[K+1].partialLength){for(Z=(Y-ae)/P.points[K+1].partialLength,I=P.points[K].point.length,ee=0;ee<I;ee+=1)m[ee]=P.points[K].point[ee]+(P.points[K+1].point[ee]-P.points[K].point[ee])*Z;break}K<q-1?K+=1:D=!1}h._lastPoint=K,h._lastAddedLength=ae-P.points[K].partialLength,h._lastKeyframeIndex=x}}else{var Se,Ke,De,Te,Ye;if(A=L.s.length,_=B.s||L.e,this.sh&&L.h!==1)if(c>=G)m[0]=_[0],m[1]=_[1],m[2]=_[2];else if(c<=O)m[0]=L.s[0],m[1]=L.s[1],m[2]=L.s[2];else{var ke=fr(L.s),xe=fr(_),M=(c-O)/(G-O);zr(m,Si(ke,xe,M))}else for(x=0;x<A;x+=1)L.h!==1&&(c>=G?H=1:c<O?H=0:(L.o.x.constructor===Array?(V.__fnct||(V.__fnct=[]),V.__fnct[x]?J=V.__fnct[x]:(Se=L.o.x[x]===void 0?L.o.x[0]:L.o.x[x],Ke=L.o.y[x]===void 0?L.o.y[0]:L.o.y[x],De=L.i.x[x]===void 0?L.i.x[0]:L.i.x[x],Te=L.i.y[x]===void 0?L.i.y[0]:L.i.y[x],J=si.getBezierEasing(Se,Ke,De,Te).get,V.__fnct[x]=J)):V.__fnct?J=V.__fnct:(Se=L.o.x,Ke=L.o.y,De=L.i.x,Te=L.i.y,J=si.getBezierEasing(Se,Ke,De,Te).get,L.keyframeMetadata=J),H=J((c-O)/(G-O)))),_=B.s||L.e,Ye=L.h===1?L.s[x]:L.s[x]+(_[x]-L.s[x])*H,this.propType==="multidimensional"?m[x]=Ye:m=Ye}return h.lastIndex=S,m}function Si(c,h,p){var m=[],S=c[0],x=c[1],A=c[2],D=c[3],L=h[0],B=h[1],V=h[2],ee=h[3],I,H,q,K,J;return H=S*L+x*B+A*V+D*ee,H<0&&(H=-H,L=-L,B=-B,V=-V,ee=-ee),1-H>1e-6?(I=Math.acos(H),q=Math.sin(I),K=Math.sin((1-p)*I)/q,J=Math.sin(p*I)/q):(K=1-p,J=p),m[0]=K*S+J*L,m[1]=K*x+J*B,m[2]=K*A+J*V,m[3]=K*D+J*ee,m}function zr(c,h){var p=h[0],m=h[1],S=h[2],x=h[3],A=Math.atan2(2*m*x-2*p*S,1-2*m*m-2*S*S),D=Math.asin(2*p*m+2*S*x),L=Math.atan2(2*p*x-2*m*S,1-2*p*p-2*S*S);c[0]=A/Q,c[1]=D/Q,c[2]=L/Q}function fr(c){var h=c[0]*Q,p=c[1]*Q,m=c[2]*Q,S=Math.cos(h/2),x=Math.cos(p/2),A=Math.cos(m/2),D=Math.sin(h/2),L=Math.sin(p/2),B=Math.sin(m/2),V=S*x*A-D*L*B,ee=D*L*A+S*x*B,I=D*x*A+S*L*B,H=S*L*A-D*x*B;return[ee,I,H,V]}function Wr(){var c=this.comp.renderedFrame-this.offsetTime,h=this.keyframes[0].t-this.offsetTime,p=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(c===this._caching.lastFrame||this._caching.lastFrame!==ii&&(this._caching.lastFrame>=p&&c>=p||this._caching.lastFrame<h&&c<h))){this._caching.lastFrame>=c&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var m=this.interpolateValue(c,this._caching);this.pv=m}return this._caching.lastFrame=c,this.pv}function pr(c){var h;if(this.propType==="unidimensional")h=c*this.mult,dr(this.v-h)>1e-5&&(this.v=h,this._mdf=!0);else for(var p=0,m=this.v.length;p<m;)h=c[p]*this.mult,dr(this.v[p]-h)>1e-5&&(this.v[p]=h,this._mdf=!0),p+=1}function Hi(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var c,h=this.effectsSequence.length,p=this.kf?this.pv:this.data.k;for(c=0;c<h;c+=1)p=this.effectsSequence[c](p);this.setVValue(p),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function gr(c){this.effectsSequence.push(c),this.container.addDynamicProperty(this)}function Nn(c,h,p,m){this.propType="unidimensional",this.mult=p||1,this.data=h,this.v=p?h.k*p:h.k,this.pv=h.k,this._mdf=!1,this.elem=c,this.container=m,this.comp=c.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=Hi,this.setVValue=pr,this.addEffect=gr}function Bn(c,h,p,m){this.propType="multidimensional",this.mult=p||1,this.data=h,this._mdf=!1,this.elem=c,this.container=m,this.comp=c.comp,this.k=!1,this.kf=!1,this.frameId=-1;var S,x=h.k.length;for(this.v=y("float32",x),this.pv=y("float32",x),this.vel=y("float32",x),S=0;S<x;S+=1)this.v[S]=h.k[S]*this.mult,this.pv[S]=h.k[S];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=Hi,this.setVValue=pr,this.addEffect=gr}function ao(c,h,p,m){this.propType="unidimensional",this.keyframes=h.k,this.keyframesMetadata=[],this.offsetTime=c.data.st,this.frameId=-1,this._caching={lastFrame:ii,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=h,this.mult=p||1,this.elem=c,this.container=m,this.comp=c.comp,this.v=ii,this.pv=ii,this._isFirstFrame=!0,this.getValue=Hi,this.setVValue=pr,this.interpolateValue=Kr,this.effectsSequence=[Wr.bind(this)],this.addEffect=gr}function oo(c,h,p,m){this.propType="multidimensional";var S,x=h.k.length,A,D,L,B;for(S=0;S<x-1;S+=1)h.k[S].to&&h.k[S].s&&h.k[S+1]&&h.k[S+1].s&&(A=h.k[S].s,D=h.k[S+1].s,L=h.k[S].to,B=h.k[S].ti,(A.length===2&&!(A[0]===D[0]&&A[1]===D[1])&&gs.pointOnLine2D(A[0],A[1],D[0],D[1],A[0]+L[0],A[1]+L[1])&&gs.pointOnLine2D(A[0],A[1],D[0],D[1],D[0]+B[0],D[1]+B[1])||A.length===3&&!(A[0]===D[0]&&A[1]===D[1]&&A[2]===D[2])&&gs.pointOnLine3D(A[0],A[1],A[2],D[0],D[1],D[2],A[0]+L[0],A[1]+L[1],A[2]+L[2])&&gs.pointOnLine3D(A[0],A[1],A[2],D[0],D[1],D[2],D[0]+B[0],D[1]+B[1],D[2]+B[2]))&&(h.k[S].to=null,h.k[S].ti=null),A[0]===D[0]&&A[1]===D[1]&&L[0]===0&&L[1]===0&&B[0]===0&&B[1]===0&&(A.length===2||A[2]===D[2]&&L[2]===0&&B[2]===0)&&(h.k[S].to=null,h.k[S].ti=null));this.effectsSequence=[Wr.bind(this)],this.data=h,this.keyframes=h.k,this.keyframesMetadata=[],this.offsetTime=c.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=p||1,this.elem=c,this.container=m,this.comp=c.comp,this.getValue=Hi,this.setVValue=pr,this.interpolateValue=Kr,this.frameId=-1;var V=h.k[0].s.length;for(this.v=y("float32",V),this.pv=y("float32",V),S=0;S<V;S+=1)this.v[S]=ii,this.pv[S]=ii;this._caching={lastFrame:ii,lastIndex:0,value:y("float32",V)},this.addEffect=gr}var Ae=function(){function c(p,m,S,x,A){m.sid&&(m=p.globalData.slotManager.getProp(m));var D;if(!m.k.length)D=new Nn(p,m,x,A);else if(typeof m.k[0]=="number")D=new Bn(p,m,x,A);else switch(S){case 0:D=new ao(p,m,x,A);break;case 1:D=new oo(p,m,x,A);break}return D.effectsSequence.length&&A.addDynamicProperty(D),D}var h={getProp:c};return h}();function Rt(){}Rt.prototype={addDynamicProperty:function(h){this.dynamicProperties.indexOf(h)===-1&&(this.dynamicProperties.push(h),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){this._mdf=!1;var h,p=this.dynamicProperties.length;for(h=0;h<p;h+=1)this.dynamicProperties[h].getValue(),this.dynamicProperties[h]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(h){this.container=h,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var ri=function(){function c(){return y("float32",2)}return hr(8,c)}();function Ts(){this.c=!1,this._length=0,this._maxLength=8,this.v=E(this._maxLength),this.o=E(this._maxLength),this.i=E(this._maxLength)}Ts.prototype.setPathData=function(c,h){this.c=c,this.setLength(h);for(var p=0;p<h;)this.v[p]=ri.newElement(),this.o[p]=ri.newElement(),this.i[p]=ri.newElement(),p+=1},Ts.prototype.setLength=function(c){for(;this._maxLength<c;)this.doubleArrayLength();this._length=c},Ts.prototype.doubleArrayLength=function(){this.v=this.v.concat(E(this._maxLength)),this.i=this.i.concat(E(this._maxLength)),this.o=this.o.concat(E(this._maxLength)),this._maxLength*=2},Ts.prototype.setXYAt=function(c,h,p,m,S){var x;switch(this._length=Math.max(this._length,m+1),this._length>=this._maxLength&&this.doubleArrayLength(),p){case"v":x=this.v;break;case"i":x=this.i;break;case"o":x=this.o;break;default:x=[];break}(!x[m]||x[m]&&!S)&&(x[m]=ri.newElement()),x[m][0]=c,x[m][1]=h},Ts.prototype.setTripleAt=function(c,h,p,m,S,x,A,D){this.setXYAt(c,h,"v",A,D),this.setXYAt(p,m,"o",A,D),this.setXYAt(S,x,"i",A,D)},Ts.prototype.reverse=function(){var c=new Ts;c.setPathData(this.c,this._length);var h=this.v,p=this.o,m=this.i,S=0;this.c&&(c.setTripleAt(h[0][0],h[0][1],m[0][0],m[0][1],p[0][0],p[0][1],0,!1),S=1);var x=this._length-1,A=this._length,D;for(D=S;D<A;D+=1)c.setTripleAt(h[x][0],h[x][1],m[x][0],m[x][1],p[x][0],p[x][1],D,!1),x-=1;return c},Ts.prototype.length=function(){return this._length};var Dt=function(){function c(){return new Ts}function h(S){var x=S._length,A;for(A=0;A<x;A+=1)ri.release(S.v[A]),ri.release(S.i[A]),ri.release(S.o[A]),S.v[A]=null,S.i[A]=null,S.o[A]=null;S._length=0,S.c=!1}function p(S){var x=m.newElement(),A,D=S._length===void 0?S.v.length:S._length;for(x.setLength(D),x.c=S.c,A=0;A<D;A+=1)x.setTripleAt(S.v[A][0],S.v[A][1],S.o[A][0],S.o[A][1],S.i[A][0],S.i[A][1],A);return x}var m=hr(4,c,h);return m.clone=p,m}();function W(){this._length=0,this._maxLength=4,this.shapes=E(this._maxLength)}W.prototype.addShape=function(c){this._length===this._maxLength&&(this.shapes=this.shapes.concat(E(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=c,this._length+=1},W.prototype.releaseShapes=function(){var c;for(c=0;c<this._length;c+=1)Dt.release(this.shapes[c]);this._length=0};var Ee=function(){var c={newShapeCollection:S,release:x},h=0,p=4,m=E(p);function S(){var A;return h?(h-=1,A=m[h]):A=new W,A}function x(A){var D,L=A._length;for(D=0;D<L;D+=1)Dt.release(A.shapes[D]);A._length=0,h===p&&(m=Mn.double(m),p*=2),m[h]=A,h+=1}return c}(),Ce=function(){var c=-999999;function h(G,O,_){var P=_.lastIndex,$,Y,Z,ae,Se,Ke,De,Te,Ye,ke=this.keyframes;if(G<ke[0].t-this.offsetTime)$=ke[0].s[0],Z=!0,P=0;else if(G>=ke[ke.length-1].t-this.offsetTime)$=ke[ke.length-1].s?ke[ke.length-1].s[0]:ke[ke.length-2].e[0],Z=!0;else{for(var xe=P,M=ke.length-1,z=!0,T,R,ne;z&&(T=ke[xe],R=ke[xe+1],!(R.t-this.offsetTime>G));)xe<M-1?xe+=1:z=!1;if(ne=this.keyframesMetadata[xe]||{},Z=T.h===1,P=xe,!Z){if(G>=R.t-this.offsetTime)Te=1;else if(G<T.t-this.offsetTime)Te=0;else{var X;ne.__fnct?X=ne.__fnct:(X=si.getBezierEasing(T.o.x,T.o.y,T.i.x,T.i.y).get,ne.__fnct=X),Te=X((G-(T.t-this.offsetTime))/(R.t-this.offsetTime-(T.t-this.offsetTime)))}Y=R.s?R.s[0]:T.e[0]}$=T.s[0]}for(Ke=O._length,De=$.i[0].length,_.lastIndex=P,ae=0;ae<Ke;ae+=1)for(Se=0;Se<De;Se+=1)Ye=Z?$.i[ae][Se]:$.i[ae][Se]+(Y.i[ae][Se]-$.i[ae][Se])*Te,O.i[ae][Se]=Ye,Ye=Z?$.o[ae][Se]:$.o[ae][Se]+(Y.o[ae][Se]-$.o[ae][Se])*Te,O.o[ae][Se]=Ye,Ye=Z?$.v[ae][Se]:$.v[ae][Se]+(Y.v[ae][Se]-$.v[ae][Se])*Te,O.v[ae][Se]=Ye}function p(){var G=this.comp.renderedFrame-this.offsetTime,O=this.keyframes[0].t-this.offsetTime,_=this.keyframes[this.keyframes.length-1].t-this.offsetTime,P=this._caching.lastFrame;return P!==c&&(P<O&&G<O||P>_&&G>_)||(this._caching.lastIndex=P<G?this._caching.lastIndex:0,this.interpolateShape(G,this.pv,this._caching)),this._caching.lastFrame=G,this.pv}function m(){this.paths=this.localShapeCollection}function S(G,O){if(G._length!==O._length||G.c!==O.c)return!1;var _,P=G._length;for(_=0;_<P;_+=1)if(G.v[_][0]!==O.v[_][0]||G.v[_][1]!==O.v[_][1]||G.o[_][0]!==O.o[_][0]||G.o[_][1]!==O.o[_][1]||G.i[_][0]!==O.i[_][0]||G.i[_][1]!==O.i[_][1])return!1;return!0}function x(G){S(this.v,G)||(this.v=Dt.clone(G),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function A(){if(this.elem.globalData.frameId!==this.frameId){if(!this.effectsSequence.length){this._mdf=!1;return}if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=!1;var G;this.kf?G=this.pv:this.data.ks?G=this.data.ks.k:G=this.data.pt.k;var O,_=this.effectsSequence.length;for(O=0;O<_;O+=1)G=this.effectsSequence[O](G);this.setVValue(G),this.lock=!1,this.frameId=this.elem.globalData.frameId}}function D(G,O,_){this.propType="shape",this.comp=G.comp,this.container=G,this.elem=G,this.data=O,this.k=!1,this.kf=!1,this._mdf=!1;var P=_===3?O.pt.k:O.ks.k;this.v=Dt.clone(P),this.pv=Dt.clone(this.v),this.localShapeCollection=Ee.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=m,this.effectsSequence=[]}function L(G){this.effectsSequence.push(G),this.container.addDynamicProperty(this)}D.prototype.interpolateShape=h,D.prototype.getValue=A,D.prototype.setVValue=x,D.prototype.addEffect=L;function B(G,O,_){this.propType="shape",this.comp=G.comp,this.elem=G,this.container=G,this.offsetTime=G.data.st,this.keyframes=_===3?O.pt.k:O.ks.k,this.keyframesMetadata=[],this.k=!0,this.kf=!0;var P=this.keyframes[0].s[0].i.length;this.v=Dt.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,P),this.pv=Dt.clone(this.v),this.localShapeCollection=Ee.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=c,this.reset=m,this._caching={lastFrame:c,lastIndex:0},this.effectsSequence=[p.bind(this)]}B.prototype.getValue=A,B.prototype.interpolateShape=h,B.prototype.setVValue=x,B.prototype.addEffect=L;var V=function(){var G=le;function O(_,P){this.v=Dt.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=Ee.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=P.d,this.elem=_,this.comp=_.comp,this.frameId=-1,this.initDynamicPropertyContainer(_),this.p=Ae.getProp(_,P.p,1,0,this),this.s=Ae.getProp(_,P.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return O.prototype={reset:m,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var P=this.p.v[0],$=this.p.v[1],Y=this.s.v[0]/2,Z=this.s.v[1]/2,ae=this.d!==3,Se=this.v;Se.v[0][0]=P,Se.v[0][1]=$-Z,Se.v[1][0]=ae?P+Y:P-Y,Se.v[1][1]=$,Se.v[2][0]=P,Se.v[2][1]=$+Z,Se.v[3][0]=ae?P-Y:P+Y,Se.v[3][1]=$,Se.i[0][0]=ae?P-Y*G:P+Y*G,Se.i[0][1]=$-Z,Se.i[1][0]=ae?P+Y:P-Y,Se.i[1][1]=$-Z*G,Se.i[2][0]=ae?P+Y*G:P-Y*G,Se.i[2][1]=$+Z,Se.i[3][0]=ae?P-Y:P+Y,Se.i[3][1]=$+Z*G,Se.o[0][0]=ae?P+Y*G:P-Y*G,Se.o[0][1]=$-Z,Se.o[1][0]=ae?P+Y:P-Y,Se.o[1][1]=$+Z*G,Se.o[2][0]=ae?P-Y*G:P+Y*G,Se.o[2][1]=$+Z,Se.o[3][0]=ae?P-Y:P+Y,Se.o[3][1]=$-Z*G}},f([Rt],O),O}(),ee=function(){function G(O,_){this.v=Dt.newElement(),this.v.setPathData(!0,0),this.elem=O,this.comp=O.comp,this.data=_,this.frameId=-1,this.d=_.d,this.initDynamicPropertyContainer(O),_.sy===1?(this.ir=Ae.getProp(O,_.ir,0,0,this),this.is=Ae.getProp(O,_.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=Ae.getProp(O,_.pt,0,0,this),this.p=Ae.getProp(O,_.p,1,0,this),this.r=Ae.getProp(O,_.r,0,Q,this),this.or=Ae.getProp(O,_.or,0,0,this),this.os=Ae.getProp(O,_.os,0,.01,this),this.localShapeCollection=Ee.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return G.prototype={reset:m,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var _=Math.floor(this.pt.v)*2,P=Math.PI*2/_,$=!0,Y=this.or.v,Z=this.ir.v,ae=this.os.v,Se=this.is.v,Ke=2*Math.PI*Y/(_*2),De=2*Math.PI*Z/(_*2),Te,Ye,ke,xe,M=-Math.PI/2;M+=this.r.v;var z=this.data.d===3?-1:1;for(this.v._length=0,Te=0;Te<_;Te+=1){Ye=$?Y:Z,ke=$?ae:Se,xe=$?Ke:De;var T=Ye*Math.cos(M),R=Ye*Math.sin(M),ne=T===0&&R===0?0:R/Math.sqrt(T*T+R*R),X=T===0&&R===0?0:-T/Math.sqrt(T*T+R*R);T+=+this.p.v[0],R+=+this.p.v[1],this.v.setTripleAt(T,R,T-ne*xe*ke*z,R-X*xe*ke*z,T+ne*xe*ke*z,R+X*xe*ke*z,Te,!0),$=!$,M+=P*z}},convertPolygonToPath:function(){var _=Math.floor(this.pt.v),P=Math.PI*2/_,$=this.or.v,Y=this.os.v,Z=2*Math.PI*$/(_*4),ae,Se=-Math.PI*.5,Ke=this.data.d===3?-1:1;for(Se+=this.r.v,this.v._length=0,ae=0;ae<_;ae+=1){var De=$*Math.cos(Se),Te=$*Math.sin(Se),Ye=De===0&&Te===0?0:Te/Math.sqrt(De*De+Te*Te),ke=De===0&&Te===0?0:-De/Math.sqrt(De*De+Te*Te);De+=+this.p.v[0],Te+=+this.p.v[1],this.v.setTripleAt(De,Te,De-Ye*Z*Y*Ke,Te-ke*Z*Y*Ke,De+Ye*Z*Y*Ke,Te+ke*Z*Y*Ke,ae,!0),Se+=P*Ke}this.paths.length=0,this.paths[0]=this.v}},f([Rt],G),G}(),I=function(){function G(O,_){this.v=Dt.newElement(),this.v.c=!0,this.localShapeCollection=Ee.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=O,this.comp=O.comp,this.frameId=-1,this.d=_.d,this.initDynamicPropertyContainer(O),this.p=Ae.getProp(O,_.p,1,0,this),this.s=Ae.getProp(O,_.s,1,0,this),this.r=Ae.getProp(O,_.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return G.prototype={convertRectToPath:function(){var _=this.p.v[0],P=this.p.v[1],$=this.s.v[0]/2,Y=this.s.v[1]/2,Z=j($,Y,this.r.v),ae=Z*(1-le);this.v._length=0,this.d===2||this.d===1?(this.v.setTripleAt(_+$,P-Y+Z,_+$,P-Y+Z,_+$,P-Y+ae,0,!0),this.v.setTripleAt(_+$,P+Y-Z,_+$,P+Y-ae,_+$,P+Y-Z,1,!0),Z!==0?(this.v.setTripleAt(_+$-Z,P+Y,_+$-Z,P+Y,_+$-ae,P+Y,2,!0),this.v.setTripleAt(_-$+Z,P+Y,_-$+ae,P+Y,_-$+Z,P+Y,3,!0),this.v.setTripleAt(_-$,P+Y-Z,_-$,P+Y-Z,_-$,P+Y-ae,4,!0),this.v.setTripleAt(_-$,P-Y+Z,_-$,P-Y+ae,_-$,P-Y+Z,5,!0),this.v.setTripleAt(_-$+Z,P-Y,_-$+Z,P-Y,_-$+ae,P-Y,6,!0),this.v.setTripleAt(_+$-Z,P-Y,_+$-ae,P-Y,_+$-Z,P-Y,7,!0)):(this.v.setTripleAt(_-$,P+Y,_-$+ae,P+Y,_-$,P+Y,2),this.v.setTripleAt(_-$,P-Y,_-$,P-Y+ae,_-$,P-Y,3))):(this.v.setTripleAt(_+$,P-Y+Z,_+$,P-Y+ae,_+$,P-Y+Z,0,!0),Z!==0?(this.v.setTripleAt(_+$-Z,P-Y,_+$-Z,P-Y,_+$-ae,P-Y,1,!0),this.v.setTripleAt(_-$+Z,P-Y,_-$+ae,P-Y,_-$+Z,P-Y,2,!0),this.v.setTripleAt(_-$,P-Y+Z,_-$,P-Y+Z,_-$,P-Y+ae,3,!0),this.v.setTripleAt(_-$,P+Y-Z,_-$,P+Y-ae,_-$,P+Y-Z,4,!0),this.v.setTripleAt(_-$+Z,P+Y,_-$+Z,P+Y,_-$+ae,P+Y,5,!0),this.v.setTripleAt(_+$-Z,P+Y,_+$-ae,P+Y,_+$-Z,P+Y,6,!0),this.v.setTripleAt(_+$,P+Y-Z,_+$,P+Y-Z,_+$,P+Y-ae,7,!0)):(this.v.setTripleAt(_-$,P-Y,_-$+ae,P-Y,_-$,P-Y,1,!0),this.v.setTripleAt(_-$,P+Y,_-$,P+Y-ae,_-$,P+Y,2,!0),this.v.setTripleAt(_+$,P+Y,_+$-ae,P+Y,_+$,P+Y,3,!0)))},getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:m},f([Rt],G),G}();function H(G,O,_){var P;if(_===3||_===4){var $=_===3?O.pt:O.ks,Y=$.k;Y.length?P=new B(G,O,_):P=new D(G,O,_)}else _===5?P=new I(G,O):_===6?P=new V(G,O):_===7&&(P=new ee(G,O));return P.k&&G.addDynamicProperty(P),P}function q(){return D}function K(){return B}var J={};return J.getShapeProp=H,J.getConstructorFunction=q,J.getKeyframedConstructorFunction=K,J}();/*!
|
|
77
|
+
} (data length: ${t&&t.byteLength})`),r.update(t)}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){return new Promise((t,s)=>{const r=Ho(this.config),n=e.map(Fh).filter(a=>!!a&&r.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:a})=>{const o=Oh(a);o?t(o):s(new Error(`Unable to find format for key-system "${a}"`))}).catch(s)})}loadKey(e){const t=e.keyInfo.decryptdata,s=this.getKeyIdString(t),r=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[s];return n||(n=this.keyIdToKeySessionPromise[s]=this.getKeySystemForKeyPromise(t).then(({keySystem:a,mediaKeys:o})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(a,o).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:a,mediaKeys:o,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),n.catch(a=>this.handleError(a))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof xs?this.hls.trigger(C.ERROR,e.data):this.hls.trigger(C.ERROR,{type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[t];if(!s){const r=Fh(e.keyFormat),n=r?[r]:Ho(this.config);return this.attemptKeySystemAccess(n)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=Ho(this.config)),e.length===0)throw new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:s}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),s===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[yt.FAIRPLAY]){const d=kt(new Uint8Array(s));try{const f=yc(JSON.parse(d).sinf),g=Hp(new Uint8Array(f));if(!g)return;r=g.subarray(8,24),n=yt.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const d=MT(s);if(d===null)return;d.version===0&&d.systemId===Mp.WIDEVINE&&d.data&&(r=d.data.subarray(8,24)),n=lT(d.systemId)}if(!n||!r)return;const a=js.hexDump(r),{keyIdToKeySessionPromise:o,mediaKeySessions:l}=this;let u=o[a];for(let d=0;d<l.length;d++){const f=l[d],g=f.decryptdata;if(g.pssh||!g.keyId)continue;const v=js.hexDump(g.keyId);if(a===v||g.uri.replace(/-/g,"").indexOf(a)!==-1){u=o[v],delete o[v],g.pssh=new Uint8Array(s),g.keyId=r,u=o[a]=u.then(()=>this.generateRequestWithPreferredKeySession(f,t,s,"encrypted-event-key-match"));break}}u||(u=o[a]=this.getKeySystemSelectionPromise([n]).then(({keySystem:d,mediaKeys:f})=>{var g;this.throwIfDestroyed();const v=new kn("ISO-23001-7",a,(g=Oh(d))!=null?g:"");return v.pssh=new Uint8Array(s),v.keyId=r,this.attemptSetMediaKeys(d,f).then(()=>{this.throwIfDestroyed();const y=this.createMediaKeySessionContext({decryptdata:v,keySystem:d,mediaKeys:f});return this.generateRequestWithPreferredKeySession(y,t,s,"encrypted-event-no-match")})})),u.catch(d=>this.handleError(d))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(s).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>s.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,s,r){var n,a;const o=(n=this.config.drmSystems)==null||(a=n[e.keySystem])==null?void 0:a.generateRequest;if(o)try{const y=o.call(this.hls,t,s,e);if(!y)throw new Error("Invalid response from configured generateRequest filter");t=y.initDataType,s=e.decryptdata.pssh=y.initData?new Uint8Array(y.initData):null}catch(y){var l;if(this.warn(y.message),(l=this.hls)!=null&&l.config.debug)throw y}if(s===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const u=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${u} (init data type: ${t} length: ${s?s.byteLength:null})`);const d=new Ic,f=e._onmessage=y=>{const E=e.mediaKeysSession;if(!E){d.emit("error",new Error("invalid state"));return}const{messageType:b,message:w}=y;this.log(`"${b}" message event for session "${E.sessionId}" message size: ${w.byteLength}`),b==="license-request"||b==="license-renewal"?this.renewLicense(e,w).catch(F=>{this.handleError(F),d.emit("error",F)}):b==="license-release"?e.keySystem===yt.FAIRPLAY&&(this.updateKeySession(e,Al("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${b}"`)},g=e._onkeystatuseschange=y=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const b=e.keyStatus;d.emit("keyStatus",b),b==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",f),e.mediaKeysSession.addEventListener("keystatuseschange",g);const v=new Promise((y,E)=>{d.on("error",E),d.on("keyStatus",b=>{b.startsWith("usable")?y():b==="output-restricted"?E(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):b==="internal-error"?E(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${b}"`)):b==="expired"?E(new Error("key expired while generating request")):this.warn(`unhandled key status change "${b}"`)})});return e.mediaKeysSession.generateRequest(t,s).then(()=>{var y;this.log(`Request generated for key-session "${(y=e.mediaKeysSession)==null?void 0:y.sessionId}" keyId: ${u}`)}).catch(y=>{throw new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_SESSION,error:y,fatal:!1},`Error generating key-session request: ${y}`)}).then(()=>v).catch(y=>{throw d.removeAllListeners(),this.removeSession(e),y}).then(()=>(d.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,s)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${js.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${js.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,s=t.loader,r=new s(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:n},u=t.certLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(g,v,y,E)=>{a(g.data)},onError:(g,v,y,E)=>{o(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:Nt({url:l.url,data:void 0},g)},`"${e}" certificate request failed (${n}). Status: ${g.code} (${g.text})`))},onTimeout:(g,v,y)=>{o(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(g,v,y)=>{o(new Error("aborted"))}};r.load(l,d,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((r,n)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s==null?void 0:s.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(r=>{throw new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(s,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let d;for(let f=0,g=n.length;f<g;f++){var a,o;d=n[f];const v=(a=d.querySelector("name"))==null?void 0:a.textContent,y=(o=d.querySelector("value"))==null?void 0:o.textContent;v&&y&&e.setRequestHeader(v,y)}}const l=r.querySelector("Challenge"),u=l==null?void 0:l.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return Al(atob(u))}setupLicenseXHR(e,t,s,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,s,r)}).catch(a=>{if(!s.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,s,r)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const a=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const u=this.config.licenseResponseCallback;if(u)try{l=u.call(this.hls,o,a,e)}catch(d){this.error(d)}r(l)}else{const l=s.errorRetry,u=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)n(new xs({type:je.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const d=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${d} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:u})=>{e.keySystem==yt.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(l,u)),l.send(u)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,s.addEventListener("encrypted",this.onMediaEncrypted),s.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},kn.clearKeyUriToKeyIdMap();const s=t.length;Or.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}`)}))).then(()=>{s&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}Or.CDMCleanupPromise=void 0;class xs 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}}var Wt;(function(i){i.MANIFEST="m",i.AUDIO="a",i.VIDEO="v",i.MUXED="av",i.INIT="i",i.CAPTION="c",i.TIMED_TEXT="tt",i.KEY="k",i.OTHER="o"})(Wt||(Wt={}));var Fl;(function(i){i.DASH="d",i.HLS="h",i.SMOOTH="s",i.OTHER="o"})(Fl||(Fl={}));var er;(function(i){i.OBJECT="CMCD-Object",i.REQUEST="CMCD-Request",i.SESSION="CMCD-Session",i.STATUS="CMCD-Status"})(er||(er={}));const ZA={[er.OBJECT]:["br","d","ot","tb"],[er.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[er.SESSION]:["cid","pr","sf","sid","st","v"],[er.STATUS]:["bs","rtp"]};class Gr{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(s=>s instanceof Gr?s:new Gr(s))),this.value=e,this.params=t}}class Ig{constructor(e){this.description=void 0,this.description=e}}const eL="Dict";function tL(i){return Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":typeof i=="object"?JSON.stringify(i):String(i)}function sL(i,e,t,s){return new Error(`failed to ${i} "${tL(e)}" as ${t}`,{cause:s})}const Pd="Bare Item",iL="Boolean",rL="Byte Sequence",nL="Decimal",aL="Integer";function oL(i){return i<-999999999999999||999999999999999<i}const lL=/[\x00-\x1f\x7f]+/,cL="Token",uL="Key";function ti(i,e,t){return sL("serialize",i,e,t)}function hL(i){if(typeof i!="boolean")throw ti(i,iL);return i?"?1":"?0"}function dL(i){return btoa(String.fromCharCode(...i))}function fL(i){if(ArrayBuffer.isView(i)===!1)throw ti(i,rL);return`:${dL(i)}:`}function kg(i){if(oL(i))throw ti(i,aL);return i.toString()}function pL(i){return`@${kg(i.getTime()/1e3)}`}function Pg(i,e){if(i<0)return-Pg(-i,e);const t=Math.pow(10,e);if(Math.abs(i*t%1-.5)<Number.EPSILON){const r=Math.floor(i*t);return(r%2===0?r:r+1)/t}else return Math.round(i*t)/t}function gL(i){const e=Pg(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ti(i,nL);const t=e.toString();return t.includes(".")?t:`${t}.0`}const mL="String";function vL(i){if(lL.test(i))throw ti(i,mL);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function yL(i){return i.description||i.toString().slice(7,-1)}function Dd(i){const e=yL(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ti(e,cL);return e}function Ol(i){switch(typeof i){case"number":if(!_e(i))throw ti(i,Pd);return Number.isInteger(i)?kg(i):gL(i);case"string":return vL(i);case"symbol":return Dd(i);case"boolean":return hL(i);case"object":if(i instanceof Date)return pL(i);if(i instanceof Uint8Array)return fL(i);if(i instanceof Ig)return Dd(i);default:throw ti(i,Pd)}}function Nl(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw ti(i,uL);return i}function Mc(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${Nl(e)}`:`;${Nl(e)}=${Ol(t)}`).join("")}function Dg(i){return i instanceof Gr?`${Ol(i.value)}${Mc(i.params)}`:Ol(i)}function xL(i){return`(${i.value.map(Dg).join(" ")})${Mc(i.params)}`}function SL(i,e={whitespace:!0}){if(typeof i!="object")throw ti(i,eL);const t=i instanceof Map?i.entries():Object.entries(i),s=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Gr||(n=new Gr(n));let a=Nl(r);return n.value===!0?a+=Mc(n.params):(a+="=",Array.isArray(n.value)?a+=xL(n):a+=Dg(n)),a}).join(`,${s}`)}function EL(i,e){return SL(i,e)}const bL=i=>i==="ot"||i==="sf"||i==="st",TL=i=>typeof i=="number"?_e(i):i!=null&&i!==""&&i!==!1;function wL(i,e){const t=new URL(i),s=new URL(e);if(t.origin!==s.origin)return i;const r=t.pathname.split("/").slice(1),n=s.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")}function AL(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}const La=i=>Math.round(i),LL=(i,e)=>(e!=null&&e.baseUrl&&(i=wL(i,e.baseUrl)),encodeURIComponent(i)),fa=i=>La(i/100)*100,CL={br:La,d:La,bl:fa,dl:fa,mtp:fa,nor:LL,rtp:fa,tb:La};function RL(i,e){const t={};if(i==null||typeof i!="object")return t;const s=Object.keys(i).sort(),r=Ct({},CL,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return s.forEach(a=>{if(n!=null&&n(a))return;let o=i[a];const l=r[a];l&&(o=l(o,e)),!(a==="v"&&o===1)&&(a=="pr"&&o===1||TL(o)&&(bL(a)&&typeof o=="string"&&(o=new Ig(o)),t[a]=o))}),t}function Mg(i,e={}){return i?EL(RL(i,e),Ct({whitespace:!1},e)):""}function _L(i,e={}){if(!i)return{};const t=Object.entries(i),s=Object.entries(ZA).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),r=t.reduce((n,a)=>{var o,l;const[u,d]=a,f=((o=s.find(g=>g[1].includes(u)))==null?void 0:o[0])||er.REQUEST;return(l=n[f])!=null||(n[f]={}),n[f][u]=d,n},{});return Object.entries(r).reduce((n,[a,o])=>(n[a]=Mg(o,e),n),{})}function IL(i,e,t){return Ct(i,_L(e,t))}const kL="CMCD";function PL(i,e={}){if(!i)return"";const t=Mg(i,e);return`${kL}=${encodeURIComponent(t)}`}const Md=/CMCD=[^&#]+/;function DL(i,e,t){const s=PL(e,t);if(!s)return i;if(Md.test(i))return i.replace(Md,s);const r=i.includes("?")?"&":"?";return`${i}${r}${s}`}class ML{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=r=>{try{this.apply(r,{ot:Wt.MANIFEST,su:!this.initialized})}catch(n){ie.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,a=this.hls.levels[n.level],o=this.getObjectType(n),l={d:n.duration*1e3,ot:o};(o===Wt.VIDEO||o===Wt.AUDIO||o==Wt.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(r,l)}catch(n){ie.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||AL(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHED,this.onMediaDetached,this),e.on(C.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHED,this.onMediaDetached,this),e.off(C.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=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 s,r;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:Fl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ct(t,this.createData());const s=t.ot===Wt.INIT||t.ot===Wt.VIDEO||t.ot===Wt.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((n,a)=>(r.includes(a)&&(n[a]=t[a]),n),{})),this.useHeaders?(e.headers||(e.headers={}),IL(e.headers,t)):e.url=DL(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Wt.TIMED_TEXT;if(e.sn==="initSegment")return Wt.INIT;if(t==="audio")return Wt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Wt.VIDEO:Wt.MUXED}getTopBandwidth(e){let t=0,s;const r=this.hls;if(e===Wt.AUDIO)s=r.audioTracks;else{const n=r.maxAutoLevel,a=n>-1?n+1:r.levels.length;s=r.levels.slice(0,a)}for(const n of s)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,s=e===Wt.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:vt.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}}const FL=3e5;class OL{constructor(e){this.hls=void 0,this.log=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.log=ie.log.bind(ie,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(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(s=>s!==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:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if((s==null?void 0:s.action)===Ht.SendAlternateToPenaltyBox&&s.flags===_s.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this.pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:u}=t.context;o&&r?a=this.getPathwayForGroupId(o,u,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&r&&(n=r.reduce((o,l)=>(o.indexOf(l.pathwayId)===-1&&o.push(l.pathwayId),o),[])),n&&n.length>1&&(this.updatePathwayPriority(n),s.resolved=this.pathwayId!==a),s.resolved||ie.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${r&&r.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const s=this.penalizedPathways,r=performance.now();Object.keys(s).forEach(n=>{r-s[n]>FL&&delete s[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in s)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Zp(t),this.hls.trigger(C.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];l&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){const r=this.getLevelsForPathway(s).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===it.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===it.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return s}clonePathways(e){const t=this.levels;if(!t)return;const s={},r={};e.forEach(n=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(d=>d.pathwayId===a))return;const u=this.getLevelsForPathway(o).map(d=>{const f=new St(d.attrs);f["PATHWAY-ID"]=a;const g=f.AUDIO&&`${f.AUDIO}_clone_${a}`,v=f.SUBTITLES&&`${f.SUBTITLES}_clone_${a}`;g&&(s[f.AUDIO]=g,f.AUDIO=g),v&&(r[f.SUBTITLES]=v,f.SUBTITLES=v);const y=Fg(d.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),E=new $r({attrs:f,audioCodec:d.audioCodec,bitrate:d.bitrate,height:d.height,name:d.name,url:y,videoCodec:d.videoCodec,width:d.width});if(d.audioGroups)for(let b=1;b<d.audioGroups.length;b++)E.addGroupId("audio",`${d.audioGroups[b]}_clone_${a}`);if(d.subtitleGroups)for(let b=1;b<d.subtitleGroups.length;b++)E.addGroupId("text",`${d.subtitleGroups[b]}_clone_${a}`);return E});t.push(...u),Fd(this.audioTracks,s,l,a),Fd(this.subtitleTracks,r,l,a)})}loadSteeringManifest(e){const t=this.hls.config,s=t.loader;this.loader&&this.loader.destroy(),this.loader=new s(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const d=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+d)}const n={responseType:"json",url:r.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(d,f,g,v)=>{this.log(`Loaded steering manifest: "${r}"`);const y=d.data;if(y.VERSION!==1){this.log(`Steering VERSION ${y.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=y.TTL;const{"RELOAD-URI":E,"PATHWAY-CLONES":b,"PATHWAY-PRIORITY":w}=y;if(E)try{this.uri=new self.URL(E,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${E}`);return}this.scheduleRefresh(this.uri||g.url),b&&this.clonePathways(b);const F={steeringManifest:y,url:r.toString()};this.hls.trigger(C.STEERING_MANIFEST_LOADED,F),w&&this.updatePathwayPriority(w)},onError:(d,f,g,v)=>{if(this.log(`Error loading steering manifest: ${d.code} ${d.text} (${f.url})`),this.stopLoad(),d.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let y=this.timeToLoad*1e3;if(d.code===429){const E=this.loader;if(typeof(E==null?void 0:E.getResponseHeader)=="function"){const b=E.getResponseHeader("Retry-After");b&&(y=parseFloat(b)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,y)},onTimeout:(d,f,g)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,l,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const r=(s=this.hls)==null?void 0:s.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Fd(i,e,t,s){i&&Object.keys(e).forEach(r=>{const n=i.filter(a=>a.groupId===r).map(a=>{const o=Ct({},a);return o.details=void 0,o.attrs=new St(o.attrs),o.url=o.attrs.URI=Fg(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[r],o.attrs["PATHWAY-ID"]=s,o});i.push(...n)})}function Fg(i,e,t,s){const{HOST:r,PARAMS:n,[t]:a}=s;let o;e&&(o=a==null?void 0:a[e],o&&(i=o));const l=new self.URL(i);return r&&!o&&(l.host=r),n&&Object.keys(n).sort().forEach(u=>{u&&l.searchParams.set(u,n[u])}),l.href}const NL=/^age:\s*[\d.]+\s*$/im;class Og{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 io,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){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=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!this.stats.aborted)return n(s,t.url)}).catch(a=>(s.open("GET",t.url,!0),n(s,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(a=>{this.callbacks.onError({code:s.status,text:a.message},t,s,r)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=s.loadPolicy;if(r)for(const o in r)e.setRequestHeader(o,r[o]);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),s.timeout=n&&_e(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!s.aborted&&r>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.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-(s.loading.first-s.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const a=t.status,o=t.responseType!=="text";if(a>=200&&a<300&&(o&&t.response||t.responseText!==null)){s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=o?t.response:t.responseText,u=t.responseType==="arraybuffer"?l.byteLength:l.length;if(s.loaded=s.total=u,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first),!this.callbacks)return;const d=this.callbacks.onProgress;if(d&&d(s,e,l,t),!this.callbacks)return;const f={url:t.responseURL,data:l,code:a};this.callbacks.onSuccess(f,s,e,t)}else{const l=n.loadPolicy.errorRetry,u=s.retry,d={url:e.url,data:void 0,code:a};Ka(l,u,!1,d)?this.retry(l):(ie.error(`${a} while loading ${e.url}`),this.callbacks.onError({code:a,text:t.statusText},e,t,s))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,s=this.stats.retry;if(Ka(t,s,!0))this.retry(t);else{var r;ie.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=Ec(e,s.retry),s.retry++,ie.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${s.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&&NL.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}}function BL(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const $L=/(\d+)-(\d+)\/(\d+)/;class Od{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||HL,this.controller=new self.AbortController,this.stats=new io}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(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=UL(e,this.controller.signal),a=s.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:u,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=u&&_e(u)?u:d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(f=>{this.response=this.loader=f;const g=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(r,e,this.response)},d-(g-r.loading.start)),!f.ok){const{status:v,statusText:y}=f;throw new jL(y||"fetch, bad network response",v,f)}return r.loading.first=g,r.total=VL(f.headers)||r.total,a&&_e(t.highWaterMark)?this.loadProgressively(f,r,e,t.highWaterMark,a):o?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{const g=this.response;if(!g)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const v=f[l];v&&(r.loaded=r.total=v);const y={url:g.url,data:f,code:g.status};a&&!_e(t.highWaterMark)&&a(r,e,f,g),s.onSuccess(y,r,e,g)}).catch(f=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const g=f&&f.code||0,v=f?f.message:null;s.onError({code:g,text:v},e,f?f.details:null,r)})}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,s,r=0,n){const a=new ig,o=e.body.getReader(),l=()=>o.read().then(u=>{if(u.done)return a.dataLength&&n(t,s,a.flush(),e),Promise.resolve(new ArrayBuffer(0));const d=u.value,f=d.length;return t.loaded+=f,f<r||a.dataLength?(a.push(d),a.dataLength>=r&&n(t,s,a.flush(),e)):n(t,s,d,e),l()}).catch(()=>Promise.reject());return l()}}function UL(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ct({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function GL(i){const e=$L.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function VL(i){const e=i.get("Content-Range");if(e){const s=GL(e);if(_e(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function HL(i,e){return new self.Request(i.url,e)}class jL extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const KL=/\s/,zL={newCue(i,e,t,s){const r=[];let n,a,o,l,u;const d=self.VTTCue||self.TextTrackCue;for(let g=0;g<s.rows.length;g++)if(n=s.rows[g],o=!0,l=0,u="",!n.isEmpty()){var f;for(let E=0;E<n.chars.length;E++)KL.test(n.chars[E].uchar)&&o?l++:(u+=n.chars[E].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const v=Ag(u.trim()),y=Pc(e,t,v);i!=null&&(f=i.cues)!=null&&f.getCueById(y)||(a=new d(e,t,v),a.id=y,a.line=g+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),r.push(a))}return i&&r.length&&(r.sort((g,v)=>g.line==="auto"||v.line==="auto"?0:g.line>8&&v.line>8?v.line-g.line:g.line-v.line),r.forEach(g=>Yp(i,g))),r}},WL={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Ng=Nt(Nt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,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,loader:Og,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Tw,bufferController:CA,capLevelController:Dc,errorController:hw,fpsController:JA,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:Fp,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:WL},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}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},qL()),{},{subtitleStreamController:TA,subtitleTrackController:AA,timelineController:XA,audioStreamController:EA,audioTrackController:bA,emeController:Or,cmcdController:ML,contentSteeringController:OL});function qL(){return{cueHandler:zL,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function YL(i,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Bl(i),s=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(n=>{const a=`${n==="level"?"playlist":n}LoadPolicy`,o=e[a]===void 0,l=[];r.forEach(u=>{const d=`${n}Loading${u}`,f=e[d];if(f!==void 0&&o){l.push(d);const g=t[a].default;switch(e[a]={default:g},u){case"TimeOut":g.maxLoadTimeMs=f,g.maxTimeToFirstByteMs=f;break;case"MaxRetry":g.errorRetry.maxNumRetry=f,g.timeoutRetry.maxNumRetry=f;break;case"RetryDelay":g.errorRetry.retryDelayMs=f,g.timeoutRetry.retryDelayMs=f;break;case"MaxRetryTimeout":g.errorRetry.maxRetryDelayMs=f,g.timeoutRetry.maxRetryDelayMs=f;break}}}),l.length&&ie.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(e[a])}`)}),Nt(Nt({},t),e)}function Bl(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(Bl):Object.keys(i).reduce((e,t)=>(e[t]=Bl(i[t]),e),{}):i}function XL(i){const e=i.loader;e!==Od&&e!==Og?(ie.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):BL()&&(i.loader=Od,i.progressive=!0,i.enableSoftwareAES=!0,ie.log("[config]: Progressive streaming enabled, using FetchLoader"))}let ll;class QL extends bc{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(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.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 s=this.hls.config.preferManagedMediaSource,r=[],n={},a={};let o=!1,l=!1,u=!1;t.levels.forEach(d=>{var f,g;const v=d.attrs;let{audioCodec:y,videoCodec:E}=d;((f=y)==null?void 0:f.indexOf("mp4a.40.34"))!==-1&&(ll||(ll=/chrome|firefox/i.test(navigator.userAgent)),ll&&(d.audioCodec=y=void 0)),y&&(d.audioCodec=y=Va(y,s)),((g=E)==null?void 0:g.indexOf("avc1"))===0&&(E=d.videoCodec=GT(E));const{width:b,height:w,unknownCodecs:F}=d;if(o||(o=!!(b&&w)),l||(l=!!E),u||(u=!!y),F!=null&&F.length||y&&!Wo(y,"audio",s)||E&&!Wo(E,"video",s))return;const{CODECS:k,"FRAME-RATE":U,"HDCP-LEVEL":N,"PATHWAY-ID":te,RESOLUTION:j,"VIDEO-RANGE":re}=v,le=`${`${te||"."}-`}${d.bitrate}-${j}-${U}-${k}-${re}-${N}`;if(n[le])if(n[le].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const se=a[le]+=1;d.attrs["PATHWAY-ID"]=new Array(se+1).join(".");const pe=new $r(d);n[le]=pe,r.push(pe)}else n[le].addGroupId("audio",v.AUDIO),n[le].addGroupId("text",v.SUBTITLES);else{const se=new $r(d);n[le]=se,a[le]=1,r.push(se)}}),this.filterAndSortMediaOptions(r,t,o,l,u)}filterAndSortMediaOptions(e,t,s,r,n){let a=[],o=[],l=e;if((s||r)&&n&&(l=l.filter(({videoCodec:y,videoRange:E,width:b,height:w})=>(!!y||!!(b&&w))&&ew(E))),l.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const y=new Error("no level with compatible codecs found in manifest");this.hls.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:y,reason:y.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:y}=this.hls.config;a=t.audioTracks.filter(E=>!E.audioCodec||Wo(E.audioCodec,"audio",y)),Nd(a)}t.subtitles&&(o=t.subtitles,Nd(o));const u=l.slice(0);l.sort((y,E)=>{if(y.attrs["HDCP-LEVEL"]!==E.attrs["HDCP-LEVEL"])return(y.attrs["HDCP-LEVEL"]||"")>(E.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&y.height!==E.height)return y.height-E.height;if(y.frameRate!==E.frameRate)return y.frameRate-E.frameRate;if(y.videoRange!==E.videoRange)return Ha.indexOf(y.videoRange)-Ha.indexOf(E.videoRange);if(y.videoCodec!==E.videoCodec){const b=Gh(y.videoCodec),w=Gh(E.videoCodec);if(b!==w)return w-b}if(y.uri===E.uri&&y.codecSet!==E.codecSet){const b=Ga(y.codecSet),w=Ga(E.codecSet);if(b!==w)return w-b}return y.averageBitrate!==E.averageBitrate?y.averageBitrate-E.averageBitrate:0});let d=u[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==u.length)){for(let y=0;y<u.length;y++)if(u[y].pathwayId===l[0].pathwayId){d=u[y];break}}this._levels=l;for(let y=0;y<l.length;y++)if(l[y]===d){var f;this._firstLevel=y;const E=d.bitrate,b=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${E}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const w=Math.min(E,this.hls.config.abrEwmaDefaultEstimateMax);w>b&&b===Ng.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=w)}break}const g=n&&!r,v={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:!g&&a.some(y=>!!y.url)};this.hls.trigger(C.MANIFEST_PARSED,v),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const d=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(C.ERROR,{type:je.OTHER_ERROR,details:ce.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:d,reason:d.message}),f)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,s===e&&a.details&&r&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${s}${n?" with Pathway "+n:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(C.LEVEL_SWITCHING,l);const u=a.details;if(!u||u.live){const d=this.switchParams(a.uri,r==null?void 0:r.details,u);this.loadPlaylist(d)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===it.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===He.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(n=>!!s[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var s;const{level:r,details:n}=t,a=this._levels[r];if(!a){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(r,t,a.details)):(s=t.deliveryDirectives)!=null&&s.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,s=this.currentLevel;if(s&&this.shouldLoadPlaylist(s)){let r=s.uri;if(e)try{r=e.addDirectives(r)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}const n=s.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${r}`),this.clearTimer(),this.hls.trigger(C.LEVEL_LOADING,{url:r,level:t,pathwayId:s.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const s=this._levels.filter((r,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(a=>a.level=-1)),!1));Zp(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(C.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(C.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Nd(i){const e={};i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}class JL{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[s].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=ce.KEY_LOAD_ERROR,s,r,n){return new gi({type:je.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:s,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:s,cc:r}=e;for(let n=0;n<t.length;n++){const a=t[n];if(r<=a.cc&&(s==="initSegment"||a.sn==="initSegment"||s<a.sn)){this.emeController.selectKeySystemFormat(a).then(o=>{a.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const u=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,ce.KEY_LOAD_ERROR,u))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,ce.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((s=o)!=null&&s.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((r=o)!=null&&r.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(u=>(n.key=u.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[a]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,ce.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(s);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,s))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,r=s.loader,n=new r(s);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=s.keyLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(g,v,y,E)=>{const{frag:b,keyInfo:w,url:F}=y;if(!b.decryptdata||w!==this.keyUriToKeyInfo[F])return o(this.createKeyLoadError(b,ce.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),E));w.decryptdata.key=b.decryptdata.key=new Uint8Array(g.data),b.keyLoader=null,w.loader=null,a({frag:b,keyInfo:w})},onError:(g,v,y,E)=>{this.resetLoader(v),o(this.createKeyLoadError(t,ce.KEY_LOAD_ERROR,new Error(`HTTP Error ${g.code} loading key ${g.text}`),y,Nt({url:l.url,data:void 0},g)))},onTimeout:(g,v,y)=>{this.resetLoader(v),o(this.createKeyLoadError(t,ce.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),y))},onAbort:(g,v,y)=>{this.resetLoader(v),o(this.createKeyLoadError(t,ce.INTERNAL_ABORTED,new Error("key loading aborted"),y))}};n.load(l,d,f)})}resetLoader(e){const{frag:t,keyInfo:s,url:r}=e,n=s.loader;t.keyLoader===n&&(t.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function Bg(){return self.SourceBuffer||self.WebKitSourceBuffer}function $g(){if(!ar())return!1;const e=Bg();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function ZL(){if(!$g())return!1;const i=ar();return typeof(i==null?void 0:i.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Pn(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Pn(e,"audio"))))}function eC(){var i;const e=Bg();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const tC=250,Ca=2,sC=.1,iC=.05;class rC{constructor(e,t,s,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=s,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:s,media:r,stalled:n}=this;if(r===null)return;const{currentTime:a,seeking:o}=r,l=this.seeking&&!o,u=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),n!==null){if(this.stallReported){const b=self.performance.now()-n;ie.warn(`playback not stuck anymore @${a}, after ${Math.round(b)}ms`),this.stallReported=!1}this.stalled=null}return}if(u||l){this.stalled=null;return}if(r.paused&&!o||r.ended||r.playbackRate===0||!vt.getBuffered(r).length){this.nudgeRetry=0;return}const d=vt.bufferInfo(r,a,0),f=d.nextStart||0;if(o){const b=d.len>Ca,w=!f||t&&t.start<=a||f-a>Ca&&!this.fragmentTracker.getPartialFragment(a);if(b||w)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g;if(!(d.len>0)&&!f)return;const w=Math.max(f,d.start||0)-a,F=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,U=(F==null||(g=F.details)==null?void 0:g.live)?F.details.targetduration*2:Ca,N=this.fragmentTracker.getPartialFragment(a);if(w>0&&(w<=U||N)){r.paused||this._trySkipBufferHole(N);return}}const v=self.performance.now();if(n===null){this.stalled=v;return}const y=v-n;if(!o&&y>=tC&&(this._reportStall(d),!this.media))return;const E=vt.bufferInfo(r,a,s.maxBufferHole);this._tryFixBufferStall(E,y)}_tryFixBufferStall(e,t){const{config:s,fragmentTracker:r,media:n}=this;if(n===null)return;const a=n.currentTime,o=r.getPartialFragment(a);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>s.maxBufferHole||e.nextStart&&e.nextStart-a<s.maxBufferHole)&&t>s.highBufferWatchdogPeriod*1e3&&(ie.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:s,stallReported:r}=this;if(!r&&s){this.stallReported=!0;const n=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${JSON.stringify(e)})`);ie.warn(n.message),t.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:s,media:r}=this;if(r===null)return 0;const n=r.currentTime,a=vt.bufferInfo(r,n,0),o=n<a.start?a.start:a.nextStart;if(o){const l=a.len<=t.maxBufferHole,u=a.len>0&&a.len<1&&r.readyState<3,d=o-n;if(d>0&&(l||u)){if(d>t.maxBufferHole){const{fragmentTracker:g}=this;let v=!1;if(n===0){const y=g.getAppendedFrag(0,He.MAIN);y&&o<y.end&&(v=!0)}if(!v){const y=e||g.getAppendedFrag(n,He.MAIN);if(y){let E=!1,b=y.end;for(;b<o;){const w=g.getPartialFragment(b);if(w)b+=w.duration;else{E=!0;break}}if(E)return 0}}}const f=Math.max(o+iC,n+sC);if(ie.warn(`skipping hole, adjusting currentTime from ${n} to ${f}`),this.moved=!0,this.stalled=null,r.currentTime=f,e&&!e.gap){const g=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${f}`);s.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:g,reason:g.message,frag:e})}return f}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:s,nudgeRetry:r}=this;if(s===null)return;const n=s.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const a=n+(r+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);ie.warn(o.message),s.currentTime=a,t.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{const a=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);ie.error(a.message),t.trigger(C.ERROR,{type:je.MEDIA_ERROR,details:ce.BUFFER_STALLED_ERROR,error:a,fatal:!0})}}}const nC=100;class aC extends Ac{constructor(e,t,s){super(e,t,s,"[stream-controller]",He.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(C.ERROR,this.onError,this),e.on(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(C.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(C.BUFFER_CREATED,this.onBufferCreated,this),e.on(C.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(C.ERROR,this.onError,this),e.off(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(C.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(C.BUFFER_CREATED,this.onBufferCreated,this),e.off(C.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:s}=this;if(this.stopLoad(),this.setInterval(nC),this.level=-1,!this.startFragRequested){let r=s.startLevel;r===-1&&(s.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=s.firstAutoLevel),s.nextLoadLevel=r,this.level=s.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=ve.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=ve.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case ve.WAITING_LEVEL:{const{levels:t,level:s}=this,r=t==null?void 0:t[s],n=r==null?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=ve.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=ve.IDLE;break}break}case ve.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),s=this.retryDate;if(!s||t>=s||(e=this.media)!=null&&e.seeking){const{levels:r,level:n}=this,a=r==null?void 0:r[n];this.resetStartWhenNotLoaded(a||null),this.state=ve.IDLE}}break}this.state===ve.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(s!=null&&s[n]))return;const a=s[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const E={};this.altAudio&&(E.type="video"),this.hls.trigger(C.BUFFER_EOS,E),this.state=ve.ENDED;return}e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const u=a.details;if(!u||this.state===ve.WAITING_LEVEL||u.live&&this.levelLastLoaded!==a){this.level=n,this.state=ve.WAITING_LEVEL;return}const d=o.len,f=this.getMaxBufferLength(a.maxBitrate);if(d>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const g=this.backtrackFragment?this.backtrackFragment.start:o.end;let v=this.getNextFragment(g,u);if(this.couldBacktrack&&!this.fragPrevious&&v&&v.sn!=="initSegment"&&this.fragmentTracker.getState(v)!==Ot.OK){var y;const b=((y=this.backtrackFragment)!=null?y:v).sn-u.startSN,w=u.fragments[b-1];w&&v.cc===w.cc&&(v=w,this.fragmentTracker.removeFragment(w))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(v&&this.isLoopLoading(v,g)){if(!v.gap){const b=this.audioOnly&&!this.altAudio?ht.AUDIO:ht.VIDEO,w=(b===ht.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;w&&this.afterBufferFlushed(w,b,He.MAIN)}v=this.getNextFragmentLoopLoading(v,u,o,He.MAIN,f)}v&&(v.initSegment&&!v.initSegment.data&&!this.bitrateTest&&(v=v.initSegment),this.loadFragment(v,a,g))}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===Ot.NOT_LOADED||r===Ot.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):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)):(this.startFragRequested=!0,super.loadFragment(e,t,s)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,He.MAIN)}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(t!=null&&t.readyState){let s;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<n.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,l=e[o],u=this.fragLastKbps;u&&this.fragCurrent?s=this.fragCurrent.duration*l.maxBitrate/(1e3*u)+1:s=0}else s=0;const a=this.getBufferedFrag(t.currentTime+s);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const l=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,d=Math.max(a.end,l+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,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 ve.KEY_LOADING:case ve.FRAG_LOADING:case ve.FRAG_LOADING_WAITING_RETRY:case ve.PARSING:case ve.PARSED:this.state=ve.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const s=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),s.addEventListener("playing",this.onvplaying),s.addEventListener("seeked",this.onvseeked),this.gapController=new rC(this.config,s,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;_e(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const s=this.getMainFwdBufferInfo();if(s===null||s.len===0){this.warn(`Main forward buffer length on "seeked" event ${s?s.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(C.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let s=!1,r=!1;t.levels.forEach(n=>{const a=n.audioCodec;a&&(s=s||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=s&&r&&!eC(),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:s}=this;if(!s||this.state!==ve.IDLE)return;const r=s[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=ve.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:r}=this,n=t.level,a=t.details,o=a.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const l=r[n],u=this.fragCurrent;u&&(this.state===ve.FRAG_LOADING||this.state===ve.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let d=0;if(a.live||(s=l.details)!=null&&s.live){var f;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;d=this.alignPlaylists(a,l.details,(f=this.levelLastLoaded)==null?void 0:f.details)}if(l.details=a,this.levelLastLoaded=l,this.hls.trigger(C.LEVEL_UPDATED,{details:a,level:n}),this.state===ve.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=ve.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:r,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const o=a[s.level],l=o.details;if(!l){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const u=o.videoCodec,d=l.PTSKnown||!l.live,f=(t=s.initSegment)==null?void 0:t.data,g=this._getAudioCodec(o),v=this.transmuxer=this.transmuxer||new xg(this.hls,He.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),y=r?r.index:-1,E=y!==-1,b=new Tc(s.level,s.sn,s.stats.chunkCount,n.byteLength,y,E),w=this.initPTS[s.cc];v.push(n,f,g,u,s,r,l.totalduration,d,b,w)}onAudioTrackSwitching(e,t){const s=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;s&&(n.trigger(C.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(C.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=t.id,r=!!this.hls.audioTracks[s].url;if(r){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()}onBufferCreated(e,t){const s=t.tracks;let r,n,a=!1;for(const o in s){const l=s[o];if(l.id==="main"){if(n=o,r=l,o==="video"){const u=s[o];u&&(this.videoBuffer=u.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:r}=t;if(s&&s.type!==He.MAIN)return;if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===ve.PARSED&&(this.state=ve.IDLE);return}const n=r?r.stats:s.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),s.sn!=="initSegment"&&(this.fragPrevious=s),this.fragBufferedComplete(s,r)}onError(e,t){var s;if(t.fatal){this.state=ve.ERROR;return}switch(t.details){case ce.FRAG_GAP:case ce.FRAG_PARSING_ERROR:case ce.FRAG_DECRYPT_ERROR:case ce.FRAG_LOAD_ERROR:case ce.FRAG_LOAD_TIMEOUT:case ce.KEY_LOAD_ERROR:case ce.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(He.MAIN,t);break;case ce.LEVEL_LOAD_ERROR:case ce.LEVEL_LOAD_TIMEOUT:case ce.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ve.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===it.LEVEL&&(this.state=ve.IDLE);break;case ce.BUFFER_APPEND_ERROR:case ce.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===ce.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case ce.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!vt.getBuffered(e).length){const s=this.state!==ve.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,s)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=ve.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==ht.AUDIO||this.audioOnly&&!this.altAudio){const s=(t===ht.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(s,t,He.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t<s){if(e.seeking){this.log(`could not seek to ${s}, already seeking at ${t}`);return}const r=vt.getBuffered(e),a=(r.length?r.start(0):0)-s;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),s+=a,this.startPosition=s),this.log(`seek to target start position ${s} from current time ${t}`),e.currentTime=s}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(s=>{const{hls:r}=this;if(!s||this.fragContextChanged(e))return;t.fragmentError=0,this.state=ve.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(C.FRAG_LOADED,s),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const s="main",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:u,level:d}=o,{video:f,text:g,id3:v,initSegment:y}=n,{details:E}=d,b=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=ve.PARSING,y){if(y!=null&&y.tracks){const k=l.initSegment||l;this._bufferInitSegment(d,y.tracks,k,a),r.trigger(C.FRAG_PARSING_INIT_SEGMENT,{frag:k,id:s,tracks:y.tracks})}const w=y.initPTS,F=y.timescale;_e(w)&&(this.initPTS[l.cc]={baseTime:w,timescale:F},r.trigger(C.INIT_PTS_FOUND,{frag:l,id:s,initPTS:w,timescale:F}))}if(f&&E&&l.sn!=="initSegment"){const w=E.fragments[l.sn-1-E.startSN],F=l.sn===E.startSN,k=!w||l.cc>w.cc;if(n.independent!==!1){const{startPTS:U,endPTS:N,startDTS:te,endDTS:j}=f;if(u)u.elementaryStreams[f.type]={startPTS:U,endPTS:N,startDTS:te,endDTS:j};else if(f.firstKeyFrame&&f.independent&&a.id===1&&!k&&(this.couldBacktrack=!0),f.dropped&&f.independent){const re=this.getMainFwdBufferInfo(),Q=(re?re.end:this.getLoadPosition())+this.config.maxBufferHole,le=f.firstKeyFramePTS?f.firstKeyFramePTS:U;if(!F&&Q<le-this.config.maxBufferHole&&!k){this.backtrack(l);return}else k&&(l.gap=!0);l.setElementaryStreamInfo(f.type,l.start,N,l.start,j,!0)}else F&&U>Ca&&(l.gap=!0);l.setElementaryStreamInfo(f.type,U,N,te,j),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(f,l,u,a,F||k)}else if(F||k)l.gap=!0;else{this.backtrack(l);return}}if(b){const{startPTS:w,endPTS:F,startDTS:k,endDTS:U}=b;u&&(u.elementaryStreams[ht.AUDIO]={startPTS:w,endPTS:F,startDTS:k,endDTS:U}),l.setElementaryStreamInfo(ht.AUDIO,w,F,k,U),this.bufferFragmentData(b,l,u,a)}if(E&&v!=null&&(t=v.samples)!=null&&t.length){const w={id:s,frag:l,details:E,samples:v.samples};r.trigger(C.FRAG_PARSING_METADATA,w)}if(E&&g){const w={id:s,frag:l,details:E,samples:g.samples};r.trigger(C.FRAG_PARSING_USERDATA,w)}}_bufferInitSegment(e,t,s,r){if(this.state!==ve.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:a,audiovideo:o}=t;if(n){let l=e.audioCodec;const u=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),n.metadata.channelCount!==1&&u.indexOf("firefox")===-1&&(l="mp4a.40.5")),l&&l.indexOf("mp4a.40.5")!==-1&&u.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),n.levelCodec=l,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${n.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id="main",this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(C.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const d=t[l].initSegment;d!=null&&d.byteLength&&this.hls.trigger(C.BUFFER_APPENDING,{type:l,data:d,frag:s,part:null,chunkMeta:r,parent:s.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,He.MAIN)}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=ve.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(vt.isBuffered(e,s)?t=this.getAppendedFrag(s):vt.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(C.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(C.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,s=this.currentFrag;if(s&&_e(t)&&_e(s.programDateTime)){const r=s.programDateTime+(t-s.start)*1e3;return new Date(r)}}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 Ps{static get version(){return"1.5.8"}static isMSESupported(){return $g()}static isSupported(){return ZL()}static getMediaSource(){return ar()}static get Events(){return C}static get ErrorTypes(){return je}static get ErrorDetails(){return ce}static get DefaultConfig(){return Ps.defaultConfig?Ps.defaultConfig:Ng}static set DefaultConfig(e){Ps.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Ic,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,Jb(e.debug||!1,"Hls instance");const t=this.config=YL(Ps.DefaultConfig,e);this.userConfig=e,t.progressive&&XL(t);const{abrController:s,bufferController:r,capLevelController:n,errorController:a,fpsController:o}=t,l=new a(this),u=this.abrController=new s(this),d=this.bufferController=new r(this),f=this.capLevelController=new n(this),g=new o(this),v=new zT(this),y=new QT(this),E=t.contentSteeringController,b=E?new E(this):null,w=this.levelController=new QL(this,b),F=new Aw(this),k=new JL(this.config),U=this.streamController=new aC(this,F,k);f.setStreamController(U),g.setStreamController(U);const N=[v,w,U];b&&N.splice(1,0,b),this.networkControllers=N;const te=[u,d,f,g,y,F];this.audioTrackController=this.createController(t.audioTrackController,N);const j=t.audioStreamController;j&&N.push(new j(this,F,k)),this.subtitleTrackController=this.createController(t.subtitleTrackController,N);const re=t.subtitleStreamController;re&&N.push(new re(this,F,k)),this.createController(t.timelineController,te),k.emeController=this.emeController=this.createController(t.emeController,te),this.cmcdController=this.createController(t.cmcdController,te),this.latencyController=this.createController(JT,te),this.coreComponents=te,N.push(l);const Q=l.onErrorOut;typeof Q=="function"&&this.on(C.ERROR,Q,l)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,r){this._emitter.off(e,t,s,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(ie.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const r=e===C.ERROR;this.trigger(C.ERROR,{type:je.OTHER_ERROR,details:ce.INTERNAL_EXCEPTION,fatal:r,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){ie.log("destroy"),this.trigger(C.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){ie.log("attachMedia"),this._media=e,this.trigger(C.MEDIA_ATTACHING,{media:e})}detachMedia(){ie.log("detachMedia"),this.trigger(C.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,s=this.url,r=this.url=vc.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,ie.log(`loadSource:${r}`),t&&s&&(s!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(C.MANIFEST_LOADING,{url:e})}startLoad(e=-1){ie.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){ie.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){ie.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){ie.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){ie.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){ie.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){ie.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){ie.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){ie.log(`set startLevel:${e}`),e!==-1&&(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 ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(ie.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){ZT(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let r=0;r<s;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,s)for(let n=r;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=s)return n}return r}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()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||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:!1}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}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}Ps.defaultConfig=void 0;function oC({src:i,quality:e,initialTime:t,timeOffsetStart:s,timeOffsetEnd:r,timeUpdateEvent:n=!1,debug:a,onSync:o,onInit:l,onDestroy:u}){const[d,f]=fe.useState(),[g,v]=fe.useState(!1),[y,E]=fe.useState(1),[b,w]=fe.useState(!1),[F,k]=fe.useState(!1),[U,N]=fe.useState(),[te,j]=fe.useState({originDurationTime:0,originCurrentTime:0,progress:0,currentTime:0,durationTime:0}),re=fe.useRef(null),Q=fe.useRef();E1({element:re.current,eventName:"timeupdate",handler:n&&b?()=>{if(!re.current)return;const ue=re.current,he=ue.currentTime,we=ue.duration===1/0&&ue.buffered.length>0?ue.buffered.end(0):ue.duration,me=he-(s??0),ye=(r??we)-(s??0);j({originCurrentTime:he,originDurationTime:we,currentTime:me,durationTime:ye,progress:me/ye*100})}:void 0});const le=()=>{if(!re.current)return;const ue=re.current;ue.paused?ue.play().catch(()=>{N(!0)}):ue.pause()},se=()=>{if(!re.current)return;const ue=re.current,he=ue.currentTime+10;typeof r=="number"&&r<he?ue.currentTime=r:ue.currentTime=he},pe=()=>{if(!re.current)return;const ue=re.current,he=ue.currentTime-10;typeof s=="number"&&s>he?ue.currentTime=s:ue.currentTime=he},de=()=>{if(!re.current)return;const ue=re.current;ue.playbackRate===2?ue.playbackRate=1:ue.playbackRate+=.5},be=ue=>{if(!re.current)return;const he=re.current;he.currentTime=(s??0)+ue},Le=fe.useCallback(ue=>{const he=re.current;he&&(w(!1),Ps.isSupported()?(d==null||d.stopLoad(),d==null||d.loadSource(ue)):he.canPlayType("application/vnd.apple.mpegurl")&&(he.src=ue))},[d]);return fe.useEffect(()=>{Q.current=o},[o]),fe.useEffect(()=>{if(!re.current||!i)return;const ue=re.current;let he;if(Ps.isSupported()){const Xe={debug:!1,enableWorker:!0,lowLatencyMode:!0,backBufferLength:90,highBufferWatchdogPeriod:1,maxMaxBufferLength:8};he=new Ps(Xe),he.attachMedia(ue),he.loadSource(i),f(he)}else ue.canPlayType("application/vnd.apple.mpegurl")&&(ue.src=i);const we=()=>{var Rt,ps,Be,as;const Xe=ue.duration,dt=((Be=(ps=(Rt=he==null?void 0:he.levels)==null?void 0:Rt[0])==null?void 0:ps.details)==null?void 0:Be.live)||Xe===1/0;v(dt),(as=Q.current)==null||as.call(Q,!0),Xe!==1/0&&j(os=>({...os,durationTime:Math.floor(Xe)})),t&&(ue.currentTime=t),s&&!dt&&(ue.currentTime=s),ue.play().catch(()=>{N(!0)})},me=()=>{k(!1)},ye=()=>{typeof r=="number"&&ue.currentTime>=r&&typeof s=="number"&&(ue.currentTime=s),k(!0),N(!1)},Ve=()=>{ue.pause()},$e=()=>{w(!0)},Je=()=>{E(ue.playbackRate)},st=({detail:Xe})=>{he&&(he.currentLevel=Xe.quality)},rt=()=>{var Rt,ps,Be,as,os,cr,Ds,Gi,Vi,ls,ur,Ms;const Xe=ue.currentTime,dt=ue.duration;if((ps=(Rt=he==null?void 0:he.levels[he.currentLevel])==null?void 0:Rt.details)!=null&&ps.live)(Be=Q==null?void 0:Q.current)==null||Be.call(Q,dt-Xe<10);else if(dt===1/0&&ue.buffered.length>0){const Fs=ue.buffered.end(0);(as=Q==null?void 0:Q.current)==null||as.call(Q,Fs-Xe<10)}if(typeof r=="number"&&Xe>=r&&(ue.currentTime=r,ue.pause()),a){const Fs=ue.buffered.length>0?ue.buffered.end(0):0,Os=((cr=(os=he==null?void 0:he.levels[he.currentLevel])==null?void 0:os.details)==null?void 0:cr.live)||dt===1/0,Me={isSupported:Ps.isSupported(),version:Ps.version,live:Os,currentLevel:((Ds=he==null?void 0:he.levels[he.currentLevel])==null?void 0:Ds.width)||"auto",firstLevel:((Gi=he==null?void 0:he.levels[he.firstLevel])==null?void 0:Gi.width)||"auto",latency:(Vi=he==null?void 0:he.latency)==null?void 0:Vi.toFixed(2),targetLatency:he==null?void 0:he.targetLatency,currentTime:Xe,durationTime:dt,bufferedEnd:Fs,sync:Os?(ur=(ls=he==null?void 0:he.levels[he.currentLevel])==null?void 0:ls.details)!=null&&ur.live?Fs-Xe<5:dt-Xe<5:"not live"};(Ms=window==null?void 0:window.__brix_console)==null||Ms.call(window,"hls",Me)}},Ze=Xe=>{console.log(Xe)};return document.addEventListener("__BP_VIDEO_QUALITY",st),ue.addEventListener("progress",rt),ue.addEventListener("loadedmetadata",we),ue.addEventListener("pause",me),ue.addEventListener("play",ye),ue.addEventListener("ratechange",Je),ue.addEventListener("canplay",$e),ue.addEventListener("ended",Ve),ue.addEventListener("error",Ze),l==null||l(ue,he),()=>{document.removeEventListener("__BP_VIDEO_QUALITY",st),ue.removeEventListener("progress",rt),ue.removeEventListener("loadedmetadata",we),ue.removeEventListener("pause",me),ue.removeEventListener("play",ye),ue.removeEventListener("ratechange",Je),ue.removeEventListener("canplay",$e),ue.removeEventListener("ended",Ve),ue.removeEventListener("error",Ze),he==null||he.stopLoad(),he==null||he.destroy(),u==null||u()}},[i,a,s,t,r,l,u]),fe.useEffect(()=>{!b||typeof e>"u"||document.dispatchEvent(new CustomEvent("__BP_VIDEO_QUALITY",{detail:{quality:e}}))},[b,e]),{ref:re,play:F,live:g,error:U,time:te,hls:d,playbackRate:y,canPlay:b,handlePlayToggle:le,handleBackward:pe,handleForward:se,handlePlaybackRate:de,handleSeektime:be,handleChangeSource:Le}}const lC="_root_yg3vm_2",cC="_progress_wrap_yg3vm_14",uC="_rail_yg3vm_22",hC="_progress_yg3vm_14",dC="_handle_yg3vm_38",dn={root:lC,progress_wrap:cC,rail:uC,progress:hC,handle:dC};function Ug({handle:i,progress:e,className:t,onChangeProgress:s}){const r=fe.useRef(null),[n,a]=fe.useState(!1),o=fe.useCallback((v,y)=>{if(!r.current)return;const E=r.current.parentElement,b=(y-E.getBoundingClientRect().left)/E.offsetWidth,w=Math.max(0,Math.min(100,b*100));r.current.style.width=`${w}%`,s==null||s(v,w)},[s]),l=v=>{o(v,v.clientX)},u=v=>{o(v,v.clientX),a(!0)},d=v=>{n&&o(v,v.clientX)},f=()=>{a(!1)},g=v=>{o(v,v.targetTouches[0].clientX)};return Ne.jsx("div",{className:`${dn.root} ${t||""}`,onMouseUp:f,onMouseLeave:f,children:Ne.jsxs("div",{className:dn.progress_wrap,onClick:l,onMouseDown:u,onMouseMove:d,onTouchMove:g,children:[Ne.jsx("div",{className:dn.rail}),Ne.jsx("div",{className:`${dn.progress} ${i?dn.handle:""}`,ref:r,style:{width:`${e}%`}})]})})}const fC="_root_nvyal_1",pC={root:fC};function Bd(i,e=!1){const t=Math.floor(+i/3600),s=Math.floor((+i-t*3600)/60),r=(+i-t*3600-s*60).toFixed(0),n=t.toString().padStart(2,"0"),a=s.toString().padStart(2,"0"),o=r.padStart(2,"0");return e||t>0?`${n}:${a}:${o}`:`${a}:${o}`}function gC(i){const e=i.split(":").map(Number);let t=0;if(e.length===3){const[s,r,n]=e;t=s*3600+r*60+n}else if(e.length===2){const[s,r]=e;t=s*60+r}else t=+i;return t}function $d(i,e){let t="",s="",r="";if(e){const[n,...a]=e.split("?");s=a.join("&"),r=n}for(const n in i)Object.prototype.hasOwnProperty.call(i,n)&&i[n]!==void 0&&(t+=`${n}=${encodeURIComponent(i[n])}&`);return t+=s?`&${s}`:"",t.length>0&&t.endsWith("&")&&(t=t.slice(0,-1)),r?`${r}?${t}`:t}function mC({currentTime:i=0,durationTime:e=0,className:t}){return Ne.jsxs("div",{className:`${pC.root} ${t||""}`,children:[Ne.jsx("div",{children:Bd(i)}),Ne.jsx("div",{children:Bd(e)})]})}var $l={exports:{}};(function(i,e){typeof navigator<"u"&&function(t,s){i.exports=s()}(Cm,function(){var t="http://www.w3.org/2000/svg",s="",r=!1,n=-999999,a=function(h){r=!!h},o=function(){return r},l=function(h){s=h},u=function(){return s};function d(c){return document.createElement(c)}function f(c,h){var p,m=c.length,S;for(p=0;p<m;p+=1){S=c[p].prototype;for(var x in S)Object.prototype.hasOwnProperty.call(S,x)&&(h.prototype[x]=S[x])}}function g(c){function h(){}return h.prototype=c,h}var v=function(){function c(h){this.audios=[],this.audioFactory=h,this._volume=1,this._isMuted=!1}return c.prototype={addAudio:function(p){this.audios.push(p)},pause:function(){var p,m=this.audios.length;for(p=0;p<m;p+=1)this.audios[p].pause()},resume:function(){var p,m=this.audios.length;for(p=0;p<m;p+=1)this.audios[p].resume()},setRate:function(p){var m,S=this.audios.length;for(m=0;m<S;m+=1)this.audios[m].setRate(p)},createAudio:function(p){return this.audioFactory?this.audioFactory(p):window.Howl?new window.Howl({src:[p]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(p){this.audioFactory=p},setVolume:function(p){this._volume=p,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var p,m=this.audios.length;for(p=0;p<m;p+=1)this.audios[p].volume(this._volume*(this._isMuted?0:1))}},function(){return new c}}(),y=function(){function c(p,m){var S=0,x=[],A;switch(p){case"int16":case"uint8c":A=1;break;default:A=1.1;break}for(S=0;S<m;S+=1)x.push(A);return x}function h(p,m){return p==="float32"?new Float32Array(m):p==="int16"?new Int16Array(m):p==="uint8c"?new Uint8ClampedArray(m):c(p,m)}return typeof Uint8ClampedArray=="function"&&typeof Float32Array=="function"?h:c}();function E(c){return Array.apply(null,{length:c})}var b=!0,w=null,F="",k=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),U=Math.pow,N=Math.sqrt,te=Math.floor,j=Math.min,re=150,Q=Math.PI/180,le=.5519;function se(c,h,p,m){this.type=c,this.currentTime=h,this.totalTime=p,this.direction=m<0?-1:1}function pe(c,h){this.type=c,this.direction=h<0?-1:1}function de(c,h,p,m){this.type=c,this.currentLoop=p,this.totalLoops=h,this.direction=m<0?-1:1}function be(c,h,p){this.type=c,this.firstFrame=h,this.totalFrames=p}function Le(c,h){this.type=c,this.target=h}function ue(c,h){this.type="renderFrameError",this.nativeError=c,this.currentTime=h}function he(c){this.type="configError",this.nativeError=c}var we=function(){var c=0;return function(){return c+=1,F+"__lottie_element_"+c}}();function me(c,h,p){var m,S,x,A,D,L,B,V;switch(A=Math.floor(c*6),D=c*6-A,L=p*(1-h),B=p*(1-D*h),V=p*(1-(1-D)*h),A%6){case 0:m=p,S=V,x=L;break;case 1:m=B,S=p,x=L;break;case 2:m=L,S=p,x=V;break;case 3:m=L,S=B,x=p;break;case 4:m=V,S=L,x=p;break;case 5:m=p,S=L,x=B;break}return[m,S,x]}function ye(c,h,p){var m=Math.max(c,h,p),S=Math.min(c,h,p),x=m-S,A,D=m===0?0:x/m,L=m/255;switch(m){case S:A=0;break;case c:A=h-p+x*(h<p?6:0),A/=6*x;break;case h:A=p-c+x*2,A/=6*x;break;case p:A=c-h+x*4,A/=6*x;break}return[A,D,L]}function Ve(c,h){var p=ye(c[0]*255,c[1]*255,c[2]*255);return p[1]+=h,p[1]>1?p[1]=1:p[1]<=0&&(p[1]=0),me(p[0],p[1],p[2])}function $e(c,h){var p=ye(c[0]*255,c[1]*255,c[2]*255);return p[2]+=h,p[2]>1?p[2]=1:p[2]<0&&(p[2]=0),me(p[0],p[1],p[2])}function Je(c,h){var p=ye(c[0]*255,c[1]*255,c[2]*255);return p[0]+=h/360,p[0]>1?p[0]-=1:p[0]<0&&(p[0]+=1),me(p[0],p[1],p[2])}(function(){var c=[],h,p;for(h=0;h<256;h+=1)p=h.toString(16),c[h]=p.length===1?"0"+p:p;return function(m,S,x){return m<0&&(m=0),S<0&&(S=0),x<0&&(x=0),"#"+c[m]+c[S]+c[x]}})();var st=function(h){b=!!h},rt=function(){return b},Ze=function(h){w=h},Xe=function(){return w},dt=function(h){re=h},Rt=function(){return re},ps=function(h){F=h};function Be(c){return document.createElementNS(t,c)}function as(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?as=function(p){return typeof p}:as=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},as(c)}var os=function(){var c=1,h=[],p,m,S={onmessage:function(){},postMessage:function(H){p({data:H})}},x={postMessage:function(H){S.onmessage({data:H})}};function A(I){if(window.Worker&&window.Blob&&o()){var H=new Blob(["var _workerSelf = self; self.onmessage = ",I.toString()],{type:"text/javascript"}),q=URL.createObjectURL(H);return new Worker(q)}return p=I,S}function D(){m||(m=A(function(H){function q(){function J(xe,M){var z,T,R=xe.length,ne,X,Re,Ue;for(T=0;T<R;T+=1)if(z=xe[T],"ks"in z&&!z.completed){if(z.completed=!0,z.hasMask){var ze=z.masksProperties;for(X=ze.length,ne=0;ne<X;ne+=1)if(ze[ne].pt.k.i)$(ze[ne].pt.k);else for(Ue=ze[ne].pt.k.length,Re=0;Re<Ue;Re+=1)ze[ne].pt.k[Re].s&&$(ze[ne].pt.k[Re].s[0]),ze[ne].pt.k[Re].e&&$(ze[ne].pt.k[Re].e[0])}z.ty===0?(z.layers=_(z.refId,M),J(z.layers,M)):z.ty===4?P(z.shapes):z.ty===5&&Ye(z)}}function G(xe,M){if(xe){var z=0,T=xe.length;for(z=0;z<T;z+=1)xe[z].t===1&&(xe[z].data.layers=_(xe[z].data.refId,M),J(xe[z].data.layers,M))}}function O(xe,M){for(var z=0,T=M.length;z<T;){if(M[z].id===xe)return M[z];z+=1}return null}function _(xe,M){var z=O(xe,M);return z?z.layers.__used?JSON.parse(JSON.stringify(z.layers)):(z.layers.__used=!0,z.layers):null}function P(xe){var M,z=xe.length,T,R;for(M=z-1;M>=0;M-=1)if(xe[M].ty==="sh")if(xe[M].ks.k.i)$(xe[M].ks.k);else for(R=xe[M].ks.k.length,T=0;T<R;T+=1)xe[M].ks.k[T].s&&$(xe[M].ks.k[T].s[0]),xe[M].ks.k[T].e&&$(xe[M].ks.k[T].e[0]);else xe[M].ty==="gr"&&P(xe[M].it)}function $(xe){var M,z=xe.i.length;for(M=0;M<z;M+=1)xe.i[M][0]+=xe.v[M][0],xe.i[M][1]+=xe.v[M][1],xe.o[M][0]+=xe.v[M][0],xe.o[M][1]+=xe.v[M][1]}function Y(xe,M){var z=M?M.split("."):[100,100,100];return xe[0]>z[0]?!0:z[0]>xe[0]?!1:xe[1]>z[1]?!0:z[1]>xe[1]?!1:xe[2]>z[2]?!0:z[2]>xe[2]?!1:null}var Z=function(){var xe=[4,4,14];function M(T){var R=T.t.d;T.t.d={k:[{s:R,t:0}]}}function z(T){var R,ne=T.length;for(R=0;R<ne;R+=1)T[R].ty===5&&M(T[R])}return function(T){if(Y(xe,T.v)&&(z(T.layers),T.assets)){var R,ne=T.assets.length;for(R=0;R<ne;R+=1)T.assets[R].layers&&z(T.assets[R].layers)}}}(),ae=function(){var xe=[4,7,99];return function(M){if(M.chars&&!Y(xe,M.v)){var z,T=M.chars.length;for(z=0;z<T;z+=1){var R=M.chars[z];R.data&&R.data.shapes&&(P(R.data.shapes),R.data.ip=0,R.data.op=99999,R.data.st=0,R.data.sr=1,R.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},M.chars[z].t||(R.data.shapes.push({ty:"no"}),R.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}}(),Se=function(){var xe=[5,7,15];function M(T){var R=T.t.p;typeof R.a=="number"&&(R.a={a:0,k:R.a}),typeof R.p=="number"&&(R.p={a:0,k:R.p}),typeof R.r=="number"&&(R.r={a:0,k:R.r})}function z(T){var R,ne=T.length;for(R=0;R<ne;R+=1)T[R].ty===5&&M(T[R])}return function(T){if(Y(xe,T.v)&&(z(T.layers),T.assets)){var R,ne=T.assets.length;for(R=0;R<ne;R+=1)T.assets[R].layers&&z(T.assets[R].layers)}}}(),Ke=function(){var xe=[4,1,9];function M(T){var R,ne=T.length,X,Re;for(R=0;R<ne;R+=1)if(T[R].ty==="gr")M(T[R].it);else if(T[R].ty==="fl"||T[R].ty==="st")if(T[R].c.k&&T[R].c.k[0].i)for(Re=T[R].c.k.length,X=0;X<Re;X+=1)T[R].c.k[X].s&&(T[R].c.k[X].s[0]/=255,T[R].c.k[X].s[1]/=255,T[R].c.k[X].s[2]/=255,T[R].c.k[X].s[3]/=255),T[R].c.k[X].e&&(T[R].c.k[X].e[0]/=255,T[R].c.k[X].e[1]/=255,T[R].c.k[X].e[2]/=255,T[R].c.k[X].e[3]/=255);else T[R].c.k[0]/=255,T[R].c.k[1]/=255,T[R].c.k[2]/=255,T[R].c.k[3]/=255}function z(T){var R,ne=T.length;for(R=0;R<ne;R+=1)T[R].ty===4&&M(T[R].shapes)}return function(T){if(Y(xe,T.v)&&(z(T.layers),T.assets)){var R,ne=T.assets.length;for(R=0;R<ne;R+=1)T.assets[R].layers&&z(T.assets[R].layers)}}}(),De=function(){var xe=[4,4,18];function M(T){var R,ne=T.length,X,Re;for(R=ne-1;R>=0;R-=1)if(T[R].ty==="sh")if(T[R].ks.k.i)T[R].ks.k.c=T[R].closed;else for(Re=T[R].ks.k.length,X=0;X<Re;X+=1)T[R].ks.k[X].s&&(T[R].ks.k[X].s[0].c=T[R].closed),T[R].ks.k[X].e&&(T[R].ks.k[X].e[0].c=T[R].closed);else T[R].ty==="gr"&&M(T[R].it)}function z(T){var R,ne,X=T.length,Re,Ue,ze,nt;for(ne=0;ne<X;ne+=1){if(R=T[ne],R.hasMask){var at=R.masksProperties;for(Ue=at.length,Re=0;Re<Ue;Re+=1)if(at[Re].pt.k.i)at[Re].pt.k.c=at[Re].cl;else for(nt=at[Re].pt.k.length,ze=0;ze<nt;ze+=1)at[Re].pt.k[ze].s&&(at[Re].pt.k[ze].s[0].c=at[Re].cl),at[Re].pt.k[ze].e&&(at[Re].pt.k[ze].e[0].c=at[Re].cl)}R.ty===4&&M(R.shapes)}}return function(T){if(Y(xe,T.v)&&(z(T.layers),T.assets)){var R,ne=T.assets.length;for(R=0;R<ne;R+=1)T.assets[R].layers&&z(T.assets[R].layers)}}}();function Te(xe){xe.__complete||(Ke(xe),Z(xe),ae(xe),Se(xe),De(xe),J(xe.layers,xe.assets),G(xe.chars,xe.assets),xe.__complete=!0)}function Ye(xe){xe.t.a.length===0&&"m"in xe.t.p}var ke={};return ke.completeData=Te,ke.checkColors=Ke,ke.checkChars=ae,ke.checkPathProperties=Se,ke.checkShapes=De,ke.completeLayers=J,ke}if(x.dataManager||(x.dataManager=q()),x.assetLoader||(x.assetLoader=function(){function J(O){var _=O.getResponseHeader("content-type");return _&&O.responseType==="json"&&_.indexOf("json")!==-1||O.response&&as(O.response)==="object"?O.response:O.response&&typeof O.response=="string"?JSON.parse(O.response):O.responseText?JSON.parse(O.responseText):null}function G(O,_,P,$){var Y,Z=new XMLHttpRequest;try{Z.responseType="json"}catch{}Z.onreadystatechange=function(){if(Z.readyState===4)if(Z.status===200)Y=J(Z),P(Y);else try{Y=J(Z),P(Y)}catch(ae){$&&$(ae)}};try{Z.open(["G","E","T"].join(""),O,!0)}catch{Z.open(["G","E","T"].join(""),_+"/"+O,!0)}Z.send()}return{load:G}}()),H.data.type==="loadAnimation")x.assetLoader.load(H.data.path,H.data.fullPath,function(J){x.dataManager.completeData(J),x.postMessage({id:H.data.id,payload:J,status:"success"})},function(){x.postMessage({id:H.data.id,status:"error"})});else if(H.data.type==="complete"){var K=H.data.animation;x.dataManager.completeData(K),x.postMessage({id:H.data.id,payload:K,status:"success"})}else H.data.type==="loadData"&&x.assetLoader.load(H.data.path,H.data.fullPath,function(J){x.postMessage({id:H.data.id,payload:J,status:"success"})},function(){x.postMessage({id:H.data.id,status:"error"})})}),m.onmessage=function(I){var H=I.data,q=H.id,K=h[q];h[q]=null,H.status==="success"?K.onComplete(H.payload):K.onError&&K.onError()})}function L(I,H){c+=1;var q="processId_"+c;return h[q]={onComplete:I,onError:H},q}function B(I,H,q){D();var K=L(H,q);m.postMessage({type:"loadAnimation",path:I,fullPath:window.location.origin+window.location.pathname,id:K})}function V(I,H,q){D();var K=L(H,q);m.postMessage({type:"loadData",path:I,fullPath:window.location.origin+window.location.pathname,id:K})}function ee(I,H,q){D();var K=L(H,q);m.postMessage({type:"complete",animation:I,id:K})}return{loadAnimation:B,loadData:V,completeAnimation:ee}}(),cr=function(){var c=function(){var G=d("canvas");G.width=1,G.height=1;var O=G.getContext("2d");return O.fillStyle="rgba(0,0,0,0)",O.fillRect(0,0,1,1),G}();function h(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function p(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function m(G,O,_){var P="";if(G.e)P=G.p;else if(O){var $=G.p;$.indexOf("images/")!==-1&&($=$.split("/")[1]),P=O+$}else P=_,P+=G.u?G.u:"",P+=G.p;return P}function S(G){var O=0,_=setInterval((function(){var P=G.getBBox();(P.width||O>500)&&(this._imageLoaded(),clearInterval(_)),O+=1}).bind(this),50)}function x(G){var O=m(G,this.assetsPath,this.path),_=Be("image");k?this.testImageLoaded(_):_.addEventListener("load",this._imageLoaded,!1),_.addEventListener("error",(function(){P.img=c,this._imageLoaded()}).bind(this),!1),_.setAttributeNS("http://www.w3.org/1999/xlink","href",O),this._elementHelper.append?this._elementHelper.append(_):this._elementHelper.appendChild(_);var P={img:_,assetData:G};return P}function A(G){var O=m(G,this.assetsPath,this.path),_=d("img");_.crossOrigin="anonymous",_.addEventListener("load",this._imageLoaded,!1),_.addEventListener("error",(function(){P.img=c,this._imageLoaded()}).bind(this),!1),_.src=O;var P={img:_,assetData:G};return P}function D(G){var O={assetData:G},_=m(G,this.assetsPath,this.path);return os.loadData(_,(function(P){O.img=P,this._footageLoaded()}).bind(this),(function(){O.img={},this._footageLoaded()}).bind(this)),O}function L(G,O){this.imagesLoadedCb=O;var _,P=G.length;for(_=0;_<P;_+=1)G[_].layers||(!G[_].t||G[_].t==="seq"?(this.totalImages+=1,this.images.push(this._createImageData(G[_]))):G[_].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(G[_]))))}function B(G){this.path=G||""}function V(G){this.assetsPath=G||""}function ee(G){for(var O=0,_=this.images.length;O<_;){if(this.images[O].assetData===G)return this.images[O].img;O+=1}return null}function I(){this.imagesLoadedCb=null,this.images.length=0}function H(){return this.totalImages===this.loadedAssets}function q(){return this.totalFootages===this.loadedFootagesCount}function K(G,O){G==="svg"?(this._elementHelper=O,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function J(){this._imageLoaded=h.bind(this),this._footageLoaded=p.bind(this),this.testImageLoaded=S.bind(this),this.createFootageData=D.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return J.prototype={loadAssets:L,setAssetsPath:V,setPath:B,loadedImages:H,loadedFootages:q,destroy:I,getAsset:ee,createImgData:A,createImageData:x,imageLoaded:h,footageLoaded:p,setCacheType:K},J}();function Ds(){}Ds.prototype={triggerEvent:function(h,p){if(this._cbs[h])for(var m=this._cbs[h],S=0;S<m.length;S+=1)m[S](p)},addEventListener:function(h,p){return this._cbs[h]||(this._cbs[h]=[]),this._cbs[h].push(p),(function(){this.removeEventListener(h,p)}).bind(this)},removeEventListener:function(h,p){if(!p)this._cbs[h]=null;else if(this._cbs[h]){for(var m=0,S=this._cbs[h].length;m<S;)this._cbs[h][m]===p&&(this._cbs[h].splice(m,1),m-=1,S-=1),m+=1;this._cbs[h].length||(this._cbs[h]=null)}}};var Gi=function(){function c(h){for(var p=h.split(`\r
|
|
78
|
+
`),m={},S,x=0,A=0;A<p.length;A+=1)S=p[A].split(":"),S.length===2&&(m[S[0]]=S[1].trim(),x+=1);if(x===0)throw new Error;return m}return function(h){for(var p=[],m=0;m<h.length;m+=1){var S=h[m],x={time:S.tm,duration:S.dr};try{x.payload=JSON.parse(h[m].cm)}catch{try{x.payload=c(h[m].cm)}catch{x.payload={name:h[m].cm}}}p.push(x)}return p}}(),Vi=function(){function c(h){this.compositions.push(h)}return function(){function h(p){for(var m=0,S=this.compositions.length;m<S;){if(this.compositions[m].data&&this.compositions[m].data.nm===p)return this.compositions[m].prepareFrame&&this.compositions[m].data.xt&&this.compositions[m].prepareFrame(this.currentFrame),this.compositions[m].compInterface;m+=1}return null}return h.compositions=[],h.currentFrame=0,h.registerComposition=c,h}}(),ls={},ur=function(h,p){ls[h]=p};function Ms(c){return ls[c]}function Fs(){if(ls.canvas)return"canvas";for(var c in ls)if(ls[c])return c;return""}function Os(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Os=function(p){return typeof p}:Os=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},Os(c)}var Me=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=we(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=rt(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=Vi(),this.imagePreloader=new cr,this.audioController=v(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new se("drawnFrame",0,0,0),this.expressionsPlugin=Xe()};f([Ds],Me),Me.prototype.setParams=function(c){(c.wrapper||c.container)&&(this.wrapper=c.wrapper||c.container);var h="svg";c.animType?h=c.animType:c.renderer&&(h=c.renderer);var p=Ms(h);this.renderer=new p(this,c.rendererSettings),this.imagePreloader.setCacheType(h,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=h,c.loop===""||c.loop===null||c.loop===void 0||c.loop===!0?this.loop=!0:c.loop===!1?this.loop=!1:this.loop=parseInt(c.loop,10),this.autoplay="autoplay"in c?c.autoplay:!0,this.name=c.name?c.name:"",this.autoloadSegments=Object.prototype.hasOwnProperty.call(c,"autoloadSegments")?c.autoloadSegments:!0,this.assetsPath=c.assetsPath,this.initialSegment=c.initialSegment,c.audioFactory&&this.audioController.setAudioFactory(c.audioFactory),c.animationData?this.setupAnimation(c.animationData):c.path&&(c.path.lastIndexOf("\\")!==-1?this.path=c.path.substr(0,c.path.lastIndexOf("\\")+1):this.path=c.path.substr(0,c.path.lastIndexOf("/")+1),this.fileName=c.path.substr(c.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),os.loadAnimation(c.path,this.configAnimation,this.onSetupError))},Me.prototype.onSetupError=function(){this.trigger("data_failed")},Me.prototype.setupAnimation=function(c){os.completeAnimation(c,this.configAnimation)},Me.prototype.setData=function(c,h){h&&Os(h)!=="object"&&(h=JSON.parse(h));var p={wrapper:c,animationData:h},m=c.attributes;p.path=m.getNamedItem("data-animation-path")?m.getNamedItem("data-animation-path").value:m.getNamedItem("data-bm-path")?m.getNamedItem("data-bm-path").value:m.getNamedItem("bm-path")?m.getNamedItem("bm-path").value:"",p.animType=m.getNamedItem("data-anim-type")?m.getNamedItem("data-anim-type").value:m.getNamedItem("data-bm-type")?m.getNamedItem("data-bm-type").value:m.getNamedItem("bm-type")?m.getNamedItem("bm-type").value:m.getNamedItem("data-bm-renderer")?m.getNamedItem("data-bm-renderer").value:m.getNamedItem("bm-renderer")?m.getNamedItem("bm-renderer").value:Fs()||"canvas";var S=m.getNamedItem("data-anim-loop")?m.getNamedItem("data-anim-loop").value:m.getNamedItem("data-bm-loop")?m.getNamedItem("data-bm-loop").value:m.getNamedItem("bm-loop")?m.getNamedItem("bm-loop").value:"";S==="false"?p.loop=!1:S==="true"?p.loop=!0:S!==""&&(p.loop=parseInt(S,10));var x=m.getNamedItem("data-anim-autoplay")?m.getNamedItem("data-anim-autoplay").value:m.getNamedItem("data-bm-autoplay")?m.getNamedItem("data-bm-autoplay").value:m.getNamedItem("bm-autoplay")?m.getNamedItem("bm-autoplay").value:!0;p.autoplay=x!=="false",p.name=m.getNamedItem("data-name")?m.getNamedItem("data-name").value:m.getNamedItem("data-bm-name")?m.getNamedItem("data-bm-name").value:m.getNamedItem("bm-name")?m.getNamedItem("bm-name").value:"";var A=m.getNamedItem("data-anim-prerender")?m.getNamedItem("data-anim-prerender").value:m.getNamedItem("data-bm-prerender")?m.getNamedItem("data-bm-prerender").value:m.getNamedItem("bm-prerender")?m.getNamedItem("bm-prerender").value:"";A==="false"&&(p.prerender=!1),p.path?this.setParams(p):this.trigger("destroy")},Me.prototype.includeLayers=function(c){c.op>this.animationData.op&&(this.animationData.op=c.op,this.totalFrames=Math.floor(c.op-this.animationData.ip));var h=this.animationData.layers,p,m=h.length,S=c.layers,x,A=S.length;for(x=0;x<A;x+=1)for(p=0;p<m;){if(h[p].id===S[x].id){h[p]=S[x];break}p+=1}if((c.chars||c.fonts)&&(this.renderer.globalData.fontManager.addChars(c.chars),this.renderer.globalData.fontManager.addFonts(c.fonts,this.renderer.globalData.defs)),c.assets)for(m=c.assets.length,p=0;p<m;p+=1)this.animationData.assets.push(c.assets[p]);this.animationData.__complete=!1,os.completeAnimation(this.animationData,this.onSegmentComplete)},Me.prototype.onSegmentComplete=function(c){this.animationData=c;var h=Xe();h&&h.initExpressions(this),this.loadNextSegment()},Me.prototype.loadNextSegment=function(){var c=this.animationData.segments;if(!c||c.length===0||!this.autoloadSegments){this.trigger("data_ready"),this.timeCompleted=this.totalFrames;return}var h=c.shift();this.timeCompleted=h.time*this.frameRate;var p=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,os.loadData(p,this.includeLayers.bind(this),(function(){this.trigger("data_failed")}).bind(this))},Me.prototype.loadSegments=function(){var c=this.animationData.segments;c||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},Me.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},Me.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},Me.prototype.configAnimation=function(c){if(this.renderer)try{this.animationData=c,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(c),c.assets||(c.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(c.assets),this.markers=Gi(c.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(h){this.triggerConfigError(h)}},Me.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},Me.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||this.renderer.rendererType!=="canvas")&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var c=Xe();c&&c.initExpressions(this),this.renderer.initItems(),setTimeout((function(){this.trigger("DOMLoaded")}).bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},Me.prototype.resize=function(c,h){var p=typeof c=="number"?c:void 0,m=typeof h=="number"?h:void 0;this.renderer.updateContainerSize(p,m)},Me.prototype.setSubframe=function(c){this.isSubframeEnabled=!!c},Me.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},Me.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(c){this.triggerRenderFrameError(c)}},Me.prototype.play=function(c){c&&this.name!==c||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},Me.prototype.pause=function(c){c&&this.name!==c||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},Me.prototype.togglePause=function(c){c&&this.name!==c||(this.isPaused===!0?this.play():this.pause())},Me.prototype.stop=function(c){c&&this.name!==c||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},Me.prototype.getMarkerData=function(c){for(var h,p=0;p<this.markers.length;p+=1)if(h=this.markers[p],h.payload&&h.payload.name===c)return h;return null},Me.prototype.goToAndStop=function(c,h,p){if(!(p&&this.name!==p)){var m=Number(c);if(isNaN(m)){var S=this.getMarkerData(c);S&&this.goToAndStop(S.time,!0)}else h?this.setCurrentRawFrameValue(c):this.setCurrentRawFrameValue(c*this.frameModifier);this.pause()}},Me.prototype.goToAndPlay=function(c,h,p){if(!(p&&this.name!==p)){var m=Number(c);if(isNaN(m)){var S=this.getMarkerData(c);S&&(S.duration?this.playSegments([S.time,S.time+S.duration],!0):this.goToAndStop(S.time,!0))}else this.goToAndStop(m,h,p);this.play()}},Me.prototype.advanceTime=function(c){if(!(this.isPaused===!0||this.isLoaded===!1)){var h=this.currentRawFrame+c*this.frameModifier,p=!1;h>=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(h>this.totalFrames?h%this.totalFrames:0)||(p=!0,h=this.totalFrames-1):h>=this.totalFrames?(this.playCount+=1,this.checkSegments(h%this.totalFrames)||(this.setCurrentRawFrameValue(h%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(h):h<0?this.checkSegments(h%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+h%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(p=!0,h=0)):this.setCurrentRawFrameValue(h),p&&(this.setCurrentRawFrameValue(h),this.pause(),this.trigger("complete"))}},Me.prototype.adjustSegment=function(c,h){this.playCount=0,c[1]<c[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=c[0]-c[1],this.timeCompleted=this.totalFrames,this.firstFrame=c[1],this.setCurrentRawFrameValue(this.totalFrames-.001-h)):c[1]>c[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=c[1]-c[0],this.timeCompleted=this.totalFrames,this.firstFrame=c[0],this.setCurrentRawFrameValue(.001+h)),this.trigger("segmentStart")},Me.prototype.setSegment=function(c,h){var p=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<c?p=c:this.currentRawFrame+this.firstFrame>h&&(p=h-c)),this.firstFrame=c,this.totalFrames=h-c,this.timeCompleted=this.totalFrames,p!==-1&&this.goToAndStop(p,!0)},Me.prototype.playSegments=function(c,h){if(h&&(this.segments.length=0),Os(c[0])==="object"){var p,m=c.length;for(p=0;p<m;p+=1)this.segments.push(c[p])}else this.segments.push(c);this.segments.length&&h&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},Me.prototype.resetSegments=function(c){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),c&&this.checkSegments(0)},Me.prototype.checkSegments=function(c){return this.segments.length?(this.adjustSegment(this.segments.shift(),c),!0):!1},Me.prototype.destroy=function(c){c&&this.name!==c||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)},Me.prototype.setCurrentRawFrameValue=function(c){this.currentRawFrame=c,this.gotoFrame()},Me.prototype.setSpeed=function(c){this.playSpeed=c,this.updaFrameModifier()},Me.prototype.setDirection=function(c){this.playDirection=c<0?-1:1,this.updaFrameModifier()},Me.prototype.setLoop=function(c){this.loop=c},Me.prototype.setVolume=function(c,h){h&&this.name!==h||this.audioController.setVolume(c)},Me.prototype.getVolume=function(){return this.audioController.getVolume()},Me.prototype.mute=function(c){c&&this.name!==c||this.audioController.mute()},Me.prototype.unmute=function(c){c&&this.name!==c||this.audioController.unmute()},Me.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},Me.prototype.getPath=function(){return this.path},Me.prototype.getAssetsPath=function(c){var h="";if(c.e)h=c.p;else if(this.assetsPath){var p=c.p;p.indexOf("images/")!==-1&&(p=p.split("/")[1]),h=this.assetsPath+p}else h=this.path,h+=c.u?c.u:"",h+=c.p;return h},Me.prototype.getAssetData=function(c){for(var h=0,p=this.assets.length;h<p;){if(c===this.assets[h].id)return this.assets[h];h+=1}return null},Me.prototype.hide=function(){this.renderer.hide()},Me.prototype.show=function(){this.renderer.show()},Me.prototype.getDuration=function(c){return c?this.totalFrames:this.totalFrames/this.frameRate},Me.prototype.updateDocumentData=function(c,h,p){try{var m=this.renderer.getElementByPath(c);m.updateDocumentData(h,p)}catch{}},Me.prototype.trigger=function(c){if(this._cbs&&this._cbs[c])switch(c){case"enterFrame":this.triggerEvent(c,new se(c,this.currentFrame,this.totalFrames,this.frameModifier));break;case"drawnFrame":this.drawnFrameEvent.currentTime=this.currentFrame,this.drawnFrameEvent.totalTime=this.totalFrames,this.drawnFrameEvent.direction=this.frameModifier,this.triggerEvent(c,this.drawnFrameEvent);break;case"loopComplete":this.triggerEvent(c,new de(c,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(c,new pe(c,this.frameMult));break;case"segmentStart":this.triggerEvent(c,new be(c,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(c,new Le(c,this));break;default:this.triggerEvent(c)}c==="enterFrame"&&this.onEnterFrame&&this.onEnterFrame.call(this,new se(c,this.currentFrame,this.totalFrames,this.frameMult)),c==="loopComplete"&&this.onLoopComplete&&this.onLoopComplete.call(this,new de(c,this.loop,this.playCount,this.frameMult)),c==="complete"&&this.onComplete&&this.onComplete.call(this,new pe(c,this.frameMult)),c==="segmentStart"&&this.onSegmentStart&&this.onSegmentStart.call(this,new be(c,this.firstFrame,this.totalFrames)),c==="destroy"&&this.onDestroy&&this.onDestroy.call(this,new Le(c,this))},Me.prototype.triggerRenderFrameError=function(c){var h=new ue(c,this.currentFrame);this.triggerEvent("error",h),this.onError&&this.onError.call(this,h)},Me.prototype.triggerConfigError=function(c){var h=new he(c,this.currentFrame);this.triggerEvent("error",h),this.onError&&this.onError.call(this,h)};var Tt=function(){var c={},h=[],p=0,m=0,S=0,x=!0,A=!1;function D(M){for(var z=0,T=M.target;z<m;)h[z].animation===T&&(h.splice(z,1),z-=1,m-=1,T.isPaused||ee()),z+=1}function L(M,z){if(!M)return null;for(var T=0;T<m;){if(h[T].elem===M&&h[T].elem!==null)return h[T].animation;T+=1}var R=new Me;return I(R,M),R.setData(M,z),R}function B(){var M,z=h.length,T=[];for(M=0;M<z;M+=1)T.push(h[M].animation);return T}function V(){S+=1,Ke()}function ee(){S-=1}function I(M,z){M.addEventListener("destroy",D),M.addEventListener("_active",V),M.addEventListener("_idle",ee),h.push({elem:z,animation:M}),m+=1}function H(M){var z=new Me;return I(z,null),z.setParams(M),z}function q(M,z){var T;for(T=0;T<m;T+=1)h[T].animation.setSpeed(M,z)}function K(M,z){var T;for(T=0;T<m;T+=1)h[T].animation.setDirection(M,z)}function J(M){var z;for(z=0;z<m;z+=1)h[z].animation.play(M)}function G(M){var z=M-p,T;for(T=0;T<m;T+=1)h[T].animation.advanceTime(z);p=M,S&&!A?window.requestAnimationFrame(G):x=!0}function O(M){p=M,window.requestAnimationFrame(G)}function _(M){var z;for(z=0;z<m;z+=1)h[z].animation.pause(M)}function P(M,z,T){var R;for(R=0;R<m;R+=1)h[R].animation.goToAndStop(M,z,T)}function $(M){var z;for(z=0;z<m;z+=1)h[z].animation.stop(M)}function Y(M){var z;for(z=0;z<m;z+=1)h[z].animation.togglePause(M)}function Z(M){var z;for(z=m-1;z>=0;z-=1)h[z].animation.destroy(M)}function ae(M,z,T){var R=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),ne,X=R.length;for(ne=0;ne<X;ne+=1)T&&R[ne].setAttribute("data-bm-type",T),L(R[ne],M);if(z&&X===0){T||(T="svg");var Re=document.getElementsByTagName("body")[0];Re.innerText="";var Ue=d("div");Ue.style.width="100%",Ue.style.height="100%",Ue.setAttribute("data-bm-type",T),Re.appendChild(Ue),L(Ue,M)}}function Se(){var M;for(M=0;M<m;M+=1)h[M].animation.resize()}function Ke(){!A&&S&&x&&(window.requestAnimationFrame(O),x=!1)}function De(){A=!0}function Te(){A=!1,Ke()}function Ye(M,z){var T;for(T=0;T<m;T+=1)h[T].animation.setVolume(M,z)}function ke(M){var z;for(z=0;z<m;z+=1)h[z].animation.mute(M)}function xe(M){var z;for(z=0;z<m;z+=1)h[z].animation.unmute(M)}return c.registerAnimation=L,c.loadAnimation=H,c.setSpeed=q,c.setDirection=K,c.play=J,c.pause=_,c.stop=$,c.togglePause=Y,c.searchAnimations=ae,c.resize=Se,c.goToAndStop=P,c.destroy=Z,c.freeze=De,c.unfreeze=Te,c.setVolume=Ye,c.mute=ke,c.unmute=xe,c.getRegisteredAnimations=B,c}(),si=function(){var c={};c.getBezierEasing=p;var h={};function p(O,_,P,$,Y){var Z=Y||("bez_"+O+"_"+_+"_"+P+"_"+$).replace(/\./g,"p");if(h[Z])return h[Z];var ae=new G([O,_,P,$]);return h[Z]=ae,ae}var m=4,S=.001,x=1e-7,A=10,D=11,L=1/(D-1),B=typeof Float32Array=="function";function V(O,_){return 1-3*_+3*O}function ee(O,_){return 3*_-6*O}function I(O){return 3*O}function H(O,_,P){return((V(_,P)*O+ee(_,P))*O+I(_))*O}function q(O,_,P){return 3*V(_,P)*O*O+2*ee(_,P)*O+I(_)}function K(O,_,P,$,Y){var Z,ae,Se=0;do ae=_+(P-_)/2,Z=H(ae,$,Y)-O,Z>0?P=ae:_=ae;while(Math.abs(Z)>x&&++Se<A);return ae}function J(O,_,P,$){for(var Y=0;Y<m;++Y){var Z=q(_,P,$);if(Z===0)return _;var ae=H(_,P,$)-O;_-=ae/Z}return _}function G(O){this._p=O,this._mSampleValues=B?new Float32Array(D):new Array(D),this._precomputed=!1,this.get=this.get.bind(this)}return G.prototype={get:function(_){var P=this._p[0],$=this._p[1],Y=this._p[2],Z=this._p[3];return this._precomputed||this._precompute(),P===$&&Y===Z?_:_===0?0:_===1?1:H(this._getTForX(_),$,Z)},_precompute:function(){var _=this._p[0],P=this._p[1],$=this._p[2],Y=this._p[3];this._precomputed=!0,(_!==P||$!==Y)&&this._calcSampleValues()},_calcSampleValues:function(){for(var _=this._p[0],P=this._p[2],$=0;$<D;++$)this._mSampleValues[$]=H($*L,_,P)},_getTForX:function(_){for(var P=this._p[0],$=this._p[2],Y=this._mSampleValues,Z=0,ae=1,Se=D-1;ae!==Se&&Y[ae]<=_;++ae)Z+=L;--ae;var Ke=(_-Y[ae])/(Y[ae+1]-Y[ae]),De=Z+Ke*L,Te=q(De,P,$);return Te>=S?J(_,De,P,$):Te===0?De:K(_,Z,Z+L,P,$)}},c}(),Mn=function(){function c(h){return h.concat(E(h.length))}return{double:c}}(),hr=function(){return function(c,h,p){var m=0,S=c,x=E(S),A={newElement:D,release:L};function D(){var B;return m?(m-=1,B=x[m]):B=h(),B}function L(B){m===S&&(x=Mn.double(x),S*=2),p&&p(B),x[m]=B,m+=1}return A}}(),Fn=function(){function c(){return{addedLength:0,percents:y("float32",Rt()),lengths:y("float32",Rt())}}return hr(8,c)}(),On=function(){function c(){return{lengths:[],totalLength:0}}function h(p){var m,S=p.lengths.length;for(m=0;m<S;m+=1)Fn.release(p.lengths[m]);p.lengths.length=0}return hr(8,c,h)}();function no(){var c=Math;function h(I,H,q,K,J,G){var O=I*K+H*J+q*G-J*K-G*I-q*H;return O>-.001&&O<.001}function p(I,H,q,K,J,G,O,_,P){if(q===0&&G===0&&P===0)return h(I,H,K,J,O,_);var $=c.sqrt(c.pow(K-I,2)+c.pow(J-H,2)+c.pow(G-q,2)),Y=c.sqrt(c.pow(O-I,2)+c.pow(_-H,2)+c.pow(P-q,2)),Z=c.sqrt(c.pow(O-K,2)+c.pow(_-J,2)+c.pow(P-G,2)),ae;return $>Y?$>Z?ae=$-Y-Z:ae=Z-Y-$:Z>Y?ae=Z-Y-$:ae=Y-$-Z,ae>-1e-4&&ae<1e-4}var m=function(){return function(I,H,q,K){var J=Rt(),G,O,_,P,$,Y=0,Z,ae=[],Se=[],Ke=Fn.newElement();for(_=q.length,G=0;G<J;G+=1){for($=G/(J-1),Z=0,O=0;O<_;O+=1)P=U(1-$,3)*I[O]+3*U(1-$,2)*$*q[O]+3*(1-$)*U($,2)*K[O]+U($,3)*H[O],ae[O]=P,Se[O]!==null&&(Z+=U(ae[O]-Se[O],2)),Se[O]=ae[O];Z&&(Z=N(Z),Y+=Z),Ke.percents[G]=$,Ke.lengths[G]=Y}return Ke.addedLength=Y,Ke}}();function S(I){var H=On.newElement(),q=I.c,K=I.v,J=I.o,G=I.i,O,_=I._length,P=H.lengths,$=0;for(O=0;O<_-1;O+=1)P[O]=m(K[O],K[O+1],J[O],G[O+1]),$+=P[O].addedLength;return q&&_&&(P[O]=m(K[O],K[0],J[O],G[0]),$+=P[O].addedLength),H.totalLength=$,H}function x(I){this.segmentLength=0,this.points=new Array(I)}function A(I,H){this.partialLength=I,this.point=H}var D=function(){var I={};return function(H,q,K,J){var G=(H[0]+"_"+H[1]+"_"+q[0]+"_"+q[1]+"_"+K[0]+"_"+K[1]+"_"+J[0]+"_"+J[1]).replace(/\./g,"p");if(!I[G]){var O=Rt(),_,P,$,Y,Z,ae=0,Se,Ke,De=null;H.length===2&&(H[0]!==q[0]||H[1]!==q[1])&&h(H[0],H[1],q[0],q[1],H[0]+K[0],H[1]+K[1])&&h(H[0],H[1],q[0],q[1],q[0]+J[0],q[1]+J[1])&&(O=2);var Te=new x(O);for($=K.length,_=0;_<O;_+=1){for(Ke=E($),Z=_/(O-1),Se=0,P=0;P<$;P+=1)Y=U(1-Z,3)*H[P]+3*U(1-Z,2)*Z*(H[P]+K[P])+3*(1-Z)*U(Z,2)*(q[P]+J[P])+U(Z,3)*q[P],Ke[P]=Y,De!==null&&(Se+=U(Ke[P]-De[P],2));Se=N(Se),ae+=Se,Te.points[_]=new A(Se,Ke),De=Ke}Te.segmentLength=ae,I[G]=Te}return I[G]}}();function L(I,H){var q=H.percents,K=H.lengths,J=q.length,G=te((J-1)*I),O=I*H.addedLength,_=0;if(G===J-1||G===0||O===K[G])return q[G];for(var P=K[G]>O?-1:1,$=!0;$;)if(K[G]<=O&&K[G+1]>O?(_=(O-K[G])/(K[G+1]-K[G]),$=!1):G+=P,G<0||G>=J-1){if(G===J-1)return q[G];$=!1}return q[G]+(q[G+1]-q[G])*_}function B(I,H,q,K,J,G){var O=L(J,G),_=1-O,P=c.round((_*_*_*I[0]+(O*_*_+_*O*_+_*_*O)*q[0]+(O*O*_+_*O*O+O*_*O)*K[0]+O*O*O*H[0])*1e3)/1e3,$=c.round((_*_*_*I[1]+(O*_*_+_*O*_+_*_*O)*q[1]+(O*O*_+_*O*O+O*_*O)*K[1]+O*O*O*H[1])*1e3)/1e3;return[P,$]}var V=y("float32",8);function ee(I,H,q,K,J,G,O){J<0?J=0:J>1&&(J=1);var _=L(J,O);G=G>1?1:G;var P=L(G,O),$,Y=I.length,Z=1-_,ae=1-P,Se=Z*Z*Z,Ke=_*Z*Z*3,De=_*_*Z*3,Te=_*_*_,Ye=Z*Z*ae,ke=_*Z*ae+Z*_*ae+Z*Z*P,xe=_*_*ae+Z*_*P+_*Z*P,M=_*_*P,z=Z*ae*ae,T=_*ae*ae+Z*P*ae+Z*ae*P,R=_*P*ae+Z*P*P+_*ae*P,ne=_*P*P,X=ae*ae*ae,Re=P*ae*ae+ae*P*ae+ae*ae*P,Ue=P*P*ae+ae*P*P+P*ae*P,ze=P*P*P;for($=0;$<Y;$+=1)V[$*4]=c.round((Se*I[$]+Ke*q[$]+De*K[$]+Te*H[$])*1e3)/1e3,V[$*4+1]=c.round((Ye*I[$]+ke*q[$]+xe*K[$]+M*H[$])*1e3)/1e3,V[$*4+2]=c.round((z*I[$]+T*q[$]+R*K[$]+ne*H[$])*1e3)/1e3,V[$*4+3]=c.round((X*I[$]+Re*q[$]+Ue*K[$]+ze*H[$])*1e3)/1e3;return V}return{getSegmentsLength:S,getNewSegment:ee,getPointInSegment:B,buildBezierData:D,pointOnLine2D:h,pointOnLine3D:p}}var gs=no(),ii=n,dr=Math.abs;function Kr(c,h){var p=this.offsetTime,m;this.propType==="multidimensional"&&(m=y("float32",this.pv.length));for(var S=h.lastIndex,x=S,A=this.keyframes.length-1,D=!0,L,B,V;D;){if(L=this.keyframes[x],B=this.keyframes[x+1],x===A-1&&c>=B.t-p){L.h&&(L=B),S=0;break}if(B.t-p>c){S=x;break}x<A-1?x+=1:(S=0,D=!1)}V=this.keyframesMetadata[x]||{};var ee,I,H,q,K,J,G=B.t-p,O=L.t-p,_;if(L.to){V.bezierData||(V.bezierData=gs.buildBezierData(L.s,B.s||L.e,L.to,L.ti));var P=V.bezierData;if(c>=G||c<O){var $=c>=G?P.points.length-1:0;for(I=P.points[$].point.length,ee=0;ee<I;ee+=1)m[ee]=P.points[$].point[ee]}else{V.__fnct?J=V.__fnct:(J=si.getBezierEasing(L.o.x,L.o.y,L.i.x,L.i.y,L.n).get,V.__fnct=J),H=J((c-O)/(G-O));var Y=P.segmentLength*H,Z,ae=h.lastFrame<c&&h._lastKeyframeIndex===x?h._lastAddedLength:0;for(K=h.lastFrame<c&&h._lastKeyframeIndex===x?h._lastPoint:0,D=!0,q=P.points.length;D;){if(ae+=P.points[K].partialLength,Y===0||H===0||K===P.points.length-1){for(I=P.points[K].point.length,ee=0;ee<I;ee+=1)m[ee]=P.points[K].point[ee];break}else if(Y>=ae&&Y<ae+P.points[K+1].partialLength){for(Z=(Y-ae)/P.points[K+1].partialLength,I=P.points[K].point.length,ee=0;ee<I;ee+=1)m[ee]=P.points[K].point[ee]+(P.points[K+1].point[ee]-P.points[K].point[ee])*Z;break}K<q-1?K+=1:D=!1}h._lastPoint=K,h._lastAddedLength=ae-P.points[K].partialLength,h._lastKeyframeIndex=x}}else{var Se,Ke,De,Te,Ye;if(A=L.s.length,_=B.s||L.e,this.sh&&L.h!==1)if(c>=G)m[0]=_[0],m[1]=_[1],m[2]=_[2];else if(c<=O)m[0]=L.s[0],m[1]=L.s[1],m[2]=L.s[2];else{var ke=fr(L.s),xe=fr(_),M=(c-O)/(G-O);zr(m,Si(ke,xe,M))}else for(x=0;x<A;x+=1)L.h!==1&&(c>=G?H=1:c<O?H=0:(L.o.x.constructor===Array?(V.__fnct||(V.__fnct=[]),V.__fnct[x]?J=V.__fnct[x]:(Se=L.o.x[x]===void 0?L.o.x[0]:L.o.x[x],Ke=L.o.y[x]===void 0?L.o.y[0]:L.o.y[x],De=L.i.x[x]===void 0?L.i.x[0]:L.i.x[x],Te=L.i.y[x]===void 0?L.i.y[0]:L.i.y[x],J=si.getBezierEasing(Se,Ke,De,Te).get,V.__fnct[x]=J)):V.__fnct?J=V.__fnct:(Se=L.o.x,Ke=L.o.y,De=L.i.x,Te=L.i.y,J=si.getBezierEasing(Se,Ke,De,Te).get,L.keyframeMetadata=J),H=J((c-O)/(G-O)))),_=B.s||L.e,Ye=L.h===1?L.s[x]:L.s[x]+(_[x]-L.s[x])*H,this.propType==="multidimensional"?m[x]=Ye:m=Ye}return h.lastIndex=S,m}function Si(c,h,p){var m=[],S=c[0],x=c[1],A=c[2],D=c[3],L=h[0],B=h[1],V=h[2],ee=h[3],I,H,q,K,J;return H=S*L+x*B+A*V+D*ee,H<0&&(H=-H,L=-L,B=-B,V=-V,ee=-ee),1-H>1e-6?(I=Math.acos(H),q=Math.sin(I),K=Math.sin((1-p)*I)/q,J=Math.sin(p*I)/q):(K=1-p,J=p),m[0]=K*S+J*L,m[1]=K*x+J*B,m[2]=K*A+J*V,m[3]=K*D+J*ee,m}function zr(c,h){var p=h[0],m=h[1],S=h[2],x=h[3],A=Math.atan2(2*m*x-2*p*S,1-2*m*m-2*S*S),D=Math.asin(2*p*m+2*S*x),L=Math.atan2(2*p*x-2*m*S,1-2*p*p-2*S*S);c[0]=A/Q,c[1]=D/Q,c[2]=L/Q}function fr(c){var h=c[0]*Q,p=c[1]*Q,m=c[2]*Q,S=Math.cos(h/2),x=Math.cos(p/2),A=Math.cos(m/2),D=Math.sin(h/2),L=Math.sin(p/2),B=Math.sin(m/2),V=S*x*A-D*L*B,ee=D*L*A+S*x*B,I=D*x*A+S*L*B,H=S*L*A-D*x*B;return[ee,I,H,V]}function Wr(){var c=this.comp.renderedFrame-this.offsetTime,h=this.keyframes[0].t-this.offsetTime,p=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(c===this._caching.lastFrame||this._caching.lastFrame!==ii&&(this._caching.lastFrame>=p&&c>=p||this._caching.lastFrame<h&&c<h))){this._caching.lastFrame>=c&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var m=this.interpolateValue(c,this._caching);this.pv=m}return this._caching.lastFrame=c,this.pv}function pr(c){var h;if(this.propType==="unidimensional")h=c*this.mult,dr(this.v-h)>1e-5&&(this.v=h,this._mdf=!0);else for(var p=0,m=this.v.length;p<m;)h=c[p]*this.mult,dr(this.v[p]-h)>1e-5&&(this.v[p]=h,this._mdf=!0),p+=1}function Hi(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var c,h=this.effectsSequence.length,p=this.kf?this.pv:this.data.k;for(c=0;c<h;c+=1)p=this.effectsSequence[c](p);this.setVValue(p),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function gr(c){this.effectsSequence.push(c),this.container.addDynamicProperty(this)}function Nn(c,h,p,m){this.propType="unidimensional",this.mult=p||1,this.data=h,this.v=p?h.k*p:h.k,this.pv=h.k,this._mdf=!1,this.elem=c,this.container=m,this.comp=c.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=Hi,this.setVValue=pr,this.addEffect=gr}function Bn(c,h,p,m){this.propType="multidimensional",this.mult=p||1,this.data=h,this._mdf=!1,this.elem=c,this.container=m,this.comp=c.comp,this.k=!1,this.kf=!1,this.frameId=-1;var S,x=h.k.length;for(this.v=y("float32",x),this.pv=y("float32",x),this.vel=y("float32",x),S=0;S<x;S+=1)this.v[S]=h.k[S]*this.mult,this.pv[S]=h.k[S];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=Hi,this.setVValue=pr,this.addEffect=gr}function ao(c,h,p,m){this.propType="unidimensional",this.keyframes=h.k,this.keyframesMetadata=[],this.offsetTime=c.data.st,this.frameId=-1,this._caching={lastFrame:ii,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=h,this.mult=p||1,this.elem=c,this.container=m,this.comp=c.comp,this.v=ii,this.pv=ii,this._isFirstFrame=!0,this.getValue=Hi,this.setVValue=pr,this.interpolateValue=Kr,this.effectsSequence=[Wr.bind(this)],this.addEffect=gr}function oo(c,h,p,m){this.propType="multidimensional";var S,x=h.k.length,A,D,L,B;for(S=0;S<x-1;S+=1)h.k[S].to&&h.k[S].s&&h.k[S+1]&&h.k[S+1].s&&(A=h.k[S].s,D=h.k[S+1].s,L=h.k[S].to,B=h.k[S].ti,(A.length===2&&!(A[0]===D[0]&&A[1]===D[1])&&gs.pointOnLine2D(A[0],A[1],D[0],D[1],A[0]+L[0],A[1]+L[1])&&gs.pointOnLine2D(A[0],A[1],D[0],D[1],D[0]+B[0],D[1]+B[1])||A.length===3&&!(A[0]===D[0]&&A[1]===D[1]&&A[2]===D[2])&&gs.pointOnLine3D(A[0],A[1],A[2],D[0],D[1],D[2],A[0]+L[0],A[1]+L[1],A[2]+L[2])&&gs.pointOnLine3D(A[0],A[1],A[2],D[0],D[1],D[2],D[0]+B[0],D[1]+B[1],D[2]+B[2]))&&(h.k[S].to=null,h.k[S].ti=null),A[0]===D[0]&&A[1]===D[1]&&L[0]===0&&L[1]===0&&B[0]===0&&B[1]===0&&(A.length===2||A[2]===D[2]&&L[2]===0&&B[2]===0)&&(h.k[S].to=null,h.k[S].ti=null));this.effectsSequence=[Wr.bind(this)],this.data=h,this.keyframes=h.k,this.keyframesMetadata=[],this.offsetTime=c.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=p||1,this.elem=c,this.container=m,this.comp=c.comp,this.getValue=Hi,this.setVValue=pr,this.interpolateValue=Kr,this.frameId=-1;var V=h.k[0].s.length;for(this.v=y("float32",V),this.pv=y("float32",V),S=0;S<V;S+=1)this.v[S]=ii,this.pv[S]=ii;this._caching={lastFrame:ii,lastIndex:0,value:y("float32",V)},this.addEffect=gr}var Ae=function(){function c(p,m,S,x,A){m.sid&&(m=p.globalData.slotManager.getProp(m));var D;if(!m.k.length)D=new Nn(p,m,x,A);else if(typeof m.k[0]=="number")D=new Bn(p,m,x,A);else switch(S){case 0:D=new ao(p,m,x,A);break;case 1:D=new oo(p,m,x,A);break}return D.effectsSequence.length&&A.addDynamicProperty(D),D}var h={getProp:c};return h}();function _t(){}_t.prototype={addDynamicProperty:function(h){this.dynamicProperties.indexOf(h)===-1&&(this.dynamicProperties.push(h),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){this._mdf=!1;var h,p=this.dynamicProperties.length;for(h=0;h<p;h+=1)this.dynamicProperties[h].getValue(),this.dynamicProperties[h]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(h){this.container=h,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var ri=function(){function c(){return y("float32",2)}return hr(8,c)}();function Ts(){this.c=!1,this._length=0,this._maxLength=8,this.v=E(this._maxLength),this.o=E(this._maxLength),this.i=E(this._maxLength)}Ts.prototype.setPathData=function(c,h){this.c=c,this.setLength(h);for(var p=0;p<h;)this.v[p]=ri.newElement(),this.o[p]=ri.newElement(),this.i[p]=ri.newElement(),p+=1},Ts.prototype.setLength=function(c){for(;this._maxLength<c;)this.doubleArrayLength();this._length=c},Ts.prototype.doubleArrayLength=function(){this.v=this.v.concat(E(this._maxLength)),this.i=this.i.concat(E(this._maxLength)),this.o=this.o.concat(E(this._maxLength)),this._maxLength*=2},Ts.prototype.setXYAt=function(c,h,p,m,S){var x;switch(this._length=Math.max(this._length,m+1),this._length>=this._maxLength&&this.doubleArrayLength(),p){case"v":x=this.v;break;case"i":x=this.i;break;case"o":x=this.o;break;default:x=[];break}(!x[m]||x[m]&&!S)&&(x[m]=ri.newElement()),x[m][0]=c,x[m][1]=h},Ts.prototype.setTripleAt=function(c,h,p,m,S,x,A,D){this.setXYAt(c,h,"v",A,D),this.setXYAt(p,m,"o",A,D),this.setXYAt(S,x,"i",A,D)},Ts.prototype.reverse=function(){var c=new Ts;c.setPathData(this.c,this._length);var h=this.v,p=this.o,m=this.i,S=0;this.c&&(c.setTripleAt(h[0][0],h[0][1],m[0][0],m[0][1],p[0][0],p[0][1],0,!1),S=1);var x=this._length-1,A=this._length,D;for(D=S;D<A;D+=1)c.setTripleAt(h[x][0],h[x][1],m[x][0],m[x][1],p[x][0],p[x][1],D,!1),x-=1;return c},Ts.prototype.length=function(){return this._length};var Dt=function(){function c(){return new Ts}function h(S){var x=S._length,A;for(A=0;A<x;A+=1)ri.release(S.v[A]),ri.release(S.i[A]),ri.release(S.o[A]),S.v[A]=null,S.i[A]=null,S.o[A]=null;S._length=0,S.c=!1}function p(S){var x=m.newElement(),A,D=S._length===void 0?S.v.length:S._length;for(x.setLength(D),x.c=S.c,A=0;A<D;A+=1)x.setTripleAt(S.v[A][0],S.v[A][1],S.o[A][0],S.o[A][1],S.i[A][0],S.i[A][1],A);return x}var m=hr(4,c,h);return m.clone=p,m}();function W(){this._length=0,this._maxLength=4,this.shapes=E(this._maxLength)}W.prototype.addShape=function(c){this._length===this._maxLength&&(this.shapes=this.shapes.concat(E(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=c,this._length+=1},W.prototype.releaseShapes=function(){var c;for(c=0;c<this._length;c+=1)Dt.release(this.shapes[c]);this._length=0};var Ee=function(){var c={newShapeCollection:S,release:x},h=0,p=4,m=E(p);function S(){var A;return h?(h-=1,A=m[h]):A=new W,A}function x(A){var D,L=A._length;for(D=0;D<L;D+=1)Dt.release(A.shapes[D]);A._length=0,h===p&&(m=Mn.double(m),p*=2),m[h]=A,h+=1}return c}(),Ce=function(){var c=-999999;function h(G,O,_){var P=_.lastIndex,$,Y,Z,ae,Se,Ke,De,Te,Ye,ke=this.keyframes;if(G<ke[0].t-this.offsetTime)$=ke[0].s[0],Z=!0,P=0;else if(G>=ke[ke.length-1].t-this.offsetTime)$=ke[ke.length-1].s?ke[ke.length-1].s[0]:ke[ke.length-2].e[0],Z=!0;else{for(var xe=P,M=ke.length-1,z=!0,T,R,ne;z&&(T=ke[xe],R=ke[xe+1],!(R.t-this.offsetTime>G));)xe<M-1?xe+=1:z=!1;if(ne=this.keyframesMetadata[xe]||{},Z=T.h===1,P=xe,!Z){if(G>=R.t-this.offsetTime)Te=1;else if(G<T.t-this.offsetTime)Te=0;else{var X;ne.__fnct?X=ne.__fnct:(X=si.getBezierEasing(T.o.x,T.o.y,T.i.x,T.i.y).get,ne.__fnct=X),Te=X((G-(T.t-this.offsetTime))/(R.t-this.offsetTime-(T.t-this.offsetTime)))}Y=R.s?R.s[0]:T.e[0]}$=T.s[0]}for(Ke=O._length,De=$.i[0].length,_.lastIndex=P,ae=0;ae<Ke;ae+=1)for(Se=0;Se<De;Se+=1)Ye=Z?$.i[ae][Se]:$.i[ae][Se]+(Y.i[ae][Se]-$.i[ae][Se])*Te,O.i[ae][Se]=Ye,Ye=Z?$.o[ae][Se]:$.o[ae][Se]+(Y.o[ae][Se]-$.o[ae][Se])*Te,O.o[ae][Se]=Ye,Ye=Z?$.v[ae][Se]:$.v[ae][Se]+(Y.v[ae][Se]-$.v[ae][Se])*Te,O.v[ae][Se]=Ye}function p(){var G=this.comp.renderedFrame-this.offsetTime,O=this.keyframes[0].t-this.offsetTime,_=this.keyframes[this.keyframes.length-1].t-this.offsetTime,P=this._caching.lastFrame;return P!==c&&(P<O&&G<O||P>_&&G>_)||(this._caching.lastIndex=P<G?this._caching.lastIndex:0,this.interpolateShape(G,this.pv,this._caching)),this._caching.lastFrame=G,this.pv}function m(){this.paths=this.localShapeCollection}function S(G,O){if(G._length!==O._length||G.c!==O.c)return!1;var _,P=G._length;for(_=0;_<P;_+=1)if(G.v[_][0]!==O.v[_][0]||G.v[_][1]!==O.v[_][1]||G.o[_][0]!==O.o[_][0]||G.o[_][1]!==O.o[_][1]||G.i[_][0]!==O.i[_][0]||G.i[_][1]!==O.i[_][1])return!1;return!0}function x(G){S(this.v,G)||(this.v=Dt.clone(G),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function A(){if(this.elem.globalData.frameId!==this.frameId){if(!this.effectsSequence.length){this._mdf=!1;return}if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=!1;var G;this.kf?G=this.pv:this.data.ks?G=this.data.ks.k:G=this.data.pt.k;var O,_=this.effectsSequence.length;for(O=0;O<_;O+=1)G=this.effectsSequence[O](G);this.setVValue(G),this.lock=!1,this.frameId=this.elem.globalData.frameId}}function D(G,O,_){this.propType="shape",this.comp=G.comp,this.container=G,this.elem=G,this.data=O,this.k=!1,this.kf=!1,this._mdf=!1;var P=_===3?O.pt.k:O.ks.k;this.v=Dt.clone(P),this.pv=Dt.clone(this.v),this.localShapeCollection=Ee.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=m,this.effectsSequence=[]}function L(G){this.effectsSequence.push(G),this.container.addDynamicProperty(this)}D.prototype.interpolateShape=h,D.prototype.getValue=A,D.prototype.setVValue=x,D.prototype.addEffect=L;function B(G,O,_){this.propType="shape",this.comp=G.comp,this.elem=G,this.container=G,this.offsetTime=G.data.st,this.keyframes=_===3?O.pt.k:O.ks.k,this.keyframesMetadata=[],this.k=!0,this.kf=!0;var P=this.keyframes[0].s[0].i.length;this.v=Dt.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,P),this.pv=Dt.clone(this.v),this.localShapeCollection=Ee.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=c,this.reset=m,this._caching={lastFrame:c,lastIndex:0},this.effectsSequence=[p.bind(this)]}B.prototype.getValue=A,B.prototype.interpolateShape=h,B.prototype.setVValue=x,B.prototype.addEffect=L;var V=function(){var G=le;function O(_,P){this.v=Dt.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=Ee.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=P.d,this.elem=_,this.comp=_.comp,this.frameId=-1,this.initDynamicPropertyContainer(_),this.p=Ae.getProp(_,P.p,1,0,this),this.s=Ae.getProp(_,P.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return O.prototype={reset:m,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var P=this.p.v[0],$=this.p.v[1],Y=this.s.v[0]/2,Z=this.s.v[1]/2,ae=this.d!==3,Se=this.v;Se.v[0][0]=P,Se.v[0][1]=$-Z,Se.v[1][0]=ae?P+Y:P-Y,Se.v[1][1]=$,Se.v[2][0]=P,Se.v[2][1]=$+Z,Se.v[3][0]=ae?P-Y:P+Y,Se.v[3][1]=$,Se.i[0][0]=ae?P-Y*G:P+Y*G,Se.i[0][1]=$-Z,Se.i[1][0]=ae?P+Y:P-Y,Se.i[1][1]=$-Z*G,Se.i[2][0]=ae?P+Y*G:P-Y*G,Se.i[2][1]=$+Z,Se.i[3][0]=ae?P-Y:P+Y,Se.i[3][1]=$+Z*G,Se.o[0][0]=ae?P+Y*G:P-Y*G,Se.o[0][1]=$-Z,Se.o[1][0]=ae?P+Y:P-Y,Se.o[1][1]=$+Z*G,Se.o[2][0]=ae?P-Y*G:P+Y*G,Se.o[2][1]=$+Z,Se.o[3][0]=ae?P-Y:P+Y,Se.o[3][1]=$-Z*G}},f([_t],O),O}(),ee=function(){function G(O,_){this.v=Dt.newElement(),this.v.setPathData(!0,0),this.elem=O,this.comp=O.comp,this.data=_,this.frameId=-1,this.d=_.d,this.initDynamicPropertyContainer(O),_.sy===1?(this.ir=Ae.getProp(O,_.ir,0,0,this),this.is=Ae.getProp(O,_.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=Ae.getProp(O,_.pt,0,0,this),this.p=Ae.getProp(O,_.p,1,0,this),this.r=Ae.getProp(O,_.r,0,Q,this),this.or=Ae.getProp(O,_.or,0,0,this),this.os=Ae.getProp(O,_.os,0,.01,this),this.localShapeCollection=Ee.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return G.prototype={reset:m,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var _=Math.floor(this.pt.v)*2,P=Math.PI*2/_,$=!0,Y=this.or.v,Z=this.ir.v,ae=this.os.v,Se=this.is.v,Ke=2*Math.PI*Y/(_*2),De=2*Math.PI*Z/(_*2),Te,Ye,ke,xe,M=-Math.PI/2;M+=this.r.v;var z=this.data.d===3?-1:1;for(this.v._length=0,Te=0;Te<_;Te+=1){Ye=$?Y:Z,ke=$?ae:Se,xe=$?Ke:De;var T=Ye*Math.cos(M),R=Ye*Math.sin(M),ne=T===0&&R===0?0:R/Math.sqrt(T*T+R*R),X=T===0&&R===0?0:-T/Math.sqrt(T*T+R*R);T+=+this.p.v[0],R+=+this.p.v[1],this.v.setTripleAt(T,R,T-ne*xe*ke*z,R-X*xe*ke*z,T+ne*xe*ke*z,R+X*xe*ke*z,Te,!0),$=!$,M+=P*z}},convertPolygonToPath:function(){var _=Math.floor(this.pt.v),P=Math.PI*2/_,$=this.or.v,Y=this.os.v,Z=2*Math.PI*$/(_*4),ae,Se=-Math.PI*.5,Ke=this.data.d===3?-1:1;for(Se+=this.r.v,this.v._length=0,ae=0;ae<_;ae+=1){var De=$*Math.cos(Se),Te=$*Math.sin(Se),Ye=De===0&&Te===0?0:Te/Math.sqrt(De*De+Te*Te),ke=De===0&&Te===0?0:-De/Math.sqrt(De*De+Te*Te);De+=+this.p.v[0],Te+=+this.p.v[1],this.v.setTripleAt(De,Te,De-Ye*Z*Y*Ke,Te-ke*Z*Y*Ke,De+Ye*Z*Y*Ke,Te+ke*Z*Y*Ke,ae,!0),Se+=P*Ke}this.paths.length=0,this.paths[0]=this.v}},f([_t],G),G}(),I=function(){function G(O,_){this.v=Dt.newElement(),this.v.c=!0,this.localShapeCollection=Ee.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=O,this.comp=O.comp,this.frameId=-1,this.d=_.d,this.initDynamicPropertyContainer(O),this.p=Ae.getProp(O,_.p,1,0,this),this.s=Ae.getProp(O,_.s,1,0,this),this.r=Ae.getProp(O,_.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return G.prototype={convertRectToPath:function(){var _=this.p.v[0],P=this.p.v[1],$=this.s.v[0]/2,Y=this.s.v[1]/2,Z=j($,Y,this.r.v),ae=Z*(1-le);this.v._length=0,this.d===2||this.d===1?(this.v.setTripleAt(_+$,P-Y+Z,_+$,P-Y+Z,_+$,P-Y+ae,0,!0),this.v.setTripleAt(_+$,P+Y-Z,_+$,P+Y-ae,_+$,P+Y-Z,1,!0),Z!==0?(this.v.setTripleAt(_+$-Z,P+Y,_+$-Z,P+Y,_+$-ae,P+Y,2,!0),this.v.setTripleAt(_-$+Z,P+Y,_-$+ae,P+Y,_-$+Z,P+Y,3,!0),this.v.setTripleAt(_-$,P+Y-Z,_-$,P+Y-Z,_-$,P+Y-ae,4,!0),this.v.setTripleAt(_-$,P-Y+Z,_-$,P-Y+ae,_-$,P-Y+Z,5,!0),this.v.setTripleAt(_-$+Z,P-Y,_-$+Z,P-Y,_-$+ae,P-Y,6,!0),this.v.setTripleAt(_+$-Z,P-Y,_+$-ae,P-Y,_+$-Z,P-Y,7,!0)):(this.v.setTripleAt(_-$,P+Y,_-$+ae,P+Y,_-$,P+Y,2),this.v.setTripleAt(_-$,P-Y,_-$,P-Y+ae,_-$,P-Y,3))):(this.v.setTripleAt(_+$,P-Y+Z,_+$,P-Y+ae,_+$,P-Y+Z,0,!0),Z!==0?(this.v.setTripleAt(_+$-Z,P-Y,_+$-Z,P-Y,_+$-ae,P-Y,1,!0),this.v.setTripleAt(_-$+Z,P-Y,_-$+ae,P-Y,_-$+Z,P-Y,2,!0),this.v.setTripleAt(_-$,P-Y+Z,_-$,P-Y+Z,_-$,P-Y+ae,3,!0),this.v.setTripleAt(_-$,P+Y-Z,_-$,P+Y-ae,_-$,P+Y-Z,4,!0),this.v.setTripleAt(_-$+Z,P+Y,_-$+Z,P+Y,_-$+ae,P+Y,5,!0),this.v.setTripleAt(_+$-Z,P+Y,_+$-ae,P+Y,_+$-Z,P+Y,6,!0),this.v.setTripleAt(_+$,P+Y-Z,_+$,P+Y-Z,_+$,P+Y-ae,7,!0)):(this.v.setTripleAt(_-$,P-Y,_-$+ae,P-Y,_-$,P-Y,1,!0),this.v.setTripleAt(_-$,P+Y,_-$,P+Y-ae,_-$,P+Y,2,!0),this.v.setTripleAt(_+$,P+Y,_+$-ae,P+Y,_+$,P+Y,3,!0)))},getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:m},f([_t],G),G}();function H(G,O,_){var P;if(_===3||_===4){var $=_===3?O.pt:O.ks,Y=$.k;Y.length?P=new B(G,O,_):P=new D(G,O,_)}else _===5?P=new I(G,O):_===6?P=new V(G,O):_===7&&(P=new ee(G,O));return P.k&&G.addDynamicProperty(P),P}function q(){return D}function K(){return B}var J={};return J.getShapeProp=H,J.getConstructorFunction=q,J.getKeyframedConstructorFunction=K,J}();/*!
|
|
78
79
|
Transformation Matrix v2.0
|
|
79
80
|
(c) Epistemex 2014-2015
|
|
80
81
|
www.epistemex.com
|
|
81
82
|
By Ken Fyrstenberg
|
|
82
83
|
Contributions by leeoniya.
|
|
83
84
|
License: MIT, header required.
|
|
84
|
-
*/var Ie=function(){var c=Math.cos,h=Math.sin,p=Math.tan,m=Math.round;function S(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function x(T){if(T===0)return this;var R=c(T),ne=h(T);return this._t(R,-ne,0,0,ne,R,0,0,0,0,1,0,0,0,0,1)}function A(T){if(T===0)return this;var R=c(T),ne=h(T);return this._t(1,0,0,0,0,R,-ne,0,0,ne,R,0,0,0,0,1)}function D(T){if(T===0)return this;var R=c(T),ne=h(T);return this._t(R,0,ne,0,0,1,0,0,-ne,0,R,0,0,0,0,1)}function L(T){if(T===0)return this;var R=c(T),ne=h(T);return this._t(R,-ne,0,0,ne,R,0,0,0,0,1,0,0,0,0,1)}function B(T,R){return this._t(1,R,T,1,0,0)}function V(T,R){return this.shear(p(T),p(R))}function ee(T,R){var ne=c(R),X=h(R);return this._t(ne,X,0,0,-X,ne,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,p(T),1,0,0,0,0,1,0,0,0,0,1)._t(ne,-X,0,0,X,ne,0,0,0,0,1,0,0,0,0,1)}function I(T,R,ne){return!ne&&ne!==0&&(ne=1),T===1&&R===1&&ne===1?this:this._t(T,0,0,0,0,R,0,0,0,0,ne,0,0,0,0,1)}function H(T,R,ne,X,Re,Ue,ze,nt,at,_t,Zt,Bs,es,Ut,cs,dt){return this.props[0]=T,this.props[1]=R,this.props[2]=ne,this.props[3]=X,this.props[4]=Re,this.props[5]=Ue,this.props[6]=ze,this.props[7]=nt,this.props[8]=at,this.props[9]=_t,this.props[10]=Zt,this.props[11]=Bs,this.props[12]=es,this.props[13]=Ut,this.props[14]=cs,this.props[15]=dt,this}function q(T,R,ne){return ne=ne||0,T!==0||R!==0||ne!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,T,R,ne,1):this}function K(T,R,ne,X,Re,Ue,ze,nt,at,_t,Zt,Bs,es,Ut,cs,dt){var Pe=this.props;if(T===1&&R===0&&ne===0&&X===0&&Re===0&&Ue===1&&ze===0&&nt===0&&at===0&&_t===0&&Zt===1&&Bs===0)return Pe[12]=Pe[12]*T+Pe[15]*es,Pe[13]=Pe[13]*Ue+Pe[15]*Ut,Pe[14]=Pe[14]*Zt+Pe[15]*cs,Pe[15]*=dt,this._identityCalculated=!1,this;var oi=Pe[0],Ri=Pe[1],li=Pe[2],$s=Pe[3],ci=Pe[4],ui=Pe[5],ts=Pe[6],_i=Pe[7],Ii=Pe[8],Cs=Pe[9],ki=Pe[10],Rs=Pe[11],Wi=Pe[12],Kn=Pe[13],zn=Pe[14],Wn=Pe[15];return Pe[0]=oi*T+Ri*Re+li*at+$s*es,Pe[1]=oi*R+Ri*Ue+li*_t+$s*Ut,Pe[2]=oi*ne+Ri*ze+li*Zt+$s*cs,Pe[3]=oi*X+Ri*nt+li*Bs+$s*dt,Pe[4]=ci*T+ui*Re+ts*at+_i*es,Pe[5]=ci*R+ui*Ue+ts*_t+_i*Ut,Pe[6]=ci*ne+ui*ze+ts*Zt+_i*cs,Pe[7]=ci*X+ui*nt+ts*Bs+_i*dt,Pe[8]=Ii*T+Cs*Re+ki*at+Rs*es,Pe[9]=Ii*R+Cs*Ue+ki*_t+Rs*Ut,Pe[10]=Ii*ne+Cs*ze+ki*Zt+Rs*cs,Pe[11]=Ii*X+Cs*nt+ki*Bs+Rs*dt,Pe[12]=Wi*T+Kn*Re+zn*at+Wn*es,Pe[13]=Wi*R+Kn*Ue+zn*_t+Wn*Ut,Pe[14]=Wi*ne+Kn*ze+zn*Zt+Wn*cs,Pe[15]=Wi*X+Kn*nt+zn*Bs+Wn*dt,this._identityCalculated=!1,this}function J(T){var R=T.props;return this.transform(R[0],R[1],R[2],R[3],R[4],R[5],R[6],R[7],R[8],R[9],R[10],R[11],R[12],R[13],R[14],R[15])}function G(){return this._identityCalculated||(this._identity=!(this.props[0]!==1||this.props[1]!==0||this.props[2]!==0||this.props[3]!==0||this.props[4]!==0||this.props[5]!==1||this.props[6]!==0||this.props[7]!==0||this.props[8]!==0||this.props[9]!==0||this.props[10]!==1||this.props[11]!==0||this.props[12]!==0||this.props[13]!==0||this.props[14]!==0||this.props[15]!==1),this._identityCalculated=!0),this._identity}function O(T){for(var R=0;R<16;){if(T.props[R]!==this.props[R])return!1;R+=1}return!0}function _(T){var R;for(R=0;R<16;R+=1)T.props[R]=this.props[R];return T}function P(T){var R;for(R=0;R<16;R+=1)this.props[R]=T[R]}function $(T,R,ne){return{x:T*this.props[0]+R*this.props[4]+ne*this.props[8]+this.props[12],y:T*this.props[1]+R*this.props[5]+ne*this.props[9]+this.props[13],z:T*this.props[2]+R*this.props[6]+ne*this.props[10]+this.props[14]}}function Y(T,R,ne){return T*this.props[0]+R*this.props[4]+ne*this.props[8]+this.props[12]}function Z(T,R,ne){return T*this.props[1]+R*this.props[5]+ne*this.props[9]+this.props[13]}function ae(T,R,ne){return T*this.props[2]+R*this.props[6]+ne*this.props[10]+this.props[14]}function Se(){var T=this.props[0]*this.props[5]-this.props[1]*this.props[4],R=this.props[5]/T,ne=-this.props[1]/T,X=-this.props[4]/T,Re=this.props[0]/T,Ue=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/T,ze=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/T,nt=new Ie;return nt.props[0]=R,nt.props[1]=ne,nt.props[4]=X,nt.props[5]=Re,nt.props[12]=Ue,nt.props[13]=ze,nt}function Ke(T){var R=this.getInverseMatrix();return R.applyToPointArray(T[0],T[1],T[2]||0)}function De(T){var R,ne=T.length,X=[];for(R=0;R<ne;R+=1)X[R]=Ke(T[R]);return X}function Te(T,R,ne){var X=y("float32",6);if(this.isIdentity())X[0]=T[0],X[1]=T[1],X[2]=R[0],X[3]=R[1],X[4]=ne[0],X[5]=ne[1];else{var Re=this.props[0],Ue=this.props[1],ze=this.props[4],nt=this.props[5],at=this.props[12],_t=this.props[13];X[0]=T[0]*Re+T[1]*ze+at,X[1]=T[0]*Ue+T[1]*nt+_t,X[2]=R[0]*Re+R[1]*ze+at,X[3]=R[0]*Ue+R[1]*nt+_t,X[4]=ne[0]*Re+ne[1]*ze+at,X[5]=ne[0]*Ue+ne[1]*nt+_t}return X}function Ye(T,R,ne){var X;return this.isIdentity()?X=[T,R,ne]:X=[T*this.props[0]+R*this.props[4]+ne*this.props[8]+this.props[12],T*this.props[1]+R*this.props[5]+ne*this.props[9]+this.props[13],T*this.props[2]+R*this.props[6]+ne*this.props[10]+this.props[14]],X}function ke(T,R){if(this.isIdentity())return T+","+R;var ne=this.props;return Math.round((T*ne[0]+R*ne[4]+ne[12])*100)/100+","+Math.round((T*ne[1]+R*ne[5]+ne[13])*100)/100}function xe(){for(var T=0,R=this.props,ne="matrix3d(",X=1e4;T<16;)ne+=m(R[T]*X)/X,ne+=T===15?")":",",T+=1;return ne}function M(T){var R=1e4;return T<1e-6&&T>0||T>-1e-6&&T<0?m(T*R)/R:T}function z(){var T=this.props,R=M(T[0]),ne=M(T[1]),X=M(T[4]),Re=M(T[5]),Ue=M(T[12]),ze=M(T[13]);return"matrix("+R+","+ne+","+X+","+Re+","+Ue+","+ze+")"}return function(){this.reset=S,this.rotate=x,this.rotateX=A,this.rotateY=D,this.rotateZ=L,this.skew=V,this.skewFromAxis=ee,this.shear=B,this.scale=I,this.setTransform=H,this.translate=q,this.transform=K,this.multiply=J,this.applyToPoint=$,this.applyToX=Y,this.applyToY=Z,this.applyToZ=ae,this.applyToPointArray=Ye,this.applyToTriplePoints=Te,this.applyToPointStringified=ke,this.toCSS=xe,this.to2dCSS=z,this.clone=_,this.cloneFromProps=P,this.equals=O,this.inversePoints=De,this.inversePoint=Ke,this.getInverseMatrix=Se,this._t=this.transform,this.isIdentity=G,this._identity=!0,this._identityCalculated=!1,this.props=y("float32",16),this.reset()}}();function lt(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?lt=function(p){return typeof p}:lt=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},lt(c)}var Fe={};function tt(c){l(c)}function Ze(){Tt.searchAnimations()}function $t(c){st(c)}function xt(c){ps(c)}function Et(c){return Tt.loadAnimation(c)}function ws(c){if(typeof c=="string")switch(c){case"high":vt(200);break;default:case"medium":vt(50);break;case"low":vt(10);break}else!isNaN(c)&&c>1&&vt(c)}function Ei(){return typeof navigator<"u"}function $n(c,h){c==="expressions"&&rt(h)}function As(c){switch(c){case"propertyFactory":return Ae;case"shapePropertyFactory":return Ce;case"matrix":return Ie;default:return null}}Fe.play=Tt.play,Fe.pause=Tt.pause,Fe.setLocationHref=tt,Fe.togglePause=Tt.togglePause,Fe.setSpeed=Tt.setSpeed,Fe.setDirection=Tt.setDirection,Fe.stop=Tt.stop,Fe.searchAnimations=Ze,Fe.registerAnimation=Tt.registerAnimation,Fe.loadAnimation=Et,Fe.setSubframeRendering=$t,Fe.resize=Tt.resize,Fe.goToAndStop=Tt.goToAndStop,Fe.destroy=Tt.destroy,Fe.setQuality=ws,Fe.inBrowser=Ei,Fe.installPlugin=$n,Fe.freeze=Tt.freeze,Fe.unfreeze=Tt.unfreeze,Fe.setVolume=Tt.setVolume,Fe.mute=Tt.mute,Fe.unmute=Tt.unmute,Fe.getRegisteredAnimations=Tt.getRegisteredAnimations,Fe.useWebWorker=a,Fe.setIDPrefix=xt,Fe.__getFactory=As,Fe.version="5.12.2";function em(){document.readyState==="complete"&&(clearInterval(im),Ze())}function tm(c){for(var h=Nc.split("&"),p=0;p<h.length;p+=1){var m=h[p].split("=");if(decodeURIComponent(m[0])==c)return decodeURIComponent(m[1])}return null}var Nc="";{var Bc=document.getElementsByTagName("script"),sm=Bc.length-1,$c=Bc[sm]||{src:""};Nc=$c.src?$c.src.replace(/^[^\?]+\??/,""):"",tm("renderer")}var im=setInterval(em,100);try{lt(e)!=="object"&&(window.bodymovin=Fe)}catch{}var bi=function(){var c={},h={};c.registerModifier=p,c.getModifier=m;function p(S,x){h[S]||(h[S]=x)}function m(S,x,A){return new h[S](x,A)}return c}();function ms(){}ms.prototype.initModifierProperties=function(){},ms.prototype.addShapeToModifier=function(){},ms.prototype.addShape=function(c){if(!this.closed){c.sh.container.addDynamicProperty(c.sh);var h={shape:c.sh,data:c,localShapeCollection:Ee.newShapeCollection()};this.shapes.push(h),this.addShapeToModifier(h),this._isAnimated&&c.setAsAnimated()}},ms.prototype.init=function(c,h){this.shapes=[],this.elem=c,this.initDynamicPropertyContainer(c),this.initModifierProperties(c,h),this.frameId=n,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ms.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},f([Rt],ms);function Ls(){}f([ms],Ls),Ls.prototype.initModifierProperties=function(c,h){this.s=Ae.getProp(c,h.s,0,.01,this),this.e=Ae.getProp(c,h.e,0,.01,this),this.o=Ae.getProp(c,h.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=h.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},Ls.prototype.addShapeToModifier=function(c){c.pathsData=[]},Ls.prototype.calculateShapeEdges=function(c,h,p,m,S){var x=[];h<=1?x.push({s:c,e:h}):c>=1?x.push({s:c-1,e:h-1}):(x.push({s:c,e:1}),x.push({s:0,e:h-1}));var A=[],D,L=x.length,B;for(D=0;D<L;D+=1)if(B=x[D],!(B.e*S<m||B.s*S>m+p)){var V,ee;B.s*S<=m?V=0:V=(B.s*S-m)/p,B.e*S>=m+p?ee=1:ee=(B.e*S-m)/p,A.push([V,ee])}return A.length||A.push([0,0]),A},Ls.prototype.releasePathsData=function(c){var h,p=c.length;for(h=0;h<p;h+=1)On.release(c[h]);return c.length=0,c},Ls.prototype.processShapes=function(c){var h,p;if(this._mdf||c){var m=this.o.v%360/360;if(m<0&&(m+=1),this.s.v>1?h=1+m:this.s.v<0?h=0+m:h=this.s.v+m,this.e.v>1?p=1+m:this.e.v<0?p=0+m:p=this.e.v+m,h>p){var S=h;h=p,p=S}h=Math.round(h*1e4)*1e-4,p=Math.round(p*1e4)*1e-4,this.sValue=h,this.eValue=p}else h=this.sValue,p=this.eValue;var x,A,D=this.shapes.length,L,B,V,ee,I,H=0;if(p===h)for(A=0;A<D;A+=1)this.shapes[A].localShapeCollection.releaseShapes(),this.shapes[A].shape._mdf=!0,this.shapes[A].shape.paths=this.shapes[A].localShapeCollection,this._mdf&&(this.shapes[A].pathsData.length=0);else if(p===1&&h===0||p===0&&h===1){if(this._mdf)for(A=0;A<D;A+=1)this.shapes[A].pathsData.length=0,this.shapes[A].shape._mdf=!0}else{var q=[],K,J;for(A=0;A<D;A+=1)if(K=this.shapes[A],!K.shape._mdf&&!this._mdf&&!c&&this.m!==2)K.shape.paths=K.localShapeCollection;else{if(x=K.shape.paths,B=x._length,I=0,!K.shape._mdf&&K.pathsData.length)I=K.totalShapeLength;else{for(V=this.releasePathsData(K.pathsData),L=0;L<B;L+=1)ee=gs.getSegmentsLength(x.shapes[L]),V.push(ee),I+=ee.totalLength;K.totalShapeLength=I,K.pathsData=V}H+=I,K.shape._mdf=!0}var G=h,O=p,_=0,P;for(A=D-1;A>=0;A-=1)if(K=this.shapes[A],K.shape._mdf){for(J=K.localShapeCollection,J.releaseShapes(),this.m===2&&D>1?(P=this.calculateShapeEdges(h,p,K.totalShapeLength,_,H),_+=K.totalShapeLength):P=[[G,O]],B=P.length,L=0;L<B;L+=1){G=P[L][0],O=P[L][1],q.length=0,O<=1?q.push({s:K.totalShapeLength*G,e:K.totalShapeLength*O}):G>=1?q.push({s:K.totalShapeLength*(G-1),e:K.totalShapeLength*(O-1)}):(q.push({s:K.totalShapeLength*G,e:K.totalShapeLength}),q.push({s:0,e:K.totalShapeLength*(O-1)}));var $=this.addShapes(K,q[0]);if(q[0].s!==q[0].e){if(q.length>1){var Y=K.shape.paths.shapes[K.shape.paths._length-1];if(Y.c){var Z=$.pop();this.addPaths($,J),$=this.addShapes(K,q[1],Z)}else this.addPaths($,J),$=this.addShapes(K,q[1])}this.addPaths($,J)}}K.shape.paths=J}}},Ls.prototype.addPaths=function(c,h){var p,m=c.length;for(p=0;p<m;p+=1)h.addShape(c[p])},Ls.prototype.addSegment=function(c,h,p,m,S,x,A){S.setXYAt(h[0],h[1],"o",x),S.setXYAt(p[0],p[1],"i",x+1),A&&S.setXYAt(c[0],c[1],"v",x),S.setXYAt(m[0],m[1],"v",x+1)},Ls.prototype.addSegmentFromArray=function(c,h,p,m){h.setXYAt(c[1],c[5],"o",p),h.setXYAt(c[2],c[6],"i",p+1),m&&h.setXYAt(c[0],c[4],"v",p),h.setXYAt(c[3],c[7],"v",p+1)},Ls.prototype.addShapes=function(c,h,p){var m=c.pathsData,S=c.shape.paths.shapes,x,A=c.shape.paths._length,D,L,B=0,V,ee,I,H,q=[],K,J=!0;for(p?(ee=p._length,K=p._length):(p=Dt.newElement(),ee=0,K=0),q.push(p),x=0;x<A;x+=1){for(I=m[x].lengths,p.c=S[x].c,L=S[x].c?I.length:I.length+1,D=1;D<L;D+=1)if(V=I[D-1],B+V.addedLength<h.s)B+=V.addedLength,p.c=!1;else if(B>h.e){p.c=!1;break}else h.s<=B&&h.e>=B+V.addedLength?(this.addSegment(S[x].v[D-1],S[x].o[D-1],S[x].i[D],S[x].v[D],p,ee,J),J=!1):(H=gs.getNewSegment(S[x].v[D-1],S[x].v[D],S[x].o[D-1],S[x].i[D],(h.s-B)/V.addedLength,(h.e-B)/V.addedLength,I[D-1]),this.addSegmentFromArray(H,p,ee,J),J=!1,p.c=!1),B+=V.addedLength,ee+=1;if(S[x].c&&I.length){if(V=I[D-1],B<=h.e){var G=I[D-1].addedLength;h.s<=B&&h.e>=B+G?(this.addSegment(S[x].v[D-1],S[x].o[D-1],S[x].i[0],S[x].v[0],p,ee,J),J=!1):(H=gs.getNewSegment(S[x].v[D-1],S[x].v[0],S[x].o[D-1],S[x].i[0],(h.s-B)/G,(h.e-B)/G,I[D-1]),this.addSegmentFromArray(H,p,ee,J),J=!1,p.c=!1)}else p.c=!1;B+=V.addedLength,ee+=1}if(p._length&&(p.setXYAt(p.v[K][0],p.v[K][1],"i",K),p.setXYAt(p.v[p._length-1][0],p.v[p._length-1][1],"o",p._length-1)),B>h.e)break;x<A-1&&(p=Dt.newElement(),J=!0,q.push(p),ee=0)}return q};function qr(){}f([ms],qr),qr.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.amount=Ae.getProp(c,h.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},qr.prototype.processPath=function(c,h){var p=h/100,m=[0,0],S=c._length,x=0;for(x=0;x<S;x+=1)m[0]+=c.v[x][0],m[1]+=c.v[x][1];m[0]/=S,m[1]/=S;var A=Dt.newElement();A.c=c.c;var D,L,B,V,ee,I;for(x=0;x<S;x+=1)D=c.v[x][0]+(m[0]-c.v[x][0])*p,L=c.v[x][1]+(m[1]-c.v[x][1])*p,B=c.o[x][0]+(m[0]-c.o[x][0])*-p,V=c.o[x][1]+(m[1]-c.o[x][1])*-p,ee=c.i[x][0]+(m[0]-c.i[x][0])*-p,I=c.i[x][1]+(m[1]-c.i[x][1])*-p,A.setTripleAt(D,L,B,V,ee,I,x);return A},qr.prototype.processShapes=function(c){var h,p,m=this.shapes.length,S,x,A=this.amount.v;if(A!==0){var D,L;for(p=0;p<m;p+=1){if(D=this.shapes[p],L=D.localShapeCollection,!(!D.shape._mdf&&!this._mdf&&!c))for(L.releaseShapes(),D.shape._mdf=!0,h=D.shape.paths.shapes,x=D.shape.paths._length,S=0;S<x;S+=1)L.addShape(this.processPath(h[S],A));D.shape.paths=D.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};var lo=function(){var c=[0,0];function h(L){var B=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||B,this.a&&L.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&L.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&L.skewFromAxis(-this.sk.v,this.sa.v),this.r?L.rotate(-this.r.v):L.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?L.translate(this.px.v,this.py.v,-this.pz.v):L.translate(this.px.v,this.py.v,0):L.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}function p(L){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||L){var B;if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var V,ee;if(B=this.elem.globalData.frameRate,this.p&&this.p.keyframes&&this.p.getValueAtTime)this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(V=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/B,0),ee=this.p.getValueAtTime(this.p.keyframes[0].t/B,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(V=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/B,0),ee=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/B,0)):(V=this.p.pv,ee=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/B,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){V=[],ee=[];var I=this.px,H=this.py;I._caching.lastFrame+I.offsetTime<=I.keyframes[0].t?(V[0]=I.getValueAtTime((I.keyframes[0].t+.01)/B,0),V[1]=H.getValueAtTime((H.keyframes[0].t+.01)/B,0),ee[0]=I.getValueAtTime(I.keyframes[0].t/B,0),ee[1]=H.getValueAtTime(H.keyframes[0].t/B,0)):I._caching.lastFrame+I.offsetTime>=I.keyframes[I.keyframes.length-1].t?(V[0]=I.getValueAtTime(I.keyframes[I.keyframes.length-1].t/B,0),V[1]=H.getValueAtTime(H.keyframes[H.keyframes.length-1].t/B,0),ee[0]=I.getValueAtTime((I.keyframes[I.keyframes.length-1].t-.01)/B,0),ee[1]=H.getValueAtTime((H.keyframes[H.keyframes.length-1].t-.01)/B,0)):(V=[I.pv,H.pv],ee[0]=I.getValueAtTime((I._caching.lastFrame+I.offsetTime-.01)/B,I.offsetTime),ee[1]=H.getValueAtTime((H._caching.lastFrame+H.offsetTime-.01)/B,H.offsetTime))}else ee=c,V=ee;this.v.rotate(-Math.atan2(V[1]-ee[1],V[0]-ee[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function m(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function S(){}function x(L){this._addDynamicProperty(L),this.elem.addDynamicProperty(L),this._isDirty=!0}function A(L,B,V){if(this.elem=L,this.frameId=-1,this.propType="transform",this.data=B,this.v=new Ie,this.pre=new Ie,this.appliedTransformations=0,this.initDynamicPropertyContainer(V||L),B.p&&B.p.s?(this.px=Ae.getProp(L,B.p.x,0,0,this),this.py=Ae.getProp(L,B.p.y,0,0,this),B.p.z&&(this.pz=Ae.getProp(L,B.p.z,0,0,this))):this.p=Ae.getProp(L,B.p||{k:[0,0,0]},1,0,this),B.rx){if(this.rx=Ae.getProp(L,B.rx,0,Q,this),this.ry=Ae.getProp(L,B.ry,0,Q,this),this.rz=Ae.getProp(L,B.rz,0,Q,this),B.or.k[0].ti){var ee,I=B.or.k.length;for(ee=0;ee<I;ee+=1)B.or.k[ee].to=null,B.or.k[ee].ti=null}this.or=Ae.getProp(L,B.or,1,Q,this),this.or.sh=!0}else this.r=Ae.getProp(L,B.r||{k:0},0,Q,this);B.sk&&(this.sk=Ae.getProp(L,B.sk,0,Q,this),this.sa=Ae.getProp(L,B.sa,0,Q,this)),this.a=Ae.getProp(L,B.a||{k:[0,0,0]},1,0,this),this.s=Ae.getProp(L,B.s||{k:[100,100,100]},1,.01,this),B.o?this.o=Ae.getProp(L,B.o,0,.01,L):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}A.prototype={applyToMatrix:h,getValue:p,precalculateMatrix:m,autoOrient:S},f([Rt],A),A.prototype.addDynamicProperty=x,A.prototype._addDynamicProperty=Rt.prototype.addDynamicProperty;function D(L,B,V){return new A(L,B,V)}return{getTransformProperty:D}}();function Ns(){}f([ms],Ns),Ns.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.c=Ae.getProp(c,h.c,0,null,this),this.o=Ae.getProp(c,h.o,0,null,this),this.tr=lo.getTransformProperty(c,h.tr,this),this.so=Ae.getProp(c,h.tr.so,0,.01,this),this.eo=Ae.getProp(c,h.tr.eo,0,.01,this),this.data=h,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Ie,this.rMatrix=new Ie,this.sMatrix=new Ie,this.tMatrix=new Ie,this.matrix=new Ie},Ns.prototype.applyTransforms=function(c,h,p,m,S,x){var A=x?-1:1,D=m.s.v[0]+(1-m.s.v[0])*(1-S),L=m.s.v[1]+(1-m.s.v[1])*(1-S);c.translate(m.p.v[0]*A*S,m.p.v[1]*A*S,m.p.v[2]),h.translate(-m.a.v[0],-m.a.v[1],m.a.v[2]),h.rotate(-m.r.v*A*S),h.translate(m.a.v[0],m.a.v[1],m.a.v[2]),p.translate(-m.a.v[0],-m.a.v[1],m.a.v[2]),p.scale(x?1/D:D,x?1/L:L),p.translate(m.a.v[0],m.a.v[1],m.a.v[2])},Ns.prototype.init=function(c,h,p,m){for(this.elem=c,this.arr=h,this.pos=p,this.elemsData=m,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(c),this.initModifierProperties(c,h[p]);p>0;)p-=1,this._elements.unshift(h[p]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},Ns.prototype.resetElements=function(c){var h,p=c.length;for(h=0;h<p;h+=1)c[h]._processed=!1,c[h].ty==="gr"&&this.resetElements(c[h].it)},Ns.prototype.cloneElements=function(c){var h=JSON.parse(JSON.stringify(c));return this.resetElements(h),h},Ns.prototype.changeGroupRender=function(c,h){var p,m=c.length;for(p=0;p<m;p+=1)c[p]._render=h,c[p].ty==="gr"&&this.changeGroupRender(c[p].it,h)},Ns.prototype.processShapes=function(c){var h,p,m,S,x,A=!1;if(this._mdf||c){var D=Math.ceil(this.c.v);if(this._groups.length<D){for(;this._groups.length<D;){var L={it:this.cloneElements(this._elements),ty:"gr"};L.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,L),this._groups.splice(0,0,L),this._currentCopies+=1}this.elem.reloadShapes(),A=!0}x=0;var B;for(m=0;m<=this._groups.length-1;m+=1){if(B=x<D,this._groups[m]._render=B,this.changeGroupRender(this._groups[m].it,B),!B){var V=this.elemsData[m].it,ee=V[V.length-1];ee.transform.op.v!==0?(ee.transform.op._mdf=!0,ee.transform.op.v=0):ee.transform.op._mdf=!1}x+=1}this._currentCopies=D;var I=this.o.v,H=I%1,q=I>0?Math.floor(I):Math.ceil(I),K=this.pMatrix.props,J=this.rMatrix.props,G=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var O=0;if(I>0){for(;O<q;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),O+=1;H&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,H,!1),O+=H)}else if(I<0){for(;O>q;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),O-=1;H&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-H,!0),O-=H)}m=this.data.m===1?0:this._currentCopies-1,S=this.data.m===1?1:-1,x=this._currentCopies;for(var _,P;x;){if(h=this.elemsData[m].it,p=h[h.length-1].transform.mProps.v.props,P=p.length,h[h.length-1].transform.mProps._mdf=!0,h[h.length-1].transform.op._mdf=!0,h[h.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(m/(this._currentCopies-1)),O!==0){for((m!==0&&S===1||m!==this._currentCopies-1&&S===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(J[0],J[1],J[2],J[3],J[4],J[5],J[6],J[7],J[8],J[9],J[10],J[11],J[12],J[13],J[14],J[15]),this.matrix.transform(G[0],G[1],G[2],G[3],G[4],G[5],G[6],G[7],G[8],G[9],G[10],G[11],G[12],G[13],G[14],G[15]),this.matrix.transform(K[0],K[1],K[2],K[3],K[4],K[5],K[6],K[7],K[8],K[9],K[10],K[11],K[12],K[13],K[14],K[15]),_=0;_<P;_+=1)p[_]=this.matrix.props[_];this.matrix.reset()}else for(this.matrix.reset(),_=0;_<P;_+=1)p[_]=this.matrix.props[_];O+=1,x-=1,m+=S}}else for(x=this._currentCopies,m=0,S=1;x;)h=this.elemsData[m].it,p=h[h.length-1].transform.mProps.v.props,h[h.length-1].transform.mProps._mdf=!1,h[h.length-1].transform.op._mdf=!1,x-=1,m+=S;return A},Ns.prototype.addShape=function(){};function Yr(){}f([ms],Yr),Yr.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.rd=Ae.getProp(c,h.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},Yr.prototype.processPath=function(c,h){var p=Dt.newElement();p.c=c.c;var m,S=c._length,x,A,D,L,B,V,ee=0,I,H,q,K,J,G;for(m=0;m<S;m+=1)x=c.v[m],D=c.o[m],A=c.i[m],x[0]===D[0]&&x[1]===D[1]&&x[0]===A[0]&&x[1]===A[1]?(m===0||m===S-1)&&!c.c?(p.setTripleAt(x[0],x[1],D[0],D[1],A[0],A[1],ee),ee+=1):(m===0?L=c.v[S-1]:L=c.v[m-1],B=Math.sqrt(Math.pow(x[0]-L[0],2)+Math.pow(x[1]-L[1],2)),V=B?Math.min(B/2,h)/B:0,J=x[0]+(L[0]-x[0])*V,I=J,G=x[1]-(x[1]-L[1])*V,H=G,q=I-(I-x[0])*le,K=H-(H-x[1])*le,p.setTripleAt(I,H,q,K,J,G,ee),ee+=1,m===S-1?L=c.v[0]:L=c.v[m+1],B=Math.sqrt(Math.pow(x[0]-L[0],2)+Math.pow(x[1]-L[1],2)),V=B?Math.min(B/2,h)/B:0,q=x[0]+(L[0]-x[0])*V,I=q,K=x[1]+(L[1]-x[1])*V,H=K,J=I-(I-x[0])*le,G=H-(H-x[1])*le,p.setTripleAt(I,H,q,K,J,G,ee),ee+=1):(p.setTripleAt(c.v[m][0],c.v[m][1],c.o[m][0],c.o[m][1],c.i[m][0],c.i[m][1],ee),ee+=1);return p},Yr.prototype.processShapes=function(c){var h,p,m=this.shapes.length,S,x,A=this.rd.v;if(A!==0){var D,L;for(p=0;p<m;p+=1){if(D=this.shapes[p],L=D.localShapeCollection,!(!D.shape._mdf&&!this._mdf&&!c))for(L.releaseShapes(),D.shape._mdf=!0,h=D.shape.paths.shapes,x=D.shape.paths._length,S=0;S<x;S+=1)L.addShape(this.processPath(h[S],A));D.shape.paths=D.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function Un(c,h){return Math.abs(c-h)*1e5<=Math.min(Math.abs(c),Math.abs(h))}function co(c){return Math.abs(c)<=1e-5}function Uc(c,h,p){return c*(1-p)+h*p}function Ti(c,h,p){return[Uc(c[0],h[0],p),Uc(c[1],h[1],p)]}function rm(c,h,p){if(c===0)return[];var m=h*h-4*c*p;if(m<0)return[];var S=-h/(2*c);if(m===0)return[S];var x=Math.sqrt(m)/(2*c);return[S-x,S+x]}function Gc(c,h,p,m){return[-c+3*h-3*p+m,3*c-6*h+3*p,-3*c+3*h,c]}function Vc(c){return new wt(c,c,c,c,!1)}function wt(c,h,p,m,S){S&&vr(c,h)&&(h=Ti(c,m,1/3)),S&&vr(p,m)&&(p=Ti(c,m,2/3));var x=Gc(c[0],h[0],p[0],m[0]),A=Gc(c[1],h[1],p[1],m[1]);this.a=[x[0],A[0]],this.b=[x[1],A[1]],this.c=[x[2],A[2]],this.d=[x[3],A[3]],this.points=[c,h,p,m]}wt.prototype.point=function(c){return[((this.a[0]*c+this.b[0])*c+this.c[0])*c+this.d[0],((this.a[1]*c+this.b[1])*c+this.c[1])*c+this.d[1]]},wt.prototype.derivative=function(c){return[(3*c*this.a[0]+2*this.b[0])*c+this.c[0],(3*c*this.a[1]+2*this.b[1])*c+this.c[1]]},wt.prototype.tangentAngle=function(c){var h=this.derivative(c);return Math.atan2(h[1],h[0])},wt.prototype.normalAngle=function(c){var h=this.derivative(c);return Math.atan2(h[0],h[1])},wt.prototype.inflectionPoints=function(){var c=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(co(c))return[];var h=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/c,p=h*h-1/3*(this.b[1]*this.c[0]-this.b[0]*this.c[1])/c;if(p<0)return[];var m=Math.sqrt(p);return co(m)?m>0&&m<1?[h]:[]:[h-m,h+m].filter(function(S){return S>0&&S<1})},wt.prototype.split=function(c){if(c<=0)return[Vc(this.points[0]),this];if(c>=1)return[this,Vc(this.points[this.points.length-1])];var h=Ti(this.points[0],this.points[1],c),p=Ti(this.points[1],this.points[2],c),m=Ti(this.points[2],this.points[3],c),S=Ti(h,p,c),x=Ti(p,m,c),A=Ti(S,x,c);return[new wt(this.points[0],h,S,A,!0),new wt(A,x,m,this.points[3],!0)]};function Hc(c,h){var p=c.points[0][h],m=c.points[c.points.length-1][h];if(p>m){var S=m;m=p,p=S}for(var x=rm(3*c.a[h],2*c.b[h],c.c[h]),A=0;A<x.length;A+=1)if(x[A]>0&&x[A]<1){var D=c.point(x[A])[h];D<p?p=D:D>m&&(m=D)}return{min:p,max:m}}wt.prototype.bounds=function(){return{x:Hc(this,0),y:Hc(this,1)}},wt.prototype.boundingBox=function(){var c=this.bounds();return{left:c.x.min,right:c.x.max,top:c.y.min,bottom:c.y.max,width:c.x.max-c.x.min,height:c.y.max-c.y.min,cx:(c.x.max+c.x.min)/2,cy:(c.y.max+c.y.min)/2}};function Gn(c,h,p){var m=c.boundingBox();return{cx:m.cx,cy:m.cy,width:m.width,height:m.height,bez:c,t:(h+p)/2,t1:h,t2:p}}function jc(c){var h=c.bez.split(.5);return[Gn(h[0],c.t1,c.t),Gn(h[1],c.t,c.t2)]}function nm(c,h){return Math.abs(c.cx-h.cx)*2<c.width+h.width&&Math.abs(c.cy-h.cy)*2<c.height+h.height}function Xr(c,h,p,m,S,x){if(nm(c,h)){if(p>=x||c.width<=m&&c.height<=m&&h.width<=m&&h.height<=m){S.push([c.t,h.t]);return}var A=jc(c),D=jc(h);Xr(A[0],D[0],p+1,m,S,x),Xr(A[0],D[1],p+1,m,S,x),Xr(A[1],D[0],p+1,m,S,x),Xr(A[1],D[1],p+1,m,S,x)}}wt.prototype.intersections=function(c,h,p){h===void 0&&(h=2),p===void 0&&(p=7);var m=[];return Xr(Gn(this,0,1),Gn(c,0,1),0,h,m,p),m},wt.shapeSegment=function(c,h){var p=(h+1)%c.length();return new wt(c.v[h],c.o[h],c.i[p],c.v[p],!0)},wt.shapeSegmentInverted=function(c,h){var p=(h+1)%c.length();return new wt(c.v[p],c.i[p],c.o[h],c.v[h],!0)};function uo(c,h){return[c[1]*h[2]-c[2]*h[1],c[2]*h[0]-c[0]*h[2],c[0]*h[1]-c[1]*h[0]]}function Vn(c,h,p,m){var S=[c[0],c[1],1],x=[h[0],h[1],1],A=[p[0],p[1],1],D=[m[0],m[1],1],L=uo(uo(S,x),uo(A,D));return co(L[2])?null:[L[0]/L[2],L[1]/L[2]]}function mr(c,h,p){return[c[0]+Math.cos(h)*p,c[1]-Math.sin(h)*p]}function ho(c,h){return Math.hypot(c[0]-h[0],c[1]-h[1])}function vr(c,h){return Un(c[0],h[0])&&Un(c[1],h[1])}function Qr(){}f([ms],Qr),Qr.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.amplitude=Ae.getProp(c,h.s,0,null,this),this.frequency=Ae.getProp(c,h.r,0,null,this),this.pointsType=Ae.getProp(c,h.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function Kc(c,h,p,m,S,x,A){var D=p-Math.PI/2,L=p+Math.PI/2,B=h[0]+Math.cos(p)*m*S,V=h[1]-Math.sin(p)*m*S;c.setTripleAt(B,V,B+Math.cos(D)*x,V-Math.sin(D)*x,B+Math.cos(L)*A,V-Math.sin(L)*A,c.length())}function am(c,h){var p=[h[0]-c[0],h[1]-c[1]],m=-Math.PI*.5,S=[Math.cos(m)*p[0]-Math.sin(m)*p[1],Math.sin(m)*p[0]+Math.cos(m)*p[1]];return S}function om(c,h){var p=h===0?c.length()-1:h-1,m=(h+1)%c.length(),S=c.v[p],x=c.v[m],A=am(S,x);return Math.atan2(0,1)-Math.atan2(A[1],A[0])}function zc(c,h,p,m,S,x,A){var D=om(h,p),L=h.v[p%h._length],B=h.v[p===0?h._length-1:p-1],V=h.v[(p+1)%h._length],ee=x===2?Math.sqrt(Math.pow(L[0]-B[0],2)+Math.pow(L[1]-B[1],2)):0,I=x===2?Math.sqrt(Math.pow(L[0]-V[0],2)+Math.pow(L[1]-V[1],2)):0;Kc(c,h.v[p%h._length],D,A,m,I/((S+1)*2),ee/((S+1)*2))}function lm(c,h,p,m,S,x){for(var A=0;A<m;A+=1){var D=(A+1)/(m+1),L=S===2?Math.sqrt(Math.pow(h.points[3][0]-h.points[0][0],2)+Math.pow(h.points[3][1]-h.points[0][1],2)):0,B=h.normalAngle(D),V=h.point(D);Kc(c,V,B,x,p,L/((m+1)*2),L/((m+1)*2)),x=-x}return x}Qr.prototype.processPath=function(c,h,p,m){var S=c._length,x=Dt.newElement();if(x.c=c.c,c.c||(S-=1),S===0)return x;var A=-1,D=wt.shapeSegment(c,0);zc(x,c,0,h,p,m,A);for(var L=0;L<S;L+=1)A=lm(x,D,h,p,m,-A),L===S-1&&!c.c?D=null:D=wt.shapeSegment(c,(L+1)%S),zc(x,c,L+1,h,p,m,A);return x},Qr.prototype.processShapes=function(c){var h,p,m=this.shapes.length,S,x,A=this.amplitude.v,D=Math.max(0,Math.round(this.frequency.v)),L=this.pointsType.v;if(A!==0){var B,V;for(p=0;p<m;p+=1){if(B=this.shapes[p],V=B.localShapeCollection,!(!B.shape._mdf&&!this._mdf&&!c))for(V.releaseShapes(),B.shape._mdf=!0,h=B.shape.paths.shapes,x=B.shape.paths._length,S=0;S<x;S+=1)V.addShape(this.processPath(h[S],A,D,L));B.shape.paths=B.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function fo(c,h,p){var m=Math.atan2(h[0]-c[0],h[1]-c[1]);return[mr(c,m,p),mr(h,m,p)]}function yr(c,h){var p,m,S,x,A,D,L;L=fo(c.points[0],c.points[1],h),p=L[0],m=L[1],L=fo(c.points[1],c.points[2],h),S=L[0],x=L[1],L=fo(c.points[2],c.points[3],h),A=L[0],D=L[1];var B=Vn(p,m,S,x);B===null&&(B=m);var V=Vn(A,D,S,x);return V===null&&(V=A),new wt(p,B,V,D)}function Wc(c,h,p,m,S){var x=h.points[3],A=p.points[0];if(m===3||vr(x,A))return x;if(m===2){var D=-h.tangentAngle(1),L=-p.tangentAngle(0)+Math.PI,B=Vn(x,mr(x,D+Math.PI/2,100),A,mr(A,D+Math.PI/2,100)),V=B?ho(B,x):ho(x,A)/2,ee=mr(x,D,2*V*le);return c.setXYAt(ee[0],ee[1],"o",c.length()-1),ee=mr(A,L,2*V*le),c.setTripleAt(A[0],A[1],A[0],A[1],ee[0],ee[1],c.length()),A}var I=vr(x,h.points[2])?h.points[0]:h.points[2],H=vr(A,p.points[1])?p.points[3]:p.points[1],q=Vn(I,x,A,H);return q&&ho(q,x)<S?(c.setTripleAt(q[0],q[1],q[0],q[1],q[0],q[1],c.length()),q):x}function qc(c,h){var p=c.intersections(h);return p.length&&Un(p[0][0],1)&&p.shift(),p.length?p[0]:null}function Yc(c,h){var p=c.slice(),m=h.slice(),S=qc(c[c.length-1],h[0]);return S&&(p[c.length-1]=c[c.length-1].split(S[0])[0],m[0]=h[0].split(S[1])[1]),c.length>1&&h.length>1&&(S=qc(c[0],h[h.length-1]),S)?[[c[0].split(S[0])[0]],[h[h.length-1].split(S[1])[1]]]:[p,m]}function cm(c){for(var h,p=1;p<c.length;p+=1)h=Yc(c[p-1],c[p]),c[p-1]=h[0],c[p]=h[1];return c.length>1&&(h=Yc(c[c.length-1],c[0]),c[c.length-1]=h[0],c[0]=h[1]),c}function Xc(c,h){var p=c.inflectionPoints(),m,S,x,A;if(p.length===0)return[yr(c,h)];if(p.length===1||Un(p[1],1))return x=c.split(p[0]),m=x[0],S=x[1],[yr(m,h),yr(S,h)];x=c.split(p[0]),m=x[0];var D=(p[1]-p[0])/(1-p[0]);return x=x[1].split(D),A=x[0],S=x[1],[yr(m,h),yr(A,h),yr(S,h)]}function Jr(){}f([ms],Jr),Jr.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.amount=Ae.getProp(c,h.a,0,null,this),this.miterLimit=Ae.getProp(c,h.ml,0,null,this),this.lineJoin=h.lj,this._isAnimated=this.amount.effectsSequence.length!==0},Jr.prototype.processPath=function(c,h,p,m){var S=Dt.newElement();S.c=c.c;var x=c.length();c.c||(x-=1);var A,D,L,B=[];for(A=0;A<x;A+=1)L=wt.shapeSegment(c,A),B.push(Xc(L,h));if(!c.c)for(A=x-1;A>=0;A-=1)L=wt.shapeSegmentInverted(c,A),B.push(Xc(L,h));B=cm(B);var V=null,ee=null;for(A=0;A<B.length;A+=1){var I=B[A];for(ee&&(V=Wc(S,ee,I[0],p,m)),ee=I[I.length-1],D=0;D<I.length;D+=1)L=I[D],V&&vr(L.points[0],V)?S.setXYAt(L.points[1][0],L.points[1][1],"o",S.length()-1):S.setTripleAt(L.points[0][0],L.points[0][1],L.points[1][0],L.points[1][1],L.points[0][0],L.points[0][1],S.length()),S.setTripleAt(L.points[3][0],L.points[3][1],L.points[3][0],L.points[3][1],L.points[2][0],L.points[2][1],S.length()),V=L.points[3]}return B.length&&Wc(S,ee,B[0][0],p,m),S},Jr.prototype.processShapes=function(c){var h,p,m=this.shapes.length,S,x,A=this.amount.v,D=this.miterLimit.v,L=this.lineJoin;if(A!==0){var B,V;for(p=0;p<m;p+=1){if(B=this.shapes[p],V=B.localShapeCollection,!(!B.shape._mdf&&!this._mdf&&!c))for(V.releaseShapes(),B.shape._mdf=!0,h=B.shape.paths.shapes,x=B.shape.paths._length,S=0;S<x;S+=1)V.addShape(this.processPath(h[S],A,L,D));B.shape.paths=B.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function Qc(c){for(var h=c.fStyle?c.fStyle.split(" "):[],p="normal",m="normal",S=h.length,x,A=0;A<S;A+=1)switch(x=h[A].toLowerCase(),x){case"italic":m="italic";break;case"bold":p="700";break;case"black":p="900";break;case"medium":p="500";break;case"regular":case"normal":p="400";break;case"light":case"thin":p="200";break}return{style:m,weight:c.fWeight||p}}var ji=function(){var c=5e3,h={w:0,size:0,shapes:[],data:{shapes:[]}},p=[];p=p.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var m=127988,S=917631,x=917601,A=917626,D=65039,L=8205,B=127462,V=127487,ee=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function I(M){var z=M.split(","),T,R=z.length,ne=[];for(T=0;T<R;T+=1)z[T]!=="sans-serif"&&z[T]!=="monospace"&&ne.push(z[T]);return ne.join(",")}function H(M,z){var T=d("span");T.setAttribute("aria-hidden",!0),T.style.fontFamily=z;var R=d("span");R.innerText="giItT1WQy@!-/#",T.style.position="absolute",T.style.left="-10000px",T.style.top="-10000px",T.style.fontSize="300px",T.style.fontVariant="normal",T.style.fontStyle="normal",T.style.fontWeight="normal",T.style.letterSpacing="0",T.appendChild(R),document.body.appendChild(T);var ne=R.offsetWidth;return R.style.fontFamily=I(M)+", "+z,{node:R,w:ne,parent:T}}function q(){var M,z=this.fonts.length,T,R,ne=z;for(M=0;M<z;M+=1)this.fonts[M].loaded?ne-=1:this.fonts[M].fOrigin==="n"||this.fonts[M].origin===0?this.fonts[M].loaded=!0:(T=this.fonts[M].monoCase.node,R=this.fonts[M].monoCase.w,T.offsetWidth!==R?(ne-=1,this.fonts[M].loaded=!0):(T=this.fonts[M].sansCase.node,R=this.fonts[M].sansCase.w,T.offsetWidth!==R&&(ne-=1,this.fonts[M].loaded=!0)),this.fonts[M].loaded&&(this.fonts[M].sansCase.parent.parentNode.removeChild(this.fonts[M].sansCase.parent),this.fonts[M].monoCase.parent.parentNode.removeChild(this.fonts[M].monoCase.parent)));ne!==0&&Date.now()-this.initTime<c?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)}function K(M,z){var T=document.body&&z?"svg":"canvas",R,ne=Qc(M);if(T==="svg"){var X=Be("text");X.style.fontSize="100px",X.setAttribute("font-family",M.fFamily),X.setAttribute("font-style",ne.style),X.setAttribute("font-weight",ne.weight),X.textContent="1",M.fClass?(X.style.fontFamily="inherit",X.setAttribute("class",M.fClass)):X.style.fontFamily=M.fFamily,z.appendChild(X),R=X}else{var Re=new OffscreenCanvas(500,500).getContext("2d");Re.font=ne.style+" "+ne.weight+" 100px "+M.fFamily,R=Re}function Ue(ze){return T==="svg"?(R.textContent=ze,R.getComputedTextLength()):R.measureText(ze).width}return{measureText:Ue}}function J(M,z){if(!M){this.isLoaded=!0;return}if(this.chars){this.isLoaded=!0,this.fonts=M.list;return}if(!document.body){this.isLoaded=!0,M.list.forEach(function(Zt){Zt.helper=K(Zt),Zt.cache={}}),this.fonts=M.list;return}var T=M.list,R,ne=T.length,X=ne;for(R=0;R<ne;R+=1){var Re=!0,Ue,ze;if(T[R].loaded=!1,T[R].monoCase=H(T[R].fFamily,"monospace"),T[R].sansCase=H(T[R].fFamily,"sans-serif"),!T[R].fPath)T[R].loaded=!0,X-=1;else if(T[R].fOrigin==="p"||T[R].origin===3){if(Ue=document.querySelectorAll('style[f-forigin="p"][f-family="'+T[R].fFamily+'"], style[f-origin="3"][f-family="'+T[R].fFamily+'"]'),Ue.length>0&&(Re=!1),Re){var nt=d("style");nt.setAttribute("f-forigin",T[R].fOrigin),nt.setAttribute("f-origin",T[R].origin),nt.setAttribute("f-family",T[R].fFamily),nt.type="text/css",nt.innerText="@font-face {font-family: "+T[R].fFamily+"; font-style: normal; src: url('"+T[R].fPath+"');}",z.appendChild(nt)}}else if(T[R].fOrigin==="g"||T[R].origin===1){for(Ue=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),ze=0;ze<Ue.length;ze+=1)Ue[ze].href.indexOf(T[R].fPath)!==-1&&(Re=!1);if(Re){var at=d("link");at.setAttribute("f-forigin",T[R].fOrigin),at.setAttribute("f-origin",T[R].origin),at.type="text/css",at.rel="stylesheet",at.href=T[R].fPath,document.body.appendChild(at)}}else if(T[R].fOrigin==="t"||T[R].origin===2){for(Ue=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),ze=0;ze<Ue.length;ze+=1)T[R].fPath===Ue[ze].src&&(Re=!1);if(Re){var _t=d("link");_t.setAttribute("f-forigin",T[R].fOrigin),_t.setAttribute("f-origin",T[R].origin),_t.setAttribute("rel","stylesheet"),_t.setAttribute("href",T[R].fPath),z.appendChild(_t)}}T[R].helper=K(T[R],z),T[R].cache={},this.fonts.push(T[R])}X===0?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}function G(M){if(M){this.chars||(this.chars=[]);var z,T=M.length,R,ne=this.chars.length,X;for(z=0;z<T;z+=1){for(R=0,X=!1;R<ne;)this.chars[R].style===M[z].style&&this.chars[R].fFamily===M[z].fFamily&&this.chars[R].ch===M[z].ch&&(X=!0),R+=1;X||(this.chars.push(M[z]),ne+=1)}}}function O(M,z,T){for(var R=0,ne=this.chars.length;R<ne;){if(this.chars[R].ch===M&&this.chars[R].style===z&&this.chars[R].fFamily===T)return this.chars[R];R+=1}return(typeof M=="string"&&M.charCodeAt(0)!==13||!M)&&console&&console.warn&&!this._warned&&(this._warned=!0,console.warn("Missing character from exported characters list: ",M,z,T)),h}function _(M,z,T){var R=this.getFontByName(z),ne=M;if(!R.cache[ne]){var X=R.helper;if(M===" "){var Re=X.measureText("|"+M+"|"),Ue=X.measureText("||");R.cache[ne]=(Re-Ue)/100}else R.cache[ne]=X.measureText(M)/100}return R.cache[ne]*T}function P(M){for(var z=0,T=this.fonts.length;z<T;){if(this.fonts[z].fName===M)return this.fonts[z];z+=1}return this.fonts[0]}function $(M){var z=0,T=M.charCodeAt(0);if(T>=55296&&T<=56319){var R=M.charCodeAt(1);R>=56320&&R<=57343&&(z=(T-55296)*1024+R-56320+65536)}return z}function Y(M,z){var T=M.toString(16)+z.toString(16);return ee.indexOf(T)!==-1}function Z(M){return M===L}function ae(M){return M===D}function Se(M){var z=$(M);return z>=B&&z<=V}function Ke(M){return Se(M.substr(0,2))&&Se(M.substr(2,2))}function De(M){return p.indexOf(M)!==-1}function Te(M,z){var T=$(M.substr(z,2));if(T!==m)return!1;var R=0;for(z+=2;R<5;){if(T=$(M.substr(z,2)),T<x||T>A)return!1;R+=1,z+=2}return $(M.substr(z,2))===S}function Ye(){this.isLoaded=!0}var ke=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};ke.isModifier=Y,ke.isZeroWidthJoiner=Z,ke.isFlagEmoji=Ke,ke.isRegionalCode=Se,ke.isCombinedCharacter=De,ke.isRegionalFlag=Te,ke.isVariationSelector=ae,ke.BLACK_FLAG_CODE_POINT=m;var xe={addChars:G,addFonts:J,getCharData:O,getFontByName:P,measureText:_,checkLoadedFonts:q,setIsLoaded:Ye};return ke.prototype=xe,ke}();function Jc(c){this.animationData=c}Jc.prototype.getProp=function(c){return this.animationData.slots&&this.animationData.slots[c.sid]?Object.assign(c,this.animationData.slots[c.sid].p):c};function um(c){return new Jc(c)}function Hn(){}Hn.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(h){this.renderableComponents.indexOf(h)===-1&&this.renderableComponents.push(h)},removeRenderableComponent:function(h){this.renderableComponents.indexOf(h)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(h),1)},prepareRenderableFrame:function(h){this.checkLayerLimits(h)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(h){this.data.ip-this.data.st<=h&&this.data.op-this.data.st>h?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var h,p=this.renderableComponents.length;for(h=0;h<p;h+=1)this.renderableComponents[h].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return this.data.ty===5?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}};var po=function(){var c={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"};return function(h){return c[h]||""}}();function hm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function dm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function fm(c,h,p){this.p=Ae.getProp(h,c.v,1,0,p)}function pm(c,h,p){this.p=Ae.getProp(h,c.v,1,0,p)}function gm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function mm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function vm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function ym(){this.p={}}function Zc(c,h){var p=c.ef||[];this.effectElements=[];var m,S=p.length,x;for(m=0;m<S;m+=1)x=new Zr(p[m],h),this.effectElements.push(x)}function Zr(c,h){this.init(c,h)}f([Rt],Zr),Zr.prototype.getValue=Zr.prototype.iterateDynamicProperties,Zr.prototype.init=function(c,h){this.data=c,this.effectElements=[],this.initDynamicPropertyContainer(h);var p,m=this.data.ef.length,S,x=this.data.ef;for(p=0;p<m;p+=1){switch(S=null,x[p].ty){case 0:S=new hm(x[p],h,this);break;case 1:S=new dm(x[p],h,this);break;case 2:S=new fm(x[p],h,this);break;case 3:S=new pm(x[p],h,this);break;case 4:case 7:S=new vm(x[p],h,this);break;case 10:S=new gm(x[p],h,this);break;case 11:S=new mm(x[p],h,this);break;case 5:S=new Zc(x[p],h);break;default:S=new ym(x[p]);break}S&&this.effectElements.push(S)}};function wi(){}wi.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var h=0,p=this.data.masksProperties.length;h<p;){if(this.data.masksProperties[h].mode!=="n"&&this.data.masksProperties[h].cl!==!1)return!0;h+=1}return!1},initExpressions:function(){},setBlendMode:function(){var h=po(this.data.bm),p=this.baseElement||this.layerElement;p.style["mix-blend-mode"]=h},initBaseData:function(h,p,m){this.globalData=p,this.comp=m,this.data=h,this.layerId=we(),this.data.sr||(this.data.sr=1),this.effectsManager=new Zc(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}};function Ai(){}Ai.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(h,p){var m,S=this.dynamicProperties.length;for(m=0;m<S;m+=1)(p||this._isParent&&this.dynamicProperties[m].propType==="transform")&&(this.dynamicProperties[m].getValue(),this.dynamicProperties[m]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(h){this.dynamicProperties.indexOf(h)===-1&&this.dynamicProperties.push(h)}};function Li(c,h,p){this.initFrame(),this.initRenderable(),this.assetData=h.getAssetData(c.refId),this.footageData=h.imageLoader.getAsset(this.assetData),this.initBaseData(c,h,p)}Li.prototype.prepareFrame=function(){},f([Hn,wi,Ai],Li),Li.prototype.getBaseElement=function(){return null},Li.prototype.renderFrame=function(){},Li.prototype.destroy=function(){},Li.prototype.initExpressions=function(){},Li.prototype.getFootageData=function(){return this.footageData};function Jt(c,h,p){this.initFrame(),this.initRenderable(),this.assetData=h.getAssetData(c.refId),this.initBaseData(c,h,p),this._isPlaying=!1,this._canPlay=!1;var m=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(m),this._currentTime=0,this.globalData.audioController.addAudio(this),this._volumeMultiplier=1,this._volume=1,this._previousVolume=null,this.tm=c.tm?Ae.getProp(this,c.tm,0,h.frameRate,this):{_placeholder:!0},this.lv=Ae.getProp(this,c.au&&c.au.lv?c.au.lv:{k:[100]},1,.01,this)}Jt.prototype.prepareFrame=function(c){if(this.prepareRenderableFrame(c,!0),this.prepareProperties(c,!0),this.tm._placeholder)this._currentTime=c/this.data.sr;else{var h=this.tm.v;this._currentTime=h}this._volume=this.lv.v[0];var p=this._volume*this._volumeMultiplier;this._previousVolume!==p&&(this._previousVolume=p,this.audio.volume(p))},f([Hn,wi,Ai],Jt),Jt.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},Jt.prototype.show=function(){},Jt.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},Jt.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},Jt.prototype.resume=function(){this._canPlay=!0},Jt.prototype.setRate=function(c){this.audio.rate(c)},Jt.prototype.volume=function(c){this._volumeMultiplier=c,this._previousVolume=c*this._volume,this.audio.volume(this._previousVolume)},Jt.prototype.getBaseElement=function(){return null},Jt.prototype.destroy=function(){},Jt.prototype.sourceRectAtTime=function(){},Jt.prototype.initExpressions=function(){};function zt(){}zt.prototype.checkLayers=function(c){var h,p=this.layers.length,m;for(this.completeLayers=!0,h=p-1;h>=0;h-=1)this.elements[h]||(m=this.layers[h],m.ip-m.st<=c-this.layers[h].st&&m.op-m.st>c-this.layers[h].st&&this.buildItem(h)),this.completeLayers=this.elements[h]?this.completeLayers:!1;this.checkPendingElements()},zt.prototype.createItem=function(c){switch(c.ty){case 2:return this.createImage(c);case 0:return this.createComp(c);case 1:return this.createSolid(c);case 3:return this.createNull(c);case 4:return this.createShape(c);case 5:return this.createText(c);case 6:return this.createAudio(c);case 13:return this.createCamera(c);case 15:return this.createFootage(c);default:return this.createNull(c)}},zt.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},zt.prototype.createAudio=function(c){return new Jt(c,this.globalData,this)},zt.prototype.createFootage=function(c){return new Li(c,this.globalData,this)},zt.prototype.buildAllItems=function(){var c,h=this.layers.length;for(c=0;c<h;c+=1)this.buildItem(c);this.checkPendingElements()},zt.prototype.includeLayers=function(c){this.completeLayers=!1;var h,p=c.length,m,S=this.layers.length;for(h=0;h<p;h+=1)for(m=0;m<S;){if(this.layers[m].id===c[h].id){this.layers[m]=c[h];break}m+=1}},zt.prototype.setProjectInterface=function(c){this.globalData.projectInterface=c},zt.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},zt.prototype.buildElementParenting=function(c,h,p){for(var m=this.elements,S=this.layers,x=0,A=S.length;x<A;)S[x].ind==h&&(!m[x]||m[x]===!0?(this.buildItem(x),this.addPendingElement(c)):(p.push(m[x]),m[x].setAsParent(),S[x].parent!==void 0?this.buildElementParenting(c,S[x].parent,p):c.setHierarchy(p))),x+=1},zt.prototype.addPendingElement=function(c){this.pendingElements.push(c)},zt.prototype.searchExtraCompositions=function(c){var h,p=c.length;for(h=0;h<p;h+=1)if(c[h].xt){var m=this.createComp(c[h]);m.initExpressions(),this.globalData.projectInterface.registerComposition(m)}},zt.prototype.getElementById=function(c){var h,p=this.elements.length;for(h=0;h<p;h+=1)if(this.elements[h].data.ind===c)return this.elements[h];return null},zt.prototype.getElementByPath=function(c){var h=c.shift(),p;if(typeof h=="number")p=this.elements[h];else{var m,S=this.elements.length;for(m=0;m<S;m+=1)if(this.elements[m].data.nm===h){p=this.elements[m];break}}return c.length===0?p:p.getElementByPath(c)},zt.prototype.setupGlobalData=function(c,h){this.globalData.fontManager=new ji,this.globalData.slotManager=um(c),this.globalData.fontManager.addChars(c.chars),this.globalData.fontManager.addFonts(c.fonts,h),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.audioController=this.animationItem.audioController,this.globalData.frameId=0,this.globalData.frameRate=c.fr,this.globalData.nm=c.nm,this.globalData.compSize={w:c.w,h:c.h}};var xm={TRANSFORM_EFFECT:"transformEFfect"};function xr(){}xr.prototype={initTransform:function(){var h=new Ie;this.finalTransform={mProp:this.data.ks?lo.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:h,localMat:h,localOpacity:1},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var h,p=this.finalTransform.mat,m=0,S=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;m<S;){if(this.hierarchy[m].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}m+=1}if(this.finalTransform._matMdf)for(h=this.finalTransform.mProp.v.props,p.cloneFromProps(h),m=0;m<S;m+=1)p.multiply(this.hierarchy[m].finalTransform.mProp.v)}this.finalTransform._matMdf&&(this.finalTransform._localMatMdf=this.finalTransform._matMdf),this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v)},renderLocalTransform:function(){if(this.localTransforms){var h=0,p=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;h<p;)this.localTransforms[h]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[h]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),h+=1;if(this.finalTransform._localMatMdf){var m=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(m),h=1;h<p;h+=1){var S=this.localTransforms[h].matrix;m.multiply(S)}m.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var x=this.finalTransform.localOpacity;for(h=0;h<p;h+=1)x*=this.localTransforms[h].opacity*.01;this.finalTransform.localOpacity=x}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var h=this.renderableEffectsManager.getEffects(xm.TRANSFORM_EFFECT);if(h.length){this.localTransforms=[],this.finalTransform.localMat=new Ie;var p=0,m=h.length;for(p=0;p<m;p+=1)this.localTransforms.push(h[p])}}},globalToLocal:function(h){var p=[];p.push(this.finalTransform);for(var m=!0,S=this.comp;m;)S.finalTransform?(S.data.hasMask&&p.splice(0,0,S.finalTransform),S=S.comp):m=!1;var x,A=p.length,D;for(x=0;x<A;x+=1)D=p[x].mat.applyToPointArray(0,0,0),h=[h[0]-D[0],h[1]-D[1],0];return h},mHelper:new Ie};function Ki(c,h,p){this.data=c,this.element=h,this.globalData=p,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var m=this.globalData.defs,S,x=this.masksProperties?this.masksProperties.length:0;this.viewData=E(x),this.solidPath="";var A,D=this.masksProperties,L=0,B=[],V,ee,I=we(),H,q,K,J,G="clipPath",O="clip-path";for(S=0;S<x;S+=1)if((D[S].mode!=="a"&&D[S].mode!=="n"||D[S].inv||D[S].o.k!==100||D[S].o.x)&&(G="mask",O="mask"),(D[S].mode==="s"||D[S].mode==="i")&&L===0?(H=Be("rect"),H.setAttribute("fill","#ffffff"),H.setAttribute("width",this.element.comp.data.w||0),H.setAttribute("height",this.element.comp.data.h||0),B.push(H)):H=null,A=Be("path"),D[S].mode==="n")this.viewData[S]={op:Ae.getProp(this.element,D[S].o,0,.01,this.element),prop:Ce.getShapeProp(this.element,D[S],3),elem:A,lastPath:""},m.appendChild(A);else{L+=1,A.setAttribute("fill",D[S].mode==="s"?"#000000":"#ffffff"),A.setAttribute("clip-rule","nonzero");var _;if(D[S].x.k!==0?(G="mask",O="mask",J=Ae.getProp(this.element,D[S].x,0,null,this.element),_=we(),q=Be("filter"),q.setAttribute("id",_),K=Be("feMorphology"),K.setAttribute("operator","erode"),K.setAttribute("in","SourceGraphic"),K.setAttribute("radius","0"),q.appendChild(K),m.appendChild(q),A.setAttribute("stroke",D[S].mode==="s"?"#000000":"#ffffff")):(K=null,J=null),this.storedData[S]={elem:A,x:J,expan:K,lastPath:"",lastOperator:"",filterId:_,lastRadius:0},D[S].mode==="i"){ee=B.length;var P=Be("g");for(V=0;V<ee;V+=1)P.appendChild(B[V]);var $=Be("mask");$.setAttribute("mask-type","alpha"),$.setAttribute("id",I+"_"+L),$.appendChild(A),m.appendChild($),P.setAttribute("mask","url("+u()+"#"+I+"_"+L+")"),B.length=0,B.push(P)}else B.push(A);D[S].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[S]={elem:A,lastPath:"",op:Ae.getProp(this.element,D[S].o,0,.01,this.element),prop:Ce.getShapeProp(this.element,D[S],3),invRect:H},this.viewData[S].prop.k||this.drawPath(D[S],this.viewData[S].prop.v,this.viewData[S])}for(this.maskElement=Be(G),x=B.length,S=0;S<x;S+=1)this.maskElement.appendChild(B[S]);L>0&&(this.maskElement.setAttribute("id",I),this.element.maskedElement.setAttribute(O,"url("+u()+"#"+I+")"),m.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}Ki.prototype.getMaskProperty=function(c){return this.viewData[c].prop},Ki.prototype.renderFrame=function(c){var h=this.element.finalTransform.mat,p,m=this.masksProperties.length;for(p=0;p<m;p+=1)if((this.viewData[p].prop._mdf||c)&&this.drawPath(this.masksProperties[p],this.viewData[p].prop.v,this.viewData[p]),(this.viewData[p].op._mdf||c)&&this.viewData[p].elem.setAttribute("fill-opacity",this.viewData[p].op.v),this.masksProperties[p].mode!=="n"&&(this.viewData[p].invRect&&(this.element.finalTransform.mProp._mdf||c)&&this.viewData[p].invRect.setAttribute("transform",h.getInverseMatrix().to2dCSS()),this.storedData[p].x&&(this.storedData[p].x._mdf||c))){var S=this.storedData[p].expan;this.storedData[p].x.v<0?(this.storedData[p].lastOperator!=="erode"&&(this.storedData[p].lastOperator="erode",this.storedData[p].elem.setAttribute("filter","url("+u()+"#"+this.storedData[p].filterId+")")),S.setAttribute("radius",-this.storedData[p].x.v)):(this.storedData[p].lastOperator!=="dilate"&&(this.storedData[p].lastOperator="dilate",this.storedData[p].elem.setAttribute("filter",null)),this.storedData[p].elem.setAttribute("stroke-width",this.storedData[p].x.v*2))}},Ki.prototype.getMaskelement=function(){return this.maskElement},Ki.prototype.createLayerSolidPath=function(){var c="M0,0 ";return c+=" h"+this.globalData.compSize.w,c+=" v"+this.globalData.compSize.h,c+=" h-"+this.globalData.compSize.w,c+=" v-"+this.globalData.compSize.h+" ",c},Ki.prototype.drawPath=function(c,h,p){var m=" M"+h.v[0][0]+","+h.v[0][1],S,x;for(x=h._length,S=1;S<x;S+=1)m+=" C"+h.o[S-1][0]+","+h.o[S-1][1]+" "+h.i[S][0]+","+h.i[S][1]+" "+h.v[S][0]+","+h.v[S][1];if(h.c&&x>1&&(m+=" C"+h.o[S-1][0]+","+h.o[S-1][1]+" "+h.i[0][0]+","+h.i[0][1]+" "+h.v[0][0]+","+h.v[0][1]),p.lastPath!==m){var A="";p.elem&&(h.c&&(A=c.inv?this.solidPath+m:m),p.elem.setAttribute("d",A)),p.lastPath=m}},Ki.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var en=function(){var c={};c.createFilter=h,c.createAlphaToLuminanceFilter=p;function h(m,S){var x=Be("filter");return x.setAttribute("id",m),S!==!0&&(x.setAttribute("filterUnits","objectBoundingBox"),x.setAttribute("x","0%"),x.setAttribute("y","0%"),x.setAttribute("width","100%"),x.setAttribute("height","100%")),x}function p(){var m=Be("feColorMatrix");return m.setAttribute("type","matrix"),m.setAttribute("color-interpolation-filters","sRGB"),m.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),m}return c}(),eu=function(){var c={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(c.maskType=!1),/firefox/i.test(navigator.userAgent)&&(c.svgLumaHidden=!1),c}(),go={},tu="filter_result_";function mo(c){var h,p="SourceGraphic",m=c.data.ef?c.data.ef.length:0,S=we(),x=en.createFilter(S,!0),A=0;this.filters=[];var D;for(h=0;h<m;h+=1){D=null;var L=c.data.ef[h].ty;if(go[L]){var B=go[L].effect;D=new B(x,c.effectsManager.effectElements[h],c,tu+A,p),p=tu+A,go[L].countsAsEffect&&(A+=1)}D&&this.filters.push(D)}A&&(c.globalData.defs.appendChild(x),c.layerElement.setAttribute("filter","url("+u()+"#"+S+")")),this.filters.length&&c.addRenderableComponent(this)}mo.prototype.renderFrame=function(c){var h,p=this.filters.length;for(h=0;h<p;h+=1)this.filters[h].renderFrame(c)},mo.prototype.getEffects=function(c){var h,p=this.filters.length,m=[];for(h=0;h<p;h+=1)this.filters[h].type===c&&m.push(this.filters[h]);return m};function tn(){}tn.prototype={initRendererElement:function(){this.layerElement=Be("g")},createContainerElements:function(){this.matteElement=Be("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var h=null;if(this.data.td){this.matteMasks={};var p=Be("g");p.setAttribute("id",this.layerId),p.appendChild(this.layerElement),h=p,this.globalData.defs.appendChild(p)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),h=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.ty===0&&!this.data.hd){var m=Be("clipPath"),S=Be("path");S.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var x=we();if(m.setAttribute("id",x),m.appendChild(S),this.globalData.defs.appendChild(m),this.checkMasks()){var A=Be("g");A.setAttribute("clip-path","url("+u()+"#"+x+")"),A.appendChild(this.layerElement),this.transformedElement=A,h?h.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+u()+"#"+x+")")}this.data.bm!==0&&this.setBlendMode()},renderElement:function(){this.finalTransform._localMatMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.localMat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.localOpacity)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new Ki(this.data,this,this.globalData),this.renderableEffectsManager=new mo(this),this.searchEffectTransforms()},getMatte:function(h){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[h]){var p=this.layerId+"_"+h,m,S,x,A;if(h===1||h===3){var D=Be("mask");D.setAttribute("id",p),D.setAttribute("mask-type",h===3?"luminance":"alpha"),x=Be("use"),x.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),D.appendChild(x),this.globalData.defs.appendChild(D),!eu.maskType&&h===1&&(D.setAttribute("mask-type","luminance"),m=we(),S=en.createFilter(m),this.globalData.defs.appendChild(S),S.appendChild(en.createAlphaToLuminanceFilter()),A=Be("g"),A.appendChild(x),D.appendChild(A),A.setAttribute("filter","url("+u()+"#"+m+")"))}else if(h===2){var L=Be("mask");L.setAttribute("id",p),L.setAttribute("mask-type","alpha");var B=Be("g");L.appendChild(B),m=we(),S=en.createFilter(m);var V=Be("feComponentTransfer");V.setAttribute("in","SourceGraphic"),S.appendChild(V);var ee=Be("feFuncA");ee.setAttribute("type","table"),ee.setAttribute("tableValues","1.0 0.0"),V.appendChild(ee),this.globalData.defs.appendChild(S);var I=Be("rect");I.setAttribute("width",this.comp.data.w),I.setAttribute("height",this.comp.data.h),I.setAttribute("x","0"),I.setAttribute("y","0"),I.setAttribute("fill","#ffffff"),I.setAttribute("opacity","0"),B.setAttribute("filter","url("+u()+"#"+m+")"),B.appendChild(I),x=Be("use"),x.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),B.appendChild(x),eu.maskType||(L.setAttribute("mask-type","luminance"),S.appendChild(en.createAlphaToLuminanceFilter()),A=Be("g"),B.appendChild(I),A.appendChild(this.layerElement),B.appendChild(A)),this.globalData.defs.appendChild(L)}this.matteMasks[h]=p}return this.matteMasks[h]},setMatte:function(h){this.matteElement&&this.matteElement.setAttribute("mask","url("+u()+"#"+h+")")}};function Sr(){}Sr.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(h){this.hierarchy=h},setAsParent:function(){this._isParent=!0},checkParenting:function(){this.data.parent!==void 0&&this.comp.buildElementParenting(this,this.data.parent,[])}};function sn(){}(function(){var c={initElement:function(p,m,S){this.initFrame(),this.initBaseData(p,m,S),this.initTransform(p,m,S),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){if(!this.hidden&&(!this.isInRange||this.isTransparent)){var p=this.baseElement||this.layerElement;p.style.display="none",this.hidden=!0}},show:function(){if(this.isInRange&&!this.isTransparent){if(!this.data.hd){var p=this.baseElement||this.layerElement;p.style.display="block"}this.hidden=!1,this._isFirstFrame=!0}},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(p){this._mdf=!1,this.prepareRenderableFrame(p),this.prepareProperties(p,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}};f([Hn,g(c)],sn)})();function rn(c,h,p){this.assetData=h.getAssetData(c.refId),this.assetData&&this.assetData.sid&&(this.assetData=h.slotManager.getProp(this.assetData)),this.initElement(c,h,p),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}f([wi,xr,tn,Sr,Ai,sn],rn),rn.prototype.createContent=function(){var c=this.globalData.getAssetsPath(this.assetData);this.innerElem=Be("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",c),this.layerElement.appendChild(this.innerElem)},rn.prototype.sourceRectAtTime=function(){return this.sourceRect};function Sm(c,h){this.elem=c,this.pos=h}function su(){}su.prototype={addShapeToModifiers:function(h){var p,m=this.shapeModifiers.length;for(p=0;p<m;p+=1)this.shapeModifiers[p].addShape(h)},isShapeInAnimatedModifiers:function(h){for(var p=0,m=this.shapeModifiers.length;p<m;)if(this.shapeModifiers[p].isAnimatedWithShape(h))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var h,p=this.shapes.length;for(h=0;h<p;h+=1)this.shapes[h].sh.reset();p=this.shapeModifiers.length;var m;for(h=p-1;h>=0&&(m=this.shapeModifiers[h].processShapes(this._isFirstFrame),!m);h-=1);}},searchProcessedElement:function(h){for(var p=this.processedElements,m=0,S=p.length;m<S;){if(p[m].elem===h)return p[m].pos;m+=1}return 0},addProcessedElement:function(h,p){for(var m=this.processedElements,S=m.length;S;)if(S-=1,m[S].elem===h){m[S].pos=p;return}m.push(new Sm(h,p))},prepareFrame:function(h){this.prepareRenderableFrame(h),this.prepareProperties(h,this.isInRange)}};var iu={1:"butt",2:"round",3:"square"},ru={1:"miter",2:"round",3:"bevel"};function nu(c,h,p){this.caches=[],this.styles=[],this.transformers=c,this.lStr="",this.sh=p,this.lvl=h,this._isAnimated=!!p.k;for(var m=0,S=c.length;m<S;){if(c[m].mProps.dynamicProperties.length){this._isAnimated=!0;break}m+=1}}nu.prototype.setAsAnimated=function(){this._isAnimated=!0};function au(c,h){this.data=c,this.type=c.ty,this.d="",this.lvl=h,this._mdf=!1,this.closed=c.hd===!0,this.pElem=Be("path"),this.msElem=null}au.prototype.reset=function(){this.d="",this._mdf=!1};function jn(c,h,p,m){this.elem=c,this.frameId=-1,this.dataProps=E(h.length),this.renderer=p,this.k=!1,this.dashStr="",this.dashArray=y("float32",h.length?h.length-1:0),this.dashoffset=y("float32",1),this.initDynamicPropertyContainer(m);var S,x=h.length||0,A;for(S=0;S<x;S+=1)A=Ae.getProp(c,h[S].v,0,0,this),this.k=A.k||this.k,this.dataProps[S]={n:h[S].n,p:A};this.k||this.getValue(!0),this._isAnimated=this.k}jn.prototype.getValue=function(c){if(!(this.elem.globalData.frameId===this.frameId&&!c)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||c,this._mdf)){var h=0,p=this.dataProps.length;for(this.renderer==="svg"&&(this.dashStr=""),h=0;h<p;h+=1)this.dataProps[h].n!=="o"?this.renderer==="svg"?this.dashStr+=" "+this.dataProps[h].p.v:this.dashArray[h]=this.dataProps[h].p.v:this.dashoffset[0]=this.dataProps[h].p.v}},f([Rt],jn);function ou(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.o=Ae.getProp(c,h.o,0,.01,this),this.w=Ae.getProp(c,h.w,0,null,this),this.d=new jn(c,h.d||{},"svg",this),this.c=Ae.getProp(c,h.c,1,255,this),this.style=p,this._isAnimated=!!this._isAnimated}f([Rt],ou);function lu(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.o=Ae.getProp(c,h.o,0,.01,this),this.c=Ae.getProp(c,h.c,1,255,this),this.style=p}f([Rt],lu);function cu(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.style=p}f([Rt],cu);function nn(c,h,p){this.data=h,this.c=y("uint8c",h.p*4);var m=h.k.k[0].s?h.k.k[0].s.length-h.p*4:h.k.k.length-h.p*4;this.o=y("float32",m),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=m,this.initDynamicPropertyContainer(p),this.prop=Ae.getProp(c,h.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}nn.prototype.comparePoints=function(c,h){for(var p=0,m=this.o.length/2,S;p<m;){if(S=Math.abs(c[p*4]-c[h*4+p*2]),S>.01)return!1;p+=1}return!0},nn.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var c=0,h=this.data.k.k.length;c<h;){if(!this.comparePoints(this.data.k.k[c].s,this.data.p))return!1;c+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},nn.prototype.getValue=function(c){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||c){var h,p=this.data.p*4,m,S;for(h=0;h<p;h+=1)m=h%4===0?100:255,S=Math.round(this.prop.v[h]*m),this.c[h]!==S&&(this.c[h]=S,this._cmdf=!c);if(this.o.length)for(p=this.prop.v.length,h=this.data.p*4;h<p;h+=1)m=h%2===0?100:1,S=h%2===0?Math.round(this.prop.v[h]*100):this.prop.v[h],this.o[h-this.data.p*4]!==S&&(this.o[h-this.data.p*4]=S,this._omdf=!c);this._mdf=!c}},f([Rt],nn);function Er(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.initGradientData(c,h,p)}Er.prototype.initGradientData=function(c,h,p){this.o=Ae.getProp(c,h.o,0,.01,this),this.s=Ae.getProp(c,h.s,1,null,this),this.e=Ae.getProp(c,h.e,1,null,this),this.h=Ae.getProp(c,h.h||{k:0},0,.01,this),this.a=Ae.getProp(c,h.a||{k:0},0,Q,this),this.g=new nn(c,h.g,this),this.style=p,this.stops=[],this.setGradientData(p.pElem,h),this.setGradientOpacity(h,p),this._isAnimated=!!this._isAnimated},Er.prototype.setGradientData=function(c,h){var p=we(),m=Be(h.t===1?"linearGradient":"radialGradient");m.setAttribute("id",p),m.setAttribute("spreadMethod","pad"),m.setAttribute("gradientUnits","userSpaceOnUse");var S=[],x,A,D;for(D=h.g.p*4,A=0;A<D;A+=4)x=Be("stop"),m.appendChild(x),S.push(x);c.setAttribute(h.ty==="gf"?"fill":"stroke","url("+u()+"#"+p+")"),this.gf=m,this.cst=S},Er.prototype.setGradientOpacity=function(c,h){if(this.g._hasOpacity&&!this.g._collapsable){var p,m,S,x=Be("mask"),A=Be("path");x.appendChild(A);var D=we(),L=we();x.setAttribute("id",L);var B=Be(c.t===1?"linearGradient":"radialGradient");B.setAttribute("id",D),B.setAttribute("spreadMethod","pad"),B.setAttribute("gradientUnits","userSpaceOnUse"),S=c.g.k.k[0].s?c.g.k.k[0].s.length:c.g.k.k.length;var V=this.stops;for(m=c.g.p*4;m<S;m+=2)p=Be("stop"),p.setAttribute("stop-color","rgb(255,255,255)"),B.appendChild(p),V.push(p);A.setAttribute(c.ty==="gf"?"fill":"stroke","url("+u()+"#"+D+")"),c.ty==="gs"&&(A.setAttribute("stroke-linecap",iu[c.lc||2]),A.setAttribute("stroke-linejoin",ru[c.lj||2]),c.lj===1&&A.setAttribute("stroke-miterlimit",c.ml)),this.of=B,this.ms=x,this.ost=V,this.maskId=L,h.msElem=A}},f([Rt],Er);function uu(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.w=Ae.getProp(c,h.w,0,null,this),this.d=new jn(c,h.d||{},"svg",this),this.initGradientData(c,h,p),this._isAnimated=!!this._isAnimated}f([Er,Rt],uu);function Em(){this.it=[],this.prevViewData=[],this.gr=Be("g")}function bm(c,h,p){this.transform={mProps:c,op:h,container:p},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}var hu=function(h,p,m,S){if(p===0)return"";var x=h.o,A=h.i,D=h.v,L,B=" M"+S.applyToPointStringified(D[0][0],D[0][1]);for(L=1;L<p;L+=1)B+=" C"+S.applyToPointStringified(x[L-1][0],x[L-1][1])+" "+S.applyToPointStringified(A[L][0],A[L][1])+" "+S.applyToPointStringified(D[L][0],D[L][1]);return m&&p&&(B+=" C"+S.applyToPointStringified(x[L-1][0],x[L-1][1])+" "+S.applyToPointStringified(A[0][0],A[0][1])+" "+S.applyToPointStringified(D[0][0],D[0][1]),B+="z"),B},Tm=function(){var c=new Ie,h=new Ie,p={createRenderFunction:m};function m(ee){switch(ee.ty){case"fl":return D;case"gf":return B;case"gs":return L;case"st":return V;case"sh":case"el":case"rc":case"sr":return A;case"tr":return S;case"no":return x;default:return null}}function S(ee,I,H){(H||I.transform.op._mdf)&&I.transform.container.setAttribute("opacity",I.transform.op.v),(H||I.transform.mProps._mdf)&&I.transform.container.setAttribute("transform",I.transform.mProps.v.to2dCSS())}function x(){}function A(ee,I,H){var q,K,J,G,O,_,P=I.styles.length,$=I.lvl,Y,Z,ae,Se;for(_=0;_<P;_+=1){if(G=I.sh._mdf||H,I.styles[_].lvl<$){for(Z=h.reset(),ae=$-I.styles[_].lvl,Se=I.transformers.length-1;!G&&ae>0;)G=I.transformers[Se].mProps._mdf||G,ae-=1,Se-=1;if(G)for(ae=$-I.styles[_].lvl,Se=I.transformers.length-1;ae>0;)Z.multiply(I.transformers[Se].mProps.v),ae-=1,Se-=1}else Z=c;if(Y=I.sh.paths,K=Y._length,G){for(J="",q=0;q<K;q+=1)O=Y.shapes[q],O&&O._length&&(J+=hu(O,O._length,O.c,Z));I.caches[_]=J}else J=I.caches[_];I.styles[_].d+=ee.hd===!0?"":J,I.styles[_]._mdf=G||I.styles[_]._mdf}}function D(ee,I,H){var q=I.style;(I.c._mdf||H)&&q.pElem.setAttribute("fill","rgb("+te(I.c.v[0])+","+te(I.c.v[1])+","+te(I.c.v[2])+")"),(I.o._mdf||H)&&q.pElem.setAttribute("fill-opacity",I.o.v)}function L(ee,I,H){B(ee,I,H),V(ee,I,H)}function B(ee,I,H){var q=I.gf,K=I.g._hasOpacity,J=I.s.v,G=I.e.v;if(I.o._mdf||H){var O=ee.ty==="gf"?"fill-opacity":"stroke-opacity";I.style.pElem.setAttribute(O,I.o.v)}if(I.s._mdf||H){var _=ee.t===1?"x1":"cx",P=_==="x1"?"y1":"cy";q.setAttribute(_,J[0]),q.setAttribute(P,J[1]),K&&!I.g._collapsable&&(I.of.setAttribute(_,J[0]),I.of.setAttribute(P,J[1]))}var $,Y,Z,ae;if(I.g._cmdf||H){$=I.cst;var Se=I.g.c;for(Z=$.length,Y=0;Y<Z;Y+=1)ae=$[Y],ae.setAttribute("offset",Se[Y*4]+"%"),ae.setAttribute("stop-color","rgb("+Se[Y*4+1]+","+Se[Y*4+2]+","+Se[Y*4+3]+")")}if(K&&(I.g._omdf||H)){var Ke=I.g.o;for(I.g._collapsable?$=I.cst:$=I.ost,Z=$.length,Y=0;Y<Z;Y+=1)ae=$[Y],I.g._collapsable||ae.setAttribute("offset",Ke[Y*2]+"%"),ae.setAttribute("stop-opacity",Ke[Y*2+1])}if(ee.t===1)(I.e._mdf||H)&&(q.setAttribute("x2",G[0]),q.setAttribute("y2",G[1]),K&&!I.g._collapsable&&(I.of.setAttribute("x2",G[0]),I.of.setAttribute("y2",G[1])));else{var De;if((I.s._mdf||I.e._mdf||H)&&(De=Math.sqrt(Math.pow(J[0]-G[0],2)+Math.pow(J[1]-G[1],2)),q.setAttribute("r",De),K&&!I.g._collapsable&&I.of.setAttribute("r",De)),I.e._mdf||I.h._mdf||I.a._mdf||H){De||(De=Math.sqrt(Math.pow(J[0]-G[0],2)+Math.pow(J[1]-G[1],2)));var Te=Math.atan2(G[1]-J[1],G[0]-J[0]),Ye=I.h.v;Ye>=1?Ye=.99:Ye<=-1&&(Ye=-.99);var ke=De*Ye,xe=Math.cos(Te+I.a.v)*ke+J[0],M=Math.sin(Te+I.a.v)*ke+J[1];q.setAttribute("fx",xe),q.setAttribute("fy",M),K&&!I.g._collapsable&&(I.of.setAttribute("fx",xe),I.of.setAttribute("fy",M))}}}function V(ee,I,H){var q=I.style,K=I.d;K&&(K._mdf||H)&&K.dashStr&&(q.pElem.setAttribute("stroke-dasharray",K.dashStr),q.pElem.setAttribute("stroke-dashoffset",K.dashoffset[0])),I.c&&(I.c._mdf||H)&&q.pElem.setAttribute("stroke","rgb("+te(I.c.v[0])+","+te(I.c.v[1])+","+te(I.c.v[2])+")"),(I.o._mdf||H)&&q.pElem.setAttribute("stroke-opacity",I.o.v),(I.w._mdf||H)&&(q.pElem.setAttribute("stroke-width",I.w.v),q.msElem&&q.msElem.setAttribute("stroke-width",I.w.v))}return p}();function Lt(c,h,p){this.shapes=[],this.shapesData=c.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(c,h,p),this.prevViewData=[]}f([wi,xr,tn,su,Sr,Ai,sn],Lt),Lt.prototype.initSecondaryElement=function(){},Lt.prototype.identityMatrix=new Ie,Lt.prototype.buildExpressionInterface=function(){},Lt.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},Lt.prototype.filterUniqueShapes=function(){var c,h=this.shapes.length,p,m,S=this.stylesList.length,x,A=[],D=!1;for(m=0;m<S;m+=1){for(x=this.stylesList[m],D=!1,A.length=0,c=0;c<h;c+=1)p=this.shapes[c],p.styles.indexOf(x)!==-1&&(A.push(p),D=p._isAnimated||D);A.length>1&&D&&this.setShapesAsAnimated(A)}},Lt.prototype.setShapesAsAnimated=function(c){var h,p=c.length;for(h=0;h<p;h+=1)c[h].setAsAnimated()},Lt.prototype.createStyleElement=function(c,h){var p,m=new au(c,h),S=m.pElem;if(c.ty==="st")p=new ou(this,c,m);else if(c.ty==="fl")p=new lu(this,c,m);else if(c.ty==="gf"||c.ty==="gs"){var x=c.ty==="gf"?Er:uu;p=new x(this,c,m),this.globalData.defs.appendChild(p.gf),p.maskId&&(this.globalData.defs.appendChild(p.ms),this.globalData.defs.appendChild(p.of),S.setAttribute("mask","url("+u()+"#"+p.maskId+")"))}else c.ty==="no"&&(p=new cu(this,c,m));return(c.ty==="st"||c.ty==="gs")&&(S.setAttribute("stroke-linecap",iu[c.lc||2]),S.setAttribute("stroke-linejoin",ru[c.lj||2]),S.setAttribute("fill-opacity","0"),c.lj===1&&S.setAttribute("stroke-miterlimit",c.ml)),c.r===2&&S.setAttribute("fill-rule","evenodd"),c.ln&&S.setAttribute("id",c.ln),c.cl&&S.setAttribute("class",c.cl),c.bm&&(S.style["mix-blend-mode"]=po(c.bm)),this.stylesList.push(m),this.addToAnimatedContents(c,p),p},Lt.prototype.createGroupElement=function(c){var h=new Em;return c.ln&&h.gr.setAttribute("id",c.ln),c.cl&&h.gr.setAttribute("class",c.cl),c.bm&&(h.gr.style["mix-blend-mode"]=po(c.bm)),h},Lt.prototype.createTransformElement=function(c,h){var p=lo.getTransformProperty(this,c,this),m=new bm(p,p.o,h);return this.addToAnimatedContents(c,m),m},Lt.prototype.createShapeElement=function(c,h,p){var m=4;c.ty==="rc"?m=5:c.ty==="el"?m=6:c.ty==="sr"&&(m=7);var S=Ce.getShapeProp(this,c,m,this),x=new nu(h,p,S);return this.shapes.push(x),this.addShapeToModifiers(x),this.addToAnimatedContents(c,x),x},Lt.prototype.addToAnimatedContents=function(c,h){for(var p=0,m=this.animatedContents.length;p<m;){if(this.animatedContents[p].element===h)return;p+=1}this.animatedContents.push({fn:Tm.createRenderFunction(c),element:h,data:c})},Lt.prototype.setElementStyles=function(c){var h=c.styles,p,m=this.stylesList.length;for(p=0;p<m;p+=1)this.stylesList[p].closed||h.push(this.stylesList[p])},Lt.prototype.reloadShapes=function(){this._isFirstFrame=!0;var c,h=this.itemsData.length;for(c=0;c<h;c+=1)this.prevViewData[c]=this.itemsData[c];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),h=this.dynamicProperties.length,c=0;c<h;c+=1)this.dynamicProperties[c].getValue();this.renderModifiers()},Lt.prototype.searchShapes=function(c,h,p,m,S,x,A){var D=[].concat(x),L,B=c.length-1,V,ee,I=[],H=[],q,K,J;for(L=B;L>=0;L-=1){if(J=this.searchProcessedElement(c[L]),J?h[L]=p[J-1]:c[L]._render=A,c[L].ty==="fl"||c[L].ty==="st"||c[L].ty==="gf"||c[L].ty==="gs"||c[L].ty==="no")J?h[L].style.closed=!1:h[L]=this.createStyleElement(c[L],S),c[L]._render&&h[L].style.pElem.parentNode!==m&&m.appendChild(h[L].style.pElem),I.push(h[L].style);else if(c[L].ty==="gr"){if(!J)h[L]=this.createGroupElement(c[L]);else for(ee=h[L].it.length,V=0;V<ee;V+=1)h[L].prevViewData[V]=h[L].it[V];this.searchShapes(c[L].it,h[L].it,h[L].prevViewData,h[L].gr,S+1,D,A),c[L]._render&&h[L].gr.parentNode!==m&&m.appendChild(h[L].gr)}else c[L].ty==="tr"?(J||(h[L]=this.createTransformElement(c[L],m)),q=h[L].transform,D.push(q)):c[L].ty==="sh"||c[L].ty==="rc"||c[L].ty==="el"||c[L].ty==="sr"?(J||(h[L]=this.createShapeElement(c[L],D,S)),this.setElementStyles(h[L])):c[L].ty==="tm"||c[L].ty==="rd"||c[L].ty==="ms"||c[L].ty==="pb"||c[L].ty==="zz"||c[L].ty==="op"?(J?(K=h[L],K.closed=!1):(K=bi.getModifier(c[L].ty),K.init(this,c[L]),h[L]=K,this.shapeModifiers.push(K)),H.push(K)):c[L].ty==="rp"&&(J?(K=h[L],K.closed=!0):(K=bi.getModifier(c[L].ty),h[L]=K,K.init(this,c,L,h),this.shapeModifiers.push(K),A=!1),H.push(K));this.addProcessedElement(c[L],L+1)}for(B=I.length,L=0;L<B;L+=1)I[L].closed=!0;for(B=H.length,L=0;L<B;L+=1)H[L].closed=!0},Lt.prototype.renderInnerContent=function(){this.renderModifiers();var c,h=this.stylesList.length;for(c=0;c<h;c+=1)this.stylesList[c].reset();for(this.renderShape(),c=0;c<h;c+=1)(this.stylesList[c]._mdf||this._isFirstFrame)&&(this.stylesList[c].msElem&&(this.stylesList[c].msElem.setAttribute("d",this.stylesList[c].d),this.stylesList[c].d="M0 0"+this.stylesList[c].d),this.stylesList[c].pElem.setAttribute("d",this.stylesList[c].d||"M0 0"))},Lt.prototype.renderShape=function(){var c,h=this.animatedContents.length,p;for(c=0;c<h;c+=1)p=this.animatedContents[c],(this._isFirstFrame||p.element._isAnimated)&&p.data!==!0&&p.fn(p.data,p.element,this._isFirstFrame)},Lt.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null};function vo(c,h,p,m,S,x){this.o=c,this.sw=h,this.sc=p,this.fc=m,this.m=S,this.p=x,this._mdf={o:!0,sw:!!h,sc:!!p,fc:!!m,m:!0,p:!0}}vo.prototype.update=function(c,h,p,m,S,x){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1,this._mdf.p=!1;var A=!1;return this.o!==c&&(this.o=c,this._mdf.o=!0,A=!0),this.sw!==h&&(this.sw=h,this._mdf.sw=!0,A=!0),this.sc!==p&&(this.sc=p,this._mdf.sc=!0,A=!0),this.fc!==m&&(this.fc=m,this._mdf.fc=!0,A=!0),this.m!==S&&(this.m=S,this._mdf.m=!0,A=!0),x.length&&(this.p[0]!==x[0]||this.p[1]!==x[1]||this.p[4]!==x[4]||this.p[5]!==x[5]||this.p[12]!==x[12]||this.p[13]!==x[13])&&(this.p=x,this._mdf.p=!0,A=!0),A};function Yt(c,h){this._frameId=n,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,h.d&&h.d.sid&&(h.d=c.globalData.slotManager.getProp(h.d)),this.data=h,this.elem=c,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}Yt.prototype.defaultBoxWidth=[0,0],Yt.prototype.copyData=function(c,h){for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(c[p]=h[p]);return c},Yt.prototype.setCurrentData=function(c){c.__complete||this.completeTextData(c),this.currentData=c,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},Yt.prototype.searchProperty=function(){return this.searchKeyframes()},Yt.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},Yt.prototype.addEffect=function(c){this.effectsSequence.push(c),this.elem.addDynamicProperty(this)},Yt.prototype.getValue=function(c){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!c)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var h=this.currentData,p=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var m,S=this.effectsSequence.length,x=c||this.data.d.k[this.keysIndex].s;for(m=0;m<S;m+=1)p!==this.keysIndex?x=this.effectsSequence[m](x,x.t):x=this.effectsSequence[m](this.currentData,x.t);h!==x&&this.setCurrentData(x),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}},Yt.prototype.getKeyframeValue=function(){for(var c=this.data.d.k,h=this.elem.comp.renderedFrame,p=0,m=c.length;p<=m-1&&!(p===m-1||c[p+1].t>h);)p+=1;return this.keysIndex!==p&&(this.keysIndex=p),this.data.d.k[this.keysIndex].s},Yt.prototype.buildFinalText=function(c){for(var h=[],p=0,m=c.length,S,x,A=!1,D=!1,L="";p<m;)A=D,D=!1,S=c.charCodeAt(p),L=c.charAt(p),ji.isCombinedCharacter(S)?A=!0:S>=55296&&S<=56319?ji.isRegionalFlag(c,p)?L=c.substr(p,14):(x=c.charCodeAt(p+1),x>=56320&&x<=57343&&(ji.isModifier(S,x)?(L=c.substr(p,2),A=!0):ji.isFlagEmoji(c.substr(p,4))?L=c.substr(p,4):L=c.substr(p,2))):S>56319?(x=c.charCodeAt(p+1),ji.isVariationSelector(S)&&(A=!0)):ji.isZeroWidthJoiner(S)&&(A=!0,D=!0),A?(h[h.length-1]+=L,A=!1):h.push(L),p+=L.length;return h},Yt.prototype.completeTextData=function(c){c.__complete=!0;var h=this.elem.globalData.fontManager,p=this.data,m=[],S,x,A,D=0,L,B=p.m.g,V=0,ee=0,I=0,H=[],q=0,K=0,J,G,O=h.getFontByName(c.f),_,P=0,$=Qc(O);c.fWeight=$.weight,c.fStyle=$.style,c.finalSize=c.s,c.finalText=this.buildFinalText(c.t),x=c.finalText.length,c.finalLineHeight=c.lh;var Y=c.tr/1e3*c.finalSize,Z;if(c.sz)for(var ae=!0,Se=c.sz[0],Ke=c.sz[1],De,Te;ae;){Te=this.buildFinalText(c.t),De=0,q=0,x=Te.length,Y=c.tr/1e3*c.finalSize;var Ye=-1;for(S=0;S<x;S+=1)Z=Te[S].charCodeAt(0),A=!1,Te[S]===" "?Ye=S:(Z===13||Z===3)&&(q=0,A=!0,De+=c.finalLineHeight||c.finalSize*1.2),h.chars?(_=h.getCharData(Te[S],O.fStyle,O.fFamily),P=A?0:_.w*c.finalSize/100):P=h.measureText(Te[S],c.f,c.finalSize),q+P>Se&&Te[S]!==" "?(Ye===-1?x+=1:S=Ye,De+=c.finalLineHeight||c.finalSize*1.2,Te.splice(S,Ye===S?1:0,"\r"),Ye=-1,q=0):(q+=P,q+=Y);De+=O.ascent*c.finalSize/100,this.canResize&&c.finalSize>this.minimumFontSize&&Ke<De?(c.finalSize-=1,c.finalLineHeight=c.finalSize*c.lh/c.s):(c.finalText=Te,x=c.finalText.length,ae=!1)}q=-Y,P=0;var ke=0,xe;for(S=0;S<x;S+=1)if(A=!1,xe=c.finalText[S],Z=xe.charCodeAt(0),Z===13||Z===3?(ke=0,H.push(q),K=q>K?q:K,q=-2*Y,L="",A=!0,I+=1):L=xe,h.chars?(_=h.getCharData(xe,O.fStyle,h.getFontByName(c.f).fFamily),P=A?0:_.w*c.finalSize/100):P=h.measureText(L,c.f,c.finalSize),xe===" "?ke+=P+Y:(q+=P+Y+ke,ke=0),m.push({l:P,an:P,add:V,n:A,anIndexes:[],val:L,line:I,animatorJustifyOffset:0}),B==2){if(V+=P,L===""||L===" "||S===x-1){for((L===""||L===" ")&&(V-=P);ee<=S;)m[ee].an=V,m[ee].ind=D,m[ee].extra=P,ee+=1;D+=1,V=0}}else if(B==3){if(V+=P,L===""||S===x-1){for(L===""&&(V-=P);ee<=S;)m[ee].an=V,m[ee].ind=D,m[ee].extra=P,ee+=1;V=0,D+=1}}else m[D].ind=D,m[D].extra=0,D+=1;if(c.l=m,K=q>K?q:K,H.push(q),c.sz)c.boxWidth=c.sz[0],c.justifyOffset=0;else switch(c.boxWidth=K,c.j){case 1:c.justifyOffset=-c.boxWidth;break;case 2:c.justifyOffset=-c.boxWidth/2;break;default:c.justifyOffset=0}c.lineWidths=H;var M=p.a,z,T;G=M.length;var R,ne,X=[];for(J=0;J<G;J+=1){for(z=M[J],z.a.sc&&(c.strokeColorAnim=!0),z.a.sw&&(c.strokeWidthAnim=!0),(z.a.fc||z.a.fh||z.a.fs||z.a.fb)&&(c.fillColorAnim=!0),ne=0,R=z.s.b,S=0;S<x;S+=1)T=m[S],T.anIndexes[J]=ne,(R==1&&T.val!==""||R==2&&T.val!==""&&T.val!==" "||R==3&&(T.n||T.val==" "||S==x-1)||R==4&&(T.n||S==x-1))&&(z.s.rn===1&&X.push(ne),ne+=1);p.a[J].s.totalChars=ne;var Re=-1,Ue;if(z.s.rn===1)for(S=0;S<x;S+=1)T=m[S],Re!=T.anIndexes[J]&&(Re=T.anIndexes[J],Ue=X.splice(Math.floor(Math.random()*X.length),1)[0]),T.anIndexes[J]=Ue}c.yOffset=c.finalLineHeight||c.finalSize*1.2,c.ls=c.ls||0,c.ascent=O.ascent*c.finalSize/100},Yt.prototype.updateDocumentData=function(c,h){h=h===void 0?this.keysIndex:h;var p=this.copyData({},this.data.d.k[h].s);p=this.copyData(p,c),this.data.d.k[h].s=p,this.recalculate(h),this.setCurrentData(p),this.elem.addDynamicProperty(this)},Yt.prototype.recalculate=function(c){var h=this.data.d.k[c].s;h.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(h)},Yt.prototype.canResizeFont=function(c){this.canResize=c,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},Yt.prototype.setMinimumFontSize=function(c){this.minimumFontSize=Math.floor(c)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var wm=function(){var c=Math.max,h=Math.min,p=Math.floor;function m(x,A){this._currentTextLength=-1,this.k=!1,this.data=A,this.elem=x,this.comp=x.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(x),this.s=Ae.getProp(x,A.s||{k:0},0,0,this),"e"in A?this.e=Ae.getProp(x,A.e,0,0,this):this.e={v:100},this.o=Ae.getProp(x,A.o||{k:0},0,0,this),this.xe=Ae.getProp(x,A.xe||{k:0},0,0,this),this.ne=Ae.getProp(x,A.ne||{k:0},0,0,this),this.sm=Ae.getProp(x,A.sm||{k:100},0,0,this),this.a=Ae.getProp(x,A.a,0,.01,this),this.dynamicProperties.length||this.getValue()}m.prototype={getMult:function(A){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var D=0,L=0,B=1,V=1;this.ne.v>0?D=this.ne.v/100:L=-this.ne.v/100,this.xe.v>0?B=1-this.xe.v/100:V=1+this.xe.v/100;var ee=si.getBezierEasing(D,L,B,V).get,I=0,H=this.finalS,q=this.finalE,K=this.data.sh;if(K===2)q===H?I=A>=q?1:0:I=c(0,h(.5/(q-H)+(A-H)/(q-H),1)),I=ee(I);else if(K===3)q===H?I=A>=q?0:1:I=1-c(0,h(.5/(q-H)+(A-H)/(q-H),1)),I=ee(I);else if(K===4)q===H?I=0:(I=c(0,h(.5/(q-H)+(A-H)/(q-H),1)),I<.5?I*=2:I=1-2*(I-.5)),I=ee(I);else if(K===5){if(q===H)I=0;else{var J=q-H;A=h(c(0,A+.5-H),q-H);var G=-J/2+A,O=J/2;I=Math.sqrt(1-G*G/(O*O))}I=ee(I)}else K===6?(q===H?I=0:(A=h(c(0,A+.5-H),q-H),I=(1+Math.cos(Math.PI+Math.PI*2*A/(q-H)))/2),I=ee(I)):(A>=p(H)&&(A-H<0?I=c(0,h(h(q,1)-(H-A),1)):I=c(0,h(q-A,1))),I=ee(I));if(this.sm.v!==100){var _=this.sm.v*.01;_===0&&(_=1e-8);var P=.5-_*.5;I<P?I=0:(I=(I-P)/_,I>1&&(I=1))}return I*this.a.v},getValue:function(A){this.iterateDynamicProperties(),this._mdf=A||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,A&&this.data.r===2&&(this.e.v=this._currentTextLength);var D=this.data.r===2?1:100/this.data.totalChars,L=this.o.v/D,B=this.s.v/D+L,V=this.e.v/D+L;if(B>V){var ee=B;B=V,V=ee}this.finalS=B,this.finalE=V}},f([Rt],m);function S(x,A,D){return new m(x,A)}return{getTextSelectorProp:S}}();function Am(c,h,p){var m={propType:!1},S=Ae.getProp,x=h.a;this.a={r:x.r?S(c,x.r,0,Q,p):m,rx:x.rx?S(c,x.rx,0,Q,p):m,ry:x.ry?S(c,x.ry,0,Q,p):m,sk:x.sk?S(c,x.sk,0,Q,p):m,sa:x.sa?S(c,x.sa,0,Q,p):m,s:x.s?S(c,x.s,1,.01,p):m,a:x.a?S(c,x.a,1,0,p):m,o:x.o?S(c,x.o,0,.01,p):m,p:x.p?S(c,x.p,1,0,p):m,sw:x.sw?S(c,x.sw,0,0,p):m,sc:x.sc?S(c,x.sc,1,0,p):m,fc:x.fc?S(c,x.fc,1,0,p):m,fh:x.fh?S(c,x.fh,0,0,p):m,fs:x.fs?S(c,x.fs,0,.01,p):m,fb:x.fb?S(c,x.fb,0,.01,p):m,t:x.t?S(c,x.t,0,0,p):m},this.s=wm.getTextSelectorProp(c,h.s,p),this.s.t=h.s.t}function zi(c,h,p){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=c,this._renderType=h,this._elem=p,this._animatorsData=E(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(p)}zi.prototype.searchProperties=function(){var c,h=this._textData.a.length,p,m=Ae.getProp;for(c=0;c<h;c+=1)p=this._textData.a[c],this._animatorsData[c]=new Am(this._elem,p,this);this._textData.p&&"m"in this._textData.p?(this._pathData={a:m(this._elem,this._textData.p.a,0,0,this),f:m(this._elem,this._textData.p.f,0,0,this),l:m(this._elem,this._textData.p.l,0,0,this),r:m(this._elem,this._textData.p.r,0,0,this),p:m(this._elem,this._textData.p.p,0,0,this),m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=m(this._elem,this._textData.m.a,1,0,this)},zi.prototype.getMeasures=function(c,h){if(this.lettersChangedFlag=h,!(!this._mdf&&!this._isFirstFrame&&!h&&(!this._hasMaskedPath||!this._pathData.m._mdf))){this._isFirstFrame=!1;var p=this._moreOptions.alignment.v,m=this._animatorsData,S=this._textData,x=this.mHelper,A=this._renderType,D=this.renderedLetters.length,L,B,V,ee,I=c.l,H,q,K,J,G,O,_,P,$,Y,Z,ae,Se,Ke,De;if(this._hasMaskedPath){if(De=this._pathData.m,!this._pathData.n||this._pathData._mdf){var Te=De.v;this._pathData.r.v&&(Te=Te.reverse()),H={tLength:0,segments:[]},ee=Te._length-1;var Ye;for(ae=0,V=0;V<ee;V+=1)Ye=gs.buildBezierData(Te.v[V],Te.v[V+1],[Te.o[V][0]-Te.v[V][0],Te.o[V][1]-Te.v[V][1]],[Te.i[V+1][0]-Te.v[V+1][0],Te.i[V+1][1]-Te.v[V+1][1]]),H.tLength+=Ye.segmentLength,H.segments.push(Ye),ae+=Ye.segmentLength;V=ee,De.v.c&&(Ye=gs.buildBezierData(Te.v[V],Te.v[0],[Te.o[V][0]-Te.v[V][0],Te.o[V][1]-Te.v[V][1]],[Te.i[0][0]-Te.v[0][0],Te.i[0][1]-Te.v[0][1]]),H.tLength+=Ye.segmentLength,H.segments.push(Ye),ae+=Ye.segmentLength),this._pathData.pi=H}if(H=this._pathData.pi,q=this._pathData.f.v,_=0,O=1,J=0,G=!0,Y=H.segments,q<0&&De.v.c)for(H.tLength<Math.abs(q)&&(q=-Math.abs(q)%H.tLength),_=Y.length-1,$=Y[_].points,O=$.length-1;q<0;)q+=$[O].partialLength,O-=1,O<0&&(_-=1,$=Y[_].points,O=$.length-1);$=Y[_].points,P=$[O-1],K=$[O],Z=K.partialLength}ee=I.length,L=0,B=0;var ke=c.finalSize*1.2*.714,xe=!0,M,z,T,R,ne;R=m.length;var X,Re=-1,Ue,ze,nt,at=q,_t=_,Zt=O,Bs=-1,es,Ut,cs,dt,Pe,oi,Ri,li,$s="",ci=this.defaultPropsArray,ui;if(c.j===2||c.j===1){var ts=0,_i=0,Ii=c.j===2?-.5:-1,Cs=0,ki=!0;for(V=0;V<ee;V+=1)if(I[V].n){for(ts&&(ts+=_i);Cs<V;)I[Cs].animatorJustifyOffset=ts,Cs+=1;ts=0,ki=!0}else{for(T=0;T<R;T+=1)M=m[T].a,M.t.propType&&(ki&&c.j===2&&(_i+=M.t.v*Ii),z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?ts+=M.t.v*X[0]*Ii:ts+=M.t.v*X*Ii);ki=!1}for(ts&&(ts+=_i);Cs<V;)I[Cs].animatorJustifyOffset=ts,Cs+=1}for(V=0;V<ee;V+=1){if(x.reset(),es=1,I[V].n)L=0,B+=c.yOffset,B+=xe?1:0,q=at,xe=!1,this._hasMaskedPath&&(_=_t,O=Zt,$=Y[_].points,P=$[O-1],K=$[O],Z=K.partialLength,J=0),$s="",li="",oi="",ui="",ci=this.defaultPropsArray;else{if(this._hasMaskedPath){if(Bs!==I[V].line){switch(c.j){case 1:q+=ae-c.lineWidths[I[V].line];break;case 2:q+=(ae-c.lineWidths[I[V].line])/2;break}Bs=I[V].line}Re!==I[V].ind&&(I[Re]&&(q+=I[Re].extra),q+=I[V].an/2,Re=I[V].ind),q+=p[0]*I[V].an*.005;var Rs=0;for(T=0;T<R;T+=1)M=m[T].a,M.p.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?Rs+=M.p.v[0]*X[0]:Rs+=M.p.v[0]*X),M.a.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?Rs+=M.a.v[0]*X[0]:Rs+=M.a.v[0]*X);for(G=!0,this._pathData.a.v&&(q=I[0].an*.5+(ae-this._pathData.f.v-I[0].an*.5-I[I.length-1].an*.5)*Re/(ee-1),q+=this._pathData.f.v);G;)J+Z>=q+Rs||!$?(Se=(q+Rs-J)/K.partialLength,ze=P.point[0]+(K.point[0]-P.point[0])*Se,nt=P.point[1]+(K.point[1]-P.point[1])*Se,x.translate(-p[0]*I[V].an*.005,-(p[1]*ke)*.01),G=!1):$&&(J+=K.partialLength,O+=1,O>=$.length&&(O=0,_+=1,Y[_]?$=Y[_].points:De.v.c?(O=0,_=0,$=Y[_].points):(J-=K.partialLength,$=null)),$&&(P=K,K=$[O],Z=K.partialLength));Ue=I[V].an/2-I[V].add,x.translate(-Ue,0,0)}else Ue=I[V].an/2-I[V].add,x.translate(-Ue,0,0),x.translate(-p[0]*I[V].an*.005,-p[1]*ke*.01,0);for(T=0;T<R;T+=1)M=m[T].a,M.t.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),(L!==0||c.j!==0)&&(this._hasMaskedPath?X.length?q+=M.t.v*X[0]:q+=M.t.v*X:X.length?L+=M.t.v*X[0]:L+=M.t.v*X));for(c.strokeWidthAnim&&(cs=c.sw||0),c.strokeColorAnim&&(c.sc?Ut=[c.sc[0],c.sc[1],c.sc[2]]:Ut=[0,0,0]),c.fillColorAnim&&c.fc&&(dt=[c.fc[0],c.fc[1],c.fc[2]]),T=0;T<R;T+=1)M=m[T].a,M.a.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?x.translate(-M.a.v[0]*X[0],-M.a.v[1]*X[1],M.a.v[2]*X[2]):x.translate(-M.a.v[0]*X,-M.a.v[1]*X,M.a.v[2]*X));for(T=0;T<R;T+=1)M=m[T].a,M.s.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?x.scale(1+(M.s.v[0]-1)*X[0],1+(M.s.v[1]-1)*X[1],1):x.scale(1+(M.s.v[0]-1)*X,1+(M.s.v[1]-1)*X,1));for(T=0;T<R;T+=1){if(M=m[T].a,z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),M.sk.propType&&(X.length?x.skewFromAxis(-M.sk.v*X[0],M.sa.v*X[1]):x.skewFromAxis(-M.sk.v*X,M.sa.v*X)),M.r.propType&&(X.length?x.rotateZ(-M.r.v*X[2]):x.rotateZ(-M.r.v*X)),M.ry.propType&&(X.length?x.rotateY(M.ry.v*X[1]):x.rotateY(M.ry.v*X)),M.rx.propType&&(X.length?x.rotateX(M.rx.v*X[0]):x.rotateX(M.rx.v*X)),M.o.propType&&(X.length?es+=(M.o.v*X[0]-es)*X[0]:es+=(M.o.v*X-es)*X),c.strokeWidthAnim&&M.sw.propType&&(X.length?cs+=M.sw.v*X[0]:cs+=M.sw.v*X),c.strokeColorAnim&&M.sc.propType)for(Pe=0;Pe<3;Pe+=1)X.length?Ut[Pe]+=(M.sc.v[Pe]-Ut[Pe])*X[0]:Ut[Pe]+=(M.sc.v[Pe]-Ut[Pe])*X;if(c.fillColorAnim&&c.fc){if(M.fc.propType)for(Pe=0;Pe<3;Pe+=1)X.length?dt[Pe]+=(M.fc.v[Pe]-dt[Pe])*X[0]:dt[Pe]+=(M.fc.v[Pe]-dt[Pe])*X;M.fh.propType&&(X.length?dt=Xe(dt,M.fh.v*X[0]):dt=Xe(dt,M.fh.v*X)),M.fs.propType&&(X.length?dt=Ve(dt,M.fs.v*X[0]):dt=Ve(dt,M.fs.v*X)),M.fb.propType&&(X.length?dt=$e(dt,M.fb.v*X[0]):dt=$e(dt,M.fb.v*X))}}for(T=0;T<R;T+=1)M=m[T].a,M.p.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),this._hasMaskedPath?X.length?x.translate(0,M.p.v[1]*X[0],-M.p.v[2]*X[1]):x.translate(0,M.p.v[1]*X,-M.p.v[2]*X):X.length?x.translate(M.p.v[0]*X[0],M.p.v[1]*X[1],-M.p.v[2]*X[2]):x.translate(M.p.v[0]*X,M.p.v[1]*X,-M.p.v[2]*X));if(c.strokeWidthAnim&&(oi=cs<0?0:cs),c.strokeColorAnim&&(Ri="rgb("+Math.round(Ut[0]*255)+","+Math.round(Ut[1]*255)+","+Math.round(Ut[2]*255)+")"),c.fillColorAnim&&c.fc&&(li="rgb("+Math.round(dt[0]*255)+","+Math.round(dt[1]*255)+","+Math.round(dt[2]*255)+")"),this._hasMaskedPath){if(x.translate(0,-c.ls),x.translate(0,p[1]*ke*.01+B,0),this._pathData.p.v){Ke=(K.point[1]-P.point[1])/(K.point[0]-P.point[0]);var Wi=Math.atan(Ke)*180/Math.PI;K.point[0]<P.point[0]&&(Wi+=180),x.rotate(-Wi*Math.PI/180)}x.translate(ze,nt,0),q-=p[0]*I[V].an*.005,I[V+1]&&Re!==I[V+1].ind&&(q+=I[V].an/2,q+=c.tr*.001*c.finalSize)}else{switch(x.translate(L,B,0),c.ps&&x.translate(c.ps[0],c.ps[1]+c.ascent,0),c.j){case 1:x.translate(I[V].animatorJustifyOffset+c.justifyOffset+(c.boxWidth-c.lineWidths[I[V].line]),0,0);break;case 2:x.translate(I[V].animatorJustifyOffset+c.justifyOffset+(c.boxWidth-c.lineWidths[I[V].line])/2,0,0);break}x.translate(0,-c.ls),x.translate(Ue,0,0),x.translate(p[0]*I[V].an*.005,p[1]*ke*.01,0),L+=I[V].l+c.tr*.001*c.finalSize}A==="html"?$s=x.toCSS():A==="svg"?$s=x.to2dCSS():ci=[x.props[0],x.props[1],x.props[2],x.props[3],x.props[4],x.props[5],x.props[6],x.props[7],x.props[8],x.props[9],x.props[10],x.props[11],x.props[12],x.props[13],x.props[14],x.props[15]],ui=es}D<=V?(ne=new vo(ui,oi,Ri,li,$s,ci),this.renderedLetters.push(ne),D+=1,this.lettersChangedFlag=!0):(ne=this.renderedLetters[V],this.lettersChangedFlag=ne.update(ui,oi,Ri,li,$s,ci)||this.lettersChangedFlag)}}},zi.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},zi.prototype.mHelper=new Ie,zi.prototype.defaultPropsArray=[],f([Rt],zi);function vs(){}vs.prototype.initElement=function(c,h,p){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(c,h,p),this.textProperty=new Yt(this,c.t,this.dynamicProperties),this.textAnimator=new zi(c.t,this.renderType,this),this.initTransform(c,h,p),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},vs.prototype.prepareFrame=function(c){this._mdf=!1,this.prepareRenderableFrame(c),this.prepareProperties(c,this.isInRange)},vs.prototype.createPathShape=function(c,h){var p,m=h.length,S,x="";for(p=0;p<m;p+=1)h[p].ty==="sh"&&(S=h[p].ks.k,x+=hu(S,S.i.length,!0,c));return x},vs.prototype.updateDocumentData=function(c,h){this.textProperty.updateDocumentData(c,h)},vs.prototype.canResizeFont=function(c){this.textProperty.canResizeFont(c)},vs.prototype.setMinimumFontSize=function(c){this.textProperty.setMinimumFontSize(c)},vs.prototype.applyTextPropertiesToMatrix=function(c,h,p,m,S){switch(c.ps&&h.translate(c.ps[0],c.ps[1]+c.ascent,0),h.translate(0,-c.ls,0),c.j){case 1:h.translate(c.justifyOffset+(c.boxWidth-c.lineWidths[p]),0,0);break;case 2:h.translate(c.justifyOffset+(c.boxWidth-c.lineWidths[p])/2,0,0);break}h.translate(m,S,0)},vs.prototype.buildColor=function(c){return"rgb("+Math.round(c[0]*255)+","+Math.round(c[1]*255)+","+Math.round(c[2]*255)+")"},vs.prototype.emptyProp=new vo,vs.prototype.destroy=function(){},vs.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var Lm={shapes:[]};function ni(c,h,p){this.textSpans=[],this.renderType="svg",this.initElement(c,h,p)}f([wi,xr,tn,Sr,Ai,sn,vs],ni),ni.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=Be("text"))},ni.prototype.buildTextContents=function(c){for(var h=0,p=c.length,m=[],S="";h<p;)c[h]==="\r"||c[h]===""?(m.push(S),S=""):S+=c[h],h+=1;return m.push(S),m},ni.prototype.buildShapeData=function(c,h){if(c.shapes&&c.shapes.length){var p=c.shapes[0];if(p.it){var m=p.it[p.it.length-1];m.s&&(m.s.k[0]=h,m.s.k[1]=h)}}return c},ni.prototype.buildNewText=function(){this.addDynamicProperty(this);var c,h,p=this.textProperty.currentData;this.renderedLetters=E(p?p.l.length:0),p.fc?this.layerElement.setAttribute("fill",this.buildColor(p.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),p.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(p.sc)),this.layerElement.setAttribute("stroke-width",p.sw)),this.layerElement.setAttribute("font-size",p.finalSize);var m=this.globalData.fontManager.getFontByName(p.f);if(m.fClass)this.layerElement.setAttribute("class",m.fClass);else{this.layerElement.setAttribute("font-family",m.fFamily);var S=p.fWeight,x=p.fStyle;this.layerElement.setAttribute("font-style",x),this.layerElement.setAttribute("font-weight",S)}this.layerElement.setAttribute("aria-label",p.t);var A=p.l||[],D=!!this.globalData.fontManager.chars;h=A.length;var L,B=this.mHelper,V="",ee=this.data.singleShape,I=0,H=0,q=!0,K=p.tr*.001*p.finalSize;if(ee&&!D&&!p.sz){var J=this.textContainer,G="start";switch(p.j){case 1:G="end";break;case 2:G="middle";break;default:G="start";break}J.setAttribute("text-anchor",G),J.setAttribute("letter-spacing",K);var O=this.buildTextContents(p.finalText);for(h=O.length,H=p.ps?p.ps[1]+p.ascent:0,c=0;c<h;c+=1)L=this.textSpans[c].span||Be("tspan"),L.textContent=O[c],L.setAttribute("x",0),L.setAttribute("y",H),L.style.display="inherit",J.appendChild(L),this.textSpans[c]||(this.textSpans[c]={span:null,glyph:null}),this.textSpans[c].span=L,H+=p.finalLineHeight;this.layerElement.appendChild(J)}else{var _=this.textSpans.length,P;for(c=0;c<h;c+=1){if(this.textSpans[c]||(this.textSpans[c]={span:null,childSpan:null,glyph:null}),!D||!ee||c===0){if(L=_>c?this.textSpans[c].span:Be(D?"g":"text"),_<=c){if(L.setAttribute("stroke-linecap","butt"),L.setAttribute("stroke-linejoin","round"),L.setAttribute("stroke-miterlimit","4"),this.textSpans[c].span=L,D){var $=Be("g");L.appendChild($),this.textSpans[c].childSpan=$}this.textSpans[c].span=L,this.layerElement.appendChild(L)}L.style.display="inherit"}if(B.reset(),ee&&(A[c].n&&(I=-K,H+=p.yOffset,H+=q?1:0,q=!1),this.applyTextPropertiesToMatrix(p,B,A[c].line,I,H),I+=A[c].l||0,I+=K),D){P=this.globalData.fontManager.getCharData(p.finalText[c],m.fStyle,this.globalData.fontManager.getFontByName(p.f).fFamily);var Y;if(P.t===1)Y=new an(P.data,this.globalData,this);else{var Z=Lm;P.data&&P.data.shapes&&(Z=this.buildShapeData(P.data,p.finalSize)),Y=new Lt(Z,this.globalData,this)}if(this.textSpans[c].glyph){var ae=this.textSpans[c].glyph;this.textSpans[c].childSpan.removeChild(ae.layerElement),ae.destroy()}this.textSpans[c].glyph=Y,Y._debug=!0,Y.prepareFrame(0),Y.renderFrame(),this.textSpans[c].childSpan.appendChild(Y.layerElement),P.t===1&&this.textSpans[c].childSpan.setAttribute("transform","scale("+p.finalSize/100+","+p.finalSize/100+")")}else ee&&L.setAttribute("transform","translate("+B.props[12]+","+B.props[13]+")"),L.textContent=A[c].val,L.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}ee&&L&&L.setAttribute("d",V)}for(;c<this.textSpans.length;)this.textSpans[c].span.style.display="none",c+=1;this._sizeChanged=!0},ni.prototype.sourceRectAtTime=function(){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var c=this.layerElement.getBBox();this.bbox={top:c.y,left:c.x,width:c.width,height:c.height}}return this.bbox},ni.prototype.getValue=function(){var c,h=this.textSpans.length,p;for(this.renderedFrame=this.comp.renderedFrame,c=0;c<h;c+=1)p=this.textSpans[c].glyph,p&&(p.prepareFrame(this.comp.renderedFrame-this.data.st),p._mdf&&(this._mdf=!0))},ni.prototype.renderInnerContent=function(){if(this.validateText(),(!this.data.singleShape||this._mdf)&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){this._sizeChanged=!0;var c,h,p=this.textAnimator.renderedLetters,m=this.textProperty.currentData.l;h=m.length;var S,x,A;for(c=0;c<h;c+=1)m[c].n||(S=p[c],x=this.textSpans[c].span,A=this.textSpans[c].glyph,A&&A.renderFrame(),S._mdf.m&&x.setAttribute("transform",S.m),S._mdf.o&&x.setAttribute("opacity",S.o),S._mdf.sw&&x.setAttribute("stroke-width",S.sw),S._mdf.sc&&x.setAttribute("stroke",S.sc),S._mdf.fc&&x.setAttribute("fill",S.fc))}};function yo(c,h,p){this.initElement(c,h,p)}f([rn],yo),yo.prototype.createContent=function(){var c=Be("rect");c.setAttribute("width",this.data.sw),c.setAttribute("height",this.data.sh),c.setAttribute("fill",this.data.sc),this.layerElement.appendChild(c)};function Ci(c,h,p){this.initFrame(),this.initBaseData(c,h,p),this.initFrame(),this.initTransform(c,h,p),this.initHierarchy()}Ci.prototype.prepareFrame=function(c){this.prepareProperties(c,!0)},Ci.prototype.renderFrame=function(){},Ci.prototype.getBaseElement=function(){return null},Ci.prototype.destroy=function(){},Ci.prototype.sourceRectAtTime=function(){},Ci.prototype.hide=function(){},f([wi,xr,Sr,Ai],Ci);function Mt(){}f([zt],Mt),Mt.prototype.createNull=function(c){return new Ci(c,this.globalData,this)},Mt.prototype.createShape=function(c){return new Lt(c,this.globalData,this)},Mt.prototype.createText=function(c){return new ni(c,this.globalData,this)},Mt.prototype.createImage=function(c){return new rn(c,this.globalData,this)},Mt.prototype.createSolid=function(c){return new yo(c,this.globalData,this)},Mt.prototype.configAnimation=function(c){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.svgElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+c.w+" "+c.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",c.w),this.svgElement.setAttribute("height",c.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)",this.svgElement.style.contentVisibility=this.renderConfig.contentVisibility),this.renderConfig.width&&this.svgElement.setAttribute("width",this.renderConfig.width),this.renderConfig.height&&this.svgElement.setAttribute("height",this.renderConfig.height),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),this.renderConfig.focusable!==void 0&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var h=this.globalData.defs;this.setupGlobalData(c,h),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=c;var p=Be("clipPath"),m=Be("rect");m.setAttribute("width",c.w),m.setAttribute("height",c.h),m.setAttribute("x",0),m.setAttribute("y",0);var S=we();p.setAttribute("id",S),p.appendChild(m),this.layerElement.setAttribute("clip-path","url("+u()+"#"+S+")"),h.appendChild(p),this.layers=c.layers,this.elements=E(c.layers.length)},Mt.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var c,h=this.layers?this.layers.length:0;for(c=0;c<h;c+=1)this.elements[c]&&this.elements[c].destroy&&this.elements[c].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},Mt.prototype.updateContainerSize=function(){},Mt.prototype.findIndexByInd=function(c){var h=0,p=this.layers.length;for(h=0;h<p;h+=1)if(this.layers[h].ind===c)return h;return-1},Mt.prototype.buildItem=function(c){var h=this.elements;if(!(h[c]||this.layers[c].ty===99)){h[c]=!0;var p=this.createItem(this.layers[c]);if(h[c]=p,Je()&&(this.layers[c].ty===0&&this.globalData.projectInterface.registerComposition(p),p.initExpressions()),this.appendElementInPos(p,c),this.layers[c].tt){var m="tp"in this.layers[c]?this.findIndexByInd(this.layers[c].tp):c-1;if(m===-1)return;if(!this.elements[m]||this.elements[m]===!0)this.buildItem(m),this.addPendingElement(p);else{var S=h[m],x=S.getMatte(this.layers[c].tt);p.setMatte(x)}}}},Mt.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var c=this.pendingElements.pop();if(c.checkParenting(),c.data.tt)for(var h=0,p=this.elements.length;h<p;){if(this.elements[h]===c){var m="tp"in c.data?this.findIndexByInd(c.data.tp):h-1,S=this.elements[m],x=S.getMatte(this.layers[h].tt);c.setMatte(x);break}h+=1}}},Mt.prototype.renderFrame=function(c){if(!(this.renderedFrame===c||this.destroyed)){c===null?c=this.renderedFrame:this.renderedFrame=c,this.globalData.frameNum=c,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=c,this.globalData._mdf=!1;var h,p=this.layers.length;for(this.completeLayers||this.checkLayers(c),h=p-1;h>=0;h-=1)(this.completeLayers||this.elements[h])&&this.elements[h].prepareFrame(c-this.layers[h].st);if(this.globalData._mdf)for(h=0;h<p;h+=1)(this.completeLayers||this.elements[h])&&this.elements[h].renderFrame()}},Mt.prototype.appendElementInPos=function(c,h){var p=c.getBaseElement();if(p){for(var m=0,S;m<h;)this.elements[m]&&this.elements[m]!==!0&&this.elements[m].getBaseElement()&&(S=this.elements[m].getBaseElement()),m+=1;S?this.layerElement.insertBefore(p,S):this.layerElement.appendChild(p)}},Mt.prototype.hide=function(){this.layerElement.style.display="none"},Mt.prototype.show=function(){this.layerElement.style.display="block"};function ai(){}f([wi,xr,Sr,Ai,sn],ai),ai.prototype.initElement=function(c,h,p){this.initFrame(),this.initBaseData(c,h,p),this.initTransform(c,h,p),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),(this.data.xt||!h.progressiveLoad)&&this.buildAllItems(),this.hide()},ai.prototype.prepareFrame=function(c){if(this._mdf=!1,this.prepareRenderableFrame(c),this.prepareProperties(c,this.isInRange),!(!this.isInRange&&!this.data.xt)){if(this.tm._placeholder)this.renderedFrame=c/this.data.sr;else{var h=this.tm.v;h===this.data.op&&(h=this.data.op-1),this.renderedFrame=h}var p,m=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),p=m-1;p>=0;p-=1)(this.completeLayers||this.elements[p])&&(this.elements[p].prepareFrame(this.renderedFrame-this.layers[p].st),this.elements[p]._mdf&&(this._mdf=!0))}},ai.prototype.renderInnerContent=function(){var c,h=this.layers.length;for(c=0;c<h;c+=1)(this.completeLayers||this.elements[c])&&this.elements[c].renderFrame()},ai.prototype.setElements=function(c){this.elements=c},ai.prototype.getElements=function(){return this.elements},ai.prototype.destroyElements=function(){var c,h=this.layers.length;for(c=0;c<h;c+=1)this.elements[c]&&this.elements[c].destroy()},ai.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()};function an(c,h,p){this.layers=c.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?E(this.layers.length):[],this.initElement(c,h,p),this.tm=c.tm?Ae.getProp(this,c.tm,0,h.frameRate,this):{_placeholder:!0}}f([Mt,ai,tn],an),an.prototype.createComp=function(c){return new an(c,this.globalData,this)};function xo(c,h){this.animationItem=c,this.layers=null,this.renderedFrame=-1,this.svgElement=Be("svg");var p="";if(h&&h.title){var m=Be("title"),S=we();m.setAttribute("id",S),m.textContent=h.title,this.svgElement.appendChild(m),p+=S}if(h&&h.description){var x=Be("desc"),A=we();x.setAttribute("id",A),x.textContent=h.description,this.svgElement.appendChild(x),p+=" "+A}p&&this.svgElement.setAttribute("aria-labelledby",p);var D=Be("defs");this.svgElement.appendChild(D);var L=Be("g");this.svgElement.appendChild(L),this.layerElement=L,this.renderConfig={preserveAspectRatio:h&&h.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:h&&h.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:h&&h.contentVisibility||"visible",progressiveLoad:h&&h.progressiveLoad||!1,hideOnTransparent:!(h&&h.hideOnTransparent===!1),viewBoxOnly:h&&h.viewBoxOnly||!1,viewBoxSize:h&&h.viewBoxSize||!1,className:h&&h.className||"",id:h&&h.id||"",focusable:h&&h.focusable,filterSize:{width:h&&h.filterSize&&h.filterSize.width||"100%",height:h&&h.filterSize&&h.filterSize.height||"100%",x:h&&h.filterSize&&h.filterSize.x||"0%",y:h&&h.filterSize&&h.filterSize.y||"0%"},width:h&&h.width,height:h&&h.height,runExpressions:!h||h.runExpressions===void 0||h.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:D,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}return f([Mt],xo),xo.prototype.createComp=function(c){return new an(c,this.globalData,this)},ur("svg",xo),bi.registerModifier("tm",Ls),bi.registerModifier("pb",qr),bi.registerModifier("rp",Ns),bi.registerModifier("rd",Yr),bi.registerModifier("zz",Qr),bi.registerModifier("op",Jr),Fe})})($l,$l.exports);var vC=$l.exports;const yC=Rm(vC);function xC({loop:i=!1,path:e,animationData:t,className:s,onComplete:r,onError:n}){const a=fe.useRef(null),[o,l]=fe.useState(!1);return fe.useEffect(()=>{if(!a.current)return;l(!1);const u=yC.loadAnimation({container:a.current,renderer:"svg",autoplay:!0,loop:i,path:e,animationData:t}),d=()=>{l(!0),n==null||n()},f=()=>{r==null||r()};return u.addEventListener("data_failed",d),u.addEventListener("complete",f),()=>{u.removeEventListener("data_failed",d),u.removeEventListener("complete",f),u.destroy()}},[i,e,t]),o?null:Ne.jsx("div",{ref:a,className:s})}const SC="5.5.7",EC=30,bC=0,TC=31,wC=360,AC=360,LC="forward right",CC=0,RC=[],_C=[{ddd:0,ind:1,ty:4,nm:"Layer 2",sr:1,ks:{o:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:0,s:[0]},{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:10,s:[100]},{t:20,s:[0]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[161.086,180,0],ix:2},a:{a:0,k:[-18.914,0,0],ix:1},s:{a:0,k:[100,100,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,.923],[0,0],[-.777,-.499],[0,0],[.714,-.459],[0,0]],o:[[0,0],[0,-.923],[0,0],[.714,.459],[0,0],[-.777,.499]],v:[[-26.586,8.363],[-26.586,-8.363],[-24.788,-9.344],[-11.779,-.981],[-11.779,.981],[-24.788,9.344]],c:!0},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:!1},{ty:"fl",c:{a:0,k:[1,1,1,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"Fill 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Group 1",np:2,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:300,st:0,bm:0},{ddd:0,ind:2,ty:4,nm:"Layer 1",sr:1,ks:{o:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:5,s:[0]},{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:15,s:[100]},{t:25,s:[0]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[179.914,180,0],ix:2},a:{a:0,k:[-.086,0,0],ix:1},s:{a:0,k:[100,100,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,.923],[0,0],[-.777,-.499],[0,0],[.714,-.459],[0,0]],o:[[0,0],[0,-.923],[0,0],[.714,.459],[0,0],[-.777,.499]],v:[[-7.757,8.363],[-7.757,-8.363],[-5.959,-9.344],[7.05,-.981],[7.05,.981],[-5.959,9.344]],c:!0},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:!1},{ty:"fl",c:{a:0,k:[1,1,1,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"Fill 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Group 1",np:2,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:300,st:0,bm:0},{ddd:0,ind:3,ty:4,nm:"Layer 3",sr:1,ks:{o:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:10,s:[0]},{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:20,s:[100]},{t:30,s:[0]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[198.914,180,0],ix:2},a:{a:0,k:[18.914,0,0],ix:1},s:{a:0,k:[100,100,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,.923],[0,0],[-.777,-.499],[0,0],[.714,-.459],[0,0]],o:[[0,0],[0,-.923],[0,0],[.714,.459],[0,0],[-.777,.499]],v:[[11.243,8.363],[11.243,-8.363],[13.041,-9.344],[26.05,-.981],[26.05,.981],[13.041,9.344]],c:!0},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:!1},{ty:"fl",c:{a:0,k:[1,1,1,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"Fill 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Group 1",np:2,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:300,st:0,bm:0}],IC=[],kC={v:SC,fr:EC,ip:bC,op:TC,w:wC,h:AC,nm:LC,ddd:CC,assets:RC,layers:_C,markers:IC},PC="_root_1v1it_1",DC="_chapter_img_1v1it_20",MC="_name_1v1it_26",FC="_time_1v1it_37",pa={root:PC,chapter_img:DC,name:MC,time:FC};function OC({width:i,height:e,src:t,alt:s,draggable:r=!1,className:n}){return Ne.jsxs("picture",{children:[Ne.jsx("source",{type:"image/webp",srcSet:`${$d({f:"webp",h:e?e*2:void 0,w:i?i*2:void 0},t)}`,height:e}),Ne.jsx("img",{src:`${$d({h:e?e*2:void 0,w:i?i*2:void 0},t)}`,alt:s,draggable:r,width:i,height:e,className:n})]})}function NC({name:i,time:e,imageUrl:t,className:s,onClick:r}){return Ne.jsxs("div",{className:`${pa.root} ${s||""}`,onClick:r,children:[Ne.jsx(OC,{className:pa.chapter_img,src:t,width:90,height:130,alt:"챕터 이미지"}),Ne.jsx("div",{className:pa.name,children:i}),Ne.jsx("div",{className:pa.time,children:e})]})}const BC=fe.forwardRef(({src:i,ratio:e=!1,shadow:t=!0,controls:s=!0,posterSrc:r,initialTime:n,timeOffsetStart:a,timeOffsetEnd:o,quality:l,chapter:u,debug:d,loop:f,live:g,renderControls:v,onClick:y,onInit:E,onDestroy:b,onSync:w,className:F},k)=>{const[U,N]=fh(!1),[te,j]=fh(!1),[re,Q]=T1("",650),{ref:le,live:se,time:pe,play:de,playbackRate:be,handleSeektime:Le,handleBackward:ue,handleForward:he,handlePlayToggle:we,handlePlaybackRate:me}=oC({src:i,timeUpdateEvent:U,initialTime:n,timeOffsetStart:a,timeOffsetEnd:o,quality:l,debug:d,onSync:w,onInit:E,onDestroy:b}),ye=b1({onClick:N,onDoubleClick:et=>{if(g||se)return;const rt=et.target.getBoundingClientRect(),Je=rt.left+rt.width/2;et.clientX<Je?(ue(),Q("left")):(he(),Q("right"))}}),Ve=(et,rt)=>{if(et.stopPropagation(),!le.current)return;const Je=rt*((o??le.current.duration)-(a??0))/100;Le(Je)},$e=()=>{j()},Xe=et=>rt=>{rt.stopPropagation(),et()};fe.useEffect(()=>{y==null||y(U)},[U,y]);const st=!(g||se);return Ne.jsxs("div",{ref:k,className:`${bt.root} ${F||""}`,children:[Ne.jsx("video",{className:`${bt.video} ${e?bt.origin_ratio:""}`,ref:le,muted:!0,playsInline:!0,loop:f}),r&&Ne.jsx("div",{className:`${bt.poster} ${e?bt.origin_ratio:""}`,style:{backgroundImage:`url("${r}?h=1600&f=webp")`}}),Ne.jsxs("div",{className:`${bt.layer} ${t?bt.shadow:""}`,onClick:ye,children:[re&&Ne.jsx("div",{className:`${bt.indicator} ${bt[`indicator_${re}`]}`,children:Ne.jsx(xC,{animationData:kC,loop:!0})}),s&&U&&Ne.jsxs(Ne.Fragment,{children:[st&&Ne.jsx(Ug,{handle:!0,className:bt.progress,progress:pe.progress,onChangeProgress:Ve}),st&&Ne.jsx(mC,{className:bt.time,currentTime:pe.currentTime,durationTime:pe.durationTime}),st&&Ne.jsxs("button",{className:`${bt.button} ${bt.playbackrate}`,onClick:Xe(me),"aria-label":"비디오 배속",children:[be,"x"]}),Ne.jsx("button",{className:`${bt.button} ${bt.play_toggle}`,onClick:Xe(we),"aria-label":"비디오 재생","aria-pressed":de,children:Ne.jsx(Go,{name:de?"pause":"play"})}),st&&Ne.jsx("button",{className:`${bt.button} ${bt.backward}`,onClick:Xe(ue),"aria-label":"비디오 10초 뒤로",children:Ne.jsx(Go,{name:"backward"})}),st&&Ne.jsx("button",{className:`${bt.button} ${bt.forward}`,onClick:Xe(he),"aria-label":"비디오 10초 앞으로",children:Ne.jsx(Go,{name:"forward"})}),!!u&&st&&Ne.jsx("button",{className:`${bt.button} ${bt.chapter_toggle}`,"aria-label":"비디오 챕터",onClick:Xe($e),children:Kt.t("chapter")}),!!u&&te&&Ne.jsx("div",{className:bt.chapter_wrap,children:u==null?void 0:u.map(et=>Ne.jsx(NC,{...et,onClick:Xe(()=>Le(gC(et.time)))},et.id))})]}),U&&(v==null?void 0:v({time:pe,play:de,handlePlayToggle:we,handleChangeProgress:Ve}))]})]})});function Ud(i){return i!==null&&typeof i=="object"&&"constructor"in i&&i.constructor===Object}function Fc(i,e){i===void 0&&(i={}),e===void 0&&(e={}),Object.keys(e).forEach(t=>{typeof i[t]>"u"?i[t]=e[t]:Ud(e[t])&&Ud(i[t])&&Object.keys(e[t]).length>0&&Fc(i[t],e[t])})}const Gg={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function lr(){const i=typeof document<"u"?document:{};return Fc(i,Gg),i}const $C={document:Gg,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(i){return typeof setTimeout>"u"?(i(),null):setTimeout(i,0)},cancelAnimationFrame(i){typeof setTimeout>"u"||clearTimeout(i)}};function fs(){const i=typeof window<"u"?window:{};return Fc(i,$C),i}function UC(i){const e=i;Object.keys(e).forEach(t=>{try{e[t]=null}catch{}try{delete e[t]}catch{}})}function Ul(i,e){return e===void 0&&(e=0),setTimeout(i,e)}function Ya(){return Date.now()}function GC(i){const e=fs();let t;return e.getComputedStyle&&(t=e.getComputedStyle(i,null)),!t&&i.currentStyle&&(t=i.currentStyle),t||(t=i.style),t}function VC(i,e){e===void 0&&(e="x");const t=fs();let s,r,n;const a=GC(i);return t.WebKitCSSMatrix?(r=a.transform||a.webkitTransform,r.split(",").length>6&&(r=r.split(", ").map(o=>o.replace(",",".")).join(", ")),n=new t.WebKitCSSMatrix(r==="none"?"":r)):(n=a.MozTransform||a.OTransform||a.MsTransform||a.msTransform||a.transform||a.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),s=n.toString().split(",")),e==="x"&&(t.WebKitCSSMatrix?r=n.m41:s.length===16?r=parseFloat(s[12]):r=parseFloat(s[4])),e==="y"&&(t.WebKitCSSMatrix?r=n.m42:s.length===16?r=parseFloat(s[13]):r=parseFloat(s[5])),r||0}function ga(i){return typeof i=="object"&&i!==null&&i.constructor&&Object.prototype.toString.call(i).slice(8,-1)==="Object"}function HC(i){return typeof window<"u"&&typeof window.HTMLElement<"u"?i instanceof HTMLElement:i&&(i.nodeType===1||i.nodeType===11)}function us(){const i=Object(arguments.length<=0?void 0:arguments[0]),e=["__proto__","constructor","prototype"];for(let t=1;t<arguments.length;t+=1){const s=t<0||arguments.length<=t?void 0:arguments[t];if(s!=null&&!HC(s)){const r=Object.keys(Object(s)).filter(n=>e.indexOf(n)<0);for(let n=0,a=r.length;n<a;n+=1){const o=r[n],l=Object.getOwnPropertyDescriptor(s,o);l!==void 0&&l.enumerable&&(ga(i[o])&&ga(s[o])?s[o].__swiper__?i[o]=s[o]:us(i[o],s[o]):!ga(i[o])&&ga(s[o])?(i[o]={},s[o].__swiper__?i[o]=s[o]:us(i[o],s[o])):i[o]=s[o])}}}return i}function ma(i,e,t){i.style.setProperty(e,t)}function Vg(i){let{swiper:e,targetPosition:t,side:s}=i;const r=fs(),n=-e.translate;let a=null,o;const l=e.params.speed;e.wrapperEl.style.scrollSnapType="none",r.cancelAnimationFrame(e.cssModeFrameID);const u=t>n?"next":"prev",d=(g,v)=>u==="next"&&g>=v||u==="prev"&&g<=v,f=()=>{o=new Date().getTime(),a===null&&(a=o);const g=Math.max(Math.min((o-a)/l,1),0),v=.5-Math.cos(g*Math.PI)/2;let y=n+v*(t-n);if(d(y,t)&&(y=t),e.wrapperEl.scrollTo({[s]:y}),d(y,t)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[s]:y})}),r.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=r.requestAnimationFrame(f)};f()}function vi(i,e){return e===void 0&&(e=""),[...i.children].filter(t=>t.matches(e))}function jC(i,e){e===void 0&&(e=[]);const t=document.createElement(i);return t.classList.add(...Array.isArray(e)?e:[e]),t}function KC(i,e){const t=[];for(;i.previousElementSibling;){const s=i.previousElementSibling;e?s.matches(e)&&t.push(s):t.push(s),i=s}return t}function zC(i,e){const t=[];for(;i.nextElementSibling;){const s=i.nextElementSibling;e?s.matches(e)&&t.push(s):t.push(s),i=s}return t}function Bi(i,e){return fs().getComputedStyle(i,null).getPropertyValue(e)}function Gd(i){let e=i,t;if(e){for(t=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(t+=1);return t}}function WC(i,e){const t=[];let s=i.parentElement;for(;s;)t.push(s),s=s.parentElement;return t}function Vd(i,e,t){const s=fs();return i[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(s.getComputedStyle(i,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(s.getComputedStyle(i,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}let cl;function qC(){const i=fs(),e=lr();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in i||i.DocumentTouch&&e instanceof i.DocumentTouch)}}function Hg(){return cl||(cl=qC()),cl}let ul;function YC(i){let{userAgent:e}=i===void 0?{}:i;const t=Hg(),s=fs(),r=s.navigator.platform,n=e||s.navigator.userAgent,a={ios:!1,android:!1},o=s.screen.width,l=s.screen.height,u=n.match(/(Android);?[\s\/]+([\d.]+)?/);let d=n.match(/(iPad).*OS\s([\d_]+)/);const f=n.match(/(iPod)(.*OS\s([\d_]+))?/),g=!d&&n.match(/(iPhone\sOS|iOS)\s([\d_]+)/),v=r==="Win32";let y=r==="MacIntel";const E=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!d&&y&&t.touch&&E.indexOf(`${o}x${l}`)>=0&&(d=n.match(/(Version)\/([\d.]+)/),d||(d=[0,1,"13_0_0"]),y=!1),u&&!v&&(a.os="android",a.android=!0),(d||g||f)&&(a.os="ios",a.ios=!0),a}function XC(i){return i===void 0&&(i={}),ul||(ul=YC(i)),ul}let hl;function QC(){const i=fs();let e=!1;function t(){const s=i.navigator.userAgent.toLowerCase();return s.indexOf("safari")>=0&&s.indexOf("chrome")<0&&s.indexOf("android")<0}if(t()){const s=String(i.navigator.userAgent);if(s.includes("Version/")){const[r,n]=s.split("Version/")[1].split(" ")[0].split(".").map(a=>Number(a));e=r<16||r===16&&n<2}}return{isSafari:e||t(),needPerspectiveFix:e,isWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(i.navigator.userAgent)}}function JC(){return hl||(hl=QC()),hl}function ZC(i){let{swiper:e,on:t,emit:s}=i;const r=fs();let n=null,a=null;const o=()=>{!e||e.destroyed||!e.initialized||(s("beforeResize"),s("resize"))},l=()=>{!e||e.destroyed||!e.initialized||(n=new ResizeObserver(f=>{a=r.requestAnimationFrame(()=>{const{width:g,height:v}=e;let y=g,E=v;f.forEach(b=>{let{contentBoxSize:w,contentRect:F,target:k}=b;k&&k!==e.el||(y=F?F.width:(w[0]||w).inlineSize,E=F?F.height:(w[0]||w).blockSize)}),(y!==g||E!==v)&&o()})}),n.observe(e.el))},u=()=>{a&&r.cancelAnimationFrame(a),n&&n.unobserve&&e.el&&(n.unobserve(e.el),n=null)},d=()=>{!e||e.destroyed||!e.initialized||s("orientationchange")};t("init",()=>{if(e.params.resizeObserver&&typeof r.ResizeObserver<"u"){l();return}r.addEventListener("resize",o),r.addEventListener("orientationchange",d)}),t("destroy",()=>{u(),r.removeEventListener("resize",o),r.removeEventListener("orientationchange",d)})}function eR(i){let{swiper:e,extendParams:t,on:s,emit:r}=i;const n=[],a=fs(),o=function(d,f){f===void 0&&(f={});const g=a.MutationObserver||a.WebkitMutationObserver,v=new g(y=>{if(e.__preventObserver__)return;if(y.length===1){r("observerUpdate",y[0]);return}const E=function(){r("observerUpdate",y[0])};a.requestAnimationFrame?a.requestAnimationFrame(E):a.setTimeout(E,0)});v.observe(d,{attributes:typeof f.attributes>"u"?!0:f.attributes,childList:typeof f.childList>"u"?!0:f.childList,characterData:typeof f.characterData>"u"?!0:f.characterData}),n.push(v)},l=()=>{if(e.params.observer){if(e.params.observeParents){const d=WC(e.hostEl);for(let f=0;f<d.length;f+=1)o(d[f])}o(e.hostEl,{childList:e.params.observeSlideChildren}),o(e.wrapperEl,{attributes:!1})}},u=()=>{n.forEach(d=>{d.disconnect()}),n.splice(0,n.length)};t({observer:!1,observeParents:!1,observeSlideChildren:!1}),s("init",l),s("destroy",u)}var tR={on(i,e,t){const s=this;if(!s.eventsListeners||s.destroyed||typeof e!="function")return s;const r=t?"unshift":"push";return i.split(" ").forEach(n=>{s.eventsListeners[n]||(s.eventsListeners[n]=[]),s.eventsListeners[n][r](e)}),s},once(i,e,t){const s=this;if(!s.eventsListeners||s.destroyed||typeof e!="function")return s;function r(){s.off(i,r),r.__emitterProxy&&delete r.__emitterProxy;for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];e.apply(s,a)}return r.__emitterProxy=e,s.on(i,r,t)},onAny(i,e){const t=this;if(!t.eventsListeners||t.destroyed||typeof i!="function")return t;const s=e?"unshift":"push";return t.eventsAnyListeners.indexOf(i)<0&&t.eventsAnyListeners[s](i),t},offAny(i){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsAnyListeners)return e;const t=e.eventsAnyListeners.indexOf(i);return t>=0&&e.eventsAnyListeners.splice(t,1),e},off(i,e){const t=this;return!t.eventsListeners||t.destroyed||!t.eventsListeners||i.split(" ").forEach(s=>{typeof e>"u"?t.eventsListeners[s]=[]:t.eventsListeners[s]&&t.eventsListeners[s].forEach((r,n)=>{(r===e||r.__emitterProxy&&r.__emitterProxy===e)&&t.eventsListeners[s].splice(n,1)})}),t},emit(){const i=this;if(!i.eventsListeners||i.destroyed||!i.eventsListeners)return i;let e,t,s;for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return typeof n[0]=="string"||Array.isArray(n[0])?(e=n[0],t=n.slice(1,n.length),s=i):(e=n[0].events,t=n[0].data,s=n[0].context||i),t.unshift(s),(Array.isArray(e)?e:e.split(" ")).forEach(l=>{i.eventsAnyListeners&&i.eventsAnyListeners.length&&i.eventsAnyListeners.forEach(u=>{u.apply(s,[l,...t])}),i.eventsListeners&&i.eventsListeners[l]&&i.eventsListeners[l].forEach(u=>{u.apply(s,t)})}),i}};function sR(){const i=this;let e,t;const s=i.el;typeof i.params.width<"u"&&i.params.width!==null?e=i.params.width:e=s.clientWidth,typeof i.params.height<"u"&&i.params.height!==null?t=i.params.height:t=s.clientHeight,!(e===0&&i.isHorizontal()||t===0&&i.isVertical())&&(e=e-parseInt(Bi(s,"padding-left")||0,10)-parseInt(Bi(s,"padding-right")||0,10),t=t-parseInt(Bi(s,"padding-top")||0,10)-parseInt(Bi(s,"padding-bottom")||0,10),Number.isNaN(e)&&(e=0),Number.isNaN(t)&&(t=0),Object.assign(i,{width:e,height:t,size:i.isHorizontal()?e:t}))}function iR(){const i=this;function e(se){return i.isHorizontal()?se:{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"}[se]}function t(se,pe){return parseFloat(se.getPropertyValue(e(pe))||0)}const s=i.params,{wrapperEl:r,slidesEl:n,size:a,rtlTranslate:o,wrongRTL:l}=i,u=i.virtual&&s.virtual.enabled,d=u?i.virtual.slides.length:i.slides.length,f=vi(n,`.${i.params.slideClass}, swiper-slide`),g=u?i.virtual.slides.length:f.length;let v=[];const y=[],E=[];let b=s.slidesOffsetBefore;typeof b=="function"&&(b=s.slidesOffsetBefore.call(i));let w=s.slidesOffsetAfter;typeof w=="function"&&(w=s.slidesOffsetAfter.call(i));const F=i.snapGrid.length,k=i.slidesGrid.length;let U=s.spaceBetween,N=-b,te=0,j=0;if(typeof a>"u")return;typeof U=="string"&&U.indexOf("%")>=0?U=parseFloat(U.replace("%",""))/100*a:typeof U=="string"&&(U=parseFloat(U)),i.virtualSize=-U,f.forEach(se=>{o?se.style.marginLeft="":se.style.marginRight="",se.style.marginBottom="",se.style.marginTop=""}),s.centeredSlides&&s.cssMode&&(ma(r,"--swiper-centered-offset-before",""),ma(r,"--swiper-centered-offset-after",""));const re=s.grid&&s.grid.rows>1&&i.grid;re&&i.grid.initSlides(g);let Q;const le=s.slidesPerView==="auto"&&s.breakpoints&&Object.keys(s.breakpoints).filter(se=>typeof s.breakpoints[se].slidesPerView<"u").length>0;for(let se=0;se<g;se+=1){Q=0;let pe;if(f[se]&&(pe=f[se]),re&&i.grid.updateSlide(se,pe,g,e),!(f[se]&&Bi(pe,"display")==="none")){if(s.slidesPerView==="auto"){le&&(f[se].style[e("width")]="");const de=getComputedStyle(pe),be=pe.style.transform,Le=pe.style.webkitTransform;if(be&&(pe.style.transform="none"),Le&&(pe.style.webkitTransform="none"),s.roundLengths)Q=i.isHorizontal()?Vd(pe,"width"):Vd(pe,"height");else{const ue=t(de,"width"),he=t(de,"padding-left"),we=t(de,"padding-right"),me=t(de,"margin-left"),ye=t(de,"margin-right"),Ve=de.getPropertyValue("box-sizing");if(Ve&&Ve==="border-box")Q=ue+me+ye;else{const{clientWidth:$e,offsetWidth:Xe}=pe;Q=ue+he+we+me+ye+(Xe-$e)}}be&&(pe.style.transform=be),Le&&(pe.style.webkitTransform=Le),s.roundLengths&&(Q=Math.floor(Q))}else Q=(a-(s.slidesPerView-1)*U)/s.slidesPerView,s.roundLengths&&(Q=Math.floor(Q)),f[se]&&(f[se].style[e("width")]=`${Q}px`);f[se]&&(f[se].swiperSlideSize=Q),E.push(Q),s.centeredSlides?(N=N+Q/2+te/2+U,te===0&&se!==0&&(N=N-a/2-U),se===0&&(N=N-a/2-U),Math.abs(N)<1/1e3&&(N=0),s.roundLengths&&(N=Math.floor(N)),j%s.slidesPerGroup===0&&v.push(N),y.push(N)):(s.roundLengths&&(N=Math.floor(N)),(j-Math.min(i.params.slidesPerGroupSkip,j))%i.params.slidesPerGroup===0&&v.push(N),y.push(N),N=N+Q+U),i.virtualSize+=Q+U,te=Q,j+=1}}if(i.virtualSize=Math.max(i.virtualSize,a)+w,o&&l&&(s.effect==="slide"||s.effect==="coverflow")&&(r.style.width=`${i.virtualSize+U}px`),s.setWrapperSize&&(r.style[e("width")]=`${i.virtualSize+U}px`),re&&i.grid.updateWrapperSize(Q,v,e),!s.centeredSlides){const se=[];for(let pe=0;pe<v.length;pe+=1){let de=v[pe];s.roundLengths&&(de=Math.floor(de)),v[pe]<=i.virtualSize-a&&se.push(de)}v=se,Math.floor(i.virtualSize-a)-Math.floor(v[v.length-1])>1&&v.push(i.virtualSize-a)}if(u&&s.loop){const se=E[0]+U;if(s.slidesPerGroup>1){const pe=Math.ceil((i.virtual.slidesBefore+i.virtual.slidesAfter)/s.slidesPerGroup),de=se*s.slidesPerGroup;for(let be=0;be<pe;be+=1)v.push(v[v.length-1]+de)}for(let pe=0;pe<i.virtual.slidesBefore+i.virtual.slidesAfter;pe+=1)s.slidesPerGroup===1&&v.push(v[v.length-1]+se),y.push(y[y.length-1]+se),i.virtualSize+=se}if(v.length===0&&(v=[0]),U!==0){const se=i.isHorizontal()&&o?"marginLeft":e("marginRight");f.filter((pe,de)=>!s.cssMode||s.loop?!0:de!==f.length-1).forEach(pe=>{pe.style[se]=`${U}px`})}if(s.centeredSlides&&s.centeredSlidesBounds){let se=0;E.forEach(de=>{se+=de+(U||0)}),se-=U;const pe=se-a;v=v.map(de=>de<=0?-b:de>pe?pe+w:de)}if(s.centerInsufficientSlides){let se=0;if(E.forEach(pe=>{se+=pe+(U||0)}),se-=U,se<a){const pe=(a-se)/2;v.forEach((de,be)=>{v[be]=de-pe}),y.forEach((de,be)=>{y[be]=de+pe})}}if(Object.assign(i,{slides:f,snapGrid:v,slidesGrid:y,slidesSizesGrid:E}),s.centeredSlides&&s.cssMode&&!s.centeredSlidesBounds){ma(r,"--swiper-centered-offset-before",`${-v[0]}px`),ma(r,"--swiper-centered-offset-after",`${i.size/2-E[E.length-1]/2}px`);const se=-i.snapGrid[0],pe=-i.slidesGrid[0];i.snapGrid=i.snapGrid.map(de=>de+se),i.slidesGrid=i.slidesGrid.map(de=>de+pe)}if(g!==d&&i.emit("slidesLengthChange"),v.length!==F&&(i.params.watchOverflow&&i.checkOverflow(),i.emit("snapGridLengthChange")),y.length!==k&&i.emit("slidesGridLengthChange"),s.watchSlidesProgress&&i.updateSlidesOffset(),!u&&!s.cssMode&&(s.effect==="slide"||s.effect==="fade")){const se=`${s.containerModifierClass}backface-hidden`,pe=i.el.classList.contains(se);g<=s.maxBackfaceHiddenSlides?pe||i.el.classList.add(se):pe&&i.el.classList.remove(se)}}function rR(i){const e=this,t=[],s=e.virtual&&e.params.virtual.enabled;let r=0,n;typeof i=="number"?e.setTransition(i):i===!0&&e.setTransition(e.params.speed);const a=o=>s?e.slides[e.getSlideIndexByData(o)]:e.slides[o];if(e.params.slidesPerView!=="auto"&&e.params.slidesPerView>1)if(e.params.centeredSlides)(e.visibleSlides||[]).forEach(o=>{t.push(o)});else for(n=0;n<Math.ceil(e.params.slidesPerView);n+=1){const o=e.activeIndex+n;if(o>e.slides.length&&!s)break;t.push(a(o))}else t.push(a(e.activeIndex));for(n=0;n<t.length;n+=1)if(typeof t[n]<"u"){const o=t[n].offsetHeight;r=o>r?o:r}(r||r===0)&&(e.wrapperEl.style.height=`${r}px`)}function nR(){const i=this,e=i.slides,t=i.isElement?i.isHorizontal()?i.wrapperEl.offsetLeft:i.wrapperEl.offsetTop:0;for(let s=0;s<e.length;s+=1)e[s].swiperSlideOffset=(i.isHorizontal()?e[s].offsetLeft:e[s].offsetTop)-t-i.cssOverflowAdjustment()}function aR(i){i===void 0&&(i=this&&this.translate||0);const e=this,t=e.params,{slides:s,rtlTranslate:r,snapGrid:n}=e;if(s.length===0)return;typeof s[0].swiperSlideOffset>"u"&&e.updateSlidesOffset();let a=-i;r&&(a=i),s.forEach(l=>{l.classList.remove(t.slideVisibleClass)}),e.visibleSlidesIndexes=[],e.visibleSlides=[];let o=t.spaceBetween;typeof o=="string"&&o.indexOf("%")>=0?o=parseFloat(o.replace("%",""))/100*e.size:typeof o=="string"&&(o=parseFloat(o));for(let l=0;l<s.length;l+=1){const u=s[l];let d=u.swiperSlideOffset;t.cssMode&&t.centeredSlides&&(d-=s[0].swiperSlideOffset);const f=(a+(t.centeredSlides?e.minTranslate():0)-d)/(u.swiperSlideSize+o),g=(a-n[0]+(t.centeredSlides?e.minTranslate():0)-d)/(u.swiperSlideSize+o),v=-(a-d),y=v+e.slidesSizesGrid[l];(v>=0&&v<e.size-1||y>1&&y<=e.size||v<=0&&y>=e.size)&&(e.visibleSlides.push(u),e.visibleSlidesIndexes.push(l),s[l].classList.add(t.slideVisibleClass)),u.progress=r?-f:f,u.originalProgress=r?-g:g}}function oR(i){const e=this;if(typeof i>"u"){const d=e.rtlTranslate?-1:1;i=e&&e.translate&&e.translate*d||0}const t=e.params,s=e.maxTranslate()-e.minTranslate();let{progress:r,isBeginning:n,isEnd:a,progressLoop:o}=e;const l=n,u=a;if(s===0)r=0,n=!0,a=!0;else{r=(i-e.minTranslate())/s;const d=Math.abs(i-e.minTranslate())<1,f=Math.abs(i-e.maxTranslate())<1;n=d||r<=0,a=f||r>=1,d&&(r=0),f&&(r=1)}if(t.loop){const d=e.getSlideIndexByData(0),f=e.getSlideIndexByData(e.slides.length-1),g=e.slidesGrid[d],v=e.slidesGrid[f],y=e.slidesGrid[e.slidesGrid.length-1],E=Math.abs(i);E>=g?o=(E-g)/y:o=(E+y-v)/y,o>1&&(o-=1)}Object.assign(e,{progress:r,progressLoop:o,isBeginning:n,isEnd:a}),(t.watchSlidesProgress||t.centeredSlides&&t.autoHeight)&&e.updateSlidesProgress(i),n&&!l&&e.emit("reachBeginning toEdge"),a&&!u&&e.emit("reachEnd toEdge"),(l&&!n||u&&!a)&&e.emit("fromEdge"),e.emit("progress",r)}function lR(){const i=this,{slides:e,params:t,slidesEl:s,activeIndex:r}=i,n=i.virtual&&t.virtual.enabled,a=l=>vi(s,`.${t.slideClass}${l}, swiper-slide${l}`)[0];e.forEach(l=>{l.classList.remove(t.slideActiveClass,t.slideNextClass,t.slidePrevClass)});let o;if(n)if(t.loop){let l=r-i.virtual.slidesBefore;l<0&&(l=i.virtual.slides.length+l),l>=i.virtual.slides.length&&(l-=i.virtual.slides.length),o=a(`[data-swiper-slide-index="${l}"]`)}else o=a(`[data-swiper-slide-index="${r}"]`);else o=e[r];if(o){o.classList.add(t.slideActiveClass);let l=zC(o,`.${t.slideClass}, swiper-slide`)[0];t.loop&&!l&&(l=e[0]),l&&l.classList.add(t.slideNextClass);let u=KC(o,`.${t.slideClass}, swiper-slide`)[0];t.loop&&!u===0&&(u=e[e.length-1]),u&&u.classList.add(t.slidePrevClass)}i.emitSlidesClasses()}const Ra=(i,e)=>{if(!i||i.destroyed||!i.params)return;const t=()=>i.isElement?"swiper-slide":`.${i.params.slideClass}`,s=e.closest(t());if(s){let r=s.querySelector(`.${i.params.lazyPreloaderClass}`);!r&&i.isElement&&(s.shadowRoot?r=s.shadowRoot.querySelector(`.${i.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{s.shadowRoot&&(r=s.shadowRoot.querySelector(`.${i.params.lazyPreloaderClass}`),r&&r.remove())})),r&&r.remove()}},dl=(i,e)=>{if(!i.slides[e])return;const t=i.slides[e].querySelector('[loading="lazy"]');t&&t.removeAttribute("loading")},Gl=i=>{if(!i||i.destroyed||!i.params)return;let e=i.params.lazyPreloadPrevNext;const t=i.slides.length;if(!t||!e||e<0)return;e=Math.min(e,t);const s=i.params.slidesPerView==="auto"?i.slidesPerViewDynamic():Math.ceil(i.params.slidesPerView),r=i.activeIndex;if(i.params.grid&&i.params.grid.rows>1){const a=r,o=[a-e];o.push(...Array.from({length:e}).map((l,u)=>a+s+u)),i.slides.forEach((l,u)=>{o.includes(l.column)&&dl(i,u)});return}const n=r+s-1;if(i.params.rewind||i.params.loop)for(let a=r-e;a<=n+e;a+=1){const o=(a%t+t)%t;(o<r||o>n)&&dl(i,o)}else for(let a=Math.max(r-e,0);a<=Math.min(n+e,t-1);a+=1)a!==r&&(a>n||a<r)&&dl(i,a)};function cR(i){const{slidesGrid:e,params:t}=i,s=i.rtlTranslate?i.translate:-i.translate;let r;for(let n=0;n<e.length;n+=1)typeof e[n+1]<"u"?s>=e[n]&&s<e[n+1]-(e[n+1]-e[n])/2?r=n:s>=e[n]&&s<e[n+1]&&(r=n+1):s>=e[n]&&(r=n);return t.normalizeSlideIndex&&(r<0||typeof r>"u")&&(r=0),r}function uR(i){const e=this,t=e.rtlTranslate?e.translate:-e.translate,{snapGrid:s,params:r,activeIndex:n,realIndex:a,snapIndex:o}=e;let l=i,u;const d=g=>{let v=g-e.virtual.slidesBefore;return v<0&&(v=e.virtual.slides.length+v),v>=e.virtual.slides.length&&(v-=e.virtual.slides.length),v};if(typeof l>"u"&&(l=cR(e)),s.indexOf(t)>=0)u=s.indexOf(t);else{const g=Math.min(r.slidesPerGroupSkip,l);u=g+Math.floor((l-g)/r.slidesPerGroup)}if(u>=s.length&&(u=s.length-1),l===n){u!==o&&(e.snapIndex=u,e.emit("snapIndexChange")),e.params.loop&&e.virtual&&e.params.virtual.enabled&&(e.realIndex=d(l));return}let f;e.virtual&&r.virtual.enabled&&r.loop?f=d(l):e.slides[l]?f=parseInt(e.slides[l].getAttribute("data-swiper-slide-index")||l,10):f=l,Object.assign(e,{previousSnapIndex:o,snapIndex:u,previousRealIndex:a,realIndex:f,previousIndex:n,activeIndex:l}),e.initialized&&Gl(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(a!==f&&e.emit("realIndexChange"),e.emit("slideChange"))}function hR(i,e){const t=this,s=t.params;let r=i.closest(`.${s.slideClass}, swiper-slide`);!r&&t.isElement&&e&&e.length>1&&e.includes(i)&&[...e.slice(e.indexOf(i)+1,e.length)].forEach(o=>{!r&&o.matches&&o.matches(`.${s.slideClass}, swiper-slide`)&&(r=o)});let n=!1,a;if(r){for(let o=0;o<t.slides.length;o+=1)if(t.slides[o]===r){n=!0,a=o;break}}if(r&&n)t.clickedSlide=r,t.virtual&&t.params.virtual.enabled?t.clickedIndex=parseInt(r.getAttribute("data-swiper-slide-index"),10):t.clickedIndex=a;else{t.clickedSlide=void 0,t.clickedIndex=void 0;return}s.slideToClickedSlide&&t.clickedIndex!==void 0&&t.clickedIndex!==t.activeIndex&&t.slideToClickedSlide()}var dR={updateSize:sR,updateSlides:iR,updateAutoHeight:rR,updateSlidesOffset:nR,updateSlidesProgress:aR,updateProgress:oR,updateSlidesClasses:lR,updateActiveIndex:uR,updateClickedSlide:hR};function fR(i){i===void 0&&(i=this.isHorizontal()?"x":"y");const e=this,{params:t,rtlTranslate:s,translate:r,wrapperEl:n}=e;if(t.virtualTranslate)return s?-r:r;if(t.cssMode)return r;let a=VC(n,i);return a+=e.cssOverflowAdjustment(),s&&(a=-a),a||0}function pR(i,e){const t=this,{rtlTranslate:s,params:r,wrapperEl:n,progress:a}=t;let o=0,l=0;const u=0;t.isHorizontal()?o=s?-i:i:l=i,r.roundLengths&&(o=Math.floor(o),l=Math.floor(l)),t.previousTranslate=t.translate,t.translate=t.isHorizontal()?o:l,r.cssMode?n[t.isHorizontal()?"scrollLeft":"scrollTop"]=t.isHorizontal()?-o:-l:r.virtualTranslate||(t.isHorizontal()?o-=t.cssOverflowAdjustment():l-=t.cssOverflowAdjustment(),n.style.transform=`translate3d(${o}px, ${l}px, ${u}px)`);let d;const f=t.maxTranslate()-t.minTranslate();f===0?d=0:d=(i-t.minTranslate())/f,d!==a&&t.updateProgress(i),t.emit("setTranslate",t.translate,e)}function gR(){return-this.snapGrid[0]}function mR(){return-this.snapGrid[this.snapGrid.length-1]}function vR(i,e,t,s,r){i===void 0&&(i=0),e===void 0&&(e=this.params.speed),t===void 0&&(t=!0),s===void 0&&(s=!0);const n=this,{params:a,wrapperEl:o}=n;if(n.animating&&a.preventInteractionOnTransition)return!1;const l=n.minTranslate(),u=n.maxTranslate();let d;if(s&&i>l?d=l:s&&i<u?d=u:d=i,n.updateProgress(d),a.cssMode){const f=n.isHorizontal();if(e===0)o[f?"scrollLeft":"scrollTop"]=-d;else{if(!n.support.smoothScroll)return Vg({swiper:n,targetPosition:-d,side:f?"left":"top"}),!0;o.scrollTo({[f?"left":"top"]:-d,behavior:"smooth"})}return!0}return e===0?(n.setTransition(0),n.setTranslate(d),t&&(n.emit("beforeTransitionStart",e,r),n.emit("transitionEnd"))):(n.setTransition(e),n.setTranslate(d),t&&(n.emit("beforeTransitionStart",e,r),n.emit("transitionStart")),n.animating||(n.animating=!0,n.onTranslateToWrapperTransitionEnd||(n.onTranslateToWrapperTransitionEnd=function(g){!n||n.destroyed||g.target===this&&(n.wrapperEl.removeEventListener("transitionend",n.onTranslateToWrapperTransitionEnd),n.onTranslateToWrapperTransitionEnd=null,delete n.onTranslateToWrapperTransitionEnd,t&&n.emit("transitionEnd"))}),n.wrapperEl.addEventListener("transitionend",n.onTranslateToWrapperTransitionEnd))),!0}var yR={getTranslate:fR,setTranslate:pR,minTranslate:gR,maxTranslate:mR,translateTo:vR};function xR(i,e){const t=this;t.params.cssMode||(t.wrapperEl.style.transitionDuration=`${i}ms`,t.wrapperEl.style.transitionDelay=i===0?"0ms":""),t.emit("setTransition",i,e)}function jg(i){let{swiper:e,runCallbacks:t,direction:s,step:r}=i;const{activeIndex:n,previousIndex:a}=e;let o=s;if(o||(n>a?o="next":n<a?o="prev":o="reset"),e.emit(`transition${r}`),t&&n!==a){if(o==="reset"){e.emit(`slideResetTransition${r}`);return}e.emit(`slideChangeTransition${r}`),o==="next"?e.emit(`slideNextTransition${r}`):e.emit(`slidePrevTransition${r}`)}}function SR(i,e){i===void 0&&(i=!0);const t=this,{params:s}=t;s.cssMode||(s.autoHeight&&t.updateAutoHeight(),jg({swiper:t,runCallbacks:i,direction:e,step:"Start"}))}function ER(i,e){i===void 0&&(i=!0);const t=this,{params:s}=t;t.animating=!1,!s.cssMode&&(t.setTransition(0),jg({swiper:t,runCallbacks:i,direction:e,step:"End"}))}var bR={setTransition:xR,transitionStart:SR,transitionEnd:ER};function TR(i,e,t,s,r){i===void 0&&(i=0),e===void 0&&(e=this.params.speed),t===void 0&&(t=!0),typeof i=="string"&&(i=parseInt(i,10));const n=this;let a=i;a<0&&(a=0);const{params:o,snapGrid:l,slidesGrid:u,previousIndex:d,activeIndex:f,rtlTranslate:g,wrapperEl:v,enabled:y}=n;if(n.animating&&o.preventInteractionOnTransition||!y&&!s&&!r)return!1;const E=Math.min(n.params.slidesPerGroupSkip,a);let b=E+Math.floor((a-E)/n.params.slidesPerGroup);b>=l.length&&(b=l.length-1);const w=-l[b];if(o.normalizeSlideIndex)for(let k=0;k<u.length;k+=1){const U=-Math.floor(w*100),N=Math.floor(u[k]*100),te=Math.floor(u[k+1]*100);typeof u[k+1]<"u"?U>=N&&U<te-(te-N)/2?a=k:U>=N&&U<te&&(a=k+1):U>=N&&(a=k)}if(n.initialized&&a!==f&&(!n.allowSlideNext&&(g?w>n.translate&&w>n.minTranslate():w<n.translate&&w<n.minTranslate())||!n.allowSlidePrev&&w>n.translate&&w>n.maxTranslate()&&(f||0)!==a))return!1;a!==(d||0)&&t&&n.emit("beforeSlideChangeStart"),n.updateProgress(w);let F;if(a>f?F="next":a<f?F="prev":F="reset",g&&-w===n.translate||!g&&w===n.translate)return n.updateActiveIndex(a),o.autoHeight&&n.updateAutoHeight(),n.updateSlidesClasses(),o.effect!=="slide"&&n.setTranslate(w),F!=="reset"&&(n.transitionStart(t,F),n.transitionEnd(t,F)),!1;if(o.cssMode){const k=n.isHorizontal(),U=g?w:-w;if(e===0){const N=n.virtual&&n.params.virtual.enabled;N&&(n.wrapperEl.style.scrollSnapType="none",n._immediateVirtual=!0),N&&!n._cssModeVirtualInitialSet&&n.params.initialSlide>0?(n._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{v[k?"scrollLeft":"scrollTop"]=U})):v[k?"scrollLeft":"scrollTop"]=U,N&&requestAnimationFrame(()=>{n.wrapperEl.style.scrollSnapType="",n._immediateVirtual=!1})}else{if(!n.support.smoothScroll)return Vg({swiper:n,targetPosition:U,side:k?"left":"top"}),!0;v.scrollTo({[k?"left":"top"]:U,behavior:"smooth"})}return!0}return n.setTransition(e),n.setTranslate(w),n.updateActiveIndex(a),n.updateSlidesClasses(),n.emit("beforeTransitionStart",e,s),n.transitionStart(t,F),e===0?n.transitionEnd(t,F):n.animating||(n.animating=!0,n.onSlideToWrapperTransitionEnd||(n.onSlideToWrapperTransitionEnd=function(U){!n||n.destroyed||U.target===this&&(n.wrapperEl.removeEventListener("transitionend",n.onSlideToWrapperTransitionEnd),n.onSlideToWrapperTransitionEnd=null,delete n.onSlideToWrapperTransitionEnd,n.transitionEnd(t,F))}),n.wrapperEl.addEventListener("transitionend",n.onSlideToWrapperTransitionEnd)),!0}function wR(i,e,t,s){i===void 0&&(i=0),e===void 0&&(e=this.params.speed),t===void 0&&(t=!0),typeof i=="string"&&(i=parseInt(i,10));const r=this;let n=i;return r.params.loop&&(r.virtual&&r.params.virtual.enabled?n=n+r.virtual.slidesBefore:n=r.getSlideIndexByData(n)),r.slideTo(n,e,t,s)}function AR(i,e,t){i===void 0&&(i=this.params.speed),e===void 0&&(e=!0);const s=this,{enabled:r,params:n,animating:a}=s;if(!r)return s;let o=n.slidesPerGroup;n.slidesPerView==="auto"&&n.slidesPerGroup===1&&n.slidesPerGroupAuto&&(o=Math.max(s.slidesPerViewDynamic("current",!0),1));const l=s.activeIndex<n.slidesPerGroupSkip?1:o,u=s.virtual&&n.virtual.enabled;if(n.loop){if(a&&!u&&n.loopPreventsSliding)return!1;if(s.loopFix({direction:"next"}),s._clientLeft=s.wrapperEl.clientLeft,s.activeIndex===s.slides.length-1&&n.cssMode)return requestAnimationFrame(()=>{s.slideTo(s.activeIndex+l,i,e,t)}),!0}return n.rewind&&s.isEnd?s.slideTo(0,i,e,t):s.slideTo(s.activeIndex+l,i,e,t)}function LR(i,e,t){i===void 0&&(i=this.params.speed),e===void 0&&(e=!0);const s=this,{params:r,snapGrid:n,slidesGrid:a,rtlTranslate:o,enabled:l,animating:u}=s;if(!l)return s;const d=s.virtual&&r.virtual.enabled;if(r.loop){if(u&&!d&&r.loopPreventsSliding)return!1;s.loopFix({direction:"prev"}),s._clientLeft=s.wrapperEl.clientLeft}const f=o?s.translate:-s.translate;function g(w){return w<0?-Math.floor(Math.abs(w)):Math.floor(w)}const v=g(f),y=n.map(w=>g(w));let E=n[y.indexOf(v)-1];if(typeof E>"u"&&r.cssMode){let w;n.forEach((F,k)=>{v>=F&&(w=k)}),typeof w<"u"&&(E=n[w>0?w-1:w])}let b=0;if(typeof E<"u"&&(b=a.indexOf(E),b<0&&(b=s.activeIndex-1),r.slidesPerView==="auto"&&r.slidesPerGroup===1&&r.slidesPerGroupAuto&&(b=b-s.slidesPerViewDynamic("previous",!0)+1,b=Math.max(b,0))),r.rewind&&s.isBeginning){const w=s.params.virtual&&s.params.virtual.enabled&&s.virtual?s.virtual.slides.length-1:s.slides.length-1;return s.slideTo(w,i,e,t)}else if(r.loop&&s.activeIndex===0&&r.cssMode)return requestAnimationFrame(()=>{s.slideTo(b,i,e,t)}),!0;return s.slideTo(b,i,e,t)}function CR(i,e,t){i===void 0&&(i=this.params.speed),e===void 0&&(e=!0);const s=this;return s.slideTo(s.activeIndex,i,e,t)}function RR(i,e,t,s){i===void 0&&(i=this.params.speed),e===void 0&&(e=!0),s===void 0&&(s=.5);const r=this;let n=r.activeIndex;const a=Math.min(r.params.slidesPerGroupSkip,n),o=a+Math.floor((n-a)/r.params.slidesPerGroup),l=r.rtlTranslate?r.translate:-r.translate;if(l>=r.snapGrid[o]){const u=r.snapGrid[o],d=r.snapGrid[o+1];l-u>(d-u)*s&&(n+=r.params.slidesPerGroup)}else{const u=r.snapGrid[o-1],d=r.snapGrid[o];l-u<=(d-u)*s&&(n-=r.params.slidesPerGroup)}return n=Math.max(n,0),n=Math.min(n,r.slidesGrid.length-1),r.slideTo(n,i,e,t)}function _R(){const i=this,{params:e,slidesEl:t}=i,s=e.slidesPerView==="auto"?i.slidesPerViewDynamic():e.slidesPerView;let r=i.clickedIndex,n;const a=i.isElement?"swiper-slide":`.${e.slideClass}`;if(e.loop){if(i.animating)return;n=parseInt(i.clickedSlide.getAttribute("data-swiper-slide-index"),10),e.centeredSlides?r<i.loopedSlides-s/2||r>i.slides.length-i.loopedSlides+s/2?(i.loopFix(),r=i.getSlideIndex(vi(t,`${a}[data-swiper-slide-index="${n}"]`)[0]),Ul(()=>{i.slideTo(r)})):i.slideTo(r):r>i.slides.length-s?(i.loopFix(),r=i.getSlideIndex(vi(t,`${a}[data-swiper-slide-index="${n}"]`)[0]),Ul(()=>{i.slideTo(r)})):i.slideTo(r)}else i.slideTo(r)}var IR={slideTo:TR,slideToLoop:wR,slideNext:AR,slidePrev:LR,slideReset:CR,slideToClosest:RR,slideToClickedSlide:_R};function kR(i){const e=this,{params:t,slidesEl:s}=e;if(!t.loop||e.virtual&&e.params.virtual.enabled)return;vi(s,`.${t.slideClass}, swiper-slide`).forEach((n,a)=>{n.setAttribute("data-swiper-slide-index",a)}),e.loopFix({slideRealIndex:i,direction:t.centeredSlides?void 0:"next"})}function PR(i){let{slideRealIndex:e,slideTo:t=!0,direction:s,setTranslate:r,activeSlideIndex:n,byController:a,byMousewheel:o}=i===void 0?{}:i;const l=this;if(!l.params.loop)return;l.emit("beforeLoopFix");const{slides:u,allowSlidePrev:d,allowSlideNext:f,slidesEl:g,params:v}=l;if(l.allowSlidePrev=!0,l.allowSlideNext=!0,l.virtual&&v.virtual.enabled){t&&(!v.centeredSlides&&l.snapIndex===0?l.slideTo(l.virtual.slides.length,0,!1,!0):v.centeredSlides&&l.snapIndex<v.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.allowSlidePrev=d,l.allowSlideNext=f,l.emit("loopFix");return}const y=v.slidesPerView==="auto"?l.slidesPerViewDynamic():Math.ceil(parseFloat(v.slidesPerView,10));let E=v.loopedSlides||y;E%v.slidesPerGroup!==0&&(E+=v.slidesPerGroup-E%v.slidesPerGroup),l.loopedSlides=E;const b=[],w=[];let F=l.activeIndex;typeof n>"u"?n=l.getSlideIndex(l.slides.filter(j=>j.classList.contains(v.slideActiveClass))[0]):F=n;const k=s==="next"||!s,U=s==="prev"||!s;let N=0,te=0;if(n<E){N=Math.max(E-n,v.slidesPerGroup);for(let j=0;j<E-n;j+=1){const re=j-Math.floor(j/u.length)*u.length;b.push(u.length-re-1)}}else if(n>l.slides.length-E*2){te=Math.max(n-(l.slides.length-E*2),v.slidesPerGroup);for(let j=0;j<te;j+=1){const re=j-Math.floor(j/u.length)*u.length;w.push(re)}}if(U&&b.forEach(j=>{l.slides[j].swiperLoopMoveDOM=!0,g.prepend(l.slides[j]),l.slides[j].swiperLoopMoveDOM=!1}),k&&w.forEach(j=>{l.slides[j].swiperLoopMoveDOM=!0,g.append(l.slides[j]),l.slides[j].swiperLoopMoveDOM=!1}),l.recalcSlides(),v.slidesPerView==="auto"&&l.updateSlides(),v.watchSlidesProgress&&l.updateSlidesOffset(),t){if(b.length>0&&U)if(typeof e>"u"){const j=l.slidesGrid[F],Q=l.slidesGrid[F+N]-j;o?l.setTranslate(l.translate-Q):(l.slideTo(F+N,0,!1,!0),r&&(l.touches[l.isHorizontal()?"startX":"startY"]+=Q,l.touchEventsData.currentTranslate=l.translate))}else r&&(l.slideToLoop(e,0,!1,!0),l.touchEventsData.currentTranslate=l.translate);else if(w.length>0&&k)if(typeof e>"u"){const j=l.slidesGrid[F],Q=l.slidesGrid[F-te]-j;o?l.setTranslate(l.translate-Q):(l.slideTo(F-te,0,!1,!0),r&&(l.touches[l.isHorizontal()?"startX":"startY"]+=Q,l.touchEventsData.currentTranslate=l.translate))}else l.slideToLoop(e,0,!1,!0)}if(l.allowSlidePrev=d,l.allowSlideNext=f,l.controller&&l.controller.control&&!a){const j={slideRealIndex:e,direction:s,setTranslate:r,activeSlideIndex:n,byController:!0};Array.isArray(l.controller.control)?l.controller.control.forEach(re=>{!re.destroyed&&re.params.loop&&re.loopFix({...j,slideTo:re.params.slidesPerView===v.slidesPerView?t:!1})}):l.controller.control instanceof l.constructor&&l.controller.control.params.loop&&l.controller.control.loopFix({...j,slideTo:l.controller.control.params.slidesPerView===v.slidesPerView?t:!1})}l.emit("loopFix")}function DR(){const i=this,{params:e,slidesEl:t}=i;if(!e.loop||i.virtual&&i.params.virtual.enabled)return;i.recalcSlides();const s=[];i.slides.forEach(r=>{const n=typeof r.swiperSlideIndex>"u"?r.getAttribute("data-swiper-slide-index")*1:r.swiperSlideIndex;s[n]=r}),i.slides.forEach(r=>{r.removeAttribute("data-swiper-slide-index")}),s.forEach(r=>{t.append(r)}),i.recalcSlides(),i.slideTo(i.realIndex,0)}var MR={loopCreate:kR,loopFix:PR,loopDestroy:DR};function FR(i){const e=this;if(!e.params.simulateTouch||e.params.watchOverflow&&e.isLocked||e.params.cssMode)return;const t=e.params.touchEventsTarget==="container"?e.el:e.wrapperEl;e.isElement&&(e.__preventObserver__=!0),t.style.cursor="move",t.style.cursor=i?"grabbing":"grab",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1})}function OR(){const i=this;i.params.watchOverflow&&i.isLocked||i.params.cssMode||(i.isElement&&(i.__preventObserver__=!0),i[i.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",i.isElement&&requestAnimationFrame(()=>{i.__preventObserver__=!1}))}var NR={setGrabCursor:FR,unsetGrabCursor:OR};function BR(i,e){e===void 0&&(e=this);function t(s){if(!s||s===lr()||s===fs())return null;s.assignedSlot&&(s=s.assignedSlot);const r=s.closest(i);return!r&&!s.getRootNode?null:r||t(s.getRootNode().host)}return t(e)}function $R(i){const e=this,t=lr(),s=fs(),r=e.touchEventsData;r.evCache.push(i);const{params:n,touches:a,enabled:o}=e;if(!o||!n.simulateTouch&&i.pointerType==="mouse"||e.animating&&n.preventInteractionOnTransition)return;!e.animating&&n.cssMode&&n.loop&&e.loopFix();let l=i;l.originalEvent&&(l=l.originalEvent);let u=l.target;if(n.touchEventsTarget==="wrapper"&&!e.wrapperEl.contains(u)||"which"in l&&l.which===3||"button"in l&&l.button>0||r.isTouched&&r.isMoved)return;const d=!!n.noSwipingClass&&n.noSwipingClass!=="",f=i.composedPath?i.composedPath():i.path;d&&l.target&&l.target.shadowRoot&&f&&(u=f[0]);const g=n.noSwipingSelector?n.noSwipingSelector:`.${n.noSwipingClass}`,v=!!(l.target&&l.target.shadowRoot);if(n.noSwiping&&(v?BR(g,u):u.closest(g))){e.allowClick=!0;return}if(n.swipeHandler&&!u.closest(n.swipeHandler))return;a.currentX=l.pageX,a.currentY=l.pageY;const y=a.currentX,E=a.currentY,b=n.edgeSwipeDetection||n.iOSEdgeSwipeDetection,w=n.edgeSwipeThreshold||n.iOSEdgeSwipeThreshold;if(b&&(y<=w||y>=s.innerWidth-w))if(b==="prevent")i.preventDefault();else return;Object.assign(r,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=y,a.startY=E,r.touchStartTime=Ya(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,n.threshold>0&&(r.allowThresholdMove=!1);let F=!0;u.matches(r.focusableElements)&&(F=!1,u.nodeName==="SELECT"&&(r.isTouched=!1)),t.activeElement&&t.activeElement.matches(r.focusableElements)&&t.activeElement!==u&&t.activeElement.blur();const k=F&&e.allowTouchMove&&n.touchStartPreventDefault;(n.touchStartForcePreventDefault||k)&&!u.isContentEditable&&l.preventDefault(),n.freeMode&&n.freeMode.enabled&&e.freeMode&&e.animating&&!n.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",l)}function UR(i){const e=lr(),t=this,s=t.touchEventsData,{params:r,touches:n,rtlTranslate:a,enabled:o}=t;if(!o||!r.simulateTouch&&i.pointerType==="mouse")return;let l=i;if(l.originalEvent&&(l=l.originalEvent),!s.isTouched){s.startMoving&&s.isScrolling&&t.emit("touchMoveOpposite",l);return}const u=s.evCache.findIndex(j=>j.pointerId===l.pointerId);u>=0&&(s.evCache[u]=l);const d=s.evCache.length>1?s.evCache[0]:l,f=d.pageX,g=d.pageY;if(l.preventedByNestedSwiper){n.startX=f,n.startY=g;return}if(!t.allowTouchMove){l.target.matches(s.focusableElements)||(t.allowClick=!1),s.isTouched&&(Object.assign(n,{startX:f,startY:g,prevX:t.touches.currentX,prevY:t.touches.currentY,currentX:f,currentY:g}),s.touchStartTime=Ya());return}if(r.touchReleaseOnEdges&&!r.loop){if(t.isVertical()){if(g<n.startY&&t.translate<=t.maxTranslate()||g>n.startY&&t.translate>=t.minTranslate()){s.isTouched=!1,s.isMoved=!1;return}}else if(f<n.startX&&t.translate<=t.maxTranslate()||f>n.startX&&t.translate>=t.minTranslate())return}if(e.activeElement&&l.target===e.activeElement&&l.target.matches(s.focusableElements)){s.isMoved=!0,t.allowClick=!1;return}if(s.allowTouchCallbacks&&t.emit("touchMove",l),l.targetTouches&&l.targetTouches.length>1)return;n.currentX=f,n.currentY=g;const v=n.currentX-n.startX,y=n.currentY-n.startY;if(t.params.threshold&&Math.sqrt(v**2+y**2)<t.params.threshold)return;if(typeof s.isScrolling>"u"){let j;t.isHorizontal()&&n.currentY===n.startY||t.isVertical()&&n.currentX===n.startX?s.isScrolling=!1:v*v+y*y>=25&&(j=Math.atan2(Math.abs(y),Math.abs(v))*180/Math.PI,s.isScrolling=t.isHorizontal()?j>r.touchAngle:90-j>r.touchAngle)}if(s.isScrolling&&t.emit("touchMoveOpposite",l),typeof s.startMoving>"u"&&(n.currentX!==n.startX||n.currentY!==n.startY)&&(s.startMoving=!0),s.isScrolling||t.zoom&&t.params.zoom&&t.params.zoom.enabled&&s.evCache.length>1){s.isTouched=!1;return}if(!s.startMoving)return;t.allowClick=!1,!r.cssMode&&l.cancelable&&l.preventDefault(),r.touchMoveStopPropagation&&!r.nested&&l.stopPropagation();let E=t.isHorizontal()?v:y,b=t.isHorizontal()?n.currentX-n.previousX:n.currentY-n.previousY;r.oneWayMovement&&(E=Math.abs(E)*(a?1:-1),b=Math.abs(b)*(a?1:-1)),n.diff=E,E*=r.touchRatio,a&&(E=-E,b=-b);const w=t.touchesDirection;t.swipeDirection=E>0?"prev":"next",t.touchesDirection=b>0?"prev":"next";const F=t.params.loop&&!r.cssMode,k=t.swipeDirection==="next"&&t.allowSlideNext||t.swipeDirection==="prev"&&t.allowSlidePrev;if(!s.isMoved){if(F&&k&&t.loopFix({direction:t.swipeDirection}),s.startTranslate=t.getTranslate(),t.setTransition(0),t.animating){const j=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});t.wrapperEl.dispatchEvent(j)}s.allowMomentumBounce=!1,r.grabCursor&&(t.allowSlideNext===!0||t.allowSlidePrev===!0)&&t.setGrabCursor(!0),t.emit("sliderFirstMove",l)}let U;s.isMoved&&w!==t.touchesDirection&&F&&k&&Math.abs(E)>=1&&(t.loopFix({direction:t.swipeDirection,setTranslate:!0}),U=!0),t.emit("sliderMove",l),s.isMoved=!0,s.currentTranslate=E+s.startTranslate;let N=!0,te=r.resistanceRatio;if(r.touchReleaseOnEdges&&(te=0),E>0?(F&&k&&!U&&s.currentTranslate>(r.centeredSlides?t.minTranslate()-t.size/2:t.minTranslate())&&t.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),s.currentTranslate>t.minTranslate()&&(N=!1,r.resistance&&(s.currentTranslate=t.minTranslate()-1+(-t.minTranslate()+s.startTranslate+E)**te))):E<0&&(F&&k&&!U&&s.currentTranslate<(r.centeredSlides?t.maxTranslate()+t.size/2:t.maxTranslate())&&t.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:t.slides.length-(r.slidesPerView==="auto"?t.slidesPerViewDynamic():Math.ceil(parseFloat(r.slidesPerView,10)))}),s.currentTranslate<t.maxTranslate()&&(N=!1,r.resistance&&(s.currentTranslate=t.maxTranslate()+1-(t.maxTranslate()-s.startTranslate-E)**te))),N&&(l.preventedByNestedSwiper=!0),!t.allowSlideNext&&t.swipeDirection==="next"&&s.currentTranslate<s.startTranslate&&(s.currentTranslate=s.startTranslate),!t.allowSlidePrev&&t.swipeDirection==="prev"&&s.currentTranslate>s.startTranslate&&(s.currentTranslate=s.startTranslate),!t.allowSlidePrev&&!t.allowSlideNext&&(s.currentTranslate=s.startTranslate),r.threshold>0)if(Math.abs(E)>r.threshold||s.allowThresholdMove){if(!s.allowThresholdMove){s.allowThresholdMove=!0,n.startX=n.currentX,n.startY=n.currentY,s.currentTranslate=s.startTranslate,n.diff=t.isHorizontal()?n.currentX-n.startX:n.currentY-n.startY;return}}else{s.currentTranslate=s.startTranslate;return}!r.followFinger||r.cssMode||((r.freeMode&&r.freeMode.enabled&&t.freeMode||r.watchSlidesProgress)&&(t.updateActiveIndex(),t.updateSlidesClasses()),r.freeMode&&r.freeMode.enabled&&t.freeMode&&t.freeMode.onTouchMove(),t.updateProgress(s.currentTranslate),t.setTranslate(s.currentTranslate))}function GR(i){const e=this,t=e.touchEventsData,s=t.evCache.findIndex(k=>k.pointerId===i.pointerId);if(s>=0&&t.evCache.splice(s,1),["pointercancel","pointerout","pointerleave","contextmenu"].includes(i.type)&&!(["pointercancel","contextmenu"].includes(i.type)&&(e.browser.isSafari||e.browser.isWebView)))return;const{params:r,touches:n,rtlTranslate:a,slidesGrid:o,enabled:l}=e;if(!l||!r.simulateTouch&&i.pointerType==="mouse")return;let u=i;if(u.originalEvent&&(u=u.originalEvent),t.allowTouchCallbacks&&e.emit("touchEnd",u),t.allowTouchCallbacks=!1,!t.isTouched){t.isMoved&&r.grabCursor&&e.setGrabCursor(!1),t.isMoved=!1,t.startMoving=!1;return}r.grabCursor&&t.isMoved&&t.isTouched&&(e.allowSlideNext===!0||e.allowSlidePrev===!0)&&e.setGrabCursor(!1);const d=Ya(),f=d-t.touchStartTime;if(e.allowClick){const k=u.path||u.composedPath&&u.composedPath();e.updateClickedSlide(k&&k[0]||u.target,k),e.emit("tap click",u),f<300&&d-t.lastClickTime<300&&e.emit("doubleTap doubleClick",u)}if(t.lastClickTime=Ya(),Ul(()=>{e.destroyed||(e.allowClick=!0)}),!t.isTouched||!t.isMoved||!e.swipeDirection||n.diff===0||t.currentTranslate===t.startTranslate){t.isTouched=!1,t.isMoved=!1,t.startMoving=!1;return}t.isTouched=!1,t.isMoved=!1,t.startMoving=!1;let g;if(r.followFinger?g=a?e.translate:-e.translate:g=-t.currentTranslate,r.cssMode)return;if(r.freeMode&&r.freeMode.enabled){e.freeMode.onTouchEnd({currentPos:g});return}let v=0,y=e.slidesSizesGrid[0];for(let k=0;k<o.length;k+=k<r.slidesPerGroupSkip?1:r.slidesPerGroup){const U=k<r.slidesPerGroupSkip-1?1:r.slidesPerGroup;typeof o[k+U]<"u"?g>=o[k]&&g<o[k+U]&&(v=k,y=o[k+U]-o[k]):g>=o[k]&&(v=k,y=o[o.length-1]-o[o.length-2])}let E=null,b=null;r.rewind&&(e.isBeginning?b=r.virtual&&r.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(E=0));const w=(g-o[v])/y,F=v<r.slidesPerGroupSkip-1?1:r.slidesPerGroup;if(f>r.longSwipesMs){if(!r.longSwipes){e.slideTo(e.activeIndex);return}e.swipeDirection==="next"&&(w>=r.longSwipesRatio?e.slideTo(r.rewind&&e.isEnd?E:v+F):e.slideTo(v)),e.swipeDirection==="prev"&&(w>1-r.longSwipesRatio?e.slideTo(v+F):b!==null&&w<0&&Math.abs(w)>r.longSwipesRatio?e.slideTo(b):e.slideTo(v))}else{if(!r.shortSwipes){e.slideTo(e.activeIndex);return}e.navigation&&(u.target===e.navigation.nextEl||u.target===e.navigation.prevEl)?u.target===e.navigation.nextEl?e.slideTo(v+F):e.slideTo(v):(e.swipeDirection==="next"&&e.slideTo(E!==null?E:v+F),e.swipeDirection==="prev"&&e.slideTo(b!==null?b:v))}}function Hd(){const i=this,{params:e,el:t}=i;if(t&&t.offsetWidth===0)return;e.breakpoints&&i.setBreakpoint();const{allowSlideNext:s,allowSlidePrev:r,snapGrid:n}=i,a=i.virtual&&i.params.virtual.enabled;i.allowSlideNext=!0,i.allowSlidePrev=!0,i.updateSize(),i.updateSlides(),i.updateSlidesClasses();const o=a&&e.loop;(e.slidesPerView==="auto"||e.slidesPerView>1)&&i.isEnd&&!i.isBeginning&&!i.params.centeredSlides&&!o?i.slideTo(i.slides.length-1,0,!1,!0):i.params.loop&&!a?i.slideToLoop(i.realIndex,0,!1,!0):i.slideTo(i.activeIndex,0,!1,!0),i.autoplay&&i.autoplay.running&&i.autoplay.paused&&(clearTimeout(i.autoplay.resizeTimeout),i.autoplay.resizeTimeout=setTimeout(()=>{i.autoplay&&i.autoplay.running&&i.autoplay.paused&&i.autoplay.resume()},500)),i.allowSlidePrev=r,i.allowSlideNext=s,i.params.watchOverflow&&n!==i.snapGrid&&i.checkOverflow()}function VR(i){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&i.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(i.stopPropagation(),i.stopImmediatePropagation())))}function HR(){const i=this,{wrapperEl:e,rtlTranslate:t,enabled:s}=i;if(!s)return;i.previousTranslate=i.translate,i.isHorizontal()?i.translate=-e.scrollLeft:i.translate=-e.scrollTop,i.translate===0&&(i.translate=0),i.updateActiveIndex(),i.updateSlidesClasses();let r;const n=i.maxTranslate()-i.minTranslate();n===0?r=0:r=(i.translate-i.minTranslate())/n,r!==i.progress&&i.updateProgress(t?-i.translate:i.translate),i.emit("setTranslate",i.translate,!1)}function jR(i){const e=this;Ra(e,i.target),!(e.params.cssMode||e.params.slidesPerView!=="auto"&&!e.params.autoHeight)&&e.update()}let jd=!1;function KR(){}const Kg=(i,e)=>{const t=lr(),{params:s,el:r,wrapperEl:n,device:a}=i,o=!!s.nested,l=e==="on"?"addEventListener":"removeEventListener",u=e;r[l]("pointerdown",i.onTouchStart,{passive:!1}),t[l]("pointermove",i.onTouchMove,{passive:!1,capture:o}),t[l]("pointerup",i.onTouchEnd,{passive:!0}),t[l]("pointercancel",i.onTouchEnd,{passive:!0}),t[l]("pointerout",i.onTouchEnd,{passive:!0}),t[l]("pointerleave",i.onTouchEnd,{passive:!0}),t[l]("contextmenu",i.onTouchEnd,{passive:!0}),(s.preventClicks||s.preventClicksPropagation)&&r[l]("click",i.onClick,!0),s.cssMode&&n[l]("scroll",i.onScroll),s.updateOnWindowResize?i[u](a.ios||a.android?"resize orientationchange observerUpdate":"resize observerUpdate",Hd,!0):i[u]("observerUpdate",Hd,!0),r[l]("load",i.onLoad,{capture:!0})};function zR(){const i=this,e=lr(),{params:t}=i;i.onTouchStart=$R.bind(i),i.onTouchMove=UR.bind(i),i.onTouchEnd=GR.bind(i),t.cssMode&&(i.onScroll=HR.bind(i)),i.onClick=VR.bind(i),i.onLoad=jR.bind(i),jd||(e.addEventListener("touchstart",KR),jd=!0),Kg(i,"on")}function WR(){Kg(this,"off")}var qR={attachEvents:zR,detachEvents:WR};const Kd=(i,e)=>i.grid&&e.grid&&e.grid.rows>1;function YR(){const i=this,{realIndex:e,initialized:t,params:s,el:r}=i,n=s.breakpoints;if(!n||n&&Object.keys(n).length===0)return;const a=i.getBreakpoint(n,i.params.breakpointsBase,i.el);if(!a||i.currentBreakpoint===a)return;const l=(a in n?n[a]:void 0)||i.originalParams,u=Kd(i,s),d=Kd(i,l),f=s.enabled;u&&!d?(r.classList.remove(`${s.containerModifierClass}grid`,`${s.containerModifierClass}grid-column`),i.emitContainerClasses()):!u&&d&&(r.classList.add(`${s.containerModifierClass}grid`),(l.grid.fill&&l.grid.fill==="column"||!l.grid.fill&&s.grid.fill==="column")&&r.classList.add(`${s.containerModifierClass}grid-column`),i.emitContainerClasses()),["navigation","pagination","scrollbar"].forEach(w=>{if(typeof l[w]>"u")return;const F=s[w]&&s[w].enabled,k=l[w]&&l[w].enabled;F&&!k&&i[w].disable(),!F&&k&&i[w].enable()});const g=l.direction&&l.direction!==s.direction,v=s.loop&&(l.slidesPerView!==s.slidesPerView||g),y=s.loop;g&&t&&i.changeDirection(),us(i.params,l);const E=i.params.enabled,b=i.params.loop;Object.assign(i,{allowTouchMove:i.params.allowTouchMove,allowSlideNext:i.params.allowSlideNext,allowSlidePrev:i.params.allowSlidePrev}),f&&!E?i.disable():!f&&E&&i.enable(),i.currentBreakpoint=a,i.emit("_beforeBreakpoint",l),t&&(v?(i.loopDestroy(),i.loopCreate(e),i.updateSlides()):!y&&b?(i.loopCreate(e),i.updateSlides()):y&&!b&&i.loopDestroy()),i.emit("breakpoint",l)}function XR(i,e,t){if(e===void 0&&(e="window"),!i||e==="container"&&!t)return;let s=!1;const r=fs(),n=e==="window"?r.innerHeight:t.clientHeight,a=Object.keys(i).map(o=>{if(typeof o=="string"&&o.indexOf("@")===0){const l=parseFloat(o.substr(1));return{value:n*l,point:o}}return{value:o,point:o}});a.sort((o,l)=>parseInt(o.value,10)-parseInt(l.value,10));for(let o=0;o<a.length;o+=1){const{point:l,value:u}=a[o];e==="window"?r.matchMedia(`(min-width: ${u}px)`).matches&&(s=l):u<=t.clientWidth&&(s=l)}return s||"max"}var QR={setBreakpoint:YR,getBreakpoint:XR};function JR(i,e){const t=[];return i.forEach(s=>{typeof s=="object"?Object.keys(s).forEach(r=>{s[r]&&t.push(e+r)}):typeof s=="string"&&t.push(e+s)}),t}function ZR(){const i=this,{classNames:e,params:t,rtl:s,el:r,device:n}=i,a=JR(["initialized",t.direction,{"free-mode":i.params.freeMode&&t.freeMode.enabled},{autoheight:t.autoHeight},{rtl:s},{grid:t.grid&&t.grid.rows>1},{"grid-column":t.grid&&t.grid.rows>1&&t.grid.fill==="column"},{android:n.android},{ios:n.ios},{"css-mode":t.cssMode},{centered:t.cssMode&&t.centeredSlides},{"watch-progress":t.watchSlidesProgress}],t.containerModifierClass);e.push(...a),r.classList.add(...e),i.emitContainerClasses()}function e_(){const i=this,{el:e,classNames:t}=i;e.classList.remove(...t),i.emitContainerClasses()}var t_={addClasses:ZR,removeClasses:e_};function s_(){const i=this,{isLocked:e,params:t}=i,{slidesOffsetBefore:s}=t;if(s){const r=i.slides.length-1,n=i.slidesGrid[r]+i.slidesSizesGrid[r]+s*2;i.isLocked=i.size>n}else i.isLocked=i.snapGrid.length===1;t.allowSlideNext===!0&&(i.allowSlideNext=!i.isLocked),t.allowSlidePrev===!0&&(i.allowSlidePrev=!i.isLocked),e&&e!==i.isLocked&&(i.isEnd=!1),e!==i.isLocked&&i.emit(i.isLocked?"lock":"unlock")}var i_={checkOverflow:s_},Vl={init:!0,direction:"horizontal",oneWayMovement:!1,touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,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,loopedSlides:null,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",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function r_(i,e){return function(s){s===void 0&&(s={});const r=Object.keys(s)[0],n=s[r];if(typeof n!="object"||n===null){us(e,s);return}if(i[r]===!0&&(i[r]={enabled:!0}),r==="navigation"&&i[r]&&i[r].enabled&&!i[r].prevEl&&!i[r].nextEl&&(i[r].auto=!0),["pagination","scrollbar"].indexOf(r)>=0&&i[r]&&i[r].enabled&&!i[r].el&&(i[r].auto=!0),!(r in i&&"enabled"in n)){us(e,s);return}typeof i[r]=="object"&&!("enabled"in i[r])&&(i[r].enabled=!0),i[r]||(i[r]={enabled:!1}),us(e,s)}}const fl={eventsEmitter:tR,update:dR,translate:yR,transition:bR,slide:IR,loop:MR,grabCursor:NR,events:qR,breakpoints:QR,checkOverflow:i_,classes:t_},pl={};let Oc=class pi{constructor(){let e,t;for(var s=arguments.length,r=new Array(s),n=0;n<s;n++)r[n]=arguments[n];r.length===1&&r[0].constructor&&Object.prototype.toString.call(r[0]).slice(8,-1)==="Object"?t=r[0]:[e,t]=r,t||(t={}),t=us({},t),e&&!t.el&&(t.el=e);const a=lr();if(t.el&&typeof t.el=="string"&&a.querySelectorAll(t.el).length>1){const d=[];return a.querySelectorAll(t.el).forEach(f=>{const g=us({},t,{el:f});d.push(new pi(g))}),d}const o=this;o.__swiper__=!0,o.support=Hg(),o.device=XC({userAgent:t.userAgent}),o.browser=JC(),o.eventsListeners={},o.eventsAnyListeners=[],o.modules=[...o.__modules__],t.modules&&Array.isArray(t.modules)&&o.modules.push(...t.modules);const l={};o.modules.forEach(d=>{d({params:t,swiper:o,extendParams:r_(t,l),on:o.on.bind(o),once:o.once.bind(o),off:o.off.bind(o),emit:o.emit.bind(o)})});const u=us({},Vl,l);return o.params=us({},u,pl,t),o.originalParams=us({},o.params),o.passedParams=us({},t),o.params&&o.params.on&&Object.keys(o.params.on).forEach(d=>{o.on(d,o.params.on[d])}),o.params&&o.params.onAny&&o.onAny(o.params.onAny),Object.assign(o,{enabled:o.params.enabled,el:e,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return o.params.direction==="horizontal"},isVertical(){return o.params.direction==="vertical"},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,evCache:[]},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}getSlideIndex(e){const{slidesEl:t,params:s}=this,r=vi(t,`.${s.slideClass}, swiper-slide`),n=Gd(r[0]);return Gd(e)-n}getSlideIndexByData(e){return this.getSlideIndex(this.slides.filter(t=>t.getAttribute("data-swiper-slide-index")*1===e)[0])}recalcSlides(){const e=this,{slidesEl:t,params:s}=e;e.slides=vi(t,`.${s.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 s=this;e=Math.min(Math.max(e,0),1);const r=s.minTranslate(),a=(s.maxTranslate()-r)*e+r;s.translateTo(a,typeof t>"u"?0:t),s.updateActiveIndex(),s.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=e.el.className.split(" ").filter(s=>s.indexOf("swiper")===0||s.indexOf(e.params.containerModifierClass)===0);e.emit("_containerClasses",t.join(" "))}getSlideClasses(e){const t=this;return t.destroyed?"":e.className.split(" ").filter(s=>s.indexOf("swiper-slide")===0||s.indexOf(t.params.slideClass)===0).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=[];e.slides.forEach(s=>{const r=e.getSlideClasses(s);t.push({slideEl:s,classNames:r}),e.emit("_slideClass",s,r)}),e.emit("_slideClasses",t)}slidesPerViewDynamic(e,t){e===void 0&&(e="current"),t===void 0&&(t=!1);const s=this,{params:r,slides:n,slidesGrid:a,slidesSizesGrid:o,size:l,activeIndex:u}=s;let d=1;if(typeof r.slidesPerView=="number")return r.slidesPerView;if(r.centeredSlides){let f=n[u]?n[u].swiperSlideSize:0,g;for(let v=u+1;v<n.length;v+=1)n[v]&&!g&&(f+=n[v].swiperSlideSize,d+=1,f>l&&(g=!0));for(let v=u-1;v>=0;v-=1)n[v]&&!g&&(f+=n[v].swiperSlideSize,d+=1,f>l&&(g=!0))}else if(e==="current")for(let f=u+1;f<n.length;f+=1)(t?a[f]+o[f]-a[u]<l:a[f]-a[u]<l)&&(d+=1);else for(let f=u-1;f>=0;f-=1)a[u]-a[f]<l&&(d+=1);return d}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:s}=e;s.breakpoints&&e.setBreakpoint(),[...e.el.querySelectorAll('[loading="lazy"]')].forEach(a=>{a.complete&&Ra(e,a)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses();function r(){const a=e.rtlTranslate?e.translate*-1:e.translate,o=Math.min(Math.max(a,e.maxTranslate()),e.minTranslate());e.setTranslate(o),e.updateActiveIndex(),e.updateSlidesClasses()}let n;if(s.freeMode&&s.freeMode.enabled&&!s.cssMode)r(),s.autoHeight&&e.updateAutoHeight();else{if((s.slidesPerView==="auto"||s.slidesPerView>1)&&e.isEnd&&!s.centeredSlides){const a=e.virtual&&s.virtual.enabled?e.virtual.slides:e.slides;n=e.slideTo(a.length-1,0,!1,!0)}else n=e.slideTo(e.activeIndex,0,!1,!0);n||r()}s.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t){t===void 0&&(t=!0);const s=this,r=s.params.direction;return e||(e=r==="horizontal"?"vertical":"horizontal"),e===r||e!=="horizontal"&&e!=="vertical"||(s.el.classList.remove(`${s.params.containerModifierClass}${r}`),s.el.classList.add(`${s.params.containerModifierClass}${e}`),s.emitContainerClasses(),s.params.direction=e,s.slides.forEach(n=>{e==="vertical"?n.style.width="":n.style.height=""}),s.emit("changeDirection"),t&&s.update()),s}changeLanguageDirection(e){const t=this;t.rtl&&e==="rtl"||!t.rtl&&e==="ltr"||(t.rtl=e==="rtl",t.rtlTranslate=t.params.direction==="horizontal"&&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 s=e||t.params.el;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return!1;s.swiper=t,s.parentNode&&s.parentNode.host&&s.parentNode.host.nodeName==="SWIPER-CONTAINER"&&(t.isElement=!0);const r=()=>`.${(t.params.wrapperClass||"").trim().split(" ").join(".")}`;let a=s&&s.shadowRoot&&s.shadowRoot.querySelector?s.shadowRoot.querySelector(r()):vi(s,r())[0];return!a&&t.params.createElements&&(a=jC("div",t.params.wrapperClass),s.append(a),vi(s,`.${t.params.slideClass}`).forEach(o=>{a.append(o)})),Object.assign(t,{el:s,wrapperEl:a,slidesEl:t.isElement&&!s.parentNode.host.slideSlots?s.parentNode.host:a,hostEl:t.isElement?s.parentNode.host:s,mounted:!0,rtl:s.dir.toLowerCase()==="rtl"||Bi(s,"direction")==="rtl",rtlTranslate:t.params.direction==="horizontal"&&(s.dir.toLowerCase()==="rtl"||Bi(s,"direction")==="rtl"),wrongRTL:Bi(a,"display")==="-webkit-box"}),!0}init(e){const t=this;if(t.initialized||t.mount(e)===!1)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(n=>{n.complete?Ra(t,n):n.addEventListener("load",a=>{Ra(t,a.target)})}),Gl(t),t.initialized=!0,Gl(t),t.emit("init"),t.emit("afterInit"),t}destroy(e,t){e===void 0&&(e=!0),t===void 0&&(t=!0);const s=this,{params:r,el:n,wrapperEl:a,slides:o}=s;return typeof s.params>"u"||s.destroyed||(s.emit("beforeDestroy"),s.initialized=!1,s.detachEvents(),r.loop&&s.loopDestroy(),t&&(s.removeClasses(),n.removeAttribute("style"),a.removeAttribute("style"),o&&o.length&&o.forEach(l=>{l.classList.remove(r.slideVisibleClass,r.slideActiveClass,r.slideNextClass,r.slidePrevClass),l.removeAttribute("style"),l.removeAttribute("data-swiper-slide-index")})),s.emit("destroy"),Object.keys(s.eventsListeners).forEach(l=>{s.off(l)}),e!==!1&&(s.el.swiper=null,UC(s)),s.destroyed=!0),null}static extendDefaults(e){us(pl,e)}static get extendedDefaults(){return pl}static get defaults(){return Vl}static installModule(e){pi.prototype.__modules__||(pi.prototype.__modules__=[]);const t=pi.prototype.__modules__;typeof e=="function"&&t.indexOf(e)<0&&t.push(e)}static use(e){return Array.isArray(e)?(e.forEach(t=>pi.installModule(t)),pi):(pi.installModule(e),pi)}};Object.keys(fl).forEach(i=>{Object.keys(fl[i]).forEach(e=>{Oc.prototype[e]=fl[i][e]})});Oc.use([ZC,eR]);const zg=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","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","loopedSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideNextClass","slidePrevClass","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 or(i){return typeof i=="object"&&i!==null&&i.constructor&&Object.prototype.toString.call(i).slice(8,-1)==="Object"&&!i.__swiper__}function rr(i,e){const t=["__proto__","constructor","prototype"];Object.keys(e).filter(s=>t.indexOf(s)<0).forEach(s=>{typeof i[s]>"u"?i[s]=e[s]:or(e[s])&&or(i[s])&&Object.keys(e[s]).length>0?e[s].__swiper__?i[s]=e[s]:rr(i[s],e[s]):i[s]=e[s]})}function Wg(i){return i===void 0&&(i={}),i.navigation&&typeof i.navigation.nextEl>"u"&&typeof i.navigation.prevEl>"u"}function qg(i){return i===void 0&&(i={}),i.pagination&&typeof i.pagination.el>"u"}function Yg(i){return i===void 0&&(i={}),i.scrollbar&&typeof i.scrollbar.el>"u"}function Xg(i){i===void 0&&(i="");const e=i.split(" ").map(s=>s.trim()).filter(s=>!!s),t=[];return e.forEach(s=>{t.indexOf(s)<0&&t.push(s)}),t.join(" ")}function n_(i){return i===void 0&&(i=""),i?i.includes("swiper-wrapper")?i:`swiper-wrapper ${i}`:"swiper-wrapper"}function a_(i){let{swiper:e,slides:t,passedParams:s,changedParams:r,nextEl:n,prevEl:a,scrollbarEl:o,paginationEl:l}=i;const u=r.filter(Q=>Q!=="children"&&Q!=="direction"&&Q!=="wrapperClass"),{params:d,pagination:f,navigation:g,scrollbar:v,virtual:y,thumbs:E}=e;let b,w,F,k,U,N,te,j;r.includes("thumbs")&&s.thumbs&&s.thumbs.swiper&&d.thumbs&&!d.thumbs.swiper&&(b=!0),r.includes("controller")&&s.controller&&s.controller.control&&d.controller&&!d.controller.control&&(w=!0),r.includes("pagination")&&s.pagination&&(s.pagination.el||l)&&(d.pagination||d.pagination===!1)&&f&&!f.el&&(F=!0),r.includes("scrollbar")&&s.scrollbar&&(s.scrollbar.el||o)&&(d.scrollbar||d.scrollbar===!1)&&v&&!v.el&&(k=!0),r.includes("navigation")&&s.navigation&&(s.navigation.prevEl||a)&&(s.navigation.nextEl||n)&&(d.navigation||d.navigation===!1)&&g&&!g.prevEl&&!g.nextEl&&(U=!0);const re=Q=>{e[Q]&&(e[Q].destroy(),Q==="navigation"?(e.isElement&&(e[Q].prevEl.remove(),e[Q].nextEl.remove()),d[Q].prevEl=void 0,d[Q].nextEl=void 0,e[Q].prevEl=void 0,e[Q].nextEl=void 0):(e.isElement&&e[Q].el.remove(),d[Q].el=void 0,e[Q].el=void 0))};r.includes("loop")&&e.isElement&&(d.loop&&!s.loop?N=!0:!d.loop&&s.loop?te=!0:j=!0),u.forEach(Q=>{if(or(d[Q])&&or(s[Q]))rr(d[Q],s[Q]),(Q==="navigation"||Q==="pagination"||Q==="scrollbar")&&"enabled"in s[Q]&&!s[Q].enabled&&re(Q);else{const le=s[Q];(le===!0||le===!1)&&(Q==="navigation"||Q==="pagination"||Q==="scrollbar")?le===!1&&re(Q):d[Q]=s[Q]}}),u.includes("controller")&&!w&&e.controller&&e.controller.control&&d.controller&&d.controller.control&&(e.controller.control=d.controller.control),r.includes("children")&&t&&y&&d.virtual.enabled&&(y.slides=t,y.update(!0)),r.includes("children")&&t&&d.loop&&(j=!0),b&&E.init()&&E.update(!0),w&&(e.controller.control=d.controller.control),F&&(e.isElement&&(!l||typeof l=="string")&&(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),e.el.appendChild(l)),l&&(d.pagination.el=l),f.init(),f.render(),f.update()),k&&(e.isElement&&(!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-scrollbar"),o.part.add("scrollbar"),e.el.appendChild(o)),o&&(d.scrollbar.el=o),v.init(),v.updateSize(),v.setTranslate()),U&&(e.isElement&&((!n||typeof n=="string")&&(n=document.createElement("div"),n.classList.add("swiper-button-next"),n.innerHTML=e.hostEl.constructor.nextButtonSvg,n.part.add("button-next"),e.el.appendChild(n)),(!a||typeof a=="string")&&(a=document.createElement("div"),a.classList.add("swiper-button-prev"),a.innerHTML=e.hostEl.constructor.prevButtonSvg,a.part.add("button-prev"),e.el.appendChild(a))),n&&(d.navigation.nextEl=n),a&&(d.navigation.prevEl=a),g.init(),g.update()),r.includes("allowSlideNext")&&(e.allowSlideNext=s.allowSlideNext),r.includes("allowSlidePrev")&&(e.allowSlidePrev=s.allowSlidePrev),r.includes("direction")&&e.changeDirection(s.direction,!1),(N||j)&&e.loopDestroy(),(te||j)&&e.loopCreate(),e.update()}function o_(i,e){i===void 0&&(i={}),e===void 0&&(e=!0);const t={on:{}},s={},r={};rr(t,Vl),t._emitClasses=!0,t.init=!1;const n={},a=zg.map(l=>l.replace(/_/,"")),o=Object.assign({},i);return Object.keys(o).forEach(l=>{typeof i[l]>"u"||(a.indexOf(l)>=0?or(i[l])?(t[l]={},r[l]={},rr(t[l],i[l]),rr(r[l],i[l])):(t[l]=i[l],r[l]=i[l]):l.search(/on[A-Z]/)===0&&typeof i[l]=="function"?e?s[`${l[2].toLowerCase()}${l.substr(3)}`]=i[l]:t.on[`${l[2].toLowerCase()}${l.substr(3)}`]=i[l]:n[l]=i[l])}),["navigation","pagination","scrollbar"].forEach(l=>{t[l]===!0&&(t[l]={}),t[l]===!1&&delete t[l]}),{params:t,passedParams:r,rest:n,events:s}}function l_(i,e){let{el:t,nextEl:s,prevEl:r,paginationEl:n,scrollbarEl:a,swiper:o}=i;Wg(e)&&s&&r&&(o.params.navigation.nextEl=s,o.originalParams.navigation.nextEl=s,o.params.navigation.prevEl=r,o.originalParams.navigation.prevEl=r),qg(e)&&n&&(o.params.pagination.el=n,o.originalParams.pagination.el=n),Yg(e)&&a&&(o.params.scrollbar.el=a,o.originalParams.scrollbar.el=a),o.init(t)}function c_(i,e,t,s,r){const n=[];if(!e)return n;const a=l=>{n.indexOf(l)<0&&n.push(l)};if(t&&s){const l=s.map(r),u=t.map(r);l.join("")!==u.join("")&&a("children"),s.length!==t.length&&a("children")}return zg.filter(l=>l[0]==="_").map(l=>l.replace(/_/,"")).forEach(l=>{if(l in i&&l in e)if(or(i[l])&&or(e[l])){const u=Object.keys(i[l]),d=Object.keys(e[l]);u.length!==d.length?a(l):(u.forEach(f=>{i[l][f]!==e[l][f]&&a(l)}),d.forEach(f=>{i[l][f]!==e[l][f]&&a(l)}))}else i[l]!==e[l]&&a(l)}),n}const u_=i=>{!i||i.destroyed||!i.params.virtual||i.params.virtual&&!i.params.virtual.enabled||(i.updateSlides(),i.updateProgress(),i.updateSlidesClasses(),i.parallax&&i.params.parallax&&i.params.parallax.enabled&&i.parallax.setTranslate())};function Xa(){return Xa=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Xa.apply(this,arguments)}function Qg(i){return i.type&&i.type.displayName&&i.type.displayName.includes("SwiperSlide")}function Jg(i){const e=[];return fe.Children.toArray(i).forEach(t=>{Qg(t)?e.push(t):t.props&&t.props.children&&Jg(t.props.children).forEach(s=>e.push(s))}),e}function h_(i){const e=[],t={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return fe.Children.toArray(i).forEach(s=>{if(Qg(s))e.push(s);else if(s.props&&s.props.slot&&t[s.props.slot])t[s.props.slot].push(s);else if(s.props&&s.props.children){const r=Jg(s.props.children);r.length>0?r.forEach(n=>e.push(n)):t["container-end"].push(s)}else t["container-end"].push(s)}),{slides:e,slots:t}}function d_(i,e,t){if(!t)return null;const s=d=>{let f=d;return d<0?f=e.length+d:f>=e.length&&(f=f-e.length),f},r=i.isHorizontal()?{[i.rtlTranslate?"right":"left"]:`${t.offset}px`}:{top:`${t.offset}px`},{from:n,to:a}=t,o=i.params.loop?-e.length:0,l=i.params.loop?e.length*2:e.length,u=[];for(let d=o;d<l;d+=1)d>=n&&d<=a&&u.push(e[s(d)]);return u.map((d,f)=>fe.cloneElement(d,{swiper:i,style:r,key:`slide-${f}`}))}function Sn(i,e){return typeof window>"u"?fe.useEffect(i,e):fe.useLayoutEffect(i,e)}const zd=fe.createContext(null),f_=fe.createContext(null),p_=fe.forwardRef(function(i,e){let{className:t,tag:s="div",wrapperTag:r="div",children:n,onSwiper:a,...o}=i===void 0?{}:i,l=!1;const[u,d]=fe.useState("swiper"),[f,g]=fe.useState(null),[v,y]=fe.useState(!1),E=fe.useRef(!1),b=fe.useRef(null),w=fe.useRef(null),F=fe.useRef(null),k=fe.useRef(null),U=fe.useRef(null),N=fe.useRef(null),te=fe.useRef(null),j=fe.useRef(null),{params:re,passedParams:Q,rest:le,events:se}=o_(o),{slides:pe,slots:de}=h_(n),be=()=>{y(!v)};Object.assign(re.on,{_containerClasses(me,ye){d(ye)}});const Le=()=>{Object.assign(re.on,se),l=!0;const me={...re};if(delete me.wrapperClass,w.current=new Oc(me),w.current.virtual&&w.current.params.virtual.enabled){w.current.virtual.slides=pe;const ye={cache:!1,slides:pe,renderExternal:g,renderExternalUpdate:!1};rr(w.current.params.virtual,ye),rr(w.current.originalParams.virtual,ye)}};b.current||Le(),w.current&&w.current.on("_beforeBreakpoint",be);const ue=()=>{l||!se||!w.current||Object.keys(se).forEach(me=>{w.current.on(me,se[me])})},he=()=>{!se||!w.current||Object.keys(se).forEach(me=>{w.current.off(me,se[me])})};fe.useEffect(()=>()=>{w.current&&w.current.off("_beforeBreakpoint",be)}),fe.useEffect(()=>{!E.current&&w.current&&(w.current.emitSlidesClasses(),E.current=!0)}),Sn(()=>{if(e&&(e.current=b.current),!!b.current)return w.current.destroyed&&Le(),l_({el:b.current,nextEl:U.current,prevEl:N.current,paginationEl:te.current,scrollbarEl:j.current,swiper:w.current},re),a&&a(w.current),()=>{w.current&&!w.current.destroyed&&w.current.destroy(!0,!1)}},[]),Sn(()=>{ue();const me=c_(Q,F.current,pe,k.current,ye=>ye.key);return F.current=Q,k.current=pe,me.length&&w.current&&!w.current.destroyed&&a_({swiper:w.current,slides:pe,passedParams:Q,changedParams:me,nextEl:U.current,prevEl:N.current,scrollbarEl:j.current,paginationEl:te.current}),()=>{he()}}),Sn(()=>{u_(w.current)},[f]);function we(){return re.virtual?d_(w.current,pe,f):pe.map((me,ye)=>fe.cloneElement(me,{swiper:w.current,swiperSlideIndex:ye}))}return fe.createElement(s,Xa({ref:b,className:Xg(`${u}${t?` ${t}`:""}`)},le),fe.createElement(f_.Provider,{value:w.current},de["container-start"],fe.createElement(r,{className:n_(re.wrapperClass)},de["wrapper-start"],we(),de["wrapper-end"]),Wg(re)&&fe.createElement(fe.Fragment,null,fe.createElement("div",{ref:N,className:"swiper-button-prev"}),fe.createElement("div",{ref:U,className:"swiper-button-next"})),Yg(re)&&fe.createElement("div",{ref:j,className:"swiper-scrollbar"}),qg(re)&&fe.createElement("div",{ref:te,className:"swiper-pagination"}),de["container-end"]))});p_.displayName="Swiper";const g_=fe.forwardRef(function(i,e){let{tag:t="div",children:s,className:r="",swiper:n,zoom:a,lazy:o,virtualIndex:l,swiperSlideIndex:u,...d}=i===void 0?{}:i;const f=fe.useRef(null),[g,v]=fe.useState("swiper-slide"),[y,E]=fe.useState(!1);function b(U,N,te){N===f.current&&v(te)}Sn(()=>{if(typeof u<"u"&&(f.current.swiperSlideIndex=u),e&&(e.current=f.current),!(!f.current||!n)){if(n.destroyed){g!=="swiper-slide"&&v("swiper-slide");return}return n.on("_slideClass",b),()=>{n&&n.off("_slideClass",b)}}}),Sn(()=>{n&&f.current&&!n.destroyed&&v(n.getSlideClasses(f.current))},[n]);const w={isActive:g.indexOf("swiper-slide-active")>=0,isVisible:g.indexOf("swiper-slide-visible")>=0,isPrev:g.indexOf("swiper-slide-prev")>=0,isNext:g.indexOf("swiper-slide-next")>=0},F=()=>typeof s=="function"?s(w):s,k=()=>{E(!0)};return fe.createElement(t,Xa({ref:f,className:Xg(`${g}${r?` ${r}`:""}`),"data-swiper-slide-index":l,onLoad:k},d),a&&fe.createElement(zd.Provider,{value:w},fe.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":typeof a=="number"?a:void 0},F(),o&&!y&&fe.createElement("div",{className:"swiper-lazy-preloader"}))),!a&&fe.createElement(zd.Provider,{value:w},F(),o&&!y&&fe.createElement("div",{className:"swiper-lazy-preloader"})))});g_.displayName="SwiperSlide";const m_=[{key:"entryTime",title:"진입 시간",value:"",accumulate:!1},{key:"lastUpdated",title:"데이터 업데이트 시간",value:"",accumulate:!1},{key:"clientId",title:"클라이언트 ID",value:"",accumulate:!1},{key:"id",title:"ID",value:"",accumulate:!1},{key:"likeCount",title:"좋아요수",value:[0,0],accumulate:!0},{key:"commentCount",title:"댓글수",value:0,accumulate:!0},{key:"viewCount",title:"조회수",value:[0,0],accumulate:!0},{key:"watchingTime",title:"누적 WT(초)",value:0,accumulate:!1},{key:"shareCount",title:"공유수",value:0,accumulate:!0},{key:"chattingCount",title:"채팅수",value:0,accumulate:!0},{key:"productCount",title:"상품 클릭수",value:0,accumulate:!0},{key:"bannerCount",title:"배너 클릭수",value:0,type:!0},{key:"userId",title:"유저 ID",value:"",accumulate:!1},{key:"authType",title:"회원 타입",value:"",accumulate:!1},{key:"expireTime",title:"회원 만료 시간",value:"",accumulate:!1},{key:"info",title:"OS / 브라우저 정보",value:"",accumulate:!1},{key:"version",title:"플레이어 버전",value:"",accumulate:!1}];m_.findIndex(i=>i.key==="lastUpdated");var Vt=[];for(var gl=0;gl<256;++gl)Vt.push((gl+256).toString(16).slice(1));function v_(i,e=0){return(Vt[i[e+0]]+Vt[i[e+1]]+Vt[i[e+2]]+Vt[i[e+3]]+"-"+Vt[i[e+4]]+Vt[i[e+5]]+"-"+Vt[i[e+6]]+Vt[i[e+7]]+"-"+Vt[i[e+8]]+Vt[i[e+9]]+"-"+Vt[i[e+10]]+Vt[i[e+11]]+Vt[i[e+12]]+Vt[i[e+13]]+Vt[i[e+14]]+Vt[i[e+15]]).toLowerCase()}var va,y_=new Uint8Array(16);function x_(){if(!va&&(va=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!va))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return va(y_)}var S_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Wd={randomUUID:S_};function E_(i,e,t){if(Wd.randomUUID&&!e&&!i)return Wd.randomUUID();i=i||{};var s=i.random||(i.rng||x_)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,v_(s)}const b_="_root_1y479_2",T_="_checkbox_1y479_22",w_="_checkbox_input_1y479_31",A_="_checkbox_label_1y479_35",L_="_toggle_1y479_57",C_="_toggle_input_1y479_66",R_="_toggle_label_1y479_71",Hs={root:b_,checkbox:T_,checkbox_input:w_,checkbox_label:A_,toggle:L_,toggle_input:C_,toggle_label:R_};fe.forwardRef(({id:i,type:e="text",autoComplete:t="off",className:s,...r},n)=>{const o=fe.useRef(i||E_()).current;return e==="toggle"?Ne.jsxs("div",{className:`${Hs.root} ${Hs.toggle} ${s||""}`,children:[Ne.jsx("input",{ref:n,className:Hs.toggle_input,type:"checkbox",id:o,...r}),Ne.jsx("label",{className:Hs.toggle_label,htmlFor:o,children:Ne.jsx("span",{className:Hs.cursor})})]}):e==="checkbox"?Ne.jsxs("div",{className:`${Hs.root} ${Hs.checkbox} ${s||""}`,children:[Ne.jsx("input",{ref:n,className:Hs.checkbox_input,type:"checkbox",id:o,...r}),Ne.jsx("label",{className:Hs.checkbox_label,htmlFor:o})]}):Ne.jsx("input",{ref:n,id:o,type:e,autoComplete:t,className:`${Hs.root} ${s||""}`,...r})});function Hl(i){this.message=i}Hl.prototype=new Error,Hl.prototype.name="InvalidCharacterError";var qd=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(i){var e=String(i).replace(/=+$/,"");if(e.length%4==1)throw new Hl("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,s,r=0,n=0,a="";s=e.charAt(n++);~s&&(t=r%4?64*t+s:s,r++%4)?a+=String.fromCharCode(255&t>>(-2*r&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);return a};function __(i){var e=i.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(qd(t).replace(/(.)/g,function(s,r){var n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(e)}catch{return qd(e)}}function Qa(i){this.message=i}function Yd(i,e){if(typeof i!="string")throw new Qa("Invalid token specified");var t=(e=e||{}).header===!0?0:1;try{return JSON.parse(__(i.split(".")[t]))}catch(s){throw new Qa("Invalid token specified: "+s.message)}}Qa.prototype=new Error,Qa.prototype.name="InvalidTokenError";const Zg={dev:"https://dev.api.brixcloud.io/v1",stage:"https://stage.api.brixcloud.io/v1",prod:"https://api.brixcloud.io/v1"},I_={dev:"https://dev.auth.brixcloud.io/v1",stage:"https://stage.auth.brixcloud.io/v1",prod:"https://auth.brixcloud.io/v1"},k_=async({id:i,env:e})=>{const t=await fetch(Zg[e]+`/public/ugc/${i}`),s=await t.json();if(!t.ok)throw s;return s},P_=async({id:i,env:e})=>{function t(n){return{statusCode:n.statusCode,success:n.success,timestamp:n.timestamp,userId:n.shortform.clientId,nickName:void 0,title:n.shortform.title,content:void 0,images:n.shortform.images,tags:n.shortform.tags,enableComment:n.shortform.enableComment,metaData:void 0,id:n.shortform.id,client:{id:n.shortform.clientId,name:void 0},products:void 0,counter:n.shortform.counter,playUrl:n.shortform.playUrl}}const s=await fetch(Zg[e]+`/public/shortform/${i}?onlyOne=true`),r=await s.json();if(!s.ok)throw r;return t(r)},D_=async({clientId:i,token:e,env:t})=>{const s=`__brix_session_token_${i}`,r="__brix_session_api_status";let n=e??localStorage.getItem(s);if(n)try{Yd(n).exp*1e3-Date.now()<0&&(n=null)}catch{n=null}if(!n)if(sessionStorage.getItem(r)==="pending")for(;sessionStorage.getItem(r)==="pending";)await new Promise(o=>setTimeout(o,100)),n=localStorage.getItem(s);else try{sessionStorage.setItem(s,"pending"),n=(await(await fetch(I_[t]+"/auth/token/guest",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({partner:i})})).json()).accessToken}finally{sessionStorage.setItem(s,"success")}return localStorage.setItem(s,n),Yd(n)},Xd=(i,e=!1)=>{const[t,s]=fe.useState(null),[r,n]=fe.useState(null);return fe.useEffect(()=>{if(e)return;(async()=>{try{const o=await i();s(o),n(null)}catch(o){s(null),n(o.message)}})()},[i,e]),{data:t,error:r}};function M_({id:i,type:e,env:t,shadow:s,token:r,style:n,ratio:a,loop:o,autoplay:l=!0,restartFromBeginning:u=!0,className:d}){var Le,ue;if(!i||!e||!t)throw new Error("id, type, env는 필수값입니다.");const[f,g]=fe.useState(),[v,y]=fe.useState(0),[E,b]=fe.useState(!0),[w,F]=fe.useState(!1),{data:k}=Xd(fe.useCallback(()=>e==="ugc"?k_({id:i,env:t}):P_({id:i,env:t}),[i,t]),!i),U=fe.useRef(),{data:N}=Xd(fe.useCallback(()=>{var he;return D_({clientId:(he=k==null?void 0:k.client)==null?void 0:he.id,env:t,token:r})},[(Le=k==null?void 0:k.client)==null?void 0:Le.id,t,r]),!((ue=k==null?void 0:k.client)!=null&&ue.id)),te=fe.useRef(null),j=w1({ref:te,threshold:.1}),re=fe.useCallback(he=>{g(he),he.loop=!!o},[]),Q=fe.useCallback(()=>{g(void 0)},[]),le=()=>{f&&f.play()},se=()=>{f&&f.pause()},pe=(he,we)=>{if(he.stopPropagation(),!f)return;const me=we*f.duration/100;f.currentTime=me},de=he=>{he.stopPropagation(),f&&(f.muted=!f.muted,b(f.muted))},be=fe.useMemo(()=>{var he,we;return t?new y1({identityPoolId:(he=dh[t])==null?void 0:he.identityPoolId,streamName:(we=dh[t])==null?void 0:we.streamName}):void 0},[t]);return fe.useEffect(()=>{if(!f||!be)return;const he=Ve=>{const $e=Ve.target;y($e.currentTime/$e.duration*100)},we=()=>{F(!0),u&&(f.currentTime=0),be.start()},me=()=>{F(!1),be.stop()},ye=()=>{l?f.play():f.pause()};return f.addEventListener("loadedmetadata",ye),f.addEventListener("timeupdate",he),f.addEventListener("play",we),f.addEventListener("pause",me),()=>{f.removeEventListener("loadedmetadata",ye),f.removeEventListener("timeupdate",he),f.removeEventListener("play",we),f.removeEventListener("pause",me)}},[f,be]),fe.useEffect(()=>{f&&(U.current&&clearTimeout(U.current),j&&l&&(U.current=setTimeout(()=>{f.play()},300)),j||(U.current=setTimeout(()=>{f.pause()},700)))},[j,f]),fe.useEffect(()=>{!t||!N||!i||!be||(be.setType(e),be.setId(i),be.setUser(N.userId,N.role),be.stop())},[be]),(k==null?void 0:k.status)==="standby"||(k==null?void 0:k.status)==="converting"?Ne.jsx("div",{className:Us.root,children:Ne.jsx("div",{className:Us.error,children:`업로드된 영상이 처리중 입니다.
|
|
85
|
-
잠시 후 확인해 주세요.`})}):Ne.jsx(S1,{kinesis:be,children:Ne.jsxs("div",{ref:te,className:[Us.root,d??""].join(" "),style:n,children:[Ne.jsx(BC,{ratio:a,className:Us.player,controls:!1,shadow:s,src:k==null?void 0:k.playUrl,onInit:re,onDestroy:Q}),!w&&Ne.jsx("div",{className:Us.play_button,onClick:le}),w&&Ne.jsx("div",{className:Us.pause_button,onClick:se}),Ne.jsx("div",{className:[Us.mute_button,E?Us.sound_off_icon:Us.sound_on_icon].join(" "),onClick:de}),Ne.jsx(Ug,{className:Us.progress,progress:v,onChangeProgress:pe})]})})}exports.CognitoIdentityClient=wp;exports.Command=Ql;exports.HttpRequest=ns;exports.PlayerUser=M_;exports.ServiceException=to;exports._json=
|
|
86
|
-
//# sourceMappingURL=
|
|
85
|
+
*/var Ie=function(){var c=Math.cos,h=Math.sin,p=Math.tan,m=Math.round;function S(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function x(T){if(T===0)return this;var R=c(T),ne=h(T);return this._t(R,-ne,0,0,ne,R,0,0,0,0,1,0,0,0,0,1)}function A(T){if(T===0)return this;var R=c(T),ne=h(T);return this._t(1,0,0,0,0,R,-ne,0,0,ne,R,0,0,0,0,1)}function D(T){if(T===0)return this;var R=c(T),ne=h(T);return this._t(R,0,ne,0,0,1,0,0,-ne,0,R,0,0,0,0,1)}function L(T){if(T===0)return this;var R=c(T),ne=h(T);return this._t(R,-ne,0,0,ne,R,0,0,0,0,1,0,0,0,0,1)}function B(T,R){return this._t(1,R,T,1,0,0)}function V(T,R){return this.shear(p(T),p(R))}function ee(T,R){var ne=c(R),X=h(R);return this._t(ne,X,0,0,-X,ne,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,p(T),1,0,0,0,0,1,0,0,0,0,1)._t(ne,-X,0,0,X,ne,0,0,0,0,1,0,0,0,0,1)}function I(T,R,ne){return!ne&&ne!==0&&(ne=1),T===1&&R===1&&ne===1?this:this._t(T,0,0,0,0,R,0,0,0,0,ne,0,0,0,0,1)}function H(T,R,ne,X,Re,Ue,ze,nt,at,It,Zt,Bs,es,Ut,cs,ft){return this.props[0]=T,this.props[1]=R,this.props[2]=ne,this.props[3]=X,this.props[4]=Re,this.props[5]=Ue,this.props[6]=ze,this.props[7]=nt,this.props[8]=at,this.props[9]=It,this.props[10]=Zt,this.props[11]=Bs,this.props[12]=es,this.props[13]=Ut,this.props[14]=cs,this.props[15]=ft,this}function q(T,R,ne){return ne=ne||0,T!==0||R!==0||ne!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,T,R,ne,1):this}function K(T,R,ne,X,Re,Ue,ze,nt,at,It,Zt,Bs,es,Ut,cs,ft){var Pe=this.props;if(T===1&&R===0&&ne===0&&X===0&&Re===0&&Ue===1&&ze===0&&nt===0&&at===0&&It===0&&Zt===1&&Bs===0)return Pe[12]=Pe[12]*T+Pe[15]*es,Pe[13]=Pe[13]*Ue+Pe[15]*Ut,Pe[14]=Pe[14]*Zt+Pe[15]*cs,Pe[15]*=ft,this._identityCalculated=!1,this;var oi=Pe[0],Ri=Pe[1],li=Pe[2],$s=Pe[3],ci=Pe[4],ui=Pe[5],ts=Pe[6],_i=Pe[7],Ii=Pe[8],Cs=Pe[9],ki=Pe[10],Rs=Pe[11],Wi=Pe[12],Kn=Pe[13],zn=Pe[14],Wn=Pe[15];return Pe[0]=oi*T+Ri*Re+li*at+$s*es,Pe[1]=oi*R+Ri*Ue+li*It+$s*Ut,Pe[2]=oi*ne+Ri*ze+li*Zt+$s*cs,Pe[3]=oi*X+Ri*nt+li*Bs+$s*ft,Pe[4]=ci*T+ui*Re+ts*at+_i*es,Pe[5]=ci*R+ui*Ue+ts*It+_i*Ut,Pe[6]=ci*ne+ui*ze+ts*Zt+_i*cs,Pe[7]=ci*X+ui*nt+ts*Bs+_i*ft,Pe[8]=Ii*T+Cs*Re+ki*at+Rs*es,Pe[9]=Ii*R+Cs*Ue+ki*It+Rs*Ut,Pe[10]=Ii*ne+Cs*ze+ki*Zt+Rs*cs,Pe[11]=Ii*X+Cs*nt+ki*Bs+Rs*ft,Pe[12]=Wi*T+Kn*Re+zn*at+Wn*es,Pe[13]=Wi*R+Kn*Ue+zn*It+Wn*Ut,Pe[14]=Wi*ne+Kn*ze+zn*Zt+Wn*cs,Pe[15]=Wi*X+Kn*nt+zn*Bs+Wn*ft,this._identityCalculated=!1,this}function J(T){var R=T.props;return this.transform(R[0],R[1],R[2],R[3],R[4],R[5],R[6],R[7],R[8],R[9],R[10],R[11],R[12],R[13],R[14],R[15])}function G(){return this._identityCalculated||(this._identity=!(this.props[0]!==1||this.props[1]!==0||this.props[2]!==0||this.props[3]!==0||this.props[4]!==0||this.props[5]!==1||this.props[6]!==0||this.props[7]!==0||this.props[8]!==0||this.props[9]!==0||this.props[10]!==1||this.props[11]!==0||this.props[12]!==0||this.props[13]!==0||this.props[14]!==0||this.props[15]!==1),this._identityCalculated=!0),this._identity}function O(T){for(var R=0;R<16;){if(T.props[R]!==this.props[R])return!1;R+=1}return!0}function _(T){var R;for(R=0;R<16;R+=1)T.props[R]=this.props[R];return T}function P(T){var R;for(R=0;R<16;R+=1)this.props[R]=T[R]}function $(T,R,ne){return{x:T*this.props[0]+R*this.props[4]+ne*this.props[8]+this.props[12],y:T*this.props[1]+R*this.props[5]+ne*this.props[9]+this.props[13],z:T*this.props[2]+R*this.props[6]+ne*this.props[10]+this.props[14]}}function Y(T,R,ne){return T*this.props[0]+R*this.props[4]+ne*this.props[8]+this.props[12]}function Z(T,R,ne){return T*this.props[1]+R*this.props[5]+ne*this.props[9]+this.props[13]}function ae(T,R,ne){return T*this.props[2]+R*this.props[6]+ne*this.props[10]+this.props[14]}function Se(){var T=this.props[0]*this.props[5]-this.props[1]*this.props[4],R=this.props[5]/T,ne=-this.props[1]/T,X=-this.props[4]/T,Re=this.props[0]/T,Ue=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/T,ze=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/T,nt=new Ie;return nt.props[0]=R,nt.props[1]=ne,nt.props[4]=X,nt.props[5]=Re,nt.props[12]=Ue,nt.props[13]=ze,nt}function Ke(T){var R=this.getInverseMatrix();return R.applyToPointArray(T[0],T[1],T[2]||0)}function De(T){var R,ne=T.length,X=[];for(R=0;R<ne;R+=1)X[R]=Ke(T[R]);return X}function Te(T,R,ne){var X=y("float32",6);if(this.isIdentity())X[0]=T[0],X[1]=T[1],X[2]=R[0],X[3]=R[1],X[4]=ne[0],X[5]=ne[1];else{var Re=this.props[0],Ue=this.props[1],ze=this.props[4],nt=this.props[5],at=this.props[12],It=this.props[13];X[0]=T[0]*Re+T[1]*ze+at,X[1]=T[0]*Ue+T[1]*nt+It,X[2]=R[0]*Re+R[1]*ze+at,X[3]=R[0]*Ue+R[1]*nt+It,X[4]=ne[0]*Re+ne[1]*ze+at,X[5]=ne[0]*Ue+ne[1]*nt+It}return X}function Ye(T,R,ne){var X;return this.isIdentity()?X=[T,R,ne]:X=[T*this.props[0]+R*this.props[4]+ne*this.props[8]+this.props[12],T*this.props[1]+R*this.props[5]+ne*this.props[9]+this.props[13],T*this.props[2]+R*this.props[6]+ne*this.props[10]+this.props[14]],X}function ke(T,R){if(this.isIdentity())return T+","+R;var ne=this.props;return Math.round((T*ne[0]+R*ne[4]+ne[12])*100)/100+","+Math.round((T*ne[1]+R*ne[5]+ne[13])*100)/100}function xe(){for(var T=0,R=this.props,ne="matrix3d(",X=1e4;T<16;)ne+=m(R[T]*X)/X,ne+=T===15?")":",",T+=1;return ne}function M(T){var R=1e4;return T<1e-6&&T>0||T>-1e-6&&T<0?m(T*R)/R:T}function z(){var T=this.props,R=M(T[0]),ne=M(T[1]),X=M(T[4]),Re=M(T[5]),Ue=M(T[12]),ze=M(T[13]);return"matrix("+R+","+ne+","+X+","+Re+","+Ue+","+ze+")"}return function(){this.reset=S,this.rotate=x,this.rotateX=A,this.rotateY=D,this.rotateZ=L,this.skew=V,this.skewFromAxis=ee,this.shear=B,this.scale=I,this.setTransform=H,this.translate=q,this.transform=K,this.multiply=J,this.applyToPoint=$,this.applyToX=Y,this.applyToY=Z,this.applyToZ=ae,this.applyToPointArray=Ye,this.applyToTriplePoints=Te,this.applyToPointStringified=ke,this.toCSS=xe,this.to2dCSS=z,this.clone=_,this.cloneFromProps=P,this.equals=O,this.inversePoints=De,this.inversePoint=Ke,this.getInverseMatrix=Se,this._t=this.transform,this.isIdentity=G,this._identity=!0,this._identityCalculated=!1,this.props=y("float32",16),this.reset()}}();function lt(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?lt=function(p){return typeof p}:lt=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},lt(c)}var Fe={};function tt(c){l(c)}function et(){Tt.searchAnimations()}function $t(c){st(c)}function xt(c){ps(c)}function Et(c){return Tt.loadAnimation(c)}function ws(c){if(typeof c=="string")switch(c){case"high":dt(200);break;default:case"medium":dt(50);break;case"low":dt(10);break}else!isNaN(c)&&c>1&&dt(c)}function Ei(){return typeof navigator<"u"}function $n(c,h){c==="expressions"&&Ze(h)}function As(c){switch(c){case"propertyFactory":return Ae;case"shapePropertyFactory":return Ce;case"matrix":return Ie;default:return null}}Fe.play=Tt.play,Fe.pause=Tt.pause,Fe.setLocationHref=tt,Fe.togglePause=Tt.togglePause,Fe.setSpeed=Tt.setSpeed,Fe.setDirection=Tt.setDirection,Fe.stop=Tt.stop,Fe.searchAnimations=et,Fe.registerAnimation=Tt.registerAnimation,Fe.loadAnimation=Et,Fe.setSubframeRendering=$t,Fe.resize=Tt.resize,Fe.goToAndStop=Tt.goToAndStop,Fe.destroy=Tt.destroy,Fe.setQuality=ws,Fe.inBrowser=Ei,Fe.installPlugin=$n,Fe.freeze=Tt.freeze,Fe.unfreeze=Tt.unfreeze,Fe.setVolume=Tt.setVolume,Fe.mute=Tt.mute,Fe.unmute=Tt.unmute,Fe.getRegisteredAnimations=Tt.getRegisteredAnimations,Fe.useWebWorker=a,Fe.setIDPrefix=xt,Fe.__getFactory=As,Fe.version="5.12.2";function em(){document.readyState==="complete"&&(clearInterval(im),et())}function tm(c){for(var h=Nc.split("&"),p=0;p<h.length;p+=1){var m=h[p].split("=");if(decodeURIComponent(m[0])==c)return decodeURIComponent(m[1])}return null}var Nc="";{var Bc=document.getElementsByTagName("script"),sm=Bc.length-1,$c=Bc[sm]||{src:""};Nc=$c.src?$c.src.replace(/^[^\?]+\??/,""):"",tm("renderer")}var im=setInterval(em,100);try{lt(e)!=="object"&&(window.bodymovin=Fe)}catch{}var bi=function(){var c={},h={};c.registerModifier=p,c.getModifier=m;function p(S,x){h[S]||(h[S]=x)}function m(S,x,A){return new h[S](x,A)}return c}();function ms(){}ms.prototype.initModifierProperties=function(){},ms.prototype.addShapeToModifier=function(){},ms.prototype.addShape=function(c){if(!this.closed){c.sh.container.addDynamicProperty(c.sh);var h={shape:c.sh,data:c,localShapeCollection:Ee.newShapeCollection()};this.shapes.push(h),this.addShapeToModifier(h),this._isAnimated&&c.setAsAnimated()}},ms.prototype.init=function(c,h){this.shapes=[],this.elem=c,this.initDynamicPropertyContainer(c),this.initModifierProperties(c,h),this.frameId=n,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ms.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},f([_t],ms);function Ls(){}f([ms],Ls),Ls.prototype.initModifierProperties=function(c,h){this.s=Ae.getProp(c,h.s,0,.01,this),this.e=Ae.getProp(c,h.e,0,.01,this),this.o=Ae.getProp(c,h.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=h.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},Ls.prototype.addShapeToModifier=function(c){c.pathsData=[]},Ls.prototype.calculateShapeEdges=function(c,h,p,m,S){var x=[];h<=1?x.push({s:c,e:h}):c>=1?x.push({s:c-1,e:h-1}):(x.push({s:c,e:1}),x.push({s:0,e:h-1}));var A=[],D,L=x.length,B;for(D=0;D<L;D+=1)if(B=x[D],!(B.e*S<m||B.s*S>m+p)){var V,ee;B.s*S<=m?V=0:V=(B.s*S-m)/p,B.e*S>=m+p?ee=1:ee=(B.e*S-m)/p,A.push([V,ee])}return A.length||A.push([0,0]),A},Ls.prototype.releasePathsData=function(c){var h,p=c.length;for(h=0;h<p;h+=1)On.release(c[h]);return c.length=0,c},Ls.prototype.processShapes=function(c){var h,p;if(this._mdf||c){var m=this.o.v%360/360;if(m<0&&(m+=1),this.s.v>1?h=1+m:this.s.v<0?h=0+m:h=this.s.v+m,this.e.v>1?p=1+m:this.e.v<0?p=0+m:p=this.e.v+m,h>p){var S=h;h=p,p=S}h=Math.round(h*1e4)*1e-4,p=Math.round(p*1e4)*1e-4,this.sValue=h,this.eValue=p}else h=this.sValue,p=this.eValue;var x,A,D=this.shapes.length,L,B,V,ee,I,H=0;if(p===h)for(A=0;A<D;A+=1)this.shapes[A].localShapeCollection.releaseShapes(),this.shapes[A].shape._mdf=!0,this.shapes[A].shape.paths=this.shapes[A].localShapeCollection,this._mdf&&(this.shapes[A].pathsData.length=0);else if(p===1&&h===0||p===0&&h===1){if(this._mdf)for(A=0;A<D;A+=1)this.shapes[A].pathsData.length=0,this.shapes[A].shape._mdf=!0}else{var q=[],K,J;for(A=0;A<D;A+=1)if(K=this.shapes[A],!K.shape._mdf&&!this._mdf&&!c&&this.m!==2)K.shape.paths=K.localShapeCollection;else{if(x=K.shape.paths,B=x._length,I=0,!K.shape._mdf&&K.pathsData.length)I=K.totalShapeLength;else{for(V=this.releasePathsData(K.pathsData),L=0;L<B;L+=1)ee=gs.getSegmentsLength(x.shapes[L]),V.push(ee),I+=ee.totalLength;K.totalShapeLength=I,K.pathsData=V}H+=I,K.shape._mdf=!0}var G=h,O=p,_=0,P;for(A=D-1;A>=0;A-=1)if(K=this.shapes[A],K.shape._mdf){for(J=K.localShapeCollection,J.releaseShapes(),this.m===2&&D>1?(P=this.calculateShapeEdges(h,p,K.totalShapeLength,_,H),_+=K.totalShapeLength):P=[[G,O]],B=P.length,L=0;L<B;L+=1){G=P[L][0],O=P[L][1],q.length=0,O<=1?q.push({s:K.totalShapeLength*G,e:K.totalShapeLength*O}):G>=1?q.push({s:K.totalShapeLength*(G-1),e:K.totalShapeLength*(O-1)}):(q.push({s:K.totalShapeLength*G,e:K.totalShapeLength}),q.push({s:0,e:K.totalShapeLength*(O-1)}));var $=this.addShapes(K,q[0]);if(q[0].s!==q[0].e){if(q.length>1){var Y=K.shape.paths.shapes[K.shape.paths._length-1];if(Y.c){var Z=$.pop();this.addPaths($,J),$=this.addShapes(K,q[1],Z)}else this.addPaths($,J),$=this.addShapes(K,q[1])}this.addPaths($,J)}}K.shape.paths=J}}},Ls.prototype.addPaths=function(c,h){var p,m=c.length;for(p=0;p<m;p+=1)h.addShape(c[p])},Ls.prototype.addSegment=function(c,h,p,m,S,x,A){S.setXYAt(h[0],h[1],"o",x),S.setXYAt(p[0],p[1],"i",x+1),A&&S.setXYAt(c[0],c[1],"v",x),S.setXYAt(m[0],m[1],"v",x+1)},Ls.prototype.addSegmentFromArray=function(c,h,p,m){h.setXYAt(c[1],c[5],"o",p),h.setXYAt(c[2],c[6],"i",p+1),m&&h.setXYAt(c[0],c[4],"v",p),h.setXYAt(c[3],c[7],"v",p+1)},Ls.prototype.addShapes=function(c,h,p){var m=c.pathsData,S=c.shape.paths.shapes,x,A=c.shape.paths._length,D,L,B=0,V,ee,I,H,q=[],K,J=!0;for(p?(ee=p._length,K=p._length):(p=Dt.newElement(),ee=0,K=0),q.push(p),x=0;x<A;x+=1){for(I=m[x].lengths,p.c=S[x].c,L=S[x].c?I.length:I.length+1,D=1;D<L;D+=1)if(V=I[D-1],B+V.addedLength<h.s)B+=V.addedLength,p.c=!1;else if(B>h.e){p.c=!1;break}else h.s<=B&&h.e>=B+V.addedLength?(this.addSegment(S[x].v[D-1],S[x].o[D-1],S[x].i[D],S[x].v[D],p,ee,J),J=!1):(H=gs.getNewSegment(S[x].v[D-1],S[x].v[D],S[x].o[D-1],S[x].i[D],(h.s-B)/V.addedLength,(h.e-B)/V.addedLength,I[D-1]),this.addSegmentFromArray(H,p,ee,J),J=!1,p.c=!1),B+=V.addedLength,ee+=1;if(S[x].c&&I.length){if(V=I[D-1],B<=h.e){var G=I[D-1].addedLength;h.s<=B&&h.e>=B+G?(this.addSegment(S[x].v[D-1],S[x].o[D-1],S[x].i[0],S[x].v[0],p,ee,J),J=!1):(H=gs.getNewSegment(S[x].v[D-1],S[x].v[0],S[x].o[D-1],S[x].i[0],(h.s-B)/G,(h.e-B)/G,I[D-1]),this.addSegmentFromArray(H,p,ee,J),J=!1,p.c=!1)}else p.c=!1;B+=V.addedLength,ee+=1}if(p._length&&(p.setXYAt(p.v[K][0],p.v[K][1],"i",K),p.setXYAt(p.v[p._length-1][0],p.v[p._length-1][1],"o",p._length-1)),B>h.e)break;x<A-1&&(p=Dt.newElement(),J=!0,q.push(p),ee=0)}return q};function qr(){}f([ms],qr),qr.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.amount=Ae.getProp(c,h.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},qr.prototype.processPath=function(c,h){var p=h/100,m=[0,0],S=c._length,x=0;for(x=0;x<S;x+=1)m[0]+=c.v[x][0],m[1]+=c.v[x][1];m[0]/=S,m[1]/=S;var A=Dt.newElement();A.c=c.c;var D,L,B,V,ee,I;for(x=0;x<S;x+=1)D=c.v[x][0]+(m[0]-c.v[x][0])*p,L=c.v[x][1]+(m[1]-c.v[x][1])*p,B=c.o[x][0]+(m[0]-c.o[x][0])*-p,V=c.o[x][1]+(m[1]-c.o[x][1])*-p,ee=c.i[x][0]+(m[0]-c.i[x][0])*-p,I=c.i[x][1]+(m[1]-c.i[x][1])*-p,A.setTripleAt(D,L,B,V,ee,I,x);return A},qr.prototype.processShapes=function(c){var h,p,m=this.shapes.length,S,x,A=this.amount.v;if(A!==0){var D,L;for(p=0;p<m;p+=1){if(D=this.shapes[p],L=D.localShapeCollection,!(!D.shape._mdf&&!this._mdf&&!c))for(L.releaseShapes(),D.shape._mdf=!0,h=D.shape.paths.shapes,x=D.shape.paths._length,S=0;S<x;S+=1)L.addShape(this.processPath(h[S],A));D.shape.paths=D.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};var lo=function(){var c=[0,0];function h(L){var B=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||B,this.a&&L.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&L.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&L.skewFromAxis(-this.sk.v,this.sa.v),this.r?L.rotate(-this.r.v):L.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?L.translate(this.px.v,this.py.v,-this.pz.v):L.translate(this.px.v,this.py.v,0):L.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}function p(L){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||L){var B;if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var V,ee;if(B=this.elem.globalData.frameRate,this.p&&this.p.keyframes&&this.p.getValueAtTime)this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(V=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/B,0),ee=this.p.getValueAtTime(this.p.keyframes[0].t/B,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(V=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/B,0),ee=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/B,0)):(V=this.p.pv,ee=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/B,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){V=[],ee=[];var I=this.px,H=this.py;I._caching.lastFrame+I.offsetTime<=I.keyframes[0].t?(V[0]=I.getValueAtTime((I.keyframes[0].t+.01)/B,0),V[1]=H.getValueAtTime((H.keyframes[0].t+.01)/B,0),ee[0]=I.getValueAtTime(I.keyframes[0].t/B,0),ee[1]=H.getValueAtTime(H.keyframes[0].t/B,0)):I._caching.lastFrame+I.offsetTime>=I.keyframes[I.keyframes.length-1].t?(V[0]=I.getValueAtTime(I.keyframes[I.keyframes.length-1].t/B,0),V[1]=H.getValueAtTime(H.keyframes[H.keyframes.length-1].t/B,0),ee[0]=I.getValueAtTime((I.keyframes[I.keyframes.length-1].t-.01)/B,0),ee[1]=H.getValueAtTime((H.keyframes[H.keyframes.length-1].t-.01)/B,0)):(V=[I.pv,H.pv],ee[0]=I.getValueAtTime((I._caching.lastFrame+I.offsetTime-.01)/B,I.offsetTime),ee[1]=H.getValueAtTime((H._caching.lastFrame+H.offsetTime-.01)/B,H.offsetTime))}else ee=c,V=ee;this.v.rotate(-Math.atan2(V[1]-ee[1],V[0]-ee[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function m(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function S(){}function x(L){this._addDynamicProperty(L),this.elem.addDynamicProperty(L),this._isDirty=!0}function A(L,B,V){if(this.elem=L,this.frameId=-1,this.propType="transform",this.data=B,this.v=new Ie,this.pre=new Ie,this.appliedTransformations=0,this.initDynamicPropertyContainer(V||L),B.p&&B.p.s?(this.px=Ae.getProp(L,B.p.x,0,0,this),this.py=Ae.getProp(L,B.p.y,0,0,this),B.p.z&&(this.pz=Ae.getProp(L,B.p.z,0,0,this))):this.p=Ae.getProp(L,B.p||{k:[0,0,0]},1,0,this),B.rx){if(this.rx=Ae.getProp(L,B.rx,0,Q,this),this.ry=Ae.getProp(L,B.ry,0,Q,this),this.rz=Ae.getProp(L,B.rz,0,Q,this),B.or.k[0].ti){var ee,I=B.or.k.length;for(ee=0;ee<I;ee+=1)B.or.k[ee].to=null,B.or.k[ee].ti=null}this.or=Ae.getProp(L,B.or,1,Q,this),this.or.sh=!0}else this.r=Ae.getProp(L,B.r||{k:0},0,Q,this);B.sk&&(this.sk=Ae.getProp(L,B.sk,0,Q,this),this.sa=Ae.getProp(L,B.sa,0,Q,this)),this.a=Ae.getProp(L,B.a||{k:[0,0,0]},1,0,this),this.s=Ae.getProp(L,B.s||{k:[100,100,100]},1,.01,this),B.o?this.o=Ae.getProp(L,B.o,0,.01,L):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}A.prototype={applyToMatrix:h,getValue:p,precalculateMatrix:m,autoOrient:S},f([_t],A),A.prototype.addDynamicProperty=x,A.prototype._addDynamicProperty=_t.prototype.addDynamicProperty;function D(L,B,V){return new A(L,B,V)}return{getTransformProperty:D}}();function Ns(){}f([ms],Ns),Ns.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.c=Ae.getProp(c,h.c,0,null,this),this.o=Ae.getProp(c,h.o,0,null,this),this.tr=lo.getTransformProperty(c,h.tr,this),this.so=Ae.getProp(c,h.tr.so,0,.01,this),this.eo=Ae.getProp(c,h.tr.eo,0,.01,this),this.data=h,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Ie,this.rMatrix=new Ie,this.sMatrix=new Ie,this.tMatrix=new Ie,this.matrix=new Ie},Ns.prototype.applyTransforms=function(c,h,p,m,S,x){var A=x?-1:1,D=m.s.v[0]+(1-m.s.v[0])*(1-S),L=m.s.v[1]+(1-m.s.v[1])*(1-S);c.translate(m.p.v[0]*A*S,m.p.v[1]*A*S,m.p.v[2]),h.translate(-m.a.v[0],-m.a.v[1],m.a.v[2]),h.rotate(-m.r.v*A*S),h.translate(m.a.v[0],m.a.v[1],m.a.v[2]),p.translate(-m.a.v[0],-m.a.v[1],m.a.v[2]),p.scale(x?1/D:D,x?1/L:L),p.translate(m.a.v[0],m.a.v[1],m.a.v[2])},Ns.prototype.init=function(c,h,p,m){for(this.elem=c,this.arr=h,this.pos=p,this.elemsData=m,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(c),this.initModifierProperties(c,h[p]);p>0;)p-=1,this._elements.unshift(h[p]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},Ns.prototype.resetElements=function(c){var h,p=c.length;for(h=0;h<p;h+=1)c[h]._processed=!1,c[h].ty==="gr"&&this.resetElements(c[h].it)},Ns.prototype.cloneElements=function(c){var h=JSON.parse(JSON.stringify(c));return this.resetElements(h),h},Ns.prototype.changeGroupRender=function(c,h){var p,m=c.length;for(p=0;p<m;p+=1)c[p]._render=h,c[p].ty==="gr"&&this.changeGroupRender(c[p].it,h)},Ns.prototype.processShapes=function(c){var h,p,m,S,x,A=!1;if(this._mdf||c){var D=Math.ceil(this.c.v);if(this._groups.length<D){for(;this._groups.length<D;){var L={it:this.cloneElements(this._elements),ty:"gr"};L.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,L),this._groups.splice(0,0,L),this._currentCopies+=1}this.elem.reloadShapes(),A=!0}x=0;var B;for(m=0;m<=this._groups.length-1;m+=1){if(B=x<D,this._groups[m]._render=B,this.changeGroupRender(this._groups[m].it,B),!B){var V=this.elemsData[m].it,ee=V[V.length-1];ee.transform.op.v!==0?(ee.transform.op._mdf=!0,ee.transform.op.v=0):ee.transform.op._mdf=!1}x+=1}this._currentCopies=D;var I=this.o.v,H=I%1,q=I>0?Math.floor(I):Math.ceil(I),K=this.pMatrix.props,J=this.rMatrix.props,G=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var O=0;if(I>0){for(;O<q;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),O+=1;H&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,H,!1),O+=H)}else if(I<0){for(;O>q;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),O-=1;H&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-H,!0),O-=H)}m=this.data.m===1?0:this._currentCopies-1,S=this.data.m===1?1:-1,x=this._currentCopies;for(var _,P;x;){if(h=this.elemsData[m].it,p=h[h.length-1].transform.mProps.v.props,P=p.length,h[h.length-1].transform.mProps._mdf=!0,h[h.length-1].transform.op._mdf=!0,h[h.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(m/(this._currentCopies-1)),O!==0){for((m!==0&&S===1||m!==this._currentCopies-1&&S===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(J[0],J[1],J[2],J[3],J[4],J[5],J[6],J[7],J[8],J[9],J[10],J[11],J[12],J[13],J[14],J[15]),this.matrix.transform(G[0],G[1],G[2],G[3],G[4],G[5],G[6],G[7],G[8],G[9],G[10],G[11],G[12],G[13],G[14],G[15]),this.matrix.transform(K[0],K[1],K[2],K[3],K[4],K[5],K[6],K[7],K[8],K[9],K[10],K[11],K[12],K[13],K[14],K[15]),_=0;_<P;_+=1)p[_]=this.matrix.props[_];this.matrix.reset()}else for(this.matrix.reset(),_=0;_<P;_+=1)p[_]=this.matrix.props[_];O+=1,x-=1,m+=S}}else for(x=this._currentCopies,m=0,S=1;x;)h=this.elemsData[m].it,p=h[h.length-1].transform.mProps.v.props,h[h.length-1].transform.mProps._mdf=!1,h[h.length-1].transform.op._mdf=!1,x-=1,m+=S;return A},Ns.prototype.addShape=function(){};function Yr(){}f([ms],Yr),Yr.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.rd=Ae.getProp(c,h.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},Yr.prototype.processPath=function(c,h){var p=Dt.newElement();p.c=c.c;var m,S=c._length,x,A,D,L,B,V,ee=0,I,H,q,K,J,G;for(m=0;m<S;m+=1)x=c.v[m],D=c.o[m],A=c.i[m],x[0]===D[0]&&x[1]===D[1]&&x[0]===A[0]&&x[1]===A[1]?(m===0||m===S-1)&&!c.c?(p.setTripleAt(x[0],x[1],D[0],D[1],A[0],A[1],ee),ee+=1):(m===0?L=c.v[S-1]:L=c.v[m-1],B=Math.sqrt(Math.pow(x[0]-L[0],2)+Math.pow(x[1]-L[1],2)),V=B?Math.min(B/2,h)/B:0,J=x[0]+(L[0]-x[0])*V,I=J,G=x[1]-(x[1]-L[1])*V,H=G,q=I-(I-x[0])*le,K=H-(H-x[1])*le,p.setTripleAt(I,H,q,K,J,G,ee),ee+=1,m===S-1?L=c.v[0]:L=c.v[m+1],B=Math.sqrt(Math.pow(x[0]-L[0],2)+Math.pow(x[1]-L[1],2)),V=B?Math.min(B/2,h)/B:0,q=x[0]+(L[0]-x[0])*V,I=q,K=x[1]+(L[1]-x[1])*V,H=K,J=I-(I-x[0])*le,G=H-(H-x[1])*le,p.setTripleAt(I,H,q,K,J,G,ee),ee+=1):(p.setTripleAt(c.v[m][0],c.v[m][1],c.o[m][0],c.o[m][1],c.i[m][0],c.i[m][1],ee),ee+=1);return p},Yr.prototype.processShapes=function(c){var h,p,m=this.shapes.length,S,x,A=this.rd.v;if(A!==0){var D,L;for(p=0;p<m;p+=1){if(D=this.shapes[p],L=D.localShapeCollection,!(!D.shape._mdf&&!this._mdf&&!c))for(L.releaseShapes(),D.shape._mdf=!0,h=D.shape.paths.shapes,x=D.shape.paths._length,S=0;S<x;S+=1)L.addShape(this.processPath(h[S],A));D.shape.paths=D.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function Un(c,h){return Math.abs(c-h)*1e5<=Math.min(Math.abs(c),Math.abs(h))}function co(c){return Math.abs(c)<=1e-5}function Uc(c,h,p){return c*(1-p)+h*p}function Ti(c,h,p){return[Uc(c[0],h[0],p),Uc(c[1],h[1],p)]}function rm(c,h,p){if(c===0)return[];var m=h*h-4*c*p;if(m<0)return[];var S=-h/(2*c);if(m===0)return[S];var x=Math.sqrt(m)/(2*c);return[S-x,S+x]}function Gc(c,h,p,m){return[-c+3*h-3*p+m,3*c-6*h+3*p,-3*c+3*h,c]}function Vc(c){return new wt(c,c,c,c,!1)}function wt(c,h,p,m,S){S&&vr(c,h)&&(h=Ti(c,m,1/3)),S&&vr(p,m)&&(p=Ti(c,m,2/3));var x=Gc(c[0],h[0],p[0],m[0]),A=Gc(c[1],h[1],p[1],m[1]);this.a=[x[0],A[0]],this.b=[x[1],A[1]],this.c=[x[2],A[2]],this.d=[x[3],A[3]],this.points=[c,h,p,m]}wt.prototype.point=function(c){return[((this.a[0]*c+this.b[0])*c+this.c[0])*c+this.d[0],((this.a[1]*c+this.b[1])*c+this.c[1])*c+this.d[1]]},wt.prototype.derivative=function(c){return[(3*c*this.a[0]+2*this.b[0])*c+this.c[0],(3*c*this.a[1]+2*this.b[1])*c+this.c[1]]},wt.prototype.tangentAngle=function(c){var h=this.derivative(c);return Math.atan2(h[1],h[0])},wt.prototype.normalAngle=function(c){var h=this.derivative(c);return Math.atan2(h[0],h[1])},wt.prototype.inflectionPoints=function(){var c=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(co(c))return[];var h=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/c,p=h*h-1/3*(this.b[1]*this.c[0]-this.b[0]*this.c[1])/c;if(p<0)return[];var m=Math.sqrt(p);return co(m)?m>0&&m<1?[h]:[]:[h-m,h+m].filter(function(S){return S>0&&S<1})},wt.prototype.split=function(c){if(c<=0)return[Vc(this.points[0]),this];if(c>=1)return[this,Vc(this.points[this.points.length-1])];var h=Ti(this.points[0],this.points[1],c),p=Ti(this.points[1],this.points[2],c),m=Ti(this.points[2],this.points[3],c),S=Ti(h,p,c),x=Ti(p,m,c),A=Ti(S,x,c);return[new wt(this.points[0],h,S,A,!0),new wt(A,x,m,this.points[3],!0)]};function Hc(c,h){var p=c.points[0][h],m=c.points[c.points.length-1][h];if(p>m){var S=m;m=p,p=S}for(var x=rm(3*c.a[h],2*c.b[h],c.c[h]),A=0;A<x.length;A+=1)if(x[A]>0&&x[A]<1){var D=c.point(x[A])[h];D<p?p=D:D>m&&(m=D)}return{min:p,max:m}}wt.prototype.bounds=function(){return{x:Hc(this,0),y:Hc(this,1)}},wt.prototype.boundingBox=function(){var c=this.bounds();return{left:c.x.min,right:c.x.max,top:c.y.min,bottom:c.y.max,width:c.x.max-c.x.min,height:c.y.max-c.y.min,cx:(c.x.max+c.x.min)/2,cy:(c.y.max+c.y.min)/2}};function Gn(c,h,p){var m=c.boundingBox();return{cx:m.cx,cy:m.cy,width:m.width,height:m.height,bez:c,t:(h+p)/2,t1:h,t2:p}}function jc(c){var h=c.bez.split(.5);return[Gn(h[0],c.t1,c.t),Gn(h[1],c.t,c.t2)]}function nm(c,h){return Math.abs(c.cx-h.cx)*2<c.width+h.width&&Math.abs(c.cy-h.cy)*2<c.height+h.height}function Xr(c,h,p,m,S,x){if(nm(c,h)){if(p>=x||c.width<=m&&c.height<=m&&h.width<=m&&h.height<=m){S.push([c.t,h.t]);return}var A=jc(c),D=jc(h);Xr(A[0],D[0],p+1,m,S,x),Xr(A[0],D[1],p+1,m,S,x),Xr(A[1],D[0],p+1,m,S,x),Xr(A[1],D[1],p+1,m,S,x)}}wt.prototype.intersections=function(c,h,p){h===void 0&&(h=2),p===void 0&&(p=7);var m=[];return Xr(Gn(this,0,1),Gn(c,0,1),0,h,m,p),m},wt.shapeSegment=function(c,h){var p=(h+1)%c.length();return new wt(c.v[h],c.o[h],c.i[p],c.v[p],!0)},wt.shapeSegmentInverted=function(c,h){var p=(h+1)%c.length();return new wt(c.v[p],c.i[p],c.o[h],c.v[h],!0)};function uo(c,h){return[c[1]*h[2]-c[2]*h[1],c[2]*h[0]-c[0]*h[2],c[0]*h[1]-c[1]*h[0]]}function Vn(c,h,p,m){var S=[c[0],c[1],1],x=[h[0],h[1],1],A=[p[0],p[1],1],D=[m[0],m[1],1],L=uo(uo(S,x),uo(A,D));return co(L[2])?null:[L[0]/L[2],L[1]/L[2]]}function mr(c,h,p){return[c[0]+Math.cos(h)*p,c[1]-Math.sin(h)*p]}function ho(c,h){return Math.hypot(c[0]-h[0],c[1]-h[1])}function vr(c,h){return Un(c[0],h[0])&&Un(c[1],h[1])}function Qr(){}f([ms],Qr),Qr.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.amplitude=Ae.getProp(c,h.s,0,null,this),this.frequency=Ae.getProp(c,h.r,0,null,this),this.pointsType=Ae.getProp(c,h.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function Kc(c,h,p,m,S,x,A){var D=p-Math.PI/2,L=p+Math.PI/2,B=h[0]+Math.cos(p)*m*S,V=h[1]-Math.sin(p)*m*S;c.setTripleAt(B,V,B+Math.cos(D)*x,V-Math.sin(D)*x,B+Math.cos(L)*A,V-Math.sin(L)*A,c.length())}function am(c,h){var p=[h[0]-c[0],h[1]-c[1]],m=-Math.PI*.5,S=[Math.cos(m)*p[0]-Math.sin(m)*p[1],Math.sin(m)*p[0]+Math.cos(m)*p[1]];return S}function om(c,h){var p=h===0?c.length()-1:h-1,m=(h+1)%c.length(),S=c.v[p],x=c.v[m],A=am(S,x);return Math.atan2(0,1)-Math.atan2(A[1],A[0])}function zc(c,h,p,m,S,x,A){var D=om(h,p),L=h.v[p%h._length],B=h.v[p===0?h._length-1:p-1],V=h.v[(p+1)%h._length],ee=x===2?Math.sqrt(Math.pow(L[0]-B[0],2)+Math.pow(L[1]-B[1],2)):0,I=x===2?Math.sqrt(Math.pow(L[0]-V[0],2)+Math.pow(L[1]-V[1],2)):0;Kc(c,h.v[p%h._length],D,A,m,I/((S+1)*2),ee/((S+1)*2))}function lm(c,h,p,m,S,x){for(var A=0;A<m;A+=1){var D=(A+1)/(m+1),L=S===2?Math.sqrt(Math.pow(h.points[3][0]-h.points[0][0],2)+Math.pow(h.points[3][1]-h.points[0][1],2)):0,B=h.normalAngle(D),V=h.point(D);Kc(c,V,B,x,p,L/((m+1)*2),L/((m+1)*2)),x=-x}return x}Qr.prototype.processPath=function(c,h,p,m){var S=c._length,x=Dt.newElement();if(x.c=c.c,c.c||(S-=1),S===0)return x;var A=-1,D=wt.shapeSegment(c,0);zc(x,c,0,h,p,m,A);for(var L=0;L<S;L+=1)A=lm(x,D,h,p,m,-A),L===S-1&&!c.c?D=null:D=wt.shapeSegment(c,(L+1)%S),zc(x,c,L+1,h,p,m,A);return x},Qr.prototype.processShapes=function(c){var h,p,m=this.shapes.length,S,x,A=this.amplitude.v,D=Math.max(0,Math.round(this.frequency.v)),L=this.pointsType.v;if(A!==0){var B,V;for(p=0;p<m;p+=1){if(B=this.shapes[p],V=B.localShapeCollection,!(!B.shape._mdf&&!this._mdf&&!c))for(V.releaseShapes(),B.shape._mdf=!0,h=B.shape.paths.shapes,x=B.shape.paths._length,S=0;S<x;S+=1)V.addShape(this.processPath(h[S],A,D,L));B.shape.paths=B.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function fo(c,h,p){var m=Math.atan2(h[0]-c[0],h[1]-c[1]);return[mr(c,m,p),mr(h,m,p)]}function yr(c,h){var p,m,S,x,A,D,L;L=fo(c.points[0],c.points[1],h),p=L[0],m=L[1],L=fo(c.points[1],c.points[2],h),S=L[0],x=L[1],L=fo(c.points[2],c.points[3],h),A=L[0],D=L[1];var B=Vn(p,m,S,x);B===null&&(B=m);var V=Vn(A,D,S,x);return V===null&&(V=A),new wt(p,B,V,D)}function Wc(c,h,p,m,S){var x=h.points[3],A=p.points[0];if(m===3||vr(x,A))return x;if(m===2){var D=-h.tangentAngle(1),L=-p.tangentAngle(0)+Math.PI,B=Vn(x,mr(x,D+Math.PI/2,100),A,mr(A,D+Math.PI/2,100)),V=B?ho(B,x):ho(x,A)/2,ee=mr(x,D,2*V*le);return c.setXYAt(ee[0],ee[1],"o",c.length()-1),ee=mr(A,L,2*V*le),c.setTripleAt(A[0],A[1],A[0],A[1],ee[0],ee[1],c.length()),A}var I=vr(x,h.points[2])?h.points[0]:h.points[2],H=vr(A,p.points[1])?p.points[3]:p.points[1],q=Vn(I,x,A,H);return q&&ho(q,x)<S?(c.setTripleAt(q[0],q[1],q[0],q[1],q[0],q[1],c.length()),q):x}function qc(c,h){var p=c.intersections(h);return p.length&&Un(p[0][0],1)&&p.shift(),p.length?p[0]:null}function Yc(c,h){var p=c.slice(),m=h.slice(),S=qc(c[c.length-1],h[0]);return S&&(p[c.length-1]=c[c.length-1].split(S[0])[0],m[0]=h[0].split(S[1])[1]),c.length>1&&h.length>1&&(S=qc(c[0],h[h.length-1]),S)?[[c[0].split(S[0])[0]],[h[h.length-1].split(S[1])[1]]]:[p,m]}function cm(c){for(var h,p=1;p<c.length;p+=1)h=Yc(c[p-1],c[p]),c[p-1]=h[0],c[p]=h[1];return c.length>1&&(h=Yc(c[c.length-1],c[0]),c[c.length-1]=h[0],c[0]=h[1]),c}function Xc(c,h){var p=c.inflectionPoints(),m,S,x,A;if(p.length===0)return[yr(c,h)];if(p.length===1||Un(p[1],1))return x=c.split(p[0]),m=x[0],S=x[1],[yr(m,h),yr(S,h)];x=c.split(p[0]),m=x[0];var D=(p[1]-p[0])/(1-p[0]);return x=x[1].split(D),A=x[0],S=x[1],[yr(m,h),yr(A,h),yr(S,h)]}function Jr(){}f([ms],Jr),Jr.prototype.initModifierProperties=function(c,h){this.getValue=this.processKeys,this.amount=Ae.getProp(c,h.a,0,null,this),this.miterLimit=Ae.getProp(c,h.ml,0,null,this),this.lineJoin=h.lj,this._isAnimated=this.amount.effectsSequence.length!==0},Jr.prototype.processPath=function(c,h,p,m){var S=Dt.newElement();S.c=c.c;var x=c.length();c.c||(x-=1);var A,D,L,B=[];for(A=0;A<x;A+=1)L=wt.shapeSegment(c,A),B.push(Xc(L,h));if(!c.c)for(A=x-1;A>=0;A-=1)L=wt.shapeSegmentInverted(c,A),B.push(Xc(L,h));B=cm(B);var V=null,ee=null;for(A=0;A<B.length;A+=1){var I=B[A];for(ee&&(V=Wc(S,ee,I[0],p,m)),ee=I[I.length-1],D=0;D<I.length;D+=1)L=I[D],V&&vr(L.points[0],V)?S.setXYAt(L.points[1][0],L.points[1][1],"o",S.length()-1):S.setTripleAt(L.points[0][0],L.points[0][1],L.points[1][0],L.points[1][1],L.points[0][0],L.points[0][1],S.length()),S.setTripleAt(L.points[3][0],L.points[3][1],L.points[3][0],L.points[3][1],L.points[2][0],L.points[2][1],S.length()),V=L.points[3]}return B.length&&Wc(S,ee,B[0][0],p,m),S},Jr.prototype.processShapes=function(c){var h,p,m=this.shapes.length,S,x,A=this.amount.v,D=this.miterLimit.v,L=this.lineJoin;if(A!==0){var B,V;for(p=0;p<m;p+=1){if(B=this.shapes[p],V=B.localShapeCollection,!(!B.shape._mdf&&!this._mdf&&!c))for(V.releaseShapes(),B.shape._mdf=!0,h=B.shape.paths.shapes,x=B.shape.paths._length,S=0;S<x;S+=1)V.addShape(this.processPath(h[S],A,L,D));B.shape.paths=B.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function Qc(c){for(var h=c.fStyle?c.fStyle.split(" "):[],p="normal",m="normal",S=h.length,x,A=0;A<S;A+=1)switch(x=h[A].toLowerCase(),x){case"italic":m="italic";break;case"bold":p="700";break;case"black":p="900";break;case"medium":p="500";break;case"regular":case"normal":p="400";break;case"light":case"thin":p="200";break}return{style:m,weight:c.fWeight||p}}var ji=function(){var c=5e3,h={w:0,size:0,shapes:[],data:{shapes:[]}},p=[];p=p.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var m=127988,S=917631,x=917601,A=917626,D=65039,L=8205,B=127462,V=127487,ee=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function I(M){var z=M.split(","),T,R=z.length,ne=[];for(T=0;T<R;T+=1)z[T]!=="sans-serif"&&z[T]!=="monospace"&&ne.push(z[T]);return ne.join(",")}function H(M,z){var T=d("span");T.setAttribute("aria-hidden",!0),T.style.fontFamily=z;var R=d("span");R.innerText="giItT1WQy@!-/#",T.style.position="absolute",T.style.left="-10000px",T.style.top="-10000px",T.style.fontSize="300px",T.style.fontVariant="normal",T.style.fontStyle="normal",T.style.fontWeight="normal",T.style.letterSpacing="0",T.appendChild(R),document.body.appendChild(T);var ne=R.offsetWidth;return R.style.fontFamily=I(M)+", "+z,{node:R,w:ne,parent:T}}function q(){var M,z=this.fonts.length,T,R,ne=z;for(M=0;M<z;M+=1)this.fonts[M].loaded?ne-=1:this.fonts[M].fOrigin==="n"||this.fonts[M].origin===0?this.fonts[M].loaded=!0:(T=this.fonts[M].monoCase.node,R=this.fonts[M].monoCase.w,T.offsetWidth!==R?(ne-=1,this.fonts[M].loaded=!0):(T=this.fonts[M].sansCase.node,R=this.fonts[M].sansCase.w,T.offsetWidth!==R&&(ne-=1,this.fonts[M].loaded=!0)),this.fonts[M].loaded&&(this.fonts[M].sansCase.parent.parentNode.removeChild(this.fonts[M].sansCase.parent),this.fonts[M].monoCase.parent.parentNode.removeChild(this.fonts[M].monoCase.parent)));ne!==0&&Date.now()-this.initTime<c?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)}function K(M,z){var T=document.body&&z?"svg":"canvas",R,ne=Qc(M);if(T==="svg"){var X=Be("text");X.style.fontSize="100px",X.setAttribute("font-family",M.fFamily),X.setAttribute("font-style",ne.style),X.setAttribute("font-weight",ne.weight),X.textContent="1",M.fClass?(X.style.fontFamily="inherit",X.setAttribute("class",M.fClass)):X.style.fontFamily=M.fFamily,z.appendChild(X),R=X}else{var Re=new OffscreenCanvas(500,500).getContext("2d");Re.font=ne.style+" "+ne.weight+" 100px "+M.fFamily,R=Re}function Ue(ze){return T==="svg"?(R.textContent=ze,R.getComputedTextLength()):R.measureText(ze).width}return{measureText:Ue}}function J(M,z){if(!M){this.isLoaded=!0;return}if(this.chars){this.isLoaded=!0,this.fonts=M.list;return}if(!document.body){this.isLoaded=!0,M.list.forEach(function(Zt){Zt.helper=K(Zt),Zt.cache={}}),this.fonts=M.list;return}var T=M.list,R,ne=T.length,X=ne;for(R=0;R<ne;R+=1){var Re=!0,Ue,ze;if(T[R].loaded=!1,T[R].monoCase=H(T[R].fFamily,"monospace"),T[R].sansCase=H(T[R].fFamily,"sans-serif"),!T[R].fPath)T[R].loaded=!0,X-=1;else if(T[R].fOrigin==="p"||T[R].origin===3){if(Ue=document.querySelectorAll('style[f-forigin="p"][f-family="'+T[R].fFamily+'"], style[f-origin="3"][f-family="'+T[R].fFamily+'"]'),Ue.length>0&&(Re=!1),Re){var nt=d("style");nt.setAttribute("f-forigin",T[R].fOrigin),nt.setAttribute("f-origin",T[R].origin),nt.setAttribute("f-family",T[R].fFamily),nt.type="text/css",nt.innerText="@font-face {font-family: "+T[R].fFamily+"; font-style: normal; src: url('"+T[R].fPath+"');}",z.appendChild(nt)}}else if(T[R].fOrigin==="g"||T[R].origin===1){for(Ue=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),ze=0;ze<Ue.length;ze+=1)Ue[ze].href.indexOf(T[R].fPath)!==-1&&(Re=!1);if(Re){var at=d("link");at.setAttribute("f-forigin",T[R].fOrigin),at.setAttribute("f-origin",T[R].origin),at.type="text/css",at.rel="stylesheet",at.href=T[R].fPath,document.body.appendChild(at)}}else if(T[R].fOrigin==="t"||T[R].origin===2){for(Ue=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),ze=0;ze<Ue.length;ze+=1)T[R].fPath===Ue[ze].src&&(Re=!1);if(Re){var It=d("link");It.setAttribute("f-forigin",T[R].fOrigin),It.setAttribute("f-origin",T[R].origin),It.setAttribute("rel","stylesheet"),It.setAttribute("href",T[R].fPath),z.appendChild(It)}}T[R].helper=K(T[R],z),T[R].cache={},this.fonts.push(T[R])}X===0?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}function G(M){if(M){this.chars||(this.chars=[]);var z,T=M.length,R,ne=this.chars.length,X;for(z=0;z<T;z+=1){for(R=0,X=!1;R<ne;)this.chars[R].style===M[z].style&&this.chars[R].fFamily===M[z].fFamily&&this.chars[R].ch===M[z].ch&&(X=!0),R+=1;X||(this.chars.push(M[z]),ne+=1)}}}function O(M,z,T){for(var R=0,ne=this.chars.length;R<ne;){if(this.chars[R].ch===M&&this.chars[R].style===z&&this.chars[R].fFamily===T)return this.chars[R];R+=1}return(typeof M=="string"&&M.charCodeAt(0)!==13||!M)&&console&&console.warn&&!this._warned&&(this._warned=!0,console.warn("Missing character from exported characters list: ",M,z,T)),h}function _(M,z,T){var R=this.getFontByName(z),ne=M;if(!R.cache[ne]){var X=R.helper;if(M===" "){var Re=X.measureText("|"+M+"|"),Ue=X.measureText("||");R.cache[ne]=(Re-Ue)/100}else R.cache[ne]=X.measureText(M)/100}return R.cache[ne]*T}function P(M){for(var z=0,T=this.fonts.length;z<T;){if(this.fonts[z].fName===M)return this.fonts[z];z+=1}return this.fonts[0]}function $(M){var z=0,T=M.charCodeAt(0);if(T>=55296&&T<=56319){var R=M.charCodeAt(1);R>=56320&&R<=57343&&(z=(T-55296)*1024+R-56320+65536)}return z}function Y(M,z){var T=M.toString(16)+z.toString(16);return ee.indexOf(T)!==-1}function Z(M){return M===L}function ae(M){return M===D}function Se(M){var z=$(M);return z>=B&&z<=V}function Ke(M){return Se(M.substr(0,2))&&Se(M.substr(2,2))}function De(M){return p.indexOf(M)!==-1}function Te(M,z){var T=$(M.substr(z,2));if(T!==m)return!1;var R=0;for(z+=2;R<5;){if(T=$(M.substr(z,2)),T<x||T>A)return!1;R+=1,z+=2}return $(M.substr(z,2))===S}function Ye(){this.isLoaded=!0}var ke=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};ke.isModifier=Y,ke.isZeroWidthJoiner=Z,ke.isFlagEmoji=Ke,ke.isRegionalCode=Se,ke.isCombinedCharacter=De,ke.isRegionalFlag=Te,ke.isVariationSelector=ae,ke.BLACK_FLAG_CODE_POINT=m;var xe={addChars:G,addFonts:J,getCharData:O,getFontByName:P,measureText:_,checkLoadedFonts:q,setIsLoaded:Ye};return ke.prototype=xe,ke}();function Jc(c){this.animationData=c}Jc.prototype.getProp=function(c){return this.animationData.slots&&this.animationData.slots[c.sid]?Object.assign(c,this.animationData.slots[c.sid].p):c};function um(c){return new Jc(c)}function Hn(){}Hn.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(h){this.renderableComponents.indexOf(h)===-1&&this.renderableComponents.push(h)},removeRenderableComponent:function(h){this.renderableComponents.indexOf(h)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(h),1)},prepareRenderableFrame:function(h){this.checkLayerLimits(h)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(h){this.data.ip-this.data.st<=h&&this.data.op-this.data.st>h?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var h,p=this.renderableComponents.length;for(h=0;h<p;h+=1)this.renderableComponents[h].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return this.data.ty===5?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}};var po=function(){var c={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"};return function(h){return c[h]||""}}();function hm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function dm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function fm(c,h,p){this.p=Ae.getProp(h,c.v,1,0,p)}function pm(c,h,p){this.p=Ae.getProp(h,c.v,1,0,p)}function gm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function mm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function vm(c,h,p){this.p=Ae.getProp(h,c.v,0,0,p)}function ym(){this.p={}}function Zc(c,h){var p=c.ef||[];this.effectElements=[];var m,S=p.length,x;for(m=0;m<S;m+=1)x=new Zr(p[m],h),this.effectElements.push(x)}function Zr(c,h){this.init(c,h)}f([_t],Zr),Zr.prototype.getValue=Zr.prototype.iterateDynamicProperties,Zr.prototype.init=function(c,h){this.data=c,this.effectElements=[],this.initDynamicPropertyContainer(h);var p,m=this.data.ef.length,S,x=this.data.ef;for(p=0;p<m;p+=1){switch(S=null,x[p].ty){case 0:S=new hm(x[p],h,this);break;case 1:S=new dm(x[p],h,this);break;case 2:S=new fm(x[p],h,this);break;case 3:S=new pm(x[p],h,this);break;case 4:case 7:S=new vm(x[p],h,this);break;case 10:S=new gm(x[p],h,this);break;case 11:S=new mm(x[p],h,this);break;case 5:S=new Zc(x[p],h);break;default:S=new ym(x[p]);break}S&&this.effectElements.push(S)}};function wi(){}wi.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var h=0,p=this.data.masksProperties.length;h<p;){if(this.data.masksProperties[h].mode!=="n"&&this.data.masksProperties[h].cl!==!1)return!0;h+=1}return!1},initExpressions:function(){},setBlendMode:function(){var h=po(this.data.bm),p=this.baseElement||this.layerElement;p.style["mix-blend-mode"]=h},initBaseData:function(h,p,m){this.globalData=p,this.comp=m,this.data=h,this.layerId=we(),this.data.sr||(this.data.sr=1),this.effectsManager=new Zc(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}};function Ai(){}Ai.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(h,p){var m,S=this.dynamicProperties.length;for(m=0;m<S;m+=1)(p||this._isParent&&this.dynamicProperties[m].propType==="transform")&&(this.dynamicProperties[m].getValue(),this.dynamicProperties[m]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(h){this.dynamicProperties.indexOf(h)===-1&&this.dynamicProperties.push(h)}};function Li(c,h,p){this.initFrame(),this.initRenderable(),this.assetData=h.getAssetData(c.refId),this.footageData=h.imageLoader.getAsset(this.assetData),this.initBaseData(c,h,p)}Li.prototype.prepareFrame=function(){},f([Hn,wi,Ai],Li),Li.prototype.getBaseElement=function(){return null},Li.prototype.renderFrame=function(){},Li.prototype.destroy=function(){},Li.prototype.initExpressions=function(){},Li.prototype.getFootageData=function(){return this.footageData};function Jt(c,h,p){this.initFrame(),this.initRenderable(),this.assetData=h.getAssetData(c.refId),this.initBaseData(c,h,p),this._isPlaying=!1,this._canPlay=!1;var m=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(m),this._currentTime=0,this.globalData.audioController.addAudio(this),this._volumeMultiplier=1,this._volume=1,this._previousVolume=null,this.tm=c.tm?Ae.getProp(this,c.tm,0,h.frameRate,this):{_placeholder:!0},this.lv=Ae.getProp(this,c.au&&c.au.lv?c.au.lv:{k:[100]},1,.01,this)}Jt.prototype.prepareFrame=function(c){if(this.prepareRenderableFrame(c,!0),this.prepareProperties(c,!0),this.tm._placeholder)this._currentTime=c/this.data.sr;else{var h=this.tm.v;this._currentTime=h}this._volume=this.lv.v[0];var p=this._volume*this._volumeMultiplier;this._previousVolume!==p&&(this._previousVolume=p,this.audio.volume(p))},f([Hn,wi,Ai],Jt),Jt.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},Jt.prototype.show=function(){},Jt.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},Jt.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},Jt.prototype.resume=function(){this._canPlay=!0},Jt.prototype.setRate=function(c){this.audio.rate(c)},Jt.prototype.volume=function(c){this._volumeMultiplier=c,this._previousVolume=c*this._volume,this.audio.volume(this._previousVolume)},Jt.prototype.getBaseElement=function(){return null},Jt.prototype.destroy=function(){},Jt.prototype.sourceRectAtTime=function(){},Jt.prototype.initExpressions=function(){};function zt(){}zt.prototype.checkLayers=function(c){var h,p=this.layers.length,m;for(this.completeLayers=!0,h=p-1;h>=0;h-=1)this.elements[h]||(m=this.layers[h],m.ip-m.st<=c-this.layers[h].st&&m.op-m.st>c-this.layers[h].st&&this.buildItem(h)),this.completeLayers=this.elements[h]?this.completeLayers:!1;this.checkPendingElements()},zt.prototype.createItem=function(c){switch(c.ty){case 2:return this.createImage(c);case 0:return this.createComp(c);case 1:return this.createSolid(c);case 3:return this.createNull(c);case 4:return this.createShape(c);case 5:return this.createText(c);case 6:return this.createAudio(c);case 13:return this.createCamera(c);case 15:return this.createFootage(c);default:return this.createNull(c)}},zt.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},zt.prototype.createAudio=function(c){return new Jt(c,this.globalData,this)},zt.prototype.createFootage=function(c){return new Li(c,this.globalData,this)},zt.prototype.buildAllItems=function(){var c,h=this.layers.length;for(c=0;c<h;c+=1)this.buildItem(c);this.checkPendingElements()},zt.prototype.includeLayers=function(c){this.completeLayers=!1;var h,p=c.length,m,S=this.layers.length;for(h=0;h<p;h+=1)for(m=0;m<S;){if(this.layers[m].id===c[h].id){this.layers[m]=c[h];break}m+=1}},zt.prototype.setProjectInterface=function(c){this.globalData.projectInterface=c},zt.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},zt.prototype.buildElementParenting=function(c,h,p){for(var m=this.elements,S=this.layers,x=0,A=S.length;x<A;)S[x].ind==h&&(!m[x]||m[x]===!0?(this.buildItem(x),this.addPendingElement(c)):(p.push(m[x]),m[x].setAsParent(),S[x].parent!==void 0?this.buildElementParenting(c,S[x].parent,p):c.setHierarchy(p))),x+=1},zt.prototype.addPendingElement=function(c){this.pendingElements.push(c)},zt.prototype.searchExtraCompositions=function(c){var h,p=c.length;for(h=0;h<p;h+=1)if(c[h].xt){var m=this.createComp(c[h]);m.initExpressions(),this.globalData.projectInterface.registerComposition(m)}},zt.prototype.getElementById=function(c){var h,p=this.elements.length;for(h=0;h<p;h+=1)if(this.elements[h].data.ind===c)return this.elements[h];return null},zt.prototype.getElementByPath=function(c){var h=c.shift(),p;if(typeof h=="number")p=this.elements[h];else{var m,S=this.elements.length;for(m=0;m<S;m+=1)if(this.elements[m].data.nm===h){p=this.elements[m];break}}return c.length===0?p:p.getElementByPath(c)},zt.prototype.setupGlobalData=function(c,h){this.globalData.fontManager=new ji,this.globalData.slotManager=um(c),this.globalData.fontManager.addChars(c.chars),this.globalData.fontManager.addFonts(c.fonts,h),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.audioController=this.animationItem.audioController,this.globalData.frameId=0,this.globalData.frameRate=c.fr,this.globalData.nm=c.nm,this.globalData.compSize={w:c.w,h:c.h}};var xm={TRANSFORM_EFFECT:"transformEFfect"};function xr(){}xr.prototype={initTransform:function(){var h=new Ie;this.finalTransform={mProp:this.data.ks?lo.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:h,localMat:h,localOpacity:1},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var h,p=this.finalTransform.mat,m=0,S=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;m<S;){if(this.hierarchy[m].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}m+=1}if(this.finalTransform._matMdf)for(h=this.finalTransform.mProp.v.props,p.cloneFromProps(h),m=0;m<S;m+=1)p.multiply(this.hierarchy[m].finalTransform.mProp.v)}this.finalTransform._matMdf&&(this.finalTransform._localMatMdf=this.finalTransform._matMdf),this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v)},renderLocalTransform:function(){if(this.localTransforms){var h=0,p=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;h<p;)this.localTransforms[h]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[h]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),h+=1;if(this.finalTransform._localMatMdf){var m=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(m),h=1;h<p;h+=1){var S=this.localTransforms[h].matrix;m.multiply(S)}m.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var x=this.finalTransform.localOpacity;for(h=0;h<p;h+=1)x*=this.localTransforms[h].opacity*.01;this.finalTransform.localOpacity=x}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var h=this.renderableEffectsManager.getEffects(xm.TRANSFORM_EFFECT);if(h.length){this.localTransforms=[],this.finalTransform.localMat=new Ie;var p=0,m=h.length;for(p=0;p<m;p+=1)this.localTransforms.push(h[p])}}},globalToLocal:function(h){var p=[];p.push(this.finalTransform);for(var m=!0,S=this.comp;m;)S.finalTransform?(S.data.hasMask&&p.splice(0,0,S.finalTransform),S=S.comp):m=!1;var x,A=p.length,D;for(x=0;x<A;x+=1)D=p[x].mat.applyToPointArray(0,0,0),h=[h[0]-D[0],h[1]-D[1],0];return h},mHelper:new Ie};function Ki(c,h,p){this.data=c,this.element=h,this.globalData=p,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var m=this.globalData.defs,S,x=this.masksProperties?this.masksProperties.length:0;this.viewData=E(x),this.solidPath="";var A,D=this.masksProperties,L=0,B=[],V,ee,I=we(),H,q,K,J,G="clipPath",O="clip-path";for(S=0;S<x;S+=1)if((D[S].mode!=="a"&&D[S].mode!=="n"||D[S].inv||D[S].o.k!==100||D[S].o.x)&&(G="mask",O="mask"),(D[S].mode==="s"||D[S].mode==="i")&&L===0?(H=Be("rect"),H.setAttribute("fill","#ffffff"),H.setAttribute("width",this.element.comp.data.w||0),H.setAttribute("height",this.element.comp.data.h||0),B.push(H)):H=null,A=Be("path"),D[S].mode==="n")this.viewData[S]={op:Ae.getProp(this.element,D[S].o,0,.01,this.element),prop:Ce.getShapeProp(this.element,D[S],3),elem:A,lastPath:""},m.appendChild(A);else{L+=1,A.setAttribute("fill",D[S].mode==="s"?"#000000":"#ffffff"),A.setAttribute("clip-rule","nonzero");var _;if(D[S].x.k!==0?(G="mask",O="mask",J=Ae.getProp(this.element,D[S].x,0,null,this.element),_=we(),q=Be("filter"),q.setAttribute("id",_),K=Be("feMorphology"),K.setAttribute("operator","erode"),K.setAttribute("in","SourceGraphic"),K.setAttribute("radius","0"),q.appendChild(K),m.appendChild(q),A.setAttribute("stroke",D[S].mode==="s"?"#000000":"#ffffff")):(K=null,J=null),this.storedData[S]={elem:A,x:J,expan:K,lastPath:"",lastOperator:"",filterId:_,lastRadius:0},D[S].mode==="i"){ee=B.length;var P=Be("g");for(V=0;V<ee;V+=1)P.appendChild(B[V]);var $=Be("mask");$.setAttribute("mask-type","alpha"),$.setAttribute("id",I+"_"+L),$.appendChild(A),m.appendChild($),P.setAttribute("mask","url("+u()+"#"+I+"_"+L+")"),B.length=0,B.push(P)}else B.push(A);D[S].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[S]={elem:A,lastPath:"",op:Ae.getProp(this.element,D[S].o,0,.01,this.element),prop:Ce.getShapeProp(this.element,D[S],3),invRect:H},this.viewData[S].prop.k||this.drawPath(D[S],this.viewData[S].prop.v,this.viewData[S])}for(this.maskElement=Be(G),x=B.length,S=0;S<x;S+=1)this.maskElement.appendChild(B[S]);L>0&&(this.maskElement.setAttribute("id",I),this.element.maskedElement.setAttribute(O,"url("+u()+"#"+I+")"),m.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}Ki.prototype.getMaskProperty=function(c){return this.viewData[c].prop},Ki.prototype.renderFrame=function(c){var h=this.element.finalTransform.mat,p,m=this.masksProperties.length;for(p=0;p<m;p+=1)if((this.viewData[p].prop._mdf||c)&&this.drawPath(this.masksProperties[p],this.viewData[p].prop.v,this.viewData[p]),(this.viewData[p].op._mdf||c)&&this.viewData[p].elem.setAttribute("fill-opacity",this.viewData[p].op.v),this.masksProperties[p].mode!=="n"&&(this.viewData[p].invRect&&(this.element.finalTransform.mProp._mdf||c)&&this.viewData[p].invRect.setAttribute("transform",h.getInverseMatrix().to2dCSS()),this.storedData[p].x&&(this.storedData[p].x._mdf||c))){var S=this.storedData[p].expan;this.storedData[p].x.v<0?(this.storedData[p].lastOperator!=="erode"&&(this.storedData[p].lastOperator="erode",this.storedData[p].elem.setAttribute("filter","url("+u()+"#"+this.storedData[p].filterId+")")),S.setAttribute("radius",-this.storedData[p].x.v)):(this.storedData[p].lastOperator!=="dilate"&&(this.storedData[p].lastOperator="dilate",this.storedData[p].elem.setAttribute("filter",null)),this.storedData[p].elem.setAttribute("stroke-width",this.storedData[p].x.v*2))}},Ki.prototype.getMaskelement=function(){return this.maskElement},Ki.prototype.createLayerSolidPath=function(){var c="M0,0 ";return c+=" h"+this.globalData.compSize.w,c+=" v"+this.globalData.compSize.h,c+=" h-"+this.globalData.compSize.w,c+=" v-"+this.globalData.compSize.h+" ",c},Ki.prototype.drawPath=function(c,h,p){var m=" M"+h.v[0][0]+","+h.v[0][1],S,x;for(x=h._length,S=1;S<x;S+=1)m+=" C"+h.o[S-1][0]+","+h.o[S-1][1]+" "+h.i[S][0]+","+h.i[S][1]+" "+h.v[S][0]+","+h.v[S][1];if(h.c&&x>1&&(m+=" C"+h.o[S-1][0]+","+h.o[S-1][1]+" "+h.i[0][0]+","+h.i[0][1]+" "+h.v[0][0]+","+h.v[0][1]),p.lastPath!==m){var A="";p.elem&&(h.c&&(A=c.inv?this.solidPath+m:m),p.elem.setAttribute("d",A)),p.lastPath=m}},Ki.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var en=function(){var c={};c.createFilter=h,c.createAlphaToLuminanceFilter=p;function h(m,S){var x=Be("filter");return x.setAttribute("id",m),S!==!0&&(x.setAttribute("filterUnits","objectBoundingBox"),x.setAttribute("x","0%"),x.setAttribute("y","0%"),x.setAttribute("width","100%"),x.setAttribute("height","100%")),x}function p(){var m=Be("feColorMatrix");return m.setAttribute("type","matrix"),m.setAttribute("color-interpolation-filters","sRGB"),m.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),m}return c}(),eu=function(){var c={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(c.maskType=!1),/firefox/i.test(navigator.userAgent)&&(c.svgLumaHidden=!1),c}(),go={},tu="filter_result_";function mo(c){var h,p="SourceGraphic",m=c.data.ef?c.data.ef.length:0,S=we(),x=en.createFilter(S,!0),A=0;this.filters=[];var D;for(h=0;h<m;h+=1){D=null;var L=c.data.ef[h].ty;if(go[L]){var B=go[L].effect;D=new B(x,c.effectsManager.effectElements[h],c,tu+A,p),p=tu+A,go[L].countsAsEffect&&(A+=1)}D&&this.filters.push(D)}A&&(c.globalData.defs.appendChild(x),c.layerElement.setAttribute("filter","url("+u()+"#"+S+")")),this.filters.length&&c.addRenderableComponent(this)}mo.prototype.renderFrame=function(c){var h,p=this.filters.length;for(h=0;h<p;h+=1)this.filters[h].renderFrame(c)},mo.prototype.getEffects=function(c){var h,p=this.filters.length,m=[];for(h=0;h<p;h+=1)this.filters[h].type===c&&m.push(this.filters[h]);return m};function tn(){}tn.prototype={initRendererElement:function(){this.layerElement=Be("g")},createContainerElements:function(){this.matteElement=Be("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var h=null;if(this.data.td){this.matteMasks={};var p=Be("g");p.setAttribute("id",this.layerId),p.appendChild(this.layerElement),h=p,this.globalData.defs.appendChild(p)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),h=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.ty===0&&!this.data.hd){var m=Be("clipPath"),S=Be("path");S.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var x=we();if(m.setAttribute("id",x),m.appendChild(S),this.globalData.defs.appendChild(m),this.checkMasks()){var A=Be("g");A.setAttribute("clip-path","url("+u()+"#"+x+")"),A.appendChild(this.layerElement),this.transformedElement=A,h?h.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+u()+"#"+x+")")}this.data.bm!==0&&this.setBlendMode()},renderElement:function(){this.finalTransform._localMatMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.localMat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.localOpacity)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new Ki(this.data,this,this.globalData),this.renderableEffectsManager=new mo(this),this.searchEffectTransforms()},getMatte:function(h){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[h]){var p=this.layerId+"_"+h,m,S,x,A;if(h===1||h===3){var D=Be("mask");D.setAttribute("id",p),D.setAttribute("mask-type",h===3?"luminance":"alpha"),x=Be("use"),x.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),D.appendChild(x),this.globalData.defs.appendChild(D),!eu.maskType&&h===1&&(D.setAttribute("mask-type","luminance"),m=we(),S=en.createFilter(m),this.globalData.defs.appendChild(S),S.appendChild(en.createAlphaToLuminanceFilter()),A=Be("g"),A.appendChild(x),D.appendChild(A),A.setAttribute("filter","url("+u()+"#"+m+")"))}else if(h===2){var L=Be("mask");L.setAttribute("id",p),L.setAttribute("mask-type","alpha");var B=Be("g");L.appendChild(B),m=we(),S=en.createFilter(m);var V=Be("feComponentTransfer");V.setAttribute("in","SourceGraphic"),S.appendChild(V);var ee=Be("feFuncA");ee.setAttribute("type","table"),ee.setAttribute("tableValues","1.0 0.0"),V.appendChild(ee),this.globalData.defs.appendChild(S);var I=Be("rect");I.setAttribute("width",this.comp.data.w),I.setAttribute("height",this.comp.data.h),I.setAttribute("x","0"),I.setAttribute("y","0"),I.setAttribute("fill","#ffffff"),I.setAttribute("opacity","0"),B.setAttribute("filter","url("+u()+"#"+m+")"),B.appendChild(I),x=Be("use"),x.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),B.appendChild(x),eu.maskType||(L.setAttribute("mask-type","luminance"),S.appendChild(en.createAlphaToLuminanceFilter()),A=Be("g"),B.appendChild(I),A.appendChild(this.layerElement),B.appendChild(A)),this.globalData.defs.appendChild(L)}this.matteMasks[h]=p}return this.matteMasks[h]},setMatte:function(h){this.matteElement&&this.matteElement.setAttribute("mask","url("+u()+"#"+h+")")}};function Sr(){}Sr.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(h){this.hierarchy=h},setAsParent:function(){this._isParent=!0},checkParenting:function(){this.data.parent!==void 0&&this.comp.buildElementParenting(this,this.data.parent,[])}};function sn(){}(function(){var c={initElement:function(p,m,S){this.initFrame(),this.initBaseData(p,m,S),this.initTransform(p,m,S),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){if(!this.hidden&&(!this.isInRange||this.isTransparent)){var p=this.baseElement||this.layerElement;p.style.display="none",this.hidden=!0}},show:function(){if(this.isInRange&&!this.isTransparent){if(!this.data.hd){var p=this.baseElement||this.layerElement;p.style.display="block"}this.hidden=!1,this._isFirstFrame=!0}},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(p){this._mdf=!1,this.prepareRenderableFrame(p),this.prepareProperties(p,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}};f([Hn,g(c)],sn)})();function rn(c,h,p){this.assetData=h.getAssetData(c.refId),this.assetData&&this.assetData.sid&&(this.assetData=h.slotManager.getProp(this.assetData)),this.initElement(c,h,p),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}f([wi,xr,tn,Sr,Ai,sn],rn),rn.prototype.createContent=function(){var c=this.globalData.getAssetsPath(this.assetData);this.innerElem=Be("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",c),this.layerElement.appendChild(this.innerElem)},rn.prototype.sourceRectAtTime=function(){return this.sourceRect};function Sm(c,h){this.elem=c,this.pos=h}function su(){}su.prototype={addShapeToModifiers:function(h){var p,m=this.shapeModifiers.length;for(p=0;p<m;p+=1)this.shapeModifiers[p].addShape(h)},isShapeInAnimatedModifiers:function(h){for(var p=0,m=this.shapeModifiers.length;p<m;)if(this.shapeModifiers[p].isAnimatedWithShape(h))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var h,p=this.shapes.length;for(h=0;h<p;h+=1)this.shapes[h].sh.reset();p=this.shapeModifiers.length;var m;for(h=p-1;h>=0&&(m=this.shapeModifiers[h].processShapes(this._isFirstFrame),!m);h-=1);}},searchProcessedElement:function(h){for(var p=this.processedElements,m=0,S=p.length;m<S;){if(p[m].elem===h)return p[m].pos;m+=1}return 0},addProcessedElement:function(h,p){for(var m=this.processedElements,S=m.length;S;)if(S-=1,m[S].elem===h){m[S].pos=p;return}m.push(new Sm(h,p))},prepareFrame:function(h){this.prepareRenderableFrame(h),this.prepareProperties(h,this.isInRange)}};var iu={1:"butt",2:"round",3:"square"},ru={1:"miter",2:"round",3:"bevel"};function nu(c,h,p){this.caches=[],this.styles=[],this.transformers=c,this.lStr="",this.sh=p,this.lvl=h,this._isAnimated=!!p.k;for(var m=0,S=c.length;m<S;){if(c[m].mProps.dynamicProperties.length){this._isAnimated=!0;break}m+=1}}nu.prototype.setAsAnimated=function(){this._isAnimated=!0};function au(c,h){this.data=c,this.type=c.ty,this.d="",this.lvl=h,this._mdf=!1,this.closed=c.hd===!0,this.pElem=Be("path"),this.msElem=null}au.prototype.reset=function(){this.d="",this._mdf=!1};function jn(c,h,p,m){this.elem=c,this.frameId=-1,this.dataProps=E(h.length),this.renderer=p,this.k=!1,this.dashStr="",this.dashArray=y("float32",h.length?h.length-1:0),this.dashoffset=y("float32",1),this.initDynamicPropertyContainer(m);var S,x=h.length||0,A;for(S=0;S<x;S+=1)A=Ae.getProp(c,h[S].v,0,0,this),this.k=A.k||this.k,this.dataProps[S]={n:h[S].n,p:A};this.k||this.getValue(!0),this._isAnimated=this.k}jn.prototype.getValue=function(c){if(!(this.elem.globalData.frameId===this.frameId&&!c)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||c,this._mdf)){var h=0,p=this.dataProps.length;for(this.renderer==="svg"&&(this.dashStr=""),h=0;h<p;h+=1)this.dataProps[h].n!=="o"?this.renderer==="svg"?this.dashStr+=" "+this.dataProps[h].p.v:this.dashArray[h]=this.dataProps[h].p.v:this.dashoffset[0]=this.dataProps[h].p.v}},f([_t],jn);function ou(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.o=Ae.getProp(c,h.o,0,.01,this),this.w=Ae.getProp(c,h.w,0,null,this),this.d=new jn(c,h.d||{},"svg",this),this.c=Ae.getProp(c,h.c,1,255,this),this.style=p,this._isAnimated=!!this._isAnimated}f([_t],ou);function lu(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.o=Ae.getProp(c,h.o,0,.01,this),this.c=Ae.getProp(c,h.c,1,255,this),this.style=p}f([_t],lu);function cu(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.style=p}f([_t],cu);function nn(c,h,p){this.data=h,this.c=y("uint8c",h.p*4);var m=h.k.k[0].s?h.k.k[0].s.length-h.p*4:h.k.k.length-h.p*4;this.o=y("float32",m),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=m,this.initDynamicPropertyContainer(p),this.prop=Ae.getProp(c,h.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}nn.prototype.comparePoints=function(c,h){for(var p=0,m=this.o.length/2,S;p<m;){if(S=Math.abs(c[p*4]-c[h*4+p*2]),S>.01)return!1;p+=1}return!0},nn.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var c=0,h=this.data.k.k.length;c<h;){if(!this.comparePoints(this.data.k.k[c].s,this.data.p))return!1;c+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},nn.prototype.getValue=function(c){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||c){var h,p=this.data.p*4,m,S;for(h=0;h<p;h+=1)m=h%4===0?100:255,S=Math.round(this.prop.v[h]*m),this.c[h]!==S&&(this.c[h]=S,this._cmdf=!c);if(this.o.length)for(p=this.prop.v.length,h=this.data.p*4;h<p;h+=1)m=h%2===0?100:1,S=h%2===0?Math.round(this.prop.v[h]*100):this.prop.v[h],this.o[h-this.data.p*4]!==S&&(this.o[h-this.data.p*4]=S,this._omdf=!c);this._mdf=!c}},f([_t],nn);function Er(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.initGradientData(c,h,p)}Er.prototype.initGradientData=function(c,h,p){this.o=Ae.getProp(c,h.o,0,.01,this),this.s=Ae.getProp(c,h.s,1,null,this),this.e=Ae.getProp(c,h.e,1,null,this),this.h=Ae.getProp(c,h.h||{k:0},0,.01,this),this.a=Ae.getProp(c,h.a||{k:0},0,Q,this),this.g=new nn(c,h.g,this),this.style=p,this.stops=[],this.setGradientData(p.pElem,h),this.setGradientOpacity(h,p),this._isAnimated=!!this._isAnimated},Er.prototype.setGradientData=function(c,h){var p=we(),m=Be(h.t===1?"linearGradient":"radialGradient");m.setAttribute("id",p),m.setAttribute("spreadMethod","pad"),m.setAttribute("gradientUnits","userSpaceOnUse");var S=[],x,A,D;for(D=h.g.p*4,A=0;A<D;A+=4)x=Be("stop"),m.appendChild(x),S.push(x);c.setAttribute(h.ty==="gf"?"fill":"stroke","url("+u()+"#"+p+")"),this.gf=m,this.cst=S},Er.prototype.setGradientOpacity=function(c,h){if(this.g._hasOpacity&&!this.g._collapsable){var p,m,S,x=Be("mask"),A=Be("path");x.appendChild(A);var D=we(),L=we();x.setAttribute("id",L);var B=Be(c.t===1?"linearGradient":"radialGradient");B.setAttribute("id",D),B.setAttribute("spreadMethod","pad"),B.setAttribute("gradientUnits","userSpaceOnUse"),S=c.g.k.k[0].s?c.g.k.k[0].s.length:c.g.k.k.length;var V=this.stops;for(m=c.g.p*4;m<S;m+=2)p=Be("stop"),p.setAttribute("stop-color","rgb(255,255,255)"),B.appendChild(p),V.push(p);A.setAttribute(c.ty==="gf"?"fill":"stroke","url("+u()+"#"+D+")"),c.ty==="gs"&&(A.setAttribute("stroke-linecap",iu[c.lc||2]),A.setAttribute("stroke-linejoin",ru[c.lj||2]),c.lj===1&&A.setAttribute("stroke-miterlimit",c.ml)),this.of=B,this.ms=x,this.ost=V,this.maskId=L,h.msElem=A}},f([_t],Er);function uu(c,h,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.w=Ae.getProp(c,h.w,0,null,this),this.d=new jn(c,h.d||{},"svg",this),this.initGradientData(c,h,p),this._isAnimated=!!this._isAnimated}f([Er,_t],uu);function Em(){this.it=[],this.prevViewData=[],this.gr=Be("g")}function bm(c,h,p){this.transform={mProps:c,op:h,container:p},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}var hu=function(h,p,m,S){if(p===0)return"";var x=h.o,A=h.i,D=h.v,L,B=" M"+S.applyToPointStringified(D[0][0],D[0][1]);for(L=1;L<p;L+=1)B+=" C"+S.applyToPointStringified(x[L-1][0],x[L-1][1])+" "+S.applyToPointStringified(A[L][0],A[L][1])+" "+S.applyToPointStringified(D[L][0],D[L][1]);return m&&p&&(B+=" C"+S.applyToPointStringified(x[L-1][0],x[L-1][1])+" "+S.applyToPointStringified(A[0][0],A[0][1])+" "+S.applyToPointStringified(D[0][0],D[0][1]),B+="z"),B},Tm=function(){var c=new Ie,h=new Ie,p={createRenderFunction:m};function m(ee){switch(ee.ty){case"fl":return D;case"gf":return B;case"gs":return L;case"st":return V;case"sh":case"el":case"rc":case"sr":return A;case"tr":return S;case"no":return x;default:return null}}function S(ee,I,H){(H||I.transform.op._mdf)&&I.transform.container.setAttribute("opacity",I.transform.op.v),(H||I.transform.mProps._mdf)&&I.transform.container.setAttribute("transform",I.transform.mProps.v.to2dCSS())}function x(){}function A(ee,I,H){var q,K,J,G,O,_,P=I.styles.length,$=I.lvl,Y,Z,ae,Se;for(_=0;_<P;_+=1){if(G=I.sh._mdf||H,I.styles[_].lvl<$){for(Z=h.reset(),ae=$-I.styles[_].lvl,Se=I.transformers.length-1;!G&&ae>0;)G=I.transformers[Se].mProps._mdf||G,ae-=1,Se-=1;if(G)for(ae=$-I.styles[_].lvl,Se=I.transformers.length-1;ae>0;)Z.multiply(I.transformers[Se].mProps.v),ae-=1,Se-=1}else Z=c;if(Y=I.sh.paths,K=Y._length,G){for(J="",q=0;q<K;q+=1)O=Y.shapes[q],O&&O._length&&(J+=hu(O,O._length,O.c,Z));I.caches[_]=J}else J=I.caches[_];I.styles[_].d+=ee.hd===!0?"":J,I.styles[_]._mdf=G||I.styles[_]._mdf}}function D(ee,I,H){var q=I.style;(I.c._mdf||H)&&q.pElem.setAttribute("fill","rgb("+te(I.c.v[0])+","+te(I.c.v[1])+","+te(I.c.v[2])+")"),(I.o._mdf||H)&&q.pElem.setAttribute("fill-opacity",I.o.v)}function L(ee,I,H){B(ee,I,H),V(ee,I,H)}function B(ee,I,H){var q=I.gf,K=I.g._hasOpacity,J=I.s.v,G=I.e.v;if(I.o._mdf||H){var O=ee.ty==="gf"?"fill-opacity":"stroke-opacity";I.style.pElem.setAttribute(O,I.o.v)}if(I.s._mdf||H){var _=ee.t===1?"x1":"cx",P=_==="x1"?"y1":"cy";q.setAttribute(_,J[0]),q.setAttribute(P,J[1]),K&&!I.g._collapsable&&(I.of.setAttribute(_,J[0]),I.of.setAttribute(P,J[1]))}var $,Y,Z,ae;if(I.g._cmdf||H){$=I.cst;var Se=I.g.c;for(Z=$.length,Y=0;Y<Z;Y+=1)ae=$[Y],ae.setAttribute("offset",Se[Y*4]+"%"),ae.setAttribute("stop-color","rgb("+Se[Y*4+1]+","+Se[Y*4+2]+","+Se[Y*4+3]+")")}if(K&&(I.g._omdf||H)){var Ke=I.g.o;for(I.g._collapsable?$=I.cst:$=I.ost,Z=$.length,Y=0;Y<Z;Y+=1)ae=$[Y],I.g._collapsable||ae.setAttribute("offset",Ke[Y*2]+"%"),ae.setAttribute("stop-opacity",Ke[Y*2+1])}if(ee.t===1)(I.e._mdf||H)&&(q.setAttribute("x2",G[0]),q.setAttribute("y2",G[1]),K&&!I.g._collapsable&&(I.of.setAttribute("x2",G[0]),I.of.setAttribute("y2",G[1])));else{var De;if((I.s._mdf||I.e._mdf||H)&&(De=Math.sqrt(Math.pow(J[0]-G[0],2)+Math.pow(J[1]-G[1],2)),q.setAttribute("r",De),K&&!I.g._collapsable&&I.of.setAttribute("r",De)),I.e._mdf||I.h._mdf||I.a._mdf||H){De||(De=Math.sqrt(Math.pow(J[0]-G[0],2)+Math.pow(J[1]-G[1],2)));var Te=Math.atan2(G[1]-J[1],G[0]-J[0]),Ye=I.h.v;Ye>=1?Ye=.99:Ye<=-1&&(Ye=-.99);var ke=De*Ye,xe=Math.cos(Te+I.a.v)*ke+J[0],M=Math.sin(Te+I.a.v)*ke+J[1];q.setAttribute("fx",xe),q.setAttribute("fy",M),K&&!I.g._collapsable&&(I.of.setAttribute("fx",xe),I.of.setAttribute("fy",M))}}}function V(ee,I,H){var q=I.style,K=I.d;K&&(K._mdf||H)&&K.dashStr&&(q.pElem.setAttribute("stroke-dasharray",K.dashStr),q.pElem.setAttribute("stroke-dashoffset",K.dashoffset[0])),I.c&&(I.c._mdf||H)&&q.pElem.setAttribute("stroke","rgb("+te(I.c.v[0])+","+te(I.c.v[1])+","+te(I.c.v[2])+")"),(I.o._mdf||H)&&q.pElem.setAttribute("stroke-opacity",I.o.v),(I.w._mdf||H)&&(q.pElem.setAttribute("stroke-width",I.w.v),q.msElem&&q.msElem.setAttribute("stroke-width",I.w.v))}return p}();function Lt(c,h,p){this.shapes=[],this.shapesData=c.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(c,h,p),this.prevViewData=[]}f([wi,xr,tn,su,Sr,Ai,sn],Lt),Lt.prototype.initSecondaryElement=function(){},Lt.prototype.identityMatrix=new Ie,Lt.prototype.buildExpressionInterface=function(){},Lt.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},Lt.prototype.filterUniqueShapes=function(){var c,h=this.shapes.length,p,m,S=this.stylesList.length,x,A=[],D=!1;for(m=0;m<S;m+=1){for(x=this.stylesList[m],D=!1,A.length=0,c=0;c<h;c+=1)p=this.shapes[c],p.styles.indexOf(x)!==-1&&(A.push(p),D=p._isAnimated||D);A.length>1&&D&&this.setShapesAsAnimated(A)}},Lt.prototype.setShapesAsAnimated=function(c){var h,p=c.length;for(h=0;h<p;h+=1)c[h].setAsAnimated()},Lt.prototype.createStyleElement=function(c,h){var p,m=new au(c,h),S=m.pElem;if(c.ty==="st")p=new ou(this,c,m);else if(c.ty==="fl")p=new lu(this,c,m);else if(c.ty==="gf"||c.ty==="gs"){var x=c.ty==="gf"?Er:uu;p=new x(this,c,m),this.globalData.defs.appendChild(p.gf),p.maskId&&(this.globalData.defs.appendChild(p.ms),this.globalData.defs.appendChild(p.of),S.setAttribute("mask","url("+u()+"#"+p.maskId+")"))}else c.ty==="no"&&(p=new cu(this,c,m));return(c.ty==="st"||c.ty==="gs")&&(S.setAttribute("stroke-linecap",iu[c.lc||2]),S.setAttribute("stroke-linejoin",ru[c.lj||2]),S.setAttribute("fill-opacity","0"),c.lj===1&&S.setAttribute("stroke-miterlimit",c.ml)),c.r===2&&S.setAttribute("fill-rule","evenodd"),c.ln&&S.setAttribute("id",c.ln),c.cl&&S.setAttribute("class",c.cl),c.bm&&(S.style["mix-blend-mode"]=po(c.bm)),this.stylesList.push(m),this.addToAnimatedContents(c,p),p},Lt.prototype.createGroupElement=function(c){var h=new Em;return c.ln&&h.gr.setAttribute("id",c.ln),c.cl&&h.gr.setAttribute("class",c.cl),c.bm&&(h.gr.style["mix-blend-mode"]=po(c.bm)),h},Lt.prototype.createTransformElement=function(c,h){var p=lo.getTransformProperty(this,c,this),m=new bm(p,p.o,h);return this.addToAnimatedContents(c,m),m},Lt.prototype.createShapeElement=function(c,h,p){var m=4;c.ty==="rc"?m=5:c.ty==="el"?m=6:c.ty==="sr"&&(m=7);var S=Ce.getShapeProp(this,c,m,this),x=new nu(h,p,S);return this.shapes.push(x),this.addShapeToModifiers(x),this.addToAnimatedContents(c,x),x},Lt.prototype.addToAnimatedContents=function(c,h){for(var p=0,m=this.animatedContents.length;p<m;){if(this.animatedContents[p].element===h)return;p+=1}this.animatedContents.push({fn:Tm.createRenderFunction(c),element:h,data:c})},Lt.prototype.setElementStyles=function(c){var h=c.styles,p,m=this.stylesList.length;for(p=0;p<m;p+=1)this.stylesList[p].closed||h.push(this.stylesList[p])},Lt.prototype.reloadShapes=function(){this._isFirstFrame=!0;var c,h=this.itemsData.length;for(c=0;c<h;c+=1)this.prevViewData[c]=this.itemsData[c];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),h=this.dynamicProperties.length,c=0;c<h;c+=1)this.dynamicProperties[c].getValue();this.renderModifiers()},Lt.prototype.searchShapes=function(c,h,p,m,S,x,A){var D=[].concat(x),L,B=c.length-1,V,ee,I=[],H=[],q,K,J;for(L=B;L>=0;L-=1){if(J=this.searchProcessedElement(c[L]),J?h[L]=p[J-1]:c[L]._render=A,c[L].ty==="fl"||c[L].ty==="st"||c[L].ty==="gf"||c[L].ty==="gs"||c[L].ty==="no")J?h[L].style.closed=!1:h[L]=this.createStyleElement(c[L],S),c[L]._render&&h[L].style.pElem.parentNode!==m&&m.appendChild(h[L].style.pElem),I.push(h[L].style);else if(c[L].ty==="gr"){if(!J)h[L]=this.createGroupElement(c[L]);else for(ee=h[L].it.length,V=0;V<ee;V+=1)h[L].prevViewData[V]=h[L].it[V];this.searchShapes(c[L].it,h[L].it,h[L].prevViewData,h[L].gr,S+1,D,A),c[L]._render&&h[L].gr.parentNode!==m&&m.appendChild(h[L].gr)}else c[L].ty==="tr"?(J||(h[L]=this.createTransformElement(c[L],m)),q=h[L].transform,D.push(q)):c[L].ty==="sh"||c[L].ty==="rc"||c[L].ty==="el"||c[L].ty==="sr"?(J||(h[L]=this.createShapeElement(c[L],D,S)),this.setElementStyles(h[L])):c[L].ty==="tm"||c[L].ty==="rd"||c[L].ty==="ms"||c[L].ty==="pb"||c[L].ty==="zz"||c[L].ty==="op"?(J?(K=h[L],K.closed=!1):(K=bi.getModifier(c[L].ty),K.init(this,c[L]),h[L]=K,this.shapeModifiers.push(K)),H.push(K)):c[L].ty==="rp"&&(J?(K=h[L],K.closed=!0):(K=bi.getModifier(c[L].ty),h[L]=K,K.init(this,c,L,h),this.shapeModifiers.push(K),A=!1),H.push(K));this.addProcessedElement(c[L],L+1)}for(B=I.length,L=0;L<B;L+=1)I[L].closed=!0;for(B=H.length,L=0;L<B;L+=1)H[L].closed=!0},Lt.prototype.renderInnerContent=function(){this.renderModifiers();var c,h=this.stylesList.length;for(c=0;c<h;c+=1)this.stylesList[c].reset();for(this.renderShape(),c=0;c<h;c+=1)(this.stylesList[c]._mdf||this._isFirstFrame)&&(this.stylesList[c].msElem&&(this.stylesList[c].msElem.setAttribute("d",this.stylesList[c].d),this.stylesList[c].d="M0 0"+this.stylesList[c].d),this.stylesList[c].pElem.setAttribute("d",this.stylesList[c].d||"M0 0"))},Lt.prototype.renderShape=function(){var c,h=this.animatedContents.length,p;for(c=0;c<h;c+=1)p=this.animatedContents[c],(this._isFirstFrame||p.element._isAnimated)&&p.data!==!0&&p.fn(p.data,p.element,this._isFirstFrame)},Lt.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null};function vo(c,h,p,m,S,x){this.o=c,this.sw=h,this.sc=p,this.fc=m,this.m=S,this.p=x,this._mdf={o:!0,sw:!!h,sc:!!p,fc:!!m,m:!0,p:!0}}vo.prototype.update=function(c,h,p,m,S,x){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1,this._mdf.p=!1;var A=!1;return this.o!==c&&(this.o=c,this._mdf.o=!0,A=!0),this.sw!==h&&(this.sw=h,this._mdf.sw=!0,A=!0),this.sc!==p&&(this.sc=p,this._mdf.sc=!0,A=!0),this.fc!==m&&(this.fc=m,this._mdf.fc=!0,A=!0),this.m!==S&&(this.m=S,this._mdf.m=!0,A=!0),x.length&&(this.p[0]!==x[0]||this.p[1]!==x[1]||this.p[4]!==x[4]||this.p[5]!==x[5]||this.p[12]!==x[12]||this.p[13]!==x[13])&&(this.p=x,this._mdf.p=!0,A=!0),A};function Yt(c,h){this._frameId=n,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,h.d&&h.d.sid&&(h.d=c.globalData.slotManager.getProp(h.d)),this.data=h,this.elem=c,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}Yt.prototype.defaultBoxWidth=[0,0],Yt.prototype.copyData=function(c,h){for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(c[p]=h[p]);return c},Yt.prototype.setCurrentData=function(c){c.__complete||this.completeTextData(c),this.currentData=c,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},Yt.prototype.searchProperty=function(){return this.searchKeyframes()},Yt.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},Yt.prototype.addEffect=function(c){this.effectsSequence.push(c),this.elem.addDynamicProperty(this)},Yt.prototype.getValue=function(c){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!c)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var h=this.currentData,p=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var m,S=this.effectsSequence.length,x=c||this.data.d.k[this.keysIndex].s;for(m=0;m<S;m+=1)p!==this.keysIndex?x=this.effectsSequence[m](x,x.t):x=this.effectsSequence[m](this.currentData,x.t);h!==x&&this.setCurrentData(x),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}},Yt.prototype.getKeyframeValue=function(){for(var c=this.data.d.k,h=this.elem.comp.renderedFrame,p=0,m=c.length;p<=m-1&&!(p===m-1||c[p+1].t>h);)p+=1;return this.keysIndex!==p&&(this.keysIndex=p),this.data.d.k[this.keysIndex].s},Yt.prototype.buildFinalText=function(c){for(var h=[],p=0,m=c.length,S,x,A=!1,D=!1,L="";p<m;)A=D,D=!1,S=c.charCodeAt(p),L=c.charAt(p),ji.isCombinedCharacter(S)?A=!0:S>=55296&&S<=56319?ji.isRegionalFlag(c,p)?L=c.substr(p,14):(x=c.charCodeAt(p+1),x>=56320&&x<=57343&&(ji.isModifier(S,x)?(L=c.substr(p,2),A=!0):ji.isFlagEmoji(c.substr(p,4))?L=c.substr(p,4):L=c.substr(p,2))):S>56319?(x=c.charCodeAt(p+1),ji.isVariationSelector(S)&&(A=!0)):ji.isZeroWidthJoiner(S)&&(A=!0,D=!0),A?(h[h.length-1]+=L,A=!1):h.push(L),p+=L.length;return h},Yt.prototype.completeTextData=function(c){c.__complete=!0;var h=this.elem.globalData.fontManager,p=this.data,m=[],S,x,A,D=0,L,B=p.m.g,V=0,ee=0,I=0,H=[],q=0,K=0,J,G,O=h.getFontByName(c.f),_,P=0,$=Qc(O);c.fWeight=$.weight,c.fStyle=$.style,c.finalSize=c.s,c.finalText=this.buildFinalText(c.t),x=c.finalText.length,c.finalLineHeight=c.lh;var Y=c.tr/1e3*c.finalSize,Z;if(c.sz)for(var ae=!0,Se=c.sz[0],Ke=c.sz[1],De,Te;ae;){Te=this.buildFinalText(c.t),De=0,q=0,x=Te.length,Y=c.tr/1e3*c.finalSize;var Ye=-1;for(S=0;S<x;S+=1)Z=Te[S].charCodeAt(0),A=!1,Te[S]===" "?Ye=S:(Z===13||Z===3)&&(q=0,A=!0,De+=c.finalLineHeight||c.finalSize*1.2),h.chars?(_=h.getCharData(Te[S],O.fStyle,O.fFamily),P=A?0:_.w*c.finalSize/100):P=h.measureText(Te[S],c.f,c.finalSize),q+P>Se&&Te[S]!==" "?(Ye===-1?x+=1:S=Ye,De+=c.finalLineHeight||c.finalSize*1.2,Te.splice(S,Ye===S?1:0,"\r"),Ye=-1,q=0):(q+=P,q+=Y);De+=O.ascent*c.finalSize/100,this.canResize&&c.finalSize>this.minimumFontSize&&Ke<De?(c.finalSize-=1,c.finalLineHeight=c.finalSize*c.lh/c.s):(c.finalText=Te,x=c.finalText.length,ae=!1)}q=-Y,P=0;var ke=0,xe;for(S=0;S<x;S+=1)if(A=!1,xe=c.finalText[S],Z=xe.charCodeAt(0),Z===13||Z===3?(ke=0,H.push(q),K=q>K?q:K,q=-2*Y,L="",A=!0,I+=1):L=xe,h.chars?(_=h.getCharData(xe,O.fStyle,h.getFontByName(c.f).fFamily),P=A?0:_.w*c.finalSize/100):P=h.measureText(L,c.f,c.finalSize),xe===" "?ke+=P+Y:(q+=P+Y+ke,ke=0),m.push({l:P,an:P,add:V,n:A,anIndexes:[],val:L,line:I,animatorJustifyOffset:0}),B==2){if(V+=P,L===""||L===" "||S===x-1){for((L===""||L===" ")&&(V-=P);ee<=S;)m[ee].an=V,m[ee].ind=D,m[ee].extra=P,ee+=1;D+=1,V=0}}else if(B==3){if(V+=P,L===""||S===x-1){for(L===""&&(V-=P);ee<=S;)m[ee].an=V,m[ee].ind=D,m[ee].extra=P,ee+=1;V=0,D+=1}}else m[D].ind=D,m[D].extra=0,D+=1;if(c.l=m,K=q>K?q:K,H.push(q),c.sz)c.boxWidth=c.sz[0],c.justifyOffset=0;else switch(c.boxWidth=K,c.j){case 1:c.justifyOffset=-c.boxWidth;break;case 2:c.justifyOffset=-c.boxWidth/2;break;default:c.justifyOffset=0}c.lineWidths=H;var M=p.a,z,T;G=M.length;var R,ne,X=[];for(J=0;J<G;J+=1){for(z=M[J],z.a.sc&&(c.strokeColorAnim=!0),z.a.sw&&(c.strokeWidthAnim=!0),(z.a.fc||z.a.fh||z.a.fs||z.a.fb)&&(c.fillColorAnim=!0),ne=0,R=z.s.b,S=0;S<x;S+=1)T=m[S],T.anIndexes[J]=ne,(R==1&&T.val!==""||R==2&&T.val!==""&&T.val!==" "||R==3&&(T.n||T.val==" "||S==x-1)||R==4&&(T.n||S==x-1))&&(z.s.rn===1&&X.push(ne),ne+=1);p.a[J].s.totalChars=ne;var Re=-1,Ue;if(z.s.rn===1)for(S=0;S<x;S+=1)T=m[S],Re!=T.anIndexes[J]&&(Re=T.anIndexes[J],Ue=X.splice(Math.floor(Math.random()*X.length),1)[0]),T.anIndexes[J]=Ue}c.yOffset=c.finalLineHeight||c.finalSize*1.2,c.ls=c.ls||0,c.ascent=O.ascent*c.finalSize/100},Yt.prototype.updateDocumentData=function(c,h){h=h===void 0?this.keysIndex:h;var p=this.copyData({},this.data.d.k[h].s);p=this.copyData(p,c),this.data.d.k[h].s=p,this.recalculate(h),this.setCurrentData(p),this.elem.addDynamicProperty(this)},Yt.prototype.recalculate=function(c){var h=this.data.d.k[c].s;h.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(h)},Yt.prototype.canResizeFont=function(c){this.canResize=c,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},Yt.prototype.setMinimumFontSize=function(c){this.minimumFontSize=Math.floor(c)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var wm=function(){var c=Math.max,h=Math.min,p=Math.floor;function m(x,A){this._currentTextLength=-1,this.k=!1,this.data=A,this.elem=x,this.comp=x.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(x),this.s=Ae.getProp(x,A.s||{k:0},0,0,this),"e"in A?this.e=Ae.getProp(x,A.e,0,0,this):this.e={v:100},this.o=Ae.getProp(x,A.o||{k:0},0,0,this),this.xe=Ae.getProp(x,A.xe||{k:0},0,0,this),this.ne=Ae.getProp(x,A.ne||{k:0},0,0,this),this.sm=Ae.getProp(x,A.sm||{k:100},0,0,this),this.a=Ae.getProp(x,A.a,0,.01,this),this.dynamicProperties.length||this.getValue()}m.prototype={getMult:function(A){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var D=0,L=0,B=1,V=1;this.ne.v>0?D=this.ne.v/100:L=-this.ne.v/100,this.xe.v>0?B=1-this.xe.v/100:V=1+this.xe.v/100;var ee=si.getBezierEasing(D,L,B,V).get,I=0,H=this.finalS,q=this.finalE,K=this.data.sh;if(K===2)q===H?I=A>=q?1:0:I=c(0,h(.5/(q-H)+(A-H)/(q-H),1)),I=ee(I);else if(K===3)q===H?I=A>=q?0:1:I=1-c(0,h(.5/(q-H)+(A-H)/(q-H),1)),I=ee(I);else if(K===4)q===H?I=0:(I=c(0,h(.5/(q-H)+(A-H)/(q-H),1)),I<.5?I*=2:I=1-2*(I-.5)),I=ee(I);else if(K===5){if(q===H)I=0;else{var J=q-H;A=h(c(0,A+.5-H),q-H);var G=-J/2+A,O=J/2;I=Math.sqrt(1-G*G/(O*O))}I=ee(I)}else K===6?(q===H?I=0:(A=h(c(0,A+.5-H),q-H),I=(1+Math.cos(Math.PI+Math.PI*2*A/(q-H)))/2),I=ee(I)):(A>=p(H)&&(A-H<0?I=c(0,h(h(q,1)-(H-A),1)):I=c(0,h(q-A,1))),I=ee(I));if(this.sm.v!==100){var _=this.sm.v*.01;_===0&&(_=1e-8);var P=.5-_*.5;I<P?I=0:(I=(I-P)/_,I>1&&(I=1))}return I*this.a.v},getValue:function(A){this.iterateDynamicProperties(),this._mdf=A||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,A&&this.data.r===2&&(this.e.v=this._currentTextLength);var D=this.data.r===2?1:100/this.data.totalChars,L=this.o.v/D,B=this.s.v/D+L,V=this.e.v/D+L;if(B>V){var ee=B;B=V,V=ee}this.finalS=B,this.finalE=V}},f([_t],m);function S(x,A,D){return new m(x,A)}return{getTextSelectorProp:S}}();function Am(c,h,p){var m={propType:!1},S=Ae.getProp,x=h.a;this.a={r:x.r?S(c,x.r,0,Q,p):m,rx:x.rx?S(c,x.rx,0,Q,p):m,ry:x.ry?S(c,x.ry,0,Q,p):m,sk:x.sk?S(c,x.sk,0,Q,p):m,sa:x.sa?S(c,x.sa,0,Q,p):m,s:x.s?S(c,x.s,1,.01,p):m,a:x.a?S(c,x.a,1,0,p):m,o:x.o?S(c,x.o,0,.01,p):m,p:x.p?S(c,x.p,1,0,p):m,sw:x.sw?S(c,x.sw,0,0,p):m,sc:x.sc?S(c,x.sc,1,0,p):m,fc:x.fc?S(c,x.fc,1,0,p):m,fh:x.fh?S(c,x.fh,0,0,p):m,fs:x.fs?S(c,x.fs,0,.01,p):m,fb:x.fb?S(c,x.fb,0,.01,p):m,t:x.t?S(c,x.t,0,0,p):m},this.s=wm.getTextSelectorProp(c,h.s,p),this.s.t=h.s.t}function zi(c,h,p){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=c,this._renderType=h,this._elem=p,this._animatorsData=E(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(p)}zi.prototype.searchProperties=function(){var c,h=this._textData.a.length,p,m=Ae.getProp;for(c=0;c<h;c+=1)p=this._textData.a[c],this._animatorsData[c]=new Am(this._elem,p,this);this._textData.p&&"m"in this._textData.p?(this._pathData={a:m(this._elem,this._textData.p.a,0,0,this),f:m(this._elem,this._textData.p.f,0,0,this),l:m(this._elem,this._textData.p.l,0,0,this),r:m(this._elem,this._textData.p.r,0,0,this),p:m(this._elem,this._textData.p.p,0,0,this),m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=m(this._elem,this._textData.m.a,1,0,this)},zi.prototype.getMeasures=function(c,h){if(this.lettersChangedFlag=h,!(!this._mdf&&!this._isFirstFrame&&!h&&(!this._hasMaskedPath||!this._pathData.m._mdf))){this._isFirstFrame=!1;var p=this._moreOptions.alignment.v,m=this._animatorsData,S=this._textData,x=this.mHelper,A=this._renderType,D=this.renderedLetters.length,L,B,V,ee,I=c.l,H,q,K,J,G,O,_,P,$,Y,Z,ae,Se,Ke,De;if(this._hasMaskedPath){if(De=this._pathData.m,!this._pathData.n||this._pathData._mdf){var Te=De.v;this._pathData.r.v&&(Te=Te.reverse()),H={tLength:0,segments:[]},ee=Te._length-1;var Ye;for(ae=0,V=0;V<ee;V+=1)Ye=gs.buildBezierData(Te.v[V],Te.v[V+1],[Te.o[V][0]-Te.v[V][0],Te.o[V][1]-Te.v[V][1]],[Te.i[V+1][0]-Te.v[V+1][0],Te.i[V+1][1]-Te.v[V+1][1]]),H.tLength+=Ye.segmentLength,H.segments.push(Ye),ae+=Ye.segmentLength;V=ee,De.v.c&&(Ye=gs.buildBezierData(Te.v[V],Te.v[0],[Te.o[V][0]-Te.v[V][0],Te.o[V][1]-Te.v[V][1]],[Te.i[0][0]-Te.v[0][0],Te.i[0][1]-Te.v[0][1]]),H.tLength+=Ye.segmentLength,H.segments.push(Ye),ae+=Ye.segmentLength),this._pathData.pi=H}if(H=this._pathData.pi,q=this._pathData.f.v,_=0,O=1,J=0,G=!0,Y=H.segments,q<0&&De.v.c)for(H.tLength<Math.abs(q)&&(q=-Math.abs(q)%H.tLength),_=Y.length-1,$=Y[_].points,O=$.length-1;q<0;)q+=$[O].partialLength,O-=1,O<0&&(_-=1,$=Y[_].points,O=$.length-1);$=Y[_].points,P=$[O-1],K=$[O],Z=K.partialLength}ee=I.length,L=0,B=0;var ke=c.finalSize*1.2*.714,xe=!0,M,z,T,R,ne;R=m.length;var X,Re=-1,Ue,ze,nt,at=q,It=_,Zt=O,Bs=-1,es,Ut,cs,ft,Pe,oi,Ri,li,$s="",ci=this.defaultPropsArray,ui;if(c.j===2||c.j===1){var ts=0,_i=0,Ii=c.j===2?-.5:-1,Cs=0,ki=!0;for(V=0;V<ee;V+=1)if(I[V].n){for(ts&&(ts+=_i);Cs<V;)I[Cs].animatorJustifyOffset=ts,Cs+=1;ts=0,ki=!0}else{for(T=0;T<R;T+=1)M=m[T].a,M.t.propType&&(ki&&c.j===2&&(_i+=M.t.v*Ii),z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?ts+=M.t.v*X[0]*Ii:ts+=M.t.v*X*Ii);ki=!1}for(ts&&(ts+=_i);Cs<V;)I[Cs].animatorJustifyOffset=ts,Cs+=1}for(V=0;V<ee;V+=1){if(x.reset(),es=1,I[V].n)L=0,B+=c.yOffset,B+=xe?1:0,q=at,xe=!1,this._hasMaskedPath&&(_=It,O=Zt,$=Y[_].points,P=$[O-1],K=$[O],Z=K.partialLength,J=0),$s="",li="",oi="",ui="",ci=this.defaultPropsArray;else{if(this._hasMaskedPath){if(Bs!==I[V].line){switch(c.j){case 1:q+=ae-c.lineWidths[I[V].line];break;case 2:q+=(ae-c.lineWidths[I[V].line])/2;break}Bs=I[V].line}Re!==I[V].ind&&(I[Re]&&(q+=I[Re].extra),q+=I[V].an/2,Re=I[V].ind),q+=p[0]*I[V].an*.005;var Rs=0;for(T=0;T<R;T+=1)M=m[T].a,M.p.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?Rs+=M.p.v[0]*X[0]:Rs+=M.p.v[0]*X),M.a.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?Rs+=M.a.v[0]*X[0]:Rs+=M.a.v[0]*X);for(G=!0,this._pathData.a.v&&(q=I[0].an*.5+(ae-this._pathData.f.v-I[0].an*.5-I[I.length-1].an*.5)*Re/(ee-1),q+=this._pathData.f.v);G;)J+Z>=q+Rs||!$?(Se=(q+Rs-J)/K.partialLength,ze=P.point[0]+(K.point[0]-P.point[0])*Se,nt=P.point[1]+(K.point[1]-P.point[1])*Se,x.translate(-p[0]*I[V].an*.005,-(p[1]*ke)*.01),G=!1):$&&(J+=K.partialLength,O+=1,O>=$.length&&(O=0,_+=1,Y[_]?$=Y[_].points:De.v.c?(O=0,_=0,$=Y[_].points):(J-=K.partialLength,$=null)),$&&(P=K,K=$[O],Z=K.partialLength));Ue=I[V].an/2-I[V].add,x.translate(-Ue,0,0)}else Ue=I[V].an/2-I[V].add,x.translate(-Ue,0,0),x.translate(-p[0]*I[V].an*.005,-p[1]*ke*.01,0);for(T=0;T<R;T+=1)M=m[T].a,M.t.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),(L!==0||c.j!==0)&&(this._hasMaskedPath?X.length?q+=M.t.v*X[0]:q+=M.t.v*X:X.length?L+=M.t.v*X[0]:L+=M.t.v*X));for(c.strokeWidthAnim&&(cs=c.sw||0),c.strokeColorAnim&&(c.sc?Ut=[c.sc[0],c.sc[1],c.sc[2]]:Ut=[0,0,0]),c.fillColorAnim&&c.fc&&(ft=[c.fc[0],c.fc[1],c.fc[2]]),T=0;T<R;T+=1)M=m[T].a,M.a.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?x.translate(-M.a.v[0]*X[0],-M.a.v[1]*X[1],M.a.v[2]*X[2]):x.translate(-M.a.v[0]*X,-M.a.v[1]*X,M.a.v[2]*X));for(T=0;T<R;T+=1)M=m[T].a,M.s.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),X.length?x.scale(1+(M.s.v[0]-1)*X[0],1+(M.s.v[1]-1)*X[1],1):x.scale(1+(M.s.v[0]-1)*X,1+(M.s.v[1]-1)*X,1));for(T=0;T<R;T+=1){if(M=m[T].a,z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),M.sk.propType&&(X.length?x.skewFromAxis(-M.sk.v*X[0],M.sa.v*X[1]):x.skewFromAxis(-M.sk.v*X,M.sa.v*X)),M.r.propType&&(X.length?x.rotateZ(-M.r.v*X[2]):x.rotateZ(-M.r.v*X)),M.ry.propType&&(X.length?x.rotateY(M.ry.v*X[1]):x.rotateY(M.ry.v*X)),M.rx.propType&&(X.length?x.rotateX(M.rx.v*X[0]):x.rotateX(M.rx.v*X)),M.o.propType&&(X.length?es+=(M.o.v*X[0]-es)*X[0]:es+=(M.o.v*X-es)*X),c.strokeWidthAnim&&M.sw.propType&&(X.length?cs+=M.sw.v*X[0]:cs+=M.sw.v*X),c.strokeColorAnim&&M.sc.propType)for(Pe=0;Pe<3;Pe+=1)X.length?Ut[Pe]+=(M.sc.v[Pe]-Ut[Pe])*X[0]:Ut[Pe]+=(M.sc.v[Pe]-Ut[Pe])*X;if(c.fillColorAnim&&c.fc){if(M.fc.propType)for(Pe=0;Pe<3;Pe+=1)X.length?ft[Pe]+=(M.fc.v[Pe]-ft[Pe])*X[0]:ft[Pe]+=(M.fc.v[Pe]-ft[Pe])*X;M.fh.propType&&(X.length?ft=Je(ft,M.fh.v*X[0]):ft=Je(ft,M.fh.v*X)),M.fs.propType&&(X.length?ft=Ve(ft,M.fs.v*X[0]):ft=Ve(ft,M.fs.v*X)),M.fb.propType&&(X.length?ft=$e(ft,M.fb.v*X[0]):ft=$e(ft,M.fb.v*X))}}for(T=0;T<R;T+=1)M=m[T].a,M.p.propType&&(z=m[T].s,X=z.getMult(I[V].anIndexes[T],S.a[T].s.totalChars),this._hasMaskedPath?X.length?x.translate(0,M.p.v[1]*X[0],-M.p.v[2]*X[1]):x.translate(0,M.p.v[1]*X,-M.p.v[2]*X):X.length?x.translate(M.p.v[0]*X[0],M.p.v[1]*X[1],-M.p.v[2]*X[2]):x.translate(M.p.v[0]*X,M.p.v[1]*X,-M.p.v[2]*X));if(c.strokeWidthAnim&&(oi=cs<0?0:cs),c.strokeColorAnim&&(Ri="rgb("+Math.round(Ut[0]*255)+","+Math.round(Ut[1]*255)+","+Math.round(Ut[2]*255)+")"),c.fillColorAnim&&c.fc&&(li="rgb("+Math.round(ft[0]*255)+","+Math.round(ft[1]*255)+","+Math.round(ft[2]*255)+")"),this._hasMaskedPath){if(x.translate(0,-c.ls),x.translate(0,p[1]*ke*.01+B,0),this._pathData.p.v){Ke=(K.point[1]-P.point[1])/(K.point[0]-P.point[0]);var Wi=Math.atan(Ke)*180/Math.PI;K.point[0]<P.point[0]&&(Wi+=180),x.rotate(-Wi*Math.PI/180)}x.translate(ze,nt,0),q-=p[0]*I[V].an*.005,I[V+1]&&Re!==I[V+1].ind&&(q+=I[V].an/2,q+=c.tr*.001*c.finalSize)}else{switch(x.translate(L,B,0),c.ps&&x.translate(c.ps[0],c.ps[1]+c.ascent,0),c.j){case 1:x.translate(I[V].animatorJustifyOffset+c.justifyOffset+(c.boxWidth-c.lineWidths[I[V].line]),0,0);break;case 2:x.translate(I[V].animatorJustifyOffset+c.justifyOffset+(c.boxWidth-c.lineWidths[I[V].line])/2,0,0);break}x.translate(0,-c.ls),x.translate(Ue,0,0),x.translate(p[0]*I[V].an*.005,p[1]*ke*.01,0),L+=I[V].l+c.tr*.001*c.finalSize}A==="html"?$s=x.toCSS():A==="svg"?$s=x.to2dCSS():ci=[x.props[0],x.props[1],x.props[2],x.props[3],x.props[4],x.props[5],x.props[6],x.props[7],x.props[8],x.props[9],x.props[10],x.props[11],x.props[12],x.props[13],x.props[14],x.props[15]],ui=es}D<=V?(ne=new vo(ui,oi,Ri,li,$s,ci),this.renderedLetters.push(ne),D+=1,this.lettersChangedFlag=!0):(ne=this.renderedLetters[V],this.lettersChangedFlag=ne.update(ui,oi,Ri,li,$s,ci)||this.lettersChangedFlag)}}},zi.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},zi.prototype.mHelper=new Ie,zi.prototype.defaultPropsArray=[],f([_t],zi);function vs(){}vs.prototype.initElement=function(c,h,p){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(c,h,p),this.textProperty=new Yt(this,c.t,this.dynamicProperties),this.textAnimator=new zi(c.t,this.renderType,this),this.initTransform(c,h,p),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},vs.prototype.prepareFrame=function(c){this._mdf=!1,this.prepareRenderableFrame(c),this.prepareProperties(c,this.isInRange)},vs.prototype.createPathShape=function(c,h){var p,m=h.length,S,x="";for(p=0;p<m;p+=1)h[p].ty==="sh"&&(S=h[p].ks.k,x+=hu(S,S.i.length,!0,c));return x},vs.prototype.updateDocumentData=function(c,h){this.textProperty.updateDocumentData(c,h)},vs.prototype.canResizeFont=function(c){this.textProperty.canResizeFont(c)},vs.prototype.setMinimumFontSize=function(c){this.textProperty.setMinimumFontSize(c)},vs.prototype.applyTextPropertiesToMatrix=function(c,h,p,m,S){switch(c.ps&&h.translate(c.ps[0],c.ps[1]+c.ascent,0),h.translate(0,-c.ls,0),c.j){case 1:h.translate(c.justifyOffset+(c.boxWidth-c.lineWidths[p]),0,0);break;case 2:h.translate(c.justifyOffset+(c.boxWidth-c.lineWidths[p])/2,0,0);break}h.translate(m,S,0)},vs.prototype.buildColor=function(c){return"rgb("+Math.round(c[0]*255)+","+Math.round(c[1]*255)+","+Math.round(c[2]*255)+")"},vs.prototype.emptyProp=new vo,vs.prototype.destroy=function(){},vs.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var Lm={shapes:[]};function ni(c,h,p){this.textSpans=[],this.renderType="svg",this.initElement(c,h,p)}f([wi,xr,tn,Sr,Ai,sn,vs],ni),ni.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=Be("text"))},ni.prototype.buildTextContents=function(c){for(var h=0,p=c.length,m=[],S="";h<p;)c[h]==="\r"||c[h]===""?(m.push(S),S=""):S+=c[h],h+=1;return m.push(S),m},ni.prototype.buildShapeData=function(c,h){if(c.shapes&&c.shapes.length){var p=c.shapes[0];if(p.it){var m=p.it[p.it.length-1];m.s&&(m.s.k[0]=h,m.s.k[1]=h)}}return c},ni.prototype.buildNewText=function(){this.addDynamicProperty(this);var c,h,p=this.textProperty.currentData;this.renderedLetters=E(p?p.l.length:0),p.fc?this.layerElement.setAttribute("fill",this.buildColor(p.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),p.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(p.sc)),this.layerElement.setAttribute("stroke-width",p.sw)),this.layerElement.setAttribute("font-size",p.finalSize);var m=this.globalData.fontManager.getFontByName(p.f);if(m.fClass)this.layerElement.setAttribute("class",m.fClass);else{this.layerElement.setAttribute("font-family",m.fFamily);var S=p.fWeight,x=p.fStyle;this.layerElement.setAttribute("font-style",x),this.layerElement.setAttribute("font-weight",S)}this.layerElement.setAttribute("aria-label",p.t);var A=p.l||[],D=!!this.globalData.fontManager.chars;h=A.length;var L,B=this.mHelper,V="",ee=this.data.singleShape,I=0,H=0,q=!0,K=p.tr*.001*p.finalSize;if(ee&&!D&&!p.sz){var J=this.textContainer,G="start";switch(p.j){case 1:G="end";break;case 2:G="middle";break;default:G="start";break}J.setAttribute("text-anchor",G),J.setAttribute("letter-spacing",K);var O=this.buildTextContents(p.finalText);for(h=O.length,H=p.ps?p.ps[1]+p.ascent:0,c=0;c<h;c+=1)L=this.textSpans[c].span||Be("tspan"),L.textContent=O[c],L.setAttribute("x",0),L.setAttribute("y",H),L.style.display="inherit",J.appendChild(L),this.textSpans[c]||(this.textSpans[c]={span:null,glyph:null}),this.textSpans[c].span=L,H+=p.finalLineHeight;this.layerElement.appendChild(J)}else{var _=this.textSpans.length,P;for(c=0;c<h;c+=1){if(this.textSpans[c]||(this.textSpans[c]={span:null,childSpan:null,glyph:null}),!D||!ee||c===0){if(L=_>c?this.textSpans[c].span:Be(D?"g":"text"),_<=c){if(L.setAttribute("stroke-linecap","butt"),L.setAttribute("stroke-linejoin","round"),L.setAttribute("stroke-miterlimit","4"),this.textSpans[c].span=L,D){var $=Be("g");L.appendChild($),this.textSpans[c].childSpan=$}this.textSpans[c].span=L,this.layerElement.appendChild(L)}L.style.display="inherit"}if(B.reset(),ee&&(A[c].n&&(I=-K,H+=p.yOffset,H+=q?1:0,q=!1),this.applyTextPropertiesToMatrix(p,B,A[c].line,I,H),I+=A[c].l||0,I+=K),D){P=this.globalData.fontManager.getCharData(p.finalText[c],m.fStyle,this.globalData.fontManager.getFontByName(p.f).fFamily);var Y;if(P.t===1)Y=new an(P.data,this.globalData,this);else{var Z=Lm;P.data&&P.data.shapes&&(Z=this.buildShapeData(P.data,p.finalSize)),Y=new Lt(Z,this.globalData,this)}if(this.textSpans[c].glyph){var ae=this.textSpans[c].glyph;this.textSpans[c].childSpan.removeChild(ae.layerElement),ae.destroy()}this.textSpans[c].glyph=Y,Y._debug=!0,Y.prepareFrame(0),Y.renderFrame(),this.textSpans[c].childSpan.appendChild(Y.layerElement),P.t===1&&this.textSpans[c].childSpan.setAttribute("transform","scale("+p.finalSize/100+","+p.finalSize/100+")")}else ee&&L.setAttribute("transform","translate("+B.props[12]+","+B.props[13]+")"),L.textContent=A[c].val,L.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}ee&&L&&L.setAttribute("d",V)}for(;c<this.textSpans.length;)this.textSpans[c].span.style.display="none",c+=1;this._sizeChanged=!0},ni.prototype.sourceRectAtTime=function(){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var c=this.layerElement.getBBox();this.bbox={top:c.y,left:c.x,width:c.width,height:c.height}}return this.bbox},ni.prototype.getValue=function(){var c,h=this.textSpans.length,p;for(this.renderedFrame=this.comp.renderedFrame,c=0;c<h;c+=1)p=this.textSpans[c].glyph,p&&(p.prepareFrame(this.comp.renderedFrame-this.data.st),p._mdf&&(this._mdf=!0))},ni.prototype.renderInnerContent=function(){if(this.validateText(),(!this.data.singleShape||this._mdf)&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){this._sizeChanged=!0;var c,h,p=this.textAnimator.renderedLetters,m=this.textProperty.currentData.l;h=m.length;var S,x,A;for(c=0;c<h;c+=1)m[c].n||(S=p[c],x=this.textSpans[c].span,A=this.textSpans[c].glyph,A&&A.renderFrame(),S._mdf.m&&x.setAttribute("transform",S.m),S._mdf.o&&x.setAttribute("opacity",S.o),S._mdf.sw&&x.setAttribute("stroke-width",S.sw),S._mdf.sc&&x.setAttribute("stroke",S.sc),S._mdf.fc&&x.setAttribute("fill",S.fc))}};function yo(c,h,p){this.initElement(c,h,p)}f([rn],yo),yo.prototype.createContent=function(){var c=Be("rect");c.setAttribute("width",this.data.sw),c.setAttribute("height",this.data.sh),c.setAttribute("fill",this.data.sc),this.layerElement.appendChild(c)};function Ci(c,h,p){this.initFrame(),this.initBaseData(c,h,p),this.initFrame(),this.initTransform(c,h,p),this.initHierarchy()}Ci.prototype.prepareFrame=function(c){this.prepareProperties(c,!0)},Ci.prototype.renderFrame=function(){},Ci.prototype.getBaseElement=function(){return null},Ci.prototype.destroy=function(){},Ci.prototype.sourceRectAtTime=function(){},Ci.prototype.hide=function(){},f([wi,xr,Sr,Ai],Ci);function Mt(){}f([zt],Mt),Mt.prototype.createNull=function(c){return new Ci(c,this.globalData,this)},Mt.prototype.createShape=function(c){return new Lt(c,this.globalData,this)},Mt.prototype.createText=function(c){return new ni(c,this.globalData,this)},Mt.prototype.createImage=function(c){return new rn(c,this.globalData,this)},Mt.prototype.createSolid=function(c){return new yo(c,this.globalData,this)},Mt.prototype.configAnimation=function(c){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.svgElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+c.w+" "+c.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",c.w),this.svgElement.setAttribute("height",c.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)",this.svgElement.style.contentVisibility=this.renderConfig.contentVisibility),this.renderConfig.width&&this.svgElement.setAttribute("width",this.renderConfig.width),this.renderConfig.height&&this.svgElement.setAttribute("height",this.renderConfig.height),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),this.renderConfig.focusable!==void 0&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var h=this.globalData.defs;this.setupGlobalData(c,h),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=c;var p=Be("clipPath"),m=Be("rect");m.setAttribute("width",c.w),m.setAttribute("height",c.h),m.setAttribute("x",0),m.setAttribute("y",0);var S=we();p.setAttribute("id",S),p.appendChild(m),this.layerElement.setAttribute("clip-path","url("+u()+"#"+S+")"),h.appendChild(p),this.layers=c.layers,this.elements=E(c.layers.length)},Mt.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var c,h=this.layers?this.layers.length:0;for(c=0;c<h;c+=1)this.elements[c]&&this.elements[c].destroy&&this.elements[c].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},Mt.prototype.updateContainerSize=function(){},Mt.prototype.findIndexByInd=function(c){var h=0,p=this.layers.length;for(h=0;h<p;h+=1)if(this.layers[h].ind===c)return h;return-1},Mt.prototype.buildItem=function(c){var h=this.elements;if(!(h[c]||this.layers[c].ty===99)){h[c]=!0;var p=this.createItem(this.layers[c]);if(h[c]=p,Xe()&&(this.layers[c].ty===0&&this.globalData.projectInterface.registerComposition(p),p.initExpressions()),this.appendElementInPos(p,c),this.layers[c].tt){var m="tp"in this.layers[c]?this.findIndexByInd(this.layers[c].tp):c-1;if(m===-1)return;if(!this.elements[m]||this.elements[m]===!0)this.buildItem(m),this.addPendingElement(p);else{var S=h[m],x=S.getMatte(this.layers[c].tt);p.setMatte(x)}}}},Mt.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var c=this.pendingElements.pop();if(c.checkParenting(),c.data.tt)for(var h=0,p=this.elements.length;h<p;){if(this.elements[h]===c){var m="tp"in c.data?this.findIndexByInd(c.data.tp):h-1,S=this.elements[m],x=S.getMatte(this.layers[h].tt);c.setMatte(x);break}h+=1}}},Mt.prototype.renderFrame=function(c){if(!(this.renderedFrame===c||this.destroyed)){c===null?c=this.renderedFrame:this.renderedFrame=c,this.globalData.frameNum=c,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=c,this.globalData._mdf=!1;var h,p=this.layers.length;for(this.completeLayers||this.checkLayers(c),h=p-1;h>=0;h-=1)(this.completeLayers||this.elements[h])&&this.elements[h].prepareFrame(c-this.layers[h].st);if(this.globalData._mdf)for(h=0;h<p;h+=1)(this.completeLayers||this.elements[h])&&this.elements[h].renderFrame()}},Mt.prototype.appendElementInPos=function(c,h){var p=c.getBaseElement();if(p){for(var m=0,S;m<h;)this.elements[m]&&this.elements[m]!==!0&&this.elements[m].getBaseElement()&&(S=this.elements[m].getBaseElement()),m+=1;S?this.layerElement.insertBefore(p,S):this.layerElement.appendChild(p)}},Mt.prototype.hide=function(){this.layerElement.style.display="none"},Mt.prototype.show=function(){this.layerElement.style.display="block"};function ai(){}f([wi,xr,Sr,Ai,sn],ai),ai.prototype.initElement=function(c,h,p){this.initFrame(),this.initBaseData(c,h,p),this.initTransform(c,h,p),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),(this.data.xt||!h.progressiveLoad)&&this.buildAllItems(),this.hide()},ai.prototype.prepareFrame=function(c){if(this._mdf=!1,this.prepareRenderableFrame(c),this.prepareProperties(c,this.isInRange),!(!this.isInRange&&!this.data.xt)){if(this.tm._placeholder)this.renderedFrame=c/this.data.sr;else{var h=this.tm.v;h===this.data.op&&(h=this.data.op-1),this.renderedFrame=h}var p,m=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),p=m-1;p>=0;p-=1)(this.completeLayers||this.elements[p])&&(this.elements[p].prepareFrame(this.renderedFrame-this.layers[p].st),this.elements[p]._mdf&&(this._mdf=!0))}},ai.prototype.renderInnerContent=function(){var c,h=this.layers.length;for(c=0;c<h;c+=1)(this.completeLayers||this.elements[c])&&this.elements[c].renderFrame()},ai.prototype.setElements=function(c){this.elements=c},ai.prototype.getElements=function(){return this.elements},ai.prototype.destroyElements=function(){var c,h=this.layers.length;for(c=0;c<h;c+=1)this.elements[c]&&this.elements[c].destroy()},ai.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()};function an(c,h,p){this.layers=c.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?E(this.layers.length):[],this.initElement(c,h,p),this.tm=c.tm?Ae.getProp(this,c.tm,0,h.frameRate,this):{_placeholder:!0}}f([Mt,ai,tn],an),an.prototype.createComp=function(c){return new an(c,this.globalData,this)};function xo(c,h){this.animationItem=c,this.layers=null,this.renderedFrame=-1,this.svgElement=Be("svg");var p="";if(h&&h.title){var m=Be("title"),S=we();m.setAttribute("id",S),m.textContent=h.title,this.svgElement.appendChild(m),p+=S}if(h&&h.description){var x=Be("desc"),A=we();x.setAttribute("id",A),x.textContent=h.description,this.svgElement.appendChild(x),p+=" "+A}p&&this.svgElement.setAttribute("aria-labelledby",p);var D=Be("defs");this.svgElement.appendChild(D);var L=Be("g");this.svgElement.appendChild(L),this.layerElement=L,this.renderConfig={preserveAspectRatio:h&&h.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:h&&h.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:h&&h.contentVisibility||"visible",progressiveLoad:h&&h.progressiveLoad||!1,hideOnTransparent:!(h&&h.hideOnTransparent===!1),viewBoxOnly:h&&h.viewBoxOnly||!1,viewBoxSize:h&&h.viewBoxSize||!1,className:h&&h.className||"",id:h&&h.id||"",focusable:h&&h.focusable,filterSize:{width:h&&h.filterSize&&h.filterSize.width||"100%",height:h&&h.filterSize&&h.filterSize.height||"100%",x:h&&h.filterSize&&h.filterSize.x||"0%",y:h&&h.filterSize&&h.filterSize.y||"0%"},width:h&&h.width,height:h&&h.height,runExpressions:!h||h.runExpressions===void 0||h.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:D,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}return f([Mt],xo),xo.prototype.createComp=function(c){return new an(c,this.globalData,this)},ur("svg",xo),bi.registerModifier("tm",Ls),bi.registerModifier("pb",qr),bi.registerModifier("rp",Ns),bi.registerModifier("rd",Yr),bi.registerModifier("zz",Qr),bi.registerModifier("op",Jr),Fe})})($l,$l.exports);var vC=$l.exports;const yC=Rm(vC);function xC({loop:i=!1,path:e,animationData:t,className:s,onComplete:r,onError:n}){const a=fe.useRef(null),[o,l]=fe.useState(!1);return fe.useEffect(()=>{if(!a.current)return;l(!1);const u=yC.loadAnimation({container:a.current,renderer:"svg",autoplay:!0,loop:i,path:e,animationData:t}),d=()=>{l(!0),n==null||n()},f=()=>{r==null||r()};return u.addEventListener("data_failed",d),u.addEventListener("complete",f),()=>{u.removeEventListener("data_failed",d),u.removeEventListener("complete",f),u.destroy()}},[i,e,t]),o?null:Ne.jsx("div",{ref:a,className:s})}const SC="5.5.7",EC=30,bC=0,TC=31,wC=360,AC=360,LC="forward right",CC=0,RC=[],_C=[{ddd:0,ind:1,ty:4,nm:"Layer 2",sr:1,ks:{o:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:0,s:[0]},{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:10,s:[100]},{t:20,s:[0]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[161.086,180,0],ix:2},a:{a:0,k:[-18.914,0,0],ix:1},s:{a:0,k:[100,100,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,.923],[0,0],[-.777,-.499],[0,0],[.714,-.459],[0,0]],o:[[0,0],[0,-.923],[0,0],[.714,.459],[0,0],[-.777,.499]],v:[[-26.586,8.363],[-26.586,-8.363],[-24.788,-9.344],[-11.779,-.981],[-11.779,.981],[-24.788,9.344]],c:!0},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:!1},{ty:"fl",c:{a:0,k:[1,1,1,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"Fill 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Group 1",np:2,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:300,st:0,bm:0},{ddd:0,ind:2,ty:4,nm:"Layer 1",sr:1,ks:{o:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:5,s:[0]},{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:15,s:[100]},{t:25,s:[0]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[179.914,180,0],ix:2},a:{a:0,k:[-.086,0,0],ix:1},s:{a:0,k:[100,100,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,.923],[0,0],[-.777,-.499],[0,0],[.714,-.459],[0,0]],o:[[0,0],[0,-.923],[0,0],[.714,.459],[0,0],[-.777,.499]],v:[[-7.757,8.363],[-7.757,-8.363],[-5.959,-9.344],[7.05,-.981],[7.05,.981],[-5.959,9.344]],c:!0},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:!1},{ty:"fl",c:{a:0,k:[1,1,1,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"Fill 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Group 1",np:2,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:300,st:0,bm:0},{ddd:0,ind:3,ty:4,nm:"Layer 3",sr:1,ks:{o:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:10,s:[0]},{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:20,s:[100]},{t:30,s:[0]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[198.914,180,0],ix:2},a:{a:0,k:[18.914,0,0],ix:1},s:{a:0,k:[100,100,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,.923],[0,0],[-.777,-.499],[0,0],[.714,-.459],[0,0]],o:[[0,0],[0,-.923],[0,0],[.714,.459],[0,0],[-.777,.499]],v:[[11.243,8.363],[11.243,-8.363],[13.041,-9.344],[26.05,-.981],[26.05,.981],[13.041,9.344]],c:!0},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:!1},{ty:"fl",c:{a:0,k:[1,1,1,1],ix:4},o:{a:0,k:100,ix:5},r:1,bm:0,nm:"Fill 1",mn:"ADBE Vector Graphic - Fill",hd:!1},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Group 1",np:2,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:300,st:0,bm:0}],IC=[],kC={v:SC,fr:EC,ip:bC,op:TC,w:wC,h:AC,nm:LC,ddd:CC,assets:RC,layers:_C,markers:IC},PC="_root_1v1it_1",DC="_chapter_img_1v1it_20",MC="_name_1v1it_26",FC="_time_1v1it_37",pa={root:PC,chapter_img:DC,name:MC,time:FC};function OC({width:i,height:e,src:t,alt:s,draggable:r=!1,className:n}){return Ne.jsxs("picture",{children:[Ne.jsx("source",{type:"image/webp",srcSet:`${$d({f:"webp",h:e?e*2:void 0,w:i?i*2:void 0},t)}`,height:e}),Ne.jsx("img",{src:`${$d({h:e?e*2:void 0,w:i?i*2:void 0},t)}`,alt:s,draggable:r,width:i,height:e,className:n})]})}function NC({name:i,time:e,imageUrl:t,className:s,onClick:r}){return Ne.jsxs("div",{className:`${pa.root} ${s||""}`,onClick:r,children:[Ne.jsx(OC,{className:pa.chapter_img,src:t,width:90,height:130,alt:"챕터 이미지"}),Ne.jsx("div",{className:pa.name,children:i}),Ne.jsx("div",{className:pa.time,children:e})]})}const BC=fe.forwardRef(({src:i,ratio:e=!1,shadow:t=!0,controls:s=!0,posterSrc:r,initialTime:n,timeOffsetStart:a,timeOffsetEnd:o,quality:l,chapter:u,debug:d,loop:f,live:g,renderControls:v,onClick:y,onInit:E,onDestroy:b,onSync:w,className:F},k)=>{const[U,N]=fh(!1),[te,j]=fh(!1),[re,Q]=T1("",650),{ref:le,live:se,time:pe,play:de,playbackRate:be,handleSeektime:Le,handleBackward:ue,handleForward:he,handlePlayToggle:we,handlePlaybackRate:me}=oC({src:i,timeUpdateEvent:U,initialTime:n,timeOffsetStart:a,timeOffsetEnd:o,quality:l,debug:d,onSync:w,onInit:E,onDestroy:b}),ye=b1({onClick:N,onDoubleClick:Ze=>{if(g||se)return;const Xe=Ze.target.getBoundingClientRect(),dt=Xe.left+Xe.width/2;Ze.clientX<dt?(ue(),Q("left")):(he(),Q("right"))}}),Ve=(Ze,Xe)=>{if(Ze.stopPropagation(),!le.current)return;const dt=Xe*((o??le.current.duration)-(a??0))/100;Le(dt)},$e=()=>{j()},Je=Ze=>{Ze.key==="Enter"&&ye()},st=Ze=>Xe=>{Xe.stopPropagation(),Ze()};fe.useEffect(()=>{y==null||y(U)},[U,y]);const rt=!(g||se);return Ne.jsxs("div",{ref:k,className:`${bt.root} ${F||""}`,children:[Ne.jsx("video",{className:`${bt.video} ${e?bt.origin_ratio:""}`,ref:le,muted:!0,playsInline:!0,loop:f}),r&&Ne.jsx("div",{className:`${bt.poster} ${e?bt.origin_ratio:""}`,style:{backgroundImage:`url("${r}?h=1600&f=webp")`}}),Ne.jsxs("div",{className:`${bt.layer} ${t?bt.shadow:""}`,onClick:ye,onKeyDown:Je,tabIndex:0,"aria-label":"비디오 플레이어 컨트롤","aria-pressed":U,children:[re&&Ne.jsx("div",{className:`${bt.indicator} ${bt[`indicator_${re}`]}`,children:Ne.jsx(xC,{animationData:kC,loop:!0})}),s&&U&&Ne.jsxs(Ne.Fragment,{children:[rt&&Ne.jsx(Ug,{handle:!0,className:bt.progress,progress:pe.progress,onChangeProgress:Ve}),rt&&Ne.jsx(mC,{className:bt.time,currentTime:pe.currentTime,durationTime:pe.durationTime}),rt&&Ne.jsxs("button",{className:`${bt.button} ${bt.playbackrate}`,onClick:st(me),"aria-label":"비디오 배속",children:[be,"x"]}),Ne.jsx("button",{className:`${bt.button} ${bt.play_toggle}`,onClick:st(we),"aria-label":"비디오 재생","aria-pressed":de,children:Ne.jsx(Go,{name:de?"pause":"play"})}),rt&&Ne.jsx("button",{className:`${bt.button} ${bt.backward}`,onClick:st(ue),"aria-label":"비디오 10초 뒤로",children:Ne.jsx(Go,{name:"backward"})}),rt&&Ne.jsx("button",{className:`${bt.button} ${bt.forward}`,onClick:st(he),"aria-label":"비디오 10초 앞으로",children:Ne.jsx(Go,{name:"forward"})}),!!u&&rt&&Ne.jsx("button",{className:`${bt.button} ${bt.chapter_toggle}`,"aria-label":"비디오 챕터",onClick:st($e),children:Kt.t("chapter")}),!!u&&te&&Ne.jsx("div",{className:bt.chapter_wrap,children:u==null?void 0:u.map(Ze=>Ne.jsx(NC,{...Ze,onClick:st(()=>Le(gC(Ze.time)))},Ze.id))})]}),U&&(v==null?void 0:v({time:pe,play:de,handlePlayToggle:we,handleChangeProgress:Ve}))]})]})});function Ud(i){return i!==null&&typeof i=="object"&&"constructor"in i&&i.constructor===Object}function Fc(i,e){i===void 0&&(i={}),e===void 0&&(e={}),Object.keys(e).forEach(t=>{typeof i[t]>"u"?i[t]=e[t]:Ud(e[t])&&Ud(i[t])&&Object.keys(e[t]).length>0&&Fc(i[t],e[t])})}const Gg={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function lr(){const i=typeof document<"u"?document:{};return Fc(i,Gg),i}const $C={document:Gg,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(i){return typeof setTimeout>"u"?(i(),null):setTimeout(i,0)},cancelAnimationFrame(i){typeof setTimeout>"u"||clearTimeout(i)}};function fs(){const i=typeof window<"u"?window:{};return Fc(i,$C),i}function UC(i){const e=i;Object.keys(e).forEach(t=>{try{e[t]=null}catch{}try{delete e[t]}catch{}})}function Ul(i,e){return e===void 0&&(e=0),setTimeout(i,e)}function Ya(){return Date.now()}function GC(i){const e=fs();let t;return e.getComputedStyle&&(t=e.getComputedStyle(i,null)),!t&&i.currentStyle&&(t=i.currentStyle),t||(t=i.style),t}function VC(i,e){e===void 0&&(e="x");const t=fs();let s,r,n;const a=GC(i);return t.WebKitCSSMatrix?(r=a.transform||a.webkitTransform,r.split(",").length>6&&(r=r.split(", ").map(o=>o.replace(",",".")).join(", ")),n=new t.WebKitCSSMatrix(r==="none"?"":r)):(n=a.MozTransform||a.OTransform||a.MsTransform||a.msTransform||a.transform||a.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),s=n.toString().split(",")),e==="x"&&(t.WebKitCSSMatrix?r=n.m41:s.length===16?r=parseFloat(s[12]):r=parseFloat(s[4])),e==="y"&&(t.WebKitCSSMatrix?r=n.m42:s.length===16?r=parseFloat(s[13]):r=parseFloat(s[5])),r||0}function ga(i){return typeof i=="object"&&i!==null&&i.constructor&&Object.prototype.toString.call(i).slice(8,-1)==="Object"}function HC(i){return typeof window<"u"&&typeof window.HTMLElement<"u"?i instanceof HTMLElement:i&&(i.nodeType===1||i.nodeType===11)}function us(){const i=Object(arguments.length<=0?void 0:arguments[0]),e=["__proto__","constructor","prototype"];for(let t=1;t<arguments.length;t+=1){const s=t<0||arguments.length<=t?void 0:arguments[t];if(s!=null&&!HC(s)){const r=Object.keys(Object(s)).filter(n=>e.indexOf(n)<0);for(let n=0,a=r.length;n<a;n+=1){const o=r[n],l=Object.getOwnPropertyDescriptor(s,o);l!==void 0&&l.enumerable&&(ga(i[o])&&ga(s[o])?s[o].__swiper__?i[o]=s[o]:us(i[o],s[o]):!ga(i[o])&&ga(s[o])?(i[o]={},s[o].__swiper__?i[o]=s[o]:us(i[o],s[o])):i[o]=s[o])}}}return i}function ma(i,e,t){i.style.setProperty(e,t)}function Vg(i){let{swiper:e,targetPosition:t,side:s}=i;const r=fs(),n=-e.translate;let a=null,o;const l=e.params.speed;e.wrapperEl.style.scrollSnapType="none",r.cancelAnimationFrame(e.cssModeFrameID);const u=t>n?"next":"prev",d=(g,v)=>u==="next"&&g>=v||u==="prev"&&g<=v,f=()=>{o=new Date().getTime(),a===null&&(a=o);const g=Math.max(Math.min((o-a)/l,1),0),v=.5-Math.cos(g*Math.PI)/2;let y=n+v*(t-n);if(d(y,t)&&(y=t),e.wrapperEl.scrollTo({[s]:y}),d(y,t)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[s]:y})}),r.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=r.requestAnimationFrame(f)};f()}function vi(i,e){return e===void 0&&(e=""),[...i.children].filter(t=>t.matches(e))}function jC(i,e){e===void 0&&(e=[]);const t=document.createElement(i);return t.classList.add(...Array.isArray(e)?e:[e]),t}function KC(i,e){const t=[];for(;i.previousElementSibling;){const s=i.previousElementSibling;e?s.matches(e)&&t.push(s):t.push(s),i=s}return t}function zC(i,e){const t=[];for(;i.nextElementSibling;){const s=i.nextElementSibling;e?s.matches(e)&&t.push(s):t.push(s),i=s}return t}function Bi(i,e){return fs().getComputedStyle(i,null).getPropertyValue(e)}function Gd(i){let e=i,t;if(e){for(t=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(t+=1);return t}}function WC(i,e){const t=[];let s=i.parentElement;for(;s;)t.push(s),s=s.parentElement;return t}function Vd(i,e,t){const s=fs();return i[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(s.getComputedStyle(i,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(s.getComputedStyle(i,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}let cl;function qC(){const i=fs(),e=lr();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in i||i.DocumentTouch&&e instanceof i.DocumentTouch)}}function Hg(){return cl||(cl=qC()),cl}let ul;function YC(i){let{userAgent:e}=i===void 0?{}:i;const t=Hg(),s=fs(),r=s.navigator.platform,n=e||s.navigator.userAgent,a={ios:!1,android:!1},o=s.screen.width,l=s.screen.height,u=n.match(/(Android);?[\s\/]+([\d.]+)?/);let d=n.match(/(iPad).*OS\s([\d_]+)/);const f=n.match(/(iPod)(.*OS\s([\d_]+))?/),g=!d&&n.match(/(iPhone\sOS|iOS)\s([\d_]+)/),v=r==="Win32";let y=r==="MacIntel";const E=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!d&&y&&t.touch&&E.indexOf(`${o}x${l}`)>=0&&(d=n.match(/(Version)\/([\d.]+)/),d||(d=[0,1,"13_0_0"]),y=!1),u&&!v&&(a.os="android",a.android=!0),(d||g||f)&&(a.os="ios",a.ios=!0),a}function XC(i){return i===void 0&&(i={}),ul||(ul=YC(i)),ul}let hl;function QC(){const i=fs();let e=!1;function t(){const s=i.navigator.userAgent.toLowerCase();return s.indexOf("safari")>=0&&s.indexOf("chrome")<0&&s.indexOf("android")<0}if(t()){const s=String(i.navigator.userAgent);if(s.includes("Version/")){const[r,n]=s.split("Version/")[1].split(" ")[0].split(".").map(a=>Number(a));e=r<16||r===16&&n<2}}return{isSafari:e||t(),needPerspectiveFix:e,isWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(i.navigator.userAgent)}}function JC(){return hl||(hl=QC()),hl}function ZC(i){let{swiper:e,on:t,emit:s}=i;const r=fs();let n=null,a=null;const o=()=>{!e||e.destroyed||!e.initialized||(s("beforeResize"),s("resize"))},l=()=>{!e||e.destroyed||!e.initialized||(n=new ResizeObserver(f=>{a=r.requestAnimationFrame(()=>{const{width:g,height:v}=e;let y=g,E=v;f.forEach(b=>{let{contentBoxSize:w,contentRect:F,target:k}=b;k&&k!==e.el||(y=F?F.width:(w[0]||w).inlineSize,E=F?F.height:(w[0]||w).blockSize)}),(y!==g||E!==v)&&o()})}),n.observe(e.el))},u=()=>{a&&r.cancelAnimationFrame(a),n&&n.unobserve&&e.el&&(n.unobserve(e.el),n=null)},d=()=>{!e||e.destroyed||!e.initialized||s("orientationchange")};t("init",()=>{if(e.params.resizeObserver&&typeof r.ResizeObserver<"u"){l();return}r.addEventListener("resize",o),r.addEventListener("orientationchange",d)}),t("destroy",()=>{u(),r.removeEventListener("resize",o),r.removeEventListener("orientationchange",d)})}function eR(i){let{swiper:e,extendParams:t,on:s,emit:r}=i;const n=[],a=fs(),o=function(d,f){f===void 0&&(f={});const g=a.MutationObserver||a.WebkitMutationObserver,v=new g(y=>{if(e.__preventObserver__)return;if(y.length===1){r("observerUpdate",y[0]);return}const E=function(){r("observerUpdate",y[0])};a.requestAnimationFrame?a.requestAnimationFrame(E):a.setTimeout(E,0)});v.observe(d,{attributes:typeof f.attributes>"u"?!0:f.attributes,childList:typeof f.childList>"u"?!0:f.childList,characterData:typeof f.characterData>"u"?!0:f.characterData}),n.push(v)},l=()=>{if(e.params.observer){if(e.params.observeParents){const d=WC(e.hostEl);for(let f=0;f<d.length;f+=1)o(d[f])}o(e.hostEl,{childList:e.params.observeSlideChildren}),o(e.wrapperEl,{attributes:!1})}},u=()=>{n.forEach(d=>{d.disconnect()}),n.splice(0,n.length)};t({observer:!1,observeParents:!1,observeSlideChildren:!1}),s("init",l),s("destroy",u)}var tR={on(i,e,t){const s=this;if(!s.eventsListeners||s.destroyed||typeof e!="function")return s;const r=t?"unshift":"push";return i.split(" ").forEach(n=>{s.eventsListeners[n]||(s.eventsListeners[n]=[]),s.eventsListeners[n][r](e)}),s},once(i,e,t){const s=this;if(!s.eventsListeners||s.destroyed||typeof e!="function")return s;function r(){s.off(i,r),r.__emitterProxy&&delete r.__emitterProxy;for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];e.apply(s,a)}return r.__emitterProxy=e,s.on(i,r,t)},onAny(i,e){const t=this;if(!t.eventsListeners||t.destroyed||typeof i!="function")return t;const s=e?"unshift":"push";return t.eventsAnyListeners.indexOf(i)<0&&t.eventsAnyListeners[s](i),t},offAny(i){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsAnyListeners)return e;const t=e.eventsAnyListeners.indexOf(i);return t>=0&&e.eventsAnyListeners.splice(t,1),e},off(i,e){const t=this;return!t.eventsListeners||t.destroyed||!t.eventsListeners||i.split(" ").forEach(s=>{typeof e>"u"?t.eventsListeners[s]=[]:t.eventsListeners[s]&&t.eventsListeners[s].forEach((r,n)=>{(r===e||r.__emitterProxy&&r.__emitterProxy===e)&&t.eventsListeners[s].splice(n,1)})}),t},emit(){const i=this;if(!i.eventsListeners||i.destroyed||!i.eventsListeners)return i;let e,t,s;for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return typeof n[0]=="string"||Array.isArray(n[0])?(e=n[0],t=n.slice(1,n.length),s=i):(e=n[0].events,t=n[0].data,s=n[0].context||i),t.unshift(s),(Array.isArray(e)?e:e.split(" ")).forEach(l=>{i.eventsAnyListeners&&i.eventsAnyListeners.length&&i.eventsAnyListeners.forEach(u=>{u.apply(s,[l,...t])}),i.eventsListeners&&i.eventsListeners[l]&&i.eventsListeners[l].forEach(u=>{u.apply(s,t)})}),i}};function sR(){const i=this;let e,t;const s=i.el;typeof i.params.width<"u"&&i.params.width!==null?e=i.params.width:e=s.clientWidth,typeof i.params.height<"u"&&i.params.height!==null?t=i.params.height:t=s.clientHeight,!(e===0&&i.isHorizontal()||t===0&&i.isVertical())&&(e=e-parseInt(Bi(s,"padding-left")||0,10)-parseInt(Bi(s,"padding-right")||0,10),t=t-parseInt(Bi(s,"padding-top")||0,10)-parseInt(Bi(s,"padding-bottom")||0,10),Number.isNaN(e)&&(e=0),Number.isNaN(t)&&(t=0),Object.assign(i,{width:e,height:t,size:i.isHorizontal()?e:t}))}function iR(){const i=this;function e(se){return i.isHorizontal()?se:{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"}[se]}function t(se,pe){return parseFloat(se.getPropertyValue(e(pe))||0)}const s=i.params,{wrapperEl:r,slidesEl:n,size:a,rtlTranslate:o,wrongRTL:l}=i,u=i.virtual&&s.virtual.enabled,d=u?i.virtual.slides.length:i.slides.length,f=vi(n,`.${i.params.slideClass}, swiper-slide`),g=u?i.virtual.slides.length:f.length;let v=[];const y=[],E=[];let b=s.slidesOffsetBefore;typeof b=="function"&&(b=s.slidesOffsetBefore.call(i));let w=s.slidesOffsetAfter;typeof w=="function"&&(w=s.slidesOffsetAfter.call(i));const F=i.snapGrid.length,k=i.slidesGrid.length;let U=s.spaceBetween,N=-b,te=0,j=0;if(typeof a>"u")return;typeof U=="string"&&U.indexOf("%")>=0?U=parseFloat(U.replace("%",""))/100*a:typeof U=="string"&&(U=parseFloat(U)),i.virtualSize=-U,f.forEach(se=>{o?se.style.marginLeft="":se.style.marginRight="",se.style.marginBottom="",se.style.marginTop=""}),s.centeredSlides&&s.cssMode&&(ma(r,"--swiper-centered-offset-before",""),ma(r,"--swiper-centered-offset-after",""));const re=s.grid&&s.grid.rows>1&&i.grid;re&&i.grid.initSlides(g);let Q;const le=s.slidesPerView==="auto"&&s.breakpoints&&Object.keys(s.breakpoints).filter(se=>typeof s.breakpoints[se].slidesPerView<"u").length>0;for(let se=0;se<g;se+=1){Q=0;let pe;if(f[se]&&(pe=f[se]),re&&i.grid.updateSlide(se,pe,g,e),!(f[se]&&Bi(pe,"display")==="none")){if(s.slidesPerView==="auto"){le&&(f[se].style[e("width")]="");const de=getComputedStyle(pe),be=pe.style.transform,Le=pe.style.webkitTransform;if(be&&(pe.style.transform="none"),Le&&(pe.style.webkitTransform="none"),s.roundLengths)Q=i.isHorizontal()?Vd(pe,"width"):Vd(pe,"height");else{const ue=t(de,"width"),he=t(de,"padding-left"),we=t(de,"padding-right"),me=t(de,"margin-left"),ye=t(de,"margin-right"),Ve=de.getPropertyValue("box-sizing");if(Ve&&Ve==="border-box")Q=ue+me+ye;else{const{clientWidth:$e,offsetWidth:Je}=pe;Q=ue+he+we+me+ye+(Je-$e)}}be&&(pe.style.transform=be),Le&&(pe.style.webkitTransform=Le),s.roundLengths&&(Q=Math.floor(Q))}else Q=(a-(s.slidesPerView-1)*U)/s.slidesPerView,s.roundLengths&&(Q=Math.floor(Q)),f[se]&&(f[se].style[e("width")]=`${Q}px`);f[se]&&(f[se].swiperSlideSize=Q),E.push(Q),s.centeredSlides?(N=N+Q/2+te/2+U,te===0&&se!==0&&(N=N-a/2-U),se===0&&(N=N-a/2-U),Math.abs(N)<1/1e3&&(N=0),s.roundLengths&&(N=Math.floor(N)),j%s.slidesPerGroup===0&&v.push(N),y.push(N)):(s.roundLengths&&(N=Math.floor(N)),(j-Math.min(i.params.slidesPerGroupSkip,j))%i.params.slidesPerGroup===0&&v.push(N),y.push(N),N=N+Q+U),i.virtualSize+=Q+U,te=Q,j+=1}}if(i.virtualSize=Math.max(i.virtualSize,a)+w,o&&l&&(s.effect==="slide"||s.effect==="coverflow")&&(r.style.width=`${i.virtualSize+U}px`),s.setWrapperSize&&(r.style[e("width")]=`${i.virtualSize+U}px`),re&&i.grid.updateWrapperSize(Q,v,e),!s.centeredSlides){const se=[];for(let pe=0;pe<v.length;pe+=1){let de=v[pe];s.roundLengths&&(de=Math.floor(de)),v[pe]<=i.virtualSize-a&&se.push(de)}v=se,Math.floor(i.virtualSize-a)-Math.floor(v[v.length-1])>1&&v.push(i.virtualSize-a)}if(u&&s.loop){const se=E[0]+U;if(s.slidesPerGroup>1){const pe=Math.ceil((i.virtual.slidesBefore+i.virtual.slidesAfter)/s.slidesPerGroup),de=se*s.slidesPerGroup;for(let be=0;be<pe;be+=1)v.push(v[v.length-1]+de)}for(let pe=0;pe<i.virtual.slidesBefore+i.virtual.slidesAfter;pe+=1)s.slidesPerGroup===1&&v.push(v[v.length-1]+se),y.push(y[y.length-1]+se),i.virtualSize+=se}if(v.length===0&&(v=[0]),U!==0){const se=i.isHorizontal()&&o?"marginLeft":e("marginRight");f.filter((pe,de)=>!s.cssMode||s.loop?!0:de!==f.length-1).forEach(pe=>{pe.style[se]=`${U}px`})}if(s.centeredSlides&&s.centeredSlidesBounds){let se=0;E.forEach(de=>{se+=de+(U||0)}),se-=U;const pe=se-a;v=v.map(de=>de<=0?-b:de>pe?pe+w:de)}if(s.centerInsufficientSlides){let se=0;if(E.forEach(pe=>{se+=pe+(U||0)}),se-=U,se<a){const pe=(a-se)/2;v.forEach((de,be)=>{v[be]=de-pe}),y.forEach((de,be)=>{y[be]=de+pe})}}if(Object.assign(i,{slides:f,snapGrid:v,slidesGrid:y,slidesSizesGrid:E}),s.centeredSlides&&s.cssMode&&!s.centeredSlidesBounds){ma(r,"--swiper-centered-offset-before",`${-v[0]}px`),ma(r,"--swiper-centered-offset-after",`${i.size/2-E[E.length-1]/2}px`);const se=-i.snapGrid[0],pe=-i.slidesGrid[0];i.snapGrid=i.snapGrid.map(de=>de+se),i.slidesGrid=i.slidesGrid.map(de=>de+pe)}if(g!==d&&i.emit("slidesLengthChange"),v.length!==F&&(i.params.watchOverflow&&i.checkOverflow(),i.emit("snapGridLengthChange")),y.length!==k&&i.emit("slidesGridLengthChange"),s.watchSlidesProgress&&i.updateSlidesOffset(),!u&&!s.cssMode&&(s.effect==="slide"||s.effect==="fade")){const se=`${s.containerModifierClass}backface-hidden`,pe=i.el.classList.contains(se);g<=s.maxBackfaceHiddenSlides?pe||i.el.classList.add(se):pe&&i.el.classList.remove(se)}}function rR(i){const e=this,t=[],s=e.virtual&&e.params.virtual.enabled;let r=0,n;typeof i=="number"?e.setTransition(i):i===!0&&e.setTransition(e.params.speed);const a=o=>s?e.slides[e.getSlideIndexByData(o)]:e.slides[o];if(e.params.slidesPerView!=="auto"&&e.params.slidesPerView>1)if(e.params.centeredSlides)(e.visibleSlides||[]).forEach(o=>{t.push(o)});else for(n=0;n<Math.ceil(e.params.slidesPerView);n+=1){const o=e.activeIndex+n;if(o>e.slides.length&&!s)break;t.push(a(o))}else t.push(a(e.activeIndex));for(n=0;n<t.length;n+=1)if(typeof t[n]<"u"){const o=t[n].offsetHeight;r=o>r?o:r}(r||r===0)&&(e.wrapperEl.style.height=`${r}px`)}function nR(){const i=this,e=i.slides,t=i.isElement?i.isHorizontal()?i.wrapperEl.offsetLeft:i.wrapperEl.offsetTop:0;for(let s=0;s<e.length;s+=1)e[s].swiperSlideOffset=(i.isHorizontal()?e[s].offsetLeft:e[s].offsetTop)-t-i.cssOverflowAdjustment()}function aR(i){i===void 0&&(i=this&&this.translate||0);const e=this,t=e.params,{slides:s,rtlTranslate:r,snapGrid:n}=e;if(s.length===0)return;typeof s[0].swiperSlideOffset>"u"&&e.updateSlidesOffset();let a=-i;r&&(a=i),s.forEach(l=>{l.classList.remove(t.slideVisibleClass)}),e.visibleSlidesIndexes=[],e.visibleSlides=[];let o=t.spaceBetween;typeof o=="string"&&o.indexOf("%")>=0?o=parseFloat(o.replace("%",""))/100*e.size:typeof o=="string"&&(o=parseFloat(o));for(let l=0;l<s.length;l+=1){const u=s[l];let d=u.swiperSlideOffset;t.cssMode&&t.centeredSlides&&(d-=s[0].swiperSlideOffset);const f=(a+(t.centeredSlides?e.minTranslate():0)-d)/(u.swiperSlideSize+o),g=(a-n[0]+(t.centeredSlides?e.minTranslate():0)-d)/(u.swiperSlideSize+o),v=-(a-d),y=v+e.slidesSizesGrid[l];(v>=0&&v<e.size-1||y>1&&y<=e.size||v<=0&&y>=e.size)&&(e.visibleSlides.push(u),e.visibleSlidesIndexes.push(l),s[l].classList.add(t.slideVisibleClass)),u.progress=r?-f:f,u.originalProgress=r?-g:g}}function oR(i){const e=this;if(typeof i>"u"){const d=e.rtlTranslate?-1:1;i=e&&e.translate&&e.translate*d||0}const t=e.params,s=e.maxTranslate()-e.minTranslate();let{progress:r,isBeginning:n,isEnd:a,progressLoop:o}=e;const l=n,u=a;if(s===0)r=0,n=!0,a=!0;else{r=(i-e.minTranslate())/s;const d=Math.abs(i-e.minTranslate())<1,f=Math.abs(i-e.maxTranslate())<1;n=d||r<=0,a=f||r>=1,d&&(r=0),f&&(r=1)}if(t.loop){const d=e.getSlideIndexByData(0),f=e.getSlideIndexByData(e.slides.length-1),g=e.slidesGrid[d],v=e.slidesGrid[f],y=e.slidesGrid[e.slidesGrid.length-1],E=Math.abs(i);E>=g?o=(E-g)/y:o=(E+y-v)/y,o>1&&(o-=1)}Object.assign(e,{progress:r,progressLoop:o,isBeginning:n,isEnd:a}),(t.watchSlidesProgress||t.centeredSlides&&t.autoHeight)&&e.updateSlidesProgress(i),n&&!l&&e.emit("reachBeginning toEdge"),a&&!u&&e.emit("reachEnd toEdge"),(l&&!n||u&&!a)&&e.emit("fromEdge"),e.emit("progress",r)}function lR(){const i=this,{slides:e,params:t,slidesEl:s,activeIndex:r}=i,n=i.virtual&&t.virtual.enabled,a=l=>vi(s,`.${t.slideClass}${l}, swiper-slide${l}`)[0];e.forEach(l=>{l.classList.remove(t.slideActiveClass,t.slideNextClass,t.slidePrevClass)});let o;if(n)if(t.loop){let l=r-i.virtual.slidesBefore;l<0&&(l=i.virtual.slides.length+l),l>=i.virtual.slides.length&&(l-=i.virtual.slides.length),o=a(`[data-swiper-slide-index="${l}"]`)}else o=a(`[data-swiper-slide-index="${r}"]`);else o=e[r];if(o){o.classList.add(t.slideActiveClass);let l=zC(o,`.${t.slideClass}, swiper-slide`)[0];t.loop&&!l&&(l=e[0]),l&&l.classList.add(t.slideNextClass);let u=KC(o,`.${t.slideClass}, swiper-slide`)[0];t.loop&&!u===0&&(u=e[e.length-1]),u&&u.classList.add(t.slidePrevClass)}i.emitSlidesClasses()}const Ra=(i,e)=>{if(!i||i.destroyed||!i.params)return;const t=()=>i.isElement?"swiper-slide":`.${i.params.slideClass}`,s=e.closest(t());if(s){let r=s.querySelector(`.${i.params.lazyPreloaderClass}`);!r&&i.isElement&&(s.shadowRoot?r=s.shadowRoot.querySelector(`.${i.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{s.shadowRoot&&(r=s.shadowRoot.querySelector(`.${i.params.lazyPreloaderClass}`),r&&r.remove())})),r&&r.remove()}},dl=(i,e)=>{if(!i.slides[e])return;const t=i.slides[e].querySelector('[loading="lazy"]');t&&t.removeAttribute("loading")},Gl=i=>{if(!i||i.destroyed||!i.params)return;let e=i.params.lazyPreloadPrevNext;const t=i.slides.length;if(!t||!e||e<0)return;e=Math.min(e,t);const s=i.params.slidesPerView==="auto"?i.slidesPerViewDynamic():Math.ceil(i.params.slidesPerView),r=i.activeIndex;if(i.params.grid&&i.params.grid.rows>1){const a=r,o=[a-e];o.push(...Array.from({length:e}).map((l,u)=>a+s+u)),i.slides.forEach((l,u)=>{o.includes(l.column)&&dl(i,u)});return}const n=r+s-1;if(i.params.rewind||i.params.loop)for(let a=r-e;a<=n+e;a+=1){const o=(a%t+t)%t;(o<r||o>n)&&dl(i,o)}else for(let a=Math.max(r-e,0);a<=Math.min(n+e,t-1);a+=1)a!==r&&(a>n||a<r)&&dl(i,a)};function cR(i){const{slidesGrid:e,params:t}=i,s=i.rtlTranslate?i.translate:-i.translate;let r;for(let n=0;n<e.length;n+=1)typeof e[n+1]<"u"?s>=e[n]&&s<e[n+1]-(e[n+1]-e[n])/2?r=n:s>=e[n]&&s<e[n+1]&&(r=n+1):s>=e[n]&&(r=n);return t.normalizeSlideIndex&&(r<0||typeof r>"u")&&(r=0),r}function uR(i){const e=this,t=e.rtlTranslate?e.translate:-e.translate,{snapGrid:s,params:r,activeIndex:n,realIndex:a,snapIndex:o}=e;let l=i,u;const d=g=>{let v=g-e.virtual.slidesBefore;return v<0&&(v=e.virtual.slides.length+v),v>=e.virtual.slides.length&&(v-=e.virtual.slides.length),v};if(typeof l>"u"&&(l=cR(e)),s.indexOf(t)>=0)u=s.indexOf(t);else{const g=Math.min(r.slidesPerGroupSkip,l);u=g+Math.floor((l-g)/r.slidesPerGroup)}if(u>=s.length&&(u=s.length-1),l===n){u!==o&&(e.snapIndex=u,e.emit("snapIndexChange")),e.params.loop&&e.virtual&&e.params.virtual.enabled&&(e.realIndex=d(l));return}let f;e.virtual&&r.virtual.enabled&&r.loop?f=d(l):e.slides[l]?f=parseInt(e.slides[l].getAttribute("data-swiper-slide-index")||l,10):f=l,Object.assign(e,{previousSnapIndex:o,snapIndex:u,previousRealIndex:a,realIndex:f,previousIndex:n,activeIndex:l}),e.initialized&&Gl(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(a!==f&&e.emit("realIndexChange"),e.emit("slideChange"))}function hR(i,e){const t=this,s=t.params;let r=i.closest(`.${s.slideClass}, swiper-slide`);!r&&t.isElement&&e&&e.length>1&&e.includes(i)&&[...e.slice(e.indexOf(i)+1,e.length)].forEach(o=>{!r&&o.matches&&o.matches(`.${s.slideClass}, swiper-slide`)&&(r=o)});let n=!1,a;if(r){for(let o=0;o<t.slides.length;o+=1)if(t.slides[o]===r){n=!0,a=o;break}}if(r&&n)t.clickedSlide=r,t.virtual&&t.params.virtual.enabled?t.clickedIndex=parseInt(r.getAttribute("data-swiper-slide-index"),10):t.clickedIndex=a;else{t.clickedSlide=void 0,t.clickedIndex=void 0;return}s.slideToClickedSlide&&t.clickedIndex!==void 0&&t.clickedIndex!==t.activeIndex&&t.slideToClickedSlide()}var dR={updateSize:sR,updateSlides:iR,updateAutoHeight:rR,updateSlidesOffset:nR,updateSlidesProgress:aR,updateProgress:oR,updateSlidesClasses:lR,updateActiveIndex:uR,updateClickedSlide:hR};function fR(i){i===void 0&&(i=this.isHorizontal()?"x":"y");const e=this,{params:t,rtlTranslate:s,translate:r,wrapperEl:n}=e;if(t.virtualTranslate)return s?-r:r;if(t.cssMode)return r;let a=VC(n,i);return a+=e.cssOverflowAdjustment(),s&&(a=-a),a||0}function pR(i,e){const t=this,{rtlTranslate:s,params:r,wrapperEl:n,progress:a}=t;let o=0,l=0;const u=0;t.isHorizontal()?o=s?-i:i:l=i,r.roundLengths&&(o=Math.floor(o),l=Math.floor(l)),t.previousTranslate=t.translate,t.translate=t.isHorizontal()?o:l,r.cssMode?n[t.isHorizontal()?"scrollLeft":"scrollTop"]=t.isHorizontal()?-o:-l:r.virtualTranslate||(t.isHorizontal()?o-=t.cssOverflowAdjustment():l-=t.cssOverflowAdjustment(),n.style.transform=`translate3d(${o}px, ${l}px, ${u}px)`);let d;const f=t.maxTranslate()-t.minTranslate();f===0?d=0:d=(i-t.minTranslate())/f,d!==a&&t.updateProgress(i),t.emit("setTranslate",t.translate,e)}function gR(){return-this.snapGrid[0]}function mR(){return-this.snapGrid[this.snapGrid.length-1]}function vR(i,e,t,s,r){i===void 0&&(i=0),e===void 0&&(e=this.params.speed),t===void 0&&(t=!0),s===void 0&&(s=!0);const n=this,{params:a,wrapperEl:o}=n;if(n.animating&&a.preventInteractionOnTransition)return!1;const l=n.minTranslate(),u=n.maxTranslate();let d;if(s&&i>l?d=l:s&&i<u?d=u:d=i,n.updateProgress(d),a.cssMode){const f=n.isHorizontal();if(e===0)o[f?"scrollLeft":"scrollTop"]=-d;else{if(!n.support.smoothScroll)return Vg({swiper:n,targetPosition:-d,side:f?"left":"top"}),!0;o.scrollTo({[f?"left":"top"]:-d,behavior:"smooth"})}return!0}return e===0?(n.setTransition(0),n.setTranslate(d),t&&(n.emit("beforeTransitionStart",e,r),n.emit("transitionEnd"))):(n.setTransition(e),n.setTranslate(d),t&&(n.emit("beforeTransitionStart",e,r),n.emit("transitionStart")),n.animating||(n.animating=!0,n.onTranslateToWrapperTransitionEnd||(n.onTranslateToWrapperTransitionEnd=function(g){!n||n.destroyed||g.target===this&&(n.wrapperEl.removeEventListener("transitionend",n.onTranslateToWrapperTransitionEnd),n.onTranslateToWrapperTransitionEnd=null,delete n.onTranslateToWrapperTransitionEnd,t&&n.emit("transitionEnd"))}),n.wrapperEl.addEventListener("transitionend",n.onTranslateToWrapperTransitionEnd))),!0}var yR={getTranslate:fR,setTranslate:pR,minTranslate:gR,maxTranslate:mR,translateTo:vR};function xR(i,e){const t=this;t.params.cssMode||(t.wrapperEl.style.transitionDuration=`${i}ms`,t.wrapperEl.style.transitionDelay=i===0?"0ms":""),t.emit("setTransition",i,e)}function jg(i){let{swiper:e,runCallbacks:t,direction:s,step:r}=i;const{activeIndex:n,previousIndex:a}=e;let o=s;if(o||(n>a?o="next":n<a?o="prev":o="reset"),e.emit(`transition${r}`),t&&n!==a){if(o==="reset"){e.emit(`slideResetTransition${r}`);return}e.emit(`slideChangeTransition${r}`),o==="next"?e.emit(`slideNextTransition${r}`):e.emit(`slidePrevTransition${r}`)}}function SR(i,e){i===void 0&&(i=!0);const t=this,{params:s}=t;s.cssMode||(s.autoHeight&&t.updateAutoHeight(),jg({swiper:t,runCallbacks:i,direction:e,step:"Start"}))}function ER(i,e){i===void 0&&(i=!0);const t=this,{params:s}=t;t.animating=!1,!s.cssMode&&(t.setTransition(0),jg({swiper:t,runCallbacks:i,direction:e,step:"End"}))}var bR={setTransition:xR,transitionStart:SR,transitionEnd:ER};function TR(i,e,t,s,r){i===void 0&&(i=0),e===void 0&&(e=this.params.speed),t===void 0&&(t=!0),typeof i=="string"&&(i=parseInt(i,10));const n=this;let a=i;a<0&&(a=0);const{params:o,snapGrid:l,slidesGrid:u,previousIndex:d,activeIndex:f,rtlTranslate:g,wrapperEl:v,enabled:y}=n;if(n.animating&&o.preventInteractionOnTransition||!y&&!s&&!r)return!1;const E=Math.min(n.params.slidesPerGroupSkip,a);let b=E+Math.floor((a-E)/n.params.slidesPerGroup);b>=l.length&&(b=l.length-1);const w=-l[b];if(o.normalizeSlideIndex)for(let k=0;k<u.length;k+=1){const U=-Math.floor(w*100),N=Math.floor(u[k]*100),te=Math.floor(u[k+1]*100);typeof u[k+1]<"u"?U>=N&&U<te-(te-N)/2?a=k:U>=N&&U<te&&(a=k+1):U>=N&&(a=k)}if(n.initialized&&a!==f&&(!n.allowSlideNext&&(g?w>n.translate&&w>n.minTranslate():w<n.translate&&w<n.minTranslate())||!n.allowSlidePrev&&w>n.translate&&w>n.maxTranslate()&&(f||0)!==a))return!1;a!==(d||0)&&t&&n.emit("beforeSlideChangeStart"),n.updateProgress(w);let F;if(a>f?F="next":a<f?F="prev":F="reset",g&&-w===n.translate||!g&&w===n.translate)return n.updateActiveIndex(a),o.autoHeight&&n.updateAutoHeight(),n.updateSlidesClasses(),o.effect!=="slide"&&n.setTranslate(w),F!=="reset"&&(n.transitionStart(t,F),n.transitionEnd(t,F)),!1;if(o.cssMode){const k=n.isHorizontal(),U=g?w:-w;if(e===0){const N=n.virtual&&n.params.virtual.enabled;N&&(n.wrapperEl.style.scrollSnapType="none",n._immediateVirtual=!0),N&&!n._cssModeVirtualInitialSet&&n.params.initialSlide>0?(n._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{v[k?"scrollLeft":"scrollTop"]=U})):v[k?"scrollLeft":"scrollTop"]=U,N&&requestAnimationFrame(()=>{n.wrapperEl.style.scrollSnapType="",n._immediateVirtual=!1})}else{if(!n.support.smoothScroll)return Vg({swiper:n,targetPosition:U,side:k?"left":"top"}),!0;v.scrollTo({[k?"left":"top"]:U,behavior:"smooth"})}return!0}return n.setTransition(e),n.setTranslate(w),n.updateActiveIndex(a),n.updateSlidesClasses(),n.emit("beforeTransitionStart",e,s),n.transitionStart(t,F),e===0?n.transitionEnd(t,F):n.animating||(n.animating=!0,n.onSlideToWrapperTransitionEnd||(n.onSlideToWrapperTransitionEnd=function(U){!n||n.destroyed||U.target===this&&(n.wrapperEl.removeEventListener("transitionend",n.onSlideToWrapperTransitionEnd),n.onSlideToWrapperTransitionEnd=null,delete n.onSlideToWrapperTransitionEnd,n.transitionEnd(t,F))}),n.wrapperEl.addEventListener("transitionend",n.onSlideToWrapperTransitionEnd)),!0}function wR(i,e,t,s){i===void 0&&(i=0),e===void 0&&(e=this.params.speed),t===void 0&&(t=!0),typeof i=="string"&&(i=parseInt(i,10));const r=this;let n=i;return r.params.loop&&(r.virtual&&r.params.virtual.enabled?n=n+r.virtual.slidesBefore:n=r.getSlideIndexByData(n)),r.slideTo(n,e,t,s)}function AR(i,e,t){i===void 0&&(i=this.params.speed),e===void 0&&(e=!0);const s=this,{enabled:r,params:n,animating:a}=s;if(!r)return s;let o=n.slidesPerGroup;n.slidesPerView==="auto"&&n.slidesPerGroup===1&&n.slidesPerGroupAuto&&(o=Math.max(s.slidesPerViewDynamic("current",!0),1));const l=s.activeIndex<n.slidesPerGroupSkip?1:o,u=s.virtual&&n.virtual.enabled;if(n.loop){if(a&&!u&&n.loopPreventsSliding)return!1;if(s.loopFix({direction:"next"}),s._clientLeft=s.wrapperEl.clientLeft,s.activeIndex===s.slides.length-1&&n.cssMode)return requestAnimationFrame(()=>{s.slideTo(s.activeIndex+l,i,e,t)}),!0}return n.rewind&&s.isEnd?s.slideTo(0,i,e,t):s.slideTo(s.activeIndex+l,i,e,t)}function LR(i,e,t){i===void 0&&(i=this.params.speed),e===void 0&&(e=!0);const s=this,{params:r,snapGrid:n,slidesGrid:a,rtlTranslate:o,enabled:l,animating:u}=s;if(!l)return s;const d=s.virtual&&r.virtual.enabled;if(r.loop){if(u&&!d&&r.loopPreventsSliding)return!1;s.loopFix({direction:"prev"}),s._clientLeft=s.wrapperEl.clientLeft}const f=o?s.translate:-s.translate;function g(w){return w<0?-Math.floor(Math.abs(w)):Math.floor(w)}const v=g(f),y=n.map(w=>g(w));let E=n[y.indexOf(v)-1];if(typeof E>"u"&&r.cssMode){let w;n.forEach((F,k)=>{v>=F&&(w=k)}),typeof w<"u"&&(E=n[w>0?w-1:w])}let b=0;if(typeof E<"u"&&(b=a.indexOf(E),b<0&&(b=s.activeIndex-1),r.slidesPerView==="auto"&&r.slidesPerGroup===1&&r.slidesPerGroupAuto&&(b=b-s.slidesPerViewDynamic("previous",!0)+1,b=Math.max(b,0))),r.rewind&&s.isBeginning){const w=s.params.virtual&&s.params.virtual.enabled&&s.virtual?s.virtual.slides.length-1:s.slides.length-1;return s.slideTo(w,i,e,t)}else if(r.loop&&s.activeIndex===0&&r.cssMode)return requestAnimationFrame(()=>{s.slideTo(b,i,e,t)}),!0;return s.slideTo(b,i,e,t)}function CR(i,e,t){i===void 0&&(i=this.params.speed),e===void 0&&(e=!0);const s=this;return s.slideTo(s.activeIndex,i,e,t)}function RR(i,e,t,s){i===void 0&&(i=this.params.speed),e===void 0&&(e=!0),s===void 0&&(s=.5);const r=this;let n=r.activeIndex;const a=Math.min(r.params.slidesPerGroupSkip,n),o=a+Math.floor((n-a)/r.params.slidesPerGroup),l=r.rtlTranslate?r.translate:-r.translate;if(l>=r.snapGrid[o]){const u=r.snapGrid[o],d=r.snapGrid[o+1];l-u>(d-u)*s&&(n+=r.params.slidesPerGroup)}else{const u=r.snapGrid[o-1],d=r.snapGrid[o];l-u<=(d-u)*s&&(n-=r.params.slidesPerGroup)}return n=Math.max(n,0),n=Math.min(n,r.slidesGrid.length-1),r.slideTo(n,i,e,t)}function _R(){const i=this,{params:e,slidesEl:t}=i,s=e.slidesPerView==="auto"?i.slidesPerViewDynamic():e.slidesPerView;let r=i.clickedIndex,n;const a=i.isElement?"swiper-slide":`.${e.slideClass}`;if(e.loop){if(i.animating)return;n=parseInt(i.clickedSlide.getAttribute("data-swiper-slide-index"),10),e.centeredSlides?r<i.loopedSlides-s/2||r>i.slides.length-i.loopedSlides+s/2?(i.loopFix(),r=i.getSlideIndex(vi(t,`${a}[data-swiper-slide-index="${n}"]`)[0]),Ul(()=>{i.slideTo(r)})):i.slideTo(r):r>i.slides.length-s?(i.loopFix(),r=i.getSlideIndex(vi(t,`${a}[data-swiper-slide-index="${n}"]`)[0]),Ul(()=>{i.slideTo(r)})):i.slideTo(r)}else i.slideTo(r)}var IR={slideTo:TR,slideToLoop:wR,slideNext:AR,slidePrev:LR,slideReset:CR,slideToClosest:RR,slideToClickedSlide:_R};function kR(i){const e=this,{params:t,slidesEl:s}=e;if(!t.loop||e.virtual&&e.params.virtual.enabled)return;vi(s,`.${t.slideClass}, swiper-slide`).forEach((n,a)=>{n.setAttribute("data-swiper-slide-index",a)}),e.loopFix({slideRealIndex:i,direction:t.centeredSlides?void 0:"next"})}function PR(i){let{slideRealIndex:e,slideTo:t=!0,direction:s,setTranslate:r,activeSlideIndex:n,byController:a,byMousewheel:o}=i===void 0?{}:i;const l=this;if(!l.params.loop)return;l.emit("beforeLoopFix");const{slides:u,allowSlidePrev:d,allowSlideNext:f,slidesEl:g,params:v}=l;if(l.allowSlidePrev=!0,l.allowSlideNext=!0,l.virtual&&v.virtual.enabled){t&&(!v.centeredSlides&&l.snapIndex===0?l.slideTo(l.virtual.slides.length,0,!1,!0):v.centeredSlides&&l.snapIndex<v.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.allowSlidePrev=d,l.allowSlideNext=f,l.emit("loopFix");return}const y=v.slidesPerView==="auto"?l.slidesPerViewDynamic():Math.ceil(parseFloat(v.slidesPerView,10));let E=v.loopedSlides||y;E%v.slidesPerGroup!==0&&(E+=v.slidesPerGroup-E%v.slidesPerGroup),l.loopedSlides=E;const b=[],w=[];let F=l.activeIndex;typeof n>"u"?n=l.getSlideIndex(l.slides.filter(j=>j.classList.contains(v.slideActiveClass))[0]):F=n;const k=s==="next"||!s,U=s==="prev"||!s;let N=0,te=0;if(n<E){N=Math.max(E-n,v.slidesPerGroup);for(let j=0;j<E-n;j+=1){const re=j-Math.floor(j/u.length)*u.length;b.push(u.length-re-1)}}else if(n>l.slides.length-E*2){te=Math.max(n-(l.slides.length-E*2),v.slidesPerGroup);for(let j=0;j<te;j+=1){const re=j-Math.floor(j/u.length)*u.length;w.push(re)}}if(U&&b.forEach(j=>{l.slides[j].swiperLoopMoveDOM=!0,g.prepend(l.slides[j]),l.slides[j].swiperLoopMoveDOM=!1}),k&&w.forEach(j=>{l.slides[j].swiperLoopMoveDOM=!0,g.append(l.slides[j]),l.slides[j].swiperLoopMoveDOM=!1}),l.recalcSlides(),v.slidesPerView==="auto"&&l.updateSlides(),v.watchSlidesProgress&&l.updateSlidesOffset(),t){if(b.length>0&&U)if(typeof e>"u"){const j=l.slidesGrid[F],Q=l.slidesGrid[F+N]-j;o?l.setTranslate(l.translate-Q):(l.slideTo(F+N,0,!1,!0),r&&(l.touches[l.isHorizontal()?"startX":"startY"]+=Q,l.touchEventsData.currentTranslate=l.translate))}else r&&(l.slideToLoop(e,0,!1,!0),l.touchEventsData.currentTranslate=l.translate);else if(w.length>0&&k)if(typeof e>"u"){const j=l.slidesGrid[F],Q=l.slidesGrid[F-te]-j;o?l.setTranslate(l.translate-Q):(l.slideTo(F-te,0,!1,!0),r&&(l.touches[l.isHorizontal()?"startX":"startY"]+=Q,l.touchEventsData.currentTranslate=l.translate))}else l.slideToLoop(e,0,!1,!0)}if(l.allowSlidePrev=d,l.allowSlideNext=f,l.controller&&l.controller.control&&!a){const j={slideRealIndex:e,direction:s,setTranslate:r,activeSlideIndex:n,byController:!0};Array.isArray(l.controller.control)?l.controller.control.forEach(re=>{!re.destroyed&&re.params.loop&&re.loopFix({...j,slideTo:re.params.slidesPerView===v.slidesPerView?t:!1})}):l.controller.control instanceof l.constructor&&l.controller.control.params.loop&&l.controller.control.loopFix({...j,slideTo:l.controller.control.params.slidesPerView===v.slidesPerView?t:!1})}l.emit("loopFix")}function DR(){const i=this,{params:e,slidesEl:t}=i;if(!e.loop||i.virtual&&i.params.virtual.enabled)return;i.recalcSlides();const s=[];i.slides.forEach(r=>{const n=typeof r.swiperSlideIndex>"u"?r.getAttribute("data-swiper-slide-index")*1:r.swiperSlideIndex;s[n]=r}),i.slides.forEach(r=>{r.removeAttribute("data-swiper-slide-index")}),s.forEach(r=>{t.append(r)}),i.recalcSlides(),i.slideTo(i.realIndex,0)}var MR={loopCreate:kR,loopFix:PR,loopDestroy:DR};function FR(i){const e=this;if(!e.params.simulateTouch||e.params.watchOverflow&&e.isLocked||e.params.cssMode)return;const t=e.params.touchEventsTarget==="container"?e.el:e.wrapperEl;e.isElement&&(e.__preventObserver__=!0),t.style.cursor="move",t.style.cursor=i?"grabbing":"grab",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1})}function OR(){const i=this;i.params.watchOverflow&&i.isLocked||i.params.cssMode||(i.isElement&&(i.__preventObserver__=!0),i[i.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",i.isElement&&requestAnimationFrame(()=>{i.__preventObserver__=!1}))}var NR={setGrabCursor:FR,unsetGrabCursor:OR};function BR(i,e){e===void 0&&(e=this);function t(s){if(!s||s===lr()||s===fs())return null;s.assignedSlot&&(s=s.assignedSlot);const r=s.closest(i);return!r&&!s.getRootNode?null:r||t(s.getRootNode().host)}return t(e)}function $R(i){const e=this,t=lr(),s=fs(),r=e.touchEventsData;r.evCache.push(i);const{params:n,touches:a,enabled:o}=e;if(!o||!n.simulateTouch&&i.pointerType==="mouse"||e.animating&&n.preventInteractionOnTransition)return;!e.animating&&n.cssMode&&n.loop&&e.loopFix();let l=i;l.originalEvent&&(l=l.originalEvent);let u=l.target;if(n.touchEventsTarget==="wrapper"&&!e.wrapperEl.contains(u)||"which"in l&&l.which===3||"button"in l&&l.button>0||r.isTouched&&r.isMoved)return;const d=!!n.noSwipingClass&&n.noSwipingClass!=="",f=i.composedPath?i.composedPath():i.path;d&&l.target&&l.target.shadowRoot&&f&&(u=f[0]);const g=n.noSwipingSelector?n.noSwipingSelector:`.${n.noSwipingClass}`,v=!!(l.target&&l.target.shadowRoot);if(n.noSwiping&&(v?BR(g,u):u.closest(g))){e.allowClick=!0;return}if(n.swipeHandler&&!u.closest(n.swipeHandler))return;a.currentX=l.pageX,a.currentY=l.pageY;const y=a.currentX,E=a.currentY,b=n.edgeSwipeDetection||n.iOSEdgeSwipeDetection,w=n.edgeSwipeThreshold||n.iOSEdgeSwipeThreshold;if(b&&(y<=w||y>=s.innerWidth-w))if(b==="prevent")i.preventDefault();else return;Object.assign(r,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=y,a.startY=E,r.touchStartTime=Ya(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,n.threshold>0&&(r.allowThresholdMove=!1);let F=!0;u.matches(r.focusableElements)&&(F=!1,u.nodeName==="SELECT"&&(r.isTouched=!1)),t.activeElement&&t.activeElement.matches(r.focusableElements)&&t.activeElement!==u&&t.activeElement.blur();const k=F&&e.allowTouchMove&&n.touchStartPreventDefault;(n.touchStartForcePreventDefault||k)&&!u.isContentEditable&&l.preventDefault(),n.freeMode&&n.freeMode.enabled&&e.freeMode&&e.animating&&!n.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",l)}function UR(i){const e=lr(),t=this,s=t.touchEventsData,{params:r,touches:n,rtlTranslate:a,enabled:o}=t;if(!o||!r.simulateTouch&&i.pointerType==="mouse")return;let l=i;if(l.originalEvent&&(l=l.originalEvent),!s.isTouched){s.startMoving&&s.isScrolling&&t.emit("touchMoveOpposite",l);return}const u=s.evCache.findIndex(j=>j.pointerId===l.pointerId);u>=0&&(s.evCache[u]=l);const d=s.evCache.length>1?s.evCache[0]:l,f=d.pageX,g=d.pageY;if(l.preventedByNestedSwiper){n.startX=f,n.startY=g;return}if(!t.allowTouchMove){l.target.matches(s.focusableElements)||(t.allowClick=!1),s.isTouched&&(Object.assign(n,{startX:f,startY:g,prevX:t.touches.currentX,prevY:t.touches.currentY,currentX:f,currentY:g}),s.touchStartTime=Ya());return}if(r.touchReleaseOnEdges&&!r.loop){if(t.isVertical()){if(g<n.startY&&t.translate<=t.maxTranslate()||g>n.startY&&t.translate>=t.minTranslate()){s.isTouched=!1,s.isMoved=!1;return}}else if(f<n.startX&&t.translate<=t.maxTranslate()||f>n.startX&&t.translate>=t.minTranslate())return}if(e.activeElement&&l.target===e.activeElement&&l.target.matches(s.focusableElements)){s.isMoved=!0,t.allowClick=!1;return}if(s.allowTouchCallbacks&&t.emit("touchMove",l),l.targetTouches&&l.targetTouches.length>1)return;n.currentX=f,n.currentY=g;const v=n.currentX-n.startX,y=n.currentY-n.startY;if(t.params.threshold&&Math.sqrt(v**2+y**2)<t.params.threshold)return;if(typeof s.isScrolling>"u"){let j;t.isHorizontal()&&n.currentY===n.startY||t.isVertical()&&n.currentX===n.startX?s.isScrolling=!1:v*v+y*y>=25&&(j=Math.atan2(Math.abs(y),Math.abs(v))*180/Math.PI,s.isScrolling=t.isHorizontal()?j>r.touchAngle:90-j>r.touchAngle)}if(s.isScrolling&&t.emit("touchMoveOpposite",l),typeof s.startMoving>"u"&&(n.currentX!==n.startX||n.currentY!==n.startY)&&(s.startMoving=!0),s.isScrolling||t.zoom&&t.params.zoom&&t.params.zoom.enabled&&s.evCache.length>1){s.isTouched=!1;return}if(!s.startMoving)return;t.allowClick=!1,!r.cssMode&&l.cancelable&&l.preventDefault(),r.touchMoveStopPropagation&&!r.nested&&l.stopPropagation();let E=t.isHorizontal()?v:y,b=t.isHorizontal()?n.currentX-n.previousX:n.currentY-n.previousY;r.oneWayMovement&&(E=Math.abs(E)*(a?1:-1),b=Math.abs(b)*(a?1:-1)),n.diff=E,E*=r.touchRatio,a&&(E=-E,b=-b);const w=t.touchesDirection;t.swipeDirection=E>0?"prev":"next",t.touchesDirection=b>0?"prev":"next";const F=t.params.loop&&!r.cssMode,k=t.swipeDirection==="next"&&t.allowSlideNext||t.swipeDirection==="prev"&&t.allowSlidePrev;if(!s.isMoved){if(F&&k&&t.loopFix({direction:t.swipeDirection}),s.startTranslate=t.getTranslate(),t.setTransition(0),t.animating){const j=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});t.wrapperEl.dispatchEvent(j)}s.allowMomentumBounce=!1,r.grabCursor&&(t.allowSlideNext===!0||t.allowSlidePrev===!0)&&t.setGrabCursor(!0),t.emit("sliderFirstMove",l)}let U;s.isMoved&&w!==t.touchesDirection&&F&&k&&Math.abs(E)>=1&&(t.loopFix({direction:t.swipeDirection,setTranslate:!0}),U=!0),t.emit("sliderMove",l),s.isMoved=!0,s.currentTranslate=E+s.startTranslate;let N=!0,te=r.resistanceRatio;if(r.touchReleaseOnEdges&&(te=0),E>0?(F&&k&&!U&&s.currentTranslate>(r.centeredSlides?t.minTranslate()-t.size/2:t.minTranslate())&&t.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),s.currentTranslate>t.minTranslate()&&(N=!1,r.resistance&&(s.currentTranslate=t.minTranslate()-1+(-t.minTranslate()+s.startTranslate+E)**te))):E<0&&(F&&k&&!U&&s.currentTranslate<(r.centeredSlides?t.maxTranslate()+t.size/2:t.maxTranslate())&&t.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:t.slides.length-(r.slidesPerView==="auto"?t.slidesPerViewDynamic():Math.ceil(parseFloat(r.slidesPerView,10)))}),s.currentTranslate<t.maxTranslate()&&(N=!1,r.resistance&&(s.currentTranslate=t.maxTranslate()+1-(t.maxTranslate()-s.startTranslate-E)**te))),N&&(l.preventedByNestedSwiper=!0),!t.allowSlideNext&&t.swipeDirection==="next"&&s.currentTranslate<s.startTranslate&&(s.currentTranslate=s.startTranslate),!t.allowSlidePrev&&t.swipeDirection==="prev"&&s.currentTranslate>s.startTranslate&&(s.currentTranslate=s.startTranslate),!t.allowSlidePrev&&!t.allowSlideNext&&(s.currentTranslate=s.startTranslate),r.threshold>0)if(Math.abs(E)>r.threshold||s.allowThresholdMove){if(!s.allowThresholdMove){s.allowThresholdMove=!0,n.startX=n.currentX,n.startY=n.currentY,s.currentTranslate=s.startTranslate,n.diff=t.isHorizontal()?n.currentX-n.startX:n.currentY-n.startY;return}}else{s.currentTranslate=s.startTranslate;return}!r.followFinger||r.cssMode||((r.freeMode&&r.freeMode.enabled&&t.freeMode||r.watchSlidesProgress)&&(t.updateActiveIndex(),t.updateSlidesClasses()),r.freeMode&&r.freeMode.enabled&&t.freeMode&&t.freeMode.onTouchMove(),t.updateProgress(s.currentTranslate),t.setTranslate(s.currentTranslate))}function GR(i){const e=this,t=e.touchEventsData,s=t.evCache.findIndex(k=>k.pointerId===i.pointerId);if(s>=0&&t.evCache.splice(s,1),["pointercancel","pointerout","pointerleave","contextmenu"].includes(i.type)&&!(["pointercancel","contextmenu"].includes(i.type)&&(e.browser.isSafari||e.browser.isWebView)))return;const{params:r,touches:n,rtlTranslate:a,slidesGrid:o,enabled:l}=e;if(!l||!r.simulateTouch&&i.pointerType==="mouse")return;let u=i;if(u.originalEvent&&(u=u.originalEvent),t.allowTouchCallbacks&&e.emit("touchEnd",u),t.allowTouchCallbacks=!1,!t.isTouched){t.isMoved&&r.grabCursor&&e.setGrabCursor(!1),t.isMoved=!1,t.startMoving=!1;return}r.grabCursor&&t.isMoved&&t.isTouched&&(e.allowSlideNext===!0||e.allowSlidePrev===!0)&&e.setGrabCursor(!1);const d=Ya(),f=d-t.touchStartTime;if(e.allowClick){const k=u.path||u.composedPath&&u.composedPath();e.updateClickedSlide(k&&k[0]||u.target,k),e.emit("tap click",u),f<300&&d-t.lastClickTime<300&&e.emit("doubleTap doubleClick",u)}if(t.lastClickTime=Ya(),Ul(()=>{e.destroyed||(e.allowClick=!0)}),!t.isTouched||!t.isMoved||!e.swipeDirection||n.diff===0||t.currentTranslate===t.startTranslate){t.isTouched=!1,t.isMoved=!1,t.startMoving=!1;return}t.isTouched=!1,t.isMoved=!1,t.startMoving=!1;let g;if(r.followFinger?g=a?e.translate:-e.translate:g=-t.currentTranslate,r.cssMode)return;if(r.freeMode&&r.freeMode.enabled){e.freeMode.onTouchEnd({currentPos:g});return}let v=0,y=e.slidesSizesGrid[0];for(let k=0;k<o.length;k+=k<r.slidesPerGroupSkip?1:r.slidesPerGroup){const U=k<r.slidesPerGroupSkip-1?1:r.slidesPerGroup;typeof o[k+U]<"u"?g>=o[k]&&g<o[k+U]&&(v=k,y=o[k+U]-o[k]):g>=o[k]&&(v=k,y=o[o.length-1]-o[o.length-2])}let E=null,b=null;r.rewind&&(e.isBeginning?b=r.virtual&&r.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(E=0));const w=(g-o[v])/y,F=v<r.slidesPerGroupSkip-1?1:r.slidesPerGroup;if(f>r.longSwipesMs){if(!r.longSwipes){e.slideTo(e.activeIndex);return}e.swipeDirection==="next"&&(w>=r.longSwipesRatio?e.slideTo(r.rewind&&e.isEnd?E:v+F):e.slideTo(v)),e.swipeDirection==="prev"&&(w>1-r.longSwipesRatio?e.slideTo(v+F):b!==null&&w<0&&Math.abs(w)>r.longSwipesRatio?e.slideTo(b):e.slideTo(v))}else{if(!r.shortSwipes){e.slideTo(e.activeIndex);return}e.navigation&&(u.target===e.navigation.nextEl||u.target===e.navigation.prevEl)?u.target===e.navigation.nextEl?e.slideTo(v+F):e.slideTo(v):(e.swipeDirection==="next"&&e.slideTo(E!==null?E:v+F),e.swipeDirection==="prev"&&e.slideTo(b!==null?b:v))}}function Hd(){const i=this,{params:e,el:t}=i;if(t&&t.offsetWidth===0)return;e.breakpoints&&i.setBreakpoint();const{allowSlideNext:s,allowSlidePrev:r,snapGrid:n}=i,a=i.virtual&&i.params.virtual.enabled;i.allowSlideNext=!0,i.allowSlidePrev=!0,i.updateSize(),i.updateSlides(),i.updateSlidesClasses();const o=a&&e.loop;(e.slidesPerView==="auto"||e.slidesPerView>1)&&i.isEnd&&!i.isBeginning&&!i.params.centeredSlides&&!o?i.slideTo(i.slides.length-1,0,!1,!0):i.params.loop&&!a?i.slideToLoop(i.realIndex,0,!1,!0):i.slideTo(i.activeIndex,0,!1,!0),i.autoplay&&i.autoplay.running&&i.autoplay.paused&&(clearTimeout(i.autoplay.resizeTimeout),i.autoplay.resizeTimeout=setTimeout(()=>{i.autoplay&&i.autoplay.running&&i.autoplay.paused&&i.autoplay.resume()},500)),i.allowSlidePrev=r,i.allowSlideNext=s,i.params.watchOverflow&&n!==i.snapGrid&&i.checkOverflow()}function VR(i){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&i.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(i.stopPropagation(),i.stopImmediatePropagation())))}function HR(){const i=this,{wrapperEl:e,rtlTranslate:t,enabled:s}=i;if(!s)return;i.previousTranslate=i.translate,i.isHorizontal()?i.translate=-e.scrollLeft:i.translate=-e.scrollTop,i.translate===0&&(i.translate=0),i.updateActiveIndex(),i.updateSlidesClasses();let r;const n=i.maxTranslate()-i.minTranslate();n===0?r=0:r=(i.translate-i.minTranslate())/n,r!==i.progress&&i.updateProgress(t?-i.translate:i.translate),i.emit("setTranslate",i.translate,!1)}function jR(i){const e=this;Ra(e,i.target),!(e.params.cssMode||e.params.slidesPerView!=="auto"&&!e.params.autoHeight)&&e.update()}let jd=!1;function KR(){}const Kg=(i,e)=>{const t=lr(),{params:s,el:r,wrapperEl:n,device:a}=i,o=!!s.nested,l=e==="on"?"addEventListener":"removeEventListener",u=e;r[l]("pointerdown",i.onTouchStart,{passive:!1}),t[l]("pointermove",i.onTouchMove,{passive:!1,capture:o}),t[l]("pointerup",i.onTouchEnd,{passive:!0}),t[l]("pointercancel",i.onTouchEnd,{passive:!0}),t[l]("pointerout",i.onTouchEnd,{passive:!0}),t[l]("pointerleave",i.onTouchEnd,{passive:!0}),t[l]("contextmenu",i.onTouchEnd,{passive:!0}),(s.preventClicks||s.preventClicksPropagation)&&r[l]("click",i.onClick,!0),s.cssMode&&n[l]("scroll",i.onScroll),s.updateOnWindowResize?i[u](a.ios||a.android?"resize orientationchange observerUpdate":"resize observerUpdate",Hd,!0):i[u]("observerUpdate",Hd,!0),r[l]("load",i.onLoad,{capture:!0})};function zR(){const i=this,e=lr(),{params:t}=i;i.onTouchStart=$R.bind(i),i.onTouchMove=UR.bind(i),i.onTouchEnd=GR.bind(i),t.cssMode&&(i.onScroll=HR.bind(i)),i.onClick=VR.bind(i),i.onLoad=jR.bind(i),jd||(e.addEventListener("touchstart",KR),jd=!0),Kg(i,"on")}function WR(){Kg(this,"off")}var qR={attachEvents:zR,detachEvents:WR};const Kd=(i,e)=>i.grid&&e.grid&&e.grid.rows>1;function YR(){const i=this,{realIndex:e,initialized:t,params:s,el:r}=i,n=s.breakpoints;if(!n||n&&Object.keys(n).length===0)return;const a=i.getBreakpoint(n,i.params.breakpointsBase,i.el);if(!a||i.currentBreakpoint===a)return;const l=(a in n?n[a]:void 0)||i.originalParams,u=Kd(i,s),d=Kd(i,l),f=s.enabled;u&&!d?(r.classList.remove(`${s.containerModifierClass}grid`,`${s.containerModifierClass}grid-column`),i.emitContainerClasses()):!u&&d&&(r.classList.add(`${s.containerModifierClass}grid`),(l.grid.fill&&l.grid.fill==="column"||!l.grid.fill&&s.grid.fill==="column")&&r.classList.add(`${s.containerModifierClass}grid-column`),i.emitContainerClasses()),["navigation","pagination","scrollbar"].forEach(w=>{if(typeof l[w]>"u")return;const F=s[w]&&s[w].enabled,k=l[w]&&l[w].enabled;F&&!k&&i[w].disable(),!F&&k&&i[w].enable()});const g=l.direction&&l.direction!==s.direction,v=s.loop&&(l.slidesPerView!==s.slidesPerView||g),y=s.loop;g&&t&&i.changeDirection(),us(i.params,l);const E=i.params.enabled,b=i.params.loop;Object.assign(i,{allowTouchMove:i.params.allowTouchMove,allowSlideNext:i.params.allowSlideNext,allowSlidePrev:i.params.allowSlidePrev}),f&&!E?i.disable():!f&&E&&i.enable(),i.currentBreakpoint=a,i.emit("_beforeBreakpoint",l),t&&(v?(i.loopDestroy(),i.loopCreate(e),i.updateSlides()):!y&&b?(i.loopCreate(e),i.updateSlides()):y&&!b&&i.loopDestroy()),i.emit("breakpoint",l)}function XR(i,e,t){if(e===void 0&&(e="window"),!i||e==="container"&&!t)return;let s=!1;const r=fs(),n=e==="window"?r.innerHeight:t.clientHeight,a=Object.keys(i).map(o=>{if(typeof o=="string"&&o.indexOf("@")===0){const l=parseFloat(o.substr(1));return{value:n*l,point:o}}return{value:o,point:o}});a.sort((o,l)=>parseInt(o.value,10)-parseInt(l.value,10));for(let o=0;o<a.length;o+=1){const{point:l,value:u}=a[o];e==="window"?r.matchMedia(`(min-width: ${u}px)`).matches&&(s=l):u<=t.clientWidth&&(s=l)}return s||"max"}var QR={setBreakpoint:YR,getBreakpoint:XR};function JR(i,e){const t=[];return i.forEach(s=>{typeof s=="object"?Object.keys(s).forEach(r=>{s[r]&&t.push(e+r)}):typeof s=="string"&&t.push(e+s)}),t}function ZR(){const i=this,{classNames:e,params:t,rtl:s,el:r,device:n}=i,a=JR(["initialized",t.direction,{"free-mode":i.params.freeMode&&t.freeMode.enabled},{autoheight:t.autoHeight},{rtl:s},{grid:t.grid&&t.grid.rows>1},{"grid-column":t.grid&&t.grid.rows>1&&t.grid.fill==="column"},{android:n.android},{ios:n.ios},{"css-mode":t.cssMode},{centered:t.cssMode&&t.centeredSlides},{"watch-progress":t.watchSlidesProgress}],t.containerModifierClass);e.push(...a),r.classList.add(...e),i.emitContainerClasses()}function e_(){const i=this,{el:e,classNames:t}=i;e.classList.remove(...t),i.emitContainerClasses()}var t_={addClasses:ZR,removeClasses:e_};function s_(){const i=this,{isLocked:e,params:t}=i,{slidesOffsetBefore:s}=t;if(s){const r=i.slides.length-1,n=i.slidesGrid[r]+i.slidesSizesGrid[r]+s*2;i.isLocked=i.size>n}else i.isLocked=i.snapGrid.length===1;t.allowSlideNext===!0&&(i.allowSlideNext=!i.isLocked),t.allowSlidePrev===!0&&(i.allowSlidePrev=!i.isLocked),e&&e!==i.isLocked&&(i.isEnd=!1),e!==i.isLocked&&i.emit(i.isLocked?"lock":"unlock")}var i_={checkOverflow:s_},Vl={init:!0,direction:"horizontal",oneWayMovement:!1,touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,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,loopedSlides:null,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",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function r_(i,e){return function(s){s===void 0&&(s={});const r=Object.keys(s)[0],n=s[r];if(typeof n!="object"||n===null){us(e,s);return}if(i[r]===!0&&(i[r]={enabled:!0}),r==="navigation"&&i[r]&&i[r].enabled&&!i[r].prevEl&&!i[r].nextEl&&(i[r].auto=!0),["pagination","scrollbar"].indexOf(r)>=0&&i[r]&&i[r].enabled&&!i[r].el&&(i[r].auto=!0),!(r in i&&"enabled"in n)){us(e,s);return}typeof i[r]=="object"&&!("enabled"in i[r])&&(i[r].enabled=!0),i[r]||(i[r]={enabled:!1}),us(e,s)}}const fl={eventsEmitter:tR,update:dR,translate:yR,transition:bR,slide:IR,loop:MR,grabCursor:NR,events:qR,breakpoints:QR,checkOverflow:i_,classes:t_},pl={};let Oc=class pi{constructor(){let e,t;for(var s=arguments.length,r=new Array(s),n=0;n<s;n++)r[n]=arguments[n];r.length===1&&r[0].constructor&&Object.prototype.toString.call(r[0]).slice(8,-1)==="Object"?t=r[0]:[e,t]=r,t||(t={}),t=us({},t),e&&!t.el&&(t.el=e);const a=lr();if(t.el&&typeof t.el=="string"&&a.querySelectorAll(t.el).length>1){const d=[];return a.querySelectorAll(t.el).forEach(f=>{const g=us({},t,{el:f});d.push(new pi(g))}),d}const o=this;o.__swiper__=!0,o.support=Hg(),o.device=XC({userAgent:t.userAgent}),o.browser=JC(),o.eventsListeners={},o.eventsAnyListeners=[],o.modules=[...o.__modules__],t.modules&&Array.isArray(t.modules)&&o.modules.push(...t.modules);const l={};o.modules.forEach(d=>{d({params:t,swiper:o,extendParams:r_(t,l),on:o.on.bind(o),once:o.once.bind(o),off:o.off.bind(o),emit:o.emit.bind(o)})});const u=us({},Vl,l);return o.params=us({},u,pl,t),o.originalParams=us({},o.params),o.passedParams=us({},t),o.params&&o.params.on&&Object.keys(o.params.on).forEach(d=>{o.on(d,o.params.on[d])}),o.params&&o.params.onAny&&o.onAny(o.params.onAny),Object.assign(o,{enabled:o.params.enabled,el:e,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return o.params.direction==="horizontal"},isVertical(){return o.params.direction==="vertical"},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,evCache:[]},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}getSlideIndex(e){const{slidesEl:t,params:s}=this,r=vi(t,`.${s.slideClass}, swiper-slide`),n=Gd(r[0]);return Gd(e)-n}getSlideIndexByData(e){return this.getSlideIndex(this.slides.filter(t=>t.getAttribute("data-swiper-slide-index")*1===e)[0])}recalcSlides(){const e=this,{slidesEl:t,params:s}=e;e.slides=vi(t,`.${s.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 s=this;e=Math.min(Math.max(e,0),1);const r=s.minTranslate(),a=(s.maxTranslate()-r)*e+r;s.translateTo(a,typeof t>"u"?0:t),s.updateActiveIndex(),s.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=e.el.className.split(" ").filter(s=>s.indexOf("swiper")===0||s.indexOf(e.params.containerModifierClass)===0);e.emit("_containerClasses",t.join(" "))}getSlideClasses(e){const t=this;return t.destroyed?"":e.className.split(" ").filter(s=>s.indexOf("swiper-slide")===0||s.indexOf(t.params.slideClass)===0).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=[];e.slides.forEach(s=>{const r=e.getSlideClasses(s);t.push({slideEl:s,classNames:r}),e.emit("_slideClass",s,r)}),e.emit("_slideClasses",t)}slidesPerViewDynamic(e,t){e===void 0&&(e="current"),t===void 0&&(t=!1);const s=this,{params:r,slides:n,slidesGrid:a,slidesSizesGrid:o,size:l,activeIndex:u}=s;let d=1;if(typeof r.slidesPerView=="number")return r.slidesPerView;if(r.centeredSlides){let f=n[u]?n[u].swiperSlideSize:0,g;for(let v=u+1;v<n.length;v+=1)n[v]&&!g&&(f+=n[v].swiperSlideSize,d+=1,f>l&&(g=!0));for(let v=u-1;v>=0;v-=1)n[v]&&!g&&(f+=n[v].swiperSlideSize,d+=1,f>l&&(g=!0))}else if(e==="current")for(let f=u+1;f<n.length;f+=1)(t?a[f]+o[f]-a[u]<l:a[f]-a[u]<l)&&(d+=1);else for(let f=u-1;f>=0;f-=1)a[u]-a[f]<l&&(d+=1);return d}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:s}=e;s.breakpoints&&e.setBreakpoint(),[...e.el.querySelectorAll('[loading="lazy"]')].forEach(a=>{a.complete&&Ra(e,a)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses();function r(){const a=e.rtlTranslate?e.translate*-1:e.translate,o=Math.min(Math.max(a,e.maxTranslate()),e.minTranslate());e.setTranslate(o),e.updateActiveIndex(),e.updateSlidesClasses()}let n;if(s.freeMode&&s.freeMode.enabled&&!s.cssMode)r(),s.autoHeight&&e.updateAutoHeight();else{if((s.slidesPerView==="auto"||s.slidesPerView>1)&&e.isEnd&&!s.centeredSlides){const a=e.virtual&&s.virtual.enabled?e.virtual.slides:e.slides;n=e.slideTo(a.length-1,0,!1,!0)}else n=e.slideTo(e.activeIndex,0,!1,!0);n||r()}s.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t){t===void 0&&(t=!0);const s=this,r=s.params.direction;return e||(e=r==="horizontal"?"vertical":"horizontal"),e===r||e!=="horizontal"&&e!=="vertical"||(s.el.classList.remove(`${s.params.containerModifierClass}${r}`),s.el.classList.add(`${s.params.containerModifierClass}${e}`),s.emitContainerClasses(),s.params.direction=e,s.slides.forEach(n=>{e==="vertical"?n.style.width="":n.style.height=""}),s.emit("changeDirection"),t&&s.update()),s}changeLanguageDirection(e){const t=this;t.rtl&&e==="rtl"||!t.rtl&&e==="ltr"||(t.rtl=e==="rtl",t.rtlTranslate=t.params.direction==="horizontal"&&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 s=e||t.params.el;if(typeof s=="string"&&(s=document.querySelector(s)),!s)return!1;s.swiper=t,s.parentNode&&s.parentNode.host&&s.parentNode.host.nodeName==="SWIPER-CONTAINER"&&(t.isElement=!0);const r=()=>`.${(t.params.wrapperClass||"").trim().split(" ").join(".")}`;let a=s&&s.shadowRoot&&s.shadowRoot.querySelector?s.shadowRoot.querySelector(r()):vi(s,r())[0];return!a&&t.params.createElements&&(a=jC("div",t.params.wrapperClass),s.append(a),vi(s,`.${t.params.slideClass}`).forEach(o=>{a.append(o)})),Object.assign(t,{el:s,wrapperEl:a,slidesEl:t.isElement&&!s.parentNode.host.slideSlots?s.parentNode.host:a,hostEl:t.isElement?s.parentNode.host:s,mounted:!0,rtl:s.dir.toLowerCase()==="rtl"||Bi(s,"direction")==="rtl",rtlTranslate:t.params.direction==="horizontal"&&(s.dir.toLowerCase()==="rtl"||Bi(s,"direction")==="rtl"),wrongRTL:Bi(a,"display")==="-webkit-box"}),!0}init(e){const t=this;if(t.initialized||t.mount(e)===!1)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(n=>{n.complete?Ra(t,n):n.addEventListener("load",a=>{Ra(t,a.target)})}),Gl(t),t.initialized=!0,Gl(t),t.emit("init"),t.emit("afterInit"),t}destroy(e,t){e===void 0&&(e=!0),t===void 0&&(t=!0);const s=this,{params:r,el:n,wrapperEl:a,slides:o}=s;return typeof s.params>"u"||s.destroyed||(s.emit("beforeDestroy"),s.initialized=!1,s.detachEvents(),r.loop&&s.loopDestroy(),t&&(s.removeClasses(),n.removeAttribute("style"),a.removeAttribute("style"),o&&o.length&&o.forEach(l=>{l.classList.remove(r.slideVisibleClass,r.slideActiveClass,r.slideNextClass,r.slidePrevClass),l.removeAttribute("style"),l.removeAttribute("data-swiper-slide-index")})),s.emit("destroy"),Object.keys(s.eventsListeners).forEach(l=>{s.off(l)}),e!==!1&&(s.el.swiper=null,UC(s)),s.destroyed=!0),null}static extendDefaults(e){us(pl,e)}static get extendedDefaults(){return pl}static get defaults(){return Vl}static installModule(e){pi.prototype.__modules__||(pi.prototype.__modules__=[]);const t=pi.prototype.__modules__;typeof e=="function"&&t.indexOf(e)<0&&t.push(e)}static use(e){return Array.isArray(e)?(e.forEach(t=>pi.installModule(t)),pi):(pi.installModule(e),pi)}};Object.keys(fl).forEach(i=>{Object.keys(fl[i]).forEach(e=>{Oc.prototype[e]=fl[i][e]})});Oc.use([ZC,eR]);const zg=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","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","loopedSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideNextClass","slidePrevClass","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 or(i){return typeof i=="object"&&i!==null&&i.constructor&&Object.prototype.toString.call(i).slice(8,-1)==="Object"&&!i.__swiper__}function rr(i,e){const t=["__proto__","constructor","prototype"];Object.keys(e).filter(s=>t.indexOf(s)<0).forEach(s=>{typeof i[s]>"u"?i[s]=e[s]:or(e[s])&&or(i[s])&&Object.keys(e[s]).length>0?e[s].__swiper__?i[s]=e[s]:rr(i[s],e[s]):i[s]=e[s]})}function Wg(i){return i===void 0&&(i={}),i.navigation&&typeof i.navigation.nextEl>"u"&&typeof i.navigation.prevEl>"u"}function qg(i){return i===void 0&&(i={}),i.pagination&&typeof i.pagination.el>"u"}function Yg(i){return i===void 0&&(i={}),i.scrollbar&&typeof i.scrollbar.el>"u"}function Xg(i){i===void 0&&(i="");const e=i.split(" ").map(s=>s.trim()).filter(s=>!!s),t=[];return e.forEach(s=>{t.indexOf(s)<0&&t.push(s)}),t.join(" ")}function n_(i){return i===void 0&&(i=""),i?i.includes("swiper-wrapper")?i:`swiper-wrapper ${i}`:"swiper-wrapper"}function a_(i){let{swiper:e,slides:t,passedParams:s,changedParams:r,nextEl:n,prevEl:a,scrollbarEl:o,paginationEl:l}=i;const u=r.filter(Q=>Q!=="children"&&Q!=="direction"&&Q!=="wrapperClass"),{params:d,pagination:f,navigation:g,scrollbar:v,virtual:y,thumbs:E}=e;let b,w,F,k,U,N,te,j;r.includes("thumbs")&&s.thumbs&&s.thumbs.swiper&&d.thumbs&&!d.thumbs.swiper&&(b=!0),r.includes("controller")&&s.controller&&s.controller.control&&d.controller&&!d.controller.control&&(w=!0),r.includes("pagination")&&s.pagination&&(s.pagination.el||l)&&(d.pagination||d.pagination===!1)&&f&&!f.el&&(F=!0),r.includes("scrollbar")&&s.scrollbar&&(s.scrollbar.el||o)&&(d.scrollbar||d.scrollbar===!1)&&v&&!v.el&&(k=!0),r.includes("navigation")&&s.navigation&&(s.navigation.prevEl||a)&&(s.navigation.nextEl||n)&&(d.navigation||d.navigation===!1)&&g&&!g.prevEl&&!g.nextEl&&(U=!0);const re=Q=>{e[Q]&&(e[Q].destroy(),Q==="navigation"?(e.isElement&&(e[Q].prevEl.remove(),e[Q].nextEl.remove()),d[Q].prevEl=void 0,d[Q].nextEl=void 0,e[Q].prevEl=void 0,e[Q].nextEl=void 0):(e.isElement&&e[Q].el.remove(),d[Q].el=void 0,e[Q].el=void 0))};r.includes("loop")&&e.isElement&&(d.loop&&!s.loop?N=!0:!d.loop&&s.loop?te=!0:j=!0),u.forEach(Q=>{if(or(d[Q])&&or(s[Q]))rr(d[Q],s[Q]),(Q==="navigation"||Q==="pagination"||Q==="scrollbar")&&"enabled"in s[Q]&&!s[Q].enabled&&re(Q);else{const le=s[Q];(le===!0||le===!1)&&(Q==="navigation"||Q==="pagination"||Q==="scrollbar")?le===!1&&re(Q):d[Q]=s[Q]}}),u.includes("controller")&&!w&&e.controller&&e.controller.control&&d.controller&&d.controller.control&&(e.controller.control=d.controller.control),r.includes("children")&&t&&y&&d.virtual.enabled&&(y.slides=t,y.update(!0)),r.includes("children")&&t&&d.loop&&(j=!0),b&&E.init()&&E.update(!0),w&&(e.controller.control=d.controller.control),F&&(e.isElement&&(!l||typeof l=="string")&&(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),e.el.appendChild(l)),l&&(d.pagination.el=l),f.init(),f.render(),f.update()),k&&(e.isElement&&(!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-scrollbar"),o.part.add("scrollbar"),e.el.appendChild(o)),o&&(d.scrollbar.el=o),v.init(),v.updateSize(),v.setTranslate()),U&&(e.isElement&&((!n||typeof n=="string")&&(n=document.createElement("div"),n.classList.add("swiper-button-next"),n.innerHTML=e.hostEl.constructor.nextButtonSvg,n.part.add("button-next"),e.el.appendChild(n)),(!a||typeof a=="string")&&(a=document.createElement("div"),a.classList.add("swiper-button-prev"),a.innerHTML=e.hostEl.constructor.prevButtonSvg,a.part.add("button-prev"),e.el.appendChild(a))),n&&(d.navigation.nextEl=n),a&&(d.navigation.prevEl=a),g.init(),g.update()),r.includes("allowSlideNext")&&(e.allowSlideNext=s.allowSlideNext),r.includes("allowSlidePrev")&&(e.allowSlidePrev=s.allowSlidePrev),r.includes("direction")&&e.changeDirection(s.direction,!1),(N||j)&&e.loopDestroy(),(te||j)&&e.loopCreate(),e.update()}function o_(i,e){i===void 0&&(i={}),e===void 0&&(e=!0);const t={on:{}},s={},r={};rr(t,Vl),t._emitClasses=!0,t.init=!1;const n={},a=zg.map(l=>l.replace(/_/,"")),o=Object.assign({},i);return Object.keys(o).forEach(l=>{typeof i[l]>"u"||(a.indexOf(l)>=0?or(i[l])?(t[l]={},r[l]={},rr(t[l],i[l]),rr(r[l],i[l])):(t[l]=i[l],r[l]=i[l]):l.search(/on[A-Z]/)===0&&typeof i[l]=="function"?e?s[`${l[2].toLowerCase()}${l.substr(3)}`]=i[l]:t.on[`${l[2].toLowerCase()}${l.substr(3)}`]=i[l]:n[l]=i[l])}),["navigation","pagination","scrollbar"].forEach(l=>{t[l]===!0&&(t[l]={}),t[l]===!1&&delete t[l]}),{params:t,passedParams:r,rest:n,events:s}}function l_(i,e){let{el:t,nextEl:s,prevEl:r,paginationEl:n,scrollbarEl:a,swiper:o}=i;Wg(e)&&s&&r&&(o.params.navigation.nextEl=s,o.originalParams.navigation.nextEl=s,o.params.navigation.prevEl=r,o.originalParams.navigation.prevEl=r),qg(e)&&n&&(o.params.pagination.el=n,o.originalParams.pagination.el=n),Yg(e)&&a&&(o.params.scrollbar.el=a,o.originalParams.scrollbar.el=a),o.init(t)}function c_(i,e,t,s,r){const n=[];if(!e)return n;const a=l=>{n.indexOf(l)<0&&n.push(l)};if(t&&s){const l=s.map(r),u=t.map(r);l.join("")!==u.join("")&&a("children"),s.length!==t.length&&a("children")}return zg.filter(l=>l[0]==="_").map(l=>l.replace(/_/,"")).forEach(l=>{if(l in i&&l in e)if(or(i[l])&&or(e[l])){const u=Object.keys(i[l]),d=Object.keys(e[l]);u.length!==d.length?a(l):(u.forEach(f=>{i[l][f]!==e[l][f]&&a(l)}),d.forEach(f=>{i[l][f]!==e[l][f]&&a(l)}))}else i[l]!==e[l]&&a(l)}),n}const u_=i=>{!i||i.destroyed||!i.params.virtual||i.params.virtual&&!i.params.virtual.enabled||(i.updateSlides(),i.updateProgress(),i.updateSlidesClasses(),i.parallax&&i.params.parallax&&i.params.parallax.enabled&&i.parallax.setTranslate())};function Xa(){return Xa=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Xa.apply(this,arguments)}function Qg(i){return i.type&&i.type.displayName&&i.type.displayName.includes("SwiperSlide")}function Jg(i){const e=[];return fe.Children.toArray(i).forEach(t=>{Qg(t)?e.push(t):t.props&&t.props.children&&Jg(t.props.children).forEach(s=>e.push(s))}),e}function h_(i){const e=[],t={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return fe.Children.toArray(i).forEach(s=>{if(Qg(s))e.push(s);else if(s.props&&s.props.slot&&t[s.props.slot])t[s.props.slot].push(s);else if(s.props&&s.props.children){const r=Jg(s.props.children);r.length>0?r.forEach(n=>e.push(n)):t["container-end"].push(s)}else t["container-end"].push(s)}),{slides:e,slots:t}}function d_(i,e,t){if(!t)return null;const s=d=>{let f=d;return d<0?f=e.length+d:f>=e.length&&(f=f-e.length),f},r=i.isHorizontal()?{[i.rtlTranslate?"right":"left"]:`${t.offset}px`}:{top:`${t.offset}px`},{from:n,to:a}=t,o=i.params.loop?-e.length:0,l=i.params.loop?e.length*2:e.length,u=[];for(let d=o;d<l;d+=1)d>=n&&d<=a&&u.push(e[s(d)]);return u.map((d,f)=>fe.cloneElement(d,{swiper:i,style:r,key:`slide-${f}`}))}function Sn(i,e){return typeof window>"u"?fe.useEffect(i,e):fe.useLayoutEffect(i,e)}const zd=fe.createContext(null),f_=fe.createContext(null),p_=fe.forwardRef(function(i,e){let{className:t,tag:s="div",wrapperTag:r="div",children:n,onSwiper:a,...o}=i===void 0?{}:i,l=!1;const[u,d]=fe.useState("swiper"),[f,g]=fe.useState(null),[v,y]=fe.useState(!1),E=fe.useRef(!1),b=fe.useRef(null),w=fe.useRef(null),F=fe.useRef(null),k=fe.useRef(null),U=fe.useRef(null),N=fe.useRef(null),te=fe.useRef(null),j=fe.useRef(null),{params:re,passedParams:Q,rest:le,events:se}=o_(o),{slides:pe,slots:de}=h_(n),be=()=>{y(!v)};Object.assign(re.on,{_containerClasses(me,ye){d(ye)}});const Le=()=>{Object.assign(re.on,se),l=!0;const me={...re};if(delete me.wrapperClass,w.current=new Oc(me),w.current.virtual&&w.current.params.virtual.enabled){w.current.virtual.slides=pe;const ye={cache:!1,slides:pe,renderExternal:g,renderExternalUpdate:!1};rr(w.current.params.virtual,ye),rr(w.current.originalParams.virtual,ye)}};b.current||Le(),w.current&&w.current.on("_beforeBreakpoint",be);const ue=()=>{l||!se||!w.current||Object.keys(se).forEach(me=>{w.current.on(me,se[me])})},he=()=>{!se||!w.current||Object.keys(se).forEach(me=>{w.current.off(me,se[me])})};fe.useEffect(()=>()=>{w.current&&w.current.off("_beforeBreakpoint",be)}),fe.useEffect(()=>{!E.current&&w.current&&(w.current.emitSlidesClasses(),E.current=!0)}),Sn(()=>{if(e&&(e.current=b.current),!!b.current)return w.current.destroyed&&Le(),l_({el:b.current,nextEl:U.current,prevEl:N.current,paginationEl:te.current,scrollbarEl:j.current,swiper:w.current},re),a&&a(w.current),()=>{w.current&&!w.current.destroyed&&w.current.destroy(!0,!1)}},[]),Sn(()=>{ue();const me=c_(Q,F.current,pe,k.current,ye=>ye.key);return F.current=Q,k.current=pe,me.length&&w.current&&!w.current.destroyed&&a_({swiper:w.current,slides:pe,passedParams:Q,changedParams:me,nextEl:U.current,prevEl:N.current,scrollbarEl:j.current,paginationEl:te.current}),()=>{he()}}),Sn(()=>{u_(w.current)},[f]);function we(){return re.virtual?d_(w.current,pe,f):pe.map((me,ye)=>fe.cloneElement(me,{swiper:w.current,swiperSlideIndex:ye}))}return fe.createElement(s,Xa({ref:b,className:Xg(`${u}${t?` ${t}`:""}`)},le),fe.createElement(f_.Provider,{value:w.current},de["container-start"],fe.createElement(r,{className:n_(re.wrapperClass)},de["wrapper-start"],we(),de["wrapper-end"]),Wg(re)&&fe.createElement(fe.Fragment,null,fe.createElement("div",{ref:N,className:"swiper-button-prev"}),fe.createElement("div",{ref:U,className:"swiper-button-next"})),Yg(re)&&fe.createElement("div",{ref:j,className:"swiper-scrollbar"}),qg(re)&&fe.createElement("div",{ref:te,className:"swiper-pagination"}),de["container-end"]))});p_.displayName="Swiper";const g_=fe.forwardRef(function(i,e){let{tag:t="div",children:s,className:r="",swiper:n,zoom:a,lazy:o,virtualIndex:l,swiperSlideIndex:u,...d}=i===void 0?{}:i;const f=fe.useRef(null),[g,v]=fe.useState("swiper-slide"),[y,E]=fe.useState(!1);function b(U,N,te){N===f.current&&v(te)}Sn(()=>{if(typeof u<"u"&&(f.current.swiperSlideIndex=u),e&&(e.current=f.current),!(!f.current||!n)){if(n.destroyed){g!=="swiper-slide"&&v("swiper-slide");return}return n.on("_slideClass",b),()=>{n&&n.off("_slideClass",b)}}}),Sn(()=>{n&&f.current&&!n.destroyed&&v(n.getSlideClasses(f.current))},[n]);const w={isActive:g.indexOf("swiper-slide-active")>=0,isVisible:g.indexOf("swiper-slide-visible")>=0,isPrev:g.indexOf("swiper-slide-prev")>=0,isNext:g.indexOf("swiper-slide-next")>=0},F=()=>typeof s=="function"?s(w):s,k=()=>{E(!0)};return fe.createElement(t,Xa({ref:f,className:Xg(`${g}${r?` ${r}`:""}`),"data-swiper-slide-index":l,onLoad:k},d),a&&fe.createElement(zd.Provider,{value:w},fe.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":typeof a=="number"?a:void 0},F(),o&&!y&&fe.createElement("div",{className:"swiper-lazy-preloader"}))),!a&&fe.createElement(zd.Provider,{value:w},F(),o&&!y&&fe.createElement("div",{className:"swiper-lazy-preloader"})))});g_.displayName="SwiperSlide";const m_=[{key:"entryTime",title:"진입 시간",value:"",accumulate:!1},{key:"lastUpdated",title:"데이터 업데이트 시간",value:"",accumulate:!1},{key:"clientId",title:"클라이언트 ID",value:"",accumulate:!1},{key:"id",title:"ID",value:"",accumulate:!1},{key:"likeCount",title:"좋아요수",value:[0,0],accumulate:!0},{key:"commentCount",title:"댓글수",value:0,accumulate:!0},{key:"viewCount",title:"조회수",value:[0,0],accumulate:!0},{key:"watchingTime",title:"누적 WT(초)",value:0,accumulate:!1},{key:"shareCount",title:"공유수",value:0,accumulate:!0},{key:"chattingCount",title:"채팅수",value:0,accumulate:!0},{key:"productCount",title:"상품 클릭수",value:0,accumulate:!0},{key:"bannerCount",title:"배너 클릭수",value:0,type:!0},{key:"userId",title:"유저 ID",value:"",accumulate:!1},{key:"authType",title:"회원 타입",value:"",accumulate:!1},{key:"expireTime",title:"회원 만료 시간",value:"",accumulate:!1},{key:"info",title:"OS / 브라우저 정보",value:"",accumulate:!1},{key:"version",title:"플레이어 버전",value:"",accumulate:!1}];m_.findIndex(i=>i.key==="lastUpdated");var Vt=[];for(var gl=0;gl<256;++gl)Vt.push((gl+256).toString(16).slice(1));function v_(i,e=0){return(Vt[i[e+0]]+Vt[i[e+1]]+Vt[i[e+2]]+Vt[i[e+3]]+"-"+Vt[i[e+4]]+Vt[i[e+5]]+"-"+Vt[i[e+6]]+Vt[i[e+7]]+"-"+Vt[i[e+8]]+Vt[i[e+9]]+"-"+Vt[i[e+10]]+Vt[i[e+11]]+Vt[i[e+12]]+Vt[i[e+13]]+Vt[i[e+14]]+Vt[i[e+15]]).toLowerCase()}var va,y_=new Uint8Array(16);function x_(){if(!va&&(va=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!va))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return va(y_)}var S_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Wd={randomUUID:S_};function E_(i,e,t){if(Wd.randomUUID&&!e&&!i)return Wd.randomUUID();i=i||{};var s=i.random||(i.rng||x_)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,v_(s)}const b_="_root_1y479_2",T_="_checkbox_1y479_22",w_="_checkbox_input_1y479_31",A_="_checkbox_label_1y479_35",L_="_toggle_1y479_57",C_="_toggle_input_1y479_66",R_="_toggle_label_1y479_71",Hs={root:b_,checkbox:T_,checkbox_input:w_,checkbox_label:A_,toggle:L_,toggle_input:C_,toggle_label:R_};fe.forwardRef(({id:i,type:e="text",autoComplete:t="off",className:s,...r},n)=>{const o=fe.useRef(i||E_()).current;return e==="toggle"?Ne.jsxs("div",{className:`${Hs.root} ${Hs.toggle} ${s||""}`,children:[Ne.jsx("input",{ref:n,className:Hs.toggle_input,type:"checkbox",id:o,...r}),Ne.jsx("label",{className:Hs.toggle_label,htmlFor:o,children:Ne.jsx("span",{className:Hs.cursor})})]}):e==="checkbox"?Ne.jsxs("div",{className:`${Hs.root} ${Hs.checkbox} ${s||""}`,children:[Ne.jsx("input",{ref:n,className:Hs.checkbox_input,type:"checkbox",id:o,...r}),Ne.jsx("label",{className:Hs.checkbox_label,htmlFor:o})]}):Ne.jsx("input",{ref:n,id:o,type:e,autoComplete:t,className:`${Hs.root} ${s||""}`,...r})});function Hl(i){this.message=i}Hl.prototype=new Error,Hl.prototype.name="InvalidCharacterError";var qd=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(i){var e=String(i).replace(/=+$/,"");if(e.length%4==1)throw new Hl("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,s,r=0,n=0,a="";s=e.charAt(n++);~s&&(t=r%4?64*t+s:s,r++%4)?a+=String.fromCharCode(255&t>>(-2*r&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);return a};function __(i){var e=i.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(qd(t).replace(/(.)/g,function(s,r){var n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(e)}catch{return qd(e)}}function Qa(i){this.message=i}function Yd(i,e){if(typeof i!="string")throw new Qa("Invalid token specified");var t=(e=e||{}).header===!0?0:1;try{return JSON.parse(__(i.split(".")[t]))}catch(s){throw new Qa("Invalid token specified: "+s.message)}}Qa.prototype=new Error,Qa.prototype.name="InvalidTokenError";const Zg={dev:"https://dev.api.brixcloud.io/v1",stage:"https://stage.api.brixcloud.io/v1",prod:"https://api.brixcloud.io/v1"},I_={dev:"https://dev.auth.brixcloud.io/v1",stage:"https://stage.auth.brixcloud.io/v1",prod:"https://auth.brixcloud.io/v1"},k_=async({id:i,env:e})=>{const t=await fetch(Zg[e]+`/public/ugc/${i}`),s=await t.json();if(!t.ok)throw s;return s},P_=async({id:i,env:e})=>{function t(n){return{statusCode:n.statusCode,success:n.success,timestamp:n.timestamp,userId:n.shortform.clientId,nickName:void 0,title:n.shortform.title,content:void 0,images:n.shortform.images,tags:n.shortform.tags,enableComment:n.shortform.enableComment,metaData:void 0,id:n.shortform.id,client:{id:n.shortform.clientId,name:void 0},products:void 0,counter:n.shortform.counter,playUrl:n.shortform.playUrl}}const s=await fetch(Zg[e]+`/public/shortform/${i}?onlyOne=true`),r=await s.json();if(!s.ok)throw r;return t(r)},D_=async({clientId:i,token:e,env:t})=>{const s=`__brix_session_token_${i}`,r="__brix_session_api_status";let n=e??localStorage.getItem(s);if(n)try{Yd(n).exp*1e3-Date.now()<0&&(n=null)}catch{n=null}if(!n)if(sessionStorage.getItem(r)==="pending")for(;sessionStorage.getItem(r)==="pending";)await new Promise(o=>setTimeout(o,100)),n=localStorage.getItem(s);else try{sessionStorage.setItem(s,"pending"),n=(await(await fetch(I_[t]+"/auth/token/guest",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({partner:i})})).json()).accessToken}finally{sessionStorage.setItem(s,"success")}return localStorage.setItem(s,n),Yd(n)},Xd=(i,e=!1)=>{const[t,s]=fe.useState(null),[r,n]=fe.useState(null);return fe.useEffect(()=>{if(e)return;let a=!0;return(async()=>{try{const l=await i();a&&(s(l),n(null))}catch(l){a&&(s(null),n(l.message))}})(),()=>{a=!1}},[i,e]),{data:t,error:r}};function M_({id:i,type:e,env:t,shadow:s,token:r,style:n,ratio:a,loop:o,autoplay:l=!0,restartFromBeginning:u=!0,className:d}){var Le,ue;if(!i||!e||!t)return null;const[f,g]=fe.useState(),[v,y]=fe.useState(0),[E,b]=fe.useState(!0),[w,F]=fe.useState(!1),{data:k}=Xd(fe.useCallback(()=>e==="ugc"?k_({id:i,env:t}):P_({id:i,env:t}),[i,t]),!i),U=fe.useRef(),{data:N}=Xd(fe.useCallback(()=>{var he;return D_({clientId:(he=k==null?void 0:k.client)==null?void 0:he.id,env:t,token:r})},[(Le=k==null?void 0:k.client)==null?void 0:Le.id,t,r]),!((ue=k==null?void 0:k.client)!=null&&ue.id)),te=fe.useRef(null),j=w1({ref:te,threshold:.1}),re=fe.useCallback(he=>{g(he),he.loop=!!o},[]),Q=fe.useCallback(()=>{g(void 0)},[]),le=()=>{f&&f.play()},se=()=>{f&&f.pause()},pe=(he,we)=>{if(he.stopPropagation(),!f)return;const me=we*f.duration/100;f.currentTime=me},de=he=>{he.stopPropagation(),f&&(f.muted=!f.muted,b(f.muted))},be=fe.useMemo(()=>{var he,we;return t?new y1({identityPoolId:(he=dh[t])==null?void 0:he.identityPoolId,streamName:(we=dh[t])==null?void 0:we.streamName}):void 0},[t]);return fe.useEffect(()=>{if(!f||!be)return;const he=Ve=>{const $e=Ve.target;y($e.currentTime/$e.duration*100)},we=()=>{F(!0),u&&(f.currentTime=0),be.start()},me=()=>{F(!1),be.stop()},ye=()=>{l?f.play():f.pause()};return f.addEventListener("loadedmetadata",ye),f.addEventListener("timeupdate",he),f.addEventListener("play",we),f.addEventListener("pause",me),()=>{f.removeEventListener("loadedmetadata",ye),f.removeEventListener("timeupdate",he),f.removeEventListener("play",we),f.removeEventListener("pause",me)}},[f,be]),fe.useEffect(()=>{if(!f)return;let he=!0;return U.current&&clearTimeout(U.current),j&&l&&(U.current=setTimeout(()=>{he&&f.play()},300)),j||(U.current=setTimeout(()=>{he&&f.pause()},700)),()=>{he=!1,U.current&&clearTimeout(U.current)}},[j,f,l]),fe.useEffect(()=>{!t||!N||!i||!be||(be.setType(e),be.setId(i),be.setUser(N.userId,N.role),be.stop())},[be]),(k==null?void 0:k.status)==="standby"||(k==null?void 0:k.status)==="converting"?Ne.jsx("div",{className:Us.root,children:Ne.jsx("div",{className:Us.error,children:`업로드된 영상이 처리중 입니다.
|
|
86
|
+
잠시 후 확인해 주세요.`})}):Ne.jsx(S1,{kinesis:be,children:Ne.jsxs("div",{ref:te,className:[Us.root,d??""].join(" "),style:n,children:[Ne.jsx(BC,{ratio:a,className:Us.player,controls:!1,shadow:s,src:k==null?void 0:k.playUrl,onInit:re,onDestroy:Q}),!w&&Ne.jsx("div",{className:Us.play_button,onClick:le}),w&&Ne.jsx("div",{className:Us.pause_button,onClick:se}),Ne.jsx("div",{className:[Us.mute_button,E?Us.sound_off_icon:Us.sound_on_icon].join(" "),onClick:de}),Ne.jsx(Ug,{className:Us.progress,progress:v,onChangeProgress:pe})]})})}exports.CognitoIdentityClient=wp;exports.Command=Ql;exports.HttpRequest=ns;exports.PlayerUser=M_;exports.ServiceException=to;exports._json=Pt;exports.commonParams=jS;exports.decorateServiceException=jt;exports.getEndpointPlugin=bf;exports.getSerdePlugin=Sf;exports.loadRestJsonErrorCode=ip;exports.parseJsonBody=Zl;exports.parseJsonErrorBody=sp;exports.take=$f;exports.withBaseException=Ff;
|
|
87
|
+
//# sourceMappingURL=Cdqd-vpy.cjs.js.map
|