@squadx_dev/brix-client-library 1.15.8 → 1.15.10

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.
@@ -0,0 +1,145 @@
1
+ "use strict";var W0=Object.defineProperty;var q0=(i,e,t)=>e in i?W0(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var an=(i,e,t)=>(q0(i,typeof e!="symbol"?e+"":e,t),t);const ye=require("react");var Y0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function X0(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function ls(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var $l={exports:{}},bs={};/*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */var No,Zu;function ap(){if(Zu)return No;Zu=1;var i=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function s(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;for(var a={},o=0;o<10;o++)a["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(a).map(function(h){return a[h]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(h){u[h]=h}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return No=s()?Object.assign:function(n,a){for(var o,l=r(n),u,h=1;h<arguments.length;h++){o=Object(arguments[h]);for(var d in o)e.call(o,d)&&(l[d]=o[d]);if(i){u=i(o);for(var g=0;g<u.length;g++)t.call(o,u[g])&&(l[u[g]]=o[u[g]])}}return l},No}/** @license React v17.0.2
6
+ * react-jsx-runtime.production.min.js
7
+ *
8
+ * Copyright (c) Facebook, Inc. and its affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */var eh;function Q0(){if(eh)return bs;eh=1,ap();var i=ye,e=60103;if(bs.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var t=Symbol.for;e=t("react.element"),bs.Fragment=t("react.fragment")}var r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s=Object.prototype.hasOwnProperty,n={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,u){var h,d={},g=null,v=null;u!==void 0&&(g=""+u),l.key!==void 0&&(g=""+l.key),l.ref!==void 0&&(v=l.ref);for(h in l)s.call(l,h)&&!n.hasOwnProperty(h)&&(d[h]=l[h]);if(o&&o.defaultProps)for(h in l=o.defaultProps,l)d[h]===void 0&&(d[h]=l[h]);return{$$typeof:e,type:o,key:g,ref:v,props:d,_owner:r.current}}return bs.jsx=a,bs.jsxs=a,bs}var Bo={},th;function J0(){return th||(th=1,function(i){var e={};/** @license React v17.0.2
13
+ * react-jsx-runtime.development.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */e.NODE_ENV!=="production"&&function(){var t=ye,r=ap(),s=60103,n=60106;i.Fragment=60107;var a=60108,o=60114,l=60109,u=60110,h=60112,d=60113,g=60120,v=60115,y=60116,b=60121,E=60122,A=60117,M=60129,D=60131;if(typeof Symbol=="function"&&Symbol.for){var B=Symbol.for;s=B("react.element"),n=B("react.portal"),i.Fragment=B("react.fragment"),a=B("react.strict_mode"),o=B("react.profiler"),l=B("react.provider"),u=B("react.context"),h=B("react.forward_ref"),d=B("react.suspense"),g=B("react.suspense_list"),v=B("react.memo"),y=B("react.lazy"),b=B("react.block"),E=B("react.server.block"),A=B("react.fundamental"),B("react.scope"),B("react.opaque.id"),M=B("react.debug_trace_mode"),B("react.offscreen"),D=B("react.legacy_hidden")}var N=typeof Symbol=="function"&&Symbol.iterator,J="@@iterator";function Z(z){if(z===null||typeof z!="object")return null;var be=N&&z[N]||z[J];return typeof be=="function"?be:null}var se=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Q(z){{for(var be=arguments.length,we=new Array(be>1?be-1:0),Ue=1;Ue<be;Ue++)we[Ue-1]=arguments[Ue];q("error",z,we)}}function q(z,be,we){{var Ue=se.ReactDebugCurrentFrame,Fe=Ue.getStackAddendum();Fe!==""&&(be+="%s",we=we.concat([Fe]));var ct=we.map(function(tt){return""+tt});ct.unshift("Warning: "+be),Function.prototype.apply.call(console[z],console,ct)}}var oe=!1;function ge(z){return!!(typeof z=="string"||typeof z=="function"||z===i.Fragment||z===o||z===M||z===a||z===d||z===g||z===D||oe||typeof z=="object"&&z!==null&&(z.$$typeof===y||z.$$typeof===v||z.$$typeof===l||z.$$typeof===u||z.$$typeof===h||z.$$typeof===A||z.$$typeof===b||z[0]===E))}function he(z,be,we){var Ue=be.displayName||be.name||"";return z.displayName||(Ue!==""?we+"("+Ue+")":we)}function Ee(z){return z.displayName||"Context"}function Te(z){if(z==null)return null;if(typeof z.tag=="number"&&Q("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof z=="function")return z.displayName||z.name||null;if(typeof z=="string")return z;switch(z){case i.Fragment:return"Fragment";case n:return"Portal";case o:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case g:return"SuspenseList"}if(typeof z=="object")switch(z.$$typeof){case u:var be=z;return Ee(be)+".Consumer";case l:var we=z;return Ee(we._context)+".Provider";case h:return he(z,z.render,"ForwardRef");case v:return Te(z.type);case b:return Te(z._render);case y:{var Ue=z,Fe=Ue._payload,ct=Ue._init;try{return Te(ct(Fe))}catch{return null}}}return null}var ue=0,pe,Ce,me,Se,We,$e,Xe;function rt(){}rt.__reactDisabledLog=!0;function et(){{if(ue===0){pe=console.log,Ce=console.info,me=console.warn,Se=console.error,We=console.group,$e=console.groupCollapsed,Xe=console.groupEnd;var z={configurable:!0,enumerable:!0,value:rt,writable:!0};Object.defineProperties(console,{info:z,log:z,warn:z,error:z,group:z,groupCollapsed:z,groupEnd:z})}ue++}}function ot(){{if(ue--,ue===0){var z={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:r({},z,{value:pe}),info:r({},z,{value:Ce}),warn:r({},z,{value:me}),error:r({},z,{value:Se}),group:r({},z,{value:We}),groupCollapsed:r({},z,{value:$e}),groupEnd:r({},z,{value:Xe})})}ue<0&&Q("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Je=se.ReactCurrentDispatcher,vt;function Rt(z,be,we){{if(vt===void 0)try{throw Error()}catch(Fe){var Ue=Fe.stack.trim().match(/\n( *(at )?)/);vt=Ue&&Ue[1]||""}return`
20
+ `+vt+z}}var Sr=!1,ke;{var hr=typeof WeakMap=="function"?WeakMap:Map;ke=new hr}function sr(z,be){if(!z||Sr)return"";{var we=ke.get(z);if(we!==void 0)return we}var Ue;Sr=!0;var Fe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ct;ct=Je.current,Je.current=null,et();try{if(be){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(wr){Ue=wr}Reflect.construct(z,[],tt)}else{try{tt.call()}catch(wr){Ue=wr}z.call(tt.prototype)}}else{try{throw Error()}catch(wr){Ue=wr}z()}}catch(wr){if(wr&&Ue&&typeof wr.stack=="string"){for(var Ze=wr.stack.split(`
21
+ `),$t=Ue.stack.split(`
22
+ `),xt=Ze.length-1,Et=$t.length-1;xt>=1&&Et>=0&&Ze[xt]!==$t[Et];)Et--;for(;xt>=1&&Et>=0;xt--,Et--)if(Ze[xt]!==$t[Et]){if(xt!==1||Et!==1)do if(xt--,Et--,Et<0||Ze[xt]!==$t[Et]){var Tr=`
23
+ `+Ze[xt].replace(" at new "," at ");return typeof z=="function"&&ke.set(z,Tr),Tr}while(xt>=1&&Et>=0);break}}}finally{Sr=!1,Je.current=ct,ot(),Error.prepareStackTrace=Fe}var Si=z?z.displayName||z.name:"",sa=Si?Rt(Si):"";return typeof z=="function"&&ke.set(z,sa),sa}function $i(z,be,we){return sr(z,!1)}function Ui(z){var be=z.prototype;return!!(be&&be.isReactComponent)}function Zr(z,be,we){if(z==null)return"";if(typeof z=="function")return sr(z,Ui(z));if(typeof z=="string")return Rt(z);switch(z){case d:return Rt("Suspense");case g:return Rt("SuspenseList")}if(typeof z=="object")switch(z.$$typeof){case h:return $i(z.render);case v:return Zr(z.type,be,we);case b:return $i(z._render);case y:{var Ue=z,Fe=Ue._payload,ct=Ue._init;try{return Zr(ct(Fe),be,we)}catch{}}}return""}var Gi={},xr=se.ReactDebugCurrentFrame;function ei(z){if(z){var be=z._owner,we=Zr(z.type,z._source,be?be.type:null);xr.setExtraStackFrame(we)}else xr.setExtraStackFrame(null)}function vi(z,be,we,Ue,Fe){{var ct=Function.call.bind(Object.prototype.hasOwnProperty);for(var tt in z)if(ct(z,tt)){var Ze=void 0;try{if(typeof z[tt]!="function"){var $t=Error((Ue||"React class")+": "+we+" type `"+tt+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof z[tt]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw $t.name="Invariant Violation",$t}Ze=z[tt](be,tt,Ue,we,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(xt){Ze=xt}Ze&&!(Ze instanceof Error)&&(ei(Fe),Q("%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).",Ue||"React class",we,tt,typeof Ze),ei(null)),Ze instanceof Error&&!(Ze.message in Gi)&&(Gi[Ze.message]=!0,ei(Fe),Q("Failed %s type: %s",we,Ze.message),ei(null))}}}var Dr=se.ReactCurrentOwner,br=Object.prototype.hasOwnProperty,Oe={key:!0,ref:!0,__self:!0,__source:!0},St,Or,cs;cs={};function us(z){if(br.call(z,"ref")){var be=Object.getOwnPropertyDescriptor(z,"ref").get;if(be&&be.isReactWarning)return!1}return z.ref!==void 0}function Jn(z){if(br.call(z,"key")){var be=Object.getOwnPropertyDescriptor(z,"key").get;if(be&&be.isReactWarning)return!1}return z.key!==void 0}function Zn(z,be){if(typeof z.ref=="string"&&Dr.current&&be&&Dr.current.stateNode!==be){var we=Te(Dr.current.type);cs[we]||(Q('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',Te(Dr.current.type),z.ref),cs[we]=!0)}}function To(z,be){{var we=function(){St||(St=!0,Q("%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)",be))};we.isReactWarning=!0,Object.defineProperty(z,"key",{get:we,configurable:!0})}}function fr(z,be){{var we=function(){Or||(Or=!0,Q("%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)",be))};we.isReactWarning=!0,Object.defineProperty(z,"ref",{get:we,configurable:!0})}}var ti=function(z,be,we,Ue,Fe,ct,tt){var Ze={$$typeof:s,type:z,key:be,ref:we,props:tt,_owner:ct};return Ze._store={},Object.defineProperty(Ze._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ze,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Ue}),Object.defineProperty(Ze,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Fe}),Object.freeze&&(Object.freeze(Ze.props),Object.freeze(Ze)),Ze};function ea(z,be,we,Ue,Fe){{var ct,tt={},Ze=null,$t=null;we!==void 0&&(Ze=""+we),Jn(be)&&(Ze=""+be.key),us(be)&&($t=be.ref,Zn(be,Fe));for(ct in be)br.call(be,ct)&&!Oe.hasOwnProperty(ct)&&(tt[ct]=be[ct]);if(z&&z.defaultProps){var xt=z.defaultProps;for(ct in xt)tt[ct]===void 0&&(tt[ct]=xt[ct])}if(Ze||$t){var Et=typeof z=="function"?z.displayName||z.name||"Unknown":z;Ze&&To(tt,Et),$t&&fr(tt,Et)}return ti(z,Ze,$t,Fe,Ue,Dr.current,tt)}}var hs=se.ReactCurrentOwner,ta=se.ReactDebugCurrentFrame;function yi(z){if(z){var be=z._owner,we=Zr(z.type,z._source,be?be.type:null);ta.setExtraStackFrame(we)}else ta.setExtraStackFrame(null)}var fs;fs=!1;function ds(z){return typeof z=="object"&&z!==null&&z.$$typeof===s}function Vi(){{if(hs.current){var z=Te(hs.current.type);if(z)return`
24
+
25
+ Check the render method of \``+z+"`."}return""}}function ps(z){return""}var ji={};function wo(z){{var be=Vi();if(!be){var we=typeof z=="string"?z:z.displayName||z.name;we&&(be=`
26
+
27
+ Check the top-level render call using <`+we+">.")}return be}}function ra(z,be){{if(!z._store||z._store.validated||z.key!=null)return;z._store.validated=!0;var we=wo(be);if(ji[we])return;ji[we]=!0;var Ue="";z&&z._owner&&z._owner!==hs.current&&(Ue=" It was passed a child from "+Te(z._owner.type)+"."),yi(z),Q('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',we,Ue),yi(null)}}function ia(z,be){{if(typeof z!="object")return;if(Array.isArray(z))for(var we=0;we<z.length;we++){var Ue=z[we];ds(Ue)&&ra(Ue,be)}else if(ds(z))z._store&&(z._store.validated=!0);else if(z){var Fe=Z(z);if(typeof Fe=="function"&&Fe!==z.entries)for(var ct=Fe.call(z),tt;!(tt=ct.next()).done;)ds(tt.value)&&ra(tt.value,be)}}}function Ao(z){{var be=z.type;if(be==null||typeof be=="string")return;var we;if(typeof be=="function")we=be.propTypes;else if(typeof be=="object"&&(be.$$typeof===h||be.$$typeof===v))we=be.propTypes;else return;if(we){var Ue=Te(be);vi(we,z.props,"prop",Ue,z)}else if(be.PropTypes!==void 0&&!fs){fs=!0;var Fe=Te(be);Q("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Fe||"Unknown")}typeof be.getDefaultProps=="function"&&!be.getDefaultProps.isReactClassApproved&&Q("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function _e(z){{for(var be=Object.keys(z.props),we=0;we<be.length;we++){var Ue=be[we];if(Ue!=="children"&&Ue!=="key"){yi(z),Q("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ue),yi(null);break}}z.ref!==null&&(yi(z),Q("Invalid attribute `ref` supplied to `React.Fragment`."),yi(null))}}function _t(z,be,we,Ue,Fe,ct){{var tt=ge(z);if(!tt){var Ze="";(z===void 0||typeof z=="object"&&z!==null&&Object.keys(z).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=ps();$t?Ze+=$t:Ze+=Vi();var xt;z===null?xt="null":Array.isArray(z)?xt="array":z!==void 0&&z.$$typeof===s?(xt="<"+(Te(z.type)||"Unknown")+" />",Ze=" Did you accidentally export a JSX literal instead of a component?"):xt=typeof z,Q("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=ea(z,be,we,Fe,ct);if(Et==null)return Et;if(tt){var Tr=be.children;if(Tr!==void 0)if(Ue)if(Array.isArray(Tr)){for(var Si=0;Si<Tr.length;Si++)ia(Tr[Si],z);Object.freeze&&Object.freeze(Tr)}else Q("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 ia(Tr,z)}return z===i.Fragment?_e(Et):Ao(Et),Et}}function ri(z,be,we){return _t(z,be,we,!0)}function Er(z,be,we){return _t(z,be,we,!1)}var Dt=Er,zs=ri;i.jsx=Dt,i.jsxs=zs}()}(Bo)),Bo}var Z0={};Z0.NODE_ENV==="production"?$l.exports=Q0():$l.exports=J0();var Ye=$l.exports;const ev="_root_1e6x7_1",tv="_progress_1e6x7_8",rv="_pop_1e6x7_1",iv="_play_button_1e6x7_25",sv="_pause_button_1e6x7_26",nv="_play_icon_1e6x7_38",av="_mute_button_1e6x7_46",qi={root:ev,progress:tv,pop:rv,play_button:iv,pause_button:sv,play_icon:nv,mute_button:av},op=i=>{let e=i.httpHandler;return{setHttpHandler(t){e=t},httpHandler(){return e},updateHttpClientConfig(t,r){e.updateHttpClientConfig(t,r)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},lp=i=>({httpHandler:i.httpHandler()});var rh;(function(i){i.HEADER="header",i.QUERY="query"})(rh||(rh={}));var ih;(function(i){i.HEADER="header",i.QUERY="query"})(ih||(ih={}));var On;(function(i){i.HTTP="http",i.HTTPS="https"})(On||(On={}));var Ka;(function(i){i.MD5="md5",i.CRC32="crc32",i.CRC32C="crc32c",i.SHA1="sha1",i.SHA256="sha256"})(Ka||(Ka={}));var sh;(function(i){i[i.HEADER=0]="HEADER",i[i.TRAILER=1]="TRAILER"})(sh||(sh={}));const Ul="__smithy_context";var nh;(function(i){i.PROFILE="profile",i.SSO_SESSION="sso-session",i.SERVICES="services"})(nh||(nh={}));var ah;(function(i){i.HTTP_0_9="http/0.9",i.HTTP_1_0="http/1.0",i.TDS_8_0="tds/8.0"})(ah||(ah={}));class kr{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 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(){const e=new kr({...this,headers:{...this.headers}});return e.query&&(e.query=ov(e.query)),e}}function ov(i){return Object.keys(i).reduce((e,t)=>{const r=i[t];return{...e,[t]:Array.isArray(r)?[...r]:r}},{})}class za{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 lv=i=>e=>async t=>{if(!kr.isInstance(t.request))return e(t);const{request:r}=t,{handlerProtocol:s=""}=i.requestHandler.metadata||{};if(s.indexOf("h2")>=0&&!r.headers[":authority"])delete r.headers.host,r.headers[":authority"]=r.hostname+(r.port?":"+r.port:"");else if(!r.headers.host){let n=r.hostname;r.port!=null&&(n+=`:${r.port}`),r.headers.host=n}return e(t)},cv={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},cp=i=>({applyToStack:e=>{e.add(lv(i),cv)}}),uv=()=>(i,e)=>async t=>{var r,s;try{const n=await i(t),{clientName:a,commandName:o,logger:l,dynamoDbDocumentClientOptions:u={}}=e,{overrideInputFilterSensitiveLog:h,overrideOutputFilterSensitiveLog:d}=u,g=h??e.inputFilterSensitiveLog,v=d??e.outputFilterSensitiveLog,{$metadata:y,...b}=n.output;return(r=l==null?void 0:l.info)==null||r.call(l,{clientName:a,commandName:o,input:g(t.input),output:v(b),metadata:y}),n}catch(n){const{clientName:a,commandName:o,logger:l,dynamoDbDocumentClientOptions:u={}}=e,{overrideInputFilterSensitiveLog:h}=u,d=h??e.inputFilterSensitiveLog;throw(s=l==null?void 0:l.error)==null||s.call(l,{clientName:a,commandName:o,input:d(t.input),error:n,metadata:n.$metadata}),n}},hv={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},up=i=>({applyToStack:e=>{e.add(uv(),hv)}});var oh={};const lh="X-Amzn-Trace-Id",fv="AWS_LAMBDA_FUNCTION_NAME",dv="_X_AMZN_TRACE_ID",pv=i=>e=>async t=>{const{request:r}=t;if(!kr.isInstance(r)||i.runtime!=="node"||r.headers.hasOwnProperty(lh))return e(t);const s=oh[fv],n=oh[dv],a=o=>typeof o=="string"&&o.length>0;return a(s)&&a(n)&&(r.headers[lh]=n),e({...t,request:r})},gv={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},hp=i=>({applyToStack:e=>{e.add(pv(i),gv)}});function fp(i){return{...i,customUserAgent:typeof i.customUserAgent=="string"?[[i.customUserAgent]]:i.customUserAgent}}const mv=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}$"),dp=i=>mv.test(i)||i.startsWith("[")&&i.endsWith("]"),vv=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Lc=(i,e=!1)=>{if(!e)return vv.test(i);const t=i.split(".");for(const r of t)if(!Lc(r))return!1;return!0},Mn={},Fn="endpoints";function Ni(i){return typeof i!="object"||i==null?i:"ref"in i?`$${Ni(i.ref)}`:"fn"in i?`${i.fn}(${(i.argv||[]).map(Ni).join(", ")})`:JSON.stringify(i,null,2)}class cr extends Error{constructor(e){super(e),this.name="EndpointError"}}const yv=(i,e)=>i===e,Sv=i=>{const e=i.split("."),t=[];for(const r of e){const s=r.indexOf("[");if(s!==-1){if(r.indexOf("]")!==r.length-1)throw new cr(`Path: '${i}' does not end with ']'`);const n=r.slice(s+1,-1);if(Number.isNaN(parseInt(n)))throw new cr(`Invalid array index: '${n}' in path: '${i}'`);s!==0&&t.push(r.slice(0,s)),t.push(n)}else t.push(r)}return t},pp=(i,e)=>Sv(e).reduce((t,r)=>{if(typeof t!="object")throw new cr(`Index '${r}' in '${e}' not found in '${JSON.stringify(i)}'`);return Array.isArray(t)?t[parseInt(r)]:t[r]},i),xv=i=>i!=null,bv=i=>!i,$o={[On.HTTP]:80,[On.HTTPS]:443},Ev=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:b="",query:E={}}=i,A=new URL(`${y}//${g}${v?`:${v}`:""}${b}`);return A.search=Object.entries(E).map(([M,D])=>`${M}=${D}`).join("&"),A}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:r,hostname:s,pathname:n,protocol:a,search:o}=e;if(o)return null;const l=a.slice(0,-1);if(!Object.values(On).includes(l))return null;const u=dp(s),h=t.includes(`${r}:${$o[l]}`)||typeof i=="string"&&i.includes(`${r}:${$o[l]}`),d=`${r}${h?`:${$o[l]}`:""}`;return{scheme:l,authority:d,path:n,normalizedPath:n.endsWith("/")?n:`${n}/`,isIp:u}},Tv=(i,e)=>i===e,wv=(i,e,t,r)=>e>=t||i.length<t?null:r?i.substring(i.length-t,i.length-e):i.substring(e,t),Av=i=>encodeURIComponent(i).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),_v={booleanEquals:yv,getAttr:pp,isSet:xv,isValidHostLabel:Lc,not:bv,parseURL:Ev,stringEquals:Tv,substring:wv,uriEncode:Av},gp=(i,e)=>{const t=[],r={...e.endpointParams,...e.referenceRecord};let s=0;for(;s<i.length;){const n=i.indexOf("{",s);if(n===-1){t.push(i.slice(s));break}t.push(i.slice(s,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)),s=a+2);const o=i.substring(n+1,a);if(o.includes("#")){const[l,u]=o.split("#");t.push(pp(r[l],u))}else t.push(r[o]);s=a+1}return t.join("")},Cv=({ref:i},e)=>({...e.endpointParams,...e.referenceRecord})[i],mo=(i,e,t)=>{if(typeof i=="string")return gp(i,t);if(i.fn)return mp(i,t);if(i.ref)return Cv(i,t);throw new cr(`'${e}': ${String(i)} is not a string, function or reference.`)},mp=({fn:i,argv:e},t)=>{const r=e.map(n=>["boolean","number"].includes(typeof n)?n:mo(n,"arg",t)),s=i.split(".");return s[0]in Mn&&s[1]!=null?Mn[s[0]][s[1]](...r):_v[i](...r)},Lv=({assign:i,...e},t)=>{var s,n;if(i&&i in t.referenceRecord)throw new cr(`'${i}' is already defined in Reference Record.`);const r=mp(e,t);return(n=(s=t.logger)==null?void 0:s.debug)==null||n.call(s,`${Fn} evaluateCondition: ${Ni(e)} = ${Ni(r)}`),{result:r===""?!0:!!r,...i!=null&&{toAssign:{name:i,value:r}}}},Rc=(i=[],e)=>{var r,s;const t={};for(const n of i){const{result:a,toAssign:o}=Lv(n,{...e,referenceRecord:{...e.referenceRecord,...t}});if(!a)return{result:a};o&&(t[o.name]=o.value,(s=(r=e.logger)==null?void 0:r.debug)==null||s.call(r,`${Fn} assign: ${o.name} := ${Ni(o.value)}`))}return{result:!0,referenceRecord:t}},Rv=(i,e)=>Object.entries(i).reduce((t,[r,s])=>({...t,[r]:s.map(n=>{const a=mo(n,"Header value entry",e);if(typeof a!="string")throw new cr(`Header '${r}' value '${a}' is not a string`);return a})}),{}),vp=(i,e)=>{if(Array.isArray(i))return i.map(t=>vp(t,e));switch(typeof i){case"string":return gp(i,e);case"object":if(i===null)throw new cr(`Unexpected endpoint property: ${i}`);return yp(i,e);case"boolean":return i;default:throw new cr(`Unexpected endpoint property type: ${typeof i}`)}},yp=(i,e)=>Object.entries(i).reduce((t,[r,s])=>({...t,[r]:vp(s,e)}),{}),Iv=(i,e)=>{const t=mo(i,"Endpoint URL",e);if(typeof t=="string")try{return new URL(t)}catch(r){throw console.error(`Failed to construct URL with ${t}`,r),r}throw new cr(`Endpoint URL must be a string, got ${typeof t}`)},Pv=(i,e)=>{var h,d;const{conditions:t,endpoint:r}=i,{result:s,referenceRecord:n}=Rc(t,e);if(!s)return;const a={...e,referenceRecord:{...e.referenceRecord,...n}},{url:o,properties:l,headers:u}=r;return(d=(h=e.logger)==null?void 0:h.debug)==null||d.call(h,`${Fn} Resolving endpoint from template: ${Ni(r)}`),{...u!=null&&{headers:Rv(u,a)},...l!=null&&{properties:yp(l,a)},url:Iv(o,a)}},kv=(i,e)=>{const{conditions:t,error:r}=i,{result:s,referenceRecord:n}=Rc(t,e);if(s)throw new cr(mo(r,"Error",{...e,referenceRecord:{...e.referenceRecord,...n}}))},Dv=(i,e)=>{const{conditions:t,rules:r}=i,{result:s,referenceRecord:n}=Rc(t,e);if(s)return Sp(r,{...e,referenceRecord:{...e.referenceRecord,...n}})},Sp=(i,e)=>{for(const t of i)if(t.type==="endpoint"){const r=Pv(t,e);if(r)return r}else if(t.type==="error")kv(t,e);else if(t.type==="tree"){const r=Dv(t,e);if(r)return r}else throw new cr(`Unknown endpoint rule: ${t}`);throw new cr("Rules evaluation failed")},xp=(i,e)=>{var u,h,d,g,v;const{endpointParams:t,logger:r}=e,{parameters:s,rules:n}=i;(h=(u=e.logger)==null?void 0:u.debug)==null||h.call(u,`${Fn} Initial EndpointParams: ${Ni(t)}`);const a=Object.entries(s).filter(([,y])=>y.default!=null).map(([y,b])=>[y,b.default]);if(a.length>0)for(const[y,b]of a)t[y]=t[y]??b;const o=Object.entries(s).filter(([,y])=>y.required).map(([y])=>y);for(const y of o)if(t[y]==null)throw new cr(`Missing required parameter: '${y}'`);const l=Sp(n,{endpointParams:t,logger:r,referenceRecord:{}});if((d=e.endpointParams)!=null&&d.Endpoint)try{const y=new URL(e.endpointParams.Endpoint),{protocol:b,port:E}=y;l.url.protocol=b,l.url.port=E}catch{}return(v=(g=e.logger)==null?void 0:g.debug)==null||v.call(g,`${Fn} Resolved endpoint: ${Ni(l)}`),l},bp=(i,e=!1)=>{if(e){for(const t of i.split("."))if(!bp(t))return!1;return!0}return!(!Lc(i)||i.length<3||i.length>63||i!==i.toLowerCase()||dp(i))},Ov=i=>{const e=i.split(":");if(e.length<6)return null;const[t,r,s,n,a,...o]=e;return t!=="arn"||r===""||s===""||o[0]===""?null:{partition:r,service:s,region:n,accountId:a,resourceId:o[0].includes("/")?o[0].split("/"):o}},Mv=[{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)"},"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:{}},{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:{}}],Fv="1.1",Nv={partitions:Mv,version:Fv};let Bv=Nv;const $v=i=>{const{partitions:e}=Bv;for(const r of e){const{regions:s,outputs:n}=r;for(const[a,o]of Object.entries(s))if(a===i)return{...n,...o}}for(const r of e){const{regionRegex:s,outputs:n}=r;if(new RegExp(s).test(i))return{...n}}const t=e.find(r=>r.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}},Ic={isVirtualHostableS3Bucket:bp,parseArn:Ov,partition:$v};Mn.aws=Ic;const ch="user-agent",Uo="x-amz-user-agent",uh=" ",Go="/",Uv=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Gv=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,hh="-",Vv=i=>(e,t)=>async r=>{var d,g;const{request:s}=r;if(!kr.isInstance(s))return e(r);const{headers:n}=s,a=((d=t==null?void 0:t.userAgent)==null?void 0:d.map(Vo))||[],o=(await i.defaultUserAgentProvider()).map(Vo),l=((g=i==null?void 0:i.customUserAgent)==null?void 0:g.map(Vo))||[],u=[].concat([...o,...a,...l]).join(uh),h=[...o.filter(v=>v.startsWith("aws-sdk-")),...l].join(uh);return i.runtime!=="browser"?(h&&(n[Uo]=n[Uo]?`${n[ch]} ${h}`:h),n[ch]=u):n[Uo]=u,e({...r,request:s})},Vo=i=>{var a;const e=i[0].split(Go).map(o=>o.replace(Uv,hh)).join(Go),t=(a=i[1])==null?void 0:a.replace(Gv,hh),r=e.indexOf(Go),s=e.substring(0,r);let n=e.substring(r+1);return s==="api"&&(n=n.toLowerCase()),[s,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}`}},"")},jv={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ep=i=>({applyToStack:e=>{e.add(Vv(i),jv)}});var fh;(function(i){i.ENV="env",i.CONFIG="shared config entry"})(fh||(fh={}));const Tp=!1,wp=!1,Xn=i=>i[Ul]||(i[Ul]={}),mi=i=>{if(typeof i=="function")return i;const e=Promise.resolve(i);return()=>e},Ap=i=>typeof i=="string"&&(i.startsWith("fips-")||i.endsWith("-fips")),dh=i=>Ap(i)?["fips-aws-global","aws-fips"].includes(i)?"us-east-1":i.replace(/fips-(dkr-|prod-)?|-fips/,""):i,_p=i=>{const{region:e,useFipsEndpoint:t}=i;if(!e)throw new Error("Region is missing");return{...i,region:async()=>{if(typeof e=="string")return dh(e);const r=await e();return dh(r)},useFipsEndpoint:async()=>{const r=typeof e=="string"?e:await e();return Ap(r)?!0:typeof t!="function"?Promise.resolve(!!t):t()}}};function Hv(i){const e=new Map;for(const t of i)e.set(t.schemeId,t);return e}const Kv=(i,e)=>(t,r)=>async s=>{var u;const n=i.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(i,r,s.input)),a=Hv(i.httpAuthSchemes),o=Xn(r),l=[];for(const h of n){const d=a.get(h.schemeId);if(!d){l.push(`HttpAuthScheme \`${h.schemeId}\` was not enabled for this service.`);continue}const g=d.identityProvider(await e.identityProviderConfigProvider(i));if(!g){l.push(`HttpAuthScheme \`${h.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:v={},signingProperties:y={}}=((u=h.propertiesExtractor)==null?void 0:u.call(h,i,r))||{};h.identityProperties=Object.assign(h.identityProperties||{},v),h.signingProperties=Object.assign(h.signingProperties||{},y),o.selectedHttpAuthScheme={httpAuthOption:h,identity:await g(h.identityProperties),signer:d.signer};break}if(!o.selectedHttpAuthScheme)throw new Error(l.join(`
28
+ `));return t(s)},zv=async i=>{const e=(i==null?void 0:i.Bucket)||"";if(typeof i.Bucket=="string"&&(i.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Qv(e)){if(i.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Xv(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},Wv=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,qv=/(\d+\.){3}\d+/,Yv=/\.\./,Xv=i=>Wv.test(i)&&!qv.test(i)&&!Yv.test(i),Qv=i=>{const[e,t,r,,,s]=i.split(":"),n=e==="arn"&&i.split(":").length>=6,a=!!(n&&t&&r&&s);if(n&&!a)throw new Error(`Invalid ARN: ${i} was an invalid ARN.`);return a},Jv=(i,e,t)=>{const r=async()=>{const s=t[i]??t[e];return typeof s=="function"?s():s};return i==="credentialScope"||e==="CredentialScope"?async()=>{const s=typeof t.credentials=="function"?await t.credentials():t.credentials;return(s==null?void 0:s.credentialScope)??(s==null?void 0:s.CredentialScope)}:i==="endpoint"||e==="endpoint"?async()=>{const s=await r();if(s&&typeof s=="object"){if("url"in s)return s.url.href;if("hostname"in s){const{protocol:n,hostname:a,port:o,path:l}=s;return`${n}//${a}${o?":"+o:""}${l}`}}return s}:r},Zv=async i=>{};function ey(i){const e={};if(i=i.replace(/^\?/,""),i)for(const t of i.split("&")){let[r,s=null]=t.split("=");r=decodeURIComponent(r),s&&(s=decodeURIComponent(s)),r in e?Array.isArray(e[r])?e[r].push(s):e[r]=[e[r],s]:e[r]=s}return e}const Nn=i=>{if(typeof i=="string")return Nn(new URL(i));const{hostname:e,pathname:t,port:r,protocol:s,search:n}=i;let a;return n&&(a=ey(n)),{hostname:e,port:r?parseInt(r):void 0,protocol:s,path:t,query:a}},Cp=i=>typeof i=="object"?"url"in i?Nn(i.url):i:Nn(i),ty=async(i,e,t,r)=>{if(!t.endpoint){const a=await Zv(t.serviceId||"");a&&(t.endpoint=()=>Promise.resolve(Cp(a)))}const s=await ry(i,e,t);if(typeof t.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return t.endpointProvider(s,r)},ry=async(i,e,t)=>{var n;const r={},s=((n=e==null?void 0:e.getEndpointParameterInstructions)==null?void 0:n.call(e))||{};for(const[a,o]of Object.entries(s))switch(o.type){case"staticContextParams":r[a]=o.value;break;case"contextParams":r[a]=i[o.name];break;case"clientContextParams":case"builtInParams":r[a]=await Jv(o.name,a,t)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return Object.keys(s).length===0&&Object.assign(r,t),String(t.serviceId).toLowerCase()==="s3"&&await zv(r),r},iy=({config:i,instructions:e})=>(t,r)=>async s=>{var o,l,u;const n=await ty(s.input,{getEndpointParameterInstructions(){return e}},{...i},r);r.endpointV2=n,r.authSchemes=(o=n.properties)==null?void 0:o.authSchemes;const a=(l=r.authSchemes)==null?void 0:l[0];if(a){r.signing_region=a.signingRegion,r.signing_service=a.signingName;const h=Xn(r),d=(u=h==null?void 0:h.selectedHttpAuthScheme)==null?void 0:u.httpAuthOption;d&&(d.signingProperties=Object.assign(d.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return t({...s})},sy=(i,e)=>t=>async r=>{const{response:s}=await t(r);try{const n=await e(s,i);return{response:s,output:n}}catch(n){if(Object.defineProperty(n,"$response",{value:s}),!("$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}},ny=(i,e)=>(t,r)=>async s=>{var o;const n=(o=r.endpointV2)!=null&&o.url&&i.urlParser?async()=>i.urlParser(r.endpointV2.url):i.endpoint;if(!n)throw new Error("No valid endpoint provider available.");const a=await e(s.input,{...i,endpoint:n});return t({...s,request:a})},ay={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Pc={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Lp(i,e,t){return{applyToStack:r=>{r.add(sy(i,t),ay),r.add(ny(i,e),Pc)}}}const Rp={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Pc.name},Ip=(i,e)=>({applyToStack:t=>{t.addRelativeTo(iy({config:i,instructions:e}),Rp)}}),Pp=i=>{const e=i.tls??!0,{endpoint:t}=i,r=t!=null?async()=>Cp(await mi(t)()):void 0;return{...i,endpoint:r,tls:e,isCustomEndpoint:!!t,useDualstackEndpoint:mi(i.useDualstackEndpoint??!1),useFipsEndpoint:mi(i.useFipsEndpoint??!1)}},oy={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Rp.name},kp=(i,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t})=>({applyToStack:r=>{r.addRelativeTo(Kv(i,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t}),oy)}});Pc.name;const ly=i=>e=>{throw e},cy=(i,e)=>{},uy=i=>(e,t)=>async r=>{if(!kr.isInstance(r.request))return e(r);const n=Xn(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({...r,request:await l.sign(r.request,o,a)}).catch((l.errorHandler||ly)(a));return(l.successHandler||cy)(u.response,a),u};var Ns;(function(i){i.STANDARD="standard",i.ADAPTIVE="adaptive"})(Ns||(Ns={}));const Bn=3,Dp=Ns.STANDARD,hy=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],fy=["TimeoutError","RequestTimeout","RequestTimeoutException"],dy=[500,502,503,504],py=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],gy=i=>{var e;return(e=i.$metadata)==null?void 0:e.clockSkewCorrected},Op=i=>{var e,t;return((e=i.$metadata)==null?void 0:e.httpStatusCode)===429||hy.includes(i.name)||((t=i.$retryable)==null?void 0:t.throttling)==!0},Mp=i=>{var e;return gy(i)||fy.includes(i.name)||py.includes((i==null?void 0:i.code)||"")||dy.includes(((e=i.$metadata)==null?void 0:e.httpStatusCode)||0)},my=i=>{var e;if(((e=i.$metadata)==null?void 0:e.httpStatusCode)!==void 0){const t=i.$metadata.httpStatusCode;return 500<=t&&t<=599&&!Mp(i)}return!1};class vy{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(r=>setTimeout(r,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(),Op(e)){const s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const r=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(r)}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 r=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(r*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const Gl=100,Fp=20*1e3,yy=500,ph=500,Sy=5,xy=10,by=1,Ey="amz-sdk-invocation-id",Ty="amz-sdk-request",wy=()=>{let i=Gl;return{computeNextBackoffDelay:r=>Math.floor(Math.min(Fp,Math.random()*2**r*i)),setDelayBase:r=>{i=r}}},gh=({retryDelay:i,retryCount:e,retryCost:t})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(Fp,i),getRetryCost:()=>t});class Np{constructor(e){this.maxAttempts=e,this.mode=Ns.STANDARD,this.capacity=ph,this.retryBackoffStrategy=wy(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return gh({retryDelay:Gl,retryCount:0})}async refreshRetryTokenForRetry(e,t){const r=await this.getMaxAttempts();if(this.shouldRetry(e,t,r)){const s=t.errorType;this.retryBackoffStrategy.setDelayBase(s==="THROTTLING"?yy:Gl);const n=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),a=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,n):n,o=this.getCapacityCost(s);return this.capacity-=o,gh({retryDelay:a,retryCount:e.getRetryCount()+1,retryCost:o})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(ph,this.capacity+(e.getRetryCost()??by))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${Bn}`),Bn}}shouldRetry(e,t,r){return e.getRetryCount()+1<r&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return e==="TRANSIENT"?xy:Sy}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class Ay{constructor(e,t){this.maxAttemptsProvider=e,this.mode=Ns.ADAPTIVE;const{rateLimiter:r}=t??{};this.rateLimiter=r??new vy,this.standardRetryStrategy=new Np(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 da;const _y=new Uint8Array(16);function Cy(){if(!da&&(da=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!da))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return da(_y)}const Gt=[];for(let i=0;i<256;++i)Gt.push((i+256).toString(16).slice(1));function Ly(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 Ry=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),mh={randomUUID:Ry};function Iy(i,e,t){if(mh.randomUUID&&!e&&!i)return mh.randomUUID();i=i||{};const r=i.random||(i.rng||Cy)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ly(r)}const Py=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}`),Bp=i=>{const{retryStrategy:e}=i,t=mi(i.maxAttempts??Bn);return{...i,maxAttempts:t,retryStrategy:async()=>e||(await mi(i.retryMode)()===Ns.ADAPTIVE?new Ay(t):new Np(t))}};class kc{trace(){}debug(){}info(){}warn(){}error(){}}const Yi=(i,e)=>{const t=[];if(i&&t.push(i),e)for(const r of e)t.push(r);return t},Ii=(i,e)=>`${i||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,Wa=()=>{let i=[],e=[],t=!1;const r=new Set,s=d=>d.sort((g,v)=>vh[v.step]-vh[g.step]||yh[v.priority||"normal"]-yh[g.priority||"normal"]),n=d=>{let g=!1;const v=y=>{const b=Yi(y.name,y.aliases);if(b.includes(d)){g=!0;for(const E of b)r.delete(E);return!1}return!0};return i=i.filter(v),e=e.filter(v),g},a=d=>{let g=!1;const v=y=>{if(y.middleware===d){g=!0;for(const b of Yi(y.name,y.aliases))r.delete(b);return!1}return!0};return i=i.filter(v),e=e.filter(v),g},o=d=>{var g;return i.forEach(v=>{d.add(v.middleware,{...v})}),e.forEach(v=>{d.addRelativeTo(v.middleware,{...v})}),(g=d.identifyOnResolve)==null||g.call(d,h.identifyOnResolve()),d},l=d=>{const g=[];return d.before.forEach(v=>{v.before.length===0&&v.after.length===0?g.push(v):g.push(...l(v))}),g.push(d),d.after.reverse().forEach(v=>{v.before.length===0&&v.after.length===0?g.push(v):g.push(...l(v))}),g},u=(d=!1)=>{const g=[],v=[],y={};return i.forEach(E=>{const A={...E,before:[],after:[]};for(const M of Yi(A.name,A.aliases))y[M]=A;g.push(A)}),e.forEach(E=>{const A={...E,before:[],after:[]};for(const M of Yi(A.name,A.aliases))y[M]=A;v.push(A)}),v.forEach(E=>{if(E.toMiddleware){const A=y[E.toMiddleware];if(A===void 0){if(d)return;throw new Error(`${E.toMiddleware} is not found when adding ${Ii(E.name,E.aliases)} middleware ${E.relation} ${E.toMiddleware}`)}E.relation==="after"&&A.after.push(E),E.relation==="before"&&A.before.push(E)}}),s(g).map(l).reduce((E,A)=>(E.push(...A),E),[])},h={add:(d,g={})=>{const{name:v,override:y,aliases:b}=g,E={step:"initialize",priority:"normal",middleware:d,...g},A=Yi(v,b);if(A.length>0){if(A.some(M=>r.has(M))){if(!y)throw new Error(`Duplicate middleware name '${Ii(v,b)}'`);for(const M of A){const D=i.findIndex(N=>{var J;return N.name===M||((J=N.aliases)==null?void 0:J.some(Z=>Z===M))});if(D===-1)continue;const B=i[D];if(B.step!==E.step||E.priority!==B.priority)throw new Error(`"${Ii(B.name,B.aliases)}" middleware with ${B.priority} priority in ${B.step} step cannot be overridden by "${Ii(v,b)}" middleware with ${E.priority} priority in ${E.step} step.`);i.splice(D,1)}}for(const M of A)r.add(M)}i.push(E)},addRelativeTo:(d,g)=>{const{name:v,override:y,aliases:b}=g,E={middleware:d,...g},A=Yi(v,b);if(A.length>0){if(A.some(M=>r.has(M))){if(!y)throw new Error(`Duplicate middleware name '${Ii(v,b)}'`);for(const M of A){const D=e.findIndex(N=>{var J;return N.name===M||((J=N.aliases)==null?void 0:J.some(Z=>Z===M))});if(D===-1)continue;const B=e[D];if(B.toMiddleware!==E.toMiddleware||B.relation!==E.relation)throw new Error(`"${Ii(B.name,B.aliases)}" middleware ${B.relation} "${B.toMiddleware}" middleware cannot be overridden by "${Ii(v,b)}" middleware ${E.relation} "${E.toMiddleware}" middleware.`);e.splice(D,1)}}for(const M of A)r.add(M)}e.push(E)},clone:()=>o(Wa()),use:d=>{d.applyToStack(h)},remove:d=>typeof d=="string"?n(d):a(d),removeByTag:d=>{let g=!1;const v=y=>{const{tags:b,name:E,aliases:A}=y;if(b&&b.includes(d)){const M=Yi(E,A);for(const D of M)r.delete(D);return g=!0,!1}return!0};return i=i.filter(v),e=e.filter(v),g},concat:d=>{var v;const g=o(Wa());return g.use(d),g.identifyOnResolve(t||g.identifyOnResolve()||(((v=d.identifyOnResolve)==null?void 0:v.call(d))??!1)),g},applyToStack:o,identify:()=>u(!0).map(d=>{const g=d.step??d.relation+" "+d.toMiddleware;return Ii(d.name,d.aliases)+" - "+g}),identifyOnResolve(d){return typeof d=="boolean"&&(t=d),t},resolve:(d,g)=>{for(const v of u().map(y=>y.middleware).reverse())d=v(d,g);return t&&console.log(h.identify()),d}};return h},vh={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},yh={high:3,normal:2,low:1};class $p{constructor(e){this.middlewareStack=Wa(),this.config=e}send(e,t,r){const s=typeof t!="function"?t:void 0,n=typeof t=="function"?t:r,a=e.resolveMiddleware(this.middlewareStack,this.config,s);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 Bi={},Vs=new Array(64);for(let i=0,e=65,t=90;i+e<=t;i++){const r=String.fromCharCode(i+e);Bi[r]=i,Vs[i]=r}for(let i=0,e=97,t=122;i+e<=t;i++){const r=String.fromCharCode(i+e),s=i+26;Bi[r]=s,Vs[s]=r}for(let i=0;i<10;i++){Bi[i.toString(10)]=i+52;const e=i.toString(10),t=i+52;Bi[e]=t,Vs[t]=e}Bi["+"]=62;Vs[62]="+";Bi["/"]=63;Vs[63]="/";const Ds=6,An=8,ky=63,vo=i=>{let e=i.length/4*3;i.slice(-2)==="=="?e-=2:i.slice(-1)==="="&&e--;const t=new ArrayBuffer(e),r=new DataView(t);for(let s=0;s<i.length;s+=4){let n=0,a=0;for(let u=s,h=s+3;u<=h;u++)if(i[u]!=="="){if(!(i[u]in Bi))throw new TypeError(`Invalid character ${i[u]} in base64 string.`);n|=Bi[i[u]]<<(h-u)*Ds,a+=Ds}else n>>=Ds;const o=s/4*3;n>>=a%An;const l=Math.floor(a/An);for(let u=0;u<l;u++){const h=(l-u-1)*An;r.setUint8(o+u,(n&255<<h)>>h)}}return new Uint8Array(t)},ns=i=>new TextEncoder().encode(i),_n=i=>typeof i=="string"?ns(i):ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(i),Dc=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 Oc(i){let e;typeof i=="string"?e=ns(i):e=i;const t=typeof e=="object"&&typeof e.length=="number",r=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!t&&!r)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let s="";for(let n=0;n<e.length;n+=3){let a=0,o=0;for(let u=n,h=Math.min(n+3,e.length);u<h;u++)a|=e[u]<<(h-u-1)*An,o+=An;const l=Math.ceil(o/Ds);a<<=l*Ds-o;for(let u=1;u<=l;u++){const h=(l-u)*Ds;s+=Vs[(a&ky<<h)>>h]}s+="==".slice(0,4-l)}return s}function Dy(i,e="utf-8"){return e==="base64"?Oc(i):Dc(i)}function Oy(i,e){return e==="base64"?rs.mutate(vo(i)):rs.mutate(ns(i))}class rs extends Uint8Array{static fromString(e,t="utf-8"){switch(typeof e){case"string":return Oy(e,t);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,rs.prototype),e}transformToString(e="utf-8"){return Dy(this,e)}}const Mi=i=>encodeURIComponent(i).replace(/[!'()*]/g,My),My=i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`;function Fy(i){const e=[];for(let t of Object.keys(i).sort()){const r=i[t];if(t=Mi(t),Array.isArray(r))for(let s=0,n=r.length;s<n;s++)e.push(`${t}=${Mi(r[s])}`);else{let s=t;(r||typeof r=="string")&&(s+=`=${Mi(r)}`),e.push(s)}}return e.join("&")}function Ny(i=0){return new Promise((e,t)=>{i&&setTimeout(()=>{const r=new Error(`Request did not complete within ${i} ms`);r.name="TimeoutError",t(r)},i)})}const By={supported:typeof Request<"u"&&"keepalive"in new Request("https://[::1]")};class yo{static create(e){return typeof(e==null?void 0:e.handle)=="function"?e:new yo(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(t=>t||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config))}destroy(){}async handle(e,{abortSignal:t}={}){this.config||(this.config=await this.configProvider);const r=this.config.requestTimeout,s=this.config.keepAlive===!0;if(t!=null&&t.aborted){const b=new Error("Request aborted");return b.name="AbortError",Promise.reject(b)}let n=e.path;const a=Fy(e.query||{});a&&(n+=`?${a}`),e.fragment&&(n+=`#${e.fragment}`);let o="";if(e.username!=null||e.password!=null){const b=e.username??"",E=e.password??"";o=`${b}:${E}@`}const{port:l,method:u}=e,h=`${e.protocol}//${o}${e.hostname}${l?`:${l}`:""}${n}`,d=u==="GET"||u==="HEAD"?void 0:e.body,g={body:d,headers:new Headers(e.headers),method:u};d&&(g.duplex="half"),typeof AbortController<"u"&&(g.signal=t),By.supported&&(g.keepalive=s);const v=new Request(h,g),y=[fetch(v).then(b=>{const E=b.headers,A={};for(const D of E.entries())A[D[0]]=D[1];return b.body!=null?{response:new za({headers:A,reason:b.statusText,statusCode:b.status,body:b.body})}:b.blob().then(D=>({response:new za({headers:A,reason:b.statusText,statusCode:b.status,body:D})}))}),Ny(r)];return t&&y.push(new Promise((b,E)=>{t.onabort=()=>{const A=new Error("Request aborted");A.name="AbortError",E(A)}})),Promise.race(y)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(r=>(r[e]=t,r))}httpHandlerConfigs(){return this.config??{}}}const Up=i=>typeof Blob=="function"&&i instanceof Blob?$y(i):Uy(i);async function $y(i){const e=await Gy(i),t=vo(e);return new Uint8Array(t)}async function Uy(i){const e=[],t=i.getReader();let r=!1,s=0;for(;!r;){const{done:o,value:l}=await t.read();l&&(e.push(l),s+=l.length),r=o}const n=new Uint8Array(s);let a=0;for(const o of e)n.set(o,a),a+=o.length;return n}function Gy(i){return new Promise((e,t)=>{const r=new FileReader;r.onloadend=()=>{if(r.readyState!==2)return t(new Error("Reader aborted too early"));const s=r.result??"",n=s.indexOf(","),a=n>-1?n+1:s.length;e(s.substring(a))},r.onabort=()=>t(new Error("Read aborted")),r.onerror=()=>t(r.error),r.readAsDataURL(i)})}const Gp={},Vl={};for(let i=0;i<256;i++){let e=i.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Gp[i]=e,Vl[e]=i}function Vp(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 r=i.slice(t,t+2).toLowerCase();if(r in Vl)e[t/2]=Vl[r];else throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return e}function lr(i){let e="";for(let t=0;t<i.byteLength;t++)e+=Gp[i[t]];return e}const Vy=async(i=new Uint8Array,e)=>{if(i instanceof Uint8Array)return rs.mutate(i);if(!i)return rs.mutate(new Uint8Array);const t=e.streamCollector(i);return rs.mutate(await t)};class Mc{constructor(){this.middlewareStack=Wa()}static classBuilder(){return new jy}resolveMiddlewareWithContext(e,t,r,{middlewareFn:s,clientName:n,commandName:a,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,smithyContext:u,additionalContext:h,CommandCtor:d}){for(const E of s.bind(this)(d,e,t,r))this.middlewareStack.use(E);const g=e.concat(this.middlewareStack),{logger:v}=t,y={logger:v,clientName:n,commandName:a,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,[Ul]:{...u},...h},{requestHandler:b}=t;return g.resolve(E=>b.handle(E.request,r||{}),y)}}class jy{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,r={}){return this._smithyContext={service:e,operation:t,...r},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=r=>r,t=r=>r){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 Mc{static getEndpointParameterInstructions(){return e._ep}constructor(...[r]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=r??{},e._init(this)}resolveMiddleware(r,s,n){return this.resolveMiddlewareWithContext(r,s,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 So extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,So.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const jt=(i,e={})=>{Object.entries(e).filter(([,r])=>r!==void 0).forEach(([r,s])=>{(i[r]==null||i[r]==="")&&(i[r]=s)});const t=i.message||i.Message||"UnknownError";return i.message=t,delete i.Message,i},Hy=({output:i,parsedBody:e,exceptionCtor:t,errorCode:r})=>{const s=Ky(i),n=s.httpStatusCode?s.httpStatusCode+"":void 0,a=new t({name:(e==null?void 0:e.code)||(e==null?void 0:e.Code)||r||n||"UnknownError",$fault:"client",$metadata:s});throw jt(a,e)},jp=i=>({output:e,parsedBody:t,errorCode:r})=>{Hy({output:e,parsedBody:t,exceptionCtor:i,errorCode:r})},Ky=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"]}),Hp=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{}}},zy=i=>{const e=[];for(const t in Ka){const r=Ka[t];i[r]!==void 0&&e.push({algorithmId:()=>r,checksumConstructor:()=>i[r]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(t){this._checksumAlgorithms.push(t)},checksumAlgorithms(){return this._checksumAlgorithms}}},Wy=i=>{const e={};return i.checksumAlgorithms().forEach(t=>{e[t.algorithmId()]=t.checksumConstructor()}),e},qy=i=>{let e=i.retryStrategy;return{setRetryStrategy(t){e=t},retryStrategy(){return e}}},Yy=i=>{const e={};return e.retryStrategy=i.retryStrategy(),e},Kp=i=>({...zy(i),...qy(i)}),zp=i=>({...Wy(i),...Yy(i)}),jl=function(){const i=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),t=new e;return Object.setPrototypeOf(t,i.prototype),t};jl.prototype=Object.create(String.prototype,{constructor:{value:jl,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(jl,String);const Wp=(i,e)=>{const t={};for(const r in e)Xy(t,i,e,r);return t},Xy=(i,e,t,r)=>{if(e!==null){let a=t[r];typeof a=="function"&&(a=[,a]);const[o=Qy,l=Jy,u=r]=a;(typeof o=="function"&&o(e[u])||typeof o!="function"&&o)&&(i[r]=l(e[u]));return}let[s,n]=t[r];if(typeof n=="function"){let a;const o=s===void 0&&(a=n())!=null,l=typeof s=="function"&&!!s(void 0)||typeof s!="function"&&!!s;o?i[r]=a:l&&(i[r]=n())}else{const a=s===void 0&&n!=null,o=typeof s=="function"&&!!s(n)||typeof s!="function"&&!!s;(a||o)&&(i[r]=n)}},Qy=i=>i!=null,Jy=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},Zy=i=>(i==null?void 0:i.body)instanceof ReadableStream,eS=i=>(e,t)=>async r=>{var a;let s=await i.retryStrategy();const n=await i.maxAttempts();if(tS(s)){s=s;let o=await s.acquireInitialRetryToken(t.partition_id),l=new Error,u=0,h=0;const{request:d}=r,g=kr.isInstance(d);for(g&&(d.headers[Ey]=Iy());;)try{g&&(d.headers[Ty]=`attempt=${u+1}; max=${n}`);const{response:v,output:y}=await e(r);return s.recordSuccess(o),y.$metadata.attempts=u+1,y.$metadata.totalRetryDelay=h,{response:v,output:y}}catch(v){const y=rS(v);if(l=Py(v),g&&Zy(d))throw(a=t.logger instanceof kc?console:t.logger)==null||a.warn("An error was encountered in a non-retryable streaming request."),l;try{o=await s.refreshRetryTokenForRetry(o,y)}catch{throw l.$metadata||(l.$metadata={}),l.$metadata.attempts=u+1,l.$metadata.totalRetryDelay=h,l}u=o.getRetryCount();const b=o.getRetryDelay();h+=b,await new Promise(E=>setTimeout(E,b))}}else return s=s,s!=null&&s.mode&&(t.userAgent=[...t.userAgent||[],["cfg/retry-mode",s.mode]]),s.retry(e,r)},tS=i=>typeof i.acquireInitialRetryToken<"u"&&typeof i.refreshRetryTokenForRetry<"u"&&typeof i.recordSuccess<"u",rS=i=>{const e={error:i,errorType:iS(i)},t=sS(i.$response);return t&&(e.retryAfterHint=t),e},iS=i=>Op(i)?"THROTTLING":Mp(i)?"TRANSIENT":my(i)?"SERVER_ERROR":"CLIENT_ERROR",qp={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Yp=i=>({applyToStack:e=>{e.add(eS(i),qp)}}),sS=i=>{if(!za.isInstance(i))return;const e=Object.keys(i.headers).find(n=>n.toLowerCase()==="retry-after");if(!e)return;const t=i.headers[e],r=Number(t);return Number.isNaN(r)?new Date(t):new Date(r*1e3)},nS={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:qp.name},Xp=i=>({applyToStack:e=>{e.addRelativeTo(uy(),nS)}});class Qp{constructor(e){this.authSchemes=new Map;for(const[t,r]of Object.entries(e))r!==void 0&&this.authSchemes.set(t,r)}getIdentityProvider(e){return this.authSchemes.get(e)}}class aS{async sign(e,t,r){return e}}const oS=i=>e=>Jp(e)&&e.expiration.getTime()-Date.now()<i,lS=3e5,cS=oS(lS),Jp=i=>i.expiration!==void 0,uS=(i,e,t)=>{if(i===void 0)return;const r=typeof i!="function"?async()=>Promise.resolve(i):i;let s,n,a,o=!1;const l=async u=>{n||(n=r(u));try{s=await n,a=!0,o=!1}finally{n=void 0}return s};return e===void 0?async u=>((!a||u!=null&&u.forceRefresh)&&(s=await l(u)),s):async u=>((!a||u!=null&&u.forceRefresh)&&(s=await l(u)),o?s:t(s)?(e(s)&&await l(u),s):(o=!0,s))},pa=i=>{if(typeof i=="function")return i;const e=Promise.resolve(i);return()=>e},hS=i=>({...i,eventStreamMarshaller:i.eventStreamSerdeProvider(i)}),Sh="content-length";function fS(i){return e=>async t=>{const r=t.request;if(kr.isInstance(r)){const{body:s,headers:n}=r;if(s&&Object.keys(n).map(a=>a.toLowerCase()).indexOf(Sh)===-1)try{const a=i(s);r.headers={...r.headers,[Sh]:String(a)}}catch{}}return e({...t,request:r})}}const dS={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Zp=i=>({applyToStack:e=>{e.add(fS(i.bodyLengthChecker),dS)}}),xh=i=>{var e,t;return za.isInstance(i)?((e=i.headers)==null?void 0:e.date)??((t=i.headers)==null?void 0:t.Date):void 0},eg=i=>new Date(Date.now()+i),pS=(i,e)=>Math.abs(eg(e).getTime()-i)>=3e5,bh=(i,e)=>{const t=Date.parse(i);return pS(t,e)?t-Date.now():e},Cn=(i,e)=>{if(!e)throw new Error(`Property \`${i}\` is not resolved for AWS SDK SigV4Auth`);return e},gS=async i=>{var l,u,h;const e=Cn("context",i.context),t=Cn("config",i.config),r=(h=(u=(l=e.endpointV2)==null?void 0:l.properties)==null?void 0:u.authSchemes)==null?void 0:h[0],n=await Cn("signer",t.signer)(r),a=i==null?void 0:i.signingRegion,o=i==null?void 0:i.signingName;return{config:t,signer:n,signingRegion:a,signingName:o}};class tg{async sign(e,t,r){if(!kr.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const{config:s,signer:n,signingRegion:a,signingName:o}=await gS(r);return await n.sign(e,{signingDate:eg(s.systemClockOffset),signingRegion:a,signingService:o})}errorHandler(e){return t=>{const r=t.ServerTime??xh(t.$response);if(r){const s=Cn("config",e.config),n=s.systemClockOffset;s.systemClockOffset=bh(r,s.systemClockOffset),s.systemClockOffset!==n&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const r=xh(e);if(r){const s=Cn("config",t.config);s.systemClockOffset=bh(r,s.systemClockOffset)}}}const mS="X-Amz-Algorithm",vS="X-Amz-Credential",rg="X-Amz-Date",yS="X-Amz-SignedHeaders",SS="X-Amz-Expires",ig="X-Amz-Signature",sg="X-Amz-Security-Token",ng="authorization",ag=rg.toLowerCase(),xS="date",bS=[ng,ag,xS],ES=ig.toLowerCase(),Hl="x-amz-content-sha256",TS=sg.toLowerCase(),wS={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},AS=/^proxy-/,_S=/^sec-/,jo="AWS4-HMAC-SHA256",CS="AWS4-HMAC-SHA256-PAYLOAD",LS="UNSIGNED-PAYLOAD",RS=50,og="aws4_request",IS=60*60*24*7,ga={},Ho=[],Ko=(i,e,t)=>`${i}/${e}/${t}/${og}`,PS=async(i,e,t,r,s)=>{const n=await Eh(i,e.secretAccessKey,e.accessKeyId),a=`${t}:${r}:${s}:${lr(n)}:${e.sessionToken}`;if(a in ga)return ga[a];for(Ho.push(a);Ho.length>RS;)delete ga[Ho.shift()];let o=`AWS4${e.secretAccessKey}`;for(const l of[t,r,s,og])o=await Eh(i,o,l);return ga[a]=o},Eh=(i,e,t)=>{const r=new i(e);return r.update(_n(t)),r.digest()},Th=({headers:i},e,t)=>{const r={};for(const s of Object.keys(i).sort()){if(i[s]==null)continue;const n=s.toLowerCase();(n in wS||e!=null&&e.has(n)||AS.test(n)||_S.test(n))&&(!t||t&&!t.has(n))||(r[n]=i[s].trim().replace(/\s+/g," "))}return r},kS=({query:i={}})=>{const e=[],t={};for(const r of Object.keys(i).sort()){if(r.toLowerCase()===ES)continue;e.push(r);const s=i[r];typeof s=="string"?t[r]=`${Mi(r)}=${Mi(s)}`:Array.isArray(s)&&(t[r]=s.slice(0).reduce((n,a)=>n.concat([`${Mi(r)}=${Mi(a)}`]),[]).sort().join("&"))}return e.map(r=>t[r]).filter(r=>r).join("&")},DS=i=>typeof ArrayBuffer=="function"&&i instanceof ArrayBuffer||Object.prototype.toString.call(i)==="[object ArrayBuffer]",zo=async({headers:i,body:e},t)=>{for(const r of Object.keys(i))if(r.toLowerCase()===Hl)return i[r];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||DS(e)){const r=new t;return r.update(_n(e)),lr(await r.digest())}return LS};class OS{format(e){const t=[];for(const n of Object.keys(e)){const a=ns(n);t.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[n]))}const r=new Uint8Array(t.reduce((n,a)=>n+a.byteLength,0));let s=0;for(const n of t)r.set(n,s),s+=n.byteLength;return r}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 r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;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=ns(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 h=new Uint8Array(9);return h[0]=8,h.set(FS.fromNumber(e.value.valueOf()).bytes,1),h;case"uuid":if(!MS.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(Vp(e.value.replace(/\-/g,"")),1),d}}}var wh;(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"})(wh||(wh={}));const MS=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let FS=class lg{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 r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)t[r]=s;return e<0&&Ah(t),new lg(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&Ah(e),parseInt(lr(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function Ah(i){for(let e=0;e<8;e++)i[e]^=255;for(let e=7;e>-1&&(i[e]++,i[e]===0);e--);}const NS=(i,e)=>{i=i.toLowerCase();for(const t of Object.keys(e))if(i===t.toLowerCase())return!0;return!1},cg=({headers:i,query:e,...t})=>({...t,headers:{...i},query:e?BS(e):void 0}),BS=i=>Object.keys(i).reduce((e,t)=>{const r=i[t];return{...e,[t]:Array.isArray(r)?[...r]:r}},{}),$S=(i,e={})=>{var s;const{headers:t,query:r={}}=typeof i.clone=="function"?i.clone():cg(i);for(const n of Object.keys(t)){const a=n.toLowerCase();a.slice(0,6)==="x-amz-"&&!((s=e.unhoistableHeaders)!=null&&s.has(a))&&(r[n]=t[n],delete t[n])}return{...i,headers:t,query:r}},_h=i=>{i=typeof i.clone=="function"?i.clone():cg(i);for(const e of Object.keys(i.headers))bS.indexOf(e.toLowerCase())>-1&&delete i.headers[e];return i},US=i=>GS(i).toISOString().replace(/\.\d{3}Z$/,"Z"),GS=i=>typeof i=="number"?new Date(i*1e3):typeof i=="string"?Number(i)?new Date(Number(i)*1e3):new Date(i):i;class Ch{constructor({applyChecksum:e,credentials:t,region:r,service:s,sha256:n,uriEscapePath:a=!0}){this.headerFormatter=new OS,this.service=s,this.sha256=n,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=mi(r),this.credentialProvider=mi(t)}async presign(e,t={}){const{signingDate:r=new Date,expiresIn:s=3600,unsignableHeaders:n,unhoistableHeaders:a,signableHeaders:o,signingRegion:l,signingService:u}=t,h=await this.credentialProvider();this.validateResolvedCredentials(h);const d=l??await this.regionProvider(),{longDate:g,shortDate:v}=ma(r);if(s>IS)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const y=Ko(v,d,u??this.service),b=$S(_h(e),{unhoistableHeaders:a});h.sessionToken&&(b.query[sg]=h.sessionToken),b.query[mS]=jo,b.query[vS]=`${h.accessKeyId}/${y}`,b.query[rg]=g,b.query[SS]=s.toString(10);const E=Th(b,n,o);return b.query[yS]=Lh(E),b.query[ig]=await this.getSignature(g,y,this.getSigningKey(h,d,v,u),this.createCanonicalRequest(b,E,await zo(e,this.sha256))),b}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:r=new Date,priorSignature:s,signingRegion:n,signingService:a}){const o=n??await this.regionProvider(),{shortDate:l,longDate:u}=ma(r),h=Ko(l,o,a??this.service),d=await zo({headers:{},body:t},this.sha256),g=new this.sha256;g.update(e);const v=lr(await g.digest()),y=[CS,u,h,s,v,d].join(`
30
+ `);return this.signString(y,{signingDate:r,signingRegion:o,signingService:a})}async signMessage(e,{signingDate:t=new Date,signingRegion:r,signingService:s}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:r,signingService:s,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:t=new Date,signingRegion:r,signingService:s}={}){const n=await this.credentialProvider();this.validateResolvedCredentials(n);const a=r??await this.regionProvider(),{shortDate:o}=ma(t),l=new this.sha256(await this.getSigningKey(n,a,o,s));return l.update(_n(e)),lr(await l.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:r,unsignableHeaders:s,signingRegion:n,signingService:a}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const l=n??await this.regionProvider(),u=_h(e),{longDate:h,shortDate:d}=ma(t),g=Ko(d,l,a??this.service);u.headers[ag]=h,o.sessionToken&&(u.headers[TS]=o.sessionToken);const v=await zo(u,this.sha256);!NS(Hl,u.headers)&&this.applyChecksum&&(u.headers[Hl]=v);const y=Th(u,s,r),b=await this.getSignature(h,g,this.getSigningKey(o,l,d,a),this.createCanonicalRequest(u,y,v));return u.headers[ng]=`${jo} Credential=${o.accessKeyId}/${g}, SignedHeaders=${Lh(y)}, Signature=${b}`,u}createCanonicalRequest(e,t,r){const s=Object.keys(t).sort();return`${e.method}
31
+ ${this.getCanonicalPath(e)}
32
+ ${kS(e)}
33
+ ${s.map(n=>`${n}:${t[n]}`).join(`
34
+ `)}
35
+
36
+ ${s.join(";")}
37
+ ${r}`}async createStringToSign(e,t,r){const s=new this.sha256;s.update(_n(r));const n=await s.digest();return`${jo}
38
+ ${e}
39
+ ${t}
40
+ ${lr(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 r=`${e!=null&&e.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&(e!=null&&e.endsWith("/"))?"/":""}`;return Mi(r).replace(/%2F/g,"/")}return e}async getSignature(e,t,r,s){const n=await this.createStringToSign(e,t,s),a=new this.sha256(await r);return a.update(_n(n)),lr(await a.digest())}getSigningKey(e,t,r,s){return PS(this.sha256,e,r,t,s||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 ma=i=>{const e=US(i).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Lh=i=>Object.keys(i).sort().join(";"),ug=i=>{let e;i.credentials&&(e=uS(i.credentials,cS,Jp)),e||(i.credentialDefaultProvider?e=pa(i.credentialDefaultProvider(Object.assign({},i,{parentClientConfig:i}))):e=async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:t=!0,systemClockOffset:r=i.systemClockOffset||0,sha256:s}=i;let n;return i.signer?n=pa(i.signer):i.regionInfoProvider?n=()=>pa(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 h={...i,credentials:e,region:i.signingRegion,service:i.signingName,sha256:s,uriEscapePath:t},d=i.signerConstructor||Ch;return new d(h)}):n=async a=>{a=Object.assign({},{name:"sigv4",signingName:i.signingName||i.defaultSigningName,signingRegion:await pa(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:s,uriEscapePath:t},h=i.signerConstructor||Ch;return new h(u)},{...i,systemClockOffset:r,signingEscapePath:t,credentials:e,signer:n}},VS=(i,e)=>Vy(i,e).then(t=>e.utf8Encoder(t)),Fc=(i,e)=>VS(i,e).then(t=>{if(t.length)try{return JSON.parse(t)}catch(r){throw(r==null?void 0:r.name)==="SyntaxError"&&Object.defineProperty(r,"$responseBodyText",{value:t}),r}return{}}),hg=async(i,e)=>{const t=await Fc(i,e);return t.message=t.message??t.Message,t},fg=(i,e)=>{const t=(n,a)=>Object.keys(n).find(o=>o.toLowerCase()===a.toLowerCase()),r=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},s=t(i.headers,"x-amzn-errortype");if(s!==void 0)return r(i.headers[s]);if(e.code!==void 0)return r(e.code);if(e.__type!==void 0)return r(e.__type)},jS=async(i,e,t)=>({operation:Xn(e).operation,region:await mi(i.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function HS(i){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"kinesis",region:i.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const KS=i=>{const e=[];switch(i.operation){default:e.push(HS(i))}return e},zS=i=>({...ug(i)}),WS=i=>({...i,useDualstackEndpoint:i.useDualstackEndpoint??!1,useFipsEndpoint:i.useFipsEndpoint??!1,defaultSigningName:"kinesis"}),qS={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},YS="@aws-sdk/client-kinesis",XS="AWS SDK for JavaScript Kinesis Client for Node.js, Browser and React Native",QS="3.582.0",JS={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"},ZS="./dist-cjs/index.js",e1="./dist-types/index.d.ts",t1="./dist-es/index.js",r1=!1,i1={"@aws-crypto/sha256-browser":"3.0.0","@aws-crypto/sha256-js":"3.0.0","@aws-sdk/client-sso-oidc":"3.582.0","@aws-sdk/client-sts":"3.582.0","@aws-sdk/core":"3.582.0","@aws-sdk/credential-provider-node":"3.582.0","@aws-sdk/middleware-host-header":"3.577.0","@aws-sdk/middleware-logger":"3.577.0","@aws-sdk/middleware-recursion-detection":"3.577.0","@aws-sdk/middleware-user-agent":"3.577.0","@aws-sdk/region-config-resolver":"3.577.0","@aws-sdk/types":"3.577.0","@aws-sdk/util-endpoints":"3.577.0","@aws-sdk/util-user-agent-browser":"3.577.0","@aws-sdk/util-user-agent-node":"3.577.0","@smithy/config-resolver":"^3.0.0","@smithy/core":"^2.0.1","@smithy/eventstream-serde-browser":"^3.0.0","@smithy/eventstream-serde-config-resolver":"^3.0.0","@smithy/eventstream-serde-node":"^3.0.0","@smithy/fetch-http-handler":"^3.0.1","@smithy/hash-node":"^3.0.0","@smithy/invalid-dependency":"^3.0.0","@smithy/middleware-content-length":"^3.0.0","@smithy/middleware-endpoint":"^3.0.0","@smithy/middleware-retry":"^3.0.1","@smithy/middleware-serde":"^3.0.0","@smithy/middleware-stack":"^3.0.0","@smithy/node-config-provider":"^3.0.0","@smithy/node-http-handler":"^3.0.0","@smithy/protocol-http":"^4.0.0","@smithy/smithy-client":"^3.0.1","@smithy/types":"^3.0.0","@smithy/url-parser":"^3.0.0","@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.1","@smithy/util-defaults-mode-node":"^3.0.1","@smithy/util-endpoints":"^2.0.0","@smithy/util-middleware":"^3.0.0","@smithy/util-retry":"^3.0.0","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.0.0",tslib:"^2.6.2"},s1={"@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"},n1={node:">=16.0.0"},a1={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},o1=["dist-*/**"],l1={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},c1="Apache-2.0",u1={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},h1="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-kinesis",f1={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-kinesis"},d1={name:YS,description:XS,version:QS,scripts:JS,main:ZS,types:e1,module:t1,sideEffects:r1,dependencies:i1,devDependencies:s1,engines:n1,typesVersions:a1,files:o1,author:l1,license:c1,browser:u1,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:h1,repository:f1};var Nc={};/*! *****************************************************************************
41
+ Copyright (c) Microsoft Corporation.
42
+
43
+ Permission to use, copy, modify, and/or distribute this software for any
44
+ purpose with or without fee is hereby granted.
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
47
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
48
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
49
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
50
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
51
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
52
+ PERFORMANCE OF THIS SOFTWARE.
53
+ ***************************************************************************** */var Kl=function(i,e){return Kl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)r.hasOwnProperty(s)&&(t[s]=r[s])},Kl(i,e)};function p1(i,e){Kl(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var zl=function(){return zl=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},zl.apply(this,arguments)};function g1(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(i);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(i,r[s])&&(t[r[s]]=i[r[s]]);return t}function m1(i,e,t,r){var s=arguments.length,n=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(a=i[o])&&(n=(s<3?a(n):s>3?a(e,t,n):a(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n}function v1(i,e){return function(t,r){e(t,r,i)}}function y1(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function S1(i,e,t,r){function s(n){return n instanceof t?n:new t(function(a){a(n)})}return new(t||(t=Promise))(function(n,a){function o(h){try{u(r.next(h))}catch(d){a(d)}}function l(h){try{u(r.throw(h))}catch(d){a(d)}}function u(h){h.done?n(h.value):s(h.value).then(o,l)}u((r=r.apply(i,e||[])).next())})}function x1(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(h){return l([u,h])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(n=u[0]&2?s.return:u[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,u[1])).done)return n;switch(s=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++,s=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(h){u=[6,h],s=0}finally{r=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function b1(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]}function E1(i,e){for(var t in i)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=i[t])}function Wl(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function dg(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),s,n=[],a;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(o){a={error:o}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return n}function T1(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(dg(arguments[e]));return i}function w1(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),s=0,e=0;e<t;e++)for(var n=arguments[e],a=0,o=n.length;a<o;a++,s++)r[s]=n[a];return r}function $n(i){return this instanceof $n?(this.v=i,this):new $n(i)}function A1(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),s,n=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(g){r[g]&&(s[g]=function(v){return new Promise(function(y,b){n.push([g,v,y,b])>1||o(g,v)})})}function o(g,v){try{l(r[g](v))}catch(y){d(n[0][3],y)}}function l(g){g.value instanceof $n?Promise.resolve(g.value.v).then(u,h):d(n[0][2],g)}function u(g){o("next",g)}function h(g){o("throw",g)}function d(g,v){g(v),n.shift(),n.length&&o(n[0][0],n[0][1])}}function _1(i){var e,t;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,n){e[s]=i[s]?function(a){return(t=!t)?{value:$n(i[s](a)),done:s==="return"}:n?n(a):a}:n}}function C1(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof Wl=="function"?Wl(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=i[n]&&function(a){return new Promise(function(o,l){a=i[n](a),s(o,l,a.done,a.value)})}}function s(n,a,o,l){Promise.resolve(l).then(function(u){n({value:u,done:o})},a)}}function L1(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function R1(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,e}function I1(i){return i&&i.__esModule?i:{default:i}}function P1(i,e){if(!e.has(i))throw new TypeError("attempted to get private field on non-instance");return e.get(i)}function k1(i,e,t){if(!e.has(i))throw new TypeError("attempted to set private field on non-instance");return e.set(i,t),t}const D1=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return zl},__asyncDelegator:_1,__asyncGenerator:A1,__asyncValues:C1,__await:$n,__awaiter:S1,__classPrivateFieldGet:P1,__classPrivateFieldSet:k1,__createBinding:b1,__decorate:m1,__exportStar:E1,__extends:p1,__generator:x1,__importDefault:I1,__importStar:R1,__makeTemplateObject:L1,__metadata:y1,__param:v1,__read:dg,__rest:g1,__spread:T1,__spreadArrays:w1,__values:Wl},Symbol.toStringTag,{value:"Module"})),O1=ls(D1);var on={},ln={},cn={},Rh;function M1(){if(Rh)return cn;Rh=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.isEmptyData=void 0;function i(e){return typeof e=="string"?e.length===0:e.byteLength===0}return cn.isEmptyData=i,cn}var Wo={},Ih;function pg(){return Ih||(Ih=1,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.EMPTY_DATA_SHA_256=i.SHA_256_HMAC_ALGO=i.SHA_256_HASH=void 0,i.SHA_256_HASH={name:"SHA-256"},i.SHA_256_HMAC_ALGO={name:"HMAC",hash:i.SHA_256_HASH},i.EMPTY_DATA_SHA_256=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])}(Wo)),Wo}const F1=i=>{const e=[];for(let t=0,r=i.length;t<r;t++){const s=i.charCodeAt(t);if(s<128)e.push(s);else if(s<2048)e.push(s>>6|192,s&63|128);else if(t+1<i.length&&(s&64512)===55296&&(i.charCodeAt(t+1)&64512)===56320){const n=65536+((s&1023)<<10)+(i.charCodeAt(++t)&1023);e.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else e.push(s>>12|224,s>>6&63|128,s&63|128)}return Uint8Array.from(e)},N1=i=>{let e="";for(let t=0,r=i.length;t<r;t++){const s=i[t];if(s<128)e+=String.fromCharCode(s);else if(192<=s&&s<224){const n=i[++t];e+=String.fromCharCode((s&31)<<6|n&63)}else if(240<=s&&s<365){const a="%"+[s,i[++t],i[++t],i[++t]].map(o=>o.toString(16)).join("%");e+=decodeURIComponent(a)}else e+=String.fromCharCode((s&15)<<12|(i[++t]&63)<<6|i[++t]&63)}return e};function B1(i){return new TextEncoder().encode(i)}function $1(i){return new TextDecoder("utf-8").decode(i)}const U1=i=>typeof TextEncoder=="function"?B1(i):F1(i),G1=i=>typeof TextDecoder=="function"?$1(i):N1(i),V1=Object.freeze(Object.defineProperty({__proto__:null,fromUtf8:U1,toUtf8:G1},Symbol.toStringTag,{value:"Module"})),gg=ls(V1),j1={};function H1(){return typeof window<"u"?window:typeof self<"u"?self:j1}const K1=Object.freeze(Object.defineProperty({__proto__:null,locateWindow:H1},Symbol.toStringTag,{value:"Module"})),Bc=ls(K1);var Ph;function mg(){if(Ph)return ln;Ph=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.Sha256=void 0;var i=M1(),e=pg(),t=gg,r=Bc,s=function(){function o(l){this.secret=l,this.reset()}return o.prototype.update=function(l){var u=this;(0,i.isEmptyData)(l)||(this.operation=this.operation.then(function(h){return h.onerror=function(){u.operation=Promise.reject(new Error("Error encountered updating hash"))},h.process(a(l)),h}),this.operation.catch(function(){}))},o.prototype.digest=function(){return this.operation.then(function(l){return new Promise(function(u,h){l.onerror=function(){h(new Error("Error encountered finalizing hash"))},l.oncomplete=function(){l.result&&u(new Uint8Array(l.result)),h(new Error("Error encountered finalizing hash"))},l.finish()})})},o.prototype.reset=function(){this.secret?(this.operation=n(this.secret).then(function(l){return(0,r.locateWindow)().msCrypto.subtle.sign(e.SHA_256_HMAC_ALGO,l)}),this.operation.catch(function(){})):this.operation=Promise.resolve((0,r.locateWindow)().msCrypto.subtle.digest("SHA-256"))},o}();ln.Sha256=s;function n(o){return new Promise(function(l,u){var h=(0,r.locateWindow)().msCrypto.subtle.importKey("raw",a(o),e.SHA_256_HMAC_ALGO,!1,["sign"]);h.oncomplete=function(){h.result&&l(h.result),u(new Error("ImportKey completed without importing key."))},h.onerror=function(){u(new Error("ImportKey failed to import key."))}})}function a(o){return typeof o=="string"?(0,t.fromUtf8)(o):ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(o)}return ln}var un={},qo={},hn={},kh;function z1(){if(kh)return hn;kh=1,Object.defineProperty(hn,"__esModule",{value:!0}),hn.convertToBuffer=void 0;var i=gg,e=typeof Buffer<"u"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:i.fromUtf8;function t(r){return r instanceof Uint8Array?r:typeof r=="string"?e(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r)}return hn.convertToBuffer=t,hn}var fn={},Dh;function W1(){if(Dh)return fn;Dh=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.isEmptyData=void 0;function i(e){return typeof e=="string"?e.length===0:e.byteLength===0}return fn.isEmptyData=i,fn}var dn={},Oh;function q1(){if(Oh)return dn;Oh=1,Object.defineProperty(dn,"__esModule",{value:!0}),dn.numToUint8=void 0;function i(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}return dn.numToUint8=i,dn}var pn={},Mh;function Y1(){if(Mh)return pn;Mh=1,Object.defineProperty(pn,"__esModule",{value:!0}),pn.uint32ArrayFrom=void 0;function i(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),r=0;r<e.length;)t[r]=e[r],r+=1;return t}return Uint32Array.from(e)}return pn.uint32ArrayFrom=i,pn}var Fh;function Qn(){return Fh||(Fh=1,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.uint32ArrayFrom=i.numToUint8=i.isEmptyData=i.convertToBuffer=void 0;var e=z1();Object.defineProperty(i,"convertToBuffer",{enumerable:!0,get:function(){return e.convertToBuffer}});var t=W1();Object.defineProperty(i,"isEmptyData",{enumerable:!0,get:function(){return t.isEmptyData}});var r=q1();Object.defineProperty(i,"numToUint8",{enumerable:!0,get:function(){return r.numToUint8}});var s=Y1();Object.defineProperty(i,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})}(qo)),qo}var Nh;function vg(){if(Nh)return un;Nh=1,Object.defineProperty(un,"__esModule",{value:!0}),un.Sha256=void 0;var i=Qn(),e=pg(),t=Bc,r=function(){function s(n){this.toHash=new Uint8Array(0),this.secret=n,this.reset()}return s.prototype.update=function(n){if(!(0,i.isEmptyData)(n)){var a=(0,i.convertToBuffer)(n),o=new Uint8Array(this.toHash.byteLength+a.byteLength);o.set(this.toHash,0),o.set(a,this.toHash.byteLength),this.toHash=o}},s.prototype.digest=function(){var n=this;return this.key?this.key.then(function(a){return(0,t.locateWindow)().crypto.subtle.sign(e.SHA_256_HMAC_ALGO,a,n.toHash).then(function(o){return new Uint8Array(o)})}):(0,i.isEmptyData)(this.toHash)?Promise.resolve(e.EMPTY_DATA_SHA_256):Promise.resolve().then(function(){return(0,t.locateWindow)().crypto.subtle.digest(e.SHA_256_HASH,n.toHash)}).then(function(a){return Promise.resolve(new Uint8Array(a))})},s.prototype.reset=function(){var n=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(a,o){(0,t.locateWindow)().crypto.subtle.importKey("raw",(0,i.convertToBuffer)(n.secret),e.SHA_256_HMAC_ALGO,!1,["sign"]).then(a,o)}),this.key.catch(function(){}))},s}();return un.Sha256=r,un}var Yo={};/*! *****************************************************************************
54
+ Copyright (c) Microsoft Corporation.
55
+
56
+ Permission to use, copy, modify, and/or distribute this software for any
57
+ purpose with or without fee is hereby granted.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
60
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
61
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
62
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
63
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
64
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65
+ PERFORMANCE OF THIS SOFTWARE.
66
+ ***************************************************************************** */var ql=function(i,e){return ql=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)r.hasOwnProperty(s)&&(t[s]=r[s])},ql(i,e)};function X1(i,e){ql(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Yl=function(){return Yl=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Yl.apply(this,arguments)};function Q1(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(i);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(i,r[s])&&(t[r[s]]=i[r[s]]);return t}function J1(i,e,t,r){var s=arguments.length,n=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(a=i[o])&&(n=(s<3?a(n):s>3?a(e,t,n):a(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n}function Z1(i,e){return function(t,r){e(t,r,i)}}function ex(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function tx(i,e,t,r){function s(n){return n instanceof t?n:new t(function(a){a(n)})}return new(t||(t=Promise))(function(n,a){function o(h){try{u(r.next(h))}catch(d){a(d)}}function l(h){try{u(r.throw(h))}catch(d){a(d)}}function u(h){h.done?n(h.value):s(h.value).then(o,l)}u((r=r.apply(i,e||[])).next())})}function rx(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(h){return l([u,h])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(n=u[0]&2?s.return:u[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,u[1])).done)return n;switch(s=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++,s=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(h){u=[6,h],s=0}finally{r=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ix(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]}function sx(i,e){for(var t in i)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=i[t])}function Xl(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yg(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),s,n=[],a;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(o){a={error:o}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return n}function nx(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(yg(arguments[e]));return i}function ax(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),s=0,e=0;e<t;e++)for(var n=arguments[e],a=0,o=n.length;a<o;a++,s++)r[s]=n[a];return r}function Un(i){return this instanceof Un?(this.v=i,this):new Un(i)}function ox(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),s,n=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(g){r[g]&&(s[g]=function(v){return new Promise(function(y,b){n.push([g,v,y,b])>1||o(g,v)})})}function o(g,v){try{l(r[g](v))}catch(y){d(n[0][3],y)}}function l(g){g.value instanceof Un?Promise.resolve(g.value.v).then(u,h):d(n[0][2],g)}function u(g){o("next",g)}function h(g){o("throw",g)}function d(g,v){g(v),n.shift(),n.length&&o(n[0][0],n[0][1])}}function lx(i){var e,t;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,n){e[s]=i[s]?function(a){return(t=!t)?{value:Un(i[s](a)),done:s==="return"}:n?n(a):a}:n}}function cx(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof Xl=="function"?Xl(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=i[n]&&function(a){return new Promise(function(o,l){a=i[n](a),s(o,l,a.done,a.value)})}}function s(n,a,o,l){Promise.resolve(l).then(function(u){n({value:u,done:o})},a)}}function ux(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function hx(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,e}function fx(i){return i&&i.__esModule?i:{default:i}}function dx(i,e){if(!e.has(i))throw new TypeError("attempted to get private field on non-instance");return e.get(i)}function px(i,e,t){if(!e.has(i))throw new TypeError("attempted to set private field on non-instance");return e.set(i,t),t}const gx=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Yl},__asyncDelegator:lx,__asyncGenerator:ox,__asyncValues:cx,__await:Un,__awaiter:tx,__classPrivateFieldGet:dx,__classPrivateFieldSet:px,__createBinding:ix,__decorate:J1,__exportStar:sx,__extends:X1,__generator:rx,__importDefault:fx,__importStar:hx,__makeTemplateObject:ux,__metadata:ex,__param:Z1,__read:yg,__rest:Q1,__spread:nx,__spreadArrays:ax,__values:Xl},Symbol.toStringTag,{value:"Module"})),Sg=ls(gx);var gn={},ar={},Bh;function xg(){return Bh||(Bh=1,Object.defineProperty(ar,"__esModule",{value:!0}),ar.MAX_HASHABLE_LENGTH=ar.INIT=ar.KEY=ar.DIGEST_LENGTH=ar.BLOCK_SIZE=void 0,ar.BLOCK_SIZE=64,ar.DIGEST_LENGTH=32,ar.KEY=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]),ar.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],ar.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1),ar}var mn={},$h;function mx(){if($h)return mn;$h=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.RawSha256=void 0;var i=xg(),e=function(){function t(){this.state=Int32Array.from(i.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return t.prototype.update=function(r){if(this.finished)throw new Error("Attempted to update an already finished hash.");var s=0,n=r.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>i.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=r[s++],n--,this.bufferLength===i.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},t.prototype.digest=function(){if(!this.finished){var r=this.bytesHashed*8,s=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(s.setUint8(this.bufferLength++,128),n%i.BLOCK_SIZE>=i.BLOCK_SIZE-8){for(var a=this.bufferLength;a<i.BLOCK_SIZE;a++)s.setUint8(a,0);this.hashBuffer(),this.bufferLength=0}for(var a=this.bufferLength;a<i.BLOCK_SIZE-8;a++)s.setUint8(a,0);s.setUint32(i.BLOCK_SIZE-8,Math.floor(r/4294967296),!0),s.setUint32(i.BLOCK_SIZE-4,r),this.hashBuffer(),this.finished=!0}for(var o=new Uint8Array(i.DIGEST_LENGTH),a=0;a<8;a++)o[a*4]=this.state[a]>>>24&255,o[a*4+1]=this.state[a]>>>16&255,o[a*4+2]=this.state[a]>>>8&255,o[a*4+3]=this.state[a]>>>0&255;return o},t.prototype.hashBuffer=function(){for(var r=this,s=r.buffer,n=r.state,a=n[0],o=n[1],l=n[2],u=n[3],h=n[4],d=n[5],g=n[6],v=n[7],y=0;y<i.BLOCK_SIZE;y++){if(y<16)this.temp[y]=(s[y*4]&255)<<24|(s[y*4+1]&255)<<16|(s[y*4+2]&255)<<8|s[y*4+3]&255;else{var b=this.temp[y-2],E=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10;b=this.temp[y-15];var A=(b>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;this.temp[y]=(E+this.temp[y-7]|0)+(A+this.temp[y-16]|0)}var M=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&d^~h&g)|0)+(v+(i.KEY[y]+this.temp[y]|0)|0)|0,D=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&o^a&l^o&l)|0;v=g,g=d,d=h,h=u+M|0,u=l,l=o,o=a,a=M+D|0}n[0]+=a,n[1]+=o,n[2]+=l,n[3]+=u,n[4]+=h,n[5]+=d,n[6]+=g,n[7]+=v},t}();return mn.RawSha256=e,mn}var Uh;function vx(){if(Uh)return gn;Uh=1,Object.defineProperty(gn,"__esModule",{value:!0}),gn.Sha256=void 0;var i=Sg,e=xg(),t=mx(),r=Qn(),s=function(){function a(o){this.secret=o,this.hash=new t.RawSha256,this.reset()}return a.prototype.update=function(o){if(!((0,r.isEmptyData)(o)||this.error))try{this.hash.update((0,r.convertToBuffer)(o))}catch(l){this.error=l}},a.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()},a.prototype.digest=function(){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(o){return[2,this.digestSync()]})})},a.prototype.reset=function(){if(this.hash=new t.RawSha256,this.secret){this.outer=new t.RawSha256;var o=n(this.secret),l=new Uint8Array(e.BLOCK_SIZE);l.set(o);for(var u=0;u<e.BLOCK_SIZE;u++)o[u]^=54,l[u]^=92;this.hash.update(o),this.outer.update(l);for(var u=0;u<o.byteLength;u++)o[u]=0}},a}();gn.Sha256=s;function n(a){var o=(0,r.convertToBuffer)(a);if(o.byteLength>e.BLOCK_SIZE){var l=new t.RawSha256;l.update(o),o=l.digest()}var u=new Uint8Array(e.BLOCK_SIZE);return u.set(o),u}return gn}var Gh;function yx(){return Gh||(Gh=1,function(i){Object.defineProperty(i,"__esModule",{value:!0});var e=Sg;e.__exportStar(vx(),i)}(Yo)),Yo}var Xo={};/*! *****************************************************************************
67
+ Copyright (c) Microsoft Corporation.
68
+
69
+ Permission to use, copy, modify, and/or distribute this software for any
70
+ purpose with or without fee is hereby granted.
71
+
72
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
73
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
74
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
75
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
76
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
77
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
78
+ PERFORMANCE OF THIS SOFTWARE.
79
+ ***************************************************************************** */var Ql=function(i,e){return Ql=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)r.hasOwnProperty(s)&&(t[s]=r[s])},Ql(i,e)};function Sx(i,e){Ql(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Jl=function(){return Jl=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Jl.apply(this,arguments)};function xx(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(i);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(i,r[s])&&(t[r[s]]=i[r[s]]);return t}function bx(i,e,t,r){var s=arguments.length,n=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(a=i[o])&&(n=(s<3?a(n):s>3?a(e,t,n):a(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n}function Ex(i,e){return function(t,r){e(t,r,i)}}function Tx(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function wx(i,e,t,r){function s(n){return n instanceof t?n:new t(function(a){a(n)})}return new(t||(t=Promise))(function(n,a){function o(h){try{u(r.next(h))}catch(d){a(d)}}function l(h){try{u(r.throw(h))}catch(d){a(d)}}function u(h){h.done?n(h.value):s(h.value).then(o,l)}u((r=r.apply(i,e||[])).next())})}function Ax(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(h){return l([u,h])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(n=u[0]&2?s.return:u[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,u[1])).done)return n;switch(s=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++,s=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(h){u=[6,h],s=0}finally{r=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function _x(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]}function Cx(i,e){for(var t in i)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=i[t])}function Zl(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bg(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),s,n=[],a;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(o){a={error:o}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return n}function Lx(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(bg(arguments[e]));return i}function Rx(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),s=0,e=0;e<t;e++)for(var n=arguments[e],a=0,o=n.length;a<o;a++,s++)r[s]=n[a];return r}function Gn(i){return this instanceof Gn?(this.v=i,this):new Gn(i)}function Ix(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),s,n=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(g){r[g]&&(s[g]=function(v){return new Promise(function(y,b){n.push([g,v,y,b])>1||o(g,v)})})}function o(g,v){try{l(r[g](v))}catch(y){d(n[0][3],y)}}function l(g){g.value instanceof Gn?Promise.resolve(g.value.v).then(u,h):d(n[0][2],g)}function u(g){o("next",g)}function h(g){o("throw",g)}function d(g,v){g(v),n.shift(),n.length&&o(n[0][0],n[0][1])}}function Px(i){var e,t;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,n){e[s]=i[s]?function(a){return(t=!t)?{value:Gn(i[s](a)),done:s==="return"}:n?n(a):a}:n}}function kx(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof Zl=="function"?Zl(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=i[n]&&function(a){return new Promise(function(o,l){a=i[n](a),s(o,l,a.done,a.value)})}}function s(n,a,o,l){Promise.resolve(l).then(function(u){n({value:u,done:o})},a)}}function Dx(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function Ox(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,e}function Mx(i){return i&&i.__esModule?i:{default:i}}function Fx(i,e){if(!e.has(i))throw new TypeError("attempted to get private field on non-instance");return e.get(i)}function Nx(i,e,t){if(!e.has(i))throw new TypeError("attempted to set private field on non-instance");return e.set(i,t),t}const Bx=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Jl},__asyncDelegator:Px,__asyncGenerator:Ix,__asyncValues:kx,__await:Gn,__awaiter:wx,__classPrivateFieldGet:Fx,__classPrivateFieldSet:Nx,__createBinding:_x,__decorate:bx,__exportStar:Cx,__extends:Sx,__generator:Ax,__importDefault:Mx,__importStar:Ox,__makeTemplateObject:Dx,__metadata:Tx,__param:Ex,__read:bg,__rest:xx,__spread:Lx,__spreadArrays:Rx,__values:Zl},Symbol.toStringTag,{value:"Module"})),Eg=ls(Bx);var Lr={},Vh;function $x(){if(Vh)return Lr;Vh=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.supportsZeroByteGCM=Lr.supportsSubtleCrypto=Lr.supportsSecureRandom=Lr.supportsWebCrypto=void 0;var i=Eg,e=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function t(a){if(r(a)&&typeof a.crypto.subtle=="object"){var o=a.crypto.subtle;return s(o)}return!1}Lr.supportsWebCrypto=t;function r(a){if(typeof a=="object"&&typeof a.crypto=="object"){var o=a.crypto.getRandomValues;return typeof o=="function"}return!1}Lr.supportsSecureRandom=r;function s(a){return a&&e.every(function(o){return typeof a[o]=="function"})}Lr.supportsSubtleCrypto=s;function n(a){return i.__awaiter(this,void 0,void 0,function(){var o,l;return i.__generator(this,function(u){switch(u.label){case 0:if(!s(a))return[2,!1];u.label=1;case 1:return u.trys.push([1,4,,5]),[4,a.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return o=u.sent(),[4,a.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},o,new Uint8Array(0))];case 3:return l=u.sent(),[2,l.byteLength===16];case 4:return u.sent(),[2,!1];case 5:return[2]}})})}return Lr.supportsZeroByteGCM=n,Lr}var jh;function Ux(){return jh||(jh=1,function(i){Object.defineProperty(i,"__esModule",{value:!0});var e=Eg;e.__exportStar($x(),i)}(Xo)),Xo}var Qo={};/*! *****************************************************************************
80
+ Copyright (c) Microsoft Corporation.
81
+
82
+ Permission to use, copy, modify, and/or distribute this software for any
83
+ purpose with or without fee is hereby granted.
84
+
85
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
86
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
87
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
88
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
89
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
90
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
91
+ PERFORMANCE OF THIS SOFTWARE.
92
+ ***************************************************************************** */var ec=function(i,e){return ec=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)r.hasOwnProperty(s)&&(t[s]=r[s])},ec(i,e)};function Gx(i,e){ec(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var tc=function(){return tc=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},tc.apply(this,arguments)};function Vx(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(i);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(i,r[s])&&(t[r[s]]=i[r[s]]);return t}function jx(i,e,t,r){var s=arguments.length,n=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(a=i[o])&&(n=(s<3?a(n):s>3?a(e,t,n):a(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n}function Hx(i,e){return function(t,r){e(t,r,i)}}function Kx(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function zx(i,e,t,r){function s(n){return n instanceof t?n:new t(function(a){a(n)})}return new(t||(t=Promise))(function(n,a){function o(h){try{u(r.next(h))}catch(d){a(d)}}function l(h){try{u(r.throw(h))}catch(d){a(d)}}function u(h){h.done?n(h.value):s(h.value).then(o,l)}u((r=r.apply(i,e||[])).next())})}function Wx(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(h){return l([u,h])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(n=u[0]&2?s.return:u[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,u[1])).done)return n;switch(s=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++,s=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(h){u=[6,h],s=0}finally{r=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function qx(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]}function Yx(i,e){for(var t in i)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=i[t])}function rc(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tg(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),s,n=[],a;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(o){a={error:o}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return n}function Xx(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(Tg(arguments[e]));return i}function Qx(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),s=0,e=0;e<t;e++)for(var n=arguments[e],a=0,o=n.length;a<o;a++,s++)r[s]=n[a];return r}function Vn(i){return this instanceof Vn?(this.v=i,this):new Vn(i)}function Jx(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),s,n=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(g){r[g]&&(s[g]=function(v){return new Promise(function(y,b){n.push([g,v,y,b])>1||o(g,v)})})}function o(g,v){try{l(r[g](v))}catch(y){d(n[0][3],y)}}function l(g){g.value instanceof Vn?Promise.resolve(g.value.v).then(u,h):d(n[0][2],g)}function u(g){o("next",g)}function h(g){o("throw",g)}function d(g,v){g(v),n.shift(),n.length&&o(n[0][0],n[0][1])}}function Zx(i){var e,t;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,n){e[s]=i[s]?function(a){return(t=!t)?{value:Vn(i[s](a)),done:s==="return"}:n?n(a):a}:n}}function eb(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof rc=="function"?rc(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=i[n]&&function(a){return new Promise(function(o,l){a=i[n](a),s(o,l,a.done,a.value)})}}function s(n,a,o,l){Promise.resolve(l).then(function(u){n({value:u,done:o})},a)}}function tb(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function rb(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,e}function ib(i){return i&&i.__esModule?i:{default:i}}function sb(i,e){if(!e.has(i))throw new TypeError("attempted to get private field on non-instance");return e.get(i)}function nb(i,e,t){if(!e.has(i))throw new TypeError("attempted to set private field on non-instance");return e.set(i,t),t}const ab=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return tc},__asyncDelegator:Zx,__asyncGenerator:Jx,__asyncValues:eb,__await:Vn,__awaiter:zx,__classPrivateFieldGet:sb,__classPrivateFieldSet:nb,__createBinding:qx,__decorate:jx,__exportStar:Yx,__extends:Gx,__generator:Wx,__importDefault:ib,__importStar:rb,__makeTemplateObject:tb,__metadata:Kx,__param:Hx,__read:Tg,__rest:Vx,__spread:Xx,__spreadArrays:Qx,__values:rc},Symbol.toStringTag,{value:"Module"})),ob=ls(ab);var Jo={},Hh;function lb(){return Hh||(Hh=1,Object.defineProperty(Jo,"__esModule",{value:!0})),Jo}var Zo={},Kh;function cb(){return Kh||(Kh=1,Object.defineProperty(Zo,"__esModule",{value:!0})),Zo}var el={},zh;function ub(){return zh||(zh=1,Object.defineProperty(el,"__esModule",{value:!0})),el}var tl={},Wh;function hb(){return Wh||(Wh=1,Object.defineProperty(tl,"__esModule",{value:!0})),tl}var vn={},qh;function fb(){if(qh)return vn;qh=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.isMsWindow=void 0;var i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function e(r){return"MSInputMethodContext"in r&&"msCrypto"in r}function t(r){if(e(r)&&r.msCrypto.subtle!==void 0){var s=r.msCrypto,n=s.getRandomValues,a=s.subtle;return i.map(function(o){return a[o]}).concat(n).every(function(o){return typeof o=="function"})}return!1}return vn.isMsWindow=t,vn}var Yh;function db(){return Yh||(Yh=1,function(i){Object.defineProperty(i,"__esModule",{value:!0});var e=ob;e.__exportStar(lb(),i),e.__exportStar(cb(),i),e.__exportStar(ub(),i),e.__exportStar(hb(),i),e.__exportStar(fb(),i)}(Qo)),Qo}var Xh;function pb(){if(Xh)return on;Xh=1,Object.defineProperty(on,"__esModule",{value:!0}),on.Sha256=void 0;var i=mg(),e=vg(),t=yx(),r=Ux(),s=db(),n=Bc,a=Qn(),o=function(){function l(u){(0,r.supportsWebCrypto)((0,n.locateWindow)())?this.hash=new e.Sha256(u):(0,s.isMsWindow)((0,n.locateWindow)())?this.hash=new i.Sha256(u):this.hash=new t.Sha256(u)}return l.prototype.update=function(u,h){this.hash.update((0,a.convertToBuffer)(u))},l.prototype.digest=function(){return this.hash.digest()},l.prototype.reset=function(){this.hash.reset()},l}();return on.Sha256=o,on}(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.WebCryptoSha256=i.Ie11Sha256=void 0;var e=O1;e.__exportStar(pb(),i);var t=mg();Object.defineProperty(i,"Ie11Sha256",{enumerable:!0,get:function(){return t.Sha256}});var r=vg();Object.defineProperty(i,"WebCryptoSha256",{enumerable:!0,get:function(){return r.Sha256}})})(Nc);const gb={"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"},wg={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"},Yt={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"},ki={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class fe{static getFirstMatch(e,t){const r=t.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,t){const r=t.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,t,r){if(e.test(t))return r}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(r=>parseInt(r,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(r=>parseInt(r,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,r=!1){const s=fe.getVersionPrecision(e),n=fe.getVersionPrecision(t);let a=Math.max(s,n),o=0;const l=fe.map([e,t],u=>{const h=a-fe.getVersionPrecision(u),d=u+new Array(h+1).join(".0");return fe.map(d.split("."),g=>new Array(20-g.length).join("0")+g).reverse()});for(r&&(o=a-Math.min(s,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 r=[];let s;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(s=0;s<e.length;s+=1)r.push(t(e[s]));return r}static find(e,t){let r,s;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,s=e.length;r<s;r+=1){const n=e[r];if(t(n,r))return n}}static assign(e,...t){const r=e;let s,n;if(Object.assign)return Object.assign(e,...t);for(s=0,n=t.length;s<n;s+=1){const a=t[s];typeof a=="object"&&a!==null&&Object.keys(a).forEach(l=>{r[l]=a[l]})}return e}static getBrowserAlias(e){return gb[e]}static getBrowserTypeByAlias(e){return wg[e]||""}}const gt=/version\/(\d+(\.?_?\d+)+)/i,mb=[{test:[/googlebot/i],describe(i){const e={name:"Googlebot"},t=fe.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/opera/i],describe(i){const e={name:"Opera"},t=fe.getFirstMatch(gt,i)||fe.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/opr\/|opios/i],describe(i){const e={name:"Opera"},t=fe.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/SamsungBrowser/i],describe(i){const e={name:"Samsung Internet for Android"},t=fe.getFirstMatch(gt,i)||fe.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=fe.getFirstMatch(gt,i)||fe.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/MZBrowser/i],describe(i){const e={name:"MZ Browser"},t=fe.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/focus/i],describe(i){const e={name:"Focus"},t=fe.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/swing/i],describe(i){const e={name:"Swing"},t=fe.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/coast/i],describe(i){const e={name:"Opera Coast"},t=fe.getFirstMatch(gt,i)||fe.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=fe.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/yabrowser/i],describe(i){const e={name:"Yandex Browser"},t=fe.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/ucbrowser/i],describe(i){const e={name:"UC Browser"},t=fe.getFirstMatch(gt,i)||fe.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/Maxthon|mxios/i],describe(i){const e={name:"Maxthon"},t=fe.getFirstMatch(gt,i)||fe.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/epiphany/i],describe(i){const e={name:"Epiphany"},t=fe.getFirstMatch(gt,i)||fe.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/puffin/i],describe(i){const e={name:"Puffin"},t=fe.getFirstMatch(gt,i)||fe.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/sleipnir/i],describe(i){const e={name:"Sleipnir"},t=fe.getFirstMatch(gt,i)||fe.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=fe.getFirstMatch(gt,i)||fe.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/micromessenger/i],describe(i){const e={name:"WeChat"},t=fe.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,i)||fe.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=fe.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/msie|trident/i],describe(i){const e={name:"Internet Explorer"},t=fe.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/\sedg\//i],describe(i){const e={name:"Microsoft Edge"},t=fe.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=fe.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/vivaldi/i],describe(i){const e={name:"Vivaldi"},t=fe.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/seamonkey/i],describe(i){const e={name:"SeaMonkey"},t=fe.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/sailfish/i],describe(i){const e={name:"Sailfish"},t=fe.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=fe.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/phantom/i],describe(i){const e={name:"PhantomJS"},t=fe.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/slimerjs/i],describe(i){const e={name:"SlimerJS"},t=fe.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=fe.getFirstMatch(gt,i)||fe.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=fe.getFirstMatch(gt,i)||fe.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=fe.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/tizen/i],describe(i){const e={name:"Tizen"},t=fe.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/qupzilla/i],describe(i){const e={name:"QupZilla"},t=fe.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/firefox|iceweasel|fxios/i],describe(i){const e={name:"Firefox"},t=fe.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=fe.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/MiuiBrowser/i],describe(i){const e={name:"Miui"},t=fe.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/chromium/i],describe(i){const e={name:"Chromium"},t=fe.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,i)||fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/chrome|crios|crmo/i],describe(i){const e={name:"Chrome"},t=fe.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=fe.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=fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/playstation 4/i],describe(i){const e={name:"PlayStation 4"},t=fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/safari|applewebkit/i],describe(i){const e={name:"Safari"},t=fe.getFirstMatch(gt,i);return t&&(e.version=t),e}},{test:[/.*/i],describe(i){const e=/^(.*)\/(.*) /,t=/^(.*)\/(.*)[ \t]\((.*)/,s=i.search("\\(")!==-1?t:e;return{name:fe.getFirstMatch(s,i),version:fe.getSecondMatch(s,i)}}}],vb=[{test:[/Roku\/DVP/],describe(i){const e=fe.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,i);return{name:Yt.Roku,version:e}}},{test:[/windows phone/i],describe(i){const e=fe.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,i);return{name:Yt.WindowsPhone,version:e}}},{test:[/windows /i],describe(i){const e=fe.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,i),t=fe.getWindowsVersionName(e);return{name:Yt.Windows,version:e,versionName:t}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(i){const e={name:Yt.iOS},t=fe.getSecondMatch(/(Version\/)(\d[\d.]+)/,i);return t&&(e.version=t),e}},{test:[/macintosh/i],describe(i){const e=fe.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,i).replace(/[_\s]/g,"."),t=fe.getMacOSVersionName(e),r={name:Yt.MacOS,version:e};return t&&(r.versionName=t),r}},{test:[/(ipod|iphone|ipad)/i],describe(i){const e=fe.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,i).replace(/[_\s]/g,".");return{name:Yt.iOS,version:e}}},{test(i){const e=!i.test(/like android/i),t=i.test(/android/i);return e&&t},describe(i){const e=fe.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,i),t=fe.getAndroidVersionName(e),r={name:Yt.Android,version:e};return t&&(r.versionName=t),r}},{test:[/(web|hpw)[o0]s/i],describe(i){const e=fe.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,i),t={name:Yt.WebOS};return e&&e.length&&(t.version=e),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(i){const e=fe.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,i)||fe.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,i)||fe.getFirstMatch(/\bbb(\d+)/i,i);return{name:Yt.BlackBerry,version:e}}},{test:[/bada/i],describe(i){const e=fe.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,i);return{name:Yt.Bada,version:e}}},{test:[/tizen/i],describe(i){const e=fe.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,i);return{name:Yt.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Yt.Linux}}},{test:[/CrOS/],describe(){return{name:Yt.ChromeOS}}},{test:[/PlayStation 4/],describe(i){const e=fe.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,i);return{name:Yt.PlayStation4,version:e}}}],yb=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(i){const e=fe.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=fe.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}}}],Sb=[{test(i){return i.getBrowserName(!0)==="microsoft edge"},describe(i){if(/\sedg\//i.test(i))return{name:ki.Blink};const t=fe.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,i);return{name:ki.EdgeHTML,version:t}}},{test:[/trident/i],describe(i){const e={name:ki.Trident},t=fe.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test(i){return i.test(/presto/i)},describe(i){const e={name:ki.Presto},t=fe.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:ki.Gecko},t=fe.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ki.Blink}}},{test:[/(apple)?webkit/i],describe(i){const e={name:ki.WebKit},t=fe.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,i);return t&&(e.version=t),e}}];class Qh{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=fe.find(mb,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(r=>this.test(r));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=fe.find(vb,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(r=>this.test(r));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=fe.find(yb,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(r=>this.test(r));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=fe.find(Sb,t=>{if(typeof t.test=="function")return t.test(this);if(t.test instanceof Array)return t.test.some(r=>this.test(r));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 fe.assign({},this.parsedResult)}satisfies(e){const t={};let r=0;const s={};let n=0;if(Object.keys(e).forEach(o=>{const l=e[o];typeof l=="string"?(s[o]=l,n+=1):typeof l=="object"&&(t[o]=l,r+=1)}),r>0){const o=Object.keys(t),l=fe.find(o,h=>this.isOS(h));if(l){const h=this.satisfies(t[l]);if(h!==void 0)return h}const u=fe.find(o,h=>this.isPlatform(h));if(u){const h=this.satisfies(t[u]);if(h!==void 0)return h}}if(n>0){const o=Object.keys(s),l=fe.find(o,u=>this.isBrowser(u,!0));if(l!==void 0)return this.compareVersion(s[l])}}isBrowser(e,t=!1){const r=this.getBrowserName().toLowerCase();let s=e.toLowerCase();const n=fe.getBrowserTypeByAlias(s);return t&&n&&(s=n.toLowerCase()),s===r}compareVersion(e){let t=[0],r=e,s=!1;const n=this.getBrowserVersion();if(typeof n=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(s=!0,r=e.substr(2)):t=[],e[0]===">"?t.push(1):t.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(s=!0,r=e.substr(1)),t.indexOf(fe.compareVersions(n,r,s))>-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))}}/*!
93
+ * Bowser - a browser detector
94
+ * https://github.com/lancedikson/bowser
95
+ * MIT License | (c) Dustin Diaz 2012-2015
96
+ * MIT License | (c) Denis Demchenko 2015-2019
97
+ */class Ag{static getParser(e,t=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new Qh(e,t)}static parse(e){return new Qh(e).getResult()}static get BROWSER_MAP(){return wg}static get ENGINE_MAP(){return ki}static get OS_MAP(){return Yt}static get PLATFORMS_MAP(){return At}}const _g=({serviceId:i,clientVersion:e})=>async()=>{var s,n,a,o,l;const t=typeof window<"u"&&((s=window==null?void 0:window.navigator)!=null&&s.userAgent)?Ag.parse(window.navigator.userAgent):void 0,r=[["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&&r.push([`api/${i}`,e]),r};var rl={};/*! *****************************************************************************
98
+ Copyright (c) Microsoft Corporation.
99
+
100
+ Permission to use, copy, modify, and/or distribute this software for any
101
+ purpose with or without fee is hereby granted.
102
+
103
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
104
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
105
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
106
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
107
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
108
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
109
+ PERFORMANCE OF THIS SOFTWARE.
110
+ ***************************************************************************** */var ic=function(i,e){return ic=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)r.hasOwnProperty(s)&&(t[s]=r[s])},ic(i,e)};function xb(i,e){ic(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var sc=function(){return sc=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},sc.apply(this,arguments)};function bb(i,e){var t={};for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(i);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(i,r[s])&&(t[r[s]]=i[r[s]]);return t}function Eb(i,e,t,r){var s=arguments.length,n=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(a=i[o])&&(n=(s<3?a(n):s>3?a(e,t,n):a(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n}function Tb(i,e){return function(t,r){e(t,r,i)}}function wb(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}function Ab(i,e,t,r){function s(n){return n instanceof t?n:new t(function(a){a(n)})}return new(t||(t=Promise))(function(n,a){function o(h){try{u(r.next(h))}catch(d){a(d)}}function l(h){try{u(r.throw(h))}catch(d){a(d)}}function u(h){h.done?n(h.value):s(h.value).then(o,l)}u((r=r.apply(i,e||[])).next())})}function _b(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(h){return l([u,h])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(n=u[0]&2?s.return:u[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,u[1])).done)return n;switch(s=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++,s=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(h){u=[6,h],s=0}finally{r=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Cb(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]}function Lb(i,e){for(var t in i)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=i[t])}function nc(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],r=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Cg(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var r=t.call(i),s,n=[],a;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(o){a={error:o}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return n}function Rb(){for(var i=[],e=0;e<arguments.length;e++)i=i.concat(Cg(arguments[e]));return i}function Ib(){for(var i=0,e=0,t=arguments.length;e<t;e++)i+=arguments[e].length;for(var r=Array(i),s=0,e=0;e<t;e++)for(var n=arguments[e],a=0,o=n.length;a<o;a++,s++)r[s]=n[a];return r}function jn(i){return this instanceof jn?(this.v=i,this):new jn(i)}function Pb(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(i,e||[]),s,n=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(g){r[g]&&(s[g]=function(v){return new Promise(function(y,b){n.push([g,v,y,b])>1||o(g,v)})})}function o(g,v){try{l(r[g](v))}catch(y){d(n[0][3],y)}}function l(g){g.value instanceof jn?Promise.resolve(g.value.v).then(u,h):d(n[0][2],g)}function u(g){o("next",g)}function h(g){o("throw",g)}function d(g,v){g(v),n.shift(),n.length&&o(n[0][0],n[0][1])}}function kb(i){var e,t;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,n){e[s]=i[s]?function(a){return(t=!t)?{value:jn(i[s](a)),done:s==="return"}:n?n(a):a}:n}}function Db(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i[Symbol.asyncIterator],t;return e?e.call(i):(i=typeof nc=="function"?nc(i):i[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=i[n]&&function(a){return new Promise(function(o,l){a=i[n](a),s(o,l,a.done,a.value)})}}function s(n,a,o,l){Promise.resolve(l).then(function(u){n({value:u,done:o})},a)}}function Ob(i,e){return Object.defineProperty?Object.defineProperty(i,"raw",{value:e}):i.raw=e,i}function Mb(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,e}function Fb(i){return i&&i.__esModule?i:{default:i}}function Nb(i,e){if(!e.has(i))throw new TypeError("attempted to get private field on non-instance");return e.get(i)}function Bb(i,e,t){if(!e.has(i))throw new TypeError("attempted to set private field on non-instance");return e.set(i,t),t}const $b=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return sc},__asyncDelegator:kb,__asyncGenerator:Pb,__asyncValues:Db,__await:jn,__awaiter:Ab,__classPrivateFieldGet:Nb,__classPrivateFieldSet:Bb,__createBinding:Cb,__decorate:Eb,__exportStar:Lb,__extends:xb,__generator:_b,__importDefault:Fb,__importStar:Mb,__makeTemplateObject:Ob,__metadata:wb,__param:Tb,__read:Cg,__rest:bb,__spread:Rb,__spreadArrays:Ib,__values:nc},Symbol.toStringTag,{value:"Module"})),Lg=ls($b);var yn={},Jh;function Ub(){if(Jh)return yn;Jh=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.AwsCrc32=void 0;var i=Lg,e=Qn(),t=Rg(),r=function(){function s(){this.crc32=new t.Crc32}return s.prototype.update=function(n){(0,e.isEmptyData)(n)||this.crc32.update((0,e.convertToBuffer)(n))},s.prototype.digest=function(){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(n){return[2,(0,e.numToUint8)(this.crc32.digest())]})})},s.prototype.reset=function(){this.crc32=new t.Crc32},s}();return yn.AwsCrc32=r,yn}var Zh;function Rg(){return Zh||(Zh=1,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.AwsCrc32=i.Crc32=i.crc32=void 0;var e=Lg,t=Qn();function r(l){return new s().update(l).digest()}i.crc32=r;var s=function(){function l(){this.checksum=4294967295}return l.prototype.update=function(u){var h,d;try{for(var g=e.__values(u),v=g.next();!v.done;v=g.next()){var y=v.value;this.checksum=this.checksum>>>8^a[(this.checksum^y)&255]}}catch(b){h={error:b}}finally{try{v&&!v.done&&(d=g.return)&&d.call(g)}finally{if(h)throw h.error}}return this},l.prototype.digest=function(){return(this.checksum^4294967295)>>>0},l}();i.Crc32=s;var n=[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],a=(0,t.uint32ArrayFrom)(n),o=Ub();Object.defineProperty(i,"AwsCrc32",{enumerable:!0,get:function(){return o.AwsCrc32}})}(rl)),rl}var Ig=Rg();class Ln{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 r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)t[r]=s;return e<0&&ef(t),new Ln(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&ef(e),parseInt(lr(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function ef(i){for(let e=0;e<8;e++)i[e]^=255;for(let e=7;e>-1&&(i[e]++,i[e]===0);e--);}class Gb{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 r=new Uint8Array(t.reduce((n,a)=>n+a.byteLength,0));let s=0;for(const n of t)r.set(n,s),s+=n.byteLength;return r}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 r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;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 h=new Uint8Array(9);return h[0]=8,h.set(Ln.fromNumber(e.value.valueOf()).bytes,1),h;case"uuid":if(!Xb.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(Vp(e.value.replace(/\-/g,"")),1),d}}parse(e){const t={};let r=0;for(;r<e.byteLength;){const s=e.getUint8(r++),n=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,s));switch(r+=s,e.getUint8(r++)){case 0:t[n]={type:rf,value:!0};break;case 1:t[n]={type:rf,value:!1};break;case 2:t[n]={type:Vb,value:e.getInt8(r++)};break;case 3:t[n]={type:jb,value:e.getInt16(r,!1)},r+=2;break;case 4:t[n]={type:Hb,value:e.getInt32(r,!1)},r+=4;break;case 5:t[n]={type:Kb,value:new Ln(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case 6:const a=e.getUint16(r,!1);r+=2,t[n]={type:zb,value:new Uint8Array(e.buffer,e.byteOffset+r,a)},r+=a;break;case 7:const o=e.getUint16(r,!1);r+=2,t[n]={type:Wb,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,o))},r+=o;break;case 8:t[n]={type:qb,value:new Date(new Ln(new Uint8Array(e.buffer,e.byteOffset+r,8)).valueOf())},r+=8;break;case 9:const l=new Uint8Array(e.buffer,e.byteOffset+r,16);r+=16,t[n]={type:Yb,value:`${lr(l.subarray(0,4))}-${lr(l.subarray(4,6))}-${lr(l.subarray(6,8))}-${lr(l.subarray(8,10))}-${lr(l.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}}var tf;(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"})(tf||(tf={}));const rf="boolean",Vb="byte",jb="short",Hb="integer",Kb="long",zb="binary",Wb="string",qb="timestamp",Yb="uuid",Xb=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Pg=4,Di=Pg*2,Qi=4,Qb=Di+Qi*2;function Jb({byteLength:i,byteOffset:e,buffer:t}){if(i<Qb)throw new Error("Provided message too short to accommodate event stream message overhead");const r=new DataView(t,e,i),s=r.getUint32(0,!1);if(i!==s)throw new Error("Reported message length does not match received message length");const n=r.getUint32(Pg,!1),a=r.getUint32(Di,!1),o=r.getUint32(i-Qi,!1),l=new Ig.Crc32().update(new Uint8Array(t,e,Di));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+Di,i-(Di+Qi))),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+Di+Qi,n),body:new Uint8Array(t,e+Di+Qi+n,s-n-(Di+Qi+Qi))}}class Zb{constructor(e,t){this.headerMarshaller=new Gb(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 r=this.headerMarshaller.format(e),s=r.byteLength+t.byteLength+16,n=new Uint8Array(s),a=new DataView(n.buffer,n.byteOffset,n.byteLength),o=new Ig.Crc32;return a.setUint32(0,s,!1),a.setUint32(4,r.byteLength,!1),a.setUint32(8,o.update(n.subarray(0,8)).digest(),!1),n.set(r,12),n.set(t,r.byteLength+12),a.setUint32(s-4,o.update(n.subarray(8,s-4)).digest(),!1),n}decode(e){const{headers:t,body:r}=Jb(e);return{headers:this.headerMarshaller.parse(t),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}}class eE{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 tE{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 rE{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 iE{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 sE(i){let e=0,t=0,r=null,s=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,r=new Uint8Array(o),new DataView(r.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 r;else throw new Error("Truncated event message received.");else return;return}const h=l.length;let d=0;for(;d<h;){if(!r){const v=h-d;s||(s=new Uint8Array(4));const y=Math.min(4-t,v);if(s.set(l.slice(d,d+y),t),t+=y,d+=y,t<4)break;n(new DataView(s.buffer).getUint32(0,!1)),s=null}const g=Math.min(e-t,h-d);r.set(l.slice(d,d+g),t),t+=g,d+=g,e&&e===t&&(yield r,r=null,e=0,t=0)}}};return{[Symbol.asyncIterator]:a}}function nE(i,e){return async function(t){const{value:r}=t.headers[":message-type"];if(r==="error"){const s=new Error(t.headers[":error-message"].value||"UnknownError");throw s.name=t.headers[":error-code"].value,s}else if(r==="exception"){const s=t.headers[":exception-type"].value,n={[s]:t},a=await i(n);if(a.$unknown){const o=new Error(e(t.body));throw o.name=s,o}throw a[s]}else if(r==="event"){const s={[t.headers[":event-type"].value]:t},n=await i(s);return n.$unknown?void 0:n}else throw Error(`Unrecognizable event type: ${t.headers[":event-type"].value}`)}}let aE=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new Zb(e,t),this.utfEncoder=e}deserialize(e,t){const r=sE(e);return new rE({messageStream:new eE({inputStream:r,decoder:this.eventStreamCodec}),deserializer:nE(t,this.utfEncoder)})}serialize(e,t){return new tE({messageStream:new iE({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};const oE=i=>({[Symbol.asyncIterator]:async function*(){const e=i.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}}}),lE=i=>{const e=i[Symbol.asyncIterator]();return new ReadableStream({async pull(t){const{done:r,value:s}=await e.next();if(r)return t.close();t.enqueue(s)}})};class cE{constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new aE({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){const r=uE(e)?oE(e):e;return this.universalMarshaller.deserialize(r,t)}serialize(e,t){const r=this.universalMarshaller.serialize(e,t);return typeof ReadableStream=="function"?lE(r):r}}const uE=i=>typeof ReadableStream=="function"&&i instanceof ReadableStream,hE=i=>new cE(i),kg=i=>()=>Promise.reject(i),sf=typeof TextEncoder=="function"?new TextEncoder:null,Dg=i=>{if(typeof i=="string"){if(sf)return sf.encode(i).byteLength;let e=i.length;for(let t=e-1;t>=0;t--){const r=i.charCodeAt(t);r>127&&r<=2047?e++:r>2047&&r<=65535&&(e+=2),r>=56320&&r<=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}`)},Og="required",Me="type",lt="rules",at="conditions",Ke="fn",ze="argv",pt="ref",Rn="assign",Gr="url",Vr="properties",jr="headers",fE=!0,is="isSet",Zi="stringEquals",il="aws.parseArn",es="arn",Xt="booleanEquals",rr="endpoint",ut="tree",dt="error",Es={[Og]:!1,[Me]:"String"},nf={[Og]:!0,default:!1,[Me]:"Boolean"},sl={[Ke]:"not",[ze]:[{[Ke]:is,[ze]:[{[pt]:"Endpoint"}]}]},Mg={[pt]:"Endpoint"},va={[Ke]:is,[ze]:[{[pt]:"Region"}]},ya={[Ke]:"aws.partition",[ze]:[{[pt]:"Region"}],[Rn]:"PartitionResult"},nl={[Ke]:"not",[ze]:[{[Ke]:Zi,[ze]:[{[Ke]:"getAttr",[ze]:[{[pt]:"PartitionResult"},"name"]},"aws-iso"]}]},$c={[Ke]:"getAttr",[ze]:[{[pt]:"PartitionResult"},"name"]},al={[Ke]:"not",[ze]:[{[Ke]:Zi,[ze]:[$c,"aws-iso-b"]}]},qa={[Ke]:"getAttr",[ze]:[{[pt]:"PartitionResult"},"supportsFIPS"]},gr={},Fg={[dt]:"FIPS is enabled but this partition does not support FIPS",[Me]:dt},Ng={[dt]:"DualStack is enabled but this partition does not support DualStack",[Me]:dt},ol={[dt]:"Invalid ARN: Failed to parse ARN.",[Me]:dt},af={[Ke]:Xt,[ze]:[!0,{[Ke]:"getAttr",[ze]:[{[pt]:"PartitionResult"},"supportsDualStack"]}]},of=[{[pt]:"StreamARN"}],dE=[{[Ke]:is,[ze]:[Mg]}],ll=[{[at]:[{[Ke]:"isValidHostLabel",[ze]:[{[Ke]:"getAttr",[ze]:[{[pt]:es},"accountId"]},!1]}],[lt]:[{[at]:[{[Ke]:"isValidHostLabel",[ze]:[{[Ke]:"getAttr",[ze]:[{[pt]:es},"region"]},!1]}],[lt]:[{[at]:[{[Ke]:Zi,[ze]:[{[Ke]:"getAttr",[ze]:[{[pt]:es},"service"]},"kinesis"]}],[lt]:[{[at]:[{[Ke]:"getAttr",[ze]:[{[pt]:es},"resourceId[0]"],[Rn]:"arnType"},{[Ke]:"not",[ze]:[{[Ke]:Zi,[ze]:[{[pt]:"arnType"},""]}]}],[lt]:[{[at]:[{[Ke]:Zi,[ze]:[{[pt]:"arnType"},"stream"]}],[lt]:[{[at]:[{[Ke]:Zi,[ze]:[$c,"{arn#partition}"]}],[lt]:[{[at]:[{[Ke]:is,[ze]:[{[pt]:"OperationType"}]}],[lt]:[{[at]:[{[Ke]:Xt,[ze]:[{[pt]:"UseFIPS"},!0]},{[Ke]:Xt,[ze]:[{[pt]:"UseDualStack"},!0]}],[lt]:[{[at]:[{[Ke]:Xt,[ze]:[qa,!0]}],[lt]:[{[at]:[{[Ke]:Xt,[ze]:[{[Ke]:"getAttr",[ze]:[{[pt]:"PartitionResult"},"supportsDualStack"]},!0]}],[lt]:[{[rr]:{[Gr]:"https://{arn#accountId}.{OperationType}-kinesis-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[Vr]:{},[jr]:{}},[Me]:rr}],[Me]:ut},{[dt]:"DualStack is enabled, but this partition does not support DualStack.",[Me]:dt}],[Me]:ut},{[dt]:"FIPS is enabled, but this partition does not support FIPS.",[Me]:dt}],[Me]:ut},{[at]:[{[Ke]:Xt,[ze]:[{[pt]:"UseFIPS"},!0]}],[lt]:[{[at]:[{[Ke]:Xt,[ze]:[qa,!0]}],[lt]:[{[rr]:{[Gr]:"https://{arn#accountId}.{OperationType}-kinesis-fips.{Region}.{PartitionResult#dnsSuffix}",[Vr]:{},[jr]:{}},[Me]:rr}],[Me]:ut},Fg],[Me]:ut},{[at]:[{[Ke]:Xt,[ze]:[{[pt]:"UseDualStack"},!0]}],[lt]:[{[at]:[{[Ke]:Xt,[ze]:[{[Ke]:"getAttr",[ze]:[{[pt]:"PartitionResult"},"supportsDualStack"]},!0]}],[lt]:[{[rr]:{[Gr]:"https://{arn#accountId}.{OperationType}-kinesis.{Region}.{PartitionResult#dualStackDnsSuffix}",[Vr]:{},[jr]:{}},[Me]:rr}],[Me]:ut},Ng],[Me]:ut},{[rr]:{[Gr]:"https://{arn#accountId}.{OperationType}-kinesis.{Region}.{PartitionResult#dnsSuffix}",[Vr]:{},[jr]:{}},[Me]:rr}],[Me]:ut},{[dt]:"Operation Type is not set. Please contact service team for resolution.",[Me]:dt}],[Me]:ut},{[dt]:"Partition: {arn#partition} from ARN doesn't match with partition name: {PartitionResult#name}.",[Me]:dt}],[Me]:ut},{[dt]:"Invalid ARN: Kinesis ARNs don't support `{arnType}` arn types.",[Me]:dt}],[Me]:ut},{[dt]:"Invalid ARN: No ARN type specified",[Me]:dt}],[Me]:ut},{[dt]:"Invalid ARN: The ARN was not for the Kinesis service, found: {arn#service}.",[Me]:dt}],[Me]:ut},{[dt]:"Invalid ARN: Invalid region.",[Me]:dt}],[Me]:ut},{[dt]:"Invalid ARN: Invalid account id.",[Me]:dt}],pE=[{[Ke]:Xt,[ze]:[{[pt]:"UseFIPS"},!0]},{[Ke]:Xt,[ze]:[{[pt]:"UseDualStack"},!0]}],gE=[{[Ke]:Xt,[ze]:[qa,!0]}],lf=[{[Ke]:Xt,[ze]:[{[pt]:"UseFIPS"},!0]}],cf=[{[Ke]:Xt,[ze]:[{[pt]:"UseDualStack"},!0]}],uf=[{[pt]:"ConsumerARN"}],hf=[{[pt]:"ResourceARN"}],mE={version:"1.0",parameters:{Region:Es,UseDualStack:nf,UseFIPS:nf,Endpoint:Es,StreamARN:Es,OperationType:Es,ConsumerARN:Es,ResourceARN:Es},[lt]:[{[at]:[{[Ke]:is,[ze]:of},sl,va,ya,nl,al],[lt]:[{[at]:[{[Ke]:il,[ze]:of,[Rn]:es}],[lt]:ll,[Me]:ut},ol],[Me]:ut},{[at]:[{[Ke]:is,[ze]:uf},sl,va,ya,nl,al],[lt]:[{[at]:[{[Ke]:il,[ze]:uf,[Rn]:es}],[lt]:ll,[Me]:ut},ol],[Me]:ut},{[at]:[{[Ke]:is,[ze]:hf},sl,va,ya,nl,al],[lt]:[{[at]:[{[Ke]:il,[ze]:hf,[Rn]:es}],[lt]:ll,[Me]:ut},ol],[Me]:ut},{[at]:dE,[lt]:[{[at]:lf,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Me]:dt},{[at]:cf,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Me]:dt},{endpoint:{[Gr]:Mg,[Vr]:gr,[jr]:gr},[Me]:rr}],[Me]:ut},{[at]:[va],[lt]:[{[at]:[ya],[lt]:[{[at]:pE,[lt]:[{[at]:[{[Ke]:Xt,[ze]:[fE,qa]},af],[lt]:[{endpoint:{[Gr]:"https://kinesis-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[Vr]:gr,[jr]:gr},[Me]:rr}],[Me]:ut},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Me]:dt}],[Me]:ut},{[at]:lf,[lt]:[{[at]:gE,[lt]:[{[at]:[{[Ke]:Zi,[ze]:[$c,"aws-us-gov"]}],endpoint:{[Gr]:"https://kinesis.{Region}.amazonaws.com",[Vr]:gr,[jr]:gr},[Me]:rr},{endpoint:{[Gr]:"https://kinesis-fips.{Region}.{PartitionResult#dnsSuffix}",[Vr]:gr,[jr]:gr},[Me]:rr}],[Me]:ut},Fg],[Me]:ut},{[at]:cf,[lt]:[{[at]:[af],[lt]:[{endpoint:{[Gr]:"https://kinesis.{Region}.{PartitionResult#dualStackDnsSuffix}",[Vr]:gr,[jr]:gr},[Me]:rr}],[Me]:ut},Ng],[Me]:ut},{endpoint:{[Gr]:"https://kinesis.{Region}.{PartitionResult#dnsSuffix}",[Vr]:gr,[jr]:gr},[Me]:rr}],[Me]:ut}],[Me]:ut},{error:"Invalid Configuration: Missing Region",[Me]:dt}]},vE=mE,yE=(i,e={})=>xp(vE,{endpointParams:i,logger:e.logger});Mn.aws=Ic;const SE=i=>({apiVersion:"2013-12-02",base64Decoder:(i==null?void 0:i.base64Decoder)??vo,base64Encoder:(i==null?void 0:i.base64Encoder)??Oc,disableHostPrefix:(i==null?void 0:i.disableHostPrefix)??!1,endpointProvider:(i==null?void 0:i.endpointProvider)??yE,extensions:(i==null?void 0:i.extensions)??[],httpAuthSchemeProvider:(i==null?void 0:i.httpAuthSchemeProvider)??KS,httpAuthSchemes:(i==null?void 0:i.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new tg}],logger:(i==null?void 0:i.logger)??new kc,serviceId:(i==null?void 0:i.serviceId)??"Kinesis",urlParser:(i==null?void 0:i.urlParser)??Nn,utf8Decoder:(i==null?void 0:i.utf8Decoder)??ns,utf8Encoder:(i==null?void 0:i.utf8Encoder)??Dc});class Uc extends Error{constructor(e,t=!0){super(e),this.tryNextLink=t,this.name="ProviderError",Object.setPrototypeOf(this,Uc.prototype)}static from(e,t=!0){return Object.assign(new this(e.message,t),e)}}class js extends Uc{constructor(e,t=!0){super(e,t),this.tryNextLink=t,this.name="CredentialsProviderError",Object.setPrototypeOf(this,js.prototype)}}const xE=(i,e,t)=>{let r,s,n,a=!1;const o=async()=>{s||(s=i());try{r=await s,n=!0,a=!1}finally{s=void 0}return r};return async l=>((!n||l!=null&&l.forceRefresh)&&(r=await o()),r)},bE=["in-region","cross-region","mobile","standard","legacy"],Bg=({defaultsMode:i}={})=>xE(async()=>{const e=typeof i=="function"?await i():i;switch(e==null?void 0:e.toLowerCase()){case"auto":return Promise.resolve(EE()?"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 ${bE.join(", ")}, got ${e}`)}}),EE=()=>{var t,r;const i=typeof window<"u"&&((t=window==null?void 0:window.navigator)!=null&&t.userAgent)?Ag.parse(window.navigator.userAgent):void 0,e=(r=i==null?void 0:i.platform)==null?void 0:r.type;return e==="tablet"||e==="mobile"},TE=i=>{const e=Bg(i),t=()=>e().then(Hp),r=SE(i);return{...r,...i,runtime:"browser",defaultsMode:e,bodyLengthChecker:(i==null?void 0:i.bodyLengthChecker)??Dg,credentialDefaultProvider:(i==null?void 0:i.credentialDefaultProvider)??(s=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(i==null?void 0:i.defaultUserAgentProvider)??_g({serviceId:r.serviceId,clientVersion:d1.version}),eventStreamSerdeProvider:(i==null?void 0:i.eventStreamSerdeProvider)??hE,maxAttempts:(i==null?void 0:i.maxAttempts)??Bn,region:(i==null?void 0:i.region)??kg("Region is missing"),requestHandler:yo.create((i==null?void 0:i.requestHandler)??t),retryMode:(i==null?void 0:i.retryMode)??(async()=>(await t()).retryMode||Dp),sha256:(i==null?void 0:i.sha256)??Nc.Sha256,streamCollector:(i==null?void 0:i.streamCollector)??Up,useDualstackEndpoint:(i==null?void 0:i.useDualstackEndpoint)??(()=>Promise.resolve(Tp)),useFipsEndpoint:(i==null?void 0:i.useFipsEndpoint)??(()=>Promise.resolve(wp))}},$g=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}}},Ug=i=>({region:i.region()}),wE=i=>{const e=i.httpAuthSchemes;let t=i.httpAuthSchemeProvider,r=i.credentials;return{setHttpAuthScheme(s){const n=e.findIndex(a=>a.schemeId===s.schemeId);n===-1?e.push(s):e.splice(n,1,s)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(s){t=s},httpAuthSchemeProvider(){return t},setCredentials(s){r=s},credentials(){return r}}},AE=i=>({httpAuthSchemes:i.httpAuthSchemes(),httpAuthSchemeProvider:i.httpAuthSchemeProvider(),credentials:i.credentials()}),Sa=i=>i,_E=(i,e)=>{const t={...Sa($g(i)),...Sa(Kp(i)),...Sa(op(i)),...Sa(wE(i))};return e.forEach(r=>r.configure(t)),{...i,...Ug(t),...zp(t),...lp(t),...AE(t)}};class CE extends $p{constructor(...[e]){const t=TE(e||{}),r=WS(t),s=_p(r),n=Pp(s),a=Bp(n),o=a,l=fp(o),u=hS(l),h=zS(u),d=_E(h,(e==null?void 0:e.extensions)||[]);super(d),this.config=d,this.middlewareStack.use(Yp(this.config)),this.middlewareStack.use(Zp(this.config)),this.middlewareStack.use(cp(this.config)),this.middlewareStack.use(up(this.config)),this.middlewareStack.use(hp(this.config)),this.middlewareStack.use(Ep(this.config)),this.middlewareStack.use(kp(this.config,{httpAuthSchemeParametersProvider:this.getDefaultHttpAuthSchemeParametersProvider(),identityProviderConfigProvider:this.getIdentityProviderConfigProvider()})),this.middlewareStack.use(Xp(this.config))}destroy(){super.destroy()}getDefaultHttpAuthSchemeParametersProvider(){return jS}getIdentityProviderConfigProvider(){return async e=>new Qp({"aws.auth#sigv4":e.credentials})}}class Bt extends So{constructor(e){super(e),Object.setPrototypeOf(this,Bt.prototype)}}class Gc extends Bt{constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,Gc.prototype)}}class Vc extends Bt{constructor(e){super({name:"InvalidArgumentException",$fault:"client",...e}),this.name="InvalidArgumentException",this.$fault="client",Object.setPrototypeOf(this,Vc.prototype)}}class jc extends Bt{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,jc.prototype)}}class Hc extends Bt{constructor(e){super({name:"ResourceInUseException",$fault:"client",...e}),this.name="ResourceInUseException",this.$fault="client",Object.setPrototypeOf(this,Hc.prototype)}}class Kc extends Bt{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,Kc.prototype)}}class zc extends Bt{constructor(e){super({name:"ExpiredIteratorException",$fault:"client",...e}),this.name="ExpiredIteratorException",this.$fault="client",Object.setPrototypeOf(this,zc.prototype)}}class Wc extends Bt{constructor(e){super({name:"ExpiredNextTokenException",$fault:"client",...e}),this.name="ExpiredNextTokenException",this.$fault="client",Object.setPrototypeOf(this,Wc.prototype)}}class qc extends Bt{constructor(e){super({name:"KMSAccessDeniedException",$fault:"client",...e}),this.name="KMSAccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,qc.prototype)}}class Yc extends Bt{constructor(e){super({name:"KMSDisabledException",$fault:"client",...e}),this.name="KMSDisabledException",this.$fault="client",Object.setPrototypeOf(this,Yc.prototype)}}class Xc extends Bt{constructor(e){super({name:"KMSInvalidStateException",$fault:"client",...e}),this.name="KMSInvalidStateException",this.$fault="client",Object.setPrototypeOf(this,Xc.prototype)}}class Qc extends Bt{constructor(e){super({name:"KMSNotFoundException",$fault:"client",...e}),this.name="KMSNotFoundException",this.$fault="client",Object.setPrototypeOf(this,Qc.prototype)}}class Jc extends Bt{constructor(e){super({name:"KMSOptInRequired",$fault:"client",...e}),this.name="KMSOptInRequired",this.$fault="client",Object.setPrototypeOf(this,Jc.prototype)}}class Zc extends Bt{constructor(e){super({name:"KMSThrottlingException",$fault:"client",...e}),this.name="KMSThrottlingException",this.$fault="client",Object.setPrototypeOf(this,Zc.prototype)}}class eu extends Bt{constructor(e){super({name:"ProvisionedThroughputExceededException",$fault:"client",...e}),this.name="ProvisionedThroughputExceededException",this.$fault="client",Object.setPrototypeOf(this,eu.prototype)}}class tu extends Bt{constructor(e){super({name:"ValidationException",$fault:"client",...e}),this.name="ValidationException",this.$fault="client",Object.setPrototypeOf(this,tu.prototype)}}var ff;(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])})(ff||(ff={}));const LE=async(i,e)=>{const t=YE("PutRecord");let r;return r=JSON.stringify(zE(i,e)),qE(e,t,"/",void 0,r)},RE=async(i,e)=>{if(i.statusCode>=300)return IE(i,e);const t=await Fc(i.body,e);let r={};return r=kt(t),{$metadata:Wt(i),...r}},IE=async(i,e)=>{const t={...i,body:await hg(i.body,e)},r=fg(i,t.body);switch(r){case"AccessDeniedException":case"com.amazonaws.kinesis#AccessDeniedException":throw await PE(t);case"InvalidArgumentException":case"com.amazonaws.kinesis#InvalidArgumentException":throw await OE(t);case"LimitExceededException":case"com.amazonaws.kinesis#LimitExceededException":throw await GE(t);case"ResourceInUseException":case"com.amazonaws.kinesis#ResourceInUseException":throw await jE(t);case"ResourceNotFoundException":case"com.amazonaws.kinesis#ResourceNotFoundException":throw await HE(t);case"ExpiredIteratorException":case"com.amazonaws.kinesis#ExpiredIteratorException":throw await kE(t);case"KMSAccessDeniedException":case"com.amazonaws.kinesis#KMSAccessDeniedException":throw await ME(t);case"KMSDisabledException":case"com.amazonaws.kinesis#KMSDisabledException":throw await FE(t);case"KMSInvalidStateException":case"com.amazonaws.kinesis#KMSInvalidStateException":throw await NE(t);case"KMSNotFoundException":case"com.amazonaws.kinesis#KMSNotFoundException":throw await BE(t);case"KMSOptInRequired":case"com.amazonaws.kinesis#KMSOptInRequired":throw await $E(t);case"KMSThrottlingException":case"com.amazonaws.kinesis#KMSThrottlingException":throw await UE(t);case"ProvisionedThroughputExceededException":case"com.amazonaws.kinesis#ProvisionedThroughputExceededException":throw await VE(t);case"ExpiredNextTokenException":case"com.amazonaws.kinesis#ExpiredNextTokenException":throw await DE(t);case"ValidationException":case"com.amazonaws.kinesis#ValidationException":throw await KE(t);default:const s=t.body;return WE({output:i,parsedBody:s,errorCode:r})}},PE=async(i,e)=>{const t=i.body,r=kt(t),s=new Gc({$metadata:Wt(i),...r});return jt(s,t)},kE=async(i,e)=>{const t=i.body,r=kt(t),s=new zc({$metadata:Wt(i),...r});return jt(s,t)},DE=async(i,e)=>{const t=i.body,r=kt(t),s=new Wc({$metadata:Wt(i),...r});return jt(s,t)},OE=async(i,e)=>{const t=i.body,r=kt(t),s=new Vc({$metadata:Wt(i),...r});return jt(s,t)},ME=async(i,e)=>{const t=i.body,r=kt(t),s=new qc({$metadata:Wt(i),...r});return jt(s,t)},FE=async(i,e)=>{const t=i.body,r=kt(t),s=new Yc({$metadata:Wt(i),...r});return jt(s,t)},NE=async(i,e)=>{const t=i.body,r=kt(t),s=new Xc({$metadata:Wt(i),...r});return jt(s,t)},BE=async(i,e)=>{const t=i.body,r=kt(t),s=new Qc({$metadata:Wt(i),...r});return jt(s,t)},$E=async(i,e)=>{const t=i.body,r=kt(t),s=new Jc({$metadata:Wt(i),...r});return jt(s,t)},UE=async(i,e)=>{const t=i.body,r=kt(t),s=new Zc({$metadata:Wt(i),...r});return jt(s,t)},GE=async(i,e)=>{const t=i.body,r=kt(t),s=new jc({$metadata:Wt(i),...r});return jt(s,t)},VE=async(i,e)=>{const t=i.body,r=kt(t),s=new eu({$metadata:Wt(i),...r});return jt(s,t)},jE=async(i,e)=>{const t=i.body,r=kt(t),s=new Hc({$metadata:Wt(i),...r});return jt(s,t)},HE=async(i,e)=>{const t=i.body,r=kt(t),s=new Kc({$metadata:Wt(i),...r});return jt(s,t)},KE=async(i,e)=>{const t=i.body,r=kt(t),s=new tu({$metadata:Wt(i),...r});return jt(s,t)},zE=(i,e)=>Wp(i,{Data:e.base64Encoder,ExplicitHashKey:[],PartitionKey:[],SequenceNumberForOrdering:[],StreamARN:[],StreamName:[]}),Wt=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"]}),WE=jp(Bt),qE=async(i,e,t,r,s)=>{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 s!==void 0&&(u.body=s),new kr(u)};function YE(i){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`Kinesis_20131202.${i}`}}class XE extends Mc.classBuilder().ep({...qS,OperationType:{type:"staticContextParams",value:"data"},StreamARN:{type:"contextParams",name:"StreamARN"}}).m(function(e,t,r,s){return[Lp(r,this.serialize,this.deserialize),Ip(r,e.getEndpointParameterInstructions())]}).s("Kinesis_20131202","PutRecord",{}).n("KinesisClient","PutRecordCommand").f(void 0,void 0).ser(LE).de(RE).build(){}function Gg(i){return Promise.all(Object.keys(i).reduce((e,t)=>{const r=i[t];return typeof r=="string"?e.push([t,r]):e.push(r().then(s=>[t,s])),e},[])).then(e=>e.reduce((t,[r,s])=>(t[r]=s,t),{}))}function QE(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("./BVABk0Tw.cjs.js")),{Credentials:{AccessKeyId:r=JE(),Expiration:s,SecretKey:n=eT(),SessionToken:a}=ZE()}=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 Gg(i.logins):void 0}));return{identityId:i.identityId,accessKeyId:r,secretAccessKey:n,sessionToken:a,expiration:s}}}function JE(){throw new js("Response from Amazon Cognito contained no access key ID")}function ZE(){throw new js("Response from Amazon Cognito contained no credentials")}function eT(){throw new js("Response from Amazon Cognito contained no secret key")}const cl="IdentityIds";class tT{constructor(e="aws:cognito-identity-ids"){this.dbName=e}getItem(e){return this.withObjectStore("readonly",t=>{const r=t.get(e);return new Promise(s=>{r.onerror=()=>s(null),r.onsuccess=()=>s(r.result?r.result.value:null)})}).catch(()=>null)}removeItem(e){return this.withObjectStore("readwrite",t=>{const r=t.delete(e);return new Promise((s,n)=>{r.onerror=()=>n(r.error),r.onsuccess=()=>s()})})}setItem(e,t){return this.withObjectStore("readwrite",r=>{const s=r.put({id:e,value:t});return new Promise((n,a)=>{s.onerror=()=>a(s.error),s.onsuccess=()=>n()})})}getDb(){const e=self.indexedDB.open(this.dbName,1);return new Promise((t,r)=>{e.onsuccess=()=>{t(e.result)},e.onerror=()=>{r(e.error)},e.onblocked=()=>{r(new Error("Unable to access DB"))},e.onupgradeneeded=()=>{const s=e.result;s.onerror=()=>{r(new Error("Failed to create object store"))},s.createObjectStore(cl,{keyPath:"id"})}})}withObjectStore(e,t){return this.getDb().then(r=>{const s=r.transaction(cl,e);return s.oncomplete=()=>r.close(),new Promise((n,a)=>{s.onerror=()=>a(s.error),n(t(s.objectStore(cl)))}).catch(n=>{throw r.close(),n})})}}class rT{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 iT=new rT;function sT(){return typeof self=="object"&&self.indexedDB?new tT:typeof window=="object"&&window.localStorage?window.localStorage:iT}function nT({accountId:i,cache:e=sT(),client:t,clientConfig:r,customRoleArn:s,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 h=o?`aws:cognito-identity-credentials:${n}:${o}`:void 0;let d=async()=>{const{GetIdCommand:g,CognitoIdentityClient:v}=await Promise.resolve().then(()=>require("./BVABk0Tw.cjs.js")),y=t??new v(Object.assign({},r??{},{region:(r==null?void 0:r.region)??(u==null?void 0:u.region)}));let b=h&&await e.getItem(h);if(!b){const{IdentityId:E=aT()}=await y.send(new g({AccountId:i,IdentityPoolId:n,Logins:a?await Gg(a):void 0}));b=E,h&&Promise.resolve(e.setItem(h,b)).catch(()=>{})}return d=QE({client:y,customRoleArn:s,logins:a,identityId:b}),d()};return()=>d().catch(async g=>{throw h&&Promise.resolve(e.removeItem(h)).catch(()=>{}),g})}function aT(){throw new js("Response from Amazon Cognito contained no identity ID")}const oT=async(i,e,t)=>({operation:Xn(e).operation,region:await mi(i.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function lT(i){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:i.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function xa(i){return{schemeId:"smithy.api#noAuth"}}const cT=i=>{const e=[];switch(i.operation){case"GetCredentialsForIdentity":{e.push(xa());break}case"GetId":{e.push(xa());break}case"GetOpenIdToken":{e.push(xa());break}case"UnlinkIdentity":{e.push(xa());break}default:e.push(lT(i))}return e},uT=i=>({...ug(i)}),hT=i=>({...i,useDualstackEndpoint:i.useDualstackEndpoint??!1,useFipsEndpoint:i.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),fT={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},dT="@aws-sdk/client-cognito-identity",pT="AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",gT="3.582.0",mT={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"},vT="./dist-cjs/index.js",yT="./dist-types/index.d.ts",ST="./dist-es/index.js",xT=!1,bT={"@aws-crypto/sha256-browser":"3.0.0","@aws-crypto/sha256-js":"3.0.0","@aws-sdk/client-sso-oidc":"3.582.0","@aws-sdk/client-sts":"3.582.0","@aws-sdk/core":"3.582.0","@aws-sdk/credential-provider-node":"3.582.0","@aws-sdk/middleware-host-header":"3.577.0","@aws-sdk/middleware-logger":"3.577.0","@aws-sdk/middleware-recursion-detection":"3.577.0","@aws-sdk/middleware-user-agent":"3.577.0","@aws-sdk/region-config-resolver":"3.577.0","@aws-sdk/types":"3.577.0","@aws-sdk/util-endpoints":"3.577.0","@aws-sdk/util-user-agent-browser":"3.577.0","@aws-sdk/util-user-agent-node":"3.577.0","@smithy/config-resolver":"^3.0.0","@smithy/core":"^2.0.1","@smithy/fetch-http-handler":"^3.0.1","@smithy/hash-node":"^3.0.0","@smithy/invalid-dependency":"^3.0.0","@smithy/middleware-content-length":"^3.0.0","@smithy/middleware-endpoint":"^3.0.0","@smithy/middleware-retry":"^3.0.1","@smithy/middleware-serde":"^3.0.0","@smithy/middleware-stack":"^3.0.0","@smithy/node-config-provider":"^3.0.0","@smithy/node-http-handler":"^3.0.0","@smithy/protocol-http":"^4.0.0","@smithy/smithy-client":"^3.0.1","@smithy/types":"^3.0.0","@smithy/url-parser":"^3.0.0","@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.1","@smithy/util-defaults-mode-node":"^3.0.1","@smithy/util-endpoints":"^2.0.0","@smithy/util-middleware":"^3.0.0","@smithy/util-retry":"^3.0.0","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},ET={"@aws-sdk/client-iam":"3.582.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"},TT={node:">=16.0.0"},wT={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},AT=["dist-*/**"],_T={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},CT="Apache-2.0",LT={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},RT="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity",IT={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity"},PT={name:dT,description:pT,version:gT,scripts:mT,main:vT,types:yT,module:ST,sideEffects:xT,dependencies:bT,devDependencies:ET,engines:TT,typesVersions:wT,files:AT,author:_T,license:CT,browser:LT,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:RT,repository:IT},Vg="required",Kr="fn",zr="argv",Hs="ref",df=!0,pf="isSet",Hn="booleanEquals",Ts="error",Sn="endpoint",ci="tree",ru="PartitionResult",gf={[Vg]:!1,type:"String"},mf={[Vg]:!0,default:!1,type:"Boolean"},vf={[Hs]:"Endpoint"},jg={[Kr]:Hn,[zr]:[{[Hs]:"UseFIPS"},!0]},Hg={[Kr]:Hn,[zr]:[{[Hs]:"UseDualStack"},!0]},Br={},yf={[Kr]:"getAttr",[zr]:[{[Hs]:ru},"supportsFIPS"]},Sf={[Kr]:Hn,[zr]:[!0,{[Kr]:"getAttr",[zr]:[{[Hs]:ru},"supportsDualStack"]}]},xf=[jg],bf=[Hg],Ef=[{[Hs]:"Region"}],kT={version:"1.0",parameters:{Region:gf,UseDualStack:mf,UseFIPS:mf,Endpoint:gf},rules:[{conditions:[{[Kr]:pf,[zr]:[vf]}],rules:[{conditions:xf,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Ts},{conditions:bf,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Ts},{endpoint:{url:vf,properties:Br,headers:Br},type:Sn}],type:ci},{conditions:[{[Kr]:pf,[zr]:Ef}],rules:[{conditions:[{[Kr]:"aws.partition",[zr]:Ef,assign:ru}],rules:[{conditions:[jg,Hg],rules:[{conditions:[{[Kr]:Hn,[zr]:[df,yf]},Sf],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Br,headers:Br},type:Sn}],type:ci},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Ts}],type:ci},{conditions:xf,rules:[{conditions:[{[Kr]:Hn,[zr]:[yf,df]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Br,headers:Br},type:Sn}],type:ci},{error:"FIPS is enabled but this partition does not support FIPS",type:Ts}],type:ci},{conditions:bf,rules:[{conditions:[Sf],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Br,headers:Br},type:Sn}],type:ci},{error:"DualStack is enabled but this partition does not support DualStack",type:Ts}],type:ci},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:Br,headers:Br},type:Sn}],type:ci}],type:ci},{error:"Invalid Configuration: Missing Region",type:Ts}]},DT=kT,OT=(i,e={})=>xp(DT,{endpointParams:i,logger:e.logger});Mn.aws=Ic;const MT=i=>({apiVersion:"2014-06-30",base64Decoder:(i==null?void 0:i.base64Decoder)??vo,base64Encoder:(i==null?void 0:i.base64Encoder)??Oc,disableHostPrefix:(i==null?void 0:i.disableHostPrefix)??!1,endpointProvider:(i==null?void 0:i.endpointProvider)??OT,extensions:(i==null?void 0:i.extensions)??[],httpAuthSchemeProvider:(i==null?void 0:i.httpAuthSchemeProvider)??cT,httpAuthSchemes:(i==null?void 0:i.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new tg},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new aS}],logger:(i==null?void 0:i.logger)??new kc,serviceId:(i==null?void 0:i.serviceId)??"Cognito Identity",urlParser:(i==null?void 0:i.urlParser)??Nn,utf8Decoder:(i==null?void 0:i.utf8Decoder)??ns,utf8Encoder:(i==null?void 0:i.utf8Encoder)??Dc}),FT=i=>{const e=Bg(i),t=()=>e().then(Hp),r=MT(i);return{...r,...i,runtime:"browser",defaultsMode:e,bodyLengthChecker:(i==null?void 0:i.bodyLengthChecker)??Dg,credentialDefaultProvider:(i==null?void 0:i.credentialDefaultProvider)??(s=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(i==null?void 0:i.defaultUserAgentProvider)??_g({serviceId:r.serviceId,clientVersion:PT.version}),maxAttempts:(i==null?void 0:i.maxAttempts)??Bn,region:(i==null?void 0:i.region)??kg("Region is missing"),requestHandler:yo.create((i==null?void 0:i.requestHandler)??t),retryMode:(i==null?void 0:i.retryMode)??(async()=>(await t()).retryMode||Dp),sha256:(i==null?void 0:i.sha256)??Nc.Sha256,streamCollector:(i==null?void 0:i.streamCollector)??Up,useDualstackEndpoint:(i==null?void 0:i.useDualstackEndpoint)??(()=>Promise.resolve(Tp)),useFipsEndpoint:(i==null?void 0:i.useFipsEndpoint)??(()=>Promise.resolve(wp))}},NT=i=>{const e=i.httpAuthSchemes;let t=i.httpAuthSchemeProvider,r=i.credentials;return{setHttpAuthScheme(s){const n=e.findIndex(a=>a.schemeId===s.schemeId);n===-1?e.push(s):e.splice(n,1,s)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(s){t=s},httpAuthSchemeProvider(){return t},setCredentials(s){r=s},credentials(){return r}}},BT=i=>({httpAuthSchemes:i.httpAuthSchemes(),httpAuthSchemeProvider:i.httpAuthSchemeProvider(),credentials:i.credentials()}),ba=i=>i,$T=(i,e)=>{const t={...ba($g(i)),...ba(Kp(i)),...ba(op(i)),...ba(NT(i))};return e.forEach(r=>r.configure(t)),{...i,...Ug(t),...zp(t),...lp(t),...BT(t)}};class Kg extends $p{constructor(...[e]){const t=FT(e||{}),r=hT(t),s=_p(r),n=Pp(s),a=Bp(n),o=a,l=fp(o),u=uT(l),h=$T(u,(e==null?void 0:e.extensions)||[]);super(h),this.config=h,this.middlewareStack.use(Yp(this.config)),this.middlewareStack.use(Zp(this.config)),this.middlewareStack.use(cp(this.config)),this.middlewareStack.use(up(this.config)),this.middlewareStack.use(hp(this.config)),this.middlewareStack.use(Ep(this.config)),this.middlewareStack.use(kp(this.config,{httpAuthSchemeParametersProvider:this.getDefaultHttpAuthSchemeParametersProvider(),identityProviderConfigProvider:this.getIdentityProviderConfigProvider()})),this.middlewareStack.use(Xp(this.config))}destroy(){super.destroy()}getDefaultHttpAuthSchemeParametersProvider(){return oT}getIdentityProviderConfigProvider(){return async e=>new Qp({"aws.auth#sigv4":e.credentials})}}const Tf={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 UT{constructor({identityPoolId:e,streamName:t}){an(this,"client");an(this,"streamName");an(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}});an(this,"loopId",null);const r=new URLSearchParams(window.location.search);this.client=new CE({region:"ap-northeast-2",credentials:nT({client:new Kg({region:"ap-northeast-2"}),identityPoolId:e})}),this.streamName=t,this.data.um={s:r.get("utm_source")??void 0}}send(e){var s;const t=JSON.stringify(e??this.data),r=new XE({Data:new TextEncoder().encode(t),PartitionKey:"partitionKey-"+Math.random(),StreamName:this.streamName});(s=window==null?void 0:window.__brix_console)==null||s.call(window,"kinesis send",JSON.parse(t)),this.client.send(r)}sleep(e){return new Promise(t=>setTimeout(t,e))}interval(e,t){return new Promise(r=>{this.loopId=setInterval(()=>{t(e),r()},e)})}timeout(e,t){return new Promise(r=>{this.loopId=setTimeout(()=>{t(e),r()},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(){var e;(e=window==null?void 0:window.__brix_console)==null||e.call(window,"kinesis init"),this.data.ii.p=1}async start(){var t,r,s;if(this.loopId&&((t=window==null?void 0:window.__brix_console)==null||t.call(window,"kinesis remove exist start"),clearTimeout(this.loopId),clearInterval(this.loopId)),(r=window==null?void 0:window.__brix_console)==null||r.call(window,"kinesis start"),this.data.ts.wt=new Date().getTime(),this.data.ty==="c"&&!this.data.di.iv){await this.sleep(500),(s=window==null?void 0:window.__brix_console)==null||s.call(window,"require setVodId"),this.stop(),this.init(),this.start();return}const e=n=>{n>1e3&&(this.data.ii.p=0),this.data.ii.i=n;const a=new Date().getTime();this.data.ts.tt=a,this.data.ts.ws=+((a-this.data.ts.wt)/1e3).toFixed(0),this.send()};await this.timeout(1e3,e),await this.timeout(3e3,e),await this.timeout(6e3,e),await this.interval(1e4,e)}stop(){var e;(e=window==null?void 0:window.__brix_console)==null||e.call(window,"kinesis stop"),this.loopId&&(clearTimeout(this.loopId),clearInterval(this.loopId))}sendAnalyze({like:e,comment:t,product:r,share:s,banner:n}){var o;(o=window==null?void 0:window.__brix_console)==null||o.call(window,"kinesis analyze",{like:e,comment:t,product:r,share:s,banner:n});const a={...this.data};e&&(a.cc={lk:e}),t&&(a.cc={c:1}),s&&(a.cc={s:1}),r&&(a.pc={ip:r,tp:this.data.ts.wt}),n&&(a.bc={ib:n,tb:this.data.ts.wt}),this.send(a)}setUser(e,t){var r;(r=window==null?void 0:window.__brix_console)==null||r.call(window,"kinesis setUser",{userId:e,role:t}),this.data.di.iu=e,this.data.di.tu=t===0?"g":"m",this.stop(),this.init(),this.start()}setId(e){var t,r;if((t=window==null?void 0:window.__brix_console)==null||t.call(window,"kinesis setId",{id:e}),!this.data.ty){(r=window==null?void 0:window.__brix_console)==null||r.call(window,"require setType");return}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"),this.stop(),this.init(),this.start()}setClientId(e){var t;(t=window==null?void 0:window.__brix_console)==null||t.call(window,"kinesis setClientId",{id:e}),this.data.di.ic=e}setStatus(e){var t;(t=window==null?void 0:window.__brix_console)==null||t.call(window,"kinesis setStatus",{status:e}),this.data.ii.s=e,e==="cancel"&&this.stop()}setType(e){var t;(t=window==null?void 0:window.__brix_console)==null||t.call(window,"kinesis setType",{type: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){var t;(t=window==null?void 0:window.__brix_console)==null||t.call(window,"kinesis setChannelVodId",{vodId:e}),this.data.di.iv=e,this.init()}setChannelScheduleId(e){var t;(t=window==null?void 0:window.__brix_console)==null||t.call(window,"kinesis setChannelScheduleId",{scheduleId:e}),this.data.di.ics=e}getAPIQuery(){var s;const e=new Date().getTime(),t=+((e-this.data.ts.wt)/1e3).toFixed(0),r={tt:e,ws:t,wt:this.data.ts.wt,p:this.data.ii.p,s:this.data.ii.s};return this.data.ty==="c"?{...r,vodId:this.data.di.iv,ics:this.data.di.ics}:((s=window==null?void 0:window.__brix_console)==null||s.call(window,"kinesis getAPIQuery",{query:r}),r)}}const GT=ye.createContext(null);function VT({kinesis:i,children:e}){return Ye.jsx(GT.Provider,{value:i,children:e})}function jT({element:i,eventName:e,handler:t}){const r=ye.useRef();ye.useEffect(()=>{r.current=t},[t]),ye.useEffect(()=>{if(!(i&&i.addEventListener))return;const s=n=>{r.current&&r.current(n)};return i.addEventListener(e,s),()=>{i.removeEventListener(e,s)}},[e,i])}function wf(i=!1){const[e,t]=ye.useState(i);return[e,()=>t(s=>!s)]}function HT({onClick:i,onDoubleClick:e,time:t=250}){const r=ye.useRef(),s=()=>{r.current&&(clearTimeout(r.current),r.current=void 0)};return ye.useCallback(a=>{s(),a.detail===1&&(r.current=setTimeout(()=>{i==null||i(a)},t)),a.detail===2&&(e==null||e(a))},[i,e,t])}function KT(i,e=500){const[t,r]=ye.useState(i);return ye.useEffect(()=>{let s;const n=()=>{r(i)};return(()=>{clearTimeout(s),s=setTimeout(n,e)})(),()=>clearTimeout(s)},[t,i,e]),[t,r]}function zT({ref:i,...e}){const[t,r]=ye.useState(!1);return ye.useEffect(()=>{const s=i==null?void 0:i.current;if(!s||!window.IntersectionObserver)return;const n=new IntersectionObserver(a=>{if(a.length>0){const o=a[0];r(o.isIntersecting)}},e);return n.observe(s),()=>{n.unobserve(s),n.disconnect()}},[]),t}ye.createContext(null);ye.forwardRef(function({overlayElement:e,onExit:t},r){const[s,n]=ye.useState(!1),a=ye.useCallback(()=>n(!1),[]);return ye.useImperativeHandle(r,()=>({close:a}),[a]),ye.useEffect(()=>{requestAnimationFrame(()=>{n(!0)})},[]),Ye.jsx(e,{isOpen:s,close:a,exit:t})});const WT="_root_1det3_1",qT="_video_1det3_10",YT="_poster_1det3_18",XT="_origin_ratio_1det3_27",QT="_layer_1det3_34",JT="_shadow_1det3_40",ZT="_forward_animation_1det3_62",ew="_forward_1det3_62",tw="_backward_animation_1det3_66",rw="_backward_1det3_66",iw="_indicator_1det3_70",sw="_indicator_right_1det3_77",nw="_indicator_left_1det3_82",aw="_progress_1det3_88",ow="_time_1det3_96",lw="_button_1det3_109",cw="_playbackrate_1det3_131",uw="_play_toggle_1det3_142",hw="_chapter_toggle_1det3_149",fw="_chapter_wrap_1det3_158",Tt={root:WT,video:qT,poster:YT,origin_ratio:XT,layer:QT,shadow:JT,forward_animation:ZT,forward:ew,backward_animation:tw,backward:rw,indicator:iw,indicator_right:sw,indicator_left:nw,progress:aw,time:ow,button:lw,playbackrate:cw,play_toggle:uw,chapter_toggle:hw,chapter_wrap:fw};function dw(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var zg={exports:{}};(function(i,e){(function(t){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,u,h){if(h=h||{},l=l.trim(),u=u.trim(),!u){if(!h.alwaysNormalize)return l;var d=o.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var g=o.parseURL(u);if(!g)throw new Error("Error trying to parse relative URL.");if(g.scheme)return h.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=s.exec(v.path);v.netLoc=y[1],v.path=y[2]}v.netLoc&&!v.path&&(v.path="/");var b={scheme:v.scheme,netLoc:g.netLoc,path:null,params:g.params,query:g.query,fragment:g.fragment};if(!g.netLoc&&(b.netLoc=v.netLoc,g.path[0]!=="/"))if(!g.path)b.path=v.path,g.params||(b.params=v.params,g.query||(b.query=v.query));else{var E=v.path,A=E.substring(0,E.lastIndexOf("/")+1)+g.path;b.path=o.normalizePath(A)}return b.path===null&&(b.path=h.alwaysNormalize?o.normalizePath(g.path):g.path),o.buildURLFromParts(b)},parseURL:function(l){var u=r.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})()})(zg);var iu=zg.exports;function Af(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function Nt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Af(Object(t),!0).forEach(function(r){mw(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Af(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function pw(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function gw(i){var e=pw(i,"string");return typeof e=="symbol"?e:String(e)}function mw(i,e,t){return e=gw(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Lt(){return Lt=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Lt.apply(this,arguments)}const Re=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)},vw=Number.isSafeInteger||function(i){return typeof i=="number"&&Math.abs(i)<=yw},yw=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}({}),Ve=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 Ji=function(){},ac={trace:Ji,debug:Ji,log:Ji,warn:Ji,info:Ji,error:Ji};let In=ac;function Sw(i){const e=self.console[i];return e?e.bind(self.console,`[${i}] >`):Ji}function xw(i,...e){e.forEach(function(t){In[t]=i[t]?i[t].bind(i):Sw(t)})}function bw(i,e){if(typeof console=="object"&&i===!0||typeof i=="object"){xw(i,"debug","log","info","warn","error");try{In.log(`Debug logs enabled for "${e}" in hls.js version 1.5.8`)}catch{In=ac}}else In=ac}const ie=In,Ew=/^(\d+)x(\d+)$/,_f=/(.+?)=(".*?"|.*?)(?:,|$)/g;class bt{constructor(e){typeof e=="string"&&(e=bt.parseAttrList(e)),Lt(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 r=new Uint8Array(t.length/2);for(let s=0;s<t.length/2;s++)r[s]=parseInt(t.slice(s*2,s*2+2),16);return r}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 r=this[e];return r?parseFloat(r):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Ew.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const r={},s='"';for(_f.lastIndex=0;(t=_f.exec(e))!==null;){let n=t[2];n.indexOf(s)===0&&n.lastIndexOf(s)===n.length-1&&(n=n.slice(1,-1));const a=t[1].trim();r[a]=n}return r}}function Tw(i){return i!=="ID"&&i!=="CLASS"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function ww(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"}class Wg{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const r=t.attr;for(const s in r)if(Object.prototype.hasOwnProperty.call(e,s)&&e[s]!==r[s]){ie.warn(`DATERANGE tag attribute: "${s}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=s;break}e=Lt(new bt({}),r,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const r=new Date(this.attr["END-DATE"]);Re(r.getTime())&&(this._endDate=r)}}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(Re(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&&Re(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class xo{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 qg{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 r=e.split("@",2);let s;r.length===1?s=(t==null?void 0:t.byteRangeEndOffset)||0:s=parseInt(r[1]),this._byteRange=[s,parseInt(r[0])+s]}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=iu.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class ul extends qg{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 xo,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 r=Object.keys(this.levelkeys);if(r.length===1)return this._decryptdata=this.levelkeys[r[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!Re(this.programDateTime))return null;const e=Re(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),r=t.length;if(r>1||r===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,r,s,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:r,startDTS:s,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,r),l.startDTS=Math.min(l.startDTS,s),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 Aw extends qg{constructor(e,t,r,s,n){super(r),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new xo,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=s;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 _w=10;class Cw{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,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&r>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?Re(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||_w}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 su(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function Lw(i){const e=oc(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Rw(i){const e=function(r,s,n){const a=r[s];r[s]=r[n],r[n]=a};e(i,0,3),e(i,1,2),e(i,4,5),e(i,6,7)}function Iw(i){const e=i.split(":");let t=null;if(e[0]==="data"&&e.length===2){const r=e[1].split(";"),s=r[r.length-1].split(",");if(s.length===2){const n=s[0]==="base64",a=s[1];n?(r.splice(-1,1),t=su(a)):t=Lw(a)}}return t}function oc(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}const Bs=typeof self<"u"?self:void 0;var yt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ir={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Cf(i){switch(i){case ir.FAIRPLAY:return yt.FAIRPLAY;case ir.PLAYREADY:return yt.PLAYREADY;case ir.WIDEVINE:return yt.WIDEVINE;case ir.CLEARKEY:return yt.CLEARKEY}}var Yg={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Pw(i){if(i===Yg.WIDEVINE)return yt.WIDEVINE}function Lf(i){switch(i){case yt.FAIRPLAY:return ir.FAIRPLAY;case yt.PLAYREADY:return ir.PLAYREADY;case yt.WIDEVINE:return ir.WIDEVINE;case yt.CLEARKEY:return ir.CLEARKEY}}function hl(i){const{drmSystems:e,widevineLicenseUrl:t}=i,r=e?[yt.FAIRPLAY,yt.WIDEVINE,yt.PLAYREADY,yt.CLEARKEY].filter(s=>!!e[s]):[];return!r[yt.WIDEVINE]&&t&&r.push(yt.WIDEVINE),r}const Xg=function(i){return Bs!=null&&(i=Bs.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function kw(i,e,t,r){let s;switch(i){case yt.FAIRPLAY:s=["cenc","sinf"];break;case yt.WIDEVINE:case yt.PLAYREADY:s=["cenc"];break;case yt.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return Dw(s,e,t,r)}function Dw(i,e,t,r){return[{initDataTypes:i,persistentState:r.persistentState||"optional",distinctiveIdentifier:r.distinctiveIdentifier||"optional",sessionTypes:r.sessionTypes||[r.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:r.audioRobustness||"",encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:r.videoRobustness||"",encryptionScheme:r.videoEncryptionScheme||null}))}]}function ss(i,e,t){return Uint8Array.prototype.slice?i.slice(e,t):new Uint8Array(Array.prototype.slice.call(i,e,t))}const nu=(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,Qg=(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,Kn=(i,e)=>{const t=e;let r=0;for(;nu(i,e);){r+=10;const s=bo(i,e+6);r+=s,Qg(i,e+10)&&(r+=10),e+=r}if(r>0)return i.subarray(t,t+r)},bo=(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},Ow=(i,e)=>nu(i,e)&&bo(i,e+6)+10<=i.length-e,au=i=>{const e=Zg(i);for(let t=0;t<e.length;t++){const r=e[t];if(Jg(r))return Uw(r)}},Jg=i=>i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp",Mw=i=>{const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=bo(i,4),r=10;return{type:e,size:t,data:i.subarray(r,r+t)}},Zg=i=>{let e=0;const t=[];for(;nu(i,e);){const r=bo(i,e+6);e+=10;const s=e+r;for(;e+8<s;){const n=Mw(i.subarray(e)),a=Fw(n);a&&t.push(a),e+=n.size+10}Qg(i,e)&&(e+=10)}return t},Fw=i=>i.type==="PRIV"?Nw(i):i.type[0]==="W"?$w(i):Bw(i),Nw=i=>{if(i.size<2)return;const e=Qr(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}},Bw=i=>{if(i.size<2)return;if(i.type==="TXXX"){let t=1;const r=Qr(i.data.subarray(t),!0);t+=r.length+1;const s=Qr(i.data.subarray(t));return{key:i.type,info:r,data:s}}const e=Qr(i.data.subarray(1));return{key:i.type,data:e}},$w=i=>{if(i.type==="WXXX"){if(i.size<2)return;let t=1;const r=Qr(i.data.subarray(t),!0);t+=r.length+1;const s=Qr(i.data.subarray(t));return{key:i.type,info:r,data:s}}const e=Qr(i.data);return{key:i.type,data:e}},Uw=i=>{if(i.data.byteLength===8){const e=new Uint8Array(i.data),t=e[3]&1;let r=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return r/=45,t&&(r+=4772185884e-2),Math.round(r)}},Qr=(i,e=!1)=>{const t=Gw();if(t){const u=t.decode(i);if(e){const h=u.indexOf("\0");return h!==-1?u.substring(0,h):u}return u.replace(/\0/g,"")}const r=i.length;let s,n,a,o="",l=0;for(;l<r;){if(s=i[l++],s===0&&e)return o;if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(s);break;case 12:case 13:n=i[l++],o+=String.fromCharCode((s&31)<<6|n&63);break;case 14:n=i[l++],a=i[l++],o+=String.fromCharCode((s&15)<<12|(n&63)<<6|(a&63)<<0);break}}return o};let fl;function Gw(){if(!navigator.userAgent.includes("PlayStation 4"))return!fl&&typeof self.TextDecoder<"u"&&(fl=new self.TextDecoder("utf-8")),fl}const Ur={hexDump:function(i){let e="";for(let t=0;t<i.length;t++){let r=i[t].toString(16);r.length<2&&(r="0"+r),e+=r}return e}},Ya=Math.pow(2,32)-1,Vw=[].push,em={video:1,audio:2,id3:3,text:4};function Pt(i){return String.fromCharCode.apply(null,i)}function tm(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function Be(i,e){const t=rm(i,e);return t<0?4294967296+t:t}function Rf(i,e){let t=Be(i,e);return t*=Math.pow(2,32),t+=Be(i,e+4),t}function rm(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function dl(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 jw(i){const e=i.byteLength;for(let t=0;t<e;){const r=Be(i,t);if(r>8&&i[t+4]===109&&i[t+5]===111&&i[t+6]===111&&i[t+7]===102)return!0;t=r>1?t+r:e}return!1}function Qe(i,e){const t=[];if(!e.length)return t;const r=i.byteLength;for(let s=0;s<r;){const n=Be(i,s),a=Pt(i.subarray(s+4,s+8)),o=n>1?s+n:r;if(a===e[0])if(e.length===1)t.push(i.subarray(s+8,o));else{const l=Qe(i.subarray(s+8,o),e.slice(1));l.length&&Vw.apply(t,l)}s=o}return t}function Hw(i){const e=[],t=i[0];let r=8;const s=Be(i,r);r+=4;let n=0,a=0;t===0?(n=Be(i,r),a=Be(i,r+4),r+=8):(n=Rf(i,r),a=Rf(i,r+8),r+=16),r+=2;let o=i.length+a;const l=tm(i,r);r+=2;for(let u=0;u<l;u++){let h=r;const d=Be(i,h);h+=4;const g=d&2147483647;if((d&2147483648)>>>31===1)return ie.warn("SIDX has hierarchical references (not supported)"),null;const y=Be(i,h);h+=4,e.push({referenceSize:g,subsegmentDuration:y,info:{duration:y/s,start:o,end:o+g-1}}),o+=g,h+=4,r=h}return{earliestPresentationTime:n,timescale:s,version:t,referencesCount:l,references:e}}function im(i){const e=[],t=Qe(i,["moov","trak"]);for(let s=0;s<t.length;s++){const n=t[s],a=Qe(n,["tkhd"])[0];if(a){let o=a[0];const l=Be(a,o===0?12:20),u=Qe(n,["mdia","mdhd"])[0];if(u){o=u[0];const h=Be(u,o===0?12:20),d=Qe(n,["mdia","hdlr"])[0];if(d){const g=Pt(d.subarray(8,12)),v={soun:ht.AUDIO,vide:ht.VIDEO}[g];if(v){const y=Qe(n,["mdia","minf","stbl","stsd"])[0],b=Kw(y);e[l]={timescale:h,type:v},e[v]=Nt({timescale:h,id:l},b)}}}}}return Qe(i,["moov","mvex","trex"]).forEach(s=>{const n=Be(s,4),a=e[n];a&&(a.default={duration:Be(s,12),flags:Be(s,20)})}),e}function Kw(i){const e=i.subarray(8),t=e.subarray(86),r=Pt(e.subarray(4,8));let s=r;const n=r==="enca"||r==="encv";if(n){const o=Qe(e,[r])[0].subarray(r==="enca"?28:78);Qe(o,["sinf"]).forEach(u=>{const h=Qe(u,["schm"])[0];if(h){const d=Pt(h.subarray(4,8));if(d==="cbcs"||d==="cenc"){const g=Qe(u,["frma"])[0];g&&(s=Pt(g))}}})}switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const a=Qe(t,["avcC"])[0];s+="."+Ea(a[1])+Ea(a[2])+Ea(a[3]);break}case"mp4a":{const a=Qe(e,[r])[0],o=Qe(a.subarray(28),["esds"])[0];if(o&&o.length>12){let l=4;if(o[l++]!==3)break;l=pl(o,l),l+=2;const u=o[l++];if(u&128&&(l+=2),u&64&&(l+=o[l++]),o[l++]!==4)break;l=pl(o,l);const h=o[l++];if(h===64)s+="."+Ea(h);else break;if(l+=12,o[l++]!==5)break;l=pl(o,l);const d=o[l++];let g=(d&248)>>3;g===31&&(g+=1+((d&7)<<3)+((o[l]&224)>>5)),s+="."+g}break}case"hvc1":case"hev1":{const a=Qe(t,["hvcC"])[0],o=a[1],l=["","A","B","C"][o>>6],u=o&31,h=Be(a,2),d=(o&32)>>5?"H":"L",g=a[12],v=a.subarray(6,12);s+="."+l+u,s+="."+h.toString(16).toUpperCase(),s+="."+d+g;let y="";for(let b=v.length;b--;){const E=v[b];(E||y)&&(y="."+E.toString(16).toUpperCase()+y)}s+=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;s+="."+$r(o)+"."+$r(l);break}case"vp09":{const a=Qe(t,["vpcC"])[0],o=a[4],l=a[5],u=a[6]>>4&15;s+="."+$r(o)+"."+$r(l)+"."+$r(u);break}case"av01":{const a=Qe(t,["av1C"])[0],o=a[1]>>>5,l=a[1]&31,u=a[2]>>>7?"H":"M",h=(a[2]&64)>>6,d=(a[2]&32)>>5,g=o===2&&h?d?12:10:h?10:8,v=(a[2]&16)>>4,y=(a[2]&8)>>3,b=(a[2]&4)>>2,E=a[2]&3;s+="."+o+"."+$r(l)+u+"."+$r(g)+"."+v+"."+y+b+E+"."+$r(1)+"."+$r(1)+"."+$r(1)+"."+0;break}}return{codec:s,encrypted:n}}function pl(i,e){const t=e+5;for(;i[e++]&128&&e<t;);return e}function Ea(i){return("0"+i.toString(16).toUpperCase()).slice(-2)}function $r(i){return(i<10?"0":"")+i}function zw(i,e){if(!i||!e)return i;const t=e.keyId;return t&&e.isCommonEncryption&&Qe(i,["moov","trak"]).forEach(s=>{const a=Qe(s,["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 h=l?u.subarray(28):u.subarray(78);Qe(h,["sinf"]).forEach(g=>{const v=sm(g);if(v){const y=v.subarray(8,24);y.some(b=>b!==0)||(ie.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${Ur.hexDump(y)} -> ${Ur.hexDump(t)}`),v.set(t,8))}})})}),i}function sm(i){const e=Qe(i,["schm"])[0];if(e){const t=Pt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Qe(i,["schi","tenc"])[0]}return ie.error("[eme] missing 'schm' box"),null}function Ww(i,e){return Qe(e,["moof","traf"]).reduce((t,r)=>{const s=Qe(r,["tfdt"])[0],n=s[0],a=Qe(r,["tfhd"]).reduce((o,l)=>{const u=Be(l,4),h=i[u];if(h){let d=Be(s,4);if(n===1){if(d===Ya)return ie.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;d*=Ya+1,d+=Be(s,8)}const g=h.timescale||9e4,v=d/g;if(Re(v)&&(o===null||v<o))return v}return o},null);return a!==null&&Re(a)&&(t===null||a<t)?a:t},null)}function qw(i,e){let t=0,r=0,s=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=Be(l,4),h=e[u];if(!h)continue;const d=h.default,g=Be(l,0)|(d==null?void 0:d.flags);let v=d==null?void 0:d.duration;g&8&&(g&2?v=Be(l,12):v=Be(l,8));const y=h.timescale||9e4,b=Qe(o,["trun"]);for(let E=0;E<b.length;E++){if(t=Yw(b[E]),!t&&v){const A=Be(b[E],4);t=v*A}h.type===ht.VIDEO?r+=t/y:h.type===ht.AUDIO&&(s+=t/y)}}if(r===0&&s===0){let a=1/0,o=0,l=0;const u=Qe(i,["sidx"]);for(let h=0;h<u.length;h++){const d=Hw(u[h]);if(d!=null&&d.references){a=Math.min(a,d.earliestPresentationTime/d.timescale);const g=d.references.reduce((v,y)=>v+y.info.duration||0,0);o=Math.max(o,g+d.earliestPresentationTime/d.timescale),l=o-a}}if(l&&Re(l))return l}return r||s}function Yw(i){const e=Be(i,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let r=0;const s=Be(i,4);for(let n=0;n<s;n++){if(e&256){const a=Be(i,t);r+=a,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return r}function Xw(i,e,t){Qe(e,["moof","traf"]).forEach(r=>{Qe(r,["tfhd"]).forEach(s=>{const n=Be(s,4),a=i[n];if(!a)return;const o=a.timescale||9e4;Qe(r,["tfdt"]).forEach(l=>{const u=l[0],h=t*o;if(h){let d=Be(l,4);if(u===0)d-=h,d=Math.max(d,0),dl(l,4,d);else{d*=Math.pow(2,32),d+=Be(l,8),d-=h,d=Math.max(d,0);const g=Math.floor(d/(Ya+1)),v=Math.floor(d%(Ya+1));dl(l,4,g),dl(l,8,v)}}})})})}function Qw(i){const e={valid:null,remainder:null},t=Qe(i,["moof"]);if(t.length<2)return e.remainder=i,e;const r=t[t.length-1];return e.valid=ss(i,0,r.byteOffset-8),e.remainder=ss(i,r.byteOffset-8),e}function yr(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function If(i,e){const t=[],r=e.samples,s=e.timescale,n=e.id;let a=!1;return Qe(r,["moof"]).map(l=>{const u=l.byteOffset-8;Qe(l,["traf"]).map(d=>{const g=Qe(d,["tfdt"]).map(v=>{const y=v[0];let b=Be(v,4);return y===1&&(b*=Math.pow(2,32),b+=Be(v,8)),b/s})[0];return g!==void 0&&(i=g),Qe(d,["tfhd"]).map(v=>{const y=Be(v,4),b=Be(v,0)&16777215,E=(b&1)!==0,A=(b&2)!==0,M=(b&8)!==0;let D=0;const B=(b&16)!==0;let N=0;const J=(b&32)!==0;let Z=8;y===n&&(E&&(Z+=8),A&&(Z+=4),M&&(D=Be(v,Z),Z+=4),B&&(N=Be(v,Z),Z+=4),J&&(Z+=4),e.type==="video"&&(a=Jw(e.codec)),Qe(d,["trun"]).map(se=>{const Q=se[0],q=Be(se,0)&16777215,oe=(q&1)!==0;let ge=0;const he=(q&4)!==0,Ee=(q&256)!==0;let Te=0;const ue=(q&512)!==0;let pe=0;const Ce=(q&1024)!==0,me=(q&2048)!==0;let Se=0;const We=Be(se,4);let $e=8;oe&&(ge=Be(se,$e),$e+=4),he&&($e+=4);let Xe=ge+u;for(let rt=0;rt<We;rt++){if(Ee?(Te=Be(se,$e),$e+=4):Te=D,ue?(pe=Be(se,$e),$e+=4):pe=N,Ce&&($e+=4),me&&(Q===0?Se=Be(se,$e):Se=rm(se,$e),$e+=4),e.type===ht.VIDEO){let et=0;for(;et<pe;){const ot=Be(r,Xe);if(Xe+=4,Zw(a,r[Xe])){const Je=r.subarray(Xe,Xe+ot);nm(Je,a?2:1,i+Se/s,t)}Xe+=ot,et+=ot+4}}i+=Te/s}}))})})}),t}function Jw(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 Zw(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function nm(i,e,t,r){const s=am(i);let n=0;n+=e;let a=0,o=0,l=0;for(;n<s.length;){a=0;do{if(n>=s.length)break;l=s[n++],a+=l}while(l===255);o=0;do{if(n>=s.length)break;l=s[n++],o+=l}while(l===255);const u=s.length-n;let h=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(s[h++]===181){const g=tm(s,h);if(h+=2,g===49){const v=Be(s,h);if(h+=4,v===1195456820){const y=s[h++];if(y===3){const b=s[h++],E=31&b,A=64&b,M=A?2+E*3:0,D=new Uint8Array(M);if(A){D[0]=b;for(let B=1;B<M;B++)D[B]=s[h++]}r.push({type:y,payloadType:a,pts:t,bytes:D})}}}}}else if(a===5&&o>16){const d=[];for(let y=0;y<16;y++){const b=s[h++].toString(16);d.push(b.length==1?"0"+b:b),(y===3||y===5||y===7||y===9)&&d.push("-")}const g=o-16,v=new Uint8Array(g);for(let y=0;y<g;y++)v[y]=s[h++];r.push({payloadType:a,pts:t,uuid:d.join(""),userData:Qr(v),userDataBytes:v})}}}function am(i){const e=i.byteLength,t=[];let r=1;for(;r<e-2;)i[r]===0&&i[r+1]===0&&i[r+2]===3?(t.push(r+2),r+=2):r++;if(t.length===0)return i;const s=e-t.length,n=new Uint8Array(s);let a=0;for(r=0;r<s;a++,r++)a===t[0]&&(a++,t.shift()),n[r]=i[a];return n}function eA(i){const e=i[0];let t="",r="",s=0,n=0,a=0,o=0,l=0,u=0;if(e===0){for(;Pt(i.subarray(u,u+1))!=="\0";)t+=Pt(i.subarray(u,u+1)),u+=1;for(t+=Pt(i.subarray(u,u+1)),u+=1;Pt(i.subarray(u,u+1))!=="\0";)r+=Pt(i.subarray(u,u+1)),u+=1;r+=Pt(i.subarray(u,u+1)),u+=1,s=Be(i,12),n=Be(i,16),o=Be(i,20),l=Be(i,24),u=28}else if(e===1){u+=4,s=Be(i,u),u+=4;const d=Be(i,u);u+=4;const g=Be(i,u);for(u+=4,a=2**32*d+g,vw(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=Be(i,u),u+=4,l=Be(i,u),u+=4;Pt(i.subarray(u,u+1))!=="\0";)t+=Pt(i.subarray(u,u+1)),u+=1;for(t+=Pt(i.subarray(u,u+1)),u+=1;Pt(i.subarray(u,u+1))!=="\0";)r+=Pt(i.subarray(u,u+1)),u+=1;r+=Pt(i.subarray(u,u+1)),u+=1}const h=i.subarray(u,i.byteLength);return{schemeIdUri:t,value:r,timeScale:s,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:l,payload:h}}function tA(i,...e){const t=e.length;let r=8,s=t;for(;s--;)r+=e[s].byteLength;const n=new Uint8Array(r);for(n[0]=r>>24&255,n[1]=r>>16&255,n[2]=r>>8&255,n[3]=r&255,n.set(i,4),s=0,r=8;s<t;s++)n.set(e[s],r),r+=e[s].byteLength;return n}function rA(i,e,t){if(i.byteLength!==16)throw new RangeError("Invalid system id");let r,s;r=0,s=new Uint8Array;let n;r>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),tA([112,115,115,104],new Uint8Array([r,0,0,0]),i,n,s,a,t||new Uint8Array)}function iA(i){if(!(i instanceof ArrayBuffer)||i.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(i),r=t.getUint32(0);if(i.byteLength!==r&&r>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=Ur.hexDump(new Uint8Array(i,12,16));const n=t.getUint32(28);if(e.version===0){if(r-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 Ta={};class zn{static clearKeyUriToKeyIdMap(){Ta={}}constructor(e,t,r,s=[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=r,this.keyFormatVersions=s,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 ir.FAIRPLAY:case ir.WIDEVINE:case ir.PLAYREADY:case ir.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 r=sA(e);return new zn(this.method,this.uri,"identity",this.keyFormatVersions,r)}const t=Iw(this.uri);if(t)switch(this.keyFormat){case ir.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case ir.PLAYREADY:{const r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=rA(r,null,t);const s=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(s)),a=n.substring(n.indexOf("<"),n.length),u=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("KID")[0];if(u){const h=u.childNodes[0]?u.childNodes[0].nodeValue:u.getAttribute("VALUE");if(h){const d=su(h).subarray(0,16);Rw(d),this.keyId=d}}break}default:{let r=t.subarray(0,16);if(r.length!==16){const s=new Uint8Array(16);s.set(r,16-r.length),r=s}this.keyId=r;break}}if(!this.keyId||this.keyId.byteLength!==16){let r=Ta[this.uri];if(!r){const s=Object.keys(Ta).length%Number.MAX_SAFE_INTEGER;r=new Uint8Array(16),new DataView(r.buffer,12,4).setUint32(0,s),Ta[this.uri]=r}this.keyId=r}return this}}function sA(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const om=/\{\$([a-zA-Z0-9-_]+)\}/g;function Pf(i){return om.test(i)}function tr(i,e,t){if(i.variableList!==null||i.hasVariableRefs)for(let r=t.length;r--;){const s=t[r],n=e[s];n&&(e[s]=lc(i,n))}}function lc(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(om,r=>{const s=r.substring(2,r.length-1),n=t==null?void 0:t[s];return n===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),r):n})}return e}function kf(i,e,t){let r=i.variableList;r||(i.variableList=r={});let s,n;if("QUERYPARAM"in e){s=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(s))n=a.get(s);else throw new Error(`"${s}" does not match any query parameter in URI: "${t}"`)}catch(a){i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else s=e.NAME,n=e.VALUE;s in r?i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):r[s]=n||""}function nA(i,e,t){const r=e.IMPORT;if(t&&r in t){let s=i.variableList;s||(i.variableList=s={}),s[r]=t[r]}else i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`))}function as(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function aA(i){return typeof self<"u"&&i===self.ManagedMediaSource}const Xa={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 oA(i,e){const t=Xa[e];return!!t&&!!t[i.slice(0,4)]}function gl(i,e,t=!0){return!i.split(",").some(r=>!lm(r,e,t))}function lm(i,e,t=!0){var r;const s=as(t);return(r=s==null?void 0:s.isTypeSupported(Wn(i,e)))!=null?r:!1}function Wn(i,e){return`${e}/mp4;codecs="${i}"`}function Df(i){if(i){const e=i.substring(0,4);return Xa.video[e]}return 2}function Qa(i){return i.split(",").reduce((e,t)=>{const r=Xa.video[t];return r?(r*2+e)/(e?3:2):(Xa.audio[t]+e)/(e?2:1)},0)}const ml={};function lA(i,e=!0){if(ml[i])return ml[i];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[i];for(let r=0;r<t.length;r++)if(lm(t[r],"audio",e))return ml[i]=t[r],t[r];return i}const cA=/flac|opus/i;function Ja(i,e=!0){return i.replace(cA,t=>lA(t.toLowerCase(),e))}function Of(i,e){return i&&i!=="mp4a"?i:e&&e.split(",")[0]}function uA(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 Mf=/#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,Ff=/#EXT-X-MEDIA:(.*)/g,hA=/^#EXT(?:INF|-X-TARGETDURATION):/m,Nf=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),fA=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 Wr{static findGroup(e,t){for(let r=0;r<e.length;r++){const s=e[r];if(s.id===t)return s}}static resolve(e,t){return iu.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return hA.test(e)}static parseMasterPlaylist(e,t){const r=Pf(e),s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:r},n=[];Mf.lastIndex=0;let a;for(;(a=Mf.exec(e))!=null;)if(a[1]){var o;const u=new bt(a[1]);tr(s,u,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const h=lc(s,a[2]),d={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Wr.resolve(h,t)},g=u.decimalResolution("RESOLUTION");g&&(d.width=g.width,d.height=g.height),dA(u.CODECS,d),(o=d.unknownCodecs)!=null&&o.length||n.push(d),s.levels.push(d)}else if(a[3]){const u=a[3],h=a[4];switch(u){case"SESSION-DATA":{const d=new bt(h);tr(s,d,["DATA-ID","LANGUAGE","VALUE","URI"]);const g=d["DATA-ID"];g&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[g]=d);break}case"SESSION-KEY":{const d=Bf(h,t,s);d.encrypted&&d.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(d)):ie.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const d=new bt(h);tr(s,d,["NAME","VALUE","QUERYPARAM"]),kf(s,d,t)}break}case"CONTENT-STEERING":{const d=new bt(h);tr(s,d,["SERVER-URI","PATHWAY-ID"]),s.contentSteering={uri:Wr.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{s.startTimeOffset=$f(h);break}}}const l=n.length>0&&n.length<s.levels.length;return s.levels=l?n:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,t,r){let s;const n={},a=r.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(Ff.lastIndex=0;(s=Ff.exec(e))!==null;){const u=new bt(s[1]),h=u.TYPE;if(h){const d=o[h],g=n[h]||[];n[h]=g,tr(r,u,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const v=u.LANGUAGE,y=u["ASSOC-LANGUAGE"],b=u.CHANNELS,E=u.CHARACTERISTICS,A=u["INSTREAM-ID"],M={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||v||"",type:h,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:v,url:u.URI?Wr.resolve(u.URI,t):""};if(y&&(M.assocLang=y),b&&(M.channels=b),E&&(M.characteristics=E),A&&(M.instreamId=A),d!=null&&d.length){const D=Wr.findGroup(d,M.groupId)||d[0];Uf(M,D,"audioCodec"),Uf(M,D,"textCodec")}g.push(M)}}return n}static parseLevelPlaylist(e,t,r,s,n,a){const o=new Cw(t),l=o.fragments;let u=null,h=0,d=0,g=0,v=0,y=null,b=new ul(s,t),E,A,M,D=-1,B=!1,N=null;for(Nf.lastIndex=0,o.m3u8=e,o.hasVariableRefs=Pf(e);(E=Nf.exec(e))!==null;){B&&(B=!1,b=new ul(s,t),b.start=g,b.sn=h,b.cc=v,b.level=r,u&&(b.initSegment=u,b.rawProgramDateTime=u.rawProgramDateTime,u.rawProgramDateTime=null,N&&(b.setByteRange(N),N=null)));const Q=E[1];if(Q){b.duration=parseFloat(Q);const q=(" "+E[2]).slice(1);b.title=q||null,b.tagList.push(q?["INF",Q,q]:["INF",Q])}else if(E[3]){if(Re(b.duration)){b.start=g,M&&jf(b,M,o),b.sn=h,b.level=r,b.cc=v,l.push(b);const q=(" "+E[3]).slice(1);b.relurl=lc(o,q),Gf(b,y),y=b,g+=b.duration,h++,d=0,B=!0}}else if(E[4]){const q=(" "+E[4]).slice(1);y?b.setByteRange(q,y):b.setByteRange(q)}else if(E[5])b.rawProgramDateTime=(" "+E[5]).slice(1),b.tagList.push(["PROGRAM-DATE-TIME",b.rawProgramDateTime]),D===-1&&(D=l.length);else{if(E=E[0].match(fA),!E){ie.warn("No matches on slow regex match for level playlist!");continue}for(A=1;A<E.length&&!(typeof E[A]<"u");A++);const q=(" "+E[A]).slice(1),oe=(" "+E[A+1]).slice(1),ge=E[A+2]?(" "+E[A+2]).slice(1):"";switch(q){case"PLAYLIST-TYPE":o.type=oe.toUpperCase();break;case"MEDIA-SEQUENCE":h=o.startSN=parseInt(oe);break;case"SKIP":{const he=new bt(oe);tr(o,he,["RECENTLY-REMOVED-DATERANGES"]);const Ee=he.decimalInteger("SKIPPED-SEGMENTS");if(Re(Ee)){o.skippedSegments=Ee;for(let ue=Ee;ue--;)l.unshift(null);h+=Ee}const Te=he.enumeratedString("RECENTLY-REMOVED-DATERANGES");Te&&(o.recentlyRemovedDateranges=Te.split(" "));break}case"TARGETDURATION":o.targetduration=Math.max(parseInt(oe),1);break;case"VERSION":o.version=parseInt(oe);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":(oe||ge)&&b.tagList.push(ge?[oe,ge]:[oe]);break;case"DISCONTINUITY":v++,b.tagList.push(["DIS"]);break;case"GAP":b.gap=!0,b.tagList.push([q]);break;case"BITRATE":b.tagList.push([q,oe]);break;case"DATERANGE":{const he=new bt(oe);tr(o,he,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),tr(o,he,he.clientAttrs);const Ee=new Wg(he,o.dateRanges[he.ID]);Ee.isValid||o.skippedSegments?o.dateRanges[Ee.id]=Ee:ie.warn(`Ignoring invalid DATERANGE tag: "${oe}"`),b.tagList.push(["EXT-X-DATERANGE",oe]);break}case"DEFINE":{{const he=new bt(oe);tr(o,he,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in he?nA(o,he,a):kf(o,he,t)}break}case"DISCONTINUITY-SEQUENCE":v=parseInt(oe);break;case"KEY":{const he=Bf(oe,t,o);if(he.isSupported()){if(he.method==="NONE"){M=void 0;break}M||(M={}),M[he.keyFormat]&&(M=Lt({},M)),M[he.keyFormat]=he}else ie.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${oe}"`);break}case"START":o.startTimeOffset=$f(oe);break;case"MAP":{const he=new bt(oe);if(tr(o,he,["BYTERANGE","URI"]),b.duration){const Ee=new ul(s,t);Vf(Ee,he,r,M),u=Ee,b.initSegment=u,u.rawProgramDateTime&&!b.rawProgramDateTime&&(b.rawProgramDateTime=u.rawProgramDateTime)}else{const Ee=b.byteRangeEndOffset;if(Ee){const Te=b.byteRangeStartOffset;N=`${Ee-Te}@${Te}`}else N=null;Vf(b,he,r,M),u=b,B=!0}break}case"SERVER-CONTROL":{const he=new bt(oe);o.canBlockReload=he.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=he.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&he.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=he.optionalFloat("PART-HOLD-BACK",0),o.holdBack=he.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const he=new bt(oe);o.partTarget=he.decimalFloatingPoint("PART-TARGET");break}case"PART":{let he=o.partList;he||(he=o.partList=[]);const Ee=d>0?he[he.length-1]:void 0,Te=d++,ue=new bt(oe);tr(o,ue,["BYTERANGE","URI"]);const pe=new Aw(ue,b,t,Te,Ee);he.push(pe),b.duration+=pe.duration;break}case"PRELOAD-HINT":{const he=new bt(oe);tr(o,he,["URI"]),o.preloadHint=he;break}case"RENDITION-REPORT":{const he=new bt(oe);tr(o,he,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(he);break}default:ie.warn(`line parsed but not handled: ${E}`);break}}}y&&!y.relurl?(l.pop(),g-=y.duration,o.partList&&(o.fragmentHint=y)):o.partList&&(Gf(b,y),b.cc=v,o.fragmentHint=b,M&&jf(b,M,o));const J=l.length,Z=l[0],se=l[J-1];if(g+=o.skippedSegments*o.targetduration,g>0&&J&&se){o.averagetargetduration=g/J;const Q=se.sn;o.endSN=Q!=="initSegment"?Q:0,o.live||(se.endList=!0),Z&&(o.startCC=Z.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(g+=o.fragmentHint.duration),o.totalduration=g,o.endCC=v,D>0&&pA(l,D),o}}function Bf(i,e,t){var r,s;const n=new bt(i);tr(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=(r=n.METHOD)!=null?r:"",o=n.URI,l=n.hexadecimalInteger("IV"),u=n.KEYFORMATVERSIONS,h=(s=n.KEYFORMAT)!=null?s:"identity";o&&n.IV&&!l&&ie.error(`Invalid IV: ${n.IV}`);const d=o?Wr.resolve(o,e):"",g=(u||"1").split("/").map(Number).filter(Number.isFinite);return new zn(a,d,h,g,l)}function $f(i){const t=new bt(i).decimalFloatingPoint("TIME-OFFSET");return Re(t)?t:null}function dA(i,e){let t=(i||"").split(/[ ,]+/).filter(r=>r);["video","audio","text"].forEach(r=>{const s=t.filter(n=>oA(n,r));s.length&&(e[`${r}Codec`]=s.join(","),t=t.filter(n=>s.indexOf(n)===-1))}),e.unknownCodecs=t}function Uf(i,e,t){const r=e[t];r&&(i[t]=r)}function pA(i,e){let t=i[e];for(let r=e;r--;){const s=i[r];if(!s)return;s.programDateTime=t.programDateTime-s.duration*1e3,t=s}}function Gf(i,e){i.rawProgramDateTime?i.programDateTime=Date.parse(i.rawProgramDateTime):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime),Re(i.programDateTime)||(i.programDateTime=null,i.rawProgramDateTime=null)}function Vf(i,e,t,r){i.relurl=e.URI,e.BYTERANGE&&i.setByteRange(e.BYTERANGE),i.level=t,i.sn="initSegment",r&&(i.levelkeys=r),i.initSegment=null}function jf(i,e,t){i.levelkeys=e;const{encryptedFragments:r}=t;(!r.length||r[r.length-1].levelkeys!==e)&&Object.keys(e).some(s=>e[s].isCommonEncryption)&&r.push(i)}var it={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ge={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Hf(i){const{type:e}=i;switch(e){case it.AUDIO_TRACK:return Ge.AUDIO;case it.SUBTITLE_TRACK:return Ge.SUBTITLE;default:return Ge.MAIN}}function vl(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class gA{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,r=t.pLoader,s=t.loader,n=r||s,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:r}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:it.MANIFEST,url:r,deliveryDirectives:null})}onLevelLoading(e,t){const{id:r,level:s,pathwayId:n,url:a,deliveryDirectives:o}=t;this.load({id:r,level:s,pathwayId:n,responseType:"text",type:it.LEVEL,url:a,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:r,groupId:s,url:n,deliveryDirectives:a}=t;this.load({id:r,groupId:s,level:null,responseType:"text",type:it.AUDIO_TRACK,url:n,deliveryDirectives:a})}onSubtitleTrackLoading(e,t){const{id:r,groupId:s,url:n,deliveryDirectives:a}=t;this.load({id:r,groupId:s,level:null,responseType:"text",type:it.SUBTITLE_TRACK,url:n,deliveryDirectives:a})}load(e){var t;const r=this.hls.config;let s=this.getInternalLoader(e);if(s){const u=s.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}`),s.abort()}let n;if(e.type===it.MANIFEST?n=r.manifestLoadPolicy.default:n=Lt({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),Re((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 h=u.partTarget,d=u.targetduration;if(h&&d){const g=Math.max(h*3,d*.8)*1e3;n=Lt({},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,h,d,g)=>{const v=this.getInternalLoader(d);this.resetInternalLoader(d.type);const y=u.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,d,new Error("no EXTM3U delimiter"),g||null,h);return}h.parsing.start=performance.now(),Wr.isMediaPlaylist(y)?this.handleTrackOrLevelPlaylist(u,h,d,g||null,v):this.handleMasterPlaylist(u,h,d,g)},onError:(u,h,d,g)=>{this.handleNetworkError(h,d,!1,u,g)},onTimeout:(u,h,d)=>{this.handleNetworkError(h,d,!0,void 0,u)}};s.load(e,o,l)}handleMasterPlaylist(e,t,r,s){const n=this.hls,a=e.data,o=vl(e,r),l=Wr.parseMasterPlaylist(a,o);if(l.playlistParsingError){this.handleManifestParsingError(e,r,l.playlistParsingError,s,t);return}const{contentSteering:u,levels:h,sessionData:d,sessionKeys:g,startTimeOffset:v,variableList:y}=l;this.variableList=y;const{AUDIO:b=[],SUBTITLES:E,"CLOSED-CAPTIONS":A}=Wr.parseMasterPlaylistMedia(a,o,l);b.length&&!b.some(D=>!D.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(ie.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new bt({}),bitrate:0,url:""})),n.trigger(C.MANIFEST_LOADED,{levels:h,audioTracks:b,subtitles:E,captions:A,contentSteering:u,url:o,stats:t,networkDetails:s,sessionData:d,sessionKeys:g,startTimeOffset:v,variableList:y})}handleTrackOrLevelPlaylist(e,t,r,s,n){const a=this.hls,{id:o,level:l,type:u}=r,h=vl(e,r),d=0,g=Re(l)?l:Re(o)?o:0,v=Hf(r),y=Wr.parseLevelPlaylist(e.data,h,g,v,d,this.variableList);if(u===it.MANIFEST){const b={attrs:new bt({}),bitrate:0,details:y,name:"",url:h};a.trigger(C.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:h,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),r.levelDetails=y,this.handlePlaylistLoaded(y,e,t,r,s,n)}handleManifestParsingError(e,t,r,s,n){this.hls.trigger(C.ERROR,{type:Ve.NETWORK_ERROR,details:ce.MANIFEST_PARSING_ERROR,fatal:t.type===it.MANIFEST,url:e.url,err:r,error:r,reason:r.message,response:e,context:t,networkDetails:s,stats:n})}handleNetworkError(e,t,r=!1,s,n){let a=`A network ${r?"timeout":"error"+(s?" (status "+s.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 h=this.getInternalLoader(e);switch(e.type){case it.MANIFEST:l=r?ce.MANIFEST_LOAD_TIMEOUT:ce.MANIFEST_LOAD_ERROR,u=!0;break;case it.LEVEL:l=r?ce.LEVEL_LOAD_TIMEOUT:ce.LEVEL_LOAD_ERROR,u=!1;break;case it.AUDIO_TRACK:l=r?ce.AUDIO_TRACK_LOAD_TIMEOUT:ce.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case it.SUBTITLE_TRACK:l=r?ce.SUBTITLE_TRACK_LOAD_TIMEOUT:ce.SUBTITLE_LOAD_ERROR,u=!1;break}h&&this.resetInternalLoader(e.type);const d={type:Ve.NETWORK_ERROR,details:l,fatal:u,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:n};if(s){const g=(t==null?void 0:t.url)||e.url;d.response=Nt({url:g,data:void 0},s)}this.hls.trigger(C.ERROR,d)}handlePlaylistLoaded(e,t,r,s,n,a){const o=this.hls,{type:l,level:u,id:h,groupId:d,deliveryDirectives:g}=s,v=vl(t,s),y=Hf(s),b=typeof s.level=="number"&&y===Ge.MAIN?u:void 0;if(!e.fragments.length){const A=new Error("No Segments found in Playlist");o.trigger(C.ERROR,{type:Ve.NETWORK_ERROR,details:ce.LEVEL_EMPTY_ERROR,fatal:!1,url:v,error:A,reason:A.message,response:t,context:s,level:b,parent:y,networkDetails:n,stats:r});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const E=e.playlistParsingError;if(E){o.trigger(C.ERROR,{type:Ve.NETWORK_ERROR,details:ce.LEVEL_PARSING_ERROR,fatal:!1,url:v,error:E,reason:E.message,response:t,context:s,level:b,parent:y,networkDetails:n,stats:r});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:b||0,id:h||0,stats:r,networkDetails:n,deliveryDirectives:g});break;case it.AUDIO_TRACK:o.trigger(C.AUDIO_TRACK_LOADED,{details:e,id:h||0,groupId:d||"",stats:r,networkDetails:n,deliveryDirectives:g});break;case it.SUBTITLE_TRACK:o.trigger(C.SUBTITLE_TRACK_LOADED,{details:e,id:h||0,groupId:d||"",stats:r,networkDetails:n,deliveryDirectives:g});break}}}function cm(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 um(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(r){ie.debug(`[texttrack-utils]: ${r}`);try{const s=new self.TextTrackCue(e.startTime,e.endTime,e.text);s.id=e.id,i.addCue(s)}catch(s){ie.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${s}`)}}t==="disabled"&&(i.mode=t)}function ks(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 cc(i,e,t,r){const s=i.mode;if(s==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const n=vA(i.cues,e,t);for(let a=0;a<n.length;a++)(!r||r(n[a]))&&i.removeCue(n[a])}s==="disabled"&&(i.mode=s)}function mA(i,e){if(e<i[0].startTime)return 0;const t=i.length-1;if(e>i[t].endTime)return-1;let r=0,s=t;for(;r<=s;){const n=Math.floor((s+r)/2);if(e<i[n].startTime)s=n-1;else if(e>i[n].startTime&&r<t)r=n+1;else return n}return i[r].startTime-e<e-i[s].startTime?r:s}function vA(i,e,t){const r=[],s=mA(i,e);if(s>-1)for(let n=s,a=i.length;n<a;n++){const o=i[n];if(o.startTime>=e&&o.endTime<=t)r.push(o);else if(o.startTime>t)return r}return r}function Fa(i){const e=[];for(let t=0;t<i.length;t++){const r=i[t];(r.kind==="subtitles"||r.kind==="captions")&&r.label&&e.push(i[t])}return e}var Pr={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const yA=.25;function uc(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Kf(i,e,t,r,s){let n=new i(e,t,"");try{n.value=r,s&&(n.type=s)}catch{n=new i(e,t,JSON.stringify(s?Nt({type:s},r):r))}return n}const wa=(()=>{const i=uc();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function yl(i,e){return i.getTime()/1e3-e}function SA(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class xA{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&&(ks(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 r=e[t];if(r.kind==="metadata"&&r.label==="id3")return cm(r,this.media),r}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:r,enableID3MetadataCues:s}}}=this;if(!r&&!s)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=uc();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===Pr.emsg&&!r||!s)continue;const u=Zg(n[o].data);if(u){const h=n[o].pts;let d=h+n[o].duration;d>wa&&(d=wa),d-h<=0&&(d=h+yA);for(let v=0;v<u.length;v++){const y=u[v];if(!Jg(y)){this.updateId3CueEnds(h,l);const b=Kf(a,h,d,y,l);b&&this.id3Track.addCue(b)}}}}}updateId3CueEnds(e,t){var r;const s=(r=this.id3Track)==null?void 0:r.cues;if(s)for(let n=s.length;n--;){const a=s[n];a.type===t&&a.startTime<e&&a.endTime===wa&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:r,type:s}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(n&&(o||l)){let u;s==="audio"?u=h=>h.type===Pr.audioId3&&l:s==="video"?u=h=>h.type===Pr.emsg&&o:u=h=>h.type===Pr.audioId3&&l||h.type===Pr.emsg&&o,cc(n,t,r,u)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:r,id3Track:s}=this,{dateRanges:n}=t,a=Object.keys(n);if(s){const h=Object.keys(r).filter(d=>!a.includes(d));for(let d=h.length;d--;){const g=h[d];Object.keys(r[g].cues).forEach(v=>{s.removeCue(r[g].cues[v])}),delete r[g]}}const o=t.fragments[t.fragments.length-1];if(a.length===0||!Re(o==null?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=o.programDateTime/1e3-o.start,u=uc();for(let h=0;h<a.length;h++){const d=a[h],g=n[d],v=yl(g.startDate,l),y=r[d],b=(y==null?void 0:y.cues)||{};let E=(y==null?void 0:y.durationKnown)||!1,A=wa;const M=g.endDate;if(M)A=yl(M,l),E=!0;else if(g.endOnNext&&!E){const B=a.reduce((N,J)=>{if(J!==g.id){const Z=n[J];if(Z.class===g.class&&Z.startDate>g.startDate&&(!N||g.startDate<N.startDate))return Z}return N},null);B&&(A=yl(B.startDate,l),E=!0)}const D=Object.keys(g.attr);for(let B=0;B<D.length;B++){const N=D[B];if(!Tw(N))continue;const J=b[N];if(J)E&&!y.durationKnown&&(J.endTime=A);else if(u){let Z=g.attr[N];ww(N)&&(Z=SA(Z));const se=Kf(u,v,A,{key:N,data:Z},Pr.dateRange);se&&(se.id=d,this.id3Track.addCue(se),b[N]=se)}}r[d]={cues:b,dateRange:g,durationKnown:E}}}}class bA{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:r,targetduration:s}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let u=o&&r||t;(l.liveSyncDuration||l.liveSyncDurationCount||u===0)&&(u=n!==void 0?n:a*s);const h=s;return u+Math.min(this.stallCount*1,h)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,r=this.levelDetails;if(e===null||t===null||r===null)return null;const s=r.edge,n=e-t-this.edgeStalled,a=s-r.totalduration,o=s-(this.config.lowLatencyMode&&r.partTarget||r.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 r=e.buffered.length;return(r?e.buffered.end(r-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 r;t.details===ce.BUFFER_STALLED_ERROR&&(this.stallCount++,(r=this.levelDetails)!=null&&r.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 r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:n}=this.config;if(!s||n===1||!t.live)return;const a=this.targetLatency;if(a===null)return;const o=r-a,l=Math.min(this.maxLatency,a+t.targetduration);if(o<l&&o>.05&&this.forwardBufferLength>1){const h=Math.min(2,Math.max(1,n)),d=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(h,Math.max(1,d))}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 hc=["NONE","TYPE-0","TYPE-1",null];function EA(i){return hc.indexOf(i)>-1}const Za=["SDR","PQ","HLG"];function TA(i){return!!i&&Za.indexOf(i)>-1}var Na={No:"",Yes:"YES",v2:"v2"};function zf(i){const{canSkipUntil:e,canSkipDateRanges:t,age:r}=i,s=r<e/2;return e&&s?t?Na.v2:Na.Yes:Na.No}class Wf{constructor(e,t,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=r}addDirectives(e){const t=new self.URL(e);return 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 $s{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 qf(this._audioGroups,e)}hasSubtitleGroup(e){return qf(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let r=this._audioGroups;r||(r=this._audioGroups=[]),r.indexOf(t)===-1&&r.push(t)}else if(e==="text"){let r=this._subtitleGroups;r||(r=this._subtitleGroups=[]),r.indexOf(t)===-1&&r.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 qf(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function Sl(i,e){const t=e.startPTS;if(Re(t)){let r=0,s;e.sn>i.sn?(r=t-i.start,s=i):(r=i.start-t,s=e),s.duration!==r&&(s.duration=r)}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 hm(i,e,t,r,s,n){r-t<=0&&(ie.warn("Fragment should have a positive duration",e),r=t+e.duration,n=s+e.duration);let o=t,l=r;const u=e.startPTS,h=e.endPTS;if(Re(u)){const E=Math.abs(u-t);Re(e.deltaPTS)?e.deltaPTS=Math.max(E,e.deltaPTS):e.deltaPTS=E,o=Math.max(t,u),t=Math.min(t,u),s=Math.min(s,e.startDTS),l=Math.min(r,h),r=Math.max(r,h),n=Math.max(n,e.endDTS)}const d=t-e.start;e.start!==0&&(e.start=t),e.duration=r-e.start,e.startPTS=t,e.maxStartPTS=o,e.startDTS=s,e.endPTS=r,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,b=i.fragments;for(b[y]=e,v=y;v>0;v--)Sl(b[v],b[v-1]);for(v=y;v<b.length-1;v++)Sl(b[v],b[v+1]);return i.fragmentHint&&Sl(b[b.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,d}function wA(i,e){let t=null;const r=i.fragments;for(let l=r.length-1;l>=0;l--){const u=r[l].initSegment;if(u){t=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let s=0,n;if(CA(i,e,(l,u)=>{l.relurl&&(s=l.cc-u.cc),Re(l.startPTS)&&Re(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 h;u&&(!u.initSegment||u.initSegment.relurl===((h=t)==null?void 0:h.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=AA(i.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const a=e.fragments;if(s){ie.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<a.length;l++)a[l].cc+=s}e.skippedSegments&&(e.startCC=e.fragments[0].cc),_A(i.partList,e.partList,(l,u)=>{u.elementaryStreams=l.elementaryStreams,u.stats=l.stats}),n?hm(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):fm(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 AA(i,e,t){const r=Lt({},i);return t&&t.forEach(s=>{delete r[s]}),Object.keys(e).forEach(s=>{const n=new Wg(e[s].attr,r[s]);n.isValid?r[s]=n:ie.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[s].attr)}"`)}),r}function _A(i,e,t){if(i&&e){let r=0;for(let s=0,n=i.length;s<=n;s++){const a=i[s],o=e[s+r];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):r--}}}function CA(i,e,t){const r=e.skippedSegments,s=Math.max(i.startSN,e.startSN)-e.startSN,n=(i.fragmentHint?1:0)+(r?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=s;u<=n;u++){const h=l[a+u];let d=o[u];r&&!d&&u<r&&(d=e.fragments[u]=h),h&&d&&t(h,d)}}function fm(i,e){const t=e.startSN+e.skippedSegments-i.startSN,r=i.fragments;t<0||t>=r.length||fc(e,r[t].start)}function fc(i,e){if(e){const t=i.fragments;for(let r=i.skippedSegments;r<t.length;r++)t[r].start+=e;i.fragmentHint&&(i.fragmentHint.start+=e)}}function LA(i,e=1/0){let t=1e3*i.targetduration;if(i.updated){const r=i.fragments;if(r.length&&t*4>e){const n=r[r.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function RA(i,e,t){if(!(i!=null&&i.details))return null;const r=i.details;let s=r.fragments[e-r.startSN];return s||(s=r.fragmentHint,s&&s.sn===e)?s:e<r.startSN&&t&&t.sn===e?t:null}function Yf(i,e,t){var r;return i!=null&&i.details?dm((r=i.details)==null?void 0:r.partList,e,t):null}function dm(i,e,t){if(i)for(let r=i.length;r--;){const s=i[r];if(s.index===t&&s.fragment.sn===e)return s}return null}function pm(i){i.forEach((e,t)=>{const{details:r}=e;r!=null&&r.fragments&&r.fragments.forEach(s=>{s.level=t})})}function eo(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 Xf(i,e){const t=eo(e);return i.default[`${t?"timeout":"error"}Retry`]}function ou(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function Qf(i){return Nt(Nt({},i),{errorRetry:null,timeoutRetry:null})}function to(i,e,t,r){if(!i)return!1;const s=r==null?void 0:r.code,n=e<i.maxNumRetry&&(IA(s)||!!t);return i.shouldRetry?i.shouldRetry(i,e,t,r,n):n}function IA(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}const gm={search:function(i,e){let t=0,r=i.length-1,s=null,n=null;for(;t<=r;){s=(t+r)/2|0,n=i[s];const a=e(n);if(a>0)t=s+1;else if(a<0)r=s-1;else return n}return null}};function PA(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!Re(e))return null;const r=i[0].programDateTime;if(e<(r||0))return null;const s=i[i.length-1].endProgramDateTime;if(e>=(s||0))return null;t=t||0;for(let n=0;n<i.length;++n){const a=i[n];if(kA(e,t,a))return a}return null}function ro(i,e,t=0,r=0){let s=null;if(i){s=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&&(s=e[0]);if(s&&(!i||i.level===s.level)&&dc(t,r,s)===0)return s;const n=gm.search(e,dc.bind(null,t,r));return n&&(n!==i||!s)?n:s}function dc(i=0,e=0,t){if(t.start<=i&&t.start+t.duration>i)return 0;const r=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-r<=i?1:t.start-r>i&&t.start?-1:0}function kA(i,e,t){const r=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-r>i}function DA(i,e){return gm.search(i,t=>t.cc<e?1:t.cc>e?-1:0)}var Vt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Rr={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class OA{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)===Ge.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var r,s;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((r=t.frag)!=null&&r.gap){t.errorAction={action:Vt.DoNothing,flags:Rr.None};return}case ce.FRAG_GAP:case ce.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Vt.SendAlternateToPenaltyBox;return}case ce.LEVEL_EMPTY_ERROR:case ce.LEVEL_PARSING_ERROR:{var o,l;const u=t.parent===Ge.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=Vt.SendAlternateToPenaltyBox,t.errorAction.flags=Rr.MoveAllAlternatesMatchingHost;return}}return;case ce.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=n.levels[n.loadLevel],h=u==null?void 0:u.attrs["HDCP-LEVEL"];h?t.errorAction={action:Vt.SendAlternateToPenaltyBox,flags:Rr.MoveAllAlternatesMatchingHDCP,hdcpLevel:h}: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,(s=t.level)!=null?s: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:Vt.DoNothing,flags:Rr.None};return}t.type===Ve.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 r=this.hls,s=Xf(r.config.playlistLoadPolicy,e),n=this.playlistError++;if(to(s,n,eo(e),e.response))return{action:Vt.RetryRequest,flags:Rr.None,retryConfig:s,retryCount:n};const o=this.getLevelSwitchAction(e,t);return s&&(o.retryConfig=s,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,r=this.getVariantLevelIndex(e.frag),s=t.levels[r],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=Xf(e.details.startsWith("key")?a:n,e),l=t.levels.reduce((h,d)=>h+d.fragmentError,0);if(s&&(e.details!==ce.FRAG_GAP&&s.fragmentError++,to(o,l,eo(e),e.response)))return{action:Vt.RetryRequest,flags:Rr.None,retryConfig:o,retryCount:l};const u=this.getLevelSwitchAction(e,r);return o&&(u.retryConfig=o,u.retryCount=l),u}getLevelSwitchAction(e,t){const r=this.hls;t==null&&(t=r.loadLevel);const s=this.hls.levels[t];if(s){var n,a;const u=e.details;s.loadError++,u===ce.BUFFER_APPEND_ERROR&&s.fragmentError++;let h=-1;const{levels:d,loadLevel:g,minAutoLevel:v,maxAutoLevel:y}=r;r.autoLevelEnabled||(r.loadLevel=-1);const b=(n=e.frag)==null?void 0:n.type,A=(b===Ge.AUDIO&&u===ce.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===ce.BUFFER_ADD_CODEC_ERROR||u===ce.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:J})=>s.audioCodec!==J),D=e.sourceBufferName==="video"&&(u===ce.BUFFER_ADD_CODEC_ERROR||u===ce.BUFFER_APPEND_ERROR)&&d.some(({codecSet:J,audioCodec:Z})=>s.codecSet!==J&&s.audioCodec===Z),{type:B,groupId:N}=(a=e.context)!=null?a:{};for(let J=d.length;J--;){const Z=(J+g)%d.length;if(Z!==g&&Z>=v&&Z<=y&&d[Z].loadError===0){var o,l;const se=d[Z];if(u===ce.FRAG_GAP&&e.frag){const Q=d[Z].details;if(Q){const q=ro(e.frag,Q.fragments,e.frag.start);if(q!=null&&q.gap)continue}}else{if(B===it.AUDIO_TRACK&&se.hasAudioGroup(N)||B===it.SUBTITLE_TRACK&&se.hasSubtitleGroup(N))continue;if(b===Ge.AUDIO&&(o=s.audioGroups)!=null&&o.some(Q=>se.hasAudioGroup(Q))||b===Ge.SUBTITLE&&(l=s.subtitleGroups)!=null&&l.some(Q=>se.hasSubtitleGroup(Q))||A&&s.audioCodec===se.audioCodec||!A&&s.audioCodec!==se.audioCodec||D&&s.codecSet===se.codecSet)continue}h=Z;break}}if(h>-1&&r.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:Vt.SendAlternateToPenaltyBox,flags:Rr.None,nextAutoLevel:h}}return{action:Vt.SendAlternateToPenaltyBox,flags:Rr.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var r;switch((r=t.errorAction)==null?void 0:r.action){case Vt.DoNothing:break;case Vt.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,r=e.errorAction;if(!r)return;const{flags:s,hdcpLevel:n,nextAutoLevel:a}=r;switch(s){case Rr.None:this.switchLevel(e,a);break;case Rr.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=hc[hc.indexOf(n)-1],r.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}r.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 lu{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,r){const s=t==null?void 0:t.renditionReports;if(s){let n=-1;for(let a=0;a<s.length;a++){const o=s[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=s[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 h=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&h>t.partTarget&&(l+=1)}const u=r&&zf(r);return new Wf(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,r){const{details:s,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;if(s.advancedDateTime=Date.now()-o,s.live||r!=null&&r.live){if(s.reloaded(r),r&&this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),r&&s.fragments.length>0&&wA(r,s),!this.canLoad||!s.live)return;let l,u,h;if(s.canBlockReload&&s.endSN&&s.advanced){const E=this.hls.config.lowLatencyMode,A=s.lastPartSn,M=s.endSN,D=s.lastPartIndex,B=D!==-1,N=A===M,J=E?0:D;B?(u=N?M+1:A,h=N?J:D+1):u=M+1;const Z=s.age,se=Z+s.ageHeader;let Q=Math.min(se-s.partTarget,s.targetduration*1.5);if(Q>0){if(r&&Q>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${Q} with playlist age: ${s.age}`),Q=0;else{const q=Math.floor(Q/s.targetduration);if(u+=q,h!==void 0){const oe=Math.round(Q%s.targetduration/s.partTarget);h+=oe}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${Z.toFixed(2)}s goal: ${Q} skip sn ${q} to part ${h}`)}s.tuneInGoal=Q}if(l=this.getDeliveryDirectives(s,t.deliveryDirectives,u,h),E||!N){this.loadPlaylist(l);return}}else(s.canBlockReload||s.canSkipUntil)&&(l=this.getDeliveryDirectives(s,t.deliveryDirectives,u,h));const d=this.hls.mainForwardBufferInfo,g=d?d.end-d.len:0,v=(s.edge-g)*1e3,y=LA(s,v);s.updated&&a>this.requestScheduled+y&&(this.requestScheduled=n.loading.start),u!==void 0&&s.canBlockReload?this.requestScheduled=n.loading.first+y-(s.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+y<a?this.requestScheduled=a:this.requestScheduled-a<=0&&(this.requestScheduled+=y);let b=this.requestScheduled-a;b=Math.max(0,b),this.log(`reload live playlist ${e} in ${Math.round(b)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),b)}else this.clearTimer()}getDeliveryDirectives(e,t,r,s){let n=zf(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,s=t.part,n=Na.No),new Wf(r,s,n)}checkRetry(e){const t=e.details,r=eo(e),s=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=s||{},l=!!s&&!!o&&(n===Vt.RetryRequest||!s.resolved&&n===Vt.SendAlternateToPenaltyBox);if(l){var u;if(this.requestScheduled=-1,a>=o.maxNumRetry)return!1;if(r&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=ou(o,a);this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,s.resolved=!0}return l}}class ws{constructor(e,t=0,r=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=r}sample(e,t){const r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class MA{constructor(e,t,r,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ws(e),this.fast_=new ws(t),this.defaultTTFB_=s,this.ttfb_=new ws(e)}update(e,t){const{slow_:r,fast_:s,ttfb_:n}=this;r.halfLife!==e&&(this.slow_=new ws(e,r.getEstimate(),r.getTotalWeight())),s.halfLife!==t&&(this.fast_=new ws(t,s.getEstimate(),s.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new ws(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const r=8*t,s=e/1e3,n=r/s;this.fast_.sample(s,n),this.slow_.sample(s,n)}sampleTTFB(e){const t=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(r,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const mm={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Jf={};function FA(i,e,t,r,s,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 h=null;if(a!=null&&a.length)try{a.length===1&&a[0]?h=e.groups[a[0]].channels:h=a.reduce((d,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=>{d[y]=(d[y]||0)+v.channels[y]})}return d},{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(r,30)||i.videoRange!=="SDR"&&i.videoRange!==t||i.bitrate>Math.max(s,8e6))||!!h&&Re(u)&&Object.keys(h).some(d=>parseInt(d)>u)}function NA(i,e,t){const r=i.videoCodec,s=i.audioCodec;if(!r||!s||!t)return Promise.resolve(mm);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=r.split(",").map(l=>({type:"media-source",video:Nt(Nt({},n),{},{contentType:Wn(l,"video")})}));return s&&i.audioGroups&&i.audioGroups.forEach(l=>{var u;l&&((u=e.groups[l])==null||u.tracks.forEach(h=>{if(h.groupId===l){const d=h.channels||"",g=parseFloat(d);Re(g)&&g>2&&o.push.apply(o,s.split(",").map(v=>({type:"media-source",audio:{contentType:Wn(v,"audio"),channels:""+g}})))}}))}),Promise.all(o.map(l=>{const u=BA(l);return Jf[u]||(Jf[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 BA(i){const{audio:e,video:t}=i,r=t||e;if(r){const s=r.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${s}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${s}`}return""}function $A(){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 UA(i,e){let t=!1,r=[];return i&&(t=i!=="SDR",r=[i]),e&&(r=e.allowedVideoRanges||Za.slice(0),t=e.preferHDR!==void 0?e.preferHDR:$A(),t?r=r.filter(s=>s!=="SDR"):r=["SDR"]),{preferHDR:t,allowedVideoRanges:r}}function GA(i,e,t,r,s){const n=Object.keys(i),a=r==null?void 0:r.channels,o=r==null?void 0:r.audioCodec,l=a&&parseInt(a)===2;let u=!0,h=!1,d=1/0,g=1/0,v=1/0,y=0,b=[];const{preferHDR:E,allowedVideoRanges:A}=UA(e,s);for(let N=n.length;N--;){const J=i[n[N]];u=J.channels[2]>0,d=Math.min(d,J.minHeight),g=Math.min(g,J.minFramerate),v=Math.min(v,J.minBitrate);const Z=A.filter(se=>J.videoRanges[se]>0);Z.length>0&&(h=!0,b=Z)}d=Re(d)?d:0,g=Re(g)?g:0;const M=Math.max(1080,d),D=Math.max(30,g);return v=Re(v)?v:t,t=Math.max(v,t),h||(e=void 0,b=[]),{codecSet:n.reduce((N,J)=>{const Z=i[J];if(J===N)return N;if(Z.minBitrate>t)return ui(J,`min bitrate of ${Z.minBitrate} > current estimate of ${t}`),N;if(!Z.hasDefaultAudio)return ui(J,"no renditions with default or auto-select sound found"),N;if(o&&J.indexOf(o.substring(0,4))%5!==0)return ui(J,`audio codec preference "${o}" not found`),N;if(a&&!l){if(!Z.channels[a])return ui(J,`no renditions with ${a} channel sound found (channels options: ${Object.keys(Z.channels)})`),N}else if((!o||l)&&u&&Z.channels[2]===0)return ui(J,"no renditions with stereo sound found"),N;return Z.minHeight>M?(ui(J,`min resolution of ${Z.minHeight} > maximum of ${M}`),N):Z.minFramerate>D?(ui(J,`min framerate of ${Z.minFramerate} > maximum of ${D}`),N):b.some(se=>Z.videoRanges[se]>0)?Z.maxScore<y?(ui(J,`max score of ${Z.maxScore} < selected max of ${y}`),N):N&&(Qa(J)>=Qa(N)||Z.fragmentError>i[N].fragmentError)?N:(y=Z.maxScore,J):(ui(J,`no variants with VIDEO-RANGE of ${JSON.stringify(b)} found`),N)},void 0),videoRanges:b,preferHDR:E,minFramerate:g,minBitrate:v}}function ui(i,e){ie.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function VA(i){return i.reduce((e,t)=>{let r=e.groups[t.groupId];r||(r=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(t);const s=t.channels||"2";return r.channels[s]=(r.channels[s]||0)+1,r.hasDefault=r.hasDefault||t.default,r.hasAutoSelect=r.hasAutoSelect||t.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function jA(i,e,t,r){return i.slice(t,r+1).reduce((s,n)=>{if(!n.codecSet)return s;const a=n.audioGroups;let o=s[n.codecSet];o||(s[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 h=e.groups[u];h&&(o.hasDefaultAudio=o.hasDefaultAudio||e.hasDefaultAudio?h.hasDefault:h.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(h.channels).forEach(d=>{o.channels[d]=(o.channels[d]||0)+h.channels[d]}))}),s},{})}function qr(i,e,t){if("attrs"in i){const r=e.indexOf(i);if(r!==-1)return r}for(let r=0;r<e.length;r++){const s=e[r];if(Os(i,s,t))return r}return-1}function Os(i,e,t){const{groupId:r,name:s,lang:n,assocLang:a,characteristics:o,default:l}=i,u=i.forced;return(r===void 0||e.groupId===r)&&(s===void 0||e.name===s)&&(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||HA(o,e.characteristics))&&(t===void 0||t(i,e))}function HA(i,e=""){const t=i.split(","),r=e.split(",");return t.length===r.length&&!t.some(s=>r.indexOf(s)===-1)}function As(i,e){const{audioCodec:t,channels:r}=i;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(r===void 0||r===(e.channels||"2"))}function KA(i,e,t,r,s){const n=e[r],o=e.reduce((g,v,y)=>{const b=v.uri;return(g[b]||(g[b]=[])).push(y),g},{})[n.uri];o.length>1&&(r=Math.max.apply(Math,o));const l=n.videoRange,u=n.frameRate,h=n.codecSet.substring(0,4),d=Zf(e,r,g=>{if(g.videoRange!==l||g.frameRate!==u||g.codecSet.substring(0,4)!==h)return!1;const v=g.audioGroups,y=t.filter(b=>!v||v.indexOf(b.groupId)!==-1);return qr(i,y,s)>-1});return d>-1?d:Zf(e,r,g=>{const v=g.audioGroups,y=t.filter(b=>!v||v.indexOf(b.groupId)!==-1);return qr(i,y,s)>-1})}function Zf(i,e,t){for(let r=e;r;r--)if(t(i[r]))return r;for(let r=e+1;r<i.length;r++)if(t(i[r]))return r;return-1}class zA{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:r,hls:s}=this,{autoLevelEnabled:n,media:a}=s;if(!t||!a)return;const o=performance.now(),l=r?r.stats:t.stats,u=r?r.duration:t.duration,h=o-l.loading.start,d=s.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=d){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||a.paused||!a.playbackRate||!a.readyState)return;const g=s.mainForwardBufferInfo;if(g===null)return;const v=this.bwEstimator.getEstimateTTFB(),y=Math.abs(a.playbackRate);if(h<=Math.max(v,1e3*(u/(y*2))))return;const b=g.len/y,E=l.loading.first?l.loading.first-l.loading.start:-1,A=l.loaded&&E>-1,M=this.getBwEstimate(),D=s.levels,B=D[t.level],N=l.total||Math.max(l.loaded,Math.round(u*B.averageBitrate/8));let J=A?h-E:h;J<1&&A&&(J=Math.min(h,l.loaded*8/M));const Z=A?l.loaded*1e3/J:0,se=Z?(N-l.loaded)/Z:N*8/M+v/1e3;if(se<=b)return;const Q=Z?Z*8:M;let q=Number.POSITIVE_INFINITY,oe;for(oe=t.level-1;oe>d;oe--){const he=D[oe].maxBitrate;if(q=this.getTimeToLoadFrag(v/1e3,Q,u*he,!D[oe].details),q<b)break}if(q>=se||q>u*10)return;s.nextLoadLevel=s.nextAutoLevel=oe,A?this.bwEstimator.sample(h-Math.min(v,E),l.loaded):this.bwEstimator.sampleTTFB(h);const ge=D[oe].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>ge&&this.resetEstimator(ge),this.clearTimer(),ie.warn(`[abr] Fragment ${t.sn}${r?" part "+r.index:""} of level ${t.level} is loading too slowly;
111
+ Time to underbuffer: ${b.toFixed(3)} s
112
+ Estimated load time for current fragment: ${se.toFixed(3)} s
113
+ Estimated load time for down switch fragment: ${q.toFixed(3)} s
114
+ TTFB estimate: ${E|0} ms
115
+ Current BW estimate: ${Re(M)?M|0:"Unknown"} bps
116
+ New BW estimate: ${this.getBwEstimate()|0} bps
117
+ Switching to level ${oe} @ ${ge|0} bps`),s.trigger(C.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:r,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 MA(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 r=t.frag;if(!this.ignoreFragment(r)){if(!r.bitrateTest){var s;this.fragCurrent=r,this.partCurrent=(s=t.part)!=null?s: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 r=t.frag,{fragCurrent:s,partCurrent:n}=this;if(r&&s&&r.sn===s.sn&&r.level===s.level){const a=performance.now(),o=n?n.stats:r.stats,l=a-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(d,u),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,r,s){const n=e+r/t,a=s?this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const r=this.hls.config,{loading:s}=t.stats,n=s.end-s.start;Re(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:r}){const s=r?r.stats:t.stats;if(t.type===Ge.MAIN&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=r?r.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+s.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:s,frag:t,part:r,id:t.type};this.onFragBuffered(C.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:r,part:s}=t,n=s!=null&&s.stats.loaded?s.stats:r.stats;if(n.aborted||this.ignoreFragment(r))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(),r.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ge.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,r=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,n=this.findBestLevel(r,t,e,0,s,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,r=this.bwEstimator.canEstimate(),s=this.lastLoadedFragLevel>-1;if(e!==-1&&(!r||!s||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=r&&s?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:r}=this,{maxAutoLevel:s,config:n,minAutoLevel:a}=r,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),u=this.getStarvationDelay();let h=n.abrBandWidthFactor,d=n.abrBandWidthUpFactor;if(u){const E=this.findBestLevel(l,a,s,u,0,h,d);if(E>=0)return E}let g=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!u){const E=this.bitrateTestDelay;E&&(g=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-E,ie.info(`[abr] bitrate test took ${Math.round(1e3*E)}ms, set first fragment max fetchDuration to ${Math.round(1e3*g)} ms`),h=d=1)}const v=this.findBestLevel(l,a,s,u,g,h,d);if(ie.info(`[abr] ${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${v}`),v>-1)return v;const y=r.levels[a],b=r.levels[r.loadLevel];return(y==null?void 0:y.bitrate)<(b==null?void 0:b.bitrate)?a:r.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const r=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/r}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,r,s,n,a,o){var l;const u=s+n,h=this.lastLoadedFragLevel,d=h===-1?this.hls.firstLevel:h,{fragCurrent:g,partCurrent:v}=this,{levels:y,allAudioTracks:b,loadLevel:E,config:A}=this.hls;if(y.length===1)return 0;const M=y[d],D=!!(M!=null&&(l=M.details)!=null&&l.live),B=E===-1||h===-1;let N,J="SDR",Z=(M==null?void 0:M.frameRate)||0;const{audioPreference:se,videoPreference:Q}=A,q=this.audioTracksByGroup||(this.audioTracksByGroup=VA(b));if(B){if(this.firstSelection!==-1)return this.firstSelection;const Te=this.codecTiers||(this.codecTiers=jA(y,q,t,r)),ue=GA(Te,J,e,se,Q),{codecSet:pe,videoRanges:Ce,minFramerate:me,minBitrate:Se,preferHDR:We}=ue;N=pe,J=We?Ce[Ce.length-1]:Ce[0],Z=me,e=Math.max(e,Se),ie.log(`[abr] picked start tier ${JSON.stringify(ue)}`)}else N=M==null?void 0:M.codecSet,J=M==null?void 0:M.videoRange;const oe=v?v.duration:g?g.duration:0,ge=this.bwEstimator.getEstimateTTFB()/1e3,he=[];for(let Te=r;Te>=t;Te--){var Ee;const ue=y[Te],pe=Te>d;if(!ue)continue;if(A.useMediaCapabilities&&!ue.supportedResult&&!ue.supportedPromise){const rt=navigator.mediaCapabilities;typeof(rt==null?void 0:rt.decodingInfo)=="function"&&FA(ue,q,J,Z,e,se)?(ue.supportedPromise=NA(ue,q,rt),ue.supportedPromise.then(et=>{if(!this.hls)return;ue.supportedResult=et;const ot=this.hls.levels,Je=ot.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&&ot.length>1&&(ie.log(`[abr] Removing unsupported level ${Je}`),this.hls.removeLevel(Je)))})):ue.supportedResult=mm}if(N&&ue.codecSet!==N||J&&ue.videoRange!==J||pe&&Z>ue.frameRate||!pe&&Z>0&&Z<ue.frameRate||ue.supportedResult&&!((Ee=ue.supportedResult.decodingInfoResults)!=null&&Ee[0].smooth)){he.push(Te);continue}const Ce=ue.details,me=(v?Ce==null?void 0:Ce.partTarget:Ce==null?void 0:Ce.averagetargetduration)||oe;let Se;pe?Se=o*e:Se=a*e;const We=oe&&s>=oe*2&&n===0?y[Te].averageBitrate:y[Te].maxBitrate,$e=this.getTimeToLoadFrag(ge,Se,We*me,Ce===void 0);if(Se>=We&&(Te===h||ue.loadError===0&&ue.fragmentError===0)&&($e<=ge||!Re($e)||D&&!this.bitrateTestDelay||$e<u)){const rt=this.forcedAutoLevel;return Te!==E&&(rt===-1||rt!==E)&&(he.length&&ie.trace(`[abr] Skipped level(s) ${he.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${y[he[0]].codecs}" ${y[he[0]].videoRange}; not compatible with "${M.codecs}" ${J}`),ie.info(`[abr] switch candidate:${d}->${Te} adjustedbw(${Math.round(Se)})-bitrate=${Math.round(Se-We)} ttfb:${ge.toFixed(1)} avgDuration:${me.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${$e.toFixed(1)} firstSelection:${B} codecSet:${N} videoRange:${J} hls.loadLevel:${E}`)),B&&(this.firstSelection=Te),Te}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:r}=this.hls,s=Math.min(Math.max(e,r),t);this._nextAutoLevel!==s&&(this.nextAutoLevelKey="",this._nextAutoLevel=s)}}class WA{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 Ft={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class qA{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 r=this.activePartLists[t];if(r)for(let s=r.length;s--;){const n=r[s];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:r}=this,s=Object.keys(r);for(let n=s.length;n--;){const a=r[s[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,r,s){this.timeRanges&&(this.timeRanges[e]=t);const n=(s==null?void 0:s.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===r&&this.removeFragment(o.body);return}const l=o.range[e];l&&l.time.some(u=>{const h=!this.isTimeBuffered(u.startPTS,u.endPTS,t);return h&&this.removeFragment(o.body),h})})}detectPartialFragments(e){const t=this.timeRanges,{frag:r,part:s}=e;if(!t||r.sn==="initSegment")return;const n=_s(r),a=this.fragments[n];if(!a||a.buffered&&r.gap)return;const o=!r.relurl;Object.keys(t).forEach(l=>{const u=r.elementaryStreams[l];if(!u)return;const h=t[l],d=o||u.partial===!0;a.range[l]=this.getBufferedTimes(r,s,d,h)}),a.loaded=null,Object.keys(a.range).length?(a.buffered=!0,(a.body.endList=r.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),Aa(a)||this.removeParts(r.sn-1,r.type)):this.removeFragment(a.body)}removeParts(e,t){const r=this.activePartLists[t];r&&(this.activePartLists[t]=r.filter(s=>s.fragment.sn>=e))}fragBuffered(e,t){const r=_s(e);let s=this.fragments[r];!s&&t&&(s=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,t,r,s){const n={time:[],partial:r},a=e.start,o=e.end,l=e.minEndPTS||o,u=e.maxStartPTS||a;for(let h=0;h<s.length;h++){const d=s.start(h)-this.bufferPadding,g=s.end(h)+this.bufferPadding;if(u>=d&&l<=g){n.time.push({startPTS:Math.max(a,s.start(h)),endPTS:Math.min(o,s.end(h))});break}else if(a<g&&o>d){const v=Math.max(a,s.start(h)),y=Math.min(o,s.end(h));y>v&&(n.partial=!0,n.time.push({startPTS:v,endPTS:y}))}else if(o<=d)break}return n}getPartialFragment(e){let t=null,r,s,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(u=>{const h=l[u];h&&Aa(h)&&(s=h.body.start-o,n=h.body.end+o,e>=s&&e<=n&&(r=Math.min(e-s,n-e),a<=r&&(t=h.body,a=r)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Aa(t))}getState(e){const t=_s(e),r=this.fragments[t];return r?r.buffered?Aa(r)?Ft.PARTIAL:Ft.OK:Ft.APPENDING:Ft.NOT_LOADED}isTimeBuffered(e,t,r){let s,n;for(let a=0;a<r.length;a++){if(s=r.start(a)-this.bufferPadding,n=r.end(a)+this.bufferPadding,e>=s&&t<=n)return!0;if(t<=s)return!1}return!1}onFragLoaded(e,t){const{frag:r,part:s}=t;if(r.sn==="initSegment"||r.bitrateTest)return;const n=s?null:t,a=_s(r);this.fragments[a]={body:r,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:r,part:s,timeRanges:n}=t;if(r.sn==="initSegment")return;const a=r.type;if(s){let o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(s)}this.timeRanges=n,Object.keys(n).forEach(o=>{const l=n[o];this.detectEvictedFragments(o,l,a,s)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=_s(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,r,s,n){s&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==r||s&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=_s(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const r=this.activePartLists[e.type];if(r){const s=e.sn;this.activePartLists[e.type]=r.filter(n=>n.fragment.sn!==s)}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 Aa(i){var e,t,r;return i.buffered&&(i.body.gap||((e=i.range.video)==null?void 0:e.partial)||((t=i.range.audio)==null?void 0:t.partial)||((r=i.range.audiovideo)==null?void 0:r.partial))}function _s(i){return`${i.type}_${i.level}_${i.sn}`}const YA={length:0,start:()=>0,end:()=>0};class mt{static isBuffered(e,t){try{if(e){const r=mt.getBuffered(e);for(let s=0;s<r.length;s++)if(t>=r.start(s)&&t<=r.end(s))return!0}}catch{}return!1}static bufferInfo(e,t,r){try{if(e){const s=mt.getBuffered(e),n=[];let a;for(a=0;a<s.length;a++)n.push({start:s.start(a),end:s.end(a)});return this.bufferedInfo(n,t,r)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,r){t=Math.max(0,t),e.sort(function(u,h){const d=u.start-h.start;return d||h.end-u.end});let s=[];if(r)for(let u=0;u<e.length;u++){const h=s.length;if(h){const d=s[h-1].end;e[u].start-d<r?e[u].end>d&&(s[h-1].end=e[u].end):s.push(e[u])}else s.push(e[u])}else s=e;let n=0,a,o=t,l=t;for(let u=0;u<s.length;u++){const h=s[u].start,d=s[u].end;if(t+r>=h&&t<d)o=h,l=d,n=l-t;else if(t+r<h){a=h;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),YA}}}class cu{constructor(e,t,r,s=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=_a(),this.buffering={audio:_a(),video:_a(),audiovideo:_a()},this.level=e,this.sn=t,this.id=r,this.size=s,this.part=n,this.partial=a}}function _a(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Ba(i,e){for(let r=0,s=i.length;r<s;r++){var t;if(((t=i[r])==null?void 0:t.cc)===e)return i[r]}return null}function XA(i,e,t){return!!(e&&(t.endCC>t.startCC||i&&i.cc<t.startCC))}function QA(i,e){const t=i.fragments,r=e.fragments;if(!r.length||!t.length){ie.log("No fragments to align");return}const s=Ba(t,r[0].cc);if(!s||s&&!s.startPTS){ie.log("No frag in previous level to align on");return}return s}function ed(i,e){if(i){const t=i.start+e;i.start=i.startPTS=t,i.endPTS=t+i.duration}}function vm(i,e){const t=e.fragments;for(let r=0,s=t.length;r<s;r++)ed(t[r],i);e.fragmentHint&&ed(e.fragmentHint,i),e.alignedSliding=!0}function JA(i,e,t){e&&(ZA(i,t,e),!t.alignedSliding&&e&&io(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&fm(e,t))}function ZA(i,e,t){if(XA(i,t,e)){const r=QA(t,e);r&&Re(r.start)&&(ie.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),vm(r.start,e))}}function io(i,e){if(!i.hasProgramDateTime||!e.hasProgramDateTime)return;const t=i.fragments,r=e.fragments;if(!t.length||!r.length)return;let s,n;const a=Math.min(e.endCC,i.endCC);e.startCC<a&&i.startCC<a&&(s=Ba(r,a),n=Ba(t,a)),(!s||!n)&&(s=r[Math.floor(r.length/2)],n=Ba(t,s.cc)||t[Math.floor(t.length/2)]);const o=s.programDateTime,l=n.programDateTime;if(!o||!l)return;const u=(l-o)/1e3-(n.start-s.start);vm(u,i)}const td=Math.pow(2,17);class e_{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const r=e.url;if(!r)return Promise.reject(new di({type:Ve.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${r?"part list":"url"}`),networkDetails:null}));this.abort();const s=this.config,n=s.fLoader,a=s.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(v=>v[0]==="GAP")){l(id(e));return}else e.gap=!1;const u=this.loader=e.loader=n?new n(s):new a(s),h=rd(e),d=Qf(s.fragLoadPolicy.default),g={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:td};e.stats=u.stats,u.load(h,g,{onSuccess:(v,y,b,E)=>{this.resetLoader(e,u);let A=v.data;b.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(A.slice(0,16)),A=A.slice(16)),o({frag:e,part:null,payload:A,networkDetails:E})},onError:(v,y,b,E)=>{this.resetLoader(e,u),l(new di({type:Ve.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Nt({url:r,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:b,stats:E}))},onAbort:(v,y,b)=>{this.resetLoader(e,u),l(new di({type:Ve.NETWORK_ERROR,details:ce.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:b,stats:v}))},onTimeout:(v,y,b)=>{this.resetLoader(e,u),l(new di({type:Ve.NETWORK_ERROR,details:ce.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:b,stats:v}))},onProgress:(v,y,b,E)=>{t&&t({frag:e,part:null,payload:b,networkDetails:E})}})})}loadPart(e,t,r){this.abort();const s=this.config,n=s.fLoader,a=s.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(id(e,t));return}const u=this.loader=e.loader=n?new n(s):new a(s),h=rd(e,t),d=Qf(s.fragLoadPolicy.default),g={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:td};t.stats=u.stats,u.load(h,g,{onSuccess:(v,y,b,E)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const A={frag:e,part:t,payload:v.data,networkDetails:E};r(A),o(A)},onError:(v,y,b,E)=>{this.resetLoader(e,u),l(new di({type:Ve.NETWORK_ERROR,details:ce.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Nt({url:h.url,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:b,stats:E}))},onAbort:(v,y,b)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),l(new di({type:Ve.NETWORK_ERROR,details:ce.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:b,stats:v}))},onTimeout:(v,y,b)=>{this.resetLoader(e,u),l(new di({type:Ve.NETWORK_ERROR,details:ce.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:b,stats:v}))}})})}updateStatsFromPart(e,t){const r=e.stats,s=t.stats,n=s.total;if(r.loaded+=s.loaded,n){const l=Math.round(e.duration/t.duration),u=Math.min(Math.round(r.loaded/n),l),d=(l-u)*Math.round(r.loaded/u);r.total=r.loaded+d}else r.total=Math.max(r.loaded,r.total);const a=r.loading,o=s.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 rd(i,e=null){const t=e||i,r={frag:i,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},s=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(Re(s)&&Re(n)){var a;let o=s,l=n;if(i.sn==="initSegment"&&((a=i.decryptdata)==null?void 0:a.method)==="AES-128"){const u=n-s;u%16&&(l=n+(16-u%16)),s!==0&&(r.resetIV=!0,o=s-16)}r.rangeStart=o,r.rangeEnd=l}return r}function id(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),r={type:Ve.MEDIA_ERROR,details:ce.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(r.part=e),(e||i).stats.aborted=!0,new di(r)}class di extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class t_{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 r_{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 i_(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?ss(i,0,e-t):i}class s_{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),r=new Uint32Array(4);for(let s=0;s<4;s++)r[s]=t.getUint32(s*4);return r}initTable(){const e=this.sBox,t=this.invSBox,r=this.subMix,s=r[0],n=r[1],a=r[2],o=r[3],l=this.invSubMix,u=l[0],h=l[1],d=l[2],g=l[3],v=new Uint32Array(256);let y=0,b=0,E=0;for(E=0;E<256;E++)E<128?v[E]=E<<1:v[E]=E<<1^283;for(E=0;E<256;E++){let A=b^b<<1^b<<2^b<<3^b<<4;A=A>>>8^A&255^99,e[y]=A,t[A]=y;const M=v[y],D=v[M],B=v[D];let N=v[A]*257^A*16843008;s[y]=N<<24|N>>>8,n[y]=N<<16|N>>>16,a[y]=N<<8|N>>>24,o[y]=N,N=B*16843009^D*65537^M*257^y*16843008,u[A]=N<<24|N>>>8,h[A]=N<<16|N>>>16,d[A]=N<<8|N>>>24,g[A]=N,y?(y=M^v[v[v[B^M]]],b^=v[v[b]]):y=b=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let r=!0,s=0;for(;s<t.length&&r;)r=t[s]===this.key[s],s++;if(r)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),h=this.invKeySchedule=new Uint32Array(a),d=this.sBox,g=this.rcon,v=this.invSubMix,y=v[0],b=v[1],E=v[2],A=v[3];let M,D;for(o=0;o<a;o++){if(o<n){M=u[o]=t[o];continue}D=M,o%n===0?(D=D<<8|D>>>24,D=d[D>>>24]<<24|d[D>>>16&255]<<16|d[D>>>8&255]<<8|d[D&255],D^=g[o/n|0]<<24):n>6&&o%n===4&&(D=d[D>>>24]<<24|d[D>>>16&255]<<16|d[D>>>8&255]<<8|d[D&255]),u[o]=M=(u[o-n]^D)>>>0}for(l=0;l<a;l++)o=a-l,l&3?D=u[o]:D=u[o-4],l<4||o<=4?h[l]=D:h[l]=y[d[D>>>24]]^b[d[D>>>16&255]]^E[d[D>>>8&255]]^A[d[D&255]],h[l]=h[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,r){const s=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],u=o[1],h=o[2],d=o[3],g=this.uint8ArrayToUint32Array_(r);let v=g[0],y=g[1],b=g[2],E=g[3];const A=new Int32Array(e),M=new Int32Array(A.length);let D,B,N,J,Z,se,Q,q,oe,ge,he,Ee,Te,ue;const pe=this.networkToHostOrderSwap;for(;t<A.length;){for(oe=pe(A[t]),ge=pe(A[t+1]),he=pe(A[t+2]),Ee=pe(A[t+3]),Z=oe^n[0],se=Ee^n[1],Q=he^n[2],q=ge^n[3],Te=4,ue=1;ue<s;ue++)D=l[Z>>>24]^u[se>>16&255]^h[Q>>8&255]^d[q&255]^n[Te],B=l[se>>>24]^u[Q>>16&255]^h[q>>8&255]^d[Z&255]^n[Te+1],N=l[Q>>>24]^u[q>>16&255]^h[Z>>8&255]^d[se&255]^n[Te+2],J=l[q>>>24]^u[Z>>16&255]^h[se>>8&255]^d[Q&255]^n[Te+3],Z=D,se=B,Q=N,q=J,Te=Te+4;D=a[Z>>>24]<<24^a[se>>16&255]<<16^a[Q>>8&255]<<8^a[q&255]^n[Te],B=a[se>>>24]<<24^a[Q>>16&255]<<16^a[q>>8&255]<<8^a[Z&255]^n[Te+1],N=a[Q>>>24]<<24^a[q>>16&255]<<16^a[Z>>8&255]<<8^a[se&255]^n[Te+2],J=a[q>>>24]<<24^a[Z>>16&255]<<16^a[se>>8&255]<<8^a[Q&255]^n[Te+3],M[t]=pe(D^v),M[t+1]=pe(J^y),M[t+2]=pe(N^b),M[t+3]=pe(B^E),v=oe,y=ge,b=he,E=Ee,t=t+4}return M.buffer}}const n_=16;class uu{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 r=self.crypto;r&&(this.subtle=r.subtle||r.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 r=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?i_(r):r}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,r){return this.useSoftware?new Promise((s,n)=>{this.softwareDecrypt(new Uint8Array(e),t,r);const a=this.flush();a?s(a.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,r)}softwareDecrypt(e,t,r){const{currentIV:s,currentResult:n,remainderData:a}=this;this.logOnce("JS AES decrypt"),a&&(e=yr(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;s&&(r=s);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new s_),l.expandKey(t);const u=n;return this.currentResult=l.decrypt(o.buffer,0,r),this.currentIV=ss(o,-16).buffer,u||null}webCryptoDecrypt(e,t,r){const s=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new r_(s,t)),this.fastAesKey.expandKey().then(n=>s?(this.logOnce("WebCrypto AES decrypt"),new t_(s,new Uint8Array(r)).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,r)))}onWebCryptoError(e,t,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r);const s=this.flush();if(s)return s.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const r=e.length-e.length%n_;return r!==e.length&&(t=ss(e,0,r),this.remainderData=ss(e,r)),t}logOnce(e){this.logEnabled&&(ie.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const a_={toString:function(i){let e="";const t=i.length;for(let r=0;r<t;r++)e+=`[${i.start(r).toFixed(3)}-${i.end(r).toFixed(3)}]`;return e}},de={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 hu extends WA{constructor(e,t,r,s,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=de.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=s,this.log=ie.log.bind(ie,`${s}:`),this.warn=ie.warn.bind(ie,`${s}:`),this.hls=e,this.fragmentLoader=new e_(e.config),this.keyLoader=r,this.fragmentTracker=t,this.config=e.config,this.decrypter=new uu(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=de.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const r=t.partList;if(r!=null&&r.length){const n=r[r.length-1];return mt.isBuffered(this.media,n.start+n.duration/2)}const s=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(s)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const r=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);const s=this.config;this.levels&&s.autoStartLoad&&this.state===de.STOPPED&&this.startLoad(s.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:r,mediaBuffer:s,state:n}=this,a=r?r.currentTime:0,o=mt.bufferInfo(s||r,a,e.maxBufferHole);if(this.log(`media seeking to ${Re(a)?a.toFixed(3):a}, state: ${n}`),this.state===de.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,u=t.start-l,h=t.start+t.duration+l;if(!o.len||h<o.start||u>o.end){const d=a>h;(a<u||d)&&(d&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}r&&(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=de.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,r){this._loadFragForPlayback(e,t,r)}_loadFragForPlayback(e,t,r){const s=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,r,s).then(n=>{if(!n)return;const a=this.state;if(this.fragContextChanged(e)){(a===de.FRAG_LOADING||!this.fragCurrent&&a===de.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=de.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===de.STOPPED||this.state===de.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:r}=this;if(r.getState(e)===Ft.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)&&r.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?r.removeAllFragments():r.hasParts(e.type)&&(r.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),r.getState(e)===Ft.PARTIAL&&r.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,r=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:r};this.hls.trigger(C.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(r=>{if(!r||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return r}).then(r=>{const{hls:s}=this,{payload:n}=r,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 s.trigger(C.ERROR,{type:Ve.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 s.trigger(C.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:o,tdecrypt:u}}),r.payload=l,this.completeInitSegmentLoad(r)})}return this.completeInitSegmentLoad(r)}).catch(r=>{this.state===de.STOPPED||this.state===de.ERROR||(this.warn(r),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const r=e.frag.stats;this.state=de.IDLE,e.frag.data=new Uint8Array(e.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var r,s,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===Ge.MAIN?"level":"track"} ${e.level} (frag:[${((r=e.startPTS)!=null?r:NaN).toFixed(3)}-${((s=e.endPTS)!=null?s:NaN).toFixed(3)}] > buffer:${o?a_.toString(mt.getBuffered(o)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==Ge.SUBTITLE){const h=e.elementaryStreams;if(!Object.keys(h).some(d=>!!h[d])){this.state=de.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=de.IDLE,o&&(!this.loadedmetadata&&e.type==Ge.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:r,part:s,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new cu(r.level,r.sn,r.stats.chunkCount+1,0,s?s.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,r=null,s){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=de.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(C.KEY_LOADED,h),this.state===de.KEY_LOADING&&(this.state=de.IDLE),h}),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),r=Math.max(e.start,r||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const h=a.partList;if(h&&s){r>e.end&&a.fragmentHint&&(e=a.fragmentHint);const d=this.getNextPart(h,e,r);if(d>-1){const g=h[d];this.log(`Loading part sn: ${e.sn} p: ${g.index} cc: ${e.cc} of playlist [${a.startSN}-${a.endSN}] parts [0-${d}-${h.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(r.toFixed(3))}`),this.nextLoadPosition=g.start+g.duration,this.state=de.FRAG_LOADING;let v;return o?v=o.then(y=>!y||this.fragContextChanged(y.frag)?null:this.doFragPartsLoad(e,g,t,s)).catch(y=>this.handleFragLoadError(y)):v=this.doFragPartsLoad(e,g,t,s).catch(y=>this.handleFragLoadError(y)),this.hls.trigger(C.FRAG_LOADING,{frag:e,part:g,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):v}else if(!e.url||this.loadedEndOfParts(h,r))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(r.toFixed(3))}`),Re(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=de.FRAG_LOADING;const l=this.config.progressive;let u;return l&&o?u=o.then(h=>!h||this.fragContextChanged(h==null?void 0:h.frag)?null:this.fragmentLoader.load(e,s)).catch(h=>this.handleFragLoadError(h)):u=Promise.all([this.fragmentLoader.load(e,l?s:void 0),o]).then(([h])=>(!l&&h&&s&&s(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(C.FRAG_LOADING,{frag:e,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):u}doFragPartsLoad(e,t,r,s){return new Promise((n,a)=>{var o;const l=[],u=(o=r.details)==null?void 0:o.partList,h=d=>{this.fragmentLoader.loadPart(e,d,s).then(g=>{l[d.index]=g;const v=g.part;this.hls.trigger(C.FRAG_LOADED,g);const y=Yf(r,e.sn,d.index+1)||dm(u,e.sn,d.index+1);if(y)h(y);else return n({frag:e,part:v,partsLoaded:l})}).catch(a)};h(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:Ve.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!==de.PARSING){!this.fragCurrent&&this.state!==de.STOPPED&&this.state!==de.ERROR&&(this.state=de.IDLE);return}const{frag:r,part:s,level:n}=t,a=self.performance.now();r.stats.parsing.end=a,s&&(s.stats.parsing.end=a),this.updateLevelTiming(r,s,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:r}=this,{level:s,sn:n,part:a}=e;if(!(t!=null&&t[s]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${s}. The current chunk will not be buffered.`),null;const o=t[s],l=a>-1?Yf(o,n,a):null,u=l?l.fragment:RA(o,n,r);return u?(r&&r!==u&&(u.stats=r.stats),{frag:u,part:l,level:o}):null}bufferFragmentData(e,t,r,s,n){var a;if(!e||this.state!==de.PARSING)return;const{data1:o,data2:l}=e;let u=o;if(o&&l&&(u=yr(o,l)),!((a=u)!=null&&a.length))return;const h={type:e.type,frag:t,part:r,chunkMeta:s,parent:t.type,data:u};if(this.hls.trigger(C.BUFFER_APPENDING,h),e.dropped&&e.independent&&!r){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 r=t.currentTime,s=mt.bufferInfo(t,r,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,s.end-a),r+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const r=this.getLoadPosition();return Re(r)?this.getFwdBufferInfoAtPos(e,r,t):null}getFwdBufferInfoAtPos(e,t,r){const{config:{maxBufferHole:s}}=this,n=mt.bufferInfo(e,t,s);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,r);if(a&&n.nextStart<a.end)return mt.bufferInfo(e,t,Math.max(n.nextStart,s))}return n}getMaxBufferLength(e){const{config:t}=this;let r;return e?r=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):r=t.maxBufferLength,Math.min(r,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,r=e||t.maxBufferLength;return t.maxMaxBufferLength>=r?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=Ge.MAIN){const r=this.fragmentTracker.getAppendedFrag(e,Ge.MAIN);return r&&"fragment"in r?r.fragment:r}getNextFragment(e,t){const r=t.fragments,s=r.length;if(!s)return null;const{config:n}=this,a=r[0].start;let o;if(t.live){const l=n.initialLiveManifestSize;if(s<l)return this.warn(`Not enough fragments to start playback (have: ${s}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a)&&(o=this.getInitialLiveFragment(t,r),this.startPosition=this.nextLoadPosition=o?this.hls.liveSyncPosition||o.start:e)}else e<=a&&(o=r[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 r=this.fragmentTracker.getState(e);return(r===Ft.OK||r===Ft.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,r,s,n){const a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,a&&e&&!e.gap&&r.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,s);if(l!==null&&r.len+l.len>=n)return this.log(`buffer full after gaps in "${s}" 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,r){let s=-1,n=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const u=e[o];if(a=a&&!u.independent,s>-1&&r<u.start)break;const h=u.loaded;h?s=-1:(n||u.independent||a)&&u.fragment===t&&(s=o),n=h}return s}loadedEndOfParts(e,t){const r=e[e.length-1];return r&&t>r.start&&r.loaded}getInitialLiveFragment(e,t){const r=this.fragPrevious;let s=null;if(r){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`),s=PA(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!s){const n=r.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];r.cc===a.cc&&(s=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=DA(t,r.cc),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(s=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,r){const{config:s}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=r;const{fragmentHint:l}=r,u=s.maxFragLookUpTolerance,h=r.partList,d=!!(s.lowLatencyMode&&h!=null&&h.length&&l);d&&l&&!this.bitrateTest&&(a=a.concat(l),o=l.sn);let g;if(e<t){const v=e>t-u?0:u;g=ro(n,a,e,v)}else g=a[a.length-1];if(g){const v=g.sn-r.startSN,y=this.fragmentTracker.getState(g);if((y===Ft.OK||y===Ft.PARTIAL&&g.gap)&&(n=g),n&&g.sn===n.sn&&(!d||h[0].fragment.sn>g.sn)&&n&&g.level===n.level){const E=a[v+1];g.sn<o&&this.fragmentTracker.getState(E)!==Ft.OK?g=E:g=null}}return g}synchronizeToLiveEdge(e){const{config:t,media:r}=this;if(!r)return;const s=this.hls.liveSyncPosition,n=r.currentTime,a=e.fragments[0].start,o=e.edge,l=n>=a-t.maxFragLookUpTolerance&&n<=o;if(s!==null&&r.duration>s&&(n<s||!l)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&r.readyState<4||n<o-u)&&(this.loadedmetadata||(this.nextLoadPosition=s),r.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${s.toFixed(3)}`),r.currentTime=s))}}alignPlaylists(e,t,r){const s=e.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,a=!t,o=e.alignedSliding&&Re(n);if(a||!o&&!n){const{fragPrevious:l}=this;JA(l,r,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: ${s}`),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 r=this.startPosition;if(r<t&&(r=-1),r===-1||this.lastCurrentTime===-1){const s=this.startTimeOffset!==null,n=s?this.startTimeOffset:e.startTimeOffset;n!==null&&Re(n)?(r=t+n,n<0&&(r+=e.totalduration),r=Math.min(Math.max(t,r),t+e.totalduration),this.log(`Start time offset ${n} found in ${s?"multivariant":"media"} playlist, adjust startPosition to ${r}`),this.startPosition=r):e.live?r=this.hls.liveSyncPosition||t:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r}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!==de.FRAG_LOADING_WAITING_RETRY)&&(this.state=de.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const h=this.getCurrentContext(t.chunkMeta);h&&(t.frag=h.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var s;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const n=t.details===ce.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(r,!0);const a=t.errorAction,{action:o,retryCount:l=0,retryConfig:u}=a||{};if(a&&o===Vt.RetryRequest&&u){this.resetStartWhenNotLoaded(this.levelLastLoaded);const h=ou(u,l);this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${l+1}/${u.maxNumRetry} in ${h}ms`),a.resolved=!0,this.retryDate=self.performance.now()+h,this.state=de.FRAG_LOADING_WAITING_RETRY}else if(u&&a)if(this.resetFragmentErrors(e),l<u.maxNumRetry)!n&&o!==Vt.RemoveAlternatePermanently&&(a.resolved=!0);else{ie.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(a==null?void 0:a.action)===Vt.SendAlternateToPenaltyBox?this.state=de.WAITING_LEVEL:this.state=de.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===de.PARSING||this.state===de.PARSED){const t=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,t),s=r&&r.len>.5;s&&this.reduceMaxBufferLength(r.len);const n=!s;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===Ge.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==de.STOPPED&&(this.state=de.IDLE)}afterBufferFlushed(e,t,r){if(!e)return;const s=mt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,r),this.state===de.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=de.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,r,s){var n;const a=r.details;if(!a){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,u)=>{const h=e.elementaryStreams[u];if(h){const d=h.endPTS-h.startPTS;if(d<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${d})`),l||!1;const g=s?0:hm(a,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS);return this.hls.trigger(C.LEVEL_PTS_UPDATED,{details:a,level:r,drift:g,type:u,frag:e,start:h.startPTS,end:h.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(r.fragmentError===0&&(r.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(C.ERROR,{type:Ve.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=de.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 ym{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let r;if(e.length)e.length===1?r=e[0]:r=o_(e,t);else return new Uint8Array(0);return this.reset(),r}reset(){this.chunks.length=0,this.dataLength=0}}function o_(i,e){const t=new Uint8Array(e);let r=0;for(let s=0;s<i.length;s++){const n=i[s];t.set(n,r),r+=n.length}return t}function l_(){return typeof __HLS_WORKER_BUNDLE__=="function"}function c_(){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 u_(i){const e=new self.URL(i,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Hr(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class fu{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,r,s){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,r){}demux(e,t){this.cachedData&&(e=yr(this.cachedData,e),this.cachedData=null);let r=Kn(e,0),s=r?r.length:0,n;const a=this._audioTrack,o=this._id3Track,l=r?au(r):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&Re(l))&&(this.basePTS=h_(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:Pr.audioId3,duration:Number.POSITIVE_INFINITY});s<u;){if(this.canParse(e,s)){const h=this.appendFrame(a,e,s);h?(this.frameIndex++,this.lastPTS=h.sample.pts,s+=h.length,n=s):s=u}else Ow(e,s)?(r=Kn(e,s),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:Pr.audioId3,duration:Number.POSITIVE_INFINITY}),s+=r.length,n=s):s++;if(s===u&&n!==u){const h=ss(e,n);this.cachedData?this.cachedData=yr(this.cachedData,h):this.cachedData=h}}return{audioTrack:a,videoTrack:Hr(),id3Track:o,textTrack:Hr()}}demuxSampleAes(e,t,r){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Hr(),id3Track:this._id3Track,textTrack:Hr()}}destroy(){}}const h_=(i,e,t)=>{if(Re(i))return i*90;const r=t?t.baseTime*9e4/t.timescale:0;return e*9e4+r};function f_(i,e,t,r){let s,n,a,o;const l=navigator.userAgent.toLowerCase(),u=r,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];s=((e[t+2]&192)>>>6)+1;const d=(e[t+2]&60)>>>2;if(d>h.length-1){const g=new Error(`invalid ADTS sampling index:${d}`);i.emit(C.ERROR,C.ERROR,{type:Ve.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:${r}, ADTS type:${s}, samplingIndex:${d}`),/firefox/i.test(l)?d>=6?(s=5,o=new Array(4),n=d-3):(s=2,o=new Array(2),n=d):l.indexOf("android")!==-1?(s=2,o=new Array(2),n=d):(s=5,o=new Array(4),r&&(r.indexOf("mp4a.40.29")!==-1||r.indexOf("mp4a.40.5")!==-1)||!r&&d>=6?n=d-3:((r&&r.indexOf("mp4a.40.2")!==-1&&(d>=6&&a===1||/vivaldi/i.test(l))||!r&&a===1)&&(s=2,o=new Array(2)),n=d)),o[0]=s<<3,o[0]|=(d&14)>>1,o[1]|=(d&1)<<7,o[1]|=a<<3,s===5&&(o[1]|=(n&14)>>1,o[2]=(n&1)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:h[d],channelCount:a,codec:"mp4a.40."+s,manifestCodec:u}}function Sm(i,e){return i[e]===255&&(i[e+1]&246)===240}function xm(i,e){return i[e+1]&1?7:9}function du(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function d_(i,e){return e+5<i.length}function so(i,e){return e+1<i.length&&Sm(i,e)}function p_(i,e){return d_(i,e)&&Sm(i,e)&&du(i,e)<=i.length-e}function g_(i,e){if(so(i,e)){const t=xm(i,e);if(e+t>=i.length)return!1;const r=du(i,e);if(r<=t)return!1;const s=e+r;return s===i.length||so(i,s)}return!1}function bm(i,e,t,r,s){if(!i.samplerate){const n=f_(e,t,r,s);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 Em(i){return 1024*9e4/i}function m_(i,e){const t=xm(i,e);if(e+t<=i.length){const r=du(i,e)-t;if(r>0)return{headerLength:t,frameLength:r}}}function Tm(i,e,t,r,s){const n=Em(i.samplerate),a=r+s*n,o=m_(e,t);let l;if(o){const{frameLength:d,headerLength:g}=o,v=g+d,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 b={unit:l,pts:a};return y||i.samples.push(b),{sample:b,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 v_=[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],y_=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],S_=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],x_=[0,1,1,4];function wm(i,e,t,r,s){if(t+24>e.length)return;const n=Am(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=r+s*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 Am(i,e){const t=i[e+1]>>3&3,r=i[e+1]>>1&3,s=i[e+2]>>4&15,n=i[e+2]>>2&3;if(t!==1&&s!==0&&s!==15&&n!==3){const a=i[e+2]>>1&1,o=i[e+3]>>6,l=t===3?3-r:r===3?3:4,u=v_[l*14+s-1]*1e3,d=y_[(t===3?0:t===2?1:2)*3+n],g=o===3?1:2,v=S_[t][r],y=x_[r],b=v*8*y,E=Math.floor(v*u/d+a)*y;if(Ca===null){const D=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ca=D?parseInt(D[1]):0}return!!Ca&&Ca<=87&&r===2&&u>=224e3&&o===0&&(i[e+3]=i[e+3]|128),{sampleRate:d,channelCount:g,frameLength:E,samplesPerFrame:b}}}function pu(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function _m(i,e){return e+1<i.length&&pu(i,e)}function b_(i,e){return pu(i,e)&&4<=i.length-e}function Cm(i,e){if(e+1<i.length&&pu(i,e)){const r=Am(i,e);let s=4;r!=null&&r.frameLength&&(s=r.frameLength);const n=e+s;return n===i.length||_m(i,n)}return!1}class E_ extends fu{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,r,s){super.resetInitSegment(e,t,r,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Kn(e,0);let r=(t==null?void 0:t.length)||0;if(Cm(e,r))return!1;for(let s=e.length;r<s;r++)if(g_(e,r))return ie.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return p_(e,t)}appendFrame(e,t,r){bm(e,this.observer,t,r,e.manifestCodec);const s=Tm(e,t,r,this.basePTS,this.frameIndex);if(s&&s.missing===0)return s}}const T_=/\/emsg[-/]ID3/i;class w_{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,r,s){const n=this.videoTrack=Hr("video",1),a=this.audioTrack=Hr("audio",1),o=this.txtTrack=Hr("text",1);if(this.id3Track=Hr("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=im(e);if(l.video){const{id:u,timescale:h,codec:d}=l.video;n.id=u,n.timescale=o.timescale=h,n.codec=d}if(l.audio){const{id:u,timescale:h,codec:d}=l.audio;a.id=u,a.timescale=h,a.codec=d}o.id=em.text,n.sampleDuration=0,n.duration=a.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return jw(e)}demux(e,t){this.timeOffset=t;let r=e;const s=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=yr(this.remainderData,e));const o=Qw(r);this.remainderData=o.remainder,s.samples=o.valid||new Uint8Array}else s.samples=r;const a=this.extractID3Track(s,t);return n.samples=If(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,r=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return r.samples=If(e,t),{videoTrack:t,audioTrack:Hr(),id3Track:s,textTrack:Hr()}}extractID3Track(e,t){const r=this.id3Track;if(e.samples.length){const s=Qe(e.samples,["emsg"]);s&&s.forEach(n=>{const a=eA(n);if(T_.test(a.schemeIdUri)){const o=Re(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;r.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Pr.emsg,duration:l})}})}return r}demuxSampleAes(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Lm=(i,e)=>{let t=0,r=5;e+=r;const s=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;r>0;){a[0]=i[e];const o=Math.min(r,8),l=8-o;n[0]=4278190080>>>24+l<<l,s[0]=(a[0]&n[0])>>l,t=t?t<<o|s[0]:s[0],e+=1,r-=o}return t};class A_ extends fu{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,r,s){super.resetInitSegment(e,t,r,s),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,r){const s=Rm(e,t,r,this.basePTS,this.frameIndex);if(s!==-1)return{sample:e.samples[e.samples.length-1],length:s,missing:0}}static probe(e){if(!e)return!1;const t=Kn(e,0);if(!t)return!1;const r=t.length;return e[r]===11&&e[r+1]===119&&au(t)!==void 0&&Lm(e,r)<16}}function Rm(i,e,t,r,s){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,h=[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+h>e.length)return-1;const d=e[t+6]>>5;let g=0;d===2?g+=2:(d&1&&d!==1&&(g+=2),d&4&&(g+=2));const v=(e[t+6]<<8|e[t+7])>>12-g&1,b=[2,1,2,3,3,4,4,5][d]+v,E=e[t+5]>>3,A=e[t+5]&7,M=new Uint8Array([n<<6|E<<1|A>>2,(A&3)<<6|d<<3|v<<2|l>>4,l<<4&224]),D=1536/o*9e4,B=r+s*D,N=e.subarray(t,t+h);return i.config=M,i.channelCount=b,i.samplerate=o,i.samples.push({unit:N,pts:B}),h}class __{constructor(){this.VideoSample=null}createVideoSample(e,t,r,s){return{key:e,frame:!1,pts:t,dts:r,units:[],debug:s,length:0}}getLastNalUnit(e){var t;let r=this.VideoSample,s;if((!r||r.units.length===0)&&(r=e[e.length-1]),(t=r)!=null&&t.units){const n=r.units;s=n[n.length-1]}return s}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const r=t.samples,s=r.length;if(s){const n=r[s-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 sd{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,r=e.byteLength-t,s=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");s.set(e.subarray(r,r+n)),this.word=new DataView(s.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 r=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?r<<t|this.readBits(t):r}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,r=8,s;for(let n=0;n<e;n++)r!==0&&(s=this.readEG(),r=(t+s+256)%256),t=r===0?t:r}readSPS(){let e=0,t=0,r=0,s=0,n,a,o;const l=this.readUByte.bind(this),u=this.readBits.bind(this),h=this.readUEG.bind(this),d=this.readBoolean.bind(this),g=this.skipBits.bind(this),v=this.skipEG.bind(this),y=this.skipUEG.bind(this),b=this.skipScalingList.bind(this);l();const E=l();if(u(5),g(3),l(),y(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){const J=h();if(J===3&&g(1),y(),y(),g(1),d())for(a=J!==3?8:12,o=0;o<a;o++)d()&&(o<6?b(16):b(64))}y();const A=h();if(A===0)h();else if(A===1)for(g(1),v(),v(),n=h(),o=0;o<n;o++)v();y(),g(1);const M=h(),D=h(),B=u(1);B===0&&g(1),g(1),d()&&(e=h(),t=h(),r=h(),s=h());let N=[1,1];if(d()&&d())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((M+1)*16-e*2-t*2),height:(2-B)*(D+1)*16-(B?2:4)*(r+s),pixelRatio:N}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class C_ extends __{parseAVCPES(e,t,r,s,n){const a=this.parseAVCNALu(e,r.data);let o=this.VideoSample,l,u=!1;r.data=null,o&&a.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"")),a.forEach(h=>{var d;switch(h.type){case 1:{let b=!1;l=!0;const E=h.data;if(u&&E.length>4){const A=new sd(E).readSliceType();(A===2||A===4||A===7||A===9)&&(b=!0)}if(b){var g;(g=o)!=null&&g.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),o.frame=!0,o.key=b;break}case 5:l=!0,(d=o)!=null&&d.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),o.key=!0,o.frame=!0;break;case 6:{l=!0,nm(h.data,1,r.pts,t.samples);break}case 7:{var v,y;l=!0,u=!0;const b=h.data,A=new sd(b).readSPS();if(!e.sps||e.width!==A.width||e.height!==A.height||((v=e.pixelRatio)==null?void 0:v[0])!==A.pixelRatio[0]||((y=e.pixelRatio)==null?void 0:y[1])!==A.pixelRatio[1]){e.width=A.width,e.height=A.height,e.pixelRatio=A.pixelRatio,e.sps=[b],e.duration=n;const M=b.subarray(1,4);let D="avc1.";for(let B=0;B<3;B++){let N=M[B].toString(16);N.length<2&&(N="0"+N),D+=N}e.codec=D}break}case 8:l=!0,e.pps=[h.data];break;case 9:l=!0,e.audFound=!0,o&&this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"");break;case 12:l=!0;break;default:l=!1,o&&(o.debug+="unknown NAL "+h.type+" ");break}o&&l&&o.units.push(h)}),s&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}parseAVCNALu(e,t){const r=t.byteLength;let s=e.naluState||0;const n=s,a=[];let o=0,l,u,h,d=-1,g=0;for(s===-1&&(d=0,g=t[0]&31,s=0,o=1);o<r;){if(l=t[o++],!s){s=l?0:1;continue}if(s===1){s=l?0:2;continue}if(!l)s=3;else if(l===1){if(u=o-s-1,d>=0){const v={data:t.subarray(d,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=yr(v.data,t.subarray(0,u)),v.state=0))}o<r?(h=t[o]&31,d=o,g=h,s=0):s=-1}else s=0}if(d>=0&&s>=0){const v={data:t.subarray(d,r),type:g,state:s};a.push(v)}if(a.length===0){const v=this.getLastNalUnit(e.samples);v&&(v.data=yr(v.data,t))}return e.naluState=s,a}}class L_{constructor(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new uu(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,r){const s=e[t].unit;if(s.length<=16)return;const n=s.subarray(16,s.length-s.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);s.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,r)})}decryptAacSamples(e,t,r){for(;;t++){if(t>=e.length){r();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,r),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,r=new Int8Array(t);let s=0;for(let n=32;n<e.length-16;n+=160,s+=16)r.set(e.subarray(n,n+16),s);return r}getAvcDecryptedUnit(e,t){const r=new Uint8Array(t);let s=0;for(let n=32;n<e.length-16;n+=160,s+=16)e.set(r.subarray(s,s+16),n);return e}decryptAvcSample(e,t,r,s,n){const a=am(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,r+1,s)})}decryptAvcSamples(e,t,r,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length){s();return}const n=e[t].units;for(;!(r>=n.length);r++){const a=n[r];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,r,s,a),!this.decrypter.isSync()))return}}}}const Mt=188;class Oi{constructor(e,t,r){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=r,this.videoParser=new C_}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 r=Math.min(Mt*5,t-Mt)+1,s=0;for(;s<r;){let n=!1,a=-1,o=0;for(let l=s;l<t;l+=Mt)if(e[l]===71&&(t-l===Mt||e[l+Mt]===71)){if(o++,a===-1&&(a=l,a!==0&&(r=Math.min(a+Mt*99,e.length-Mt)+1)),n||(n=pc(e,l)===0),n&&o>1&&(a===0&&o>2||l+Mt>r))return a}else{if(o)return-1;break}s++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:em[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,r,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Oi.createTrack("video"),this._audioTrack=Oi.createTrack("audio",s),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=r,this._duration=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:r}=this;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,r=!1,s=!1){r||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,u=this._txtTrack;let h=a.pid,d=a.pesData,g=o.pid,v=l.pid,y=o.pesData,b=l.pesData,E=null,A=this.pmtParsed,M=this._pmtId,D=e.length;if(this.remainderData&&(e=yr(this.remainderData,e),D=e.length,this.remainderData=null),D<Mt&&!s)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:u};const B=Math.max(0,Oi.syncOffset(e));D-=(D-B)%Mt,D<e.byteLength&&!s&&(this.remainderData=new Uint8Array(e.buffer,D,e.buffer.byteLength-D));let N=0;for(let Z=B;Z<D;Z+=Mt)if(e[Z]===71){const se=!!(e[Z+1]&64),Q=pc(e,Z),q=(e[Z+3]&48)>>4;let oe;if(q>1){if(oe=Z+5+e[Z+4],oe===Z+Mt)continue}else oe=Z+4;switch(Q){case h:se&&(d&&(n=Cs(d))&&this.videoParser.parseAVCPES(a,u,n,!1,this._duration),d={data:[],size:0}),d&&(d.data.push(e.subarray(oe,Z+Mt)),d.size+=Z+Mt-oe);break;case g:if(se){if(y&&(n=Cs(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(oe,Z+Mt)),y.size+=Z+Mt-oe);break;case v:se&&(b&&(n=Cs(b))&&this.parseID3PES(l,n),b={data:[],size:0}),b&&(b.data.push(e.subarray(oe,Z+Mt)),b.size+=Z+Mt-oe);break;case 0:se&&(oe+=e[oe]+1),M=this._pmtId=R_(e,oe);break;case M:{se&&(oe+=e[oe]+1);const ge=I_(e,oe,this.typeSupported,r);h=ge.videoPid,h>0&&(a.pid=h,a.segmentCodec=ge.segmentVideoCodec),g=ge.audioPid,g>0&&(o.pid=g,o.segmentCodec=ge.segmentAudioCodec),v=ge.id3Pid,v>0&&(l.pid=v),E!==null&&!A&&(ie.warn(`MPEG-TS PMT found at ${Z} after unknown PID '${E}'. Backtracking to sync byte @${B} to parse all TS packets.`),E=null,Z=B-188),A=this.pmtParsed=!0;break}case 17:case 8191:break;default:E=Q;break}}else N++;if(N>0){const Z=new Error(`Found ${N} TS packet/s that do not start with 0x47`);this.observer.emit(C.ERROR,C.ERROR,{type:Ve.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:Z,reason:Z.message})}a.pesData=d,o.pesData=y,l.pesData=b;const J={audioTrack:o,videoTrack:a,id3Track:l,textTrack:u};return s&&this.extractRemainingSamples(J),J}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:r,id3Track:s,textTrack:n}=e,a=r.pesData,o=t.pesData,l=s.pesData;let u;if(a&&(u=Cs(a))?(this.videoParser.parseAVCPES(r,n,u,!0,this._duration),r.pesData=null):r.pesData=a,o&&(u=Cs(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=Cs(l))?(this.parseID3PES(s,u),s.pesData=null):s.pesData=l}demuxSampleAes(e,t,r){const s=this.demux(e,r,!0,!this.config.progressive),n=this.sampleAes=new L_(this.observer,this.config,t);return this.decrypt(s,n)}decrypt(e,t){return new Promise(r=>{const{audioTrack:s,videoTrack:n}=e;s.samples&&s.segmentCodec==="aac"?t.decryptAacSamples(s.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{r(e)}):r(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{r(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let r=0;const s=this.aacOverFlow;let n=t.data;if(s){this.aacOverFlow=null;const d=s.missing,g=s.sample.unit.byteLength;if(d===-1)n=yr(s.sample.unit,n);else{const v=g-d;s.sample.unit.set(n.subarray(0,d),v),e.samples.push(s.sample),r=s.missing}}let a,o;for(a=r,o=n.length;a<o-1&&!so(n,a);a++);if(a!==r){let d;const g=a<o-1;g?d=`AAC PES did not start with ADTS header,offset:${a}`:d="No ADTS header found in AAC PES";const v=new Error(d);if(ie.warn(`parsing error: ${d}`),this.observer.emit(C.ERROR,C.ERROR,{type:Ve.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,levelRetry:g,error:v,reason:d}),!g)return}bm(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(s){const d=Em(e.samplerate);l=s.sample.pts+d}else{ie.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,h;for(;a<o;)if(h=Tm(e,n,a,l,u),a+=h.length,h.missing){this.aacOverFlow=h;break}else for(u++;a<o-1&&!so(n,a);a++);}parseMPEGPES(e,t){const r=t.data,s=r.length;let n=0,a=0;const o=t.pts;if(o===void 0){ie.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<s;)if(_m(r,a)){const l=wm(e,r,a,o,n);if(l)a+=l.length,n++;else break}else a++}parseAC3PES(e,t){{const r=t.data,s=t.pts;if(s===void 0){ie.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=r.length;let a=0,o=0,l;for(;o<n&&(l=Rm(e,r,o,s,a++))>0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){ie.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const r=Lt({},t,{type:this._videoTrack?Pr.emsg:Pr.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}}function pc(i,e){return((i[e+1]&31)<<8)+i[e+2]}function R_(i,e){return(i[e+10]&31)<<8|i[e+11]}function I_(i,e,t,r){const s={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=pc(i,e),u=(i[e+3]&15)<<8|i[e+4];switch(i[e]){case 207:if(!r){xl("ADTS AAC");break}case 15:s.audioPid===-1&&(s.audioPid=l);break;case 21:s.id3Pid===-1&&(s.id3Pid=l);break;case 219:if(!r){xl("H.264");break}case 27:s.videoPid===-1&&(s.videoPid=l,s.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?ie.log("MPEG audio found, not supported in this browser"):s.audioPid===-1&&(s.audioPid=l,s.segmentAudioCodec="mp3");break;case 193:if(!r){xl("AC-3");break}case 129:t.ac3?s.audioPid===-1&&(s.audioPid=l,s.segmentAudioCodec="ac3"):ie.log("AC-3 audio found, not supported in this browser");break;case 6:if(s.audioPid===-1&&u>0){let h=e+5,d=u;for(;d>2;){switch(i[h]){case 106:t.ac3!==!0?ie.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=l,s.segmentAudioCodec="ac3");break}const v=i[h+1]+2;h+=v,d-=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 s}function xl(i){ie.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function Cs(i){let e=0,t,r,s,n,a;const o=i.data;if(!i||i.size===0)return null;for(;o[0].length<19&&o.length>1;)o[0]=yr(o[0],o[1]),o.splice(1,1);if(t=o[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(r=(t[4]<<8)+t[5],r&&r>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),s=t[8];let h=s+9;if(i.size<=h)return null;i.size-=h;const d=new Uint8Array(i.size);for(let g=0,v=o.length;g<v;g++){t=o[g];let y=t.byteLength;if(h)if(h>y){h-=y;continue}else t=t.subarray(h),y-=h,h=0;d.set(t,e),e+=y}return r&&(r-=s+3),{data:d,pts:n,dts:a,len:r}}return null}class P_ extends fu{resetInitSegment(e,t,r,s){super.resetInitSegment(e,t,r,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Kn(e,0);let r=(t==null?void 0:t.length)||0;if(t&&e[r]===11&&e[r+1]===119&&au(t)!==void 0&&Lm(e,r)<=16)return!1;for(let s=e.length;r<s;r++)if(Cm(e,r))return ie.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return b_(e,t)}appendFrame(e,t,r){if(this.basePTS!==null)return wm(e,t,r,this.basePTS,this.frameIndex)}}class nd{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 Pi=Math.pow(2,32)-1;class le{static init(){le.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 le.types)le.types.hasOwnProperty(e)&&(le.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);le.HDLR_TYPES={video:t,audio:r};const s=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]);le.STTS=le.STSC=le.STCO=n,le.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),le.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),le.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),le.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]);le.FTYP=le.box(le.types.ftyp,a,l,a,o),le.DINF=le.box(le.types.dinf,le.box(le.types.dref,s))}static box(e,...t){let r=8,s=t.length;const n=s;for(;s--;)r+=t[s].byteLength;const a=new Uint8Array(r);for(a[0]=r>>24&255,a[1]=r>>16&255,a[2]=r>>8&255,a[3]=r&255,a.set(e,4),s=0,r=8;s<n;s++)a.set(t[s],r),r+=t[s].byteLength;return a}static hdlr(e){return le.box(le.types.hdlr,le.HDLR_TYPES[e])}static mdat(e){return le.box(le.types.mdat,e)}static mdhd(e,t){t*=e;const r=Math.floor(t/(Pi+1)),s=Math.floor(t%(Pi+1));return le.box(le.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,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&255,85,196,0,0]))}static mdia(e){return le.box(le.types.mdia,le.mdhd(e.timescale,e.duration),le.hdlr(e.type),le.minf(e))}static mfhd(e){return le.box(le.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"?le.box(le.types.minf,le.box(le.types.smhd,le.SMHD),le.DINF,le.stbl(e)):le.box(le.types.minf,le.box(le.types.vmhd,le.VMHD),le.DINF,le.stbl(e))}static moof(e,t,r){return le.box(le.types.moof,le.mfhd(e),le.traf(r,t))}static moov(e){let t=e.length;const r=[];for(;t--;)r[t]=le.trak(e[t]);return le.box.apply(null,[le.types.moov,le.mvhd(e[0].timescale,e[0].duration)].concat(r).concat(le.mvex(e)))}static mvex(e){let t=e.length;const r=[];for(;t--;)r[t]=le.trex(e[t]);return le.box.apply(null,[le.types.mvex,...r])}static mvhd(e,t){t*=e;const r=Math.floor(t/(Pi+1)),s=Math.floor(t%(Pi+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,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&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 le.box(le.types.mvhd,n)}static sdtp(e){const t=e.samples||[],r=new Uint8Array(4+t.length);let s,n;for(s=0;s<t.length;s++)n=t[s].flags,r[s+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return le.box(le.types.sdtp,r)}static stbl(e){return le.box(le.types.stbl,le.stsd(e),le.box(le.types.stts,le.STTS),le.box(le.types.stsc,le.STSC),le.box(le.types.stsz,le.STSZ),le.box(le.types.stco,le.STCO))}static avc1(e){let t=[],r=[],s,n,a;for(s=0;s<e.sps.length;s++)n=e.sps[s],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(s=0;s<e.pps.length;s++)n=e.pps[s],a=n.byteLength,r.push(a>>>8&255),r.push(a&255),r=r.concat(Array.prototype.slice.call(n));const o=le.box(le.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(r))),l=e.width,u=e.height,h=e.pixelRatio[0],d=e.pixelRatio[1];return le.box(le.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,le.box(le.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),le.box(le.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,d>>24,d>>16&255,d>>8&255,d&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 le.box(le.types.mp4a,le.audioStsd(e),le.box(le.types.esds,le.esds(e)))}static mp3(e){return le.box(le.types[".mp3"],le.audioStsd(e))}static ac3(e){return le.box(le.types["ac-3"],le.audioStsd(e),le.box(le.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?le.box(le.types.stsd,le.STSD,le.mp3(e)):e.segmentCodec==="ac3"?le.box(le.types.stsd,le.STSD,le.ac3(e)):le.box(le.types.stsd,le.STSD,le.mp4a(e)):le.box(le.types.stsd,le.STSD,le.avc1(e))}static tkhd(e){const t=e.id,r=e.duration*e.timescale,s=e.width,n=e.height,a=Math.floor(r/(Pi+1)),o=Math.floor(r%(Pi+1));return le.box(le.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,s>>8&255,s&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const r=le.sdtp(e),s=e.id,n=Math.floor(t/(Pi+1)),a=Math.floor(t%(Pi+1));return le.box(le.types.traf,le.box(le.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),le.box(le.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])),le.trun(e,r.length+16+20+8+16+8+8),r)}static trak(e){return e.duration=e.duration||4294967295,le.box(le.types.trak,le.tkhd(e),le.mdia(e))}static trex(e){const t=e.id;return le.box(le.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 r=e.samples||[],s=r.length,n=12+16*s,a=new Uint8Array(n);let o,l,u,h,d,g;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<s;o++)l=r[o],u=l.duration,h=l.size,d=l.flags,g=l.cts,a.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,g>>>24&255,g>>>16&255,g>>>8&255,g&255],12+16*o);return le.box(le.types.trun,a)}static initSegment(e){le.types||le.init();const t=le.moov(e);return yr(le.FTYP,t)}}le.types=void 0;le.HDLR_TYPES=void 0;le.STTS=void 0;le.STSC=void 0;le.STCO=void 0;le.STSZ=void 0;le.VMHD=void 0;le.SMHD=void 0;le.STSD=void 0;le.FTYP=void 0;le.DINF=void 0;const Im=9e4;function gu(i,e,t=1,r=!1){const s=i*e*t;return r?Math.round(s):s}function k_(i,e,t=1,r=!1){return gu(i,e,1/t,r)}function xn(i,e=!1){return gu(i,1e3,1/Im,e)}function D_(i,e=1){return gu(i,Im,1/e)}const O_=10*1e3,ad=1024,M_=1152,F_=1536;let Ls=null,bl=null;class $a{constructor(e,t,r,s=""){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=r,this.ISGenerated=!1,Ls===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ls=a?parseInt(a[1]):0}if(bl===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);bl=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 r=e.reduce((s,n)=>{const a=n.pts-s;return a<-4294967296?(t=!0,vr(s,n.pts)):a>0?s:n.pts},e[0].pts);return t&&ie.debug("PTS rollover detected"),r}remux(e,t,r,s,n,a,o,l){let u,h,d,g,v,y,b=n,E=n;const A=e.pid>-1,M=t.pid>-1,D=t.samples.length,B=e.samples.length>0,N=o&&D>0||D>1;if((!A||B)&&(!M||N)||this.ISGenerated||o){if(this.ISGenerated){var Z,se,Q,q;const Ee=this.videoTrackConfig;Ee&&(t.width!==Ee.width||t.height!==Ee.height||((Z=t.pixelRatio)==null?void 0:Z[0])!==((se=Ee.pixelRatio)==null?void 0:se[0])||((Q=t.pixelRatio)==null?void 0:Q[1])!==((q=Ee.pixelRatio)==null?void 0:q[1]))&&this.resetInitSegment()}else d=this.generateIS(e,t,n,a);const oe=this.isVideoContiguous;let ge=-1,he;if(N&&(ge=N_(t.samples),!oe&&this.config.forceKeyFrameOnDiscontinuity))if(y=!0,ge>0){ie.warn(`[mp4-remuxer]: Dropped ${ge} out of ${D} video samples due to a missing keyframe`);const Ee=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(ge),t.dropped+=ge,E+=(t.samples[0].pts-Ee)/t.inputTimeScale,he=E}else ge===-1&&(ie.warn(`[mp4-remuxer]: No keyframe found out of ${D} video samples`),y=!1);if(this.ISGenerated){if(B&&N){const Ee=this.getVideoStartPts(t.samples),ue=(vr(e.samples[0].pts,Ee)-Ee)/t.inputTimeScale;b+=Math.max(0,ue),E+=Math.max(0,-ue)}if(B){if(e.samplerate||(ie.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(e,t,n,a)),h=this.remuxAudio(e,b,this.isAudioContiguous,a,M||N||l===Ge.AUDIO?E:void 0),N){const Ee=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(ie.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(e,t,n,a)),u=this.remuxVideo(t,E,oe,Ee)}}else N&&(u=this.remuxVideo(t,E,oe,0));u&&(u.firstKeyFrame=ge,u.independent=ge!==-1,u.firstKeyFramePTS=he)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(v=Pm(r,n,this._initPTS,this._initDTS)),s.samples.length&&(g=km(s,n,this._initPTS))),{audio:h,video:u,initSegment:d,independent:y,text:g,id3:v}}generateIS(e,t,r,s){const n=e.samples,a=t.samples,o=this.typeSupported,l={},u=this._initPTS;let h=!u||s,d="audio/mp4",g,v,y;if(h&&(g=v=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(d="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:d,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):le.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(y=e.inputTimeScale,!u||y!==u.timescale?g=v=n[0].pts-Math.round(y*r):h=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:le.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(y=t.inputTimeScale,!u||y!==u.timescale){const b=this.getVideoStartPts(a),E=Math.round(y*r);v=Math.min(v,vr(a[0].dts,b)-E),g=Math.min(g,b-E)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,h?(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,r,s){const n=e.inputTimeScale,a=e.samples,o=[],l=a.length,u=this._initPTS;let h=this.nextAvcDts,d=8,g=this.videoSampleDuration,v,y,b=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,A=!1;if(!r||h===null){const me=t*n,Se=a[0].pts-vr(a[0].dts,a[0].pts);Ls&&h!==null&&Math.abs(me-Se-h)<15e3?r=!0:h=me-Se}const M=u.baseTime*n/u.timescale;for(let me=0;me<l;me++){const Se=a[me];Se.pts=vr(Se.pts-M,h),Se.dts=vr(Se.dts-M,h),Se.dts<a[me>0?me-1:me].dts&&(A=!0)}A&&a.sort(function(me,Se){const We=me.dts-Se.dts,$e=me.pts-Se.pts;return We||$e}),v=a[0].dts,y=a[a.length-1].dts;const D=y-v,B=D?Math.round(D/(l-1)):g||e.inputTimeScale/30;if(r){const me=v-h,Se=me>B,We=me<-1;if((Se||We)&&(Se?ie.warn(`AVC: ${xn(me,!0)} ms (${me}dts) hole between fragments detected at ${t.toFixed(3)}`):ie.warn(`AVC: ${xn(-me,!0)} ms (${me}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!We||h>=a[0].pts||Ls)){v=h;const $e=a[0].pts-me;if(Se)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: ${xn($e,!0)}/${xn(v,!0)}, delta: ${xn(me,!0)} ms`)}}v=Math.max(0,v);let N=0,J=0,Z=v;for(let me=0;me<l;me++){const Se=a[me],We=Se.units,$e=We.length;let Xe=0;for(let rt=0;rt<$e;rt++)Xe+=We[rt].data.length;J+=Xe,N+=$e,Se.length=Xe,Se.dts<Z?(Se.dts=Z,Z+=B/4|0||1):Z=Se.dts,b=Math.min(Se.pts,b),E=Math.max(Se.pts,E)}y=a[l-1].dts;const se=J+4*N+8;let Q;try{Q=new Uint8Array(se)}catch(me){this.observer.emit(C.ERROR,C.ERROR,{type:Ve.MUX_ERROR,details:ce.REMUX_ALLOC_ERROR,fatal:!1,error:me,bytes:se,reason:`fail allocating video mdat ${se}`});return}const q=new DataView(Q.buffer);q.setUint32(0,se),Q.set(le.types.mdat,4);let oe=!1,ge=Number.POSITIVE_INFINITY,he=Number.POSITIVE_INFINITY,Ee=Number.NEGATIVE_INFINITY,Te=Number.NEGATIVE_INFINITY;for(let me=0;me<l;me++){const Se=a[me],We=Se.units;let $e=0;for(let et=0,ot=We.length;et<ot;et++){const Je=We[et],vt=Je.data,Rt=Je.data.byteLength;q.setUint32(d,Rt),d+=4,Q.set(vt,d),d+=Rt,$e+=4+Rt}let Xe;if(me<l-1)g=a[me+1].dts-Se.dts,Xe=a[me+1].pts-Se.pts;else{const et=this.config,ot=me>0?Se.dts-a[me-1].dts:B;if(Xe=me>0?Se.pts-a[me-1].pts:B,et.stretchShortVideoTrack&&this.nextAudioPts!==null){const Je=Math.floor(et.maxBufferHole*n),vt=(s?b+s*n:this.nextAudioPts)-Se.pts;vt>Je?(g=vt-ot,g<0?g=ot:oe=!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=ot}else g=ot}const rt=Math.round(Se.pts-Se.dts);ge=Math.min(ge,g),Ee=Math.max(Ee,g),he=Math.min(he,Xe),Te=Math.max(Te,Xe),o.push(new od(Se.key,g,$e,rt))}if(o.length){if(Ls){if(Ls<70){const me=o[0].flags;me.dependsOn=2,me.isNonSync=0}}else if(bl&&Te-he<Ee-ge&&B/Ee<.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 Se=0,We=o.length;Se<We;Se++){const $e=me+o[Se].duration,Xe=me+o[Se].cts;if(Se<We-1){const rt=$e+o[Se+1].cts;o[Se].duration=rt-Xe}else o[Se].duration=Se?o[Se-1].duration:B;o[Se].cts=0,me=$e}}}g=oe||!g?B:g,this.nextAvcDts=h=y+g,this.videoSampleDuration=g,this.isVideoContiguous=!0;const Ce={data1:le.moof(e.sequenceNumber++,v,Lt({},e,{samples:o})),data2:Q,startPTS:b/n,endPTS:(E+g)/n,startDTS:v/n,endDTS:h/n,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Ce}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return M_;case"ac3":return F_;default:return ad}}remuxAudio(e,t,r,s,n){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,u=this.getSamplesPerFrame(e),h=u*l,d=this._initPTS,g=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,v=[],y=n!==void 0;let b=e.samples,E=g?0:8,A=this.nextAudioPts||-1;const M=t*a,D=d.baseTime*a/d.timescale;if(this.isAudioContiguous=r=r||b.length&&A>0&&(s&&Math.abs(M-A)<9e3||Math.abs(vr(b[0].pts-D,M)-A)<20*h),b.forEach(function(ue){ue.pts=vr(ue.pts-D,M)}),!r||A<0){if(b=b.filter(ue=>ue.pts>=0),!b.length)return;n===0?A=0:s&&!y?A=Math.max(0,M):A=b[0].pts}if(e.segmentCodec==="aac"){const ue=this.config.maxAudioFramesDrift;for(let pe=0,Ce=A;pe<b.length;pe++){const me=b[pe],Se=me.pts,We=Se-Ce,$e=Math.abs(1e3*We/a);if(We<=-ue*h&&y)pe===0&&(ie.warn(`Audio frame @ ${(Se/a).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*We/a)} ms.`),this.nextAudioPts=A=Ce=Se);else if(We>=ue*h&&$e<O_&&y){let Xe=Math.round(We/h);Ce=Se-Xe*h,Ce<0&&(Xe--,Ce+=h),pe===0&&(this.nextAudioPts=A=Ce),ie.warn(`[mp4-remuxer]: Injecting ${Xe} audio frame @ ${(Ce/a).toFixed(3)}s due to ${Math.round(1e3*We/a)} ms gap.`);for(let rt=0;rt<Xe;rt++){const et=Math.max(Ce,0);let ot=nd.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ot||(ie.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ot=me.unit.subarray()),b.splice(pe,0,{unit:ot,pts:et}),Ce+=h,pe++}}me.pts=Ce,Ce+=h}}let B=null,N=null,J,Z=0,se=b.length;for(;se--;)Z+=b[se].unit.byteLength;for(let ue=0,pe=b.length;ue<pe;ue++){const Ce=b[ue],me=Ce.unit;let Se=Ce.pts;if(N!==null){const $e=v[ue-1];$e.duration=Math.round((Se-N)/l)}else if(r&&e.segmentCodec==="aac"&&(Se=A),B=Se,Z>0){Z+=E;try{J=new Uint8Array(Z)}catch($e){this.observer.emit(C.ERROR,C.ERROR,{type:Ve.MUX_ERROR,details:ce.REMUX_ALLOC_ERROR,fatal:!1,error:$e,bytes:Z,reason:`fail allocating audio mdat ${Z}`});return}g||(new DataView(J.buffer).setUint32(0,Z),J.set(le.types.mdat,4))}else return;J.set(me,E);const We=me.byteLength;E+=We,v.push(new od(!0,u,We,0)),N=Se}const Q=v.length;if(!Q)return;const q=v[v.length-1];this.nextAudioPts=A=N+l*q.duration;const oe=g?new Uint8Array(0):le.moof(e.sequenceNumber++,B/l,Lt({},e,{samples:v}));e.samples=[];const ge=B/a,he=A/a,Te={data1:oe,data2:J,startPTS:ge,endPTS:he,startDTS:ge,endDTS:he,type:"audio",hasAudio:!0,hasVideo:!1,nb:Q};return this.isAudioContiguous=!0,Te}remuxEmptyAudio(e,t,r,s){const n=e.inputTimeScale,a=e.samplerate?e.samplerate:n,o=n/a,l=this.nextAudioPts,u=this._initDTS,h=u.baseTime*9e4/u.timescale,d=(l!==null?l:s.startDTS*n)+h,g=s.endDTS*n+h,v=o*ad,y=Math.ceil((g-d)/v),b=nd.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(ie.warn("[mp4-remuxer]: remux empty Audio"),!b){ie.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const E=[];for(let A=0;A<y;A++){const M=d+A*v;E.push({unit:b,pts:M,dts:M})}return e.samples=E,this.remuxAudio(e,t,r,!1)}}function vr(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 N_(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function Pm(i,e,t,r){const s=i.samples.length;if(!s)return;const n=i.inputTimeScale;for(let o=0;o<s;o++){const l=i.samples[o];l.pts=vr(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=vr(l.dts-r.baseTime*n/r.timescale,e*n)/n}const a=i.samples;return i.samples=[],{samples:a}}function km(i,e,t){const r=i.samples.length;if(!r)return;const s=i.inputTimeScale;for(let a=0;a<r;a++){const o=i.samples[a];o.pts=vr(o.pts-t.baseTime*s/t.timescale,e*s)/s}i.samples.sort((a,o)=>a.pts-o.pts);const n=i.samples;return i.samples=[],{samples:n}}class od{constructor(e,t,r,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=r,this.cts=s,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class B_{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,r,s){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(zw(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const s=this.initData=im(e);s.audio&&(t=ld(s.audio,ht.AUDIO)),s.video&&(r=ld(s.video,ht.VIDEO));const n={};s.audio&&s.video?n.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:s.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:s.video?n.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:ie.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,r,s,n,a){var o,l;let{initPTS:u,lastEndTime:h}=this;const d={audio:void 0,video:void 0,text:s,id3:r,initSegment:void 0};Re(h)||(h=this.lastEndTime=n||0);const g=t.samples;if(!(g!=null&&g.length))return d;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."),d;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1);const b=qw(g,y),E=Ww(y,g),A=E===null?n:E;($_(u,A,n,b)||v.timescale!==u.timescale&&a)&&(v.initPTS=A-n,u&&u.timescale===1&&ie.warn(`Adjusting initPTS by ${v.initPTS-u.baseTime}`),this.initPTS=u={baseTime:v.initPTS,timescale:1});const M=e?A-u.baseTime/u.timescale:h,D=M+b;Xw(y,g,u.baseTime/u.timescale),b>0?this.lastEndTime=D:(ie.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const B=!!y.audio,N=!!y.video;let J="";B&&(J+="audio"),N&&(J+="video");const Z={data1:g,startPTS:M,startDTS:M,endPTS:D,endDTS:D,type:J,hasAudio:B,hasVideo:N,nb:1,dropped:0};return d.audio=Z.type==="audio"?Z:void 0,d.video=Z.type!=="audio"?Z:void 0,d.initSegment=v,d.id3=Pm(r,n,u,u),s.samples.length&&(d.text=km(s,n,u)),d}}function $_(i,e,t,r){if(i===null)return!0;const s=Math.max(r,1),n=e-i.baseTime/i.timescale;return Math.abs(n-t)>s}function ld(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 Ja(t,!1);const r="mp4a.40.5";return ie.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${r}"`),r}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 pi;try{pi=self.performance.now.bind(self.performance)}catch{ie.debug("Unable to use Performance API on this environment"),pi=Bs==null?void 0:Bs.Date.now}const Ua=[{demux:w_,remux:B_},{demux:Oi,remux:$a},{demux:E_,remux:$a},{demux:P_,remux:$a}];Ua.splice(2,0,{demux:A_,remux:$a});class cd{constructor(e,t,r,s,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=r,this.vendor=s,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,r,s){const n=r.transmuxing;n.executeStart=pi();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;s&&(this.currentTransmuxState=s);const{contiguous:u,discontinuity:h,trackSwitch:d,accurateTimeOffset:g,timeOffset:v,initSegmentChange:y}=s||o,{audioCodec:b,videoCodec:E,defaultInitPts:A,duration:M,initSegmentData:D}=l,B=U_(a,t);if(B&&B.method==="AES-128"){const se=this.getDecrypter();if(se.isSync()){let Q=se.softwareDecrypt(a,B.key.buffer,B.iv.buffer);if(r.part>-1&&(Q=se.flush()),!Q)return n.executeEnd=pi(),El(r);a=new Uint8Array(Q)}else return this.decryptionPromise=se.webCryptoDecrypt(a,B.key.buffer,B.iv.buffer).then(Q=>{const q=this.push(Q,null,r);return this.decryptionPromise=null,q}),this.decryptionPromise}const N=this.needsProbing(h,d);if(N){const se=this.configureTransmuxer(a);if(se)return ie.warn(`[transmuxer] ${se.message}`),this.observer.emit(C.ERROR,C.ERROR,{type:Ve.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,fatal:!1,error:se,reason:se.message}),n.executeEnd=pi(),El(r)}(h||d||y||N)&&this.resetInitSegment(D,b,E,M,t),(h||y||N)&&this.resetInitialTimestamp(A),u||this.resetContiguity();const J=this.transmux(a,B,v,g,r),Z=this.currentTransmuxState;return Z.contiguous=!0,Z.discontinuity=!1,Z.trackSwitch=!1,n.executeEnd=pi(),J}flush(e){const t=e.transmuxing;t.executeStart=pi();const{decrypter:r,currentTransmuxState:s,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const a=[],{timeOffset:o}=s;if(r){const d=r.flush();d&&a.push(this.push(d,null,e))}const{demuxer:l,remuxer:u}=this;if(!l||!u)return t.executeEnd=pi(),[El(e)];const h=l.flush(o);return Ga(h)?h.then(d=>(this.flushRemux(a,d,e),a)):(this.flushRemux(a,h,e),a)}flushRemux(e,t,r){const{audioTrack:s,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:u}=this.currentTransmuxState;ie.log(`[transmuxer.ts]: Flushed fragment ${r.sn}${r.part>-1?" p: "+r.part:""} of level ${r.level}`);const h=this.remuxer.remux(s,n,a,o,u,l,!0,this.id);e.push({remuxResult:h,chunkMeta:r}),r.transmuxing.executeEnd=pi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:r}=this;!t||!r||(t.resetTimeStamp(e),r.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,r,s,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,r,s),o.resetInitSegment(e,t,r,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,r,s,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,r,s,n):a=this.transmuxUnencrypted(e,r,s,n),a}transmuxUnencrypted(e,t,r,s){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,r,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,r,s,n){return this.demuxer.demuxSampleAes(e,t,r).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,r,s,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:r,typeSupported:s,vendor:n}=this;let a;for(let g=0,v=Ua.length;g<v;g++){var o;if((o=Ua[g].demux)!=null&&o.probe(e)){a=Ua[g];break}}if(!a)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,u=this.remuxer,h=a.remux,d=a.demux;(!u||!(u instanceof h))&&(this.remuxer=new h(r,t,s,n)),(!l||!(l instanceof d))&&(this.demuxer=new d(r,t,s),this.probe=d.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new uu(this.config)),e}}function U_(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 Ga(i){return"then"in i&&i.then instanceof Function}class G_{constructor(e,t,r,s,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=r,this.duration=s,this.defaultInitPts=n||null}}class V_{constructor(e,t,r,s,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=r,this.trackSwitch=s,this.timeOffset=n,this.initSegmentChange=a}}var Dm={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function s(l,u,h){this.fn=l,this.context=u,this.once=h||!1}function n(l,u,h,d,g){if(typeof h!="function")throw new TypeError("The listener must be a function");var v=new s(h,d||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 r:delete l._events[u]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],h,d;if(this._eventsCount===0)return u;for(d in h=this._events)e.call(h,d)&&u.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},o.prototype.listeners=function(u){var h=t?t+u:u,d=this._events[h];if(!d)return[];if(d.fn)return[d.fn];for(var g=0,v=d.length,y=new Array(v);g<v;g++)y[g]=d[g].fn;return y},o.prototype.listenerCount=function(u){var h=t?t+u:u,d=this._events[h];return d?d.fn?1:d.length:0},o.prototype.emit=function(u,h,d,g,v,y){var b=t?t+u:u;if(!this._events[b])return!1;var E=this._events[b],A=arguments.length,M,D;if(E.fn){switch(E.once&&this.removeListener(u,E.fn,void 0,!0),A){case 1:return E.fn.call(E.context),!0;case 2:return E.fn.call(E.context,h),!0;case 3:return E.fn.call(E.context,h,d),!0;case 4:return E.fn.call(E.context,h,d,g),!0;case 5:return E.fn.call(E.context,h,d,g,v),!0;case 6:return E.fn.call(E.context,h,d,g,v,y),!0}for(D=1,M=new Array(A-1);D<A;D++)M[D-1]=arguments[D];E.fn.apply(E.context,M)}else{var B=E.length,N;for(D=0;D<B;D++)switch(E[D].once&&this.removeListener(u,E[D].fn,void 0,!0),A){case 1:E[D].fn.call(E[D].context);break;case 2:E[D].fn.call(E[D].context,h);break;case 3:E[D].fn.call(E[D].context,h,d);break;case 4:E[D].fn.call(E[D].context,h,d,g);break;default:if(!M)for(N=1,M=new Array(A-1);N<A;N++)M[N-1]=arguments[N];E[D].fn.apply(E[D].context,M)}}return!0},o.prototype.on=function(u,h,d){return n(this,u,h,d,!1)},o.prototype.once=function(u,h,d){return n(this,u,h,d,!0)},o.prototype.removeListener=function(u,h,d,g){var v=t?t+u:u;if(!this._events[v])return this;if(!h)return a(this,v),this;var y=this._events[v];if(y.fn)y.fn===h&&(!g||y.once)&&(!d||y.context===d)&&a(this,v);else{for(var b=0,E=[],A=y.length;b<A;b++)(y[b].fn!==h||g&&!y[b].once||d&&y[b].context!==d)&&E.push(y[b]);E.length?this._events[v]=E.length===1?E[0]:E:a(this,v)}return this},o.prototype.removeAllListeners=function(u){var h;return u?(h=t?t+u:u,this._events[h]&&a(this,h)):(this._events=new r,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})(Dm);var j_=Dm.exports,mu=dw(j_);class Om{constructor(e,t,r,s){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=r,this.onFlush=s;const a=(h,d)=>{d=d||{},d.frag=this.frag,d.id=this.id,h===C.ERROR&&(this.error=d.error),this.hls.trigger(h,d)};this.observer=new mu,this.observer.on(C.FRAG_DECRYPTED,a),this.observer.on(C.ERROR,a);const o=as(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||l_())){try{n.workerPath?(ie.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=u_(n.workerPath)):(ie.log(`injecting Web Worker for "${t}"`),this.workerContext=c_()),this.onwmsg=g=>this.onWorkerMessage(g);const{worker:d}=this.workerContext;d.addEventListener("message",this.onwmsg),d.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:Ve.OTHER_ERROR,details:ce.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:v})},d.postMessage({cmd:"init",typeSupported:l,vendor:u,id:t,config:JSON.stringify(n)})}catch(d){ie.warn(`Error setting up "${t}" Web Worker, fallback to inline`,d),this.resetWorker(),this.error=null,this.transmuxer=new cd(this.observer,l,n,u,t)}return}this.transmuxer=new cd(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,r,s,n,a,o,l,u,h){var d,g;u.transmuxing.start=self.performance.now();const{transmuxer:v}=this,y=a?a.start:n.start,b=n.decryptdata,E=this.frag,A=!(E&&n.cc===E.cc),M=!(E&&u.level===E.level),D=E?u.sn-E.sn:-1,B=this.part?u.part-this.part.index:-1,N=D===0&&u.id>1&&u.id===(E==null?void 0:E.stats.chunkCount),J=!M&&(D===1||D===0&&(B===1||N&&B<=0)),Z=self.performance.now();(M||D||n.stats.parsing.start===0)&&(n.stats.parsing.start=Z),a&&(B||!J)&&(a.stats.parsing.start=Z);const se=!(E&&((d=n.initSegment)==null?void 0:d.url)===((g=E.initSegment)==null?void 0:g.url)),Q=new V_(A,J,l,M,y,se);if(!J||A||se){ie.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${u.sn} p: ${u.part} level: ${u.level} id: ${u.id}
118
+ discontinuity: ${A}
119
+ trackSwitch: ${M}
120
+ contiguous: ${J}
121
+ accurateTimeOffset: ${l}
122
+ timeOffset: ${y}
123
+ initSegmentChange: ${se}`);const q=new G_(r,s,t,o,h);this.configureTransmuxer(q)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:b,chunkMeta:u,state:Q},e instanceof ArrayBuffer?[e]:[]);else if(v){const q=v.push(e,b,u,Q);Ga(q)?(v.async=!0,q.then(oe=>{this.handleTransmuxComplete(oe)}).catch(oe=>{this.transmuxerError(oe,u,"transmuxer-interface push error")})):(v.async=!1,this.handleTransmuxComplete(q))}}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 r=t.flush(e);Ga(r)||t.async?(Ga(r)||(r=Promise.resolve(r)),r.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(r,e)}}transmuxerError(e,t,r){this.hls&&(this.error=e,this.hls.trigger(C.ERROR,{type:Ve.MEDIA_ERROR,details:ce.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:r}))}handleFlushResult(e,t){e.forEach(r=>{this.handleTransmuxComplete(r)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,r=this.hls;switch(t.event){case"init":{var s;const n=(s=this.workerContext)==null?void 0:s.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,r.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 Mm(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!Us(i[t].attrs,e[t].attrs))return!1;return!0}function Us(i,e,t){const r=i["STABLE-RENDITION-ID"];return r&&!t?r===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(s=>i[s]!==e[s])}function gc(i,e){return e.label.toLowerCase()===i.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(i.lang||"").toLowerCase())}const ud=100;class H_ extends hu{constructor(e,t,r){super(e,t,r,"[audio-stream-controller]",Ge.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:r,initPTS:s,timescale:n}){if(r==="main"){const a=t.cc;this.initPTS[t.cc]={baseTime:s,timescale:n},this.log(`InitPTS for cc: ${a} found from main: ${s}`),this.videoTrackCC=a,this.state===de.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=de.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(ud),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=de.IDLE):(this.loadedmetadata=!1,this.state=de.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case de.IDLE:this.doTickIdle();break;case de.WAITING_TRACK:{var e;const{levels:r,trackId:s}=this,n=r==null||(e=r[s])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=de.WAITING_INIT_PTS}break}case de.FRAG_LOADING_WAITING_RETRY:{var t;const r=performance.now(),s=this.retryDate;if(!s||r>=s||(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=de.IDLE}break}case de.WAITING_INIT_PTS:{const r=this.waitingData;if(r){const{frag:s,part:n,cache:a,complete:o}=r;if(this.initPTS[s.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=de.FRAG_LOADING;const l=a.flush(),u={frag:s,part:n,payload:l,networkDetails:null};this._handleFragmentLoadProgress(u),o&&super._handleFragmentLoadComplete(u)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${s.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);dc(u.end,this.config.maxFragLookUpTolerance,s)<0&&(this.log(`Waiting fragment cc (${s.cc}) @ ${s.start} cancelled because another fragment at ${u.end} is needed`),this.clearWaitingFragment())}}else this.state=de.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=de.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:r,trackId:s}=this,n=e.config;if(!r&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[s]))return;const a=t[s],o=a.details;if(!o||o.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(o)){this.state=de.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,ht.AUDIO,Ge.AUDIO));const u=this.getFwdBufferInfo(l,Ge.AUDIO);if(u===null)return;const{bufferedTrack:h,switchingTrack:d}=this;if(!d&&this._streamEnded(u,o)){e.trigger(C.BUFFER_EOS,{type:"audio"}),this.state=de.ENDED;return}const g=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ge.MAIN),v=u.len,y=this.getMaxBufferLength(g==null?void 0:g.len),b=o.fragments,E=b[0].start;let A=this.flushing?this.getLoadPosition():u.end;if(d&&r){const N=this.getLoadPosition();h&&!Us(d.attrs,h.attrs)&&(A=N),o.PTSKnown&&N<E&&(u.end>E||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=E+.05)}if(v>=y&&!d&&A<b[b.length-1].start)return;let M=this.getNextFragment(A,o),D=!1;if(M&&this.isLoopLoading(M,A)&&(D=!!M.gap,M=this.getNextFragmentLoopLoading(M,o,u,Ge.MAIN,y)),!M){this.bufferFlushed=!0;return}const B=g&&M.start>g.end+o.targetduration;if(B||!(g!=null&&g.len)&&u.len){const N=this.getAppendedFrag(M.start,Ge.MAIN);if(N===null||(D||(D=!!N.gap||!!B&&g.len===0),B&&!D||D&&u.nextStart&&u.nextStart<N.end))return}this.loadFragment(M,a,A)}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(r=>new $s(r))}onAudioTrackSwitching(e,t){const r=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),r?this.setInterval(ud):this.resetTransmuxer(),r?(this.switchingTrack=t,this.state=de.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=de.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 r;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:s}=this,{details:n,id:a}=t;if(!s){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=s[a];let l=0;if(n.live||(r=o.details)!=null&&r.live){this.checkLiveUpdate(n);const h=this.mainDetails;if(n.deltaUpdateFailed||!h)return;if(!o.details&&n.hasProgramDateTime&&h.hasProgramDateTime)io(n,h),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===de.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=de.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:r,part:s,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 ${r.sn} of level ${r.level} will not be buffered`);return}const u=l[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const h=u.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(r.start);return}const d=a.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let g=this.transmuxer;g||(g=this.transmuxer=new Om(this.hls,Ge.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const v=this.initPTS[r.cc],y=(t=r.initSegment)==null?void 0:t.data;if(v!==void 0){const E=s?s.index:-1,A=E!==-1,M=new cu(r.level,r.sn,r.stats.chunkCount,n.byteLength,E,A);g.push(n,y,d,"",r,s,h.totalduration,!1,M,v)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:b}=this.waitingData=this.waitingData||{frag:r,part:s,cache:new ym,complete:!1};b.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=de.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 r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:r,part:s}=t;if(r.type!==Ge.AUDIO){if(!this.loadedmetadata&&r.type===Ge.MAIN){const n=this.videoBuffer||this.media;n&&mt.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(r.sn!=="initSegment"){this.fragPrevious=r;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(C.AUDIO_TRACK_SWITCHED,Nt({},n)))}this.fragBufferedComplete(r,s)}onError(e,t){var r;if(t.fatal){this.state=de.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(Ge.AUDIO,t);break;case ce.AUDIO_TRACK_LOAD_ERROR:case ce.AUDIO_TRACK_LOAD_TIMEOUT:case ce.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===de.WAITING_TRACK&&((r=t.context)==null?void 0:r.type)===it.AUDIO_TRACK&&(this.state=de.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===de.ENDED&&(this.state=de.IDLE);const r=this.mediaBuffer||this.media;r&&(this.afterBufferFlushed(r,t,Ge.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const r="audio",{hls:s}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:u,level:h}=o,{details:d}=h,{audio:g,text:v,id3:y,initSegment:b}=n;if(this.fragContextChanged(l)||!d){this.fragmentTracker.removeFragment(l);return}if(this.state=de.PARSING,this.switchingTrack&&g&&this.completeAudioSwitch(this.switchingTrack),b!=null&&b.tracks){const E=l.initSegment||l;this._bufferInitSegment(h,b.tracks,E,a),s.trigger(C.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:r,tracks:b.tracks})}if(g){const{startPTS:E,endPTS:A,startDTS:M,endDTS:D}=g;u&&(u.elementaryStreams[ht.AUDIO]={startPTS:E,endPTS:A,startDTS:M,endDTS:D}),l.setElementaryStreamInfo(ht.AUDIO,E,A,M,D),this.bufferFragmentData(g,l,u,a)}if(y!=null&&(t=y.samples)!=null&&t.length){const E=Lt({id:r,frag:l,details:d},y);s.trigger(C.FRAG_PARSING_METADATA,E)}if(v){const E=Lt({id:r,frag:l,details:d},v);s.trigger(C.FRAG_PARSING_USERDATA,E)}}_bufferInitSegment(e,t,r,s){if(this.state!==de.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:r,part:null,chunkMeta:s,parent:r.type,data:o};this.hls.trigger(C.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,r){const s=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||s===Ft.NOT_LOADED||s===Ft.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=de.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragments[0].start!==t.details.fragments[0].start&&io(t.details,a)}else this.startFragRequested=!0,super.loadFragment(e,t,r)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:r}=this,s=r==null?void 0:r.attrs,n=e.attrs;t&&s&&(s.CHANNELS!==n.CHANNELS||r.name!==e.name||r.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 K_ extends lu{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:r,groupId:s,details:n}=t,a=this.tracksInGroup[r];if(!a||a.groupId!==s){this.warn(`Audio track with id:${r} and group:${s} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${r} "${a.name}" lang:${a.lang} group:${s} loaded [${n.startSN}-${n.endSN}]`),r===this.trackId&&this.playlistLoaded(r,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 r=t.audioGroups||null,s=this.groupIds;let n=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(o=>(s==null?void 0:s.indexOf(o))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(g=>!r||r.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=qr(l,o,As);if(g>-1)n=o[g];else{const v=qr(l,this.tracks);n=this.tracks[v]}}let u=this.findTrackId(n);u===-1&&n&&(u=this.findTrackId(null));const h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${r==null?void 0:r.join(",")}`),this.hls.trigger(C.AUDIO_TRACKS_UPDATED,h);const d=this.trackId;if(u!==-1&&d===-1)this.setAudioTrack(u);else if(o.length&&d===-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:Ve.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 r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const s=this.currentTrack;if(s&&Os(e,s,As))return s;const n=qr(e,this.tracksInGroup,As);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(s){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=KA(e,t.levels,r,a,As);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=qr(e,r);if(a>-1)return r[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 r=this.currentTrack,s=t[e],n=s.details&&!s.details.live;if(e===this.trackId&&s===r&&n||(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(C.AUDIO_TRACK_SWITCHING,Nt({},s)),n))return;const a=this.switchParams(s.url,r==null?void 0:r.details,s.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let r=0;r<t.length;r++){const s=t[r];if(!(this.selectDefaultTrack&&!s.default)&&(!e||Os(e,s,As)))return r}if(e){const{name:r,lang:s,assocLang:n,characteristics:a,audioCodec:o,channels:l}=e;for(let u=0;u<t.length;u++){const h=t[u];if(Os({name:r,lang:s,assocLang:n,characteristics:a,audioCodec:o,channels:l},h,As))return u}for(let u=0;u<t.length;u++){const h=t[u];if(Us(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const h=t[u];if(Us(e.attrs,h.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const r=t.id,s=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 ${r} "${t.name}" lang:${t.lang} group:${s}`),this.clearTimer(),this.hls.trigger(C.AUDIO_TRACK_LOADING,{url:n,id:r,groupId:s,deliveryDirectives:e||null})}}}const hd=500;class z_ extends hu{constructor(e,t,r){super(e,t,r,"[subtitle-stream-controller]",Ge.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=de.IDLE,this.setInterval(hd),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:r,success:s}=t;if(this.fragPrevious=r,this.state=de.IDLE,!s)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=r.start;for(let u=0;u<n.length;u++)if(o>=n[u].start&&o<=n[u].end){a=n[u];break}const l=r.start+r.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null)}onBufferFlushing(e,t){const{startOffset:r,endOffset:s}=t;if(r===0&&s!==Number.POSITIVE_INFINITY){const n=s-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(r,n,Ge.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===Ge.MAIN){var r;(r=this.media)!=null&&r.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const r=t.frag;(r==null?void 0:r.type)===Ge.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==de.STOPPED&&(this.state=de.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Mm(this.levels,t)){this.levels=t.map(r=>new $s(r));return}this.tracksBuffered=[],this.levels=t.map(r=>{const s=new $s(r);return this.tracksBuffered[s.id]=[],s}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ge.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var r;if(this.currentTrackId=t.id,!((r=this.levels)!=null&&r.length)||this.currentTrackId===-1){this.clearInterval();return}const s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(hd)}onSubtitleTrackLoaded(e,t){var r;const{currentTrackId:s,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=n[s];if(o>=n.length||o!==s||!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||(r=l.details)!=null&&r.live){const d=this.mainDetails;if(a.deltaUpdateFailed||!d)return;const g=d.fragments[0];if(!l.details)a.hasProgramDateTime&&d.hasProgramDateTime?(io(a,d),u=a.fragments[0].start):g&&(u=g.start,fc(a,u));else{var h;u=this.alignPlaylists(a,l.details,(h=this.levelLastLoaded)==null?void 0:h.details),u===0&&g&&(u=g.start,fc(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===de.IDLE&&(ro(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:r}=e,s=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&r&&r.byteLength>0&&s!=null&&s.key&&s.iv&&s.method==="AES-128"){const a=performance.now();this.decrypter.decrypt(new Uint8Array(r),s.key.buffer,s.iv.buffer).catch(o=>{throw n.trigger(C.ERROR,{type:Ve.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=de.IDLE})}}doTick(){if(!this.media){this.state=de.IDLE;return}if(this.state===de.IDLE){const{currentTrackId:e,levels:t}=this,r=t==null?void 0:t[e];if(!r||!t.length||!r.details)return;const{config:s}=this,n=this.getLoadPosition(),a=mt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,s.maxBufferHole),{end:o,len:l}=a,u=this.getFwdBufferInfo(this.media,Ge.MAIN),h=r.details,d=this.getMaxBufferLength(u==null?void 0:u.len)+h.levelTargetDuration;if(l>d)return;const g=h.fragments,v=g.length,y=h.edge;let b=null;const E=this.fragPrevious;if(o<y){const A=s.maxFragLookUpTolerance,M=o>y-A?0:A;b=ro(E,g,Math.max(g[0].start,o),M),!b&&E&&E.start<g[0].start&&(b=g[0])}else b=g[v-1];if(!b)return;if(b=this.mapToInitFragWhenRequired(b),b.sn!=="initSegment"){const A=b.sn-h.startSN,M=g[A-1];M&&M.cc===b.cc&&this.fragmentTracker.getState(M)===Ft.NOT_LOADED&&(b=M)}this.fragmentTracker.getState(b)===Ft.NOT_LOADED&&this.loadFragment(b,r,o)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,r){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,r))}get mediaBufferTimeRanges(){return new W_(this.tracksBuffered[this.currentTrackId]||[])}}class W_{constructor(e){this.buffered=void 0;const t=(r,s,n)=>{if(s=s>>>0,s>n-1)throw new DOMException(`Failed to execute '${r}' on 'TimeRanges': The index provided (${s}) is greater than the maximum bound (${n})`);return e[s][r]};this.buffered={get length(){return e.length},end(r){return t("end",r,e.length)},start(r){return t("start",r,e.length)}}}}class q_ extends lu{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 r=Fa(this.media.textTracks);for(let n=0;n<r.length;n++)if(r[n].mode==="hidden")t=r[n];else if(r[n].mode==="showing"){t=r[n];break}const s=this.findTrackForTextTrack(t);this.subtitleTrack!==s&&this.setSubtitleTrack(s)},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),Fa(this.media.textTracks).forEach(t=>{ks(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:r,groupId:s,details:n}=t,a=this.tracksInGroup[r];if(!a||a.groupId!==s){this.warn(`Subtitle track with id:${r} and group:${s} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${r} "${a.name}" lang:${a.lang} group:${s} loaded [${n.startSN}-${n.endSN}]`),r===this.trackId&&this.playlistLoaded(r,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 r=t.subtitleGroups||null,s=this.groupIds;let n=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(a=>(s==null?void 0:s.indexOf(a))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!r||r.indexOf(h.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(h=>h.default)&&(this.selectDefaultTrack=!1),a.forEach((h,d)=>{h.id=d});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const h=qr(o,a);if(h>-1)n=a[h];else{const d=qr(o,this.tracks);n=this.tracks[d]}}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 "${r==null?void 0:r.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,r=this.selectDefaultTrack;for(let s=0;s<t.length;s++){const n=t[s];if(!(r&&!n.default||!r&&!e)&&(!e||Os(n,e)))return s}if(e){for(let s=0;s<t.length;s++){const n=t[s];if(Us(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(let s=0;s<t.length;s++){const n=t[s];if(Us(e.attrs,n.attrs,["LANGUAGE"]))return s}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let r=0;r<t.length;r++){const s=t[r];if(gc(s,e))return r}}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 r=this.currentTrack;if(r&&Os(e,r))return r;const s=qr(e,this.tracksInGroup);if(s>-1){const n=this.tracksInGroup[s];return this.setSubtitleTrack(s),n}else{if(r)return null;{const n=qr(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const r=t.id,s=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 ${r}`),this.hls.trigger(C.SUBTITLE_TRACK_LOADING,{url:n,id:r,groupId:s,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Fa(e.textTracks),r=this.currentTrack;let s;if(r&&(s=t.filter(n=>gc(r,n))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==s&&(n.mode="disabled")}),s){const n=this.subtitleDisplay?"showing":"hidden";s.mode!==n&&(s.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!Re(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s){this.hls.trigger(C.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!s.details&&!s.details.live;if(e===this.trackId&&s===r&&n)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:a,groupId:o="",name:l,type:u,url:h}=s;this.hls.trigger(C.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:u,url:h});const d=this.switchParams(s.url,r==null?void 0:r.details,s.details);this.loadPlaylist(d)}}class Y_{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,r){const s=this.queues[t];s.push(e),s.length===1&&!r&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const r=new Promise(n=>{t=n}),s={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(s,e),r}executeNext(e){const t=this.queues[e];if(t.length){const r=t[0];try{r.execute()}catch(s){ie.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${s}`),r.onError(s);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 fd=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class X_{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=r=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=r=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:r,mediaSource:s}=this;this.log("Media source opened"),r&&(r.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(C.MEDIA_ATTACHED,{media:r,mediaSource:s})),s&&s.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:r,_objectUrl:s}=this;r!==s&&ie.error(`Media element src was set while attaching MediaSource (${s} > ${r})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=aA(as(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 Y_(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 r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const r=this.media=t.media,s=as(this.appendSource);if(r&&s){var n;const a=this.mediaSource=new s;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{r.removeAttribute("src");const l=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||l&&a instanceof l,dd(r),Q_(r,o),r.load()}catch{r.src=o}else r.src=o;r.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:r}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(s){this.warn(`onMediaDetaching: ${s.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),r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(e.removeAttribute("src"),this.appendSource&&dd(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 r;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(s){this.warn(`onBufferReset ${e}`,s)}}onBufferCodecs(e,t){const r=this.getSourceBufferTypes().length,s=Object.keys(t);if(s.forEach(a=>{if(r){const l=this.tracks[a];if(l&&typeof l.buffer.changeType=="function"){var o;const{id:u,codec:h,levelCodec:d,container:g,metadata:v}=t[a],y=Of(l.codec,l.levelCodec),b=y==null?void 0:y.replace(fd,"$1");let E=Of(h,d);const A=(o=E)==null?void 0:o.replace(fd,"$1");if(E&&b!==A){a.slice(0,5)==="audio"&&(E=Ja(E,this.appendSource));const M=`${g};codecs=${E}`;this.appendChangeType(a,M),this.log(`switching codec ${y} to ${E}`),this.tracks[a]={buffer:l.buffer,codec:h,container:g,levelCodec:d,metadata:v,id:u}}}}else this.pendingTracks[a]=t[a]}),r)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${s.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:r}=this,s={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),r.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};r.append(s,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:r,operationQueue:s,tracks:n}=this,{data:a,type:o,frag:l,part:u,chunkMeta:h}=t,d=h.buffering[o],g=self.performance.now();d.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 b=n.audio;let E=!1;o==="audio"&&(b==null?void 0:b.container)==="audio/mpeg"&&(E=!this.lastMpegAudioChunk||h.id===1||this.lastMpegAudioChunk.sn!==h.sn,this.lastMpegAudioChunk=h);const A=l.start,M={execute:()=>{if(d.executeStart=self.performance.now(),E){const D=this.sourceBuffer[o];if(D){const B=A-D.timestampOffset;Math.abs(B)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${A} (delta: ${B}) sn: ${l.sn})`),D.timestampOffset=A)}}this.appendExecutor(a,o)},onStart:()=>{},onComplete:()=>{const D=self.performance.now();d.executeEnd=d.end=D,v.first===0&&(v.first=D),y&&y.first===0&&(y.first=D);const{sourceBuffer:B}=this,N={};for(const J in B)N[J]=mt.getBuffered(B[J]);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:h,parent:l.type,timeRanges:N})},onError:D=>{const B={type:Ve.MEDIA_ERROR,parent:l.type,details:ce.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:l,part:u,chunkMeta:h,error:D,err:D,fatal:!1};if(D.code===DOMException.QUOTA_EXCEEDED_ERR)B.details=ce.BUFFER_FULL_ERROR;else{const N=++this.appendErrors[o];B.details=ce.BUFFER_APPEND_ERROR,this.warn(`Failed ${N}/${r.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),N>=r.config.appendErrorMaxRetry&&(B.fatal=!0)}r.trigger(C.ERROR,B)}};s.append(M,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:r}=this,s=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?r.append(s(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{r.append(s(n),n)})}onFragParsed(e,t){const{frag:r,part:s}=t,n=[],a=s?s.elementaryStreams:r.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();r.stats.buffering.end=l,s&&(s.stats.buffering.end=l);const u=s?s.stats:r.stats;this.hls.trigger(C.FRAG_BUFFERED,{frag:r,part:s,stats:u,id:r.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${r.type} level: ${r.level} sn: ${r.sn}`),this.blockBuffers(o,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((s,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`))),s&&!!(!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:s}=this;if(!s||s.readyState!=="open"){s&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${s.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),s.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:r}=this;if(!r||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,a=r.currentTime,o=t.levelTargetDuration,l=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(Re(l)&&l>0){const u=Math.max(l,o),h=Math.floor(a/o)*o-u;this.flushBackBuffer(a,o,h)}if(Re(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const u=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),h=Math.max(u,o),d=Math.floor(a/o)*o+h;this.flushFrontBuffer(a,o,d)}}flushBackBuffer(e,t,r){const{details:s,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(o=>{const l=n[o];if(l){const u=mt.getBuffered(l);if(u.length>0&&r>u.start(0)){if(this.hls.trigger(C.BACK_BUFFER_REACHED,{bufferEnd:r}),s!=null&&s.live)this.hls.trigger(C.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});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:r,type:o})}}})}flushFrontBuffer(e,t,r){const{sourceBuffer:s}=this;this.getSourceBufferTypes().forEach(a=>{const o=s[a];if(o){const l=mt.getBuffered(o),u=l.length;if(u<2)return;const h=l.start(u-1),d=l.end(u-1);if(r>h||e>=h&&e<=d)return;if(o.ended&&e-d<2*t){this.log(`Cannot flush ${a} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(C.BUFFER_FLUSHING,{startOffset:h,endOffset:1/0,type:a})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:r,mediaSource:s}=this,n=e.fragments[0].start+e.totalduration,a=r.duration,o=Re(s.duration)?s.duration:0;e.live&&t.config.liveDurationInfinity?(s.duration=1/0,this.updateSeekableRange(e)):(n>o&&n>a||!Re(a))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),s.duration=n)}updateSeekableRange(e){const t=this.mediaSource,r=e.fragments;if(r.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,r[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:r}=this,s=Object.keys(r).length;if(s&&(!e||s===2||"audiovideo"in r)){this.createSourceBuffers(r),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:Ve.MEDIA_ERROR,details:ce.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:r}=this;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(const n in e)if(!t[n]){var s;const a=e[n];if(!a)throw Error(`source buffer exists for track ${n}, however track does not`);let o=((s=a.levelCodec)==null?void 0:s.indexOf(","))===-1?a.levelCodec:a.codec;o&&n.slice(0,5)==="audio"&&(o=Ja(o,this.appendSource));const l=`${a.container};codecs=${o}`;this.log(`creating sourceBuffer(${l})`);try{const u=t[n]=r.addSourceBuffer(l),h=n;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(h,"bufferedchange",(d,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:Ve.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:r}=this;r.current(e).onComplete(),r.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var r;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(r=this.mediaSource)==null?void 0:r.readyState}`);this.error(`${s}`,t),this.hls.trigger(C.ERROR,{type:Ve.MEDIA_ERROR,details:ce.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(s)}removeExecutor(e,t,r){const{media:s,mediaSource:n,operationQueue:a,sourceBuffer:o}=this,l=o[e];if(!s||!n||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),a.shiftAndExecuteNext(e);return}const u=Re(s.duration)?s.duration:1/0,h=Re(n.duration)?n.duration:1/0,d=Math.max(0,t),g=Math.min(r,u,h);g>d&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${d},${g}] from the ${e} SourceBuffer`),l.remove(d,g)):a.shiftAndExecuteNext(e)}appendExecutor(e,t){const r=this.sourceBuffer[t];if(!r){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}r.ended=!1,r.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:r}=this,s=t.map(n=>r.appendBlocker(n));Promise.all(s).then(()=>{e(),t.forEach(n=>{const a=this.sourceBuffer[n];a!=null&&a.updating||r.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,r){const s=this.sourceBuffer[e];if(!s)return;const n=r.bind(this,e);this.listeners[e].push({event:t,listener:n}),s.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(r=>{t.removeEventListener(r.event,r.listener)})}}function dd(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function Q_(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}const pd={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},Fm=function(e){let t=e;return pd.hasOwnProperty(e)&&(t=pd[e]),String.fromCharCode(t)},Ir=15,hi=100,J_={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Z_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},eC={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},tC={25:2,26:4,29:6,30:8,31:10,27:13,28:15},rC=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class iC{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const r=typeof t=="function"?t():t;ie.log(`${this.time} [${e}] ${r}`)}}}const Xi=function(e){const t=[];for(let r=0;r<e.length;r++)t.push(e[r].toString(16));return t};class Nm{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let r=0;r<t.length;r++){const s=t[r];e.hasOwnProperty(s)&&(this[s]=e[s])}}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 sC{constructor(){this.uchar=" ",this.penState=new Nm}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 nC{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Nm,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<hi;t++)this.chars.push(new sC);this.logger=e}equals(e){for(let t=0;t<hi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<hi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<hi;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>hi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=hi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let r=this.pos+1;r<t+1;r++)this.chars[r].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=Fm(e);if(this.pos>=hi){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<hi;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let r=0;r<hi;r++){const s=this.chars[r].uchar;s!==" "&&(t=!1),e.push(s)}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=Ir-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Ir;t++)this.rows.push(new nC(e));this.logger=e}reset(){for(let e=0;e<Ir;e++)this.rows[e].clear();this.currRow=Ir-1}equals(e){let t=!0;for(let r=0;r<Ir;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}copy(e){for(let t=0;t<Ir;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Ir;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<Ir;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 r=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);r.setCursor(e.indent),e.color=r.chars[a].penState.foreground}const s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(s)}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 r="",s=-1;for(let n=0;n<Ir;n++){const a=this.rows[n].getTextString();a&&(s=n+1,e?t.push("Row "+s+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?r="["+t.join(" | ")+"]":r=t.join(`
124
+ `)),r}getTextAndFormat(){return this.rows}}class gd{constructor(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Tl(r),this.nonDisplayedMemory=new Tl(r),this.lastOutputScreen=new Tl(r),this.currRollUpRow=this.displayedMemory.rows[Ir-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Ir-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 r=0;r<e.length;r++)this.writeScreen.insertChar(e[r]);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 r=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[r]}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 md{constructor(e,t,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=yd(),this.logger=void 0;const s=this.logger=new iC;this.channels=[null,new gd(e,t,s),new gd(e+1,r,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let r,s,n,a=!1;this.logger.time=e;for(let o=0;o<t.length;o+=2)if(s=t[o]&127,n=t[o+1]&127,!(s===0&&n===0)){if(this.logger.log(3,"["+Xi([t[o],t[o+1]])+"] -> ("+Xi([s,n])+")"),r=this.parseCmd(s,n),r||(r=this.parseMidrow(s,n)),r||(r=this.parsePAC(s,n)),r||(r=this.parseBackgroundAttributes(s,n)),!r&&(a=this.parseChars(s,n),a)){const l=this.currentChannel;l&&l>0?this.channels[l].insertChars(a):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!a&&this.logger.log(2,"Couldn't parse cleaned data "+Xi([s,n])+" orig: "+Xi([t[o],t[o+1]]))}}parseCmd(e,t){const{cmdHistory:r}=this,s=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(s||n))return!1;if(vd(e,t,r))return Rs(null,null,r),this.logger.log(3,"Repeated command ("+Xi([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),Rs(e,t,r),this.currentChannel=a,!0}parseMidrow(e,t){let r=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?r=1:r=2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[r];return s?(s.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Xi([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let r;const s=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(vd(e,t,s))return Rs(null,null,s),!0;const o=e<=23?1:2;t>=64&&t<=95?r=o===1?J_[e]:eC[e]:r=o===1?Z_[e]:tC[e];const l=this.channels[o];return l?(l.setPAC(this.interpretPAC(r,t)),Rs(e,t,s),this.currentChannel=o,!0):!1}interpretPAC(e,t){let r;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?r=t-96:r=t-64,s.underline=(r&1)===1,r<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(s.italics=!0,s.color="white"):s.indent=Math.floor((r-16)/2)*4,s}parseChars(e,t){let r,s=null,n=null;if(e>=25?(r=2,n=e-8):(r=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 '"+Fm(a)+"' in channel "+r),s=[a]}else e>=32&&e<=127&&(s=t===0?[e]:[e,t]);if(s){const a=Xi(s);this.logger.log(3,"Char codes = "+a.join(",")),Rs(e,t,this.cmdHistory)}return s}parseBackgroundAttributes(e,t){const r=(e===16||e===24)&&t>=32&&t<=47,s=(e===23||e===31)&&t>=45&&t<=47;if(!(r||s))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=rC[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),Rs(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=yd()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const r=this.channels[t];r&&r.cueSplitAtTime(e)}}}function Rs(i,e,t){t.a=i,t.b=e}function vd(i,e,t){return t.a===i&&t.b===e}function yd(){return{a:null,b:null}}class La{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,r){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var vu=function(){if(Bs!=null&&Bs.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 r(o){return t(i,o)}function s(o){return t(e,o)}function n(o,...l){let u=1;for(;u<arguments.length;u++){const h=arguments[u];for(const d in h)o[d]=h[d]}return o}function a(o,l,u){const h=this,d={enumerable:!0};h.hasBeenReset=!1;let g="",v=!1,y=o,b=l,E=u,A=null,M="",D=!0,B="auto",N="start",J=50,Z="middle",se=50,Q="middle";Object.defineProperty(h,"id",n({},d,{get:function(){return g},set:function(q){g=""+q}})),Object.defineProperty(h,"pauseOnExit",n({},d,{get:function(){return v},set:function(q){v=!!q}})),Object.defineProperty(h,"startTime",n({},d,{get:function(){return y},set:function(q){if(typeof q!="number")throw new TypeError("Start time must be set to a number.");y=q,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",n({},d,{get:function(){return b},set:function(q){if(typeof q!="number")throw new TypeError("End time must be set to a number.");b=q,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",n({},d,{get:function(){return E},set:function(q){E=""+q,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",n({},d,{get:function(){return A},set:function(q){A=q,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",n({},d,{get:function(){return M},set:function(q){const oe=r(q);if(oe===!1)throw new SyntaxError("An invalid or illegal string was specified.");M=oe,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",n({},d,{get:function(){return D},set:function(q){D=!!q,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",n({},d,{get:function(){return B},set:function(q){if(typeof q!="number"&&q!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");B=q,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",n({},d,{get:function(){return N},set:function(q){const oe=s(q);if(!oe)throw new SyntaxError("An invalid or illegal string was specified.");N=oe,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",n({},d,{get:function(){return J},set:function(q){if(q<0||q>100)throw new Error("Position must be between 0 and 100.");J=q,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",n({},d,{get:function(){return Z},set:function(q){const oe=s(q);if(!oe)throw new SyntaxError("An invalid or illegal string was specified.");Z=oe,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",n({},d,{get:function(){return se},set:function(q){if(q<0||q>100)throw new Error("Size must be between 0 and 100.");se=q,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",n({},d,{get:function(){return Q},set:function(q){const oe=s(q);if(!oe)throw new SyntaxError("An invalid or illegal string was specified.");Q=oe,this.hasBeenReset=!0}})),h.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class aC{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Bm(i){function e(r,s,n,a){return(r|0)*3600+(s|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 oC{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,r){for(let s=0;s<r.length;++s)if(t===r[s]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const r=parseFloat(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1}}function $m(i,e,t,r){const s=r?i.split(r):[i];for(const n in s){if(typeof s[n]!="string")continue;const a=s[n].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const mc=new vu(0,0,""),Ra=mc.align==="middle"?"middle":"center";function lC(i,e,t){const r=i;function s(){const o=Bm(i);if(o===null)throw new Error("Malformed timestamp: "+r);return i=i.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){const u=new oC;$m(o,function(g,v){let y;switch(g){case"region":for(let b=t.length-1;b>=0;b--)if(t[b].id===v){u.set(g,t[b].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",Ra,"end"]);break;case"position":y=v.split(","),u.percent(g,y[0]),y.length===2&&u.alt("positionAlign",y[1],["start",Ra,"end","line-left","line-right","auto"]);break;case"size":u.percent(g,v);break;case"align":u.alt(g,v,["start",Ra,"end","left","right"]);break}},/:/,/\s/),l.region=u.get("region",null),l.vertical=u.get("vertical","");let h=u.get("line","auto");h==="auto"&&mc.line===-1&&(h=-1),l.line=h,l.lineAlign=u.get("lineAlign","start"),l.snapToLines=u.get("snapToLines",!0),l.size=u.get("size",100),l.align=u.get("align",Ra);let d=u.get("position","auto");d==="auto"&&mc.position===50&&(d=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=d}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=s(),a(),i.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);i=i.slice(3),a(),e.endTime=s(),a(),n(i,e)}function Um(i){return i.replace(/<br(?: \/)?>/gi,`
125
+ `)}class cC{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new aC,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 r(){let n=t.buffer,a=0;for(n=Um(n);a<n.length&&n[a]!=="\r"&&n[a]!==`
126
+ `;)++a;const o=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===`
127
+ `&&++a,t.buffer=n.slice(a),o}function s(n){$m(n,function(a,o){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=r();const o=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:n=r(),t.state){case"HEADER":/:/.test(n)?s(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new vu(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{lC(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=n.indexOf("-->")!==-1;if(!n||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
128
+ `),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
129
+
130
+ `,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const uC=/\r\n|\n\r|\n|\r/g,wl=function(e,t,r=0){return e.slice(r,r+t.length)===t},hC=function(e){let t=parseInt(e.slice(-3));const r=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!Re(t)||!Re(r)||!Re(s)||!Re(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*r,t+=60*1e3*s,t+=60*60*1e3*n,t},Al=function(e){let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return(t>>>0).toString()};function yu(i,e,t){return Al(i.toString())+Al(e.toString())+Al(t)}const fC=function(e,t,r){let s=e[t],n=e[s.prevCC];if(!n||!n.new&&s.new){e.ccOffset=e.presentationOffset=s.start,s.new=!1;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=s.start-n.start,s.new=!1,s=n,n=e[s.prevCC]}e.presentationOffset=r};function dC(i,e,t,r,s,n,a){const o=new cC,l=Qr(new Uint8Array(i)).trim().replace(uC,`
131
+ `).split(`
132
+ `),u=[],h=e?D_(e.baseTime,e.timescale):0;let d="00:00.000",g=0,v=0,y,b=!0;o.oncue=function(E){const A=t[r];let M=t.ccOffset;const D=(g-h)/9e4;if(A!=null&&A.new&&(v!==void 0?M=t.ccOffset=A.start:fC(t,r,D)),D){if(!e){y=new Error("Missing initPTS for VTT MPEGTS");return}M=D-t.presentationOffset}const B=E.endTime-E.startTime,N=vr((E.startTime+M-v)*9e4,s*9e4)/9e4;E.startTime=Math.max(N,0),E.endTime=Math.max(N+B,0);const J=E.text.trim();E.text=decodeURIComponent(encodeURIComponent(J)),E.id||(E.id=yu(E.startTime,E.endTime,J)),E.endTime>0&&u.push(E)},o.onparsingerror=function(E){y=E},o.onflush=function(){if(y){a(y);return}n(u)},l.forEach(E=>{if(b)if(wl(E,"X-TIMESTAMP-MAP=")){b=!1,E.slice(16).split(",").forEach(A=>{wl(A,"LOCAL:")?d=A.slice(6):wl(A,"MPEGTS:")&&(g=parseInt(A.slice(7)))});try{v=hC(d)/1e3}catch(A){y=A}return}else E===""&&(b=!1);o.parse(E+`
133
+ `)}),o.flush()}const _l="stpp.ttml.im1t",Gm=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Vm=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,pC={left:"start",center:"center",right:"end",start:"start",end:"end"};function Sd(i,e,t,r){const s=Qe(new Uint8Array(i),["mdat"]);if(s.length===0){r(new Error("Could not parse IMSC1 mdat"));return}const n=s.map(o=>Qr(o)),a=k_(e.baseTime,1,e.timescale);try{n.forEach(o=>t(gC(o,a)))}catch(o){r(o)}}function gC(i,e){const s=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((d,g)=>(d[g]=s.getAttribute(`ttp:${g}`)||n[g],d),{}),o=s.getAttribute("xml:space")!=="preserve",l=xd(Cl(s,"styling","style")),u=xd(Cl(s,"layout","region")),h=Cl(s,"body","[begin]");return[].map.call(h,d=>{const g=jm(d,o);if(!g||!d.hasAttribute("begin"))return null;const v=Rl(d.getAttribute("begin"),a),y=Rl(d.getAttribute("dur"),a);let b=Rl(d.getAttribute("end"),a);if(v===null)throw bd(d);if(b===null){if(y===null)throw bd(d);b=v+y}const E=new vu(v-e,b-e,g);E.id=yu(E.startTime,E.endTime,E.text);const A=u[d.getAttribute("region")],M=l[d.getAttribute("style")],D=mC(A,M,l),{textAlign:B}=D;if(B){const N=pC[B];N&&(E.lineAlign=N),E.align=B}return Lt(E,D),E}).filter(d=>d!==null)}function Cl(i,e,t){const r=i.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(t)):[]}function xd(i){return i.reduce((e,t)=>{const r=t.getAttribute("xml:id");return r&&(e[r]=t),e},{})}function jm(i,e){return[].slice.call(i.childNodes).reduce((t,r,s)=>{var n;return r.nodeName==="br"&&s?t+`
134
+ `:(n=r.childNodes)!=null&&n.length?jm(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}function mC(i,e,t){const r="http://www.w3.org/ns/ttml#styling";let s=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=i!=null&&i.hasAttribute("style")?i.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(s=t[a]),n.reduce((o,l)=>{const u=Ll(e,r,l)||Ll(i,r,l)||Ll(s,r,l);return u&&(o[l]=u),o},{})}function Ll(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function bd(i){return new Error(`Could not parse ttml timestamp ${i}`)}function Rl(i,e){if(!i)return null;let t=Bm(i);return t===null&&(Gm.test(i)?t=vC(i,e):Vm.test(i)&&(t=yC(i,e))),t}function vC(i,e){const t=Gm.exec(i),r=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+r/e.frameRate}function yC(i,e){const t=Vm.exec(i),r=Number(t[1]);switch(t[2]){case"h":return r*3600;case"m":return r*60;case"ms":return r*1e3;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}class SC{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=Td(),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 La(this,"textTrack1"),t=new La(this,"textTrack2"),r=new La(this,"textTrack3"),s=new La(this,"textTrack4");this.cea608Parser1=new md(1,e,t),this.cea608Parser2=new md(3,r,s)}}addCues(e,t,r,s,n){let a=!1;for(let o=n.length;o--;){const l=n[o],u=xC(l[0],l[1],t,r);if(u>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],r),a=!0,u/(r-t)>.5))return}if(a||n.push([t,r]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,r,s)}else{const o=this.Cues.newCue(null,t,r,s);this.hls.trigger(C.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:r,initPTS:s,timescale:n}){const{unparsedVttFrags:a}=this;r==="main"&&(this.initPTS[t.cc]={baseTime:s,timescale:n}),a.length&&(this.unparsedVttFrags=[],a.forEach(o=>{this.onFragLoaded(C.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:r}=this;if(r)for(let s=0;s<r.textTracks.length;s++){const n=r.textTracks[s];if(Ed(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:r,media:s}=this,{label:n,languageCode:a}=t[e],o=this.getExistingTrack(n,a);if(o)r[e]=o,ks(r[e]),cm(r[e],s);else{const l=this.createTextTrack("captions",n,a);l&&(l[e]=!0,r[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const r=t.label,s={_id:e,label:r,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(C.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,t,r){const s=this.media;if(s)return s.addTextTrack(e,t,r)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{ks(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Td(),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 r=0;r<t.length;r++)ks(t[r])}onSubtitleTracksUpdated(e,t){const r=t.subtitleTracks||[],s=r.some(n=>n.textCodec===_l);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(Mm(this.tracks,r)){this.tracks=r;return}if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){const a=this.media,o=a?Fa(a.textTracks):null;if(this.tracks.forEach((l,u)=>{let h;if(o){let d=null;for(let g=0;g<o.length;g++)if(o[g]&&Ed(o[g],l)){d=o[g],o[g]=null;break}d&&(h=d)}if(h)ks(h);else{const d=Hm(l);h=this.createTextTrack(d,l.name,l.lang),h&&(h.mode="disabled")}h&&this.textTracks.push(h)}),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(r=>{const s=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(!s)return;const n=`textTrack${s[1]}`,a=this.captionsProperties[n];a&&(a.label=r.name,r.lang&&(a.languageCode=r.lang),a.media=r)})}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:r,cea608Parser2:s,lastCc:n,lastSn:a,lastPartIndex:o}=this;if(!(!this.enabled||!r||!s)&&t.frag.type===Ge.MAIN){var l,u;const{cc:h,sn:d}=t.frag,g=(l=t==null||(u=t.part)==null?void 0:u.index)!=null?l:-1;d===a+1||d===a&&g===o+1||h===n||(r.reset(),s.reset()),this.lastCc=h,this.lastSn=d,this.lastPartIndex=g}}onFragLoaded(e,t){const{frag:r,payload:s}=t;if(r.type===Ge.SUBTITLE)if(s.byteLength){const n=r.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[r.level],l=this.vttCCs;l[r.cc]||(l[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),o&&o.textCodec===_l?this._parseIMSC1(r,s):this._parseVTTs(t)}}else this.hls.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const r=this.hls;Sd(t,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),r.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{ie.log(`Failed to parse IMSC1: ${s}`),r.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var t;const{frag:r,payload:s}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[r.cc]&&o===-1){a.push(e);return}const l=this.hls,u=(t=r.initSegment)!=null&&t.data?yr(r.initSegment.data,new Uint8Array(s)):s;dC(u,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,h=>{this._appendCues(h,r.level),l.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},h=>{const d=h.message==="Missing initPTS for VTT MPEGTS";d?a.push(e):this._fallbackToIMSC1(r,s),ie.log(`Failed to parse VTT cue: ${h}`),!(d&&o>r.cc)&&l.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:h})})}_fallbackToIMSC1(e,t){const r=this.tracks[e.level];r.textCodec||Sd(t,this.initPTS[e.cc],()=>{r.textCodec=_l,this._parseIMSC1(e,t)},()=>{r.textCodec="wvtt"})}_appendCues(e,t){const r=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[t];if(!s||s.mode==="disabled")return;e.forEach(n=>um(s,n))}else{const s=this.tracks[t];if(!s)return;const n=s.default?"default":"subtitles"+t;r.trigger(C.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:r}=t;r.type===Ge.SUBTITLE&&this.onFragLoaded(C.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:r,cea608Parser2:s}=this;if(!this.enabled||!r||!s)return;const{frag:n,samples:a}=t;if(!(n.type===Ge.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);r.addData(a[o].pts,u[0]),s.addData(a[o].pts,u[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:r,endOffsetSubtitles:s,type:n}){const{media:a}=this;if(!(!a||a.currentTime<r)){if(!n||n==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(l=>cc(o[l],t,r))}if(this.config.renderTextTracksNatively&&t===0&&s!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>cc(o[l],t,s))}}}extractCea608Data(e){const t=[[],[]],r=e[0]&31;let s=2;for(let n=0;n<r;n++){const a=e[s++],o=127&e[s++],l=127&e[s++];if(o===0&&l===0)continue;if((4&a)!==0){const h=3&a;(h===0||h===1)&&(t[h].push(o),t[h].push(l))}}return t}}function Hm(i){return i.characteristics&&/transcribes-spoken-dialog/gi.test(i.characteristics)&&/describes-music-and-sound/gi.test(i.characteristics)?"captions":"subtitles"}function Ed(i,e){return!!i&&i.kind===Hm(e)&&gc(e,i)}function xC(i,e,t,r){return Math.min(e,r)-Math.max(i,t)}function Td(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Su{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 r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Re(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,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&ie.log(`Setting autoLevelCapping to ${r}: ${e[r].height}p@${e[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=r,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const r=t.filter((s,n)=>this.isLevelAllowed(s)&&n<=e);return this.clientRect=null,Su.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,!t.width&&!t.height&&(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(r=>e.bitrate===r.bitrate&&e.width===r.width&&e.height===r.height)}static getMaxLevelByMediaSize(e,t,r){if(!(e!=null&&e.length))return-1;const s=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let n=e.length-1;const a=Math.max(t,r);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&s(l,e[o+1])){n=o;break}}return n}}class bC{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 r=this.hls.config;if(r.capLevelOnFPSDrop){const s=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,r){const s=performance.now();if(t){if(this.lastTime){const n=s-this.lastTime,a=r-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,u=this.hls;if(u.trigger(C.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:r}),l>0&&a>u.config.fpsDroppedMonitoringThreshold*o){let h=u.currentLevel;ie.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=h)&&(h=h-1,u.trigger(C.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const Ia="[eme]";class Ms{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=Ms.CDMCleanupPromise?[Ms.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=ie.debug.bind(ie,Ia),this.log=ie.log.bind(ie,Ia),this.warn=ie.warn.bind(ie,Ia),this.error=ie.error.bind(ie,Ia),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:r}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===yt.WIDEVINE&&r)return r;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,r=t[e];if(r)return r.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,r=(a,o,l)=>!!a&&l.indexOf(a)===o,s=t.map(a=>a.audioCodec).filter(r),n=t.map(a=>a.videoCodec).filter(r);return s.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const l=u=>{const h=u.shift();this.getMediaKeysPromise(h,s,n).then(d=>a({keySystem:h,mediaKeys:d})).catch(d=>{u.length?l(u):d instanceof mr?o(d):o(new mr({type:Ve.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:r}=this.config;if(typeof r!="function"){let s=`Configured requestMediaKeySystemAccess is not a function ${r}`;return Xg===null&&self.location.protocol==="http:"&&(s=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(s))}return r(e,t)}getMediaKeysPromise(e,t,r){const s=kw(e,t,r,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(s)}`),a=this.requestMediaKeySystemAccess(e,s);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(h=>(this.log(`Media-keys created for "${e}"`),u.then(d=>d?this.setMediaKeysServerCertificate(h,e,d):h))),o.mediaKeys.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),o.mediaKeys})}return a.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:r}){this.log(`Creating key-system session "${t}" keyId: ${Ur.hexDump(e.keyId||[])}`);const s=r.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:r,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const r=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(r,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 Ur.hexDump(e.keyId)}updateKeySession(e,t){var r;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${Ur.hexDump(((r=e.decryptdata)==null?void 0:r.keyId)||[])}
135
+ } (data length: ${t&&t.byteLength})`),s.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,r)=>{const s=hl(this.config),n=e.map(Cf).filter(a=>!!a&&s.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:a})=>{const o=Lf(a);o?t(o):r(new Error(`Unable to find format for key-system "${a}"`))}).catch(r)})}loadKey(e){const t=e.keyInfo.decryptdata,r=this.getKeyIdString(t),s=`(keyId: ${r} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let n=this.keyIdToKeySessionPromise[r];return n||(n=this.keyIdToKeySessionPromise[r]=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 ${s}`),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 mr?this.hls.trigger(C.ERROR,e.data):this.hls.trigger(C.ERROR,{type:Ve.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),r=this.keyIdToKeySessionPromise[t];if(!r){const s=Cf(e.keyFormat),n=s?[s]:hl(this.config);return this.attemptKeySystemAccess(n)}return r}getKeySystemSelectionPromise(e){if(e.length||(e=hl(this.config)),e.length===0)throw new mr({type:Ve.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:r}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),r===null)return;let s,n;if(t==="sinf"&&this.config.drmSystems[yt.FAIRPLAY]){const h=Pt(new Uint8Array(r));try{const d=su(JSON.parse(h).sinf),g=sm(new Uint8Array(d));if(!g)return;s=g.subarray(8,24),n=yt.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const h=iA(r);if(h===null)return;h.version===0&&h.systemId===Yg.WIDEVINE&&h.data&&(s=h.data.subarray(8,24)),n=Pw(h.systemId)}if(!n||!s)return;const a=Ur.hexDump(s),{keyIdToKeySessionPromise:o,mediaKeySessions:l}=this;let u=o[a];for(let h=0;h<l.length;h++){const d=l[h],g=d.decryptdata;if(g.pssh||!g.keyId)continue;const v=Ur.hexDump(g.keyId);if(a===v||g.uri.replace(/-/g,"").indexOf(a)!==-1){u=o[v],delete o[v],g.pssh=new Uint8Array(r),g.keyId=s,u=o[a]=u.then(()=>this.generateRequestWithPreferredKeySession(d,t,r,"encrypted-event-key-match"));break}}u||(u=o[a]=this.getKeySystemSelectionPromise([n]).then(({keySystem:h,mediaKeys:d})=>{var g;this.throwIfDestroyed();const v=new zn("ISO-23001-7",a,(g=Lf(h))!=null?g:"");return v.pssh=new Uint8Array(r),v.keyId=s,this.attemptSetMediaKeys(h,d).then(()=>{this.throwIfDestroyed();const y=this.createMediaKeySessionContext({decryptdata:v,keySystem:h,mediaKeys:d});return this.generateRequestWithPreferredKeySession(y,t,r,"encrypted-event-no-match")})})),u.catch(h=>this.handleError(h))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(r).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),r.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>r.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,r,s){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,r,e);if(!y)throw new Error("Invalid response from configured generateRequest filter");t=y.initDataType,r=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(r===null)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const u=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${u} (init data type: ${t} length: ${r?r.byteLength:null})`);const h=new mu,d=e._onmessage=y=>{const b=e.mediaKeysSession;if(!b){h.emit("error",new Error("invalid state"));return}const{messageType:E,message:A}=y;this.log(`"${E}" message event for session "${b.sessionId}" message size: ${A.byteLength}`),E==="license-request"||E==="license-renewal"?this.renewLicense(e,A).catch(M=>{this.handleError(M),h.emit("error",M)}):E==="license-release"?e.keySystem===yt.FAIRPLAY&&(this.updateKeySession(e,oc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${E}"`)},g=e._onkeystatuseschange=y=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const E=e.keyStatus;h.emit("keyStatus",E),E==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",d),e.mediaKeysSession.addEventListener("keystatuseschange",g);const v=new Promise((y,b)=>{h.on("error",b),h.on("keyStatus",E=>{E.startsWith("usable")?y():E==="output-restricted"?b(new mr({type:Ve.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):E==="internal-error"?b(new mr({type:Ve.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${E}"`)):E==="expired"?b(new Error("key expired while generating request")):this.warn(`unhandled key status change "${E}"`)})});return e.mediaKeysSession.generateRequest(t,r).then(()=>{var y;this.log(`Request generated for key-session "${(y=e.mediaKeysSession)==null?void 0:y.sessionId}" keyId: ${u}`)}).catch(y=>{throw new mr({type:Ve.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_NO_SESSION,error:y,fatal:!1},`Error generating key-session request: ${y}`)}).then(()=>v).catch(y=>{throw h.removeAllListeners(),this.removeSession(e),y}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,r)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Ur.hexDump("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))} session keyId: ${Ur.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,r=t.loader,s=new r(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,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(g,v,y,b)=>{a(g.data)},onError:(g,v,y,b)=>{o(new mr({type:Ve.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 mr({type:Ve.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"))}};s.load(l,h,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,r){return new Promise((s,n)=>{e.setServerCertificate(r).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${r==null?void 0:r.byteLength}) on "${t}"`),s(e)}).catch(a=>{n(new mr({type:Ve.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(r=>this.updateKeySession(e,new Uint8Array(r)).catch(s=>{throw new mr({type:Ve.KEY_SYSTEM_ERROR,details:ce.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:s,fatal:!0},s.message)}))}unpackPlayReadyKeyMessage(e,t){const r=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=new DOMParser().parseFromString(r,"application/xml"),n=s.querySelectorAll("HttpHeader");if(n.length>0){let h;for(let d=0,g=n.length;d<g;d++){var a,o;h=n[d];const v=(a=h.querySelector("name"))==null?void 0:a.textContent,y=(o=h.querySelector("value"))==null?void 0:o.textContent;v&&y&&e.setRequestHeader(v,y)}}const l=s.querySelector("Challenge"),u=l==null?void 0:l.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return oc(atob(u))}setupLicenseXHR(e,t,r,s){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!r.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,r,s)}).catch(a=>{if(!r.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,r,s)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||s})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const r=this.config.keyLoadPolicy.default;return new Promise((s,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(h){this.error(h)}s(l)}else{const l=r.errorRetry,u=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)n(new mr({type:Ve.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 h=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(s,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 r=t.media;this.media=r,r.addEventListener("encrypted",this.onMediaEncrypted),r.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={},zn.clearKeyUriToKeyIdMap();const r=t.length;Ms.CDMCleanupPromise=Promise.all(t.map(s=>this.removeSession(s)).concat(e==null?void 0:e.setMediaKeys(null).catch(s=>{this.log(`Could not clear media keys: ${s}`)}))).then(()=>{r&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const r=t.reduce((s,n)=>(s.indexOf(n.keyFormat)===-1&&s.push(n.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:r}=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),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}Ms.CDMCleanupPromise=void 0;class mr 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 zt;(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"})(zt||(zt={}));var vc;(function(i){i.DASH="d",i.HLS="h",i.SMOOTH="s",i.OTHER="o"})(vc||(vc={}));var ts;(function(i){i.OBJECT="CMCD-Object",i.REQUEST="CMCD-Request",i.SESSION="CMCD-Session",i.STATUS="CMCD-Status"})(ts||(ts={}));const EC={[ts.OBJECT]:["br","d","ot","tb"],[ts.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[ts.SESSION]:["cid","pr","sf","sid","st","v"],[ts.STATUS]:["bs","rtp"]};class Gs{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(r=>r instanceof Gs?r:new Gs(r))),this.value=e,this.params=t}}class Km{constructor(e){this.description=void 0,this.description=e}}const TC="Dict";function wC(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 AC(i,e,t,r){return new Error(`failed to ${i} "${wC(e)}" as ${t}`,{cause:r})}const wd="Bare Item",_C="Boolean",CC="Byte Sequence",LC="Decimal",RC="Integer";function IC(i){return i<-999999999999999||999999999999999<i}const PC=/[\x00-\x1f\x7f]+/,kC="Token",DC="Key";function Jr(i,e,t){return AC("serialize",i,e,t)}function OC(i){if(typeof i!="boolean")throw Jr(i,_C);return i?"?1":"?0"}function MC(i){return btoa(String.fromCharCode(...i))}function FC(i){if(ArrayBuffer.isView(i)===!1)throw Jr(i,CC);return`:${MC(i)}:`}function zm(i){if(IC(i))throw Jr(i,RC);return i.toString()}function NC(i){return`@${zm(i.getTime()/1e3)}`}function Wm(i,e){if(i<0)return-Wm(-i,e);const t=Math.pow(10,e);if(Math.abs(i*t%1-.5)<Number.EPSILON){const s=Math.floor(i*t);return(s%2===0?s:s+1)/t}else return Math.round(i*t)/t}function BC(i){const e=Wm(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Jr(i,LC);const t=e.toString();return t.includes(".")?t:`${t}.0`}const $C="String";function UC(i){if(PC.test(i))throw Jr(i,$C);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function GC(i){return i.description||i.toString().slice(7,-1)}function Ad(i){const e=GC(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Jr(e,kC);return e}function yc(i){switch(typeof i){case"number":if(!Re(i))throw Jr(i,wd);return Number.isInteger(i)?zm(i):BC(i);case"string":return UC(i);case"symbol":return Ad(i);case"boolean":return OC(i);case"object":if(i instanceof Date)return NC(i);if(i instanceof Uint8Array)return FC(i);if(i instanceof Km)return Ad(i);default:throw Jr(i,wd)}}function Sc(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw Jr(i,DC);return i}function xu(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${Sc(e)}`:`;${Sc(e)}=${yc(t)}`).join("")}function qm(i){return i instanceof Gs?`${yc(i.value)}${xu(i.params)}`:yc(i)}function VC(i){return`(${i.value.map(qm).join(" ")})${xu(i.params)}`}function jC(i,e={whitespace:!0}){if(typeof i!="object")throw Jr(i,TC);const t=i instanceof Map?i.entries():Object.entries(i),r=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([s,n])=>{n instanceof Gs||(n=new Gs(n));let a=Sc(s);return n.value===!0?a+=xu(n.params):(a+="=",Array.isArray(n.value)?a+=VC(n):a+=qm(n)),a}).join(`,${r}`)}function HC(i,e){return jC(i,e)}const KC=i=>i==="ot"||i==="sf"||i==="st",zC=i=>typeof i=="number"?Re(i):i!=null&&i!==""&&i!==!1;function WC(i,e){const t=new URL(i),r=new URL(e);if(t.origin!==r.origin)return i;const s=t.pathname.split("/").slice(1),n=r.pathname.split("/").slice(1,-1);for(;s[0]===n[0];)s.shift(),n.shift();for(;n.length;)n.shift(),s.unshift("..");return s.join("/")}function qC(){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,s=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s=="x"?n:n&3|8).toString(16)})}}}const Va=i=>Math.round(i),YC=(i,e)=>(e!=null&&e.baseUrl&&(i=WC(i,e.baseUrl)),encodeURIComponent(i)),Pa=i=>Va(i/100)*100,XC={br:Va,d:Va,bl:Pa,dl:Pa,mtp:Pa,nor:YC,rtp:Pa,tb:Va};function QC(i,e){const t={};if(i==null||typeof i!="object")return t;const r=Object.keys(i).sort(),s=Lt({},XC,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return r.forEach(a=>{if(n!=null&&n(a))return;let o=i[a];const l=s[a];l&&(o=l(o,e)),!(a==="v"&&o===1)&&(a=="pr"&&o===1||zC(o)&&(KC(a)&&typeof o=="string"&&(o=new Km(o)),t[a]=o))}),t}function Ym(i,e={}){return i?HC(QC(i,e),Lt({whitespace:!1},e)):""}function JC(i,e={}){if(!i)return{};const t=Object.entries(i),r=Object.entries(EC).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=t.reduce((n,a)=>{var o,l;const[u,h]=a,d=((o=r.find(g=>g[1].includes(u)))==null?void 0:o[0])||ts.REQUEST;return(l=n[d])!=null||(n[d]={}),n[d][u]=h,n},{});return Object.entries(s).reduce((n,[a,o])=>(n[a]=Ym(o,e),n),{})}function ZC(i,e,t){return Lt(i,JC(e,t))}const eL="CMCD";function tL(i,e={}){if(!i)return"";const t=Ym(i,e);return`${eL}=${encodeURIComponent(t)}`}const _d=/CMCD=[^&#]+/;function rL(i,e,t){const r=tL(e,t);if(!r)return i;if(_d.test(i))return i.replace(_d,r);const s=i.includes("?")?"&":"?";return`${i}${s}${r}`}class iL{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=s=>{try{this.apply(s,{ot:zt.MANIFEST,su:!this.initialized})}catch(n){ie.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=s=>{try{const n=s.frag,a=this.hls.levels[n.level],o=this.getObjectType(n),l={d:n.duration*1e3,ot:o};(o===zt.VIDEO||o===zt.AUDIO||o==zt.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(s,l)}catch(n){ie.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:r}=t;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||qC(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.includeKeys=r.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 r,s;this.audioBuffer=(r=t.tracks.audio)==null?void 0:r.buffer,this.videoBuffer=(s=t.tracks.video)==null?void 0:s.buffer}createData(){var e;return{v:1,sf:vc.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Lt(t,this.createData());const r=t.ot===zt.INIT||t.ot===zt.VIDEO||t.ot===zt.MUXED;this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce((n,a)=>(s.includes(a)&&(n[a]=t[a]),n),{})),this.useHeaders?(e.headers||(e.headers={}),ZC(e.headers,t)):e.url=rL(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return zt.TIMED_TEXT;if(e.sn==="initSegment")return zt.INIT;if(t==="audio")return zt.AUDIO;if(t==="main")return this.hls.audioTracks.length?zt.VIDEO:zt.MUXED}getTopBandwidth(e){let t=0,r;const s=this.hls;if(e===zt.AUDIO)r=s.audioTracks;else{const n=s.maxAutoLevel,a=n>-1?n+1:s.levels.length;r=s.levels.slice(0,a)}for(const n of r)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,r=e===zt.AUDIO?this.audioBuffer:this.videoBuffer;return!r||!t?NaN:mt.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,r=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new r(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,r=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new r(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 sL=3e5;class nL{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(r=>r!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:r}=t;r!==null&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:r}=t;if((r==null?void 0:r.action)===Vt.SendAlternateToPenaltyBox&&r.flags===Rr.MoveAllAlternatesMatchingHost){const s=this.levels;let n=this.pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:u}=t.context;o&&s?a=this.getPathwayForGroupId(o,u,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&s&&(n=s.reduce((o,l)=>(o.indexOf(l.pathwayId)===-1&&o.push(l.pathwayId),o),[])),n&&n.length>1&&(this.updatePathwayPriority(n),r.resolved=this.pathwayId!==a),r.resolved||ie.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${s&&s.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 r=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),t=this.getLevelsForPathway(r),this.pathwayId=r}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const r=this.penalizedPathways,s=performance.now();Object.keys(r).forEach(n=>{s-r[n]>sL&&delete r[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in r)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,pm(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,r){const s=this.getLevelsForPathway(r).concat(this.levels||[]);for(let n=0;n<s.length;n++)if(t===it.AUDIO_TRACK&&s[n].hasAudioGroup(e)||t===it.SUBTITLE_TRACK&&s[n].hasSubtitleGroup(e))return s[n].pathwayId;return r}clonePathways(e){const t=this.levels;if(!t)return;const r={},s={};e.forEach(n=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(h=>h.pathwayId===a))return;const u=this.getLevelsForPathway(o).map(h=>{const d=new bt(h.attrs);d["PATHWAY-ID"]=a;const g=d.AUDIO&&`${d.AUDIO}_clone_${a}`,v=d.SUBTITLES&&`${d.SUBTITLES}_clone_${a}`;g&&(r[d.AUDIO]=g,d.AUDIO=g),v&&(s[d.SUBTITLES]=v,d.SUBTITLES=v);const y=Xm(h.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),b=new $s({attrs:d,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:y,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let E=1;E<h.audioGroups.length;E++)b.addGroupId("audio",`${h.audioGroups[E]}_clone_${a}`);if(h.subtitleGroups)for(let E=1;E<h.subtitleGroups.length;E++)b.addGroupId("text",`${h.subtitleGroups[E]}_clone_${a}`);return b});t.push(...u),Cd(this.audioTracks,r,l,a),Cd(this.subtitleTracks,s,l,a)})}loadSteeringManifest(e){const t=this.hls.config,r=t.loader;this.loader&&this.loader.destroy(),this.loader=new r(t);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+h)}const n={responseType:"json",url:s.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:(h,d,g,v)=>{this.log(`Loaded steering manifest: "${s}"`);const y=h.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":b,"PATHWAY-CLONES":E,"PATHWAY-PRIORITY":A}=y;if(b)try{this.uri=new self.URL(b,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${b}`);return}this.scheduleRefresh(this.uri||g.url),E&&this.clonePathways(E);const M={steeringManifest:y,url:s.toString()};this.hls.trigger(C.STEERING_MANIFEST_LOADED,M),A&&this.updatePathwayPriority(A)},onError:(h,d,g,v)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${d.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let y=this.timeToLoad*1e3;if(h.code===429){const b=this.loader;if(typeof(b==null?void 0:b.getResponseHeader)=="function"){const E=b.getResponseHeader("Retry-After");E&&(y=parseFloat(E)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,y)},onTimeout:(h,d,g)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(n,l,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var r;const s=(r=this.hls)==null?void 0:r.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Cd(i,e,t,r){i&&Object.keys(e).forEach(s=>{const n=i.filter(a=>a.groupId===s).map(a=>{const o=Lt({},a);return o.details=void 0,o.attrs=new bt(o.attrs),o.url=o.attrs.URI=Xm(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[s],o.attrs["PATHWAY-ID"]=r,o});i.push(...n)})}function Xm(i,e,t,r){const{HOST:s,PARAMS:n,[t]:a}=r;let o;e&&(o=a==null?void 0:a[e],o&&(i=o));const l=new self.URL(i);return s&&!o&&(l.host=s),n&&Object.keys(n).sort().forEach(u=>{u&&l.searchParams.set(u,n[u])}),l.href}const aL=/^age:\s*[\d.]+\s*$/im;class Qm{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 xo,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,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const r=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!this.stats.aborted)return n(r,t.url)}).catch(a=>(r.open("GET",t.url,!0),n(r,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(r,t,e)}).catch(a=>{this.callbacks.onError({code:r.status,text:a.message},t,r,s)}):this.openAndSendXhr(r,t,e)}openAndSendXhr(e,t,r){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=r.loadPolicy;if(s)for(const o in s)e.setRequestHeader(o,s[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),r.timeout=n&&Re(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:r}=this;if(!e||!t)return;const s=t.readyState,n=this.config;if(!r.aborted&&s>=2&&(r.loading.first===0&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),s===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)){r.loading.end=Math.max(self.performance.now(),r.loading.first);const l=o?t.response:t.responseText,u=t.responseType==="arraybuffer"?l.byteLength:l.length;if(r.loaded=r.total=u,r.bwEstimate=r.total*8e3/(r.loading.end-r.loading.first),!this.callbacks)return;const h=this.callbacks.onProgress;if(h&&h(r,e,l,t),!this.callbacks)return;const d={url:t.responseURL,data:l,code:a};this.callbacks.onSuccess(d,r,e,t)}else{const l=n.loadPolicy.errorRetry,u=r.retry,h={url:e.url,data:void 0,code:a};to(l,u,!1,h)?this.retry(l):(ie.error(`${a} while loading ${e.url}`),this.callbacks.onError({code:a,text:t.statusText},e,t,r))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,r=this.stats.retry;if(to(t,r,!0))this.retry(t);else{var s;ie.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:r}=this;this.retryDelay=ou(e,r.retry),r.retry++,ie.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${r.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&aL.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 oL(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const lL=/(\d+)-(\d+)\/(\d+)/;class Ld{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||fL,this.controller=new self.AbortController,this.stats=new xo}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,r){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const n=cL(e,this.controller.signal),a=r.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:u,maxLoadTimeMs:h}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=u&&Re(u)?u:h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),r.onTimeout(s,e,this.response)},t.timeout),self.fetch(this.request).then(d=>{this.response=this.loader=d;const g=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),r.onTimeout(s,e,this.response)},h-(g-s.loading.start)),!d.ok){const{status:v,statusText:y}=d;throw new dL(y||"fetch, bad network response",v,d)}return s.loading.first=g,s.total=hL(d.headers)||s.total,a&&Re(t.highWaterMark)?this.loadProgressively(d,s,e,t.highWaterMark,a):o?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{const g=this.response;if(!g)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const v=d[l];v&&(s.loaded=s.total=v);const y={url:g.url,data:d,code:g.status};a&&!Re(t.highWaterMark)&&a(s,e,d,g),r.onSuccess(y,s,e,g)}).catch(d=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const g=d&&d.code||0,v=d?d.message:null;r.onError({code:g,text:v},e,d?d.details:null,s)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,r,s=0,n){const a=new ym,o=e.body.getReader(),l=()=>o.read().then(u=>{if(u.done)return a.dataLength&&n(t,r,a.flush(),e),Promise.resolve(new ArrayBuffer(0));const h=u.value,d=h.length;return t.loaded+=d,d<s||a.dataLength?(a.push(h),a.dataLength>=s&&n(t,r,a.flush(),e)):n(t,r,h,e),l()}).catch(()=>Promise.reject());return l()}}function cL(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Lt({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function uL(i){const e=lL.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function hL(i){const e=i.get("Content-Range");if(e){const r=uL(e);if(Re(r))return r}const t=i.get("Content-Length");if(t)return parseInt(t)}function fL(i,e){return new self.Request(i.url,e)}class dL extends Error{constructor(e,t,r){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=r}}const pL=/\s/,gL={newCue(i,e,t,r){const s=[];let n,a,o,l,u;const h=self.VTTCue||self.TextTrackCue;for(let g=0;g<r.rows.length;g++)if(n=r.rows[g],o=!0,l=0,u="",!n.isEmpty()){var d;for(let b=0;b<n.chars.length;b++)pL.test(n.chars[b].uchar)&&o?l++:(u+=n.chars[b].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const v=Um(u.trim()),y=yu(e,t,v);i!=null&&(d=i.cues)!=null&&d.getCueById(y)||(a=new h(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),s.push(a))}return i&&s.length&&(s.sort((g,v)=>g.line==="auto"||v.line==="auto"?0:g.line>8&&v.line>8?v.line-g.line:g.line-v.line),s.forEach(g=>um(i,g))),s}},mL={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Jm=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:Qm,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:zA,bufferController:X_,capLevelController:Su,errorController:OA,fpsController:bC,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:Xg,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:mL},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},vL()),{},{subtitleStreamController:z_,subtitleTrackController:q_,timelineController:SC,audioStreamController:H_,audioTrackController:K_,emeController:Ms,cmcdController:iL,contentSteeringController:nL});function vL(){return{cueHandler:gL,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=xc(i),r=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(n=>{const a=`${n==="level"?"playlist":n}LoadPolicy`,o=e[a]===void 0,l=[];s.forEach(u=>{const h=`${n}Loading${u}`,d=e[h];if(d!==void 0&&o){l.push(h);const g=t[a].default;switch(e[a]={default:g},u){case"TimeOut":g.maxLoadTimeMs=d,g.maxTimeToFirstByteMs=d;break;case"MaxRetry":g.errorRetry.maxNumRetry=d,g.timeoutRetry.maxNumRetry=d;break;case"RetryDelay":g.errorRetry.retryDelayMs=d,g.timeoutRetry.retryDelayMs=d;break;case"MaxRetryTimeout":g.errorRetry.maxRetryDelayMs=d,g.timeoutRetry.maxRetryDelayMs=d;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 xc(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(xc):Object.keys(i).reduce((e,t)=>(e[t]=xc(i[t]),e),{}):i}function SL(i){const e=i.loader;e!==Ld&&e!==Qm?(ie.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):oL()&&(i.loader=Ld,i.progressive=!0,i.enableSoftwareAES=!0,ie.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Il;class xL extends lu{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 r=this.hls.config.preferManagedMediaSource,s=[],n={},a={};let o=!1,l=!1,u=!1;t.levels.forEach(h=>{var d,g;const v=h.attrs;let{audioCodec:y,videoCodec:b}=h;((d=y)==null?void 0:d.indexOf("mp4a.40.34"))!==-1&&(Il||(Il=/chrome|firefox/i.test(navigator.userAgent)),Il&&(h.audioCodec=y=void 0)),y&&(h.audioCodec=y=Ja(y,r)),((g=b)==null?void 0:g.indexOf("avc1"))===0&&(b=h.videoCodec=uA(b));const{width:E,height:A,unknownCodecs:M}=h;if(o||(o=!!(E&&A)),l||(l=!!b),u||(u=!!y),M!=null&&M.length||y&&!gl(y,"audio",r)||b&&!gl(b,"video",r))return;const{CODECS:D,"FRAME-RATE":B,"HDCP-LEVEL":N,"PATHWAY-ID":J,RESOLUTION:Z,"VIDEO-RANGE":se}=v,q=`${`${J||"."}-`}${h.bitrate}-${Z}-${B}-${D}-${se}-${N}`;if(n[q])if(n[q].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const oe=a[q]+=1;h.attrs["PATHWAY-ID"]=new Array(oe+1).join(".");const ge=new $s(h);n[q]=ge,s.push(ge)}else n[q].addGroupId("audio",v.AUDIO),n[q].addGroupId("text",v.SUBTITLES);else{const oe=new $s(h);n[q]=oe,a[q]=1,s.push(oe)}}),this.filterAndSortMediaOptions(s,t,o,l,u)}filterAndSortMediaOptions(e,t,r,s,n){let a=[],o=[],l=e;if((r||s)&&n&&(l=l.filter(({videoCodec:y,videoRange:b,width:E,height:A})=>(!!y||!!(E&&A))&&TA(b))),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:Ve.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(b=>!b.audioCodec||gl(b.audioCodec,"audio",y)),Rd(a)}t.subtitles&&(o=t.subtitles,Rd(o));const u=l.slice(0);l.sort((y,b)=>{if(y.attrs["HDCP-LEVEL"]!==b.attrs["HDCP-LEVEL"])return(y.attrs["HDCP-LEVEL"]||"")>(b.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&y.height!==b.height)return y.height-b.height;if(y.frameRate!==b.frameRate)return y.frameRate-b.frameRate;if(y.videoRange!==b.videoRange)return Za.indexOf(y.videoRange)-Za.indexOf(b.videoRange);if(y.videoCodec!==b.videoCodec){const E=Df(y.videoCodec),A=Df(b.videoCodec);if(E!==A)return A-E}if(y.uri===b.uri&&y.codecSet!==b.codecSet){const E=Qa(y.codecSet),A=Qa(b.codecSet);if(E!==A)return A-E}return y.averageBitrate!==b.averageBitrate?y.averageBitrate-b.averageBitrate:0});let h=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){h=u[y];break}}this._levels=l;for(let y=0;y<l.length;y++)if(l[y]===h){var d;this._firstLevel=y;const b=h.bitrate,E=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${b}`),((d=this.hls.userConfig)==null?void 0:d.abrEwmaDefaultEstimate)===void 0){const A=Math.min(b,this.hls.config.abrEwmaDefaultEstimateMax);A>E&&E===Jm.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=A)}break}const g=n&&!s,v={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:s,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 h=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(C.ERROR,{type:Ve.OTHER_ERROR,details:ce.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:h,reason:h.message}),d)return;e=Math.min(e,t.length-1)}const r=this.currentLevelIndex,s=this.currentLevel,n=s?s.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,r===e&&a.details&&s&&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 ${r}${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 h=this.switchParams(a.uri,s==null?void 0:s.details,u);this.loadPlaylist(h)}}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===Ge.MAIN){const r=t.elementaryStreams;if(!Object.keys(r).some(n=>!!r[n]))return;const s=this._levels[t.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,t){var r;const{level:s,details:n}=t,a=this._levels[s];if(!a){var o;this.warn(`Invalid level index ${s}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}s===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(s,t,a.details)):(r=t.deliveryDirectives)!=null&&r.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){let s=r.uri;if(e)try{s=e.addDirectives(s)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}const n=r.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:""} ${s}`),this.clearTimer(),this.hls.trigger(C.LEVEL_LOADING,{url:s,level:t,pathwayId:r.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 r=this._levels.filter((s,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(a=>a.level=-1)),!1));pm(r),this._levels=r,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(C.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(C.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}}function Rd(i){const e={};i.forEach(t=>{const r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++})}class bL{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const r in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[r].loader;if(s){var t;if(e&&e!==((t=s.context)==null?void 0:t.frag.type))return;s.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,r,s,n){return new di({type:Ve.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:r,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:r,cc:s}=e;for(let n=0;n<t.length;n++){const a=t[n];if(s<=a.cc&&(r==="initSegment"||a.sn==="initSegment"||r<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 r,s;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((r=o)!=null&&r.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((s=o)!=null&&s.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 r={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const s=this.emeController.loadKey(r);if(s)return(e.keyLoadPromise=s.then(n=>(e.mediaKeySessionContext=n,r))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(r)}loadKeyHTTP(e,t){const r=this.config,s=r.loader,n=new s(r);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=r.keyLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(g,v,y,b)=>{const{frag:E,keyInfo:A,url:M}=y;if(!E.decryptdata||A!==this.keyUriToKeyInfo[M])return o(this.createKeyLoadError(E,ce.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),b));A.decryptdata.key=E.decryptdata.key=new Uint8Array(g.data),E.keyLoader=null,A.loader=null,a({frag:E,keyInfo:A})},onError:(g,v,y,b)=>{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,h,d)})}resetLoader(e){const{frag:t,keyInfo:r,url:s}=e,n=r.loader;t.keyLoader===n&&(t.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[s],n&&n.destroy()}}function Zm(){return self.SourceBuffer||self.WebKitSourceBuffer}function e0(){if(!as())return!1;const e=Zm();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function EL(){if(!e0())return!1;const i=as();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(Wn(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Wn(e,"audio"))))}function TL(){var i;const e=Zm();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const wL=250,ja=2,AL=.1,_L=.05;class CL{constructor(e,t,r,s){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=r,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:r,media:s,stalled:n}=this;if(s===null)return;const{currentTime:a,seeking:o}=s,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 E=self.performance.now()-n;ie.warn(`playback not stuck anymore @${a}, after ${Math.round(E)}ms`),this.stallReported=!1}this.stalled=null}return}if(u||l){this.stalled=null;return}if(s.paused&&!o||s.ended||s.playbackRate===0||!mt.getBuffered(s).length){this.nudgeRetry=0;return}const h=mt.bufferInfo(s,a,0),d=h.nextStart||0;if(o){const E=h.len>ja,A=!d||t&&t.start<=a||d-a>ja&&!this.fragmentTracker.getPartialFragment(a);if(E||A)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g;if(!(h.len>0)&&!d)return;const A=Math.max(d,h.start||0)-a,M=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,B=(M==null||(g=M.details)==null?void 0:g.live)?M.details.targetduration*2:ja,N=this.fragmentTracker.getPartialFragment(a);if(A>0&&(A<=B||N)){s.paused||this._trySkipBufferHole(N);return}}const v=self.performance.now();if(n===null){this.stalled=v;return}const y=v-n;if(!o&&y>=wL&&(this._reportStall(h),!this.media))return;const b=mt.bufferInfo(s,a,r.maxBufferHole);this._tryFixBufferStall(b,y)}_tryFixBufferStall(e,t){const{config:r,fragmentTracker:s,media:n}=this;if(n===null)return;const a=n.currentTime,o=s.getPartialFragment(a);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>r.maxBufferHole||e.nextStart&&e.nextStart-a<r.maxBufferHole)&&t>r.highBufferWatchdogPeriod*1e3&&(ie.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:r,stallReported:s}=this;if(!s&&r){this.stallReported=!0;const n=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${JSON.stringify(e)})`);ie.warn(n.message),t.trigger(C.ERROR,{type:Ve.MEDIA_ERROR,details:ce.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:r,media:s}=this;if(s===null)return 0;const n=s.currentTime,a=mt.bufferInfo(s,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&&s.readyState<3,h=o-n;if(h>0&&(l||u)){if(h>t.maxBufferHole){const{fragmentTracker:g}=this;let v=!1;if(n===0){const y=g.getAppendedFrag(0,Ge.MAIN);y&&o<y.end&&(v=!0)}if(!v){const y=e||g.getAppendedFrag(n,Ge.MAIN);if(y){let b=!1,E=y.end;for(;E<o;){const A=g.getPartialFragment(E);if(A)E+=A.duration;else{b=!0;break}}if(b)return 0}}}const d=Math.max(o+_L,n+AL);if(ie.warn(`skipping hole, adjusting currentTime from ${n} to ${d}`),this.moved=!0,this.stalled=null,s.currentTime=d,e&&!e.gap){const g=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${d}`);r.trigger(C.ERROR,{type:Ve.MEDIA_ERROR,details:ce.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:g,reason:g.message,frag:e})}return d}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:r,nudgeRetry:s}=this;if(r===null)return;const n=r.currentTime;if(this.nudgeRetry++,s<e.nudgeMaxRetry){const a=n+(s+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);ie.warn(o.message),r.currentTime=a,t.trigger(C.ERROR,{type:Ve.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:Ve.MEDIA_ERROR,details:ce.BUFFER_STALLED_ERROR,error:a,fatal:!0})}}}const LL=100;class RL extends hu{constructor(e,t,r){super(e,t,r,"[stream-controller]",Ge.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:r}=this;if(this.stopLoad(),this.setInterval(LL),this.level=-1,!this.startFragRequested){let s=r.startLevel;s===-1&&(r.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=r.firstAutoLevel),r.nextLoadLevel=s,this.level=r.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=de.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=de.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case de.WAITING_LEVEL:{const{levels:t,level:r}=this,s=t==null?void 0:t[r],n=s==null?void 0:s.details;if(n&&(!n.live||this.levelLastLoaded===s)){if(this.waitForCdnTuneIn(n))break;this.state=de.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=de.IDLE;break}break}case de.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),r=this.retryDate;if(!r||t>=r||(e=this.media)!=null&&e.seeking){const{levels:s,level:n}=this,a=s==null?void 0:s[n];this.resetStartWhenNotLoaded(a||null),this.state=de.IDLE}}break}this.state===de.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:r,media:s}=this;if(t===null||!s&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(r!=null&&r[n]))return;const a=r[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const b={};this.altAudio&&(b.type="video"),this.hls.trigger(C.BUFFER_EOS,b),this.state=de.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===de.WAITING_LEVEL||u.live&&this.levelLastLoaded!==a){this.level=n,this.state=de.WAITING_LEVEL;return}const h=o.len,d=this.getMaxBufferLength(a.maxBitrate);if(h>=d)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)!==Ft.OK){var y;const E=((y=this.backtrackFragment)!=null?y:v).sn-u.startSN,A=u.fragments[E-1];A&&v.cc===A.cc&&(v=A,this.fragmentTracker.removeFragment(A))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(v&&this.isLoopLoading(v,g)){if(!v.gap){const E=this.audioOnly&&!this.altAudio?ht.AUDIO:ht.VIDEO,A=(E===ht.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;A&&this.afterBufferFlushed(A,E,Ge.MAIN)}v=this.getNextFragmentLoopLoading(v,u,o,Ge.MAIN,d)}v&&(v.initSegment&&!v.initSegment.data&&!this.bitrateTest&&(v=v.initSegment),this.loadFragment(v,a,g))}loadFragment(e,t,r){const s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===Ft.NOT_LOADED||s===Ft.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,r)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Ge.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 r;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.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?r=this.fragCurrent.duration*l.maxBitrate/(1e3*u)+1:r=0}else r=0;const a=this.getBufferedFrag(t.currentTime+r);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const l=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,h=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(h,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 de.KEY_LOADING:case de.FRAG_LOADING:case de.FRAG_LOADING_WAITING_RETRY:case de.PARSING:case de.PARSED:this.state=de.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 r=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new CL(this.config,r,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;Re(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const r=this.getMainFwdBufferInfo();if(r===null||r.len===0){this.warn(`Main forward buffer length on "seeked" event ${r?r.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 r=!1,s=!1;t.levels.forEach(n=>{const a=n.audioCodec;a&&(r=r||a.indexOf("mp4a.40.2")!==-1,s=s||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=r&&s&&!TL(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:r}=this;if(!r||this.state!==de.IDLE)return;const s=r[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=de.WAITING_LEVEL)}onLevelLoaded(e,t){var r;const{levels:s}=this,n=t.level,a=t.details,o=a.totalduration;if(!s){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=s[n],u=this.fragCurrent;u&&(this.state===de.FRAG_LOADING||this.state===de.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let h=0;if(a.live||(r=l.details)!=null&&r.live){var d;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;h=this.alignPlaylists(a,l.details,(d=this.levelLastLoaded)==null?void 0:d.details)}if(l.details=a,this.levelLastLoaded=l,this.hls.trigger(C.LEVEL_UPDATED,{details:a,level:n}),this.state===de.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=de.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,h),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:r,part:s,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const o=a[r.level],l=o.details;if(!l){this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),this.fragmentTracker.removeFragment(r);return}const u=o.videoCodec,h=l.PTSKnown||!l.live,d=(t=r.initSegment)==null?void 0:t.data,g=this._getAudioCodec(o),v=this.transmuxer=this.transmuxer||new Om(this.hls,Ge.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),y=s?s.index:-1,b=y!==-1,E=new cu(r.level,r.sn,r.stats.chunkCount,n.byteLength,y,b),A=this.initPTS[r.cc];v.push(n,d,g,u,r,s,l.totalduration,h,E,A)}onAudioTrackSwitching(e,t){const r=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;r&&(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 r=t.id,s=!!this.hls.audioTracks[r].url;if(s){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=s,this.tick()}onBufferCreated(e,t){const r=t.tracks;let s,n,a=!1;for(const o in r){const l=r[o];if(l.id==="main"){if(n=o,s=l,o==="video"){const u=r[o];u&&(this.videoBuffer=u.buffer)}}else a=!0}a&&s?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:r,part:s}=t;if(r&&r.type!==Ge.MAIN)return;if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),this.state===de.PARSED&&(this.state=de.IDLE);return}const n=s?s.stats:r.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),r.sn!=="initSegment"&&(this.fragPrevious=r),this.fragBufferedComplete(r,s)}onError(e,t){var r;if(t.fatal){this.state=de.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(Ge.MAIN,t);break;case ce.LEVEL_LOAD_ERROR:case ce.LEVEL_LOAD_TIMEOUT:case ce.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===de.WAITING_LEVEL&&((r=t.context)==null?void 0:r.type)===it.LEVEL&&(this.state=de.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 r=this.state!==de.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,r)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=de.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 r=(t===ht.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,t,Ge.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 r=this.startPosition;if(r>=0&&t<r){if(e.seeking){this.log(`could not seek to ${r}, already seeking at ${t}`);return}const s=mt.getBuffered(e),a=(s.length?s.start(0):0)-r;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),r+=a,this.startPosition=r),this.log(`seek to target start position ${r} from current time ${t}`),e.currentTime=r}}_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(r=>{const{hls:s}=this;if(!r||this.fragContextChanged(e))return;t.fragmentError=0,this.state=de.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(),s.trigger(C.FRAG_LOADED,r),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const r="main",{hls:s}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:u,level:h}=o,{video:d,text:g,id3:v,initSegment:y}=n,{details:b}=h,E=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=de.PARSING,y){if(y!=null&&y.tracks){const D=l.initSegment||l;this._bufferInitSegment(h,y.tracks,D,a),s.trigger(C.FRAG_PARSING_INIT_SEGMENT,{frag:D,id:r,tracks:y.tracks})}const A=y.initPTS,M=y.timescale;Re(A)&&(this.initPTS[l.cc]={baseTime:A,timescale:M},s.trigger(C.INIT_PTS_FOUND,{frag:l,id:r,initPTS:A,timescale:M}))}if(d&&b&&l.sn!=="initSegment"){const A=b.fragments[l.sn-1-b.startSN],M=l.sn===b.startSN,D=!A||l.cc>A.cc;if(n.independent!==!1){const{startPTS:B,endPTS:N,startDTS:J,endDTS:Z}=d;if(u)u.elementaryStreams[d.type]={startPTS:B,endPTS:N,startDTS:J,endDTS:Z};else if(d.firstKeyFrame&&d.independent&&a.id===1&&!D&&(this.couldBacktrack=!0),d.dropped&&d.independent){const se=this.getMainFwdBufferInfo(),Q=(se?se.end:this.getLoadPosition())+this.config.maxBufferHole,q=d.firstKeyFramePTS?d.firstKeyFramePTS:B;if(!M&&Q<q-this.config.maxBufferHole&&!D){this.backtrack(l);return}else D&&(l.gap=!0);l.setElementaryStreamInfo(d.type,l.start,N,l.start,Z,!0)}else M&&B>ja&&(l.gap=!0);l.setElementaryStreamInfo(d.type,B,N,J,Z),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(d,l,u,a,M||D)}else if(M||D)l.gap=!0;else{this.backtrack(l);return}}if(E){const{startPTS:A,endPTS:M,startDTS:D,endDTS:B}=E;u&&(u.elementaryStreams[ht.AUDIO]={startPTS:A,endPTS:M,startDTS:D,endDTS:B}),l.setElementaryStreamInfo(ht.AUDIO,A,M,D,B),this.bufferFragmentData(E,l,u,a)}if(b&&v!=null&&(t=v.samples)!=null&&t.length){const A={id:r,frag:l,details:b,samples:v.samples};s.trigger(C.FRAG_PARSING_METADATA,A)}if(b&&g){const A={id:r,frag:l,details:b,samples:g.samples};s.trigger(C.FRAG_PARSING_USERDATA,A)}}_bufferInitSegment(e,t,r,s){if(this.state!==de.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 h=t[l].initSegment;h!=null&&h.byteLength&&this.hls.trigger(C.BUFFER_APPENDING,{type:l,data:h,frag:r,part:null,chunkMeta:s,parent:r.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Ge.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=de.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const r=e.currentTime;if(mt.isBuffered(e,r)?t=this.getAppendedFrag(r):mt.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){this.backtrackFragment=null;const s=this.fragPlaying,n=t.level;(!s||t.sn!==s.sn||s.level!==n)&&(this.fragPlaying=t,this.hls.trigger(C.FRAG_CHANGED,{frag:t}),(!s||s.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,r=this.currentFrag;if(r&&Re(t)&&Re(r.programDateTime)){const s=r.programDateTime+(t-r.start)*1e3;return new Date(s)}}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 Yr{static get version(){return"1.5.8"}static isMSESupported(){return e0()}static isSupported(){return EL()}static getMediaSource(){return as()}static get Events(){return C}static get ErrorTypes(){return Ve}static get ErrorDetails(){return ce}static get DefaultConfig(){return Yr.defaultConfig?Yr.defaultConfig:Jm}static set DefaultConfig(e){Yr.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 mu,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,bw(e.debug||!1,"Hls instance");const t=this.config=yL(Yr.DefaultConfig,e);this.userConfig=e,t.progressive&&SL(t);const{abrController:r,bufferController:s,capLevelController:n,errorController:a,fpsController:o}=t,l=new a(this),u=this.abrController=new r(this),h=this.bufferController=new s(this),d=this.capLevelController=new n(this),g=new o(this),v=new gA(this),y=new xA(this),b=t.contentSteeringController,E=b?new b(this):null,A=this.levelController=new xL(this,E),M=new qA(this),D=new bL(this.config),B=this.streamController=new RL(this,M,D);d.setStreamController(B),g.setStreamController(B);const N=[v,A,B];E&&N.splice(1,0,E),this.networkControllers=N;const J=[u,h,d,g,y,M];this.audioTrackController=this.createController(t.audioTrackController,N);const Z=t.audioStreamController;Z&&N.push(new Z(this,M,D)),this.subtitleTrackController=this.createController(t.subtitleTrackController,N);const se=t.subtitleStreamController;se&&N.push(new se(this,M,D)),this.createController(t.timelineController,J),D.emeController=this.emeController=this.createController(t.emeController,J),this.cmcdController=this.createController(t.cmcdController,J),this.latencyController=this.createController(bA,J),this.coreComponents=J,N.push(l);const Q=l.onErrorOut;typeof Q=="function"&&this.on(C.ERROR,Q,l)}createController(e,t){if(e){const r=new e(this);return t&&t.push(r),r}return null}on(e,t,r=this){this._emitter.on(e,t,r)}once(e,t,r=this){this._emitter.once(e,t,r)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,r=this,s){this._emitter.off(e,t,r,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,r){return this._emitter.emit(e,t,r)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(r){if(ie.error("An internal error happened while handling event "+e+'. Error message: "'+r.message+'". Here is a stacktrace:',r),!this.triggeringException){this.triggeringException=!0;const s=e===C.ERROR;this.trigger(C.ERROR,{type:Ve.OTHER_ERROR,details:ce.INTERNAL_EXCEPTION,fatal:s,event:e,error:r}),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,r=this.url,s=this.url=iu.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,ie.log(`loadSource:${s}`),t&&r&&(r!==s||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){EA(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 r=e.length;for(let s=0;s<r;s++)if(e[s].maxBitrate>=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:r}=this;let s;if(t===-1&&e!=null&&e.length?s=e.length-1:s=t,r)for(let n=s;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=r)return n}return s}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}}Yr.defaultConfig=void 0;function IL({src:i,quality:e,initialTime:t,timeOffsetStart:r,timeOffsetEnd:s,timeUpdateEvent:n=!1,debug:a,onSync:o,onInit:l,onDestroy:u}){const[h,d]=ye.useState(),[g,v]=ye.useState(!1),[y,b]=ye.useState(1),[E,A]=ye.useState(!1),[M,D]=ye.useState(!1),[B,N]=ye.useState(),[J,Z]=ye.useState({originDurationTime:0,originCurrentTime:0,progress:0,currentTime:0,durationTime:0}),se=ye.useRef(null),Q=ye.useRef();jT({element:se.current,eventName:"timeupdate",handler:n&&E?()=>{if(!se.current)return;const ue=se.current,pe=Math.floor(ue.currentTime),Ce=Math.floor(ue.duration===1/0?ue.buffered.end(0):ue.duration),me=pe-(r??0),Se=(s??Ce)-(r??0);Z({originCurrentTime:pe,originDurationTime:Ce,currentTime:me,durationTime:Se,progress:me/Se*100})}:void 0});const q=()=>{if(!se.current)return;const ue=se.current;ue.paused?ue.play().catch(()=>{N(!0)}):ue.pause()},oe=()=>{if(!se.current)return;const ue=se.current,pe=ue.currentTime+10;typeof s=="number"&&s<pe?ue.currentTime=s:ue.currentTime=pe},ge=()=>{if(!se.current)return;const ue=se.current,pe=ue.currentTime-10;typeof r=="number"&&r>pe?ue.currentTime=r:ue.currentTime=pe},he=()=>{if(!se.current)return;const ue=se.current;ue.playbackRate===2?ue.playbackRate=1:ue.playbackRate+=.5},Ee=ue=>{if(!se.current)return;const pe=se.current;pe.currentTime=(r??0)+ue},Te=ye.useCallback(ue=>{const pe=se.current;pe&&(A(!1),Yr.isSupported()?(h==null||h.stopLoad(),h==null||h.loadSource(ue)):pe.canPlayType("application/vnd.apple.mpegurl")&&(pe.src=ue))},[h]);return ye.useEffect(()=>{Q.current=o},[o]),ye.useEffect(()=>{if(!se.current||!i)return;const ue=se.current;let pe;if(Yr.isSupported()){const Je={debug:!1,enableWorker:!0,lowLatencyMode:!0,backBufferLength:90,highBufferWatchdogPeriod:1,maxMaxBufferLength:8};pe=new Yr(Je),pe.attachMedia(ue),pe.loadSource(i),d(pe)}else ue.canPlayType("application/vnd.apple.mpegurl")&&(ue.src=i);const Ce=()=>{var Rt,Sr,ke,hr;const Je=ue.duration,vt=((ke=(Sr=(Rt=pe==null?void 0:pe.levels)==null?void 0:Rt[0])==null?void 0:Sr.details)==null?void 0:ke.live)||Je===1/0;v(vt),(hr=Q.current)==null||hr.call(Q,!0),Je!==1/0&&Z(sr=>({...sr,durationTime:Math.floor(Je)})),t&&(ue.currentTime=t),r&&!vt&&(ue.currentTime=r),ue.play().catch(()=>{N(!0)})},me=()=>{D(!1)},Se=()=>{typeof s=="number"&&ue.currentTime>=s&&typeof r=="number"&&(ue.currentTime=r),D(!0),N(!1)},We=()=>{ue.pause()},$e=()=>{A(!0)},Xe=()=>{b(ue.playbackRate)},rt=({detail:Je})=>{pe&&(pe.currentLevel=Je.quality)},et=()=>{var Rt,Sr,ke,hr,sr,$i,Ui,Zr,Gi,xr,ei;const Je=ue.currentTime,vt=ue.duration;if((Sr=(Rt=pe==null?void 0:pe.levels[pe.currentLevel])==null?void 0:Rt.details)!=null&&Sr.live)(ke=Q==null?void 0:Q.current)==null||ke.call(Q,vt-Je<5);else if(vt===1/0){const vi=ue.buffered.end(0);(hr=Q==null?void 0:Q.current)==null||hr.call(Q,vi-Je<5)}if(typeof s=="number"&&Je>=s&&(ue.currentTime=s,ue.pause()),a){const vi=ue.buffered.end(0),Dr=(($i=(sr=pe==null?void 0:pe.levels[pe.currentLevel])==null?void 0:sr.details)==null?void 0:$i.live)||vt===1/0,br={hls:Yr.isSupported(),live:Dr,currentLevel:((Ui=pe==null?void 0:pe.levels[pe.currentLevel])==null?void 0:Ui.width)||"auto",firstLevel:((Zr=pe==null?void 0:pe.levels[pe.firstLevel])==null?void 0:Zr.width)||"auto",latency:(Gi=pe==null?void 0:pe.latency)==null?void 0:Gi.toFixed(2),targetLatency:pe==null?void 0:pe.targetLatency,currentTime:Je,durationTime:vt,bufferedEnd:vi,sync:Dr?(ei=(xr=pe==null?void 0:pe.levels[pe.currentLevel])==null?void 0:xr.details)!=null&&ei.live?vi-Je<5:vt-Je<5:"not live"},Oe=Object.entries(br).map(([St,Or])=>`
136
+ ${St}: ${Or}`).join("");window==null||window.__brix_console(Oe)}},ot=Je=>{console.log(Je)};return document.addEventListener("__BP_VIDEO_QUALITY",rt),ue.addEventListener("progress",et),ue.addEventListener("loadedmetadata",Ce),ue.addEventListener("pause",me),ue.addEventListener("play",Se),ue.addEventListener("ratechange",Xe),ue.addEventListener("canplay",$e),ue.addEventListener("ended",We),ue.addEventListener("error",ot),l==null||l(ue,pe),()=>{document.removeEventListener("__BP_VIDEO_QUALITY",rt),ue.removeEventListener("progress",et),ue.removeEventListener("loadedmetadata",Ce),ue.removeEventListener("pause",me),ue.removeEventListener("play",Se),ue.removeEventListener("ratechange",Xe),ue.removeEventListener("canplay",$e),ue.removeEventListener("ended",We),ue.removeEventListener("error",ot),pe==null||pe.stopLoad(),pe==null||pe.destroy(),u==null||u()}},[i,a,r,t,s,l,u]),ye.useEffect(()=>{!E||typeof e>"u"||document.dispatchEvent(new CustomEvent("__BP_VIDEO_QUALITY",{detail:{quality:e}}))},[E,e]),{ref:se,play:M,live:g,error:B,time:J,hls:h,playbackRate:y,canPlay:E,handlePlayToggle:q,handleBackward:ge,handleForward:oe,handlePlaybackRate:he,handleSeektime:Ee,handleChangeSource:Te}}const PL="_root_ob44w_2",kL="_progress_wrap_ob44w_14",DL="_rail_ob44w_22",OL="_progress_ob44w_14",ML="_handle_ob44w_38",bn={root:PL,progress_wrap:kL,rail:DL,progress:OL,handle:ML};function t0({handle:i,progress:e,className:t,onChangeProgress:r}){const s=ye.useRef(null),n=l=>{const u=l.target,h=l.nativeEvent.offsetX/u.offsetWidth;r==null||r(l,h*100)},a=l=>{if(l.buttons!==1||!s.current)return;const u=l.target,h=l.nativeEvent.offsetX/u.offsetWidth;s.current.style.width=h*100+"%",r==null||r(l,h*100)},o=l=>{if(!s.current)return;const u=l.target,h=(l.targetTouches[0].clientX-u.getBoundingClientRect().x)/u.offsetWidth;s.current.style.width=h*100+"%",r==null||r(l,h*100)};return Ye.jsx("div",{className:`${bn.root} ${t||""}`,children:Ye.jsxs("div",{className:bn.progress_wrap,onClick:n,onMouseMove:a,onTouchMove:o,children:[Ye.jsx("div",{className:bn.rail}),Ye.jsx("div",{className:`${bn.progress} ${i?bn.handle:""}`,ref:s,style:{width:`${e}%`}})]})})}const FL="_root_pwcz5_1",NL={root:FL};function Id(i){const e=Math.floor(+i/3600),t=Math.floor((+i-e*3600)/60),r=(+i-e*3600-t*60).toFixed(0);return e>0?`${e.toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}:${r.padStart(2,"0")}`:`${t.toString().padStart(2,"0")}:${r.padStart(2,"0")}`}function BL(i){const e=i.split(":").map(Number);let t=0;if(e.length===3){const[r,s,n]=e;t=r*3600+s*60+n}else if(e.length===2){const[r,s]=e;t=r*60+s}else t=+i;return t}function Pd(i,e){let t="",r="",s="";if(e){const[n,...a]=e.split("?");r=a.join("&"),s=n}for(const n in i)Object.prototype.hasOwnProperty.call(i,n)&&i[n]!==void 0&&(t+=`${n}=${encodeURIComponent(i[n])}&`);return t+=r?`&${r}`:"",t.length>0&&t.endsWith("&")&&(t=t.slice(0,-1)),s?`${s}?${t}`:t}const $L={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 no{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||$L,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,r,s){return s&&!this.debug?null:(typeof e[0]=="string"&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new no(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new no(this.logger,e)}}var Xr=new no;class Eo{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(t)||0;this.observers[r].set(t,s+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,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(a=>{let[o,l]=a;for(let u=0;u<l;u++)o(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[o,l]=a;for(let u=0;u<l;u++)o.apply(o,[e,...r])})}}function En(){let i,e;const t=new Promise((r,s)=>{i=r,e=s});return t.resolve=i,t.reject=e,t}function kd(i){return i==null?"":""+i}function UL(i,e,t){i.forEach(r=>{e[r]&&(t[r]=e[r])})}const GL=/###/g;function Pn(i,e,t){function r(o){return o&&o.indexOf("###")>-1?o.replace(GL,"."):o}function s(){return!i||typeof i=="string"}const n=typeof e!="string"?e:e.split(".");let a=0;for(;a<n.length-1;){if(s())return{};const o=r(n[a]);!i[o]&&t&&(i[o]=new t),Object.prototype.hasOwnProperty.call(i,o)?i=i[o]:i={},++a}return s()?{}:{obj:i,k:r(n[a])}}function Dd(i,e,t){const{obj:r,k:s}=Pn(i,e,Object);if(r!==void 0||e.length===1){r[s]=t;return}let n=e[e.length-1],a=e.slice(0,e.length-1),o=Pn(i,a,Object);for(;o.obj===void 0&&a.length;)n=`${a[a.length-1]}.${n}`,a=a.slice(0,a.length-1),o=Pn(i,a,Object),o&&o.obj&&typeof o.obj[`${o.k}.${n}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${n}`]=t}function VL(i,e,t,r){const{obj:s,k:n}=Pn(i,e,Object);s[n]=s[n]||[],s[n].push(t)}function ao(i,e){const{obj:t,k:r}=Pn(i,e);if(t)return t[r]}function jL(i,e,t){const r=ao(i,t);return r!==void 0?r:ao(e,t)}function r0(i,e,t){for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in i?typeof i[r]=="string"||i[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(i[r]=e[r]):r0(i[r],e[r],t):i[r]=e[r]);return i}function Is(i){return i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var HL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function KL(i){return typeof i=="string"?i.replace(/[&<>"'\/]/g,e=>HL[e]):i}class zL{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 r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const WL=[" ",",","?","!",";"],qL=new zL(20);function YL(i,e,t){e=e||"",t=t||"";const r=WL.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(r.length===0)return!0;const s=qL.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let n=!s.test(i);if(!n){const a=i.indexOf(t);a>0&&!s.test(i.substring(0,a))&&(n=!0)}return n}function bc(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!i)return;if(i[e])return i[e];const r=e.split(t);let s=i;for(let n=0;n<r.length;){if(!s||typeof s!="object")return;let a,o="";for(let l=n;l<r.length;++l)if(l!==n&&(o+=t),o+=r[l],a=s[o],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<r.length-1)continue;n+=l-n+1;break}s=a}return s}function oo(i){return i&&i.indexOf("_")>0?i.replace("_","-"):i}class Od extends Eo{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,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const n=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],r&&(Array.isArray(r)?o.push(...r):typeof r=="string"&&n?o.push(...r.split(n)):o.push(r)));const l=ao(this.data,o);return!l&&!t&&!r&&e.indexOf(".")>-1&&(e=o[0],t=o[1],r=o.slice(2).join(".")),l||!a||typeof r!="string"?l:bc(this.data&&this.data[e]&&this.data[e][t],r,n)}addResource(e,t,r,s){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];r&&(o=o.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(o=e.split("."),s=t,t=o[1]),this.addNamespaces(t),Dd(this.data,o,s),n.silent||this.emit("added",e,t,r,s)}addResources(e,t,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const n in r)(typeof r[n]=="string"||Array.isArray(r[n]))&&this.addResource(e,t,n,r[n],{silent:!0});s.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,s,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("."),s=r,r=t,t=o[1]),this.addNamespaces(t);let l=ao(this.data,o)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?r0(l,r,n):l={...l,...r},Dd(this.data,o,l),a.silent||this.emit("added",e,t,r)}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(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var i0={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,e,t,r,s){return i.forEach(n=>{this.processors[n]&&(e=this.processors[n].process(e,t,r,s))}),e}};const Md={};class lo extends Eo{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),UL(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Xr.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 r=this.resolve(e,t);return r&&r.res!==void 0}extractFromKey(e,t){let r=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const a=r&&e.indexOf(r)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!YL(e,r,s);if(a&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:n};const u=e.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(n=u.shift()),e=u.join(s)}return typeof n=="string"&&(n=[n]),{key:e,namespaces:n}}translate(e,t,r){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 s=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,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(h){const B=t.nsSeparator||this.options.nsSeparator;return s?{res:`${l}${B}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${B}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:a}const d=this.resolve(e,t);let g=d&&d.res;const v=d&&d.usedKey||a,y=d&&d.exactUsedKey||a,b=Object.prototype.toString.apply(g),E=["[object Number]","[object Function]","[object RegExp]"],A=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,M=!this.i18nFormat||this.i18nFormat.handleAsObject;if(M&&g&&(typeof g!="string"&&typeof g!="boolean"&&typeof g!="number")&&E.indexOf(b)<0&&!(typeof A=="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 B=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,g,{...t,ns:o}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(d.res=B,d.usedParams=this.getUsedParamsDetails(t),d):B}if(n){const B=Array.isArray(g),N=B?[]:{},J=B?y:v;for(const Z in g)if(Object.prototype.hasOwnProperty.call(g,Z)){const se=`${J}${n}${Z}`;N[Z]=this.translate(se,{...t,joinArrays:!1,ns:o}),N[Z]===se&&(N[Z]=g[Z])}g=N}}else if(M&&typeof A=="string"&&Array.isArray(g))g=g.join(A),g&&(g=this.extendTranslation(g,e,t,r));else{let B=!1,N=!1;const J=t.count!==void 0&&typeof t.count!="string",Z=lo.hasDefaultValue(t),se=J?this.pluralResolver.getSuffix(u,t.count,t):"",Q=t.ordinal&&J?this.pluralResolver.getSuffix(u,t.count,{ordinal:!1}):"",q=J&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),oe=q&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${se}`]||t[`defaultValue${Q}`]||t.defaultValue;!this.isValidLookup(g)&&Z&&(B=!0,g=oe),this.isValidLookup(g)||(N=!0,g=a);const he=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:g,Ee=Z&&oe!==g&&this.options.updateMissing;if(N||B||Ee){if(this.logger.log(Ee?"updateKey":"missingKey",u,l,a,Ee?oe:g),n){const Ce=this.resolve(a,{...t,keySeparator:!1});Ce&&Ce.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 Te=[];const ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(let Ce=0;Ce<ue.length;Ce++)Te.push(ue[Ce]);else this.options.saveMissingTo==="all"?Te=this.languageUtils.toResolveHierarchy(t.lng||this.language):Te.push(t.lng||this.language);const pe=(Ce,me,Se)=>{const We=Z&&Se!==g?Se:he;this.options.missingKeyHandler?this.options.missingKeyHandler(Ce,l,me,We,Ee,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(Ce,l,me,We,Ee,t),this.emit("missingKey",Ce,l,me,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&J?Te.forEach(Ce=>{const me=this.pluralResolver.getSuffixes(Ce,t);q&&t[`defaultValue${this.options.pluralSeparator}zero`]&&me.indexOf(`${this.options.pluralSeparator}zero`)<0&&me.push(`${this.options.pluralSeparator}zero`),me.forEach(Se=>{pe([Ce],a+Se,t[`defaultValue${Se}`]||oe)})}):pe(Te,a,oe))}g=this.extendTranslation(g,e,t,d,r),N&&g===a&&this.options.appendNamespaceToMissingKey&&(g=`${l}:${a}`),(N||B)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,B?g:void 0):g=this.options.parseMissingKeyHandler(g))}return s?(d.res=g,d.usedParams=this.getUsedParamsDetails(t),d):g}extendTranslation(e,t,r,s,n){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof e=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(u){const g=e.match(this.interpolator.nestingRegexp);h=g&&g.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,r.lng||this.language,r),u){const g=e.match(this.interpolator.nestingRegexp),v=g&&g.length;h<v&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=s.usedLng),r.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]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${t[0]}`),null):a.translate(...v,t)},r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,l=typeof o=="string"?[o]:o;return e!=null&&l&&l.length&&r.applyPostProcessor!==!1&&(e=i0.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,n,a,o;return typeof e=="string"&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,t),h=u.key;s=h;let d=u.namespaces;this.options.fallbackNS&&(d=d.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!=="",b=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);d.forEach(E=>{this.isValidLookup(r)||(o=E,!Md[`${b[0]}-${E}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(o)&&(Md[`${b[0]}-${E}`]=!0,this.logger.warn(`key "${s}" for languages "${b.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!!!")),b.forEach(A=>{if(this.isValidLookup(r))return;a=A;const M=[h];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(M,h,A,E,t);else{let B;g&&(B=this.pluralResolver.getSuffix(A,t.count,t));const N=`${this.options.pluralSeparator}zero`,J=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(M.push(h+B),t.ordinal&&B.indexOf(J)===0&&M.push(h+B.replace(J,this.options.pluralSeparator)),v&&M.push(h+N)),y){const Z=`${h}${this.options.contextSeparator}${t.context}`;M.push(Z),g&&(M.push(Z+B),t.ordinal&&B.indexOf(J)===0&&M.push(Z+B.replace(J,this.options.pluralSeparator)),v&&M.push(Z+N))}}let D;for(;D=M.pop();)this.isValidLookup(r)||(n=D,r=this.getResource(A,E,D,t))}))})}),{res:r,usedKey:s,exactUsedKey:n,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,s):this.resourceStore.getResource(e,t,r,s)}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"],r=e.replace&&typeof e.replace!="string";let s=r?e.replace:e;if(r&&typeof e.count<"u"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const n of t)delete s[n]}return s}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,t.length)&&e[r]!==void 0)return!0;return!1}}function Pl(i){return i.charAt(0).toUpperCase()+i.slice(1)}class Fd{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Xr.create("languageUtils")}getScriptPartFromCode(e){if(e=oo(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=oo(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 r=e.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=Pl(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=Pl(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=Pl(r[2].toLowerCase()))),r.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(r=>{if(t)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(r=>{if(t)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return t=s;t=this.options.supportedLngs.find(n=>{if(n===s)return n;if(!(n.indexOf("-")<0&&s.indexOf("-")<0)&&(n.indexOf("-")>0&&s.indexOf("-")<0&&n.substring(0,n.indexOf("-"))===s||n.indexOf(s)===0&&s.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 r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),s=[],n=a=>{a&&(this.isSupportedCode(a)?s.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)),r.forEach(a=>{s.indexOf(a)<0&&n(this.formatLanguageCode(a))}),s}}let XL=[{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}],QL={1:function(i){return+(i>1)},2:function(i){return+(i!=1)},3:function(i){return 0},4:function(i){return i%10==1&&i%100!=11?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2},5:function(i){return i==0?0:i==1?1:i==2?2:i%100>=3&&i%100<=10?3:i%100>=11?4:5},6:function(i){return i==1?0:i>=2&&i<=4?1:2},7:function(i){return i==1?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2},8:function(i){return i==1?0:i==2?1:i!=8&&i!=11?2:3},9:function(i){return+(i>=2)},10:function(i){return i==1?0:i==2?1:i<7?2:i<11?3:4},11:function(i){return i==1||i==11?0:i==2||i==12?1:i>2&&i<20?2:3},12:function(i){return+(i%10!=1||i%100==11)},13:function(i){return+(i!==0)},14:function(i){return i==1?0:i==2?1:i==3?2:3},15:function(i){return i%10==1&&i%100!=11?0:i%10>=2&&(i%100<10||i%100>=20)?1:2},16:function(i){return i%10==1&&i%100!=11?0:i!==0?1:2},17:function(i){return i==1||i%10==1&&i%100!=11?0:1},18:function(i){return i==0?0:i==1?1:2},19:function(i){return i==1?0:i==0||i%100>1&&i%100<11?1:i%100>10&&i%100<20?2:3},20:function(i){return i==1?0:i==0||i%100>0&&i%100<20?1:2},21:function(i){return i%100==1?1:i%100==2?2:i%100==3||i%100==4?3:0},22:function(i){return i==1?0:i==2?1:(i<0||i>10)&&i%10==0?2:3}};const JL=["v1","v2","v3"],ZL=["v4"],Nd={zero:0,one:1,two:2,few:3,many:4,other:5};function eR(){const i={};return XL.forEach(e=>{e.lngs.forEach(t=>{i[t]={numbers:e.nr,plurals:QL[e.fc]}})}),i}class tR{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Xr.create("pluralResolver"),(!this.options.compatibilityJSON||ZL.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=eR()}addRule(e,t){this.rules[e]=t}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(oo(e==="dev"?"en":e),{type:t.ordinal?"ordinal":"cardinal"})}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 r=this.getRule(e,t);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(s=>`${t}${s}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,t);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,n)=>Nd[s]-Nd[n]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(e,s,t)):[]}getSuffix(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(e,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:this.getSuffixRetroCompatible(s,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let s=e.numbers[r];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const n=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:n():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?n():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!JL.includes(this.options.compatibilityJSON)}}function Bd(i,e,t){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,n=jL(i,e,t);return!n&&s&&typeof t=="string"&&(n=bc(i,t,r),n===void 0&&(n=bc(e,t,r))),n}class rR{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Xr.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:r,useRawValueToEscape:s,prefix:n,prefixEscaped:a,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:h,unescapePrefix:d,nestingPrefix:g,nestingPrefixEscaped:v,nestingSuffix:y,nestingSuffixEscaped:b,nestingOptionsSeparator:E,maxReplaces:A,alwaysFormat:M}=e.interpolation;this.escape=t!==void 0?t:KL,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=n?Is(n):a||"{{",this.suffix=o?Is(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=h?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=g?Is(g):v||Is("$t("),this.nestingSuffix=y?Is(y):b||Is(")"),this.nestingOptionsSeparator=E||",",this.maxReplaces=A||1e3,this.alwaysFormat=M!==void 0?M:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,r)=>t&&t.source===r?(t.lastIndex=0,t):new RegExp(r,"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,r,s){let n,a,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(y){return y.replace(/\$/g,"$$$$")}const h=y=>{if(y.indexOf(this.formatSeparator)<0){const M=Bd(t,l,y,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(M,void 0,r,{...s,...t,interpolationkey:y}):M}const b=y.split(this.formatSeparator),E=b.shift().trim(),A=b.join(this.formatSeparator).trim();return this.format(Bd(t,l,E,this.options.keySeparator,this.options.ignoreJSONStructure),A,r,{...s,...t,interpolationkey:E})};this.resetRegExp();const d=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,g=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:y=>u(y)},{regex:this.regexp,safeValue:y=>this.escapeValue?u(this.escape(y)):u(y)}].forEach(y=>{for(o=0;n=y.regex.exec(e);){const b=n[1].trim();if(a=h(b),a===void 0)if(typeof d=="function"){const A=d(e,n,s);a=typeof A=="string"?A:""}else if(s&&Object.prototype.hasOwnProperty.call(s,b))a="";else if(g){a=n[0];continue}else this.logger.warn(`missed to pass in variable ${b} for interpolating ${e}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=kd(a));const E=y.safeValue(a);if(e=e.replace(n[0],E),g?(y.regex.lastIndex+=a.length,y.regex.lastIndex-=n[0].length):y.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,n,a;function o(l,u){const h=this.nestingOptionsSeparator;if(l.indexOf(h)<0)return l;const d=l.split(new RegExp(`${h}[ ]*{`));let g=`{${d[1]}`;l=d[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(b){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,b),`${l}${h}${g}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l}for(;s=this.nestingRegexp.exec(e);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const h=s[1].split(this.formatSeparator).map(d=>d.trim());s[1]=h.shift(),l=h,u=!0}if(n=t(o.call(this,s[1].trim(),a),a),n&&s[0]===e&&typeof n!="string")return n;typeof n!="string"&&(n=kd(n)),n||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),n=""),u&&(n=l.reduce((h,d)=>this.format(h,d,r.lng,{...r,interpolationkey:s[1].trim()}),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}function iR(i){let e=i.toLowerCase().trim();const t={};if(i.indexOf("(")>-1){const r=i.split("(");e=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);e==="currency"&&s.indexOf(":")<0?t.currency||(t.currency=s.trim()):e==="relativetime"&&s.indexOf(":")<0?t.range||(t.range=s.trim()):s.split(";").forEach(a=>{if(a){const[o,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),h=o.trim();t[h]||(t[h]=u),u==="false"&&(t[h]=!1),u==="true"&&(t[h]=!0),isNaN(u)||(t[h]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}}function Ps(i){const e={};return function(r,s,n){const a=s+JSON.stringify(n);let o=e[a];return o||(o=i(oo(s),n),e[a]=o),o(r)}}class sR{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Xr.create("formatter"),this.options=e,this.formats={number:Ps((t,r)=>{const s=new Intl.NumberFormat(t,{...r});return n=>s.format(n)}),currency:Ps((t,r)=>{const s=new Intl.NumberFormat(t,{...r,style:"currency"});return n=>s.format(n)}),datetime:Ps((t,r)=>{const s=new Intl.DateTimeFormat(t,{...r});return n=>s.format(n)}),relativetime:Ps((t,r)=>{const s=new Intl.RelativeTimeFormat(t,{...r});return n=>s.format(n,r.range||"day")}),list:Ps((t,r)=>{const s=new Intl.ListFormat(t,{...r});return n=>s.format(n)})},this.init(e)}init(e){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Ps(t)}format(e,t,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return t.split(this.formatSeparator).reduce((o,l)=>{const{formatName:u,formatOptions:h}=iR(l);if(this.formats[u]){let d=o;try{const g=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},v=g.locale||g.lng||s.locale||s.lng||r;d=this.formats[u](o,v,{...h,...s,...g})}catch(g){this.logger.warn(g)}return d}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}function nR(i,e){i.pending[e]!==void 0&&(delete i.pending[e],i.pendingCount--)}class aR extends Eo{constructor(e,t,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=Xr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(e,t,r,s){const n={},a={},o={},l={};return e.forEach(u=>{let h=!0;t.forEach(d=>{const g=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?a[g]===void 0&&(a[g]=!0):(this.state[g]=1,h=!1,a[g]===void 0&&(a[g]=!0),n[g]===void 0&&(n[g]=!0),l[d]===void 0&&(l[d]=!0)))}),h||(o[u]=!0)}),(Object.keys(n).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(n),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,r){const s=e.split("|"),n=s[0],a=s[1];t&&this.emit("failedLoading",n,a,t),r&&this.store.addResourceBundle(n,a,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2;const o={};this.queue.forEach(l=>{VL(l.loaded,[n],a),nR(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const h=l.loaded[u];h.length&&h.forEach(d=>{o[u][d]===void 0&&(o[u][d]=!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,r){let s=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:r,tried:s,wait:n,callback:a});return}this.readingCalls++;const o=(u,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&h&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,r,s+1,n*2,a)},n);return}a(u,h)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(h=>o(null,h)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=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."),s&&s();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof t=="string"&&(t=[t]);const n=this.queueLoad(e,t,r,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),s=r[0],n=r[1];this.read(s,n,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${n} for language ${s}`,o),this.loaded(e,a,o)})}saveMissing(e,t,r,s,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 "${r}" 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(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:n},u=this.backend.create.bind(this.backend);if(u.length<6)try{let h;u.length===5?h=u(e,t,r,s,l):h=u(e,t,r,s),h&&typeof h.then=="function"?h.then(d=>o(null,d)).catch(o):o(null,h)}catch(h){o(h)}else u(e,t,r,s,o,l)}!e||!e[0]||this.store.addResource(e[0],t,r,s)}}}function $d(){return{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:function(e){let t={};if(typeof e[1]=="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(s=>{t[s]=r[s]})}return t},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Ud(i){return 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}function ka(){}function oR(i){Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(t=>{typeof i[t]=="function"&&(i[t]=i[t].bind(i))})}class qn extends Eo{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Ud(e),this.services={},this.logger=Xr,this.modules={external:[]},oR(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]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(r=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 s=$d();this.options={...s,...this.options,...Ud(t)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);function n(h){return h?typeof h=="function"?new h:h:null}if(!this.options.isClone){this.modules.logger?Xr.init(n(this.modules.logger),this.options):Xr.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:typeof Intl<"u"&&(h=sR);const d=new Fd(this.options);this.store=new Od(this.options.resources,this.options);const g=this.services;g.logger=Xr,g.resourceStore=this.store,g.languageUtils=d,g.pluralResolver=new tR(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),h&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(g.formatter=n(h),g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new rR(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new aR(n(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",function(v){for(var y=arguments.length,b=new Array(y>1?y-1:0),E=1;E<y;E++)b[E-1]=arguments[E];e.emit(v,...b)}),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 lo(this.services,this.options),this.translator.on("*",function(v){for(var y=arguments.length,b=new Array(y>1?y-1:0),E=1;E<y;E++)b[E-1]=arguments[E];e.emit(v,...b)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ka),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[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(h=>{this[h]=function(){return e.store[h](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=function(){return e.store[h](...arguments),e}});const l=En(),u=()=>{const h=(d,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),r(d,g)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ka;const s=typeof e=="string"?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();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)})};s?a(s):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),r(o)})}else r(null)}reloadResources(e,t,r){const s=En();return e||(e=this.languages),t||(t=this.options.ns),r||(r=ka),this.services.backendConnector.reload(e,t,n=>{s.resolve(),r(n)}),s}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"&&i0.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 r=this.languages[t];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,t){var r=this;this.isLanguageChangingTo=e;const s=En();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,s.resolve(function(){return r.t(...arguments)}),t&&t(l,function(){return r.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,h=>{a(h,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),s}getFixedT(e,t,r){var s=this;const n=function(a,o){let l;if(typeof o!="object"){for(var u=arguments.length,h=new Array(u>2?u-2:0),d=2;d<u;d++)h[d-2]=arguments[d];l=s.options.overloadTranslationOptionHandler([a,o].concat(h))}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||r||n.keyPrefix;const g=s.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,s.t(v,l)};return typeof e=="string"?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=r,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 r=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,e)&&(!s||a(n,e)))}loadNamespaces(e,t){const r=En();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),t&&t(s)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=En();typeof e=="string"&&(e=[e]);const s=this.options.preload||[],n=e.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return n.length?(this.options.preload=s.concat(n),this.loadResources(a=>{r.resolve(),t&&t(a)}),r):(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"],r=this.services&&this.services.languageUtils||new Fd($d());return t.indexOf(r.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 qn(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ka;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const s={...this.options,...e,isClone:!0},n=new qn(s);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)},r&&(n.store=new Od(this.store.data,s),n.services.resourceStore=n.store),n.translator=new lo(n.services,s),n.translator.on("*",function(o){for(var l=arguments.length,u=new Array(l>1?l-1:0),h=1;h<l;h++)u[h-1]=arguments[h];n.emit(o,...u)}),n.init(s,t),n.translator.options=s,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 Ht=qn.createInstance();Ht.createInstance=qn.createInstance;Ht.createInstance;Ht.dir;Ht.init;Ht.loadResources;Ht.reloadResources;Ht.use;Ht.changeLanguage;Ht.getFixedT;Ht.t;Ht.exists;Ht.setDefaultNamespace;Ht.hasLoadedNamespace;Ht.loadNamespaces;Ht.loadLanguages;function lR(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Yn(i){"@babel/helpers - typeof";return Yn=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},Yn(i)}function cR(i,e){if(Yn(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e);if(Yn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function uR(i){var e=cR(i,"string");return Yn(e)=="symbol"?e:e+""}function hR(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,uR(r.key),r)}}function fR(i,e,t){return e&&hR(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}var s0=[],dR=s0.forEach,pR=s0.slice;function gR(i){return dR.call(pR.call(arguments,1),function(e){if(e)for(var t in e)i[t]===void 0&&(i[t]=e[t])}),i}var Gd=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,mR=function(e,t,r){var s=r||{};s.path=s.path||"/";var n=encodeURIComponent(t),a="".concat(e,"=").concat(n);if(s.maxAge>0){var o=s.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(o))}if(s.domain){if(!Gd.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!Gd.test(s.path))throw new TypeError("option path is invalid");a+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite){var l=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.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},Vd={create:function(e,t,r,s){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(n.expires=new Date,n.expires.setTime(n.expires.getTime()+r*60*1e3)),s&&(n.domain=s),document.cookie=mR(e,encodeURIComponent(t),n)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),s=0;s<r.length;s++){for(var n=r[s];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)}},vR={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&typeof document<"u"){var r=Vd.read(e.lookupCookie);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&typeof document<"u"&&Vd.create(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},yR={name:"querystring",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var s=r.substring(1),n=s.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}},Tn=null,jd=function(){if(Tn!==null)return Tn;try{Tn=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Tn=!1}return Tn},SR={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&jd()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&jd()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},wn=null,Hd=function(){if(wn!==null)return wn;try{wn=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{wn=!1}return wn},xR={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&Hd()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&Hd()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},bR={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r<navigator.languages.length;r++)t.push(navigator.languages[r]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},ER={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},TR={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},wR={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=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(r)return r[t]}};function AR(){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 n0=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};lR(this,i),this.type="languageDetector",this.detectors={},this.init(e,t)}return fR(i,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=gR(r,this.options||{},AR()),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=s,this.addDetector(vR),this.addDetector(yR),this.addDetector(SR),this.addDetector(xR),this.addDetector(bR),this.addDetector(ER),this.addDetector(TR),this.addDetector(wR)}},{key:"addDetector",value:function(t){return this.detectors[t.name]=t,this}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var s=[];return t.forEach(function(n){if(r.detectors[n]){var a=r.detectors[n].lookup(r.options);a&&typeof a=="string"&&(a=[a]),a&&(s=s.concat(a))}}),s=s.map(function(n){return r.options.convertDetectedLanguage(n)}),this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var s=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(n){s.detectors[n]&&s.detectors[n].cacheUserLanguage(t,s.options)}))}}]),i}();n0.type="languageDetector";const _R={en:{translation:{chapter:"chapter",close:"close",soldout:"soldeout",currency:"USD",more:"more",entrace:"entrance",rehearsal:"rehearsal",live:"live",relive:"relive",converting:"converting",cancel:"cancel",ready:"ready",change_view_mode:"change view mode",enter_broadcast:"enter broadcast",sentence:{"Enter your four-digit entry code":"Enter your four-digit entry code","The entry code does not match":"The entry code does not match"}}},ko:{translation:{chapter:"챕터",close:"닫기",soldout:"품절",currency:"원",more:"더보기",entrace:"입장",rehearsal:"리허설",live:"live",relive:"relive",converting:"변환중",cancel:"방송취소",ready:"방송예정",change_view_mode:"시청모드 변경",enter_broadcast:"방송 입장",sentence:{"Enter your four-digit entry code":"입장코드 네 자리를 입력하세요.","The entry code does not match":"입장코드가 일치하지 않습니다."}}}};Ht.use(n0).init({resources:_R,detection:{order:["navigator","localStorage"]},fallbackLng:"ko",debug:!1,interpolation:{escapeValue:!1}});function CR({currentTime:i=0,durationTime:e=0,className:t}){return Ye.jsxs("div",{className:`${NL.root} ${t||""}`,children:[Ye.jsx("div",{children:Id(i)}),Ye.jsx("div",{children:Id(e)})]})}const LR="_root_1iegb_2",RR="_pip_1iegb_10",IR="_mute_1iegb_16",PR="_unmute_1iegb_22",kR="_share_1iegb_28",DR="_setting_1iegb_34",OR="_close_1iegb_40",MR="_coupon_1iegb_47",FR="_like_1iegb_53",NR="_notice_1iegb_59",BR="_chat_1iegb_65",$R="_comment_1iegb_71",UR="_product_1iegb_77",GR="_event_1iegb_83",VR="_purchase_1iegb_90",jR="_close_pane_1iegb_96",HR="_close_pane_B_1iegb_102",KR="_back_1iegb_108",zR="_backward_1iegb_115",WR="_pause_1iegb_121",qR="_play_1iegb_127",YR="_forward_1iegb_133",XR="_left_1iegb_140",QR="_right_1iegb_146",JR="_converting_1iegb_153",ZR="_cancel_1iegb_159",eI="_sm_view_1iegb_166",tI="_sm_like_1iegb_172",rI="_sm_countdown_1iegb_178",iI="_sm_question_1iegb_184",sI="_sm_comment_1iegb_190",nI="_sm_more_1iegb_196",aI="_sm_fix_1iegb_202",oI="_chapter_shorts_1iegb_208",lI="_like_shorts_1iegb_214",cI="_comment_shorts_1iegb_220",uI="_share_shorts_1iegb_226",hI="_more_product_shorts_1iegb_232",fI="_close_drawer_shorts_1iegb_238",Kd={root:LR,pip:RR,mute:IR,unmute:PR,share:kR,setting:DR,close:OR,coupon:MR,like:FR,notice:NR,chat:BR,comment:$R,product:UR,event:GR,purchase:VR,close_pane:jR,close_pane_B:HR,back:KR,backward:zR,pause:WR,play:qR,forward:YR,left:XR,right:QR,converting:JR,cancel:ZR,sm_view:eI,sm_like:tI,sm_countdown:rI,sm_question:iI,sm_comment:sI,sm_more:nI,sm_fix:aI,chapter_shorts:oI,like_shorts:lI,comment_shorts:cI,share_shorts:uI,more_product_shorts:hI,close_drawer_shorts:fI};var a0={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},zd=ye.createContext&&ye.createContext(a0),dI=["attr","size","title"];function pI(i,e){if(i==null)return{};var t=gI(i,e),r,s;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(s=0;s<n.length;s++)r=n[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(i,r)&&(t[r]=i[r])}return t}function gI(i,e){if(i==null)return{};var t={};for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)){if(e.indexOf(r)>=0)continue;t[r]=i[r]}return t}function co(){return co=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},co.apply(this,arguments)}function Wd(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function uo(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wd(Object(t),!0).forEach(function(r){mI(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Wd(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function mI(i,e,t){return e=vI(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vI(i){var e=yI(i,"string");return typeof e=="symbol"?e:e+""}function yI(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function o0(i){return i&&i.map((e,t)=>ye.createElement(e.tag,uo({key:t},e.attr),o0(e.child)))}function bu(i){return e=>ye.createElement(SI,co({attr:uo({},i.attr)},e),o0(i.child))}function SI(i){var e=t=>{var{attr:r,size:s,title:n}=i,a=pI(i,dI),o=s||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),ye.createElement("svg",co({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,a,{className:l,style:uo(uo({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&ye.createElement("title",null,n),i.children)};return zd!==void 0?ye.createElement(zd.Consumer,null,t=>e(t)):e(a0)}function xI(i){return bu({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 bI(i){return bu({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 EI(i){return bu({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)}const qd={IoVolumeHigh:bI,IoVolumeMute:EI,IoPlay:xI};function kn({className:i,name:e,...t}){if(e in qd){const r=qd[e];return Ye.jsx(r,{className:i})}else return Ye.jsx("i",{className:[Kd.root,Kd[e],i].join(" "),...t})}var Ec={exports:{}};(function(i,e){typeof navigator<"u"&&function(t,r){i.exports=r()}(Y0,function(){var t="http://www.w3.org/2000/svg",r="",s=!1,n=-999999,a=function(f){s=!!f},o=function(){return s},l=function(f){r=f},u=function(){return r};function h(c){return document.createElement(c)}function d(c,f){var p,m=c.length,x;for(p=0;p<m;p+=1){x=c[p].prototype;for(var S in x)Object.prototype.hasOwnProperty.call(x,S)&&(f.prototype[S]=x[S])}}function g(c){function f(){}return f.prototype=c,f}var v=function(){function c(f){this.audios=[],this.audioFactory=f,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,x=this.audios.length;for(m=0;m<x;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 x=0,S=[],w;switch(p){case"int16":case"uint8c":w=1;break;default:w=1.1;break}for(x=0;x<m;x+=1)S.push(w);return S}function f(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"?f:c}();function b(c){return Array.apply(null,{length:c})}var E=!0,A=null,M="",D=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),B=Math.pow,N=Math.sqrt,J=Math.floor,Z=Math.min,se=150,Q=Math.PI/180,q=.5519;function oe(c,f,p,m){this.type=c,this.currentTime=f,this.totalTime=p,this.direction=m<0?-1:1}function ge(c,f){this.type=c,this.direction=f<0?-1:1}function he(c,f,p,m){this.type=c,this.currentLoop=p,this.totalLoops=f,this.direction=m<0?-1:1}function Ee(c,f,p){this.type=c,this.firstFrame=f,this.totalFrames=p}function Te(c,f){this.type=c,this.target=f}function ue(c,f){this.type="renderFrameError",this.nativeError=c,this.currentTime=f}function pe(c){this.type="configError",this.nativeError=c}var Ce=function(){var c=0;return function(){return c+=1,M+"__lottie_element_"+c}}();function me(c,f,p){var m,x,S,w,k,_,$,V;switch(w=Math.floor(c*6),k=c*6-w,_=p*(1-f),$=p*(1-k*f),V=p*(1-(1-k)*f),w%6){case 0:m=p,x=V,S=_;break;case 1:m=$,x=p,S=_;break;case 2:m=_,x=p,S=V;break;case 3:m=_,x=$,S=p;break;case 4:m=V,x=_,S=p;break;case 5:m=p,x=_,S=$;break}return[m,x,S]}function Se(c,f,p){var m=Math.max(c,f,p),x=Math.min(c,f,p),S=m-x,w,k=m===0?0:S/m,_=m/255;switch(m){case x:w=0;break;case c:w=f-p+S*(f<p?6:0),w/=6*S;break;case f:w=p-c+S*2,w/=6*S;break;case p:w=c-f+S*4,w/=6*S;break}return[w,k,_]}function We(c,f){var p=Se(c[0]*255,c[1]*255,c[2]*255);return p[1]+=f,p[1]>1?p[1]=1:p[1]<=0&&(p[1]=0),me(p[0],p[1],p[2])}function $e(c,f){var p=Se(c[0]*255,c[1]*255,c[2]*255);return p[2]+=f,p[2]>1?p[2]=1:p[2]<0&&(p[2]=0),me(p[0],p[1],p[2])}function Xe(c,f){var p=Se(c[0]*255,c[1]*255,c[2]*255);return p[0]+=f/360,p[0]>1?p[0]-=1:p[0]<0&&(p[0]+=1),me(p[0],p[1],p[2])}(function(){var c=[],f,p;for(f=0;f<256;f+=1)p=f.toString(16),c[f]=p.length===1?"0"+p:p;return function(m,x,S){return m<0&&(m=0),x<0&&(x=0),S<0&&(S=0),"#"+c[m]+c[x]+c[S]}})();var rt=function(f){E=!!f},et=function(){return E},ot=function(f){A=f},Je=function(){return A},vt=function(f){se=f},Rt=function(){return se},Sr=function(f){M=f};function ke(c){return document.createElementNS(t,c)}function hr(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hr=function(p){return typeof p}:hr=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},hr(c)}var sr=function(){var c=1,f=[],p,m,x={onmessage:function(){},postMessage:function(j){p({data:j})}},S={postMessage:function(j){x.onmessage({data:j})}};function w(I){if(window.Worker&&window.Blob&&o()){var j=new Blob(["var _workerSelf = self; self.onmessage = ",I.toString()],{type:"text/javascript"}),W=URL.createObjectURL(j);return new Worker(W)}return p=I,x}function k(){m||(m=w(function(j){function W(){function ee(ve,O){var K,T,L=ve.length,ne,X,Le,Ne;for(T=0;T<L;T+=1)if(K=ve[T],"ks"in K&&!K.completed){if(K.completed=!0,K.hasMask){var He=K.masksProperties;for(X=He.length,ne=0;ne<X;ne+=1)if(He[ne].pt.k.i)U(He[ne].pt.k);else for(Ne=He[ne].pt.k.length,Le=0;Le<Ne;Le+=1)He[ne].pt.k[Le].s&&U(He[ne].pt.k[Le].s[0]),He[ne].pt.k[Le].e&&U(He[ne].pt.k[Le].e[0])}K.ty===0?(K.layers=R(K.refId,O),ee(K.layers,O)):K.ty===4?P(K.shapes):K.ty===5&&qe(K)}}function G(ve,O){if(ve){var K=0,T=ve.length;for(K=0;K<T;K+=1)ve[K].t===1&&(ve[K].data.layers=R(ve[K].data.refId,O),ee(ve[K].data.layers,O))}}function F(ve,O){for(var K=0,T=O.length;K<T;){if(O[K].id===ve)return O[K];K+=1}return null}function R(ve,O){var K=F(ve,O);return K?K.layers.__used?JSON.parse(JSON.stringify(K.layers)):(K.layers.__used=!0,K.layers):null}function P(ve){var O,K=ve.length,T,L;for(O=K-1;O>=0;O-=1)if(ve[O].ty==="sh")if(ve[O].ks.k.i)U(ve[O].ks.k);else for(L=ve[O].ks.k.length,T=0;T<L;T+=1)ve[O].ks.k[T].s&&U(ve[O].ks.k[T].s[0]),ve[O].ks.k[T].e&&U(ve[O].ks.k[T].e[0]);else ve[O].ty==="gr"&&P(ve[O].it)}function U(ve){var O,K=ve.i.length;for(O=0;O<K;O+=1)ve.i[O][0]+=ve.v[O][0],ve.i[O][1]+=ve.v[O][1],ve.o[O][0]+=ve.v[O][0],ve.o[O][1]+=ve.v[O][1]}function Y(ve,O){var K=O?O.split("."):[100,100,100];return ve[0]>K[0]?!0:K[0]>ve[0]?!1:ve[1]>K[1]?!0:K[1]>ve[1]?!1:ve[2]>K[2]?!0:K[2]>ve[2]?!1:null}var te=function(){var ve=[4,4,14];function O(T){var L=T.t.d;T.t.d={k:[{s:L,t:0}]}}function K(T){var L,ne=T.length;for(L=0;L<ne;L+=1)T[L].ty===5&&O(T[L])}return function(T){if(Y(ve,T.v)&&(K(T.layers),T.assets)){var L,ne=T.assets.length;for(L=0;L<ne;L+=1)T.assets[L].layers&&K(T.assets[L].layers)}}}(),ae=function(){var ve=[4,7,99];return function(O){if(O.chars&&!Y(ve,O.v)){var K,T=O.chars.length;for(K=0;K<T;K+=1){var L=O.chars[K];L.data&&L.data.shapes&&(P(L.data.shapes),L.data.ip=0,L.data.op=99999,L.data.st=0,L.data.sr=1,L.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}},O.chars[K].t||(L.data.shapes.push({ty:"no"}),L.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"})))}}}}(),xe=function(){var ve=[5,7,15];function O(T){var L=T.t.p;typeof L.a=="number"&&(L.a={a:0,k:L.a}),typeof L.p=="number"&&(L.p={a:0,k:L.p}),typeof L.r=="number"&&(L.r={a:0,k:L.r})}function K(T){var L,ne=T.length;for(L=0;L<ne;L+=1)T[L].ty===5&&O(T[L])}return function(T){if(Y(ve,T.v)&&(K(T.layers),T.assets)){var L,ne=T.assets.length;for(L=0;L<ne;L+=1)T.assets[L].layers&&K(T.assets[L].layers)}}}(),je=function(){var ve=[4,1,9];function O(T){var L,ne=T.length,X,Le;for(L=0;L<ne;L+=1)if(T[L].ty==="gr")O(T[L].it);else if(T[L].ty==="fl"||T[L].ty==="st")if(T[L].c.k&&T[L].c.k[0].i)for(Le=T[L].c.k.length,X=0;X<Le;X+=1)T[L].c.k[X].s&&(T[L].c.k[X].s[0]/=255,T[L].c.k[X].s[1]/=255,T[L].c.k[X].s[2]/=255,T[L].c.k[X].s[3]/=255),T[L].c.k[X].e&&(T[L].c.k[X].e[0]/=255,T[L].c.k[X].e[1]/=255,T[L].c.k[X].e[2]/=255,T[L].c.k[X].e[3]/=255);else T[L].c.k[0]/=255,T[L].c.k[1]/=255,T[L].c.k[2]/=255,T[L].c.k[3]/=255}function K(T){var L,ne=T.length;for(L=0;L<ne;L+=1)T[L].ty===4&&O(T[L].shapes)}return function(T){if(Y(ve,T.v)&&(K(T.layers),T.assets)){var L,ne=T.assets.length;for(L=0;L<ne;L+=1)T.assets[L].layers&&K(T.assets[L].layers)}}}(),De=function(){var ve=[4,4,18];function O(T){var L,ne=T.length,X,Le;for(L=ne-1;L>=0;L-=1)if(T[L].ty==="sh")if(T[L].ks.k.i)T[L].ks.k.c=T[L].closed;else for(Le=T[L].ks.k.length,X=0;X<Le;X+=1)T[L].ks.k[X].s&&(T[L].ks.k[X].s[0].c=T[L].closed),T[L].ks.k[X].e&&(T[L].ks.k[X].e[0].c=T[L].closed);else T[L].ty==="gr"&&O(T[L].it)}function K(T){var L,ne,X=T.length,Le,Ne,He,st;for(ne=0;ne<X;ne+=1){if(L=T[ne],L.hasMask){var nt=L.masksProperties;for(Ne=nt.length,Le=0;Le<Ne;Le+=1)if(nt[Le].pt.k.i)nt[Le].pt.k.c=nt[Le].cl;else for(st=nt[Le].pt.k.length,He=0;He<st;He+=1)nt[Le].pt.k[He].s&&(nt[Le].pt.k[He].s[0].c=nt[Le].cl),nt[Le].pt.k[He].e&&(nt[Le].pt.k[He].e[0].c=nt[Le].cl)}L.ty===4&&O(L.shapes)}}return function(T){if(Y(ve,T.v)&&(K(T.layers),T.assets)){var L,ne=T.assets.length;for(L=0;L<ne;L+=1)T.assets[L].layers&&K(T.assets[L].layers)}}}();function Ae(ve){ve.__complete||(je(ve),te(ve),ae(ve),xe(ve),De(ve),ee(ve.layers,ve.assets),G(ve.chars,ve.assets),ve.__complete=!0)}function qe(ve){ve.t.a.length===0&&"m"in ve.t.p}var Ie={};return Ie.completeData=Ae,Ie.checkColors=je,Ie.checkChars=ae,Ie.checkPathProperties=xe,Ie.checkShapes=De,Ie.completeLayers=ee,Ie}if(S.dataManager||(S.dataManager=W()),S.assetLoader||(S.assetLoader=function(){function ee(F){var R=F.getResponseHeader("content-type");return R&&F.responseType==="json"&&R.indexOf("json")!==-1||F.response&&hr(F.response)==="object"?F.response:F.response&&typeof F.response=="string"?JSON.parse(F.response):F.responseText?JSON.parse(F.responseText):null}function G(F,R,P,U){var Y,te=new XMLHttpRequest;try{te.responseType="json"}catch{}te.onreadystatechange=function(){if(te.readyState===4)if(te.status===200)Y=ee(te),P(Y);else try{Y=ee(te),P(Y)}catch(ae){U&&U(ae)}};try{te.open(["G","E","T"].join(""),F,!0)}catch{te.open(["G","E","T"].join(""),R+"/"+F,!0)}te.send()}return{load:G}}()),j.data.type==="loadAnimation")S.assetLoader.load(j.data.path,j.data.fullPath,function(ee){S.dataManager.completeData(ee),S.postMessage({id:j.data.id,payload:ee,status:"success"})},function(){S.postMessage({id:j.data.id,status:"error"})});else if(j.data.type==="complete"){var H=j.data.animation;S.dataManager.completeData(H),S.postMessage({id:j.data.id,payload:H,status:"success"})}else j.data.type==="loadData"&&S.assetLoader.load(j.data.path,j.data.fullPath,function(ee){S.postMessage({id:j.data.id,payload:ee,status:"success"})},function(){S.postMessage({id:j.data.id,status:"error"})})}),m.onmessage=function(I){var j=I.data,W=j.id,H=f[W];f[W]=null,j.status==="success"?H.onComplete(j.payload):H.onError&&H.onError()})}function _(I,j){c+=1;var W="processId_"+c;return f[W]={onComplete:I,onError:j},W}function $(I,j,W){k();var H=_(j,W);m.postMessage({type:"loadAnimation",path:I,fullPath:window.location.origin+window.location.pathname,id:H})}function V(I,j,W){k();var H=_(j,W);m.postMessage({type:"loadData",path:I,fullPath:window.location.origin+window.location.pathname,id:H})}function re(I,j,W){k();var H=_(j,W);m.postMessage({type:"complete",animation:I,id:H})}return{loadAnimation:$,loadData:V,completeAnimation:re}}(),$i=function(){var c=function(){var G=h("canvas");G.width=1,G.height=1;var F=G.getContext("2d");return F.fillStyle="rgba(0,0,0,0)",F.fillRect(0,0,1,1),G}();function f(){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,F,R){var P="";if(G.e)P=G.p;else if(F){var U=G.p;U.indexOf("images/")!==-1&&(U=U.split("/")[1]),P=F+U}else P=R,P+=G.u?G.u:"",P+=G.p;return P}function x(G){var F=0,R=setInterval((function(){var P=G.getBBox();(P.width||F>500)&&(this._imageLoaded(),clearInterval(R)),F+=1}).bind(this),50)}function S(G){var F=m(G,this.assetsPath,this.path),R=ke("image");D?this.testImageLoaded(R):R.addEventListener("load",this._imageLoaded,!1),R.addEventListener("error",(function(){P.img=c,this._imageLoaded()}).bind(this),!1),R.setAttributeNS("http://www.w3.org/1999/xlink","href",F),this._elementHelper.append?this._elementHelper.append(R):this._elementHelper.appendChild(R);var P={img:R,assetData:G};return P}function w(G){var F=m(G,this.assetsPath,this.path),R=h("img");R.crossOrigin="anonymous",R.addEventListener("load",this._imageLoaded,!1),R.addEventListener("error",(function(){P.img=c,this._imageLoaded()}).bind(this),!1),R.src=F;var P={img:R,assetData:G};return P}function k(G){var F={assetData:G},R=m(G,this.assetsPath,this.path);return sr.loadData(R,(function(P){F.img=P,this._footageLoaded()}).bind(this),(function(){F.img={},this._footageLoaded()}).bind(this)),F}function _(G,F){this.imagesLoadedCb=F;var R,P=G.length;for(R=0;R<P;R+=1)G[R].layers||(!G[R].t||G[R].t==="seq"?(this.totalImages+=1,this.images.push(this._createImageData(G[R]))):G[R].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(G[R]))))}function $(G){this.path=G||""}function V(G){this.assetsPath=G||""}function re(G){for(var F=0,R=this.images.length;F<R;){if(this.images[F].assetData===G)return this.images[F].img;F+=1}return null}function I(){this.imagesLoadedCb=null,this.images.length=0}function j(){return this.totalImages===this.loadedAssets}function W(){return this.totalFootages===this.loadedFootagesCount}function H(G,F){G==="svg"?(this._elementHelper=F,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function ee(){this._imageLoaded=f.bind(this),this._footageLoaded=p.bind(this),this.testImageLoaded=x.bind(this),this.createFootageData=k.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return ee.prototype={loadAssets:_,setAssetsPath:V,setPath:$,loadedImages:j,loadedFootages:W,destroy:I,getAsset:re,createImgData:w,createImageData:S,imageLoaded:f,footageLoaded:p,setCacheType:H},ee}();function Ui(){}Ui.prototype={triggerEvent:function(f,p){if(this._cbs[f])for(var m=this._cbs[f],x=0;x<m.length;x+=1)m[x](p)},addEventListener:function(f,p){return this._cbs[f]||(this._cbs[f]=[]),this._cbs[f].push(p),(function(){this.removeEventListener(f,p)}).bind(this)},removeEventListener:function(f,p){if(!p)this._cbs[f]=null;else if(this._cbs[f]){for(var m=0,x=this._cbs[f].length;m<x;)this._cbs[f][m]===p&&(this._cbs[f].splice(m,1),m-=1,x-=1),m+=1;this._cbs[f].length||(this._cbs[f]=null)}}};var Zr=function(){function c(f){for(var p=f.split(`\r
137
+ `),m={},x,S=0,w=0;w<p.length;w+=1)x=p[w].split(":"),x.length===2&&(m[x[0]]=x[1].trim(),S+=1);if(S===0)throw new Error;return m}return function(f){for(var p=[],m=0;m<f.length;m+=1){var x=f[m],S={time:x.tm,duration:x.dr};try{S.payload=JSON.parse(f[m].cm)}catch{try{S.payload=c(f[m].cm)}catch{S.payload={name:f[m].cm}}}p.push(S)}return p}}(),Gi=function(){function c(f){this.compositions.push(f)}return function(){function f(p){for(var m=0,x=this.compositions.length;m<x;){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 f.compositions=[],f.currentFrame=0,f.registerComposition=c,f}}(),xr={},ei=function(f,p){xr[f]=p};function vi(c){return xr[c]}function Dr(){if(xr.canvas)return"canvas";for(var c in xr)if(xr[c])return c;return""}function br(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?br=function(p){return typeof p}:br=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},br(c)}var Oe=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=Ce(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=et(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=Gi(),this.imagePreloader=new $i,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 oe("drawnFrame",0,0,0),this.expressionsPlugin=Je()};d([Ui],Oe),Oe.prototype.setParams=function(c){(c.wrapper||c.container)&&(this.wrapper=c.wrapper||c.container);var f="svg";c.animType?f=c.animType:c.renderer&&(f=c.renderer);var p=vi(f);this.renderer=new p(this,c.rendererSettings),this.imagePreloader.setCacheType(f,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=f,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")),sr.loadAnimation(c.path,this.configAnimation,this.onSetupError))},Oe.prototype.onSetupError=function(){this.trigger("data_failed")},Oe.prototype.setupAnimation=function(c){sr.completeAnimation(c,this.configAnimation)},Oe.prototype.setData=function(c,f){f&&br(f)!=="object"&&(f=JSON.parse(f));var p={wrapper:c,animationData:f},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:Dr()||"canvas";var x=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:"";x==="false"?p.loop=!1:x==="true"?p.loop=!0:x!==""&&(p.loop=parseInt(x,10));var S=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=S!=="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 w=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:"";w==="false"&&(p.prerender=!1),p.path?this.setParams(p):this.trigger("destroy")},Oe.prototype.includeLayers=function(c){c.op>this.animationData.op&&(this.animationData.op=c.op,this.totalFrames=Math.floor(c.op-this.animationData.ip));var f=this.animationData.layers,p,m=f.length,x=c.layers,S,w=x.length;for(S=0;S<w;S+=1)for(p=0;p<m;){if(f[p].id===x[S].id){f[p]=x[S];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,sr.completeAnimation(this.animationData,this.onSegmentComplete)},Oe.prototype.onSegmentComplete=function(c){this.animationData=c;var f=Je();f&&f.initExpressions(this),this.loadNextSegment()},Oe.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 f=c.shift();this.timeCompleted=f.time*this.frameRate;var p=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,sr.loadData(p,this.includeLayers.bind(this),(function(){this.trigger("data_failed")}).bind(this))},Oe.prototype.loadSegments=function(){var c=this.animationData.segments;c||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},Oe.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},Oe.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},Oe.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=Zr(c.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(f){this.triggerConfigError(f)}},Oe.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},Oe.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()}},Oe.prototype.resize=function(c,f){var p=typeof c=="number"?c:void 0,m=typeof f=="number"?f:void 0;this.renderer.updateContainerSize(p,m)},Oe.prototype.setSubframe=function(c){this.isSubframeEnabled=!!c},Oe.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")},Oe.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)}},Oe.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")))},Oe.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())},Oe.prototype.togglePause=function(c){c&&this.name!==c||(this.isPaused===!0?this.play():this.pause())},Oe.prototype.stop=function(c){c&&this.name!==c||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},Oe.prototype.getMarkerData=function(c){for(var f,p=0;p<this.markers.length;p+=1)if(f=this.markers[p],f.payload&&f.payload.name===c)return f;return null},Oe.prototype.goToAndStop=function(c,f,p){if(!(p&&this.name!==p)){var m=Number(c);if(isNaN(m)){var x=this.getMarkerData(c);x&&this.goToAndStop(x.time,!0)}else f?this.setCurrentRawFrameValue(c):this.setCurrentRawFrameValue(c*this.frameModifier);this.pause()}},Oe.prototype.goToAndPlay=function(c,f,p){if(!(p&&this.name!==p)){var m=Number(c);if(isNaN(m)){var x=this.getMarkerData(c);x&&(x.duration?this.playSegments([x.time,x.time+x.duration],!0):this.goToAndStop(x.time,!0))}else this.goToAndStop(m,f,p);this.play()}},Oe.prototype.advanceTime=function(c){if(!(this.isPaused===!0||this.isLoaded===!1)){var f=this.currentRawFrame+c*this.frameModifier,p=!1;f>=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(f>this.totalFrames?f%this.totalFrames:0)||(p=!0,f=this.totalFrames-1):f>=this.totalFrames?(this.playCount+=1,this.checkSegments(f%this.totalFrames)||(this.setCurrentRawFrameValue(f%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(f):f<0?this.checkSegments(f%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+f%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(p=!0,f=0)):this.setCurrentRawFrameValue(f),p&&(this.setCurrentRawFrameValue(f),this.pause(),this.trigger("complete"))}},Oe.prototype.adjustSegment=function(c,f){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-f)):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+f)),this.trigger("segmentStart")},Oe.prototype.setSegment=function(c,f){var p=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<c?p=c:this.currentRawFrame+this.firstFrame>f&&(p=f-c)),this.firstFrame=c,this.totalFrames=f-c,this.timeCompleted=this.totalFrames,p!==-1&&this.goToAndStop(p,!0)},Oe.prototype.playSegments=function(c,f){if(f&&(this.segments.length=0),br(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&&f&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},Oe.prototype.resetSegments=function(c){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),c&&this.checkSegments(0)},Oe.prototype.checkSegments=function(c){return this.segments.length?(this.adjustSegment(this.segments.shift(),c),!0):!1},Oe.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)},Oe.prototype.setCurrentRawFrameValue=function(c){this.currentRawFrame=c,this.gotoFrame()},Oe.prototype.setSpeed=function(c){this.playSpeed=c,this.updaFrameModifier()},Oe.prototype.setDirection=function(c){this.playDirection=c<0?-1:1,this.updaFrameModifier()},Oe.prototype.setLoop=function(c){this.loop=c},Oe.prototype.setVolume=function(c,f){f&&this.name!==f||this.audioController.setVolume(c)},Oe.prototype.getVolume=function(){return this.audioController.getVolume()},Oe.prototype.mute=function(c){c&&this.name!==c||this.audioController.mute()},Oe.prototype.unmute=function(c){c&&this.name!==c||this.audioController.unmute()},Oe.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},Oe.prototype.getPath=function(){return this.path},Oe.prototype.getAssetsPath=function(c){var f="";if(c.e)f=c.p;else if(this.assetsPath){var p=c.p;p.indexOf("images/")!==-1&&(p=p.split("/")[1]),f=this.assetsPath+p}else f=this.path,f+=c.u?c.u:"",f+=c.p;return f},Oe.prototype.getAssetData=function(c){for(var f=0,p=this.assets.length;f<p;){if(c===this.assets[f].id)return this.assets[f];f+=1}return null},Oe.prototype.hide=function(){this.renderer.hide()},Oe.prototype.show=function(){this.renderer.show()},Oe.prototype.getDuration=function(c){return c?this.totalFrames:this.totalFrames/this.frameRate},Oe.prototype.updateDocumentData=function(c,f,p){try{var m=this.renderer.getElementByPath(c);m.updateDocumentData(f,p)}catch{}},Oe.prototype.trigger=function(c){if(this._cbs&&this._cbs[c])switch(c){case"enterFrame":this.triggerEvent(c,new oe(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 he(c,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(c,new ge(c,this.frameMult));break;case"segmentStart":this.triggerEvent(c,new Ee(c,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(c,new Te(c,this));break;default:this.triggerEvent(c)}c==="enterFrame"&&this.onEnterFrame&&this.onEnterFrame.call(this,new oe(c,this.currentFrame,this.totalFrames,this.frameMult)),c==="loopComplete"&&this.onLoopComplete&&this.onLoopComplete.call(this,new he(c,this.loop,this.playCount,this.frameMult)),c==="complete"&&this.onComplete&&this.onComplete.call(this,new ge(c,this.frameMult)),c==="segmentStart"&&this.onSegmentStart&&this.onSegmentStart.call(this,new Ee(c,this.firstFrame,this.totalFrames)),c==="destroy"&&this.onDestroy&&this.onDestroy.call(this,new Te(c,this))},Oe.prototype.triggerRenderFrameError=function(c){var f=new ue(c,this.currentFrame);this.triggerEvent("error",f),this.onError&&this.onError.call(this,f)},Oe.prototype.triggerConfigError=function(c){var f=new pe(c,this.currentFrame);this.triggerEvent("error",f),this.onError&&this.onError.call(this,f)};var St=function(){var c={},f=[],p=0,m=0,x=0,S=!0,w=!1;function k(O){for(var K=0,T=O.target;K<m;)f[K].animation===T&&(f.splice(K,1),K-=1,m-=1,T.isPaused||re()),K+=1}function _(O,K){if(!O)return null;for(var T=0;T<m;){if(f[T].elem===O&&f[T].elem!==null)return f[T].animation;T+=1}var L=new Oe;return I(L,O),L.setData(O,K),L}function $(){var O,K=f.length,T=[];for(O=0;O<K;O+=1)T.push(f[O].animation);return T}function V(){x+=1,je()}function re(){x-=1}function I(O,K){O.addEventListener("destroy",k),O.addEventListener("_active",V),O.addEventListener("_idle",re),f.push({elem:K,animation:O}),m+=1}function j(O){var K=new Oe;return I(K,null),K.setParams(O),K}function W(O,K){var T;for(T=0;T<m;T+=1)f[T].animation.setSpeed(O,K)}function H(O,K){var T;for(T=0;T<m;T+=1)f[T].animation.setDirection(O,K)}function ee(O){var K;for(K=0;K<m;K+=1)f[K].animation.play(O)}function G(O){var K=O-p,T;for(T=0;T<m;T+=1)f[T].animation.advanceTime(K);p=O,x&&!w?window.requestAnimationFrame(G):S=!0}function F(O){p=O,window.requestAnimationFrame(G)}function R(O){var K;for(K=0;K<m;K+=1)f[K].animation.pause(O)}function P(O,K,T){var L;for(L=0;L<m;L+=1)f[L].animation.goToAndStop(O,K,T)}function U(O){var K;for(K=0;K<m;K+=1)f[K].animation.stop(O)}function Y(O){var K;for(K=0;K<m;K+=1)f[K].animation.togglePause(O)}function te(O){var K;for(K=m-1;K>=0;K-=1)f[K].animation.destroy(O)}function ae(O,K,T){var L=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),ne,X=L.length;for(ne=0;ne<X;ne+=1)T&&L[ne].setAttribute("data-bm-type",T),_(L[ne],O);if(K&&X===0){T||(T="svg");var Le=document.getElementsByTagName("body")[0];Le.innerText="";var Ne=h("div");Ne.style.width="100%",Ne.style.height="100%",Ne.setAttribute("data-bm-type",T),Le.appendChild(Ne),_(Ne,O)}}function xe(){var O;for(O=0;O<m;O+=1)f[O].animation.resize()}function je(){!w&&x&&S&&(window.requestAnimationFrame(F),S=!1)}function De(){w=!0}function Ae(){w=!1,je()}function qe(O,K){var T;for(T=0;T<m;T+=1)f[T].animation.setVolume(O,K)}function Ie(O){var K;for(K=0;K<m;K+=1)f[K].animation.mute(O)}function ve(O){var K;for(K=0;K<m;K+=1)f[K].animation.unmute(O)}return c.registerAnimation=_,c.loadAnimation=j,c.setSpeed=W,c.setDirection=H,c.play=ee,c.pause=R,c.stop=U,c.togglePause=Y,c.searchAnimations=ae,c.resize=xe,c.goToAndStop=P,c.destroy=te,c.freeze=De,c.unfreeze=Ae,c.setVolume=qe,c.mute=Ie,c.unmute=ve,c.getRegisteredAnimations=$,c}(),Or=function(){var c={};c.getBezierEasing=p;var f={};function p(F,R,P,U,Y){var te=Y||("bez_"+F+"_"+R+"_"+P+"_"+U).replace(/\./g,"p");if(f[te])return f[te];var ae=new G([F,R,P,U]);return f[te]=ae,ae}var m=4,x=.001,S=1e-7,w=10,k=11,_=1/(k-1),$=typeof Float32Array=="function";function V(F,R){return 1-3*R+3*F}function re(F,R){return 3*R-6*F}function I(F){return 3*F}function j(F,R,P){return((V(R,P)*F+re(R,P))*F+I(R))*F}function W(F,R,P){return 3*V(R,P)*F*F+2*re(R,P)*F+I(R)}function H(F,R,P,U,Y){var te,ae,xe=0;do ae=R+(P-R)/2,te=j(ae,U,Y)-F,te>0?P=ae:R=ae;while(Math.abs(te)>S&&++xe<w);return ae}function ee(F,R,P,U){for(var Y=0;Y<m;++Y){var te=W(R,P,U);if(te===0)return R;var ae=j(R,P,U)-F;R-=ae/te}return R}function G(F){this._p=F,this._mSampleValues=$?new Float32Array(k):new Array(k),this._precomputed=!1,this.get=this.get.bind(this)}return G.prototype={get:function(R){var P=this._p[0],U=this._p[1],Y=this._p[2],te=this._p[3];return this._precomputed||this._precompute(),P===U&&Y===te?R:R===0?0:R===1?1:j(this._getTForX(R),U,te)},_precompute:function(){var R=this._p[0],P=this._p[1],U=this._p[2],Y=this._p[3];this._precomputed=!0,(R!==P||U!==Y)&&this._calcSampleValues()},_calcSampleValues:function(){for(var R=this._p[0],P=this._p[2],U=0;U<k;++U)this._mSampleValues[U]=j(U*_,R,P)},_getTForX:function(R){for(var P=this._p[0],U=this._p[2],Y=this._mSampleValues,te=0,ae=1,xe=k-1;ae!==xe&&Y[ae]<=R;++ae)te+=_;--ae;var je=(R-Y[ae])/(Y[ae+1]-Y[ae]),De=te+je*_,Ae=W(De,P,U);return Ae>=x?ee(R,De,P,U):Ae===0?De:H(R,te,te+_,P,U)}},c}(),cs=function(){function c(f){return f.concat(b(f.length))}return{double:c}}(),us=function(){return function(c,f,p){var m=0,x=c,S=b(x),w={newElement:k,release:_};function k(){var $;return m?(m-=1,$=S[m]):$=f(),$}function _($){m===x&&(S=cs.double(S),x*=2),p&&p($),S[m]=$,m+=1}return w}}(),Jn=function(){function c(){return{addedLength:0,percents:y("float32",Rt()),lengths:y("float32",Rt())}}return us(8,c)}(),Zn=function(){function c(){return{lengths:[],totalLength:0}}function f(p){var m,x=p.lengths.length;for(m=0;m<x;m+=1)Jn.release(p.lengths[m]);p.lengths.length=0}return us(8,c,f)}();function To(){var c=Math;function f(I,j,W,H,ee,G){var F=I*H+j*ee+W*G-ee*H-G*I-W*j;return F>-.001&&F<.001}function p(I,j,W,H,ee,G,F,R,P){if(W===0&&G===0&&P===0)return f(I,j,H,ee,F,R);var U=c.sqrt(c.pow(H-I,2)+c.pow(ee-j,2)+c.pow(G-W,2)),Y=c.sqrt(c.pow(F-I,2)+c.pow(R-j,2)+c.pow(P-W,2)),te=c.sqrt(c.pow(F-H,2)+c.pow(R-ee,2)+c.pow(P-G,2)),ae;return U>Y?U>te?ae=U-Y-te:ae=te-Y-U:te>Y?ae=te-Y-U:ae=Y-U-te,ae>-1e-4&&ae<1e-4}var m=function(){return function(I,j,W,H){var ee=Rt(),G,F,R,P,U,Y=0,te,ae=[],xe=[],je=Jn.newElement();for(R=W.length,G=0;G<ee;G+=1){for(U=G/(ee-1),te=0,F=0;F<R;F+=1)P=B(1-U,3)*I[F]+3*B(1-U,2)*U*W[F]+3*(1-U)*B(U,2)*H[F]+B(U,3)*j[F],ae[F]=P,xe[F]!==null&&(te+=B(ae[F]-xe[F],2)),xe[F]=ae[F];te&&(te=N(te),Y+=te),je.percents[G]=U,je.lengths[G]=Y}return je.addedLength=Y,je}}();function x(I){var j=Zn.newElement(),W=I.c,H=I.v,ee=I.o,G=I.i,F,R=I._length,P=j.lengths,U=0;for(F=0;F<R-1;F+=1)P[F]=m(H[F],H[F+1],ee[F],G[F+1]),U+=P[F].addedLength;return W&&R&&(P[F]=m(H[F],H[0],ee[F],G[0]),U+=P[F].addedLength),j.totalLength=U,j}function S(I){this.segmentLength=0,this.points=new Array(I)}function w(I,j){this.partialLength=I,this.point=j}var k=function(){var I={};return function(j,W,H,ee){var G=(j[0]+"_"+j[1]+"_"+W[0]+"_"+W[1]+"_"+H[0]+"_"+H[1]+"_"+ee[0]+"_"+ee[1]).replace(/\./g,"p");if(!I[G]){var F=Rt(),R,P,U,Y,te,ae=0,xe,je,De=null;j.length===2&&(j[0]!==W[0]||j[1]!==W[1])&&f(j[0],j[1],W[0],W[1],j[0]+H[0],j[1]+H[1])&&f(j[0],j[1],W[0],W[1],W[0]+ee[0],W[1]+ee[1])&&(F=2);var Ae=new S(F);for(U=H.length,R=0;R<F;R+=1){for(je=b(U),te=R/(F-1),xe=0,P=0;P<U;P+=1)Y=B(1-te,3)*j[P]+3*B(1-te,2)*te*(j[P]+H[P])+3*(1-te)*B(te,2)*(W[P]+ee[P])+B(te,3)*W[P],je[P]=Y,De!==null&&(xe+=B(je[P]-De[P],2));xe=N(xe),ae+=xe,Ae.points[R]=new w(xe,je),De=je}Ae.segmentLength=ae,I[G]=Ae}return I[G]}}();function _(I,j){var W=j.percents,H=j.lengths,ee=W.length,G=J((ee-1)*I),F=I*j.addedLength,R=0;if(G===ee-1||G===0||F===H[G])return W[G];for(var P=H[G]>F?-1:1,U=!0;U;)if(H[G]<=F&&H[G+1]>F?(R=(F-H[G])/(H[G+1]-H[G]),U=!1):G+=P,G<0||G>=ee-1){if(G===ee-1)return W[G];U=!1}return W[G]+(W[G+1]-W[G])*R}function $(I,j,W,H,ee,G){var F=_(ee,G),R=1-F,P=c.round((R*R*R*I[0]+(F*R*R+R*F*R+R*R*F)*W[0]+(F*F*R+R*F*F+F*R*F)*H[0]+F*F*F*j[0])*1e3)/1e3,U=c.round((R*R*R*I[1]+(F*R*R+R*F*R+R*R*F)*W[1]+(F*F*R+R*F*F+F*R*F)*H[1]+F*F*F*j[1])*1e3)/1e3;return[P,U]}var V=y("float32",8);function re(I,j,W,H,ee,G,F){ee<0?ee=0:ee>1&&(ee=1);var R=_(ee,F);G=G>1?1:G;var P=_(G,F),U,Y=I.length,te=1-R,ae=1-P,xe=te*te*te,je=R*te*te*3,De=R*R*te*3,Ae=R*R*R,qe=te*te*ae,Ie=R*te*ae+te*R*ae+te*te*P,ve=R*R*ae+te*R*P+R*te*P,O=R*R*P,K=te*ae*ae,T=R*ae*ae+te*P*ae+te*ae*P,L=R*P*ae+te*P*P+R*ae*P,ne=R*P*P,X=ae*ae*ae,Le=P*ae*ae+ae*P*ae+ae*ae*P,Ne=P*P*ae+ae*P*P+P*ae*P,He=P*P*P;for(U=0;U<Y;U+=1)V[U*4]=c.round((xe*I[U]+je*W[U]+De*H[U]+Ae*j[U])*1e3)/1e3,V[U*4+1]=c.round((qe*I[U]+Ie*W[U]+ve*H[U]+O*j[U])*1e3)/1e3,V[U*4+2]=c.round((K*I[U]+T*W[U]+L*H[U]+ne*j[U])*1e3)/1e3,V[U*4+3]=c.round((X*I[U]+Le*W[U]+Ne*H[U]+He*j[U])*1e3)/1e3;return V}return{getSegmentsLength:x,getNewSegment:re,getPointInSegment:$,buildBezierData:k,pointOnLine2D:f,pointOnLine3D:p}}var fr=To(),ti=n,ea=Math.abs;function hs(c,f){var p=this.offsetTime,m;this.propType==="multidimensional"&&(m=y("float32",this.pv.length));for(var x=f.lastIndex,S=x,w=this.keyframes.length-1,k=!0,_,$,V;k;){if(_=this.keyframes[S],$=this.keyframes[S+1],S===w-1&&c>=$.t-p){_.h&&(_=$),x=0;break}if($.t-p>c){x=S;break}S<w-1?S+=1:(x=0,k=!1)}V=this.keyframesMetadata[S]||{};var re,I,j,W,H,ee,G=$.t-p,F=_.t-p,R;if(_.to){V.bezierData||(V.bezierData=fr.buildBezierData(_.s,$.s||_.e,_.to,_.ti));var P=V.bezierData;if(c>=G||c<F){var U=c>=G?P.points.length-1:0;for(I=P.points[U].point.length,re=0;re<I;re+=1)m[re]=P.points[U].point[re]}else{V.__fnct?ee=V.__fnct:(ee=Or.getBezierEasing(_.o.x,_.o.y,_.i.x,_.i.y,_.n).get,V.__fnct=ee),j=ee((c-F)/(G-F));var Y=P.segmentLength*j,te,ae=f.lastFrame<c&&f._lastKeyframeIndex===S?f._lastAddedLength:0;for(H=f.lastFrame<c&&f._lastKeyframeIndex===S?f._lastPoint:0,k=!0,W=P.points.length;k;){if(ae+=P.points[H].partialLength,Y===0||j===0||H===P.points.length-1){for(I=P.points[H].point.length,re=0;re<I;re+=1)m[re]=P.points[H].point[re];break}else if(Y>=ae&&Y<ae+P.points[H+1].partialLength){for(te=(Y-ae)/P.points[H+1].partialLength,I=P.points[H].point.length,re=0;re<I;re+=1)m[re]=P.points[H].point[re]+(P.points[H+1].point[re]-P.points[H].point[re])*te;break}H<W-1?H+=1:k=!1}f._lastPoint=H,f._lastAddedLength=ae-P.points[H].partialLength,f._lastKeyframeIndex=S}}else{var xe,je,De,Ae,qe;if(w=_.s.length,R=$.s||_.e,this.sh&&_.h!==1)if(c>=G)m[0]=R[0],m[1]=R[1],m[2]=R[2];else if(c<=F)m[0]=_.s[0],m[1]=_.s[1],m[2]=_.s[2];else{var Ie=fs(_.s),ve=fs(R),O=(c-F)/(G-F);yi(m,ta(Ie,ve,O))}else for(S=0;S<w;S+=1)_.h!==1&&(c>=G?j=1:c<F?j=0:(_.o.x.constructor===Array?(V.__fnct||(V.__fnct=[]),V.__fnct[S]?ee=V.__fnct[S]:(xe=_.o.x[S]===void 0?_.o.x[0]:_.o.x[S],je=_.o.y[S]===void 0?_.o.y[0]:_.o.y[S],De=_.i.x[S]===void 0?_.i.x[0]:_.i.x[S],Ae=_.i.y[S]===void 0?_.i.y[0]:_.i.y[S],ee=Or.getBezierEasing(xe,je,De,Ae).get,V.__fnct[S]=ee)):V.__fnct?ee=V.__fnct:(xe=_.o.x,je=_.o.y,De=_.i.x,Ae=_.i.y,ee=Or.getBezierEasing(xe,je,De,Ae).get,_.keyframeMetadata=ee),j=ee((c-F)/(G-F)))),R=$.s||_.e,qe=_.h===1?_.s[S]:_.s[S]+(R[S]-_.s[S])*j,this.propType==="multidimensional"?m[S]=qe:m=qe}return f.lastIndex=x,m}function ta(c,f,p){var m=[],x=c[0],S=c[1],w=c[2],k=c[3],_=f[0],$=f[1],V=f[2],re=f[3],I,j,W,H,ee;return j=x*_+S*$+w*V+k*re,j<0&&(j=-j,_=-_,$=-$,V=-V,re=-re),1-j>1e-6?(I=Math.acos(j),W=Math.sin(I),H=Math.sin((1-p)*I)/W,ee=Math.sin(p*I)/W):(H=1-p,ee=p),m[0]=H*x+ee*_,m[1]=H*S+ee*$,m[2]=H*w+ee*V,m[3]=H*k+ee*re,m}function yi(c,f){var p=f[0],m=f[1],x=f[2],S=f[3],w=Math.atan2(2*m*S-2*p*x,1-2*m*m-2*x*x),k=Math.asin(2*p*m+2*x*S),_=Math.atan2(2*p*S-2*m*x,1-2*p*p-2*x*x);c[0]=w/Q,c[1]=k/Q,c[2]=_/Q}function fs(c){var f=c[0]*Q,p=c[1]*Q,m=c[2]*Q,x=Math.cos(f/2),S=Math.cos(p/2),w=Math.cos(m/2),k=Math.sin(f/2),_=Math.sin(p/2),$=Math.sin(m/2),V=x*S*w-k*_*$,re=k*_*w+x*S*$,I=k*S*w+x*_*$,j=x*_*w-k*S*$;return[re,I,j,V]}function ds(){var c=this.comp.renderedFrame-this.offsetTime,f=this.keyframes[0].t-this.offsetTime,p=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(c===this._caching.lastFrame||this._caching.lastFrame!==ti&&(this._caching.lastFrame>=p&&c>=p||this._caching.lastFrame<f&&c<f))){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 Vi(c){var f;if(this.propType==="unidimensional")f=c*this.mult,ea(this.v-f)>1e-5&&(this.v=f,this._mdf=!0);else for(var p=0,m=this.v.length;p<m;)f=c[p]*this.mult,ea(this.v[p]-f)>1e-5&&(this.v[p]=f,this._mdf=!0),p+=1}function ps(){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,f=this.effectsSequence.length,p=this.kf?this.pv:this.data.k;for(c=0;c<f;c+=1)p=this.effectsSequence[c](p);this.setVValue(p),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function ji(c){this.effectsSequence.push(c),this.container.addDynamicProperty(this)}function wo(c,f,p,m){this.propType="unidimensional",this.mult=p||1,this.data=f,this.v=p?f.k*p:f.k,this.pv=f.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=ps,this.setVValue=Vi,this.addEffect=ji}function ra(c,f,p,m){this.propType="multidimensional",this.mult=p||1,this.data=f,this._mdf=!1,this.elem=c,this.container=m,this.comp=c.comp,this.k=!1,this.kf=!1,this.frameId=-1;var x,S=f.k.length;for(this.v=y("float32",S),this.pv=y("float32",S),this.vel=y("float32",S),x=0;x<S;x+=1)this.v[x]=f.k[x]*this.mult,this.pv[x]=f.k[x];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=ps,this.setVValue=Vi,this.addEffect=ji}function ia(c,f,p,m){this.propType="unidimensional",this.keyframes=f.k,this.keyframesMetadata=[],this.offsetTime=c.data.st,this.frameId=-1,this._caching={lastFrame:ti,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=f,this.mult=p||1,this.elem=c,this.container=m,this.comp=c.comp,this.v=ti,this.pv=ti,this._isFirstFrame=!0,this.getValue=ps,this.setVValue=Vi,this.interpolateValue=hs,this.effectsSequence=[ds.bind(this)],this.addEffect=ji}function Ao(c,f,p,m){this.propType="multidimensional";var x,S=f.k.length,w,k,_,$;for(x=0;x<S-1;x+=1)f.k[x].to&&f.k[x].s&&f.k[x+1]&&f.k[x+1].s&&(w=f.k[x].s,k=f.k[x+1].s,_=f.k[x].to,$=f.k[x].ti,(w.length===2&&!(w[0]===k[0]&&w[1]===k[1])&&fr.pointOnLine2D(w[0],w[1],k[0],k[1],w[0]+_[0],w[1]+_[1])&&fr.pointOnLine2D(w[0],w[1],k[0],k[1],k[0]+$[0],k[1]+$[1])||w.length===3&&!(w[0]===k[0]&&w[1]===k[1]&&w[2]===k[2])&&fr.pointOnLine3D(w[0],w[1],w[2],k[0],k[1],k[2],w[0]+_[0],w[1]+_[1],w[2]+_[2])&&fr.pointOnLine3D(w[0],w[1],w[2],k[0],k[1],k[2],k[0]+$[0],k[1]+$[1],k[2]+$[2]))&&(f.k[x].to=null,f.k[x].ti=null),w[0]===k[0]&&w[1]===k[1]&&_[0]===0&&_[1]===0&&$[0]===0&&$[1]===0&&(w.length===2||w[2]===k[2]&&_[2]===0&&$[2]===0)&&(f.k[x].to=null,f.k[x].ti=null));this.effectsSequence=[ds.bind(this)],this.data=f,this.keyframes=f.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=ps,this.setVValue=Vi,this.interpolateValue=hs,this.frameId=-1;var V=f.k[0].s.length;for(this.v=y("float32",V),this.pv=y("float32",V),x=0;x<V;x+=1)this.v[x]=ti,this.pv[x]=ti;this._caching={lastFrame:ti,lastIndex:0,value:y("float32",V)},this.addEffect=ji}var _e=function(){function c(p,m,x,S,w){m.sid&&(m=p.globalData.slotManager.getProp(m));var k;if(!m.k.length)k=new wo(p,m,S,w);else if(typeof m.k[0]=="number")k=new ra(p,m,S,w);else switch(x){case 0:k=new ia(p,m,S,w);break;case 1:k=new Ao(p,m,S,w);break}return k.effectsSequence.length&&w.addDynamicProperty(k),k}var f={getProp:c};return f}();function _t(){}_t.prototype={addDynamicProperty:function(f){this.dynamicProperties.indexOf(f)===-1&&(this.dynamicProperties.push(f),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){this._mdf=!1;var f,p=this.dynamicProperties.length;for(f=0;f<p;f+=1)this.dynamicProperties[f].getValue(),this.dynamicProperties[f]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(f){this.container=f,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var ri=function(){function c(){return y("float32",2)}return us(8,c)}();function Er(){this.c=!1,this._length=0,this._maxLength=8,this.v=b(this._maxLength),this.o=b(this._maxLength),this.i=b(this._maxLength)}Er.prototype.setPathData=function(c,f){this.c=c,this.setLength(f);for(var p=0;p<f;)this.v[p]=ri.newElement(),this.o[p]=ri.newElement(),this.i[p]=ri.newElement(),p+=1},Er.prototype.setLength=function(c){for(;this._maxLength<c;)this.doubleArrayLength();this._length=c},Er.prototype.doubleArrayLength=function(){this.v=this.v.concat(b(this._maxLength)),this.i=this.i.concat(b(this._maxLength)),this.o=this.o.concat(b(this._maxLength)),this._maxLength*=2},Er.prototype.setXYAt=function(c,f,p,m,x){var S;switch(this._length=Math.max(this._length,m+1),this._length>=this._maxLength&&this.doubleArrayLength(),p){case"v":S=this.v;break;case"i":S=this.i;break;case"o":S=this.o;break;default:S=[];break}(!S[m]||S[m]&&!x)&&(S[m]=ri.newElement()),S[m][0]=c,S[m][1]=f},Er.prototype.setTripleAt=function(c,f,p,m,x,S,w,k){this.setXYAt(c,f,"v",w,k),this.setXYAt(p,m,"o",w,k),this.setXYAt(x,S,"i",w,k)},Er.prototype.reverse=function(){var c=new Er;c.setPathData(this.c,this._length);var f=this.v,p=this.o,m=this.i,x=0;this.c&&(c.setTripleAt(f[0][0],f[0][1],m[0][0],m[0][1],p[0][0],p[0][1],0,!1),x=1);var S=this._length-1,w=this._length,k;for(k=x;k<w;k+=1)c.setTripleAt(f[S][0],f[S][1],m[S][0],m[S][1],p[S][0],p[S][1],k,!1),S-=1;return c},Er.prototype.length=function(){return this._length};var Dt=function(){function c(){return new Er}function f(x){var S=x._length,w;for(w=0;w<S;w+=1)ri.release(x.v[w]),ri.release(x.i[w]),ri.release(x.o[w]),x.v[w]=null,x.i[w]=null,x.o[w]=null;x._length=0,x.c=!1}function p(x){var S=m.newElement(),w,k=x._length===void 0?x.v.length:x._length;for(S.setLength(k),S.c=x.c,w=0;w<k;w+=1)S.setTripleAt(x.v[w][0],x.v[w][1],x.o[w][0],x.o[w][1],x.i[w][0],x.i[w][1],w);return S}var m=us(4,c,f);return m.clone=p,m}();function zs(){this._length=0,this._maxLength=4,this.shapes=b(this._maxLength)}zs.prototype.addShape=function(c){this._length===this._maxLength&&(this.shapes=this.shapes.concat(b(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=c,this._length+=1},zs.prototype.releaseShapes=function(){var c;for(c=0;c<this._length;c+=1)Dt.release(this.shapes[c]);this._length=0};var z=function(){var c={newShapeCollection:x,release:S},f=0,p=4,m=b(p);function x(){var w;return f?(f-=1,w=m[f]):w=new zs,w}function S(w){var k,_=w._length;for(k=0;k<_;k+=1)Dt.release(w.shapes[k]);w._length=0,f===p&&(m=cs.double(m),p*=2),m[f]=w,f+=1}return c}(),be=function(){var c=-999999;function f(G,F,R){var P=R.lastIndex,U,Y,te,ae,xe,je,De,Ae,qe,Ie=this.keyframes;if(G<Ie[0].t-this.offsetTime)U=Ie[0].s[0],te=!0,P=0;else if(G>=Ie[Ie.length-1].t-this.offsetTime)U=Ie[Ie.length-1].s?Ie[Ie.length-1].s[0]:Ie[Ie.length-2].e[0],te=!0;else{for(var ve=P,O=Ie.length-1,K=!0,T,L,ne;K&&(T=Ie[ve],L=Ie[ve+1],!(L.t-this.offsetTime>G));)ve<O-1?ve+=1:K=!1;if(ne=this.keyframesMetadata[ve]||{},te=T.h===1,P=ve,!te){if(G>=L.t-this.offsetTime)Ae=1;else if(G<T.t-this.offsetTime)Ae=0;else{var X;ne.__fnct?X=ne.__fnct:(X=Or.getBezierEasing(T.o.x,T.o.y,T.i.x,T.i.y).get,ne.__fnct=X),Ae=X((G-(T.t-this.offsetTime))/(L.t-this.offsetTime-(T.t-this.offsetTime)))}Y=L.s?L.s[0]:T.e[0]}U=T.s[0]}for(je=F._length,De=U.i[0].length,R.lastIndex=P,ae=0;ae<je;ae+=1)for(xe=0;xe<De;xe+=1)qe=te?U.i[ae][xe]:U.i[ae][xe]+(Y.i[ae][xe]-U.i[ae][xe])*Ae,F.i[ae][xe]=qe,qe=te?U.o[ae][xe]:U.o[ae][xe]+(Y.o[ae][xe]-U.o[ae][xe])*Ae,F.o[ae][xe]=qe,qe=te?U.v[ae][xe]:U.v[ae][xe]+(Y.v[ae][xe]-U.v[ae][xe])*Ae,F.v[ae][xe]=qe}function p(){var G=this.comp.renderedFrame-this.offsetTime,F=this.keyframes[0].t-this.offsetTime,R=this.keyframes[this.keyframes.length-1].t-this.offsetTime,P=this._caching.lastFrame;return P!==c&&(P<F&&G<F||P>R&&G>R)||(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 x(G,F){if(G._length!==F._length||G.c!==F.c)return!1;var R,P=G._length;for(R=0;R<P;R+=1)if(G.v[R][0]!==F.v[R][0]||G.v[R][1]!==F.v[R][1]||G.o[R][0]!==F.o[R][0]||G.o[R][1]!==F.o[R][1]||G.i[R][0]!==F.i[R][0]||G.i[R][1]!==F.i[R][1])return!1;return!0}function S(G){x(this.v,G)||(this.v=Dt.clone(G),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function w(){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 F,R=this.effectsSequence.length;for(F=0;F<R;F+=1)G=this.effectsSequence[F](G);this.setVValue(G),this.lock=!1,this.frameId=this.elem.globalData.frameId}}function k(G,F,R){this.propType="shape",this.comp=G.comp,this.container=G,this.elem=G,this.data=F,this.k=!1,this.kf=!1,this._mdf=!1;var P=R===3?F.pt.k:F.ks.k;this.v=Dt.clone(P),this.pv=Dt.clone(this.v),this.localShapeCollection=z.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=m,this.effectsSequence=[]}function _(G){this.effectsSequence.push(G),this.container.addDynamicProperty(this)}k.prototype.interpolateShape=f,k.prototype.getValue=w,k.prototype.setVValue=S,k.prototype.addEffect=_;function $(G,F,R){this.propType="shape",this.comp=G.comp,this.elem=G,this.container=G,this.offsetTime=G.data.st,this.keyframes=R===3?F.pt.k:F.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=z.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)]}$.prototype.getValue=w,$.prototype.interpolateShape=f,$.prototype.setVValue=S,$.prototype.addEffect=_;var V=function(){var G=q;function F(R,P){this.v=Dt.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=z.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=P.d,this.elem=R,this.comp=R.comp,this.frameId=-1,this.initDynamicPropertyContainer(R),this.p=_e.getProp(R,P.p,1,0,this),this.s=_e.getProp(R,P.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return F.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],U=this.p.v[1],Y=this.s.v[0]/2,te=this.s.v[1]/2,ae=this.d!==3,xe=this.v;xe.v[0][0]=P,xe.v[0][1]=U-te,xe.v[1][0]=ae?P+Y:P-Y,xe.v[1][1]=U,xe.v[2][0]=P,xe.v[2][1]=U+te,xe.v[3][0]=ae?P-Y:P+Y,xe.v[3][1]=U,xe.i[0][0]=ae?P-Y*G:P+Y*G,xe.i[0][1]=U-te,xe.i[1][0]=ae?P+Y:P-Y,xe.i[1][1]=U-te*G,xe.i[2][0]=ae?P+Y*G:P-Y*G,xe.i[2][1]=U+te,xe.i[3][0]=ae?P-Y:P+Y,xe.i[3][1]=U+te*G,xe.o[0][0]=ae?P+Y*G:P-Y*G,xe.o[0][1]=U-te,xe.o[1][0]=ae?P+Y:P-Y,xe.o[1][1]=U+te*G,xe.o[2][0]=ae?P-Y*G:P+Y*G,xe.o[2][1]=U+te,xe.o[3][0]=ae?P-Y:P+Y,xe.o[3][1]=U-te*G}},d([_t],F),F}(),re=function(){function G(F,R){this.v=Dt.newElement(),this.v.setPathData(!0,0),this.elem=F,this.comp=F.comp,this.data=R,this.frameId=-1,this.d=R.d,this.initDynamicPropertyContainer(F),R.sy===1?(this.ir=_e.getProp(F,R.ir,0,0,this),this.is=_e.getProp(F,R.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=_e.getProp(F,R.pt,0,0,this),this.p=_e.getProp(F,R.p,1,0,this),this.r=_e.getProp(F,R.r,0,Q,this),this.or=_e.getProp(F,R.or,0,0,this),this.os=_e.getProp(F,R.os,0,.01,this),this.localShapeCollection=z.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 R=Math.floor(this.pt.v)*2,P=Math.PI*2/R,U=!0,Y=this.or.v,te=this.ir.v,ae=this.os.v,xe=this.is.v,je=2*Math.PI*Y/(R*2),De=2*Math.PI*te/(R*2),Ae,qe,Ie,ve,O=-Math.PI/2;O+=this.r.v;var K=this.data.d===3?-1:1;for(this.v._length=0,Ae=0;Ae<R;Ae+=1){qe=U?Y:te,Ie=U?ae:xe,ve=U?je:De;var T=qe*Math.cos(O),L=qe*Math.sin(O),ne=T===0&&L===0?0:L/Math.sqrt(T*T+L*L),X=T===0&&L===0?0:-T/Math.sqrt(T*T+L*L);T+=+this.p.v[0],L+=+this.p.v[1],this.v.setTripleAt(T,L,T-ne*ve*Ie*K,L-X*ve*Ie*K,T+ne*ve*Ie*K,L+X*ve*Ie*K,Ae,!0),U=!U,O+=P*K}},convertPolygonToPath:function(){var R=Math.floor(this.pt.v),P=Math.PI*2/R,U=this.or.v,Y=this.os.v,te=2*Math.PI*U/(R*4),ae,xe=-Math.PI*.5,je=this.data.d===3?-1:1;for(xe+=this.r.v,this.v._length=0,ae=0;ae<R;ae+=1){var De=U*Math.cos(xe),Ae=U*Math.sin(xe),qe=De===0&&Ae===0?0:Ae/Math.sqrt(De*De+Ae*Ae),Ie=De===0&&Ae===0?0:-De/Math.sqrt(De*De+Ae*Ae);De+=+this.p.v[0],Ae+=+this.p.v[1],this.v.setTripleAt(De,Ae,De-qe*te*Y*je,Ae-Ie*te*Y*je,De+qe*te*Y*je,Ae+Ie*te*Y*je,ae,!0),xe+=P*je}this.paths.length=0,this.paths[0]=this.v}},d([_t],G),G}(),I=function(){function G(F,R){this.v=Dt.newElement(),this.v.c=!0,this.localShapeCollection=z.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=F,this.comp=F.comp,this.frameId=-1,this.d=R.d,this.initDynamicPropertyContainer(F),this.p=_e.getProp(F,R.p,1,0,this),this.s=_e.getProp(F,R.s,1,0,this),this.r=_e.getProp(F,R.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return G.prototype={convertRectToPath:function(){var R=this.p.v[0],P=this.p.v[1],U=this.s.v[0]/2,Y=this.s.v[1]/2,te=Z(U,Y,this.r.v),ae=te*(1-q);this.v._length=0,this.d===2||this.d===1?(this.v.setTripleAt(R+U,P-Y+te,R+U,P-Y+te,R+U,P-Y+ae,0,!0),this.v.setTripleAt(R+U,P+Y-te,R+U,P+Y-ae,R+U,P+Y-te,1,!0),te!==0?(this.v.setTripleAt(R+U-te,P+Y,R+U-te,P+Y,R+U-ae,P+Y,2,!0),this.v.setTripleAt(R-U+te,P+Y,R-U+ae,P+Y,R-U+te,P+Y,3,!0),this.v.setTripleAt(R-U,P+Y-te,R-U,P+Y-te,R-U,P+Y-ae,4,!0),this.v.setTripleAt(R-U,P-Y+te,R-U,P-Y+ae,R-U,P-Y+te,5,!0),this.v.setTripleAt(R-U+te,P-Y,R-U+te,P-Y,R-U+ae,P-Y,6,!0),this.v.setTripleAt(R+U-te,P-Y,R+U-ae,P-Y,R+U-te,P-Y,7,!0)):(this.v.setTripleAt(R-U,P+Y,R-U+ae,P+Y,R-U,P+Y,2),this.v.setTripleAt(R-U,P-Y,R-U,P-Y+ae,R-U,P-Y,3))):(this.v.setTripleAt(R+U,P-Y+te,R+U,P-Y+ae,R+U,P-Y+te,0,!0),te!==0?(this.v.setTripleAt(R+U-te,P-Y,R+U-te,P-Y,R+U-ae,P-Y,1,!0),this.v.setTripleAt(R-U+te,P-Y,R-U+ae,P-Y,R-U+te,P-Y,2,!0),this.v.setTripleAt(R-U,P-Y+te,R-U,P-Y+te,R-U,P-Y+ae,3,!0),this.v.setTripleAt(R-U,P+Y-te,R-U,P+Y-ae,R-U,P+Y-te,4,!0),this.v.setTripleAt(R-U+te,P+Y,R-U+te,P+Y,R-U+ae,P+Y,5,!0),this.v.setTripleAt(R+U-te,P+Y,R+U-ae,P+Y,R+U-te,P+Y,6,!0),this.v.setTripleAt(R+U,P+Y-te,R+U,P+Y-te,R+U,P+Y-ae,7,!0)):(this.v.setTripleAt(R-U,P-Y,R-U+ae,P-Y,R-U,P-Y,1,!0),this.v.setTripleAt(R-U,P+Y,R-U,P+Y-ae,R-U,P+Y,2,!0),this.v.setTripleAt(R+U,P+Y,R+U-ae,P+Y,R+U,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},d([_t],G),G}();function j(G,F,R){var P;if(R===3||R===4){var U=R===3?F.pt:F.ks,Y=U.k;Y.length?P=new $(G,F,R):P=new k(G,F,R)}else R===5?P=new I(G,F):R===6?P=new V(G,F):R===7&&(P=new re(G,F));return P.k&&G.addDynamicProperty(P),P}function W(){return k}function H(){return $}var ee={};return ee.getShapeProp=j,ee.getConstructorFunction=W,ee.getKeyframedConstructorFunction=H,ee}();/*!
138
+ Transformation Matrix v2.0
139
+ (c) Epistemex 2014-2015
140
+ www.epistemex.com
141
+ By Ken Fyrstenberg
142
+ Contributions by leeoniya.
143
+ License: MIT, header required.
144
+ */var we=function(){var c=Math.cos,f=Math.sin,p=Math.tan,m=Math.round;function x(){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 S(T){if(T===0)return this;var L=c(T),ne=f(T);return this._t(L,-ne,0,0,ne,L,0,0,0,0,1,0,0,0,0,1)}function w(T){if(T===0)return this;var L=c(T),ne=f(T);return this._t(1,0,0,0,0,L,-ne,0,0,ne,L,0,0,0,0,1)}function k(T){if(T===0)return this;var L=c(T),ne=f(T);return this._t(L,0,ne,0,0,1,0,0,-ne,0,L,0,0,0,0,1)}function _(T){if(T===0)return this;var L=c(T),ne=f(T);return this._t(L,-ne,0,0,ne,L,0,0,0,0,1,0,0,0,0,1)}function $(T,L){return this._t(1,L,T,1,0,0)}function V(T,L){return this.shear(p(T),p(L))}function re(T,L){var ne=c(L),X=f(L);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,L,ne){return!ne&&ne!==0&&(ne=1),T===1&&L===1&&ne===1?this:this._t(T,0,0,0,0,L,0,0,0,0,ne,0,0,0,0,1)}function j(T,L,ne,X,Le,Ne,He,st,nt,It,Jt,Fr,Zt,Ut,nr,ft){return this.props[0]=T,this.props[1]=L,this.props[2]=ne,this.props[3]=X,this.props[4]=Le,this.props[5]=Ne,this.props[6]=He,this.props[7]=st,this.props[8]=nt,this.props[9]=It,this.props[10]=Jt,this.props[11]=Fr,this.props[12]=Zt,this.props[13]=Ut,this.props[14]=nr,this.props[15]=ft,this}function W(T,L,ne){return ne=ne||0,T!==0||L!==0||ne!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,T,L,ne,1):this}function H(T,L,ne,X,Le,Ne,He,st,nt,It,Jt,Fr,Zt,Ut,nr,ft){var Pe=this.props;if(T===1&&L===0&&ne===0&&X===0&&Le===0&&Ne===1&&He===0&&st===0&&nt===0&&It===0&&Jt===1&&Fr===0)return Pe[12]=Pe[12]*T+Pe[15]*Zt,Pe[13]=Pe[13]*Ne+Pe[15]*Ut,Pe[14]=Pe[14]*Jt+Pe[15]*nr,Pe[15]*=ft,this._identityCalculated=!1,this;var ni=Pe[0],_i=Pe[1],ai=Pe[2],Nr=Pe[3],oi=Pe[4],li=Pe[5],er=Pe[6],Ci=Pe[7],Li=Pe[8],_r=Pe[9],Ri=Pe[10],Cr=Pe[11],Wi=Pe[12],ua=Pe[13],ha=Pe[14],fa=Pe[15];return Pe[0]=ni*T+_i*Le+ai*nt+Nr*Zt,Pe[1]=ni*L+_i*Ne+ai*It+Nr*Ut,Pe[2]=ni*ne+_i*He+ai*Jt+Nr*nr,Pe[3]=ni*X+_i*st+ai*Fr+Nr*ft,Pe[4]=oi*T+li*Le+er*nt+Ci*Zt,Pe[5]=oi*L+li*Ne+er*It+Ci*Ut,Pe[6]=oi*ne+li*He+er*Jt+Ci*nr,Pe[7]=oi*X+li*st+er*Fr+Ci*ft,Pe[8]=Li*T+_r*Le+Ri*nt+Cr*Zt,Pe[9]=Li*L+_r*Ne+Ri*It+Cr*Ut,Pe[10]=Li*ne+_r*He+Ri*Jt+Cr*nr,Pe[11]=Li*X+_r*st+Ri*Fr+Cr*ft,Pe[12]=Wi*T+ua*Le+ha*nt+fa*Zt,Pe[13]=Wi*L+ua*Ne+ha*It+fa*Ut,Pe[14]=Wi*ne+ua*He+ha*Jt+fa*nr,Pe[15]=Wi*X+ua*st+ha*Fr+fa*ft,this._identityCalculated=!1,this}function ee(T){var L=T.props;return this.transform(L[0],L[1],L[2],L[3],L[4],L[5],L[6],L[7],L[8],L[9],L[10],L[11],L[12],L[13],L[14],L[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 F(T){for(var L=0;L<16;){if(T.props[L]!==this.props[L])return!1;L+=1}return!0}function R(T){var L;for(L=0;L<16;L+=1)T.props[L]=this.props[L];return T}function P(T){var L;for(L=0;L<16;L+=1)this.props[L]=T[L]}function U(T,L,ne){return{x:T*this.props[0]+L*this.props[4]+ne*this.props[8]+this.props[12],y:T*this.props[1]+L*this.props[5]+ne*this.props[9]+this.props[13],z:T*this.props[2]+L*this.props[6]+ne*this.props[10]+this.props[14]}}function Y(T,L,ne){return T*this.props[0]+L*this.props[4]+ne*this.props[8]+this.props[12]}function te(T,L,ne){return T*this.props[1]+L*this.props[5]+ne*this.props[9]+this.props[13]}function ae(T,L,ne){return T*this.props[2]+L*this.props[6]+ne*this.props[10]+this.props[14]}function xe(){var T=this.props[0]*this.props[5]-this.props[1]*this.props[4],L=this.props[5]/T,ne=-this.props[1]/T,X=-this.props[4]/T,Le=this.props[0]/T,Ne=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/T,He=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/T,st=new we;return st.props[0]=L,st.props[1]=ne,st.props[4]=X,st.props[5]=Le,st.props[12]=Ne,st.props[13]=He,st}function je(T){var L=this.getInverseMatrix();return L.applyToPointArray(T[0],T[1],T[2]||0)}function De(T){var L,ne=T.length,X=[];for(L=0;L<ne;L+=1)X[L]=je(T[L]);return X}function Ae(T,L,ne){var X=y("float32",6);if(this.isIdentity())X[0]=T[0],X[1]=T[1],X[2]=L[0],X[3]=L[1],X[4]=ne[0],X[5]=ne[1];else{var Le=this.props[0],Ne=this.props[1],He=this.props[4],st=this.props[5],nt=this.props[12],It=this.props[13];X[0]=T[0]*Le+T[1]*He+nt,X[1]=T[0]*Ne+T[1]*st+It,X[2]=L[0]*Le+L[1]*He+nt,X[3]=L[0]*Ne+L[1]*st+It,X[4]=ne[0]*Le+ne[1]*He+nt,X[5]=ne[0]*Ne+ne[1]*st+It}return X}function qe(T,L,ne){var X;return this.isIdentity()?X=[T,L,ne]:X=[T*this.props[0]+L*this.props[4]+ne*this.props[8]+this.props[12],T*this.props[1]+L*this.props[5]+ne*this.props[9]+this.props[13],T*this.props[2]+L*this.props[6]+ne*this.props[10]+this.props[14]],X}function Ie(T,L){if(this.isIdentity())return T+","+L;var ne=this.props;return Math.round((T*ne[0]+L*ne[4]+ne[12])*100)/100+","+Math.round((T*ne[1]+L*ne[5]+ne[13])*100)/100}function ve(){for(var T=0,L=this.props,ne="matrix3d(",X=1e4;T<16;)ne+=m(L[T]*X)/X,ne+=T===15?")":",",T+=1;return ne}function O(T){var L=1e4;return T<1e-6&&T>0||T>-1e-6&&T<0?m(T*L)/L:T}function K(){var T=this.props,L=O(T[0]),ne=O(T[1]),X=O(T[4]),Le=O(T[5]),Ne=O(T[12]),He=O(T[13]);return"matrix("+L+","+ne+","+X+","+Le+","+Ne+","+He+")"}return function(){this.reset=x,this.rotate=S,this.rotateX=w,this.rotateY=k,this.rotateZ=_,this.skew=V,this.skewFromAxis=re,this.shear=$,this.scale=I,this.setTransform=j,this.translate=W,this.transform=H,this.multiply=ee,this.applyToPoint=U,this.applyToX=Y,this.applyToY=te,this.applyToZ=ae,this.applyToPointArray=qe,this.applyToTriplePoints=Ae,this.applyToPointStringified=Ie,this.toCSS=ve,this.to2dCSS=K,this.clone=R,this.cloneFromProps=P,this.equals=F,this.inversePoints=De,this.inversePoint=je,this.getInverseMatrix=xe,this._t=this.transform,this.isIdentity=G,this._identity=!0,this._identityCalculated=!1,this.props=y("float32",16),this.reset()}}();function Ue(c){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ue=function(p){return typeof p}:Ue=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},Ue(c)}var Fe={};function ct(c){l(c)}function tt(){St.searchAnimations()}function Ze(c){rt(c)}function $t(c){Sr(c)}function xt(c){return St.loadAnimation(c)}function Et(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 Tr(){return typeof navigator<"u"}function Si(c,f){c==="expressions"&&ot(f)}function sa(c){switch(c){case"propertyFactory":return _e;case"shapePropertyFactory":return be;case"matrix":return we;default:return null}}Fe.play=St.play,Fe.pause=St.pause,Fe.setLocationHref=ct,Fe.togglePause=St.togglePause,Fe.setSpeed=St.setSpeed,Fe.setDirection=St.setDirection,Fe.stop=St.stop,Fe.searchAnimations=tt,Fe.registerAnimation=St.registerAnimation,Fe.loadAnimation=xt,Fe.setSubframeRendering=Ze,Fe.resize=St.resize,Fe.goToAndStop=St.goToAndStop,Fe.destroy=St.destroy,Fe.setQuality=Et,Fe.inBrowser=Tr,Fe.installPlugin=Si,Fe.freeze=St.freeze,Fe.unfreeze=St.unfreeze,Fe.setVolume=St.setVolume,Fe.mute=St.mute,Fe.unmute=St.unmute,Fe.getRegisteredAnimations=St.getRegisteredAnimations,Fe.useWebWorker=a,Fe.setIDPrefix=$t,Fe.__getFactory=sa,Fe.version="5.12.2";function wr(){document.readyState==="complete"&&(clearInterval(T0),tt())}function b0(c){for(var f=wu.split("&"),p=0;p<f.length;p+=1){var m=f[p].split("=");if(decodeURIComponent(m[0])==c)return decodeURIComponent(m[1])}return null}var wu="";{var Au=document.getElementsByTagName("script"),E0=Au.length-1,_u=Au[E0]||{src:""};wu=_u.src?_u.src.replace(/^[^\?]+\??/,""):"",b0("renderer")}var T0=setInterval(wr,100);try{Ue(e)!=="object"&&(window.bodymovin=Fe)}catch{}var xi=function(){var c={},f={};c.registerModifier=p,c.getModifier=m;function p(x,S){f[x]||(f[x]=S)}function m(x,S,w){return new f[x](S,w)}return c}();function dr(){}dr.prototype.initModifierProperties=function(){},dr.prototype.addShapeToModifier=function(){},dr.prototype.addShape=function(c){if(!this.closed){c.sh.container.addDynamicProperty(c.sh);var f={shape:c.sh,data:c,localShapeCollection:z.newShapeCollection()};this.shapes.push(f),this.addShapeToModifier(f),this._isAnimated&&c.setAsAnimated()}},dr.prototype.init=function(c,f){this.shapes=[],this.elem=c,this.initDynamicPropertyContainer(c),this.initModifierProperties(c,f),this.frameId=n,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},dr.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},d([_t],dr);function Ar(){}d([dr],Ar),Ar.prototype.initModifierProperties=function(c,f){this.s=_e.getProp(c,f.s,0,.01,this),this.e=_e.getProp(c,f.e,0,.01,this),this.o=_e.getProp(c,f.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=f.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},Ar.prototype.addShapeToModifier=function(c){c.pathsData=[]},Ar.prototype.calculateShapeEdges=function(c,f,p,m,x){var S=[];f<=1?S.push({s:c,e:f}):c>=1?S.push({s:c-1,e:f-1}):(S.push({s:c,e:1}),S.push({s:0,e:f-1}));var w=[],k,_=S.length,$;for(k=0;k<_;k+=1)if($=S[k],!($.e*x<m||$.s*x>m+p)){var V,re;$.s*x<=m?V=0:V=($.s*x-m)/p,$.e*x>=m+p?re=1:re=($.e*x-m)/p,w.push([V,re])}return w.length||w.push([0,0]),w},Ar.prototype.releasePathsData=function(c){var f,p=c.length;for(f=0;f<p;f+=1)Zn.release(c[f]);return c.length=0,c},Ar.prototype.processShapes=function(c){var f,p;if(this._mdf||c){var m=this.o.v%360/360;if(m<0&&(m+=1),this.s.v>1?f=1+m:this.s.v<0?f=0+m:f=this.s.v+m,this.e.v>1?p=1+m:this.e.v<0?p=0+m:p=this.e.v+m,f>p){var x=f;f=p,p=x}f=Math.round(f*1e4)*1e-4,p=Math.round(p*1e4)*1e-4,this.sValue=f,this.eValue=p}else f=this.sValue,p=this.eValue;var S,w,k=this.shapes.length,_,$,V,re,I,j=0;if(p===f)for(w=0;w<k;w+=1)this.shapes[w].localShapeCollection.releaseShapes(),this.shapes[w].shape._mdf=!0,this.shapes[w].shape.paths=this.shapes[w].localShapeCollection,this._mdf&&(this.shapes[w].pathsData.length=0);else if(p===1&&f===0||p===0&&f===1){if(this._mdf)for(w=0;w<k;w+=1)this.shapes[w].pathsData.length=0,this.shapes[w].shape._mdf=!0}else{var W=[],H,ee;for(w=0;w<k;w+=1)if(H=this.shapes[w],!H.shape._mdf&&!this._mdf&&!c&&this.m!==2)H.shape.paths=H.localShapeCollection;else{if(S=H.shape.paths,$=S._length,I=0,!H.shape._mdf&&H.pathsData.length)I=H.totalShapeLength;else{for(V=this.releasePathsData(H.pathsData),_=0;_<$;_+=1)re=fr.getSegmentsLength(S.shapes[_]),V.push(re),I+=re.totalLength;H.totalShapeLength=I,H.pathsData=V}j+=I,H.shape._mdf=!0}var G=f,F=p,R=0,P;for(w=k-1;w>=0;w-=1)if(H=this.shapes[w],H.shape._mdf){for(ee=H.localShapeCollection,ee.releaseShapes(),this.m===2&&k>1?(P=this.calculateShapeEdges(f,p,H.totalShapeLength,R,j),R+=H.totalShapeLength):P=[[G,F]],$=P.length,_=0;_<$;_+=1){G=P[_][0],F=P[_][1],W.length=0,F<=1?W.push({s:H.totalShapeLength*G,e:H.totalShapeLength*F}):G>=1?W.push({s:H.totalShapeLength*(G-1),e:H.totalShapeLength*(F-1)}):(W.push({s:H.totalShapeLength*G,e:H.totalShapeLength}),W.push({s:0,e:H.totalShapeLength*(F-1)}));var U=this.addShapes(H,W[0]);if(W[0].s!==W[0].e){if(W.length>1){var Y=H.shape.paths.shapes[H.shape.paths._length-1];if(Y.c){var te=U.pop();this.addPaths(U,ee),U=this.addShapes(H,W[1],te)}else this.addPaths(U,ee),U=this.addShapes(H,W[1])}this.addPaths(U,ee)}}H.shape.paths=ee}}},Ar.prototype.addPaths=function(c,f){var p,m=c.length;for(p=0;p<m;p+=1)f.addShape(c[p])},Ar.prototype.addSegment=function(c,f,p,m,x,S,w){x.setXYAt(f[0],f[1],"o",S),x.setXYAt(p[0],p[1],"i",S+1),w&&x.setXYAt(c[0],c[1],"v",S),x.setXYAt(m[0],m[1],"v",S+1)},Ar.prototype.addSegmentFromArray=function(c,f,p,m){f.setXYAt(c[1],c[5],"o",p),f.setXYAt(c[2],c[6],"i",p+1),m&&f.setXYAt(c[0],c[4],"v",p),f.setXYAt(c[3],c[7],"v",p+1)},Ar.prototype.addShapes=function(c,f,p){var m=c.pathsData,x=c.shape.paths.shapes,S,w=c.shape.paths._length,k,_,$=0,V,re,I,j,W=[],H,ee=!0;for(p?(re=p._length,H=p._length):(p=Dt.newElement(),re=0,H=0),W.push(p),S=0;S<w;S+=1){for(I=m[S].lengths,p.c=x[S].c,_=x[S].c?I.length:I.length+1,k=1;k<_;k+=1)if(V=I[k-1],$+V.addedLength<f.s)$+=V.addedLength,p.c=!1;else if($>f.e){p.c=!1;break}else f.s<=$&&f.e>=$+V.addedLength?(this.addSegment(x[S].v[k-1],x[S].o[k-1],x[S].i[k],x[S].v[k],p,re,ee),ee=!1):(j=fr.getNewSegment(x[S].v[k-1],x[S].v[k],x[S].o[k-1],x[S].i[k],(f.s-$)/V.addedLength,(f.e-$)/V.addedLength,I[k-1]),this.addSegmentFromArray(j,p,re,ee),ee=!1,p.c=!1),$+=V.addedLength,re+=1;if(x[S].c&&I.length){if(V=I[k-1],$<=f.e){var G=I[k-1].addedLength;f.s<=$&&f.e>=$+G?(this.addSegment(x[S].v[k-1],x[S].o[k-1],x[S].i[0],x[S].v[0],p,re,ee),ee=!1):(j=fr.getNewSegment(x[S].v[k-1],x[S].v[0],x[S].o[k-1],x[S].i[0],(f.s-$)/G,(f.e-$)/G,I[k-1]),this.addSegmentFromArray(j,p,re,ee),ee=!1,p.c=!1)}else p.c=!1;$+=V.addedLength,re+=1}if(p._length&&(p.setXYAt(p.v[H][0],p.v[H][1],"i",H),p.setXYAt(p.v[p._length-1][0],p.v[p._length-1][1],"o",p._length-1)),$>f.e)break;S<w-1&&(p=Dt.newElement(),ee=!0,W.push(p),re=0)}return W};function Ws(){}d([dr],Ws),Ws.prototype.initModifierProperties=function(c,f){this.getValue=this.processKeys,this.amount=_e.getProp(c,f.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},Ws.prototype.processPath=function(c,f){var p=f/100,m=[0,0],x=c._length,S=0;for(S=0;S<x;S+=1)m[0]+=c.v[S][0],m[1]+=c.v[S][1];m[0]/=x,m[1]/=x;var w=Dt.newElement();w.c=c.c;var k,_,$,V,re,I;for(S=0;S<x;S+=1)k=c.v[S][0]+(m[0]-c.v[S][0])*p,_=c.v[S][1]+(m[1]-c.v[S][1])*p,$=c.o[S][0]+(m[0]-c.o[S][0])*-p,V=c.o[S][1]+(m[1]-c.o[S][1])*-p,re=c.i[S][0]+(m[0]-c.i[S][0])*-p,I=c.i[S][1]+(m[1]-c.i[S][1])*-p,w.setTripleAt(k,_,$,V,re,I,S);return w},Ws.prototype.processShapes=function(c){var f,p,m=this.shapes.length,x,S,w=this.amount.v;if(w!==0){var k,_;for(p=0;p<m;p+=1){if(k=this.shapes[p],_=k.localShapeCollection,!(!k.shape._mdf&&!this._mdf&&!c))for(_.releaseShapes(),k.shape._mdf=!0,f=k.shape.paths.shapes,S=k.shape.paths._length,x=0;x<S;x+=1)_.addShape(this.processPath(f[x],w));k.shape.paths=k.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};var _o=function(){var c=[0,0];function f(_){var $=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||$,this.a&&_.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&_.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&_.skewFromAxis(-this.sk.v,this.sa.v),this.r?_.rotate(-this.r.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.data.p.s?this.data.p.z?_.translate(this.px.v,this.py.v,-this.pz.v):_.translate(this.px.v,this.py.v,0):_.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}function p(_){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||_){var $;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,re;if($=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)/$,0),re=this.p.getValueAtTime(this.p.keyframes[0].t/$,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/$,0),re=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/$,0)):(V=this.p.pv,re=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/$,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){V=[],re=[];var I=this.px,j=this.py;I._caching.lastFrame+I.offsetTime<=I.keyframes[0].t?(V[0]=I.getValueAtTime((I.keyframes[0].t+.01)/$,0),V[1]=j.getValueAtTime((j.keyframes[0].t+.01)/$,0),re[0]=I.getValueAtTime(I.keyframes[0].t/$,0),re[1]=j.getValueAtTime(j.keyframes[0].t/$,0)):I._caching.lastFrame+I.offsetTime>=I.keyframes[I.keyframes.length-1].t?(V[0]=I.getValueAtTime(I.keyframes[I.keyframes.length-1].t/$,0),V[1]=j.getValueAtTime(j.keyframes[j.keyframes.length-1].t/$,0),re[0]=I.getValueAtTime((I.keyframes[I.keyframes.length-1].t-.01)/$,0),re[1]=j.getValueAtTime((j.keyframes[j.keyframes.length-1].t-.01)/$,0)):(V=[I.pv,j.pv],re[0]=I.getValueAtTime((I._caching.lastFrame+I.offsetTime-.01)/$,I.offsetTime),re[1]=j.getValueAtTime((j._caching.lastFrame+j.offsetTime-.01)/$,j.offsetTime))}else re=c,V=re;this.v.rotate(-Math.atan2(V[1]-re[1],V[0]-re[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 x(){}function S(_){this._addDynamicProperty(_),this.elem.addDynamicProperty(_),this._isDirty=!0}function w(_,$,V){if(this.elem=_,this.frameId=-1,this.propType="transform",this.data=$,this.v=new we,this.pre=new we,this.appliedTransformations=0,this.initDynamicPropertyContainer(V||_),$.p&&$.p.s?(this.px=_e.getProp(_,$.p.x,0,0,this),this.py=_e.getProp(_,$.p.y,0,0,this),$.p.z&&(this.pz=_e.getProp(_,$.p.z,0,0,this))):this.p=_e.getProp(_,$.p||{k:[0,0,0]},1,0,this),$.rx){if(this.rx=_e.getProp(_,$.rx,0,Q,this),this.ry=_e.getProp(_,$.ry,0,Q,this),this.rz=_e.getProp(_,$.rz,0,Q,this),$.or.k[0].ti){var re,I=$.or.k.length;for(re=0;re<I;re+=1)$.or.k[re].to=null,$.or.k[re].ti=null}this.or=_e.getProp(_,$.or,1,Q,this),this.or.sh=!0}else this.r=_e.getProp(_,$.r||{k:0},0,Q,this);$.sk&&(this.sk=_e.getProp(_,$.sk,0,Q,this),this.sa=_e.getProp(_,$.sa,0,Q,this)),this.a=_e.getProp(_,$.a||{k:[0,0,0]},1,0,this),this.s=_e.getProp(_,$.s||{k:[100,100,100]},1,.01,this),$.o?this.o=_e.getProp(_,$.o,0,.01,_):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}w.prototype={applyToMatrix:f,getValue:p,precalculateMatrix:m,autoOrient:x},d([_t],w),w.prototype.addDynamicProperty=S,w.prototype._addDynamicProperty=_t.prototype.addDynamicProperty;function k(_,$,V){return new w(_,$,V)}return{getTransformProperty:k}}();function Mr(){}d([dr],Mr),Mr.prototype.initModifierProperties=function(c,f){this.getValue=this.processKeys,this.c=_e.getProp(c,f.c,0,null,this),this.o=_e.getProp(c,f.o,0,null,this),this.tr=_o.getTransformProperty(c,f.tr,this),this.so=_e.getProp(c,f.tr.so,0,.01,this),this.eo=_e.getProp(c,f.tr.eo,0,.01,this),this.data=f,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new we,this.rMatrix=new we,this.sMatrix=new we,this.tMatrix=new we,this.matrix=new we},Mr.prototype.applyTransforms=function(c,f,p,m,x,S){var w=S?-1:1,k=m.s.v[0]+(1-m.s.v[0])*(1-x),_=m.s.v[1]+(1-m.s.v[1])*(1-x);c.translate(m.p.v[0]*w*x,m.p.v[1]*w*x,m.p.v[2]),f.translate(-m.a.v[0],-m.a.v[1],m.a.v[2]),f.rotate(-m.r.v*w*x),f.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(S?1/k:k,S?1/_:_),p.translate(m.a.v[0],m.a.v[1],m.a.v[2])},Mr.prototype.init=function(c,f,p,m){for(this.elem=c,this.arr=f,this.pos=p,this.elemsData=m,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(c),this.initModifierProperties(c,f[p]);p>0;)p-=1,this._elements.unshift(f[p]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},Mr.prototype.resetElements=function(c){var f,p=c.length;for(f=0;f<p;f+=1)c[f]._processed=!1,c[f].ty==="gr"&&this.resetElements(c[f].it)},Mr.prototype.cloneElements=function(c){var f=JSON.parse(JSON.stringify(c));return this.resetElements(f),f},Mr.prototype.changeGroupRender=function(c,f){var p,m=c.length;for(p=0;p<m;p+=1)c[p]._render=f,c[p].ty==="gr"&&this.changeGroupRender(c[p].it,f)},Mr.prototype.processShapes=function(c){var f,p,m,x,S,w=!1;if(this._mdf||c){var k=Math.ceil(this.c.v);if(this._groups.length<k){for(;this._groups.length<k;){var _={it:this.cloneElements(this._elements),ty:"gr"};_.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,_),this._groups.splice(0,0,_),this._currentCopies+=1}this.elem.reloadShapes(),w=!0}S=0;var $;for(m=0;m<=this._groups.length-1;m+=1){if($=S<k,this._groups[m]._render=$,this.changeGroupRender(this._groups[m].it,$),!$){var V=this.elemsData[m].it,re=V[V.length-1];re.transform.op.v!==0?(re.transform.op._mdf=!0,re.transform.op.v=0):re.transform.op._mdf=!1}S+=1}this._currentCopies=k;var I=this.o.v,j=I%1,W=I>0?Math.floor(I):Math.ceil(I),H=this.pMatrix.props,ee=this.rMatrix.props,G=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var F=0;if(I>0){for(;F<W;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),F+=1;j&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,j,!1),F+=j)}else if(I<0){for(;F>W;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),F-=1;j&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-j,!0),F-=j)}m=this.data.m===1?0:this._currentCopies-1,x=this.data.m===1?1:-1,S=this._currentCopies;for(var R,P;S;){if(f=this.elemsData[m].it,p=f[f.length-1].transform.mProps.v.props,P=p.length,f[f.length-1].transform.mProps._mdf=!0,f[f.length-1].transform.op._mdf=!0,f[f.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(m/(this._currentCopies-1)),F!==0){for((m!==0&&x===1||m!==this._currentCopies-1&&x===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(ee[0],ee[1],ee[2],ee[3],ee[4],ee[5],ee[6],ee[7],ee[8],ee[9],ee[10],ee[11],ee[12],ee[13],ee[14],ee[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(H[0],H[1],H[2],H[3],H[4],H[5],H[6],H[7],H[8],H[9],H[10],H[11],H[12],H[13],H[14],H[15]),R=0;R<P;R+=1)p[R]=this.matrix.props[R];this.matrix.reset()}else for(this.matrix.reset(),R=0;R<P;R+=1)p[R]=this.matrix.props[R];F+=1,S-=1,m+=x}}else for(S=this._currentCopies,m=0,x=1;S;)f=this.elemsData[m].it,p=f[f.length-1].transform.mProps.v.props,f[f.length-1].transform.mProps._mdf=!1,f[f.length-1].transform.op._mdf=!1,S-=1,m+=x;return w},Mr.prototype.addShape=function(){};function qs(){}d([dr],qs),qs.prototype.initModifierProperties=function(c,f){this.getValue=this.processKeys,this.rd=_e.getProp(c,f.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},qs.prototype.processPath=function(c,f){var p=Dt.newElement();p.c=c.c;var m,x=c._length,S,w,k,_,$,V,re=0,I,j,W,H,ee,G;for(m=0;m<x;m+=1)S=c.v[m],k=c.o[m],w=c.i[m],S[0]===k[0]&&S[1]===k[1]&&S[0]===w[0]&&S[1]===w[1]?(m===0||m===x-1)&&!c.c?(p.setTripleAt(S[0],S[1],k[0],k[1],w[0],w[1],re),re+=1):(m===0?_=c.v[x-1]:_=c.v[m-1],$=Math.sqrt(Math.pow(S[0]-_[0],2)+Math.pow(S[1]-_[1],2)),V=$?Math.min($/2,f)/$:0,ee=S[0]+(_[0]-S[0])*V,I=ee,G=S[1]-(S[1]-_[1])*V,j=G,W=I-(I-S[0])*q,H=j-(j-S[1])*q,p.setTripleAt(I,j,W,H,ee,G,re),re+=1,m===x-1?_=c.v[0]:_=c.v[m+1],$=Math.sqrt(Math.pow(S[0]-_[0],2)+Math.pow(S[1]-_[1],2)),V=$?Math.min($/2,f)/$:0,W=S[0]+(_[0]-S[0])*V,I=W,H=S[1]+(_[1]-S[1])*V,j=H,ee=I-(I-S[0])*q,G=j-(j-S[1])*q,p.setTripleAt(I,j,W,H,ee,G,re),re+=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],re),re+=1);return p},qs.prototype.processShapes=function(c){var f,p,m=this.shapes.length,x,S,w=this.rd.v;if(w!==0){var k,_;for(p=0;p<m;p+=1){if(k=this.shapes[p],_=k.localShapeCollection,!(!k.shape._mdf&&!this._mdf&&!c))for(_.releaseShapes(),k.shape._mdf=!0,f=k.shape.paths.shapes,S=k.shape.paths._length,x=0;x<S;x+=1)_.addShape(this.processPath(f[x],w));k.shape.paths=k.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function na(c,f){return Math.abs(c-f)*1e5<=Math.min(Math.abs(c),Math.abs(f))}function Co(c){return Math.abs(c)<=1e-5}function Cu(c,f,p){return c*(1-p)+f*p}function bi(c,f,p){return[Cu(c[0],f[0],p),Cu(c[1],f[1],p)]}function w0(c,f,p){if(c===0)return[];var m=f*f-4*c*p;if(m<0)return[];var x=-f/(2*c);if(m===0)return[x];var S=Math.sqrt(m)/(2*c);return[x-S,x+S]}function Lu(c,f,p,m){return[-c+3*f-3*p+m,3*c-6*f+3*p,-3*c+3*f,c]}function Ru(c){return new wt(c,c,c,c,!1)}function wt(c,f,p,m,x){x&&ms(c,f)&&(f=bi(c,m,1/3)),x&&ms(p,m)&&(p=bi(c,m,2/3));var S=Lu(c[0],f[0],p[0],m[0]),w=Lu(c[1],f[1],p[1],m[1]);this.a=[S[0],w[0]],this.b=[S[1],w[1]],this.c=[S[2],w[2]],this.d=[S[3],w[3]],this.points=[c,f,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 f=this.derivative(c);return Math.atan2(f[1],f[0])},wt.prototype.normalAngle=function(c){var f=this.derivative(c);return Math.atan2(f[0],f[1])},wt.prototype.inflectionPoints=function(){var c=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(Co(c))return[];var f=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/c,p=f*f-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?[f]:[]:[f-m,f+m].filter(function(x){return x>0&&x<1})},wt.prototype.split=function(c){if(c<=0)return[Ru(this.points[0]),this];if(c>=1)return[this,Ru(this.points[this.points.length-1])];var f=bi(this.points[0],this.points[1],c),p=bi(this.points[1],this.points[2],c),m=bi(this.points[2],this.points[3],c),x=bi(f,p,c),S=bi(p,m,c),w=bi(x,S,c);return[new wt(this.points[0],f,x,w,!0),new wt(w,S,m,this.points[3],!0)]};function Iu(c,f){var p=c.points[0][f],m=c.points[c.points.length-1][f];if(p>m){var x=m;m=p,p=x}for(var S=w0(3*c.a[f],2*c.b[f],c.c[f]),w=0;w<S.length;w+=1)if(S[w]>0&&S[w]<1){var k=c.point(S[w])[f];k<p?p=k:k>m&&(m=k)}return{min:p,max:m}}wt.prototype.bounds=function(){return{x:Iu(this,0),y:Iu(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 aa(c,f,p){var m=c.boundingBox();return{cx:m.cx,cy:m.cy,width:m.width,height:m.height,bez:c,t:(f+p)/2,t1:f,t2:p}}function Pu(c){var f=c.bez.split(.5);return[aa(f[0],c.t1,c.t),aa(f[1],c.t,c.t2)]}function A0(c,f){return Math.abs(c.cx-f.cx)*2<c.width+f.width&&Math.abs(c.cy-f.cy)*2<c.height+f.height}function Ys(c,f,p,m,x,S){if(A0(c,f)){if(p>=S||c.width<=m&&c.height<=m&&f.width<=m&&f.height<=m){x.push([c.t,f.t]);return}var w=Pu(c),k=Pu(f);Ys(w[0],k[0],p+1,m,x,S),Ys(w[0],k[1],p+1,m,x,S),Ys(w[1],k[0],p+1,m,x,S),Ys(w[1],k[1],p+1,m,x,S)}}wt.prototype.intersections=function(c,f,p){f===void 0&&(f=2),p===void 0&&(p=7);var m=[];return Ys(aa(this,0,1),aa(c,0,1),0,f,m,p),m},wt.shapeSegment=function(c,f){var p=(f+1)%c.length();return new wt(c.v[f],c.o[f],c.i[p],c.v[p],!0)},wt.shapeSegmentInverted=function(c,f){var p=(f+1)%c.length();return new wt(c.v[p],c.i[p],c.o[f],c.v[f],!0)};function Lo(c,f){return[c[1]*f[2]-c[2]*f[1],c[2]*f[0]-c[0]*f[2],c[0]*f[1]-c[1]*f[0]]}function oa(c,f,p,m){var x=[c[0],c[1],1],S=[f[0],f[1],1],w=[p[0],p[1],1],k=[m[0],m[1],1],_=Lo(Lo(x,S),Lo(w,k));return Co(_[2])?null:[_[0]/_[2],_[1]/_[2]]}function gs(c,f,p){return[c[0]+Math.cos(f)*p,c[1]-Math.sin(f)*p]}function Ro(c,f){return Math.hypot(c[0]-f[0],c[1]-f[1])}function ms(c,f){return na(c[0],f[0])&&na(c[1],f[1])}function Xs(){}d([dr],Xs),Xs.prototype.initModifierProperties=function(c,f){this.getValue=this.processKeys,this.amplitude=_e.getProp(c,f.s,0,null,this),this.frequency=_e.getProp(c,f.r,0,null,this),this.pointsType=_e.getProp(c,f.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function ku(c,f,p,m,x,S,w){var k=p-Math.PI/2,_=p+Math.PI/2,$=f[0]+Math.cos(p)*m*x,V=f[1]-Math.sin(p)*m*x;c.setTripleAt($,V,$+Math.cos(k)*S,V-Math.sin(k)*S,$+Math.cos(_)*w,V-Math.sin(_)*w,c.length())}function _0(c,f){var p=[f[0]-c[0],f[1]-c[1]],m=-Math.PI*.5,x=[Math.cos(m)*p[0]-Math.sin(m)*p[1],Math.sin(m)*p[0]+Math.cos(m)*p[1]];return x}function C0(c,f){var p=f===0?c.length()-1:f-1,m=(f+1)%c.length(),x=c.v[p],S=c.v[m],w=_0(x,S);return Math.atan2(0,1)-Math.atan2(w[1],w[0])}function Du(c,f,p,m,x,S,w){var k=C0(f,p),_=f.v[p%f._length],$=f.v[p===0?f._length-1:p-1],V=f.v[(p+1)%f._length],re=S===2?Math.sqrt(Math.pow(_[0]-$[0],2)+Math.pow(_[1]-$[1],2)):0,I=S===2?Math.sqrt(Math.pow(_[0]-V[0],2)+Math.pow(_[1]-V[1],2)):0;ku(c,f.v[p%f._length],k,w,m,I/((x+1)*2),re/((x+1)*2))}function L0(c,f,p,m,x,S){for(var w=0;w<m;w+=1){var k=(w+1)/(m+1),_=x===2?Math.sqrt(Math.pow(f.points[3][0]-f.points[0][0],2)+Math.pow(f.points[3][1]-f.points[0][1],2)):0,$=f.normalAngle(k),V=f.point(k);ku(c,V,$,S,p,_/((m+1)*2),_/((m+1)*2)),S=-S}return S}Xs.prototype.processPath=function(c,f,p,m){var x=c._length,S=Dt.newElement();if(S.c=c.c,c.c||(x-=1),x===0)return S;var w=-1,k=wt.shapeSegment(c,0);Du(S,c,0,f,p,m,w);for(var _=0;_<x;_+=1)w=L0(S,k,f,p,m,-w),_===x-1&&!c.c?k=null:k=wt.shapeSegment(c,(_+1)%x),Du(S,c,_+1,f,p,m,w);return S},Xs.prototype.processShapes=function(c){var f,p,m=this.shapes.length,x,S,w=this.amplitude.v,k=Math.max(0,Math.round(this.frequency.v)),_=this.pointsType.v;if(w!==0){var $,V;for(p=0;p<m;p+=1){if($=this.shapes[p],V=$.localShapeCollection,!(!$.shape._mdf&&!this._mdf&&!c))for(V.releaseShapes(),$.shape._mdf=!0,f=$.shape.paths.shapes,S=$.shape.paths._length,x=0;x<S;x+=1)V.addShape(this.processPath(f[x],w,k,_));$.shape.paths=$.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function Io(c,f,p){var m=Math.atan2(f[0]-c[0],f[1]-c[1]);return[gs(c,m,p),gs(f,m,p)]}function vs(c,f){var p,m,x,S,w,k,_;_=Io(c.points[0],c.points[1],f),p=_[0],m=_[1],_=Io(c.points[1],c.points[2],f),x=_[0],S=_[1],_=Io(c.points[2],c.points[3],f),w=_[0],k=_[1];var $=oa(p,m,x,S);$===null&&($=m);var V=oa(w,k,x,S);return V===null&&(V=w),new wt(p,$,V,k)}function Ou(c,f,p,m,x){var S=f.points[3],w=p.points[0];if(m===3||ms(S,w))return S;if(m===2){var k=-f.tangentAngle(1),_=-p.tangentAngle(0)+Math.PI,$=oa(S,gs(S,k+Math.PI/2,100),w,gs(w,k+Math.PI/2,100)),V=$?Ro($,S):Ro(S,w)/2,re=gs(S,k,2*V*q);return c.setXYAt(re[0],re[1],"o",c.length()-1),re=gs(w,_,2*V*q),c.setTripleAt(w[0],w[1],w[0],w[1],re[0],re[1],c.length()),w}var I=ms(S,f.points[2])?f.points[0]:f.points[2],j=ms(w,p.points[1])?p.points[3]:p.points[1],W=oa(I,S,w,j);return W&&Ro(W,S)<x?(c.setTripleAt(W[0],W[1],W[0],W[1],W[0],W[1],c.length()),W):S}function Mu(c,f){var p=c.intersections(f);return p.length&&na(p[0][0],1)&&p.shift(),p.length?p[0]:null}function Fu(c,f){var p=c.slice(),m=f.slice(),x=Mu(c[c.length-1],f[0]);return x&&(p[c.length-1]=c[c.length-1].split(x[0])[0],m[0]=f[0].split(x[1])[1]),c.length>1&&f.length>1&&(x=Mu(c[0],f[f.length-1]),x)?[[c[0].split(x[0])[0]],[f[f.length-1].split(x[1])[1]]]:[p,m]}function R0(c){for(var f,p=1;p<c.length;p+=1)f=Fu(c[p-1],c[p]),c[p-1]=f[0],c[p]=f[1];return c.length>1&&(f=Fu(c[c.length-1],c[0]),c[c.length-1]=f[0],c[0]=f[1]),c}function Nu(c,f){var p=c.inflectionPoints(),m,x,S,w;if(p.length===0)return[vs(c,f)];if(p.length===1||na(p[1],1))return S=c.split(p[0]),m=S[0],x=S[1],[vs(m,f),vs(x,f)];S=c.split(p[0]),m=S[0];var k=(p[1]-p[0])/(1-p[0]);return S=S[1].split(k),w=S[0],x=S[1],[vs(m,f),vs(w,f),vs(x,f)]}function Qs(){}d([dr],Qs),Qs.prototype.initModifierProperties=function(c,f){this.getValue=this.processKeys,this.amount=_e.getProp(c,f.a,0,null,this),this.miterLimit=_e.getProp(c,f.ml,0,null,this),this.lineJoin=f.lj,this._isAnimated=this.amount.effectsSequence.length!==0},Qs.prototype.processPath=function(c,f,p,m){var x=Dt.newElement();x.c=c.c;var S=c.length();c.c||(S-=1);var w,k,_,$=[];for(w=0;w<S;w+=1)_=wt.shapeSegment(c,w),$.push(Nu(_,f));if(!c.c)for(w=S-1;w>=0;w-=1)_=wt.shapeSegmentInverted(c,w),$.push(Nu(_,f));$=R0($);var V=null,re=null;for(w=0;w<$.length;w+=1){var I=$[w];for(re&&(V=Ou(x,re,I[0],p,m)),re=I[I.length-1],k=0;k<I.length;k+=1)_=I[k],V&&ms(_.points[0],V)?x.setXYAt(_.points[1][0],_.points[1][1],"o",x.length()-1):x.setTripleAt(_.points[0][0],_.points[0][1],_.points[1][0],_.points[1][1],_.points[0][0],_.points[0][1],x.length()),x.setTripleAt(_.points[3][0],_.points[3][1],_.points[3][0],_.points[3][1],_.points[2][0],_.points[2][1],x.length()),V=_.points[3]}return $.length&&Ou(x,re,$[0][0],p,m),x},Qs.prototype.processShapes=function(c){var f,p,m=this.shapes.length,x,S,w=this.amount.v,k=this.miterLimit.v,_=this.lineJoin;if(w!==0){var $,V;for(p=0;p<m;p+=1){if($=this.shapes[p],V=$.localShapeCollection,!(!$.shape._mdf&&!this._mdf&&!c))for(V.releaseShapes(),$.shape._mdf=!0,f=$.shape.paths.shapes,S=$.shape.paths._length,x=0;x<S;x+=1)V.addShape(this.processPath(f[x],w,_,k));$.shape.paths=$.localShapeCollection}}this.dynamicProperties.length||(this._mdf=!1)};function Bu(c){for(var f=c.fStyle?c.fStyle.split(" "):[],p="normal",m="normal",x=f.length,S,w=0;w<x;w+=1)switch(S=f[w].toLowerCase(),S){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 Hi=function(){var c=5e3,f={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,x=917631,S=917601,w=917626,k=65039,_=8205,$=127462,V=127487,re=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function I(O){var K=O.split(","),T,L=K.length,ne=[];for(T=0;T<L;T+=1)K[T]!=="sans-serif"&&K[T]!=="monospace"&&ne.push(K[T]);return ne.join(",")}function j(O,K){var T=h("span");T.setAttribute("aria-hidden",!0),T.style.fontFamily=K;var L=h("span");L.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(L),document.body.appendChild(T);var ne=L.offsetWidth;return L.style.fontFamily=I(O)+", "+K,{node:L,w:ne,parent:T}}function W(){var O,K=this.fonts.length,T,L,ne=K;for(O=0;O<K;O+=1)this.fonts[O].loaded?ne-=1:this.fonts[O].fOrigin==="n"||this.fonts[O].origin===0?this.fonts[O].loaded=!0:(T=this.fonts[O].monoCase.node,L=this.fonts[O].monoCase.w,T.offsetWidth!==L?(ne-=1,this.fonts[O].loaded=!0):(T=this.fonts[O].sansCase.node,L=this.fonts[O].sansCase.w,T.offsetWidth!==L&&(ne-=1,this.fonts[O].loaded=!0)),this.fonts[O].loaded&&(this.fonts[O].sansCase.parent.parentNode.removeChild(this.fonts[O].sansCase.parent),this.fonts[O].monoCase.parent.parentNode.removeChild(this.fonts[O].monoCase.parent)));ne!==0&&Date.now()-this.initTime<c?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)}function H(O,K){var T=document.body&&K?"svg":"canvas",L,ne=Bu(O);if(T==="svg"){var X=ke("text");X.style.fontSize="100px",X.setAttribute("font-family",O.fFamily),X.setAttribute("font-style",ne.style),X.setAttribute("font-weight",ne.weight),X.textContent="1",O.fClass?(X.style.fontFamily="inherit",X.setAttribute("class",O.fClass)):X.style.fontFamily=O.fFamily,K.appendChild(X),L=X}else{var Le=new OffscreenCanvas(500,500).getContext("2d");Le.font=ne.style+" "+ne.weight+" 100px "+O.fFamily,L=Le}function Ne(He){return T==="svg"?(L.textContent=He,L.getComputedTextLength()):L.measureText(He).width}return{measureText:Ne}}function ee(O,K){if(!O){this.isLoaded=!0;return}if(this.chars){this.isLoaded=!0,this.fonts=O.list;return}if(!document.body){this.isLoaded=!0,O.list.forEach(function(Jt){Jt.helper=H(Jt),Jt.cache={}}),this.fonts=O.list;return}var T=O.list,L,ne=T.length,X=ne;for(L=0;L<ne;L+=1){var Le=!0,Ne,He;if(T[L].loaded=!1,T[L].monoCase=j(T[L].fFamily,"monospace"),T[L].sansCase=j(T[L].fFamily,"sans-serif"),!T[L].fPath)T[L].loaded=!0,X-=1;else if(T[L].fOrigin==="p"||T[L].origin===3){if(Ne=document.querySelectorAll('style[f-forigin="p"][f-family="'+T[L].fFamily+'"], style[f-origin="3"][f-family="'+T[L].fFamily+'"]'),Ne.length>0&&(Le=!1),Le){var st=h("style");st.setAttribute("f-forigin",T[L].fOrigin),st.setAttribute("f-origin",T[L].origin),st.setAttribute("f-family",T[L].fFamily),st.type="text/css",st.innerText="@font-face {font-family: "+T[L].fFamily+"; font-style: normal; src: url('"+T[L].fPath+"');}",K.appendChild(st)}}else if(T[L].fOrigin==="g"||T[L].origin===1){for(Ne=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),He=0;He<Ne.length;He+=1)Ne[He].href.indexOf(T[L].fPath)!==-1&&(Le=!1);if(Le){var nt=h("link");nt.setAttribute("f-forigin",T[L].fOrigin),nt.setAttribute("f-origin",T[L].origin),nt.type="text/css",nt.rel="stylesheet",nt.href=T[L].fPath,document.body.appendChild(nt)}}else if(T[L].fOrigin==="t"||T[L].origin===2){for(Ne=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),He=0;He<Ne.length;He+=1)T[L].fPath===Ne[He].src&&(Le=!1);if(Le){var It=h("link");It.setAttribute("f-forigin",T[L].fOrigin),It.setAttribute("f-origin",T[L].origin),It.setAttribute("rel","stylesheet"),It.setAttribute("href",T[L].fPath),K.appendChild(It)}}T[L].helper=H(T[L],K),T[L].cache={},this.fonts.push(T[L])}X===0?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}function G(O){if(O){this.chars||(this.chars=[]);var K,T=O.length,L,ne=this.chars.length,X;for(K=0;K<T;K+=1){for(L=0,X=!1;L<ne;)this.chars[L].style===O[K].style&&this.chars[L].fFamily===O[K].fFamily&&this.chars[L].ch===O[K].ch&&(X=!0),L+=1;X||(this.chars.push(O[K]),ne+=1)}}}function F(O,K,T){for(var L=0,ne=this.chars.length;L<ne;){if(this.chars[L].ch===O&&this.chars[L].style===K&&this.chars[L].fFamily===T)return this.chars[L];L+=1}return(typeof O=="string"&&O.charCodeAt(0)!==13||!O)&&console&&console.warn&&!this._warned&&(this._warned=!0,console.warn("Missing character from exported characters list: ",O,K,T)),f}function R(O,K,T){var L=this.getFontByName(K),ne=O;if(!L.cache[ne]){var X=L.helper;if(O===" "){var Le=X.measureText("|"+O+"|"),Ne=X.measureText("||");L.cache[ne]=(Le-Ne)/100}else L.cache[ne]=X.measureText(O)/100}return L.cache[ne]*T}function P(O){for(var K=0,T=this.fonts.length;K<T;){if(this.fonts[K].fName===O)return this.fonts[K];K+=1}return this.fonts[0]}function U(O){var K=0,T=O.charCodeAt(0);if(T>=55296&&T<=56319){var L=O.charCodeAt(1);L>=56320&&L<=57343&&(K=(T-55296)*1024+L-56320+65536)}return K}function Y(O,K){var T=O.toString(16)+K.toString(16);return re.indexOf(T)!==-1}function te(O){return O===_}function ae(O){return O===k}function xe(O){var K=U(O);return K>=$&&K<=V}function je(O){return xe(O.substr(0,2))&&xe(O.substr(2,2))}function De(O){return p.indexOf(O)!==-1}function Ae(O,K){var T=U(O.substr(K,2));if(T!==m)return!1;var L=0;for(K+=2;L<5;){if(T=U(O.substr(K,2)),T<S||T>w)return!1;L+=1,K+=2}return U(O.substr(K,2))===x}function qe(){this.isLoaded=!0}var Ie=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)};Ie.isModifier=Y,Ie.isZeroWidthJoiner=te,Ie.isFlagEmoji=je,Ie.isRegionalCode=xe,Ie.isCombinedCharacter=De,Ie.isRegionalFlag=Ae,Ie.isVariationSelector=ae,Ie.BLACK_FLAG_CODE_POINT=m;var ve={addChars:G,addFonts:ee,getCharData:F,getFontByName:P,measureText:R,checkLoadedFonts:W,setIsLoaded:qe};return Ie.prototype=ve,Ie}();function $u(c){this.animationData=c}$u.prototype.getProp=function(c){return this.animationData.slots&&this.animationData.slots[c.sid]?Object.assign(c,this.animationData.slots[c.sid].p):c};function I0(c){return new $u(c)}function la(){}la.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(f){this.renderableComponents.indexOf(f)===-1&&this.renderableComponents.push(f)},removeRenderableComponent:function(f){this.renderableComponents.indexOf(f)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(f),1)},prepareRenderableFrame:function(f){this.checkLayerLimits(f)},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(f){this.data.ip-this.data.st<=f&&this.data.op-this.data.st>f?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 f,p=this.renderableComponents.length;for(f=0;f<p;f+=1)this.renderableComponents[f].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(f){return c[f]||""}}();function P0(c,f,p){this.p=_e.getProp(f,c.v,0,0,p)}function k0(c,f,p){this.p=_e.getProp(f,c.v,0,0,p)}function D0(c,f,p){this.p=_e.getProp(f,c.v,1,0,p)}function O0(c,f,p){this.p=_e.getProp(f,c.v,1,0,p)}function M0(c,f,p){this.p=_e.getProp(f,c.v,0,0,p)}function F0(c,f,p){this.p=_e.getProp(f,c.v,0,0,p)}function N0(c,f,p){this.p=_e.getProp(f,c.v,0,0,p)}function B0(){this.p={}}function Uu(c,f){var p=c.ef||[];this.effectElements=[];var m,x=p.length,S;for(m=0;m<x;m+=1)S=new Js(p[m],f),this.effectElements.push(S)}function Js(c,f){this.init(c,f)}d([_t],Js),Js.prototype.getValue=Js.prototype.iterateDynamicProperties,Js.prototype.init=function(c,f){this.data=c,this.effectElements=[],this.initDynamicPropertyContainer(f);var p,m=this.data.ef.length,x,S=this.data.ef;for(p=0;p<m;p+=1){switch(x=null,S[p].ty){case 0:x=new P0(S[p],f,this);break;case 1:x=new k0(S[p],f,this);break;case 2:x=new D0(S[p],f,this);break;case 3:x=new O0(S[p],f,this);break;case 4:case 7:x=new N0(S[p],f,this);break;case 10:x=new M0(S[p],f,this);break;case 11:x=new F0(S[p],f,this);break;case 5:x=new Uu(S[p],f);break;default:x=new B0(S[p]);break}x&&this.effectElements.push(x)}};function Ei(){}Ei.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var f=0,p=this.data.masksProperties.length;f<p;){if(this.data.masksProperties[f].mode!=="n"&&this.data.masksProperties[f].cl!==!1)return!0;f+=1}return!1},initExpressions:function(){},setBlendMode:function(){var f=Po(this.data.bm),p=this.baseElement||this.layerElement;p.style["mix-blend-mode"]=f},initBaseData:function(f,p,m){this.globalData=p,this.comp=m,this.data=f,this.layerId=Ce(),this.data.sr||(this.data.sr=1),this.effectsManager=new Uu(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}};function Ti(){}Ti.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(f,p){var m,x=this.dynamicProperties.length;for(m=0;m<x;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(f){this.dynamicProperties.indexOf(f)===-1&&this.dynamicProperties.push(f)}};function wi(c,f,p){this.initFrame(),this.initRenderable(),this.assetData=f.getAssetData(c.refId),this.footageData=f.imageLoader.getAsset(this.assetData),this.initBaseData(c,f,p)}wi.prototype.prepareFrame=function(){},d([la,Ei,Ti],wi),wi.prototype.getBaseElement=function(){return null},wi.prototype.renderFrame=function(){},wi.prototype.destroy=function(){},wi.prototype.initExpressions=function(){},wi.prototype.getFootageData=function(){return this.footageData};function Qt(c,f,p){this.initFrame(),this.initRenderable(),this.assetData=f.getAssetData(c.refId),this.initBaseData(c,f,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?_e.getProp(this,c.tm,0,f.frameRate,this):{_placeholder:!0},this.lv=_e.getProp(this,c.au&&c.au.lv?c.au.lv:{k:[100]},1,.01,this)}Qt.prototype.prepareFrame=function(c){if(this.prepareRenderableFrame(c,!0),this.prepareProperties(c,!0),this.tm._placeholder)this._currentTime=c/this.data.sr;else{var f=this.tm.v;this._currentTime=f}this._volume=this.lv.v[0];var p=this._volume*this._volumeMultiplier;this._previousVolume!==p&&(this._previousVolume=p,this.audio.volume(p))},d([la,Ei,Ti],Qt),Qt.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))},Qt.prototype.show=function(){},Qt.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},Qt.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},Qt.prototype.resume=function(){this._canPlay=!0},Qt.prototype.setRate=function(c){this.audio.rate(c)},Qt.prototype.volume=function(c){this._volumeMultiplier=c,this._previousVolume=c*this._volume,this.audio.volume(this._previousVolume)},Qt.prototype.getBaseElement=function(){return null},Qt.prototype.destroy=function(){},Qt.prototype.sourceRectAtTime=function(){},Qt.prototype.initExpressions=function(){};function Kt(){}Kt.prototype.checkLayers=function(c){var f,p=this.layers.length,m;for(this.completeLayers=!0,f=p-1;f>=0;f-=1)this.elements[f]||(m=this.layers[f],m.ip-m.st<=c-this.layers[f].st&&m.op-m.st>c-this.layers[f].st&&this.buildItem(f)),this.completeLayers=this.elements[f]?this.completeLayers:!1;this.checkPendingElements()},Kt.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)}},Kt.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},Kt.prototype.createAudio=function(c){return new Qt(c,this.globalData,this)},Kt.prototype.createFootage=function(c){return new wi(c,this.globalData,this)},Kt.prototype.buildAllItems=function(){var c,f=this.layers.length;for(c=0;c<f;c+=1)this.buildItem(c);this.checkPendingElements()},Kt.prototype.includeLayers=function(c){this.completeLayers=!1;var f,p=c.length,m,x=this.layers.length;for(f=0;f<p;f+=1)for(m=0;m<x;){if(this.layers[m].id===c[f].id){this.layers[m]=c[f];break}m+=1}},Kt.prototype.setProjectInterface=function(c){this.globalData.projectInterface=c},Kt.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},Kt.prototype.buildElementParenting=function(c,f,p){for(var m=this.elements,x=this.layers,S=0,w=x.length;S<w;)x[S].ind==f&&(!m[S]||m[S]===!0?(this.buildItem(S),this.addPendingElement(c)):(p.push(m[S]),m[S].setAsParent(),x[S].parent!==void 0?this.buildElementParenting(c,x[S].parent,p):c.setHierarchy(p))),S+=1},Kt.prototype.addPendingElement=function(c){this.pendingElements.push(c)},Kt.prototype.searchExtraCompositions=function(c){var f,p=c.length;for(f=0;f<p;f+=1)if(c[f].xt){var m=this.createComp(c[f]);m.initExpressions(),this.globalData.projectInterface.registerComposition(m)}},Kt.prototype.getElementById=function(c){var f,p=this.elements.length;for(f=0;f<p;f+=1)if(this.elements[f].data.ind===c)return this.elements[f];return null},Kt.prototype.getElementByPath=function(c){var f=c.shift(),p;if(typeof f=="number")p=this.elements[f];else{var m,x=this.elements.length;for(m=0;m<x;m+=1)if(this.elements[m].data.nm===f){p=this.elements[m];break}}return c.length===0?p:p.getElementByPath(c)},Kt.prototype.setupGlobalData=function(c,f){this.globalData.fontManager=new Hi,this.globalData.slotManager=I0(c),this.globalData.fontManager.addChars(c.chars),this.globalData.fontManager.addFonts(c.fonts,f),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 $0={TRANSFORM_EFFECT:"transformEFfect"};function ys(){}ys.prototype={initTransform:function(){var f=new we;this.finalTransform={mProp:this.data.ks?_o.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:f,localMat:f,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 f,p=this.finalTransform.mat,m=0,x=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;m<x;){if(this.hierarchy[m].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}m+=1}if(this.finalTransform._matMdf)for(f=this.finalTransform.mProp.v.props,p.cloneFromProps(f),m=0;m<x;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 f=0,p=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;f<p;)this.localTransforms[f]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[f]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),f+=1;if(this.finalTransform._localMatMdf){var m=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(m),f=1;f<p;f+=1){var x=this.localTransforms[f].matrix;m.multiply(x)}m.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var S=this.finalTransform.localOpacity;for(f=0;f<p;f+=1)S*=this.localTransforms[f].opacity*.01;this.finalTransform.localOpacity=S}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var f=this.renderableEffectsManager.getEffects($0.TRANSFORM_EFFECT);if(f.length){this.localTransforms=[],this.finalTransform.localMat=new we;var p=0,m=f.length;for(p=0;p<m;p+=1)this.localTransforms.push(f[p])}}},globalToLocal:function(f){var p=[];p.push(this.finalTransform);for(var m=!0,x=this.comp;m;)x.finalTransform?(x.data.hasMask&&p.splice(0,0,x.finalTransform),x=x.comp):m=!1;var S,w=p.length,k;for(S=0;S<w;S+=1)k=p[S].mat.applyToPointArray(0,0,0),f=[f[0]-k[0],f[1]-k[1],0];return f},mHelper:new we};function Ki(c,f,p){this.data=c,this.element=f,this.globalData=p,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var m=this.globalData.defs,x,S=this.masksProperties?this.masksProperties.length:0;this.viewData=b(S),this.solidPath="";var w,k=this.masksProperties,_=0,$=[],V,re,I=Ce(),j,W,H,ee,G="clipPath",F="clip-path";for(x=0;x<S;x+=1)if((k[x].mode!=="a"&&k[x].mode!=="n"||k[x].inv||k[x].o.k!==100||k[x].o.x)&&(G="mask",F="mask"),(k[x].mode==="s"||k[x].mode==="i")&&_===0?(j=ke("rect"),j.setAttribute("fill","#ffffff"),j.setAttribute("width",this.element.comp.data.w||0),j.setAttribute("height",this.element.comp.data.h||0),$.push(j)):j=null,w=ke("path"),k[x].mode==="n")this.viewData[x]={op:_e.getProp(this.element,k[x].o,0,.01,this.element),prop:be.getShapeProp(this.element,k[x],3),elem:w,lastPath:""},m.appendChild(w);else{_+=1,w.setAttribute("fill",k[x].mode==="s"?"#000000":"#ffffff"),w.setAttribute("clip-rule","nonzero");var R;if(k[x].x.k!==0?(G="mask",F="mask",ee=_e.getProp(this.element,k[x].x,0,null,this.element),R=Ce(),W=ke("filter"),W.setAttribute("id",R),H=ke("feMorphology"),H.setAttribute("operator","erode"),H.setAttribute("in","SourceGraphic"),H.setAttribute("radius","0"),W.appendChild(H),m.appendChild(W),w.setAttribute("stroke",k[x].mode==="s"?"#000000":"#ffffff")):(H=null,ee=null),this.storedData[x]={elem:w,x:ee,expan:H,lastPath:"",lastOperator:"",filterId:R,lastRadius:0},k[x].mode==="i"){re=$.length;var P=ke("g");for(V=0;V<re;V+=1)P.appendChild($[V]);var U=ke("mask");U.setAttribute("mask-type","alpha"),U.setAttribute("id",I+"_"+_),U.appendChild(w),m.appendChild(U),P.setAttribute("mask","url("+u()+"#"+I+"_"+_+")"),$.length=0,$.push(P)}else $.push(w);k[x].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[x]={elem:w,lastPath:"",op:_e.getProp(this.element,k[x].o,0,.01,this.element),prop:be.getShapeProp(this.element,k[x],3),invRect:j},this.viewData[x].prop.k||this.drawPath(k[x],this.viewData[x].prop.v,this.viewData[x])}for(this.maskElement=ke(G),S=$.length,x=0;x<S;x+=1)this.maskElement.appendChild($[x]);_>0&&(this.maskElement.setAttribute("id",I),this.element.maskedElement.setAttribute(F,"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 f=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",f.getInverseMatrix().to2dCSS()),this.storedData[p].x&&(this.storedData[p].x._mdf||c))){var x=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+")")),x.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,f,p){var m=" M"+f.v[0][0]+","+f.v[0][1],x,S;for(S=f._length,x=1;x<S;x+=1)m+=" C"+f.o[x-1][0]+","+f.o[x-1][1]+" "+f.i[x][0]+","+f.i[x][1]+" "+f.v[x][0]+","+f.v[x][1];if(f.c&&S>1&&(m+=" C"+f.o[x-1][0]+","+f.o[x-1][1]+" "+f.i[0][0]+","+f.i[0][1]+" "+f.v[0][0]+","+f.v[0][1]),p.lastPath!==m){var w="";p.elem&&(f.c&&(w=c.inv?this.solidPath+m:m),p.elem.setAttribute("d",w)),p.lastPath=m}},Ki.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var Zs=function(){var c={};c.createFilter=f,c.createAlphaToLuminanceFilter=p;function f(m,x){var S=ke("filter");return S.setAttribute("id",m),x!==!0&&(S.setAttribute("filterUnits","objectBoundingBox"),S.setAttribute("x","0%"),S.setAttribute("y","0%"),S.setAttribute("width","100%"),S.setAttribute("height","100%")),S}function p(){var m=ke("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}(),Gu=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}(),ko={},Vu="filter_result_";function Do(c){var f,p="SourceGraphic",m=c.data.ef?c.data.ef.length:0,x=Ce(),S=Zs.createFilter(x,!0),w=0;this.filters=[];var k;for(f=0;f<m;f+=1){k=null;var _=c.data.ef[f].ty;if(ko[_]){var $=ko[_].effect;k=new $(S,c.effectsManager.effectElements[f],c,Vu+w,p),p=Vu+w,ko[_].countsAsEffect&&(w+=1)}k&&this.filters.push(k)}w&&(c.globalData.defs.appendChild(S),c.layerElement.setAttribute("filter","url("+u()+"#"+x+")")),this.filters.length&&c.addRenderableComponent(this)}Do.prototype.renderFrame=function(c){var f,p=this.filters.length;for(f=0;f<p;f+=1)this.filters[f].renderFrame(c)},Do.prototype.getEffects=function(c){var f,p=this.filters.length,m=[];for(f=0;f<p;f+=1)this.filters[f].type===c&&m.push(this.filters[f]);return m};function en(){}en.prototype={initRendererElement:function(){this.layerElement=ke("g")},createContainerElements:function(){this.matteElement=ke("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var f=null;if(this.data.td){this.matteMasks={};var p=ke("g");p.setAttribute("id",this.layerId),p.appendChild(this.layerElement),f=p,this.globalData.defs.appendChild(p)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),f=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=ke("clipPath"),x=ke("path");x.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var S=Ce();if(m.setAttribute("id",S),m.appendChild(x),this.globalData.defs.appendChild(m),this.checkMasks()){var w=ke("g");w.setAttribute("clip-path","url("+u()+"#"+S+")"),w.appendChild(this.layerElement),this.transformedElement=w,f?f.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+u()+"#"+S+")")}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 Do(this),this.searchEffectTransforms()},getMatte:function(f){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[f]){var p=this.layerId+"_"+f,m,x,S,w;if(f===1||f===3){var k=ke("mask");k.setAttribute("id",p),k.setAttribute("mask-type",f===3?"luminance":"alpha"),S=ke("use"),S.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),k.appendChild(S),this.globalData.defs.appendChild(k),!Gu.maskType&&f===1&&(k.setAttribute("mask-type","luminance"),m=Ce(),x=Zs.createFilter(m),this.globalData.defs.appendChild(x),x.appendChild(Zs.createAlphaToLuminanceFilter()),w=ke("g"),w.appendChild(S),k.appendChild(w),w.setAttribute("filter","url("+u()+"#"+m+")"))}else if(f===2){var _=ke("mask");_.setAttribute("id",p),_.setAttribute("mask-type","alpha");var $=ke("g");_.appendChild($),m=Ce(),x=Zs.createFilter(m);var V=ke("feComponentTransfer");V.setAttribute("in","SourceGraphic"),x.appendChild(V);var re=ke("feFuncA");re.setAttribute("type","table"),re.setAttribute("tableValues","1.0 0.0"),V.appendChild(re),this.globalData.defs.appendChild(x);var I=ke("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"),$.setAttribute("filter","url("+u()+"#"+m+")"),$.appendChild(I),S=ke("use"),S.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),$.appendChild(S),Gu.maskType||(_.setAttribute("mask-type","luminance"),x.appendChild(Zs.createAlphaToLuminanceFilter()),w=ke("g"),$.appendChild(I),w.appendChild(this.layerElement),$.appendChild(w)),this.globalData.defs.appendChild(_)}this.matteMasks[f]=p}return this.matteMasks[f]},setMatte:function(f){this.matteElement&&this.matteElement.setAttribute("mask","url("+u()+"#"+f+")")}};function Ss(){}Ss.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(f){this.hierarchy=f},setAsParent:function(){this._isParent=!0},checkParenting:function(){this.data.parent!==void 0&&this.comp.buildElementParenting(this,this.data.parent,[])}};function tn(){}(function(){var c={initElement:function(p,m,x){this.initFrame(),this.initBaseData(p,m,x),this.initTransform(p,m,x),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()}};d([la,g(c)],tn)})();function rn(c,f,p){this.assetData=f.getAssetData(c.refId),this.assetData&&this.assetData.sid&&(this.assetData=f.slotManager.getProp(this.assetData)),this.initElement(c,f,p),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}d([Ei,ys,en,Ss,Ti,tn],rn),rn.prototype.createContent=function(){var c=this.globalData.getAssetsPath(this.assetData);this.innerElem=ke("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 U0(c,f){this.elem=c,this.pos=f}function ju(){}ju.prototype={addShapeToModifiers:function(f){var p,m=this.shapeModifiers.length;for(p=0;p<m;p+=1)this.shapeModifiers[p].addShape(f)},isShapeInAnimatedModifiers:function(f){for(var p=0,m=this.shapeModifiers.length;p<m;)if(this.shapeModifiers[p].isAnimatedWithShape(f))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var f,p=this.shapes.length;for(f=0;f<p;f+=1)this.shapes[f].sh.reset();p=this.shapeModifiers.length;var m;for(f=p-1;f>=0&&(m=this.shapeModifiers[f].processShapes(this._isFirstFrame),!m);f-=1);}},searchProcessedElement:function(f){for(var p=this.processedElements,m=0,x=p.length;m<x;){if(p[m].elem===f)return p[m].pos;m+=1}return 0},addProcessedElement:function(f,p){for(var m=this.processedElements,x=m.length;x;)if(x-=1,m[x].elem===f){m[x].pos=p;return}m.push(new U0(f,p))},prepareFrame:function(f){this.prepareRenderableFrame(f),this.prepareProperties(f,this.isInRange)}};var Hu={1:"butt",2:"round",3:"square"},Ku={1:"miter",2:"round",3:"bevel"};function zu(c,f,p){this.caches=[],this.styles=[],this.transformers=c,this.lStr="",this.sh=p,this.lvl=f,this._isAnimated=!!p.k;for(var m=0,x=c.length;m<x;){if(c[m].mProps.dynamicProperties.length){this._isAnimated=!0;break}m+=1}}zu.prototype.setAsAnimated=function(){this._isAnimated=!0};function Wu(c,f){this.data=c,this.type=c.ty,this.d="",this.lvl=f,this._mdf=!1,this.closed=c.hd===!0,this.pElem=ke("path"),this.msElem=null}Wu.prototype.reset=function(){this.d="",this._mdf=!1};function ca(c,f,p,m){this.elem=c,this.frameId=-1,this.dataProps=b(f.length),this.renderer=p,this.k=!1,this.dashStr="",this.dashArray=y("float32",f.length?f.length-1:0),this.dashoffset=y("float32",1),this.initDynamicPropertyContainer(m);var x,S=f.length||0,w;for(x=0;x<S;x+=1)w=_e.getProp(c,f[x].v,0,0,this),this.k=w.k||this.k,this.dataProps[x]={n:f[x].n,p:w};this.k||this.getValue(!0),this._isAnimated=this.k}ca.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 f=0,p=this.dataProps.length;for(this.renderer==="svg"&&(this.dashStr=""),f=0;f<p;f+=1)this.dataProps[f].n!=="o"?this.renderer==="svg"?this.dashStr+=" "+this.dataProps[f].p.v:this.dashArray[f]=this.dataProps[f].p.v:this.dashoffset[0]=this.dataProps[f].p.v}},d([_t],ca);function qu(c,f,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.o=_e.getProp(c,f.o,0,.01,this),this.w=_e.getProp(c,f.w,0,null,this),this.d=new ca(c,f.d||{},"svg",this),this.c=_e.getProp(c,f.c,1,255,this),this.style=p,this._isAnimated=!!this._isAnimated}d([_t],qu);function Yu(c,f,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.o=_e.getProp(c,f.o,0,.01,this),this.c=_e.getProp(c,f.c,1,255,this),this.style=p}d([_t],Yu);function Xu(c,f,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.style=p}d([_t],Xu);function sn(c,f,p){this.data=f,this.c=y("uint8c",f.p*4);var m=f.k.k[0].s?f.k.k[0].s.length-f.p*4:f.k.k.length-f.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=_e.getProp(c,f.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}sn.prototype.comparePoints=function(c,f){for(var p=0,m=this.o.length/2,x;p<m;){if(x=Math.abs(c[p*4]-c[f*4+p*2]),x>.01)return!1;p+=1}return!0},sn.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,f=this.data.k.k.length;c<f;){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},sn.prototype.getValue=function(c){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||c){var f,p=this.data.p*4,m,x;for(f=0;f<p;f+=1)m=f%4===0?100:255,x=Math.round(this.prop.v[f]*m),this.c[f]!==x&&(this.c[f]=x,this._cmdf=!c);if(this.o.length)for(p=this.prop.v.length,f=this.data.p*4;f<p;f+=1)m=f%2===0?100:1,x=f%2===0?Math.round(this.prop.v[f]*100):this.prop.v[f],this.o[f-this.data.p*4]!==x&&(this.o[f-this.data.p*4]=x,this._omdf=!c);this._mdf=!c}},d([_t],sn);function xs(c,f,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.initGradientData(c,f,p)}xs.prototype.initGradientData=function(c,f,p){this.o=_e.getProp(c,f.o,0,.01,this),this.s=_e.getProp(c,f.s,1,null,this),this.e=_e.getProp(c,f.e,1,null,this),this.h=_e.getProp(c,f.h||{k:0},0,.01,this),this.a=_e.getProp(c,f.a||{k:0},0,Q,this),this.g=new sn(c,f.g,this),this.style=p,this.stops=[],this.setGradientData(p.pElem,f),this.setGradientOpacity(f,p),this._isAnimated=!!this._isAnimated},xs.prototype.setGradientData=function(c,f){var p=Ce(),m=ke(f.t===1?"linearGradient":"radialGradient");m.setAttribute("id",p),m.setAttribute("spreadMethod","pad"),m.setAttribute("gradientUnits","userSpaceOnUse");var x=[],S,w,k;for(k=f.g.p*4,w=0;w<k;w+=4)S=ke("stop"),m.appendChild(S),x.push(S);c.setAttribute(f.ty==="gf"?"fill":"stroke","url("+u()+"#"+p+")"),this.gf=m,this.cst=x},xs.prototype.setGradientOpacity=function(c,f){if(this.g._hasOpacity&&!this.g._collapsable){var p,m,x,S=ke("mask"),w=ke("path");S.appendChild(w);var k=Ce(),_=Ce();S.setAttribute("id",_);var $=ke(c.t===1?"linearGradient":"radialGradient");$.setAttribute("id",k),$.setAttribute("spreadMethod","pad"),$.setAttribute("gradientUnits","userSpaceOnUse"),x=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<x;m+=2)p=ke("stop"),p.setAttribute("stop-color","rgb(255,255,255)"),$.appendChild(p),V.push(p);w.setAttribute(c.ty==="gf"?"fill":"stroke","url("+u()+"#"+k+")"),c.ty==="gs"&&(w.setAttribute("stroke-linecap",Hu[c.lc||2]),w.setAttribute("stroke-linejoin",Ku[c.lj||2]),c.lj===1&&w.setAttribute("stroke-miterlimit",c.ml)),this.of=$,this.ms=S,this.ost=V,this.maskId=_,f.msElem=w}},d([_t],xs);function Qu(c,f,p){this.initDynamicPropertyContainer(c),this.getValue=this.iterateDynamicProperties,this.w=_e.getProp(c,f.w,0,null,this),this.d=new ca(c,f.d||{},"svg",this),this.initGradientData(c,f,p),this._isAnimated=!!this._isAnimated}d([xs,_t],Qu);function G0(){this.it=[],this.prevViewData=[],this.gr=ke("g")}function V0(c,f,p){this.transform={mProps:c,op:f,container:p},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}var Ju=function(f,p,m,x){if(p===0)return"";var S=f.o,w=f.i,k=f.v,_,$=" M"+x.applyToPointStringified(k[0][0],k[0][1]);for(_=1;_<p;_+=1)$+=" C"+x.applyToPointStringified(S[_-1][0],S[_-1][1])+" "+x.applyToPointStringified(w[_][0],w[_][1])+" "+x.applyToPointStringified(k[_][0],k[_][1]);return m&&p&&($+=" C"+x.applyToPointStringified(S[_-1][0],S[_-1][1])+" "+x.applyToPointStringified(w[0][0],w[0][1])+" "+x.applyToPointStringified(k[0][0],k[0][1]),$+="z"),$},j0=function(){var c=new we,f=new we,p={createRenderFunction:m};function m(re){switch(re.ty){case"fl":return k;case"gf":return $;case"gs":return _;case"st":return V;case"sh":case"el":case"rc":case"sr":return w;case"tr":return x;case"no":return S;default:return null}}function x(re,I,j){(j||I.transform.op._mdf)&&I.transform.container.setAttribute("opacity",I.transform.op.v),(j||I.transform.mProps._mdf)&&I.transform.container.setAttribute("transform",I.transform.mProps.v.to2dCSS())}function S(){}function w(re,I,j){var W,H,ee,G,F,R,P=I.styles.length,U=I.lvl,Y,te,ae,xe;for(R=0;R<P;R+=1){if(G=I.sh._mdf||j,I.styles[R].lvl<U){for(te=f.reset(),ae=U-I.styles[R].lvl,xe=I.transformers.length-1;!G&&ae>0;)G=I.transformers[xe].mProps._mdf||G,ae-=1,xe-=1;if(G)for(ae=U-I.styles[R].lvl,xe=I.transformers.length-1;ae>0;)te.multiply(I.transformers[xe].mProps.v),ae-=1,xe-=1}else te=c;if(Y=I.sh.paths,H=Y._length,G){for(ee="",W=0;W<H;W+=1)F=Y.shapes[W],F&&F._length&&(ee+=Ju(F,F._length,F.c,te));I.caches[R]=ee}else ee=I.caches[R];I.styles[R].d+=re.hd===!0?"":ee,I.styles[R]._mdf=G||I.styles[R]._mdf}}function k(re,I,j){var W=I.style;(I.c._mdf||j)&&W.pElem.setAttribute("fill","rgb("+J(I.c.v[0])+","+J(I.c.v[1])+","+J(I.c.v[2])+")"),(I.o._mdf||j)&&W.pElem.setAttribute("fill-opacity",I.o.v)}function _(re,I,j){$(re,I,j),V(re,I,j)}function $(re,I,j){var W=I.gf,H=I.g._hasOpacity,ee=I.s.v,G=I.e.v;if(I.o._mdf||j){var F=re.ty==="gf"?"fill-opacity":"stroke-opacity";I.style.pElem.setAttribute(F,I.o.v)}if(I.s._mdf||j){var R=re.t===1?"x1":"cx",P=R==="x1"?"y1":"cy";W.setAttribute(R,ee[0]),W.setAttribute(P,ee[1]),H&&!I.g._collapsable&&(I.of.setAttribute(R,ee[0]),I.of.setAttribute(P,ee[1]))}var U,Y,te,ae;if(I.g._cmdf||j){U=I.cst;var xe=I.g.c;for(te=U.length,Y=0;Y<te;Y+=1)ae=U[Y],ae.setAttribute("offset",xe[Y*4]+"%"),ae.setAttribute("stop-color","rgb("+xe[Y*4+1]+","+xe[Y*4+2]+","+xe[Y*4+3]+")")}if(H&&(I.g._omdf||j)){var je=I.g.o;for(I.g._collapsable?U=I.cst:U=I.ost,te=U.length,Y=0;Y<te;Y+=1)ae=U[Y],I.g._collapsable||ae.setAttribute("offset",je[Y*2]+"%"),ae.setAttribute("stop-opacity",je[Y*2+1])}if(re.t===1)(I.e._mdf||j)&&(W.setAttribute("x2",G[0]),W.setAttribute("y2",G[1]),H&&!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||j)&&(De=Math.sqrt(Math.pow(ee[0]-G[0],2)+Math.pow(ee[1]-G[1],2)),W.setAttribute("r",De),H&&!I.g._collapsable&&I.of.setAttribute("r",De)),I.e._mdf||I.h._mdf||I.a._mdf||j){De||(De=Math.sqrt(Math.pow(ee[0]-G[0],2)+Math.pow(ee[1]-G[1],2)));var Ae=Math.atan2(G[1]-ee[1],G[0]-ee[0]),qe=I.h.v;qe>=1?qe=.99:qe<=-1&&(qe=-.99);var Ie=De*qe,ve=Math.cos(Ae+I.a.v)*Ie+ee[0],O=Math.sin(Ae+I.a.v)*Ie+ee[1];W.setAttribute("fx",ve),W.setAttribute("fy",O),H&&!I.g._collapsable&&(I.of.setAttribute("fx",ve),I.of.setAttribute("fy",O))}}}function V(re,I,j){var W=I.style,H=I.d;H&&(H._mdf||j)&&H.dashStr&&(W.pElem.setAttribute("stroke-dasharray",H.dashStr),W.pElem.setAttribute("stroke-dashoffset",H.dashoffset[0])),I.c&&(I.c._mdf||j)&&W.pElem.setAttribute("stroke","rgb("+J(I.c.v[0])+","+J(I.c.v[1])+","+J(I.c.v[2])+")"),(I.o._mdf||j)&&W.pElem.setAttribute("stroke-opacity",I.o.v),(I.w._mdf||j)&&(W.pElem.setAttribute("stroke-width",I.w.v),W.msElem&&W.msElem.setAttribute("stroke-width",I.w.v))}return p}();function Ct(c,f,p){this.shapes=[],this.shapesData=c.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(c,f,p),this.prevViewData=[]}d([Ei,ys,en,ju,Ss,Ti,tn],Ct),Ct.prototype.initSecondaryElement=function(){},Ct.prototype.identityMatrix=new we,Ct.prototype.buildExpressionInterface=function(){},Ct.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},Ct.prototype.filterUniqueShapes=function(){var c,f=this.shapes.length,p,m,x=this.stylesList.length,S,w=[],k=!1;for(m=0;m<x;m+=1){for(S=this.stylesList[m],k=!1,w.length=0,c=0;c<f;c+=1)p=this.shapes[c],p.styles.indexOf(S)!==-1&&(w.push(p),k=p._isAnimated||k);w.length>1&&k&&this.setShapesAsAnimated(w)}},Ct.prototype.setShapesAsAnimated=function(c){var f,p=c.length;for(f=0;f<p;f+=1)c[f].setAsAnimated()},Ct.prototype.createStyleElement=function(c,f){var p,m=new Wu(c,f),x=m.pElem;if(c.ty==="st")p=new qu(this,c,m);else if(c.ty==="fl")p=new Yu(this,c,m);else if(c.ty==="gf"||c.ty==="gs"){var S=c.ty==="gf"?xs:Qu;p=new S(this,c,m),this.globalData.defs.appendChild(p.gf),p.maskId&&(this.globalData.defs.appendChild(p.ms),this.globalData.defs.appendChild(p.of),x.setAttribute("mask","url("+u()+"#"+p.maskId+")"))}else c.ty==="no"&&(p=new Xu(this,c,m));return(c.ty==="st"||c.ty==="gs")&&(x.setAttribute("stroke-linecap",Hu[c.lc||2]),x.setAttribute("stroke-linejoin",Ku[c.lj||2]),x.setAttribute("fill-opacity","0"),c.lj===1&&x.setAttribute("stroke-miterlimit",c.ml)),c.r===2&&x.setAttribute("fill-rule","evenodd"),c.ln&&x.setAttribute("id",c.ln),c.cl&&x.setAttribute("class",c.cl),c.bm&&(x.style["mix-blend-mode"]=Po(c.bm)),this.stylesList.push(m),this.addToAnimatedContents(c,p),p},Ct.prototype.createGroupElement=function(c){var f=new G0;return c.ln&&f.gr.setAttribute("id",c.ln),c.cl&&f.gr.setAttribute("class",c.cl),c.bm&&(f.gr.style["mix-blend-mode"]=Po(c.bm)),f},Ct.prototype.createTransformElement=function(c,f){var p=_o.getTransformProperty(this,c,this),m=new V0(p,p.o,f);return this.addToAnimatedContents(c,m),m},Ct.prototype.createShapeElement=function(c,f,p){var m=4;c.ty==="rc"?m=5:c.ty==="el"?m=6:c.ty==="sr"&&(m=7);var x=be.getShapeProp(this,c,m,this),S=new zu(f,p,x);return this.shapes.push(S),this.addShapeToModifiers(S),this.addToAnimatedContents(c,S),S},Ct.prototype.addToAnimatedContents=function(c,f){for(var p=0,m=this.animatedContents.length;p<m;){if(this.animatedContents[p].element===f)return;p+=1}this.animatedContents.push({fn:j0.createRenderFunction(c),element:f,data:c})},Ct.prototype.setElementStyles=function(c){var f=c.styles,p,m=this.stylesList.length;for(p=0;p<m;p+=1)this.stylesList[p].closed||f.push(this.stylesList[p])},Ct.prototype.reloadShapes=function(){this._isFirstFrame=!0;var c,f=this.itemsData.length;for(c=0;c<f;c+=1)this.prevViewData[c]=this.itemsData[c];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),f=this.dynamicProperties.length,c=0;c<f;c+=1)this.dynamicProperties[c].getValue();this.renderModifiers()},Ct.prototype.searchShapes=function(c,f,p,m,x,S,w){var k=[].concat(S),_,$=c.length-1,V,re,I=[],j=[],W,H,ee;for(_=$;_>=0;_-=1){if(ee=this.searchProcessedElement(c[_]),ee?f[_]=p[ee-1]:c[_]._render=w,c[_].ty==="fl"||c[_].ty==="st"||c[_].ty==="gf"||c[_].ty==="gs"||c[_].ty==="no")ee?f[_].style.closed=!1:f[_]=this.createStyleElement(c[_],x),c[_]._render&&f[_].style.pElem.parentNode!==m&&m.appendChild(f[_].style.pElem),I.push(f[_].style);else if(c[_].ty==="gr"){if(!ee)f[_]=this.createGroupElement(c[_]);else for(re=f[_].it.length,V=0;V<re;V+=1)f[_].prevViewData[V]=f[_].it[V];this.searchShapes(c[_].it,f[_].it,f[_].prevViewData,f[_].gr,x+1,k,w),c[_]._render&&f[_].gr.parentNode!==m&&m.appendChild(f[_].gr)}else c[_].ty==="tr"?(ee||(f[_]=this.createTransformElement(c[_],m)),W=f[_].transform,k.push(W)):c[_].ty==="sh"||c[_].ty==="rc"||c[_].ty==="el"||c[_].ty==="sr"?(ee||(f[_]=this.createShapeElement(c[_],k,x)),this.setElementStyles(f[_])):c[_].ty==="tm"||c[_].ty==="rd"||c[_].ty==="ms"||c[_].ty==="pb"||c[_].ty==="zz"||c[_].ty==="op"?(ee?(H=f[_],H.closed=!1):(H=xi.getModifier(c[_].ty),H.init(this,c[_]),f[_]=H,this.shapeModifiers.push(H)),j.push(H)):c[_].ty==="rp"&&(ee?(H=f[_],H.closed=!0):(H=xi.getModifier(c[_].ty),f[_]=H,H.init(this,c,_,f),this.shapeModifiers.push(H),w=!1),j.push(H));this.addProcessedElement(c[_],_+1)}for($=I.length,_=0;_<$;_+=1)I[_].closed=!0;for($=j.length,_=0;_<$;_+=1)j[_].closed=!0},Ct.prototype.renderInnerContent=function(){this.renderModifiers();var c,f=this.stylesList.length;for(c=0;c<f;c+=1)this.stylesList[c].reset();for(this.renderShape(),c=0;c<f;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"))},Ct.prototype.renderShape=function(){var c,f=this.animatedContents.length,p;for(c=0;c<f;c+=1)p=this.animatedContents[c],(this._isFirstFrame||p.element._isAnimated)&&p.data!==!0&&p.fn(p.data,p.element,this._isFirstFrame)},Ct.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null};function Oo(c,f,p,m,x,S){this.o=c,this.sw=f,this.sc=p,this.fc=m,this.m=x,this.p=S,this._mdf={o:!0,sw:!!f,sc:!!p,fc:!!m,m:!0,p:!0}}Oo.prototype.update=function(c,f,p,m,x,S){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 w=!1;return this.o!==c&&(this.o=c,this._mdf.o=!0,w=!0),this.sw!==f&&(this.sw=f,this._mdf.sw=!0,w=!0),this.sc!==p&&(this.sc=p,this._mdf.sc=!0,w=!0),this.fc!==m&&(this.fc=m,this._mdf.fc=!0,w=!0),this.m!==x&&(this.m=x,this._mdf.m=!0,w=!0),S.length&&(this.p[0]!==S[0]||this.p[1]!==S[1]||this.p[4]!==S[4]||this.p[5]!==S[5]||this.p[12]!==S[12]||this.p[13]!==S[13])&&(this.p=S,this._mdf.p=!0,w=!0),w};function qt(c,f){this._frameId=n,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,f.d&&f.d.sid&&(f.d=c.globalData.slotManager.getProp(f.d)),this.data=f,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)}qt.prototype.defaultBoxWidth=[0,0],qt.prototype.copyData=function(c,f){for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(c[p]=f[p]);return c},qt.prototype.setCurrentData=function(c){c.__complete||this.completeTextData(c),this.currentData=c,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},qt.prototype.searchProperty=function(){return this.searchKeyframes()},qt.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},qt.prototype.addEffect=function(c){this.effectsSequence.push(c),this.elem.addDynamicProperty(this)},qt.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 f=this.currentData,p=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var m,x=this.effectsSequence.length,S=c||this.data.d.k[this.keysIndex].s;for(m=0;m<x;m+=1)p!==this.keysIndex?S=this.effectsSequence[m](S,S.t):S=this.effectsSequence[m](this.currentData,S.t);f!==S&&this.setCurrentData(S),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}},qt.prototype.getKeyframeValue=function(){for(var c=this.data.d.k,f=this.elem.comp.renderedFrame,p=0,m=c.length;p<=m-1&&!(p===m-1||c[p+1].t>f);)p+=1;return this.keysIndex!==p&&(this.keysIndex=p),this.data.d.k[this.keysIndex].s},qt.prototype.buildFinalText=function(c){for(var f=[],p=0,m=c.length,x,S,w=!1,k=!1,_="";p<m;)w=k,k=!1,x=c.charCodeAt(p),_=c.charAt(p),Hi.isCombinedCharacter(x)?w=!0:x>=55296&&x<=56319?Hi.isRegionalFlag(c,p)?_=c.substr(p,14):(S=c.charCodeAt(p+1),S>=56320&&S<=57343&&(Hi.isModifier(x,S)?(_=c.substr(p,2),w=!0):Hi.isFlagEmoji(c.substr(p,4))?_=c.substr(p,4):_=c.substr(p,2))):x>56319?(S=c.charCodeAt(p+1),Hi.isVariationSelector(x)&&(w=!0)):Hi.isZeroWidthJoiner(x)&&(w=!0,k=!0),w?(f[f.length-1]+=_,w=!1):f.push(_),p+=_.length;return f},qt.prototype.completeTextData=function(c){c.__complete=!0;var f=this.elem.globalData.fontManager,p=this.data,m=[],x,S,w,k=0,_,$=p.m.g,V=0,re=0,I=0,j=[],W=0,H=0,ee,G,F=f.getFontByName(c.f),R,P=0,U=Bu(F);c.fWeight=U.weight,c.fStyle=U.style,c.finalSize=c.s,c.finalText=this.buildFinalText(c.t),S=c.finalText.length,c.finalLineHeight=c.lh;var Y=c.tr/1e3*c.finalSize,te;if(c.sz)for(var ae=!0,xe=c.sz[0],je=c.sz[1],De,Ae;ae;){Ae=this.buildFinalText(c.t),De=0,W=0,S=Ae.length,Y=c.tr/1e3*c.finalSize;var qe=-1;for(x=0;x<S;x+=1)te=Ae[x].charCodeAt(0),w=!1,Ae[x]===" "?qe=x:(te===13||te===3)&&(W=0,w=!0,De+=c.finalLineHeight||c.finalSize*1.2),f.chars?(R=f.getCharData(Ae[x],F.fStyle,F.fFamily),P=w?0:R.w*c.finalSize/100):P=f.measureText(Ae[x],c.f,c.finalSize),W+P>xe&&Ae[x]!==" "?(qe===-1?S+=1:x=qe,De+=c.finalLineHeight||c.finalSize*1.2,Ae.splice(x,qe===x?1:0,"\r"),qe=-1,W=0):(W+=P,W+=Y);De+=F.ascent*c.finalSize/100,this.canResize&&c.finalSize>this.minimumFontSize&&je<De?(c.finalSize-=1,c.finalLineHeight=c.finalSize*c.lh/c.s):(c.finalText=Ae,S=c.finalText.length,ae=!1)}W=-Y,P=0;var Ie=0,ve;for(x=0;x<S;x+=1)if(w=!1,ve=c.finalText[x],te=ve.charCodeAt(0),te===13||te===3?(Ie=0,j.push(W),H=W>H?W:H,W=-2*Y,_="",w=!0,I+=1):_=ve,f.chars?(R=f.getCharData(ve,F.fStyle,f.getFontByName(c.f).fFamily),P=w?0:R.w*c.finalSize/100):P=f.measureText(_,c.f,c.finalSize),ve===" "?Ie+=P+Y:(W+=P+Y+Ie,Ie=0),m.push({l:P,an:P,add:V,n:w,anIndexes:[],val:_,line:I,animatorJustifyOffset:0}),$==2){if(V+=P,_===""||_===" "||x===S-1){for((_===""||_===" ")&&(V-=P);re<=x;)m[re].an=V,m[re].ind=k,m[re].extra=P,re+=1;k+=1,V=0}}else if($==3){if(V+=P,_===""||x===S-1){for(_===""&&(V-=P);re<=x;)m[re].an=V,m[re].ind=k,m[re].extra=P,re+=1;V=0,k+=1}}else m[k].ind=k,m[k].extra=0,k+=1;if(c.l=m,H=W>H?W:H,j.push(W),c.sz)c.boxWidth=c.sz[0],c.justifyOffset=0;else switch(c.boxWidth=H,c.j){case 1:c.justifyOffset=-c.boxWidth;break;case 2:c.justifyOffset=-c.boxWidth/2;break;default:c.justifyOffset=0}c.lineWidths=j;var O=p.a,K,T;G=O.length;var L,ne,X=[];for(ee=0;ee<G;ee+=1){for(K=O[ee],K.a.sc&&(c.strokeColorAnim=!0),K.a.sw&&(c.strokeWidthAnim=!0),(K.a.fc||K.a.fh||K.a.fs||K.a.fb)&&(c.fillColorAnim=!0),ne=0,L=K.s.b,x=0;x<S;x+=1)T=m[x],T.anIndexes[ee]=ne,(L==1&&T.val!==""||L==2&&T.val!==""&&T.val!==" "||L==3&&(T.n||T.val==" "||x==S-1)||L==4&&(T.n||x==S-1))&&(K.s.rn===1&&X.push(ne),ne+=1);p.a[ee].s.totalChars=ne;var Le=-1,Ne;if(K.s.rn===1)for(x=0;x<S;x+=1)T=m[x],Le!=T.anIndexes[ee]&&(Le=T.anIndexes[ee],Ne=X.splice(Math.floor(Math.random()*X.length),1)[0]),T.anIndexes[ee]=Ne}c.yOffset=c.finalLineHeight||c.finalSize*1.2,c.ls=c.ls||0,c.ascent=F.ascent*c.finalSize/100},qt.prototype.updateDocumentData=function(c,f){f=f===void 0?this.keysIndex:f;var p=this.copyData({},this.data.d.k[f].s);p=this.copyData(p,c),this.data.d.k[f].s=p,this.recalculate(f),this.setCurrentData(p),this.elem.addDynamicProperty(this)},qt.prototype.recalculate=function(c){var f=this.data.d.k[c].s;f.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(f)},qt.prototype.canResizeFont=function(c){this.canResize=c,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},qt.prototype.setMinimumFontSize=function(c){this.minimumFontSize=Math.floor(c)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var H0=function(){var c=Math.max,f=Math.min,p=Math.floor;function m(S,w){this._currentTextLength=-1,this.k=!1,this.data=w,this.elem=S,this.comp=S.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(S),this.s=_e.getProp(S,w.s||{k:0},0,0,this),"e"in w?this.e=_e.getProp(S,w.e,0,0,this):this.e={v:100},this.o=_e.getProp(S,w.o||{k:0},0,0,this),this.xe=_e.getProp(S,w.xe||{k:0},0,0,this),this.ne=_e.getProp(S,w.ne||{k:0},0,0,this),this.sm=_e.getProp(S,w.sm||{k:100},0,0,this),this.a=_e.getProp(S,w.a,0,.01,this),this.dynamicProperties.length||this.getValue()}m.prototype={getMult:function(w){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var k=0,_=0,$=1,V=1;this.ne.v>0?k=this.ne.v/100:_=-this.ne.v/100,this.xe.v>0?$=1-this.xe.v/100:V=1+this.xe.v/100;var re=Or.getBezierEasing(k,_,$,V).get,I=0,j=this.finalS,W=this.finalE,H=this.data.sh;if(H===2)W===j?I=w>=W?1:0:I=c(0,f(.5/(W-j)+(w-j)/(W-j),1)),I=re(I);else if(H===3)W===j?I=w>=W?0:1:I=1-c(0,f(.5/(W-j)+(w-j)/(W-j),1)),I=re(I);else if(H===4)W===j?I=0:(I=c(0,f(.5/(W-j)+(w-j)/(W-j),1)),I<.5?I*=2:I=1-2*(I-.5)),I=re(I);else if(H===5){if(W===j)I=0;else{var ee=W-j;w=f(c(0,w+.5-j),W-j);var G=-ee/2+w,F=ee/2;I=Math.sqrt(1-G*G/(F*F))}I=re(I)}else H===6?(W===j?I=0:(w=f(c(0,w+.5-j),W-j),I=(1+Math.cos(Math.PI+Math.PI*2*w/(W-j)))/2),I=re(I)):(w>=p(j)&&(w-j<0?I=c(0,f(f(W,1)-(j-w),1)):I=c(0,f(W-w,1))),I=re(I));if(this.sm.v!==100){var R=this.sm.v*.01;R===0&&(R=1e-8);var P=.5-R*.5;I<P?I=0:(I=(I-P)/R,I>1&&(I=1))}return I*this.a.v},getValue:function(w){this.iterateDynamicProperties(),this._mdf=w||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,w&&this.data.r===2&&(this.e.v=this._currentTextLength);var k=this.data.r===2?1:100/this.data.totalChars,_=this.o.v/k,$=this.s.v/k+_,V=this.e.v/k+_;if($>V){var re=$;$=V,V=re}this.finalS=$,this.finalE=V}},d([_t],m);function x(S,w,k){return new m(S,w)}return{getTextSelectorProp:x}}();function K0(c,f,p){var m={propType:!1},x=_e.getProp,S=f.a;this.a={r:S.r?x(c,S.r,0,Q,p):m,rx:S.rx?x(c,S.rx,0,Q,p):m,ry:S.ry?x(c,S.ry,0,Q,p):m,sk:S.sk?x(c,S.sk,0,Q,p):m,sa:S.sa?x(c,S.sa,0,Q,p):m,s:S.s?x(c,S.s,1,.01,p):m,a:S.a?x(c,S.a,1,0,p):m,o:S.o?x(c,S.o,0,.01,p):m,p:S.p?x(c,S.p,1,0,p):m,sw:S.sw?x(c,S.sw,0,0,p):m,sc:S.sc?x(c,S.sc,1,0,p):m,fc:S.fc?x(c,S.fc,1,0,p):m,fh:S.fh?x(c,S.fh,0,0,p):m,fs:S.fs?x(c,S.fs,0,.01,p):m,fb:S.fb?x(c,S.fb,0,.01,p):m,t:S.t?x(c,S.t,0,0,p):m},this.s=H0.getTextSelectorProp(c,f.s,p),this.s.t=f.s.t}function zi(c,f,p){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=c,this._renderType=f,this._elem=p,this._animatorsData=b(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(p)}zi.prototype.searchProperties=function(){var c,f=this._textData.a.length,p,m=_e.getProp;for(c=0;c<f;c+=1)p=this._textData.a[c],this._animatorsData[c]=new K0(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,f){if(this.lettersChangedFlag=f,!(!this._mdf&&!this._isFirstFrame&&!f&&(!this._hasMaskedPath||!this._pathData.m._mdf))){this._isFirstFrame=!1;var p=this._moreOptions.alignment.v,m=this._animatorsData,x=this._textData,S=this.mHelper,w=this._renderType,k=this.renderedLetters.length,_,$,V,re,I=c.l,j,W,H,ee,G,F,R,P,U,Y,te,ae,xe,je,De;if(this._hasMaskedPath){if(De=this._pathData.m,!this._pathData.n||this._pathData._mdf){var Ae=De.v;this._pathData.r.v&&(Ae=Ae.reverse()),j={tLength:0,segments:[]},re=Ae._length-1;var qe;for(ae=0,V=0;V<re;V+=1)qe=fr.buildBezierData(Ae.v[V],Ae.v[V+1],[Ae.o[V][0]-Ae.v[V][0],Ae.o[V][1]-Ae.v[V][1]],[Ae.i[V+1][0]-Ae.v[V+1][0],Ae.i[V+1][1]-Ae.v[V+1][1]]),j.tLength+=qe.segmentLength,j.segments.push(qe),ae+=qe.segmentLength;V=re,De.v.c&&(qe=fr.buildBezierData(Ae.v[V],Ae.v[0],[Ae.o[V][0]-Ae.v[V][0],Ae.o[V][1]-Ae.v[V][1]],[Ae.i[0][0]-Ae.v[0][0],Ae.i[0][1]-Ae.v[0][1]]),j.tLength+=qe.segmentLength,j.segments.push(qe),ae+=qe.segmentLength),this._pathData.pi=j}if(j=this._pathData.pi,W=this._pathData.f.v,R=0,F=1,ee=0,G=!0,Y=j.segments,W<0&&De.v.c)for(j.tLength<Math.abs(W)&&(W=-Math.abs(W)%j.tLength),R=Y.length-1,U=Y[R].points,F=U.length-1;W<0;)W+=U[F].partialLength,F-=1,F<0&&(R-=1,U=Y[R].points,F=U.length-1);U=Y[R].points,P=U[F-1],H=U[F],te=H.partialLength}re=I.length,_=0,$=0;var Ie=c.finalSize*1.2*.714,ve=!0,O,K,T,L,ne;L=m.length;var X,Le=-1,Ne,He,st,nt=W,It=R,Jt=F,Fr=-1,Zt,Ut,nr,ft,Pe,ni,_i,ai,Nr="",oi=this.defaultPropsArray,li;if(c.j===2||c.j===1){var er=0,Ci=0,Li=c.j===2?-.5:-1,_r=0,Ri=!0;for(V=0;V<re;V+=1)if(I[V].n){for(er&&(er+=Ci);_r<V;)I[_r].animatorJustifyOffset=er,_r+=1;er=0,Ri=!0}else{for(T=0;T<L;T+=1)O=m[T].a,O.t.propType&&(Ri&&c.j===2&&(Ci+=O.t.v*Li),K=m[T].s,X=K.getMult(I[V].anIndexes[T],x.a[T].s.totalChars),X.length?er+=O.t.v*X[0]*Li:er+=O.t.v*X*Li);Ri=!1}for(er&&(er+=Ci);_r<V;)I[_r].animatorJustifyOffset=er,_r+=1}for(V=0;V<re;V+=1){if(S.reset(),Zt=1,I[V].n)_=0,$+=c.yOffset,$+=ve?1:0,W=nt,ve=!1,this._hasMaskedPath&&(R=It,F=Jt,U=Y[R].points,P=U[F-1],H=U[F],te=H.partialLength,ee=0),Nr="",ai="",ni="",li="",oi=this.defaultPropsArray;else{if(this._hasMaskedPath){if(Fr!==I[V].line){switch(c.j){case 1:W+=ae-c.lineWidths[I[V].line];break;case 2:W+=(ae-c.lineWidths[I[V].line])/2;break}Fr=I[V].line}Le!==I[V].ind&&(I[Le]&&(W+=I[Le].extra),W+=I[V].an/2,Le=I[V].ind),W+=p[0]*I[V].an*.005;var Cr=0;for(T=0;T<L;T+=1)O=m[T].a,O.p.propType&&(K=m[T].s,X=K.getMult(I[V].anIndexes[T],x.a[T].s.totalChars),X.length?Cr+=O.p.v[0]*X[0]:Cr+=O.p.v[0]*X),O.a.propType&&(K=m[T].s,X=K.getMult(I[V].anIndexes[T],x.a[T].s.totalChars),X.length?Cr+=O.a.v[0]*X[0]:Cr+=O.a.v[0]*X);for(G=!0,this._pathData.a.v&&(W=I[0].an*.5+(ae-this._pathData.f.v-I[0].an*.5-I[I.length-1].an*.5)*Le/(re-1),W+=this._pathData.f.v);G;)ee+te>=W+Cr||!U?(xe=(W+Cr-ee)/H.partialLength,He=P.point[0]+(H.point[0]-P.point[0])*xe,st=P.point[1]+(H.point[1]-P.point[1])*xe,S.translate(-p[0]*I[V].an*.005,-(p[1]*Ie)*.01),G=!1):U&&(ee+=H.partialLength,F+=1,F>=U.length&&(F=0,R+=1,Y[R]?U=Y[R].points:De.v.c?(F=0,R=0,U=Y[R].points):(ee-=H.partialLength,U=null)),U&&(P=H,H=U[F],te=H.partialLength));Ne=I[V].an/2-I[V].add,S.translate(-Ne,0,0)}else Ne=I[V].an/2-I[V].add,S.translate(-Ne,0,0),S.translate(-p[0]*I[V].an*.005,-p[1]*Ie*.01,0);for(T=0;T<L;T+=1)O=m[T].a,O.t.propType&&(K=m[T].s,X=K.getMult(I[V].anIndexes[T],x.a[T].s.totalChars),(_!==0||c.j!==0)&&(this._hasMaskedPath?X.length?W+=O.t.v*X[0]:W+=O.t.v*X:X.length?_+=O.t.v*X[0]:_+=O.t.v*X));for(c.strokeWidthAnim&&(nr=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<L;T+=1)O=m[T].a,O.a.propType&&(K=m[T].s,X=K.getMult(I[V].anIndexes[T],x.a[T].s.totalChars),X.length?S.translate(-O.a.v[0]*X[0],-O.a.v[1]*X[1],O.a.v[2]*X[2]):S.translate(-O.a.v[0]*X,-O.a.v[1]*X,O.a.v[2]*X));for(T=0;T<L;T+=1)O=m[T].a,O.s.propType&&(K=m[T].s,X=K.getMult(I[V].anIndexes[T],x.a[T].s.totalChars),X.length?S.scale(1+(O.s.v[0]-1)*X[0],1+(O.s.v[1]-1)*X[1],1):S.scale(1+(O.s.v[0]-1)*X,1+(O.s.v[1]-1)*X,1));for(T=0;T<L;T+=1){if(O=m[T].a,K=m[T].s,X=K.getMult(I[V].anIndexes[T],x.a[T].s.totalChars),O.sk.propType&&(X.length?S.skewFromAxis(-O.sk.v*X[0],O.sa.v*X[1]):S.skewFromAxis(-O.sk.v*X,O.sa.v*X)),O.r.propType&&(X.length?S.rotateZ(-O.r.v*X[2]):S.rotateZ(-O.r.v*X)),O.ry.propType&&(X.length?S.rotateY(O.ry.v*X[1]):S.rotateY(O.ry.v*X)),O.rx.propType&&(X.length?S.rotateX(O.rx.v*X[0]):S.rotateX(O.rx.v*X)),O.o.propType&&(X.length?Zt+=(O.o.v*X[0]-Zt)*X[0]:Zt+=(O.o.v*X-Zt)*X),c.strokeWidthAnim&&O.sw.propType&&(X.length?nr+=O.sw.v*X[0]:nr+=O.sw.v*X),c.strokeColorAnim&&O.sc.propType)for(Pe=0;Pe<3;Pe+=1)X.length?Ut[Pe]+=(O.sc.v[Pe]-Ut[Pe])*X[0]:Ut[Pe]+=(O.sc.v[Pe]-Ut[Pe])*X;if(c.fillColorAnim&&c.fc){if(O.fc.propType)for(Pe=0;Pe<3;Pe+=1)X.length?ft[Pe]+=(O.fc.v[Pe]-ft[Pe])*X[0]:ft[Pe]+=(O.fc.v[Pe]-ft[Pe])*X;O.fh.propType&&(X.length?ft=Xe(ft,O.fh.v*X[0]):ft=Xe(ft,O.fh.v*X)),O.fs.propType&&(X.length?ft=We(ft,O.fs.v*X[0]):ft=We(ft,O.fs.v*X)),O.fb.propType&&(X.length?ft=$e(ft,O.fb.v*X[0]):ft=$e(ft,O.fb.v*X))}}for(T=0;T<L;T+=1)O=m[T].a,O.p.propType&&(K=m[T].s,X=K.getMult(I[V].anIndexes[T],x.a[T].s.totalChars),this._hasMaskedPath?X.length?S.translate(0,O.p.v[1]*X[0],-O.p.v[2]*X[1]):S.translate(0,O.p.v[1]*X,-O.p.v[2]*X):X.length?S.translate(O.p.v[0]*X[0],O.p.v[1]*X[1],-O.p.v[2]*X[2]):S.translate(O.p.v[0]*X,O.p.v[1]*X,-O.p.v[2]*X));if(c.strokeWidthAnim&&(ni=nr<0?0:nr),c.strokeColorAnim&&(_i="rgb("+Math.round(Ut[0]*255)+","+Math.round(Ut[1]*255)+","+Math.round(Ut[2]*255)+")"),c.fillColorAnim&&c.fc&&(ai="rgb("+Math.round(ft[0]*255)+","+Math.round(ft[1]*255)+","+Math.round(ft[2]*255)+")"),this._hasMaskedPath){if(S.translate(0,-c.ls),S.translate(0,p[1]*Ie*.01+$,0),this._pathData.p.v){je=(H.point[1]-P.point[1])/(H.point[0]-P.point[0]);var Wi=Math.atan(je)*180/Math.PI;H.point[0]<P.point[0]&&(Wi+=180),S.rotate(-Wi*Math.PI/180)}S.translate(He,st,0),W-=p[0]*I[V].an*.005,I[V+1]&&Le!==I[V+1].ind&&(W+=I[V].an/2,W+=c.tr*.001*c.finalSize)}else{switch(S.translate(_,$,0),c.ps&&S.translate(c.ps[0],c.ps[1]+c.ascent,0),c.j){case 1:S.translate(I[V].animatorJustifyOffset+c.justifyOffset+(c.boxWidth-c.lineWidths[I[V].line]),0,0);break;case 2:S.translate(I[V].animatorJustifyOffset+c.justifyOffset+(c.boxWidth-c.lineWidths[I[V].line])/2,0,0);break}S.translate(0,-c.ls),S.translate(Ne,0,0),S.translate(p[0]*I[V].an*.005,p[1]*Ie*.01,0),_+=I[V].l+c.tr*.001*c.finalSize}w==="html"?Nr=S.toCSS():w==="svg"?Nr=S.to2dCSS():oi=[S.props[0],S.props[1],S.props[2],S.props[3],S.props[4],S.props[5],S.props[6],S.props[7],S.props[8],S.props[9],S.props[10],S.props[11],S.props[12],S.props[13],S.props[14],S.props[15]],li=Zt}k<=V?(ne=new Oo(li,ni,_i,ai,Nr,oi),this.renderedLetters.push(ne),k+=1,this.lettersChangedFlag=!0):(ne=this.renderedLetters[V],this.lettersChangedFlag=ne.update(li,ni,_i,ai,Nr,oi)||this.lettersChangedFlag)}}},zi.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},zi.prototype.mHelper=new we,zi.prototype.defaultPropsArray=[],d([_t],zi);function pr(){}pr.prototype.initElement=function(c,f,p){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(c,f,p),this.textProperty=new qt(this,c.t,this.dynamicProperties),this.textAnimator=new zi(c.t,this.renderType,this),this.initTransform(c,f,p),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},pr.prototype.prepareFrame=function(c){this._mdf=!1,this.prepareRenderableFrame(c),this.prepareProperties(c,this.isInRange)},pr.prototype.createPathShape=function(c,f){var p,m=f.length,x,S="";for(p=0;p<m;p+=1)f[p].ty==="sh"&&(x=f[p].ks.k,S+=Ju(x,x.i.length,!0,c));return S},pr.prototype.updateDocumentData=function(c,f){this.textProperty.updateDocumentData(c,f)},pr.prototype.canResizeFont=function(c){this.textProperty.canResizeFont(c)},pr.prototype.setMinimumFontSize=function(c){this.textProperty.setMinimumFontSize(c)},pr.prototype.applyTextPropertiesToMatrix=function(c,f,p,m,x){switch(c.ps&&f.translate(c.ps[0],c.ps[1]+c.ascent,0),f.translate(0,-c.ls,0),c.j){case 1:f.translate(c.justifyOffset+(c.boxWidth-c.lineWidths[p]),0,0);break;case 2:f.translate(c.justifyOffset+(c.boxWidth-c.lineWidths[p])/2,0,0);break}f.translate(m,x,0)},pr.prototype.buildColor=function(c){return"rgb("+Math.round(c[0]*255)+","+Math.round(c[1]*255)+","+Math.round(c[2]*255)+")"},pr.prototype.emptyProp=new Oo,pr.prototype.destroy=function(){},pr.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var z0={shapes:[]};function ii(c,f,p){this.textSpans=[],this.renderType="svg",this.initElement(c,f,p)}d([Ei,ys,en,Ss,Ti,tn,pr],ii),ii.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=ke("text"))},ii.prototype.buildTextContents=function(c){for(var f=0,p=c.length,m=[],x="";f<p;)c[f]==="\r"||c[f]===""?(m.push(x),x=""):x+=c[f],f+=1;return m.push(x),m},ii.prototype.buildShapeData=function(c,f){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]=f,m.s.k[1]=f)}}return c},ii.prototype.buildNewText=function(){this.addDynamicProperty(this);var c,f,p=this.textProperty.currentData;this.renderedLetters=b(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 x=p.fWeight,S=p.fStyle;this.layerElement.setAttribute("font-style",S),this.layerElement.setAttribute("font-weight",x)}this.layerElement.setAttribute("aria-label",p.t);var w=p.l||[],k=!!this.globalData.fontManager.chars;f=w.length;var _,$=this.mHelper,V="",re=this.data.singleShape,I=0,j=0,W=!0,H=p.tr*.001*p.finalSize;if(re&&!k&&!p.sz){var ee=this.textContainer,G="start";switch(p.j){case 1:G="end";break;case 2:G="middle";break;default:G="start";break}ee.setAttribute("text-anchor",G),ee.setAttribute("letter-spacing",H);var F=this.buildTextContents(p.finalText);for(f=F.length,j=p.ps?p.ps[1]+p.ascent:0,c=0;c<f;c+=1)_=this.textSpans[c].span||ke("tspan"),_.textContent=F[c],_.setAttribute("x",0),_.setAttribute("y",j),_.style.display="inherit",ee.appendChild(_),this.textSpans[c]||(this.textSpans[c]={span:null,glyph:null}),this.textSpans[c].span=_,j+=p.finalLineHeight;this.layerElement.appendChild(ee)}else{var R=this.textSpans.length,P;for(c=0;c<f;c+=1){if(this.textSpans[c]||(this.textSpans[c]={span:null,childSpan:null,glyph:null}),!k||!re||c===0){if(_=R>c?this.textSpans[c].span:ke(k?"g":"text"),R<=c){if(_.setAttribute("stroke-linecap","butt"),_.setAttribute("stroke-linejoin","round"),_.setAttribute("stroke-miterlimit","4"),this.textSpans[c].span=_,k){var U=ke("g");_.appendChild(U),this.textSpans[c].childSpan=U}this.textSpans[c].span=_,this.layerElement.appendChild(_)}_.style.display="inherit"}if($.reset(),re&&(w[c].n&&(I=-H,j+=p.yOffset,j+=W?1:0,W=!1),this.applyTextPropertiesToMatrix(p,$,w[c].line,I,j),I+=w[c].l||0,I+=H),k){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 nn(P.data,this.globalData,this);else{var te=z0;P.data&&P.data.shapes&&(te=this.buildShapeData(P.data,p.finalSize)),Y=new Ct(te,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 re&&_.setAttribute("transform","translate("+$.props[12]+","+$.props[13]+")"),_.textContent=w[c].val,_.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}re&&_&&_.setAttribute("d",V)}for(;c<this.textSpans.length;)this.textSpans[c].span.style.display="none",c+=1;this._sizeChanged=!0},ii.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},ii.prototype.getValue=function(){var c,f=this.textSpans.length,p;for(this.renderedFrame=this.comp.renderedFrame,c=0;c<f;c+=1)p=this.textSpans[c].glyph,p&&(p.prepareFrame(this.comp.renderedFrame-this.data.st),p._mdf&&(this._mdf=!0))},ii.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,f,p=this.textAnimator.renderedLetters,m=this.textProperty.currentData.l;f=m.length;var x,S,w;for(c=0;c<f;c+=1)m[c].n||(x=p[c],S=this.textSpans[c].span,w=this.textSpans[c].glyph,w&&w.renderFrame(),x._mdf.m&&S.setAttribute("transform",x.m),x._mdf.o&&S.setAttribute("opacity",x.o),x._mdf.sw&&S.setAttribute("stroke-width",x.sw),x._mdf.sc&&S.setAttribute("stroke",x.sc),x._mdf.fc&&S.setAttribute("fill",x.fc))}};function Mo(c,f,p){this.initElement(c,f,p)}d([rn],Mo),Mo.prototype.createContent=function(){var c=ke("rect");c.setAttribute("width",this.data.sw),c.setAttribute("height",this.data.sh),c.setAttribute("fill",this.data.sc),this.layerElement.appendChild(c)};function Ai(c,f,p){this.initFrame(),this.initBaseData(c,f,p),this.initFrame(),this.initTransform(c,f,p),this.initHierarchy()}Ai.prototype.prepareFrame=function(c){this.prepareProperties(c,!0)},Ai.prototype.renderFrame=function(){},Ai.prototype.getBaseElement=function(){return null},Ai.prototype.destroy=function(){},Ai.prototype.sourceRectAtTime=function(){},Ai.prototype.hide=function(){},d([Ei,ys,Ss,Ti],Ai);function Ot(){}d([Kt],Ot),Ot.prototype.createNull=function(c){return new Ai(c,this.globalData,this)},Ot.prototype.createShape=function(c){return new Ct(c,this.globalData,this)},Ot.prototype.createText=function(c){return new ii(c,this.globalData,this)},Ot.prototype.createImage=function(c){return new rn(c,this.globalData,this)},Ot.prototype.createSolid=function(c){return new Mo(c,this.globalData,this)},Ot.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 f=this.globalData.defs;this.setupGlobalData(c,f),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=c;var p=ke("clipPath"),m=ke("rect");m.setAttribute("width",c.w),m.setAttribute("height",c.h),m.setAttribute("x",0),m.setAttribute("y",0);var x=Ce();p.setAttribute("id",x),p.appendChild(m),this.layerElement.setAttribute("clip-path","url("+u()+"#"+x+")"),f.appendChild(p),this.layers=c.layers,this.elements=b(c.layers.length)},Ot.prototype.destroy=function(){this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var c,f=this.layers?this.layers.length:0;for(c=0;c<f;c+=1)this.elements[c]&&this.elements[c].destroy&&this.elements[c].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},Ot.prototype.updateContainerSize=function(){},Ot.prototype.findIndexByInd=function(c){var f=0,p=this.layers.length;for(f=0;f<p;f+=1)if(this.layers[f].ind===c)return f;return-1},Ot.prototype.buildItem=function(c){var f=this.elements;if(!(f[c]||this.layers[c].ty===99)){f[c]=!0;var p=this.createItem(this.layers[c]);if(f[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 x=f[m],S=x.getMatte(this.layers[c].tt);p.setMatte(S)}}}},Ot.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var c=this.pendingElements.pop();if(c.checkParenting(),c.data.tt)for(var f=0,p=this.elements.length;f<p;){if(this.elements[f]===c){var m="tp"in c.data?this.findIndexByInd(c.data.tp):f-1,x=this.elements[m],S=x.getMatte(this.layers[f].tt);c.setMatte(S);break}f+=1}}},Ot.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 f,p=this.layers.length;for(this.completeLayers||this.checkLayers(c),f=p-1;f>=0;f-=1)(this.completeLayers||this.elements[f])&&this.elements[f].prepareFrame(c-this.layers[f].st);if(this.globalData._mdf)for(f=0;f<p;f+=1)(this.completeLayers||this.elements[f])&&this.elements[f].renderFrame()}},Ot.prototype.appendElementInPos=function(c,f){var p=c.getBaseElement();if(p){for(var m=0,x;m<f;)this.elements[m]&&this.elements[m]!==!0&&this.elements[m].getBaseElement()&&(x=this.elements[m].getBaseElement()),m+=1;x?this.layerElement.insertBefore(p,x):this.layerElement.appendChild(p)}},Ot.prototype.hide=function(){this.layerElement.style.display="none"},Ot.prototype.show=function(){this.layerElement.style.display="block"};function si(){}d([Ei,ys,Ss,Ti,tn],si),si.prototype.initElement=function(c,f,p){this.initFrame(),this.initBaseData(c,f,p),this.initTransform(c,f,p),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),(this.data.xt||!f.progressiveLoad)&&this.buildAllItems(),this.hide()},si.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 f=this.tm.v;f===this.data.op&&(f=this.data.op-1),this.renderedFrame=f}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))}},si.prototype.renderInnerContent=function(){var c,f=this.layers.length;for(c=0;c<f;c+=1)(this.completeLayers||this.elements[c])&&this.elements[c].renderFrame()},si.prototype.setElements=function(c){this.elements=c},si.prototype.getElements=function(){return this.elements},si.prototype.destroyElements=function(){var c,f=this.layers.length;for(c=0;c<f;c+=1)this.elements[c]&&this.elements[c].destroy()},si.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()};function nn(c,f,p){this.layers=c.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?b(this.layers.length):[],this.initElement(c,f,p),this.tm=c.tm?_e.getProp(this,c.tm,0,f.frameRate,this):{_placeholder:!0}}d([Ot,si,en],nn),nn.prototype.createComp=function(c){return new nn(c,this.globalData,this)};function Fo(c,f){this.animationItem=c,this.layers=null,this.renderedFrame=-1,this.svgElement=ke("svg");var p="";if(f&&f.title){var m=ke("title"),x=Ce();m.setAttribute("id",x),m.textContent=f.title,this.svgElement.appendChild(m),p+=x}if(f&&f.description){var S=ke("desc"),w=Ce();S.setAttribute("id",w),S.textContent=f.description,this.svgElement.appendChild(S),p+=" "+w}p&&this.svgElement.setAttribute("aria-labelledby",p);var k=ke("defs");this.svgElement.appendChild(k);var _=ke("g");this.svgElement.appendChild(_),this.layerElement=_,this.renderConfig={preserveAspectRatio:f&&f.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:f&&f.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:f&&f.contentVisibility||"visible",progressiveLoad:f&&f.progressiveLoad||!1,hideOnTransparent:!(f&&f.hideOnTransparent===!1),viewBoxOnly:f&&f.viewBoxOnly||!1,viewBoxSize:f&&f.viewBoxSize||!1,className:f&&f.className||"",id:f&&f.id||"",focusable:f&&f.focusable,filterSize:{width:f&&f.filterSize&&f.filterSize.width||"100%",height:f&&f.filterSize&&f.filterSize.height||"100%",x:f&&f.filterSize&&f.filterSize.x||"0%",y:f&&f.filterSize&&f.filterSize.y||"0%"},width:f&&f.width,height:f&&f.height,runExpressions:!f||f.runExpressions===void 0||f.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:k,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}return d([Ot],Fo),Fo.prototype.createComp=function(c){return new nn(c,this.globalData,this)},ei("svg",Fo),xi.registerModifier("tm",Ar),xi.registerModifier("pb",Ws),xi.registerModifier("rp",Mr),xi.registerModifier("rd",qs),xi.registerModifier("zz",Xs),xi.registerModifier("op",Qs),Fe})})(Ec,Ec.exports);var TI=Ec.exports;const wI=X0(TI);function AI({loop:i=!1,path:e,animationData:t,className:r,onComplete:s}){const n=ye.useRef(null);return ye.useEffect(()=>{if(!n.current)return;const a=wI.loadAnimation({container:n.current,renderer:"svg",autoplay:!0,loop:i,path:e,animationData:t});return s&&a.addEventListener("complete",s),()=>{s&&a.removeEventListener("complete",s),a.destroy()}},[i,e,s,t]),Ye.jsx("div",{ref:n,className:r})}const _I="5.5.7",CI=30,LI=0,RI=31,II=360,PI=360,kI="forward right",DI=0,OI=[],MI=[{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}],FI=[],NI={v:_I,fr:CI,ip:LI,op:RI,w:II,h:PI,nm:kI,ddd:DI,assets:OI,layers:MI,markers:FI},BI="_root_1v1it_1",$I="_chapter_img_1v1it_20",UI="_name_1v1it_26",GI="_time_1v1it_37",Da={root:BI,chapter_img:$I,name:UI,time:GI};function VI({width:i,height:e,src:t,alt:r,draggable:s=!1,className:n}){return Ye.jsxs("picture",{children:[Ye.jsx("source",{type:"image/webp",srcSet:`${Pd({f:"webp",h:e,w:i},t)}`,height:e}),Ye.jsx("img",{src:`${Pd({h:e,w:i},t)}`,alt:r,draggable:s,width:i,height:e,className:n})]})}function jI({name:i,time:e,imageUrl:t,className:r,onClick:s}){return Ye.jsxs("div",{className:`${Da.root} ${r||""}`,onClick:s,children:[Ye.jsx(VI,{className:Da.chapter_img,src:t,width:90,height:130,alt:"챕터 이미지"}),Ye.jsx("div",{className:Da.name,children:i}),Ye.jsx("div",{className:Da.time,children:e})]})}const HI=ye.forwardRef(({src:i,ratio:e=!1,shadow:t=!0,controls:r=!0,posterSrc:s,initialTime:n,timeOffsetStart:a,timeOffsetEnd:o,quality:l,chapter:u,debug:h,loop:d,live:g,renderControls:v,onClick:y,onInit:b,onDestroy:E,onSync:A,className:M},D)=>{const[B,N]=wf(!1),[J,Z]=wf(!1),[se,Q]=KT("",650),{ref:q,live:oe,time:ge,play:he,playbackRate:Ee,handleSeektime:Te,handleBackward:ue,handleForward:pe,handlePlayToggle:Ce,handlePlaybackRate:me}=IL({src:i,timeUpdateEvent:B,initialTime:n,timeOffsetStart:a,timeOffsetEnd:o,quality:l,debug:h,onSync:A,onInit:b,onDestroy:E}),Se=HT({onClick:N,onDoubleClick:et=>{if(!r)return;const ot=et.target.getBoundingClientRect(),Je=ot.left+ot.width/2;et.clientX<Je?(ue(),Q("left")):(pe(),Q("right"))}}),We=(et,ot)=>{if(et.stopPropagation(),!q.current)return;const Je=ot*((o??q.current.duration)-(a??0))/100;Te(Je)},$e=()=>{Z()},Xe=et=>ot=>{ot.stopPropagation(),et()};ye.useEffect(()=>{y==null||y(B)},[B,y]);const rt=!(g||oe);return Ye.jsxs("div",{ref:D,className:`${Tt.root} ${M||""}`,children:[Ye.jsx("video",{className:`${Tt.video} ${e?Tt.origin_ratio:""}`,ref:q,muted:!0,playsInline:!0,loop:d}),s&&Ye.jsx("div",{className:`${Tt.poster} ${e?Tt.origin_ratio:""}`,style:{backgroundImage:`url("${s}?h=1600&f=webp")`}}),Ye.jsxs("div",{className:`${Tt.layer} ${t?Tt.shadow:""}`,onClick:Se,children:[se&&Ye.jsx("div",{className:`${Tt.indicator} ${Tt[`indicator_${se}`]}`,children:Ye.jsx(AI,{animationData:NI,loop:!0})}),r&&B&&Ye.jsxs(Ye.Fragment,{children:[rt&&Ye.jsx(t0,{handle:!0,className:Tt.progress,progress:ge.progress,onChangeProgress:We}),rt&&Ye.jsx(CR,{className:Tt.time,currentTime:ge.currentTime,durationTime:ge.durationTime}),rt&&Ye.jsxs("button",{className:`${Tt.button} ${Tt.playbackrate}`,onClick:Xe(me),"aria-label":"비디오 배속",children:[Ee,"x"]}),Ye.jsx("button",{className:`${Tt.button} ${Tt.play_toggle}`,onClick:Xe(Ce),"aria-label":"비디오 재생",children:Ye.jsx(kn,{name:he?"pause":"play"})}),rt&&Ye.jsx("button",{className:`${Tt.button} ${Tt.backward}`,onClick:Xe(ue),"aria-label":"비디오 10초 뒤로",children:Ye.jsx(kn,{name:"backward"})}),rt&&Ye.jsx("button",{className:`${Tt.button} ${Tt.forward}`,onClick:Xe(pe),"aria-label":"비디오 10초 앞으로",children:Ye.jsx(kn,{name:"forward"})}),!!u&&rt&&Ye.jsx("button",{className:`${Tt.button} ${Tt.chapter_toggle}`,"aria-label":"비디오 챕터",onClick:Xe($e),children:Ht.t("chapter")}),!!u&&J&&Ye.jsx("div",{className:Tt.chapter_wrap,children:u==null?void 0:u.map(et=>Ye.jsx(jI,{...et,onClick:Xe(()=>Te(BL(et.time)))},et.id))})]}),B&&(v==null?void 0:v({time:ge,play:he,handlePlayToggle:Ce,handleChangeProgress:We}))]})]})});function Yd(i){return i!==null&&typeof i=="object"&&"constructor"in i&&i.constructor===Object}function Eu(i,e){i===void 0&&(i={}),e===void 0&&(e={}),Object.keys(e).forEach(t=>{typeof i[t]>"u"?i[t]=e[t]:Yd(e[t])&&Yd(i[t])&&Object.keys(e[t]).length>0&&Eu(i[t],e[t])})}const l0={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 Ks(){const i=typeof document<"u"?document:{};return Eu(i,l0),i}const KI={document:l0,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 ur(){const i=typeof window<"u"?window:{};return Eu(i,KI),i}function zI(i){return i===void 0&&(i=""),i.trim().split(" ").filter(e=>!!e.trim())}function WI(i){const e=i;Object.keys(e).forEach(t=>{try{e[t]=null}catch{}try{delete e[t]}catch{}})}function Tc(i,e){return e===void 0&&(e=0),setTimeout(i,e)}function ho(){return Date.now()}function qI(i){const e=ur();let t;return e.getComputedStyle&&(t=e.getComputedStyle(i,null)),!t&&i.currentStyle&&(t=i.currentStyle),t||(t=i.style),t}function YI(i,e){e===void 0&&(e="x");const t=ur();let r,s,n;const a=qI(i);return t.WebKitCSSMatrix?(s=a.transform||a.webkitTransform,s.split(",").length>6&&(s=s.split(", ").map(o=>o.replace(",",".")).join(", ")),n=new t.WebKitCSSMatrix(s==="none"?"":s)):(n=a.MozTransform||a.OTransform||a.MsTransform||a.msTransform||a.transform||a.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=n.toString().split(",")),e==="x"&&(t.WebKitCSSMatrix?s=n.m41:r.length===16?s=parseFloat(r[12]):s=parseFloat(r[4])),e==="y"&&(t.WebKitCSSMatrix?s=n.m42:r.length===16?s=parseFloat(r[13]):s=parseFloat(r[5])),s||0}function Oa(i){return typeof i=="object"&&i!==null&&i.constructor&&Object.prototype.toString.call(i).slice(8,-1)==="Object"}function XI(i){return typeof window<"u"&&typeof window.HTMLElement<"u"?i instanceof HTMLElement:i&&(i.nodeType===1||i.nodeType===11)}function or(){const i=Object(arguments.length<=0?void 0:arguments[0]),e=["__proto__","constructor","prototype"];for(let t=1;t<arguments.length;t+=1){const r=t<0||arguments.length<=t?void 0:arguments[t];if(r!=null&&!XI(r)){const s=Object.keys(Object(r)).filter(n=>e.indexOf(n)<0);for(let n=0,a=s.length;n<a;n+=1){const o=s[n],l=Object.getOwnPropertyDescriptor(r,o);l!==void 0&&l.enumerable&&(Oa(i[o])&&Oa(r[o])?r[o].__swiper__?i[o]=r[o]:or(i[o],r[o]):!Oa(i[o])&&Oa(r[o])?(i[o]={},r[o].__swiper__?i[o]=r[o]:or(i[o],r[o])):i[o]=r[o])}}}return i}function Ma(i,e,t){i.style.setProperty(e,t)}function c0(i){let{swiper:e,targetPosition:t,side:r}=i;const s=ur(),n=-e.translate;let a=null,o;const l=e.params.speed;e.wrapperEl.style.scrollSnapType="none",s.cancelAnimationFrame(e.cssModeFrameID);const u=t>n?"next":"prev",h=(g,v)=>u==="next"&&g>=v||u==="prev"&&g<=v,d=()=>{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(h(y,t)&&(y=t),e.wrapperEl.scrollTo({[r]:y}),h(y,t)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[r]:y})}),s.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=s.requestAnimationFrame(d)};d()}function gi(i,e){return e===void 0&&(e=""),[...i.children].filter(t=>t.matches(e))}function fo(i){try{console.warn(i);return}catch{}}function wc(i,e){e===void 0&&(e=[]);const t=document.createElement(i);return t.classList.add(...Array.isArray(e)?e:zI(e)),t}function QI(i,e){const t=[];for(;i.previousElementSibling;){const r=i.previousElementSibling;e?r.matches(e)&&t.push(r):t.push(r),i=r}return t}function JI(i,e){const t=[];for(;i.nextElementSibling;){const r=i.nextElementSibling;e?r.matches(e)&&t.push(r):t.push(r),i=r}return t}function Fi(i,e){return ur().getComputedStyle(i,null).getPropertyValue(e)}function Xd(i){let e=i,t;if(e){for(t=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(t+=1);return t}}function ZI(i,e){const t=[];let r=i.parentElement;for(;r;)t.push(r),r=r.parentElement;return t}function Qd(i,e,t){const r=ur();return i[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(i,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(i,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}let kl;function eP(){const i=ur(),e=Ks();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in i||i.DocumentTouch&&e instanceof i.DocumentTouch)}}function u0(){return kl||(kl=eP()),kl}let Dl;function tP(i){let{userAgent:e}=i===void 0?{}:i;const t=u0(),r=ur(),s=r.navigator.platform,n=e||r.navigator.userAgent,a={ios:!1,android:!1},o=r.screen.width,l=r.screen.height,u=n.match(/(Android);?[\s\/]+([\d.]+)?/);let h=n.match(/(iPad).*OS\s([\d_]+)/);const d=n.match(/(iPod)(.*OS\s([\d_]+))?/),g=!h&&n.match(/(iPhone\sOS|iOS)\s([\d_]+)/),v=s==="Win32";let y=s==="MacIntel";const b=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!h&&y&&t.touch&&b.indexOf(`${o}x${l}`)>=0&&(h=n.match(/(Version)\/([\d.]+)/),h||(h=[0,1,"13_0_0"]),y=!1),u&&!v&&(a.os="android",a.android=!0),(h||g||d)&&(a.os="ios",a.ios=!0),a}function h0(i){return i===void 0&&(i={}),Dl||(Dl=tP(i)),Dl}let Ol;function rP(){const i=ur(),e=h0();let t=!1;function r(){const o=i.navigator.userAgent.toLowerCase();return o.indexOf("safari")>=0&&o.indexOf("chrome")<0&&o.indexOf("android")<0}if(r()){const o=String(i.navigator.userAgent);if(o.includes("Version/")){const[l,u]=o.split("Version/")[1].split(" ")[0].split(".").map(h=>Number(h));t=l<16||l===16&&u<2}}const s=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(i.navigator.userAgent),n=r(),a=n||s&&e.ios;return{isSafari:t||n,needPerspectiveFix:t,need3dFix:a,isWebView:s}}function iP(){return Ol||(Ol=rP()),Ol}function sP(i){let{swiper:e,on:t,emit:r}=i;const s=ur();let n=null,a=null;const o=()=>{!e||e.destroyed||!e.initialized||(r("beforeResize"),r("resize"))},l=()=>{!e||e.destroyed||!e.initialized||(n=new ResizeObserver(d=>{a=s.requestAnimationFrame(()=>{const{width:g,height:v}=e;let y=g,b=v;d.forEach(E=>{let{contentBoxSize:A,contentRect:M,target:D}=E;D&&D!==e.el||(y=M?M.width:(A[0]||A).inlineSize,b=M?M.height:(A[0]||A).blockSize)}),(y!==g||b!==v)&&o()})}),n.observe(e.el))},u=()=>{a&&s.cancelAnimationFrame(a),n&&n.unobserve&&e.el&&(n.unobserve(e.el),n=null)},h=()=>{!e||e.destroyed||!e.initialized||r("orientationchange")};t("init",()=>{if(e.params.resizeObserver&&typeof s.ResizeObserver<"u"){l();return}s.addEventListener("resize",o),s.addEventListener("orientationchange",h)}),t("destroy",()=>{u(),s.removeEventListener("resize",o),s.removeEventListener("orientationchange",h)})}function nP(i){let{swiper:e,extendParams:t,on:r,emit:s}=i;const n=[],a=ur(),o=function(h,d){d===void 0&&(d={});const g=a.MutationObserver||a.WebkitMutationObserver,v=new g(y=>{if(e.__preventObserver__)return;if(y.length===1){s("observerUpdate",y[0]);return}const b=function(){s("observerUpdate",y[0])};a.requestAnimationFrame?a.requestAnimationFrame(b):a.setTimeout(b,0)});v.observe(h,{attributes:typeof d.attributes>"u"?!0:d.attributes,childList:typeof d.childList>"u"?!0:d.childList,characterData:typeof d.characterData>"u"?!0:d.characterData}),n.push(v)},l=()=>{if(e.params.observer){if(e.params.observeParents){const h=ZI(e.hostEl);for(let d=0;d<h.length;d+=1)o(h[d])}o(e.hostEl,{childList:e.params.observeSlideChildren}),o(e.wrapperEl,{attributes:!1})}},u=()=>{n.forEach(h=>{h.disconnect()}),n.splice(0,n.length)};t({observer:!1,observeParents:!1,observeSlideChildren:!1}),r("init",l),r("destroy",u)}var aP={on(i,e,t){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;const s=t?"unshift":"push";return i.split(" ").forEach(n=>{r.eventsListeners[n]||(r.eventsListeners[n]=[]),r.eventsListeners[n][s](e)}),r},once(i,e,t){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;function s(){r.off(i,s),s.__emitterProxy&&delete s.__emitterProxy;for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];e.apply(r,a)}return s.__emitterProxy=e,r.on(i,s,t)},onAny(i,e){const t=this;if(!t.eventsListeners||t.destroyed||typeof i!="function")return t;const r=e?"unshift":"push";return t.eventsAnyListeners.indexOf(i)<0&&t.eventsAnyListeners[r](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(r=>{typeof e>"u"?t.eventsListeners[r]=[]:t.eventsListeners[r]&&t.eventsListeners[r].forEach((s,n)=>{(s===e||s.__emitterProxy&&s.__emitterProxy===e)&&t.eventsListeners[r].splice(n,1)})}),t},emit(){const i=this;if(!i.eventsListeners||i.destroyed||!i.eventsListeners)return i;let e,t,r;for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];return typeof n[0]=="string"||Array.isArray(n[0])?(e=n[0],t=n.slice(1,n.length),r=i):(e=n[0].events,t=n[0].data,r=n[0].context||i),t.unshift(r),(Array.isArray(e)?e:e.split(" ")).forEach(l=>{i.eventsAnyListeners&&i.eventsAnyListeners.length&&i.eventsAnyListeners.forEach(u=>{u.apply(r,[l,...t])}),i.eventsListeners&&i.eventsListeners[l]&&i.eventsListeners[l].forEach(u=>{u.apply(r,t)})}),i}};function oP(){const i=this;let e,t;const r=i.el;typeof i.params.width<"u"&&i.params.width!==null?e=i.params.width:e=r.clientWidth,typeof i.params.height<"u"&&i.params.height!==null?t=i.params.height:t=r.clientHeight,!(e===0&&i.isHorizontal()||t===0&&i.isVertical())&&(e=e-parseInt(Fi(r,"padding-left")||0,10)-parseInt(Fi(r,"padding-right")||0,10),t=t-parseInt(Fi(r,"padding-top")||0,10)-parseInt(Fi(r,"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 lP(){const i=this;function e(q,oe){return parseFloat(q.getPropertyValue(i.getDirectionLabel(oe))||0)}const t=i.params,{wrapperEl:r,slidesEl:s,size:n,rtlTranslate:a,wrongRTL:o}=i,l=i.virtual&&t.virtual.enabled,u=l?i.virtual.slides.length:i.slides.length,h=gi(s,`.${i.params.slideClass}, swiper-slide`),d=l?i.virtual.slides.length:h.length;let g=[];const v=[],y=[];let b=t.slidesOffsetBefore;typeof b=="function"&&(b=t.slidesOffsetBefore.call(i));let E=t.slidesOffsetAfter;typeof E=="function"&&(E=t.slidesOffsetAfter.call(i));const A=i.snapGrid.length,M=i.slidesGrid.length;let D=t.spaceBetween,B=-b,N=0,J=0;if(typeof n>"u")return;typeof D=="string"&&D.indexOf("%")>=0?D=parseFloat(D.replace("%",""))/100*n:typeof D=="string"&&(D=parseFloat(D)),i.virtualSize=-D,h.forEach(q=>{a?q.style.marginLeft="":q.style.marginRight="",q.style.marginBottom="",q.style.marginTop=""}),t.centeredSlides&&t.cssMode&&(Ma(r,"--swiper-centered-offset-before",""),Ma(r,"--swiper-centered-offset-after",""));const Z=t.grid&&t.grid.rows>1&&i.grid;Z?i.grid.initSlides(h):i.grid&&i.grid.unsetSlides();let se;const Q=t.slidesPerView==="auto"&&t.breakpoints&&Object.keys(t.breakpoints).filter(q=>typeof t.breakpoints[q].slidesPerView<"u").length>0;for(let q=0;q<d;q+=1){se=0;let oe;if(h[q]&&(oe=h[q]),Z&&i.grid.updateSlide(q,oe,h),!(h[q]&&Fi(oe,"display")==="none")){if(t.slidesPerView==="auto"){Q&&(h[q].style[i.getDirectionLabel("width")]="");const ge=getComputedStyle(oe),he=oe.style.transform,Ee=oe.style.webkitTransform;if(he&&(oe.style.transform="none"),Ee&&(oe.style.webkitTransform="none"),t.roundLengths)se=i.isHorizontal()?Qd(oe,"width"):Qd(oe,"height");else{const Te=e(ge,"width"),ue=e(ge,"padding-left"),pe=e(ge,"padding-right"),Ce=e(ge,"margin-left"),me=e(ge,"margin-right"),Se=ge.getPropertyValue("box-sizing");if(Se&&Se==="border-box")se=Te+Ce+me;else{const{clientWidth:We,offsetWidth:$e}=oe;se=Te+ue+pe+Ce+me+($e-We)}}he&&(oe.style.transform=he),Ee&&(oe.style.webkitTransform=Ee),t.roundLengths&&(se=Math.floor(se))}else se=(n-(t.slidesPerView-1)*D)/t.slidesPerView,t.roundLengths&&(se=Math.floor(se)),h[q]&&(h[q].style[i.getDirectionLabel("width")]=`${se}px`);h[q]&&(h[q].swiperSlideSize=se),y.push(se),t.centeredSlides?(B=B+se/2+N/2+D,N===0&&q!==0&&(B=B-n/2-D),q===0&&(B=B-n/2-D),Math.abs(B)<1/1e3&&(B=0),t.roundLengths&&(B=Math.floor(B)),J%t.slidesPerGroup===0&&g.push(B),v.push(B)):(t.roundLengths&&(B=Math.floor(B)),(J-Math.min(i.params.slidesPerGroupSkip,J))%i.params.slidesPerGroup===0&&g.push(B),v.push(B),B=B+se+D),i.virtualSize+=se+D,N=se,J+=1}}if(i.virtualSize=Math.max(i.virtualSize,n)+E,a&&o&&(t.effect==="slide"||t.effect==="coverflow")&&(r.style.width=`${i.virtualSize+D}px`),t.setWrapperSize&&(r.style[i.getDirectionLabel("width")]=`${i.virtualSize+D}px`),Z&&i.grid.updateWrapperSize(se,g),!t.centeredSlides){const q=[];for(let oe=0;oe<g.length;oe+=1){let ge=g[oe];t.roundLengths&&(ge=Math.floor(ge)),g[oe]<=i.virtualSize-n&&q.push(ge)}g=q,Math.floor(i.virtualSize-n)-Math.floor(g[g.length-1])>1&&g.push(i.virtualSize-n)}if(l&&t.loop){const q=y[0]+D;if(t.slidesPerGroup>1){const oe=Math.ceil((i.virtual.slidesBefore+i.virtual.slidesAfter)/t.slidesPerGroup),ge=q*t.slidesPerGroup;for(let he=0;he<oe;he+=1)g.push(g[g.length-1]+ge)}for(let oe=0;oe<i.virtual.slidesBefore+i.virtual.slidesAfter;oe+=1)t.slidesPerGroup===1&&g.push(g[g.length-1]+q),v.push(v[v.length-1]+q),i.virtualSize+=q}if(g.length===0&&(g=[0]),D!==0){const q=i.isHorizontal()&&a?"marginLeft":i.getDirectionLabel("marginRight");h.filter((oe,ge)=>!t.cssMode||t.loop?!0:ge!==h.length-1).forEach(oe=>{oe.style[q]=`${D}px`})}if(t.centeredSlides&&t.centeredSlidesBounds){let q=0;y.forEach(ge=>{q+=ge+(D||0)}),q-=D;const oe=q-n;g=g.map(ge=>ge<=0?-b:ge>oe?oe+E:ge)}if(t.centerInsufficientSlides){let q=0;y.forEach(ge=>{q+=ge+(D||0)}),q-=D;const oe=(t.slidesOffsetBefore||0)+(t.slidesOffsetAfter||0);if(q+oe<n){const ge=(n-q-oe)/2;g.forEach((he,Ee)=>{g[Ee]=he-ge}),v.forEach((he,Ee)=>{v[Ee]=he+ge})}}if(Object.assign(i,{slides:h,snapGrid:g,slidesGrid:v,slidesSizesGrid:y}),t.centeredSlides&&t.cssMode&&!t.centeredSlidesBounds){Ma(r,"--swiper-centered-offset-before",`${-g[0]}px`),Ma(r,"--swiper-centered-offset-after",`${i.size/2-y[y.length-1]/2}px`);const q=-i.snapGrid[0],oe=-i.slidesGrid[0];i.snapGrid=i.snapGrid.map(ge=>ge+q),i.slidesGrid=i.slidesGrid.map(ge=>ge+oe)}if(d!==u&&i.emit("slidesLengthChange"),g.length!==A&&(i.params.watchOverflow&&i.checkOverflow(),i.emit("snapGridLengthChange")),v.length!==M&&i.emit("slidesGridLengthChange"),t.watchSlidesProgress&&i.updateSlidesOffset(),i.emit("slidesUpdated"),!l&&!t.cssMode&&(t.effect==="slide"||t.effect==="fade")){const q=`${t.containerModifierClass}backface-hidden`,oe=i.el.classList.contains(q);d<=t.maxBackfaceHiddenSlides?oe||i.el.classList.add(q):oe&&i.el.classList.remove(q)}}function cP(i){const e=this,t=[],r=e.virtual&&e.params.virtual.enabled;let s=0,n;typeof i=="number"?e.setTransition(i):i===!0&&e.setTransition(e.params.speed);const a=o=>r?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&&!r)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;s=o>s?o:s}(s||s===0)&&(e.wrapperEl.style.height=`${s}px`)}function uP(){const i=this,e=i.slides,t=i.isElement?i.isHorizontal()?i.wrapperEl.offsetLeft:i.wrapperEl.offsetTop:0;for(let r=0;r<e.length;r+=1)e[r].swiperSlideOffset=(i.isHorizontal()?e[r].offsetLeft:e[r].offsetTop)-t-i.cssOverflowAdjustment()}const Jd=(i,e,t)=>{e&&!i.classList.contains(t)?i.classList.add(t):!e&&i.classList.contains(t)&&i.classList.remove(t)};function hP(i){i===void 0&&(i=this&&this.translate||0);const e=this,t=e.params,{slides:r,rtlTranslate:s,snapGrid:n}=e;if(r.length===0)return;typeof r[0].swiperSlideOffset>"u"&&e.updateSlidesOffset();let a=-i;s&&(a=i),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<r.length;l+=1){const u=r[l];let h=u.swiperSlideOffset;t.cssMode&&t.centeredSlides&&(h-=r[0].swiperSlideOffset);const d=(a+(t.centeredSlides?e.minTranslate():0)-h)/(u.swiperSlideSize+o),g=(a-n[0]+(t.centeredSlides?e.minTranslate():0)-h)/(u.swiperSlideSize+o),v=-(a-h),y=v+e.slidesSizesGrid[l],b=v>=0&&v<=e.size-e.slidesSizesGrid[l],E=v>=0&&v<e.size-1||y>1&&y<=e.size||v<=0&&y>=e.size;E&&(e.visibleSlides.push(u),e.visibleSlidesIndexes.push(l)),Jd(u,E,t.slideVisibleClass),Jd(u,b,t.slideFullyVisibleClass),u.progress=s?-d:d,u.originalProgress=s?-g:g}}function fP(i){const e=this;if(typeof i>"u"){const h=e.rtlTranslate?-1:1;i=e&&e.translate&&e.translate*h||0}const t=e.params,r=e.maxTranslate()-e.minTranslate();let{progress:s,isBeginning:n,isEnd:a,progressLoop:o}=e;const l=n,u=a;if(r===0)s=0,n=!0,a=!0;else{s=(i-e.minTranslate())/r;const h=Math.abs(i-e.minTranslate())<1,d=Math.abs(i-e.maxTranslate())<1;n=h||s<=0,a=d||s>=1,h&&(s=0),d&&(s=1)}if(t.loop){const h=e.getSlideIndexByData(0),d=e.getSlideIndexByData(e.slides.length-1),g=e.slidesGrid[h],v=e.slidesGrid[d],y=e.slidesGrid[e.slidesGrid.length-1],b=Math.abs(i);b>=g?o=(b-g)/y:o=(b+y-v)/y,o>1&&(o-=1)}Object.assign(e,{progress:s,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",s)}const Ml=(i,e,t)=>{e&&!i.classList.contains(t)?i.classList.add(t):!e&&i.classList.contains(t)&&i.classList.remove(t)};function dP(){const i=this,{slides:e,params:t,slidesEl:r,activeIndex:s}=i,n=i.virtual&&t.virtual.enabled,a=i.grid&&t.grid&&t.grid.rows>1,o=d=>gi(r,`.${t.slideClass}${d}, swiper-slide${d}`)[0];let l,u,h;if(n)if(t.loop){let d=s-i.virtual.slidesBefore;d<0&&(d=i.virtual.slides.length+d),d>=i.virtual.slides.length&&(d-=i.virtual.slides.length),l=o(`[data-swiper-slide-index="${d}"]`)}else l=o(`[data-swiper-slide-index="${s}"]`);else a?(l=e.filter(d=>d.column===s)[0],h=e.filter(d=>d.column===s+1)[0],u=e.filter(d=>d.column===s-1)[0]):l=e[s];l&&(a||(h=JI(l,`.${t.slideClass}, swiper-slide`)[0],t.loop&&!h&&(h=e[0]),u=QI(l,`.${t.slideClass}, swiper-slide`)[0],t.loop&&!u===0&&(u=e[e.length-1]))),e.forEach(d=>{Ml(d,d===l,t.slideActiveClass),Ml(d,d===h,t.slideNextClass),Ml(d,d===u,t.slidePrevClass)}),i.emitSlidesClasses()}const Ha=(i,e)=>{if(!i||i.destroyed||!i.params)return;const t=()=>i.isElement?"swiper-slide":`.${i.params.slideClass}`,r=e.closest(t());if(r){let s=r.querySelector(`.${i.params.lazyPreloaderClass}`);!s&&i.isElement&&(r.shadowRoot?s=r.shadowRoot.querySelector(`.${i.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{r.shadowRoot&&(s=r.shadowRoot.querySelector(`.${i.params.lazyPreloaderClass}`),s&&s.remove())})),s&&s.remove()}},Fl=(i,e)=>{if(!i.slides[e])return;const t=i.slides[e].querySelector('[loading="lazy"]');t&&t.removeAttribute("loading")},Ac=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 r=i.params.slidesPerView==="auto"?i.slidesPerViewDynamic():Math.ceil(i.params.slidesPerView),s=i.activeIndex;if(i.params.grid&&i.params.grid.rows>1){const a=s,o=[a-e];o.push(...Array.from({length:e}).map((l,u)=>a+r+u)),i.slides.forEach((l,u)=>{o.includes(l.column)&&Fl(i,u)});return}const n=s+r-1;if(i.params.rewind||i.params.loop)for(let a=s-e;a<=n+e;a+=1){const o=(a%t+t)%t;(o<s||o>n)&&Fl(i,o)}else for(let a=Math.max(s-e,0);a<=Math.min(n+e,t-1);a+=1)a!==s&&(a>n||a<s)&&Fl(i,a)};function pP(i){const{slidesGrid:e,params:t}=i,r=i.rtlTranslate?i.translate:-i.translate;let s;for(let n=0;n<e.length;n+=1)typeof e[n+1]<"u"?r>=e[n]&&r<e[n+1]-(e[n+1]-e[n])/2?s=n:r>=e[n]&&r<e[n+1]&&(s=n+1):r>=e[n]&&(s=n);return t.normalizeSlideIndex&&(s<0||typeof s>"u")&&(s=0),s}function gP(i){const e=this,t=e.rtlTranslate?e.translate:-e.translate,{snapGrid:r,params:s,activeIndex:n,realIndex:a,snapIndex:o}=e;let l=i,u;const h=v=>{let y=v-e.virtual.slidesBefore;return y<0&&(y=e.virtual.slides.length+y),y>=e.virtual.slides.length&&(y-=e.virtual.slides.length),y};if(typeof l>"u"&&(l=pP(e)),r.indexOf(t)>=0)u=r.indexOf(t);else{const v=Math.min(s.slidesPerGroupSkip,l);u=v+Math.floor((l-v)/s.slidesPerGroup)}if(u>=r.length&&(u=r.length-1),l===n&&!e.params.loop){u!==o&&(e.snapIndex=u,e.emit("snapIndexChange"));return}if(l===n&&e.params.loop&&e.virtual&&e.params.virtual.enabled){e.realIndex=h(l);return}const d=e.grid&&s.grid&&s.grid.rows>1;let g;if(e.virtual&&s.virtual.enabled&&s.loop)g=h(l);else if(d){const v=e.slides.filter(b=>b.column===l)[0];let y=parseInt(v.getAttribute("data-swiper-slide-index"),10);Number.isNaN(y)&&(y=Math.max(e.slides.indexOf(v),0)),g=Math.floor(y/s.grid.rows)}else if(e.slides[l]){const v=e.slides[l].getAttribute("data-swiper-slide-index");v?g=parseInt(v,10):g=l}else g=l;Object.assign(e,{previousSnapIndex:o,snapIndex:u,previousRealIndex:a,realIndex:g,previousIndex:n,activeIndex:l}),e.initialized&&Ac(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(a!==g&&e.emit("realIndexChange"),e.emit("slideChange"))}function mP(i,e){const t=this,r=t.params;let s=i.closest(`.${r.slideClass}, swiper-slide`);!s&&t.isElement&&e&&e.length>1&&e.includes(i)&&[...e.slice(e.indexOf(i)+1,e.length)].forEach(o=>{!s&&o.matches&&o.matches(`.${r.slideClass}, swiper-slide`)&&(s=o)});let n=!1,a;if(s){for(let o=0;o<t.slides.length;o+=1)if(t.slides[o]===s){n=!0,a=o;break}}if(s&&n)t.clickedSlide=s,t.virtual&&t.params.virtual.enabled?t.clickedIndex=parseInt(s.getAttribute("data-swiper-slide-index"),10):t.clickedIndex=a;else{t.clickedSlide=void 0,t.clickedIndex=void 0;return}r.slideToClickedSlide&&t.clickedIndex!==void 0&&t.clickedIndex!==t.activeIndex&&t.slideToClickedSlide()}var vP={updateSize:oP,updateSlides:lP,updateAutoHeight:cP,updateSlidesOffset:uP,updateSlidesProgress:hP,updateProgress:fP,updateSlidesClasses:dP,updateActiveIndex:gP,updateClickedSlide:mP};function yP(i){i===void 0&&(i=this.isHorizontal()?"x":"y");const e=this,{params:t,rtlTranslate:r,translate:s,wrapperEl:n}=e;if(t.virtualTranslate)return r?-s:s;if(t.cssMode)return s;let a=YI(n,i);return a+=e.cssOverflowAdjustment(),r&&(a=-a),a||0}function SP(i,e){const t=this,{rtlTranslate:r,params:s,wrapperEl:n,progress:a}=t;let o=0,l=0;const u=0;t.isHorizontal()?o=r?-i:i:l=i,s.roundLengths&&(o=Math.floor(o),l=Math.floor(l)),t.previousTranslate=t.translate,t.translate=t.isHorizontal()?o:l,s.cssMode?n[t.isHorizontal()?"scrollLeft":"scrollTop"]=t.isHorizontal()?-o:-l:s.virtualTranslate||(t.isHorizontal()?o-=t.cssOverflowAdjustment():l-=t.cssOverflowAdjustment(),n.style.transform=`translate3d(${o}px, ${l}px, ${u}px)`);let h;const d=t.maxTranslate()-t.minTranslate();d===0?h=0:h=(i-t.minTranslate())/d,h!==a&&t.updateProgress(i),t.emit("setTranslate",t.translate,e)}function xP(){return-this.snapGrid[0]}function bP(){return-this.snapGrid[this.snapGrid.length-1]}function EP(i,e,t,r,s){i===void 0&&(i=0),e===void 0&&(e=this.params.speed),t===void 0&&(t=!0),r===void 0&&(r=!0);const n=this,{params:a,wrapperEl:o}=n;if(n.animating&&a.preventInteractionOnTransition)return!1;const l=n.minTranslate(),u=n.maxTranslate();let h;if(r&&i>l?h=l:r&&i<u?h=u:h=i,n.updateProgress(h),a.cssMode){const d=n.isHorizontal();if(e===0)o[d?"scrollLeft":"scrollTop"]=-h;else{if(!n.support.smoothScroll)return c0({swiper:n,targetPosition:-h,side:d?"left":"top"}),!0;o.scrollTo({[d?"left":"top"]:-h,behavior:"smooth"})}return!0}return e===0?(n.setTransition(0),n.setTranslate(h),t&&(n.emit("beforeTransitionStart",e,s),n.emit("transitionEnd"))):(n.setTransition(e),n.setTranslate(h),t&&(n.emit("beforeTransitionStart",e,s),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,n.animating=!1,t&&n.emit("transitionEnd"))}),n.wrapperEl.addEventListener("transitionend",n.onTranslateToWrapperTransitionEnd))),!0}var TP={getTranslate:yP,setTranslate:SP,minTranslate:xP,maxTranslate:bP,translateTo:EP};function wP(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 f0(i){let{swiper:e,runCallbacks:t,direction:r,step:s}=i;const{activeIndex:n,previousIndex:a}=e;let o=r;if(o||(n>a?o="next":n<a?o="prev":o="reset"),e.emit(`transition${s}`),t&&n!==a){if(o==="reset"){e.emit(`slideResetTransition${s}`);return}e.emit(`slideChangeTransition${s}`),o==="next"?e.emit(`slideNextTransition${s}`):e.emit(`slidePrevTransition${s}`)}}function AP(i,e){i===void 0&&(i=!0);const t=this,{params:r}=t;r.cssMode||(r.autoHeight&&t.updateAutoHeight(),f0({swiper:t,runCallbacks:i,direction:e,step:"Start"}))}function _P(i,e){i===void 0&&(i=!0);const t=this,{params:r}=t;t.animating=!1,!r.cssMode&&(t.setTransition(0),f0({swiper:t,runCallbacks:i,direction:e,step:"End"}))}var CP={setTransition:wP,transitionStart:AP,transitionEnd:_P};function LP(i,e,t,r,s){i===void 0&&(i=0),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:h,activeIndex:d,rtlTranslate:g,wrapperEl:v,enabled:y}=n;if(!y&&!r&&!s||n.destroyed||n.animating&&o.preventInteractionOnTransition)return!1;typeof e>"u"&&(e=n.params.speed);const b=Math.min(n.params.slidesPerGroupSkip,a);let E=b+Math.floor((a-b)/n.params.slidesPerGroup);E>=l.length&&(E=l.length-1);const A=-l[E];if(o.normalizeSlideIndex)for(let D=0;D<u.length;D+=1){const B=-Math.floor(A*100),N=Math.floor(u[D]*100),J=Math.floor(u[D+1]*100);typeof u[D+1]<"u"?B>=N&&B<J-(J-N)/2?a=D:B>=N&&B<J&&(a=D+1):B>=N&&(a=D)}if(n.initialized&&a!==d&&(!n.allowSlideNext&&(g?A>n.translate&&A>n.minTranslate():A<n.translate&&A<n.minTranslate())||!n.allowSlidePrev&&A>n.translate&&A>n.maxTranslate()&&(d||0)!==a))return!1;a!==(h||0)&&t&&n.emit("beforeSlideChangeStart"),n.updateProgress(A);let M;if(a>d?M="next":a<d?M="prev":M="reset",g&&-A===n.translate||!g&&A===n.translate)return n.updateActiveIndex(a),o.autoHeight&&n.updateAutoHeight(),n.updateSlidesClasses(),o.effect!=="slide"&&n.setTranslate(A),M!=="reset"&&(n.transitionStart(t,M),n.transitionEnd(t,M)),!1;if(o.cssMode){const D=n.isHorizontal(),B=g?A:-A;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[D?"scrollLeft":"scrollTop"]=B})):v[D?"scrollLeft":"scrollTop"]=B,N&&requestAnimationFrame(()=>{n.wrapperEl.style.scrollSnapType="",n._immediateVirtual=!1})}else{if(!n.support.smoothScroll)return c0({swiper:n,targetPosition:B,side:D?"left":"top"}),!0;v.scrollTo({[D?"left":"top"]:B,behavior:"smooth"})}return!0}return n.setTransition(e),n.setTranslate(A),n.updateActiveIndex(a),n.updateSlidesClasses(),n.emit("beforeTransitionStart",e,r),n.transitionStart(t,M),e===0?n.transitionEnd(t,M):n.animating||(n.animating=!0,n.onSlideToWrapperTransitionEnd||(n.onSlideToWrapperTransitionEnd=function(B){!n||n.destroyed||B.target===this&&(n.wrapperEl.removeEventListener("transitionend",n.onSlideToWrapperTransitionEnd),n.onSlideToWrapperTransitionEnd=null,delete n.onSlideToWrapperTransitionEnd,n.transitionEnd(t,M))}),n.wrapperEl.addEventListener("transitionend",n.onSlideToWrapperTransitionEnd)),!0}function RP(i,e,t,r){i===void 0&&(i=0),t===void 0&&(t=!0),typeof i=="string"&&(i=parseInt(i,10));const s=this;if(s.destroyed)return;typeof e>"u"&&(e=s.params.speed);const n=s.grid&&s.params.grid&&s.params.grid.rows>1;let a=i;if(s.params.loop)if(s.virtual&&s.params.virtual.enabled)a=a+s.virtual.slidesBefore;else{let o;if(n){const g=a*s.params.grid.rows;o=s.slides.filter(v=>v.getAttribute("data-swiper-slide-index")*1===g)[0].column}else o=s.getSlideIndexByData(a);const l=n?Math.ceil(s.slides.length/s.params.grid.rows):s.slides.length,{centeredSlides:u}=s.params;let h=s.params.slidesPerView;h==="auto"?h=s.slidesPerViewDynamic():(h=Math.ceil(parseFloat(s.params.slidesPerView,10)),u&&h%2===0&&(h=h+1));let d=l-o<h;if(u&&(d=d||o<Math.ceil(h/2)),r&&u&&s.params.slidesPerView!=="auto"&&!n&&(d=!1),d){const g=u?o<s.activeIndex?"prev":"next":o-s.activeIndex-1<s.params.slidesPerView?"next":"prev";s.loopFix({direction:g,slideTo:!0,activeSlideIndex:g==="next"?o+1:o-l+1,slideRealIndex:g==="next"?s.realIndex:void 0})}if(n){const g=a*s.params.grid.rows;a=s.slides.filter(v=>v.getAttribute("data-swiper-slide-index")*1===g)[0].column}else a=s.getSlideIndexByData(a)}return requestAnimationFrame(()=>{s.slideTo(a,e,t,r)}),s}function IP(i,e,t){e===void 0&&(e=!0);const r=this,{enabled:s,params:n,animating:a}=r;if(!s||r.destroyed)return r;typeof i>"u"&&(i=r.params.speed);let o=n.slidesPerGroup;n.slidesPerView==="auto"&&n.slidesPerGroup===1&&n.slidesPerGroupAuto&&(o=Math.max(r.slidesPerViewDynamic("current",!0),1));const l=r.activeIndex<n.slidesPerGroupSkip?1:o,u=r.virtual&&n.virtual.enabled;if(n.loop){if(a&&!u&&n.loopPreventsSliding)return!1;if(r.loopFix({direction:"next"}),r._clientLeft=r.wrapperEl.clientLeft,r.activeIndex===r.slides.length-1&&n.cssMode)return requestAnimationFrame(()=>{r.slideTo(r.activeIndex+l,i,e,t)}),!0}return n.rewind&&r.isEnd?r.slideTo(0,i,e,t):r.slideTo(r.activeIndex+l,i,e,t)}function PP(i,e,t){e===void 0&&(e=!0);const r=this,{params:s,snapGrid:n,slidesGrid:a,rtlTranslate:o,enabled:l,animating:u}=r;if(!l||r.destroyed)return r;typeof i>"u"&&(i=r.params.speed);const h=r.virtual&&s.virtual.enabled;if(s.loop){if(u&&!h&&s.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}const d=o?r.translate:-r.translate;function g(A){return A<0?-Math.floor(Math.abs(A)):Math.floor(A)}const v=g(d),y=n.map(A=>g(A));let b=n[y.indexOf(v)-1];if(typeof b>"u"&&s.cssMode){let A;n.forEach((M,D)=>{v>=M&&(A=D)}),typeof A<"u"&&(b=n[A>0?A-1:A])}let E=0;if(typeof b<"u"&&(E=a.indexOf(b),E<0&&(E=r.activeIndex-1),s.slidesPerView==="auto"&&s.slidesPerGroup===1&&s.slidesPerGroupAuto&&(E=E-r.slidesPerViewDynamic("previous",!0)+1,E=Math.max(E,0))),s.rewind&&r.isBeginning){const A=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(A,i,e,t)}else if(s.loop&&r.activeIndex===0&&s.cssMode)return requestAnimationFrame(()=>{r.slideTo(E,i,e,t)}),!0;return r.slideTo(E,i,e,t)}function kP(i,e,t){e===void 0&&(e=!0);const r=this;if(!r.destroyed)return typeof i>"u"&&(i=r.params.speed),r.slideTo(r.activeIndex,i,e,t)}function DP(i,e,t,r){e===void 0&&(e=!0),r===void 0&&(r=.5);const s=this;if(s.destroyed)return;typeof i>"u"&&(i=s.params.speed);let n=s.activeIndex;const a=Math.min(s.params.slidesPerGroupSkip,n),o=a+Math.floor((n-a)/s.params.slidesPerGroup),l=s.rtlTranslate?s.translate:-s.translate;if(l>=s.snapGrid[o]){const u=s.snapGrid[o],h=s.snapGrid[o+1];l-u>(h-u)*r&&(n+=s.params.slidesPerGroup)}else{const u=s.snapGrid[o-1],h=s.snapGrid[o];l-u<=(h-u)*r&&(n-=s.params.slidesPerGroup)}return n=Math.max(n,0),n=Math.min(n,s.slidesGrid.length-1),s.slideTo(n,i,e,t)}function OP(){const i=this;if(i.destroyed)return;const{params:e,slidesEl:t}=i,r=e.slidesPerView==="auto"?i.slidesPerViewDynamic():e.slidesPerView;let s=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?s<i.loopedSlides-r/2||s>i.slides.length-i.loopedSlides+r/2?(i.loopFix(),s=i.getSlideIndex(gi(t,`${a}[data-swiper-slide-index="${n}"]`)[0]),Tc(()=>{i.slideTo(s)})):i.slideTo(s):s>i.slides.length-r?(i.loopFix(),s=i.getSlideIndex(gi(t,`${a}[data-swiper-slide-index="${n}"]`)[0]),Tc(()=>{i.slideTo(s)})):i.slideTo(s)}else i.slideTo(s)}var MP={slideTo:LP,slideToLoop:RP,slideNext:IP,slidePrev:PP,slideReset:kP,slideToClosest:DP,slideToClickedSlide:OP};function FP(i){const e=this,{params:t,slidesEl:r}=e;if(!t.loop||e.virtual&&e.params.virtual.enabled)return;const s=()=>{gi(r,`.${t.slideClass}, swiper-slide`).forEach((d,g)=>{d.setAttribute("data-swiper-slide-index",g)})},n=e.grid&&t.grid&&t.grid.rows>1,a=t.slidesPerGroup*(n?t.grid.rows:1),o=e.slides.length%a!==0,l=n&&e.slides.length%t.grid.rows!==0,u=h=>{for(let d=0;d<h;d+=1){const g=e.isElement?wc("swiper-slide",[t.slideBlankClass]):wc("div",[t.slideClass,t.slideBlankClass]);e.slidesEl.append(g)}};if(o){if(t.loopAddBlankSlides){const h=a-e.slides.length%a;u(h),e.recalcSlides(),e.updateSlides()}else fo("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");s()}else if(l){if(t.loopAddBlankSlides){const h=t.grid.rows-e.slides.length%t.grid.rows;u(h),e.recalcSlides(),e.updateSlides()}else fo("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");s()}else s();e.loopFix({slideRealIndex:i,direction:t.centeredSlides?void 0:"next"})}function NP(i){let{slideRealIndex:e,slideTo:t=!0,direction:r,setTranslate:s,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:h,allowSlideNext:d,slidesEl:g,params:v}=l,{centeredSlides:y}=v;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=h,l.allowSlideNext=d,l.emit("loopFix");return}let b=v.slidesPerView;b==="auto"?b=l.slidesPerViewDynamic():(b=Math.ceil(parseFloat(v.slidesPerView,10)),y&&b%2===0&&(b=b+1));const E=v.slidesPerGroupAuto?b:v.slidesPerGroup;let A=E;A%E!==0&&(A+=E-A%E),A+=v.loopAdditionalSlides,l.loopedSlides=A;const M=l.grid&&v.grid&&v.grid.rows>1;u.length<b+A?fo("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):M&&v.grid.fill==="row"&&fo("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const D=[],B=[];let N=l.activeIndex;typeof n>"u"?n=l.getSlideIndex(u.filter(he=>he.classList.contains(v.slideActiveClass))[0]):N=n;const J=r==="next"||!r,Z=r==="prev"||!r;let se=0,Q=0;const q=M?Math.ceil(u.length/v.grid.rows):u.length,ge=(M?u[n].column:n)+(y&&typeof s>"u"?-b/2+.5:0);if(ge<A){se=Math.max(A-ge,E);for(let he=0;he<A-ge;he+=1){const Ee=he-Math.floor(he/q)*q;if(M){const Te=q-Ee-1;for(let ue=u.length-1;ue>=0;ue-=1)u[ue].column===Te&&D.push(ue)}else D.push(q-Ee-1)}}else if(ge+b>q-A){Q=Math.max(ge-(q-A*2),E);for(let he=0;he<Q;he+=1){const Ee=he-Math.floor(he/q)*q;M?u.forEach((Te,ue)=>{Te.column===Ee&&B.push(ue)}):B.push(Ee)}}if(l.__preventObserver__=!0,requestAnimationFrame(()=>{l.__preventObserver__=!1}),Z&&D.forEach(he=>{u[he].swiperLoopMoveDOM=!0,g.prepend(u[he]),u[he].swiperLoopMoveDOM=!1}),J&&B.forEach(he=>{u[he].swiperLoopMoveDOM=!0,g.append(u[he]),u[he].swiperLoopMoveDOM=!1}),l.recalcSlides(),v.slidesPerView==="auto"?l.updateSlides():M&&(D.length>0&&Z||B.length>0&&J)&&l.slides.forEach((he,Ee)=>{l.grid.updateSlide(Ee,he,l.slides)}),v.watchSlidesProgress&&l.updateSlidesOffset(),t){if(D.length>0&&Z){if(typeof e>"u"){const he=l.slidesGrid[N],Te=l.slidesGrid[N+se]-he;o?l.setTranslate(l.translate-Te):(l.slideTo(N+Math.ceil(se),0,!1,!0),s&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-Te,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-Te))}else if(s){const he=M?D.length/v.grid.rows:D.length;l.slideTo(l.activeIndex+he,0,!1,!0),l.touchEventsData.currentTranslate=l.translate}}else if(B.length>0&&J)if(typeof e>"u"){const he=l.slidesGrid[N],Te=l.slidesGrid[N-Q]-he;o?l.setTranslate(l.translate-Te):(l.slideTo(N-Q,0,!1,!0),s&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-Te,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-Te))}else{const he=M?B.length/v.grid.rows:B.length;l.slideTo(l.activeIndex-he,0,!1,!0)}}if(l.allowSlidePrev=h,l.allowSlideNext=d,l.controller&&l.controller.control&&!a){const he={slideRealIndex:e,direction:r,setTranslate:s,activeSlideIndex:n,byController:!0};Array.isArray(l.controller.control)?l.controller.control.forEach(Ee=>{!Ee.destroyed&&Ee.params.loop&&Ee.loopFix({...he,slideTo:Ee.params.slidesPerView===v.slidesPerView?t:!1})}):l.controller.control instanceof l.constructor&&l.controller.control.params.loop&&l.controller.control.loopFix({...he,slideTo:l.controller.control.params.slidesPerView===v.slidesPerView?t:!1})}l.emit("loopFix")}function BP(){const i=this,{params:e,slidesEl:t}=i;if(!e.loop||i.virtual&&i.params.virtual.enabled)return;i.recalcSlides();const r=[];i.slides.forEach(s=>{const n=typeof s.swiperSlideIndex>"u"?s.getAttribute("data-swiper-slide-index")*1:s.swiperSlideIndex;r[n]=s}),i.slides.forEach(s=>{s.removeAttribute("data-swiper-slide-index")}),r.forEach(s=>{t.append(s)}),i.recalcSlides(),i.slideTo(i.realIndex,0)}var $P={loopCreate:FP,loopFix:NP,loopDestroy:BP};function UP(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 GP(){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 VP={setGrabCursor:UP,unsetGrabCursor:GP};function jP(i,e){e===void 0&&(e=this);function t(r){if(!r||r===Ks()||r===ur())return null;r.assignedSlot&&(r=r.assignedSlot);const s=r.closest(i);return!s&&!r.getRootNode?null:s||t(r.getRootNode().host)}return t(e)}function Zd(i,e,t){const r=ur(),{params:s}=i,n=s.edgeSwipeDetection,a=s.edgeSwipeThreshold;return n&&(t<=a||t>=r.innerWidth-a)?n==="prevent"?(e.preventDefault(),!0):!1:!0}function HP(i){const e=this,t=Ks();let r=i;r.originalEvent&&(r=r.originalEvent);const s=e.touchEventsData;if(r.type==="pointerdown"){if(s.pointerId!==null&&s.pointerId!==r.pointerId)return;s.pointerId=r.pointerId}else r.type==="touchstart"&&r.targetTouches.length===1&&(s.touchId=r.targetTouches[0].identifier);if(r.type==="touchstart"){Zd(e,r,r.targetTouches[0].pageX);return}const{params:n,touches:a,enabled:o}=e;if(!o||!n.simulateTouch&&r.pointerType==="mouse"||e.animating&&n.preventInteractionOnTransition)return;!e.animating&&n.cssMode&&n.loop&&e.loopFix();let l=r.target;if(n.touchEventsTarget==="wrapper"&&!e.wrapperEl.contains(l)||"which"in r&&r.which===3||"button"in r&&r.button>0||s.isTouched&&s.isMoved)return;const u=!!n.noSwipingClass&&n.noSwipingClass!=="",h=r.composedPath?r.composedPath():r.path;u&&r.target&&r.target.shadowRoot&&h&&(l=h[0]);const d=n.noSwipingSelector?n.noSwipingSelector:`.${n.noSwipingClass}`,g=!!(r.target&&r.target.shadowRoot);if(n.noSwiping&&(g?jP(d,l):l.closest(d))){e.allowClick=!0;return}if(n.swipeHandler&&!l.closest(n.swipeHandler))return;a.currentX=r.pageX,a.currentY=r.pageY;const v=a.currentX,y=a.currentY;if(!Zd(e,r,v))return;Object.assign(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=v,a.startY=y,s.touchStartTime=ho(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,n.threshold>0&&(s.allowThresholdMove=!1);let b=!0;l.matches(s.focusableElements)&&(b=!1,l.nodeName==="SELECT"&&(s.isTouched=!1)),t.activeElement&&t.activeElement.matches(s.focusableElements)&&t.activeElement!==l&&t.activeElement.blur();const E=b&&e.allowTouchMove&&n.touchStartPreventDefault;(n.touchStartForcePreventDefault||E)&&!l.isContentEditable&&r.preventDefault(),n.freeMode&&n.freeMode.enabled&&e.freeMode&&e.animating&&!n.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",r)}function KP(i){const e=Ks(),t=this,r=t.touchEventsData,{params:s,touches:n,rtlTranslate:a,enabled:o}=t;if(!o||!s.simulateTouch&&i.pointerType==="mouse")return;let l=i;if(l.originalEvent&&(l=l.originalEvent),l.type==="pointermove"&&(r.touchId!==null||l.pointerId!==r.pointerId))return;let u;if(l.type==="touchmove"){if(u=[...l.changedTouches].filter(J=>J.identifier===r.touchId)[0],!u||u.identifier!==r.touchId)return}else u=l;if(!r.isTouched){r.startMoving&&r.isScrolling&&t.emit("touchMoveOpposite",l);return}const h=u.pageX,d=u.pageY;if(l.preventedByNestedSwiper){n.startX=h,n.startY=d;return}if(!t.allowTouchMove){l.target.matches(r.focusableElements)||(t.allowClick=!1),r.isTouched&&(Object.assign(n,{startX:h,startY:d,currentX:h,currentY:d}),r.touchStartTime=ho());return}if(s.touchReleaseOnEdges&&!s.loop){if(t.isVertical()){if(d<n.startY&&t.translate<=t.maxTranslate()||d>n.startY&&t.translate>=t.minTranslate()){r.isTouched=!1,r.isMoved=!1;return}}else if(h<n.startX&&t.translate<=t.maxTranslate()||h>n.startX&&t.translate>=t.minTranslate())return}if(e.activeElement&&l.target===e.activeElement&&l.target.matches(r.focusableElements)){r.isMoved=!0,t.allowClick=!1;return}r.allowTouchCallbacks&&t.emit("touchMove",l),n.previousX=n.currentX,n.previousY=n.currentY,n.currentX=h,n.currentY=d;const g=n.currentX-n.startX,v=n.currentY-n.startY;if(t.params.threshold&&Math.sqrt(g**2+v**2)<t.params.threshold)return;if(typeof r.isScrolling>"u"){let J;t.isHorizontal()&&n.currentY===n.startY||t.isVertical()&&n.currentX===n.startX?r.isScrolling=!1:g*g+v*v>=25&&(J=Math.atan2(Math.abs(v),Math.abs(g))*180/Math.PI,r.isScrolling=t.isHorizontal()?J>s.touchAngle:90-J>s.touchAngle)}if(r.isScrolling&&t.emit("touchMoveOpposite",l),typeof r.startMoving>"u"&&(n.currentX!==n.startX||n.currentY!==n.startY)&&(r.startMoving=!0),r.isScrolling||l.type==="touchmove"&&r.preventTouchMoveFromPointerMove){r.isTouched=!1;return}if(!r.startMoving)return;t.allowClick=!1,!s.cssMode&&l.cancelable&&l.preventDefault(),s.touchMoveStopPropagation&&!s.nested&&l.stopPropagation();let y=t.isHorizontal()?g:v,b=t.isHorizontal()?n.currentX-n.previousX:n.currentY-n.previousY;s.oneWayMovement&&(y=Math.abs(y)*(a?1:-1),b=Math.abs(b)*(a?1:-1)),n.diff=y,y*=s.touchRatio,a&&(y=-y,b=-b);const E=t.touchesDirection;t.swipeDirection=y>0?"prev":"next",t.touchesDirection=b>0?"prev":"next";const A=t.params.loop&&!s.cssMode,M=t.touchesDirection==="next"&&t.allowSlideNext||t.touchesDirection==="prev"&&t.allowSlidePrev;if(!r.isMoved){if(A&&M&&t.loopFix({direction:t.swipeDirection}),r.startTranslate=t.getTranslate(),t.setTransition(0),t.animating){const J=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});t.wrapperEl.dispatchEvent(J)}r.allowMomentumBounce=!1,s.grabCursor&&(t.allowSlideNext===!0||t.allowSlidePrev===!0)&&t.setGrabCursor(!0),t.emit("sliderFirstMove",l)}let D;if(new Date().getTime(),r.isMoved&&r.allowThresholdMove&&E!==t.touchesDirection&&A&&M&&Math.abs(y)>=1){Object.assign(n,{startX:h,startY:d,currentX:h,currentY:d,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,r.startTranslate=r.currentTranslate;return}t.emit("sliderMove",l),r.isMoved=!0,r.currentTranslate=y+r.startTranslate;let B=!0,N=s.resistanceRatio;if(s.touchReleaseOnEdges&&(N=0),y>0?(A&&M&&!D&&r.allowThresholdMove&&r.currentTranslate>(s.centeredSlides?t.minTranslate()-t.slidesSizesGrid[t.activeIndex+1]:t.minTranslate())&&t.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>t.minTranslate()&&(B=!1,s.resistance&&(r.currentTranslate=t.minTranslate()-1+(-t.minTranslate()+r.startTranslate+y)**N))):y<0&&(A&&M&&!D&&r.allowThresholdMove&&r.currentTranslate<(s.centeredSlides?t.maxTranslate()+t.slidesSizesGrid[t.slidesSizesGrid.length-1]:t.maxTranslate())&&t.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:t.slides.length-(s.slidesPerView==="auto"?t.slidesPerViewDynamic():Math.ceil(parseFloat(s.slidesPerView,10)))}),r.currentTranslate<t.maxTranslate()&&(B=!1,s.resistance&&(r.currentTranslate=t.maxTranslate()+1-(t.maxTranslate()-r.startTranslate-y)**N))),B&&(l.preventedByNestedSwiper=!0),!t.allowSlideNext&&t.swipeDirection==="next"&&r.currentTranslate<r.startTranslate&&(r.currentTranslate=r.startTranslate),!t.allowSlidePrev&&t.swipeDirection==="prev"&&r.currentTranslate>r.startTranslate&&(r.currentTranslate=r.startTranslate),!t.allowSlidePrev&&!t.allowSlideNext&&(r.currentTranslate=r.startTranslate),s.threshold>0)if(Math.abs(y)>s.threshold||r.allowThresholdMove){if(!r.allowThresholdMove){r.allowThresholdMove=!0,n.startX=n.currentX,n.startY=n.currentY,r.currentTranslate=r.startTranslate,n.diff=t.isHorizontal()?n.currentX-n.startX:n.currentY-n.startY;return}}else{r.currentTranslate=r.startTranslate;return}!s.followFinger||s.cssMode||((s.freeMode&&s.freeMode.enabled&&t.freeMode||s.watchSlidesProgress)&&(t.updateActiveIndex(),t.updateSlidesClasses()),s.freeMode&&s.freeMode.enabled&&t.freeMode&&t.freeMode.onTouchMove(),t.updateProgress(r.currentTranslate),t.setTranslate(r.currentTranslate))}function zP(i){const e=this,t=e.touchEventsData;let r=i;r.originalEvent&&(r=r.originalEvent);let s;if(r.type==="touchend"||r.type==="touchcancel"){if(s=[...r.changedTouches].filter(N=>N.identifier===t.touchId)[0],!s||s.identifier!==t.touchId)return}else{if(t.touchId!==null||r.pointerId!==t.pointerId)return;s=r}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(r.type)&&!(["pointercancel","contextmenu"].includes(r.type)&&(e.browser.isSafari||e.browser.isWebView)))return;t.pointerId=null,t.touchId=null;const{params:a,touches:o,rtlTranslate:l,slidesGrid:u,enabled:h}=e;if(!h||!a.simulateTouch&&r.pointerType==="mouse")return;if(t.allowTouchCallbacks&&e.emit("touchEnd",r),t.allowTouchCallbacks=!1,!t.isTouched){t.isMoved&&a.grabCursor&&e.setGrabCursor(!1),t.isMoved=!1,t.startMoving=!1;return}a.grabCursor&&t.isMoved&&t.isTouched&&(e.allowSlideNext===!0||e.allowSlidePrev===!0)&&e.setGrabCursor(!1);const d=ho(),g=d-t.touchStartTime;if(e.allowClick){const N=r.path||r.composedPath&&r.composedPath();e.updateClickedSlide(N&&N[0]||r.target,N),e.emit("tap click",r),g<300&&d-t.lastClickTime<300&&e.emit("doubleTap doubleClick",r)}if(t.lastClickTime=ho(),Tc(()=>{e.destroyed||(e.allowClick=!0)}),!t.isTouched||!t.isMoved||!e.swipeDirection||o.diff===0&&!t.loopSwapReset||t.currentTranslate===t.startTranslate&&!t.loopSwapReset){t.isTouched=!1,t.isMoved=!1,t.startMoving=!1;return}t.isTouched=!1,t.isMoved=!1,t.startMoving=!1;let v;if(a.followFinger?v=l?e.translate:-e.translate:v=-t.currentTranslate,a.cssMode)return;if(a.freeMode&&a.freeMode.enabled){e.freeMode.onTouchEnd({currentPos:v});return}const y=v>=-e.maxTranslate()&&!e.params.loop;let b=0,E=e.slidesSizesGrid[0];for(let N=0;N<u.length;N+=N<a.slidesPerGroupSkip?1:a.slidesPerGroup){const J=N<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;typeof u[N+J]<"u"?(y||v>=u[N]&&v<u[N+J])&&(b=N,E=u[N+J]-u[N]):(y||v>=u[N])&&(b=N,E=u[u.length-1]-u[u.length-2])}let A=null,M=null;a.rewind&&(e.isBeginning?M=a.virtual&&a.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(A=0));const D=(v-u[b])/E,B=b<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;if(g>a.longSwipesMs){if(!a.longSwipes){e.slideTo(e.activeIndex);return}e.swipeDirection==="next"&&(D>=a.longSwipesRatio?e.slideTo(a.rewind&&e.isEnd?A:b+B):e.slideTo(b)),e.swipeDirection==="prev"&&(D>1-a.longSwipesRatio?e.slideTo(b+B):M!==null&&D<0&&Math.abs(D)>a.longSwipesRatio?e.slideTo(M):e.slideTo(b))}else{if(!a.shortSwipes){e.slideTo(e.activeIndex);return}e.navigation&&(r.target===e.navigation.nextEl||r.target===e.navigation.prevEl)?r.target===e.navigation.nextEl?e.slideTo(b+B):e.slideTo(b):(e.swipeDirection==="next"&&e.slideTo(A!==null?A:b+B),e.swipeDirection==="prev"&&e.slideTo(M!==null?M:b))}}function ep(){const i=this,{params:e,el:t}=i;if(t&&t.offsetWidth===0)return;e.breakpoints&&i.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:s,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=s,i.allowSlideNext=r,i.params.watchOverflow&&n!==i.snapGrid&&i.checkOverflow()}function WP(i){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&i.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(i.stopPropagation(),i.stopImmediatePropagation())))}function qP(){const i=this,{wrapperEl:e,rtlTranslate:t,enabled:r}=i;if(!r)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 s;const n=i.maxTranslate()-i.minTranslate();n===0?s=0:s=(i.translate-i.minTranslate())/n,s!==i.progress&&i.updateProgress(t?-i.translate:i.translate),i.emit("setTranslate",i.translate,!1)}function YP(i){const e=this;Ha(e,i.target),!(e.params.cssMode||e.params.slidesPerView!=="auto"&&!e.params.autoHeight)&&e.update()}function XP(){const i=this;i.documentTouchHandlerProceeded||(i.documentTouchHandlerProceeded=!0,i.params.touchReleaseOnEdges&&(i.el.style.touchAction="auto"))}const d0=(i,e)=>{const t=Ks(),{params:r,el:s,wrapperEl:n,device:a}=i,o=!!r.nested,l=e==="on"?"addEventListener":"removeEventListener",u=e;t[l]("touchstart",i.onDocumentTouchStart,{passive:!1,capture:o}),s[l]("touchstart",i.onTouchStart,{passive:!1}),s[l]("pointerdown",i.onTouchStart,{passive:!1}),t[l]("touchmove",i.onTouchMove,{passive:!1,capture:o}),t[l]("pointermove",i.onTouchMove,{passive:!1,capture:o}),t[l]("touchend",i.onTouchEnd,{passive:!0}),t[l]("pointerup",i.onTouchEnd,{passive:!0}),t[l]("pointercancel",i.onTouchEnd,{passive:!0}),t[l]("touchcancel",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}),(r.preventClicks||r.preventClicksPropagation)&&s[l]("click",i.onClick,!0),r.cssMode&&n[l]("scroll",i.onScroll),r.updateOnWindowResize?i[u](a.ios||a.android?"resize orientationchange observerUpdate":"resize observerUpdate",ep,!0):i[u]("observerUpdate",ep,!0),s[l]("load",i.onLoad,{capture:!0})};function QP(){const i=this,{params:e}=i;i.onTouchStart=HP.bind(i),i.onTouchMove=KP.bind(i),i.onTouchEnd=zP.bind(i),i.onDocumentTouchStart=XP.bind(i),e.cssMode&&(i.onScroll=qP.bind(i)),i.onClick=WP.bind(i),i.onLoad=YP.bind(i),d0(i,"on")}function JP(){d0(this,"off")}var ZP={attachEvents:QP,detachEvents:JP};const tp=(i,e)=>i.grid&&e.grid&&e.grid.rows>1;function ek(){const i=this,{realIndex:e,initialized:t,params:r,el:s}=i,n=r.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=tp(i,r),h=tp(i,l),d=i.params.grabCursor,g=l.grabCursor,v=r.enabled;u&&!h?(s.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),i.emitContainerClasses()):!u&&h&&(s.classList.add(`${r.containerModifierClass}grid`),(l.grid.fill&&l.grid.fill==="column"||!l.grid.fill&&r.grid.fill==="column")&&s.classList.add(`${r.containerModifierClass}grid-column`),i.emitContainerClasses()),d&&!g?i.unsetGrabCursor():!d&&g&&i.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(D=>{if(typeof l[D]>"u")return;const B=r[D]&&r[D].enabled,N=l[D]&&l[D].enabled;B&&!N&&i[D].disable(),!B&&N&&i[D].enable()});const y=l.direction&&l.direction!==r.direction,b=r.loop&&(l.slidesPerView!==r.slidesPerView||y),E=r.loop;y&&t&&i.changeDirection(),or(i.params,l);const A=i.params.enabled,M=i.params.loop;Object.assign(i,{allowTouchMove:i.params.allowTouchMove,allowSlideNext:i.params.allowSlideNext,allowSlidePrev:i.params.allowSlidePrev}),v&&!A?i.disable():!v&&A&&i.enable(),i.currentBreakpoint=a,i.emit("_beforeBreakpoint",l),t&&(b?(i.loopDestroy(),i.loopCreate(e),i.updateSlides()):!E&&M?(i.loopCreate(e),i.updateSlides()):E&&!M&&i.loopDestroy()),i.emit("breakpoint",l)}function tk(i,e,t){if(e===void 0&&(e="window"),!i||e==="container"&&!t)return;let r=!1;const s=ur(),n=e==="window"?s.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"?s.matchMedia(`(min-width: ${u}px)`).matches&&(r=l):u<=t.clientWidth&&(r=l)}return r||"max"}var rk={setBreakpoint:ek,getBreakpoint:tk};function ik(i,e){const t=[];return i.forEach(r=>{typeof r=="object"?Object.keys(r).forEach(s=>{r[s]&&t.push(e+s)}):typeof r=="string"&&t.push(e+r)}),t}function sk(){const i=this,{classNames:e,params:t,rtl:r,el:s,device:n}=i,a=ik(["initialized",t.direction,{"free-mode":i.params.freeMode&&t.freeMode.enabled},{autoheight:t.autoHeight},{rtl:r},{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),s.classList.add(...e),i.emitContainerClasses()}function nk(){const i=this,{el:e,classNames:t}=i;e.classList.remove(...t),i.emitContainerClasses()}var ak={addClasses:sk,removeClasses:nk};function ok(){const i=this,{isLocked:e,params:t}=i,{slidesOffsetBefore:r}=t;if(r){const s=i.slides.length-1,n=i.slidesGrid[s]+i.slidesSizesGrid[s]+r*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 lk={checkOverflow:ok},_c={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function ck(i,e){return function(r){r===void 0&&(r={});const s=Object.keys(r)[0],n=r[s];if(typeof n!="object"||n===null){or(e,r);return}if(i[s]===!0&&(i[s]={enabled:!0}),s==="navigation"&&i[s]&&i[s].enabled&&!i[s].prevEl&&!i[s].nextEl&&(i[s].auto=!0),["pagination","scrollbar"].indexOf(s)>=0&&i[s]&&i[s].enabled&&!i[s].el&&(i[s].auto=!0),!(s in i&&"enabled"in n)){or(e,r);return}typeof i[s]=="object"&&!("enabled"in i[s])&&(i[s].enabled=!0),i[s]||(i[s]={enabled:!1}),or(e,r)}}const Nl={eventsEmitter:aP,update:vP,translate:TP,transition:CP,slide:MP,loop:$P,grabCursor:VP,events:ZP,breakpoints:rk,checkOverflow:lk,classes:ak},Bl={};let Tu=class fi{constructor(){let e,t;for(var r=arguments.length,s=new Array(r),n=0;n<r;n++)s[n]=arguments[n];s.length===1&&s[0].constructor&&Object.prototype.toString.call(s[0]).slice(8,-1)==="Object"?t=s[0]:[e,t]=s,t||(t={}),t=or({},t),e&&!t.el&&(t.el=e);const a=Ks();if(t.el&&typeof t.el=="string"&&a.querySelectorAll(t.el).length>1){const h=[];return a.querySelectorAll(t.el).forEach(d=>{const g=or({},t,{el:d});h.push(new fi(g))}),h}const o=this;o.__swiper__=!0,o.support=u0(),o.device=h0({userAgent:t.userAgent}),o.browser=iP(),o.eventsListeners={},o.eventsAnyListeners=[],o.modules=[...o.__modules__],t.modules&&Array.isArray(t.modules)&&o.modules.push(...t.modules);const l={};o.modules.forEach(h=>{h({params:t,swiper:o,extendParams:ck(t,l),on:o.on.bind(o),once:o.once.bind(o),off:o.off.bind(o),emit:o.emit.bind(o)})});const u=or({},_c,l);return o.params=or({},u,Bl,t),o.originalParams=or({},o.params),o.passedParams=or({},t),o.params&&o.params.on&&Object.keys(o.params.on).forEach(h=>{o.on(h,o.params.on[h])}),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,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:o.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),o.emit("_swiper"),o.params.init&&o.init(),o}getDirectionLabel(e){return this.isHorizontal()?e:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[e]}getSlideIndex(e){const{slidesEl:t,params:r}=this,s=gi(t,`.${r.slideClass}, swiper-slide`),n=Xd(s[0]);return Xd(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:r}=e;e.slides=gi(t,`.${r.slideClass}, swiper-slide`)}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,t){const r=this;e=Math.min(Math.max(e,0),1);const s=r.minTranslate(),a=(r.maxTranslate()-s)*e+s;r.translateTo(a,typeof t>"u"?0:t),r.updateActiveIndex(),r.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=e.el.className.split(" ").filter(r=>r.indexOf("swiper")===0||r.indexOf(e.params.containerModifierClass)===0);e.emit("_containerClasses",t.join(" "))}getSlideClasses(e){const t=this;return t.destroyed?"":e.className.split(" ").filter(r=>r.indexOf("swiper-slide")===0||r.indexOf(t.params.slideClass)===0).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const t=[];e.slides.forEach(r=>{const s=e.getSlideClasses(r);t.push({slideEl:r,classNames:s}),e.emit("_slideClass",r,s)}),e.emit("_slideClasses",t)}slidesPerViewDynamic(e,t){e===void 0&&(e="current"),t===void 0&&(t=!1);const r=this,{params:s,slides:n,slidesGrid:a,slidesSizesGrid:o,size:l,activeIndex:u}=r;let h=1;if(typeof s.slidesPerView=="number")return s.slidesPerView;if(s.centeredSlides){let d=n[u]?Math.ceil(n[u].swiperSlideSize):0,g;for(let v=u+1;v<n.length;v+=1)n[v]&&!g&&(d+=Math.ceil(n[v].swiperSlideSize),h+=1,d>l&&(g=!0));for(let v=u-1;v>=0;v-=1)n[v]&&!g&&(d+=n[v].swiperSlideSize,h+=1,d>l&&(g=!0))}else if(e==="current")for(let d=u+1;d<n.length;d+=1)(t?a[d]+o[d]-a[u]<l:a[d]-a[u]<l)&&(h+=1);else for(let d=u-1;d>=0;d-=1)a[u]-a[d]<l&&(h+=1);return h}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:r}=e;r.breakpoints&&e.setBreakpoint(),[...e.el.querySelectorAll('[loading="lazy"]')].forEach(a=>{a.complete&&Ha(e,a)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses();function s(){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(r.freeMode&&r.freeMode.enabled&&!r.cssMode)s(),r.autoHeight&&e.updateAutoHeight();else{if((r.slidesPerView==="auto"||r.slidesPerView>1)&&e.isEnd&&!r.centeredSlides){const a=e.virtual&&r.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||s()}r.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t){t===void 0&&(t=!0);const r=this,s=r.params.direction;return e||(e=s==="horizontal"?"vertical":"horizontal"),e===s||e!=="horizontal"&&e!=="vertical"||(r.el.classList.remove(`${r.params.containerModifierClass}${s}`),r.el.classList.add(`${r.params.containerModifierClass}${e}`),r.emitContainerClasses(),r.params.direction=e,r.slides.forEach(n=>{e==="vertical"?n.style.width="":n.style.height=""}),r.emit("changeDirection"),t&&r.update()),r}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 r=e||t.params.el;if(typeof r=="string"&&(r=document.querySelector(r)),!r)return!1;r.swiper=t,r.parentNode&&r.parentNode.host&&r.parentNode.host.nodeName===t.params.swiperElementNodeName.toUpperCase()&&(t.isElement=!0);const s=()=>`.${(t.params.wrapperClass||"").trim().split(" ").join(".")}`;let a=r&&r.shadowRoot&&r.shadowRoot.querySelector?r.shadowRoot.querySelector(s()):gi(r,s())[0];return!a&&t.params.createElements&&(a=wc("div",t.params.wrapperClass),r.append(a),gi(r,`.${t.params.slideClass}`).forEach(o=>{a.append(o)})),Object.assign(t,{el:r,wrapperEl:a,slidesEl:t.isElement&&!r.parentNode.host.slideSlots?r.parentNode.host:a,hostEl:t.isElement?r.parentNode.host:r,mounted:!0,rtl:r.dir.toLowerCase()==="rtl"||Fi(r,"direction")==="rtl",rtlTranslate:t.params.direction==="horizontal"&&(r.dir.toLowerCase()==="rtl"||Fi(r,"direction")==="rtl"),wrongRTL:Fi(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 s=[...t.el.querySelectorAll('[loading="lazy"]')];return t.isElement&&s.push(...t.hostEl.querySelectorAll('[loading="lazy"]')),s.forEach(n=>{n.complete?Ha(t,n):n.addEventListener("load",a=>{Ha(t,a.target)})}),Ac(t),t.initialized=!0,Ac(t),t.emit("init"),t.emit("afterInit"),t}destroy(e,t){e===void 0&&(e=!0),t===void 0&&(t=!0);const r=this,{params:s,el:n,wrapperEl:a,slides:o}=r;return typeof r.params>"u"||r.destroyed||(r.emit("beforeDestroy"),r.initialized=!1,r.detachEvents(),s.loop&&r.loopDestroy(),t&&(r.removeClasses(),n.removeAttribute("style"),a.removeAttribute("style"),o&&o.length&&o.forEach(l=>{l.classList.remove(s.slideVisibleClass,s.slideFullyVisibleClass,s.slideActiveClass,s.slideNextClass,s.slidePrevClass),l.removeAttribute("style"),l.removeAttribute("data-swiper-slide-index")})),r.emit("destroy"),Object.keys(r.eventsListeners).forEach(l=>{r.off(l)}),e!==!1&&(r.el.swiper=null,WI(r)),r.destroyed=!0),null}static extendDefaults(e){or(Bl,e)}static get extendedDefaults(){return Bl}static get defaults(){return _c}static installModule(e){fi.prototype.__modules__||(fi.prototype.__modules__=[]);const t=fi.prototype.__modules__;typeof e=="function"&&t.indexOf(e)<0&&t.push(e)}static use(e){return Array.isArray(e)?(e.forEach(t=>fi.installModule(t)),fi):(fi.installModule(e),fi)}};Object.keys(Nl).forEach(i=>{Object.keys(Nl[i]).forEach(e=>{Tu.prototype[e]=Nl[i][e]})});Tu.use([sP,nP]);const p0=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function os(i){return typeof i=="object"&&i!==null&&i.constructor&&Object.prototype.toString.call(i).slice(8,-1)==="Object"&&!i.__swiper__}function Fs(i,e){const t=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>t.indexOf(r)<0).forEach(r=>{typeof i[r]>"u"?i[r]=e[r]:os(e[r])&&os(i[r])&&Object.keys(e[r]).length>0?e[r].__swiper__?i[r]=e[r]:Fs(i[r],e[r]):i[r]=e[r]})}function g0(i){return i===void 0&&(i={}),i.navigation&&typeof i.navigation.nextEl>"u"&&typeof i.navigation.prevEl>"u"}function m0(i){return i===void 0&&(i={}),i.pagination&&typeof i.pagination.el>"u"}function v0(i){return i===void 0&&(i={}),i.scrollbar&&typeof i.scrollbar.el>"u"}function y0(i){i===void 0&&(i="");const e=i.split(" ").map(r=>r.trim()).filter(r=>!!r),t=[];return e.forEach(r=>{t.indexOf(r)<0&&t.push(r)}),t.join(" ")}function uk(i){return i===void 0&&(i=""),i?i.includes("swiper-wrapper")?i:`swiper-wrapper ${i}`:"swiper-wrapper"}function hk(i){let{swiper:e,slides:t,passedParams:r,changedParams:s,nextEl:n,prevEl:a,scrollbarEl:o,paginationEl:l}=i;const u=s.filter(Q=>Q!=="children"&&Q!=="direction"&&Q!=="wrapperClass"),{params:h,pagination:d,navigation:g,scrollbar:v,virtual:y,thumbs:b}=e;let E,A,M,D,B,N,J,Z;s.includes("thumbs")&&r.thumbs&&r.thumbs.swiper&&h.thumbs&&!h.thumbs.swiper&&(E=!0),s.includes("controller")&&r.controller&&r.controller.control&&h.controller&&!h.controller.control&&(A=!0),s.includes("pagination")&&r.pagination&&(r.pagination.el||l)&&(h.pagination||h.pagination===!1)&&d&&!d.el&&(M=!0),s.includes("scrollbar")&&r.scrollbar&&(r.scrollbar.el||o)&&(h.scrollbar||h.scrollbar===!1)&&v&&!v.el&&(D=!0),s.includes("navigation")&&r.navigation&&(r.navigation.prevEl||a)&&(r.navigation.nextEl||n)&&(h.navigation||h.navigation===!1)&&g&&!g.prevEl&&!g.nextEl&&(B=!0);const se=Q=>{e[Q]&&(e[Q].destroy(),Q==="navigation"?(e.isElement&&(e[Q].prevEl.remove(),e[Q].nextEl.remove()),h[Q].prevEl=void 0,h[Q].nextEl=void 0,e[Q].prevEl=void 0,e[Q].nextEl=void 0):(e.isElement&&e[Q].el.remove(),h[Q].el=void 0,e[Q].el=void 0))};s.includes("loop")&&e.isElement&&(h.loop&&!r.loop?N=!0:!h.loop&&r.loop?J=!0:Z=!0),u.forEach(Q=>{if(os(h[Q])&&os(r[Q]))Object.assign(h[Q],r[Q]),(Q==="navigation"||Q==="pagination"||Q==="scrollbar")&&"enabled"in r[Q]&&!r[Q].enabled&&se(Q);else{const q=r[Q];(q===!0||q===!1)&&(Q==="navigation"||Q==="pagination"||Q==="scrollbar")?q===!1&&se(Q):h[Q]=r[Q]}}),u.includes("controller")&&!A&&e.controller&&e.controller.control&&h.controller&&h.controller.control&&(e.controller.control=h.controller.control),s.includes("children")&&t&&y&&h.virtual.enabled?(y.slides=t,y.update(!0)):s.includes("virtual")&&y&&h.virtual.enabled&&(t&&(y.slides=t),y.update(!0)),s.includes("children")&&t&&h.loop&&(Z=!0),E&&b.init()&&b.update(!0),A&&(e.controller.control=h.controller.control),M&&(e.isElement&&(!l||typeof l=="string")&&(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),e.el.appendChild(l)),l&&(h.pagination.el=l),d.init(),d.render(),d.update()),D&&(e.isElement&&(!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-scrollbar"),o.part.add("scrollbar"),e.el.appendChild(o)),o&&(h.scrollbar.el=o),v.init(),v.updateSize(),v.setTranslate()),B&&(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&&(h.navigation.nextEl=n),a&&(h.navigation.prevEl=a),g.init(),g.update()),s.includes("allowSlideNext")&&(e.allowSlideNext=r.allowSlideNext),s.includes("allowSlidePrev")&&(e.allowSlidePrev=r.allowSlidePrev),s.includes("direction")&&e.changeDirection(r.direction,!1),(N||Z)&&e.loopDestroy(),(J||Z)&&e.loopCreate(),e.update()}function fk(i,e){i===void 0&&(i={}),e===void 0&&(e=!0);const t={on:{}},r={},s={};Fs(t,_c),t._emitClasses=!0,t.init=!1;const n={},a=p0.map(l=>l.replace(/_/,"")),o=Object.assign({},i);return Object.keys(o).forEach(l=>{typeof i[l]>"u"||(a.indexOf(l)>=0?os(i[l])?(t[l]={},s[l]={},Fs(t[l],i[l]),Fs(s[l],i[l])):(t[l]=i[l],s[l]=i[l]):l.search(/on[A-Z]/)===0&&typeof i[l]=="function"?e?r[`${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:s,rest:n,events:r}}function dk(i,e){let{el:t,nextEl:r,prevEl:s,paginationEl:n,scrollbarEl:a,swiper:o}=i;g0(e)&&r&&s&&(o.params.navigation.nextEl=r,o.originalParams.navigation.nextEl=r,o.params.navigation.prevEl=s,o.originalParams.navigation.prevEl=s),m0(e)&&n&&(o.params.pagination.el=n,o.originalParams.pagination.el=n),v0(e)&&a&&(o.params.scrollbar.el=a,o.originalParams.scrollbar.el=a),o.init(t)}function pk(i,e,t,r,s){const n=[];if(!e)return n;const a=l=>{n.indexOf(l)<0&&n.push(l)};if(t&&r){const l=r.map(s),u=t.map(s);l.join("")!==u.join("")&&a("children"),r.length!==t.length&&a("children")}return p0.filter(l=>l[0]==="_").map(l=>l.replace(/_/,"")).forEach(l=>{if(l in i&&l in e)if(os(i[l])&&os(e[l])){const u=Object.keys(i[l]),h=Object.keys(e[l]);u.length!==h.length?a(l):(u.forEach(d=>{i[l][d]!==e[l][d]&&a(l)}),h.forEach(d=>{i[l][d]!==e[l][d]&&a(l)}))}else i[l]!==e[l]&&a(l)}),n}const gk=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 po(){return po=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},po.apply(this,arguments)}function S0(i){return i.type&&i.type.displayName&&i.type.displayName.includes("SwiperSlide")}function x0(i){const e=[];return ye.Children.toArray(i).forEach(t=>{S0(t)?e.push(t):t.props&&t.props.children&&x0(t.props.children).forEach(r=>e.push(r))}),e}function mk(i){const e=[],t={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return ye.Children.toArray(i).forEach(r=>{if(S0(r))e.push(r);else if(r.props&&r.props.slot&&t[r.props.slot])t[r.props.slot].push(r);else if(r.props&&r.props.children){const s=x0(r.props.children);s.length>0?s.forEach(n=>e.push(n)):t["container-end"].push(r)}else t["container-end"].push(r)}),{slides:e,slots:t}}function vk(i,e,t){if(!t)return null;const r=h=>{let d=h;return h<0?d=e.length+h:d>=e.length&&(d=d-e.length),d},s=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 h=o;h<l;h+=1)h>=n&&h<=a&&u.push(e[r(h)]);return u.map((h,d)=>ye.cloneElement(h,{swiper:i,style:s,key:h.props.virtualIndex||h.key||`slide-${d}`}))}function Dn(i,e){return typeof window>"u"?ye.useEffect(i,e):ye.useLayoutEffect(i,e)}const rp=ye.createContext(null),yk=ye.createContext(null),Sk=ye.forwardRef(function(i,e){let{className:t,tag:r="div",wrapperTag:s="div",children:n,onSwiper:a,...o}=i===void 0?{}:i,l=!1;const[u,h]=ye.useState("swiper"),[d,g]=ye.useState(null),[v,y]=ye.useState(!1),b=ye.useRef(!1),E=ye.useRef(null),A=ye.useRef(null),M=ye.useRef(null),D=ye.useRef(null),B=ye.useRef(null),N=ye.useRef(null),J=ye.useRef(null),Z=ye.useRef(null),{params:se,passedParams:Q,rest:q,events:oe}=fk(o),{slides:ge,slots:he}=mk(n),Ee=()=>{y(!v)};Object.assign(se.on,{_containerClasses(me,Se){h(Se)}});const Te=()=>{Object.assign(se.on,oe),l=!0;const me={...se};if(delete me.wrapperClass,A.current=new Tu(me),A.current.virtual&&A.current.params.virtual.enabled){A.current.virtual.slides=ge;const Se={cache:!1,slides:ge,renderExternal:g,renderExternalUpdate:!1};Fs(A.current.params.virtual,Se),Fs(A.current.originalParams.virtual,Se)}};E.current||Te(),A.current&&A.current.on("_beforeBreakpoint",Ee);const ue=()=>{l||!oe||!A.current||Object.keys(oe).forEach(me=>{A.current.on(me,oe[me])})},pe=()=>{!oe||!A.current||Object.keys(oe).forEach(me=>{A.current.off(me,oe[me])})};ye.useEffect(()=>()=>{A.current&&A.current.off("_beforeBreakpoint",Ee)}),ye.useEffect(()=>{!b.current&&A.current&&(A.current.emitSlidesClasses(),b.current=!0)}),Dn(()=>{if(e&&(e.current=E.current),!!E.current)return A.current.destroyed&&Te(),dk({el:E.current,nextEl:B.current,prevEl:N.current,paginationEl:J.current,scrollbarEl:Z.current,swiper:A.current},se),a&&!A.current.destroyed&&a(A.current),()=>{A.current&&!A.current.destroyed&&A.current.destroy(!0,!1)}},[]),Dn(()=>{ue();const me=pk(Q,M.current,ge,D.current,Se=>Se.key);return M.current=Q,D.current=ge,me.length&&A.current&&!A.current.destroyed&&hk({swiper:A.current,slides:ge,passedParams:Q,changedParams:me,nextEl:B.current,prevEl:N.current,scrollbarEl:Z.current,paginationEl:J.current}),()=>{pe()}}),Dn(()=>{gk(A.current)},[d]);function Ce(){return se.virtual?vk(A.current,ge,d):ge.map((me,Se)=>ye.cloneElement(me,{swiper:A.current,swiperSlideIndex:Se}))}return ye.createElement(r,po({ref:E,className:y0(`${u}${t?` ${t}`:""}`)},q),ye.createElement(yk.Provider,{value:A.current},he["container-start"],ye.createElement(s,{className:uk(se.wrapperClass)},he["wrapper-start"],Ce(),he["wrapper-end"]),g0(se)&&ye.createElement(ye.Fragment,null,ye.createElement("div",{ref:N,className:"swiper-button-prev"}),ye.createElement("div",{ref:B,className:"swiper-button-next"})),v0(se)&&ye.createElement("div",{ref:Z,className:"swiper-scrollbar"}),m0(se)&&ye.createElement("div",{ref:J,className:"swiper-pagination"}),he["container-end"]))});Sk.displayName="Swiper";const xk=ye.forwardRef(function(i,e){let{tag:t="div",children:r,className:s="",swiper:n,zoom:a,lazy:o,virtualIndex:l,swiperSlideIndex:u,...h}=i===void 0?{}:i;const d=ye.useRef(null),[g,v]=ye.useState("swiper-slide"),[y,b]=ye.useState(!1);function E(B,N,J){N===d.current&&v(J)}Dn(()=>{if(typeof u<"u"&&(d.current.swiperSlideIndex=u),e&&(e.current=d.current),!(!d.current||!n)){if(n.destroyed){g!=="swiper-slide"&&v("swiper-slide");return}return n.on("_slideClass",E),()=>{n&&n.off("_slideClass",E)}}}),Dn(()=>{n&&d.current&&!n.destroyed&&v(n.getSlideClasses(d.current))},[n]);const A={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},M=()=>typeof r=="function"?r(A):r,D=()=>{b(!0)};return ye.createElement(t,po({ref:d,className:y0(`${g}${s?` ${s}`:""}`),"data-swiper-slide-index":l,onLoad:D},h),a&&ye.createElement(rp.Provider,{value:A},ye.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":typeof a=="number"?a:void 0},M(),o&&!y&&ye.createElement("div",{className:"swiper-lazy-preloader"}))),!a&&ye.createElement(rp.Provider,{value:A},M(),o&&!y&&ye.createElement("div",{className:"swiper-lazy-preloader"})))});xk.displayName="SwiperSlide";function Cc(i){this.message=i}Cc.prototype=new Error,Cc.prototype.name="InvalidCharacterError";var ip=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(i){var e=String(i).replace(/=+$/,"");if(e.length%4==1)throw new Cc("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,r,s=0,n=0,a="";r=e.charAt(n++);~r&&(t=s%4?64*t+r:r,s++%4)?a+=String.fromCharCode(255&t>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function bk(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(ip(t).replace(/(.)/g,function(r,s){var n=s.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(e)}catch{return ip(e)}}function go(i){this.message=i}function sp(i,e){if(typeof i!="string")throw new go("Invalid token specified");var t=(e=e||{}).header===!0?0:1;try{return JSON.parse(bk(i.split(".")[t]))}catch(r){throw new go("Invalid token specified: "+r.message)}}go.prototype=new Error,go.prototype.name="InvalidTokenError";const Ek={dev:"https://dev.api.brixcloud.io/v1",stage:"https://stage.api.brixcloud.io/v1",prod:"https://api.brixcloud.io/v1"},Tk={dev:"https://dev.auth.brixcloud.io/v1",stage:"https://stage.auth.brixcloud.io/v1",prod:"https://auth.brixcloud.io/v1"},wk=async({id:i,env:e})=>{const t=await fetch(Ek[e]+`/public/ugc/${i}`),r=await t.json();if(!t.ok)throw r;return r},Ak=async({clientId:i,token:e,env:t})=>{const r=`__brix_session_token_${i}`,s="__brix_session_api_status";let n=e??localStorage.getItem(r);if(n)try{sp(n).exp*1e3-Date.now()<0&&(n=null)}catch{n=null}if(!n)if(sessionStorage.getItem(s)==="pending")for(;sessionStorage.getItem(s)==="pending";)await new Promise(o=>setTimeout(o,100)),n=localStorage.getItem(r);else try{sessionStorage.setItem(r,"pending"),n=(await(await fetch(Tk[t]+"/auth/token/guest",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({partner:i})})).json()).accessToken}finally{sessionStorage.setItem(r,"success")}return localStorage.setItem(r,n),sp(n)},np=(i,e=!1)=>{const[t,r]=ye.useState(null),[s,n]=ye.useState(null);return ye.useEffect(()=>{if(e)return;(async()=>{try{const o=await i();r(o),n(null)}catch(o){r(null),n(o.message)}})()},[i,e]),{data:t,error:s}};function _k({id:i,env:e,token:t,style:r}){var Z,se;const[s,n]=ye.useState(),[a,o]=ye.useState(60),[l,u]=ye.useState(!0),[h,d]=ye.useState(!1),{data:g}=np(ye.useCallback(()=>wk({id:i,env:e}),[i,e]),!i),{data:v}=np(ye.useCallback(()=>{var Q;return Ak({clientId:(Q=g==null?void 0:g.client)==null?void 0:Q.id,env:e,token:t})},[(Z=g==null?void 0:g.client)==null?void 0:Z.id,e,t]),!((se=g==null?void 0:g.client)!=null&&se.id)),y=ye.useRef(null),b=zT({ref:y,threshold:1}),E=ye.useCallback(Q=>{n(Q)},[]),A=ye.useCallback(()=>{n(void 0)},[]),M=()=>{s&&s.play()},D=()=>{s&&s.pause()},B=(Q,q)=>{if(Q.stopPropagation(),!s)return;const oe=q*s.duration/100;s.currentTime=oe},N=Q=>{Q.stopPropagation(),s&&(s.muted=!s.muted,u(s.muted))},J=ye.useMemo(()=>new UT({identityPoolId:Tf[e].identityPoolId,streamName:Tf[e].streamName}),[e]);return ye.useEffect(()=>{if(!s)return;const Q=he=>{const Ee=he.target;o(Ee.currentTime/Ee.duration*100)},q=()=>{d(!0),J.start()},oe=()=>{d(!1),J.stop()},ge=()=>{s.pause()};return s.addEventListener("loadedmetadata",ge),s.addEventListener("timeupdate",Q),s.addEventListener("play",q),s.addEventListener("pause",oe),()=>{s.removeEventListener("loadedmetadata",ge),s.removeEventListener("timeupdate",Q),s.removeEventListener("play",q),s.removeEventListener("pause",oe)}},[s,J]),ye.useEffect(()=>{b||s==null||s.pause()},[b,s]),ye.useEffect(()=>{!v||!i||(J.setType("ugc"),J.setId(i),J.setUser(v.userId,v.role),J.stop())},[J,v,i]),Ye.jsx(VT,{kinesis:J,children:Ye.jsxs("div",{ref:y,className:`${qi.root}`,style:r,children:[Ye.jsx(HI,{ratio:!0,className:qi.player,controls:!1,src:g==null?void 0:g.playUrl,onInit:E,onDestroy:A}),!h&&Ye.jsx("div",{className:qi.play_button,onClick:M,children:Ye.jsx(kn,{className:qi.play_icon,name:"IoPlay"})}),h&&Ye.jsx("div",{className:qi.pause_button,onClick:D}),Ye.jsx("div",{className:qi.mute_button,onClick:N,children:Ye.jsx(kn,{name:l?"IoVolumeMute":"IoVolumeHigh"})}),Ye.jsx(t0,{className:qi.progress,progress:a,onChangeProgress:B})]})})}exports.CognitoIdentityClient=Kg;exports.Command=Mc;exports.HttpRequest=kr;exports.PlayerUser=_k;exports.ServiceException=So;exports._json=kt;exports.commonParams=fT;exports.decorateServiceException=jt;exports.getEndpointPlugin=Ip;exports.getSerdePlugin=Lp;exports.loadRestJsonErrorCode=fg;exports.parseJsonBody=Fc;exports.parseJsonErrorBody=hg;exports.take=Wp;exports.withBaseException=jp;
145
+ //# sourceMappingURL=Ch7W_T2h.cjs.js.map