12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- "use strict";const Wm=(i,e)=>{const t=i.__vccOpts||i;for(const[s,n]of e)t[s]=n;return t};/**
- * @vue/shared v3.4.21
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
- * @license MIT
- **/function _i(i,e){const t=new Set(i.split(","));return e?s=>t.has(s.toLowerCase()):s=>t.has(s)}const Le=Object.freeze({}),yu=Object.freeze([]),$e=()=>{},zm=()=>!1,Xh=i=>i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&(i.charCodeAt(2)>122||i.charCodeAt(2)<97),vu=i=>i.startsWith("onUpdate:"),me=Object.assign,$r=(i,e)=>{const t=i.indexOf(e);t>-1&&i.splice(t,1)},Qm=Object.prototype.hasOwnProperty,se=(i,e)=>Qm.call(i,e),te=Array.isArray,ws=i=>kt(i)==="[object Map]",Jh=i=>kt(i)==="[object Set]",q=i=>typeof i=="function",Se=i=>typeof i=="string",Ii=i=>typeof i=="symbol",ve=i=>i!==null&&typeof i=="object",En=i=>(ve(i)||q(i))&&q(i.then)&&q(i.catch),Zh=Object.prototype.toString,kt=i=>Zh.call(i),Hr=i=>kt(i).slice(8,-1),He=i=>kt(i)==="[object Object]",jl=i=>Se(i)&&i!=="NaN"&&i[0]!=="-"&&""+parseInt(i,10)===i,ed=_i(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ym=_i("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),Gr=i=>{const e=Object.create(null);return t=>e[t]||(e[t]=i(t))},Xm=/-(\w)/g,Nt=Gr(i=>i.replace(Xm,(e,t)=>t?t.toUpperCase():"")),Jm=/\B([A-Z])/g,Ms=Gr(i=>i.replace(Jm,"-$1").toLowerCase()),Ns=Gr(i=>i.charAt(0).toUpperCase()+i.slice(1)),bs=Gr(i=>i?`on${Ns(i)}`:""),ms=(i,e)=>!Object.is(i,e),Xn=(i,e)=>{for(let t=0;t<i.length;t++)i[t](e)},Zm=(i,e,t)=>{Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value:t})},ex=i=>{const e=parseFloat(i);return isNaN(e)?i:e};function td(i){if(te(i)){const e={};for(let t=0;t<i.length;t++){const s=i[t],n=Se(s)?nx(s):td(s);if(n)for(const r in n)e[r]=n[r]}return e}else if(Se(i)||ve(i))return i}const tx=/;(?![^(]*\))/g,sx=/:([^]+)/,ix=/\/\*[^]*?\*\//g;function nx(i){const e={};return i.replace(ix,"").split(tx).forEach(t=>{if(t){const s=t.split(sx);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function sd(i){let e="";if(Se(i))e=i;else if(te(i))for(let t=0;t<i.length;t++){const s=sd(i[t]);s&&(e+=s+" ")}else if(ve(i))for(const t in i)i[t]&&(e+=t+" ");return e.trim()}const rx=i=>Se(i)?i:i==null?"":te(i)||ve(i)&&(i.toString===Zh||!q(i.toString))?JSON.stringify(i,id,2):String(i),id=(i,e)=>e&&e.__v_isRef?id(i,e.value):ws(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[s,n],r)=>(t[lo(s,r)+" =>"]=n,t),{})}:Jh(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>lo(t))}:Ii(e)?lo(e):ve(e)&&!te(e)&&!He(e)?String(e):e,lo=(i,e="")=>{var t;return Ii(i)?`Symbol(${(t=i.description)!=null?t:e})`:i},ox="d",Kr="onShow",Vr="onHide",nd="onLaunch",Us="onError",rd="onThemeChange",od="onPageNotFound",ad="onUnhandledRejection",ax="onExit",An="onLoad",ql="onReady",Wl="onUnload",ld="onInit",cd="onSaveExitState",ud="onResize",fd="onBackPress",hd="onPageScroll",zl="onTabItemTap",Ql="onReachBottom",Yl="onPullDownRefresh",dd="onShareTimeline",pd="onShareChat",Xl="onAddToFavorites",gd="onShareAppMessage",md="onNavigationBarButtonTap",xd="onNavigationBarSearchInputClicked",yd="onNavigationBarSearchInputChanged",vd="onNavigationBarSearchInputConfirmed",Ed="onNavigationBarSearchInputFocusChanged",lx="virtualHostStyle",cx="virtualHostClass",ux="virtualHostHidden",Ba="virtualHostId";function fx(i){return i.indexOf("/")===0}function hx(i){return fx(i)?i:"/"+i}const dx=(i,e)=>{let t;for(let s=0;s<i.length;s++)t=i[s](e);return t};function Ad(i,e=null){let t;return(...s)=>(i&&(t=i.apply(e,s),i=null),t)}function Sd(i,e){if(!Se(e))return;e=e.replace(/\[(\d+)\]/g,".$1");const t=e.split(".");let s=t[0];return i||(i={}),t.length===1?i[s]:Sd(i[s],t.slice(1).join("."))}function Td(i){let e={};return He(i)&&Object.keys(i).sort().forEach(t=>{const s=t;e[s]=i[s]}),Object.keys(e)?e:i}const px=/:/g;function gx(i){return Nt(i.replace(px,"-"))}const mx=encodeURIComponent;function xx(i,e=mx){const t=i?Object.keys(i).map(s=>{let n=i[s];return typeof n===void 0||n===null?n="":He(n)&&(n=JSON.stringify(n)),e(s)+"="+e(n)}).filter(s=>s.length>0).join("&"):null;return t?`?${t}`:""}const yx=[ld,An,Kr,Vr,Wl,fd,hd,zl,Ql,Yl,dd,gd,pd,Xl,cd,md,xd,yd,vd,Ed];function vx(i){return yx.indexOf(i)>-1}const bd=[Kr,Vr,nd,Us,rd,od,ad,ax,ld,An,ql,Wl,ud,fd,hd,zl,Ql,Yl,dd,Xl,gd,pd,cd,md,xd,yd,vd,Ed],Fa={onPageScroll:1,onShareAppMessage:2,onShareTimeline:4};function _d(i,e,t=!0){return t&&!q(e)?!1:bd.indexOf(i)>-1?!0:i.indexOf("on")===0}let Oa;const Id=[];function Ex(i){if(Oa)return i(Oa);Id.push(i)}function Ax(i){Oa=i,Id.forEach(e=>e(i))}const Sx=Ad((i,e)=>e(i)),Cd=function(){};Cd.prototype={_id:1,on:function(i,e,t){var s=this.e||(this.e={});return(s[i]||(s[i]=[])).push({fn:e,ctx:t,_id:this._id}),this._id++},once:function(i,e,t){var s=this;function n(){s.off(i,n),e.apply(t,arguments)}return n._=e,this.on(i,n,t)},emit:function(i){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[i]||[]).slice(),s=0,n=t.length;for(s;s<n;s++)t[s].fn.apply(t[s].ctx,e);return this},off:function(i,e){var t=this.e||(this.e={}),s=t[i],n=[];if(s&&e){for(var r=s.length-1;r>=0;r--)if(s[r].fn===e||s[r].fn._===e||s[r]._id===e){s.splice(r,1);break}n=s}return n.length?t[i]=n:delete t[i],this}};var Tx=Cd;const co="zh-Hans",Eu="zh-Hant",Yi="en",bx="fr",_x="es";function Ix(i,e){return!!e.find(t=>i.indexOf(t)!==-1)}function Cx(i,e){return e.find(t=>i.indexOf(t)===0)}function Ld(i,e){if(!i)return;if(i=i.trim().replace(/_/g,"-"),e&&e[i])return i;if(i=i.toLowerCase(),i==="chinese")return co;if(i.indexOf("zh")===0)return i.indexOf("-hans")>-1?co:i.indexOf("-hant")>-1||Ix(i,["-tw","-hk","-mo","-cht"])?Eu:co;let t=[Yi,bx,_x];e&&Object.keys(e).length>0&&(t=Object.keys(e));const s=Cx(i,t);if(s)return s}function Lx(){var i;let e="";{const t=((i=wx.getAppBaseInfo)===null||i===void 0?void 0:i.call(wx))||wx.getSystemInfoSync(),s=t&&t.language?t.language:Yi;e=Ld(s)||Yi}return e}function Dx(i,e){console.warn(`${i}: ${e}`)}function Au(i,e,t,s){s||(s=Dx);for(const n in t){const r=Px(n,e[n],t[n],!se(e,n));Se(r)&&s(i,r)}}function Rx(i,e,t,s){if(!t)return;if(!te(t))return Au(i,e[0]||Object.create(null),t,s);const n=t.length,r=e.length;for(let o=0;o<n;o++){const a=t[o],c=Object.create(null);r>o&&(c[a.name]=e[o]),Au(i,c,{[a.name]:a},s)}}function Px(i,e,t,s){He(t)||(t={type:t});const{type:n,required:r,validator:o}=t;if(r&&s)return'Missing required args: "'+i+'"';if(!(e==null&&!r)){if(n!=null){let a=!1;const c=te(n)?n:[n],l=[];for(let u=0;u<c.length&&!a;u++){const{valid:f,expectedType:h}=Bx(e,c[u]);l.push(h||""),a=f}if(!a)return Fx(i,e,l)}if(o)return o(e)}}const kx=_i("String,Number,Boolean,Function,Symbol");function Bx(i,e){let t;const s=Ox(e);if(kx(s)){const n=typeof i;t=n===s.toLowerCase(),!t&&n==="object"&&(t=i instanceof e)}else s==="Object"?t=ve(i):s==="Array"?t=te(i):t=i instanceof e;return{valid:t,expectedType:s}}function Fx(i,e,t){let s=`Invalid args: type check failed for args "${i}". Expected ${t.map(Ns).join(", ")}`;const n=t[0],r=Hr(e),o=Su(e,n),a=Su(e,r);return t.length===1&&Tu(n)&&!Mx(n,r)&&(s+=` with value ${o}`),s+=`, got ${r} `,Tu(r)&&(s+=`with value ${a}.`),s}function Ox(i){const e=i&&i.toString().match(/^\s*function (\w+)/);return e?e[1]:""}function Su(i,e){return e==="String"?`"${i}"`:e==="Number"?`${Number(i)}`:`${i}`}function Tu(i){return["string","number","boolean"].some(t=>i.toLowerCase()===t)}function Mx(...i){return i.some(e=>e.toLowerCase()==="boolean")}function Nx(i){return function(){try{return i.apply(i,arguments)}catch(e){console.error(e)}}}let Ux=1;const Ma={};function $x(i,e,t,s=!1){return Ma[i]={name:e,keepAlive:s,callback:t},i}function Dd(i,e,t){if(typeof i=="number"){const s=Ma[i];if(s)return s.keepAlive||delete Ma[i],s.callback(e,t)}return e}const Hx="success",Gx="fail",Kx="complete";function Vx(i){const e={};for(const t in i){const s=i[t];q(s)&&(e[t]=Nx(s),delete i[t])}return e}function jx(i,e){return!i||i.indexOf(":fail")===-1?e+":ok":e+i.substring(i.indexOf(":fail"))}function qx(i,e={},{beforeAll:t,beforeSuccess:s}={}){He(e)||(e={});const{success:n,fail:r,complete:o}=Vx(e),a=q(n),c=q(r),l=q(o),u=Ux++;return $x(u,i,f=>{f=f||{},f.errMsg=jx(f.errMsg,i),q(t)&&t(f),f.errMsg===i+":ok"?(q(s)&&s(f,e),a&&n(f)):c&&r(f),l&&o(f)}),u}const Wx="success",zx="fail",Qx="complete",mi={},xi={};function Yx(i,e){return function(t){return i(t,e)||t}}function Rd(i,e,t){let s=!1;for(let n=0;n<i.length;n++){const r=i[n];if(s)s=Promise.resolve(Yx(r,t));else{const o=r(e,t);if(En(o)&&(s=Promise.resolve(o)),o===!1)return{then(){},catch(){}}}}return s||{then(n){return n(e)},catch(){}}}function bu(i,e={}){return[Wx,zx,Qx].forEach(t=>{const s=i[t];if(!te(s))return;const n=e[t];e[t]=function(o){Rd(s,o,e).then(a=>q(n)&&n(a)||a)}}),e}function ur(i,e){const t=[];te(mi.returnValue)&&t.push(...mi.returnValue);const s=xi[i];return s&&te(s.returnValue)&&t.push(...s.returnValue),t.forEach(n=>{e=n(e)||e}),e}function _u(i){const e=Object.create(null);Object.keys(mi).forEach(s=>{s!=="returnValue"&&(e[s]=mi[s].slice())});const t=xi[i];return t&&Object.keys(t).forEach(s=>{s!=="returnValue"&&(e[s]=(e[s]||[]).concat(t[s]))}),e}function fr(i,e,t,s){const n=_u(i);return n&&Object.keys(n).length?te(n.invoke)?Rd(n.invoke,t).then(o=>e(bu(_u(i),o),...s)):e(bu(n,t),...s):e(t,...s)}function Xx(i){return!!(He(i)&&[Hx,Gx,Kx].find(e=>q(i[e])))}function Jx(i,e){return(t={},...s)=>Xx(t)?ur(i,fr(i,e,me({},t),s)):ur(i,new Promise((n,r)=>{fr(i,e,me({},t,{success:n,fail:r}),s)}))}function Zx(i,e){i[0]}function e2(i,e,t){const s={errMsg:e+":ok"};return Dd(i,me(t||{},s))}function Iu(i,e,t,s={}){const n=e+":fail";let r="";t?t.indexOf(n)===0?r=t:r=n+" "+t:r=n,delete s.errCode;let o=me({errMsg:r},s);return Dd(i,o)}function wd(i,e,t,s){Rx(i,e,t);const n=Zx(e);if(n)return n}function t2(i){return!i||Se(i)?i:i.stack?((typeof globalThis>"u"||!globalThis.harmonyChannel)&&console.error(i.message+`
- `+i.stack),i.message):i}function s2(i,e,t,s){return n=>{const r=qx(i,n,s),o=wd(i,[n],t);return o?Iu(r,i,o):e(n,{resolve:a=>e2(r,i,a),reject:(a,c)=>Iu(r,i,t2(a),c)})}}function i2(i,e,t,s){return(...n)=>{const r=wd(i,n,t);if(r)throw new Error(r);return e.apply(null,n)}}function n2(i,e,t,s){return s2(i,e,t,s)}function Ks(i,e,t,s){return i2(i,e,t)}function r2(i,e,t,s){return Jx(i,n2(i,e,t,s))}const o2="upx2px",a2=[{name:"upx",type:[Number,String],required:!0}],l2=1e-4,c2=750;let Pd=!1,Na=0,kd=0;function u2(){var i,e;let t,s,n;{const r=((i=wx.getWindowInfo)===null||i===void 0?void 0:i.call(wx))||wx.getSystemInfoSync(),o=((e=wx.getDeviceInfo)===null||e===void 0?void 0:e.call(wx))||wx.getSystemInfoSync();t=r.windowWidth,s=r.pixelRatio,n=o.platform}Na=t,kd=s,Pd=n==="ios"}const Cu=Ks(o2,(i,e)=>{if(Na===0&&u2(),i=Number(i),i===0)return 0;let t=e||Na,s=i/c2*t;return s<0&&(s=-s),s=Math.floor(s+l2),s===0&&(kd===1||!Pd?s=1:s=.5),i<0?-s:s},a2);function f2(i,e,...t){e&&t.push(e),console[i].apply(console,t)}const h2="addInterceptor",d2="removeInterceptor",Bd=[{name:"method",type:[String,Object],required:!0}],p2=Bd;function Lu(i,e){Object.keys(e).forEach(t=>{q(e[t])&&(i[t]=g2(i[t],e[t]))})}function Du(i,e){!i||!e||Object.keys(e).forEach(t=>{const s=i[t],n=e[t];te(s)&&q(n)&&$r(s,n)})}function g2(i,e){const t=e?i?i.concat(e):te(e)?e:[e]:i;return t&&m2(t)}function m2(i){const e=[];for(let t=0;t<i.length;t++)e.indexOf(i[t])===-1&&e.push(i[t]);return e}const x2=Ks(h2,(i,e)=>{Se(i)&&He(e)?Lu(xi[i]||(xi[i]={}),e):He(i)&&Lu(mi,i)},Bd),y2=Ks(d2,(i,e)=>{Se(i)?He(e)?Du(xi[i],e):delete xi[i]:He(i)&&Du(mi,i)},p2),v2={},E2="$on",Fd=[{name:"event",type:String,required:!0},{name:"callback",type:Function,required:!0}],A2="$once",S2=Fd,T2="$off",b2=[{name:"event",type:[String,Array]},{name:"callback",type:[Function,Number]}],_2="$emit",I2=[{name:"event",type:String,required:!0}];class C2{constructor(){this.$emitter=new Tx}on(e,t){return this.$emitter.on(e,t)}once(e,t){return this.$emitter.once(e,t)}off(e,t){if(!e){this.$emitter.e={};return}this.$emitter.off(e,t)}emit(e,...t){this.$emitter.emit(e,...t)}}const yi=new C2,L2=Ks(E2,(i,e)=>(yi.on(i,e),()=>yi.off(i,e)),Fd),D2=Ks(A2,(i,e)=>(yi.once(i,e),()=>yi.off(i,e)),S2),R2=Ks(T2,(i,e)=>{te(i)||(i=i?[i]:[]),i.forEach(t=>{yi.off(t,e)})},b2),w2=Ks(_2,(i,...e)=>{yi.emit(i,...e)},I2);let Gi,Ua,$a;function Ru(i){try{return JSON.parse(i)}catch{}return i}function P2(i){if(i.type==="enabled")$a=!0;else if(i.type==="clientId")Gi=i.cid,Ua=i.errMsg,Od(Gi,i.errMsg);else if(i.type==="pushMsg"){const e={type:"receive",data:Ru(i.message)};for(let t=0;t<fs.length;t++){const s=fs[t];if(s(e),e.stopped)break}}else i.type==="click"&&fs.forEach(e=>{e({type:"click",data:Ru(i.message)})})}const Ha=[];function Od(i,e){Ha.forEach(t=>{t(i,e)}),Ha.length=0}const k2="getPushClientId",B2=r2(k2,(i,{resolve:e,reject:t})=>{Promise.resolve().then(()=>{typeof $a>"u"&&($a=!1,Gi="",Ua="uniPush is not enabled"),Ha.push((s,n)=>{s?e({cid:s}):t(n)}),typeof Gi<"u"&&Od(Gi,Ua)})}),fs=[],F2=i=>{fs.indexOf(i)===-1&&fs.push(i)},O2=i=>{if(!i)fs.length=0;else{const e=fs.indexOf(i);e>-1&&fs.splice(e,1)}},M2=/^\$|__f__|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|rpx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/,N2=/^create|Manager$/,U2=["createBLEConnection"],$2=["request","downloadFile","uploadFile","connectSocket"],H2=["createBLEConnection"],G2=/^on|^off/;function Jn(i){return N2.test(i)&&U2.indexOf(i)===-1}function Md(i){return M2.test(i)&&H2.indexOf(i)===-1}function K2(i){return G2.test(i)&&i!=="onPush"}function wu(i){return $2.indexOf(i)!==-1}function V2(i){return!(Jn(i)||Md(i)||K2(i))}Promise.prototype.finally||(Promise.prototype.finally=function(i){const e=this.constructor;return this.then(t=>e.resolve(i&&i()).then(()=>t),t=>e.resolve(i&&i()).then(()=>{throw t}))});function uo(i,e){return!V2(i)||!q(e)?e:function(s={},...n){return q(s.success)||q(s.fail)||q(s.complete)?ur(i,fr(i,e,me({},s),n)):ur(i,new Promise((r,o)=>{fr(i,e,me({},s,{success:r,fail:o}),n)}))}}const j2=["success","fail","cancel","complete"];function q2(i){function e(n,r,o){return function(a){return r(s(n,a,o))}}function t(n,r,o={},a={},c=!1){if(He(r)){const l=c===!0?r:{};q(o)&&(o=o(r,l)||{});for(const u in r)if(se(o,u)){let f=o[u];q(f)&&(f=f(r[u],r,l)),f?Se(f)?l[f]=r[u]:He(f)&&(l[f.name?f.name:u]=f.value):console.warn(`微信小程序 ${n} 暂不支持 ${u}`)}else if(j2.indexOf(u)!==-1){const f=r[u];q(f)&&(l[u]=e(n,f,a))}else!c&&!se(l,u)&&(l[u]=r[u]);return l}else q(r)&&(q(o)&&o(r,{}),r=e(n,r,a));return r}function s(n,r,o,a=!1){return q(i.returnValue)&&(r=i.returnValue(n,r)),t(n,r,o,{},a||!1)}return function(r,o){const a=se(i,r);if(!a&&typeof wx[r]!="function")return o;const c=a||q(i.returnValue)||Jn(r)||wu(r),l=a||q(o);if(!a&&!o)return function(){console.error(`微信小程序 暂不支持${r}`)};if(!c||!l)return o;const u=i[r];return function(f,h){let d=u||{};q(u)&&(d=u(f)),f=t(r,f,d.args,d.returnValue);const p=[f];typeof h<"u"&&p.push(h);const m=wx[d.name||r].apply(wx,p);return(Jn(r)||wu(r))&&m&&!m.__v_skip&&(m.__v_skip=!0),Md(r)?s(r,m,d.returnValue,Jn(r)):m}}}const hr=()=>{const i=q(getApp)&&getApp({allowDefault:!0});return i&&i.$vm?i.$vm.$locale:Lx()},W2=i=>{const e=q(getApp)&&getApp();return e&&e.$vm.$locale!==i?(e.$vm.$locale=i,Ga.forEach(s=>s({locale:i})),!0):!1},Ga=[],z2=i=>{Ga.indexOf(i)===-1&&Ga.push(i)};typeof global<"u"&&(global.getLocale=hr);const Pu="__DC_STAT_UUID";let Js;function Nd(i=wx){return function(t,s){Js=Js||i.getStorageSync(Pu),Js||(Js=Date.now()+""+Math.floor(Math.random()*1e7),wx.setStorage({key:Pu,data:Js})),s.deviceId=Js}}function Ud(i,e){if(i.safeArea){const t=i.safeArea;e.safeAreaInsets={top:t.top,left:t.left,right:i.windowWidth-t.right,bottom:i.screenHeight-t.bottom}}}function $d(i,e){let t="",s="";switch(t=i.split(" ")[0]||e,s=i.split(" ")[1]||"",t=t.toLowerCase(),t){case"harmony":case"ohos":case"openharmony":t="harmonyos";break;case"iphone os":t="ios";break;case"mac":case"darwin":t="macos";break;case"windows_nt":t="windows";break}return{osName:t,osVersion:s}}function Q2(i,e){const{brand:t="",model:s="",system:n="",language:r="",theme:o,version:a,platform:c,fontSizeSetting:l,SDKVersion:u,pixelRatio:f,deviceOrientation:h}=i,{osName:d,osVersion:p}=$d(n,c);let m=a,g=Hd(i,s),y=Gd(t),v=Vd(i),x=h,E=f,S=u;const T=(r||"").replace(/_/g,"-"),_={appId:"__UNI__90F7D71",appName:"签约",appVersion:"1.0.0",appVersionCode:100,appLanguage:Kd(T),uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75",uniPlatform:"mp-weixin",deviceBrand:y,deviceModel:s,deviceType:g,devicePixelRatio:E,deviceOrientation:x,osName:d,osVersion:p,hostTheme:o,hostVersion:m,hostLanguage:T,hostName:v,hostSDKVersion:S,hostFontSizeSetting:l,windowTop:0,windowBottom:0,osLanguage:void 0,osTheme:void 0,ua:void 0,hostPackageName:void 0,browserName:void 0,browserVersion:void 0,isUniAppX:!1};me(e,_)}function Hd(i,e){let t=i.deviceType||"phone";{const s={ipad:"pad",windows:"pc",mac:"pc"},n=Object.keys(s),r=e.toLowerCase();for(let o=0;o<n.length;o++){const a=n[o];if(r.indexOf(a)!==-1){t=s[a];break}}}return t}function Gd(i){let e=i;return e&&(e=e.toLowerCase()),e}function Kd(i){return hr?hr():i}function Vd(i){let t=i.hostName||"WeChat";return i.environment?t=i.environment:i.host&&i.host.env&&(t=i.host.env),t}const jd={returnValue:(i,e)=>{Ud(i,e),Nd()(i,e),Q2(i,e)}},Y2=jd,X2={},J2={args(i,e){let t=parseInt(i.current);if(isNaN(t))return;const s=i.urls;if(!te(s))return;const n=s.length;if(n)return t<0?t=0:t>=n&&(t=n-1),t>0?(e.current=s[t],e.urls=s.filter((r,o)=>o<t?r!==s[t]:!0)):e.current=s[0],{indicator:!1,loop:!1}}},Z2={args(i,e){e.alertText=i.title}},ey={returnValue:(i,e)=>{const{brand:t,model:s,system:n="",platform:r=""}=i;let o=Hd(i,s),a=Gd(t);Nd()(i,e);const{osName:c,osVersion:l}=$d(n,r);e=Td(me(e,{deviceType:o,deviceBrand:a,deviceModel:s,osName:c,osVersion:l}))}},ty={returnValue:(i,e)=>{const{version:t,language:s,SDKVersion:n,theme:r}=i;let o=Vd(i),a=(s||"").replace(/_/g,"-");const c={hostVersion:t,hostLanguage:a,hostName:o,hostSDKVersion:n,hostTheme:r,appId:"__UNI__90F7D71",appName:"签约",appVersion:"1.0.0",appVersionCode:100,appLanguage:Kd(a),isUniAppX:!1,uniPlatform:"mp-weixin",uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75"};me(e,c)}},sy={returnValue:(i,e)=>{Ud(i,e),e=Td(me(e,{windowTop:0,windowBottom:0}))}},iy={returnValue:function(i,e){const{locationReducedAccuracy:t}=i;e.locationAccuracy="unsupported",t===!0?e.locationAccuracy="reduced":t===!1&&(e.locationAccuracy="full")}},ny={args(i){const e=getApp({allowDefault:!0})||{};e.$vm?qs(Us,i,e.$vm.$):(wx.$onErrorHandlers||(wx.$onErrorHandlers=[]),wx.$onErrorHandlers.push(i))}},ry={args(i){const e=getApp({allowDefault:!0})||{};if(e.$vm){if(i.__weh){const t=e.$vm.$[Us];if(t){const s=t.indexOf(i.__weh);s>-1&&t.splice(s,1)}}}else{if(!wx.$onErrorHandlers)return;const t=wx.$onErrorHandlers.findIndex(s=>s===i);t!==-1&&wx.$onErrorHandlers.splice(t,1)}}},qd={args(){if(wx.__uni_console__){if(wx.__uni_console_warned__)return;wx.__uni_console_warned__=!0,console.warn("开发模式下小程序日志回显会使用 socket 连接,为了避免冲突,建议使用 SocketTask 的方式去管理 WebSocket 或手动关闭日志回显功能。[详情](https://uniapp.dcloud.net.cn/tutorial/run/mp-log.html)")}}},oy=qd,ku={$on:L2,$off:R2,$once:D2,$emit:w2,upx2px:Cu,rpx2px:Cu,interceptors:v2,addInterceptor:x2,removeInterceptor:y2,onCreateVueApp:Ex,invokeCreateVueAppHook:Ax,getLocale:hr,setLocale:W2,onLocaleChange:z2,getPushClientId:B2,onPushMessage:F2,offPushMessage:O2,invokePushCallback:P2,__f__:f2};function ay(i,e,t=wx){const s=q2(e),n={get(r,o){return se(r,o)?r[o]:se(i,o)?uo(o,i[o]):se(ku,o)?uo(o,ku[o]):uo(o,s(o,t[o]))}};return new Proxy({},n)}function ly(i){return function({service:t,success:s,fail:n,complete:r}){let o;i[t]?(o={errMsg:"getProvider:ok",service:t,provider:i[t]},q(s)&&s(o)):(o={errMsg:"getProvider:fail:服务["+t+"]不存在"},q(n)&&n(o)),q(r)&&r(o)}}const cy=["qy","env","error","version","lanDebug","cloud","serviceMarket","router","worklet","__webpack_require_UNI_MP_PLUGIN__"],uy=["lanDebug","router","worklet"],Bu=wx.getLaunchOptionsSync?wx.getLaunchOptionsSync():null;function fy(i){return Bu&&Bu.scene===1154&&uy.includes(i)?!1:cy.indexOf(i)>-1||typeof wx[i]=="function"}function Wd(){const i={};for(const e in wx)fy(e)&&(i[e]=wx[e]);return typeof globalThis<"u"&&typeof requireMiniProgram>"u"&&(globalThis.wx=i),i}const hy=["__route__","__wxExparserNodeId__","__wxWebviewId__"],dy=ly({oauth:["weixin"],share:["weixin"],payment:["wxpay"],push:["weixin"]});function py(i){const e=Object.create(null);return hy.forEach(t=>{e[t]=i[t]}),e}function gy(){const i=Je.createSelectorQuery(),e=i.in;return i.in=function(s){return s.$scope?e.call(this,s.$scope):e.call(this,py(s))},i}const Je=Wd();Je.canIUse("getAppBaseInfo")||(Je.getAppBaseInfo=Je.getSystemInfoSync);Je.canIUse("getWindowInfo")||(Je.getWindowInfo=Je.getSystemInfoSync);Je.canIUse("getDeviceInfo")||(Je.getDeviceInfo=Je.getSystemInfoSync);let dr=Je.getAppBaseInfo&&Je.getAppBaseInfo();dr||(dr=Je.getSystemInfoSync());const Fu=dr?dr.host:null,xy=Fu&&Fu.env==="SAAASDK"?Je.miniapp.shareVideoMessage:Je.shareVideoMessage;var yy=Object.freeze({__proto__:null,createSelectorQuery:gy,getProvider:dy,shareVideoMessage:xy});const vy={args(i,e){i.compressedHeight&&!e.compressHeight&&(e.compressHeight=i.compressedHeight),i.compressedWidth&&!e.compressWidth&&(e.compressWidth=i.compressedWidth)}};var Ey=Object.freeze({__proto__:null,compressImage:vy,getAppAuthorizeSetting:iy,getAppBaseInfo:ty,getDeviceInfo:ey,getSystemInfo:jd,getSystemInfoSync:Y2,getWindowInfo:sy,offError:ry,onError:ny,onSocketMessage:oy,onSocketOpen:qd,previewImage:J2,redirectTo:X2,showActionSheet:Z2});const hs=Wd();var X=ay(yy,Ey,hs);/**
- * @dcloudio/uni-mp-vue v3.4.21
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
- * @license MIT
- **/function xs(i,...e){console.warn(`[Vue warn] ${i}`,...e)}let At;class zd{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=At,!e&&At&&(this.index=(At.scopes||(At.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=At;try{return At=this,e()}finally{At=t}}else xs("cannot run an inactive effect scope.")}on(){At=this}off(){At=this.parent}stop(e){if(this._active){let t,s;for(t=0,s=this.effects.length;t<s;t++)this.effects[t].stop();for(t=0,s=this.cleanups.length;t<s;t++)this.cleanups[t]();if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0,this._active=!1}}}function Ay(i){return new zd(i)}function Sy(i,e=At){e&&e.active&&e.effects.push(i)}function Ty(){return At}let Ps;class Jl{constructor(e,t,s,n){this.fn=e,this.trigger=t,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,Sy(this,n)}get dirty(){if(this._dirtyLevel===2||this._dirtyLevel===3){this._dirtyLevel=1,Vs();for(let e=0;e<this._depsLength;e++){const t=this.deps[e];if(t.computed&&(by(t.computed),this._dirtyLevel>=4))break}this._dirtyLevel===1&&(this._dirtyLevel=0),js()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=ds,t=Ps;try{return ds=!0,Ps=this,this._runnings++,Ou(this),this.fn()}finally{Mu(this),this._runnings--,Ps=t,ds=e}}stop(){var e;this.active&&(Ou(this),Mu(this),(e=this.onStop)==null||e.call(this),this.active=!1)}}function by(i){return i.value}function Ou(i){i._trackId++,i._depsLength=0}function Mu(i){if(i.deps.length>i._depsLength){for(let e=i._depsLength;e<i.deps.length;e++)Qd(i.deps[e],i);i.deps.length=i._depsLength}}function Qd(i,e){const t=i.get(e);t!==void 0&&e._trackId!==t&&(i.delete(e),i.size===0&&i.cleanup())}let ds=!0,Ka=0;const Yd=[];function Vs(){Yd.push(ds),ds=!1}function js(){const i=Yd.pop();ds=i===void 0?!0:i}function Zl(){Ka++}function ec(){for(Ka--;!Ka&&Va.length;)Va.shift()()}function Xd(i,e,t){var s;if(e.get(i)!==i._trackId){e.set(i,i._trackId);const n=i.deps[i._depsLength];n!==e?(n&&Qd(n,i),i.deps[i._depsLength++]=e):i._depsLength++,(s=i.onTrack)==null||s.call(i,me({effect:i},t))}}const Va=[];function Jd(i,e,t){var s;Zl();for(const n of i.keys()){let r;n._dirtyLevel<e&&(r??(r=i.get(n)===n._trackId))&&(n._shouldSchedule||(n._shouldSchedule=n._dirtyLevel===0),n._dirtyLevel=e),n._shouldSchedule&&(r??(r=i.get(n)===n._trackId))&&((s=n.onTrigger)==null||s.call(n,me({effect:n},t)),n.trigger(),(!n._runnings||n.allowRecurse)&&n._dirtyLevel!==2&&(n._shouldSchedule=!1,n.scheduler&&Va.push(n.scheduler)))}ec()}const Zd=(i,e)=>{const t=new Map;return t.cleanup=i,t.computed=e,t},ja=new WeakMap,ks=Symbol("iterate"),qa=Symbol("Map key iterate");function Qe(i,e,t){if(ds&&Ps){let s=ja.get(i);s||ja.set(i,s=new Map);let n=s.get(t);n||s.set(t,n=Zd(()=>s.delete(t))),Xd(Ps,n,{target:i,type:e,key:t})}}function qt(i,e,t,s,n,r){const o=ja.get(i);if(!o)return;let a=[];if(e==="clear")a=[...o.values()];else if(t==="length"&&te(i)){const c=Number(s);o.forEach((l,u)=>{(u==="length"||!Ii(u)&&u>=c)&&a.push(l)})}else switch(t!==void 0&&a.push(o.get(t)),e){case"add":te(i)?jl(t)&&a.push(o.get("length")):(a.push(o.get(ks)),ws(i)&&a.push(o.get(qa)));break;case"delete":te(i)||(a.push(o.get(ks)),ws(i)&&a.push(o.get(qa)));break;case"set":ws(i)&&a.push(o.get(ks));break}Zl();for(const c of a)c&&Jd(c,4,{target:i,type:e,key:t,newValue:s,oldValue:n,oldTarget:r});ec()}const _y=_i("__proto__,__v_isRef,__isVue"),ep=new Set(Object.getOwnPropertyNames(Symbol).filter(i=>i!=="arguments"&&i!=="caller").map(i=>Symbol[i]).filter(Ii)),Nu=Iy();function Iy(){const i={};return["includes","indexOf","lastIndexOf"].forEach(e=>{i[e]=function(...t){const s=ue(this);for(let r=0,o=this.length;r<o;r++)Qe(s,"get",r+"");const n=s[e](...t);return n===-1||n===!1?s[e](...t.map(ue)):n}}),["push","pop","shift","unshift","splice"].forEach(e=>{i[e]=function(...t){Vs(),Zl();const s=ue(this)[e].apply(this,t);return ec(),js(),s}}),i}function Cy(i){const e=ue(this);return Qe(e,"has",i),e.hasOwnProperty(i)}class tp{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,s){const n=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!n;if(t==="__v_isReadonly")return n;if(t==="__v_isShallow")return r;if(t==="__v_raw")return s===(n?r?lp:ap:r?op:rp).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=te(e);if(!n){if(o&&se(Nu,t))return Reflect.get(Nu,t,s);if(t==="hasOwnProperty")return Cy}const a=Reflect.get(e,t,s);return(Ii(t)?ep.has(t):_y(t))||(n||Qe(e,"get",t),r)?a:Ze(a)?o&&jl(t)?a:a.value:ve(a)?n?cp(a):Wr(a):a}}class sp extends tp{constructor(e=!1){super(!1,e)}set(e,t,s,n){let r=e[t];if(!this._isShallow){const c=vi(r);if(!pr(s)&&!vi(s)&&(r=ue(r),s=ue(s)),!te(e)&&Ze(r)&&!Ze(s))return c?!1:(r.value=s,!0)}const o=te(e)&&jl(t)?Number(t)<e.length:se(e,t),a=Reflect.set(e,t,s,n);return e===ue(n)&&(o?ms(s,r)&&qt(e,"set",t,s,r):qt(e,"add",t,s)),a}deleteProperty(e,t){const s=se(e,t),n=e[t],r=Reflect.deleteProperty(e,t);return r&&s&&qt(e,"delete",t,void 0,n),r}has(e,t){const s=Reflect.has(e,t);return(!Ii(t)||!ep.has(t))&&Qe(e,"has",t),s}ownKeys(e){return Qe(e,"iterate",te(e)?"length":ks),Reflect.ownKeys(e)}}class ip extends tp{constructor(e=!1){super(!0,e)}set(e,t){return xs(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return xs(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const Ly=new sp,Dy=new ip,Ry=new sp(!0),wy=new ip(!0),tc=i=>i,jr=i=>Reflect.getPrototypeOf(i);function Cn(i,e,t=!1,s=!1){i=i.__v_raw;const n=ue(i),r=ue(e);t||(ms(e,r)&&Qe(n,"get",e),Qe(n,"get",r));const{has:o}=jr(n),a=s?tc:t?ic:Xi;if(o.call(n,e))return a(i.get(e));if(o.call(n,r))return a(i.get(r));i!==n&&i.get(e)}function Ln(i,e=!1){const t=this.__v_raw,s=ue(t),n=ue(i);return e||(ms(i,n)&&Qe(s,"has",i),Qe(s,"has",n)),i===n?t.has(i):t.has(i)||t.has(n)}function Dn(i,e=!1){return i=i.__v_raw,!e&&Qe(ue(i),"iterate",ks),Reflect.get(i,"size",i)}function Uu(i){i=ue(i);const e=ue(this);return jr(e).has.call(e,i)||(e.add(i),qt(e,"add",i,i)),this}function $u(i,e){e=ue(e);const t=ue(this),{has:s,get:n}=jr(t);let r=s.call(t,i);r?np(t,s,i):(i=ue(i),r=s.call(t,i));const o=n.call(t,i);return t.set(i,e),r?ms(e,o)&&qt(t,"set",i,e,o):qt(t,"add",i,e),this}function Hu(i){const e=ue(this),{has:t,get:s}=jr(e);let n=t.call(e,i);n?np(e,t,i):(i=ue(i),n=t.call(e,i));const r=s?s.call(e,i):void 0,o=e.delete(i);return n&&qt(e,"delete",i,void 0,r),o}function Gu(){const i=ue(this),e=i.size!==0,t=ws(i)?new Map(i):new Set(i),s=i.clear();return e&&qt(i,"clear",void 0,void 0,t),s}function Rn(i,e){return function(s,n){const r=this,o=r.__v_raw,a=ue(o),c=e?tc:i?ic:Xi;return!i&&Qe(a,"iterate",ks),o.forEach((l,u)=>s.call(n,c(l),c(u),r))}}function wn(i,e,t){return function(...s){const n=this.__v_raw,r=ue(n),o=ws(r),a=i==="entries"||i===Symbol.iterator&&o,c=i==="keys"&&o,l=n[i](...s),u=t?tc:e?ic:Xi;return!e&&Qe(r,"iterate",c?qa:ks),{next(){const{value:f,done:h}=l.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function Jt(i){return function(...e){{const t=e[0]?`on key "${e[0]}" `:"";xs(`${Ns(i)} operation ${t}failed: target is readonly.`,ue(this))}return i==="delete"?!1:i==="clear"?void 0:this}}function Py(){const i={get(r){return Cn(this,r)},get size(){return Dn(this)},has:Ln,add:Uu,set:$u,delete:Hu,clear:Gu,forEach:Rn(!1,!1)},e={get(r){return Cn(this,r,!1,!0)},get size(){return Dn(this)},has:Ln,add:Uu,set:$u,delete:Hu,clear:Gu,forEach:Rn(!1,!0)},t={get(r){return Cn(this,r,!0)},get size(){return Dn(this,!0)},has(r){return Ln.call(this,r,!0)},add:Jt("add"),set:Jt("set"),delete:Jt("delete"),clear:Jt("clear"),forEach:Rn(!0,!1)},s={get(r){return Cn(this,r,!0,!0)},get size(){return Dn(this,!0)},has(r){return Ln.call(this,r,!0)},add:Jt("add"),set:Jt("set"),delete:Jt("delete"),clear:Jt("clear"),forEach:Rn(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{i[r]=wn(r,!1,!1),t[r]=wn(r,!0,!1),e[r]=wn(r,!1,!0),s[r]=wn(r,!0,!0)}),[i,t,e,s]}const[ky,By,Fy,Oy]=Py();function qr(i,e){const t=e?i?Oy:Fy:i?By:ky;return(s,n,r)=>n==="__v_isReactive"?!i:n==="__v_isReadonly"?i:n==="__v_raw"?s:Reflect.get(se(t,n)&&n in s?t:s,n,r)}const My={get:qr(!1,!1)},Ny={get:qr(!1,!0)},Uy={get:qr(!0,!1)},$y={get:qr(!0,!0)};function np(i,e,t){const s=ue(t);if(s!==t&&e.call(i,s)){const n=Hr(i);xs(`Reactive ${n} contains both the raw and reactive versions of the same object${n==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const rp=new WeakMap,op=new WeakMap,ap=new WeakMap,lp=new WeakMap;function Hy(i){switch(i){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Gy(i){return i.__v_skip||!Object.isExtensible(i)?0:Hy(Hr(i))}function Wr(i){return vi(i)?i:zr(i,!1,Ly,My,rp)}function Ky(i){return zr(i,!1,Ry,Ny,op)}function cp(i){return zr(i,!0,Dy,Uy,ap)}function oi(i){return zr(i,!0,wy,$y,lp)}function zr(i,e,t,s,n){if(!ve(i))return xs(`value cannot be made reactive: ${String(i)}`),i;if(i.__v_raw&&!(e&&i.__v_isReactive))return i;const r=n.get(i);if(r)return r;const o=Gy(i);if(o===0)return i;const a=new Proxy(i,o===2?s:t);return n.set(i,a),a}function fi(i){return vi(i)?fi(i.__v_raw):!!(i&&i.__v_isReactive)}function vi(i){return!!(i&&i.__v_isReadonly)}function pr(i){return!!(i&&i.__v_isShallow)}function Vy(i){return fi(i)||vi(i)}function ue(i){const e=i&&i.__v_raw;return e?ue(e):i}function sc(i){return Object.isExtensible(i)&&Zm(i,"__v_skip",!0),i}const Xi=i=>ve(i)?Wr(i):i,ic=i=>ve(i)?cp(i):i,jy="Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free";class up{constructor(e,t,s,n){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new Jl(()=>e(this._value),()=>Zn(this,this.effect._dirtyLevel===2?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s}get value(){const e=ue(this);return(!e._cacheable||e.effect.dirty)&&ms(e._value,e._value=e.effect.run())&&Zn(e,4),fp(e),e.effect._dirtyLevel>=2&&(this._warnRecursive&&xs(jy,`
- getter: `,this.getter),Zn(e,2)),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function qy(i,e,t=!1){let s,n;const r=q(i);r?(s=i,n=()=>{xs("Write operation failed: computed value is readonly")}):(s=i.get,n=i.set);const o=new up(s,n,r||!n,t);return e&&!t&&(o.effect.onTrack=e.onTrack,o.effect.onTrigger=e.onTrigger),o}function fp(i){var e;ds&&Ps&&(i=ue(i),Xd(Ps,(e=i.dep)!=null?e:i.dep=Zd(()=>i.dep=void 0,i instanceof up?i:void 0),{target:i,type:"get",key:"value"}))}function Zn(i,e=4,t){i=ue(i);const s=i.dep;s&&Jd(s,e,{target:i,type:"set",key:"value",newValue:t})}function Ze(i){return!!(i&&i.__v_isRef===!0)}function Wy(i){return zy(i,!1)}function zy(i,e){return Ze(i)?i:new Qy(i,e)}class Qy{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:ue(e),this._value=t?e:Xi(e)}get value(){return fp(this),this._value}set value(e){const t=this.__v_isShallow||pr(e)||vi(e);e=t?e:ue(e),ms(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:Xi(e),Zn(this,4,e))}}function hp(i){return Ze(i)?i.value:i}const Yy={get:(i,e,t)=>hp(Reflect.get(i,e,t)),set:(i,e,t,s)=>{const n=i[e];return Ze(n)&&!Ze(t)?(n.value=t,!0):Reflect.set(i,e,t,s)}};function dp(i){return fi(i)?i:new Proxy(i,Yy)}const Bs=[];function nc(i){Bs.push(i)}function rc(){Bs.pop()}function J(i,...e){Vs();const t=Bs.length?Bs[Bs.length-1].component:null,s=t&&t.appContext.config.warnHandler,n=Xy();if(s)Wt(s,t,11,[i+e.map(r=>{var o,a;return(a=(o=r.toString)==null?void 0:o.call(r))!=null?a:JSON.stringify(r)}).join(""),t&&t.proxy,n.map(({vnode:r})=>`at <${Jr(t,r.type)}>`).join(`
- `),n]);else{const r=[`[Vue warn]: ${i}`,...e];n.length&&r.push(`
- `,...Jy(n)),console.warn(...r)}js()}function Xy(){let i=Bs[Bs.length-1];if(!i)return[];const e=[];for(;i;){const t=e[0];t&&t.vnode===i?t.recurseCount++:e.push({vnode:i,recurseCount:0});const s=i.component&&i.component.parent;i=s&&s.vnode}return e}function Jy(i){const e=[];return i.forEach((t,s)=>{e.push(...s===0?[]:[`
- `],...Zy(t))}),e}function Zy({vnode:i,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",s=i.component?i.component.parent==null:!1,n=` at <${Jr(i.component,i.type,s)}`,r=">"+t;return i.props?[n,...ev(i.props),r]:[n+r]}function ev(i){const e=[],t=Object.keys(i);return t.slice(0,3).forEach(s=>{e.push(...pp(s,i[s]))}),t.length>3&&e.push(" ..."),e}function pp(i,e,t){return Se(e)?(e=JSON.stringify(e),t?e:[`${i}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${i}=${e}`]:Ze(e)?(e=pp(i,ue(e.value),!0),t?e:[`${i}=Ref<`,e,">"]):q(e)?[`${i}=fn${e.name?`<${e.name}>`:""}`]:(e=ue(e),t?e:[`${i}=`,e])}const oc={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."};function Wt(i,e,t,s){try{return s?i(...s):i()}catch(n){Qr(n,e,t)}}function ys(i,e,t,s){if(q(i)){const r=Wt(i,e,t,s);return r&&En(r)&&r.catch(o=>{Qr(o,e,t)}),r}const n=[];for(let r=0;r<i.length;r++)n.push(ys(i[r],e,t,s));return n}function Qr(i,e,t,s=!0){const n=e?e.vnode:null;if(e){let r=e.parent;const o=e.proxy,a=oc[t]||t;for(;r;){const l=r.ec;if(l){for(let u=0;u<l.length;u++)if(l[u](i,o,a)===!1)return}r=r.parent}const c=e.appContext.config.errorHandler;if(c){Wt(c,null,10,[i,o,a]);return}}gp(i,t,n,s)}function gp(i,e,t,s=!0){{const n=oc[e]||e;t&&nc(t),J(`Unhandled error${n?` during execution of ${n}`:""}`),t&&rc(),console.error(i)}}let Ji=!1,Wa=!1;const Ue=[];let wt=0;const hi=[];let Kt=null,is=0;const mp=Promise.resolve();let ac=null;const tv=100;function lc(i){const e=ac||mp;return i?e.then(this?i.bind(this):i):e}function sv(i){let e=wt+1,t=Ue.length;for(;e<t;){const s=e+t>>>1,n=Ue[s],r=Zi(n);r<i||r===i&&n.pre?e=s+1:t=s}return e}function gr(i){(!Ue.length||!Ue.includes(i,Ji&&i.allowRecurse?wt+1:wt))&&(i.id==null?Ue.push(i):Ue.splice(sv(i.id),0,i),xp())}function xp(){!Ji&&!Wa&&(Wa=!0,ac=mp.then(Ep))}function iv(i){return Ue.indexOf(i)>-1}function nv(i){const e=Ue.indexOf(i);e>wt&&Ue.splice(e,1)}function yp(i){te(i)?hi.push(...i):(!Kt||!Kt.includes(i,i.allowRecurse?is+1:is))&&hi.push(i),xp()}function vp(i,e,t=Ji?wt+1:0){for(e=e||new Map;t<Ue.length;t++){const s=Ue[t];if(s&&s.pre){if(cc(e,s))continue;Ue.splice(t,1),t--,s()}}}function rv(i){if(hi.length){const e=[...new Set(hi)].sort((t,s)=>Zi(t)-Zi(s));if(hi.length=0,Kt){Kt.push(...e);return}for(Kt=e,i=i||new Map,is=0;is<Kt.length;is++)cc(i,Kt[is])||Kt[is]();Kt=null,is=0}}const Zi=i=>i.id==null?1/0:i.id,ov=(i,e)=>{const t=Zi(i)-Zi(e);if(t===0){if(i.pre&&!e.pre)return-1;if(e.pre&&!i.pre)return 1}return t};function Ep(i){Wa=!1,Ji=!0,i=i||new Map,Ue.sort(ov);const e=t=>cc(i,t);try{for(wt=0;wt<Ue.length;wt++){const t=Ue[wt];if(t&&t.active!==!1){if(e(t))continue;Wt(t,null,14)}}}finally{wt=0,Ue.length=0,rv(i),Ji=!1,ac=null,(Ue.length||hi.length)&&Ep(i)}}function cc(i,e){if(!i.has(e))i.set(e,1);else{const t=i.get(e);if(t>tv){const s=e.ownerInstance,n=s&&pc(s.type);return Qr(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}else i.set(e,t+1)}}let Pt,Ni=[],za=!1;function Yr(i,...e){Pt?Pt.emit(i,...e):za||Ni.push({event:i,args:e})}function Ap(i,e){var t,s;Pt=i,Pt?(Pt.enabled=!0,Ni.forEach(({event:n,args:r})=>Pt.emit(n,...r)),Ni=[]):typeof window<"u"&&window.HTMLElement&&!((s=(t=window.navigator)==null?void 0:t.userAgent)!=null&&s.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(r=>{Ap(r,e)}),setTimeout(()=>{Pt||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,za=!0,Ni=[])},3e3)):(za=!0,Ni=[])}function av(i,e){Yr("app:init",i,e,{Fragment:Xv,Text:Jv,Comment:Zv,Static:eE})}const lv=uc("component:added"),cv=uc("component:updated"),uv=uc("component:removed"),fv=i=>{Pt&&typeof Pt.cleanupBuffer=="function"&&!Pt.cleanupBuffer(i)&&uv(i)};/*! #__NO_SIDE_EFFECTS__ */function uc(i){return e=>{Yr(i,e.appContext.app,e.uid,e.uid===0?void 0:e.parent?e.parent.uid:0,e)}}const hv=Sp("perf:start"),dv=Sp("perf:end");function Sp(i){return(e,t,s)=>{Yr(i,e.appContext.app,e.uid,e,t,s)}}function pv(i,e,t){Yr("component:emit",i.appContext.app,i,e,t)}function gv(i,e,...t){if(i.isUnmounted)return;const s=i.vnode.props||Le;{const{emitsOptions:u,propsOptions:[f]}=i;if(u)if(!(e in u))(!f||!(bs(e)in f))&&J(`Component emitted event "${e}" but it is neither declared in the emits option nor as an "${bs(e)}" prop.`);else{const h=u[e];q(h)&&(h(...t)||J(`Invalid event arguments: event validation failed for event "${e}".`))}}let n=t;const r=e.startsWith("update:"),o=r&&e.slice(7);if(o&&o in s){const u=`${o==="modelValue"?"model":o}Modifiers`,{number:f,trim:h}=s[u]||Le;h&&(n=t.map(d=>Se(d)?d.trim():d)),f&&(n=t.map(ex))}pv(i,e,n);{const u=e.toLowerCase();u!==e&&s[bs(u)]&&J(`Event "${u}" is emitted in component ${Jr(i,i.type)} but the handler is registered for "${e}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${Ms(e)}" instead of "${e}".`)}let a,c=s[a=bs(e)]||s[a=bs(Nt(e))];!c&&r&&(c=s[a=bs(Ms(e))]),c&&ys(c,i,6,n);const l=s[a+"Once"];if(l){if(!i.emitted)i.emitted={};else if(i.emitted[a])return;i.emitted[a]=!0,ys(l,i,6,n)}}function Tp(i,e,t=!1){const s=e.emitsCache,n=s.get(i);if(n!==void 0)return n;const r=i.emits;let o={},a=!1;if(!q(i)){const c=l=>{const u=Tp(l,e,!0);u&&(a=!0,me(o,u))};!t&&e.mixins.length&&e.mixins.forEach(c),i.extends&&c(i.extends),i.mixins&&i.mixins.forEach(c)}return!r&&!a?(ve(i)&&s.set(i,null),null):(te(r)?r.forEach(c=>o[c]=null):me(o,r),ve(i)&&s.set(i,o),o)}function bp(i,e){return!i||!Xh(e)?!1:(e=e.slice(2).replace(/Once$/,""),se(i,e[0].toLowerCase()+e.slice(1))||se(i,Ms(e))||se(i,e))}let $s=null;function Ku(i){const e=$s;return $s=i,i&&i.type.__scopeId,e}const Qa="components";function mv(i,e){return xv(Qa,i,!0,e)||i}function xv(i,e,t=!0,s=!1){const n=$s||Pe;if(n){const r=n.type;if(i===Qa){const a=pc(r,!1);if(a&&(a===e||a===Nt(e)||a===Ns(Nt(e))))return r}const o=Vu(n[i]||r[i],e)||Vu(n.appContext[i],e);if(!o&&s)return r;if(t&&!o){const a=i===Qa?`
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.`:"";J(`Failed to resolve ${i.slice(0,-1)}: ${e}${a}`)}return o}else J(`resolve${Ns(i.slice(0,-1))} can only be used in render() or setup().`)}function Vu(i,e){return i&&(i[e]||i[Nt(e)]||i[Ns(Nt(e))])}const Pn={};function Ki(i,e,t){return q(e)||J("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),_p(i,e,t)}function _p(i,e,{immediate:t,deep:s,flush:n,once:r,onTrack:o,onTrigger:a}=Le){if(e&&r){const T=e;e=(..._)=>{T(..._),S()}}s!==void 0&&typeof s=="number"&&J('watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.'),e||(t!==void 0&&J('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),s!==void 0&&J('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),r!==void 0&&J('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const c=T=>{J("Invalid watch source: ",T,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},l=Pe,u=T=>s===!0?T:ai(T,s===!1?1:void 0);let f,h=!1,d=!1;if(Ze(i)?(f=()=>i.value,h=pr(i)):fi(i)?(f=()=>u(i),h=!0):te(i)?(d=!0,h=i.some(T=>fi(T)||pr(T)),f=()=>i.map(T=>{if(Ze(T))return T.value;if(fi(T))return u(T);if(q(T))return Wt(T,l,2);c(T)})):q(i)?e?f=()=>Wt(i,l,2):f=()=>(p&&p(),ys(i,l,3,[m])):(f=$e,c(i)),e&&s){const T=f;f=()=>ai(T())}let p,m=T=>{p=x.onStop=()=>{Wt(T,l,4),p=x.onStop=void 0}},g=d?new Array(i.length).fill(Pn):Pn;const y=()=>{if(!(!x.active||!x.dirty))if(e){const T=x.run();(s||h||(d?T.some((_,I)=>ms(_,g[I])):ms(T,g)))&&(p&&p(),ys(e,l,3,[T,g===Pn?void 0:d&&g[0]===Pn?[]:g,m]),g=T)}else x.run()};y.allowRecurse=!!e;let v;n==="sync"?v=y:n==="post"?v=()=>e0(y,l&&l.suspense):(y.pre=!0,l&&(y.id=l.uid),v=()=>gr(y));const x=new Jl(f,$e,v),E=Ty(),S=()=>{x.stop(),E&&$r(E.effects,x)};return x.onTrack=o,x.onTrigger=a,e?t?y():g=x.run():n==="post"?e0(x.run.bind(x),l&&l.suspense):x.run(),S}function yv(i,e,t){const s=this.proxy,n=Se(i)?i.includes(".")?Ip(s,i):()=>s[i]:i.bind(s,s);let r;q(e)?r=e:(r=e.handler,t=e);const o=Sn(this),a=_p(n,r.bind(s),t);return o(),a}function Ip(i,e){const t=e.split(".");return()=>{let s=i;for(let n=0;n<t.length&&s;n++)s=s[t[n]];return s}}function ai(i,e,t=0,s){if(!ve(i)||i.__v_skip)return i;if(e&&e>0){if(t>=e)return i;t++}if(s=s||new Set,s.has(i))return i;if(s.add(i),Ze(i))ai(i.value,e,t,s);else if(te(i))for(let n=0;n<i.length;n++)ai(i[n],e,t,s);else if(Jh(i)||ws(i))i.forEach(n=>{ai(n,e,t,s)});else if(He(i))for(const n in i)ai(i[n],e,t,s);return i}function Cp(i){Ym(i)&&J("Do not use built-in directive ids as custom directive id: "+i)}function Lp(){return{app:null,config:{isNativeTag:zm,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let vv=0;function Ev(i,e){return function(s,n=null){q(s)||(s=me({},s)),n!=null&&!ve(n)&&(J("root props passed to app.mount() must be an object."),n=null);const r=Lp(),o=new WeakSet,a=r.app={_uid:vv++,_component:s,_props:n,_container:null,_context:r,_instance:null,version:$p,get config(){return r.config},set config(c){J("app.config cannot be replaced. Modify individual options instead.")},use(c,...l){return o.has(c)?J("Plugin has already been applied to target app."):c&&q(c.install)?(o.add(c),c.install(a,...l)):q(c)?(o.add(c),c(a,...l)):J('A plugin must either be a function or an object with an "install" function.'),a},mixin(c){return r.mixins.includes(c)?J("Mixin has already been applied to target app"+(c.name?`: ${c.name}`:"")):r.mixins.push(c),a},component(c,l){return sl(c,r.config),l?(r.components[c]&&J(`Component "${c}" has already been registered in target app.`),r.components[c]=l,a):r.components[c]},directive(c,l){return Cp(c),l?(r.directives[c]&&J(`Directive "${c}" has already been registered in target app.`),r.directives[c]=l,a):r.directives[c]},mount(){},unmount(){},provide(c,l){return c in r.provides&&J(`App already provides property with key "${String(c)}". It will be overwritten with the new value.`),r.provides[c]=l,a},runWithContext(c){const l=Vi;Vi=a;try{return c()}finally{Vi=l}}};return a}}let Vi=null;function Av(i,e){if(!Pe)J("provide() can only be used inside setup().");else{let t=Pe.provides;const s=Pe.parent&&Pe.parent.provides;s===t&&(t=Pe.provides=Object.create(s)),t[i]=e,Pe.type.mpType==="app"&&Pe.appContext.app.provide(i,e)}}function er(i,e,t=!1){const s=Pe||$s;if(s||Vi){const n=s?s.parent==null?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:Vi._context.provides;if(n&&i in n)return n[i];if(arguments.length>1)return t&&q(e)?e.call(s&&s.proxy):e;J(`injection "${String(i)}" not found.`)}else J("inject() can only be used inside setup() or functional components.")}const Sv=i=>i.type.__isKeepAlive;function Tv(i,e){Dp(i,"a",e)}function bv(i,e){Dp(i,"da",e)}function Dp(i,e,t=Pe){const s=i.__wdc||(i.__wdc=()=>{let n=t;for(;n;){if(n.isDeactivated)return;n=n.parent}return i()});if(qs(e,s,t),t){let n=t.parent;for(;n&&n.parent;)Sv(n.parent.vnode)&&_v(s,e,t,n),n=n.parent}}function _v(i,e,t,s){const n=qs(e,i,s,!0);Rp(()=>{$r(s[e],n)},t)}function qs(i,e,t=Pe,s=!1){if(t){vx(i)&&(t=t.root);const n=t[i]||(t[i]=[]),r=e.__weh||(e.__weh=(...o)=>{if(t.isUnmounted)return;Vs();const a=Sn(t),c=ys(e,t,i,o);return a(),js(),c});return s?n.unshift(r):n.push(r),r}else{const n=bs((oc[i]||i.replace(/^on/,"")).replace(/ hook$/,""));J(`${n} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().`)}}const zt=i=>(e,t=Pe)=>(!dc||i==="sp")&&qs(i,(...s)=>e(...s),t),Iv=zt("bm"),Cv=zt("m"),Lv=zt("bu"),Dv=zt("u"),fc=zt("bum"),Rp=zt("um"),Rv=zt("sp"),wv=zt("rtg"),Pv=zt("rtc");function kv(i,e=Pe){qs("ec",i,e)}const Ya=i=>i?Mp(i)?Tn(i)||i.proxy:Ya(i.parent):null;function Bv(i){return i}const en=me(Object.create(null),{$:Bv,$el:i=>i.__$el||(i.__$el={}),$data:i=>i.data,$props:i=>oi(i.props),$attrs:i=>oi(i.attrs),$slots:i=>oi(i.slots),$refs:i=>oi(i.refs),$parent:i=>Ya(i.parent),$root:i=>Ya(i.root),$emit:i=>i.emit,$options:i=>kp(i),$forceUpdate:i=>i.f||(i.f=()=>{i.effect.dirty=!0,gr(i.update)}),$watch:i=>yv.bind(i)}),hc=i=>i==="_"||i==="$",fo=(i,e)=>i!==Le&&!i.__isScriptSetup&&se(i,e),wp={get({_:i},e){const{ctx:t,setupState:s,data:n,props:r,accessCache:o,type:a,appContext:c}=i;if(e==="__isVue")return!0;let l;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return s[e];case 2:return n[e];case 4:return t[e];case 3:return r[e]}else{if(fo(s,e))return o[e]=1,s[e];if(n!==Le&&se(n,e))return o[e]=2,n[e];if((l=i.propsOptions[0])&&se(l,e))return o[e]=3,r[e];if(t!==Le&&se(t,e))return o[e]=4,t[e];Xa&&(o[e]=0)}}const u=en[e];let f,h;if(u)return(e==="$attrs"||e==="$slots")&&Qe(i,"get",e),u(i);if((f=a.__cssModules)&&(f=f[e]))return f;if(t!==Le&&se(t,e))return o[e]=4,t[e];if(h=c.config.globalProperties,se(h,e))return h[e];$s&&(!Se(e)||e.indexOf("__v")!==0)&&(n!==Le&&hc(e[0])&&se(n,e)?J(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):i===$s&&J(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))},set({_:i},e,t){const{data:s,setupState:n,ctx:r}=i;return fo(n,e)?(n[e]=t,!0):n.__isScriptSetup&&se(n,e)?(J(`Cannot mutate <script setup> binding "${e}" from Options API.`),!1):s!==Le&&se(s,e)?(s[e]=t,!0):se(i.props,e)?(J(`Attempting to mutate prop "${e}". Props are readonly.`),!1):e[0]==="$"&&e.slice(1)in i?(J(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`),!1):(e in i.appContext.config.globalProperties?Object.defineProperty(r,e,{enumerable:!0,configurable:!0,value:t}):r[e]=t,!0)},has({_:{data:i,setupState:e,accessCache:t,ctx:s,appContext:n,propsOptions:r}},o){let a;return!!t[o]||i!==Le&&se(i,o)||fo(e,o)||(a=r[0])&&se(a,o)||se(s,o)||se(en,o)||se(n.config.globalProperties,o)},defineProperty(i,e,t){return t.get!=null?i._.accessCache[e]=0:se(t,"value")&&this.set(i,e,t.value,null),Reflect.defineProperty(i,e,t)}};wp.ownKeys=i=>(J("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(i));function Fv(i){const e={};return Object.defineProperty(e,"_",{configurable:!0,enumerable:!1,get:()=>i}),Object.keys(en).forEach(t=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get:()=>en[t](i),set:$e})}),e}function Ov(i){const{ctx:e,propsOptions:[t]}=i;t&&Object.keys(t).forEach(s=>{Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>i.props[s],set:$e})})}function Mv(i){const{ctx:e,setupState:t}=i;Object.keys(ue(t)).forEach(s=>{if(!t.__isScriptSetup){if(hc(s[0])){J(`setup() return property ${JSON.stringify(s)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);return}Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>t[s],set:$e})}})}function ju(i){return te(i)?i.reduce((e,t)=>(e[t]=null,e),{}):i}function Nv(){const i=Object.create(null);return(e,t)=>{i[t]?J(`${e} property "${t}" is already defined in ${i[t]}.`):i[t]=e}}let Xa=!0;function Uv(i){const e=kp(i),t=i.proxy,s=i.ctx;Xa=!1,e.beforeCreate&&qu(e.beforeCreate,i,"bc");const{data:n,computed:r,methods:o,watch:a,provide:c,inject:l,created:u,beforeMount:f,mounted:h,beforeUpdate:d,updated:p,activated:m,deactivated:g,beforeDestroy:y,beforeUnmount:v,destroyed:x,unmounted:E,render:S,renderTracked:T,renderTriggered:_,errorCaptured:I,serverPrefetch:R,expose:b,inheritAttrs:L,components:k,directives:M,filters:N}=e,F=Nv();{const[G]=i.propsOptions;if(G)for(const H in G)F("Props",H)}function O(){l&&$v(l,s,F)}if(O(),o)for(const G in o){const H=o[G];q(H)?(Object.defineProperty(s,G,{value:H.bind(t),configurable:!0,enumerable:!0,writable:!0}),F("Methods",G)):J(`Method "${G}" has type "${typeof H}" in the component definition. Did you reference the function correctly?`)}if(n){q(n)||J("The data option must be a function. Plain object usage is no longer supported.");const G=n.call(t,t);if(En(G)&&J("data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>."),!ve(G))J("data() should return an object.");else{i.data=Wr(G);for(const H in G)F("Data",H),hc(H[0])||Object.defineProperty(s,H,{configurable:!0,enumerable:!0,get:()=>G[H],set:$e})}}if(Xa=!0,r)for(const G in r){const H=r[G],C=q(H)?H.bind(t,t):q(H.get)?H.get.bind(t,t):$e;C===$e&&J(`Computed property "${G}" has no getter.`);const D=!q(H)&&q(H.set)?H.set.bind(t):()=>{J(`Write operation failed: computed property "${G}" is readonly.`)},P=Up({get:C,set:D});Object.defineProperty(s,G,{enumerable:!0,configurable:!0,get:()=>P.value,set:w=>P.value=w}),F("Computed",G)}if(a)for(const G in a)Pp(a[G],s,t,G);function K(){if(c){const G=q(c)?c.call(t):c;Reflect.ownKeys(G).forEach(H=>{Av(H,G[H])})}}K(),u&&qu(u,i,"c");function B(G,H){te(H)?H.forEach(C=>G(C.bind(t))):H&&G(H.bind(t))}if(B(Iv,f),B(Cv,h),B(Lv,d),B(Dv,p),B(Tv,m),B(bv,g),B(kv,I),B(Pv,T),B(wv,_),B(fc,v),B(Rp,E),B(Rv,R),te(b))if(b.length){const G=i.exposed||(i.exposed={});b.forEach(H=>{Object.defineProperty(G,H,{get:()=>t[H],set:C=>t[H]=C})})}else i.exposed||(i.exposed={});S&&i.render===$e&&(i.render=S),L!=null&&(i.inheritAttrs=L),k&&(i.components=k),M&&(i.directives=M),i.ctx.$onApplyOptions&&i.ctx.$onApplyOptions(e,i,t)}function $v(i,e,t=$e){te(i)&&(i=Ja(i));for(const s in i){const n=i[s];let r;ve(n)?"default"in n?r=er(n.from||s,n.default,!0):r=er(n.from||s):r=er(n),Ze(r)?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[s]=r,t("Inject",s)}}function qu(i,e,t){ys(te(i)?i.map(s=>s.bind(e.proxy)):i.bind(e.proxy),e,t)}function Pp(i,e,t,s){const n=s.includes(".")?Ip(t,s):()=>t[s];if(Se(i)){const r=e[i];q(r)?Ki(n,r):J(`Invalid watch handler specified by key "${i}"`,r)}else if(q(i))Ki(n,i.bind(t));else if(ve(i))if(te(i))i.forEach(r=>Pp(r,e,t,s));else{const r=q(i.handler)?i.handler.bind(t):e[i.handler];q(r)?Ki(n,r,i):J(`Invalid watch handler specified by key "${i.handler}"`,r)}else J(`Invalid watch option: "${s}"`,i)}function kp(i){const e=i.type,{mixins:t,extends:s}=e,{mixins:n,optionsCache:r,config:{optionMergeStrategies:o}}=i.appContext,a=r.get(e);let c;return a?c=a:!n.length&&!t&&!s?c=e:(c={},n.length&&n.forEach(l=>mr(c,l,o,!0)),mr(c,e,o)),ve(e)&&r.set(e,c),c}function mr(i,e,t,s=!1){const{mixins:n,extends:r}=e;r&&mr(i,r,t,!0),n&&n.forEach(o=>mr(i,o,t,!0));for(const o in e)if(s&&o==="expose")J('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const a=Hv[o]||t&&t[o];i[o]=a?a(i[o],e[o]):e[o]}return i}const Hv={data:Wu,props:zu,emits:zu,methods:Ui,computed:Ui,beforeCreate:Ye,created:Ye,beforeMount:Ye,mounted:Ye,beforeUpdate:Ye,updated:Ye,beforeDestroy:Ye,beforeUnmount:Ye,destroyed:Ye,unmounted:Ye,activated:Ye,deactivated:Ye,errorCaptured:Ye,serverPrefetch:Ye,components:Ui,directives:Ui,watch:Kv,provide:Wu,inject:Gv};function Wu(i,e){return e?i?function(){return me(q(i)?i.call(this,this):i,q(e)?e.call(this,this):e)}:e:i}function Gv(i,e){return Ui(Ja(i),Ja(e))}function Ja(i){if(te(i)){const e={};for(let t=0;t<i.length;t++)e[i[t]]=i[t];return e}return i}function Ye(i,e){return i?[...new Set([].concat(i,e))]:e}function Ui(i,e){return i?me(Object.create(null),i,e):e}function zu(i,e){return i?te(i)&&te(e)?[...new Set([...i,...e])]:me(Object.create(null),ju(i),ju(e??{})):e}function Kv(i,e){if(!i)return e;if(!e)return i;const t=me(Object.create(null),i);for(const s in e)t[s]=Ye(i[s],e[s]);return t}function Vv(i,e,t,s=!1){const n={},r={};i.propsDefaults=Object.create(null),Bp(i,e,n,r);for(const o in i.propsOptions[0])o in n||(n[o]=void 0);Op(e||{},n,i),t?i.props=s?n:Ky(n):i.type.props?i.props=n:i.props=r,i.attrs=r}function jv(i,e,t,s){const{props:n,attrs:r,vnode:{patchFlag:o}}=i,a=ue(n),[c]=i.propsOptions;let l=!1;if(!void 0&&(s||o>0)&&!(o&16)){if(o&8){const u=i.vnode.dynamicProps;for(let f=0;f<u.length;f++){let h=u[f];if(bp(i.emitsOptions,h))continue;const d=e[h];if(c)if(se(r,h))d!==r[h]&&(r[h]=d,l=!0);else{const p=Nt(h);n[p]=Za(c,a,p,d,i,!1)}else d!==r[h]&&(r[h]=d,l=!0)}}}else{Bp(i,e,n,r)&&(l=!0);let u;for(const f in a)(!e||!se(e,f)&&((u=Ms(f))===f||!se(e,u)))&&(c?t&&(t[f]!==void 0||t[u]!==void 0)&&(n[f]=Za(c,a,f,void 0,i,!0)):delete n[f]);if(r!==a)for(const f in r)(!e||!se(e,f))&&(delete r[f],l=!0)}l&&qt(i,"set","$attrs"),Op(e||{},n,i)}function Bp(i,e,t,s){const[n,r]=i.propsOptions;let o=!1,a;if(e)for(let c in e){if(ed(c))continue;const l=e[c];let u;n&&se(n,u=Nt(c))?!r||!r.includes(u)?t[u]=l:(a||(a={}))[u]=l:bp(i.emitsOptions,c)||(!(c in s)||l!==s[c])&&(s[c]=l,o=!0)}if(r){const c=ue(t),l=a||Le;for(let u=0;u<r.length;u++){const f=r[u];t[f]=Za(n,c,f,l[f],i,!se(l,f))}}return o}function Za(i,e,t,s,n,r){const o=i[t];if(o!=null){const a=se(o,"default");if(a&&s===void 0){const c=o.default;if(o.type!==Function&&!o.skipFactory&&q(c)){const{propsDefaults:l}=n;if(t in l)s=l[t];else{const u=Sn(n);s=l[t]=c.call(null,e),u()}}else s=c}o[0]&&(r&&!a?s=!1:o[1]&&(s===""||s===Ms(t))&&(s=!0))}return s}function Fp(i,e,t=!1){const s=e.propsCache,n=s.get(i);if(n)return n;const r=i.props,o={},a=[];let c=!1;if(!q(i)){const u=f=>{c=!0;const[h,d]=Fp(f,e,!0);me(o,h),d&&a.push(...d)};!t&&e.mixins.length&&e.mixins.forEach(u),i.extends&&u(i.extends),i.mixins&&i.mixins.forEach(u)}if(!r&&!c)return ve(i)&&s.set(i,yu),yu;if(te(r))for(let u=0;u<r.length;u++){Se(r[u])||J("props must be strings when using array syntax.",r[u]);const f=Nt(r[u]);Qu(f)&&(o[f]=Le)}else if(r){ve(r)||J("invalid props options",r);for(const u in r){const f=Nt(u);if(Qu(f)){const h=r[u],d=o[f]=te(h)||q(h)?{type:h}:me({},h);if(d){const p=Xu(Boolean,d.type),m=Xu(String,d.type);d[0]=p>-1,d[1]=m<0||p<m,(p>-1||se(d,"default"))&&a.push(f)}}}}const l=[o,a];return ve(i)&&s.set(i,l),l}function Qu(i){return i[0]!=="$"&&!ed(i)?!0:(J(`Invalid prop name: "${i}" is a reserved property.`),!1)}function el(i){return i===null?"null":typeof i=="function"?i.name||"":typeof i=="object"&&i.constructor&&i.constructor.name||""}function Yu(i,e){return el(i)===el(e)}function Xu(i,e){return te(e)?e.findIndex(t=>Yu(t,i)):q(e)&&Yu(e,i)?0:-1}function Op(i,e,t){const s=ue(e),n=t.propsOptions[0];for(const r in n){let o=n[r];o!=null&&qv(r,s[r],o,oi(s),!se(i,r)&&!se(i,Ms(r)))}}function qv(i,e,t,s,n){const{type:r,required:o,validator:a,skipCheck:c}=t;if(o&&n){J('Missing required prop: "'+i+'"');return}if(!(e==null&&!o)){if(r!=null&&r!==!0&&!c){let l=!1;const u=te(r)?r:[r],f=[];for(let h=0;h<u.length&&!l;h++){const{valid:d,expectedType:p}=zv(e,u[h]);f.push(p||""),l=d}if(!l){J(Qv(i,e,f));return}}a&&!a(e,s)&&J('Invalid prop: custom validator check failed for prop "'+i+'".')}}const Wv=_i("String,Number,Boolean,Function,Symbol,BigInt");function zv(i,e){let t;const s=el(e);if(Wv(s)){const n=typeof i;t=n===s.toLowerCase(),!t&&n==="object"&&(t=i instanceof e)}else s==="Object"?t=ve(i):s==="Array"?t=te(i):s==="null"?t=i===null:t=i instanceof e;return{valid:t,expectedType:s}}function Qv(i,e,t){if(t.length===0)return`Prop type [] for prop "${i}" won't match anything. Did you mean to use type Array instead?`;let s=`Invalid prop: type check failed for prop "${i}". Expected ${t.map(Ns).join(" | ")}`;const n=t[0],r=Hr(e),o=Ju(e,n),a=Ju(e,r);return t.length===1&&Zu(n)&&!Yv(n,r)&&(s+=` with value ${o}`),s+=`, got ${r} `,Zu(r)&&(s+=`with value ${a}.`),s}function Ju(i,e){return e==="String"?`"${i}"`:e==="Number"?`${Number(i)}`:`${i}`}function Zu(i){return["string","number","boolean"].some(t=>i.toLowerCase()===t)}function Yv(...i){return i.some(e=>e.toLowerCase()==="boolean")}let ki,os;function xr(i,e){i.appContext.config.performance&&vr()&&os.mark(`vue-${e}-${i.uid}`),hv(i,e,vr()?os.now():Date.now())}function yr(i,e){if(i.appContext.config.performance&&vr()){const t=`vue-${e}-${i.uid}`,s=t+":end";os.mark(s),os.measure(`<${Jr(i,i.type)}> ${e}`,t,s),os.clearMarks(t),os.clearMarks(s)}dv(i,e,vr()?os.now():Date.now())}function vr(){return ki!==void 0||(typeof window<"u"&&window.performance?(ki=!0,os=window.performance):ki=!1),ki}const e0=yp,Xv=Symbol.for("v-fgt"),Jv=Symbol.for("v-txt"),Zv=Symbol.for("v-cmt"),eE=Symbol.for("v-stc");function tE(i){return i?i.__v_isVNode===!0:!1}const sE="__vInternal";function iE(i){return i?Vy(i)||sE in i?me({},i):i:null}const nE=Lp();let rE=0;function oE(i,e,t){const s=i.type,n=(e?e.appContext:i.appContext)||nE,r={uid:rE++,vnode:i,type:s,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,scope:new zd(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Fp(s,n),emitsOptions:Tp(s,n),emit:null,emitted:null,propsDefaults:Le,inheritAttrs:s.inheritAttrs,ctx:Le,data:Le,props:Le,attrs:Le,slots:Le,refs:Le,setupState:Le,setupContext:null,attrsProxy:null,slotsProxy:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null,$uniElements:new Map,$templateUniElementRefs:[],$templateUniElementStyles:{},$eS:{},$eA:{}};return r.ctx=Fv(r),r.root=e?e.root:r,r.emit=gv.bind(null,r),i.ce&&i.ce(r),r}let Pe=null;const Xr=()=>Pe||$s;let Er,tl;Er=i=>{Pe=i},tl=i=>{dc=i};const Sn=i=>{const e=Pe;return Er(i),i.scope.on(),()=>{i.scope.off(),Er(e)}},t0=()=>{Pe&&Pe.scope.off(),Er(null)},aE=_i("slot,component");function sl(i,{isNativeTag:e}){(aE(i)||e(i))&&J("Do not use built-in or reserved HTML elements as component id: "+i)}function Mp(i){return i.vnode.shapeFlag&4}let dc=!1;function lE(i,e=!1){e&&tl(e);const{props:t}=i.vnode,s=Mp(i);Vv(i,t,s,e);const n=s?cE(i,e):void 0;return e&&tl(!1),n}function cE(i,e){const t=i.type;{if(t.name&&sl(t.name,i.appContext.config),t.components){const n=Object.keys(t.components);for(let r=0;r<n.length;r++)sl(n[r],i.appContext.config)}if(t.directives){const n=Object.keys(t.directives);for(let r=0;r<n.length;r++)Cp(n[r])}t.compilerOptions&&hE()&&J('"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.')}i.accessCache=Object.create(null),i.proxy=sc(new Proxy(i.ctx,wp)),Ov(i);const{setup:s}=t;if(s){const n=i.setupContext=s.length>1?gE(i):null,r=Sn(i);Vs();const o=Wt(s,i,0,[oi(i.props),n]);js(),r(),En(o)?(o.then(t0,t0),J("setup() returned a Promise, but the version of Vue you are using does not support it yet.")):uE(i,o,e)}else Np(i,e)}function uE(i,e,t){q(e)?i.render=e:ve(e)?(tE(e)&&J("setup() should not return VNodes directly - return a render function instead."),i.devtoolsRawSetupState=e,i.setupState=dp(e),Mv(i)):e!==void 0&&J(`setup() should return an object. Received: ${e===null?"null":typeof e}`),Np(i,t)}let fE;const hE=()=>!fE;function Np(i,e,t){const s=i.type;i.render||(i.render=s.render||$e);{const n=Sn(i);Vs();try{Uv(i)}finally{js(),n()}}!s.render&&i.render===$e&&!e&&(s.template?J('Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".'):J("Component is missing template or render function."))}function dE(i){return i.attrsProxy||(i.attrsProxy=new Proxy(i.attrs,{get(e,t){return Qe(i,"get","$attrs"),e[t]},set(){return J("setupContext.attrs is readonly."),!1},deleteProperty(){return J("setupContext.attrs is readonly."),!1}}))}function pE(i){return i.slotsProxy||(i.slotsProxy=new Proxy(i.slots,{get(e,t){return Qe(i,"get","$slots"),e[t]}}))}function gE(i){return Object.freeze({get attrs(){return dE(i)},get slots(){return pE(i)},get emit(){return(t,...s)=>i.emit(t,...s)},expose:t=>{if(i.exposed&&J("expose() should be called only once per setup()."),t!=null){let s=typeof t;s==="object"&&(te(t)?s="array":Ze(t)&&(s="ref")),s!=="object"&&J(`expose() should be passed a plain object, received ${s}.`)}i.exposed=t||{}}})}function Tn(i){if(i.exposed)return i.exposeProxy||(i.exposeProxy=new Proxy(dp(sc(i.exposed)),{get(e,t){return t in e?e[t]:i.proxy[t]},has(e,t){return t in e||t in en}}))}const mE=/(?:^|[-_])(\w)/g,xE=i=>i.replace(mE,e=>e.toUpperCase()).replace(/[-_]/g,"");function pc(i,e=!0){return q(i)?i.displayName||i.name:i.name||e&&i.__name}function Jr(i,e,t=!1){let s=pc(e);if(!s&&e.__file){const n=e.__file.match(/([^/\\]+)\.\w+$/);n&&(s=n[1])}if(!s&&i&&i.parent){const n=r=>{for(const o in r)if(r[o]===e)return o};s=n(i.components||i.parent.type.components)||n(i.appContext.components)}return s?xE(s):t?"App":"Anonymous"}const Up=(i,e)=>{const t=qy(i,e,dc);{const s=Xr();s&&s.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t},$p="3.4.21",gc=J;function Ar(i){return hp(i)}const Is="[object Array]",Cs="[object Object]";function Hp(i,e){const t={};return il(i,e),tr(i,e,"",t),t}function il(i,e){if(i=Ar(i),i===e)return;const t=kt(i),s=kt(e);if(t==Cs&&s==Cs)for(let n in e){const r=i[n];r===void 0?i[n]=null:il(r,e[n])}else t==Is&&s==Is&&i.length>=e.length&&e.forEach((n,r)=>{il(i[r],n)})}function tr(i,e,t,s){if(i=Ar(i),i===e)return;const n=kt(i),r=kt(e);if(n==Cs)if(r!=Cs||Object.keys(i).length<Object.keys(e).length)Zt(s,t,i);else for(let o in i){const a=Ar(i[o]),c=e[o],l=kt(a),u=kt(c);if(l!=Is&&l!=Cs)a!=c&&Zt(s,(t==""?"":t+".")+o,a);else if(l==Is)u!=Is||a.length<c.length?Zt(s,(t==""?"":t+".")+o,a):a.forEach((f,h)=>{tr(f,c[h],(t==""?"":t+".")+o+"["+h+"]",s)});else if(l==Cs)if(u!=Cs||Object.keys(a).length<Object.keys(c).length)Zt(s,(t==""?"":t+".")+o,a);else for(let f in a)tr(a[f],c[f],(t==""?"":t+".")+o+"."+f,s)}else n==Is?r!=Is||i.length<e.length?Zt(s,t,i):i.forEach((o,a)=>{tr(o,e[a],t+"["+a+"]",s)}):Zt(s,t,i)}function Zt(i,e,t){i[e]=t}function yE(i){return Ue.includes(i.update)}function s0(i){const t=i.ctx.__next_tick_callbacks;if(t&&t.length){const s=t.slice(0);t.length=0;for(let n=0;n<s.length;n++)s[n]()}}function nl(i,e){const t=i.ctx;if(!t.__next_tick_pending&&!yE(i))return lc(e&&e.bind(i.proxy));let s;return t.__next_tick_callbacks||(t.__next_tick_callbacks=[]),t.__next_tick_callbacks.push(()=>{e?Wt(e.bind(i.proxy),i,14):s&&s(i.proxy)}),new Promise(n=>{s=n})}function rl(i,e){i=Ar(i);const t=typeof i;if(t==="object"&&i!==null){let s=e.get(i);if(typeof s<"u")return s;if(te(i)){const n=i.length;s=new Array(n),e.set(i,s);for(let r=0;r<n;r++)s[r]=rl(i[r],e)}else{s={},e.set(i,s);for(const n in i)se(i,n)&&(s[n]=rl(i[n],e))}return s}if(t!=="symbol")return i}function vE(i){return rl(i,typeof WeakMap<"u"?new WeakMap:new Map)}function EE(i,e){const t=i.data,s=Object.create(null);return e.forEach(n=>{s[n]=t[n]}),s}function i0(i,e,t){if(!e)return;e=vE(e),e.$eS=i.$eS||{},e.$eA=i.$eA||{};const s=i.ctx,n=s.mpType;if(n==="page"||n==="component"){e.r0=1;const r=s.$scope,o=Object.keys(e),a=Hp(e,t||EE(r,o));Object.keys(a).length?(s.__next_tick_pending=!0,r.setData(a,()=>{s.__next_tick_pending=!1,s0(i)}),vp()):s0(i)}}function AE(i){i.globalProperties.$nextTick=function(t){return nl(this.$,t)}}function SE(i,e,t){e.appContext.config.globalProperties.$applyOptions(i,e,t);const s=i.computed;if(s){const n=Object.keys(s);if(n.length){const r=e.ctx;r.$computedKeys||(r.$computedKeys=[]),r.$computedKeys.push(...n)}}delete e.ctx.$onApplyOptions}function Gp(i,e=!1){const{setupState:t,$templateRefs:s,$templateUniElementRefs:n,ctx:{$scope:r,$mpPlatform:o}}=i;if(o==="mp-alipay"||!r||!s&&!n)return;if(e){s&&s.forEach(u=>Bi(u,null,t)),n&&n.forEach(u=>Bi(u,null,t));return}const a=o==="mp-baidu"||o==="mp-toutiao",c=u=>{if(u.length===0)return[];const f=(r.selectAllComponents(".r")||[]).concat(r.selectAllComponents(".r-i-f")||[]);return u.filter(h=>{const d=bE(f,h.i);return a&&d===null?!0:(Bi(h,d,t),!1)})},l=()=>{if(s){const u=c(s);u.length&&i.proxy&&i.proxy.$scope&&i.proxy.$scope.setData({r1:1},()=>{c(u)})}};n&&n.length&&nl(i,()=>{n.forEach(u=>{te(u.v)?u.v.forEach(f=>{Bi(u,f,t)}):Bi(u,u.v,t)})}),r._$setRef?r._$setRef(l):nl(i,l)}function TE(i){return ve(i)&&sc(i),i}function bE(i,e){const t=i.find(s=>s&&(s.properties||s.props).uI===e);if(t){const s=t.$vm;return s?Tn(s.$)||s:TE(t)}return null}function Bi({r:i,f:e},t,s){if(q(i))i(t,{});else{const n=Se(i),r=Ze(i);if(n||r)if(e){if(!r)return;te(i.value)||(i.value=[]);const o=i.value;if(o.indexOf(t)===-1){if(o.push(t),!t)return;t.$&&fc(()=>$r(o,t),t.$)}}else n?se(s,i)&&(s[i]=t):Ze(i)?i.value=t:n0(i);else n0(i)}}function n0(i){gc("Invalid template ref type:",i,`(${typeof i})`)}const ol=yp;function r0(i,e){const t=i.component=oE(i,e.parentComponent,null);return t.renderer=e.mpType?e.mpType:"component",t.ctx.$onApplyOptions=SE,t.ctx.$children=[],e.mpType==="app"&&(t.render=$e),e.onBeforeSetup&&e.onBeforeSetup(t,e),nc(i),xr(t,"mount"),xr(t,"init"),lE(t),yr(t,"init"),e.parentComponent&&t.proxy&&e.parentComponent.ctx.$children.push(Tn(t)||t.proxy),LE(t),rc(),yr(t,"mount"),t.proxy}const _E=i=>{let e;for(const t in i)(t==="class"||t==="style"||Xh(t))&&((e||(e={}))[t]=i[t]);return e};function o0(i){const{type:e,vnode:t,proxy:s,withProxy:n,props:r,propsOptions:[o],slots:a,attrs:c,emit:l,render:u,renderCache:f,data:h,setupState:d,ctx:p,uid:m,appContext:{app:{config:{globalProperties:{pruneComponentPropsCache:g}}}},inheritAttrs:y}=i;i.$uniElementIds=new Map,i.$templateRefs=[],i.$templateUniElementRefs=[],i.$templateUniElementStyles={},i.$ei=0,g(m),i.__counter=i.__counter===0?1:0;let v;const x=Ku(i);try{if(t.shapeFlag&4){a0(y,r,o,c);const E=n||s;v=u.call(E,E,f,r,d,h,p)}else{a0(y,r,o,e.props?c:_E(c));const E=e;v=E.length>1?E(r,{attrs:c,slots:a,emit:l}):E(r,null)}}catch(E){Qr(E,i,1),v=!1}return Gp(i),Ku(x),v}function a0(i,e,t,s){if(e&&s&&i!==!1){const n=Object.keys(s).filter(r=>r!=="class"&&r!=="style");if(!n.length)return;t&&n.some(vu)?n.forEach(r=>{(!vu(r)||!(r.slice(9)in t))&&(e[r]=s[r])}):n.forEach(r=>e[r]=s[r])}}const IE=i=>{Vs(),vp(),js()};function CE(){const i=this.$scopedSlotsData;if(!i||i.length===0)return;const e=this.ctx.$scope,t=e.data,s=Object.create(null);i.forEach(({path:n,index:r,data:o})=>{const a=Sd(t,n),c=Se(r)?`${n}.${r}`:`${n}[${r}]`;if(typeof a>"u"||typeof a[r]>"u")s[c]=o;else{const l=Hp(o,a[r]);Object.keys(l).forEach(u=>{s[c+"."+u]=l[u]})}}),i.length=0,Object.keys(s).length&&e.setData(s)}function ho({effect:i,update:e},t){i.allowRecurse=e.allowRecurse=t}function LE(i){const e=CE.bind(i);i.$updateScopedSlots=()=>lc(()=>gr(e));const t=()=>{if(!i.isMounted)fc(()=>{Gp(i,!0)},i),xr(i,"patch"),i0(i,o0(i)),yr(i,"patch"),lv(i);else{const{next:r,bu:o,u:a}=i;nc(r||i.vnode),ho(i,!1),IE(),o&&Xn(o),ho(i,!0),xr(i,"patch"),i0(i,o0(i)),yr(i,"patch"),a&&ol(a),cv(i),rc()}},s=i.effect=new Jl(t,$e,()=>gr(n),i.scope),n=i.update=()=>{s.dirty&&s.run()};n.id=i.uid,ho(i,!0),s.onTrack=i.rtc?r=>Xn(i.rtc,r):void 0,s.onTrigger=i.rtg?r=>Xn(i.rtg,r):void 0,n.ownerInstance=i,n()}function DE(i){const{bum:e,scope:t,update:s,um:n}=i;e&&Xn(e);{const r=i.parent;if(r){const o=r.ctx.$children,a=Tn(i)||i.proxy,c=o.indexOf(a);c>-1&&o.splice(c,1)}}t.stop(),s&&(s.active=!1),n&&ol(n),ol(()=>{i.isUnmounted=!0}),fv(i)}const RE=Ev();function wE(){if(typeof window<"u")return window;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global;if(typeof my<"u")return my}function PE(i,e=null){const t=wE();t.__VUE__=!0,Ap(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const s=RE(i,e),n=s._context;AE(n.config);const r=c=>(c.appContext=n,c.shapeFlag=6,c),o=function(l,u){return r0(r(l),u)},a=function(l){return l&&DE(l.$)};return s.mount=function(){i.render=$e;const l=r0(r({type:i}),{mpType:"app",mpInstance:null,parentComponent:null,slots:[],props:null});return s._instance=l.$,av(s,$p),l.$app=s,l.$createComponent=o,l.$destroyComponent=a,n.$appInstance=l,l},s.unmount=function(){gc("Cannot unmount an app.")},s}function l0(i,e,t,s){q(e)&&qs(i,e.bind(t),s)}function kE(i,e,t){const s=i.mpType||t.$mpType;!s||s==="component"||s==="page"&&e.renderer==="component"||Object.keys(i).forEach(n=>{if(_d(n,i[n],!1)){const r=i[n];te(r)?r.forEach(o=>l0(n,o,t,e)):l0(n,r,t,e)}})}function BE(i,e,t){kE(i,e,t)}function FE(i,e,t){return i[e]=t}function OE(i,...e){const t=this[i];return t?t(...e):(console.error(`method ${i} not found`),null)}function ME(i){const e=i.config.errorHandler;return function(s,n,r){e&&e(s,n,r);const o=i._instance;if(!o||!o.proxy)throw s;o[Us]?o.proxy.$callHook(Us,s):gp(s,r,n?n.$.vnode:null,!1)}}function NE(i,e){return i?[...new Set([].concat(i,e))]:e}function UE(i){bd.forEach(e=>{i[e]=NE})}let al;const kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",$E=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;typeof atob!="function"?al=function(i){if(i=String(i).replace(/[\t\n\f\r ]+/g,""),!$E.test(i))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");i+="==".slice(2-(i.length&3));for(var e,t="",s,n,r=0;r<i.length;)e=kn.indexOf(i.charAt(r++))<<18|kn.indexOf(i.charAt(r++))<<12|(s=kn.indexOf(i.charAt(r++)))<<6|(n=kn.indexOf(i.charAt(r++))),t+=s===64?String.fromCharCode(e>>16&255):n===64?String.fromCharCode(e>>16&255,e>>8&255):String.fromCharCode(e>>16&255,e>>8&255,e&255);return t}:al=atob;function HE(i){return decodeURIComponent(al(i).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))}function po(){const i=X.getStorageSync("uni_id_token")||"",e=i.split(".");if(!i||e.length!==3)return{uid:null,role:[],permission:[],tokenExpired:0};let t;try{t=JSON.parse(HE(e[1]))}catch(s){throw new Error("获取当前用户信息出错,详细错误信息为:"+s.message)}return t.tokenExpired=t.exp*1e3,delete t.exp,delete t.iat,t}function GE(i){i.uniIDHasRole=function(e){const{role:t}=po();return t.indexOf(e)>-1},i.uniIDHasPermission=function(e){const{permission:t}=po();return this.uniIDHasRole("admin")||t.indexOf(e)>-1},i.uniIDTokenValid=function(){const{tokenExpired:e}=po();return e>Date.now()}}function KE(i){const e=i.config;e.errorHandler=Sx(i,ME),UE(e.optionMergeStrategies);const t=e.globalProperties;GE(t),t.$set=FE,t.$applyOptions=BE,t.$callMethod=OE,X.invokeCreateVueAppHook(i)}const tn=Object.create(null);function VE(i){const{uid:e,__counter:t}=Xr(),s=(tn[e]||(tn[e]=[])).push(iE(i))-1;return e+","+s+","+t}function Kp(i){delete tn[i]}function mc(i){if(!i)return;const[e,t]=i.split(",");if(tn[e])return tn[e][parseInt(t)]}var jE={install(i){KE(i),i.config.globalProperties.pruneComponentPropsCache=Kp;const e=i.mount;i.mount=function(s){const n=e.call(i,s),r=qE();return r?r(n):typeof createMiniProgramApp<"u"&&createMiniProgramApp(n),n}}};function qE(){const i="createApp";if(typeof global<"u"&&typeof global[i]<"u")return global[i];if(typeof my<"u")return my[i]}function WE(i){return Se(i)?i:zE(td(i))}function zE(i){let e="";if(!i||Se(i))return e;for(const t in i)e+=`${t.startsWith("--")?t:Ms(t)}:${i[t]};`;return e}function QE(i,e){const t=Xr(),s=t.ctx,n=typeof e<"u"&&(s.$mpPlatform==="mp-weixin"||s.$mpPlatform==="mp-qq"||s.$mpPlatform==="mp-xhs")&&(Se(e)||typeof e=="number")?"_"+e:"",r="e"+t.$ei+++n,o=s.$scope;if(!i)return delete o[r],r;const a=o[r];return a?a.value=i:o[r]=YE(i,t),r}function YE(i,e){const t=s=>{JE(s);let n=[s];e&&e.ctx.$getTriggerEventDetail&&typeof s.detail=="number"&&(s.detail=e.ctx.$getTriggerEventDetail(s.detail)),s.detail&&s.detail.__args__&&(n=s.detail.__args__);const r=t.value,o=()=>ys(ZE(s,r),e,5,n),a=s.target,c=a&&a.dataset?String(a.dataset.eventsync)==="true":!1;if(XE.includes(s.type)&&!c)setTimeout(o);else{const l=o();return s.type==="input"&&(te(l)||En(l))?void 0:l}};return t.value=i,t}const XE=["tap","longpress","longtap","transitionend","animationstart","animationiteration","animationend","touchforcechange"];function JE(i,e){i.type&&i.target&&(i.preventDefault=$e,i.stopPropagation=$e,i.stopImmediatePropagation=$e,se(i,"detail")||(i.detail={}),se(i,"markerId")&&(i.detail=typeof i.detail=="object"?i.detail:{},i.detail.markerId=i.markerId),He(i.detail)&&se(i.detail,"checked")&&!se(i.detail,"value")&&(i.detail.value=i.detail.checked),He(i.detail)&&(i.target=me({},i.target,i.detail)))}function ZE(i,e){if(te(e)){const t=i.stopImmediatePropagation;return i.stopImmediatePropagation=()=>{t&&t.call(i),i._stopped=!0},e.map(s=>n=>!n._stopped&&s(n))}else return e}function e3(i,e){let t;if(te(i)||Se(i)){t=new Array(i.length);for(let s=0,n=i.length;s<n;s++)t[s]=e(i[s],s,s)}else if(typeof i=="number"){if(!Number.isInteger(i))return gc(`The v-for range expect an integer value but got ${i}.`),[];t=new Array(i);for(let s=0;s<i;s++)t[s]=e(s+1,s,s)}else if(ve(i))if(i[Symbol.iterator])t=Array.from(i,(s,n)=>e(s,n,n));else{const s=Object.keys(i);t=new Array(s.length);for(let n=0,r=s.length;n<r;n++){const o=s[n];t[n]=e(i[o],o,n)}}else t=[];return t}function t3(i,e,t={}){const{$templateRefs:s}=Xr();s.push({i:e,r:i,k:t.k,f:t.f})}const s3=(i,e)=>QE(i,e),i3=(i,e)=>e3(i,e),n3=i=>WE(i),r3=(i,...e)=>me(i,...e),o3=i=>sd(i),a3=i=>rx(i),l3=i=>VE(i),c3=(i,e,t)=>t3(i,e,t);function u3(i,e=null){return i&&(i.mpType="app"),PE(i,e).use(jE)}const f3=u3;function h3(i,e){if(!i)return;const t=i.split(","),s=t.length;s===1?e._$vueId=t[0]:s===2&&(e._$vueId=t[0],e._$vuePid=t[1])}const d3=["externalClasses"];function p3(i,e){d3.forEach(t=>{se(e,t)&&(i[t]=e[t])})}const g3=/_(.*)_worklet_factory_/;function m3(i,e){e&&Object.keys(e).forEach(t=>{const s=t.match(g3);if(s){const n=s[1];i[t]=e[t],i[n]=e[n]}})}function x3(i,e){te(e)&&e.forEach(t=>{i[t]=function(s){return this.$vm[t](s)}})}function y3(i,e,t){i.selectAllComponents(e).forEach(n=>{const r=n.properties.uR;t[r]=n.$vm||n})}function v3(i,e){Object.defineProperty(i,"refs",{get(){const t={};return y3(e,".r",t),e.selectAllComponents(".r-i-f").forEach(n=>{const r=n.properties.uR;r&&(t[r]||(t[r]=[]),t[r].push(n.$vm||n))}),t}})}function Vp(i,e){const t=i.$children;for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.$scope._$vueId===e)return r}let s;for(let n=t.length-1;n>=0;n--)if(s=Vp(t[n],e),s)return s}function E3(){var i;let e="";{const t=((i=wx.getAppBaseInfo)===null||i===void 0?void 0:i.call(wx))||wx.getSystemInfoSync(),s=t&&t.language?t.language:Yi;e=Ld(s)||Yi}return e}const A3=["createSelectorQuery","createIntersectionObserver","selectAllComponents","selectComponent"];function S3(i,e){return function(s,...n){const r=e.$scope;if(r&&s){const o={__args__:n};r.triggerEvent(s,o)}return i.apply(this,[s,...n])}}function jp(i,e){const t=i.ctx;t.mpType=e.mpType,t.$mpType=e.mpType,t.$mpPlatform="mp-weixin",t.$scope=e.mpInstance,Object.defineProperties(t,{[Ba]:{get(){const s=this.$scope.data[Ba];return s===void 0?"":s}}}),t.$mp={},t._self={},i.slots={},te(e.slots)&&e.slots.length&&(e.slots.forEach(s=>{i.slots[s]=!0}),i.slots[ox]&&(i.slots.default=!0)),t.getOpenerEventChannel=function(){return e.mpInstance.getOpenerEventChannel()},t.$hasHook=_3,t.$callHook=qp,i.emit=S3(i.emit,t)}function T3(i,e){jp(i,e);const t=i.ctx;A3.forEach(s=>{t[s]=function(...n){const r=t.$scope;if(r&&r[s])return r[s].apply(r,n)}})}function b3(i,e,t){const s=i.ctx;t.forEach(n=>{se(e,n)&&(i[n]=s[n]=e[n])})}function _3(i){const e=this.$[i];return!!(e&&e.length)}function qp(i,e){i==="mounted"&&(qp.call(this,"bm"),this.$.isMounted=!0,i="m");const t=this.$[i];return t&&dx(t,e)}const I3=[An,Kr,Vr,Wl,ud,zl,Ql,Yl,Xl];function ll(i,e=new Set){if(i){Object.keys(i).forEach(t=>{_d(t,i[t])&&e.add(t)});{const{extends:t,mixins:s}=i;s&&s.forEach(n=>ll(n,e)),t&&ll(t,e)}}return e}function xc(i,e,t){t.indexOf(e)===-1&&!se(i,e)&&(i[e]=function(s){return this.$vm&&this.$vm.$callHook(e,s)})}const Wp=[ql];function yc(i,e,t=Wp){e.forEach(s=>xc(i,s,t))}function zp(i,e,t=Wp){ll(e).forEach(s=>xc(i,s,t))}function C3(i,e){if(!e)return;Object.keys(Fa).forEach(s=>{e&Fa[s]&&xc(i,s,[])})}const L3=Ad(()=>{const i=[],e=q(getApp)&&getApp({allowDefault:!0});if(e&&e.$vm&&e.$vm.$){const t=e.$vm.$.appContext.mixins;if(te(t)){const s=Object.keys(Fa);t.forEach(n=>{s.forEach(r=>{se(n,r)&&!i.includes(r)&&i.push(r)})})}}return i});function D3(i){yc(i,L3())}const R3=[Kr,Vr,Us,rd,od,ad];function vc(i,e){const t=i.$,s={globalData:i.$options&&i.$options.globalData||{},$vm:i,onLaunch(o){this.$vm=i;const a=t.ctx;this.$vm&&a.$scope&&a.$callHook||(jp(t,{mpType:"app",mpInstance:this,slots:[]}),a.globalData=this.globalData,i.$callHook(nd,o))}},n=wx.$onErrorHandlers;n&&(n.forEach(o=>{qs(Us,o,t)}),n.length=0),k3(i);const r=i.$.type;yc(s,R3),zp(s,r);{const o=r.methods;o&&me(s,o)}return s}function w3(i){return function(t){return App(vc(t))}}function P3(i){return function(t){const s=vc(t),n=q(getApp)&&getApp({allowDefault:!0});if(!n)return;t.$.ctx.$scope=n;const r=n.globalData;r&&Object.keys(s.globalData).forEach(o=>{se(r,o)||(r[o]=s.globalData[o])}),Object.keys(s).forEach(o=>{se(n,o)||(n[o]=s[o])}),Qp(s,t)}}function Qp(i,e){if(q(i.onLaunch)){const t=wx.getLaunchOptionsSync&&wx.getLaunchOptionsSync();i.onLaunch(t)}q(i.onShow)&&wx.onAppShow&&wx.onAppShow(t=>{e.$callHook("onShow",t)}),q(i.onHide)&&wx.onAppHide&&wx.onAppHide(t=>{e.$callHook("onHide",t)})}function k3(i){const e=Wy(E3());Object.defineProperty(i,"$locale",{get(){return e.value},set(t){e.value=t}})}const Yp=["eO","uR","uRIF","uI","uT","uP","uS"];function B3(i,e=!1){const t={};if(!e){let s=function(n){const r=Object.create(null);n&&n.forEach(o=>{r[o]=!0}),this.setData({$slots:r})};Yp.forEach(n=>{t[n]={type:null,value:""}}),t.uS={type:null,value:[]},t.uS.observer=s}return i.behaviors&&i.behaviors.includes("wx://form-field")&&((!i.properties||!i.properties.name)&&(t.name={type:null,value:""}),(!i.properties||!i.properties.value)&&(t.value={type:null,value:""})),t}function F3(i){const e={};return i&&i.virtualHost&&(e[lx]={type:null,value:""},e[cx]={type:null,value:""},e[ux]={type:null,value:""},e[Ba]={type:null,value:""}),e}function Xp(i){i.properties||(i.properties={}),me(i.properties,B3(i),F3(i.options))}const O3=[String,Number,Boolean,Object,Array,null];function M3(i,e){return te(i)&&i.length===1?i[0]:i}function c0(i,e){const t=M3(i);return O3.indexOf(t)!==-1?t:null}function N3({properties:i},e){te(e)?e.forEach(t=>{i[t]={type:String,value:""}}):He(e)&&Object.keys(e).forEach(t=>{const s=e[t];if(He(s)){let n=s.default;q(n)&&(n=n());const r=s.type;s.type=c0(r),i[t]={type:s.type,value:n}}else i[t]={type:c0(s)}})}function U3(i,e){return(e?$3(i):mc(i.uP))||{}}function $3(i){const e={};return He(i)&&Object.keys(i).forEach(t=>{Yp.indexOf(t)===-1&&(e[t]=i[t])}),e}function H3(i){const e=i.$options;te(e.behaviors)&&e.behaviors.includes("uni://form-field")&&i.$watch("modelValue",()=>{i.$scope&&i.$scope.setData({name:i.name,value:i.modelValue})},{immediate:!0})}function G3(i){return{}}function Jp(i){const e=function(){const s=this.properties.uP;s&&(this.$vm?V3(s,this.$vm.$):this.properties.uT==="m"&&K3(s,this))};i.observers||(i.observers={}),i.observers.uP=e}function K3(i,e){const t=e.properties,s=mc(i)||{};Zp(t,s,!1)&&e.setData(s)}function V3(i,e){const t=ue(e.props),s=mc(i)||{};Zp(t,s)&&(jv(e,s,t,!1),iv(e.update)&&nv(e.update),e.update())}function Zp(i,e,t=!0){const s=Object.keys(e);if(t&&s.length!==Object.keys(i).length)return!0;for(let n=0;n<s.length;n++){const r=s[n];if(e[r]!==i[r])return!0}return!1}function j3(i){const e=i.behaviors;let t=i.props;t||(i.props=t=[]);const s=[];return te(e)&&e.forEach(n=>{s.push(n.replace("uni://","wx://")),n==="uni://form-field"&&(te(t)?(t.push("name"),t.push("modelValue")):(t.name={type:String,default:""},t.modelValue={type:[String,Number,Boolean,Array,Object,Date],default:""}))}),s}function q3(i,e){i.data=G3(),i.behaviors=j3(e)}function eg(i,{parse:e,mocks:t,isPage:s,isPageInProject:n,initRelation:r,handleLink:o,initLifetimes:a}){i=i.default||i;const c={multipleSlots:!0,addGlobalClass:!0,pureDataPattern:/^uP$/};te(i.mixins)&&i.mixins.forEach(u=>{ve(u.options)&&me(c,u.options)}),i.options&&me(c,i.options);const l={options:c,lifetimes:a({mocks:t,isPage:s,initRelation:r,vueOptions:i}),pageLifetimes:{show(){this.$vm&&this.$vm.$callHook("onPageShow")},hide(){this.$vm&&this.$vm.$callHook("onPageHide")},resize(u){this.$vm&&this.$vm.$callHook("onPageResize",u)}},methods:{__l:o}};return q3(l,i),Xp(l),Jp(l),p3(l,i),x3(l.methods,i.wxsCallMethods),m3(l.methods,i.methods),e&&e(l,{handleLink:o}),l}function W3(i){return function(t){return Component(eg(t,i))}}let go,mo;function tg(){return getApp().$vm}function z3(i,e){go||(go=tg().$createComponent);const t=go(i,e);return Tn(t.$)||t}function Q3(i){return mo||(mo=tg().$destroyComponent),mo(i)}function Y3(i,e){const{parse:t,mocks:s,isPage:n,initRelation:r,handleLink:o,initLifetimes:a}=e,c=eg(i,{mocks:s,isPage:n,isPageInProject:!0,initRelation:r,handleLink:o,initLifetimes:a});N3(c,(i.default||i).props);const l=c.methods;return l.onLoad=function(u){return this.options=u,this.$page={fullPath:hx(this.route+xx(u))},this.$vm&&this.$vm.$callHook(An,u)},yc(l,I3),zp(l,i),C3(l,i.__runtimeHooks),D3(l),t&&t(c,{handleLink:o}),c}function X3(i){return function(t){return Component(Y3(t,i))}}function J3(i){return function(t){Qp(vc(t),t)}}const Z3=Page,e4=Component;function u0(i){const e=i.triggerEvent,t=function(s,...n){return e.apply(i,[gx(s),...n])};try{i.triggerEvent=t}catch{i._triggerEvent=t}}function sg(i,e,t){const s=e[i];s?e[i]=function(...n){return u0(this),s.apply(this,n)}:e[i]=function(){u0(this)}}Page=function(i){return sg(An,i),Z3(i)};Component=function(i){return sg("created",i),i.properties&&i.properties.uP||(Xp(i),Jp(i)),e4(i)};function t4({mocks:i,isPage:e,initRelation:t,vueOptions:s}){return{attached(){let n=this.properties;h3(n.uI,this);const r={vuePid:this._$vuePid};t(this,r);const o=this,a=e(o);let c=n;this.$vm=z3({type:s,props:U3(c,a)},{mpType:a?"page":"component",mpInstance:o,slots:n.uS||{},parentComponent:r.parent&&r.parent.$,onBeforeSetup(l,u){v3(l,o),b3(l,o,i),T3(l,u)}}),a||H3(this.$vm)},ready(){this.$vm&&(this.$vm.$callHook("mounted"),this.$vm.$callHook(ql))},detached(){this.$vm&&(Kp(this.$vm.$.uid),Q3(this.$vm))}}}const s4=["__route__","__wxExparserNodeId__","__wxWebviewId__"];function i4(i){return!!i.route}function n4(i,e){i.triggerEvent("__l",e)}function r4(i){const e=i.detail||i.value,t=e.vuePid;let s;t&&(s=Vp(this.$vm,t)),s||(s=this.$vm),e.parent=s}var ig=Object.freeze({__proto__:null,handleLink:r4,initLifetimes:t4,initRelation:n4,isPage:i4,mocks:s4});const o4=w3(),a4=X3(ig),l4=W3(ig),c4=J3(),u4=P3();wx.createApp=global.createApp=o4,wx.createPage=a4,wx.createComponent=l4,wx.createPluginApp=global.createPluginApp=c4,wx.createSubpackageApp=global.createSubpackageApp=u4;/*!
- * vuex v4.1.0
- * (c) 2022 Evan You
- * @license MIT
- */var ng="store";function f4(i){return i===void 0&&(i=null),er(i!==null?i:ng)}function Ws(i,e){Object.keys(i).forEach(function(t){return e(i[t],t)})}function h4(i){return i!==null&&typeof i=="object"}function d4(i){return i&&typeof i.then=="function"}function _t(i,e){if(!i)throw new Error("[vuex] "+e)}function p4(i,e){return function(){return i(e)}}function rg(i,e,t){return e.indexOf(i)<0&&(t&&t.prepend?e.unshift(i):e.push(i)),function(){var s=e.indexOf(i);s>-1&&e.splice(s,1)}}function og(i,e){i._actions=Object.create(null),i._mutations=Object.create(null),i._wrappedGetters=Object.create(null),i._modulesNamespaceMap=Object.create(null);var t=i.state;Zr(i,t,[],i._modules.root,!0),Ec(i,t,e)}function Ec(i,e,t){var s=i._state,n=i._scope;i.getters={},i._makeLocalGettersCache=Object.create(null);var r=i._wrappedGetters,o={},a={},c=Ay(!0);c.run(function(){Ws(r,function(l,u){o[u]=p4(l,i),a[u]=Up(function(){return o[u]()}),Object.defineProperty(i.getters,u,{get:function(){return a[u].value},enumerable:!0})})}),i._state=Wr({data:e}),i._scope=c,i.strict&&E4(i),s&&t&&i._withCommit(function(){s.data=null}),n&&n.stop()}function Zr(i,e,t,s,n){var r=!t.length,o=i._modules.getNamespace(t);if(s.namespaced&&(i._modulesNamespaceMap[o]&&console.error("[vuex] duplicate namespace "+o+" for the namespaced module "+t.join("/")),i._modulesNamespaceMap[o]=s),!r&&!n){var a=Ac(e,t.slice(0,-1)),c=t[t.length-1];i._withCommit(function(){c in a&&console.warn('[vuex] state field "'+c+'" was overridden by a module with the same name at "'+t.join(".")+'"'),a[c]=s.state})}var l=s.context=g4(i,o,t);s.forEachMutation(function(u,f){var h=o+f;x4(i,h,u,l)}),s.forEachAction(function(u,f){var h=u.root?f:o+f,d=u.handler||u;y4(i,h,d,l)}),s.forEachGetter(function(u,f){var h=o+f;v4(i,h,u,l)}),s.forEachChild(function(u,f){Zr(i,e,t.concat(f),u,n)})}function g4(i,e,t){var s=e==="",n={dispatch:s?i.dispatch:function(r,o,a){var c=Sr(r,o,a),l=c.payload,u=c.options,f=c.type;if((!u||!u.root)&&(f=e+f,!i._actions[f])){console.error("[vuex] unknown local action type: "+c.type+", global type: "+f);return}return i.dispatch(f,l)},commit:s?i.commit:function(r,o,a){var c=Sr(r,o,a),l=c.payload,u=c.options,f=c.type;if((!u||!u.root)&&(f=e+f,!i._mutations[f])){console.error("[vuex] unknown local mutation type: "+c.type+", global type: "+f);return}i.commit(f,l,u)}};return Object.defineProperties(n,{getters:{get:s?function(){return i.getters}:function(){return m4(i,e)}},state:{get:function(){return Ac(i.state,t)}}}),n}function m4(i,e){if(!i._makeLocalGettersCache[e]){var t={},s=e.length;Object.keys(i.getters).forEach(function(n){if(n.slice(0,s)===e){var r=n.slice(s);Object.defineProperty(t,r,{get:function(){return i.getters[n]},enumerable:!0})}}),i._makeLocalGettersCache[e]=t}return i._makeLocalGettersCache[e]}function x4(i,e,t,s){var n=i._mutations[e]||(i._mutations[e]=[]);n.push(function(o){t.call(i,s.state,o)})}function y4(i,e,t,s){var n=i._actions[e]||(i._actions[e]=[]);n.push(function(o){var a=t.call(i,{dispatch:s.dispatch,commit:s.commit,getters:s.getters,state:s.state,rootGetters:i.getters,rootState:i.state},o);return d4(a)||(a=Promise.resolve(a)),i._devtoolHook?a.catch(function(c){throw i._devtoolHook.emit("vuex:error",c),c}):a})}function v4(i,e,t,s){if(i._wrappedGetters[e]){console.error("[vuex] duplicate getter key: "+e);return}i._wrappedGetters[e]=function(r){return t(s.state,s.getters,r.state,r.getters)}}function E4(i){Ki(function(){return i._state.data},function(){_t(i._committing,"do not mutate vuex store state outside mutation handlers.")},{deep:!0,flush:"sync"})}function Ac(i,e){return e.reduce(function(t,s){return t[s]},i)}function Sr(i,e,t){return h4(i)&&i.type&&(t=e,e=i,i=i.type),_t(typeof i=="string","expects string as the type, but found "+typeof i+"."),{type:i,payload:e,options:t}}var It=function(e,t){this.runtime=t,this._children=Object.create(null),this._rawModule=e;var s=e.state;this.state=(typeof s=="function"?s():s)||{}},ag={namespaced:{configurable:!0}};ag.namespaced.get=function(){return!!this._rawModule.namespaced};It.prototype.addChild=function(e,t){this._children[e]=t};It.prototype.removeChild=function(e){delete this._children[e]};It.prototype.getChild=function(e){return this._children[e]};It.prototype.hasChild=function(e){return e in this._children};It.prototype.update=function(e){this._rawModule.namespaced=e.namespaced,e.actions&&(this._rawModule.actions=e.actions),e.mutations&&(this._rawModule.mutations=e.mutations),e.getters&&(this._rawModule.getters=e.getters)};It.prototype.forEachChild=function(e){Ws(this._children,e)};It.prototype.forEachGetter=function(e){this._rawModule.getters&&Ws(this._rawModule.getters,e)};It.prototype.forEachAction=function(e){this._rawModule.actions&&Ws(this._rawModule.actions,e)};It.prototype.forEachMutation=function(e){this._rawModule.mutations&&Ws(this._rawModule.mutations,e)};Object.defineProperties(It.prototype,ag);var zs=function(e){this.register([],e,!1)};zs.prototype.get=function(e){return e.reduce(function(t,s){return t.getChild(s)},this.root)};zs.prototype.getNamespace=function(e){var t=this.root;return e.reduce(function(s,n){return t=t.getChild(n),s+(t.namespaced?n+"/":"")},"")};zs.prototype.update=function(e){lg([],this.root,e)};zs.prototype.register=function(e,t,s){var n=this;s===void 0&&(s=!0),cg(e,t);var r=new It(t,s);if(e.length===0)this.root=r;else{var o=this.get(e.slice(0,-1));o.addChild(e[e.length-1],r)}t.modules&&Ws(t.modules,function(a,c){n.register(e.concat(c),a,s)})};zs.prototype.unregister=function(e){var t=this.get(e.slice(0,-1)),s=e[e.length-1],n=t.getChild(s);if(!n){console.warn("[vuex] trying to unregister module '"+s+"', which is not registered");return}n.runtime&&t.removeChild(s)};zs.prototype.isRegistered=function(e){var t=this.get(e.slice(0,-1)),s=e[e.length-1];return t?t.hasChild(s):!1};function lg(i,e,t){if(cg(i,t),e.update(t),t.modules)for(var s in t.modules){if(!e.getChild(s)){console.warn("[vuex] trying to add a new module '"+s+"' on hot reloading, manual reload is needed");return}lg(i.concat(s),e.getChild(s),t.modules[s])}}var f0={assert:function(i){return typeof i=="function"},expected:"function"},A4={assert:function(i){return typeof i=="function"||typeof i=="object"&&typeof i.handler=="function"},expected:'function or object with "handler" function'},h0={getters:f0,mutations:f0,actions:A4};function cg(i,e){Object.keys(h0).forEach(function(t){if(e[t]){var s=h0[t];Ws(e[t],function(n,r){_t(s.assert(n),S4(i,t,r,n,s.expected))})}})}function S4(i,e,t,s,n){var r=e+" should be "+n+' but "'+e+"."+t+'"';return i.length>0&&(r+=' in module "'+i.join(".")+'"'),r+=" is "+JSON.stringify(s)+".",r}function T4(i){return new rt(i)}var rt=function i(e){var t=this;e===void 0&&(e={}),_t(typeof Promise<"u","vuex requires a Promise polyfill in this browser."),_t(this instanceof i,"store must be called with the new operator.");var s=e.plugins;s===void 0&&(s=[]);var n=e.strict;n===void 0&&(n=!1);var r=e.devtools;this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new zs(e),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._makeLocalGettersCache=Object.create(null),this._scope=null,this._devtools=r;var o=this,a=this,c=a.dispatch,l=a.commit;this.dispatch=function(h,d){return c.call(o,h,d)},this.commit=function(h,d,p){return l.call(o,h,d,p)},this.strict=n;var u=this._modules.root.state;Zr(this,u,[],this._modules.root),Ec(this,u),s.forEach(function(f){return f(t)})},Sc={state:{configurable:!0}};rt.prototype.install=function(e,t){e.provide(t||ng,this),e.config.globalProperties.$store=this,this._devtools!==void 0&&this._devtools};Sc.state.get=function(){return this._state.data};Sc.state.set=function(i){_t(!1,"use store.replaceState() to explicit replace store state.")};rt.prototype.commit=function(e,t,s){var n=this,r=Sr(e,t,s),o=r.type,a=r.payload,c=r.options,l={type:o,payload:a},u=this._mutations[o];if(!u){console.error("[vuex] unknown mutation type: "+o);return}this._withCommit(function(){u.forEach(function(h){h(a)})}),this._subscribers.slice().forEach(function(f){return f(l,n.state)}),c&&c.silent&&console.warn("[vuex] mutation type: "+o+". Silent option has been removed. Use the filter functionality in the vue-devtools")};rt.prototype.dispatch=function(e,t){var s=this,n=Sr(e,t),r=n.type,o=n.payload,a={type:r,payload:o},c=this._actions[r];if(!c){console.error("[vuex] unknown action type: "+r);return}try{this._actionSubscribers.slice().filter(function(u){return u.before}).forEach(function(u){return u.before(a,s.state)})}catch(u){console.warn("[vuex] error in before action subscribers: "),console.error(u)}var l=c.length>1?Promise.all(c.map(function(u){return u(o)})):c[0](o);return new Promise(function(u,f){l.then(function(h){try{s._actionSubscribers.filter(function(d){return d.after}).forEach(function(d){return d.after(a,s.state)})}catch(d){console.warn("[vuex] error in after action subscribers: "),console.error(d)}u(h)},function(h){try{s._actionSubscribers.filter(function(d){return d.error}).forEach(function(d){return d.error(a,s.state,h)})}catch(d){console.warn("[vuex] error in error action subscribers: "),console.error(d)}f(h)})})};rt.prototype.subscribe=function(e,t){return rg(e,this._subscribers,t)};rt.prototype.subscribeAction=function(e,t){var s=typeof e=="function"?{before:e}:e;return rg(s,this._actionSubscribers,t)};rt.prototype.watch=function(e,t,s){var n=this;return _t(typeof e=="function","store.watch only accepts a function."),Ki(function(){return e(n.state,n.getters)},t,Object.assign({},s))};rt.prototype.replaceState=function(e){var t=this;this._withCommit(function(){t._state.data=e})};rt.prototype.registerModule=function(e,t,s){s===void 0&&(s={}),typeof e=="string"&&(e=[e]),_t(Array.isArray(e),"module path must be a string or an Array."),_t(e.length>0,"cannot register the root module by using registerModule."),this._modules.register(e,t),Zr(this,this.state,e,this._modules.get(e),s.preserveState),Ec(this,this.state)};rt.prototype.unregisterModule=function(e){var t=this;typeof e=="string"&&(e=[e]),_t(Array.isArray(e),"module path must be a string or an Array."),this._modules.unregister(e),this._withCommit(function(){var s=Ac(t.state,e.slice(0,-1));delete s[e[e.length-1]]}),og(this)};rt.prototype.hasModule=function(e){return typeof e=="string"&&(e=[e]),_t(Array.isArray(e),"module path must be a string or an Array."),this._modules.isRegistered(e)};rt.prototype.hotUpdate=function(e){this._modules.update(e),og(this,!0)};rt.prototype._withCommit=function(e){var t=this._committing;this._committing=!0,e(),this._committing=t};Object.defineProperties(rt.prototype,Sc);const ug=i=>i;function b4(i){return/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(i)}function _4(i){return/^1[23456789]\d{9}$/.test(i)}function I4(i){return/^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/.test(i)}function C4(i){if(!i)return!1;if(typeof i=="number")return i.toString().length!==10&&i.toString().length!==13?!1:!isNaN(new Date(i).getTime());if(typeof i=="string"){const e=Number(i);if(!isNaN(e)&&(e.toString().length===10||e.toString().length===13))return!isNaN(new Date(e).getTime());if(i.length<10||i.length>19||!/^\d{4}[-\/]\d{2}[-\/]\d{2}( \d{1,2}:\d{2}(:\d{2})?)?$/.test(i))return!1;const s=new Date(i);return!isNaN(s.getTime())}return!1}function L4(i){return/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(i)}function Tr(i){return/^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(i)}function D4(i){return typeof i=="string"}function R4(i){return/^\d+$/.test(i)}function w4(i){return/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(i)}function P4(i){const e=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/,t=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;return i.length===7?t.test(i):i.length===8?e.test(i):!1}function k4(i){return/^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(i)}function B4(i){return/^[\u4e00-\u9fa5]+$/gi.test(i)}function F4(i){return/^[a-zA-Z]*$/.test(i)}function O4(i){return/^[0-9a-zA-Z]*$/g.test(i)}function M4(i,e){return i.indexOf(e)>=0}function N4(i,e){return i>=e[0]&&i<=e[1]}function U4(i,e){return i.length>=e[0]&&i.length<=e[1]}function $4(i){return/^\d{3,4}-\d{7,8}(-\d{3,4})?$/.test(i)}function cl(i){switch(typeof i){case"undefined":return!0;case"string":if(i.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g,"").length==0)return!0;break;case"boolean":if(!i)return!0;break;case"number":if(i===0||isNaN(i))return!0;break;case"object":if(i===null||i.length===0)return!0;for(const e in i)return!1;return!0}return!1}function H4(i){if(typeof i=="string")try{const e=JSON.parse(i);return!!(typeof e=="object"&&e)}catch{return!1}return!1}function fg(i){return typeof Array.isArray=="function"?Array.isArray(i):Object.prototype.toString.call(i)==="[object Array]"}function G4(i){return Object.prototype.toString.call(i)==="[object Object]"}function K4(i){return Object.prototype.toString.call(i)==="[object Promise]"}function V4(i,e=6){return new RegExp(`^\\d{${e}}$`).test(i)}function ul(i){return typeof i=="function"}function j4(i){return K4(i)&&ul(i.then)&&ul(i.catch)}function q4(i){const e=i.split("?")[0];return/\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i.test(e)}function W4(i){return/\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i.test(i)}function z4(i){return i&&Object.prototype.toString.call(i)==="[object RegExp]"}const hg={email:b4,mobile:_4,url:I4,date:C4,dateISO:L4,number:Tr,digits:R4,idCard:w4,carNo:P4,amount:k4,chinese:B4,letter:F4,enOrNum:O4,contains:M4,range:N4,rangeLength:U4,empty:cl,isEmpty:cl,jsonString:H4,landline:$4,object:G4,array:fg,code:V4,func:ul,promise:j4,video:W4,image:q4,regExp:z4,string:D4};function dg(i,e=15){return+parseFloat(Number(i).toPrecision(e))}function sn(i){const e=i.toString().split(/[eE]/),t=(e[0].split(".")[1]||"").length-+(e[1]||0);return t>0?t:0}function br(i){if(i.toString().indexOf("e")===-1)return Number(i.toString().replace(".",""));const e=sn(i);return e>0?dg(Number(i)*Math.pow(10,e)):Number(i)}function fl(i){(i>Number.MAX_SAFE_INTEGER||i<Number.MIN_SAFE_INTEGER)&&console.warn(`${i} 超出了精度限制,结果可能不正确`)}function pg(i,e){const[t,s,...n]=i;let r=e(t,s);return n.forEach(o=>{r=e(r,o)}),r}function _r(...i){if(i.length>2)return pg(i,_r);const[e,t]=i,s=br(e),n=br(t),r=sn(e)+sn(t),o=s*n;return fl(o),o/Math.pow(10,r)}function gg(...i){if(i.length>2)return pg(i,gg);const[e,t]=i,s=br(e),n=br(t);return fl(s),fl(n),_r(s/n,dg(Math.pow(10,sn(t)-sn(e))))}function Q4(i,e){const t=Math.pow(10,e);let s=gg(Math.round(Math.abs(_r(i,t))),t);return i<0&&s!==0&&(s=_r(s,-1)),s}const hl="3";console.log(`
- %c uview-plus V${hl} %c https://ijry.github.io/uview-plus/
- `,"color: #ffffff; background: #3c9cff; padding:5px 0;","color: #3c9cff;background: #ffffff; padding:5px 0;");const Qs={v:hl,version:hl,type:["primary","success","info","error","warning"],color:{"u-primary":"#2979ff","u-warning":"#ff9900","u-success":"#19be6b","u-error":"#fa3534","u-info":"#909399","u-main-color":"#303133","u-content-color":"#606266","u-tips-color":"#909399","u-light-color":"#c0c4cc","up-primary":"#2979ff","up-warning":"#ff9900","up-success":"#19be6b","up-error":"#fa3534","up-info":"#909399","up-main-color":"#303133","up-content-color":"#606266","up-tips-color":"#909399","up-light-color":"#c0c4cc"},iconUrl:"https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf",customIcon:{family:"",url:""},customIcons:{},unit:"px",interceptor:{navbarLeftClick:null},loadFontOnce:!1};function Y4(i=0,e=0,t=0){return Math.max(i,Math.min(e,Number(t)))}function X4(i,e=!1){return Tr(i)?e?`${i}px`:Number(i):/(rpx|upx)$/.test(i)?e?`${X.upx2px(parseInt(i))}px`:Number(X.upx2px(parseInt(i))):e?`${parseInt(i)}px`:parseInt(i)}function J4(i=30){return new Promise(e=>{setTimeout(()=>{e()},i)})}function Z4(){return X.getDeviceInfo().platform.toLowerCase()}function mg(){return X.getSystemInfoSync()}function eA(){let i={};return i=mg(),i}function tA(i,e){if(i>=0&&e>0&&e>=i){const t=e-i+1;return Math.floor(Math.random()*t+i)}return 0}function sA(i=32,e=!0,t=null){const s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];if(t=t||s.length,i)for(let r=0;r<i;r++)n[r]=s[0|Math.random()*t];else{let r;n[8]=n[13]=n[18]=n[23]="-",n[14]="4";for(let o=0;o<36;o++)n[o]||(r=0|Math.random()*16,n[o]=s[o==19?r&3|8:r])}return e?(n.shift(),`u${n.join("")}`):n.join("")}function Ir(i=void 0){let e=this.$parent;for(;e;)if(i=i.replace(/up-([a-zA-Z0-9-_]+)/g,"u-$1"),e.$options&&e.$options.name!==i)e=e.$parent;else return e;return!1}function iA(i,e="object"){if(cl(i)||typeof i=="object"&&e==="object"||e==="string"&&typeof i=="string")return i;if(e==="object"){i=$i(i);const s=i.split(";"),n={};for(let r=0;r<s.length;r++)if(s[r]){const o=s[r].split(":");n[$i(o[0])]=$i(o[1])}return n}let t="";return typeof i=="object"&&i.forEach((s,n)=>{const r=n.replace(/([A-Z])/g,"-$1").toLowerCase();t+=`${r}:${s};`}),$i(t)}function nA(i="auto",e=""){return e||(e=Qs.unit||"px"),e=="rpx"&&Tr(String(i))&&(i=i*2),i=String(i),Tr(i)?`${i}${e}`:i}function Tc(i){if([null,void 0,NaN,!1].includes(i)||typeof i!="object"&&typeof i!="function")return i;const e=fg(i)?[]:{};for(const t in i)i.hasOwnProperty(t)&&(e[t]=typeof i[t]=="object"?Tc(i[t]):i[t]);return e}function nn(i={},e={}){let t=Tc(i);if(typeof t!="object"||typeof e!="object")return!1;for(const s in e)e.hasOwnProperty(s)&&(s in t?e[s]==null||typeof t[s]!="object"||typeof e[s]!="object"?t[s]=e[s]:t[s].concat&&e[s].concat?t[s]=t[s].concat(e[s]):t[s]=nn(t[s],e[s]):t[s]=e[s]);return t}function li(i,e={}){if(typeof i!="object"||typeof e!="object")return!1;for(const t in e)e.hasOwnProperty(t)&&(t in i?e[t]==null||typeof i[t]!="object"||typeof e[t]!="object"?i[t]=e[t]:i[t].concat&&e[t].concat?i[t]=i[t].concat(e[t]):i[t]=li(i[t],e[t]):i[t]=e[t]);return i}function rA(i){console.error(`uView提示:${i}`)}function oA(i=[]){return i.sort(()=>Math.random()-.5)}String.prototype.padStart||(String.prototype.padStart=function(i,e=" "){if(Object.prototype.toString.call(e)!=="[object String]")throw new TypeError("fillString must be String");const t=this;if(t.length>=i)return String(t);const s=i-t.length;let n=Math.ceil(s/e.length);for(;n>>=1;)e+=e,n===1&&(e+=e);return e.slice(0,s)+t});function xg(i=null,e="yyyy-mm-dd"){let t;i?/^\d{10}$/.test(i.toString().trim())?t=new Date(i*1e3):typeof i=="string"&&/^\d+$/.test(i.trim())?t=new Date(Number(i)):typeof i=="string"&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(i)?t=new Date(i):t=new Date(typeof i=="string"?i.replace(/-/g,"/"):i):t=new Date;const s={y:t.getFullYear().toString(),m:(t.getMonth()+1).toString().padStart(2,"0"),d:t.getDate().toString().padStart(2,"0"),h:t.getHours().toString().padStart(2,"0"),M:t.getMinutes().toString().padStart(2,"0"),s:t.getSeconds().toString().padStart(2,"0")};for(const n in s){const[r]=new RegExp(`${n}+`).exec(e)||[];if(r){const o=n==="y"&&r.length===2?2:0;e=e.replace(r,s[n].slice(o))}}return e}function aA(i=null,e="yyyy-mm-dd"){i==null&&(i=Number(new Date)),i=parseInt(i),i.toString().length==10&&(i*=1e3);let t=new Date().getTime()-i;t=parseInt(t/1e3);let s="";switch(!0){case t<300:s="刚刚";break;case(t>=300&&t<3600):s=`${parseInt(t/60)}分钟前`;break;case(t>=3600&&t<86400):s=`${parseInt(t/3600)}小时前`;break;case(t>=86400&&t<2592e3):s=`${parseInt(t/86400)}天前`;break;default:e===!1?t>=2592e3&&t<365*86400?s=`${parseInt(t/(86400*30))}个月前`:s=`${parseInt(t/(86400*365))}年前`:s=xg(i,e)}return s}function $i(i,e="both"){return i=String(i),e=="both"?i.replace(/^\s+|\s+$/g,""):e=="left"?i.replace(/^\s*/,""):e=="right"?i.replace(/(\s*$)/g,""):e=="all"?i.replace(/\s+/g,""):i}function dl(i={},e=!0,t="brackets"){const s=e?"?":"",n=[];["indices","brackets","repeat","comma"].indexOf(t)==-1&&(t="brackets");for(const r in i){const o=i[r];if(!(["",void 0,null].indexOf(o)>=0))if(o.constructor===Array)switch(t){case"indices":for(let c=0;c<o.length;c++)n.push(`${r}[${c}]=${o[c]}`);break;case"brackets":o.forEach(c=>{n.push(`${r}[]=${c}`)});break;case"repeat":o.forEach(c=>{n.push(`${r}=${c}`)});break;case"comma":let a="";o.forEach(c=>{a+=(a?",":"")+c}),n.push(`${r}=${a}`);break;default:o.forEach(c=>{n.push(`${r}[]=${c}`)})}else n.push(`${r}=${o}`)}return n.length?s+n.join("&"):""}function lA(i,e=2e3){X.showToast({title:String(i),icon:"none",duration:e})}function cA(i="success",e=!1){["primary","info","error","warning","success"].indexOf(i)==-1&&(i="success");let t="";switch(i){case"primary":t="info-circle";break;case"info":t="info-circle";break;case"error":t="close-circle";break;case"warning":t="error-circle";break;case"success":t="checkmark-circle";break;default:t="checkmark-circle"}return e&&(t+="-fill"),t}function uA(i,e=0,t=".",s=","){i=`${i}`.replace(/[^0-9+-Ee.]/g,"");const n=isFinite(+i)?+i:0,r=isFinite(+e)?Math.abs(e):0,o=typeof s>"u"?",":s,a=typeof t>"u"?".":t;let c="";c=(r?Q4(n,r)+"":`${Math.round(n)}`).split(".");const l=/(-?\d+)(\d{3})/;for(;l.test(c[0]);)c[0]=c[0].replace(l,`$1${o}$2`);return(c[1]||"").length<r&&(c[1]=c[1]||"",c[1]+=new Array(r-c[1].length+1).join("0")),c.join(a)}function fA(i,e=!0){const t=parseInt(i);return e?/s$/.test(i)?i:i>30?`${i}ms`:`${i}s`:/ms$/.test(i)?t:/s$/.test(i)?t>30?t:t*1e3:t}function hA(i){return`00${i}`.slice(-2)}function dA(i,e){const t=Ir.call(i,"u-form-item"),s=Ir.call(i,"u-form");t&&s&&s.validateField(t.prop,()=>{},e)}function pA(i,e){if(typeof i!="object"||i==null||typeof e!="string"||e==="")return"";if(e.indexOf(".")!==-1){const t=e.split(".");let s=i[t[0]]||{};for(let n=1;n<t.length;n++)s&&(s=s[t[n]]);return s}return i[e]}function gA(i,e,t){if(typeof i!="object"||i==null)return;const s=function(n,r,o){if(r.length===1){n[r[0]]=o;return}for(;r.length>1;){const a=r[0];(!n[a]||typeof n[a]!="object")&&(n[a]={}),r.shift(),s(n[a],r,o)}};if(!(typeof e!="string"||e===""))if(e.indexOf(".")!==-1){const n=e.split(".");s(i,n,t)}else i[e]=t}function yg(){const i=getCurrentPages();return`/${i[i.length-1].route||""}`}function mA(){return getCurrentPages()}function xA(i,e){return e.split(".").reduce((s,n)=>s&&s[n]!==void 0?s[n]:void 0,i)}function yA(i,e=95){const t=vA(i),s=EA(t.r,t.g,t.b),n={h:s.h,s:s.s,l:Math.min(e,95)};return AA(n.h,n.s,n.l)}function vA(i){const e=i.toLowerCase().trim();if(e.startsWith("#")){const s=e.replace("#",""),n=s.length===3?s.split("").map(r=>r+r).join(""):s;return{r:parseInt(n.substring(0,2),16),g:parseInt(n.substring(2,4),16),b:parseInt(n.substring(4,6),16)}}const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t)return{r:+t[1],g:+t[2],b:+t[3]};throw new Error("Invalid color format")}function EA(i,e,t){i/=255,e/=255,t/=255;const s=Math.max(i,e,t),n=Math.min(i,e,t);let r,o,a=(s+n)/2;if(s===n)r=o=0;else{const c=s-n;switch(o=a>.5?c/(2-s-n):c/(s+n),s){case i:r=(e-t)/c+(e<t?6:0);break;case e:r=(t-i)/c+2;break;case t:r=(i-e)/c+4;break}r=(r*60).toFixed(1)}return{h:+r,s:+(o*100).toFixed(1),l:+(a*100).toFixed(1)}}function AA(i,e,t){t/=100;const s=e*Math.min(t,1-t)/100,n=r=>{const o=(r+i/30)%12,a=t-s*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*a).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`}const Ds={range:Y4,getPx:X4,sleep:J4,os:Z4,sys:mg,getWindowInfo:eA,random:tA,guid:sA,$parent:Ir,addStyle:iA,addUnit:nA,deepClone:Tc,deepMerge:nn,shallowMerge:li,error:rA,randomArray:oA,timeFormat:xg,timeFrom:aA,trim:$i,queryParams:dl,toast:lA,type2icon:cA,priceFormat:uA,getDuration:fA,padZero:hA,formValidate:dA,getProperty:pA,setProperty:gA,page:yg,pages:mA,getValueByPath:xA,genLightColor:yA};class SA{constructor(){this.config={type:"navigateTo",url:"",delta:1,params:{},animationType:"pop-in",animationDuration:300,intercept:!1},this.route=this.route.bind(this)}addRootPath(e){return e[0]==="/"?e:`/${e}`}mixinParam(e,t){e=e&&this.addRootPath(e);let s="";return/.*\/.*\?.*=.*/.test(e)?(s=dl(t,!1),e+=`&${s}`):(s=dl(t),e+=s)}async route(e={},t={}){let s={};typeof e=="string"?(s.url=this.mixinParam(e,t),s.type="navigateTo"):(s=nn(this.config,e),s.url=this.mixinParam(e.url,e.params)),s.url!==yg()&&(t.intercept&&(this.config.intercept=t.intercept),s.params=t,s=nn(this.config,s),typeof X.$u.routeIntercept=="function"?await new Promise((r,o)=>{X.$u.routeIntercept(s,r)})&&this.openPage(s):this.openPage(s))}openPage(e){const{url:t,type:s,delta:n,animationType:r,animationDuration:o}=e;(e.type=="navigateTo"||e.type=="to")&&X.navigateTo({url:t,animationType:r,animationDuration:o}),(e.type=="redirectTo"||e.type=="redirect")&&X.redirectTo({url:t}),(e.type=="switchTab"||e.type=="tab")&&X.switchTab({url:t}),(e.type=="reLaunch"||e.type=="launch")&&X.reLaunch({url:t}),(e.type=="navigateBack"||e.type=="back")&&X.navigateBack({delta:n})}}const pl=new SA().route,vg=ug({props:{customStyle:{type:[Object,String],default:()=>({})},customClass:{type:String,default:""},url:{type:String,default:""},linkType:{type:String,default:"navigateTo"}},data(){return{}},onLoad(){this.$u.getRect=this.$uGetRect},created(){this.$u.getRect=this.$uGetRect},computed:{$u(){return nn(X.$u,{props:void 0,http:void 0,mixin:void 0})},bem(){return function(i,e,t){const s=`u-${i}--`,n={};return e&&e.map(r=>{n[s+this[r]]=!0}),t&&t.map(r=>{this[r]?n[s+r]=this[r]:delete n[s+r]}),Object.keys(n)}}},methods:{openPage(i="url"){const e=this[i];e&&pl({type:this.linkType,url:e})},navTo(i="",e="navigateTo"){pl({type:this.linkType,url:i})},$uGetRect(i,e){return new Promise(t=>{X.createSelectorQuery().in(this)[e?"selectAll":"select"](i).boundingClientRect(s=>{e&&Array.isArray(s)&&s.length&&t(s),!e&&s&&t(s)}).exec()})},getParentData(i=""){this.parent||(this.parent={}),this.parent=Ir.call(this,i),this.parent.children&&this.parent.children.indexOf(this)===-1&&this.parent.children.push(this),this.parent&&this.parentData&&Object.keys(this.parentData).map(e=>{this.parentData[e]=this.parent[e]})},preventEvent(i){i&&typeof i.stopPropagation=="function"&&i.stopPropagation()},noop(i){this.preventEvent(i)}},onReachBottom(){X.$emit("uOnReachBottom")},beforeUnmount(){if(this.parent&&hg.array(this.parent.children)){const i=this.parent.children;i.map((e,t)=>{e===this&&i.splice(t,1)})}}}),TA=ug({options:{virtualHost:!0}});function bA(i="rgb(0, 0, 0)",e="rgb(255, 255, 255)",t=10){const s=gl(i,!1),n=s[0],r=s[1],o=s[2],a=gl(e,!1),c=a[0],l=a[1],u=a[2],f=(c-n)/t,h=(l-r)/t,d=(u-o)/t,p=[];for(let m=0;m<t;m++){let g=ji(`rgb(${Math.round(f*m+n)},${Math.round(h*m+r)},${Math.round(d*m+o)})`);m===0&&(g=ji(i)),m===t-1&&(g=ji(e)),p.push(g)}return p}function gl(i,e=!0){const t=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;if(i=String(i).toLowerCase(),i&&t.test(i)){if(i.length===4){let n="#";for(let r=1;r<4;r+=1)n+=i.slice(r,r+1).concat(i.slice(r,r+1));i=n}const s=[];for(let n=1;n<7;n+=2)s.push(parseInt(`0x${i.slice(n,n+2)}`));return e?`rgb(${s[0]},${s[1]},${s[2]})`:s}return/^(rgb|RGB)/.test(i)?i.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",").map(n=>Number(n)):i}function ji(i){const e=i,t=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;if(/^(rgb|RGB)/.test(e)){const s=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",");let n="#";for(let r=0;r<s.length;r++){let o=Number(s[r]).toString(16);o=String(o).length==1?`0${o}`:o,o==="0"&&(o+=o),n+=o}return n.length!==7&&(n=e),n}if(t.test(e)){const s=e.replace(/#/,"").split("");if(s.length===6)return e;if(s.length===3){let n="#";for(let r=0;r<s.length;r+=1)n+=s[r]+s[r];return n}}else return e}function _A(i,e){i=ji(i);const t=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;let s=String(i).toLowerCase();if(s&&t.test(s)){if(s.length===4){let r="#";for(let o=1;o<4;o+=1)r+=s.slice(o,o+1).concat(s.slice(o,o+1));s=r}const n=[];for(let r=1;r<7;r+=2)n.push(parseInt(`0x${s.slice(r,r+2)}`));return`rgba(${n.join(",")},${e})`}return s}const Bn={colorGradient:bA,hexToRgb:gl,rgbToHex:ji,colorToRgba:_A};let Zs=null;function IA(i,e=500,t=!1){if(Zs!==null&&clearTimeout(Zs),t){const s=!Zs;Zs=setTimeout(()=>{Zs=null},e),s&&typeof i=="function"&&i()}else Zs=setTimeout(()=>{typeof i=="function"&&i()},e)}let ei;function CA(i,e=500,t=!0){t?ei||(ei=!0,typeof i=="function"&&i(),setTimeout(()=>{ei=!1},e)):ei||(ei=!0,setTimeout(()=>{ei=!1,typeof i=="function"&&i()},e))}function LA(i,e){var t,s,n;try{t=i.toString().split(".")[1].length}catch{t=0}try{s=e.toString().split(".")[1].length}catch{s=0}return n=Math.pow(10,Math.max(t,s)),(i*n+e*n)/n}function DA(i,e){var t,s,n,r;try{t=i.toString().split(".")[1].length}catch{t=0}try{s=e.toString().split(".")[1].length}catch{s=0}return n=Math.pow(10,Math.max(t,s)),r=t>=s?t:s,Math.abs(((i*n-e*n)/n).toFixed(r))}function RA(i,e){var t=0,s=i.toString(),n=e.toString();try{t+=s.split(".")[1].length}catch{}try{t+=n.split(".")[1].length}catch{}return Number(s.replace(".",""))*Number(n.replace(".",""))/Math.pow(10,t)}function wA(i,e){var t,s,n=0,r=0;try{n=i.toString().split(".")[1].length}catch{}try{r=e.toString().split(".")[1].length}catch{}return t=Number(i.toString().replace(".","")),s=Number(e.toString().replace(".","")),xyutil.mul(t/s,Math.pow(10,r-n))}const PA={add:LA,sub:DA,mul:RA,div:wA},bc={toast:10090,noNetwork:10080,popup:10075,mask:10070,navbar:980,topTips:975,sticky:970,indexListSticky:965},eo={primary:"#3c9cff",info:"#909399",default:"#909399",warning:"#f9ae3d",error:"#f56c6c",success:"#5ac725",mainColor:"#303133",contentColor:"#606266",tipsColor:"#909399",lightColor:"#c0c4cc",borderColor:"#e4e7ed"},{toString:Eg}=Object.prototype;function Ag(i){return Eg.call(i)==="[object Array]"}function kA(i){return i!==null&&typeof i=="object"}function BA(i){return Eg.call(i)==="[object Date]"}function FA(i){return typeof URLSearchParams<"u"&&i instanceof URLSearchParams}function ml(i,e){if(!(i===null||typeof i>"u"))if(typeof i!="object"&&(i=[i]),Ag(i))for(let t=0,s=i.length;t<s;t++)e.call(null,i[t],t,i);else for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.call(null,i[t],t,i)}function OA(i){return Object.prototype.toString.call(i)==="[object Object]"}function xl(){const i={};function e(t,s){typeof i[s]=="object"&&typeof t=="object"?i[s]=xl(i[s],t):typeof t=="object"?i[s]=xl({},t):i[s]=t}for(let t=0,s=arguments.length;t<s;t++)ml(arguments[t],e);return i}function Cr(i){return typeof i>"u"}function d0(i){return encodeURIComponent(i).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function MA(i,e){if(!e)return i;let t;if(FA(e))t=e.toString();else{const s=[];ml(e,(n,r)=>{n===null||typeof n>"u"||(Ag(n)?r=`${r}[]`:n=[n],ml(n,o=>{BA(o)?o=o.toISOString():kA(o)&&(o=JSON.stringify(o)),s.push(`${d0(r)}=${d0(o)}`)}))}),t=s.join("&")}if(t){const s=i.indexOf("#");s!==-1&&(i=i.slice(0,s)),i+=(i.indexOf("?")===-1?"?":"&")+t}return i}function NA(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function UA(i,e){return e?`${i.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`:i}function $A(i,e){return i&&!NA(e)?UA(i,e):e}function HA(i,e,t){const{validateStatus:s}=t.config,n=t.statusCode;n&&(!s||s(n))?i(t):e(t)}const p0=(i,e)=>{const t={};return i.forEach(s=>{Cr(e[s])||(t[s]=e[s])}),t},GA=i=>new Promise((e,t)=>{const s=MA($A(i.baseURL,i.url),i.params),n={url:s,header:i.header,complete:o=>{i.fullPath=s,o.config=i;try{typeof o.data=="string"&&(o.data=JSON.parse(o.data))}catch{}HA(e,t,o)}};let r;if(i.method==="UPLOAD"){delete n.header["content-type"],delete n.header["Content-Type"];const o={filePath:i.filePath,name:i.name},a=["formData"];r=X.uploadFile({...n,...o,...p0(a,i)})}else if(i.method==="DOWNLOAD")r=X.downloadFile(n);else{const o=["data","method","timeout","dataType","responseType"];r=X.request({...n,...p0(o,i)})}i.getTask&&i.getTask(r,i)}),KA=i=>GA(i);function rn(){this.handlers=[]}rn.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1};rn.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};rn.prototype.forEach=function(e){this.handlers.forEach(t=>{t!==null&&e(t)})};const g0=(i,e,t)=>{const s={};return i.forEach(n=>{Cr(t[n])?Cr(e[n])||(s[n]=e[n]):s[n]=t[n]}),s},VA=(i,e={})=>{const t=e.method||i.method||"GET";let s={baseURL:i.baseURL||"",method:t,url:e.url||"",params:e.params||{},custom:{...i.custom||{},...e.custom||{}},header:xl(i.header||{},e.header||{})};return s={...s,...g0(["getTask","validateStatus"],i,e)},t==="DOWNLOAD"||(t==="UPLOAD"?(delete s.header["content-type"],delete s.header["Content-Type"],["filePath","name","formData"].forEach(o=>{Cr(e[o])||(s[o]=e[o])})):s={...s,...g0(["data","timeout","dataType","responseType"],i,e)}),s},jA={baseURL:"",header:{},method:"GET",dataType:"json",responseType:"text",custom:{},timeout:6e4,validateStatus:function(e){return e>=200&&e<300}};var qA=function(){function i(u,f){return f!=null&&u instanceof f}var e;try{e=Map}catch{e=function(){}}var t;try{t=Set}catch{t=function(){}}var s;try{s=Promise}catch{s=function(){}}function n(u,f,h,d,p){typeof f=="object"&&(h=f.depth,d=f.prototype,p=f.includeNonEnumerable,f=f.circular);var m=[],g=[],y=typeof Buffer<"u";typeof f>"u"&&(f=!0),typeof h>"u"&&(h=1/0);function v(x,E){if(x===null)return null;if(E===0)return x;var S,T;if(typeof x!="object")return x;if(i(x,e))S=new e;else if(i(x,t))S=new t;else if(i(x,s))S=new s(function(O,K){x.then(function(B){O(v(B,E-1))},function(B){K(v(B,E-1))})});else if(n.__isArray(x))S=[];else if(n.__isRegExp(x))S=new RegExp(x.source,l(x)),x.lastIndex&&(S.lastIndex=x.lastIndex);else if(n.__isDate(x))S=new Date(x.getTime());else{if(y&&Buffer.isBuffer(x))return Buffer.from?S=Buffer.from(x):(S=new Buffer(x.length),x.copy(S)),S;i(x,Error)?S=Object.create(x):typeof d>"u"?(T=Object.getPrototypeOf(x),S=Object.create(T)):(S=Object.create(d),T=d)}if(f){var _=m.indexOf(x);if(_!=-1)return g[_];m.push(x),g.push(S)}i(x,e)&&x.forEach(function(O,K){var B=v(K,E-1),G=v(O,E-1);S.set(B,G)}),i(x,t)&&x.forEach(function(O){var K=v(O,E-1);S.add(K)});for(var I in x){var R=Object.getOwnPropertyDescriptor(x,I);R&&(S[I]=v(x[I],E-1));try{var b=Object.getOwnPropertyDescriptor(x,I);if(b.set==="undefined")continue;S[I]=v(x[I],E-1)}catch(O){if(O instanceof TypeError)continue;if(O instanceof ReferenceError)continue}}if(Object.getOwnPropertySymbols)for(var L=Object.getOwnPropertySymbols(x),I=0;I<L.length;I++){var k=L[I],M=Object.getOwnPropertyDescriptor(x,k);M&&!M.enumerable&&!p||(S[k]=v(x[k],E-1),Object.defineProperty(S,k,M))}if(p)for(var N=Object.getOwnPropertyNames(x),I=0;I<N.length;I++){var F=N[I],M=Object.getOwnPropertyDescriptor(x,F);M&&M.enumerable||(S[F]=v(x[F],E-1),Object.defineProperty(S,F,M))}return S}return v(u,h)}n.clonePrototype=function(f){if(f===null)return null;var h=function(){};return h.prototype=f,new h};function r(u){return Object.prototype.toString.call(u)}n.__objToStr=r;function o(u){return typeof u=="object"&&r(u)==="[object Date]"}n.__isDate=o;function a(u){return typeof u=="object"&&r(u)==="[object Array]"}n.__isArray=a;function c(u){return typeof u=="object"&&r(u)==="[object RegExp]"}n.__isRegExp=c;function l(u){var f="";return u.global&&(f+="g"),u.ignoreCase&&(f+="i"),u.multiline&&(f+="m"),f}return n.__getRegExpFlags=l,n}();class WA{constructor(e={}){OA(e)||(e={},console.warn("设置全局参数必须接收一个Object")),this.config=qA({...jA,...e}),this.interceptors={request:new rn,response:new rn}}setConfig(e){this.config=e(this.config)}middleware(e){e=VA(this.config,e);const t=[KA,void 0];let s=Promise.resolve(e);for(this.interceptors.request.forEach(n=>{t.unshift(n.fulfilled,n.rejected)}),this.interceptors.response.forEach(n=>{t.push(n.fulfilled,n.rejected)});t.length;)s=s.then(t.shift(),t.shift());return s}request(e={}){return this.middleware(e)}get(e,t={}){return this.middleware({url:e,method:"GET",...t})}post(e,t,s={}){return this.middleware({url:e,data:t,method:"POST",...s})}put(e,t,s={}){return this.middleware({url:e,data:t,method:"PUT",...s})}delete(e,t,s={}){return this.middleware({url:e,data:t,method:"DELETE",...s})}connect(e,t,s={}){return this.middleware({url:e,data:t,method:"CONNECT",...s})}head(e,t,s={}){return this.middleware({url:e,data:t,method:"HEAD",...s})}options(e,t,s={}){return this.middleware({url:e,data:t,method:"OPTIONS",...s})}trace(e,t,s={}){return this.middleware({url:e,data:t,method:"TRACE",...s})}upload(e,t={}){return t.url=e,t.method="UPLOAD",this.middleware(t)}download(e,t={}){return t.url=e,t.method="DOWNLOAD",this.middleware(t)}}const _c=new WA,zA={actionSheet:{show:!1,title:"",description:"",actions:[],index:"",cancelText:"",closeOnClickAction:!0,safeAreaInsetBottom:!0,openType:"",closeOnClickOverlay:!0,round:0,wrapMaxHeight:"600px"}},QA={album:{urls:[],keyName:"",singleSize:180,multipleSize:70,space:6,singleMode:"scaleToFill",multipleMode:"aspectFill",maxCount:9,previewFullImage:!0,rowCount:3,showMore:!0,autoWrap:!1,unit:"px",stop:!0}},YA={alert:{title:"",type:"warning",description:"",closable:!1,showIcon:!1,effect:"light",center:!1,fontSize:14,transitionMode:"fade",duration:0,icon:"",value:!0}},XA={avatar:{src:"",shape:"circle",size:40,mode:"scaleToFill",text:"",bgColor:"#c0c4cc",color:"#ffffff",fontSize:18,icon:"",mpAvatar:!1,randomBgColor:!1,defaultUrl:"",colorIndex:"",name:""}},JA={avatarGroup:{urls:[],maxCount:5,shape:"circle",mode:"scaleToFill",showMore:!0,size:40,keyName:"",gap:.5,extraValue:0}},ZA={backtop:{mode:"circle",icon:"arrow-upward",text:"",duration:100,scrollTop:0,top:400,bottom:100,right:20,zIndex:9,iconStyle:{color:"#909399",fontSize:"19px"}}},e8={badge:{isDot:!1,value:"",show:!0,max:999,type:"error",showZero:!1,bgColor:null,color:null,shape:"circle",numberType:"overflow",offset:[],inverted:!1,absolute:!1}},t8={button:{hairline:!1,type:"info",size:"normal",shape:"square",plain:!1,disabled:!1,loading:!1,loadingText:"",loadingMode:"spinner",loadingSize:15,openType:"",formType:"",appParameter:"",hoverStopPropagation:!0,lang:"en",sessionFrom:"",sendMessageTitle:"",sendMessagePath:"",sendMessageImg:"",showMessageCard:!1,dataName:"",throttleTime:0,hoverStartTime:0,hoverStayTime:200,text:"",icon:"",iconColor:"",color:"",stop:!0}},s8={calendar:{title:"日期选择",showTitle:!0,showSubtitle:!0,mode:"single",startText:"开始",endText:"结束",customList:[],color:"#3c9cff",minDate:0,maxDate:0,defaultDate:null,maxCount:Number.MAX_SAFE_INTEGER,rowHeight:56,formatter:null,showLunar:!1,showMark:!0,confirmText:"确定",confirmDisabledText:"确定",show:!1,closeOnClickOverlay:!1,readonly:!1,showConfirm:!0,maxRange:Number.MAX_SAFE_INTEGER,rangePrompt:"",showRangePrompt:!0,allowSameDay:!1,round:0,monthNum:3,weekText:["一","二","三","四","五","六","日"],forbidDays:[],forbidDaysToast:"该日期已禁用"}},i8={carKeyboard:{random:!1}},n8={card:{full:!1,title:"",titleColor:"#303133",titleSize:"15px",subTitle:"",subTitleColor:"#909399",subTitleSize:"13px",border:!0,index:"",margin:"15px",borderRadius:"8px",headStyle:{},bodyStyle:{},footStyle:{},headBorderBottom:!0,footBorderTop:!0,thumb:"",thumbWidth:"30px",thumbCircle:!1,padding:"15px",paddingHead:"",paddingBody:"",paddingFoot:"",showHead:!0,showFoot:!0,boxShadow:"none"}},r8={cell:{customClass:"",title:"",label:"",value:"",icon:"",disabled:!1,border:!0,center:!1,url:"",linkType:"navigateTo",clickable:!1,isLink:!1,required:!1,arrowDirection:"",iconStyle:{},rightIconStyle:{},rightIcon:"arrow-right",titleStyle:{},size:"",stop:!0,name:""}},o8={cellGroup:{title:"",border:!0,customStyle:{}}},a8={checkbox:{name:"",shape:"",size:"",checkbox:!1,disabled:"",activeColor:"",inactiveColor:"",iconSize:"",iconColor:"",label:"",labelSize:"",labelColor:"",labelDisabled:""}},l8={checkboxGroup:{name:"",value:[],shape:"square",disabled:!1,activeColor:"#2979ff",inactiveColor:"#c8c9cc",size:18,placement:"row",labelSize:14,labelColor:"#303133",labelDisabled:!1,iconColor:"#ffffff",iconSize:12,iconPlacement:"left",borderBottom:!1}},c8={circleProgress:{percentage:30}},u8={code:{seconds:60,startText:"获取验证码",changeText:"X秒重新获取",endText:"重新获取",keepRunning:!1,uniqueKey:""}},f8={codeInput:{adjustPosition:!0,maxlength:6,dot:!1,mode:"box",hairline:!1,space:10,value:"",focus:!1,bold:!1,color:"#606266",fontSize:18,size:35,disabledKeyboard:!1,borderColor:"#c9cacc",disabledDot:!0}},h8={col:{span:12,offset:0,justify:"start",align:"stretch",textAlign:"left"}},d8={collapse:{value:null,accordion:!1,border:!0}},p8={collapseItem:{title:"",value:"",label:"",disabled:!1,isLink:!0,clickable:!0,border:!0,align:"left",name:"",icon:"",duration:300,showRight:!0,titleStyle:{},iconStyle:{},rightIconStyle:{},cellCustomStyle:{},cellCustomClass:""}},g8={columnNotice:{text:"",icon:"volume",mode:"",color:"#f9ae3d",bgColor:"#fdf6ec",fontSize:14,speed:80,step:!1,duration:1500,disableTouch:!0,justifyContent:"flex-start"}},m8={countDown:{time:0,format:"HH:mm:ss",autoStart:!0,millisecond:!1}},x8={countTo:{startVal:0,endVal:0,duration:2e3,autoplay:!0,decimals:0,useEasing:!0,decimal:".",color:"#606266",fontSize:22,bold:!1,separator:""}},y8={datetimePicker:{show:!1,popupMode:"bottom",showToolbar:!0,value:"",title:"",mode:"datetime",maxDate:new Date(new Date().getFullYear()+10,0,1).getTime(),minDate:new Date(new Date().getFullYear()-10,0,1).getTime(),minHour:0,maxHour:23,minMinute:0,maxMinute:59,filter:null,formatter:null,loading:!1,itemHeight:44,cancelText:"取消",confirmText:"确认",cancelColor:"#909193",confirmColor:"#3c9cff",visibleItemCount:5,closeOnClickOverlay:!1,defaultIndex:[],inputBorder:"surround",disabled:!1,disabledColor:"",placeholder:"请选择",inputProps:{}}},v8={divider:{dashed:!1,hairline:!0,dot:!1,textPosition:"center",text:"",textSize:14,textColor:"#909399",lineColor:"#dcdfe6"}},E8={empty:{icon:"",text:"",textColor:"#c0c4cc",textSize:14,iconColor:"#c0c4cc",iconSize:90,mode:"data",width:160,height:160,show:!0,marginTop:0}},A8={form:{model:{},rules:{},errorType:"message",borderBottom:!0,labelPosition:"left",labelWidth:45,labelAlign:"left",labelStyle:{}}},S8={formItem:{label:"",prop:"",rules:[],borderBottom:"",labelPosition:"",labelWidth:"",rightIcon:"",leftIcon:"",required:!1,leftIconStyle:""}},T8={gap:{bgColor:"transparent",height:20,marginTop:0,marginBottom:0,customStyle:{}}},b8={grid:{col:3,border:!1,align:"left"}},_8={gridItem:{name:null,bgColor:"transparent"}},{color:m0}=Qs,I8={icon:{name:"",color:m0["u-content-color"],size:"16px",bold:!1,index:"",hoverClass:"",customPrefix:"uicon",label:"",labelPos:"right",labelSize:"15px",labelColor:m0["u-content-color"],space:"3px",imgMode:"",width:"",height:"",top:0,stop:!1}},C8={image:{src:"",mode:"aspectFill",width:"300",height:"225",shape:"square",radius:0,lazyLoad:!0,showMenuByLongpress:!0,loadingIcon:"photo",errorIcon:"error-circle",showLoading:!0,showError:!0,fade:!0,webp:!1,duration:500,bgColor:"#f3f4f6"}},L8={indexAnchor:{text:"",color:"#606266",size:14,bgColor:"#f1f1f1",height:32}},D8={indexList:{inactiveColor:"#606266",activeColor:"#5677fc",indexList:[],sticky:!0,customNavHeight:0,safeBottomFix:!1}},R8={input:{value:"",type:"text",fixed:!1,disabled:!1,disabledColor:"#f5f7fa",clearable:!1,password:!1,maxlength:140,placeholder:null,placeholderClass:"input-placeholder",placeholderStyle:"color: #c0c4cc",showWordLimit:!1,confirmType:"done",confirmHold:!1,holdKeyboard:!1,focus:!1,autoBlur:!1,disableDefaultPadding:!1,cursor:-1,cursorSpacing:30,selectionStart:-1,selectionEnd:-1,adjustPosition:!0,inputAlign:"left",fontSize:"15px",color:"#303133",prefixIcon:"",prefixIconStyle:"",suffixIcon:"",suffixIconStyle:"",border:"surround",readonly:!1,shape:"square",formatter:null,cursorColor:""}},w8={keyboard:{mode:"number",dotDisabled:!1,tooltip:!0,showTips:!0,tips:"",showCancel:!0,showConfirm:!0,random:!1,safeAreaInsetBottom:!0,closeOnClickOverlay:!0,show:!1,overlay:!0,zIndex:10075,cancelText:"取消",confirmText:"确定",autoChange:!1}},P8={line:{color:"#d6d7d9",length:"100%",direction:"row",hairline:!0,margin:0,dashed:!1}},k8={lineProgress:{activeColor:"#19be6b",inactiveColor:"#ececec",percentage:0,showText:!0,height:12,fromRight:!1}},{color:B8}=Qs,F8={link:{color:B8["u-primary"],fontSize:15,underLine:!1,href:"",mpTips:"链接已复制,请在浏览器打开",lineColor:"",text:""}},O8={list:{showScrollbar:!1,lowerThreshold:50,upperThreshold:0,scrollTop:0,offsetAccuracy:10,enableFlex:!1,pagingEnabled:!1,scrollable:!0,scrollIntoView:"",scrollWithAnimation:!1,enableBackToTop:!1,height:0,width:0,preLoadScreen:1}},M8={listItem:{anchor:""}},{color:x0}=Qs,N8={loadingIcon:{show:!0,color:x0["u-tips-color"],textColor:x0["u-tips-color"],vertical:!1,mode:"spinner",size:24,textSize:15,text:"",timingFunction:"ease-in-out",duration:1200,inactiveColor:""}},U8={loadingPage:{loadingText:"正在加载",image:"",loadingMode:"circle",loading:!1,bgColor:"#ffffff",color:"#C8C8C8",fontSize:19,iconSize:28,loadingColor:"#C8C8C8",zIndex:10}},$8={loadmore:{status:"loadmore",bgColor:"transparent",icon:!0,fontSize:14,iconSize:17,color:"#606266",loadingIcon:"spinner",loadmoreText:"加载更多",loadingText:"正在加载...",nomoreText:"没有更多了",isDot:!1,iconColor:"#b7b7b7",marginTop:10,marginBottom:10,height:"auto",line:!1,lineColor:"#E6E8EB",dashed:!1}},H8={modal:{show:!1,title:"",content:"",confirmText:"确认",cancelText:"取消",showConfirmButton:!0,showCancelButton:!1,confirmColor:"#2979ff",cancelColor:"#606266",buttonReverse:!1,zoom:!0,asyncClose:!1,closeOnClickOverlay:!1,negativeTop:0,width:"650rpx",confirmButtonShape:"",duration:400,contentTextAlign:"left",asyncCloseTip:"操作中...",asyncCancelClose:!1,contentStyle:{}}},G8={navbar:{safeAreaInsetTop:!0,placeholder:!1,fixed:!0,border:!1,leftIcon:"arrow-left",leftText:"",rightText:"",rightIcon:"",title:"",titleColor:"",bgColor:"#ffffff",titleWidth:"400rpx",height:"44px",leftIconSize:20,leftIconColor:eo.mainColor,autoBack:!1,titleStyle:""}},K8={noNetwork:{tips:"哎呀,网络信号丢失",zIndex:"",image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABLKADAAQAAAABAAABLAAAAADYYILnAABAAElEQVR4Ae29CZhkV3kefNeq6m2W7tn3nl0aCbHIAgmQPGB+sLCNzSID9g9PYrAf57d/+4+DiW0cy8QBJ06c2In/PLFDHJ78+MGCGNsYgyxwIwktwEijAc1ohtmnZ+2Z7p5eq6vu9r/vuXWrq25VdVV1V3dXVX9Hmj73nv285963vvOd75yraeIEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQaD8E9PbrkvRopSMwMBBYRs+5O/yJS68cPnzYXel4tFP/jXbqjPRFEAiCQNe6Bw/6gdFn9Oy9Q90LLG2DgBBW2wyldIQIPPPCte2a5q3jtR+4ff/4wuBuXotrDwSEsNpjHKUXQODppy+udYJMEUEZgbd94DvnNwlA7YGAEFZ7jOOK78Xp06eTTkq7sxwQhmXuf/754VXl4iSstRAQwmqt8ZLWlkHg0UcD49qYfUjXfLtMtOZ7npExJu4iqZWLl7DWQUAIq3XGSlpaAYHD77q8xwuCOSUoXw8Sl0eMux977DGzQjES3AIICGG1wCBJEysj8PXnz230XXdr5RQFMYbRvWnv6w8UhMhliyGwYghr4Pjg3oEXL34ey9zyC9tiD2ml5h47dr1LN7S6CMjz/A3PvHh1Z6UyJby5EVgRhKUe7Kz/JU0LfvrJo5f+Y3MPibSuFgQGBgasYSd9l6GDsup0WS/T/9RTp9fXmU2SNwECdQ92E7S57iaMeJnPQLK6ixkDLfjlb7546RfrLkQyNBcC3dsP6oHWMd9G+V3JgwPHh7rnm1/yLQ8CbU9Y33zp0j+nZFUMb/DHmB7+SHGY3LUKAk8cObtD00xlHDrfNge+Z2ozU3c9dvx4Yr5lSL6lR6CtCWvg6OAPw9z538ZhhZRl6XrwhW8du1KX/iNejtwvPQIDR8+vSRqJ/obU7GupjdNdh2gW0ZDypJBFR6BtB2rg2OVtuub9JcmpHIpBoK1xfffLzx4f7C0XL2HNiYDp6bs9z23Ypn1fC1Y/9PCFDc3ZW2lVHIG2JKzTp4Ok7nv/G6Q054MIvda+bNb74pEgKGtwGAdL7pcfAa8vOKEZ2kyjWuLr7uDh+/qvN6o8KWdxEWhLwroyeek/g4zuqwU6kNrhyZcu/UktaSXN8iNwuL9/RuvVXtJ9PbPQ1vhmcP6t9+47u9ByJP/SIdB2hDVw9MJHQFYfrQdCph84evFX68kjaZcPAZJWwjMXRFpJ2zr91tfuvrh8vZCa54NA2xGWrunvmg8QWCJ/N4ir7fCYDxatkOeBB7an501agXbygVdvv9IK/ZQ2FiPQdi9osGbH+zRNf7y4m9Xu9Me7N9nv0HXdr5ZS4psHgXpJC9P/wDRTx0Vn1TxjWG9LGrbaUm/Fi5meSvcrkxf/Cg/ow9XqAUk91v3qHT97r6471dJKfHMi8Oyzgx1Z03t1YAQVT2MwgsC3u+yXHzi0faQ5eyGtqgWBtpOw2Ol9+/TM+sTOn8L08MtzgQCy+tOHXr3jA0JWc6HU/HF5Scssr4jXcYqfP6V/T8iq+ceyWgvbUsKKOn38eJAYyl56TAuCEr2WYei//9Crd/5GlFb81kdASVopSFrerKRlaoZj9HR+700H10+0fg+lB21NWBxe2lhNHsUpDZr27mi4dV379R9+za4/iO7Fbx8ECknLCPTsTDJ17O33bJpqnx6u7J60PWFxeAcCbMV56dJfQKf1bkMLfuGh1+76zMoe9vbuPUnLsb2DtmOe5HSxvXsrvWtLBEhaTx29+Ma27Jx0ShAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQaEsEVoQdVluO3BJ06ptHL34b1XRjp4Ch6Rq24+kmjG4Nwwg+9uA9u/73EjRBqhAEihAoe3xwUQq5WTYEzp0b3ZnV/Ncf6O/9AvY9wlh/6dy3X7ncN512Zw9BVLXjuAP4np44vnQtkZoEgVkEhLBmsWiKqwsXpjbPBOn3gRfenwnc+7GBe+zsjclvonFDS9nA9Iy/u3x9+vAP3735VPk4CRUEFhcBIazFxbfm0k9fHD7k+v4nQFaPQIrx8Gmyx/GJ0J/t7ez7mw0b9MmaC2pQQgh0/ZSm4g5TwueWWtqLt0HuVy4CQljLPPYnB0depTn+b3t+8B4t0AdBUv93h2H9xc6da0aXs2m+r1WQsLRnl7NdUvfKRkAIa5nG//r1oGtsZvjTgev/kqYHF/TA+AXoqv4npJemOEiQU1Eo2l+G0movBK1UBBPU7s9E1+ILAkuNgKwSLjXiqO/khVtvARH8dxDBRkMzPrF/V+9/BlG5y9CUqlXinHv9mRPXtvuus88L9H3JPv2zD2yXExCqAicJBIFWRwAvv3Xqwq0/Pnn+lv/K+ZvfPH3p9p5W75O0fxaBp793ce3AwIDMWmYhafiVgNtwSMsXeHp4eNXJC8Nf0PAdRCiuf/XgrnWUqsqotcvnl9DmRkCdweX4b9N7+m/ih+mbMraLM14yJVwcXItKpT1VRve+ArC3Qqn+3gM7132jKEGZm6tXg86J7OhDfuA/iHwPUpfUZSfu2L59tXxEoQxeyxkEgjKeOnLxHb4RqC+NY5H3+2953d4XlrNN7Vq3ENYij+yZwbG9jpt9GkBPQ5H9zgP9607OVeWp87cOQtn9zwJf+xDMNFfj+jryPqXpxj8c2Nn7P+SXey70lidu4IXzb0DNB4tr9751+HV7zxSHyd1CERDCWiiCc+QPjUCnsaqmZ62O5IN7N/VUNP48ee7mAZDTf4Tt049iUG4Guv4ZfNLos9UIbo7qJWoJEHjy+bP7fNsoOcnW0A0/aacef8PdG28sQTNWTBVCWIs01OfPj66BpfqTmq732UnjgT1bei+Vq4pTv7HM8Ceg2/o1qLQug7T+FaaM3IqTLZdewpoHgYEjV9fphvOj+OShWa5V+CxvZtpzv/LwG/aNl4uXsPoRwI+4uEYjAJ2GmdG8L0FK2mYa+tsrkdXZy+P7x2ZuHdW14P+BLdank9q6Qwd3rf+ckFWjR6Tx5Q2cP58K9Jm3VCIr1ogt48lO237r3//96YofeG18y9q7RFklXITxPXV+5DchKb3ZDMy37Nu5tuxG4R9cHH6b42QfAzlds+3EPXu2rfrBIjRFilwkBIIR7SHoJDurFU89ZOd680Gke6JaWomvjoBIWNUxqivFD87fej0e0n8Fwvr0/t1rnyqX+QfnRz7g+8FX8Rv8vL3auF/IqhxKzR2WCPxXqKeq3krDTdj2ierpJEUtCIgOqxaUakwzNBR0D09yiqePHOjveyOkpxLr9VMXb73V97S/h3nDXx7Y2fdPkAYbncW1IgIDxy5vM7LZt/hgrnLtxyaBrJNxv/72N+6tuNhSLp+EVUZACKsyNnXHvHL+1qcgNf2KbSXu2bt9dcmS9qlzo/fARgcmCtpzB3b1/Vg5QiuslLowENyDWDn8cSjl98PgdBviu03N+rl9/WufLEwr18uDwLdevLTF1YK3xnVZ2HI1bUxrT7z5zTuXdRP78qCyeLUKYTUI25OXbm4JPO00TBj+6I7+db8ZL3ZwMOiYdG4dA1lN9HWte2iuI2NAVPapC8O/CGPR34Ip/AZIbIMo7yX8G9QMbcS09P+2b1vf5XgdrXaPfiYns9oeLLEd8D1/B7Dp0E1jGP042pXQj7RKf546cmGzp+tv1TRf6YQD35/QO3seP3xow5IfC9QqmM23naJ0ny9ysXwgq98BWc0kVhv/Nhalbqe8kd/Fr8MOSEr3zEVWrwyO3I29hl+E9LUHGf+nAXI6sGPdd8uV2YphIKnE5IyL6bLxk7cn3bdkHHefrpvJAExMZ1uBZmqeNzXtfzUzk/m/ens7LjV7Px+8d9e1579/44l0duZtge+Np5zEEw8c2pBu9na3YvtEwmrAqNE8IZvNHsep5//yjl3r/0O8yFOXbv0QCO05gP0JGIL+fjw+uj91YeRh/Dp/PtCDM7Zpfmjvjt6Xo7hW9ycmJjaYduf7Hdf/8HTGfa3rG9rYxLSWnsloPg7fijZV8oFM2Ja2a9t6EJd7bCztvHP7us4rrdD/r3/7ct9I99jEI4cOiQ3dIg2YEFYDgOUJDFj1e8TqX7cT4kImXuQr5279A4DeBEX8ayvprU4N3rovcALot/TH13T0fXDTJn0qXk4r3k9OTm4y7a6PzjjORzOOvn1kbEqbnEprPhRzwAKzwFLHk05hv6Yd6N+o3R6beG50aPSdr3qV6IJKkVp5ITIlXOCYn4Yexr0w/DO6YXymHFlR0e5r7tsM3fxgJbI6fW1ivTeT+SsYmr54cFff+5Cu5X+hb94Merp6/J/PusGvTE6724eGJ7RpSFOkKPCUZvBPBccoHBet3Rwe13rX9tw/PjXzZ5hKvr8SfhWKkeA2REAIa4GD6p0feRdWBnvxjv2PckVhVfBf4A29uG/X2i+Ui2eYn8n8NryuDr3jPfWSFV5k44UT137eshIP2K7/64cObbheqZ6lCp+Ydt8TBO7vTM5od1+/NR4SFVhoLpKKt410lnE8LTMzo3V2dLznxLkhYgQ9obiVjEDln7mVjEodfYcpw+MAsftg/7qSDbAnb97sCSb0Yei2fqOcbovVqKNnNO8HmAE9Cv3Wp+uoWjt27HpXNqH9WTKR+kBHKqEFbvo5y3N/avfu4g23R45f3WGa1k9ZicTd0zPTf/f6O7f8dT311Jp2fHzmgJlI/N70jPPe4bEZ6Kg4qw0lqlrLiNKBiLWerpTW25PUbkPXZViW62ecHz+4d8PXojTirzwEyhq8rTwYFtRjvpX/rlwJ+iSXugPbMuyKBOHo3geRJtuT7PujcmVUCuPJlhnL/9NUqvMD2eyM5sxMaIlE4n7XML907tyNjcxHQjty4sZv66Z1xEok/xNW5n4uZSf+8sT5m++vVO58wkEu5sR09pd9w/rWyET2vReujiqygrSopn/zKZN5qMeirotKeTyolm7p/+X06Wvr51ue5Gt9BISwFjiGsLl6N6SrvylXDNTK70D4mX071pwtF88w6Jd/DG/1E1u26NOV0pQL71y3/8PJVOcHMzPTWkcCH2YGOaTTaS2RTN6f1fQvvvDK1bdnbO2JZCr1SeRfn05Pa1PTU0gXJBKW+ecnzlxvCGndhFQ1NRP8bcY1/vjS9bF1V26MwHwsVKiXa3etYVw1TNhYJ3TDjQCO42jJVMcez7J+t9YyJF37ISCEtahjGjxkGDr2DJZ31D8h5vUQJL5RPkXlUMM07u3qSGidICvkzzuSlmlZb0olrK9hD9v9JCrPC196JoPMAolFg6CV+PPj54YeyWecx8Vk2v1Q0rSfhFT18LnBmzBRyNalp5qrSuq7kiAsh4SFa7oZ9M0wzI+cPHOjZPo9V1kS1z4ICGEt4lhiCvZrSa2jol7qzPXJPk6nIGbVbWfUvcr7hO9MP97ZVXpggOu6ajplYStj7l1XvbRMXbPAbp6HzSSBlkraNknrvfVCcPt2sHYi7f3pTDb47KUbYxuvKqkKpYBXKBnV869c3WgbDEixAck0FGFFfEzJzbIsO9C1TyrcymWWsLZGIHoW2rqTzdo5dXyykz0NC8l779i5vu4zwM+eHVntGP5jqVTq/6AkVc5NZ3wNH2lVxNWZNIukMSjiNd9z0+CHp5DXAdX4SAg203w8GB5IATtODHzdK8C15kEjhXvNS9rWA11dnfcMDY9prscss48RySakrOLWqODCoIKAgkuVgsS0urtD60haeV1YYVbbtjUn6/74HXvW/11huFy3PwKzT1r797Upe3jq4sib9u9Y+wxe+vh7W1N7jx49v6ZzbffnQD4/Cj1Pfjx54XiBls6GVuTUc9mQsOIO9mPQFdkIRlz4fy5JLm2ZMOqTcJaXIqpcqnixVe+rdbZ3dbc2OT0D0wZIibHSksmklslknvx+//q3PiKnXcTQae/b+LPQ3r1t0969cOL6G7o6E09qgZegdMJBpVQ1DbKCpyUt6oPKz/4NEJalCAuZFIuEVBJd+jgLh4rvAiFqUVGkhJZMWFp3Z0obGSu/d5gSnWmavuO6h+/cvYHSobgVgoAYjrb4QPMUiGtj1/79jBMkLBwiTlMASlYzTkhWCJyTrGAyMOFkst/BoYMmuIIyGJYcMXMMdNwHPhYN1qWS1t6ZLGaKZL8yzFXTr15BooLLMugHMBRNKgW+It8y9TEcJGt4rvcRFCCEVQbFdg0Swmrxkb0+cf2XOzq73kgdFieEXF2jdEUJKQH6SVWQrNjtZDKlpTPp38U58iUbthk/Ph7sN6zg/xudSGvD4xkq6otcnnjyF0XRRTflkyC0IIJE1JG0QbqGNpMNp5xFhRTcZDNoj66988SFm5vv3LX+WkGUXLYxAuXnCW3c4XbqGs9hwjv+a9lsuN+ahOJSCoLjNDAFvVUll0p1aNPp6adTweSflEszPO48oFn+4yOTmR+6enOshKyYhzWpf/jDuuf6x2aV/qNRaPG/1d0gUXWCA0uu7GhMmkqmerEc8KOVU0lMuyFQ+Ylut562YX9Sncmf7Ojo3BDZWbGLtMkiUVXSWTFNuMqWuYG530f7+/tnGFboxsfdd9mm8XdDo9O7rg6NFq0CFqZr5DWlK9qV0fZqGvZchSuPlevB2VmG/hOV4yWm3RAQwmrhEcW64qu4ykfJho52Vp3J8quBYQooqWDKADftBd6HD+5efyoKj/zR8ew/hWXY56/cnFh7a3RCTTGjuMX0SVB9qzu1qfQM+jO3dBW1g6uVSHv/qVNX10Vh4rc3AkJYLTy+WA/8ou9kJjo7bOh+DLVFZ64TEbCyBktxI5PJZj56R//Gx+NdH5vM4vuI+p8NXh9LjU1iw3EZhXc8TyPuuV9wDaaCfBjTM06N0hVWQmHBDzvSDZ5tvqYR7ZAymh8BIazmH6OKLbzv0KZvJEz3ZzEFnEolaEtV2XEaCLKadrIz//TQnk1/EU85NuH8th8Yf4j9gMZUOrNkZEVZCnsbtTU9KW18GqcKFyjh420sd2+j33pg3F8uTsLaDwEhrBYf04O7N/2t7/o/C2FoGnsIy/YGlvAwSfCvZzLOe+8oR1ZT3u/5uvHJC9dGtJlMrfqjslXVHwjpat2aLi2rjFFLjUSrFUjlO0juddXSSXx7ICCE1QbjiHO0/hofbPgwpnDTOR2V6hWNQqGUx34890noet5yaO+Gko3Y45PO7/uB/lvnrwxrWdha1absbgxo1FWtwplXqYSJY5Nn5lU3bLHQmGA/yko0plVSSjMjIITVzKNTR9sO7dv8RSeb/T9BWmMkKv4D+YzBXuljV7yxd+zfte6VeHGKrHTz4+cv38JWmyUmKzSGG5z7VndoE7kz3uPtq+Welvhwm39weVjOyaoFsBZPI4TV4gNY2Pw79mz8KyebeRIH+VEZTaX0sf27+v794TKmCxNTzr/2NOPj5wZBVjjdYSklq6jN69dyKuhqmWztivYob+RTSkPbe/xMdlMUJn77IiCE1W5jq+s4dYEO6mzsYAmvi/+CrH7LDYxPcBq4HGTFVcG1ULLT5orS1ULIkoSFI2cMHKG8obiXcteOCAhhtdmo6gaOh4EWWlkyYU9gvHswXfgV19d/7+LVkSWfBrItJJhObL/p7elQR8fUZnEV70XxPc01sM+xrzhU7toRgZIHuh07uZL6xA3LBaYB+Ar8rBsfz34YX1j+D5eu317QNGy2xPquSE4mDuXb2IujY2AgytNE67RiKFshzuwCR5s9ZSMlsK0QEMJqq+GkBKOF5yFzRoidK5BoFCeMjM/8mG+a//Xy0Li55KYLBRiTrGjwOQ1br4VMBQuKVJeQKVPxMLlvPwSEsNpsTEECmBLSgbHUpwD1YGwse59l2p+9fmuig4fiNZIowrqq/6Xeqm9Vh9JbjcOKvqFtACX7gV8kTVZvkaRoRQSEsFpx1OZoM2iKxxuHLtDcsZlgLzYZfv7m7XSv+r7fIm234XSP/8o5ktWqzqSyZr89PoXPYDTYkZvziw0NLluKayoEyq4iNVULpTF1IaDjHHZmoAW4aep9geN8fiLt998cGYdtVp7K6iqzXGJFUCAi7jdkuapsBJKcPBwgyP8YRyV7B04Q3dDbpY3jg6gupoMNla5U41BbUN9n0sr1ScKaHwEhrOYfo7paCAW0WiWknihhW/0Tabf/6tDtxpIVSIhGnz1dSXUkDL8fSHKi4/lWPId9Kp3Vxqegp8J/m9f14D6DQ/nmb281FwgkZ1Dj7bnSSFx7ICCE1R7jmO8FJJr8jCvjeNrIxFjDJBpKVaSlXhwDw384MyucBoLAGEfHI5ptO6n1YAq4FjorH9IWjUOnFlF3pj62aui3whbI33ZGQAir/UY3XCVEvzgdw/8NcSyGUhSlpVWQrFg2p39xp0JYLyIohaXxdZ2FGofG6yi85/QS32F0Asu8URgu1+2JgCjd22xcsVElPC85169Gaa1YTkRWJKpSqooBiQQzONvq9sRULKKxtzzAEJw1api2EFZjoW3K0oSwmnJY5tcoSD09HanEDztubnfO/IopyUWC6sUmZUpW5aSqkgwgK04DxxaZrFivacCaIdAuH9zaM1rSDgloOwSEsNpoSMenvU93dXb+EE5taFivKElRqd67qrNmsqIF+yjMF/i56MV2JqadYKxXMDXM6+4Wu04pf/kQEMJaPuwbWvPticwj4Il/NnTrdl7JrqaDC5wTUle1GmdWWVCw1+JotjA6PgnThsIdQrXknF8arkJi/+R355dbcrUaArU9ha3WqxXW3tHR9C5dN//T9eEJ3aGdUwP7T0V7F86Mr0VW4mF6o2NTS/ilaB2HDmb8wA2+08AuS1FNjIAQVhMPTi1NgwRkGKbxRxMz3uaJSRzVUkumOtLwo6Zc7aOkVdEhynN9NQ1cyuNqeEqD67mX9TXGyxXbJhFthYAQVosP58S0909czfqJqzdGODVqaG/IUbCWr2p0yukfp4FUtDfeir1yl8IPUGjPHFy/fqJyKolpJwSEsFp4NEfT6Z3YBvOp8MvMc0hAi9hHNQ1cBrJil5TUZxhfXsTuSdFNhoAQVpMNSD3NMTzzU1PZYAM/ProYkg3UV5rHT8lXmA7SwnwEq4FLLVkRI04HM+n0LdvzvlEPZpK2tREQwmrR8ZucCd7hePr7rw2N5PfxLUZXON1zHKz4kb0KnIttP6Njk8tyaimbwXPrsW/yq3v3bhoqaJZctjkCQlgtOMCYCnU4GedTI+NpQ32XbxH7QOmKG5nzdIWZJz8HNkKygqI9TmSL2JSiovGVn0A39c8WBcpN2yMghNWCQ4zPc0HRbr6GEs6chJFnmfl3knZO4/hmII1B6fiFG9br0s6qAeXPp2WUrhzHeXH/jr6n5pNf8rQuAkJYLTZ2kK7Wul7w6zeGx9DyUsZovOodOizosTg1TM9k1Wogpa7lIisOF+w48E/7E5B1Y/cgtdizsBKbK6c1tNioT6X9n3MDcyePOo7OoJqrC6S0+ZIYV+GSOHxvc18PJCxXG4ed13I727axqTp9yk9rX1jutkj9S4+ASFhLj/m8axwdDdbgELxfGsLpoZyqVXPVU1QugVJUV0dC27p+FaaBWWxknq6ceAljTNMiAf/BoUMbJpewWqmqSRAQCatJBqKWZpgJ731Zx9pJM4aK0hXe5vlKVFEbKFlxs3PvqpSSqpbzKztRm+gnEkktnU6/2GFMfa4wXK5XDgJCWC0y1iAR6/Z49iOjY7C5qkG6mk+3SFQGlEP8FFdnygrNFqBsn1OxP5+K5pGHbcBhqhT8fqu/v39mHkVIljZAQAirRQYx7Wj3Zj3tddQjVVJ4l50CMjHe8mqOTJCCvmoTyIrENXx7Uinbm4Gs2PZUqkObnp76i0N7N36tWl8kvn0RaGnCGhgILKPn3B3+xKVXDh8+nPseX3sOlpt13+P4uonv71WeDqLr1ampFB8S1JrulNaHc9rTMxltcpofOeWns0rTLkeIZUHRnpm5YibMf7kc9UudzYNAyyrd8ZLpWvfgQT8w+oyevXeo++bBtaEtQd9s1/ffRsV3I6eDJCp+nourgH04UZQnhIYfWm1o8xdUGCU8/E/bil89sH3dlQUVJplbHoGWJaxnXri2HTvd1nEEcCBS3z++MLi75UejQgcmJjL92ax/gNJPo6QekhVXAbdvXI3D+XQ1Bcxiu02zTAEjKFIdHTQS/S8Hd2/4YhQm/spFoCUJ6+mnL651gkwRQRmBt33gO+c3teNQYin/oG6aKX5rcKEukqqoWN+Ij5vy81v8UATDG0WGC21jlJ96K6wKPpWd8H8jChN/ZSPQcoR1+vTppJPS7iw3bIZl7n/++eFV5eJaOczX9Z2YvM1LPxWpocBHKv8qHHdMqSphGUqqahaThfj40ITBcbLnsDj6oXvu2bS4n96JVy73TYtASxHWo48GxrUx+5Cu+XY5RH3PMzLGxF0ktXLxrRoGNVPPfNtOolIrgElLGYH2wbZqcipdIFVFlDbfGhqfj9bskCaHHS/7gTt3r73Y+BqkxFZFoKUI6/C7Lu/Bl1jmlKB8PUhcHjHufuyxx/g5lbZw+BL7bX4EoiZqyS0T0uM0j1+82QSl+ua+bhxj7GjD2LicwWkLzaarigbKsmDJ7gcTmezMBw/t3ixntUfAiK8QaBmzhq8/f26j77pbaxo3w+jetPf1B5D2RE3pmzyR4/nH+Mti4Wx1dUrCHO0lSVGqskFUnakkpn6mhu086jgYHkWTW3Wbo4Tli6L5gqYHE47vfeDufVv+YflaIjU3KwItIWEdO3a9Szc0ElDNDqcLbHjmxas7a87QxAnX9ljfxcr+Mzs29ykpi1O8iJjoR/cm5o7dnUl89LRLW93dyWmVIip+Kp7pmlWqIvQ8Mga9Gslm3Efu3LX+K008HNK0ZUSgplnGMrZPGxgYsIKeXa/TA61jPu0w0+7xBx/cd3M+eZspD0wbDgWm+RXP13cODY/jWGKuGAb48jG+agNpilbqlKZoWDqDY2AyjtNUlupzYZlKpXgaxIVMNv0zd+/d+uxcaSVuZSPQ/IT13TN34QRvZW81n6HSDdMLUqmjh9tgd//Fi8OHEl3JL3Z2dh3MzGA7XU664llVWRz/QhLjNYmsmaWp/DjCjqIDdlaZTOZZ1/A+fGj7hjP5OLkQBMog0NSE9cSRszuswNhdpt31BRnazM3U9IuPHDrUuG+419eChqU+cvzqjp7u5P9KJpMPpqc51Zv9QntLkFQBEqZluVCw/7nhaP9i376+8YIouRQEyiLQtIQ1cPT8GjOw7vE8tyFtxBrb2MBXdh579FF99g0vC0nzB548ebNHT2l/aFmJj1BPBYyav9EFLaQ+jdPAVNL8/pZ13a8qiJLLOhAAjvrTRy/d0enbF+69d0tzHFhWR/vnk7Rple6mp+9uFFkRGF8LVj/08IUN8wGp2fIcPLh+4sCu9R+F3ucj0MLf4vaVVnChqYWmdaQS2jpY2vd0djh86Vqh7c3Yxm8dudTPxaW0lrn7yJEjZW0Tm7HdC2lT0xKW1xecgHE3FDWNcb7uDh6+r/96Y0prjlIO7ur7TOD5b3ayzt9ylY0Gl83qKFXZsCXrXdOlrV3djf2LBr556JOshLDmMWhPPXV6vav5O5jVxYLUhNl3iIbV8yiqpbI0bQcP85C2Xu0l3dczC0XUN4Pzb71339mFltOM+Q/0rzu5f2fvu1zH+QDOt3uZ0pbVRMRFouJK5qqeTkhVqyBdtdUmhGV5JI4cudrpd5kHiyp3tTU/8s6r+4rC2vCmaQmLWJO0Ep65INJK2tbpt75298U2HLuiLh3oX/95L+0/kHUyvwTieiUJHVEimVzy1UKeWMqv2pCoKEVFRNXT1aHawnBx80eAZj7TwcxdAc5Gi5fiaNnNT37nCk4xaV/X1IRF2B94YHt63qQVaCcfePX2K+07fMU9U7qtHev+xE/7r3cc70O+6w1gxuV0dHZiusgvJS/O7IskRXLs6KCxqj+B26t9a3uUREWi4plbQlTFYzXvu+7tB3EIUGel/L6e3TNw5NS8zYAqldss4YvzBC9C7559drAja3qvDoyg6pwCP+KBZaVOPPjazS1vMLpQKE9fuPnawDB+EqehPwzWuAuSl8LPg90WVxhJJPWQCUmPBAWTBEz1TFUGpqO3wYYvIPgr2az35a2b1/50V6f1e1NTlVcvEzB0xRekj67usu5FmS2/crvQcaol/zeeObfTSOj91dIq28PxiaOHDx9quy8LtQxhcZBqIS0Dhkl2l/3yA4e2j1Qb2JUUD1Iyz1waOQib0vsxKXsAFvH3wMB0JySwtZC+DBPTN5BOCEnhrI1BuKe9l6tIzsVCiD6E0DOabrwI2elZ09aP7N3aNxjheXvK+a1OENa0EFYEyYL9rz072Ju03ZpNQKj7Xd899cKhNrA9LASvZTY/s9GcHoK0XsrakLS8UklLxyl+/rj+/Qfu2367sJNyTS7SuZfneO7ffweBGScu3NwAqWgrTvTc5jjBZmw87tMCfRXYKQWOgula4OiBOQUZ7DZuhrAGdQXxV0zPuCaGnkv3VPGHOpPw7+QPR62OM5HhdNddGOeX2kmCbSnC4mDlSStVTFr4eLljdHV+702vWz9R66Cu5HS5h5hmHvz3QiOxwJTRo2BGgY06dm7OVhewYGAY6s75oD+ZDs4JPY9JyqSCQ7ABqftd5VFM3/j2Ja4mtsWpJQSq6ZXu5UZTKeJnsHpohiYPRqBn04nkS2+CQWW59BK2dAjwS0Y4IHDz2ERWG8Gnwm7iK9W3sFmbvrqGPzw6gW8eTmvTM07XmTPX28KYd7EQ3rjnvv1QFHbPt3zT9DcMPHd+13zzN1s+/hC2rKOo7NjeQdsxT5LEWrYjbdLw05eHtwWe9jl0542u62HZHZIVpalY/yIlP5X3MHYddLLZfy4fmYiBhNuB509vw+rG3tKY+kOwGHLi7W/cS91jS7v4s9TSnZHGLx8CICH9lXNDX+zpWfXuycnaBV2e3e567nAm4973qv0bzy1fD5qr5oEB7KXt0u7B3Loh7yhWVfypbOalh9+wr6U3mbfklLC5Hi1pDRE4ef7Wj+EEiZ+amqpvJT2bzWjJRLIPR3n9riA5i4DZg720DSIrlsrvHXSZ9p7ZGlrzSgirNcetqVp9/vz5FJTqj6JRejTdq6eBMzNpHP9s//QrF4bvrydfO6f1JrCX1mvcXlo98Kembjotr3wXwmrnp36J+pYNeh5JdqRem83O77gxkpxtW3bgOZ/g1HKJmt3U1Rw+3D+zrc89aunagnWzpq6PdxujLz388L4F78tdbtCEsJZ7BFq8/sHBoMPX/I9hyrGgnuDUUZzrnnz7yQu3HlxQQW2Ued++fZmJ1e5LoPB5k5ZpWCPXz+08du+99zrtAI0QVjuM4jL2YcIZeh+2+9wF49MFtYJSlgmHE0g/JlLWLJQPg7RmhtyXsJ18eja0tivsXhj6xy9ve/mRR5TRcG2ZmjyViN9NPkDN3Dz1FW5z9XM4i+s1ME1YcFNpUIrVLHzJzHnwjl0bn1twgW1UwPHjxxPXpztejR0HFTc+F3YXRwxdfdM9W08D0zrs4wtLaM5rkbCac1xaolWOvurhZIPIih0OdVm2haNTfqUlAFjCRnJP4HBn+iUqz6tVa2nGpTe/etsP2o2s2G8hrGqjL/FlEQC5GHghfplSUSMdvwaEA/9+4vjpa3c2stx2KIsfUek2dr+EuXNF2xEjSJx98w/tbFt7NiGsdniSl6EPp84O3W/Z1oPzXRms1GRKWdCJdeCIlJ+vlGYlh997r+70+EPH8NHJEtLCauCph+7bmj81ox1xEsJqx1Fdij4Zxi9AT2KSYBrtslgxhOD2gWOyz7AstFzx6zFHj1mGobYUYAgC9cHge3ddK5uhjQKFsNpoMJeqK6+8cm0X6noXiWUxHA8WxAdWNyQM45HFKL8dyiRpueM7jllmMGpnjO+1w9fNaxmXxiogaqlR0jQdAkeOBPjczrnOiQ6jw88ESSOA6KT7iQzOHEvavu1pZsLQg4QPP/DdZG9Xx/vWrOr+mfR03SvtNffdxleAQIgvTzjBT0w409Mpu2faufZy+vDhw5WPMa25dEnYqggIYbXqyNXY7i/jCyvdfmaVb5hdVsLp9LJGp43j1/1A7/RdvdMwPRzEboRnLVHe9vEvL3eXBOB4ZMta22H+TiqV2LJQ26u5u6Bju44Z3J7O/Lvp6cwPmBanOwQ4uNHRTWMK21bSvh1Mm642nTWCtKkH07rnTE72aOO0XZq7bIltVQSEsFp15HLthg5J/+aJE12m3tVjOPYq1/dW4cTjHnwMYhXOce8xDd3y/PJW6OpMdsTRVy4iK/rKMR/jwvz825VIHFzT3fkx13UW/dnhRy3GJyeeHEs7n1XNibUPFvY6vtGDw5vV9w0Vofn81qGhZfDhi3HX8SfQ/3HPMse9CWcCX0gel2OIFJIt+2fRH7qWRaYJG85NxldGzV4tGayFSLQ24+q9ULyu9gJfMU5ELTn6wUISTl03NHz1KzyiJLqmX657OLLdSJgoXTO7cBxyN172blier4YCvBsFdSNXV2dC35tKJrbzfPfFdjwvC/qs9MSMxxNRsSqmT6LhUDQHE+jUBE7UnATXTuLsrRn01K2l/x6+qItiR3TNG8V59KNB0DGSfNXGUXwJY2Gm+osNhpSvEBDCasIHgVLTt75/aQ0MnXpBNb2QgNYEntfr4wu/nBYpKQLtxtdwAh0SBX3VDe7nM/Ha5vf1Fb/CURS2bCTAWWuxR229qRsbQQQbUed61LfW14JVKKsTJ5sk8WUcHbtlNANyTOhgcmAGKH7p3m1FWpqtuZCu+LByVdKHVMjpKEQrBwIW9tnpXOIH+QTDSH/D9f0bmCLewDn1I4HmwtAypPDZ/oe9oXKf/aMPsWxSs/RR13FHrURiZE1gDR86tKHEdCDMKX+XCwEhrOVCvqBeHNaW6ui11/mWDtLQ1kEiWodXE4rwYgepAPssTPCMOjIdAk94TZ8pMZjch8HjDorGFUTUAwlkh64be0A9/ZCatiDZWtOyE7ClQmIdJICJFYhA+TRV4Fo5/QIHiUvrTEbkVRCxiJfsSBbfYk87OTExXxdazY5yUgiRKfpHQ1YSkONmAZY+gV4NIeVFfCXoLNA5h/Plb5LzWAyzF+IVXdNnvO/6GcsyhjC1vmWZ7s2pO3fdOqzriy9asnJxZREoerDLppDAhiIAEtCfO3F5rW0a6z1PX4/nf53nG5RqqrpieSnULEVh8cx4E7ugH78H8tG9eP/24oVezY+pkpA8b/abhPF8le75BqdsXUtaFeaTlTI2IByEoU1l8oq1mkokcZHElIRoWmpejMMCMyCvQXyy7JjjuUcgOl4tLCzCMpTHgFpcgkViX/dH/ax2Szf8m2Yqc/MN+1r7BM/C/rfCtRDWEozSkbMjq7NTY5t13dqE6dhG3wsSqlp+C9DDi0ifLrqmT1f6BgUaPjiHN0lJAGAfvpWcI4XjiHIMF6ocO/EjmMa9HeelQ1LT1PRpoce/sJwOTCQtc+kfGQp6Uxl+9JWtmL+jNEaJ0gKBgbsygR58B4sHfwV5aliVWg3vCHv6ymHcdG868IzrVsK6pnd71+/dsmXxbD3m3/W2ybn0T1/bQFe5I8euX+9ybuqbXMPbDA7ZCKV4uMOecyz+9OfmWvj9x9zEw6JW+JuOX298WhE6qtwLEV3TL1tb/AWj7sqwfqaro/sdmcyM+vBp2XzzDEzaBiQsNH+e+eeTjQ+ohwqnG0BYhfVzNYKrkOmpyauYYH8KvD8G6RPBszrC6Jq+ystl0ghzXEZjR5+O4+iZwTh+eG7Yqa5rq/3hGzzTSkXKn4YgIITVABjBP+ZzP7i8ydasrZCetuCHvIvFRs92SEdlpnCYE2LOQi12OA7RNf1yjrphHIyE9yOXPnfNMDg70DpdTf8DWDKs5rRvMVwChAWrUgh21HzllD0NrigqlxKVC7bKQuOOWeGiuI7OTkhb6T8C/Xw3xkel9cXxj6eIxiY3Hhx3X9dHsWJwDaa3l1+zd9Mt/F4tUk/ijWnP+/DBb8++LWqvnh0c7NDGta0pO7kl6zpb8AJzEUr91kYEFdeBRCt69Nm4+AsSl6jwjVGckY6VwPwUpLhLURx9xliWvxFHi/w+zB0SWCnLsVpxnoXesSI2ngp4zmRJXPgf/0IleGH51R6uwjeX5MR76qtITh7+8N9Cp4GF7Sm8Zl1s35pVXVomm/5c1vG+Wm284njHJeJq44/FjixUAld8w7uijW6+xo3MhW2S6+oIVHumqpewglJ87+LFtcFUcqur+1vxwPcZJqYPMOyhXw6GKI4+4/GwQpjCBhe+6XDIpFb06PM+np5hhS5eXzw9bLJ2pBLGv4Fe36BU4kA6IQGw8MUY6MJywVeqDs54Z69zrWdY7jI3G1ZtUiSV6zzDI3IqLLew/wu9jspl+yywrA1pEed5QceXPT3jBb/DLrA5ua5UHZ/4eMTbFx+fwvE3DJO8fANrjlctL7giJhRx9MrfR89R+VgJ1Y6currONuwd0FNsxwtV02mPlWGLy1TxlPHf6Hh8PH9xesvw9yRM+5PIRT2ZIgVKKZxWUY/PT8aTFPji0i3m4Ed1hDWV/7uY9bNGtiGqAyorJRWSqCgdkrQiR5KddrwPlsq8xfhG6efvx8dvtiQczDdmmPaldDBxSVYeZ3GJXxUMWzxq5d4fPz7Ym7X1HTAL2A7NqtJHEQ3qtCPjw3LoxB/v+OMZ5VVzR5aHWRuErYA+y4uu6fM+Xl9J/lh7bFvbY+vmv0bWos9tsXAWSLIiaSnyApHxJz6SbFSFuXTw8i86r5vVRW1m+6IHmUREAuI0lcREP5q2ztWPrO9/YK54xsXHI56+cePvj3qBfimZNS+J5FWMcrjptThsRd4dPX9+DcwEd5iQphwozfkCwJKaLv9ewHYKeicfSudwShcnJDBBOD3MTwGRO0cqLIj73jQTaejDBYaPHTBgJ/i5+HyYijd95sFhRzkzB7yL2IrCtGwezj9nOQVTUlfPwiicifnu5J0qHHd8mXHIG6ZD7JQqIk9kJK6QwAokMWRUhMaSeJ0vcfaiXNhs7PyuwpYV51Vh+EM/Pu2M9GckpyiOuZm2Wvtom+Y4me8xPbvIIujzPu6Wbvyt1ejL3U7Sv/v754ZHsORwaX3KGdwiJhO5pzY+Mivk/urVq52jTnIXlEc78LKu8qAMx/G8kHhyOicosz0ovM3IrIDKb15HSvDoOoqv+hMLYCOWI8ash0vmufryZVcqLz4u8fym3ov1xT/EVp4UDUTn4/iS0xW+sZTMojASmLqGp64iH4FRXJQ2TKj+lv7JVRTVxwQkm9APyaboGnGMzSVR6VR87ipsVT645ovOzi5tamb6zzB1/nqzjz+s9YetwLioZW5C8jq08K9+1IxS8yQsfF6ap1WL2BK8VOaJc6NbPcPrx7wJ++hmHQUPvOaQgMJ3ETtVlERDP0wVsQ19uPgcLQyt/Dc+p4jlL6k/1xa2qVyh5ApEzEoErm/DsPOTXV3de6anq36roFyRdYWVbVSshHJEMt98saIXfIu9koplYZL6m/hUz7kS/Jt0/PE8+Jj6X/Y6k+fv2tA1BKIvB/OC8WnGAmp5dpqx3XW36fjgYK/upXbhFd+BrRlqn16MfkrspkoC4hnirYjbUVWzs4rHx8uL3cerjwt0TA4RcBcsuX8Rn97q54okVsCKJJ9YkSvy1gJR4aOtnAr6OJP+L13d+BKBKMEzHhAfgDh6yzD+vqHjTDDvYpAxLqwEfVdbE9bpIEi6V27tdLP+LnzPrWS/XrRTnz5d4e79+LNY7r4kP+Z7Jv7z1LyPL0B4Tb+ci9cXLy+eJ54e8Rw//rqqcUR+HOrgYVprJbBl5E2w63oI64J7k8mUDZLGhmAXs19ucVkxP8gKQu4ptCxbMy2TW3KAGI4u1P207ztH3CDx/7bL+Cdse8h1Zy5ev7Dp8uHD7blJuy0J69TV8XW6l92Dl3cbLG6g98idbhDgdANcY1ZY9o2N4mpNr96GRf1Da3Wui0RW69F1bWslvp81LD2xDTOGu9DhQzBc7AcYfYlkAqo6A6ozqHNBYJTESGitTGShsp0qQSxT4AcoPJQw0LBlEPhBFakHDjoLvY+XgVIyg7WK77tG8n9pvpHXBbXL+OMBd7FN6KLu+uf27esbX9RHdIkLbxvCGhgYsDb3v2a7obt7YHakpKmYiqgE2ioqJbzIOszXcSov/DAzRRNehyJKvPx4+igv/ZLKEaCkoZxUFMYXE1I8f7Xyq/UHp9CkAlfbCF3NdlhS7IQguA0N2wiJYy1ktC5IISb1Okr5jSYruy2SGlYkIkKLSC3yy/WrUWGzSnjaTUX/QEhYQuNewLCdwBFKRkpOuAfr4sBnwwfDg6B0MHagORhBHNqHw5WxTwYav6lAt/42MBLfrYZXHO9w3Ftr/B0Hp0pY+tkD29ddAz5ln8NGjddSlNPyhHV8aKjbzAS7Dd3egRcvgRHJWyrHASw9Pyp+vlSxEluH0jWAGQF9VVZMpxHVRZ/xSKQU4PR5Xy0+/sLQZCFS9DN/XKtSeh5WrL2x+sMyZv+W67+vwz5eC7oDx12rm9pakNg639B68XL3Qh+2Bm94DySxHhg0daBHSQhiCbyyyMS9SDi8RhEHyYP1qD9qak0S4VGn5VYrSTRKEkKHWYYiHuQmCYb/YKYLqS+3H5LYckxJmz6qhSYJ5yNgzgtuclESpncBfN8Fj3lgJdCSGpHcGECoxrouMoHjzO+4evLLMB1VKxJV8Wyj8Q80Ix043jnTu32hlTdkh08Yn7UWcnio9Qs3pzZm0lN7LCOxIdIZxbuQ1+lAVFFxJB7aMeUIiPkiPRPjo2v6dPF4FVjHnxi/oQK0Az/bymf5uI7ayGLj6eM63nrbF5VNXzV7nv3HViQL3JAEaSV1z0iBNJIgJBCYkSKJYbdjEiSHw7a0BI5s6QBBbINUswMUsQ6E11UojZGccA9dcZDBdQY+TgyFTgkiEKYyIBvstAQzIRk8cBJ+A2j4gZFDFWAqjAp3V5IhQYYwwUJ57ByS0QINzMYK8FyrRxt3KNbXb2qG/UVNT5wDyCt6/A0boGbdqzPA4tD21SPquWihPy1FWHjQzYs3xnZkM95ePIZd8RccBx1xez/UPowp46I4+uVcLD9/8Plq0Gfy6Jp+uez5uqPyY+UtNN5DuVQc06drpv4bIDXsjtsMpdkOSC79QK4Xog3PzwF4IBNCBiIhpBSpoE8jioqWaM2KCRuOqwLXgIQItKIe0lCYD/lZjoqgGIo0+J++SsmMKA8eqQ21qHuUh2PfzQHN6vgG6vVK8GfmQhcbr3Yff+AEi3rtdCtNF8u/eIWD2ATXx4Mg0XH1Vr/hm7sDQw8PvyvTrriKWocEE0C6oM/kJRJHrAykgj6WGlq+JUifu6YfS6pu4/UVa6AgQcXKi78ApekhcWFBwMstEkTX9MvVHw+Lt2ex+4+Pg62CxgsHEwZbAdgWIJfA+ICkfDRYtyAwWWB7Ay8F8VT/KB0bOJ4Gx/CQfUKSwZGrJJs8iZHYgB0zMB+zk8hopQ8hEcEog2ERASIBAOL5fIrVIKLxXKtzKPZLgZUckvGf+/nH5HsK0+Uz3316zeAjj3D23Lwu90w0ZwNpiZ72UnvwfO/AXIFnXfLBxLOsHn6yiLqmr3oQ04LHX9hq6TFHI6txrlYWkHj98UT1lh8vryR/rIKq6aO204drdP8hRWF3itmLUw42QnW1CSTSA2IAIXkWOBYKLWw8wjVqNkEaFqjFwLQNJhWI4ZiFoiq6QX0SbsEo6HMoWVFCYprwjw6FP65BXCSoXJwiOwpnFK9A6yiWkQhRDwA9XAfpwLS/AqnqSKP7jwapquiznXFXMn6x8Yg/X/HySvLHKqiaPlZfvf0H6BloAM/v3tpzHkJwUx59Uxb4GE5Lfnt2ZGS16SX3+F5mq4llfegtwnaSR6J5EC8hPUV6IDaS6aDnoZ5DpYe6AtdgOr4pyhXLNPH0KKCo/DDP7N+S+mI6qHzbQr7AbdgW+iylWn0l5cf6E29ftfSN6L9lGl04x30tOtMHklmLhxpClW9BL4S1T+i2uNPRp+0FflD0AN9A9LHnmHGBBfJCE3QL9ALiguoJqiu+64gDzWGIIAlhzhaSDsMV/yjJi3BxyY9khP9BXBSzEMY/AFORGMmM1yyKZfmm+ZKuJf4uMHV1THEj+o+S864E7zYd/8Dliqp2MamvPbt9uw4dY/M4DnXTuMuXx/scK9iHLcbryzfKwvOJBSGNPl10Tb8WV0xYyMFymDdXXv46Kq+ueChJQI4WlSUqf8StOf5CNdXqr9afxe8/Gm6AoLAqGKyCGLSG350ACFzKM2FvaeOseEhFOsjItdQ2S6wYYmkOdl2+CfLBvmpIV55vYY2Qn6uAxAWC40zbhxSmWArcQj0TSIiSU37mx0kgVesgLereOSz8E5EWJa6Qzyh1hZEcO7xY4Ct9WLfNvwa+5xA2h6uGP6vMPxMsZ8WNf0Gf+cOCw9usq51a5+kNG9Sn1IjJsjoO0LI7EpVra/vxhPdFs7JyjYriohlbTAKGxO1C6oJEljseOLqmTxfPX66OucJK66OUNzuDjK7p05UIbGwX25I/vrj4BYrnD0uZ/Rtvfzz9fPsPIkgkbL0DZNMFRVEHFEY2ZCBTcwMLdfCsCCVN4SwpE9YG+ARNgD24IDHYSYB1yNCYDkLRFoC8oOUG40AKQx5IYyAmlQ6SF7dDoSof0hbJiApzqLs43aPc5UG+AvVQ/4T7nGQFQiJ5kdbAkmgH2Sz0FaWB4gLrad22v4nmuvPt/yzCc1+V4t0e4z93r8PYwDCvNANxLSthkai0jmCf5+jq6y6Y4SkjTfoKprgWufj9Dg3AozBmiK7pl3H8WDH3u0YfLY6u6c/HVS2vSvsxoygyTF2q/qNenEyjJ5NJPYGPRidME1M1/JYqwyoNq32Ihu4J0z5M+WA2DoqwEI9wfmEaEhQJzPNsKNOh0jJwrfRVJqbnNOrC6IGwQFzgHiKrpCuq2kE+FizrMXWE7IWCEKemg7hSiimOQchNIC3EchqpHlBO95TshQThkwF5TL9k+Mm/MZLGzVo3AlQdLzagDle1vCYd/wU9/5Z5ZcyZPnNow/J8ZHZZCGtsbKw3rdn7nIzTx42o0WfP1cPKuYJ6XPFs5q7p8zmKx5v8cdcxDeMPOR1fj+gh4X10TV/dukiC+nJPeLy8eH1hrtm/UVvpKxcrP2oL/dlcs1eQ9PCeo73wGcp+R2Xyvlp74vH19B9EkoA2CYKUlcQqJCQj6vkoyBjh/IurcJiy4Zxy2FMptRBO7sK3kClR0UYUZAX+wMqfC1ICiYHMYBsKSQsSFKaAUEqZLoiK00ASFsgpN0UEUWE6yOkiiArE6NmUb91OWwAAEuNJREFUszCNxA0c/uBoF04W86YOarWQAYjGmHBBEIkUiXEqib025hNmInWknv6zKo77Sh3/RvcfSx5Xl4O4yr5Y7NxiuEEQFT4uvs8yrF5VvosX28LLS185vsiRHkc9YPiJtrCbJIzHyx3gJdfpl80flZWPR6qIxJghus7xjSqj4E9UNn2VvN76Csqq6XIR+48OYEeGlcAaXhLfQwxNQcgQEI9IErOOxBUuCuDLz9Arm5iyOTaYy7Jty8hAb2VCm43ZmwnwQTbgFpAWyA4SGEKhaMdgYNpngKAcpeMCAfFjYGE4yAqco3RZ0LorUqOkxVkf6AgzvFBPFbISSsOUD+WRrWijpcwbmI4Gomj4yxAIv4bPVU+q9sfxk/EP36UlfP49N3vNWr/m9CZdX/zzjDDofAoW3XHVr9NPHdB8p2+uORl/mjFLUktMbBTtkSJbpLCRxYyD5OpJps/4+DJuvq5IIgoLqfi3pLzcRuloM7QSzKImsBSWG80LVKkxkSvOkFHaCjL5QvrPN9rwvaSVtEg2ICmQCNRQkGjwnlOpNktMxdds+GxcRFrIyCmhTQMEUJjl4qwtzPbAOVC8o0DUZroGiMmBpEUfRBZ4DvRUJC4/1GOpij1ML9XU0PJdFxIZGsOpJkkOQ0YdFh5CPodKl0WfRqQkVUhTIEf1iN4GkdJU4Rx/xsJfHkpfMv4cd+IAUJb1+YdkfSU7NXp6+/bti7qquKiEdfVq0Gl2TO2DonYzAcUTCv0slCB8FuGia/q8j7iAPl30aNIPHVKq55w+00MvjFLo05WmV8H5P9XLzydVF/H0xbGl9UGfjm226B98po2u6fO+0f3H9M7SbT1h+FoS00ybSmm+5/RZHxzbwWvVHtSvNuLRR4BKl0vPtHRhWh1SESUsNBkH0qjvNiAx4MA1JDBc4yBmTPmwJArJCFM+dA1SE5XsmFIqRTzKUrZYkMio78IUkauFoW6Mcbin1GWrOR8nqOEUEUQFmuK3ZdEw6NFg92s9j3XLp0CIsAuS8VdPkcKhCZ9/KAc81x/c3NdzFjy6KHZc0YPNh7VhDg9jYnh4co9n2dvx1nLalys7Rimx2xLGigfEJBQ0Xr149FkBVb04BQiTlPAFbTiDxRGKM1pJf5AgarPKG0sQu413N07hkCANO5m0fSebtCwziW5DqMISHTRMJCDF23inYbmsauNCHq+Vn1ta5dErzKN8psP/RiIXVpAegKJQ30Y06AQSEXdAIpdL0wbTNsLpoSIeCwRJHZYBpTusIFAIlPC0iqL5AxoCcmLPQkkLdITRCc0dSFqQD1A51g4pLOXmhZCwDMO2BpH9q6ZtDoU4oKQIy5yEynFnv+mzw+0+/q3Sf5yT4aYs89zq1alLIK7wYeQANcCpgW5AOaqIARzxcudrXrMTz+cuFAxBI1Rw06eLKz3xsnDikt+Mmr9mWBlXrbySeJAlTt8MXJImXHRNv0zx2GpWZ3r0KKqzXHlRHH26+fQf+mkbg56ADjppUuihMJl7BEhGtmnj+4Phj1lEUAzjaQcgJkzcqPPmlI/yjdJV8Trf/+hbeYyP0uMS0zSVF8SEaSELxkhR6a7IC1IVHkNMBWEkCljxYQ7YXgWKrDCHw2ohJDDKSkr5Tst3TANBp7DdgkTFKSOpxYMtV2i3hXQoJjwbBo3L4oibAajdXmSbCl01PEvi6x3PetMvwfi3cv+xHpPRk8GZvo6Oq5y5FvZlvtfqQZ5v5igfH7iRdHqrn/H24McyEb6ejCUxkCwqEATi8JDNKtWRIxI6wrLj+aOyQgIqLT/KTZ+OLYnCFGHE60PdSgzIgVmcfrbt5evjYkB97VeNyv8plx/UYoChElhYgB7KtD3PAUWRpejIVNzNAjNzyDuYRqnrMF5dIx4CkTrlAJQRps2FhZIX5lqYwfFLOygTBeSmkUhDEgNvIC7MR5ML6JhozoCpn+858G1utbH4j7BRT0Z9VlZzbTyOKJCKeCjkqYbkFBJh+DXCPVcKuXKIFURlm8WBoZSFOBCYmk6i33ioT+Kw1CegEMspcFfe+M8+rRySNum/YUwm9I7TPT04NWOBDg/nwtz16xMbEp3mPswIOuI6G7wBSlynz1pQWZEIP0smIcEEWN3QsfJDn+nj9FFSPh73wilgdE2f+eOumo4pPqWI2kI/LKu4RVXLq7H/kJopRUFhnkj4joNT9KC/BlZgAIVD1I+cwASVUBgCIsF1KEQxJLpGPKHGP5LYrAs5ikREnmJ61KF4K5cG1+REVS6HC1JauGroYYcOrLWUEp6MSF0UpoZgK5hV2dgEzeNLYbMBnRQZEUPnOwGMT6GOp57Kg/0WTCMYjnsQHpDmlJFTR5IcNt/alvV1PdF5NsKcLSpGG03L6QcjnWDpeIXqgFYb//A9wGi1+fMPDeqY7nae6uvT530KKp+JebkhHJyX6Fqz33X83tCgRr1d6gXBH+XnFtEwDmEVMBfAtbK7UvHxVTb1gGLQokbFVBZMDtUJHmT+dsPxmqSRU2nkrxkWxhfbOfEVwLov4sIaonSRr1qZy6vy8xliPbn+qPjYHxSm6mJwdB357DfaVtJ/BMLeW0/ayVQSR6TA5AB7h8kwmFeRrFBUSFYkJk7GsM+F5SuiCQmFBEriCskHYcxfEM9ozBjBS/yaKD//rBzndjD3BHswAcmqwFdhOWGugCw5owwpEt9sxMlVGWQEK4GlcAOi1XAcL6eLICfdcMFmNDnH7xdO/YTCHTkxM2B6EiSPbuXmHrZO5eJy4Iu6lfo2Gu8orFfA+PM9UMjnHpBIx9v+/Q9Wm8nMfcMTE1d7u7vP4Ec6fzy1wqOGP3xI63JHjgT2/rsy/boTbMP0pe78dVUWS5wjK0VUjIqNN3kA62ZYeIcfxofXDFNFUZBTT4W6m71mWBlXrb4yWSoEYWh0jVIUdJEmzA6o18mRDN7dCplCEkK8IiP4WRAU9OO8j5wimZB3SAhKYlJEphLkJCaSEP7PEdxsfVG5UWFxP6qPPngTlvBED6IWLN8dTPmg8ocFPPRXWBdlFWqqCEmLlhAgLRtKdLaAkpQNfRUM6DUQGOUiTimNEaT7FvRVw/F6K91XG4/mHf9KPaovvJ36jzfSS1mpc6mUdhnvhZL4a0GjZsKBKK+n0+kt0AHvztCAsIzjeeAeUKVPF1l101cBWCICxcGmcPalUeHRnyguIsJYej79fFnpKxdjrKhu+spVK69Ke+OW6SXlh7Xk/8b7D5umJKY6nUiQAEmp5ZKoD5Ay8kTFzcAsJIrL+ZREYCWAaU4ubXRNP8wfpuSuGubHMwCJhSuGPCiYJIMw5GV6xkfY0Wd+WoPiBAlEhvnzNluw3SKZYTkQHIQ5J1RQDg7Lw/QQGUIdFp4wcC9KgQ/7KkxjucEHROVmc3ZaCFfEjMxUvlPvBZ0WhT1Q1zG06hQKyGPA9qEh4bPRJuO/0p//WvoPyXpa77BPr9L1mn64QiJRT0vlP3jg1oyn0/th1dnN6VOkQyh8wVRuPpLUH9GHi+sckD4vLaj43NSHLwfv8cKjbGxdgc97JUpFpIRbpovKYHTUltkpHYkyEqNYf1gWfZU+Vn+JiMZERS4qKyTAMv1hmwoItLT/aL6OL9cn8A4mknhDkR5CUuh43ExhAXjnIQVxRQ9UwnU1JM73meHISINzlY/1Ir3jwNQBtui5IpU3K2mFZbEUEhgJiHlZhkqI8rws7hPFxBHlZ5romu1CGRSv2HyQEQiLPkwefJcSk2o0mU+F8Z46KswbKd8qvRUWiq7BsuoYlF/q+Jd839p4/KNnFHhw+Fbc819r/y3dHO7qsk9D2lLPBvEq59SLXC6CYSCq1OTk5F48g+FxLyQSvvyzhFK8taaYL1ACiYdkkSOg/HVO4irmAySLlR8+yHy5wnaWysTF7YmnRxdyecMXFDcxx3KjNCUEGUtb2r4Iixwh5qebxEG58v2Hkh0ERqlLp5kClNLkngLSyF8XExrZi089SYbFm9DRg1FCbEKyoxQE8sqFkTOgTwrDVIPCP/k8qpRcGrxMEXmxnpwjUeXbhjpgA2bBNsp0HPQWOiwNOnddw5YcNIdSFyzTlUKehEbrLDxDNn7osjCXPw5FO22qgPfKHn/pf8XxxxetvSvYlX8BxBVKCdGDmPPDhz0W+Oijjxof//jHt+Hh2oko/qKqFx4l0BJQmQIwS3RNn/fxZXqGFbq4nQzimI9tKFs+S1S1KJ9XoQkEfUQwtKg98fSzefMMwmx5F28/IqK2RLjM2b54/gX0H0v6+IiDZSVgHJogfYWNzDMUpCtsUkKg4pKIUJAsnNTlkjNWzfBCPMOhi8JAiCSqPBmyMFVQ1OdctQwLywNZ5cPCpDl80D6IhjzBASQF0sUeREpSJCyE4ceSpJXbEO2612AHepaTSRn/YrtEAD3n8xV/ntv4+S96nyGRO9gccQZmEPiBK3bRi5kPHcG+v2T32n2+53bxNY8oQyWIB0SR9OmqxMeTh5lm/8azx8srEbCQNSqTpUTX+eagwCiPqiWeQAXO/olHV2tPaYUFjWCxsQJjt7MV564K6iOB2Xj1adNGa3PqDMFl4XwSSnAQCUIibqFPlwtTwbiOkoSR+JvLx3KYv9BXaSrlLyifSegQBNMFTAWhiIeFArRZnoX+8Y2EzKhbnuNlYO9wFpZXkwoH5Kmj/6qOFTz+0n8+Y4Y/2pVIcJqY35+YJ6wjEN33ZzL9kPY3hWjx6Sv+RcByLIQAZZYQJSn2C944FRF/QkvjQ31XZDcV04GVPOGl+WdJEhVGbaNPV3d7Va7ZP83U/1ACgzTjkg4gjUFvHhGWkrPAPnnBLNeFSEKKfAbzOu9yBAUdVj6cZURpZuU3XOUILioD93x2IEnxxFGc9c6M+M93cHSNZVzHquBQDeMn4x898wQ2us7pgGvAbyU8/z5e5EupVEqtJirCgp4KHxVI7sbrQIYKHyKF3+yvIvEEX8FsQNk9qXwgBpgQwNo7p9OKrukzfdzF08+WTmYrV35YF+tU8bEpYImInGtLVH+8PkzZ8iQcVpjrawXCLOHH5uo/9JmWjbXHJMQcNhVW8bOklbsumnJw7Q+cgtVK2mJxAUNNKKncp54KHuzAwnjCE01B1UIHA1A80ik/IkdIfTj6mE8MXh2sSKZhdHUd+IcDykwFLj4eMv7Fv+il75c8/xEmeHaojD+jZ4LgbsPVVvO5iutg4oSAFCCiAqVp/jrUKRU8mzVexsube05ff3tiD0Q1wkP/ojrYgeiaftiheHsjLKL4GrudTxYvb0H9h94bpzeAwCD4cAqJf5SmlBjFH5D8ChVC1Q8KyIkrjtgbE64y4lqtINJHel5Hq4q4ZdsYzsWBWaU+rkFWtFzQbiNNnWciNbT/qD4+Hitq/FdE/3mWzmvQU+W4hZZPenQuRHRNfylcvfVjpUqz0Tj6dNE1/fm4euufTx1z5am3/hr6z6lj9A9ElneKwPJ3IYEVEpqKys0YFeUhoDBP4TV/+bjVIkfqKuu8/ixC/+tqR73111V4DYnrrb+G8a+h1tkk9dY/m7MxV7XUzwdP3ApBgCYG6Co+L6/+kcB4X0g0ERFFzwXjojBc5q8ZhqOKtWEoROmLEwSWBIHowVySyqSS5kIABEYhisRFEov8SgRWGD6K9OMgq8IwBIkTBBYXASGsxcW3pUoHgfF5iIiLPv9x+03kuLxMqaqsUj1KJL4gsFgICGEtFrJtUG6OwDhtJHHhqLOl+dBAG0AnXRAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBAFBQBAQBAQBQUAQEAQEAUFAEBAEBIGVhMD/D0fV/fpMMM+gAAAAAElFTkSuQmCC"}},V8={noticeBar:{text:[],direction:"row",step:!1,icon:"volume",mode:"",color:"#f9ae3d",bgColor:"#fdf6ec",speed:80,fontSize:14,duration:2e3,disableTouch:!0,url:"",linkType:"navigateTo",justifyContent:"flex-start"}},j8={notify:{top:0,type:"primary",color:"#ffffff",bgColor:"",message:"",duration:3e3,fontSize:15,safeAreaInsetTop:!1}},q8={numberBox:{name:"",value:0,min:1,max:Number.MAX_SAFE_INTEGER,step:1,integer:!1,disabled:!1,disabledInput:!1,asyncChange:!1,inputWidth:35,showMinus:!0,showPlus:!0,decimalLength:null,longPress:!0,color:"#323233",buttonWidth:30,buttonSize:30,buttonRadius:"0px",bgColor:"#EBECEE",disabledBgColor:"#f7f8fa",inputBgColor:"#EBECEE",cursorSpacing:100,disableMinus:!1,disablePlus:!1,iconStyle:"",miniMode:!1}},W8={numberKeyboard:{mode:"number",dotDisabled:!1,random:!1}},z8={overlay:{show:!1,zIndex:10070,duration:300,opacity:.5}},Q8={parse:{copyLink:!0,errorImg:"",lazyLoad:!1,loadingImg:"",pauseVideo:!0,previewImg:!0,setTitle:!0,showImgMenu:!0}},Y8={picker:{show:!1,popupMode:"bottom",showToolbar:!0,title:"",columns:[],loading:!1,itemHeight:44,cancelText:"取消",confirmText:"确定",cancelColor:"#909193",confirmColor:"",visibleItemCount:5,keyName:"text",valueName:"value",closeOnClickOverlay:!1,defaultIndex:[],immediateChange:!0,zIndex:10076,disabled:!1,disabledColor:"",placeholder:"请选择",inputProps:{},bgColor:"",round:0,duration:300,overlayOpacity:.5}},X8={popup:{show:!1,overlay:!0,mode:"bottom",duration:300,closeable:!1,overlayStyle:{},closeOnClickOverlay:!0,zIndex:10075,safeAreaInsetBottom:!0,safeAreaInsetTop:!1,closeIconPos:"top-right",round:0,zoom:!0,bgColor:"",overlayOpacity:.5}},J8={radio:{name:"",shape:"",disabled:"",labelDisabled:"",activeColor:"",inactiveColor:"",iconSize:"",labelSize:"",label:"",labelColor:"",size:"",iconColor:"",placement:""}},Z8={radioGroup:{value:"",disabled:!1,shape:"circle",activeColor:"#2979ff",inactiveColor:"#c8c9cc",name:"",size:18,placement:"row",label:"",labelColor:"#303133",labelSize:14,labelDisabled:!1,iconColor:"#ffffff",iconSize:12,borderBottom:!1,iconPlacement:"left",gap:"10px"}},eS={rate:{value:1,count:5,disabled:!1,size:18,inactiveColor:"#b2b2b2",activeColor:"#FA3534",gutter:4,minCount:1,allowHalf:!1,activeIcon:"star-fill",inactiveIcon:"star",touchable:!0}},tS={readMore:{showHeight:400,toggle:!1,closeText:"展开阅读全文",openText:"收起",color:"#2979ff",fontSize:14,textIndent:"2em",name:""}},sS={row:{gutter:0,justify:"start",align:"center"}},iS={rowNotice:{text:"",icon:"volume",mode:"",color:"#f9ae3d",bgColor:"#fdf6ec",fontSize:14,speed:80}},nS={scrollList:{indicatorWidth:50,indicatorBarWidth:20,indicator:!0,indicatorColor:"#f2f2f2",indicatorActiveColor:"#3c9cff",indicatorStyle:""}},rS={search:{shape:"round",bgColor:"#f2f2f2",placeholder:"请输入关键字",clearabled:!0,focus:!1,showAction:!0,actionStyle:{},actionText:"搜索",inputAlign:"left",inputStyle:{},disabled:!1,borderColor:"transparent",searchIconColor:"#909399",searchIconSize:22,color:"#606266",placeholderColor:"#909399",searchIcon:"search",iconPosition:"left",margin:"0",animation:!1,value:"",maxlength:"-1",height:32,label:null}},oS={section:{title:"",subTitle:"更多",right:!0,fontSize:15,bold:!0,color:"#303133",subColor:"#909399",showLine:!0,lineColor:"",arrow:!0}},aS={skeleton:{loading:!0,animate:!0,rows:0,rowsWidth:"100%",rowsHeight:18,title:!0,titleWidth:"50%",titleHeight:18,avatar:!1,avatarSize:32,avatarShape:"circle"}},lS={slider:{value:0,blockSize:18,min:0,max:100,step:1,activeColor:"#2979ff",inactiveColor:"#c0c4cc",blockColor:"#ffffff",showValue:!1,disabled:!1,blockStyle:{},useNative:!1,height:"2px"}},cS={statusBar:{bgColor:"transparent",height:0}},uS={steps:{direction:"row",current:0,activeColor:"#3c9cff",inactiveColor:"#969799",activeIcon:"",inactiveIcon:"",dot:!1}},fS={stepsItem:{title:"",desc:"",iconSize:17,error:!1}},hS={sticky:{offsetTop:0,customNavHeight:0,disabled:!1,bgColor:"transparent",zIndex:"",index:""}},dS={subsection:{list:[],current:0,activeColor:"#3c9cff",inactiveColor:"#303133",mode:"button",fontSize:12,bold:!0,bgColor:"#eeeeef",keyName:"name",activeColorKeyName:"activeColorKey",inactiveColorKeyName:"inactiveColorKey",disabled:!1}},pS={swipeAction:{autoClose:!0}},gS={swipeActionItem:{show:!1,closeOnClick:!0,name:"",disabled:!1,threshold:20,autoClose:!0,options:[],duration:300}},mS={swiper:{list:[],indicator:!1,indicatorActiveColor:"#FFFFFF",indicatorInactiveColor:"rgba(255, 255, 255, 0.35)",indicatorStyle:"",indicatorMode:"line",autoplay:!0,current:0,currentItemId:"",interval:3e3,duration:300,circular:!1,previousMargin:0,nextMargin:0,acceleration:!1,displayMultipleItems:1,easingFunction:"default",keyName:"url",imgMode:"aspectFill",height:130,bgColor:"#f3f4f6",radius:4,loading:!1,showTitle:!1}},xS={swiperIndicator:{length:0,current:0,indicatorActiveColor:"",indicatorInactiveColor:"",indicatorMode:"line"}},yS={switch:{loading:!1,disabled:!1,size:25,activeColor:"#2979ff",inactiveColor:"#ffffff",value:!1,activeValue:!0,inactiveValue:!1,asyncChange:!1,space:0}},vS={tabbar:{value:null,safeAreaInsetBottom:!0,border:!0,zIndex:1,activeColor:"#1989fa",inactiveColor:"#7d7e80",fixed:!0,placeholder:!0}},ES={tabbarItem:{name:null,icon:"",badge:null,dot:!1,text:"",badgeStyle:"top: 6px;right:2px;"}},AS={tabs:{duration:300,list:[],lineColor:"",activeStyle:{color:"#303133"},inactiveStyle:{color:"#606266"},lineWidth:20,lineHeight:3,lineBgSize:"cover",itemStyle:{height:"44px"},scrollable:!0,current:0,keyName:"name",iconStyle:{}}},SS={tag:{type:"primary",disabled:!1,size:"medium",shape:"square",text:"",bgColor:"",color:"",borderColor:"",closeColor:"#C6C7CB",name:"",plainFill:!1,plain:!1,closable:!1,show:!0,icon:"",iconColor:"",textSize:"",height:"",padding:"",borderRadius:"",autoBgColor:0}},TS={text:{type:"",show:!0,text:"",prefixIcon:"",suffixIcon:"",mode:"",href:"",format:"",call:!1,openType:"",bold:!1,block:!1,lines:"",color:"#303133",size:15,iconStyle:{fontSize:"15px"},decoration:"none",margin:0,lineHeight:"",align:"left",wordWrap:"normal",flex1:!0}},bS={textarea:{value:"",placeholder:"",placeholderClass:"textarea-placeholder",placeholderStyle:"color: #c0c4cc",height:70,confirmType:"done",disabled:!1,count:!1,focus:!1,autoHeight:!1,fixed:!1,cursorSpacing:0,cursor:"",showConfirmBar:!0,selectionStart:-1,selectionEnd:-1,adjustPosition:!0,disableDefaultPadding:!1,holdKeyboard:!1,maxlength:140,border:"surround",formatter:null}},_S={toast:{zIndex:10090,loading:!1,message:"",icon:"",type:"",loadingMode:"",show:"",overlay:!1,position:"center",params:{},duration:2e3,isTab:!1,url:"",callback:null,back:!1}},IS={toolbar:{show:!0,cancelText:"取消",confirmText:"确认",cancelColor:"#909193",confirmColor:"",title:""}},CS={tooltip:{text:"",copyText:"",size:14,color:"#606266",bgColor:"transparent",direction:"top",zIndex:10071,showCopy:!0,buttons:[],overlay:!0,showToast:!0,popupBgColor:"",triggerMode:"longpress"}},LS={transition:{show:!1,mode:"fade",duration:"300",timingFunction:"ease-out"}},DS={upload:{accept:"image",extension:[],capture:["album","camera"],compressed:!0,camera:"back",maxDuration:60,uploadIcon:"camera-fill",uploadIconColor:"#D3D4D6",useBeforeRead:!1,previewFullImage:!0,maxCount:52,disabled:!1,imageMode:"aspectFill",name:"",sizeType:["original","compressed"],multiple:!1,deletable:!0,maxSize:Number.MAX_VALUE,fileList:[],uploadText:"",width:80,height:80,previewImage:!0,autoDelete:!1,autoUpload:!1,autoUploadApi:"",autoUploadAuthUrl:"",autoUploadDriver:"",autoUploadHeader:{},getVideoThumb:!1,customAfterAutoUpload:!1,videoPreviewObjectFit:"cover"}},Ic={...zA,...QA,...YA,...XA,...JA,...ZA,...e8,...t8,...s8,...i8,...n8,...r8,...o8,...a8,...l8,...c8,...u8,...f8,...h8,...d8,...p8,...g8,...m8,...x8,...y8,...v8,...E8,...A8,...S8,...T8,...b8,..._8,...I8,...C8,...L8,...D8,...R8,...w8,...P8,...k8,...F8,...O8,...M8,...N8,...U8,...$8,...H8,...G8,...K8,...V8,...j8,...q8,...W8,...z8,...Q8,...Y8,...X8,...J8,...Z8,...eS,...tS,...sS,...iS,...nS,...rS,...oS,...aS,...lS,...cS,...uS,...fS,...hS,...dS,...pS,...gS,...mS,...xS,...yS,...vS,...ES,...AS,...SS,...TS,...bS,..._S,...IS,...CS,...LS,...DS};function RS(i){li(Qs,i.config||{}),li(Ic,i.props||{}),li(eo,i.color||{}),li(bc,i.zIndex||{})}if(X&&X.upuiParams){console.log("setting uview-plus");let i=X.upuiParams();i.httpIns&&i.httpIns(_c),i.options&&RS(i.options)}let to="none";to="vue3";to="mp";to="weixin";const wS=to;let PS=["primary","success","error","warning","info"];function Sg(i){Ds.shallowMerge(Qs,i.config||{}),Ds.shallowMerge(Ic,i.props||{}),Ds.shallowMerge(eo,i.color||{}),Ds.shallowMerge(bc,i.zIndex||{})}Ds.setConfig=Sg;const y0={route:pl,date:Ds.timeFormat,colorGradient:Bn.colorGradient,hexToRgb:Bn.hexToRgb,rgbToHex:Bn.rgbToHex,colorToRgba:Bn.colorToRgba,test:hg,type:PS,http:_c,config:Qs,zIndex:bc,debounce:IA,throttle:CA,calc:PA,mixin:vg,mpMixin:TA,props:Ic,...Ds,color:eo,platform:wS},kS=(i,e="")=>{if(e){X.upuiParams=e;let t=e();t.httpIns&&t.httpIns(_c),t.options&&Sg(t.options)}X.$u=y0,i.config.globalProperties.$u=y0,i.mixin(vg)},BS={install:kS},j=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)},FS=Number.isSafeInteger||function(i){return typeof i=="number"&&Math.abs(i)<=OS},OS=Number.MAX_SAFE_INTEGER||9007199254740991;let Z=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}({}),$=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.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",i.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",i.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",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.ASSET_LIST_LOAD_ERROR="assetListLoadError",i.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",i.ASSET_LIST_PARSING_ERROR="assetListParsingError",i.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",i.INTERNAL_EXCEPTION="internalException",i.INTERNAL_ABORTED="aborted",i.ATTACH_MEDIA_ERROR="attachMediaError",i.UNKNOWN="unknown",i}({}),A=function(i){return i.MEDIA_ATTACHING="hlsMediaAttaching",i.MEDIA_ATTACHED="hlsMediaAttached",i.MEDIA_DETACHING="hlsMediaDetaching",i.MEDIA_DETACHED="hlsMediaDetached",i.MEDIA_ENDED="hlsMediaEnded",i.STALL_RESOLVED="hlsStallResolved",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.BUFFERED_TO_END="hlsBufferedToEnd",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.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",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_TRACK_UPDATED="hlsSubtitleTrackUpdated",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.ASSET_LIST_LOADING="hlsAssetListLoading",i.ASSET_LIST_LOADED="hlsAssetListLoaded",i.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",i.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",i.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",i.INTERSTITIAL_STARTED="hlsInterstitialStarted",i.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",i.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",i.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",i.INTERSTITIAL_ENDED="hlsInterstitialEnded",i.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",i.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",i.EVENT_CUE_ENTER="hlsEventCueEnter",i}({});var ce={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Y={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class ti{constructor(e,t=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class MS{constructor(e,t,s,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ti(e),this.fast_=new ti(t),this.defaultTTFB_=n,this.ttfb_=new ti(e)}update(e,t){const{slow_:s,fast_:n,ttfb_:r}=this;s.halfLife!==e&&(this.slow_=new ti(e,s.getEstimate(),s.getTotalWeight())),n.halfLife!==t&&(this.fast_=new ti(t,n.getEstimate(),n.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new ti(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,n=e/1e3,r=s/n;this.fast_.sample(n,r),this.slow_.sample(n,r)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function NS(i,e,t){return(e=$S(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ge(){return ge=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},ge.apply(null,arguments)}function v0(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,s)}return t}function xe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?v0(Object(t),!0).forEach(function(s){NS(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):v0(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function US(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function $S(i){var e=US(i,"string");return typeof e=="symbol"?e:e+""}class Ct{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const s=`[${e}]:`;this.trace=ns,this.debug=t.debug.bind(null,s),this.log=t.log.bind(null,s),this.warn=t.warn.bind(null,s),this.info=t.info.bind(null,s),this.error=t.error.bind(null,s)}}const ns=function(){},HS={trace:ns,debug:ns,log:ns,warn:ns,info:ns,error:ns};function yl(){return ge({},HS)}function GS(i,e){const t=self.console[i];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${i}] >`):ns}function E0(i,e,t){return e[i]?e[i].bind(e):GS(i,t)}const vl=yl();function KS(i,e,t){const s=yl();if(typeof console=="object"&&i===!0||typeof i=="object"){const n=["debug","log","info","warn","error"];n.forEach(r=>{s[r]=E0(r,i,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.7`)}catch{return yl()}n.forEach(r=>{vl[r]=E0(r,i)})}else ge(vl,s);return s}const de=vl;function vs(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function VS(i){return typeof self<"u"&&i===self.ManagedMediaSource}function Tg(i,e){const t=Object.keys(i),s=Object.keys(e),n=t.length,r=s.length;return!n||!r||n===r&&!t.some(o=>s.indexOf(o)===-1)}function ct(i,e=!1){if(typeof TextDecoder<"u"){const l=new TextDecoder("utf-8").decode(i);if(e){const u=l.indexOf("\0");return u!==-1?l.substring(0,u):l}return l.replace(/\0/g,"")}const t=i.length;let s,n,r,o="",a=0;for(;a<t;){if(s=i[a++],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[a++],o+=String.fromCharCode((s&31)<<6|n&63);break;case 14:n=i[a++],r=i[a++],o+=String.fromCharCode((s&15)<<12|(n&63)<<6|(r&63)<<0);break}}return o}const Ls={hexDump:function(i){let e="";for(let t=0;t<i.length;t++){let s=i[t].toString(16);s.length<2&&(s="0"+s),e+=s}return e}};function bg(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function jS(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var xo={exports:{}},A0;function qS(){return A0||(A0=1,function(i,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(c,l,u){if(u=u||{},c=c.trim(),l=l.trim(),!l){if(!u.alwaysNormalize)return c;var f=a.parseURL(c);if(!f)throw new Error("Error trying to parse base URL.");return f.path=a.normalizePath(f.path),a.buildURLFromParts(f)}var h=a.parseURL(l);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return u.alwaysNormalize?(h.path=a.normalizePath(h.path),a.buildURLFromParts(h)):l;var d=a.parseURL(c);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var p=n.exec(d.path);d.netLoc=p[1],d.path=p[2]}d.netLoc&&!d.path&&(d.path="/");var m={scheme:d.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(m.netLoc=d.netLoc,h.path[0]!=="/"))if(!h.path)m.path=d.path,h.params||(m.params=d.params,h.query||(m.query=d.query));else{var g=d.path,y=g.substring(0,g.lastIndexOf("/")+1)+h.path;m.path=a.normalizePath(y)}return m.path===null&&(m.path=u.alwaysNormalize?a.normalizePath(h.path):h.path),a.buildURLFromParts(m)},parseURL:function(c){var l=s.exec(c);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(r,"");c.length!==(c=c.replace(o,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};i.exports=a})()}(xo)),xo.exports}var Cc=qS();class Lc{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 ye={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class _g{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,zS(this,"stats")}setByteRange(e,t){const s=e.split("@",2);let n;s.length===1?n=(t==null?void 0:t.byteRangeEndOffset)||0:n=parseInt(s[1]),this._byteRange=[n,parseInt(s[0])+n]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[ye.AUDIO]:null,[ye.VIDEO]:null,[ye.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new Lc),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Cc.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[ye.AUDIO]=null,e[ye.VIDEO]=null,e[ye.AUDIOVIDEO]=null}}function De(i){return i.sn!=="initSegment"}class yo extends _g{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange){const e=this.byteRange[0],t=this.byteRange[1];if(j(e)&&j(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const s=Object.keys(this.levelkeys);if(s.length===1)return this._decryptdata=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=j(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),s=t.length;if(s>1||s===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!j(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return De(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,n,r,o=!1){const{elementaryStreams:a}=this,c=a[e];if(!c){a[e]={startPTS:t,endPTS:s,startDTS:n,endDTS:r,partial:o};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,s),c.startDTS=Math.min(c.startDTS,n),c.endDTS=Math.max(c.endDTS,r)}}class WS extends _g{constructor(e,t,s,n,r){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Ig(i,e){const t=Object.getPrototypeOf(i);if(t){const s=Object.getOwnPropertyDescriptor(t,e);return s||Ig(t,e)}}function zS(i,e){const t=Ig(i,e);t&&(t.enumerable=!0,Object.defineProperty(i,e,t))}const S0=Math.pow(2,32)-1,QS=[].push,Cg={video:1,audio:2,id3:3,text:4};function Ne(i){return String.fromCharCode.apply(null,i)}function Lg(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function ie(i,e){const t=Dg(i,e);return t<0?4294967296+t:t}function T0(i,e){let t=ie(i,e);return t*=Math.pow(2,32),t+=ie(i,e+4),t}function Dg(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function YS(i){const e=i.byteLength;for(let t=0;t<e;){const s=ie(i,t);if(s>8&&i[t+4]===109&&i[t+5]===111&&i[t+6]===111&&i[t+7]===102)return!0;t=s>1?t+s:e}return!1}function ae(i,e){const t=[];if(!e.length)return t;const s=i.byteLength;for(let n=0;n<s;){const r=ie(i,n),o=Ne(i.subarray(n+4,n+8)),a=r>1?n+r:s;if(o===e[0])if(e.length===1)t.push(i.subarray(n+8,a));else{const c=ae(i.subarray(n+8,a),e.slice(1));c.length&&QS.apply(t,c)}n=a}return t}function XS(i){const e=[],t=i[0];let s=8;const n=ie(i,s);s+=4;let r=0,o=0;t===0?(r=ie(i,s),o=ie(i,s+4),s+=8):(r=T0(i,s),o=T0(i,s+8),s+=16),s+=2;let a=i.length+o;const c=Lg(i,s);s+=2;for(let l=0;l<c;l++){let u=s;const f=ie(i,u);u+=4;const h=f&2147483647;if((f&2147483648)>>>31===1)return de.warn("SIDX has hierarchical references (not supported)"),null;const p=ie(i,u);u+=4,e.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/n,start:a,end:a+h-1}}),a+=h,u+=4,s=u}return{earliestPresentationTime:r,timescale:n,version:t,referencesCount:c,references:e}}function Rg(i){const e=[],t=ae(i,["moov","trak"]);for(let n=0;n<t.length;n++){const r=t[n],o=ae(r,["tkhd"])[0];if(o){let a=o[0];const c=ie(o,a===0?12:20),l=ae(r,["mdia","mdhd"])[0];if(l){a=l[0];const u=ie(l,a===0?12:20),f=ae(r,["mdia","hdlr"])[0];if(f){const h=Ne(f.subarray(8,12)),d={soun:ye.AUDIO,vide:ye.VIDEO}[h],p=ae(r,["mdia","minf","stbl","stsd"])[0],m=JS(p);d?(e[c]={timescale:u,type:d,stsd:m},e[d]=xe({timescale:u,id:c},m)):e[c]={timescale:u,type:h,stsd:m}}}}}return ae(i,["moov","mvex","trex"]).forEach(n=>{const r=ie(n,4),o=e[r];o&&(o.default={duration:ie(n,12),flags:ie(n,20)})}),e}function JS(i){const e=i.subarray(8),t=e.subarray(86),s=Ne(e.subarray(4,8));let n=s,r;const o=s==="enca"||s==="encv";if(o){const l=ae(e,[s])[0].subarray(s==="enca"?28:78);ae(l,["sinf"]).forEach(f=>{const h=ae(f,["schm"])[0];if(h){const d=Ne(h.subarray(4,8));if(d==="cbcs"||d==="cenc"){const p=ae(f,["frma"])[0];p&&(n=Ne(p))}}})}const a=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=ae(t,["avcC"])[0];c&&c.length>3&&(n+="."+On(c[1])+On(c[2])+On(c[3]),r=Fn(a==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=ae(e,[s])[0],l=ae(c.subarray(28),["esds"])[0];if(l&&l.length>7){let u=4;if(l[u++]!==3)break;u=vo(l,u),u+=2;const f=l[u++];if(f&128&&(u+=2),f&64&&(u+=l[u++]),l[u++]!==4)break;u=vo(l,u);const h=l[u++];if(h===64)n+="."+On(h);else break;if(u+=12,l[u++]!==5)break;u=vo(l,u);const d=l[u++];let p=(d&248)>>3;p===31&&(p+=1+((d&7)<<3)+((l[u]&224)>>5)),n+="."+p}break}case"hvc1":case"hev1":{const c=ae(t,["hvcC"])[0];if(c&&c.length>12){const l=c[1],u=["","A","B","C"][l>>6],f=l&31,h=ie(c,2),d=(l&32)>>5?"H":"L",p=c[12],m=c.subarray(6,12);n+="."+u+f,n+="."+ZS(h).toString(16).toUpperCase(),n+="."+d+p;let g="";for(let y=m.length;y--;){const v=m[y];(v||g)&&(g="."+v.toString(16).toUpperCase()+g)}n+=g}r=Fn(a=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=Fn(n,t)||n;break}case"vp09":{const c=ae(t,["vpcC"])[0];if(c&&c.length>6){const l=c[4],u=c[5],f=c[6]>>4&15;n+="."+Dt(l)+"."+Dt(u)+"."+Dt(f)}break}case"av01":{const c=ae(t,["av1C"])[0];if(c&&c.length>2){const l=c[1]>>>5,u=c[1]&31,f=c[2]>>>7?"H":"M",h=(c[2]&64)>>6,d=(c[2]&32)>>5,p=l===2&&h?d?12:10:h?10:8,m=(c[2]&16)>>4,g=(c[2]&8)>>3,y=(c[2]&4)>>2,v=c[2]&3;n+="."+l+"."+Dt(u)+f+"."+Dt(p)+"."+m+"."+g+y+v+"."+Dt(1)+"."+Dt(1)+"."+Dt(1)+"."+0,r=Fn("dav1",t)}break}}return{codec:n,encrypted:o,supplemental:r}}function Fn(i,e){const t=ae(e,["dvvC"]),s=t.length?t[0]:ae(e,["dvcC"])[0];if(s){const n=s[2]>>1&127,r=s[2]<<5&32|s[3]>>3&31;return i+"."+Dt(n)+"."+Dt(r)}}function ZS(i){let e=0;for(let t=0;t<32;t++)e|=(i>>t&1)<<31-t;return e>>>0}function vo(i,e){const t=e+5;for(;i[e++]&128&&e<t;);return e}function On(i){return("0"+i.toString(16).toUpperCase()).slice(-2)}function Dt(i){return(i<10?"0":"")+i}function e6(i,e){if(!i||!e)return i;const t=e.keyId;return t&&e.isCommonEncryption&&ae(i,["moov","trak"]).forEach(n=>{const o=ae(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=ae(o,["enca"]);const c=a.length>0;c||(a=ae(o,["encv"])),a.forEach(l=>{const u=c?l.subarray(28):l.subarray(78);ae(u,["sinf"]).forEach(h=>{const d=t6(h);if(d){const p=d.subarray(8,24);p.some(m=>m!==0)||(de.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${Ls.hexDump(p)} -> ${Ls.hexDump(t)}`),d.set(t,8))}})})}),i}function t6(i){const e=ae(i,["schm"])[0];if(e){const t=Ne(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ae(i,["schi","tenc"])[0]}return null}function s6(i,e,t){const s={},n=ae(i,["moof","traf"]);for(let r=0;r<n.length;r++){const o=n[r],a=ae(o,["tfhd"])[0],c=ie(a,4),l=e[c];if(!l)continue;const u=s[c]||(s[c]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type}),f=ae(o,["tfdt"])[0];if(f){const x=f[0];let E=ie(f,4);x===1&&(E===S0?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(E*=S0+1,E+=ie(f,8))),j(E)&&(!j(u.start)||E<u.start)&&(u.start=E)}const h=l.default,d=ie(a,0)|(h==null?void 0:h.flags);let p=(h==null?void 0:h.duration)||0;d&8&&(d&2?p=ie(a,12):p=ie(a,8));const m=ae(o,["trun"]);let g=u.start||0,y=0,v=p;for(let x=0;x<m.length;x++){const E=m[x],S=ie(E,4),T=u.sampleCount;u.sampleCount+=S;const _=E[3]&1,I=E[3]&4,R=E[2]&1,b=E[2]&2,L=E[2]&4,k=E[2]&8;let M=8,N=S;for(_&&(M+=4),I&&S&&(!(E[M+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=T),M+=4,R?(v=ie(E,M),M+=4):v=p,b&&(M+=4),k&&(M+=4),g+=v,y+=v,N--);N--;)R?(v=ie(E,M),M+=4):v=p,b&&(M+=4),L&&(E[M+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(N+1),u.keyFrameStart=g),M+=4),k&&(M+=4),g+=v,y+=v;!y&&p&&(y+=p*S)}u.duration+=y}if(!Object.keys(s).some(r=>s[r].duration)){let r=1/0,o=0;const a=ae(i,["sidx"]);for(let c=0;c<a.length;c++){const l=XS(a[c]);if(l!=null&&l.references){r=Math.min(r,l.earliestPresentationTime/l.timescale);const u=l.references.reduce((f,h)=>f+h.info.duration||0,0);o=Math.max(o,u+l.earliestPresentationTime/l.timescale)}}o&&j(o)&&Object.keys(s).forEach(c=>{s[c].duration||(s[c].duration=o*s[c].timescale-s[c].start)})}return s}function i6(i){const e={valid:null,remainder:null},t=ae(i,["moof"]);if(t.length<2)return e.remainder=i,e;const s=t[t.length-1];return e.valid=i.slice(0,s.byteOffset-8),e.remainder=i.slice(s.byteOffset-8),e}function xt(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function b0(i,e){const t=[],s=e.samples,n=e.timescale,r=e.id;let o=!1;return ae(s,["moof"]).map(c=>{const l=c.byteOffset-8;ae(c,["traf"]).map(f=>{const h=ae(f,["tfdt"]).map(d=>{const p=d[0];let m=ie(d,4);return p===1&&(m*=Math.pow(2,32),m+=ie(d,8)),m/n})[0];return h!==void 0&&(i=h),ae(f,["tfhd"]).map(d=>{const p=ie(d,4),m=ie(d,0)&16777215,g=(m&1)!==0,y=(m&2)!==0,v=(m&8)!==0;let x=0;const E=(m&16)!==0;let S=0;const T=(m&32)!==0;let _=8;p===r&&(g&&(_+=8),y&&(_+=4),v&&(x=ie(d,_),_+=4),E&&(S=ie(d,_),_+=4),T&&(_+=4),e.type==="video"&&(o=so(e.codec)),ae(f,["trun"]).map(I=>{const R=I[0],b=ie(I,0)&16777215,L=(b&1)!==0;let k=0;const M=(b&4)!==0,N=(b&256)!==0;let F=0;const O=(b&512)!==0;let K=0;const B=(b&1024)!==0,G=(b&2048)!==0;let H=0;const C=ie(I,4);let D=8;L&&(k=ie(I,D),D+=4),M&&(D+=4);let P=k+l;for(let w=0;w<C;w++){if(N?(F=ie(I,D),D+=4):F=x,O?(K=ie(I,D),D+=4):K=S,B&&(D+=4),G&&(R===0?H=ie(I,D):H=Dg(I,D),D+=4),e.type===ye.VIDEO){let W=0;for(;W<K;){const z=ie(s,P);if(P+=4,n6(o,s[P])){const ne=s.subarray(P,P+z);Dc(ne,o?2:1,i+H/n,t)}P+=z,W+=z+4}}i+=F/n}}))})})}),t}function so(i){if(!i)return!1;const e=i.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function n6(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Dc(i,e,t,s){const n=wg(i);let r=0;r+=e;let o=0,a=0,c=0;for(;r<n.length;){o=0;do{if(r>=n.length)break;c=n[r++],o+=c}while(c===255);a=0;do{if(r>=n.length)break;c=n[r++],a+=c}while(c===255);const l=n.length-r;let u=r;if(a<l)r+=a;else if(a>l){de.error(`Malformed SEI payload. ${a} is too small, only ${l} bytes left to parse.`);break}if(o===4){if(n[u++]===181){const h=Lg(n,u);if(u+=2,h===49){const d=ie(n,u);if(u+=4,d===1195456820){const p=n[u++];if(p===3){const m=n[u++],g=31&m,y=64&m,v=y?2+g*3:0,x=new Uint8Array(v);if(y){x[0]=m;for(let E=1;E<v;E++)x[E]=n[u++]}s.push({type:p,payloadType:o,pts:t,bytes:x})}}}}}else if(o===5&&a>16){const f=[];for(let p=0;p<16;p++){const m=n[u++].toString(16);f.push(m.length==1?"0"+m:m),(p===3||p===5||p===7||p===9)&&f.push("-")}const h=a-16,d=new Uint8Array(h);for(let p=0;p<h;p++)d[p]=n[u++];s.push({payloadType:o,pts:t,uuid:f.join(""),userData:ct(d),userDataBytes:d})}}}function wg(i){const e=i.byteLength,t=[];let s=1;for(;s<e-2;)i[s]===0&&i[s+1]===0&&i[s+2]===3?(t.push(s+2),s+=2):s++;if(t.length===0)return i;const n=e-t.length,r=new Uint8Array(n);let o=0;for(s=0;s<n;o++,s++)o===t[0]&&(o++,t.shift()),r[s]=i[o];return r}function r6(i){const e=i[0];let t="",s="",n=0,r=0,o=0,a=0,c=0,l=0;if(e===0){for(;Ne(i.subarray(l,l+1))!=="\0";)t+=Ne(i.subarray(l,l+1)),l+=1;for(t+=Ne(i.subarray(l,l+1)),l+=1;Ne(i.subarray(l,l+1))!=="\0";)s+=Ne(i.subarray(l,l+1)),l+=1;s+=Ne(i.subarray(l,l+1)),l+=1,n=ie(i,12),r=ie(i,16),a=ie(i,20),c=ie(i,24),l=28}else if(e===1){l+=4,n=ie(i,l),l+=4;const f=ie(i,l);l+=4;const h=ie(i,l);for(l+=4,o=2**32*f+h,FS(o)||(o=Number.MAX_SAFE_INTEGER,de.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=ie(i,l),l+=4,c=ie(i,l),l+=4;Ne(i.subarray(l,l+1))!=="\0";)t+=Ne(i.subarray(l,l+1)),l+=1;for(t+=Ne(i.subarray(l,l+1)),l+=1;Ne(i.subarray(l,l+1))!=="\0";)s+=Ne(i.subarray(l,l+1)),l+=1;s+=Ne(i.subarray(l,l+1)),l+=1}const u=i.subarray(l,i.byteLength);return{schemeIdUri:t,value:s,timeScale:n,presentationTime:o,presentationTimeDelta:r,eventDuration:a,id:c,payload:u}}function o6(i,...e){const t=e.length;let s=8,n=t;for(;n--;)s+=e[n].byteLength;const r=new Uint8Array(s);for(r[0]=s>>24&255,r[1]=s>>16&255,r[2]=s>>8&255,r[3]=s&255,r.set(i,4),n=0,s=8;n<t;n++)r.set(e[n],s),s+=e[n].byteLength;return r}function a6(i,e,t){if(i.byteLength!==16)throw new RangeError("Invalid system id");let s,n;s=0,n=new Uint8Array;let r;s>0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),o6([112,115,115,104],new Uint8Array([s,0,0,0]),i,r,n,o,t||new Uint8Array)}const Pg=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ei={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Rc(i,e){const t=Ei[e];return!!t&&!!t[i.slice(0,4)]}function El(i,e,t=!0){return!i.split(",").some(s=>!wc(s,e,t))}function wc(i,e,t=!0){var s;const n=vs(t);return(s=n==null?void 0:n.isTypeSupported(on(i,e)))!=null?s:!1}function on(i,e){return`${e}/mp4;codecs=${i}`}function _0(i){if(i){const e=i.substring(0,4);return Ei.video[e]}return 2}function Lr(i){const e=Pg();return i.split(",").reduce((t,s)=>{const r=e&&so(s)?9:Ei.video[s];return r?(r*2+t)/(t?3:2):(Ei.audio[s]+t)/(t?2:1)},0)}const Eo={};function l6(i,e=!0){if(Eo[i])return Eo[i];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[i];for(let n=0;n<t.length;n++){var s;if(wc(t[n],"audio",e))return Eo[i]=t[n],t[n];if(t[n]==="mp3"&&(s=vs(e))!=null&&s.isTypeSupported("audio/mpeg"))return""}return i}const c6=/flac|opus|mp4a\.40\.34/i;function Dr(i,e=!0){return i.replace(c6,t=>l6(t.toLowerCase(),e))}function u6(i,e){const t=[];if(i){const s=i.split(",");for(let n=0;n<s.length;n++)Rc(s[n],"video")||t.push(s[n])}return e&&t.push(e),t.join(",")}function sr(i,e){if(i&&(i.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(i)!==-1)&&(I0(i,"audio")||I0(i,"video")))return i;if(e){const t=e.split(",");if(t.length>1){if(i){for(let s=t.length;s--;)if(t[s].substring(0,4)===i.substring(0,4))return t[s]}return t[0]}}return e||i}function I0(i,e){return Rc(i,e)&&wc(i,e)}function f6(i){const e=i.split(",");for(let t=0;t<e.length;t++){const s=e[t].split(".");s.length>2&&s[0]==="avc1"&&(e[t]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return e.join(",")}function h6(i){if(i.startsWith("av01.")){const e=i.split("."),t=["0","111","01","01","01","0"];for(let s=e.length;s>4&&s<10;s++)e[s]=t[s-4];return e.join(".")}return i}function C0(i){const e=vs(i)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Al(i){return i.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const kg={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Bg(i,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:i}}function d6(i,e,t,s,n,r){const o=i.videoCodec,a=i.audioCodec?i.audioGroups:null,c=r==null?void 0:r.audioCodec,l=r==null?void 0:r.channels,u=l?parseInt(l):c?1/0:2;let f=null;if(a!=null&&a.length)try{a.length===1&&a[0]?f=e.groups[a[0]].channels:f=a.reduce((h,d)=>{if(d){const p=e.groups[d];if(!p)throw new Error(`Audio track group ${d} not found`);Object.keys(p.channels).forEach(m=>{h[m]=(h[m]||0)+p.channels[m]})}return h},{2:0})}catch{return!0}return o!==void 0&&(o.split(",").some(h=>so(h))||i.width>1920&&i.height>1088||i.height>1920&&i.width>1088||i.frameRate>Math.max(s,30)||i.videoRange!=="SDR"&&i.videoRange!==t||i.bitrate>Math.max(n,8e6))||!!f&&j(u)&&Object.keys(f).some(h=>parseInt(h)>u)}function Fg(i,e,t,s={}){const n=i.videoCodec;if(!n&&!i.audioCodec||!t)return Promise.resolve(kg);const r=[],o=p6(i),a=o.length,c=g6(i,e,a>0),l=c.length;for(let u=a||1*l||1;u--;){const f={type:"media-source"};if(a&&(f.video=o[u%a]),l){f.audio=c[u%l];const h=f.audio.bitrate;f.video&&h&&(f.video.bitrate-=h)}r.push(f)}if(n){const u=navigator.userAgent;if(n.split(",").some(f=>so(f))&&Pg())return Promise.resolve(Bg(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),r))}return Promise.all(r.map(u=>{const f=x6(u);return s[f]||(s[f]=t.decodingInfo(u))})).then(u=>({supported:!u.some(f=>!f.supported),configurations:r,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:r,decodingInfoResults:[],error:u}))}function p6(i){var e;const t=(e=i.videoCodec)==null?void 0:e.split(","),s=Og(i),n=i.width||640,r=i.height||480,o=i.frameRate||30,a=i.videoRange.toLowerCase();return t?t.map(c=>{const l={contentType:on(h6(c),"video"),width:n,height:r,bitrate:s,framerate:o};return a!=="sdr"&&(l.transferFunction=a),l}):[]}function g6(i,e,t){var s;const n=(s=i.audioCodec)==null?void 0:s.split(","),r=Og(i);return n&&i.audioGroups?i.audioGroups.reduce((o,a)=>{var c;const l=a?(c=e.groups[a])==null?void 0:c.tracks:null;return l?l.reduce((u,f)=>{if(f.groupId===a){const h=parseFloat(f.channels||"");n.forEach(d=>{const p={contentType:on(d,"audio"),bitrate:t?m6(d,r):r};h&&(p.channels=""+h),u.push(p)})}return u},o):o},[]):[]}function m6(i,e){if(e<=1)return 1;let t=128e3;return i==="ec-3"?t=768e3:i==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Og(i){return Math.ceil(Math.max(i.bitrate*.9,i.averageBitrate)/1e3)*1e3||1}function x6(i){let e="";const{audio:t,video:s}=i;if(s){const n=Al(s.contentType);e+=`${n}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(t){const n=Al(t.contentType);e+=`${s?"_":""}${n}_c${t.channels}`}return e}const Sl=["NONE","TYPE-0","TYPE-1",null];function y6(i){return Sl.indexOf(i)>-1}const Rr=["SDR","PQ","HLG"];function v6(i){return!!i&&Rr.indexOf(i)>-1}var ir={No:"",Yes:"YES",v2:"v2"};function L0(i){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=i,n=s<e/2;return e&&n?t?ir.v2:ir.Yes:ir.No}class D0{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class an{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(s=>!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const s=(t=e.supplemental)==null?void 0:t.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return R0(this._audioGroups,e)}hasSubtitleGroup(e){return R0(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function R0(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function E6(){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 A6(i,e){let t=!1,s=[];if(i&&(t=i!=="SDR",s=[i]),e){s=e.allowedVideoRanges||Rr.slice(0);const n=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&E6(),t||(s=["SDR"])}return{preferHDR:t,allowedVideoRanges:s}}const S6=i=>{const e=new WeakSet;return(t,s)=>{if(i&&(s=i(t,s)),typeof s=="object"&&s!==null){if(e.has(s))return;e.add(s)}return s}},Ee=(i,e)=>JSON.stringify(i,S6(e));function T6(i,e,t,s,n){const r=Object.keys(i),o=s==null?void 0:s.channels,a=s==null?void 0:s.audioCodec,c=n==null?void 0:n.videoCodec,l=o&&parseInt(o)===2;let u=!1,f=!1,h=1/0,d=1/0,p=1/0,m=1/0,g=0,y=[];const{preferHDR:v,allowedVideoRanges:x}=A6(e,n);for(let I=r.length;I--;){const R=i[r[I]];u||(u=R.channels[2]>0),h=Math.min(h,R.minHeight),d=Math.min(d,R.minFramerate),p=Math.min(p,R.minBitrate),x.filter(L=>R.videoRanges[L]>0).length>0&&(f=!0)}h=j(h)?h:0,d=j(d)?d:0;const E=Math.max(1080,h),S=Math.max(30,d);p=j(p)?p:t,t=Math.max(p,t),f||(e=void 0);const T=r.length>1;return{codecSet:r.reduce((I,R)=>{const b=i[R];if(R===I)return I;if(y=f?x.filter(L=>b.videoRanges[L]>0):[],T){if(b.minBitrate>t)return Lt(R,`min bitrate of ${b.minBitrate} > current estimate of ${t}`),I;if(!b.hasDefaultAudio)return Lt(R,"no renditions with default or auto-select sound found"),I;if(a&&R.indexOf(a.substring(0,4))%5!==0)return Lt(R,`audio codec preference "${a}" not found`),I;if(o&&!l){if(!b.channels[o])return Lt(R,`no renditions with ${o} channel sound found (channels options: ${Object.keys(b.channels)})`),I}else if((!a||l)&&u&&b.channels[2]===0)return Lt(R,"no renditions with stereo sound found"),I;if(b.minHeight>E)return Lt(R,`min resolution of ${b.minHeight} > maximum of ${E}`),I;if(b.minFramerate>S)return Lt(R,`min framerate of ${b.minFramerate} > maximum of ${S}`),I;if(!y.some(L=>b.videoRanges[L]>0))return Lt(R,`no variants with VIDEO-RANGE of ${Ee(y)} found`),I;if(c&&R.indexOf(c.substring(0,4))%5!==0)return Lt(R,`video codec preference "${c}" not found`),I;if(b.maxScore<g)return Lt(R,`max score of ${b.maxScore} < selected max of ${g}`),I}return I&&(Lr(R)>=Lr(I)||b.fragmentError>i[I].fragmentError)?I:(m=b.minIndex,g=b.maxScore,R)},void 0),videoRanges:y,preferHDR:v,minFramerate:d,minBitrate:p,minIndex:m}}function Lt(i,e){de.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function Mg(i){return i.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const n=t.channels||"2";return s.channels[n]=(s.channels[n]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function b6(i,e,t,s){return i.slice(t,s+1).reduce((n,r,o)=>{if(!r.codecSet)return n;const a=r.audioGroups;let c=n[r.codecSet];c||(n[r.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,r.bitrate);const l=Math.min(r.height,r.width);return c.minHeight=Math.min(c.minHeight,l),c.minFramerate=Math.min(c.minFramerate,r.frameRate),c.minIndex=Math.min(c.minIndex,o),c.maxScore=Math.max(c.maxScore,r.score),c.fragmentError+=r.fragmentError,c.videoRanges[r.videoRange]=(c.videoRanges[r.videoRange]||0)+1,a&&a.forEach(u=>{if(!u)return;const f=e.groups[u];f&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(h=>{c.channels[h]=(c.channels[h]||0)+f.channels[h]}))}),n},{})}function w0(i){if(!i)return i;const{lang:e,assocLang:t,characteristics:s,channels:n,audioCodec:r}=i;return{lang:e,assocLang:t,characteristics:s,channels:n,audioCodec:r}}function Bt(i,e,t){if("attrs"in i){const s=e.indexOf(i);if(s!==-1)return s}for(let s=0;s<e.length;s++){const n=e[s];if(Fs(i,n,t))return s}return-1}function Fs(i,e,t){const{groupId:s,name:n,lang:r,assocLang:o,default:a}=i,c=i.forced;return(s===void 0||e.groupId===s)&&(n===void 0||e.name===n)&&(r===void 0||_6(r,e.lang))&&(r===void 0||e.assocLang===o)&&(a===void 0||e.default===a)&&(c===void 0||e.forced===c)&&(!("characteristics"in i)||I6(i.characteristics||"",e.characteristics))&&(t===void 0||t(i,e))}function _6(i,e="--"){return i.length===e.length?i===e:i.startsWith(e)||e.startsWith(i)}function I6(i,e=""){const t=i.split(","),s=e.split(",");return t.length===s.length&&!t.some(n=>s.indexOf(n)===-1)}function _s(i,e){const{audioCodec:t,channels:s}=i;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function C6(i,e,t,s,n){const r=e[s],a=e.reduce((h,d,p)=>{const m=d.uri;return(h[m]||(h[m]=[])).push(p),h},{})[r.uri];a.length>1&&(s=Math.max.apply(Math,a));const c=r.videoRange,l=r.frameRate,u=r.codecSet.substring(0,4),f=P0(e,s,h=>{if(h.videoRange!==c||h.frameRate!==l||h.codecSet.substring(0,4)!==u)return!1;const d=h.audioGroups,p=t.filter(m=>!d||d.indexOf(m.groupId)!==-1);return Bt(i,p,n)>-1});return f>-1?f:P0(e,s,h=>{const d=h.audioGroups,p=t.filter(m=>!d||d.indexOf(m.groupId)!==-1);return Bt(i,p,n)>-1})}function P0(i,e,t){for(let s=e;s>-1;s--)if(t(i[s]))return s;for(let s=e+1;s<i.length;s++)if(t(i[s]))return s;return-1}function wr(i,e){var t;return!!i&&i!==((t=e.loadLevelObj)==null?void 0:t.uri)}class L6 extends Ct{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var s;const{fragCurrent:n,partCurrent:r,hls:o}=this,{autoLevelEnabled:a,media:c}=o;if(!n||!c)return;const l=performance.now(),u=r?r.stats:n.stats,f=r?r.duration:n.duration,h=l-u.loading.start,d=o.minAutoLevel,p=n.level,m=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||p<=d){this.clearTimer(),this._nextAutoLevel=-1;return}if(!a)return;const g=m>-1&&m!==p,y=!!t||g;if(!y&&(c.paused||!c.playbackRate||!c.readyState))return;const v=o.mainForwardBufferInfo;if(!y&&v===null)return;const x=this.bwEstimator.getEstimateTTFB(),E=Math.abs(c.playbackRate);if(h<=Math.max(x,1e3*(f/(E*2))))return;const S=v?v.len/E:0,T=u.loading.first?u.loading.first-u.loading.start:-1,_=u.loaded&&T>-1,I=this.getBwEstimate(),R=o.levels,b=R[p],L=Math.max(u.loaded,Math.round(f*(n.bitrate||b.averageBitrate)/8));let k=_?h-T:h;k<1&&_&&(k=Math.min(h,u.loaded*8/I));const M=_?u.loaded*1e3/k:0,N=x/1e3,F=M?(L-u.loaded)/M:L*8/I+N;if(F<=S)return;const O=M?M*8:I,K=((s=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,B=this.hls.config.abrBandWidthUpFactor;let G=Number.POSITIVE_INFINITY,H;for(H=p-1;H>d;H--){const w=R[H].maxBitrate,W=!R[H].details||K;if(G=this.getTimeToLoadFrag(N,O,f*w,W),G<Math.min(S,f+N))break}if(G>=F||G>f*10)return;_?this.bwEstimator.sample(h-Math.min(x,T),u.loaded):this.bwEstimator.sampleTTFB(h);const C=R[H].maxBitrate;this.getBwEstimate()*B>C&&this.resetEstimator(C);const D=this.findBestLevel(C,d,H,0,S,1,1);D>-1&&(H=D),this.warn(`Fragment ${n.sn}${r?" part "+r.index:""} of level ${p} is loading too slowly;
- Fragment duration: ${n.duration.toFixed(3)}
- Time to underbuffer: ${S.toFixed(3)} s
- Estimated load time for current fragment: ${F.toFixed(3)} s
- Estimated load time for down switch fragment: ${G.toFixed(3)} s
- TTFB estimate: ${T|0} ms
- Current BW estimate: ${j(I)?I|0:"Unknown"} bps
- New BW estimate: ${this.getBwEstimate()|0} bps
- Switching to level ${H} @ ${C|0} bps`),o.nextLoadLevel=o.nextAutoLevel=H,this.clearTimer();const P=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===H&&H>0){const w=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${H>0?"and switching down":""}
- Fragment duration: ${n.duration.toFixed(3)} s
- Time to underbuffer: ${w.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,H>d){let W=this.findBestLevel(this.hls.levels[d].bitrate,d,H,0,w,1,1);W===-1&&(W=d),this.hls.nextLoadLevel=this.hls.nextAutoLevel=W,this.resetEstimator(this.hls.levels[W].bitrate)}}};g||F>G*2?P():this.timer=self.setInterval(P,G*1e3),o.trigger(A.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:r,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new MS(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.FRAG_LOADING,this.onFragLoading,this),e.on(A.FRAG_LOADED,this.onFragLoaded,this),e.on(A.FRAG_BUFFERED,this.onFragBuffered,this),e.on(A.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(A.LEVEL_LOADED,this.onLevelLoaded,this),e.on(A.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(A.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(A.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.FRAG_LOADING,this.onFragLoading,this),e.off(A.FRAG_LOADED,this.onFragLoaded,this),e.off(A.FRAG_BUFFERED,this.onFragBuffered,this),e.off(A.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(A.LEVEL_LOADED,this.onLevelLoaded,this),e.off(A.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(A.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(A.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var n;this.fragCurrent=s,this.partCurrent=(n=t.part)!=null?n: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 $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:n,partCurrent:r}=this;if(s&&n&&s.sn===n.sn&&s.level===n.level){const o=performance.now(),a=r?r.stats:s.stats,c=o-a.loading.start,l=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&l>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(f,l),a.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,s,n){const r=e+s/t,o=n?e+this.lastLevelLoadSec:0;return r+o}onLevelLoaded(e,t){const s=this.hls.config,{loading:n}=t.stats,r=n.end-n.first;j(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:s}){const n=s?s.stats:t.stats;if(t.type===Y.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=s?s.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+n.loaded,c=(o.loaded?o.loaded.duration:0)+r;o.loaded={bytes:a,duration:c},o.realBitrate=Math.round(8*a/c)}if(t.bitrateTest){const r={stats:n,frag:t,part:s,id:t.type};this.onFragBuffered(A.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:n}=t,r=n!=null&&n.stats.loaded?n.stats:s.stats;if(r.aborted||this.ignoreFragment(s))return;const o=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,r.loaded),r.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Y.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,r=this.findBestLevel(s,t,e,0,n,1,1);if(r>-1)return r;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=s&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,r)&&o[e].loadError<=o[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:n,config:r,minAutoLevel:o}=s,a=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),l=this.getStarvationDelay();let u=r.abrBandWidthFactor,f=r.abrBandWidthUpFactor;if(l){const g=this.findBestLevel(c,o,n,l,0,u,f);if(g>=0)return this.rebufferNotice=-1,g}let h=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const g=this.bitrateTestDelay;g&&(h=(a?Math.min(a,r.maxLoadingDelay):r.maxLoadingDelay)-g,this.info(`bitrate test took ${Math.round(1e3*g)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),u=f=1)}const d=this.findBestLevel(c,o,n,l,h,u,f);if(this.rebufferNotice!==d&&(this.rebufferNotice=d,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`)),d>-1)return d;const p=s.levels[o],m=s.loadLevelObj;return m&&(p==null?void 0:p.bitrate)<m.bitrate?o:s.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const s=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/s}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,s,n,r,o,a){var c;const l=n+r,u=this.lastLoadedFragLevel,f=u===-1?this.hls.firstLevel:u,{fragCurrent:h,partCurrent:d}=this,{levels:p,allAudioTracks:m,loadLevel:g,config:y}=this.hls;if(p.length===1)return 0;const v=p[f],x=!!((c=this.hls.latestLevelDetails)!=null&&c.live),E=g===-1||u===-1;let S,T="SDR",_=(v==null?void 0:v.frameRate)||0;const{audioPreference:I,videoPreference:R}=y,b=this.audioTracksByGroup||(this.audioTracksByGroup=Mg(m));let L=-1;if(E){if(this.firstSelection!==-1)return this.firstSelection;const K=this.codecTiers||(this.codecTiers=b6(p,b,t,s)),B=T6(K,T,e,I,R),{codecSet:G,videoRanges:H,minFramerate:C,minBitrate:D,minIndex:P,preferHDR:w}=B;L=P,S=G,T=w?H[H.length-1]:H[0],_=C,e=Math.max(e,D),this.log(`picked start tier ${Ee(B)}`)}else S=v==null?void 0:v.codecSet,T=v==null?void 0:v.videoRange;const k=d?d.duration:h?h.duration:0,M=this.bwEstimator.getEstimateTTFB()/1e3,N=[];for(let K=s;K>=t;K--){var F,O;const B=p[K],G=K>f;if(!B)continue;if(y.useMediaCapabilities&&!B.supportedResult&&!B.supportedPromise){const z=navigator.mediaCapabilities;typeof(z==null?void 0:z.decodingInfo)=="function"&&d6(B,b,T,_,e,I)?(B.supportedPromise=Fg(B,b,z,this.supportedCache),B.supportedPromise.then(ne=>{if(!this.hls)return;B.supportedResult=ne;const ee=this.hls.levels,pe=ee.indexOf(B);ne.error?this.warn(`MediaCapabilities decodingInfo error: "${ne.error}" for level ${pe} ${Ee(ne)}`):ne.supported?ne.decodingInfoResults.some(fe=>fe.smooth===!1||fe.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${pe} not smooth or powerEfficient: ${Ee(ne)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${pe} ${Ee(ne)}`),pe>-1&&ee.length>1&&(this.log(`Removing unsupported level ${pe}`),this.hls.removeLevel(pe),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):B.supportedResult=kg}if((S&&B.codecSet!==S||T&&B.videoRange!==T||G&&_>B.frameRate||!G&&_>0&&_<B.frameRate||(F=B.supportedResult)!=null&&(O=F.decodingInfoResults)!=null&&O.some(z=>z.smooth===!1))&&(!E||K!==L)){N.push(K);continue}const H=B.details,C=(d?H==null?void 0:H.partTarget:H==null?void 0:H.averagetargetduration)||k;let D;G?D=a*e:D=o*e;const P=k&&n>=k*2&&r===0?B.averageBitrate:B.maxBitrate,w=this.getTimeToLoadFrag(M,D,P*C,H===void 0);if(D>=P&&(K===u||B.loadError===0&&B.fragmentError===0)&&(w<=M||!j(w)||x&&!this.bitrateTestDelay||w<l)){const z=this.forcedAutoLevel;return K!==g&&(z===-1||z!==g)&&(N.length&&this.trace(`Skipped level(s) ${N.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${p[N[0]].codecs}" ${p[N[0]].videoRange}; not compatible with "${S}" ${T}`),this.info(`switch candidate:${f}->${K} adjustedbw(${Math.round(D)})-bitrate=${Math.round(D-P)} ttfb:${M.toFixed(1)} avgDuration:${C.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${w.toFixed(1)} firstSelection:${E} codecSet:${B.codecSet} videoRange:${B.videoRange} hls.loadLevel:${g}`)),E&&(this.firstSelection=K),K}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),t)}}const Ng={search:function(i,e){let t=0,s=i.length-1,n=null,r=null;for(;t<=s;){n=(t+s)/2|0,r=i[n];const o=e(r);if(o>0)t=n+1;else if(o<0)s=n-1;else return r}return null}};function D6(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!j(e))return null;const s=i[0].programDateTime;if(e<(s||0))return null;const n=i[i.length-1].endProgramDateTime;if(e>=(n||0))return null;for(let r=0;r<i.length;++r){const o=i[r];if(w6(e,t,o))return o}return null}function Hs(i,e,t=0,s=0,n=.005){let r=null;if(i){r=e[1+i.sn-e[0].sn]||null;const a=i.endDTS-t;a>0&&a<15e-7&&(t+=15e-7),r&&i.level!==r.level&&r.end<=i.end&&(r=e[2+i.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!i||i.level===r.level)&&k0(t,s,r)===0||R6(r,i,Math.min(n,s))))return r;const o=Ng.search(e,k0.bind(null,t,s));return o&&(o!==i||!r)?o:r}function R6(i,e,t){if(e&&e.start===0&&e.level<i.level&&(e.endPTS||0)>0){const s=e.tagList.reduce((n,r)=>(r[0]==="INF"&&(n+=parseFloat(r[1])),n),t);return i.start<=s}return!1}function k0(i=0,e=0,t){if(t.start<=i&&t.start+t.duration>i)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=i?1:t.start-s>i&&t.start?-1:0}function w6(i,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>i}function Ug(i,e,t){if(i&&i.startCC<=e&&i.endCC>=e){let s=i.fragments;const{fragmentHint:n}=i;n&&(s=s.concat(n));let r;return Ng.search(s,o=>o.cc<e?1:o.cc>e?-1:(r=o,o.end<=t?1:o.start>t?-1:0)),r||null}return null}function Pr(i){switch(i.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function B0(i,e){const t=Pr(e);return i.default[`${t?"timeout":"error"}Retry`]}function Pc(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function F0(i){return xe(xe({},i),{errorRetry:null,timeoutRetry:null})}function kr(i,e,t,s){if(!i)return!1;const n=s==null?void 0:s.code,r=e<i.maxNumRetry&&(P6(n)||!!t);return i.shouldRetry?i.shouldRetry(i,e,t,s,r):r}function P6(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}var We={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Tt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class k6 extends Ct{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(A.ERROR,this.onError,this),e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(A.ERROR,this.onError,this),e.off(A.ERROR,this.onErrorOut,this),e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.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)===Y.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var s;if(t.fatal)return;const n=this.hls,r=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case $.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction=ln();return}case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=We.SendAlternateToPenaltyBox;return}case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:{var o,a;const l=t.parent===Y.MAIN?t.level:n.loadLevel;t.details===$.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(a=o.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:typeof(r==null?void 0:r.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const l=n.loadLevelObj;if(l&&(r.type===ce.AUDIO_TRACK&&l.hasAudioGroup(r.groupId)||r.type===ce.SUBTITLE_TRACK&&l.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=We.SendAlternateToPenaltyBox,t.errorAction.flags=Tt.MoveAllAlternatesMatchingHost;return}}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.loadLevelObj,u=l==null?void 0:l.attrs["HDCP-LEVEL"];u?t.errorAction={action:We.SendAlternateToPenaltyBox,flags:Tt.MoveAllAlternatesMatchingHDCP,hdcpLevel:u}:this.keySystemError(t)}return;case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:n.loadLevel)}return;case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:t.errorAction=ln();return}t.type===Z.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,n=B0(s.config.playlistLoadPolicy,e),r=this.playlistError++;if(kr(n,r,Pr(e),e.response))return{action:We.RetryRequest,flags:Tt.None,retryConfig:n,retryCount:r};const a=this.getLevelSwitchAction(e,t);return n&&(a.retryConfig=n,a.retryCount=r),a}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),n=t.levels[s],{fragLoadPolicy:r,keyLoadPolicy:o}=t.config,a=B0(e.details.startsWith("key")?o:r,e),c=t.levels.reduce((u,f)=>u+f.fragmentError,0);if(n&&(e.details!==$.FRAG_GAP&&n.fragmentError++,kr(a,c,Pr(e),e.response)))return{action:We.RetryRequest,flags:Tt.None,retryConfig:a,retryCount:c};const l=this.getLevelSwitchAction(e,s);return a&&(l.retryConfig=a,l.retryCount=c),l}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const n=this.hls.levels[t];if(n){var r,o;const l=e.details;n.loadError++,l===$.BUFFER_APPEND_ERROR&&n.fragmentError++;let u=-1;const{levels:f,loadLevel:h,minAutoLevel:d,maxAutoLevel:p}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const m=(r=e.frag)==null?void 0:r.type,y=(m===Y.AUDIO&&l===$.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===$.BUFFER_ADD_CODEC_ERROR||l===$.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:T})=>n.audioCodec!==T),x=e.sourceBufferName==="video"&&(l===$.BUFFER_ADD_CODEC_ERROR||l===$.BUFFER_APPEND_ERROR)&&f.some(({codecSet:T,audioCodec:_})=>n.codecSet!==T&&n.audioCodec===_),{type:E,groupId:S}=(o=e.context)!=null?o:{};for(let T=f.length;T--;){const _=(T+h)%f.length;if(_!==h&&_>=d&&_<=p&&f[_].loadError===0){var a,c;const I=f[_];if(l===$.FRAG_GAP&&m===Y.MAIN&&e.frag){const R=f[_].details;if(R){const b=Hs(e.frag,R.fragments,e.frag.start);if(b!=null&&b.gap)continue}}else{if(E===ce.AUDIO_TRACK&&I.hasAudioGroup(S)||E===ce.SUBTITLE_TRACK&&I.hasSubtitleGroup(S))continue;if(m===Y.AUDIO&&(a=n.audioGroups)!=null&&a.some(R=>I.hasAudioGroup(R))||m===Y.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(R=>I.hasSubtitleGroup(R))||y&&n.audioCodec===I.audioCodec||!y&&n.audioCodec!==I.audioCodec||x&&n.codecSet===I.codecSet)continue}u=_;break}}if(u>-1&&s.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:We.SendAlternateToPenaltyBox,flags:Tt.None,nextAutoLevel:u}}return{action:We.SendAlternateToPenaltyBox,flags:Tt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case We.DoNothing:break;case We.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==$.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:n,hdcpLevel:r,nextAutoLevel:o}=s;switch(n){case Tt.None:this.switchLevel(e,o);break;case Tt.MoveAllAlternatesMatchingHDCP:r&&(t.maxHdcpLevel=Sl[Sl.indexOf(r)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}s.resolved||this.switchLevel(e,o)}switchLevel(e,t){if(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,e.details===$.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const s=Al(e.mimeType),n=this.hls.levels;for(let r=n.length;r--;)n[r][`${e.sourceBufferName}Codec`]===s&&this.hls.removeLevel(r)}}}function ln(i){const e={action:We.DoNothing,flags:Tt.None};return i&&(e.resolved=!0),e}var ke={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class B6{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(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.BUFFER_APPENDED,this.onBufferAppended,this),e.on(A.FRAG_BUFFERED,this.onFragBuffered,this),e.on(A.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.BUFFER_APPENDED,this.onBufferAppended,this),e.off(A.FRAG_BUFFERED,this.onFragBuffered,this),e.off(A.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const s=this.activePartLists[t];if(s)for(let n=s.length;n--;){const r=s[n];if(!r)break;const o=r.end;if(r.start<=e&&o!==null&&e<=o)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,s){const{fragments:n}=this,r=Object.keys(n);for(let o=r.length;o--;){const a=n[r[o]];if((a==null?void 0:a.body.type)===t&&(!s||a.buffered)){const c=a.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,s,n,r){this.timeRanges&&(this.timeRanges[e]=t);const o=(n==null?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(a=>{const c=this.fragments[a];if(!c||o>=c.body.sn)return;if(!c.buffered&&(!c.loaded||r)){c.body.type===s&&this.removeFragment(c.body);return}const l=c.range[e];if(l){if(l.time.length===0){this.removeFragment(c.body);return}l.time.some(u=>{const f=!this.isTimeBuffered(u.startPTS,u.endPTS,t);return f&&this.removeFragment(c.body),f})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const s=e.frag,n=si(s),r=this.fragments[n];if(!r||r.buffered&&s.gap)return;const o=!s.relurl;Object.keys(t).forEach(a=>{const c=s.elementaryStreams[a];if(!c)return;const l=t[a],u=o||c.partial===!0;r.range[a]=this.getBufferedTimes(s,e.part,u,l)}),r.loaded=null,Object.keys(r.range).length?(r.buffered=!0,(r.body.endList=s.endList||r.body.endList)&&(this.endListFragments[r.body.type]=r),Mn(r)||this.removeParts(s.sn-1,s.type)):this.removeFragment(r.body)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=O0(s,n=>n.fragment.sn>=e))}fragBuffered(e,t){const s=si(e);let n=this.fragments[s];!n&&t&&(n=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(e,t,s,n){const r={time:[],partial:s},o=e.start,a=e.end,c=e.minEndPTS||a,l=e.maxStartPTS||o;for(let u=0;u<n.length;u++){const f=n.start(u)-this.bufferPadding,h=n.end(u)+this.bufferPadding;if(l>=f&&c<=h){r.time.push({startPTS:Math.max(o,n.start(u)),endPTS:Math.min(a,n.end(u))});break}else if(o<h&&a>f){const d=Math.max(o,n.start(u)),p=Math.min(a,n.end(u));p>d&&(r.partial=!0,r.time.push({startPTS:d,endPTS:p}))}else if(a<=f)break}return r}getPartialFragment(e){let t=null,s,n,r,o=0;const{bufferPadding:a,fragments:c}=this;return Object.keys(c).forEach(l=>{const u=c[l];u&&Mn(u)&&(n=u.body.start-a,r=u.body.end+a,e>=n&&e<=r&&(s=Math.min(e-n,r-e),o<=s&&(t=u.body,o=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Mn(t))}getState(e){const t=si(e),s=this.fragments[t];return s?s.buffered?Mn(s)?ke.PARTIAL:ke.OK:ke.APPENDING:ke.NOT_LOADED}isTimeBuffered(e,t,s){let n,r;for(let o=0;o<s.length;o++){if(n=s.start(o)-this.bufferPadding,r=s.end(o)+this.bufferPadding,e>=n&&t<=r)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const s=t.frag,n=t.part?null:t,r=si(s);this.fragments[r]={body:s,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:n,timeRanges:r,type:o}=t;if(s.sn==="initSegment")return;const a=s.type;if(n){let l=this.activePartLists[a];l||(this.activePartLists[a]=l=[]),l.push(n)}this.timeRanges=r;const c=r[o];this.detectEvictedFragments(o,c,a,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=si(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,s=Object.keys(t);if(!e)return s.length>0;for(let n=s.length;n--;){const r=t[s[n]];if((r==null?void 0:r.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,n,r){n&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const c=a.body;c.type!==s||n&&!c.gap||c.start<t&&c.end>e&&(a.buffered||r)&&this.removeFragment(c)})}removeFragment(e){const t=si(e);e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const n=e.sn;this.activePartLists[e.type]=O0(s,r=>r.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const s=(e=this.hls)==null||(t=e.latestLevelDetails)==null?void 0:t.partList;s&&s.forEach(n=>n.clearElementaryStreamInfo())}}function Mn(i){var e,t,s;return i.buffered&&(i.body.gap||((e=i.range.video)==null?void 0:e.partial)||((t=i.range.audio)==null?void 0:t.partial)||((s=i.range.audiovideo)==null?void 0:s.partial))}function si(i){return`${i.type}_${i.level}_${i.sn}`}function O0(i,e){return i.filter(t=>{const s=e(t);return s||t.clearElementaryStreamInfo(),s})}var Es={cbc:0,ctr:1};class F6{constructor(e,t,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=s}decrypt(e,t){switch(this.aesMode){case Es.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Es.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function O6(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?i.slice(0,e-t):i}class M6{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),s=new Uint32Array(4);for(let n=0;n<4;n++)s[n]=t.getUint32(n*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,n=s[0],r=s[1],o=s[2],a=s[3],c=this.invSubMix,l=c[0],u=c[1],f=c[2],h=c[3],d=new Uint32Array(256);let p=0,m=0,g=0;for(g=0;g<256;g++)g<128?d[g]=g<<1:d[g]=g<<1^283;for(g=0;g<256;g++){let y=m^m<<1^m<<2^m<<3^m<<4;y=y>>>8^y&255^99,e[p]=y,t[y]=p;const v=d[p],x=d[v],E=d[x];let S=d[y]*257^y*16843008;n[p]=S<<24|S>>>8,r[p]=S<<16|S>>>16,o[p]=S<<8|S>>>24,a[p]=S,S=E*16843009^x*65537^v*257^p*16843008,l[y]=S<<24|S>>>8,u[y]=S<<16|S>>>16,f[y]=S<<8|S>>>24,h[y]=S,p?(p=v^d[d[d[E^v]]],m^=d[d[m]]):p=m=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,n=0;for(;n<t.length&&s;)s=t[n]===this.key[n],n++;if(s)return;this.key=t;const r=this.keySize=t.length;if(r!==4&&r!==6&&r!==8)throw new Error("Invalid aes key size="+r);const o=this.ksRows=(r+6+1)*4;let a,c;const l=this.keySchedule=new Uint32Array(o),u=this.invKeySchedule=new Uint32Array(o),f=this.sBox,h=this.rcon,d=this.invSubMix,p=d[0],m=d[1],g=d[2],y=d[3];let v,x;for(a=0;a<o;a++){if(a<r){v=l[a]=t[a];continue}x=v,a%r===0?(x=x<<8|x>>>24,x=f[x>>>24]<<24|f[x>>>16&255]<<16|f[x>>>8&255]<<8|f[x&255],x^=h[a/r|0]<<24):r>6&&a%r===4&&(x=f[x>>>24]<<24|f[x>>>16&255]<<16|f[x>>>8&255]<<8|f[x&255]),l[a]=v=(l[a-r]^x)>>>0}for(c=0;c<o;c++)a=o-c,c&3?x=l[a]:x=l[a-4],c<4||a<=4?u[c]=x:u[c]=p[f[x>>>24]]^m[f[x>>>16&255]]^g[f[x>>>8&255]]^y[f[x&255]],u[c]=u[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,s){const n=this.keySize+6,r=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,c=a[0],l=a[1],u=a[2],f=a[3],h=this.uint8ArrayToUint32Array_(s);let d=h[0],p=h[1],m=h[2],g=h[3];const y=new Int32Array(e),v=new Int32Array(y.length);let x,E,S,T,_,I,R,b,L,k,M,N,F,O;const K=this.networkToHostOrderSwap;for(;t<y.length;){for(L=K(y[t]),k=K(y[t+1]),M=K(y[t+2]),N=K(y[t+3]),_=L^r[0],I=N^r[1],R=M^r[2],b=k^r[3],F=4,O=1;O<n;O++)x=c[_>>>24]^l[I>>16&255]^u[R>>8&255]^f[b&255]^r[F],E=c[I>>>24]^l[R>>16&255]^u[b>>8&255]^f[_&255]^r[F+1],S=c[R>>>24]^l[b>>16&255]^u[_>>8&255]^f[I&255]^r[F+2],T=c[b>>>24]^l[_>>16&255]^u[I>>8&255]^f[R&255]^r[F+3],_=x,I=E,R=S,b=T,F=F+4;x=o[_>>>24]<<24^o[I>>16&255]<<16^o[R>>8&255]<<8^o[b&255]^r[F],E=o[I>>>24]<<24^o[R>>16&255]<<16^o[b>>8&255]<<8^o[_&255]^r[F+1],S=o[R>>>24]<<24^o[b>>16&255]<<16^o[_>>8&255]<<8^o[I&255]^r[F+2],T=o[b>>>24]<<24^o[_>>16&255]<<16^o[I>>8&255]<<8^o[R&255]^r[F+3],v[t]=K(x^d),v[t+1]=K(T^p),v[t+2]=K(S^m),v[t+3]=K(E^g),d=L,p=k,m=M,g=N,t=t+4}return v.buffer}}class N6{constructor(e,t,s){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=s}expandKey(){const e=U6(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function U6(i){switch(i){case Es.cbc:return"AES-CBC";case Es.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${i}`)}}const $6=16;class kc{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?O6(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,s,n){return this.useSoftware?new Promise((r,o)=>{const a=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(a,t,s,n);const c=this.flush();c?r(c.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s,n)}softwareDecrypt(e,t,s,n){const{currentIV:r,currentResult:o,remainderData:a}=this;if(n!==Es.cbc||t.byteLength!==16)return de.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(e=xt(a,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;r&&(s=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new M6),l.expandKey(t);const u=o;return this.currentResult=l.decrypt(c.buffer,0,s),this.currentIV=c.slice(-16).buffer,u||null}webCryptoDecrypt(e,t,s,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,s,n));this.key=t,this.fastAesKey=new N6(this.subtle,t,n)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new F6(this.subtle,new Uint8Array(s),n).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(de.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,s,n)))}onWebCryptoError(e,t,s,n){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s,n);const o=this.flush();if(o)return o.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%$6;return s!==e.length&&(t=e.slice(0,s),this.remainderData=e.slice(s)),t}logOnce(e){this.logEnabled&&(de.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const M0=Math.pow(2,17);class H6{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const s=e.url;if(!s)return Promise.reject(new Vt({type:Z.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,r=n.fLoader,o=n.loader;return new Promise((a,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(p=>p[0]==="GAP")){c(U0(e));return}else e.gap=!1;const l=this.loader=r?new r(n):new o(n),u=N0(e);e.loader=l;const f=F0(n.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:M0};e.stats=l.stats;const d={onSuccess:(p,m,g,y)=>{this.resetLoader(e,l);let v=p.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(v.slice(0,16)),v=v.slice(16)),a({frag:e,part:null,payload:v,networkDetails:y})},onError:(p,m,g,y)=>{this.resetLoader(e,l),c(new Vt({type:Z.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:xe({url:s,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:g,stats:y}))},onAbort:(p,m,g)=>{this.resetLoader(e,l),c(new Vt({type:Z.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:p}))},onTimeout:(p,m,g)=>{this.resetLoader(e,l),c(new Vt({type:Z.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:p}))}};t&&(d.onProgress=(p,m,g,y)=>t({frag:e,part:null,payload:g,networkDetails:y})),l.load(u,h,d)})}loadPart(e,t,s){this.abort();const n=this.config,r=n.fLoader,o=n.loader;return new Promise((a,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(U0(e,t));return}const l=this.loader=r?new r(n):new o(n),u=N0(e,t);e.loader=l;const f=F0(n.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:M0};t.stats=l.stats,l.load(u,h,{onSuccess:(d,p,m,g)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:d.data,networkDetails:g};s(y),a(y)},onError:(d,p,m,g)=>{this.resetLoader(e,l),c(new Vt({type:Z.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:xe({url:u.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:m,stats:g}))},onAbort:(d,p,m)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),c(new Vt({type:Z.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:m,stats:d}))},onTimeout:(d,p,m)=>{this.resetLoader(e,l),c(new Vt({type:Z.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:m,stats:d}))}})})}updateStatsFromPart(e,t){const s=e.stats,n=t.stats,r=n.total;if(s.loaded+=n.loaded,r){const c=Math.round(e.duration/t.duration),l=Math.min(Math.round(s.loaded/r),c),f=(c-l)*Math.round(s.loaded/l);s.total=s.loaded+f}else s.total=Math.max(s.loaded,s.total);const o=s.loading,a=n.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function N0(i,e=null){const t=e||i,s={frag:i,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(j(n)&&j(r)){var o;let a=n,c=r;if(i.sn==="initSegment"&&G6((o=i.decryptdata)==null?void 0:o.method)){const l=r-n;l%16&&(c=r+(16-l%16)),n!==0&&(s.resetIV=!0,a=n-16)}s.rangeStart=a,s.rangeEnd=c}return s}function U0(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),s={type:Z.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(s.part=e),(e||i).stats.aborted=!0,new Vt(s)}function G6(i){return i==="AES-128"||i==="AES-256"}class Vt extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class $g extends Ct{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!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(){}}class Bc{constructor(e,t,s,n=0,r=-1,o=!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=Nn(),this.buffering={audio:Nn(),video:Nn(),audiovideo:Nn()},this.level=e,this.sn=t,this.id=s,this.size=n,this.part=r,this.partial=o}}function Nn(){return{start:0,executeStart:0,executeEnd:0,end:0}}const $0={length:0,start:()=>0,end:()=>0};class re{static isBuffered(e,t){if(e){const s=re.getBuffered(e);for(let n=s.length;n--;)if(t>=s.start(n)&&t<=s.end(n))return!0}return!1}static bufferedRanges(e){if(e){const t=re.getBuffered(e);return re.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let s=0;s<e.length;s++)t.push({start:e.start(s),end:e.end(s)});return t}static bufferInfo(e,t,s){if(e){const n=re.bufferedRanges(e);if(n.length)return re.bufferedInfo(n,t,s)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,s){t=Math.max(0,t),e.length>1&&e.sort((u,f)=>u.start-f.start||f.end-u.end);let n=-1,r=[];if(s)for(let u=0;u<e.length;u++){t>=e[u].start&&t<=e[u].end&&(n=u);const f=r.length;if(f){const h=r[f-1].end;e[u].start-h<s?e[u].end>h&&(r[f-1].end=e[u].end):r.push(e[u])}else r.push(e[u])}else r=e;let o=0,a,c=t,l=t;for(let u=0;u<r.length;u++){const f=r[u].start,h=r[u].end;if(n===-1&&t>=f&&t<=h&&(n=u),t+s>=f&&t<h)c=f,l=h,o=l-t;else if(t+s<f){a=f;break}}return{len:o,start:c||0,end:l||0,nextStart:a,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||$0}catch(t){return de.log("failed to get media.buffered",t),$0}}}const Hg=/\{\$([a-zA-Z0-9-_]+)\}/g;function H0(i){return Hg.test(i)}function Tl(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(Hg,s=>{const n=s.substring(2,s.length-1),r=t==null?void 0:t[n];return r===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),s):r})}return e}function G0(i,e,t){let s=i.variableList;s||(i.variableList=s={});let n,r;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(n))r=o.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(o){i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else n=e.NAME,r=e.VALUE;n in s?i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):s[n]=r||""}function K6(i,e,t){const s=e.IMPORT;if(t&&s in t){let n=i.variableList;n||(i.variableList=n={}),n[s]=t[s]}else i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const V6=/^(\d+)x(\d+)$/,K0=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ae{constructor(e,t){typeof e=="string"&&(e=Ae.parseAttrList(e,t)),ge(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let n=0;n<t.length/2;n++)s[n]=parseInt(t.slice(n*2,n*2+2),16);return s}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const s=this[e];return(s?s.split(/[ ,]+/):[]).reduce((n,r)=>(n[r.toLowerCase()]=!0,n),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=V6.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let s;const n={},r='"';for(K0.lastIndex=0;(s=K0.exec(e))!==null;){const o=s[1].trim();let a=s[2];const c=a.indexOf(r)===0&&a.lastIndexOf(r)===a.length-1;let l=!1;if(c)a=a.slice(1,-1);else switch(o){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":l=!0}if(t&&(c||l))a=Tl(t,a);else if(!l&&!c)switch(o){case"CLOSED-CAPTIONS":if(a==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":de.warn(`${e}: attribute ${o} is missing quotes`)}n[o]=a}return n}}const j6="com.apple.hls.interstitial";function q6(i){return i!=="ID"&&i!=="CLASS"&&i!=="CUE"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function W6(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"||i==="SCTE35-CMD"}class Gg{constructor(e,t,s=0){var n;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(n=t==null?void 0:t.tagOrder)!=null?n:s,t){const r=t.attr;for(const o in r)if(Object.prototype.hasOwnProperty.call(e,o)&&e[o]!==r[o]){de.warn(`DATERANGE tag attribute: "${o}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=o;break}e=ge(new Ae({}),r,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const r=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);j(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(de.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(j(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===j6}get isValid(){return!!this.id&&!this._badValueForSameId&&j(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const z6=10;class Q6{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}get hasProgramDateTime(){return this.fragments.length?j(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||z6}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 fragmentStart(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let s=e.length;s--;)if(e[s].index>t)return e[s].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function di(i){return i==="AES-128"||i==="AES-256"||i==="AES-256-CTR"}function Fc(i){switch(i){case"AES-128":case"AES-256":return Es.cbc;case"AES-256-CTR":return Es.ctr;default:throw new Error(`invalid full segment method ${i}`)}}function Kg(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function bl(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}function Y6(i){const e=bl(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function X6(i){const e=function(s,n,r){const o=s[n];s[n]=s[r],s[r]=o};e(i,0,3),e(i,1,2),e(i,4,5),e(i,6,7)}function J6(i){const e=i.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),n=s[s.length-1].split(",");if(n.length===2){const r=n[0]==="base64",o=n[1];r?(s.splice(-1,1),t=Kg(o)):t=Y6(o)}}return t}const Br=typeof self<"u"?self:void 0;var be={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},tt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function _l(i){switch(i){case tt.FAIRPLAY:return be.FAIRPLAY;case tt.PLAYREADY:return be.PLAYREADY;case tt.WIDEVINE:return be.WIDEVINE;case tt.CLEARKEY:return be.CLEARKEY}}function V0(i){switch(i){case be.FAIRPLAY:return tt.FAIRPLAY;case be.PLAYREADY:return tt.PLAYREADY;case be.WIDEVINE:return tt.WIDEVINE;case be.CLEARKEY:return tt.CLEARKEY}}function nr(i){const{drmSystems:e,widevineLicenseUrl:t}=i,s=e?[be.FAIRPLAY,be.WIDEVINE,be.PLAYREADY,be.CLEARKEY].filter(n=>!!e[n]):[];return!s[be.WIDEVINE]&&t&&s.push(be.WIDEVINE),s}const Vg=function(i){return Br!=null&&(i=Br.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Z6(i,e,t,s){let n;switch(i){case be.FAIRPLAY:n=["cenc","sinf"];break;case be.WIDEVINE:case be.PLAYREADY:n=["cenc"];break;case be.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return eT(n,e,t,s)}function eT(i,e,t,s){return[{initDataTypes:i,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function tT(i){var e;return i.sessionType==="persistent-license"||!!((e=i.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function sT(i){const e=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),s=t.substring(t.indexOf("<"),t.length),o=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(o){const a=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(a){const c=Kg(a).subarray(0,16);return X6(c),c}}return null}let Un={};class io{static clearKeyUriToKeyIdMap(){Un={}}constructor(e,t,s,n=[1],r=null,o){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=s,this.keyFormatVersions=n,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!di(e),o!=null&&o.startsWith("0x")&&(this.keyId=new Uint8Array(bg(o)))}matches(e){var t,s;return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&e.keyFormatVersions.join(",")===this.keyFormatVersions.join(",")&&((t=e.iv)==null?void 0:t.join(","))===((s=this.iv)==null?void 0:s.join(","))}isSupported(){if(this.method){if(di(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case tt.FAIRPLAY:case tt.WIDEVINE:case tt.PLAYREADY:case tt.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(di(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(de.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const s=iT(e);return new io(this.method,this.uri,"identity",this.keyFormatVersions,s)}if(this.pssh&&this.keyId)return this;const t=J6(this.uri);if(t)switch(this.keyFormat){case tt.WIDEVINE:if(this.pssh=t,!this.keyId&&t.length>=22){const s=t.length-22;this.keyId=t.subarray(s,s+16)}break;case tt.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=a6(s,null,t),this.keyId=sT(t);break}default:{let s=t.subarray(0,16);if(s.length!==16){const n=new Uint8Array(16);n.set(s,16-s.length),s=n}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=Un[this.uri];if(!s){const n=Object.keys(Un).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,n),Un[this.uri]=s}this.keyId=s}return this}}function iT(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const j0=/#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,q0=/#EXT-X-MEDIA:(.*)/g,nT=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ao=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),rT=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Ft{static findGroup(e,t){for(let s=0;s<e.length;s++){const n=e[s];if(n.id===t)return n}}static resolve(e,t){return Cc.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return nT.test(e)}static parseMasterPlaylist(e,t){const s=H0(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},r=[];j0.lastIndex=0;let o;for(;(o=j0.exec(e))!=null;)if(o[1]){var a;const l=new Ae(o[1],n),u=Tl(n,o[2]),f={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:Ft.resolve(u,t)},h=l.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),Q0(l.CODECS,f);const d=l["SUPPLEMENTAL-CODECS"];d&&(f.supplemental={},Q0(d,f.supplemental)),(a=f.unknownCodecs)!=null&&a.length||r.push(f),n.levels.push(f)}else if(o[3]){const l=o[3],u=o[4];switch(l){case"SESSION-DATA":{const f=new Ae(u,n),h=f["DATA-ID"];h&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[h]=f);break}case"SESSION-KEY":{const f=W0(u,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):de.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const f=new Ae(u,n);G0(n,f,t)}break}case"CONTENT-STEERING":{const f=new Ae(u,n);n.contentSteering={uri:Ft.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=z0(u);break}}}const c=r.length>0&&r.length<n.levels.length;return n.levels=c?r:n.levels,n.levels.length===0&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(e,t,s){let n;const r={},o=s.levels,a={AUDIO:o.map(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:o.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(q0.lastIndex=0;(n=q0.exec(e))!==null;){const l=new Ae(n[1],s),u=l.TYPE;if(u){const f=a[u],h=r[u]||[];r[u]=h;const d=l.LANGUAGE,p=l["ASSOC-LANGUAGE"],m=l.CHANNELS,g=l.CHARACTERISTICS,y=l["INSTREAM-ID"],v={attrs:l,bitrate:0,id:c++,groupId:l["GROUP-ID"]||"",name:l.NAME||d||"",type:u,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:d,url:l.URI?Ft.resolve(l.URI,t):""};if(p&&(v.assocLang=p),m&&(v.channels=m),g&&(v.characteristics=g),y&&(v.instreamId=y),f!=null&&f.length){const x=Ft.findGroup(f,v.groupId)||f[0];Y0(v,x,"audioCodec"),Y0(v,x,"textCodec")}h.push(v)}}return r}static parseLevelPlaylist(e,t,s,n,r,o){var a;const c={url:t},l=new Q6(t),u=l.fragments,f=[];let h=null,d=0,p=0,m=0,g=0,y=0,v=null,x=new yo(n,c),E,S,T,_=-1,I=!1,R=null,b;if(Ao.lastIndex=0,l.m3u8=e,l.hasVariableRefs=H0(e),((a=Ao.exec(e))==null?void 0:a[0])!=="#EXTM3U")return l.playlistParsingError=new Error("Missing format identifier #EXTM3U"),l;for(;(E=Ao.exec(e))!==null;){I&&(I=!1,x=new yo(n,c),x.playlistOffset=m,x.start=m,x.sn=d,x.cc=g,y&&(x.bitrate=y),x.level=s,h&&(x.initSegment=h,h.rawProgramDateTime&&(x.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null),R&&(x.setByteRange(R),R=null)));const N=E[1];if(N){x.duration=parseFloat(N);const F=(" "+E[2]).slice(1);x.title=F||null,x.tagList.push(F?["INF",N,F]:["INF",N])}else if(E[3]){if(j(x.duration)){x.playlistOffset=m,x.start=m,T&&J0(x,T,l),x.sn=d,x.level=s,x.cc=g,u.push(x);const F=(" "+E[3]).slice(1);x.relurl=Tl(l,F),Il(x,v,f),v=x,m+=x.duration,d++,p=0,I=!0}}else{if(E=E[0].match(rT),!E){de.warn("No matches on slow regex match for level playlist!");continue}for(S=1;S<E.length&&E[S]===void 0;S++);const F=(" "+E[S]).slice(1),O=(" "+E[S+1]).slice(1),K=E[S+2]?(" "+E[S+2]).slice(1):null;switch(F){case"BYTERANGE":v?x.setByteRange(O,v):x.setByteRange(O);break;case"PROGRAM-DATE-TIME":x.rawProgramDateTime=O,x.tagList.push(["PROGRAM-DATE-TIME",O]),_===-1&&(_=u.length);break;case"PLAYLIST-TYPE":l.type&&Ht(l,F,E),l.type=O.toUpperCase();break;case"MEDIA-SEQUENCE":l.startSN!==0?Ht(l,F,E):u.length>0&&Z0(l,F,E),d=l.startSN=parseInt(O);break;case"SKIP":{l.skippedSegments&&Ht(l,F,E);const B=new Ae(O,l),G=B.decimalInteger("SKIPPED-SEGMENTS");if(j(G)){l.skippedSegments+=G;for(let C=G;C--;)u.push(null);d+=G}const H=B.enumeratedString("RECENTLY-REMOVED-DATERANGES");H&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(H.split(" ")));break}case"TARGETDURATION":l.targetduration!==0&&Ht(l,F,E),l.targetduration=Math.max(parseInt(O),1);break;case"VERSION":l.version!==null&&Ht(l,F,E),l.version=parseInt(O);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":l.live||Ht(l,F,E),l.live=!1;break;case"#":(O||K)&&x.tagList.push(K?[O,K]:[O]);break;case"DISCONTINUITY":g++,x.tagList.push(["DIS"]);break;case"GAP":x.gap=!0,x.tagList.push([F]);break;case"BITRATE":x.tagList.push([F,O]),y=parseInt(O)*1e3,j(y)?x.bitrate=y:y=0;break;case"DATERANGE":{const B=new Ae(O,l),G=new Gg(B,l.dateRanges[B.ID],l.dateRangeTagCount);l.dateRangeTagCount++,G.isValid||l.skippedSegments?l.dateRanges[G.id]=G:de.warn(`Ignoring invalid DATERANGE tag: "${O}"`),x.tagList.push(["EXT-X-DATERANGE",O]);break}case"DEFINE":{{const B=new Ae(O,l);"IMPORT"in B?K6(l,B,o):G0(l,B,t)}break}case"DISCONTINUITY-SEQUENCE":l.startCC!==0?Ht(l,F,E):u.length>0&&Z0(l,F,E),l.startCC=g=parseInt(O);break;case"KEY":{const B=W0(O,t,l);if(B.isSupported()){if(B.method==="NONE"){T=void 0;break}T||(T={});const G=T[B.keyFormat];G!=null&&G.matches(B)||(G&&(T=ge({},T)),T[B.keyFormat]=B)}else de.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${O}"`);break}case"START":l.startTimeOffset=z0(O);break;case"MAP":{const B=new Ae(O,l);if(x.duration){const G=new yo(n,c);X0(G,B,s,T),h=G,x.initSegment=h,h.rawProgramDateTime&&!x.rawProgramDateTime&&(x.rawProgramDateTime=h.rawProgramDateTime)}else{const G=x.byteRangeEndOffset;if(G){const H=x.byteRangeStartOffset;R=`${G-H}@${H}`}else R=null;X0(x,B,s,T),h=x,I=!0}h.cc=g;break}case"SERVER-CONTROL":{b&&Ht(l,F,E),b=new Ae(O),l.canBlockReload=b.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=b.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&b.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=b.optionalFloat("PART-HOLD-BACK",0),l.holdBack=b.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{l.partTarget&&Ht(l,F,E);const B=new Ae(O);l.partTarget=B.decimalFloatingPoint("PART-TARGET");break}case"PART":{let B=l.partList;B||(B=l.partList=[]);const G=p>0?B[B.length-1]:void 0,H=p++,C=new Ae(O,l),D=new WS(C,x,c,H,G);B.push(D),x.duration+=D.duration;break}case"PRELOAD-HINT":{const B=new Ae(O,l);l.preloadHint=B;break}case"RENDITION-REPORT":{const B=new Ae(O,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(B);break}default:de.warn(`line parsed but not handled: ${E}`);break}}}v&&!v.relurl?(u.pop(),m-=v.duration,l.partList&&(l.fragmentHint=v)):l.partList&&(Il(x,v,f),x.cc=g,l.fragmentHint=x,T&&J0(x,T,l)),l.targetduration||(l.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const L=u.length,k=u[0],M=u[L-1];if(m+=l.skippedSegments*l.targetduration,m>0&&L&&M){l.averagetargetduration=m/L;const N=M.sn;l.endSN=N!=="initSegment"?N:0,l.live||(M.endList=!0),k&&l.startCC===void 0&&(l.startCC=k.cc),_>0&&(aT(u,_),k&&f.unshift(k))}else l.endSN=0,l.startCC=0;return l.fragmentHint&&(m+=l.fragmentHint.duration),l.totalduration=m,f.length&&l.dateRangeTagCount&&k&&jg(f,l),l.endCC=g,l}}function jg(i,e){const t=i.length;if(!t)return;const s=i[t-1],n=e.live?1/0:e.totalduration,r=Object.keys(e.dateRanges);for(let o=r.length;o--;){const a=e.dateRanges[r[o]],c=a.startDate.getTime();a.tagAnchor=s.ref;for(let l=t;l--;){const u=oT(e,c,i,l,n);if(u!==-1){a.tagAnchor=e.fragments[u].ref;break}}}}function oT(i,e,t,s,n){const r=t[s];if(r){const a=r.programDateTime;if(e>=a||s===0){var o;const c=(((o=t[s+1])==null?void 0:o.start)||n)-r.start;if(e<=a+c*1e3){const l=t[s].sn-i.startSN,u=i.fragments;if(u.length>t.length){const h=(t[s+1]||u[u.length-1]).sn-i.startSN;for(let d=h;d>l;d--){const p=u[d].programDateTime;if(e>=p&&e<p+u[d].duration*1e3)return d}}return l}}}return-1}function W0(i,e,t){var s,n;const r=new Ae(i,t),o=(s=r.METHOD)!=null?s:"",a=r.URI,c=r.hexadecimalInteger("IV"),l=r.KEYFORMATVERSIONS,u=(n=r.KEYFORMAT)!=null?n:"identity";a&&r.IV&&!c&&de.error(`Invalid IV: ${r.IV}`);const f=a?Ft.resolve(a,e):"",h=(l||"1").split("/").map(Number).filter(Number.isFinite);return new io(o,f,u,h,c,r.KEYID)}function z0(i){const t=new Ae(i).decimalFloatingPoint("TIME-OFFSET");return j(t)?t:null}function Q0(i,e){let t=(i||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const n=t.filter(r=>Rc(r,s));n.length&&(e[`${s}Codec`]=n.map(r=>r.split("/")[0]).join(","),t=t.filter(r=>n.indexOf(r)===-1))}),e.unknownCodecs=t}function Y0(i,e,t){const s=e[t];s&&(i[t]=s)}function aT(i,e){let t=i[e];for(let s=e;s--;){const n=i[s];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function Il(i,e,t){i.rawProgramDateTime?t.push(i):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime)}function X0(i,e,t,s){i.relurl=e.URI,e.BYTERANGE&&i.setByteRange(e.BYTERANGE),i.level=t,i.sn="initSegment",s&&(i.levelkeys=s),i.initSegment=null}function J0(i,e,t){i.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&s.push(i)}function Ht(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Z0(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function So(i,e){const t=e.startPTS;if(j(t)){let s=0,n;e.sn>i.sn?(s=t-i.start,n=i):(s=i.start-t,n=e),n.duration!==s&&n.setDuration(s)}else e.sn>i.sn?i.cc===e.cc&&i.minEndPTS?e.setStart(i.start+(i.minEndPTS-i.start)):e.setStart(i.start+i.duration):e.setStart(Math.max(i.start-e.duration,0))}function qg(i,e,t,s,n,r){s-t<=0&&(de.warn("Fragment should have a positive duration",e),s=t+e.duration,r=n+e.duration);let a=t,c=s;const l=e.startPTS,u=e.endPTS;if(j(l)){const g=Math.abs(l-t);j(e.deltaPTS)?e.deltaPTS=Math.max(g,e.deltaPTS):e.deltaPTS=g,a=Math.max(t,l),t=Math.min(t,l),n=Math.min(n,e.startDTS),c=Math.min(s,u),s=Math.max(s,u),r=Math.max(r,e.endDTS)}const f=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=a,e.startDTS=n,e.endPTS=s,e.minEndPTS=c,e.endDTS=r;const h=e.sn;if(!i||h<i.startSN||h>i.endSN)return 0;let d;const p=h-i.startSN,m=i.fragments;for(m[p]=e,d=p;d>0;d--)So(m[d],m[d-1]);for(d=p;d<m.length-1;d++)So(m[d],m[d+1]);return i.fragmentHint&&So(m[m.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,f}function lT(i,e){if(i===e)return;let t=null;const s=i.fragments;for(let l=s.length-1;l>=0;l--){const u=s[l].initSegment;if(u){t=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let n;fT(i,e,(l,u,f,h)=>{if((!e.startCC||e.skippedSegments)&&u.cc!==l.cc){const d=l.cc-u.cc;for(let p=f;p<h.length;p++)h[p].cc+=d;e.endCC=h[h.length-1].cc}j(l.startPTS)&&j(l.endPTS)&&(u.setStart(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.setDuration(l.endPTS-l.startPTS),u.duration&&(n=u),e.PTSKnown=e.alignedSliding=!0),l.hasStreams&&(u.elementaryStreams=l.elementaryStreams),u.loader=l.loader,l.hasStats&&(u.stats=l.stats),l.initSegment&&(u.initSegment=l.initSegment,t=l.initSegment)});const r=e.fragments,o=e.fragmentHint?r.concat(e.fragmentHint):r;if(t&&o.forEach(l=>{var u;l&&(!l.initSegment||l.initSegment.relurl===((u=t)==null?void 0:u.relurl))&&(l.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=r.some(l=>!l),e.deltaUpdateFailed){de.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)r.shift();e.startSN=r[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=cT(i.dateRanges,e));const l=i.fragments.filter(u=>u.rawProgramDateTime);if(i.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u<o.length;u++)o[u].programDateTime===null&&Il(o[u],o[u-1],l);jg(l,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var a;const l=Qg(i,e.startSN-1);e.startCC=(a=l==null?void 0:l.cc)!=null?a:r[0].cc}uT(i.partList,e.partList,(l,u)=>{u.elementaryStreams=l.elementaryStreams,u.stats=l.stats}),n?qg(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):Wg(i,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const l=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=l),e.driftEndTime=c,e.driftEnd=l}else e.driftEndTime=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=i.requestScheduled)}function cT(i,e){const{dateRanges:t,recentlyRemovedDateranges:s}=e,n=ge({},i);s&&s.forEach(a=>{delete n[a]});const o=Object.keys(n).length;return o&&Object.keys(t).forEach(a=>{const c=n[a],l=new Gg(t[a].attr,c);l.isValid?(n[a]=l,c||(l.tagOrder+=o)):de.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Ee(t[a].attr)}"`)}),n}function uT(i,e,t){if(i&&e){let s=0;for(let n=0,r=i.length;n<=r;n++){const o=i[n],a=e[n+s];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):s--}}}function fT(i,e,t){const s=e.skippedSegments,n=Math.max(i.startSN,e.startSN)-e.startSN,r=(i.fragmentHint?1:0)+(s?e.endSN:Math.min(i.endSN,e.endSN))-e.startSN,o=e.startSN-i.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;for(let l=n;l<=r;l++){const u=c[o+l];let f=a[l];if(s&&!f&&u&&(f=e.fragments[l]=u),u&&f){if(t(u,f,l,a),u.url&&u.url!==f.url){e.playlistParsingError=ef(`media sequence mismatch ${f.sn}:`,i,e,u,f);return}else if(u.cc!==f.cc){e.playlistParsingError=ef(`discontinuity sequence mismatch (${u.cc}!=${f.cc})`,i,e,u,f);return}}}}function ef(i,e,t,s,n){return new Error(`${i} ${n.url}
- Playlist starting @${e.startSN}
- ${e.m3u8}
- Playlist starting @${t.startSN}
- ${t.m3u8}`)}function Wg(i,e,t=!0){const s=e.startSN+e.skippedSegments-i.startSN,n=i.fragments,r=s>=0;let o=0;if(r&&s<n.length)o=n[s].start;else if(r&&e.startSN===i.endSN+1)o=i.fragmentEnd;else if(r&&t)o=i.fragmentStart+s*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)o=i.fragmentStart;else return;Cl(e,o)}function Cl(i,e){if(e){const t=i.fragments;for(let s=i.skippedSegments;s<t.length;s++)t[s].addStart(e);i.fragmentHint&&i.fragmentHint.addStart(e)}}function zg(i,e=1/0){let t=1e3*i.targetduration;if(i.updated){const s=i.fragments;if(s.length&&t*4>e){const r=s[s.length-1].duration*1e3;r<t&&(t=r)}}else t/=2;return Math.round(t)}function Qg(i,e,t){if(!i)return null;let s=i.fragments[e-i.startSN];return s||(s=i.fragmentHint,s&&s.sn===e)?s:e<i.startSN&&t&&t.sn===e?t:null}function tf(i,e,t){return i?Yg(i.partList,e,t):null}function Yg(i,e,t){if(i)for(let s=i.length;s--;){const n=i[s];if(n.index===t&&n.fragment.sn===e)return n}return null}function Xg(i){i.forEach((e,t)=>{var s;(s=e.details)==null||s.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function qi(i,e){for(let s=0,n=i.length;s<n;s++){var t;if(((t=i[s])==null?void 0:t.cc)===e)return i[s]}return null}function hT(i,e){return!!(i&&e.startCC<i.endCC&&e.endCC>i.startCC)}function sf(i,e){if(i){const t=i.start+e;i.start=i.startPTS=t,i.endPTS=t+i.duration}}function Jg(i,e){const t=e.fragments;for(let s=0,n=t.length;s<n;s++)sf(t[s],i);e.fragmentHint&&sf(e.fragmentHint,i),e.alignedSliding=!0}function dT(i,e){i&&(Zg(e,i),!e.alignedSliding&&i&&Fr(e,i),!e.alignedSliding&&i&&!e.skippedSegments&&Wg(i,e,!1))}function Zg(i,e){if(!hT(e,i))return;const t=Math.min(e.endCC,i.endCC),s=qi(e.fragments,t),n=qi(i.fragments,t);if(!s||!n)return;de.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const r=s.start-n.start;Jg(r,i)}function Fr(i,e){if(!i.hasProgramDateTime||!e.hasProgramDateTime)return;const t=i.fragments,s=e.fragments;if(!t.length||!s.length)return;let n,r;const o=Math.min(e.endCC,i.endCC);e.startCC<o&&i.startCC<o&&(n=qi(s,o),r=qi(t,o)),(!n||!r)&&(n=s[Math.floor(s.length/2)],r=qi(t,n.cc)||t[Math.floor(t.length/2)]);const a=n.programDateTime,c=r.programDateTime;if(!a||!c)return;const l=(c-a)/1e3-(r.start-n.start);Jg(l,i)}const pT={toString:function(i){let e="";const t=i.length;for(let s=0;s<t;s++)e+=`[${i.start(s).toFixed(3)}-${i.end(s).toFixed(3)}]`;return e}},V={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 Oc extends $g{constructor(e,t,s,n,r){super(n,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=V.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.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:o,fragCurrent:a,media:c,mediaBuffer:l,state:u}=this,f=c?c.currentTime:0,h=re.bufferInfo(l||c,f,o.maxBufferHole),d=!h.len;if(this.log(`Media seeking to ${j(f)?f.toFixed(3):f}, state: ${u}, ${d?"out of":"in"} buffer`),this.state===V.ENDED)this.resetLoadingState();else if(a){const p=o.maxFragLookUpTolerance,m=a.start-p,g=a.start+a.duration+p;if(d||g<h.start||m>h.end){const y=f>g;(f<m||y)&&(y&&a.loader&&(this.log(`Cancelling fragment load for seek (sn: ${a.sn})`),a.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const p=this.lastCurrentTime;if(f>p&&(this.lastCurrentTime=f),!this.loadingParts){const m=Math.max(h.end,f),g=this.shouldLoadParts(this.getLevelDetails(),m);g&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${m.toFixed(2)}`),this.loadingParts=g)}}this.hls.hasEnoughToStart||(this.log(`Setting ${d?"startPosition":"nextLoadPosition"} to ${f} for seek without enough to start`),this.nextLoadPosition=f,d&&(this.startPosition=f)),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=e,this.fragmentLoader=new H6(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new kc(e.config)}registerListeners(){const{hls:e}=this;e.on(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(A.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(A.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===V.STOPPED)return;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=V.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const s=e.end||0,n=this.config.timelineOffset||0;if(s<=n)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=re.bufferedInfo(r,e.start,0));const o=e.nextStart;if(o&&o>n&&o<t.edge||this.media.currentTime<e.start)return!1;const c=t.partList;if(c!=null&&c.length){const u=c[c.length-1];return re.isBuffered(this.media,u.start+u.duration/2)}const l=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(l)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const s=this.media=this.mediaBuffer=t.media;s.removeEventListener("seeking",this.onMediaSeeking),s.removeEventListener("ended",this.onMediaEnded),s.addEventListener("seeking",this.onMediaSeeking),s.addEventListener("ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===V.STOPPED&&this.startLoad(n.startPosition)}onMediaDetaching(e,t){const s=!!t.transferMedia,n=this.media;if(n!==null){if(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),n.removeEventListener("seeking",this.onMediaSeeking),n.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!s&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,s){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=V.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,s){this.startFragRequested=!0,this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){const n=r=>{const o=r.frag;if(this.fragContextChanged(o)){this.warn(`${o.type} sn: ${o.sn}${r.part?" part: "+r.part.index:""} of ${this.fragInfo(o,!1,r.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(o);return}o.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,s,n).then(r=>{if(!r)return;const o=this.state,a=r.frag;if(this.fragContextChanged(a)){(o===V.FRAG_LOADING||!this.fragCurrent&&o===V.PARSING)&&(this.fragmentTracker.removeFragment(a),this.state=V.IDLE);return}"payload"in r&&(this.log(`Loaded ${a.type} sn: ${a.sn} of ${this.playlistLabel()} ${a.level}`),this.hls.trigger(A.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===V.STOPPED||this.state===V.ERROR||(this.warn(`Frag error: ${(r==null?void 0:r.message)||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===ke.APPENDING){const r=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,r),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(a,e.duration))&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===ke.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:s};this.hls.trigger(A.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{const n=s==null?void 0:s.frag;if(!n||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:n}=this,{frag:r,payload:o}=s,a=r.decryptdata;if(o&&o.byteLength>0&&a!=null&&a.key&&a.iv&&di(a.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(o),a.key.buffer,a.iv.buffer,Fc(a.method)).catch(l=>{throw n.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:r}),l}).then(l=>{const u=self.performance.now();return n.trigger(A.FRAG_DECRYPTED,{frag:r,payload:l,stats:{tstart:c,tdecrypt:u}}),s.payload=l,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===V.STOPPED||this.state===V.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state!==V.STOPPED&&(this.state=V.IDLE),e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${s?pT.toString(re.getBuffered(s)):"(detached)"})`),De(e)){var n;if(e.type!==Y.SUBTITLE){const o=e.elementaryStreams;if(!Object.keys(o).some(a=>!!o[a])){this.state=V.IDLE;return}}const r=(n=this.levels)==null?void 0:n[e.level];r!=null&&r.fragmentError&&(this.log(`Resetting level fragment error count of ${r.fragmentError} on frag buffered`),r.fragmentError=0)}this.state=V.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:n,partsLoaded:r}=e,o=!r||r.length===0||r.some(c=>!c),a=new Bc(s.level,s.sn,s.stats.chunkCount+1,0,n?n.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,n){var r;this.fragCurrent=e;const o=t==null?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;e.encrypted&&!((r=e.decryptdata)!=null&&r.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=V.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(A.KEY_LOADED,f),this.state===V.KEY_LOADING&&(this.state=V.IDLE),f}),this.hls.trigger(A.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):e.encrypted||(a=this.keyLoader.loadClear(e,o.encryptedFragments,this.startFragRequested),a&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(De(e)&&(!c||e.sn!==c.sn)){const f=this.shouldLoadParts(t.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=f)}if(s=Math.max(e.start,s||0),this.loadingParts&&De(e)){const f=o.partList;if(f&&n){s>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(f,e,s);if(h>-1){const d=f[h];e=this.fragCurrent=d.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${d.index} (${h}/${f.length-1}) of ${this.fragInfo(e,!1,d)}) cc: ${e.cc} [${o.startSN}-${o.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=d.start+d.duration,this.state=V.FRAG_LOADING;let p;return a?p=a.then(m=>!m||this.fragContextChanged(m.frag)?null:this.doFragPartsLoad(e,d,t,n)).catch(m=>this.handleFragLoadError(m)):p=this.doFragPartsLoad(e,d,t,n).catch(m=>this.handleFragLoadError(m)),this.hls.trigger(A.FRAG_LOADING,{frag:e,part:d,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):p}else if(!e.url||this.loadedEndOfParts(f,s))return Promise.resolve(null)}}if(De(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${o?"["+o.startSN+"-"+o.endSN+"]":""}, target: ${parseFloat(s.toFixed(3))}`),j(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=V.FRAG_LOADING;const l=this.config.progressive;let u;return l&&a?u=a.then(f=>!f||this.fragContextChanged(f==null?void 0:f.frag)?null:this.fragmentLoader.load(e,n)).catch(f=>this.handleFragLoadError(f)):u=Promise.all([this.fragmentLoader.load(e,l?n:void 0),a]).then(([f])=>(!l&&f&&n&&n(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(A.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):u}doFragPartsLoad(e,t,s,n){return new Promise((r,o)=>{var a;const c=[],l=(a=s.details)==null?void 0:a.partList,u=f=>{this.fragmentLoader.loadPart(e,f,n).then(h=>{c[f.index]=h;const d=h.part;this.hls.trigger(A.FRAG_LOADED,h);const p=tf(s.details,e.sn,f.index+1)||Yg(l,e.sn,f.index+1);if(p)u(p);else return r({frag:e,part:d,partsLoaded:c})}).catch(o)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(A.ERROR,t)}else this.hls.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==V.PARSING){!this.fragCurrent&&this.state!==V.STOPPED&&this.state!==V.ERROR&&(this.state=V.IDLE);return}const{frag:s,part:n,level:r}=t,o=self.performance.now();s.stats.parsing.end=o,n&&(n.stats.parsing.end=o);const a=this.getLevelDetails(),l=a&&s.sn>a.endSN||this.shouldLoadParts(a,s.end);l!==this.loadingParts&&(this.log(`LL-Part loading ${l?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=l),this.updateLevelTiming(s,n,r,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e!=null&&e.partList){var s;const r=e.partList[0],o=r.end+(((s=e.fragmentHint)==null?void 0:s.duration)||0);if(t>=o){var n;if((this.hls.hasEnoughToStart?((n=this.media)==null?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:n,sn:r,part:o}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const a=t[n],c=a.details,l=o>-1?tf(c,r,o):null,u=l?l.fragment:Qg(c,r,s);return u?(s&&s!==u&&(u.stats=s.stats),{frag:u,part:l,level:a}):null}bufferFragmentData(e,t,s,n,r){var o;if(!e||this.state!==V.PARSING)return;const{data1:a,data2:c}=e;let l=a;if(a&&c&&(l=xt(a,c)),!((o=l)!=null&&o.length))return;const u=this.initPTS[t.cc],f=u?-u.baseTime/u.timescale:void 0,h={type:e.type,frag:t,part:s,chunkMeta:n,offset:f,parent:t.type,data:l};if(this.hls.trigger(A.BUFFER_APPENDING,h),e.dropped&&e.independent&&!s){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!re.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,n=re.bufferInfo(t,s,0),r=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),a=Math.max(Math.min(e.start-o,n.end-o),s+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){var s;const n=this.getLoadPosition();if(!j(n))return null;const o=this.lastCurrentTime>n||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,o)}getFwdBufferInfoAtPos(e,t,s,n){const r=re.bufferInfo(e,t,n);if(r.len===0&&r.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,s);if(o&&(r.nextStart<=o.end||o.gap)){const a=Math.max(Math.min(r.nextStart,o.end)-t,n);return re.bufferInfo(e,t,a)}}return r}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const s=this.config,n=Math.max(Math.min(e-t,s.maxBufferLength),t),r=Math.max(e-t*3,s.maxMaxBufferLength/2,n);return r>=n?(s.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=Y.MAIN){var s;const n=(s=this.fragmentTracker)==null?void 0:s.getAppendedFrag(e,t);return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const s=t.fragments,n=s.length;if(!n)return null;const{config:r}=this,o=s[0].start,a=r.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const f=r.initialLiveManifestSize;if(n<f)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${f})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o){var l;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t);const h=this.hls.startPosition,d=this.hls.liveSyncPosition,p=c?(h!==-1&&h>=o?h:d)||c.start:e;this.log(`Setting startPosition to ${p} to match start frag at live edge. mainStart: ${h} liveSyncPosition: ${d} frag.start: ${(l=c)==null?void 0:l.start}`),this.startPosition=this.nextLoadPosition=p}}else e<=o&&(c=s[0]);if(!c){const f=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,f,t)}let u=this.filterReplacedPrimary(c,t);if(!u&&c){const f=c.sn-t.startSN;u=this.filterReplacedPrimary(s[f+1]||null,t)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===ke.OK||s===ke.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,n,r){let o=null;if(e.gap&&(o=this.getNextFragment(this.nextLoadPosition,t),o&&!o.gap&&s.nextStart)){const a=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,n,0);if(a!==null&&s.len+a.len>=r){const c=o.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,o}get primaryPrefetch(){if(nf(this.hls.config)){var e,t;if((e=this.hls.interstitialsManager)==null||(t=e.playingItem)==null?void 0:t.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(nf(this.hls.config)&&e.type!==Y.SUBTITLE){const s=this.hls.interstitialsManager,n=s==null?void 0:s.bufferingItem;if(n){const o=n.event;if(o){if(o.appendInPlace||Math.abs(e.start-n.start)>1||n.start===0)return null}else if(e.end<=n.start&&(t==null?void 0:t.live)===!1||e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}const r=s==null?void 0:s.playerQueue;if(r)for(let o=r.length;o--;){const a=r[o].interstitial;if(a.appendInPlace&&e.start>=a.startTime&&e.end<=a.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let n=-1,r=!1,o=!0;for(let a=0,c=e.length;a<c;a++){const l=e[a];if(o=o&&!l.independent,n>-1&&s<l.start)break;const u=l.loaded;u?n=-1:(r||l.independent||o)&&l.fragment===t&&(n=a),r=u}return n}loadedEndOfParts(e,t){const s=e[e.length-1];return s&&t>s.start&&s.loaded}getInitialLiveFragment(e){const t=e.fragments,s=this.fragPrevious;let n=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),n=D6(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const r=s.sn+1;if(r>=e.startSN&&r<=e.endSN){const o=t[r-e.startSN];s.cc===o.cc&&(n=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=Ug(e,s.cc,s.end),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(n=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,s){const{config:n}=this;let{fragPrevious:r}=this,{fragments:o,endSN:a}=s;const{fragmentHint:c}=s,{maxFragLookUpTolerance:l}=n,u=s.partList,f=!!(this.loadingParts&&u!=null&&u.length&&c);f&&c&&!this.bitrateTest&&u[u.length-1].fragment.sn===c.sn&&(o=o.concat(c),a=c.sn);let h;if(e<t){var d;const m=e<this.lastCurrentTime||e>t-l||(d=this.media)!=null&&d.paused||!this.startFragRequested?0:l;h=Hs(r,o,e,m)}else h=o[o.length-1];if(h){const p=h.sn-s.startSN,m=this.fragmentTracker.getState(h);if((m===ke.OK||m===ke.PARTIAL&&h.gap)&&(r=h),r&&h.sn===r.sn&&(!f||u[0].fragment.sn>h.sn||!s.live&&!f)&&r&&h.level===r.level){const y=o[p+1];h.sn<a&&this.fragmentTracker.getState(y)!==ke.OK?h=y:h=null}}return h}alignPlaylists(e,t,s){const n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const r=e.fragmentStart,o=!t,a=e.alignedSliding&&j(r);if(o||!a&&!r){dT(s,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),c}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;s<t&&(s=-1);const n=this.timelineOffset;if(s===-1){const r=this.startTimeOffset!==null,o=r?this.startTimeOffset:e.startTimeOffset;o!==null&&j(o)?(s=t+o,o<0&&(s+=e.edge),s=Math.min(Math.max(t,s),t+e.totalduration),this.log(`Setting startPosition to ${s} for start time offset ${o} found in ${r?"multivariant":"media"} playlist`),this.startPosition=s):e.live?(s=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${s}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=s=0),this.lastCurrentTime=s+n}this.nextLoadPosition=s+n}getLoadPosition(){var e;const{media:t}=this;let s=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?s=t.currentTime:this.nextLoadPosition>=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&De(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==V.FRAG_LOADING_WAITING_RETRY)&&(this.state=V.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const p=this.getCurrentContext(t.chunkMeta);p&&(t.frag=p.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var n;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const r=t.details===$.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(s,!0);const o=t.errorAction,{action:a,flags:c,retryCount:l=0,retryConfig:u}=o||{},f=!!o&&!!u,h=f&&a===We.RetryRequest,d=f&&!o.resolved&&c===Tt.MoveAllAlternatesMatchingHost;if(!h&&d&&De(s)&&!s.endList)this.resetFragmentErrors(e),this.treatAsGap(s),o.resolved=!0;else if((h||d)&&l<u.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const p=Pc(u,l);this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${l+1}/${u.maxNumRetry} in ${p}ms`),o.resolved=!0,this.retryDate=self.performance.now()+p,this.state=V.FRAG_LOADING_WAITING_RETRY}else if(u&&o)if(this.resetFragmentErrors(e),l<u.maxNumRetry)!r&&a!==We.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${l})`);return}else a===We.SendAlternateToPenaltyBox?this.state=V.WAITING_LEVEL:this.state=V.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===V.PARSING||this.state===V.PARSED){const t=e.frag,s=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,s),r=n&&n.len>.5;r&&this.reduceMaxBufferLength(n.len,(t==null?void 0:t.duration)||10);const o=!r;return o&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Y.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==V.STOPPED&&(this.state=V.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const n=re.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,s),this.state===V.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==V.STOPPED&&(this.state=V.IDLE)}resetStartWhenNotLoaded(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of ${this.playlistLabel()} ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,n){const r=s.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,l)=>{const u=e.elementaryStreams[l];if(u){const f=u.endPTS-u.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${f})`),c||!1;const h=n?0:qg(r,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS);return this.hls.trigger(A.LEVEL_PTS_UPDATED,{details:r,level:s,drift:h,type:l,frag:e,start:u.startPTS,end:u.endPTS}),!0}return c},!1)){var a;if(s.fragmentError===0&&this.treatAsGap(e,s),((a=this.transmuxer)==null?void 0:a.error)===null){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=V.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(A.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===Y.MAIN?"level":"track"}fragInfo(e,t=!0,s){var n,r;return`${this.playlistLabel()} ${e.level} (${s?"part":"frag"}:[${((n=t&&!s?e.startPTS:(s||e).start)!=null?n:NaN).toFixed(3)}-${((r=t&&!s?e.endPTS:(s||e).end)!=null?r:NaN).toFixed(3)}]${s&&e.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),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}}function nf(i){return!!i.interstitialsController&&i.enableInterstitialPlayback!==!1}class e1{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=gT(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function gT(i,e){const t=new Uint8Array(e);let s=0;for(let n=0;n<i.length;n++){const r=i[n];t.set(r,s),s+=r.length}return t}var To={exports:{}},rf;function mT(){return rf||(rf=1,function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function n(c,l,u){this.fn=c,this.context=l,this.once=u||!1}function r(c,l,u,f,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new n(u,f||c,h),p=t?t+l:l;return c._events[p]?c._events[p].fn?c._events[p]=[c._events[p],d]:c._events[p].push(d):(c._events[p]=d,c._eventsCount++),c}function o(c,l){--c._eventsCount===0?c._events=new s:delete c._events[l]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],u,f;if(this._eventsCount===0)return l;for(f in u=this._events)e.call(u,f)&&l.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},a.prototype.listeners=function(l){var u=t?t+l:l,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,d=f.length,p=new Array(d);h<d;h++)p[h]=f[h].fn;return p},a.prototype.listenerCount=function(l){var u=t?t+l:l,f=this._events[u];return f?f.fn?1:f.length:0},a.prototype.emit=function(l,u,f,h,d,p){var m=t?t+l:l;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,v,x;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,f),!0;case 4:return g.fn.call(g.context,u,f,h),!0;case 5:return g.fn.call(g.context,u,f,h,d),!0;case 6:return g.fn.call(g.context,u,f,h,d,p),!0}for(x=1,v=new Array(y-1);x<y;x++)v[x-1]=arguments[x];g.fn.apply(g.context,v)}else{var E=g.length,S;for(x=0;x<E;x++)switch(g[x].once&&this.removeListener(l,g[x].fn,void 0,!0),y){case 1:g[x].fn.call(g[x].context);break;case 2:g[x].fn.call(g[x].context,u);break;case 3:g[x].fn.call(g[x].context,u,f);break;case 4:g[x].fn.call(g[x].context,u,f,h);break;default:if(!v)for(S=1,v=new Array(y-1);S<y;S++)v[S-1]=arguments[S];g[x].fn.apply(g[x].context,v)}}return!0},a.prototype.on=function(l,u,f){return r(this,l,u,f,!1)},a.prototype.once=function(l,u,f){return r(this,l,u,f,!0)},a.prototype.removeListener=function(l,u,f,h){var d=t?t+l:l;if(!this._events[d])return this;if(!u)return o(this,d),this;var p=this._events[d];if(p.fn)p.fn===u&&(!h||p.once)&&(!f||p.context===f)&&o(this,d);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==u||h&&!p[m].once||f&&p[m].context!==f)&&g.push(p[m]);g.length?this._events[d]=g.length===1?g[0]:g:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var u;return l?(u=t?t+l:l,this._events[u]&&o(this,u)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,i.exports=a}(To)),To.exports}var xT=mT(),Mc=jS(xT);const cn="1.6.7",Ai={};function yT(){return typeof __HLS_WORKER_BUNDLE__=="function"}function vT(){const i=Ai[cn];if(i)return i.clientCount++,i;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),n={worker:new self.Worker(t),objectURL:t,clientCount:1};return Ai[cn]=n,n}function ET(i){const e=Ai[i];if(e)return e.clientCount++,e;const t=new self.URL(i,self.location.href).href,n={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Ai[i]=n,n}function AT(i){const e=Ai[i||cn];if(e&&e.clientCount--===1){const{worker:s,objectURL:n}=e;delete Ai[i||cn],n&&self.URL.revokeObjectURL(n),s.terminate()}}function t1(i,e){return 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}function Nc(i,e){return 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}function no(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}function un(i,e){const t=e;let s=0;for(;Nc(i,e);){s+=10;const n=no(i,e+6);s+=n,t1(i,e+10)&&(s+=10),e+=s}if(s>0)return i.subarray(t,t+s)}function ST(i,e,t,s){const n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=e[t+2],o=r>>2&15;if(o>12){const d=new Error(`invalid ADTS sampling index:${o}`);i.emit(A.ERROR,A.ERROR,{type:Z.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:d,reason:d.message});return}const a=(r>>6&3)+1,c=e[t+3]>>6&3|(r&1)<<2,l="mp4a.40."+a,u=n[o];let f=o;(a===5||a===29)&&(f-=3);const h=[a<<3|(f&14)>>1,(f&1)<<7|c<<3];return de.log(`manifest codec:${s}, parsed codec:${l}, channels:${c}, rate:${u} (ADTS object type:${a} sampling index:${o})`),{config:h,samplerate:u,channelCount:c,codec:l,parsedCodec:l,manifestCodec:s}}function s1(i,e){return i[e]===255&&(i[e+1]&246)===240}function i1(i,e){return i[e+1]&1?7:9}function Uc(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function TT(i,e){return e+5<i.length}function Or(i,e){return e+1<i.length&&s1(i,e)}function bT(i,e){return TT(i,e)&&s1(i,e)&&Uc(i,e)<=i.length-e}function _T(i,e){if(Or(i,e)){const t=i1(i,e);if(e+t>=i.length)return!1;const s=Uc(i,e);if(s<=t)return!1;const n=e+s;return n===i.length||Or(i,n)}return!1}function n1(i,e,t,s,n){if(!i.samplerate){const r=ST(e,t,s,n);if(!r)return;ge(i,r)}}function r1(i){return 1024*9e4/i}function IT(i,e){const t=i1(i,e);if(e+t<=i.length){const s=Uc(i,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function o1(i,e,t,s,n){const r=r1(i.samplerate),o=s+n*r,a=IT(e,t);let c;if(a){const{frameLength:f,headerLength:h}=a,d=h+f,p=Math.max(0,t+d-e.length);p?(c=new Uint8Array(d-h),c.set(e.subarray(t+h,e.length),0)):c=e.subarray(t+h,t+d);const m={unit:c,pts:o};return p||i.samples.push(m),{sample:m,length:d,missing:p}}const l=e.length-t;return c=new Uint8Array(l),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:o},length:l,missing:-1}}function CT(i,e){return Nc(i,e)&&no(i,e+6)+10<=i.length-e}function LT(i){return i instanceof ArrayBuffer?i:i.byteOffset==0&&i.byteLength==i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer}function bo(i,e=0,t=1/0){return DT(i,e,t,Uint8Array)}function DT(i,e,t,s){const n=RT(i);let r=1;"BYTES_PER_ELEMENT"in s&&(r=s.BYTES_PER_ELEMENT);const o=wT(i)?i.byteOffset:0,a=(o+i.byteLength)/r,c=(o+e)/r,l=Math.floor(Math.max(0,Math.min(c,a))),u=Math.floor(Math.min(l+Math.max(t,0),a));return new s(n,l,u-l)}function RT(i){return i instanceof ArrayBuffer?i:i.buffer}function wT(i){return i&&i.buffer instanceof ArrayBuffer&&i.byteLength!==void 0&&i.byteOffset!==void 0}function PT(i){const e={key:i.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(i.size<2)return;if(i.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const s=i.data.subarray(1).indexOf(0);if(s===-1)return;const n=ct(bo(i.data,1,s)),r=i.data[2+s],o=i.data.subarray(3+s).indexOf(0);if(o===-1)return;const a=ct(bo(i.data,3+s,o));let c;return n==="-->"?c=ct(bo(i.data,4+s+o)):c=LT(i.data.subarray(4+s+o)),e.mimeType=n,e.pictureType=r,e.description=a,e.data=c,e}function kT(i){if(i.size<2)return;const e=ct(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}}function BT(i){if(i.size<2)return;if(i.type==="TXXX"){let t=1;const s=ct(i.data.subarray(t),!0);t+=s.length+1;const n=ct(i.data.subarray(t));return{key:i.type,info:s,data:n}}const e=ct(i.data.subarray(1));return{key:i.type,info:"",data:e}}function FT(i){if(i.type==="WXXX"){if(i.size<2)return;let t=1;const s=ct(i.data.subarray(t),!0);t+=s.length+1;const n=ct(i.data.subarray(t));return{key:i.type,info:s,data:n}}const e=ct(i.data);return{key:i.type,info:"",data:e}}function OT(i){return i.type==="PRIV"?kT(i):i.type[0]==="W"?FT(i):i.type==="APIC"?PT(i):BT(i)}function MT(i){const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=no(i,4),s=10;return{type:e,size:t,data:i.subarray(s,s+t)}}const $n=10,NT=10;function a1(i){let e=0;const t=[];for(;Nc(i,e);){const s=no(i,e+6);i[e+5]>>6&1&&(e+=$n),e+=$n;const n=e+s;for(;e+NT<n;){const r=MT(i.subarray(e)),o=OT(r);o&&t.push(o),e+=r.size+$n}t1(i,e)&&(e+=$n)}return t}function l1(i){return i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp"}function UT(i){if(i.data.byteLength===8){const e=new Uint8Array(i.data),t=e[3]&1;let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,t&&(s+=4772185884e-2),Math.round(s)}}function $c(i){const e=a1(i);for(let t=0;t<e.length;t++){const s=e[t];if(l1(s))return UT(s)}}let lt=function(i){return i.audioId3="org.id3",i.dateRange="com.apple.quicktime.HLS",i.emsg="https://aomedia.org/emsg/ID3",i.misbklv="urn:misb:KLV:bin:1910.1",i}({});function Rt(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Hc{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,s,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,s){}demux(e,t){this.cachedData&&(e=xt(this.cachedData,e),this.cachedData=null);let s=un(e,0),n=s?s.length:0,r;const o=this._audioTrack,a=this._id3Track,c=s?$c(s):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&j(c))&&(this.basePTS=$T(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:lt.audioId3,duration:Number.POSITIVE_INFINITY});n<l;){if(this.canParse(e,n)){const u=this.appendFrame(o,e,n);u?(this.frameIndex++,this.lastPTS=u.sample.pts,n+=u.length,r=n):n=l}else CT(e,n)?(s=un(e,n),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:lt.audioId3,duration:Number.POSITIVE_INFINITY}),n+=s.length,r=n):n++;if(n===l&&r!==l){const u=e.slice(r);this.cachedData?this.cachedData=xt(this.cachedData,u):this.cachedData=u}}return{audioTrack:o,videoTrack:Rt(),id3Track:a,textTrack:Rt()}}demuxSampleAes(e,t,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Rt(),id3Track:this._id3Track,textTrack:Rt()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const $T=(i,e,t)=>{if(j(i))return i*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};let Hn=null;const HT=[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],GT=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],KT=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],VT=[0,1,1,4];function c1(i,e,t,s,n){if(t+24>e.length)return;const r=u1(e,t);if(r&&t+r.frameLength<=e.length){const o=r.samplesPerFrame*9e4/r.sampleRate,a=s+n*o,c={unit:e.subarray(t,t+r.frameLength),pts:a,dts:a};return i.config=[],i.channelCount=r.channelCount,i.samplerate=r.sampleRate,i.samples.push(c),{sample:c,length:r.frameLength,missing:0}}}function u1(i,e){const t=i[e+1]>>3&3,s=i[e+1]>>1&3,n=i[e+2]>>4&15,r=i[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&r!==3){const o=i[e+2]>>1&1,a=i[e+3]>>6,c=t===3?3-s:s===3?3:4,l=HT[c*14+n-1]*1e3,f=GT[(t===3?0:t===2?1:2)*3+r],h=a===3?1:2,d=KT[t][s],p=VT[s],m=d*8*p,g=Math.floor(d*l/f+o)*p;if(Hn===null){const x=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Hn=x?parseInt(x[1]):0}return!!Hn&&Hn<=87&&s===2&&l>=224e3&&a===0&&(i[e+3]=i[e+3]|128),{sampleRate:f,channelCount:h,frameLength:g,samplesPerFrame:m}}}function Gc(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function f1(i,e){return e+1<i.length&&Gc(i,e)}function jT(i,e){return Gc(i,e)&&4<=i.length-e}function h1(i,e){if(e+1<i.length&&Gc(i,e)){const s=u1(i,e);let n=4;s!=null&&s.frameLength&&(n=s.frameLength);const r=e+n;return r===i.length||f1(i,r)}return!1}class qT extends Hc{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,s,n){super.resetInitSegment(e,t,s,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const s=un(e,0);let n=(s==null?void 0:s.length)||0;if(h1(e,n))return!1;for(let r=e.length;n<r;n++)if(_T(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return bT(e,t)}appendFrame(e,t,s){n1(e,this.observer,t,s,e.manifestCodec);const n=o1(e,t,s,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const d1=(i,e)=>{let t=0,s=5;e+=s;const n=new Uint32Array(1),r=new Uint32Array(1),o=new Uint8Array(1);for(;s>0;){o[0]=i[e];const a=Math.min(s,8),c=8-a;r[0]=4278190080>>>24+c<<c,n[0]=(o[0]&r[0])>>c,t=t?t<<a|n[0]:n[0],e+=1,s-=a}return t};class WT extends Hc{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,s,n){super.resetInitSegment(e,t,s,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,s){const n=p1(e,t,s,this.basePTS,this.frameIndex);if(n!==-1)return{sample:e.samples[e.samples.length-1],length:n,missing:0}}static probe(e){if(!e)return!1;const t=un(e,0);if(!t)return!1;const s=t.length;return e[s]===11&&e[s+1]===119&&$c(t)!==void 0&&d1(e,s)<16}}function p1(i,e,t,s,n){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const r=e[t+4]>>6;if(r>=3)return-1;const a=[48e3,44100,32e3][r],c=e[t+4]&63,u=[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][c*3+r]*2;if(t+u>e.length)return-1;const f=e[t+6]>>5;let h=0;f===2?h+=2:(f&1&&f!==1&&(h+=2),f&4&&(h+=2));const d=(e[t+6]<<8|e[t+7])>>12-h&1,m=[2,1,2,3,3,4,4,5][f]+d,g=e[t+5]>>3,y=e[t+5]&7,v=new Uint8Array([r<<6|g<<1|y>>2,(y&3)<<6|f<<3|d<<2|c>>4,c<<4&224]),x=1536/a*9e4,E=s+n*x,S=e.subarray(t,t+u);return i.config=v,i.channelCount=m,i.samplerate=a,i.samples.push({unit:S,pts:E}),u}class zT extends Hc{resetInitSegment(e,t,s,n){super.resetInitSegment(e,t,s,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=un(e,0);let s=(t==null?void 0:t.length)||0;if(t&&e[s]===11&&e[s+1]===119&&$c(t)!==void 0&&d1(e,s)<=16)return!1;for(let n=e.length;s<n;s++)if(h1(e,s))return de.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return jT(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return c1(e,t,s,this.basePTS,this.frameIndex)}}const QT=/\/emsg[-/]ID3/i;class YT{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,s,n){const r=this.videoTrack=Rt("video",1),o=this.audioTrack=Rt("audio",1),a=this.txtTrack=Rt("text",1);if(this.id3Track=Rt("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=Rg(e);if(c.video){const{id:l,timescale:u,codec:f,supplemental:h}=c.video;r.id=l,r.timescale=a.timescale=u,r.codec=f,r.supplemental=h}if(c.audio){const{id:l,timescale:u,codec:f}=c.audio;o.id=l,o.timescale=u,o.codec=f}a.id=Cg.text,r.sampleDuration=0,r.duration=o.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return YS(e)}demux(e,t){this.timeOffset=t;let s=e;const n=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=xt(this.remainderData,e));const a=i6(s);this.remainderData=a.remainder,n.samples=a.valid||new Uint8Array}else n.samples=s;const o=this.extractID3Track(n,t);return r.samples=b0(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,s=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(t,this.timeOffset);return s.samples=b0(e,t),{videoTrack:t,audioTrack:Rt(),id3Track:n,textTrack:Rt()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const n=ae(e.samples,["emsg"]);n&&n.forEach(r=>{const o=r6(r);if(QT.test(o.schemeIdUri)){const a=of(o,t);let c=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const l=o.payload;s.samples.push({data:l,len:l.byteLength,dts:a,pts:a,type:lt.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&o.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const a=of(o,t);s.samples.push({data:o.payload,len:o.payload.byteLength,dts:a,pts:a,type:lt.misbklv,duration:Number.POSITIVE_INFINITY})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function of(i,e){return j(i.presentationTime)?i.presentationTime/i.timeScale:e+i.presentationTimeDelta/i.timeScale}class XT{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new kc(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Es.cbc)}decryptAacSample(e,t,s){const n=e[t].unit;if(n.length<=16)return;const r=n.subarray(16,n.length-n.length%16),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(o).then(a=>{const c=new Uint8Array(a);n.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)})}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let n=0;for(let r=32;r<e.length-16;r+=160,n+=16)s.set(e.subarray(r,r+16),n);return s}getAvcDecryptedUnit(e,t){const s=new Uint8Array(t);let n=0;for(let r=32;r<e.length-16;r+=160,n+=16)e.set(s.subarray(n,n+16),r);return e}decryptAvcSample(e,t,s,n,r){const o=wg(r.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(c=>{r.data=this.getAvcDecryptedUnit(o,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,n)})}decryptAvcSamples(e,t,s,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){n();return}const r=e[t].units;for(;!(s>=r.length);s++){const o=r[s];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,s,n,o),!this.decrypter.isSync()))return}}}}class g1{constructor(){this.VideoSample=null}createVideoSample(e,t,s){return{key:e,frame:!1,pts:t,dts:s,units:[],length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,n;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const r=s.units;n=r[r.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,n=s.length;if(n){const r=s[n-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,s){const n=t.byteLength;let r=e.naluState||0;const o=r,a=[];let c=0,l,u,f,h=-1,d=0;for(r===-1&&(h=0,d=this.getNALuType(t,0),r=0,c=1);c<n;){if(l=t[c++],!r){r=l?0:1;continue}if(r===1){r=l?0:2;continue}if(!l)r=3;else if(l===1){if(u=c-r-1,h>=0){const p={data:t.subarray(h,u),type:d};a.push(p)}else{const p=this.getLastNalUnit(e.samples);p&&(o&&c<=4-o&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-o)),u>0&&(p.data=xt(p.data,t.subarray(0,u)),p.state=0))}c<n?(f=this.getNALuType(t,c),h=c,d=f,r=0):r=-1}else r=0}if(h>=0&&r>=0){const p={data:t.subarray(h,n),type:d,state:r};a.push(p)}if(a.length===0){const p=this.getLastNalUnit(e.samples);p&&(p.data=xt(p.data,t))}return e.naluState=r,a}}class Wi{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,s=e.byteLength-t,n=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");n.set(e.subarray(s,s+r)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const s=this.word>>>32-t;if(e>32&&de.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<<t|this.readBits(t):s}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class af extends g1{parsePES(e,t,s,n){const r=this.parseNALu(e,s.data,n);let o=this.VideoSample,a,c=!1;s.data=null,o&&r.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),r.forEach(l=>{var u,f;switch(l.type){case 1:{let m=!1;a=!0;const g=l.data;if(c&&g.length>4){const y=this.readSliceType(g);(y===2||y===4||y===7||y===9)&&(m=!0)}if(m){var h;(h=o)!=null&&h.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),o.frame=!0,o.key=m;break}case 5:a=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),o.key=!0,o.frame=!0;break;case 6:{a=!0,Dc(l.data,1,s.pts,t.samples);break}case 7:{var d,p;a=!0,c=!0;const m=l.data,g=this.readSPS(m);if(!e.sps||e.width!==g.width||e.height!==g.height||((d=e.pixelRatio)==null?void 0:d[0])!==g.pixelRatio[0]||((p=e.pixelRatio)==null?void 0:p[1])!==g.pixelRatio[1]){e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.sps=[m];const y=m.subarray(1,4);let v="avc1.";for(let x=0;x<3;x++){let E=y[x].toString(16);E.length<2&&(E="0"+E),v+=E}e.codec=v}break}case 8:a=!0,e.pps=[l.data];break;case 9:a=!0,e.audFound=!0,(f=o)!=null&&f.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:a=!0;break;default:a=!1;break}o&&a&&o.units.push(l)}),n&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Wi(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let s=8,n=8,r;for(let o=0;o<e;o++)n!==0&&(r=t.readEG(),n=(s+r+256)%256),s=n===0?s:n}readSPS(e){const t=new Wi(e);let s=0,n=0,r=0,o=0,a,c,l;const u=t.readUByte.bind(t),f=t.readBits.bind(t),h=t.readUEG.bind(t),d=t.readBoolean.bind(t),p=t.skipBits.bind(t),m=t.skipEG.bind(t),g=t.skipUEG.bind(t),y=this.skipScalingList.bind(this);u();const v=u();if(f(5),p(3),u(),g(),v===100||v===110||v===122||v===244||v===44||v===83||v===86||v===118||v===128){const I=h();if(I===3&&p(1),g(),g(),p(1),d())for(c=I!==3?8:12,l=0;l<c;l++)d()&&(l<6?y(16,t):y(64,t))}g();const x=h();if(x===0)h();else if(x===1)for(p(1),m(),m(),a=h(),l=0;l<a;l++)m();g(),p(1);const E=h(),S=h(),T=f(1);T===0&&p(1),p(1),d()&&(s=h(),n=h(),r=h(),o=h());let _=[1,1];if(d()&&d())switch(u()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:{_=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((E+1)*16-s*2-n*2),height:(2-T)*(S+1)*16-(T?2:4)*(r+o),pixelRatio:_}}}class lf extends g1{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,s,n){const r=this.parseNALu(e,s.data,n);let o=this.VideoSample,a,c=!1;s.data=null,o&&r.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),r.forEach(l=>{var u,f;switch(l.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),o.frame=!0,a=!0;break;case 16:case 17:case 18:case 21:if(a=!0,c){var h;(h=o)!=null&&h.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:a=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),o.key=!0,o.frame=!0;break;case 39:a=!0,Dc(l.data,2,s.pts,t.samples);break;case 32:a=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=ge(e.params,this.readVPS(l.data)),this.initVPS=l.data),e.vps=[l.data];break;case 33:if(a=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],l.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const d=this.readSPS(l.data);e.width=d.width,e.height=d.height,e.pixelRatio=d.pixelRatio,e.codec=d.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const p in d.params)e.params[p]=d.params[p]}this.pushParameterSet(e.sps,l.data,e.vps),o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),o.key=!0;break;case 34:if(a=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const d=this.readPPS(l.data);for(const p in d)e.params[p]=d[p]}this.pushParameterSet(e.pps,l.data,e.vps)}break;case 35:a=!0,e.audFound=!0,(f=o)!=null&&f.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:a=!1;break}o&&a&&o.units.push(l)}),n&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,t,s){(s&&s[0]===this.initVPS||!s&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let s=0;for(let n=0;n<e.byteLength;n++)n>=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[s]=e[n],s++);return new Uint8Array(t.buffer,0,s)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Wi(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const s=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:s+1,temporalIdNested:n}}readSPS(e){const t=new Wi(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const s=t.readBits(3);t.readBoolean();const n=t.readBits(2),r=t.readBoolean(),o=t.readBits(5),a=t.readUByte(),c=t.readUByte(),l=t.readUByte(),u=t.readUByte(),f=t.readUByte(),h=t.readUByte(),d=t.readUByte(),p=t.readUByte(),m=t.readUByte(),g=t.readUByte(),y=t.readUByte(),v=[],x=[];for(let le=0;le<s;le++)v.push(t.readBoolean()),x.push(t.readBoolean());if(s>0)for(let le=s;le<8;le++)t.readBits(2);for(let le=0;le<s;le++)v[le]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),x[le]&&t.readUByte();t.readUEG();const E=t.readUEG();E==3&&t.skipBits(1);const S=t.readUEG(),T=t.readUEG(),_=t.readBoolean();let I=0,R=0,b=0,L=0;_&&(I+=t.readUEG(),R+=t.readUEG(),b+=t.readUEG(),L+=t.readUEG());const k=t.readUEG(),M=t.readUEG(),N=t.readUEG(),F=t.readBoolean();for(let le=F?0:s;le<=s;le++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let Te=0;Te<4;Te++)for(let Fe=0;Fe<(Te===3?2:6);Fe++)if(!t.readBoolean())t.readUEG();else{const Ve=Math.min(64,1<<4+(Te<<1));Te>1&&t.readEG();for(let Oe=0;Oe<Ve;Oe++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const B=t.readUEG();let G=0;for(let le=0;le<B;le++){let Te=!1;if(le!==0&&(Te=t.readBoolean()),Te){le===B&&t.readUEG(),t.readBoolean(),t.readUEG();let Fe=0;for(let yt=0;yt<=G;yt++){const Ve=t.readBoolean();let Oe=!1;Ve||(Oe=t.readBoolean()),(Ve||Oe)&&Fe++}G=Fe}else{const Fe=t.readUEG(),yt=t.readUEG();G=Fe+yt;for(let Ve=0;Ve<Fe;Ve++)t.readUEG(),t.readBoolean();for(let Ve=0;Ve<yt;Ve++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const le=t.readUEG();for(let Te=0;Te<le;Te++){for(let Fe=0;Fe<N+4;Fe++)t.readBits(1);t.readBits(1)}}let C=0,D=1,P=1,w=!0,W=1,z=0;t.readBoolean(),t.readBoolean();let ne=!1;if(t.readBoolean()){if(t.readBoolean()){const Ce=t.readUByte(),vt=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],$t=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Ce>0&&Ce<16?(D=vt[Ce-1],P=$t[Ce-1]):Ce===255&&(D=t.readBits(16),P=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),ne=t.readBoolean(),ne&&(I+=t.readUEG(),R+=t.readUEG(),b+=t.readUEG(),L+=t.readUEG()),t.readBoolean()&&(W=t.readBits(32),z=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const $t=t.readBoolean(),Di=t.readBoolean();let ut=!1;($t||Di)&&(ut=t.readBoolean(),ut&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),ut&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Yt=0;Yt<=s;Yt++){w=t.readBoolean();const ao=w||t.readBoolean();let Ri=!1;ao?t.readEG():Ri=t.readBoolean();const wi=Ri?1:t.readUEG()+1;if($t)for(let ft=0;ft<wi;ft++)t.readUEG(),t.readUEG(),ut&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Di)for(let ft=0;ft<wi;ft++)t.readUEG(),t.readUEG(),ut&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),C=t.readUEG())}let pe=S,fe=T;if(_||ne){let le=1,Te=1;E===1?le=Te=2:E==2&&(le=2),pe=S-le*R-le*I,fe=T-Te*L-Te*b}const _e=n?["A","B","C"][n]:"",ot=a<<24|c<<16|l<<8|u;let Ie=0;for(let le=0;le<32;le++)Ie=(Ie|(ot>>le&1)<<31-le)>>>0;let Ke=Ie.toString(16);return o===1&&Ke==="2"&&(Ke="6"),{codecString:`hvc1.${_e}${o}.${Ke}.${r?"H":"L"}${y}.B0`,params:{general_tier_flag:r,general_profile_idc:o,general_profile_space:n,general_profile_compatibility_flags:[a,c,l,u],general_constraint_indicator_flags:[f,h,d,p,m,g],general_level_idc:y,bit_depth:k+8,bit_depth_luma_minus8:k,bit_depth_chroma_minus8:M,min_spatial_segmentation_idc:C,chroma_format_idc:E,frame_rate:{fixed:w,fps:z/W}},width:pe,height:fe,pixelRatio:[D,P]}}readPPS(e){const t=new Wi(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),r=t.readBoolean();let o=1;return r&&n?o=0:r?o=3:n&&(o=2),{parallelismType:o}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Me=188;class rs{constructor(e,t,s,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.logger=n,this.videoParser=null}static probe(e,t){const s=rs.syncOffset(e);return s>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(e){const t=e.length;let s=Math.min(Me*5,t-Me)+1,n=0;for(;n<s;){let r=!1,o=-1,a=0;for(let c=n;c<t;c+=Me)if(e[c]===71&&(t-c===Me||e[c+Me]===71)){if(a++,o===-1&&(o=c,o!==0&&(s=Math.min(o+Me*99,e.length-Me)+1)),r||(r=Ll(e,c)===0),r&&a>1&&(o===0&&a>2||c+Me>s))return o}else{if(a)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Cg[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=rs.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=rs.createTrack("audio",n),this._id3Track=rs.createTrack("id3"),this._txtTrack=rs.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,n=!1){s||(this.sampleAes=null);let r;const o=this._videoTrack,a=this._audioTrack,c=this._id3Track,l=this._txtTrack;let u=o.pid,f=o.pesData,h=a.pid,d=c.pid,p=a.pesData,m=c.pesData,g=null,y=this.pmtParsed,v=this._pmtId,x=e.length;if(this.remainderData&&(e=xt(this.remainderData,e),x=e.length,this.remainderData=null),x<Me&&!n)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:c,textTrack:l};const E=Math.max(0,rs.syncOffset(e));x-=(x-E)%Me,x<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,x,e.buffer.byteLength-x));let S=0;for(let _=E;_<x;_+=Me)if(e[_]===71){const I=!!(e[_+1]&64),R=Ll(e,_),b=(e[_+3]&48)>>4;let L;if(b>1){if(L=_+5+e[_+4],L===_+Me)continue}else L=_+4;switch(R){case u:if(I){if(f&&(r=ii(f,this.logger))){if(this.videoParser===null)switch(o.segmentCodec){case"avc":this.videoParser=new af;break;case"hevc":this.videoParser=new lf;break}this.videoParser!==null&&this.videoParser.parsePES(o,l,r,!1)}f={data:[],size:0}}f&&(f.data.push(e.subarray(L,_+Me)),f.size+=_+Me-L);break;case h:if(I){if(p&&(r=ii(p,this.logger)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r);break;case"ac3":this.parseAC3PES(a,r);break}p={data:[],size:0}}p&&(p.data.push(e.subarray(L,_+Me)),p.size+=_+Me-L);break;case d:I&&(m&&(r=ii(m,this.logger))&&this.parseID3PES(c,r),m={data:[],size:0}),m&&(m.data.push(e.subarray(L,_+Me)),m.size+=_+Me-L);break;case 0:I&&(L+=e[L]+1),v=this._pmtId=JT(e,L);break;case v:{I&&(L+=e[L]+1);const k=ZT(e,L,this.typeSupported,s,this.observer,this.logger);u=k.videoPid,u>0&&(o.pid=u,o.segmentCodec=k.segmentVideoCodec),h=k.audioPid,h>0&&(a.pid=h,a.segmentCodec=k.segmentAudioCodec),d=k.id3Pid,d>0&&(c.pid=d),g!==null&&!y&&(this.logger.warn(`MPEG-TS PMT found at ${_} after unknown PID '${g}'. Backtracking to sync byte @${E} to parse all TS packets.`),g=null,_=E-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=R;break}}else S++;S>0&&Dl(this.observer,new Error(`Found ${S} TS packet/s that do not start with 0x47`),void 0,this.logger),o.pesData=f,a.pesData=p,c.pesData=m;const T={audioTrack:a,videoTrack:o,id3Track:c,textTrack:l};return n&&this.extractRemainingSamples(T),T}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:n,textTrack:r}=e,o=s.pesData,a=t.pesData,c=n.pesData;let l;if(o&&(l=ii(o,this.logger))){if(this.videoParser===null)switch(s.segmentCodec){case"avc":this.videoParser=new af;break;case"hevc":this.videoParser=new lf;break}this.videoParser!==null&&(this.videoParser.parsePES(s,r,l,!0),s.pesData=null)}else s.pesData=o;if(a&&(l=ii(a,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l);break}t.pesData=null}else a!=null&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;c&&(l=ii(c,this.logger))?(this.parseID3PES(n,l),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,s){const n=this.demux(e,s,!0,!this.config.progressive),r=this.sampleAes=new XT(this.observer,this.config,t);return this.decrypt(n,r)}decrypt(e,t){return new Promise(s=>{const{audioTrack:n,videoTrack:r}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{s(e)}):s(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{s(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let s=0;const n=this.aacOverFlow;let r=t.data;if(n){this.aacOverFlow=null;const f=n.missing,h=n.sample.unit.byteLength;if(f===-1)r=xt(n.sample.unit,r);else{const d=h-f;n.sample.unit.set(r.subarray(0,f),d),e.samples.push(n.sample),s=n.missing}}let o,a;for(o=s,a=r.length;o<a-1&&!Or(r,o);o++);if(o!==s){let f;const h=o<a-1;if(h?f=`AAC PES did not start with ADTS header,offset:${o}`:f="No ADTS header found in AAC PES",Dl(this.observer,new Error(f),h,this.logger),!h)return}n1(e,this.observer,r,o,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(n){const f=r1(e.samplerate);c=n.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let l=0,u;for(;o<a;)if(u=o1(e,r,o,c,l),o+=u.length,u.missing){this.aacOverFlow=u;break}else for(l++;o<a-1&&!Or(r,o);o++);}parseMPEGPES(e,t){const s=t.data,n=s.length;let r=0,o=0;const a=t.pts;if(a===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<n;)if(f1(s,o)){const c=c1(e,s,o,a,r);if(c)o+=c.length,r++;else break}else o++}parseAC3PES(e,t){{const s=t.data,n=t.pts;if(n===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const r=s.length;let o=0,a=0,c;for(;a<r&&(c=p1(e,s,a,n,o++))>0;)a+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=ge({},t,{type:this._videoTrack?lt.emsg:lt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Ll(i,e){return((i[e+1]&31)<<8)+i[e+2]}function JT(i,e){return(i[e+10]&31)<<8|i[e+11]}function ZT(i,e,t,s,n,r){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=(i[e+1]&15)<<8|i[e+2],c=e+3+a-4,l=(i[e+10]&15)<<8|i[e+11];for(e+=12+l;e<c;){const u=Ll(i,e),f=(i[e+3]&15)<<8|i[e+4];switch(i[e]){case 207:if(!s){_o("ADTS AAC",r);break}case 15:o.audioPid===-1&&(o.audioPid=u);break;case 21:o.id3Pid===-1&&(o.id3Pid=u);break;case 219:if(!s){_o("H.264",r);break}case 27:o.videoPid===-1&&(o.videoPid=u);break;case 3:case 4:!t.mpeg&&!t.mp3?r.log("MPEG audio found, not supported in this browser"):o.audioPid===-1&&(o.audioPid=u,o.segmentAudioCodec="mp3");break;case 193:if(!s){_o("AC-3",r);break}case 129:t.ac3?o.audioPid===-1&&(o.audioPid=u,o.segmentAudioCodec="ac3"):r.log("AC-3 audio found, not supported in this browser");break;case 6:if(o.audioPid===-1&&f>0){let h=e+5,d=f;for(;d>2;){switch(i[h]){case 106:t.ac3!==!0?r.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=u,o.segmentAudioCodec="ac3");break}const m=i[h+1]+2;h+=m,d-=m}}break;case 194:case 135:return Dl(n,new Error("Unsupported EC-3 in M2TS found"),void 0,r),o;case 36:o.videoPid===-1&&(o.videoPid=u,o.segmentVideoCodec="hevc",r.log("HEVC in M2TS found"));break}e+=f+5}return o}function Dl(i,e,t,s){s.warn(`parsing error: ${e.message}`),i.emit(A.ERROR,A.ERROR,{type:Z.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function _o(i,e){e.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function ii(i,e){let t=0,s,n,r,o,a;const c=i.data;if(!i||i.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=xt(c[0],c[1]),c.splice(1,1);if(s=c[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(n=(s[4]<<8)+s[5],n&&n>i.size-6)return null;const u=s[7];u&192&&(o=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,u&64?(a=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,o-a>60*9e4&&(e.warn(`${Math.round((o-a)/9e4)}s delta between PTS and DTS, align them`),o=a)):a=o),r=s[8];let f=r+9;if(i.size<=f)return null;i.size-=f;const h=new Uint8Array(i.size);for(let d=0,p=c.length;d<p;d++){s=c[d];let m=s.byteLength;if(f)if(f>m){f-=m;continue}else s=s.subarray(f),m-=f,f=0;h.set(s,t),t+=m}return n&&(n-=r+3),{data:h,pts:o,dts:a,len:n}}return null}class e5{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 es=Math.pow(2,32)-1;class U{static init(){U.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in U.types)U.types.hasOwnProperty(e)&&(U.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),s=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);U.HDLR_TYPES={video:t,audio:s};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);U.STTS=U.STSC=U.STCO=r,U.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),U.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),U.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),U.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);U.FTYP=U.box(U.types.ftyp,o,c,o,a),U.DINF=U.box(U.types.dinf,U.box(U.types.dref,n))}static box(e,...t){let s=8,n=t.length;const r=n;for(;n--;)s+=t[n].byteLength;const o=new Uint8Array(s);for(o[0]=s>>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=s&255,o.set(e,4),n=0,s=8;n<r;n++)o.set(t[n],s),s+=t[n].byteLength;return o}static hdlr(e){return U.box(U.types.hdlr,U.HDLR_TYPES[e])}static mdat(e){return U.box(U.types.mdat,e)}static mdhd(e,t){t*=e;const s=Math.floor(t/(es+1)),n=Math.floor(t%(es+1));return U.box(U.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,n>>24,n>>16&255,n>>8&255,n&255,85,196,0,0]))}static mdia(e){return U.box(U.types.mdia,U.mdhd(e.timescale||0,e.duration||0),U.hdlr(e.type),U.minf(e))}static mfhd(e){return U.box(U.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"?U.box(U.types.minf,U.box(U.types.smhd,U.SMHD),U.DINF,U.stbl(e)):U.box(U.types.minf,U.box(U.types.vmhd,U.VMHD),U.DINF,U.stbl(e))}static moof(e,t,s){return U.box(U.types.moof,U.mfhd(e),U.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=U.trak(e[t]);return U.box.apply(null,[U.types.moov,U.mvhd(e[0].timescale||0,e[0].duration||0)].concat(s).concat(U.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=U.trex(e[t]);return U.box.apply(null,[U.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(es+1)),n=Math.floor(t%(es+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,n>>24,n>>16&255,n>>8&255,n&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 U.box(U.types.mvhd,r)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let n,r;for(n=0;n<t.length;n++)r=t[n].flags,s[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return U.box(U.types.sdtp,s)}static stbl(e){return U.box(U.types.stbl,U.stsd(e),U.box(U.types.stts,U.STTS),U.box(U.types.stsc,U.STSC),U.box(U.types.stsz,U.STSZ),U.box(U.types.stco,U.STCO))}static avc1(e){let t=[],s=[],n,r,o;for(n=0;n<e.sps.length;n++)r=e.sps[n],o=r.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(r));for(n=0;n<e.pps.length;n++)r=e.pps[n],o=r.byteLength,s.push(o>>>8&255),s.push(o&255),s=s.concat(Array.prototype.slice.call(r));const a=U.box(U.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),c=e.width,l=e.height,u=e.pixelRatio[0],f=e.pixelRatio[1];return U.box(U.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,c>>8&255,c&255,l>>8&255,l&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]),a,U.box(U.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),U.box(U.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,f>>24,f>>16&255,f>>8&255,f&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return U.box(U.types.mp4a,U.audioStsd(e),U.box(U.types.esds,U.esds(e)))}static mp3(e){return U.box(U.types[".mp3"],U.audioStsd(e))}static ac3(e){return U.box(U.types["ac-3"],U.audioStsd(e),U.box(U.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return U.box(U.types.stsd,U.STSD,U.mp4a(e));if(t==="ac3"&&e.config)return U.box(U.types.stsd,U.STSD,U.ac3(e));if(t==="mp3"&&e.codec==="mp3")return U.box(U.types.stsd,U.STSD,U.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return U.box(U.types.stsd,U.STSD,U.avc1(e));if(t==="hevc"&&e.vps)return U.box(U.types.stsd,U.STSD,U.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,s=(e.duration||0)*(e.timescale||0),n=e.width||0,r=e.height||0,o=Math.floor(s/(es+1)),a=Math.floor(s%(es+1));return U.box(U.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,o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&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,n>>8&255,n&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const s=U.sdtp(e),n=e.id,r=Math.floor(t/(es+1)),o=Math.floor(t%(es+1));return U.box(U.types.traf,U.box(U.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),U.box(U.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,o>>24,o>>16&255,o>>8&255,o&255])),U.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,U.box(U.types.trak,U.tkhd(e),U.mdia(e))}static trex(e){const t=e.id;return U.box(U.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],n=s.length,r=12+16*n,o=new Uint8Array(r);let a,c,l,u,f,h;for(t+=8+r,o.set([e.type==="video"?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<n;a++)c=s[a],l=c.duration,u=c.size,f=c.flags,h=c.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*a);return U.box(U.types.trun,o)}static initSegment(e){U.types||U.init();const t=U.moov(e);return xt(U.FTYP,t)}static hvc1(e){const t=e.params,s=[e.vps,e.sps,e.pps],n=4,r=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),n-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),s.length]);let o=r.length;for(let p=0;p<s.length;p+=1){o+=3;for(let m=0;m<s[p].length;m+=1)o+=2+s[p][m].length}const a=new Uint8Array(o);a.set(r,0),o=r.length;const c=s.length-1;for(let p=0;p<s.length;p+=1){a.set(new Uint8Array([32+p|(p===c?128:0),0,s[p].length]),o),o+=3;for(let m=0;m<s[p].length;m+=1)a.set(new Uint8Array([s[p][m].length>>8,s[p][m].length&255]),o),o+=2,a.set(s[p][m],o),o+=s[p][m].length}const l=U.box(U.types.hvcC,a),u=e.width,f=e.height,h=e.pixelRatio[0],d=e.pixelRatio[1];return U.box(U.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,f>>8&255,f&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]),l,U.box(U.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),U.box(U.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,d>>24,d>>16&255,d>>8&255,d&255])))}}U.types=void 0;U.HDLR_TYPES=void 0;U.STTS=void 0;U.STSC=void 0;U.STCO=void 0;U.STSZ=void 0;U.VMHD=void 0;U.SMHD=void 0;U.STSD=void 0;U.FTYP=void 0;U.DINF=void 0;const m1=9e4;function Kc(i,e,t=1,s=!1){const n=i*e*t;return s?Math.round(n):n}function t5(i,e,t=1,s=!1){return Kc(i,e,1/t,s)}function Fi(i,e=!1){return Kc(i,1e3,1/m1,e)}function s5(i,e=1){return Kc(i,m1,1/e)}const i5=10*1e3,n5=1024,r5=1152,o5=1536;let ni=null,Io=null;function cf(i,e,t,s){return{duration:e,size:t,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:i?2:1,isNonSync:i?0:1}}}class rr extends Ct{constructor(e,t,s,n){if(super("mp4-remuxer",n),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,ni===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ni=o?parseInt(o[1]):0}if(Io===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);Io=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e[0].pts,n=e.reduce((r,o)=>{let a=o.pts,c=a-r;return c<-4294967296&&(t=!0,a=pt(a,s),c=a-r),c>0?r:a},s);return t&&this.debug("PTS rollover detected"),n}remux(e,t,s,n,r,o,a,c){let l,u,f,h,d,p,m=r,g=r;const y=e.pid>-1,v=t.pid>-1,x=t.samples.length,E=e.samples.length>0,S=a&&x>0||x>1;if((!y||E)&&(!v||S)||this.ISGenerated||a){if(this.ISGenerated){var _,I,R,b;const N=this.videoTrackConfig;(N&&(t.width!==N.width||t.height!==N.height||((_=t.pixelRatio)==null?void 0:_[0])!==((I=N.pixelRatio)==null?void 0:I[0])||((R=t.pixelRatio)==null?void 0:R[1])!==((b=N.pixelRatio)==null?void 0:b[1]))||!N&&S||this.nextAudioTs===null&&E)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,r,o));const L=this.isVideoContiguous;let k=-1,M;if(S&&(k=a5(t.samples),!L&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,k>0){this.warn(`Dropped ${k} out of ${x} video samples due to a missing keyframe`);const N=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(k),t.dropped+=k,g+=(t.samples[0].pts-N)/t.inputTimeScale,M=g}else k===-1&&(this.warn(`No keyframe found out of ${x} video samples`),p=!1);if(this.ISGenerated){if(E&&S){const N=this.getVideoStartPts(t.samples),O=(pt(e.samples[0].pts,N)-N)/t.inputTimeScale;m+=Math.max(0,O),g+=Math.max(0,-O)}if(E){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),f=this.generateIS(e,t,r,o)),u=this.remuxAudio(e,m,this.isAudioContiguous,o,v||S||c===Y.AUDIO?g:void 0),S){const N=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),f=this.generateIS(e,t,r,o)),l=this.remuxVideo(t,g,L,N)}}else S&&(l=this.remuxVideo(t,g,L,0));l&&(l.firstKeyFrame=k,l.independent=k!==-1,l.firstKeyFramePTS=M)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(d=x1(s,r,this._initPTS,this._initDTS)),n.samples.length&&(h=y1(n,r,this._initPTS))),{audio:u,video:l,initSegment:f,independent:p,text:h,id3:d}}generateIS(e,t,s,n){const r=e.samples,o=t.samples,a=this.typeSupported,c={},l=this._initPTS;let u=!l||n,f="audio/mp4",h,d,p,m;if(u&&(h=d=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):U.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(m=e.id,p=e.inputTimeScale,!l||p!==l.timescale?h=d=r[0].pts-Math.round(p*s):u=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:U.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(m=t.id,p=t.inputTimeScale,!l||p!==l.timescale){const g=this.getVideoStartPts(o),y=Math.round(p*s);d=Math.min(d,pt(o[0].dts,g)-y),h=Math.min(h,g-y)}else u=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:h,timescale:p},this._initDTS={baseTime:d,timescale:p}):h=p=void 0,{tracks:c,initPTS:h,timescale:p,trackId:m}}remuxVideo(e,t,s,n){const r=e.inputTimeScale,o=e.samples,a=[],c=o.length,l=this._initPTS,u=l.baseTime*r/l.timescale;let f=this.nextVideoTs,h=8,d=this.videoSampleDuration,p,m,g=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,v=!1;if(!s||f===null){const C=u+t*r,D=o[0].pts-pt(o[0].dts,o[0].pts);ni&&f!==null&&Math.abs(C-D-(f+u))<15e3?s=!0:f=C-D-u}const x=f+u;for(let C=0;C<c;C++){const D=o[C];D.pts=pt(D.pts,x),D.dts=pt(D.dts,x),D.dts<o[C>0?C-1:C].dts&&(v=!0)}v&&o.sort(function(C,D){const P=C.dts-D.dts,w=C.pts-D.pts;return P||w}),p=o[0].dts,m=o[o.length-1].dts;const E=m-p,S=E?Math.round(E/(c-1)):d||e.inputTimeScale/30;if(s){const C=p-x,D=C>S,P=C<-1;if((D||P)&&(D?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Fi(C,!0)} ms (${C}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Fi(-C,!0)} ms (${C}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!P||x>=o[0].pts||ni)){p=x;const w=o[0].pts-C;if(D)o[0].dts=p,o[0].pts=w;else{let W=!0;for(let z=0;z<o.length&&!(o[z].dts>w&&W);z++){const ne=o[z].pts;if(o[z].dts-=C,o[z].pts-=C,z<o.length-1){const ee=o[z+1].pts,pe=o[z].pts,fe=ee<=pe,_e=ee<=ne;W=fe==_e}}}this.log(`Video: Initial PTS/DTS adjusted: ${Fi(w,!0)}/${Fi(p,!0)}, delta: ${Fi(C,!0)} ms`)}}p=Math.max(0,p);let T=0,_=0,I=p;for(let C=0;C<c;C++){const D=o[C],P=D.units,w=P.length;let W=0;for(let z=0;z<w;z++)W+=P[z].data.length;_+=W,T+=w,D.length=W,D.dts<I?(D.dts=I,I+=S/4|0||1):I=D.dts,g=Math.min(D.pts,g),y=Math.max(D.pts,y)}m=o[c-1].dts;const R=_+4*T+8;let b;try{b=new Uint8Array(R)}catch(C){this.observer.emit(A.ERROR,A.ERROR,{type:Z.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:C,bytes:R,reason:`fail allocating video mdat ${R}`});return}const L=new DataView(b.buffer);L.setUint32(0,R),b.set(U.types.mdat,4);let k=!1,M=Number.POSITIVE_INFINITY,N=Number.POSITIVE_INFINITY,F=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(let C=0;C<c;C++){const D=o[C],P=D.units;let w=0;for(let ne=0,ee=P.length;ne<ee;ne++){const pe=P[ne],fe=pe.data,_e=pe.data.byteLength;L.setUint32(h,_e),h+=4,b.set(fe,h),h+=_e,w+=4+_e}let W;if(C<c-1)d=o[C+1].dts-D.dts,W=o[C+1].pts-D.pts;else{const ne=this.config,ee=C>0?D.dts-o[C-1].dts:S;if(W=C>0?D.pts-o[C-1].pts:S,ne.stretchShortVideoTrack&&this.nextAudioTs!==null){const pe=Math.floor(ne.maxBufferHole*r),fe=(n?g+n*r:this.nextAudioTs+u)-D.pts;fe>pe?(d=fe-ee,d<0?d=ee:k=!0,this.log(`It is approximately ${fe/90} ms to the next segment; using duration ${d/90} ms for the last video frame.`)):d=ee}else d=ee}const z=Math.round(D.pts-D.dts);M=Math.min(M,d),F=Math.max(F,d),N=Math.min(N,W),O=Math.max(O,W),a.push(cf(D.key,d,w,z))}if(a.length){if(ni){if(ni<70){const C=a[0].flags;C.dependsOn=2,C.isNonSync=0}}else if(Io&&O-N<F-M&&S/F<.025&&a[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let C=p;for(let D=0,P=a.length;D<P;D++){const w=C+a[D].duration,W=C+a[D].cts;if(D<P-1){const z=w+a[D+1].cts;a[D].duration=z-W}else a[D].duration=D?a[D-1].duration:S;a[D].cts=0,C=w}}}d=k||!d?S:d;const K=m+d;this.nextVideoTs=f=K-u,this.videoSampleDuration=d,this.isVideoContiguous=!0;const H={data1:U.moof(e.sequenceNumber++,p,ge(e,{samples:a})),data2:b,startPTS:(g-u)/r,endPTS:(y+d-u)/r,startDTS:(p-u)/r,endDTS:f/r,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,H}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return r5;case"ac3":return o5;default:return n5}}remuxAudio(e,t,s,n,r){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,c=o/a,l=this.getSamplesPerFrame(e),u=l*c,f=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],p=r!==void 0;let m=e.samples,g=h?0:8,y=this.nextAudioTs||-1;const v=f.baseTime*o/f.timescale,x=v+t*o;if(this.isAudioContiguous=s=s||m.length&&y>0&&(n&&Math.abs(x-(y+v))<9e3||Math.abs(pt(m[0].pts,x)-(y+v))<20*u),m.forEach(function(O){O.pts=pt(O.pts,x)}),!s||y<0){if(m=m.filter(O=>O.pts>=0),!m.length)return;r===0?y=0:n&&!p?y=Math.max(0,x-v):y=m[0].pts-v}if(e.segmentCodec==="aac"){const O=this.config.maxAudioFramesDrift;for(let K=0,B=y+v;K<m.length;K++){const G=m[K],H=G.pts,C=H-B,D=Math.abs(1e3*C/o);if(C<=-O*u&&p)K===0&&(this.warn(`Audio frame @ ${(H/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*C/o)} ms.`),this.nextAudioTs=y=H-v,B=H);else if(C>=O*u&&D<i5&&p){let P=Math.round(C/u);for(B=H-P*u;B<0&&P&&u;)P--,B+=u;K===0&&(this.nextAudioTs=y=B-v),this.warn(`Injecting ${P} audio frames @ ${((B-v)/o).toFixed(3)}s due to ${Math.round(1e3*C/o)} ms gap.`);for(let w=0;w<P;w++){let W=e5.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);W||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),W=G.unit.subarray()),m.splice(K,0,{unit:W,pts:B}),B+=u,K++}}G.pts=B,B+=u}}let E=null,S=null,T,_=0,I=m.length;for(;I--;)_+=m[I].unit.byteLength;for(let O=0,K=m.length;O<K;O++){const B=m[O],G=B.unit;let H=B.pts;if(S!==null){const D=d[O-1];D.duration=Math.round((H-S)/c)}else if(s&&e.segmentCodec==="aac"&&(H=y+v),E=H,_>0){_+=g;try{T=new Uint8Array(_)}catch(D){this.observer.emit(A.ERROR,A.ERROR,{type:Z.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:D,bytes:_,reason:`fail allocating audio mdat ${_}`});return}h||(new DataView(T.buffer).setUint32(0,_),T.set(U.types.mdat,4))}else return;T.set(G,g);const C=G.byteLength;g+=C,d.push(cf(!0,l,C,0)),S=H}const R=d.length;if(!R)return;const b=d[d.length-1];y=S-v,this.nextAudioTs=y+c*b.duration;const L=h?new Uint8Array(0):U.moof(e.sequenceNumber++,E/c,ge({},e,{samples:d}));e.samples=[];const k=(E-v)/o,M=y/o,F={data1:L,data2:T,startPTS:k,endPTS:M,startDTS:k,endDTS:M,type:"audio",hasAudio:!0,hasVideo:!1,nb:R};return this.isAudioContiguous=!0,F}}function pt(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 a5(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function x1(i,e,t,s){const n=i.samples.length;if(!n)return;const r=i.inputTimeScale;for(let a=0;a<n;a++){const c=i.samples[a];c.pts=pt(c.pts-t.baseTime*r/t.timescale,e*r)/r,c.dts=pt(c.dts-s.baseTime*r/s.timescale,e*r)/r}const o=i.samples;return i.samples=[],{samples:o}}function y1(i,e,t){const s=i.samples.length;if(!s)return;const n=i.inputTimeScale;for(let o=0;o<s;o++){const a=i.samples[o];a.pts=pt(a.pts-t.baseTime*n/t.timescale,e*n)/n}i.samples.sort((o,a)=>o.pts-a.pts);const r=i.samples;return i.samples=[],{samples:r}}class l5 extends Ct{constructor(e,t,s,n){super("passthrough-remuxer",n),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,s,n){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(e6(e,n)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const n=this.initData=Rg(e);n.audio&&(t=uf(n.audio,ye.AUDIO,this)),n.video&&(s=uf(n.video,ye.VIDEO,this));const r={};n.audio&&n.video?r.audiovideo={container:"video/mp4",codec:t+","+s,supplemental:n.video.supplemental,initSegment:e,id:"main"}:n.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?r.video={container:"video/mp4",codec:s,supplemental:n.video.supplemental,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,s,n,r,o){var a,c;let{initPTS:l,lastEndTime:u}=this;const f={audio:void 0,video:void 0,text:n,id3:s,initSegment:void 0};j(u)||(u=this.lastEndTime=r||0);const h=t.samples;if(!(h!=null&&h.length))return f;const d={initPTS:void 0,timescale:void 0,trackId:void 0};let p=this.initData;if((a=p)!=null&&a.length||(this.generateInitSegment(h),p=this.initData),!((c=p)!=null&&c.length))return this.warn("Failed to generate initSegment."),f;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const m=s6(h,p,this),g=p.audio?m[p.audio.id]:null,y=p.video?m[p.video.id]:null,v=Gn(y,1/0),x=Gn(g,1/0),E=Gn(y,0,!0),S=Gn(g,0,!0);let T,_=r,I=0;if(g&&(!y||!l&&x<v||l&&l.trackId===p.audio.id)?(d.trackId=p.audio.id,T=g,I=S-x):y&&(d.trackId=p.video.id,T=y,I=E-v),T){const O=T.timescale;_=T.start/O,d.initPTS=T.start-r*O,d.timescale=O,l||(this.initPTS=l={baseTime:d.initPTS,timescale:O,trackId:d.trackId})}(o||!l)&&(c5(l,_,r,I)||d.timescale!==l.timescale)&&(d.initPTS=_-r,d.timescale=1,l&&l.timescale===1&&this.warn(`Adjusting initPTS @${r} from ${l.baseTime/l.timescale} to ${d.initPTS}`),this.initPTS=l={baseTime:d.initPTS,timescale:1});const R=e?_-l.baseTime/l.timescale:u,b=R+I;I>0?this.lastEndTime=b:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const L=!!p.audio,k=!!p.video;let M="";L&&(M+="audio"),k&&(M+="video");const N={data1:h,startPTS:R,startDTS:R,endPTS:b,endDTS:b,type:M,hasAudio:L,hasVideo:k,nb:1,dropped:0};f.audio=L&&!k?N:void 0,f.video=k?N:void 0;const F=y==null?void 0:y.sampleCount;if(F){const O=y.keyFrameIndex,K=O!==-1;N.nb=F,N.dropped=O===0||this.isVideoContiguous?0:K?O:F,N.independent=K,N.firstKeyFrame=O,K&&y.keyFrameStart&&(N.firstKeyFramePTS=(y.keyFrameStart-l.baseTime)/l.timescale),this.isVideoContiguous||(f.independent=K),this.isVideoContiguous||(this.isVideoContiguous=K),N.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${O}/${F} dropped: ${N.dropped} start: ${N.firstKeyFramePTS||"NA"}`)}return f.initSegment=d,f.id3=x1(s,r,l,l),n.samples.length&&(f.text=y1(n,r,l)),f}}function Gn(i,e,t=!1){return(i==null?void 0:i.start)!==void 0?(i.start+(t?i.duration:0))/i.timescale:e}function c5(i,e,t,s){if(i===null)return!0;const n=Math.max(s,1),r=e-i.baseTime/i.timescale;return Math.abs(r-t)>n}function uf(i,e,t){const s=i==null?void 0:i.codec;return s&&s.length>4?s:e===ye.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?Dr(s,!1):(t.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):(t.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let jt;try{jt=self.performance.now.bind(self.performance)}catch{jt=Date.now}const or=[{demux:YT,remux:l5},{demux:rs,remux:rr},{demux:qT,remux:rr},{demux:zT,remux:rr}];or.splice(2,0,{demux:WT,remux:rr});class ff{constructor(e,t,s,n,r,o){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=s,this.id=r,this.logger=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,n){const r=s.transmuxing;r.executeStart=jt();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:l,discontinuity:u,trackSwitch:f,accurateTimeOffset:h,timeOffset:d,initSegmentChange:p}=n||a,{audioCodec:m,videoCodec:g,defaultInitPts:y,duration:v,initSegmentData:x}=c,E=u5(o,t);if(E&&di(E.method)){const I=this.getDecrypter(),R=Fc(E.method);if(I.isSync()){let b=I.softwareDecrypt(o,E.key.buffer,E.iv.buffer,R);if(s.part>-1){const k=I.flush();b=k&&k.buffer}if(!b)return r.executeEnd=jt(),Co(s);o=new Uint8Array(b)}else return this.asyncResult=!0,this.decryptionPromise=I.webCryptoDecrypt(o,E.key.buffer,E.iv.buffer,R).then(b=>{const L=this.push(b,null,s);return this.decryptionPromise=null,L}),this.decryptionPromise}const S=this.needsProbing(u,f);if(S){const I=this.configureTransmuxer(o);if(I)return this.logger.warn(`[transmuxer] ${I.message}`),this.observer.emit(A.ERROR,A.ERROR,{type:Z.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:I,reason:I.message}),r.executeEnd=jt(),Co(s)}(u||f||p||S)&&this.resetInitSegment(x,m,g,v,t),(u||p||S)&&this.resetInitialTimestamp(y),l||this.resetContiguity();const T=this.transmux(o,E,d,h,s);this.asyncResult=fn(T);const _=this.currentTransmuxState;return _.contiguous=!0,_.discontinuity=!1,_.trackSwitch=!1,r.executeEnd=jt(),T}flush(e){const t=e.transmuxing;t.executeStart=jt();const{decrypter:s,currentTransmuxState:n,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(e));const o=[],{timeOffset:a}=n;if(s){const f=s.flush();f&&o.push(this.push(f.buffer,null,e))}const{demuxer:c,remuxer:l}=this;if(!c||!l){t.executeEnd=jt();const f=[Co(e)];return this.asyncResult?Promise.resolve(f):f}const u=c.flush(a);return fn(u)?(this.asyncResult=!0,u.then(f=>(this.flushRemux(o,f,e),o))):(this.flushRemux(o,u,e),this.asyncResult?Promise.resolve(o):o)}flushRemux(e,t,s){const{audioTrack:n,videoTrack:r,id3Track:o,textTrack:a}=t,{accurateTimeOffset:c,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===Y.MAIN?"level":"track"} ${s.level}`);const u=this.remuxer.remux(n,r,o,a,l,c,!0,this.id);e.push({remuxResult:u,chunkMeta:s}),s.transmuxing.executeEnd=jt()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,n,r){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,s,n),a.resetInitSegment(e,t,s,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,n,r){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,s,n,r):o=this.transmuxUnencrypted(e,s,n,r),o}transmuxUnencrypted(e,t,s,n){const{audioTrack:r,videoTrack:o,id3Track:a,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,o,a,c,t,s,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,s,n,r){return this.demuxer.demuxSampleAes(e,t,s).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,s,n,!1,this.id),chunkMeta:r}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:n}=this;let r;for(let f=0,h=or.length;f<h;f++){var o;if((o=or[f].demux)!=null&&o.probe(e,this.logger)){r=or[f];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,c=this.remuxer,l=r.remux,u=r.demux;(!c||!(c instanceof l))&&(this.remuxer=new l(s,t,n,this.logger)),(!a||!(a instanceof u))&&(this.demuxer=new u(s,t,n,this.logger),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new kc(this.config)),e}}function u5(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 Co=i=>({remuxResult:{},chunkMeta:i});function fn(i){return"then"in i&&i.then instanceof Function}class f5{constructor(e,t,s,n,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=s,this.duration=n,this.defaultInitPts=r||null}}class h5{constructor(e,t,s,n,r,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=s,this.trackSwitch=n,this.timeOffset=r,this.initSegmentChange=o}}let hf=0;class v1{constructor(e,t,s,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=hf++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const l=c.data,u=this.hls;if(!(!u||!(l!=null&&l.event)||l.instanceNo!==this.instanceNo))switch(l.event){case"init":{var f;const h=(f=this.workerContext)==null?void 0:f.objectURL;h&&self.URL.revokeObjectURL(h);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}case"workerLog":{u.logger[l.data.logType]&&u.logger[l.data.logType](l.data.message);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.part=this.part,l.data.id=this.id,u.trigger(l.event,l.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const l=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:l})};const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=s,this.onFlush=n;const o=(c,l)=>{l=l||{},l.frag=this.frag||void 0,c===A.ERROR&&(l=l,l.parent=this.id,l.part=this.part,this.error=l.error),this.hls.trigger(c,l)};this.observer=new Mc,this.observer.on(A.FRAG_DECRYPTED,o),this.observer.on(A.ERROR,o);const a=C0(r.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const c=this.hls.logger;if(r.workerPath||yT()){try{r.workerPath?(c.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=ET(r.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=vT());const{worker:u}=this.workerContext;u.addEventListener("message",this.onWorkerMessage),u.addEventListener("error",this.onWorkerError),u.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:a,id:t,config:Ee(r)})}catch(u){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new ff(this.observer,a,r,"",t,e.logger)}return}}this.transmuxer=new ff(this.observer,a,r,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=hf++;const t=this.hls.config,s=C0(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:s,id:this.id,config:Ee(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),AT(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,s,n,r,o,a,c,l,u){var f,h;l.transmuxing.start=self.performance.now();const{instanceNo:d,transmuxer:p}=this,m=o?o.start:r.start,g=r.decryptdata,y=this.frag,v=!(y&&r.cc===y.cc),x=!(y&&l.level===y.level),E=y?l.sn-y.sn:-1,S=this.part?l.part-this.part.index:-1,T=E===0&&l.id>1&&l.id===(y==null?void 0:y.stats.chunkCount),_=!x&&(E===1||E===0&&(S===1||T&&S<=0)),I=self.performance.now();(x||E||r.stats.parsing.start===0)&&(r.stats.parsing.start=I),o&&(S||!_)&&(o.stats.parsing.start=I);const R=!(y&&((f=r.initSegment)==null?void 0:f.url)===((h=y.initSegment)==null?void 0:h.url)),b=new h5(v,_,c,x,m,R);if(!_||v||R){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===Y.MAIN?"level":"track"}: ${l.level} id: ${l.id}
- discontinuity: ${v}
- trackSwitch: ${x}
- contiguous: ${_}
- accurateTimeOffset: ${c}
- timeOffset: ${m}
- initSegmentChange: ${R}`);const L=new f5(s,n,t,a,u);this.configureTransmuxer(L)}if(this.frag=r,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:d,cmd:"demux",data:e,decryptdata:g,chunkMeta:l,state:b},e instanceof ArrayBuffer?[e]:[]);else if(p){const L=p.push(e,g,l,b);fn(L)?L.then(k=>{this.handleTransmuxComplete(k)}).catch(k=>{this.transmuxerError(k,l,"transmuxer-interface push error")}):this.handleTransmuxComplete(L)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(s){const n=s.flush(e);fn(n)?n.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")}):this.handleFlushResult(n,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):s&&s.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const df=100;class d5 extends Oc{constructor(e,t,s){super(e,t,s,"audio-stream-controller",Y.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(A.LEVEL_LOADED,this.onLevelLoaded,this),e.on(A.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(A.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(A.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(A.BUFFER_RESET,this.onBufferReset,this),e.on(A.BUFFER_CREATED,this.onBufferCreated,this),e.on(A.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(A.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(A.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(A.FRAG_LOADING,this.onFragLoading,this),e.on(A.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(A.LEVEL_LOADED,this.onLevelLoaded,this),e.off(A.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(A.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(A.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(A.BUFFER_RESET,this.onBufferReset,this),e.off(A.BUFFER_CREATED,this.onBufferCreated,this),e.off(A.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(A.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(A.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(A.FRAG_LOADING,this.onFragLoading,this),e.off(A.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:s,initPTS:n,timescale:r}){if(s===Y.MAIN){const o=t.cc,a=this.fragCurrent;if(this.initPTS[o]={baseTime:n,timescale:r},this.log(`InitPTS for cc: ${o} found from main: ${n}/${r}`),this.mainAnchor=t,this.state===V.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==o)&&this.syncWithAnchor(t,c==null?void 0:c.frag)}else!this.hls.hasEnoughToStart&&a&&a.cc!==o?(a.abortRequests(),this.syncWithAnchor(t,a)):this.state===V.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var s;const n=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(t&&(n==null?void 0:n.cc)===t.cc)return;const r=(n||e).cc,o=this.getLevelDetails(),a=this.getLoadPosition(),c=Ug(o,r,a);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===V.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=V.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(df),s>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s,this.state=V.IDLE):this.state=V.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case V.IDLE:this.doTickIdle();break;case V.WAITING_TRACK:{const{levels:t,trackId:s}=this,n=t==null?void 0:t[s],r=n==null?void 0:n.details;if(r&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(r))break;this.state=V.WAITING_INIT_PTS}break}case V.FRAG_LOADING_WAITING_RETRY:{var e;const t=performance.now(),s=this.retryDate;if(!s||t>=s||(e=this.media)!=null&&e.seeking){const{levels:n,trackId:r}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[r])||null),this.state=V.IDLE}break}case V.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:s,part:n,cache:r,complete:o}=t,a=this.mainAnchor;if(this.initPTS[s.cc]!==void 0){this.waitingData=null,this.state=V.FRAG_LOADING;const c=r.flush().buffer,l={frag:s,part:n,payload:c,networkDetails:null};this._handleFragmentLoadProgress(l),o&&super._handleFragmentLoadComplete(l)}else a&&a.cc!==t.frag.cc&&this.syncWithAnchor(a,t.frag)}else this.state=V.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:s,media:n,trackId:r}=this,o=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!o.startFragPrefetch)||!(s!=null&&s[r]))return;const a=s[r],c=a.details;if(!c||this.waitForLive(a)||this.waitForCdnTuneIn(c)){this.state=V.WAITING_TRACK,this.startFragRequested=!1;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,ye.AUDIO,Y.AUDIO));const u=this.getFwdBufferInfo(l,Y.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,c)){t.trigger(A.BUFFER_EOS,{type:"audio"}),this.state=V.ENDED;return}const f=u.len,h=t.maxBufferLength,d=c.fragments,p=d[0].start,m=this.getLoadPosition(),g=this.flushing?m:u.end;if(this.switchingTrack&&n){const x=m;c.PTSKnown&&x<p&&(u.end>p||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=p+.05)}if(f>=h&&!this.switchingTrack&&g<d[d.length-1].start)return;let y=this.getNextFragment(g,c);if(y&&this.isLoopLoading(y,g)&&(y=this.getNextFragmentLoopLoading(y,c,u,Y.MAIN,h)),!y){this.bufferFlushed=!0;return}let v=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&v&&De(y)&&!y.endList&&(!c.live||!this.loadingParts&&g<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(v)===ke.OK&&(this.mainFragLoading=v=null),v&&De(v))){if(y.start>v.end){const E=this.fragmentTracker.getFragAtPos(g,Y.MAIN);E&&E.end>v.end&&(v=E,this.mainFragLoading={frag:E,targetBufferTime:null})}if(y.start>v.end)return}this.loadFragment(y,a,g)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new an(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),s?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==V.STOPPED&&(this.setInterval(df),this.state=V.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(A.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(e,t){var s;const{levels:n}=this,{details:r,id:o,groupId:a,track:c}=t;if(!n){this.warn(`Audio tracks reset while loading track ${o} "${c.name}" of "${a}"`);return}const l=this.mainDetails;if(!l||r.endCC>l.endCC||l.expired){this.cachedTrackLoadedData=t,this.state!==V.STOPPED&&(this.state=V.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${o} "${c.name}" of "${a}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const u=n[o];let f=0;if(r.live||(s=u.details)!=null&&s.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;if(u.details){var h;f=this.alignPlaylists(r,u.details,(h=this.levelLastLoaded)==null?void 0:h.details)}r.alignedSliding||(Zg(r,l),r.alignedSliding||Fr(r,l),f=r.fragmentStart)}u.details=r,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(l,f),this.hls.trigger(A.AUDIO_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.state===V.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=V.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const s=e.frag,{part:n,payload:r}=e,{config:o,trackId:a,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const l=c[a];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const u=l.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const f=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new v1(this.hls,Y.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[s.cc],p=(t=s.initSegment)==null?void 0:t.data;if(d!==void 0){const g=n?n.index:-1,y=g!==-1,v=new Bc(s.level,s.sn,s.stats.chunkCount,r.byteLength,g,y);h.push(r,p,f,"",s,n,u.totalduration,!1,v,d)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${u.startSN} ,${u.endSN}],track ${a}`);const{cache:m}=this.waitingData=this.waitingData||{frag:s,part:n,cache:new e1,complete:!1};m.push(new Uint8Array(r)),this.state!==V.STOPPED&&(this.state=V.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===Y.MAIN&&De(t.frag)&&(this.mainFragLoading=t,this.state===V.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:s,part:n}=t;if(s.type!==Y.AUDIO){!this.audioOnly&&s.type===Y.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${n?" p: "+n.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(De(s)){this.fragPrevious=s;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(A.AUDIO_TRACK_SWITCHED,xe({},r)))}this.fragBufferedComplete(s,n),this.media&&this.tick()}onError(e,t){var s;if(t.fatal){this.state=V.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Y.AUDIO,t);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===ce.AUDIO_TRACK&&(this.state=V.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==ye.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==ye.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===V.ENDED&&(this.state=V.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,Y.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const s="audio",{hls:n}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:c,part:l,level:u}=a,{details:f}=u,{audio:h,text:d,id3:p,initSegment:m}=r;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=V.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),m!=null&&m.tracks){const g=c.initSegment||c;this._bufferInitSegment(u,m.tracks,g,o),n.trigger(A.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:s,tracks:m.tracks})}if(h){const{startPTS:g,endPTS:y,startDTS:v,endDTS:x}=h;l&&(l.elementaryStreams[ye.AUDIO]={startPTS:g,endPTS:y,startDTS:v,endDTS:x}),c.setElementaryStreamInfo(ye.AUDIO,g,y,v,x),this.bufferFragmentData(h,c,l,o)}if(p!=null&&(t=p.samples)!=null&&t.length){const g=ge({id:s,frag:c,details:f},p);n.trigger(A.FRAG_PARSING_METADATA,g)}if(d){const g=ge({id:s,frag:c,details:f},d);n.trigger(A.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,s,n){if(this.state!==V.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const r=t.audio;r.id=Y.AUDIO;const o=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${o}/${r.codec}]`),o&&o.split(",").length===1&&(r.levelCodec=o),this.hls.trigger(A.BUFFER_CODECS,t);const a=r.initSegment;if(a!=null&&a.byteLength){const c={type:"audio",frag:s,part:null,chunkMeta:n,parent:s.type,data:a};this.hls.trigger(A.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,s){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===ke.NOT_LOADED||n===ke.PARTIAL){var r;if(!De(e))this._loadInitSegment(e,t);else if((r=t.details)!=null&&r.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=V.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragmentStart!==t.details.fragmentStart&&Fr(t.details,o)}else super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:s,assocLang:n,characteristics:r,audioCodec:o,channels:a}=this.bufferedTrack;Fs({name:t,lang:s,assocLang:n,characteristics:r,audioCodec:o,channels:a},e,_s)||(wr(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(A.AUDIO_TRACK_SWITCHED,xe({},e))}}class Vc extends Ct{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const n=t==null?void 0:t.renditionReports;if(n){let r=-1;for(let o=0;o<n.length;o++){const a=n[o];let c;try{c=new self.URL(a.URI,t.url).href}catch(l){this.warn(`Could not construct new URL for Rendition Report: ${l}`),c=a.URI||""}if(c===e){r=o;break}else c===e.substring(0,c.length)&&(r=o)}if(r!==-1){const o=n[r],a=parseInt(o["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let c=parseInt(o["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const u=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&u>t.partTarget&&(c+=1)}const l=s&&L0(s);return new D0(a,c>=0?c:void 0,l)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return e}playlistLoaded(e,t,s){const{details:n,stats:r}=t,o=self.performance.now(),a=r.loading.first?Math.max(0,o-r.loading.first):0;n.advancedDateTime=Date.now()-a;const c=this.hls.config.timelineOffset;if(c!==n.appliedTimelineOffset){const u=Math.max(c||0,0);n.appliedTimelineOffset=u,n.fragments.forEach(f=>{f.start=f.playlistOffset+u})}if(n.live||s!=null&&s.live){const u="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(s),s&&n.fragments.length>0){lT(s,n);const v=n.playlistParsingError;if(v){this.warn(v);const x=this.hls;if(!x.config.ignorePlaylistParsingErrors){var l;const{networkDetails:E}=t;x.trigger(A.ERROR,{type:Z.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:v,reason:v.message,level:t.level||void 0,parent:(l=n.fragments[0])==null?void 0:l.type,networkDetails:E,stats:r});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=r.loading.start);const f=this.hls.mainForwardBufferInfo,h=f?f.end-f.len:0,d=(n.edge-h)*1e3,p=zg(n,d);if(n.requestScheduled+p<o?n.requestScheduled=o:n.requestScheduled+=p,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let m,g,y;if(n.canBlockReload&&n.endSN&&n.advanced){const v=this.hls.config.lowLatencyMode,x=n.lastPartSn,E=n.endSN,S=n.lastPartIndex,T=S!==-1,_=x===E;T?_?(g=E+1,y=v?0:S):(g=x,y=v?S+1:n.maxPartIndex):g=E+1;const I=n.age,R=I+n.ageHeader;let b=Math.min(R-n.partTarget,n.targetduration*1.5);if(b>0){if(R>n.targetduration*3)this.log(`Playlist last advanced ${I.toFixed(2)}s ago. Omitting segment and part directives.`),g=void 0,y=void 0;else if(s!=null&&s.tuneInGoal&&R-n.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${b} with playlist age: ${n.age}`),b=0;else{const L=Math.floor(b/n.targetduration);if(g+=L,y!==void 0){const k=Math.round(b%n.targetduration/n.partTarget);y+=k}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${I.toFixed(2)}s goal: ${b} skip sn ${L} to part ${y}`)}n.tuneInGoal=b}if(m=this.getDeliveryDirectives(n,t.deliveryDirectives,g,y),v||!_){n.requestScheduled=o,this.loadingPlaylist(u,m);return}}else(n.canBlockReload||n.canSkipUntil)&&(m=this.getDeliveryDirectives(n,t.deliveryDirectives,g,y));m&&g!==void 0&&n.canBlockReload&&(n.requestScheduled=r.loading.first+Math.max(p-a*2,p/2)),this.scheduleLoading(u,m,n)}else this.clearTimer()}scheduleLoading(e,t,s){const n=s||e.details;if(!n){this.loadingPlaylist(e,t);return}const r=self.performance.now(),o=n.requestScheduled;if(r>=o){this.loadingPlaylist(e,t);return}const a=o-r;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(a)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),a)}getDeliveryDirectives(e,t,s,n){let r=L0(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,n=t.part,r=ir.No),new D0(s,n,r)}checkRetry(e){const t=e.details,s=Pr(e),n=e.errorAction,{action:r,retryCount:o=0,retryConfig:a}=n||{},c=!!n&&!!a&&(r===We.RetryRequest||!n.resolved&&r===We.SendAlternateToPenaltyBox);if(c){var l;if(o>=a.maxNumRetry)return!1;if(s&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const u=Pc(a,o);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${u}ms`)}e.levelRetry=!0,n.resolved=!0}return c}}function E1(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!hn(i[t].attrs,e[t].attrs))return!1;return!0}function hn(i,e,t){const s=i["STABLE-RENDITION-ID"];return s&&!t?s===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(n=>i[n]!==e[n])}function Rl(i,e){return e.label.toLowerCase()===i.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(i.lang||"").toLowerCase())}class p5 extends Vc{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(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.MANIFEST_PARSED,this.onManifestParsed,this),e.on(A.LEVEL_LOADING,this.onLevelLoading,this),e.on(A.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(A.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(A.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.MANIFEST_PARSED,this.onManifestParsed,this),e.off(A.LEVEL_LOADING,this.onLevelLoading,this),e.off(A.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(A.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(A.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:s,groupId:n,details:r}=t,o=this.tracksInGroup[s];if(!o||o.groupId!==n){this.warn(`Audio track with id:${s} and group:${n} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${s} "${o.name}" lang:${o.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.audioGroups||null,n=this.groupIds;let r=this.currentTrack;if(!s||(n==null?void 0:n.length)!==(s==null?void 0:s.length)||s!=null&&s.some(a=>(n==null?void 0:n.indexOf(a))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!s||s.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(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const c=this.hls.config.audioPreference;if(!r&&c){const h=Bt(c,a,_s);if(h>-1)r=a[h];else{const d=Bt(c,this.tracks);r=this.tracks[d]}}let l=this.findTrackId(r);l===-1&&r&&(l=this.findTrackId(null));const u={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${s==null?void 0:s.join(",")}`),this.hls.trigger(A.AUDIO_TRACKS_UPDATED,u);const f=this.trackId;if(l!==-1&&f===-1)this.setAudioTrack(l);else if(a.length&&f===-1){var o;const h=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${a.length}`);this.warn(h.message),this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}}onError(e,t){t.fatal||!t.context||t.context.type===ce.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const n=this.currentTrack;if(n&&Fs(e,n,_s))return n;const r=Bt(e,this.tracksInGroup,_s);if(r>-1){const o=this.tracksInGroup[r];return this.setAudioTrack(r),o}else if(n){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=C6(e,t.levels,s,o,_s);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=Bt(e,s);if(o>-1)return s[o]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,n=t[e],r=n.details&&!n.details.live;if(e===this.trackId&&n===s&&r||(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger(A.AUDIO_TRACK_SWITCHING,xe({},n)),r))return;const o=this.switchParams(n.url,s==null?void 0:s.details,n.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const n=t[s];if(!(this.selectDefaultTrack&&!n.default)&&(!e||Fs(e,n,_s)))return s}if(e){const{name:s,lang:n,assocLang:r,characteristics:o,audioCodec:a,channels:c}=e;for(let l=0;l<t.length;l++){const u=t[l];if(Fs({name:s,lang:n,assocLang:r,characteristics:o,audioCodec:a,channels:c},u,_s))return l}for(let l=0;l<t.length;l++){const u=t[l];if(hn(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const u=t[l];if(hn(e.attrs,u.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&wr(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,n=e.groupId,r=this.getUrlWithDirectives(e.url,t),o=e.details,a=o==null?void 0:o.age;this.log(`Loading audio-track ${s} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${a&&o.live?" age "+a.toFixed(1)+(o.type&&" "+o.type||""):""} ${r}`),this.hls.trigger(A.AUDIO_TRACK_LOADING,{url:r,id:s,groupId:n,deliveryDirectives:t||null,track:e})}}class g5{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,s){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];n.push(e),n.length===1&&!s&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const s={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const s={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const s=(t=e[0])==null?void 0:t.label;(s==="async-blocker"||s==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(r){var s;if(n.onError(r),this.queues===null||this.tracks===null)return;const o=(s=this.tracks[e])==null?void 0:s.buffer;o!=null&&o.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
- ${this.list("video")}
- ${this.list("audio")}
- ${this.list("audiovideo")}}`}list(e){var t,s;return(t=this.queues)!=null&&t[e]||(s=this.tracks)!=null&&s[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const s=(t=this.tracks)==null?void 0:t[e],n=s==null?void 0:s.buffer;return n?`SourceBuffer${n.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(s=>s.label).join(", "))||""}}const pf=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,A1="HlsJsTrackRemovedError";class m5 extends Error{constructor(e){super(e),this.name=A1}}class x5 extends Ct{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=s=>{var n;this.hls&&((n=this.mediaSource)==null?void 0:n.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{const{media:n,mediaSource:r}=this;s&&this.log("Media source opened"),!(!n||!r)&&(r.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(A.MEDIA_ATTACHED,{media:n,mediaSource:r}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:n}=this;s!==n&&this.error(`Media element src was set while attaching MediaSource (${n} > ${s})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=VS(vs(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.MANIFEST_PARSED,this.onManifestParsed,this),e.on(A.BUFFER_RESET,this.onBufferReset,this),e.on(A.BUFFER_APPENDING,this.onBufferAppending,this),e.on(A.BUFFER_CODECS,this.onBufferCodecs,this),e.on(A.BUFFER_EOS,this.onBufferEos,this),e.on(A.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(A.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(A.FRAG_PARSED,this.onFragParsed,this),e.on(A.FRAG_CHANGED,this.onFragChanged,this),e.on(A.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.MANIFEST_PARSED,this.onManifestParsed,this),e.off(A.BUFFER_RESET,this.onBufferReset,this),e.off(A.BUFFER_APPENDING,this.onBufferAppending,this),e.off(A.BUFFER_CODECS,this.onBufferCodecs,this),e.off(A.BUFFER_EOS,this.onBufferEos,this),e.off(A.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(A.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(A.FRAG_PARSED,this.onFragParsed,this),e.off(A.FRAG_CHANGED,this.onFragChanged,this),e.off(A.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const s={};if(this.operationQueue){const r=this.isUpdating();r||this.operationQueue.removeBlockers();const o=this.isQueued();(r||o)&&this.warn(`Transfering MediaSource with${o?" operations in queue":""}${r?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?ge(s,n.tracks):this.sourceBuffers.forEach(r=>{const[o]=r;o&&(s[o]=ge({},this.tracks[o]),this.removeBuffer(o)),r[0]=r[1]=null}),{media:e,mediaSource:t,tracks:s}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var s;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const s=this.media=t.media,n=vs(this.appendSource);if(this.transferData=this.overrides=void 0,s&&n){const r=!!t.mediaSource;(r||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const o=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(o),r)this._objectUrl=s.src,this.attachTransferred();else{const a=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{s.removeAttribute("src");const c=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||c&&o instanceof c,gf(s),y5(s,a),s.load()}catch{s.src=a}else s.src=a}s.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,s;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(s=e.constructor)==null?void 0:s.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const s=this.tracks,n=t.tracks,r=n?Object.keys(n):null,o=r?r.length:0,a=()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()};if(n&&r&&o){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
- required tracks: ${Ee(s,(c,l)=>c==="initSegment"?void 0:l)};
- transfer tracks: ${Ee(n,(c,l)=>c==="initSegment"?void 0:l)}}`),!Tg(n,s)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,l=this.details,u=Math.max(c,(l==null?void 0:l.fragments[0].start)||0);if(u-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(s)}") start time: ${u} currentTime: ${c}`),this.onMediaDetaching(A.MEDIA_DETACHING,{}),this.onMediaAttaching(A.MEDIA_ATTACHING,t),e.currentTime=u;return}this.transferData=void 0,r.forEach(c=>{const l=c,u=n[l];if(u){const f=u.buffer;if(f){const h=this.fragmentTracker,d=u.id;if(h.hasFragments(d)||h.hasParts(d)){const g=re.getBuffered(f);h.detectEvictedFragments(l,g,d,null,!0)}const p=Lo(l),m=[l,f];this.sourceBuffers[p]=m,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(l),this.trackSourceBuffer(l,u)}}}),a(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),a()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const s=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:r,_objectUrl:o}=this;if(r){if(this.log(`media source ${s?"transferring":"detaching"}`),s)this.sourceBuffers.forEach(([a])=>{a&&this.removeBuffer(a)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const a=r.readyState==="open";try{const c=r.sourceBuffers;for(let l=c.length;l--;)a&&c[l].abort(),r.removeSourceBuffer(c[l]);a&&r.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),s||(o&&self.URL.revokeObjectURL(o),this.mediaSrc===o?(n.removeAttribute("src"),this.appendSource&&gf(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(A.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const s=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),s)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s)}catch(r){this.warn(`onBufferReset ${e}`,r)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Lo(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new g5(this.tracks)}onBufferCodecs(e,t){const s=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const r="audiovideo"in t&&(s.audio||s.video)||s.audiovideo&&("audio"in t||"video"in t),o=!r&&this.sourceBufferCount&&this.media&&n.some(a=>!s[a]);if(r||o){this.warn(`Unsupported transition between "${Object.keys(s)}" and "${n}" SourceBuffers`);return}n.forEach(a=>{var c,l,u;const f=t[a],{id:h,codec:d,levelCodec:p,container:m,metadata:g,supplemental:y}=f;let v=s[a];const x=(c=this.transferData)==null||(l=c.tracks)==null?void 0:l[a],E=x!=null&&x.buffer?x:v,S=(E==null?void 0:E.pendingCodec)||(E==null?void 0:E.codec),T=E==null?void 0:E.levelCodec;v||(v=s[a]={buffer:void 0,listeners:[],codec:d,supplemental:y,container:m,levelCodec:p,metadata:g,id:h});const _=sr(S,T),I=_==null?void 0:_.replace(pf,"$1");let R=sr(d,p);const b=(u=R)==null?void 0:u.replace(pf,"$1");R&&_&&I!==b&&(a.slice(0,5)==="audio"&&(R=Dr(R,this.appendSource)),this.log(`switching codec ${S} to ${R}`),R!==(v.pendingCodec||v.codec)&&(v.pendingCodec=R),v.container=m,this.appendChangeType(a,m,R))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const s=this.tracks[t];return e[t]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},e},{})}appendChangeType(e,t,s){const n=`${t};codecs=${s}`,r={label:`change-type=${n}`,execute:()=>{const o=this.tracks[e];if(o){const a=o.buffer;a!=null&&a.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),a.changeType(n),o.codec=s,o.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Failed to change ${e} SourceBuffer type`,o)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const s=e.start,n=s+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(s,Y.MAIN))==null?void 0:t.gap)===!0)return;const o={label:"block-audio",execute:()=>{var a;const c=this.tracks.video;(this.lastVideoAppendEnd>n||c!=null&&c.buffer&&re.isBuffered(c.buffer,n)||((a=this.fragmentTracker.getAppendedFrag(n,Y.MAIN))==null?void 0:a.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn("Error executing block-audio operation",a)}};this.blockedAudioAppend={op:o,frag:e},this.append(o,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:s}=this,{data:n,type:r,parent:o,frag:a,part:c,chunkMeta:l,offset:u}=t,f=l.buffering[r],{sn:h,cc:d}=a,p=self.performance.now();f.start=p;const m=a.stats.buffering,g=c?c.stats.buffering:null;m.start===0&&(m.start=p),g&&g.start===0&&(g.start=p);const y=s.audio;let v=!1;r==="audio"&&(y==null?void 0:y.container)==="audio/mpeg"&&(v=!this.lastMpegAudioChunk||l.id===1||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);const x=s.video,E=x==null?void 0:x.buffer;if(E&&h!=="initSegment"){const _=c||a,I=this.blockedAudioAppend;if(r==="audio"&&o!=="main"&&!this.blockedAudioAppend){const b=_.start+_.duration*.05,L=E.buffered,k=this.currentOp("video");!L.length&&!k?this.blockAudio(_):!k&&!re.isBuffered(E,b)&&this.lastVideoAppendEnd<b&&this.blockAudio(_)}else if(r==="video"){const R=_.end;if(I){const b=I.frag.start;(R>b||R<this.lastVideoAppendEnd||re.isBuffered(E,b))&&this.unblockAudio()}this.lastVideoAppendEnd=R}}const S=(c||a).start,T={label:`append-${r}`,execute:()=>{var _;f.executeStart=self.performance.now();const I=(_=this.tracks[r])==null?void 0:_.buffer;I&&(v?this.updateTimestampOffset(I,S,.1,r,h,d):u!==void 0&&j(u)&&this.updateTimestampOffset(I,u,1e-6,r,h,d)),this.appendExecutor(n,r)},onStart:()=>{},onComplete:()=>{const _=self.performance.now();f.executeEnd=f.end=_,m.first===0&&(m.first=_),g&&g.first===0&&(g.first=_);const I={};this.sourceBuffers.forEach(([R,b])=>{R&&(I[R]=re.getBuffered(b))}),this.appendErrors[r]=0,r==="audio"||r==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(A.BUFFER_APPENDED,{type:r,frag:a,part:c,chunkMeta:l,parent:a.type,timeRanges:I})},onError:_=>{var I;const R={type:Z.MEDIA_ERROR,parent:a.type,details:$.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:a,part:c,chunkMeta:l,error:_,err:_,fatal:!1},b=(I=this.media)==null?void 0:I.error;if(_.code===DOMException.QUOTA_EXCEEDED_ERR||_.name=="QuotaExceededError"||"quota"in _)R.details=$.BUFFER_FULL_ERROR;else if(_.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!b)R.errorAction=ln(!0);else if(_.name===A1&&this.sourceBufferCount===0)R.errorAction=ln(!0);else{const L=++this.appendErrors[r];this.warn(`Failed ${L}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${b||"no media error"})`),(L>=this.hls.config.appendErrorMaxRetry||b)&&(R.fatal=!0)}this.hls.trigger(A.ERROR,R)}};this.append(T,r,this.isPending(this.tracks[r]))}getFlushOp(e,t,s){return this.log(`queuing "${e}" remove ${t}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,s)},onStart:()=>{},onComplete:()=>{this.hls.trigger(A.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${s} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:s,startOffset:n,endOffset:r}=t;s?this.append(this.getFlushOp(s,n,r),s):this.sourceBuffers.forEach(([o])=>{o&&this.append(this.getFlushOp(o,n,r),o)})}onFragParsed(e,t){const{frag:s,part:n}=t,r=[],o=n?n.elementaryStreams:s.elementaryStreams;o[ye.AUDIOVIDEO]?r.push("audiovideo"):(o[ye.AUDIO]&&r.push("audio"),o[ye.VIDEO]&&r.push("video"));const a=()=>{const c=self.performance.now();s.stats.buffering.end=c,n&&(n.stats.buffering.end=c);const l=n?n.stats:s.stats;this.hls.trigger(A.FRAG_BUFFERED,{frag:s,part:n,stats:l,id:s.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(a,r).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t,s;return e&&(!((t=this.tracks[e])!=null&&t.ended)||((s=this.tracks[e])==null?void 0:s.ending))})}onBufferEos(e,t){var s;this.sourceBuffers.forEach(([o])=>{if(o){const a=this.tracks[o];(!t.type||t.type===o)&&(a.ending=!0,a.ended||(a.ended=!0,this.log(`${o} buffer reached EOS`)))}});const n=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([o])=>{var a;return o&&!((a=this.tracks[o])!=null&&a.ended)})&&(n?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:o}=this;if(!o||o.readyState!=="open"){o&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${o.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),o.endOfStream(),this.hls.trigger(A.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(A.BUFFERED_TO_END,void 0)))}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===$.BUFFER_APPEND_ERROR&&t.frag){var s;const n=(s=t.errorAction)==null?void 0:s.nextAutoLevel;j(n)&&n!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.sourceBufferCount)return;const n=e.config,r=s.currentTime,o=t.levelTargetDuration,a=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(j(a)&&a>=0){const c=Math.max(a,o),l=Math.floor(r/o)*o-c;this.flushBackBuffer(r,o,l)}if(j(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const c=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),l=Math.max(c,o),u=Math.floor(r/o)*o+l;this.flushFrontBuffer(r,o,u)}}flushBackBuffer(e,t,s){this.sourceBuffers.forEach(([n,r])=>{if(r){const a=re.getBuffered(r);if(a.length>0&&s>a.start(0)){var o;this.hls.trigger(A.BACK_BUFFER_REACHED,{bufferEnd:s});const c=this.tracks[n];if((o=this.details)!=null&&o.live)this.hls.trigger(A.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(c!=null&&c.ended){this.log(`Cannot flush ${n} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(A.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:n})}}})}flushFrontBuffer(e,t,s){this.sourceBuffers.forEach(([n,r])=>{if(r){const o=re.getBuffered(r),a=o.length;if(a<2)return;const c=o.start(a-1),l=o.end(a-1);if(s>c||e>=c&&e<=l)return;this.hls.trigger(A.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:n})}})}getDurationAndRange(){var e;const{details:t,mediaSource:s}=this;if(!t||!this.media||(s==null?void 0:s.readyState)!=="open")return null;const n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&t.live&&s.setLiveSeekableRange){const l=Math.max(0,t.fragmentStart),u=Math.max(l,n);return{duration:1/0,start:l,end:u}}return{duration:1/0}}const r=(e=this.overrides)==null?void 0:e.duration;if(r)return j(r)?{duration:r}:null;const o=this.media.duration,a=j(s.duration)?s.duration:0;return n>a&&n>o||!j(o)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:s}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(j(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),n.duration=e),t!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${n.duration}. Setting seekable range to ${t}-${s}.`),n.setLiveSeekableRange(t,s)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Ee(s)}`),this.tracksReady){var n;const r=(n=this.transferData)==null?void 0:n.tracks;r&&Object.keys(r).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,s])=>{if(t){const n=this.tracks[t];e[t]={buffer:s,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger(A.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:s}=this;if(!s)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in e){const o=r,a=e[o];if(this.isPending(a)){const c=this.getTrackCodec(a,o),l=`${a.container};codecs=${c}`;a.codec=c,this.log(`creating sourceBuffer(${l})${this.currentOp(o)?" Queued":""} ${Ee(a)}`);try{const u=s.addSourceBuffer(l),f=Lo(o),h=[o,u];t[f]=h,a.buffer=u}catch(u){var n;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(o),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[o],this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:o,mimeType:l,parent:a.id});return}this.trackSourceBuffer(o,a)}}this.bufferCreated()}getTrackCodec(e,t){const s=e.supplemental;let n=e.codec;s&&(t==="video"||t==="audiovideo")&&El(s,"video")&&(n=u6(n,s));const r=sr(n,e.levelCodec);return r?t.slice(0,5)==="audio"?Dr(r,this.appendSource):r:""}trackSourceBuffer(e,t){const s=t.buffer;if(!s)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:s,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(r,o)=>{const a=o.removedRanges;a!=null&&a.length&&this.hls.trigger(A.BUFFER_FLUSHED,{type:r})})}get mediaSrc(){var e,t;const s=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return s==null?void 0:s.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const s=this.currentOp(e);s&&(s.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var s;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${n}`,t),this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const r=this.currentOp(e);r&&r.onError(n)}updateTimestampOffset(e,t,s,n,r,o){const a=t-e.timestampOffset;Math.abs(a)>=s&&(this.log(`Updating ${n} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${o})`),e.timestampOffset=t)}removeExecutor(e,t,s){const{media:n,mediaSource:r}=this,o=this.tracks[e],a=o==null?void 0:o.buffer;if(!n||!r||!a){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=j(n.duration)?n.duration:1/0,l=j(r.duration)?r.duration:1/0,u=Math.max(0,t),f=Math.min(s,c,l);f>u&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${u},${f}] from the ${e} SourceBuffer`),a.remove(u,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.tracks[t],n=s==null?void 0:s.buffer;if(!n)throw new m5(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);s.ending=!1,s.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:s}=this,n=t.map(o=>this.appendBlocker(o));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(o=>{s===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var s;const n=(s=this.tracks[t])==null?void 0:s.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,s){this.operationQueue&&this.operationQueue.append(e,t,s)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,s){const n=this.tracks[e];if(!n)return;const r=n.buffer;if(!r)return;const o=s.bind(this,e);n.listeners.push({event:t,listener:o}),r.addEventListener(t,o)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const s=t.buffer;s&&(t.listeners.forEach(n=>{s.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function gf(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function y5(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}function Lo(i){return i==="audio"?1:0}class jc{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(A.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(A.MANIFEST_PARSED,this.onManifestParsed,this),e.on(A.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(A.BUFFER_CODECS,this.onBufferCodecs,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(A.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(A.MANIFEST_PARSED,this.onManifestParsed,this),e.off(A.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(A.BUFFER_CODECS,this.onBufferCodecs,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&j(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=s,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const s=t.filter((n,r)=>this.isLevelAllowed(n)&&r<=e);return this.clientRect=null,jc.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;const n=(a,c)=>c?a.width!==c.width||a.height!==c.height:!0;let r=e.length-1;const o=Math.max(t,s);for(let a=0;a<e.length;a+=1){const c=e[a];if((c.width>=o||c.height>=o)&&n(c,e[a+1])){r=a;break}}return r}}const v5={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},et=v5,E5={HLS:"h"},A5=E5,S5="CMCD-Object",T5="CMCD-Request",b5="CMCD-Session",_5="CMCD-Status",Hi={OBJECT:S5,REQUEST:T5,SESSION:b5,STATUS:_5},I5={[Hi.OBJECT]:["br","ab","d","ot","tb","tpb","lb","tab","lab","url"],[Hi.REQUEST]:["pb","bl","tbl","dl","ltc","mtp","nor","nrr","rc","sn","sta","su","ttfb","ttfbb","ttlb","cmsdd","cmsds","smrt","df","cs"],[Hi.SESSION]:["cid","pr","sf","sid","st","v","msd"],[Hi.STATUS]:["bs","bsd","cdn","rtp","bg","pt","ec","e"]};class Si{constructor(e,t){Array.isArray(e)&&(e=e.map(s=>s instanceof Si?s:new Si(s))),this.value=e,this.params=t}}const C5="Dict";function L5(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 D5(i,e,t,s){return new Error(`failed to ${i} "${L5(e)}" as ${t}`,{cause:s})}function Ut(i,e,t){return D5("serialize",i,e,t)}class S1{constructor(e){this.description=e}}const mf="Bare Item",R5="Boolean";function w5(i){if(typeof i!="boolean")throw Ut(i,R5);return i?"?1":"?0"}function P5(i){return btoa(String.fromCharCode(...i))}const k5="Byte Sequence";function B5(i){if(ArrayBuffer.isView(i)===!1)throw Ut(i,k5);return`:${P5(i)}:`}const F5="Integer";function O5(i){return i<-999999999999999||999999999999999<i}function T1(i){if(O5(i))throw Ut(i,F5);return i.toString()}function M5(i){return`@${T1(i.getTime()/1e3)}`}function b1(i,e){if(i<0)return-b1(-i,e);const t=Math.pow(10,e);if(Math.abs(i*t%1-.5)<Number.EPSILON){const n=Math.floor(i*t);return(n%2===0?n:n+1)/t}else return Math.round(i*t)/t}const N5="Decimal";function U5(i){const e=b1(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ut(i,N5);const t=e.toString();return t.includes(".")?t:`${t}.0`}const $5="String",H5=/[\x00-\x1f\x7f]+/;function G5(i){if(H5.test(i))throw Ut(i,$5);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function K5(i){return i.description||i.toString().slice(7,-1)}const V5="Token";function xf(i){const e=K5(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ut(e,V5);return e}function wl(i){switch(typeof i){case"number":if(!j(i))throw Ut(i,mf);return Number.isInteger(i)?T1(i):U5(i);case"string":return G5(i);case"symbol":return xf(i);case"boolean":return w5(i);case"object":if(i instanceof Date)return M5(i);if(i instanceof Uint8Array)return B5(i);if(i instanceof S1)return xf(i);default:throw Ut(i,mf)}}const j5="Key";function Pl(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw Ut(i,j5);return i}function qc(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${Pl(e)}`:`;${Pl(e)}=${wl(t)}`).join("")}function _1(i){return i instanceof Si?`${wl(i.value)}${qc(i.params)}`:wl(i)}function q5(i){return`(${i.value.map(_1).join(" ")})${qc(i.params)}`}function W5(i,e={whitespace:!0}){if(typeof i!="object")throw Ut(i,C5);const t=i instanceof Map?i.entries():Object.entries(i),s=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,r])=>{r instanceof Si||(r=new Si(r));let o=Pl(n);return r.value===!0?o+=qc(r.params):(o+="=",Array.isArray(r.value)?o+=q5(r):o+=_1(r)),o}).join(`,${s}`)}function z5(i,e){return W5(i,e)}function Q5(i){return["ot","sf","st","e","sta"].includes(i)}function Y5(i){return typeof i=="number"?j(i):i!=null&&i!==""&&i!==!1}function X5(i,e){const t=new URL(i),s=new URL(e);if(t.origin!==s.origin)return i;const n=t.pathname.split("/").slice(1),r=s.pathname.split("/").slice(1,-1);for(;n[0]===r[0];)n.shift(),r.shift();for(;r.length;)r.shift(),n.unshift("..");return n.join("/")}const ar=i=>Math.round(i),J5=(i,e)=>(e!=null&&e.baseUrl&&(i=X5(i,e.baseUrl)),encodeURIComponent(i)),Kn=i=>ar(i/100)*100,Z5={br:ar,d:ar,bl:Kn,dl:Kn,mtp:Kn,nor:J5,rtp:Kn,tb:ar};function eb(i,e){const t={};if(i==null||typeof i!="object")return t;const s=Object.keys(i).sort(),n=ge({},Z5,e==null?void 0:e.formatters),r=e==null?void 0:e.filter;return s.forEach(o=>{if((r==null?void 0:r(o))===!1)return;let a=i[o];const c=n[o];c&&(a=c(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||Y5(a)&&(Q5(o)&&typeof a=="string"&&(a=new S1(a)),t[o]=a))}),t}function I1(i,e={}){return i?z5(eb(i,e),ge({whitespace:!1},e)):""}function tb(i,e={}){const t={};if(!i)return t;const s=Object.entries(i),n=Object.entries(I5).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),r=s.reduce((o,a)=>{var c,l;const[u,f]=a,h=((c=n.find(d=>d[1].includes(u)))===null||c===void 0?void 0:c[0])||Hi.REQUEST;return(l=o[h])!==null&&l!==void 0||(o[h]={}),o[h][u]=f,o},{});return Object.entries(r).reduce((o,[a,c])=>(o[a]=I1(c,e),o),t)}function sb(i,e,t){return ge(i,tb(e,t))}const ib="CMCD";function nb(i,e={}){if(!i)return"";const t=I1(i,e);return`${ib}=${encodeURIComponent(t)}`}const yf=/CMCD=[^&#]+/;function rb(i,e,t){const s=nb(e,t);if(!s)return i;if(yf.test(i))return i.replace(yf,s);const n=i.includes("?")?"&":"?";return`${i}${n}${s}`}class ob{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=n=>{try{this.apply(n,{ot:et.MANIFEST,su:!this.initialized})}catch(r){this.hls.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=n=>{try{const{frag:r,part:o}=n,a=this.hls.levels[r.level],c=this.getObjectType(r),l={d:(o||r).duration*1e3,ot:c};(c===et.VIDEO||c===et.AUDIO||c==et.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(c)/1e3,l.bl=this.getBufferLength(c));const u=o?this.getNextPart(o):this.getNextFrag(r);u!=null&&u.url&&u.url!==r.url&&(l.nor=u.url),this.apply(n,l)}catch(r){this.hls.logger.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||e.sessionId,this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(A.MEDIA_DETACHED,this.onMediaDetached,this),e.on(A.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(A.MEDIA_DETACHED,this.onMediaDetached,this),e.off(A.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var s,n;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:1,sf:A5.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){ge(t,this.createData());const s=t.ot===et.INIT||t.ot===et.VIDEO||t.ot===et.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((o,a)=>(n.includes(a)&&(o[a]=t[a]),o),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),sb(e.headers,t,r)):e.url=rb(e.url,t,r)}getNextFrag(e){var t;const s=(t=this.hls.levels[e.level])==null?void 0:t.details;if(s){const n=e.sn-s.startSN;return s.fragments[n+1]}}getNextPart(e){var t,s;const{index:n,fragment:r}=e,o=(t=this.hls.levels[r.level])==null||(s=t.details)==null?void 0:s.partList;if(o){const{sn:a}=r;for(let c=o.length-1;c>=0;c--){const l=o[c];if(l.index===n&&l.fragment.sn===a)return o[c+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return et.TIMED_TEXT;if(e.sn==="initSegment")return et.INIT;if(t==="audio")return et.AUDIO;if(t==="main")return this.hls.audioTracks.length?et.VIDEO:et.MUXED}getTopBandwidth(e){let t=0,s;const n=this.hls;if(e===et.AUDIO)s=n.audioTracks;else{const r=n.maxAutoLevel,o=r>-1?r+1:n.levels.length;s=n.levels.slice(0,o)}return s.forEach(r=>{r.bitrate>t&&(t=r.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,s=e===et.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:re.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,o,a){t(r),this.loader.load(r,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,o,a){t(r),this.loader.load(r,o,a)}}}}const ab=3e5;class lb extends Ct{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(A.MANIFEST_PARSED,this.onManifestParsed,this),e.on(A.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(A.MANIFEST_PARSED,this.onManifestParsed,this),e.off(A.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(s=>s!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if((s==null?void 0:s.action)===We.SendAlternateToPenaltyBox&&s.flags===Tt.MoveAllAlternatesMatchingHost){const n=this.levels;let r=this._pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:c,type:l}=t.context;a&&n?o=this.getPathwayForGroupId(a,l,o):c&&(o=c)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!r&&n&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),s.resolved=this.pathwayId!==o),t.details===$.BUFFER_APPEND_ERROR&&!t.fatal?s.resolved=!0:s.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${n&&n.length} priorities: ${Ee(r)} penalized: ${Ee(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const s=this.penalizedPathways,n=performance.now();Object.keys(s).forEach(r=>{n-s[r]>ab&&delete s[r]});for(let r=0;r<e.length;r++){const o=e[r];if(o in s)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,c=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,Xg(t),this.hls.trigger(A.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[a];c&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,s){const n=this.getLevelsForPathway(s).concat(this.levels||[]);for(let r=0;r<n.length;r++)if(t===ce.AUDIO_TRACK&&n[r].hasAudioGroup(e)||t===ce.SUBTITLE_TRACK&&n[r].hasSubtitleGroup(e))return n[r].pathwayId;return s}clonePathways(e){const t=this.levels;if(!t)return;const s={},n={};e.forEach(r=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":c}=r;if(t.some(u=>u.pathwayId===o))return;const l=this.getLevelsForPathway(a).map(u=>{const f=new Ae(u.attrs);f["PATHWAY-ID"]=o;const h=f.AUDIO&&`${f.AUDIO}_clone_${o}`,d=f.SUBTITLES&&`${f.SUBTITLES}_clone_${o}`;h&&(s[f.AUDIO]=h,f.AUDIO=h),d&&(n[f.SUBTITLES]=d,f.SUBTITLES=d);const p=C1(u.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),m=new an({attrs:f,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:p,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let g=1;g<u.audioGroups.length;g++)m.addGroupId("audio",`${u.audioGroups[g]}_clone_${o}`);if(u.subtitleGroups)for(let g=1;g<u.subtitleGroups.length;g++)m.addGroupId("text",`${u.subtitleGroups[g]}_clone_${o}`);return m});t.push(...l),vf(this.audioTracks,s,c,o),vf(this.subtitleTracks,n,c,o)})}loadSteeringManifest(e){const t=this.hls.config,s=t.loader;this.loader&&this.loader.destroy(),this.loader=new s(t);let n;try{n=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+u)}const r={responseType:"json",url:n.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(u,f,h,d)=>{this.log(`Loaded steering manifest: "${n}"`);const p=u.data;if((p==null?void 0:p.VERSION)!==1){this.log(`Steering VERSION ${p.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=p.TTL;const{"RELOAD-URI":m,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":y}=p;if(m)try{this.uri=new self.URL(m,n).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${m}`);return}this.scheduleRefresh(this.uri||h.url),g&&this.clonePathways(g);const v={steeringManifest:p,url:n.toString()};this.hls.trigger(A.STEERING_MANIFEST_LOADED,v),y&&this.updatePathwayPriority(y)},onError:(u,f,h,d)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${f.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let p=this.timeToLoad*1e3;if(u.code===429){const m=this.loader;if(typeof(m==null?void 0:m.getResponseHeader)=="function"){const g=m.getResponseHeader("Retry-After");g&&(p=parseFloat(g)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,p)},onTimeout:(u,f,h)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(r,c,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const n=(s=this.hls)==null?void 0:s.media;if(n&&!n.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function vf(i,e,t,s){i&&Object.keys(e).forEach(n=>{const r=i.filter(o=>o.groupId===n).map(o=>{const a=ge({},o);return a.details=void 0,a.attrs=new Ae(a.attrs),a.url=a.attrs.URI=C1(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[n],a.attrs["PATHWAY-ID"]=s,a});i.push(...r)})}function C1(i,e,t,s){const{HOST:n,PARAMS:r,[t]:o}=s;let a;e&&(a=o==null?void 0:o[e],a&&(i=a));const c=new self.URL(i);return n&&!a&&(c.host=n),r&&Object.keys(r).sort().forEach(l=>{l&&c.searchParams.set(l,r[l])}),c.href}function gt(i,e,t){bt(i,e,t),i.addEventListener(e,t)}function bt(i,e,t){i.removeEventListener(e,t)}class pi extends Ct{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=pi.CDMCleanupPromise?[pi.CDMCleanupPromise]:[],this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onWaitingForKey=null}registerListeners(){this.hls.on(A.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(A.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(A.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(A.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(A.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(A.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(A.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(A.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(A.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(A.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,n=t[e];if(n)return n.licenseUrl;if(e===be.WIDEVINE&&s)return s}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(o,a,c)=>!!o&&c.indexOf(o)===a,n=t.map(o=>o.audioCodec).filter(s),r=t.map(o=>o.videoCodec).filter(s);return n.length+r.length===0&&r.push("avc1.42e01e"),new Promise((o,a)=>{const c=l=>{const u=l.shift();this.getMediaKeysPromise(u,n,r).then(f=>o({keySystem:u,mediaKeys:f})).catch(f=>{l.length?c(l):f instanceof ht?a(f):a(new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${s}`;return Vg===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return s(e,t)}getMediaKeysPromise(e,t,s){const n=Z6(e,t,s,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let o=r==null?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Ee(n)}`),o=this.requestMediaKeySystemAccess(e,n);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),o.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const l=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=c.createMediaKeys().then(u=>(this.log(`Media-keys created for "${e}"`),a.hasMediaKeys=!0,l.then(f=>f?this.setMediaKeysServerCertificate(u,e,f):u))),a.mediaKeys.catch(u=>{this.error(`Failed to create media-keys for "${e}"}: ${u}`)}),a.mediaKeys})}return o.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${Ls.hexDump(e.keyId||[])}`);const n=s.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(s,r,t.pssh.buffer,"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 Ls.hexDump(e.keyId)}updateKeySession(e,t){var s;const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${Ls.hexDump(((s=e.decryptdata)==null?void 0:s.keyId)||[])}
- } (data length: ${t&&t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>V0(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:s})=>this.attemptSetMediaKeys(t,s))}selectKeySystem(e){return new Promise((t,s)=>this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const r=V0(n);r?t(r):s(new Error(`Unable to find format for key-system "${n}"`))}).catch(s))}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=nr(this.config),s=e.map(_l).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(s)}loadKey(e){const t=e.keyInfo.decryptdata,s=this.getKeyIdString(t),n=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);let r=this.keyIdToKeySessionPromise[s];return r||(r=this.getKeySystemForKeyPromise(t).then(({keySystem:a,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(a,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:a,mediaKeys:c,decryptdata:t}))))),(this.keyIdToKeySessionPromise[s]=r.then(a=>{const c="cenc",l=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(a,c,l,"playlist-key")})).catch(a=>this.handleError(a))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof ht?this.hls.trigger(A.ERROR,e.data):this.hls.trigger(A.ERROR,{type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[t];if(!s){const n=_l(e.keyFormat),r=n?[n]:nr(this.config);return this.attemptKeySystemAccess(r)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=nr(this.config)),e.length===0)throw new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Ee({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(s).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>s.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,s,n){var r,o;const a=(r=this.config.drmSystems)==null||(o=r[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const p=a.call(this.hls,t,s,e);if(!p)throw new Error("Invalid response from configured generateRequest filter");t=p.initDataType,s=p.initData?p.initData:null,e.decryptdata.pssh=s?new Uint8Array(s):null}catch(p){var c;if(this.warn(p.message),(c=this.hls)!=null&&c.config.debug)throw p}if(s===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${l} (init data type: ${t} length: ${s?s.byteLength:null})`);const u=new Mc,f=e._onmessage=p=>{const m=e.mediaKeysSession;if(!m){u.emit("error",new Error("invalid state"));return}const{messageType:g,message:y}=p;this.log(`"${g}" message event for session "${m.sessionId}" message size: ${y.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,y).catch(v=>{u.eventNames().length?u.emit("error",v):this.handleError(v)}):g==="license-release"?e.keySystem===be.FAIRPLAY&&(this.updateKeySession(e,bl("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},h=e._onkeystatuseschange=p=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const g=e.keyStatus;u.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};gt(e.mediaKeysSession,"message",f),gt(e.mediaKeysSession,"keystatuseschange",h);const d=new Promise((p,m)=>{u.on("error",m),u.on("keyStatus",g=>{g.startsWith("usable")?p():g==="output-restricted"?m(new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?m(new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?m(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,s).then(()=>{var p;this.log(`Request generated for key-session "${(p=e.mediaKeysSession)==null?void 0:p.sessionId}" keyId: ${l}`)}).catch(p=>{throw new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:p,fatal:!1},`Error generating key-session request: ${p}`)}).then(()=>d).catch(p=>{throw u.removeAllListeners(),this.removeSession(e),p}).then(()=>(u.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,s)=>{if(typeof s=="string"&&typeof t=="object"){const n=s;s=t,t=n}this.log(`key status change "${t}" for keyStatuses keyId: ${Ls.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${Ls.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,s=t.loader,n=new s(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const c={responseType:"arraybuffer",url:r},l=t.certLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,d,p,m)=>{o(h.data)},onError:(h,d,p,m)=>{a(new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:xe({url:c.url,data:void 0},h)},`"${e}" certificate request failed (${r}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,p)=>{a(new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(h,d,p)=>{a(new Error("aborted"))}};n.load(c,u,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((n,r)=>{e.setServerCertificate(s).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${s==null?void 0:s.byteLength}) on "${t}"`),n(e)}).catch(o=>{r(new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(n=>{throw new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:n,fatal:!0},n.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=new DOMParser().parseFromString(s,"application/xml"),r=n.querySelectorAll("HttpHeader");if(r.length>0){let u;for(let f=0,h=r.length;f<h;f++){var o,a;u=r[f];const d=(o=u.querySelector("name"))==null?void 0:o.textContent,p=(a=u.querySelector("value"))==null?void 0:a.textContent;d&&p&&e.setRequestHeader(d,p)}}const c=n.querySelector("Challenge"),l=c==null?void 0:c.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return bl(atob(l))}setupLicenseXHR(e,t,s,n){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,s,n)}).catch(o=>{if(!s.decryptdata)throw o;return e.open("POST",t,!0),r.call(this.hls,e,t,s,n)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((n,r)=>{const o=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let c=a.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const l=this.config.licenseResponseCallback;if(l)try{c=l.call(this.hls,a,o,e)}catch(u){this.error(u)}n(c)}else{const c=s.errorRetry,l=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)r(new ht({type:Z.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const u=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(n,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:c,licenseChallenge:l})=>{e.keySystem==be.PLAYREADY&&(l=this.unpackPlayReadyKeyMessage(c,l)),c.send(l)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,gt(s,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(bt(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,io.clearKeyUriToKeyIdMap();const n=s.length;pi.CDMCleanupPromise=Promise.all(s.map(r=>this.removeSession(r)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(r=>{var o;this.log(`Could not clear media keys: ${r}`),(o=this.hls)==null||o.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${r}`)})}))).catch(r=>{var o;this.log(`Could not close sessions and clear media keys: ${r}`),(o=this.hls)==null||o.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${r}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((n,r)=>(n.indexOf(r.keyFormat)===-1&&n.push(r.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{drmSystemOptions:r}=this.config;return(tT(r)?new Promise((a,c)=>{self.setTimeout(()=>c(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(a)}):Promise.resolve()).catch(a=>{var c;this.log(`Could not remove session: ${a}`),(c=this.hls)==null||c.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${a}`)})}).then(()=>t.close()).catch(a=>{var c;this.log(`Could not close session: ${a}`),(c=this.hls)==null||c.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${a}`)})})}}}pi.CDMCleanupPromise=void 0;class ht 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}}class cb{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(A.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(A.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(A.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(A.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,s){const n=performance.now();if(t){if(this.lastTime){const r=n-this.lastTime,o=s-this.lastDroppedFrames,a=t-this.lastDecodedFrames,c=1e3*o/r,l=this.hls;if(l.trigger(A.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:s}),c>0&&o>l.config.fpsDroppedMonitoringThreshold*a){let u=l.currentLevel;l.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=u)&&(u=u-1,l.trigger(A.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=s,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function L1(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 D1(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues&&!i.cues.getCueById(e.id))try{if(i.addCue(e),!i.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){de.debug(`[texttrack-utils]: ${s}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,i.addCue(n)}catch(n){de.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(i.mode=t)}function ci(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues)for(let s=i.cues.length;s--;)e&&i.cues[s].removeEventListener("enter",e),i.removeCue(i.cues[s]);t==="disabled"&&(i.mode=t)}function kl(i,e,t,s){const n=i.mode;if(n==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const r=fb(i.cues,e,t);for(let o=0;o<r.length;o++)(!s||s(r[o]))&&i.removeCue(r[o])}n==="disabled"&&(i.mode=n)}function ub(i,e){if(e<=i[0].startTime)return 0;const t=i.length-1;if(e>i[t].endTime)return-1;let s=0,n=t,r;for(;s<=n;)if(r=Math.floor((n+s)/2),e<i[r].startTime)n=r-1;else if(e>i[r].startTime&&s<t)s=r+1;else return r;return i[s].startTime-e<e-i[n].startTime?s:n}function fb(i,e,t){const s=[],n=ub(i,e);if(n>-1)for(let r=n,o=i.length;r<o;r++){const a=i[r];if(a.startTime>=e&&a.endTime<=t)s.push(a);else if(a.startTime>t)return s}return s}function lr(i){const e=[];for(let t=0;t<i.length;t++){const s=i[t];(s.kind==="subtitles"||s.kind==="captions")&&s.label&&e.push(i[t])}return e}class hb extends Vc{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=lr(this.media.textTracks);for(let r=0;r<s.length;r++)if(s[r].mode==="hidden")t=s[r];else if(s[r].mode==="showing"){t=s[r];break}const n=this.findTrackForTextTrack(t);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},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(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.MANIFEST_PARSED,this.onManifestParsed,this),e.on(A.LEVEL_LOADING,this.onLevelLoading,this),e.on(A.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(A.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(A.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.MANIFEST_PARSED,this.onManifestParsed,this),e.off(A.LEVEL_LOADING,this.onLevelLoading,this),e.off(A.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(A.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(A.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const s=this.media;if(!s)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;lr(s.textTracks).forEach(o=>{ci(o)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:s,groupId:n,details:r}=t,o=this.tracksInGroup[s];if(!o||o.groupId!==n){this.warn(`Subtitle track with id:${s} and group:${n} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${s} "${o.name}" lang:${o.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.subtitleGroups||null,n=this.groupIds;let r=this.currentTrack;if(!s||(n==null?void 0:n.length)!==(s==null?void 0:s.length)||s!=null&&s.some(o=>(n==null?void 0:n.indexOf(o))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(u=>!s||s.indexOf(u.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(u=>u.default)&&(this.selectDefaultTrack=!1),o.forEach((u,f)=>{u.id=f});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!r&&a){this.selectDefaultTrack=!1;const u=Bt(a,o);if(u>-1)r=o[u];else{const f=Bt(a,this.tracks);r=this.tracks[f]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const l={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${s==null?void 0:s.join(",")}" group-id`),this.hls.trigger(A.SUBTITLE_TRACKS_UPDATED,l),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const r=t[n];if(!(s&&!r.default||!s&&!e)&&(!e||Fs(r,e)))return n}if(e){for(let n=0;n<t.length;n++){const r=t[n];if(hn(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const r=t[n];if(hn(e.attrs,r.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const n=t[s];if(Rl(n,e))return s}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ce.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){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const s=this.currentTrack;if(s&&Fs(e,s))return s;const n=Bt(e,this.tracksInGroup);if(n>-1){const r=this.tracksInGroup[n];return this.setSubtitleTrack(n),r}else{if(s)return null;{const r=Bt(e,t);if(r>-1)return t[r]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,n=e.groupId,r=this.getUrlWithDirectives(e.url,t),o=e.details,a=o==null?void 0:o.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${a&&o.live?" age "+a.toFixed(1)+(o.type&&" "+o.type||""):""} ${r}`),this.hls.trigger(A.SUBTITLE_TRACK_LOADING,{url:r,id:s,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=lr(e.textTracks),s=this.currentTrack;let n;if(s&&(n=t.filter(r=>Rl(s,r))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!=="disabled"&&r!==n&&(r.mode="disabled")}),n){const r=this.subtitleDisplay?"showing":"hidden";n.mode!==r&&(n.mode=r)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!j(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger(A.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!n.details&&!n.details.live;if(e===this.trackId&&n===s&&r)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:o,groupId:a="",name:c,type:l,url:u}=n;this.hls.trigger(A.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:c,type:l,url:u});const f=this.switchParams(n.url,s==null?void 0:s.details,n.details);this.loadPlaylist(f)}}function db(){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,n=>{const r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?r:r&3|8).toString(16)})}}}function zi(i){let e=5381,t=i.length;for(;t;)e=e*33^i.charCodeAt(--t);return(e>>>0).toString()}const gi=.025;let Mr=function(i){return i[i.Point=0]="Point",i[i.Range=1]="Range",i}({});function pb(i,e,t){return`${i.identifier}-${t+1}-${zi(e)}`}class gb{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const s=this.playoutLimit;return e<=0||isNaN(s)?!1:s===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>s}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Do(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,s=Do(t,e);return t-s<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=j(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return Do(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<gi))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Mr.Range:Mr.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return mb(this)}}function Do(i,e){return i-e.start<e.duration/2&&!(Math.abs(i-(e.start+e.duration))<gi)?e.start:e.start+e.duration}function R1(i,e,t){const s=new self.URL(i,t);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",e),s}function Ro(i,e){for(;(t=i.assetList[++e])!=null&&t.error;)var t;return e}function mb(i){return`["${i.identifier}" ${i.cue.pre?"<pre>":i.cue.post?"<post>":""}${i.timelineStart.toFixed(2)}-${i.resumeTime.toFixed(2)}]`}function ri(i){const e=i.timelineStart,t=i.duration||0;return`["${i.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class xb{constructor(e,t,s,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls.trigger(A.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(t);this.interstitial=s,this.assetItem=n;let o=n.uri;try{o=R1(o,t.primarySessionId).href}catch{}r.loadSource(o);const a=()=>{this.hasDetails=!0};r.once(A.LEVEL_LOADED,a),r.once(A.AUDIO_TRACK_LOADED,a),r.once(A.SUBTITLE_TRACK_LOADED,a),r.on(A.MEDIA_ATTACHING,(c,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on(A.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,r.trigger(A.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var e;return((e=this.interstitial)==null?void 0:e.appendInPlace)||!1}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const s=this.timelineOffset,n=re.bufferInfo(e,s,0);return this.getAssetTime(n.end)>=this._bufferedEosTime-.02}reachedPlayout(e){const s=this.interstitial.playoutLimit;return this.startOffset+e>=s}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=re.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const s=e-t;if(Math.abs(s)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,e-t),s)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}resetDetails(){const e=this.hls;if(this.hasDetails){e.stopLoad();const t=s=>delete s.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,s){this.hls.on(e,t)}once(e,t,s){this.hls.once(e,t)}off(e,t,s){this.hls.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${ri(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Ef=.033;class yb extends Ct{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((s,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,s+1):s,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let s=-1;e.nextEvent?s=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(s=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[s]||(t===void 0&&(t=e.start),s=this.findItemIndexAtTime(t));s>=0&&(r=n[s])!=null&&r.event;){var r;s--}return s}findItemIndexAtTime(e,t){const s=this.items;if(s)for(let n=0;n<s.length;n++){let r=s[n];if(t&&t!=="primary"&&(r=r[t]),e===r.start||e>r.start&&e<r.end)return n}return-1}findJumpRestrictedIndex(e,t){const s=this.items;if(s)for(let n=e;n<=t&&s[n];n++){const r=s[n].event;if(r!=null&&r.restrictions.jump&&!r.appendInPlace)return n}return-1}findEventIndex(e){const t=this.items;if(t)for(let n=t.length;n--;){var s;if(((s=t[n].event)==null?void 0:s.identifier)===e)return n}return-1}findAssetIndex(e,t){const s=e.assetList,n=s.length;if(n>1)for(let r=0;r<n;r++){const o=s[r];if(!o.error){const a=o.timelineStart;if(t===a||t>a&&t<a+(o.duration||0))return r}}return 0}get assetIdAtEnd(){var e,t;const s=(e=this.items)==null||(t=e[this.length-1])==null?void 0:t.event;if(s){const n=s.assetList,r=n[n.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const s=e.main.details,{dateRanges:n}=s,r=this.events,o=this.parseDateRanges(n,{url:s.url},t),a=Object.keys(n),c=r?r.filter(l=>!a.includes(l.identifier)):[];o.length&&o.sort((l,u)=>{const f=l.cue.pre,h=l.cue.post,d=u.cue.pre,p=u.cue.post;if(f&&!d)return-1;if(d&&!f||h&&!p)return 1;if(p&&!h)return-1;if(!f&&!d&&!h&&!p){const m=l.startTime,g=u.startTime;if(m!==g)return m-g}return l.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=o,c.forEach(l=>{this.removeEvent(l)}),this.updateSchedule(e,c)}updateSchedule(e,t=[]){const s=this.events||[];if(s.length||t.length||this.length<2){const n=this.items,r=this.parseSchedule(s,e);(t.length||(n==null?void 0:n.length)!==r.length||r.some((a,c)=>Math.abs(a.playout.start-n[c].playout.start)>.005||Math.abs(a.playout.end-n[c].playout.end)>.005))&&(this.items=r,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,s){const n=[],r=Object.keys(e);for(let o=0;o<r.length;o++){const a=r[o],c=e[a];if(c.isInterstitial){let l=this.eventMap[a];l?l.setDateRange(c):(l=new gb(c,t),this.eventMap[a]=l,s===!1&&(l.appendInPlace=s)),n.push(l)}}return n}parseSchedule(e,t){const s=[],n=t.main.details,r=n.live?1/0:n.edge;let o=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,l=0;if(e.forEach((u,f)=>{const h=u.cue.pre,d=u.cue.post,p=e[f-1]||null,m=u.appendInPlace,g=d?r:u.startOffset,y=u.duration,v=u.timelineOccupancy===Mr.Range?y:0,x=u.resumptionOffset,E=(p==null?void 0:p.startTime)===g,S=g+u.cumulativeDuration;let T=m?S+y:g+x;if(h||!d&&g<=0){const I=l;l+=v,u.timelineStart=S;const R=o;o+=y,s.push({event:u,start:S,end:T,playout:{start:R,end:o},integrated:{start:I,end:l}})}else if(g<=r){if(!E){const b=g-c;if(b>Ef){const L=c,k=l;l+=b;const M=o;o+=b;const N={previousEvent:e[f-1]||null,nextEvent:u,start:L,end:L+b,playout:{start:M,end:o},integrated:{start:k,end:l}};s.push(N)}else b>0&&p&&(p.cumulativeDuration+=b,s[s.length-1].end=g)}d&&(T=S),u.timelineStart=S;const I=l;l+=v;const R=o;o+=y,s.push({event:u,start:S,end:T,playout:{start:R,end:o},integrated:{start:I,end:l}})}else return;const _=u.resumeTime;d||_>r?c=r:c=_}),c<r){var a;const u=c,f=l,h=r-c;l+=h;const d=o;o+=h,s.push({previousEvent:((a=s[s.length-1])==null?void 0:a.event)||null,nextEvent:null,start:c,end:u+h,playout:{start:d,end:o},integrated:{start:f,end:l}})}this.setDurations(r,o,l)}else s.push({previousEvent:null,nextEvent:null,start:0,end:r,playout:{start:0,end:r},integrated:{start:0,end:r}}),this.setDurations(r,r,r);return s}setDurations(e,t,s){this.durations={primary:e,playout:t,integrated:s}}resolveOffsets(e,t){const s=t.main.details,n=s.live?1/0:s.edge;let r=0,o=-1;e.forEach((a,c)=>{const l=a.cue.pre,u=a.cue.post,f=l?0:u?n:a.startTime;this.updateAssetDurations(a),o===f?a.cumulativeDuration=r:(r=0,o=f),!u&&a.snapOptions.in&&(a.resumeAnchor=Hs(null,s.fragments,a.startOffset+a.resumptionOffset,0,0)||void 0),a.appendInPlace&&!a.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(a,t)||(a.appendInPlace=!1)),!a.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<Ef&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${a}`));const d=j(a.resumeOffset)?a.resumeOffset:a.duration;r+=d})}primaryCanResumeInPlaceAt(e,t){const s=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(s-n)>gi?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${n}`),!1):t?!Object.keys(t).some(o=>{const a=t[o].details,c=a.edge;if(s>=c)return this.log(`"${e.identifier}" resumption ${s} past ${o} playlist end ${c}`),!1;const l=Hs(null,a.fragments,s);if(!l)return this.log(`"${e.identifier}" resumption ${s} does not align with any fragments in ${o} playlist (${a.fragStart}-${a.fragmentEnd})`),!0;const u=o==="audio"?.175:0;return Math.abs(l.start-s)<gi+u||Math.abs(l.end-s)<gi+u?!1:(this.log(`"${e.identifier}" resumption ${s} not aligned with ${o} fragment bounds (${l.start}-${l.end} sn: ${l.sn} cc: ${l.cc})`),!0)}):(this.log(`"${e.identifier}" resumption ${s} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let s=0,n=!1,r=!1;e.assetList.forEach((o,a)=>{const c=t+s;o.startOffset=s,o.timelineStart=c,n||(n=o.duration===null),r||(r=!!o.error);const l=o.error?0:o.duration||0;s+=l}),n&&!r?e.duration=Math.max(s,e.duration):e.duration=s}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function ts(i){return`[${i.event?'"'+i.event.identifier+'"':"primary"}: ${i.start.toFixed(2)}-${i.end.toFixed(2)}]`}class vb{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const s=e.assetListUrl;let n;try{n=R1(s,this.hls.sessionId,e.baseUrl)}catch(h){const d=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,h,s);this.hls.trigger(A.ERROR,d);return}t&&n.protocol!=="data:"&&n.searchParams.set("_HLS_start_offset",""+t);const r=this.hls.config,o=r.loader,a=new o(r),c={responseType:"json",url:n.href},l=r.interstitialAssetListLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,d,p,m)=>{const g=h.data,y=g==null?void 0:g.ASSETS;if(!Array.isArray(y)){const v=this.assignAssetListError(e,$.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),p.url,d,m);this.hls.trigger(A.ERROR,v);return}e.assetListResponse=g,this.hls.trigger(A.ASSET_LIST_LOADED,{event:e,assetListResponse:g,networkDetails:m})},onError:(h,d,p,m)=>{const g=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${h.code} ${h.text} (${d.url})`),d.url,m,p);this.hls.trigger(A.ERROR,g)},onTimeout:(h,d,p)=>{const m=this.assignAssetListError(e,$.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${d.url})`),d.url,h,p);this.hls.trigger(A.ERROR,m)}};return a.load(c,u,f),this.hls.trigger(A.ASSET_LIST_LOADING,{event:e}),a}assignAssetListError(e,t,s,n,r,o){return e.error=s,{type:Z.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:s,networkDetails:o,stats:r}}}function Af(i){i==null||i.play().catch(()=>{})}class Eb extends Ct{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;const n=s-this.timelinePos;if(Math.abs(n)<1/7056e5)return;const o=n<=-.01;this.timelinePos=s,this.bufferedPos=s;const a=this.playingItem;if(!a){this.checkBuffer();return}if(o&&this.schedule.resetErrorsInRange(s,s-n)&&this.updateSchedule(),this.checkBuffer(),o&&s<a.start||s>=a.end){var c;const h=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(a)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!o){const d=this.findItemIndex(a);if(h>d){const p=this.schedule.findJumpRestrictedIndex(d+1,h);if(p>d){this.setSchedulePosition(p);return}}}this.setSchedulePosition(h);return}const l=this.playingAsset;if(!l){if(this.playingLastItem&&this.isInterstitial(a)){const h=a.event.assetList[0];h&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,h))}return}const u=l.timelineStart,f=l.duration||0;(o&&s<u||s>=u+f)&&this.setScheduleToAssetAtTime(s,l)},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const n=this.playingItem;if(!n||this.playingLastItem)return;if(s>=n.end){this.timelinePos=n.end;const a=this.findItemIndex(n);this.setSchedulePosition(a+1)}const r=this.playingAsset;if(!r)return;const o=r.timelineStart+(r.duration||0);s>=o&&this.setScheduleToAssetAtTime(s,r)},this.onScheduleUpdate=(s,n)=>{const r=this.schedule,o=this.playingItem,a=r.events||[],c=r.items||[],l=r.durations,u=s.map(p=>p.identifier),f=!!(a.length||u.length);(f||n)&&this.log(`INTERSTITIALS_UPDATED (${a.length}): ${a}
- Schedule: ${c.map(p=>ts(p))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`),this.playerQueue.forEach(p=>{if(p.interstitial.appendInPlace){const m=p.assetItem.timelineStart,g=p.timelineOffset-m;if(g)try{p.timelineOffset=m}catch(y){Math.abs(g)>gi&&this.warn(`${y} ("${p.assetId}" ${p.timelineOffset}->${m})`)}}});let h=null;if(o){const p=this.updateItem(o,this.timelinePos);this.itemsMatch(o,p)&&(this.playingItem=p,this.waitingItem=this.endedItem=null,h=()=>this.trimInPlace(p,o))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const d=this.bufferingItem;if(d){const p=this.updateItem(d,this.bufferedPos);this.itemsMatch(d,p)?(this.bufferingItem=p,h||(h=()=>this.trimInPlace(p,d))):d.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(d.event,null))}if(s.forEach(p=>{p.assetList.forEach(m=>{this.clearAssetPlayer(m.identifier,null)})}),f||n){if(this.hls.trigger(A.INTERSTITIALS_UPDATED,{events:a.slice(0),schedule:c.slice(0),durations:l,removedIds:u}),this.isInterstitial(o)&&u.includes(o.event.identifier)){this.warn(`Interstitial "${o.event.identifier}" removed while playing`),this.primaryFallback(o.event);return}h&&h(),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new vb(e),this.schedule=new yb(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e.on(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(A.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(A.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(A.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(A.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(A.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(A.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(A.BUFFER_APPENDED,this.onBufferAppended,this),e.on(A.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(A.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(A.MEDIA_ENDED,this.onMediaEnded,this),e.on(A.ERROR,this.onError,this),e.on(A.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(A.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(A.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(A.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(A.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(A.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(A.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(A.BUFFER_CODECS,this.onBufferCodecs,this),e.off(A.BUFFER_APPENDED,this.onBufferAppended,this),e.off(A.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(A.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(A.MEDIA_ENDED,this.onMediaEnded,this),e.off(A.ERROR,this.onError,this),e.off(A.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){bt(e,"play",this.onPlay),bt(e,"pause",this.onPause),bt(e,"seeking",this.onSeeking),bt(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const s=this.media=t.media;gt(s,"seeking",this.onSeeking),gt(s,"timeupdate",this.onTimeupdate),gt(s,"play",this.onPlay),gt(s,"pause",this.onPause)}onMediaAttached(e,t){const s=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!n){this.clearScheduleState();const r=this.findItemIndex(s);this.setSchedulePosition(r)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const s=!!t.transferMedia,n=this.media;if(this.media=null,!s&&(n&&this.removeMediaListeners(n),this.detachedData)){const r=this.getBufferingPlayer();r&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,r.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,s=f=>f&&e.getAssetPlayer(f.identifier),n=(f,h,d,p,m)=>{if(f){let g=f[h].start;const y=f.event;if(y){if(h==="playout"||y.timelineOccupancy!==Mr.Point){const v=s(d);(v==null?void 0:v.interstitial)===y&&(g+=v.assetItem.startOffset+v[m])}}else{const v=p==="bufferedPos"?o():e[p];g+=v-f.start}return g}return 0},r=(f,h)=>{if(f!==0&&h!=="primary"&&e.schedule.length){var d;const p=e.schedule.findItemIndexAtTime(f),m=(d=e.schedule.items)==null?void 0:d[p];if(m){const g=m[h].start-m.start;return f+g}}return f},o=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?a("primary"):Math.max(f,0)},a=f=>{var h;return(h=e.primaryDetails)!=null&&h.live?e.primaryDetails.edge:e.schedule.durations[f]},c=(f,h)=>{var d,p;const m=e.effectivePlayingItem;if(m!=null&&(d=m.event)!=null&&d.restrictions.skip)return;e.log(`seek to ${f} "${h}"`);const g=e.effectivePlayingItem,y=e.schedule.findItemIndexAtTime(f,h),v=(p=e.schedule.items)==null?void 0:p[y],x=e.getBufferingPlayer(),E=x==null?void 0:x.interstitial,S=E==null?void 0:E.appendInPlace,T=g&&e.itemsMatch(g,v);if(g&&(S||T)){const I=s(e.playingAsset),R=(I==null?void 0:I.media)||e.primaryMedia;if(R){const b=h==="primary"?R.currentTime:n(g,h,e.playingAsset,"timelinePos","currentTime"),L=f-b,k=(S?b:R.currentTime)+L;if(k>=0&&(!I||S||k<=I.duration)){R.currentTime=k;return}}}if(v){let I=f;if(h!=="primary"){const b=v[h].start,L=f-b;I=v.start+L}const R=!e.isInterstitial(v);if((!e.isInterstitial(g)||g.event.appendInPlace)&&(R||v.event.appendInPlace)){const b=e.media||(S?x==null?void 0:x.media:null);b&&(b.currentTime=I)}else if(g){const b=e.findItemIndex(g);if(y>b){const k=e.schedule.findJumpRestrictedIndex(b+1,y);if(k>b){e.setSchedulePosition(k);return}}let L=0;if(R)e.timelinePos=I,e.checkBuffer();else{var _;const k=v==null||(_=v.event)==null?void 0:_.assetList;if(k){const M=f-(v[h]||v).start;for(let N=k.length;N--;){const F=k[N];if(F.duration&&M>=F.startOffset&&M<F.startOffset+F.duration){L=N;break}}}}e.setSchedulePosition(y,L)}}},l=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const h=t();return e.isInterstitial(h)?h:null},u={get currentTime(){const f=l(),h=e.effectivePlayingItem;return h&&h===f?n(h,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-h.playout.start:0},set currentTime(f){const h=l(),d=e.effectivePlayingItem;d&&d===h&&c(f+d.playout.start,"playout")},get duration(){const f=l();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const h=(f=l())==null?void 0:f.event.assetList;return h?h.map(d=>e.getAssetPlayer(d.identifier)):[]},get playingIndex(){var f;const h=(f=l())==null?void 0:f.event;return h&&e.effectivePlayingAsset?h.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return l()}};this.manager={get events(){var f,h;return((f=e.schedule)==null||(h=f.events)==null?void 0:h.slice(0))||[]},get schedule(){var f,h;return((f=e.schedule)==null||(h=f.items)==null?void 0:h.slice(0))||[]},get interstitialPlayer(){return l()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const f=t();return e.findItemIndex(f)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const f=e.effectivePlayingItem;return e.findItemIndex(f)},primary:{get bufferedEnd(){return o()},get currentTime(){const f=e.timelinePos;return f>0?f:0},set currentTime(f){c(f,"primary")},get duration(){return a("primary")},get seekableStart(){var f;return((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){c(f,"integrated")},get duration(){return a("integrated")},get seekableStart(){var f;return r(((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0,"integrated")}},skip:()=>{const f=e.effectivePlayingItem,h=f==null?void 0:f.event;if(h&&!h.restrictions.skip){const d=e.findItemIndex(f);if(h.appendInPlace){const p=f.playout.start+f.event.duration;c(p+.001,"playout")}else e.advanceAfterAssetEnded(h,d,1/0)}}}}return this.manager}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,s=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!s?!1:this.findItemIndex(t)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t,s;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(t=e.event)!=null&&t.appendInPlace&&(r=this.primaryMedia);const o=(s=r)==null?void 0:s.currentTime;if(!(o===void 0||!j(o)))return o}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const s=this.getAssetPlayer(e);s&&this.transferMediaFromPlayer(s,t)}transferMediaFromPlayer(e,t){const s=e.interstitial.appendInPlace,n=e.media;if(s&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n){this.detachedData={media:n};return}const r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Ee(r)}`),this.detachedData=r}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var s,n;if(e.media===t)return;let r=null;const o=this.hls,a=e!==o,c=a&&e.interstitial.appendInPlace,l=(s=this.detachedData)==null?void 0:s.mediaSource;let u;if(o.media)c&&(r=o.transferMedia(),this.detachedData=r),u="Primary";else if(l){const d=this.getBufferingPlayer();d?(r=d.transferMedia(),u=`${d}`):u="detached MediaSource"}else u="detached media";if(!r){if(l)r=this.detachedData,this.log(`using detachedData: MediaSource ${Ee(r)}`);else if(!this.detachedData||o.media===t){const d=this.playerQueue;d.length>1&&d.forEach(p=>{if(a&&p.interstitial.appendInPlace!==c){const m=p.interstitial;this.clearInterstitial(p.interstitial,null),m.appendInPlace=!1,m.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${m}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=r&&"mediaSource"in r&&((n=r.mediaSource)==null?void 0:n.readyState)!=="closed",h=f&&r?r:t;if(this.log(`${f?"transfering MediaSource":"attaching media"} to ${a?e:"Primary"} from ${u}`),h===r){const d=a&&e.assetId===this.schedule.assetIdAtEnd;h.overrides={duration:this.schedule.duration,endOfStream:!a||d,cueRemoval:!a}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,n=this.effectivePlayingItem;if(s===-1){const r=this.hls.startPosition;if(this.timelinePos=r,t.length&&t[0].cue.pre){const o=e.findEventIndex(t[0].identifier);this.setSchedulePosition(o)}else if(r>=0||!this.primaryLive){const o=this.timelinePos=r>0?r:0,a=e.findItemIndexAtTime(o);this.setSchedulePosition(a)}}else if(n&&!this.playingItem){const r=e.findItemIndex(n);this.setSchedulePosition(r)}}advanceAfterAssetEnded(e,t,s){const n=Ro(e,s);if(!e.isAssetPastPlayoutLimit(n))this.setSchedulePosition(t,n);else{const r=this.schedule.items;if(r){const o=t+1,a=r.length;if(o>=a){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.timelinePos=c,this.checkBuffer()),this.setSchedulePosition(o)}}}setScheduleToAssetAtTime(e,t){const s=this.schedule,n=t.parentIdentifier,r=s.getEvent(n);if(r){const o=s.findEventIndex(n),a=s.findAssetIndex(r,e);this.advanceAfterAssetEnded(r,o,a-1)}}setSchedulePosition(e,t){const s=this.schedule.items;if(!s||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const n=e>=0?s[e]:null,r=this.playingItem,o=this.playingLastItem;if(this.isInterstitial(r)){var a;const l=r.event,u=this.playingAsset,f=u==null?void 0:u.identifier,h=f?this.getAssetPlayer(f):null;if(h&&f&&(!this.eventItemsMatch(r,n)||t!==void 0&&f!==((a=l.assetList)==null?void 0:a[t].identifier))){var c;const d=l.findAssetIndex(u);if(this.log(`INTERSTITIAL_ASSET_ENDED ${d+1}/${l.assetList.length} ${ri(u)}`),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(A.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:d,event:l,schedule:s.slice(0),scheduleIndex:e,player:h}),r!==this.playingItem){this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(l,this.findItemIndex(this.playingItem),d);return}this.retreiveMediaSource(f,n),h.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&h.detachMedia()}if(!this.eventItemsMatch(r,n)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${l} ${ts(r)}`),l.hasPlayed=!0,this.hls.trigger(A.INTERSTITIAL_ENDED,{event:l,schedule:s.slice(0),scheduleIndex:e}),l.cue.once)){this.updateSchedule();const d=this.schedule.items;if(n&&d){const p=this.findItemIndex(n);this.advanceSchedule(p,d,t,r,o)}return}}this.advanceSchedule(e,s,t,r,o)}advanceSchedule(e,t,s,n,r){const o=e>=0?t[e]:null,a=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(l=>{const u=l.interstitial,f=this.schedule.findEventIndex(u.identifier);(f<e||f>e+1)&&this.clearInterstitial(u,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const l=o.event;if(s===void 0){s=this.schedule.findAssetIndex(l,this.timelinePos);const d=Ro(l,s-1);if(l.isAssetPastPlayoutLimit(d)){this.advanceAfterAssetEnded(l,e,s);return}s=d}const u=this.waitingItem;this.assetsBuffered(o,a)||this.setBufferingItem(o);let f=this.preloadAssets(l,s);if(this.eventItemsMatch(o,u||n)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${ts(o)} ${l.appendInPlace?"append in place":""}`),this.hls.trigger(A.INTERSTITIAL_STARTED,{event:l,schedule:t.slice(0),scheduleIndex:e})),!l.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${l}`);return}if(l.assetListLoader&&(l.assetListLoader.destroy(),l.assetListLoader=void 0),!a){this.log(`Waiting for attachMedia to start Interstitial ${l}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const h=l.assetList[s];if(!h){const d=t[e+1],p=this.media;d&&p&&!this.isInterstitial(d)&&p.currentTime<d.start&&(p.currentTime=this.timelinePos=d.start),this.advanceAfterAssetEnded(l,e,s||0);return}if(f||(f=this.getAssetPlayer(h.identifier)),f===null||f.destroyed){const d=l.assetList.length;this.warn(`asset ${s+1}/${d} player destroyed ${l}`),f=this.createAssetPlayer(l,h,s)}if(!this.eventItemsMatch(o,this.bufferingItem)&&l.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(f,s,t,e,a),this.shouldPlay&&Af(f.media)}else o!==null?(this.resumePrimary(o,e,n),this.shouldPlay&&Af(this.hls.media)):r&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e,t;return(e=this.mediaSelection)==null||(t=e.main)==null?void 0:t.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,s){var n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${ts(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.timelinePos=o),this.attachPrimary(o,e)}if(!s)return;const r=this.schedule.items;r&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${ts(e)}`),this.hls.trigger(A.INTERSTITIALS_PRIMARY_RESUMED,{schedule:r.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const s=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(s<n.fragmentStart||s>n.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:re.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,s){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,n),s&&this.startLoadingPrimaryAt(e,s)),s||(this.timelinePos=e,this.startLoadingPrimaryAt(e,s))}startLoadingPrimaryAt(e,t){var s;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs((((s=n.mainForwardBufferInfo)==null?void 0:s.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(A.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(A.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1)return;const s=this.hls.levels[t.level],n=xe(xe({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const s=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=xe(xe({},this.altSelection),{},{audio:s});return}const r=xe(xe({},n),{},{audio:s});this.mediaSelection=r}onSubtitleTrackUpdated(e,t){const s=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=xe(xe({},this.altSelection),{},{subtitles:s});return}const r=xe(xe({},n),{},{subtitles:s});this.mediaSelection=r}onAudioTrackSwitching(e,t){const s=w0(t);this.playerQueue.forEach(n=>n.hls.setAudioOption(t)||n.hls.setAudioOption(s))}onSubtitleTrackSwitch(e,t){const s=w0(t);this.playerQueue.forEach(n=>n.hls.setSubtitleOption(t)||t.id!==-1&&n.hls.setSubtitleOption(s))}onBufferCodecs(e,t){const s=t.tracks;s&&(this.requiredTracks=s)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let n=0;n<t.length;n++){const r=t[n];if(r.cue.post){var s;const o=this.schedule.findEventIndex(r.identifier),a=(s=this.schedule.items)==null?void 0:s[o];this.isInterstitial(a)&&this.eventItemsMatch(a,this.bufferingItem)&&this.bufferedToItem(a,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const s=this.findItemIndex(t);this.setSchedulePosition(s+1)}else this.shouldPlay=!1}updateItem(e,t){const s=this.schedule.items;if(e&&s){const n=this.findItemIndex(e,t);return s[n]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((r,o)=>{e.event.isAssetPastPlayoutLimit(o)&&this.clearAssetPlayer(r.identifier,null)});const s=e.end+.25,n=re.bufferInfo(this.primaryMedia,s,0);(n.end>s||(n.nextStart||0)>s)&&(this.attachPrimary(s,null),this.flushFrontBuffer(s))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var s;return!!t&&(e===t||e.event.identifier===((s=t.event)==null?void 0:s.identifier))}findItemIndex(e,t){return e?this.schedule.findItemIndex(e,t):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const t=this.schedule.items;if(!t)return;const s=re.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=s.len<1),this.updateBufferedPos(s.end,t,e)}updateBufferedPos(e,t,s){const n=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e)return;if(t.length===1&&this.itemsMatch(t[0],r)){this.bufferedPos=e;return}const o=this.playingItem,a=this.findItemIndex(o);let c=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var l,u;const f=this.findItemIndex(r),h=Math.min(f+1,t.length-1),d=t[h];if((c===-1&&r&&e>=r.end||(l=d.event)!=null&&l.appendInPlace&&e+.01>=d.start)&&(c=h),h-a>1&&(r==null||(u=r.event)==null?void 0:u.appendInPlace)===!1)return;if(this.bufferedPos=e,c>f&&c>a)this.bufferedToItem(d);else{const p=this.primaryDetails;this.primaryLive&&p&&e>p.edge-p.targetduration&&d.start<p.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(d)&&this.preloadAssets(d.event,0)}}else s&&o&&!this.itemsMatch(o,r)&&(c===a?this.bufferedToItem(o):c===a+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(n=>{const r=this.getAssetPlayer(n.identifier);return!(r!=null&&r.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,s=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:n,events:r}=s;if(!n||!r)return t;const o=this.isInterstitial(e),a=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=a?a.remaining:t?t.end-this.timelinePos:0;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${ts(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),this.playbackDisabled||(o?e.event.assetList.forEach(l=>{const u=this.getAssetPlayer(l.identifier);u&&u.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(l=>l.pauseBuffering()))),this.hls.trigger(A.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(e,t=0){const s=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(s!==null){this.bufferingAsset=null;const n=this.detachedData;n?n.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),s=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(s)}bufferedToEvent(e,t){const s=e.event,n=s.assetList.length===0&&!s.assetListLoader,r=s.cue.once;if(n||!r){const o=this.preloadAssets(s,t);if(o!=null&&o.interstitial.appendInPlace){const a=s.assetList[t],c=this.primaryMedia;a&&c&&this.bufferAssetPlayer(o,c)}}}preloadAssets(e,t){const s=e.assetUrl,n=e.assetList.length,r=n===0&&!e.assetListLoader,o=e.cue.once;if(r){const c=e.timelineStart;if(e.appendInPlace){var a;const h=this.playingItem;!this.isInterstitial(h)&&(h==null||(a=h.nextEvent)==null?void 0:a.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let l,u=0;if(!this.playingItem&&this.primaryLive&&(u=this.hls.startPosition,u===-1&&(u=this.hls.liveSyncPosition||0)),u&&!(e.cue.pre||e.cue.post)){const h=u-c;h>0&&(l=Math.round(h*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${s?1:n} ${e}${l?` live-start: ${u} start-offset: ${l}`:""}`),s)return this.createAsset(e,0,0,c,e.duration,s);const f=this.assetListLoader.loadAssetList(e,l);f&&(e.assetListLoader=f)}else if(!o&&n){for(let c=t;c<n;c++){const l=e.assetList[c],u=this.getAssetPlayerQueueIndex(l.identifier);(u===-1||this.playerQueue[u].destroyed)&&!l.error&&this.createAssetPlayer(e,l,c)}return this.getAssetPlayer(e.assetList[t].identifier)}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(n=>{this.hls.trigger(A.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:n})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let s=0;s<t.length;s++)if(e===t[s].assetId)return s;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let s=0;s<e.length;s++)if(e[s].media===t)return e[s]}return null}createAsset(e,t,s,n,r,o){const a={parentIdentifier:e.identifier,identifier:pb(e,o,t),duration:r,startOffset:s,timelineStart:n,uri:o};return this.createAssetPlayer(e,a,t)}createAssetPlayer(e,t,s){const n=this.hls,r=n.userConfig;let o=r.videoPreference;const a=n.loadLevelObj||n.levels[n.currentLevel];(o||a)&&(o=ge({},o),a.videoCodec&&(o.videoCodec=a.videoCodec),a.videoRange&&(o.allowedVideoRanges=[a.videoRange]));const c=n.audioTracks[n.audioTrack],l=n.subtitleTracks[n.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const x=this.timelinePos-t.timelineStart;if(x>1){const E=t.duration;E&&x<E&&(u=x)}}const f=t.identifier,h=xe(xe({},r),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:c||r.audioPreference,subtitlePreference:l||r.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(h.timelineOffset=t.timelineStart));const d=h.cmcd;d!=null&&d.sessionId&&d.contentId&&(h.cmcd=ge({},d,{contentId:zi(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const p=new xb(this.HlsPlayerClass,h,e,t);this.playerQueue.push(p),e.assetList[s]=t;const m=x=>{if(x.live){const T=new Error(`Interstitials MUST be VOD assets ${e}`),_={fatal:!0,type:Z.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:T};this.handleAssetItemError(_,e,this.schedule.findEventIndex(e.identifier),s,T.message);return}const E=x.edge-x.fragmentStart,S=t.duration;(S===null||E>S)&&(this.log(`Interstitial asset "${f}" duration change ${S} > ${E}`),t.duration=E,this.updateSchedule())};p.on(A.LEVEL_UPDATED,(x,{details:E})=>m(E)),p.on(A.LEVEL_PTS_UPDATED,(x,{details:E})=>m(E));const g=(x,E)=>{const S=this.getAssetPlayer(f);if(S&&E.tracks){S.off(A.BUFFER_CODECS,g),S.tracks=E.tracks;const T=this.primaryMedia;this.bufferingAsset===S.assetItem&&T&&!S.media&&this.bufferAssetPlayer(S,T)}};p.on(A.BUFFER_CODECS,g);const y=()=>{var x;const E=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${E}`),!E)return;const S=this.schedule.findEventIndex(e.identifier),T=(x=this.schedule.items)==null?void 0:x[S];if(this.isInterstitial(T)){const I=e.findAssetIndex(t),R=Ro(e,I);if(!e.isAssetPastPlayoutLimit(R))this.bufferedToItem(T,R);else{var _;const b=(_=this.schedule.items)==null?void 0:_[S+1];b&&this.bufferedToItem(b)}}};p.on(A.BUFFERED_TO_END,y);const v=x=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const S=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,S,x)};return p.once(A.MEDIA_ENDED,v(s)),p.once(A.PLAYOUT_LIMIT_REACHED,v(1/0)),p.on(A.ERROR,(x,E)=>{const S=this.getAssetPlayer(f);if(E.details===$.BUFFER_STALLED_ERROR){if(S!=null&&S.media){const T=S.currentTime,_=S.duration-T;T&&e.appendInPlace&&_/S.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${S.media.currentTime}`),y()):(this.warn(`Stalled at ${T} of ${T+_} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(E,e,this.schedule.findEventIndex(e.identifier),s,`Asset player error ${E.error} ${e}`)}),p.on(A.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const E=new Error(`Asset player destroyed unexpectedly ${f}`),S={fatal:!0,type:Z.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:E};this.handleAssetItemError(S,e,this.schedule.findEventIndex(e.identifier),s,E.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${ri(t)}`),this.hls.trigger(A.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:s,event:e,player:p}),p}clearInterstitial(e,t){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const s=this.playerQueue[t];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(e,t){const s=this.getAssetPlayerQueueIndex(e);if(s!==-1){this.log(`clear asset player "${e}" toSegment: ${t&&ts(t)}`);const n=this.playerQueue[s];this.transferMediaFromPlayer(n,t),this.playerQueue.splice(s,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,s,n,r){const{interstitial:o,assetItem:a,assetId:c}=e,l=o.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=a,(!u||u.identifier!==c)&&(u&&(this.clearAssetPlayer(u.identifier,s[n]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${l} ${ri(a)}`),this.hls.trigger(A.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:t,event:o,schedule:s.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var s,n;const{interstitial:r,assetItem:o}=e,a=this.schedule.findEventIndex(r.identifier),c=(s=this.schedule.items)==null?void 0:s[a];if(!c)return;this.setBufferingItem(c),this.bufferingAsset=o;const l=this.getBufferingPlayer();if(l===e)return;const u=r.appendInPlace;if(u&&(l==null?void 0:l.interstitial.appendInPlace)===!1)return;const f=(l==null?void 0:l.tracks)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(u&&o!==this.playingAsset){if(!e.tracks)return;if(f&&!Tg(f,e.tracks)){const h=new Error(`Asset ${ri(o)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),d={fatal:!0,type:Z.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:h},p=r.findAssetIndex(o);this.handleAssetItemError(d,r,a,p,h.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,s,n,r){if(e.details===$.BUFFER_STALLED_ERROR)return;const o=t.assetList[n];this.warn(`INTERSTITIAL_ASSET_ERROR ${o&&ri(o)} ${e.error}`);const a=o==null?void 0:o.identifier,c=this.getAssetPlayerQueueIndex(a),l=this.playerQueue[c]||null,u=this.schedule.items,f=ge({},e,{fatal:!1,errorAction:ln(!0),asset:o,assetListIndex:n,event:t,schedule:u,scheduleIndex:s,player:l});if(this.hls.trigger(A.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const h=this.playingAsset,d=new Error(r);if(o&&(this.clearAssetPlayer(a,null),o.error=d),!t.assetList.some(p=>!p.error))t.error=d;else{for(let p=n;p<t.assetList.length;p++)this.resetAssetPlayer(t.assetList[p].identifier);this.updateSchedule()}t.error?this.primaryFallback(t):h&&h.identifier===a&&this.advanceAfterAssetEnded(t,s,n)}primaryFallback(e){const t=e.timelineStart,s=this.effectivePlayingItem;if(this.updateSchedule(),s){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${s?ts(s):"<none>"} error: ${e.error}`);let n=this.timelinePos;n===-1&&(n=this.hls.startPosition);const r=this.updateItem(s,n);this.itemsMatch(s,r)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));const o=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(o)}else this.checkStart()}onAssetListLoaded(e,t){var s;const n=t.event,r=n.identifier,o=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(r))return;const a=n.timelineStart,c=n.duration;let l=0;o.forEach((p,m)=>{const g=parseFloat(p.DURATION);this.createAsset(n,m,l,a+l,g,p.URI),l+=g}),n.duration=l,this.log(`Loaded asset-list with duration: ${l} (was: ${c}) ${n}`);const u=this.waitingItem,f=(u==null?void 0:u.event.identifier)===r;this.updateSchedule();const h=(s=this.bufferingItem)==null?void 0:s.event;if(f){var d;const p=this.schedule.findEventIndex(r),m=(d=this.schedule.items)==null?void 0:d[p];if(m){if(!this.playingItem&&this.timelinePos>m.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==p){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.primaryFallback(n);return}this.setBufferingItem(m)}this.setSchedulePosition(p)}else if((h==null?void 0:h.identifier)===r&&h.appendInPlace){const p=n.assetList[0],m=this.getAssetPlayer(p.identifier),g=this.primaryMedia;p&&m&&g&&this.bufferAssetPlayer(m,g)}}onError(e,t){switch(t.details){case $.ASSET_LIST_PARSING_ERROR:case $.ASSET_LIST_LOAD_ERROR:case $.ASSET_LIST_LOAD_TIMEOUT:{const s=t.interstitial;s&&this.primaryFallback(s);break}case $.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Sf=500;class Ab extends Oc{constructor(e,t,s){super(e,t,s,"subtitle-stream-controller",Y.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(A.LEVEL_LOADED,this.onLevelLoaded,this),e.on(A.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(A.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(A.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(A.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(A.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(A.LEVEL_LOADED,this.onLevelLoaded,this),e.off(A.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(A.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(A.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(A.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(A.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=V.IDLE,this.setInterval(Sf),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:s,success:n}=t;if(this.fragContextChanged(s)||(De(s)&&(this.fragPrevious=s),this.state=V.IDLE),!n)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let o;const a=s.start;for(let l=0;l<r.length;l++)if(a>=r[l].start&&a<=r[l].end){o=r[l];break}const c=s.start+s.duration;o?o.end=c:(o={start:a,end:c},r.push(o)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:s,endOffset:n}=t;if(s===0&&n!==Number.POSITIVE_INFINITY){const r=n-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=r){o.shift();continue}else if(o[a].start<r)o[a].start=r;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(s,r,Y.SUBTITLE)}}onError(e,t){const s=t.frag;(s==null?void 0:s.type)===Y.SUBTITLE&&(t.details===$.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==V.STOPPED&&(this.state=V.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&E1(this.levels,t)){this.levels=t.map(s=>new an(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const n=new an(s);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Y.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const n=this.levels[this.currentTrackId];n!=null&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==V.STOPPED&&this.setInterval(Sf)}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:n,levels:r}=this,{details:o,id:a}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const c=r[a];if(a>=r.length||!c)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||(s=c.details)!=null&&s.live){if(o.deltaUpdateFailed)return;const f=this.mainDetails;if(!f){this.startFragRequested=!1;return}const h=f.fragments[0];if(!c.details)o.hasProgramDateTime&&f.hasProgramDateTime?(Fr(o,f),l=o.fragmentStart):h&&(l=h.start,Cl(o,l));else{var u;l=this.alignPlaylists(o,c.details,(u=this.levelLastLoaded)==null?void 0:u.details),l===0&&h&&(l=h.start,Cl(o,l))}f&&!this.startFragRequested&&this.setStartPosition(f,l)}c.details=o,this.levelLastLoaded=c,a===n&&(this.hls.trigger(A.SUBTITLE_TRACK_UPDATED,{details:o,id:a,groupId:t.groupId}),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===V.IDLE&&(Hs(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,n=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&n!=null&&n.key&&n.iv&&di(n.method)){const o=performance.now();this.decrypter.decrypt(new Uint8Array(s),n.key.buffer,n.iv.buffer,Fc(n.method)).catch(a=>{throw r.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const c=performance.now();r.trigger(A.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:c}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=V.IDLE})}}doTick(){if(!this.media){this.state=V.IDLE;return}if(this.state===V.IDLE){const{currentTrackId:e,levels:t}=this,s=t==null?void 0:t[e];if(!s||!t.length||!s.details||this.waitForLive(s))return;const{config:n}=this,r=this.getLoadPosition(),o=re.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,n.maxBufferHole),{end:a,len:c}=o,l=s.details,u=this.hls.maxBufferLength+l.levelTargetDuration;if(c>u)return;const f=l.fragments,h=f.length,d=l.edge;let p=null;const m=this.fragPrevious;if(a<d){const v=n.maxFragLookUpTolerance,x=a>d-v?0:v;p=Hs(m,f,Math.max(f[0].start,a),x),!p&&m&&m.start<f[0].start&&(p=f[0])}else p=f[h-1];if(p=this.filterReplacedPrimary(p,s.details),!p)return;const g=p.sn-l.startSN,y=f[g-1];if(y&&y.cc===p.cc&&this.fragmentTracker.getState(y)===ke.NOT_LOADED&&(p=y),this.fragmentTracker.getState(p)===ke.NOT_LOADED){const v=this.mapToInitFragWhenRequired(p);v&&this.loadFragment(v,s,a)}}}loadFragment(e,t,s){De(e)?super.loadFragment(e,t,s):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Sb(this.tracksBuffered[this.currentTrackId]||[])}}class Sb{constructor(e){this.buffered=void 0;const t=(s,n,r)=>{if(n=n>>>0,n>r-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${r})`);return e[n][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}const Tb={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},w1=i=>String.fromCharCode(Tb[i]||i),St=15,Gt=100,bb={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_b={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Ib={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Cb={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Lb=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Db{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;de.log(`${this.time} [${e}] ${s}`)}}}const Ts=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class P1{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let s=0;s<t.length;s++){const n=t[s];e.hasOwnProperty(n)&&(this[n]=e[n])}}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 Rb{constructor(){this.uchar=" ",this.penState=new P1}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 wb{constructor(e){this.chars=[],this.pos=0,this.currPenState=new P1,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Gt;t++)this.chars.push(new Rb);this.logger=e}equals(e){for(let t=0;t<Gt;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Gt;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Gt;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>Gt&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Gt)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s<t+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=w1(e);if(this.pos>=Gt){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<Gt;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let s=0;s<Gt;s++){const n=this.chars[s].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class wo{constructor(e){this.rows=[],this.currRow=St-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<St;t++)this.rows.push(new wb(e));this.logger=e}reset(){for(let e=0;e<St;e++)this.rows[e].clear();this.currRow=St-1}equals(e){let t=!0;for(let s=0;s<St;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<St;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<St;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 = "+Ee(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let a=0;a<St;a++)this.rows[a].clear();const r=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[r].cueStartTime,c=this.logger.time;if(a!==null&&c!==null&&a<c)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(o.rows[r+l])}}this.currRow=t;const s=this.rows[this.currRow];if(e.indent!==null){const r=e.indent,o=Math.max(r-1,0);s.setCursor(e.indent),e.color=s.chars[o].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Ee(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let s="",n=-1;for(let r=0;r<St;r++){const o=this.rows[r].getTextString();o&&(n=r+1,e?t.push("Row "+n+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?s="["+t.join(" | ")+"]":s=t.join(`
- `)),s}getTextAndFormat(){return this.rows}}class Tf{constructor(e,t,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new wo(s),this.nonDisplayedMemory=new wo(s),this.lastOutputScreen=new wo(s),this.currRollUpRow=this.displayedMemory.rows[St-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[St-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const s=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[s]}this.logger.log(2,"MIDROW: "+Ee(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 bf{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=kb(),this.logger=void 0;const n=this.logger=new Db;this.channels=[null,new Tf(e,t,n),new Tf(e+1,s,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let s=0;s<t.length;s+=2){const n=t[s]&127,r=t[s+1]&127;let o=!1,a=null;if(n===0&&r===0)continue;this.logger.log(3,()=>"["+Ts([t[s],t[s+1]])+"] -> ("+Ts([n,r])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(Pb(n,r,c)){Vn(null,null,c),this.logger.log(3,()=>"Repeated command ("+Ts([n,r])+") is dropped");continue}Vn(n,r,this.cmdHistory),o=this.parseCmd(n,r),o||(o=this.parseMidrow(n,r)),o||(o=this.parsePAC(n,r)),o||(o=this.parseBackgroundAttributes(n,r))}else Vn(null,null,c);if(!o&&(a=this.parseChars(n,r),a)){const u=this.currentChannel;u&&u>0?this.channels[u].insertChars(a):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!o&&!a&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Ts([n,r])+" orig: "+Ts([t[s],t[s+1]]))}}parseCmd(e,t){const 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;const r=e===20||e===21||e===23?1:2,o=this.channels[r];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),this.currentChannel=r,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[s];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Ts([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let s;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,r=(e===16||e===24)&&t>=64&&t<=95;if(!(n||r))return!1;const o=e<=23?1:2;t>=64&&t<=95?s=o===1?bb[e]:Ib[e]:s=o===1?_b[e]:Cb[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(s,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let s;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,n.underline=(s&1)===1,s<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((s-16)/2)*4,n}parseChars(e,t){let s,n=null,r=null;if(e>=25?(s=2,r=e-8):(s=1,r=e),r>=17&&r<=19){let o;r===17?o=t+80:r===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+w1(o)+"' in channel "+s),n=[o]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+Ts(n).join(",")),n}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(s||n))return!1;let r;const o={};e===16||e===24?(r=Math.floor((t-32)/2),o.background=Lb[r],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(o),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Vn(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const s=this.channels[t];s&&s.cueSplitAtTime(e)}}}function Vn(i,e,t){t.a=i,t.b=e}function Pb(i,e,t){return t.a===i&&t.b===e}function kb(){return{a:null,b:null}}var Wc=function(){if(Br!=null&&Br.VTTCue)return self.VTTCue;const i=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,c){if(typeof c!="string"||!Array.isArray(a))return!1;const l=c.toLowerCase();return~a.indexOf(l)?l:!1}function s(a){return t(i,a)}function n(a){return t(e,a)}function r(a,...c){let l=1;for(;l<arguments.length;l++){const u=arguments[l];for(const f in u)a[f]=u[f]}return a}function o(a,c,l){const u=this,f={enumerable:!0};u.hasBeenReset=!1;let h="",d=!1,p=a,m=c,g=l,y=null,v="",x=!0,E="auto",S="start",T=50,_="middle",I=50,R="middle";Object.defineProperty(u,"id",r({},f,{get:function(){return h},set:function(b){h=""+b}})),Object.defineProperty(u,"pauseOnExit",r({},f,{get:function(){return d},set:function(b){d=!!b}})),Object.defineProperty(u,"startTime",r({},f,{get:function(){return p},set:function(b){if(typeof b!="number")throw new TypeError("Start time must be set to a number.");p=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",r({},f,{get:function(){return m},set:function(b){if(typeof b!="number")throw new TypeError("End time must be set to a number.");m=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",r({},f,{get:function(){return g},set:function(b){g=""+b,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",r({},f,{get:function(){return y},set:function(b){y=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",r({},f,{get:function(){return v},set:function(b){const L=s(b);if(L===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",r({},f,{get:function(){return x},set:function(b){x=!!b,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",r({},f,{get:function(){return E},set:function(b){if(typeof b!="number"&&b!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");E=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",r({},f,{get:function(){return S},set:function(b){const L=n(b);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");S=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",r({},f,{get:function(){return T},set:function(b){if(b<0||b>100)throw new Error("Position must be between 0 and 100.");T=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",r({},f,{get:function(){return _},set:function(b){const L=n(b);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");_=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",r({},f,{get:function(){return I},set:function(b){if(b<0||b>100)throw new Error("Size must be between 0 and 100.");I=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",r({},f,{get:function(){return R},set:function(b){const L=n(b);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");R=L,this.hasBeenReset=!0}})),u.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class Bb{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function k1(i){function e(s,n,r,o){return(s|0)*3600+(n|0)*60+(r|0)+parseFloat(o||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 Fb{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let n=0;n<s.length;++n)if(t===s[n]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const s=parseFloat(t);if(s>=0&&s<=100)return this.set(e,s),!0}return!1}}function B1(i,e,t,s){const n=s?i.split(s):[i];for(const r in n){if(typeof n[r]!="string")continue;const o=n[r].split(t);if(o.length!==2)continue;const a=o[0],c=o[1];e(a,c)}}const Bl=new Wc(0,0,""),jn=Bl.align==="middle"?"middle":"center";function Ob(i,e,t){const s=i;function n(){const a=k1(i);if(a===null)throw new Error("Malformed timestamp: "+s);return i=i.replace(/^[^\sa-zA-Z-]+/,""),a}function r(a,c){const l=new Fb;B1(a,function(h,d){let p;switch(h){case"region":for(let m=t.length-1;m>=0;m--)if(t[m].id===d){l.set(h,t[m].region);break}break;case"vertical":l.alt(h,d,["rl","lr"]);break;case"line":p=d.split(","),l.integer(h,p[0]),l.percent(h,p[0])&&l.set("snapToLines",!1),l.alt(h,p[0],["auto"]),p.length===2&&l.alt("lineAlign",p[1],["start",jn,"end"]);break;case"position":p=d.split(","),l.percent(h,p[0]),p.length===2&&l.alt("positionAlign",p[1],["start",jn,"end","line-left","line-right","auto"]);break;case"size":l.percent(h,d);break;case"align":l.alt(h,d,["start",jn,"end","left","right"]);break}},/:/,/\s/),c.region=l.get("region",null),c.vertical=l.get("vertical","");let u=l.get("line","auto");u==="auto"&&Bl.line===-1&&(u=-1),c.line=u,c.lineAlign=l.get("lineAlign","start"),c.snapToLines=l.get("snapToLines",!0),c.size=l.get("size",100),c.align=l.get("align",jn);let f=l.get("position","auto");f==="auto"&&Bl.position===50&&(f=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=f}function o(){i=i.replace(/^\s+/,"")}if(o(),e.startTime=n(),o(),i.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);i=i.slice(3),o(),e.endTime=n(),o(),r(i,e)}function F1(i){return i.replace(/<br(?: \/)?>/gi,`
- `)}class Mb{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Bb,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function s(){let r=t.buffer,o=0;for(r=F1(r);o<r.length&&r[o]!=="\r"&&r[o]!==`
- `;)++o;const a=r.slice(0,o);return r[o]==="\r"&&++o,r[o]===`
- `&&++o,t.buffer=r.slice(o),a}function n(r){B1(r,function(o,a){},/:/)}try{let r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;r=s();const a=r.match(/^()?WEBVTT([ \t].*)?$/);if(!(a!=null&&a[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:r=s(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new Wc(0,0,""),t.state="CUE",r.indexOf("-->")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Ob(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=r.indexOf("-->")!==-1;if(!r||a&&(o=!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+=`
- `),t.cue.text+=r}continue;case"BADCUE":r||(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+=`
- `,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 Nb=/\r\n|\n\r|\n|\r/g,Po=function(e,t,s=0){return e.slice(s,s+t.length)===t},Ub=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!j(t)||!j(s)||!j(n)||!j(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*n,t+=60*60*1e3*r,t};function zc(i,e,t){return zi(i.toString())+zi(e.toString())+zi(t)}const $b=function(e,t,s){let n=e[t],r=e[n.prevCC];if(!r||!r.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(o=r)!=null&&o.new;){var o;e.ccOffset+=n.start-r.start,n.new=!1,n=r,r=e[n.prevCC]}e.presentationOffset=s};function Hb(i,e,t,s,n,r,o){const a=new Mb,c=ct(new Uint8Array(i)).trim().replace(Nb,`
- `).split(`
- `),l=[],u=e?s5(e.baseTime,e.timescale):0;let f="00:00.000",h=0,d=0,p,m=!0;a.oncue=function(g){const y=t[s];let v=t.ccOffset;const x=(h-u)/9e4;if(y!=null&&y.new&&(d!==void 0?v=t.ccOffset=y.start:$b(t,s,x)),x){if(!e){p=new Error("Missing initPTS for VTT MPEGTS");return}v=x-t.presentationOffset}const E=g.endTime-g.startTime,S=pt((g.startTime+v-d)*9e4,n*9e4)/9e4;g.startTime=Math.max(S,0),g.endTime=Math.max(S+E,0);const T=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(T)),g.id||(g.id=zc(g.startTime,g.endTime,T)),g.endTime>0&&l.push(g)},a.onparsingerror=function(g){p=g},a.onflush=function(){if(p){o(p);return}r(l)},c.forEach(g=>{if(m)if(Po(g,"X-TIMESTAMP-MAP=")){m=!1,g.slice(16).split(",").forEach(y=>{Po(y,"LOCAL:")?f=y.slice(6):Po(y,"MPEGTS:")&&(h=parseInt(y.slice(7)))});try{d=Ub(f)/1e3}catch(y){p=y}return}else g===""&&(m=!1);a.parse(g+`
- `)}),a.flush()}const ko="stpp.ttml.im1t",O1=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M1=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Gb={left:"start",center:"center",right:"end",start:"start",end:"end"};function _f(i,e,t,s){const n=ae(new Uint8Array(i),["mdat"]);if(n.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const r=n.map(a=>ct(a)),o=t5(e.baseTime,1,e.timescale);try{r.forEach(a=>t(Kb(a,o)))}catch(a){s(a)}}function Kb(i,e){const n=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(r).reduce((f,h)=>(f[h]=n.getAttribute(`ttp:${h}`)||r[h],f),{}),a=n.getAttribute("xml:space")!=="preserve",c=If(Bo(n,"styling","style")),l=If(Bo(n,"layout","region")),u=Bo(n,"body","[begin]");return[].map.call(u,f=>{const h=N1(f,a);if(!h||!f.hasAttribute("begin"))return null;const d=Oo(f.getAttribute("begin"),o),p=Oo(f.getAttribute("dur"),o);let m=Oo(f.getAttribute("end"),o);if(d===null)throw Cf(f);if(m===null){if(p===null)throw Cf(f);m=d+p}const g=new Wc(d-e,m-e,h);g.id=zc(g.startTime,g.endTime,g.text);const y=l[f.getAttribute("region")],v=c[f.getAttribute("style")],x=Vb(y,v,c),{textAlign:E}=x;if(E){const S=Gb[E];S&&(g.lineAlign=S),g.align=E}return ge(g,x),g}).filter(f=>f!==null)}function Bo(i,e,t){const s=i.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function If(i){return i.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function N1(i,e){return[].slice.call(i.childNodes).reduce((t,s,n)=>{var r;return s.nodeName==="br"&&n?t+`
- `:(r=s.childNodes)!=null&&r.length?N1(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function Vb(i,e,t){const s="http://www.w3.org/ns/ttml#styling";let n=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=i!=null&&i.hasAttribute("style")?i.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(n=t[o]),r.reduce((a,c)=>{const l=Fo(e,s,c)||Fo(i,s,c)||Fo(n,s,c);return l&&(a[c]=l),a},{})}function Fo(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function Cf(i){return new Error(`Could not parse ttml timestamp ${i}`)}function Oo(i,e){if(!i)return null;let t=k1(i);return t===null&&(O1.test(i)?t=jb(i,e):M1.test(i)&&(t=qb(i,e))),t}function jb(i,e){const t=O1.exec(i),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function qb(i,e){const t=M1.exec(i),s=Number(t[1]);switch(t[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}class qn{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class Wb{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=Df(),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(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(A.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(A.FRAG_LOADING,this.onFragLoading,this),e.on(A.FRAG_LOADED,this.onFragLoaded,this),e.on(A.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(A.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(A.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(A.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(A.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(A.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(A.FRAG_LOADING,this.onFragLoading,this),e.off(A.FRAG_LOADED,this.onFragLoaded,this),e.off(A.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(A.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(A.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(A.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(A.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new qn(this,"textTrack1"),t=new qn(this,"textTrack2"),s=new qn(this,"textTrack3"),n=new qn(this,"textTrack4");this.cea608Parser1=new bf(1,e,t),this.cea608Parser2=new bf(3,s,n)}addCues(e,t,s,n,r){let o=!1;for(let a=r.length;a--;){const c=r[a],l=zb(c[0],c[1],t,s);if(l>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],s),o=!0,l/(s-t)>.5))return}if(o||r.push([t,s]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,s,n)}else{const a=this.Cues.newCue(null,t,s,n);this.hls.trigger(A.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:n,timescale:r}){const{unparsedVttFrags:o}=this;s===Y.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.initPTS[a.frag.cc]?this.onFragLoaded(A.FRAG_LOADED,a):this.hls.trigger(A.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:s}=this;if(s)for(let n=0;n<s.textTracks.length;n++){const r=s.textTracks[n];if(Lf(r,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:s,media:n}=this,{label:r,languageCode:o}=t[e],a=this.getExistingTrack(r,o);if(a)s[e]=a,ci(s[e]),L1(s[e],n);else{const c=this.createTextTrack("captions",r,o);c&&(c[e]=!0,s[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const s=t.label,n={_id:e,label:s,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(A.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,s){const n=this.media;if(n)return n.addTextTrack(e,t,s)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const s=!!t.transferMedia;if(this.media=null,s)return;const{captionsTracks:n}=this;Object.keys(n).forEach(r=>{ci(n[r]),delete n[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Df(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let s=0;s<t.length;s++)ci(t[s])}onSubtitleTracksUpdated(e,t){const s=t.subtitleTracks||[],n=s.some(r=>r.textCodec===ko);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(E1(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const o=this.media,a=o?lr(o.textTracks):null;if(this.tracks.forEach((c,l)=>{let u;if(a){let f=null;for(let h=0;h<a.length;h++)if(a[h]&&Lf(a[h],c)){f=a[h],a[h]=null;break}f&&(u=f)}if(u)ci(u);else{const f=U1(c);u=this.createTextTrack(f,c.name,c.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),a!=null&&a.length){const c=a.filter(l=>l!==null).map(l=>l.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(A.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const n=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!n)return;const r=`textTrack${n[1]}`,o=this.captionsProperties[r];o&&(o.label=s.name,s.lang&&(o.languageCode=s.lang),o.media=s)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Y.MAIN){var s,n;const{cea608Parser1:r,cea608Parser2:o,lastSn:a}=this,{cc:c,sn:l}=t.frag,u=(s=(n=t.part)==null?void 0:n.index)!=null?s:-1;r&&o&&(l!==a+1||l===a&&u!==this.lastPartIndex+1||c!==this.lastCc)&&(r.reset(),o.reset()),this.lastCc=c,this.lastSn=l,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:s,payload:n}=t;if(s.type===Y.SUBTITLE)if(n.byteLength){const r=s.decryptdata,o="stats"in t;if(r==null||!r.encrypted||o){const a=this.tracks[s.level],c=this.vttCCs;c[s.cc]||(c[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),a&&a.textCodec===ko?this._parseIMSC1(s,n):this._parseVTTs(t)}}else this.hls.trigger(A.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;_f(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),s.trigger(A.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{s.logger.log(`Failed to parse IMSC1: ${n}`),s.trigger(A.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:s,payload:n}=e,{initPTS:r,unparsedVttFrags:o}=this,a=r.length-1;if(!r[s.cc]&&a===-1){o.push(e);return}const c=this.hls,l=(t=s.initSegment)!=null&&t.data?xt(s.initSegment.data,new Uint8Array(n)).buffer:n;Hb(l,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,u=>{this._appendCues(u,s.level),c.trigger(A.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},u=>{const f=u.message==="Missing initPTS for VTT MPEGTS";f?o.push(e):this._fallbackToIMSC1(s,n),c.logger.log(`Failed to parse VTT cue: ${u}`),!(f&&a>s.cc)&&c.trigger(A.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:u})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||_f(t,this.initPTS[e.cc],()=>{s.textCodec=ko,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(r=>D1(n,r))}else{const n=this.tracks[t];if(!n)return;const r=n.default?"default":"subtitles"+t;s.trigger(A.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===Y.SUBTITLE&&this.onFragLoaded(A.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:s,samples:n}=t;if(!(s.type===Y.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let r=0;r<n.length;r++){const o=n[r].bytes;if(o){this.cea608Parser1||this.initCea608Parsers();const a=this.extractCea608Data(o);this.cea608Parser1.addData(n[r].pts,a[0]),this.cea608Parser2.addData(n[r].pts,a[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:s,endOffsetSubtitles:n,type:r}){const{media:o}=this;if(!(!o||o.currentTime<s)){if(!r||r==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(c=>kl(a[c],t,s))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(c=>kl(a[c],t,n))}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let n=2;for(let r=0;r<s;r++){const o=e[n++],a=127&e[n++],c=127&e[n++];if(a===0&&c===0)continue;if((4&o)!==0){const u=3&o;(u===0||u===1)&&(t[u].push(a),t[u].push(c))}}return t}}function U1(i){return i.characteristics&&/transcribes-spoken-dialog/gi.test(i.characteristics)&&/describes-music-and-sound/gi.test(i.characteristics)?"captions":"subtitles"}function Lf(i,e){return!!i&&i.kind===U1(e)&&Rl(e,i)}function zb(i,e,t,s){return Math.min(e,s)-Math.max(i,t)}function Df(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const Qb=/\s/,Yb={newCue(i,e,t,s){const n=[];let r,o,a,c,l;const u=self.VTTCue||self.TextTrackCue;for(let h=0;h<s.rows.length;h++)if(r=s.rows[h],a=!0,c=0,l="",!r.isEmpty()){var f;for(let m=0;m<r.chars.length;m++)Qb.test(r.chars[m].uchar)&&a?c++:(l+=r.chars[m].uchar,a=!1);r.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const d=F1(l.trim()),p=zc(e,t,d);i!=null&&(f=i.cues)!=null&&f.getCueById(p)||(o=new u(e,t,d),o.id=p,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(c*8/32)*10),n.push(o))}return i&&n.length&&(n.sort((h,d)=>h.line==="auto"||d.line==="auto"?0:h.line>8&&d.line>8?d.line-h.line:h.line-d.line),n.forEach(h=>D1(i,h))),n}};function Xb(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const Jb=/(\d+)-(\d+)\/(\d+)/;class Rf{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||s9,this.controller=new self.AbortController,this.stats=new Lc}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const r=Zb(e,this.controller.signal),o=e.responseType==="arraybuffer",a=o?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=c&&j(c)?c:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(fn(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var h;this.response=this.loader=f;const d=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},l-(d-n.loading.start)),!f.ok){const{status:m,statusText:g}=f;throw new i9(g||"fetch, bad network response",m,f)}n.loading.first=d,n.total=t9(f.headers)||n.total;const p=(h=this.callbacks)==null?void 0:h.onProgress;return p&&j(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,p):o?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var h,d;const p=this.response;if(!p)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const m=f[a];m&&(n.loaded=n.total=m);const g={url:p.url,data:f,code:p.status},y=(h=this.callbacks)==null?void 0:h.onProgress;y&&!j(t.highWaterMark)&&y(n,e,f,p),(d=this.callbacks)==null||d.onSuccess(g,n,e,p)}).catch(f=>{var h;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const d=f&&f.code||0,p=f?f.message:null;(h=this.callbacks)==null||h.onError({code:d,text:p},e,f?f.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,s,n=0,r){const o=new e1,a=e.body.getReader(),c=()=>a.read().then(l=>{if(l.done)return o.dataLength&&r(t,s,o.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const u=l.value,f=u.length;return t.loaded+=f,f<n||o.dataLength?(o.push(u),o.dataLength>=n&&r(t,s,o.flush().buffer,e)):r(t,s,u.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function Zb(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ge({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function e9(i){const e=Jb.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function t9(i){const e=i.get("Content-Range");if(e){const s=e9(e);if(j(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function s9(i,e){return new self.Request(i.url,e)}class i9 extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const n9=/^age:\s*[\d.]+\s*$/im;class $1{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 Lc,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return r(s,t.url)}).catch(o=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",t.url,!0),r(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(o=>{var a;(a=this.callbacks)==null||a.onError({code:s.status,text:o.message},t,s,n)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const n=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:o}=s.loadPolicy;if(n)for(const a in n)e.setRequestHeader(a,n[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=r&&j(r)?r:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const n=t.readyState,r=this.config;if(!s.aborted&&n>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),n===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const l=t.status,u=t.responseType==="text"?t.responseText:null;if(l>=200&&l<300){const p=u??t.response;if(p!=null){var o,a;s.loading.end=Math.max(self.performance.now(),s.loading.first);const m=t.responseType==="arraybuffer"?p.byteLength:p.length;s.loaded=s.total=m,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const g=(o=this.callbacks)==null?void 0:o.onProgress;g&&g(s,e,p,t);const y={url:t.responseURL,data:p,code:l};(a=this.callbacks)==null||a.onSuccess(y,s,e,t);return}}const f=r.loadPolicy.errorRetry,h=s.retry,d={url:e.url,data:void 0,code:l};if(kr(f,h,!1,d))this.retry(f);else{var c;de.error(`${l} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:l,text:t.statusText},e,t,s)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(kr(e,t,!0))this.retry(e);else{var s;de.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:s}=this;this.retryDelay=Pc(e,s.retry),s.retry++,de.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&n9.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const r9={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},o9=xe(xe({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:$1,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:L6,bufferController:x5,capLevelController:jc,errorController:k6,fpsController:cb,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:Vg,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:r9},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},a9()),{},{subtitleStreamController:Ab,subtitleTrackController:hb,timelineController:Wb,audioStreamController:d5,audioTrackController:p5,emeController:pi,cmcdController:ob,contentSteeringController:lb,interstitialsController:Eb});function a9(){return{cueHandler:Yb,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 l9(i,e,t){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 s=Fl(i),n=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(o=>{const a=`${o==="level"?"playlist":o}LoadPolicy`,c=e[a]===void 0,l=[];r.forEach(u=>{const f=`${o}Loading${u}`,h=e[f];if(h!==void 0&&c){l.push(f);const d=s[a].default;switch(e[a]={default:d},u){case"TimeOut":d.maxLoadTimeMs=h,d.maxTimeToFirstByteMs=h;break;case"MaxRetry":d.errorRetry.maxNumRetry=h,d.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":d.errorRetry.retryDelayMs=h,d.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":d.errorRetry.maxRetryDelayMs=h,d.timeoutRetry.maxRetryDelayMs=h;break}}}),l.length&&t.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${a}": ${Ee(e[a])}`)}),xe(xe({},s),e)}function Fl(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(Fl):Object.keys(i).reduce((e,t)=>(e[t]=Fl(i[t]),e),{}):i}function c9(i,e){const t=i.loader;t!==Rf&&t!==$1?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):Xb()&&(i.loader=Rf,i.progressive=!0,i.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const cr=2,u9=.1,f9=.05,h9=100;class d9 extends $g{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(A.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(A.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(A.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(h9),this.mediaSource=t.mediaSource;const s=this.media=t.media;gt(s,"playing",this.onMediaPlaying),gt(s,"waiting",this.onMediaWaiting),gt(s,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:s}=this;s&&(bt(s,"playing",this.onMediaPlaying),bt(s,"waiting",this.onMediaWaiting),bt(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var s,n;const r=(s=this.hls)==null?void 0:s.config;if(!r)return;const o=this.media;if(!o)return;const{seeking:a}=o,c=this.seeking&&!a,l=!this.seeking&&a,u=o.paused&&!a||o.ended||o.playbackRate===0;if(this.seeking=a,e!==t){t&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(l||c){c&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&o.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(A.MEDIA_ENDED,{stalled:!1}));return}if(!re.getBuffered(o).length){this.nudgeRetry=0;return}const f=re.bufferInfo(o,e,0),h=f.nextStart||0,d=this.fragmentTracker;if(a&&d&&this.hls){const T=wf(this.hls.inFlightFragments,e),_=f.len>cr,I=!h||T||h-e>cr&&!d.getPartialFragment(e);if(_||I)return;this.moved=!1}const p=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&d){if(!(f.len>0)&&!h)return;const _=Math.max(h,f.start||0)-e,R=!!(p!=null&&p.live)?p.targetduration*2:cr,b=d.getPartialFragment(e);if(_>0&&(_<=R||b)){o.paused||this._trySkipBufferHole(b);return}}const m=r.detectStallWithCurrentTimeMs,g=self.performance.now(),y=this.waiting;let v=this.stalled;if(v===null)if(y>0&&g-y<m)v=this.stalled=y;else{this.stalled=g;return}const x=g-v;if(!a&&(x>=m||y)&&this.hls){var E;if(((E=this.mediaSource)==null?void 0:E.readyState)==="ended"&&!(p!=null&&p.live)&&Math.abs(e-((p==null?void 0:p.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(A.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return}const S=re.bufferInfo(o,e,r.maxBufferHole);this._tryFixBufferStall(S,x,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(A.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var s;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&n&&n.length>1&&e>n.end(0)){const r=re.bufferedInfo(re.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){const o=re.timeRangesToArray(n),a=re.bufferedInfo(o,t,0).bufferedIndex;if(a>-1&&a<o.length-1){const c=re.bufferedInfo(o,e,0).bufferedIndex,l=o[a].end,u=o[a+1].start;if((c===-1||c>a)&&u-l<1&&e-l<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${l} -> ${u} buffered index: ${c}`);this.warn(f.message),this.media.currentTime+=1e-6;const h=this.fragmentTracker.getPartialFragment(e)||void 0,d=re.bufferInfo(this.media,e,0);this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:h,buffer:d.len,bufferInfo:d})}}}}}_tryFixBufferStall(e,t,s){var n,r;const{fragmentTracker:o,media:a}=this,c=(n=this.hls)==null?void 0:n.config;if(!a||!o||!c)return;const l=(r=this.hls)==null?void 0:r.latestLevelDetails,u=o.getPartialFragment(s);if((u||l!=null&&l.live&&s<l.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;const f=e.buffered,h=this.adjacentTraversal(e,s);(f&&f.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-s<c.maxBufferHole||h))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const s=this.fragmentTracker,n=e.nextStart;if(s&&n){const r=s.getFragAtPos(t,Y.MAIN),o=s.getFragAtPos(n,Y.MAIN);if(r&&o)return o.sn-r.sn<2}return!1}_reportStall(e){const{hls:t,media:s,stallReported:n,stalled:r}=this;if(!n&&r!==null&&s&&t){this.stallReported=!0;const o=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${Ee(e)})`);this.warn(o.message),t.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:s,media:n}=this,r=(t=this.hls)==null?void 0:t.config;if(!n||!s||!r)return 0;const o=n.currentTime,a=re.bufferInfo(n,o,0),c=o<a.start?a.start:a.nextStart;if(c&&this.hls){const u=a.len<=r.maxBufferHole,f=a.len>0&&a.len<1&&n.readyState<3,h=c-o;if(h>0&&(u||f)){if(h>r.maxBufferHole){let p=!1;if(o===0){const m=s.getAppendedFrag(0,Y.MAIN);m&&c<m.end&&(p=!0)}if(!p){const m=e||s.getAppendedFrag(o,Y.MAIN);if(m){var l;if(!((l=this.hls.loadLevelObj)!=null&&l.details)||wf(this.hls.inFlightFragments,c))return 0;let y=!1,v=m.end;for(;v<c;){const x=s.getAppendedFrag(v,Y.MAIN)||s.getPartialFragment(v);if(x)v+=x.duration;else{y=!0;break}}if(y)return 0}}}const d=Math.max(c+f9,o+u9);if(this.warn(`skipping hole, adjusting currentTime from ${o} to ${d}`),this.moved=!0,n.currentTime=d,!(e!=null&&e.gap)){const p=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${d}`);this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:p,reason:p.message,frag:e||void 0,buffer:a.len,bufferInfo:a})}return d}}return 0}_tryNudgeBuffer(e){const{hls:t,media:s,nudgeRetry:n}=this,r=t==null?void 0:t.config;if(!s||!r)return 0;const o=s.currentTime;if(this.nudgeRetry++,n<r.nudgeMaxRetry){const a=o+(n+1)*r.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${o} to ${a}`);this.warn(c.message),s.currentTime=a,t.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const a=new Error(`Playhead still not moving while enough data buffered @${o} after ${r.nudgeMaxRetry} nudges`);this.error(a.message),t.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:a,fatal:!0,buffer:e.len,bufferInfo:e})}}}function wf(i,e){const t=Pf(i.main);if(t&&t.start<=e)return t;const s=Pf(i.audio);return s&&s.start<=e?s:null}function Pf(i){if(!i)return null;switch(i.state){case V.IDLE:case V.STOPPED:case V.ENDED:case V.ERROR:return null}return i.frag}const p9=.25;function Ol(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function kf(i,e,t,s,n){let r=new i(e,t,"");try{r.value=s,n&&(r.type=n)}catch{r=new i(e,t,Ee(n?xe({type:n},s):s))}return r}const Wn=(()=>{const i=Ol();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class g9{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(A.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e.on(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(A.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(A.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(A.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(A.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(A.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(A.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(A.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}onMediaAttaching(e,t){var s;this.media=t.media,((s=t.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&ci(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const s=e[t];if(s.kind==="metadata"&&s.label==="id3")return L1(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:n}}}=this;if(!s&&!n)return;const{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Ol();if(o)for(let a=0;a<r.length;a++){const c=r[a].type;if(c===lt.emsg&&!s||!n)continue;const l=a1(r[a].data);if(l){const u=r[a].pts;let f=u+r[a].duration;f>Wn&&(f=Wn),f-u<=0&&(f=u+p9);for(let d=0;d<l.length;d++){const p=l[d];if(!l1(p)){this.updateId3CueEnds(u,c);const m=kf(o,u,f,p,c);m&&this.id3Track.addCue(m)}}}}}updateId3CueEnds(e,t){var s;const n=(s=this.id3Track)==null?void 0:s.cues;if(n)for(let r=n.length;r--;){const o=n[r];o.type===t&&o.startTime<e&&o.endTime===Wn&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:s,type:n}){const{id3Track:r,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:c}}=o;if(r&&(a||c)){let l;n==="audio"?l=u=>u.type===lt.audioId3&&c:n==="video"?l=u=>u.type===lt.emsg&&a:l=u=>u.type===lt.audioId3&&c||u.type===lt.emsg&&a,kl(r,t,s,l)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:s}=this,{dateRanges:n}=e,r=Object.keys(n);let o=this.dateRangeCuesAppended;if(s&&t){var a;if((a=s.cues)!=null&&a.length){const u=Object.keys(o).filter(f=>!r.includes(f));for(let f=u.length;f--;){const h=u[f],d=o[h].cues;delete o[h],Object.keys(d).forEach(p=>{try{const m=d[p];m.removeEventListener("enter",this.onEventCueEnter),s.removeCue(m)}catch{}})}}else o=this.dateRangeCuesAppended={}}const c=e.fragments[e.fragments.length-1];if(r.length===0||!j(c==null?void 0:c.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=Ol();for(let u=0;u<r.length;u++){const f=r[u],h=n[f],d=h.startTime,p=o[f],m=(p==null?void 0:p.cues)||{};let g=(p==null?void 0:p.durationKnown)||!1,y=Wn;const{duration:v,endDate:x}=h;if(x&&v!==null)y=d+v,g=!0;else if(h.endOnNext&&!g){const S=r.reduce((T,_)=>{if(_!==h.id){const I=n[_];if(I.class===h.class&&I.startDate>h.startDate&&(!T||h.startDate<T.startDate))return I}return T},null);S&&(y=S.startTime,g=!0)}const E=Object.keys(h.attr);for(let S=0;S<E.length;S++){const T=E[S];if(!q6(T))continue;const _=m[T];if(_)g&&!p.durationKnown?_.endTime=y:Math.abs(_.startTime-d)>.01&&(_.startTime=d,_.endTime=y);else if(l){let I=h.attr[T];W6(T)&&(I=bg(I));const b=kf(l,d,y,{key:T,data:I},lt.dateRange);b&&(b.id=f,this.id3Track.addCue(b),m[T]=b,this.hls.config.interstitialsController&&(T==="X-ASSET-LIST"||T==="X-ASSET-URL")&&b.addEventListener("enter",this.onEventCueEnter))}}o[f]={cues:m,dateRange:h,durationKnown:g}}}}class m9{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,s=this.levelDetails;if(!t||!s)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:o}=this.config;if(!r||o===1||!s.live)return;const a=this.targetLatency;if(a===null)return;const c=n-a,l=Math.min(this.maxLatency,a+s.targetduration);if(c<l&&c>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,o)),h=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,d=Math.min(f,Math.max(1,h));this.changeMediaPlaybackRate(t,d)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:s,targetduration:n}=e,{liveSyncDuration:r,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,c=this.hls.userConfig;let l=a&&s||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||l===0)&&(l=r!==void 0?r:o*n);const u=n;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const s=this.levelDetails;if(s===null)return null;const n=s.edge,r=e-t-this.edgeStalled,o=n-s.totalduration,a=n-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(o,r),a)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;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}=this,t=this.levelDetails;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(A.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(A.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(A.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(A.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var s;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var s,n;e.playbackRate!==t&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(n=this.targetLatency)==null?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class x9 extends Vc{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(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(A.LEVEL_LOADED,this.onLevelLoaded,this),e.on(A.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(A.FRAG_BUFFERED,this.onFragBuffered,this),e.on(A.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(A.LEVEL_LOADED,this.onLevelLoaded,this),e.off(A.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(A.FRAG_BUFFERED,this.onFragBuffered,this),e.off(A.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const s=this.hls.config.preferManagedMediaSource,n=[],r={},o={};let a=!1,c=!1,l=!1;t.levels.forEach(u=>{const f=u.attrs;let{audioCodec:h,videoCodec:d}=u;h&&(u.audioCodec=h=Dr(h,s)||void 0),d&&(d=u.videoCodec=f6(d));const{width:p,height:m,unknownCodecs:g}=u;let y=g?g.length:0;if(g)for(let b=y;b--;){const L=g[b];this.isAudioSupported(L)?(u.audioCodec=h=h?`${h},${L}`:L,y--,Ei.audio[h.substring(0,4)]=2):this.isVideoSupported(L)&&(u.videoCodec=d=d?`${d},${L}`:L,y--,Ei.video[d.substring(0,4)]=2)}if(a||(a=!!(p&&m)),c||(c=!!d),l||(l=!!h),y||h&&!this.isAudioSupported(h)||d&&!this.isVideoSupported(d)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:v,"FRAME-RATE":x,"HDCP-LEVEL":E,"PATHWAY-ID":S,RESOLUTION:T,"VIDEO-RANGE":_}=f,R=`${`${S||"."}-`}${u.bitrate}-${T}-${x}-${v}-${_}-${E}`;if(r[R])if(r[R].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const b=o[R]+=1;u.attrs["PATHWAY-ID"]=new Array(b+1).join(".");const L=this.createLevel(u);r[R]=L,n.push(L)}else r[R].addGroupId("audio",f.AUDIO),r[R].addGroupId("text",f.SUBTITLES);else{const b=this.createLevel(u);r[R]=b,o[R]=1,n.push(b)}}),this.filterAndSortMediaOptions(n,t,a,c,l)}createLevel(e){const t=new an(e),s=e.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){const n=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(n.message),t.supportedResult=Bg(n,[])}return t}isAudioSupported(e){return El(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return El(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,s,n,r){let o=[],a=[],c=e;if((s||n)&&r&&(c=c.filter(({videoCodec:g,videoRange:y,width:v,height:x})=>(!!g||!!(v&&x))&&v6(y))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let g="no level with compatible codecs found in manifest",y=g;t.levels.length&&(y=`one or more CODECS in variant not supported: ${Ee(t.levels.map(x=>x.attrs.CODECS).filter((x,E,S)=>S.indexOf(x)===E))}`,this.warn(y),g+=` (${y})`);const v=new Error(g);this.hls.trigger(A.ERROR,{type:Z.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:v,reason:y})}});return}t.audioTracks&&(o=t.audioTracks.filter(g=>!g.audioCodec||this.isAudioSupported(g.audioCodec)),Bf(o)),t.subtitles&&(a=t.subtitles,Bf(a));const l=c.slice(0);c.sort((g,y)=>{if(g.attrs["HDCP-LEVEL"]!==y.attrs["HDCP-LEVEL"])return(g.attrs["HDCP-LEVEL"]||"")>(y.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&g.height!==y.height)return g.height-y.height;if(g.frameRate!==y.frameRate)return g.frameRate-y.frameRate;if(g.videoRange!==y.videoRange)return Rr.indexOf(g.videoRange)-Rr.indexOf(y.videoRange);if(g.videoCodec!==y.videoCodec){const v=_0(g.videoCodec),x=_0(y.videoCodec);if(v!==x)return x-v}if(g.uri===y.uri&&g.codecSet!==y.codecSet){const v=Lr(g.codecSet),x=Lr(y.codecSet);if(v!==x)return x-v}return g.averageBitrate!==y.averageBitrate?g.averageBitrate-y.averageBitrate:0});let u=l[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==l.length)){for(let g=0;g<l.length;g++)if(l[g].pathwayId===c[0].pathwayId){u=l[g];break}}this._levels=c;for(let g=0;g<c.length;g++)if(c[g]===u){var f;this._firstLevel=g;const y=u.bitrate,v=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${y}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const x=Math.min(y,this.hls.config.abrEwmaDefaultEstimateMax);x>v&&v===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=x)}break}const h=r&&!n,d=this.hls.config,p=!!(d.audioStreamController&&d.audioTrackController),m={levels:c,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:n,altAudio:p&&!h&&o.some(g=>!!g.url)};this.hls.trigger(A.MANIFEST_PARSED,m)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const u=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:u,reason:u.message}),f)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,n=this.currentLevel,r=n?n.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,s===e&&n&&r===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${s}${r?" with Pathway "+r:""}`);const c={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(A.LEVEL_SWITCHING,c);const l=o.details;if(!l||l.live){const u=this.switchParams(o.uri,n==null?void 0:n.details,l);this.loadPlaylist(u)}}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}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),s=e.filter(n=>t.indexOf(n)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=s}}onError(e,t){t.fatal||!t.context||t.context.type===ce.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Y.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(r=>!!s[r]))return;const n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var s;const{level:n,details:r}=t,o=t.levelInfo;if(!o){var a;this.warn(`Invalid level index ${n}`),(a=t.deliveryDirectives)!=null&&a.skip&&(r.deltaUpdateFailed=!0);return}if(o===this.currentLevel||t.withoutMultiVariant){o.fragmentError===0&&(o.loadError=0);let c=o.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(n,t,c)}else(s=t.deliveryDirectives)!=null&&s.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],o=e.details,a=o==null?void 0:o.age;this.log(`Loading level index ${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${r?" Pathway "+r:""}${a&&o.live?" age "+a.toFixed(1)+(o.type&&" "+o.type||""):""} ${s}`),this.hls.trigger(A.LEVEL_LOADING,{url:s,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||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;if(this._levels.length===1)return;const s=this._levels.filter((r,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(a=>a.level=-1)),!1));Xg(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=s.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(A.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(A.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Bf(i){const e={};i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}function H1(){return self.SourceBuffer||self.WebKitSourceBuffer}function G1(){if(!vs())return!1;const e=H1();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function y9(){if(!G1())return!1;const i=vs();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(on(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(on(e,"audio"))))}function v9(){var i;const e=H1();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const E9=100;class A9 extends Oc{constructor(e,t,s){super(e,t,s,"stream-controller",Y.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const n=this.media,r=n?n.currentTime:null;if(r===null||!j(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;const o=this.getFwdBufferInfoAtPos(n,r,Y.MAIN,0);if(o===null||o.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${o?o.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(A.MANIFEST_PARSED,this.onManifestParsed,this),e.on(A.LEVEL_LOADING,this.onLevelLoading,this),e.on(A.LEVEL_LOADED,this.onLevelLoaded,this),e.on(A.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(A.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(A.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(A.BUFFER_CREATED,this.onBufferCreated,this),e.on(A.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(A.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(A.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(A.MANIFEST_PARSED,this.onManifestParsed,this),e.off(A.LEVEL_LOADED,this.onLevelLoaded,this),e.off(A.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(A.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(A.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(A.BUFFER_CREATED,this.onBufferCreated,this),e.off(A.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(A.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(A.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:s,hls:n}=this;if(this.stopLoad(),this.setInterval(E9),this.level=-1,!this.startFragRequested){let r=n.startLevel;r===-1&&(n.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=n.firstAutoLevel),n.nextLoadLevel=r,this.level=n.loadLevel,this._hasEnoughToStart=!!t}s>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s),this.state=V.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=V.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case V.WAITING_LEVEL:{const{levels:t,level:s}=this,n=t==null?void 0:t[s],r=n==null?void 0:n.details;if(r&&(!r.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(r))break;this.state=V.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=V.IDLE;break}break}case V.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),s=this.retryDate;if(!s||t>=s||(e=this.media)!=null&&e.seeking){const{levels:n,level:r}=this,o=n==null?void 0:n[r];this.resetStartWhenNotLoaded(o||null),this.state=V.IDLE}}break}this.state===V.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:n}=this;if(t===null||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(s!=null&&s[r]))return;const o=s[r],a=this.getMainFwdBufferInfo();if(a===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(a,c)){const m={};this.altAudio===2&&(m.type="video"),this.hls.trigger(A.BUFFER_EOS,m),this.state=V.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=o.details;if(!l||this.state===V.WAITING_LEVEL||this.waitForLive(o)){this.level=r,this.state=V.WAITING_LEVEL,this.startFragRequested=!1;return}const u=a.len,f=this.getMaxBufferLength(o.maxBitrate);if(u>=f)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(h,l);if(this.couldBacktrack&&!this.fragPrevious&&d&&De(d)&&this.fragmentTracker.getState(d)!==ke.OK){var p;const g=((p=this.backtrackFragment)!=null?p:d).sn-l.startSN,y=l.fragments[g-1];y&&d.cc===y.cc&&(d=y,this.fragmentTracker.removeFragment(y))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,h)){if(!d.gap){const g=this.audioOnly&&!this.altAudio?ye.AUDIO:ye.VIDEO,y=(g===ye.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,g,Y.MAIN)}d=this.getNextFragmentLoopLoading(d,l,a,Y.MAIN,f)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,h))}loadFragment(e,t,s){const n=this.fragmentTracker.getState(e);n===ke.NOT_LOADED||n===ke.PARTIAL?De(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,s):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Y.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let s;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<r.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,c=e[a],l=this.fragLastKbps;l&&this.fragCurrent?s=this.fragCurrent.duration*c.maxBitrate/(1e3*l)+1:s=0}else s=0;const o=this.getBufferedFrag(t.currentTime+s);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const c=a.maxStartPTS?a.maxStartPTS:a.start,l=a.duration,u=Math.max(o.end,c+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(u,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 V.KEY_LOADING:case V.FRAG_LOADING:case V.FRAG_LOADING_WAITING_RETRY:case V.PARSING:case V.PARSED:this.state=V.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const s=t.media;gt(s,"playing",this.onMediaPlaying),gt(s,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:s}=this;s&&(bt(s,"playing",this.onMediaPlaying),bt(s,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(A.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let s=!1,n=!1;t.levels.forEach(r=>{const o=r.audioCodec;o&&(s=s||o.indexOf("mp4a.40.2")!==-1,n=n||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=s&&n&&!v9(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:s}=this;if(!s||this.state!==V.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=V.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:n,startFragRequested:r}=this,o=t.level,a=t.details,c=a.totalduration;if(!n){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${c}`);const l=t.levelInfo,u=this.fragCurrent;u&&(this.state===V.FRAG_LOADING||this.state===V.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let f=0;if(a.live||(s=l.details)!=null&&s.live){var h;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;f=this.alignPlaylists(a,l.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(l.details=a,this.levelLastLoaded=l,r||this.setStartPosition(a,f),this.hls.trigger(A.LEVEL_UPDATED,{details:a,level:o}),this.state===V.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=V.IDLE}r&&a.live&&this.synchronizeToLiveEdge(a),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:s}=this;if(!s)return;const n=this.hls.liveSyncPosition,r=this.getLoadPosition(),o=e.fragmentStart,a=e.edge,c=r>=o-t.maxFragLookUpTolerance&&r<=a;if(n!==null&&s.duration>n&&(r<n||!c)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&s.readyState<4||r<a-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),s.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${n.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var l;const f=re.bufferInfo(s,n,0);if(!(f!=null&&(l=f.buffered)!=null&&l.length)){s.currentTime=n;return}if(f.start<=r){s.currentTime=n;return}const{nextStart:d}=re.bufferedInfo(f.buffered,r,0);d&&(s.currentTime=d)}else s.currentTime=n}}_handleFragmentLoadProgress(e){var t;const s=e.frag,{part:n,payload:r}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const a=o[s.level];if(!a){this.warn(`Level ${s.level} not found on progress`);return}const c=a.details;if(!c){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const l=a.videoCodec,u=c.PTSKnown||!c.live,f=(t=s.initSegment)==null?void 0:t.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new v1(this.hls,Y.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=n?n.index:-1,m=p!==-1,g=new Bc(s.level,s.sn,s.stats.chunkCount,r.byteLength,p,m),y=this.initPTS[s.cc];d.push(r,f,h,l,s,n,c.totalduration,u,g,y)}onAudioTrackSwitching(e,t){const s=this.hls,n=this.altAudio===2;if(wr(t.url,s))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(n){this.fragmentTracker.removeAllFragments(),s.once(A.BUFFER_FLUSHED,()=>{var o;(o=this.hls)==null||o.trigger(A.AUDIO_TRACK_SWITCHED,t)}),s.trigger(A.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(A.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=wr(t.url,this.hls);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?2:0,this.tick()}onBufferCreated(e,t){const s=t.tracks;let n,r,o=!1;for(const a in s){const c=s[a];if(c.id==="main"){if(r=a,n=c,a==="video"){const l=s[a];l&&(this.videoBuffer=l.buffer)}}else o=!0}o&&n?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:n}=t,r=s.type===Y.MAIN;if(r){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${n?" p: "+n.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===V.PARSED&&(this.state=V.IDLE);return}const a=n?n.stats:s.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),De(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,n)}const o=this.media;o&&(!this._hasEnoughToStart&&re.getBuffered(o).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var s;if(t.fatal){this.state=V.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Y.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===V.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===ce.LEVEL&&(this.state=V.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=V.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==ye.AUDIO||!this.altAudio){const s=(t===ye.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,t,Y.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t<s){if(e.seeking){this.log(`could not seek to ${s}, already seeking at ${t}`);return}const n=this.timelineOffset;n&&s&&(s+=n);const r=this.getLevelDetails(),o=re.getBuffered(e),a=o.length?o.start(0):0,c=a-s,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<l||this.loadingParts&&c<2*((r==null?void 0:r.partTarget)||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),s+=c,this.startPosition=s),t<s&&(this.log(`seek to target start position ${s} from current time ${t} buffer start ${a}`),e.currentTime=s)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(s=>{const{hls:n}=this,r=s==null?void 0:s.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=V.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=r.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),n.trigger(A.FRAG_LOADED,s),r.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const s=this.playlistType,{hls:n}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:c,part:l,level:u}=a,{video:f,text:h,id3:d,initSegment:p}=r,{details:m}=u,g=this.altAudio?void 0:r.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=V.PARSING,p){if(p!=null&&p.tracks){const E=c.initSegment||c;this._bufferInitSegment(u,p.tracks,E,o),n.trigger(A.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:s,tracks:p.tracks})}const y=p.initPTS,v=p.timescale,x=this.initPTS[c.cc];j(y)&&(!x||x.baseTime!==y||x.timescale!==v)&&(this.initPTS[c.cc]={baseTime:y,timescale:v},n.trigger(A.INIT_PTS_FOUND,{frag:c,id:s,initPTS:y,timescale:v}))}if(f&&m){g&&f.type==="audiovideo"&&this.logMuxedErr(c);const y=m.fragments[c.sn-1-m.startSN],v=c.sn===m.startSN,x=!y||c.cc>y.cc;if(r.independent!==!1){const{startPTS:E,endPTS:S,startDTS:T,endDTS:_}=f;if(l)l.elementaryStreams[f.type]={startPTS:E,endPTS:S,startDTS:T,endDTS:_};else if(f.firstKeyFrame&&f.independent&&o.id===1&&!x&&(this.couldBacktrack=!0),f.dropped&&f.independent){const I=this.getMainFwdBufferInfo(),R=(I?I.end:this.getLoadPosition())+this.config.maxBufferHole,b=f.firstKeyFramePTS?f.firstKeyFramePTS:E;if(!v&&R<b-this.config.maxBufferHole&&!x){this.backtrack(c);return}else x&&(c.gap=!0);c.setElementaryStreamInfo(f.type,c.start,S,c.start,_,!0)}else v&&E-(m.appliedTimelineOffset||0)>cr&&(c.gap=!0);c.setElementaryStreamInfo(f.type,E,S,T,_),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(f,c,l,o,v||x)}else if(v||x)c.gap=!0;else{this.backtrack(c);return}}if(g){const{startPTS:y,endPTS:v,startDTS:x,endDTS:E}=g;l&&(l.elementaryStreams[ye.AUDIO]={startPTS:y,endPTS:v,startDTS:x,endDTS:E}),c.setElementaryStreamInfo(ye.AUDIO,y,v,x,E),this.bufferFragmentData(g,c,l,o)}if(m&&d!=null&&(t=d.samples)!=null&&t.length){const y={id:s,frag:c,details:m,samples:d.samples};n.trigger(A.FRAG_PARSING_METADATA,y)}if(m&&h){const y={id:s,frag:c,details:m,samples:h.samples};n.trigger(A.FRAG_PARSING_USERDATA,y)}}logMuxedErr(e){this.warn(`${De(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,s,n){if(this.state!==V.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(s));const{audio:r,video:o,audiovideo:a}=t;if(r){const l=e.audioCodec;let u=sr(r.codec,l);u==="mp4a"&&(u="mp4a.40.5");const f=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const h=r.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&f.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&f.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),l&&l!==u&&this.log(`Swapping manifest audio codec "${l}" for "${u}"`),r.levelCodec=u,r.id=Y.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${u||""}/${l||""}/${r.codec}]`),delete t.audiovideo}if(o){o.levelCodec=e.videoCodec,o.id=Y.MAIN;const l=o.codec;if((l==null?void 0:l.length)===4)switch(l){case"hvc1":case"hev1":o.codec="hvc1.1.6.L120.90";break;case"av01":o.codec="av01.0.04M.08";break;case"avc1":o.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${l}]${o.codec!==l?" parsed-corrected="+o.codec:""}${o.supplemental?" supplemental="+o.supplemental:""}`),delete t.audiovideo}a&&(this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(A.BUFFER_CODECS,t),!this.hls)return;c.forEach(l=>{const f=t[l].initSegment;f!=null&&f.byteLength&&this.hls.trigger(A.BUFFER_APPENDING,{type:l,data:f,frag:s,part:null,chunkMeta:n,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Y.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,s=e==null?void 0:e[t];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=V.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(re.isBuffered(e,s)?t=this.getAppendedFrag(s):re.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,r=t.level;(!n||t.sn!==n.sn||n.level!==r)&&(this.fragPlaying=t,this.hls.trigger(A.FRAG_CHANGED,{frag:t}),(!n||n.level!==r)&&this.hls.trigger(A.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return j(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(j(t)){const s=this.getLevelDetails(),n=this.currentFrag||(s?Hs(null,s.fragments,t):null);if(n){const r=n.programDateTime;if(r!==null){const o=r+(t-n.start)*1e3;return new Date(o)}}}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 S9{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[s].loader;if(n){var t;if(e&&e!==((t=n.context)==null?void 0:t.frag.type))return;n.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=$.KEY_LOAD_ERROR,s,n,r){return new Vt({type:Z.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:s,networkDetails:n})}loadClear(e,t,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let n=0,r=t.length;n<r;n++){const o=t[n];if(e.cc<=o.cc&&(!De(e)||!De(o)||e.sn<o.sn)||!s&&n==r-1)return this.emeController.selectKeySystemFormat(o).then(a=>{if(!this.emeController)return;o.setKeyFormat(a);const c=_l(a);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const n=nr(this.config);if(n.length)return this.emeController.getKeySystemAccess(n)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,n;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const l=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,$.KEY_LOAD_ERROR,l))}const o=r.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((s=a)!=null&&s.decryptdata.key)return r.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((n=a)!=null&&n.keyLoadPromise){var c;switch((c=a.mediaKeySessionContext)==null?void 0:c.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(l=>(r.key=l.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(s);if(n)return(e.keyLoadPromise=n.then(r=>(e.mediaKeySessionContext=r,s))).catch(r=>{throw e.keyLoadPromise=null,r})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,n=s.loader,r=new n(s);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((o,a)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=s.keyLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,d,p,m)=>{const{frag:g,keyInfo:y,url:v}=p;if(!g.decryptdata||y!==this.keyUriToKeyInfo[v])return a(this.createKeyLoadError(g,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),m));y.decryptdata.key=g.decryptdata.key=new Uint8Array(h.data),g.keyLoader=null,y.loader=null,o({frag:g,keyInfo:y})},onError:(h,d,p,m)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),p,xe({url:c.url,data:void 0},h)))},onTimeout:(h,d,p)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),p))},onAbort:(h,d,p)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),p))}};r.load(c,u,f)})}resetLoader(e){const{frag:t,keyInfo:s,url:n}=e,r=s.loader;t.keyLoader===r&&(t.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[n],r&&r.destroy()}}function Ff(i){const{type:e}=i;switch(e){case ce.AUDIO_TRACK:return Y.AUDIO;case ce.SUBTITLE_TRACK:return Y.SUBTITLE;default:return Y.MAIN}}function Mo(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class T9{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(A.MANIFEST_LOADING,this.onManifestLoading,this),e.on(A.LEVEL_LOADING,this.onLevelLoading,this),e.on(A.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(A.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(A.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(A.MANIFEST_LOADING,this.onManifestLoading,this),e.off(A.LEVEL_LOADING,this.onLevelLoading,this),e.off(A.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(A.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(A.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,n=t.loader,r=s||n,o=new r(t);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ce.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:s,level:n,pathwayId:r,url:o,deliveryDirectives:a,levelInfo:c}=t;this.load({id:s,level:n,pathwayId:r,responseType:"text",type:ce.LEVEL,url:o,deliveryDirectives:a,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:s,groupId:n,url:r,deliveryDirectives:o,track:a}=t;this.load({id:s,groupId:n,level:null,responseType:"text",type:ce.AUDIO_TRACK,url:r,deliveryDirectives:o,levelOrTrack:a})}onSubtitleTrackLoading(e,t){const{id:s,groupId:n,url:r,deliveryDirectives:o,track:a}=t;this.load({id:s,groupId:n,level:null,responseType:"text",type:ce.SUBTITLE_TRACK,url:r,deliveryDirectives:o,levelOrTrack:a})}onLevelsUpdated(e,t){const s=this.loaders[ce.LEVEL];if(s){const n=s.context;n&&!t.levels.some(r=>r===n.levelOrTrack)&&(s.abort(),delete this.loaders[ce.LEVEL])}}load(e){var t;const s=this.hls.config;let n=this.getInternalLoader(e);if(n){const l=this.hls.logger,u=n.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?l.log(`[playlist-loader]: ignore ${e.url} ongoing request`):l.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}l.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let r;if(e.type===ce.MANIFEST?r=s.manifestLoadPolicy.default:r=ge({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),j((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===ce.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===ce.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===ce.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const u=l.partTarget,f=l.targetduration;if(u&&f){const h=Math.max(u*3,f*.8)*1e3;r=ge({},r,{maxTimeToFirstByteMs:Math.min(h,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,r.maxTimeToFirstByteMs)})}}}const o=r.errorRetry||r.timeoutRetry||{},a={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},c={onSuccess:(l,u,f,h)=>{const d=this.getInternalLoader(f);this.resetInternalLoader(f.type);const p=l.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,f,new Error("no EXTM3U delimiter"),h||null,u);return}u.parsing.start=performance.now(),Ft.isMediaPlaylist(p)||f.type!==ce.MANIFEST?this.handleTrackOrLevelPlaylist(l,u,f,h||null,d):this.handleMasterPlaylist(l,u,f,h)},onError:(l,u,f,h)=>{this.handleNetworkError(u,f,!1,l,h)},onTimeout:(l,u,f)=>{this.handleNetworkError(u,f,!0,void 0,l)}};n.load(e,a,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:s}=this.hls;(e||s)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,s,n){const r=this.hls,o=e.data,a=Mo(e,s),c=Ft.parseMasterPlaylist(o,a);if(c.playlistParsingError){this.handleManifestParsingError(e,s,c.playlistParsingError,n,t);return}const{contentSteering:l,levels:u,sessionData:f,sessionKeys:h,startTimeOffset:d,variableList:p}=c;this.variableList=p;const{AUDIO:m=[],SUBTITLES:g,"CLOSED-CAPTIONS":y}=Ft.parseMasterPlaylistMedia(o,a,c);m.length&&!m.some(x=>!x.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ae({}),bitrate:0,url:""})),r.trigger(A.MANIFEST_LOADED,{levels:u,audioTracks:m,subtitles:g,captions:y,contentSteering:l,url:a,stats:t,networkDetails:n,sessionData:f,sessionKeys:h,startTimeOffset:d,variableList:p})}handleTrackOrLevelPlaylist(e,t,s,n,r){const o=this.hls,{id:a,level:c,type:l}=s,u=Mo(e,s),f=j(c)?c:j(a)?a:0,h=Ff(s),d=Ft.parseLevelPlaylist(e.data,u,f,h,0,this.variableList);if(l===ce.MANIFEST){const p={attrs:new Ae({}),bitrate:0,details:d,name:"",url:u};d.requestScheduled=t.loading.start+zg(d,0),o.trigger(A.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:u,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=d,this.handlePlaylistLoaded(d,e,t,s,n,r)}handleManifestParsingError(e,t,s,n,r){this.hls.trigger(A.ERROR,{type:Z.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===ce.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:n,stats:r})}handleNetworkError(e,t,s=!1,n,r){let o=`A network ${s?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===ce.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===ce.AUDIO_TRACK||e.type===ce.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);this.hls.logger.warn(`[playlist-loader]: ${o}`);let c=$.UNKNOWN,l=!1;const u=this.getInternalLoader(e);switch(e.type){case ce.MANIFEST:c=s?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,l=!0;break;case ce.LEVEL:c=s?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,l=!1;break;case ce.AUDIO_TRACK:c=s?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case ce.SUBTITLE_TRACK:c=s?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,l=!1;break}u&&this.resetInternalLoader(e.type);const f={type:Z.NETWORK_ERROR,details:c,fatal:l,url:e.url,loader:u,context:e,error:a,networkDetails:t,stats:r};if(n){const h=(t==null?void 0:t.url)||e.url;f.response=xe({url:h,data:void 0},n)}this.hls.trigger(A.ERROR,f)}handlePlaylistLoaded(e,t,s,n,r,o){const a=this.hls,{type:c,level:l,id:u,groupId:f,deliveryDirectives:h}=n,d=Mo(t,n),p=Ff(n),m=typeof n.level=="number"&&p===Y.MAIN?l:void 0;if(!e.fragments.length){const y=e.playlistParsingError=new Error("No Segments found in Playlist");a.trigger(A.ERROR,{type:Z.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:n,level:m,parent:p,networkDetails:r,stats:s});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const g=e.playlistParsingError;if(g){if(this.hls.logger.warn(g),!a.config.ignorePlaylistParsingErrors){a.trigger(A.ERROR,{type:Z.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:g,reason:g.message,response:t,context:n,level:m,parent:p,networkDetails:r,stats:s});return}e.playlistParsingError=null}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case ce.MANIFEST:case ce.LEVEL:a.trigger(A.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||a.levels[0],level:m||0,id:u||0,stats:s,networkDetails:r,deliveryDirectives:h,withoutMultiVariant:c===ce.MANIFEST});break;case ce.AUDIO_TRACK:a.trigger(A.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:u||0,groupId:f||"",stats:s,networkDetails:r,deliveryDirectives:h});break;case ce.SUBTITLE_TRACK:a.trigger(A.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:u||0,groupId:f||"",stats:s,networkDetails:r,deliveryDirectives:h});break}}}class as{static get version(){return cn}static isMSESupported(){return G1()}static isSupported(){return y9()}static getMediaSource(){return vs()}static get Events(){return A}static get MetadataSchema(){return lt}static get ErrorTypes(){return Z}static get ErrorDetails(){return $}static get DefaultConfig(){return as.defaultConfig?as.defaultConfig:o9}static set DefaultConfig(e){as.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Mc,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=KS(e.debug||!1,"Hls instance",e.assetPlayerId),s=this.config=l9(as.DefaultConfig,e,t);this.userConfig=e,s.progressive&&c9(s,t);const{abrController:n,bufferController:r,capLevelController:o,errorController:a,fpsController:c}=s,l=new a(this),u=this.abrController=new n(this),f=new B6(this),h=s.interstitialsController,d=h?this.interstitialsController=new h(this,as):null,p=this.bufferController=new r(this,f),m=this.capLevelController=new o(this),g=new c(this),y=new T9(this),v=s.contentSteeringController,x=v?new v(this):null,E=this.levelController=new x9(this,x),S=new g9(this),T=new S9(this.config),_=this.streamController=new A9(this,f,T),I=this.gapController=new d9(this,f);m.setStreamController(_),g.setStreamController(_);const R=[y,E,_];d&&R.splice(1,0,d),x&&R.splice(1,0,x),this.networkControllers=R;const b=[u,p,I,m,g,S,f];this.audioTrackController=this.createController(s.audioTrackController,R);const L=s.audioStreamController;L&&R.push(this.audioStreamController=new L(this,f,T)),this.subtitleTrackController=this.createController(s.subtitleTrackController,R);const k=s.subtitleStreamController;k&&R.push(this.subtititleStreamController=new k(this,f,T)),this.createController(s.timelineController,b),T.emeController=this.emeController=this.createController(s.emeController,b),this.cmcdController=this.createController(s.cmcdController,b),this.latencyController=this.createController(m9,b),this.coreComponents=b,R.push(l);const M=l.onErrorOut;typeof M=="function"&&this.on(A.ERROR,M,l),this.on(A.MANIFEST_LOADED,y.onManifestLoaded,y)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,n){this._emitter.off(e,t,s,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const n=e===A.ERROR;this.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:n,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(A.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){if(!e||"media"in e&&!e.media){const r=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(A.ERROR,{type:Z.OTHER_ERROR,details:$.ATTACH_MEDIA_ERROR,fatal:!0,error:r});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,s=t?e.media:e,n=t?e:{media:s};this._media=s,this.trigger(A.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger(A.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(A.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,s=this._url,n=this._url=Cc.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&s&&(s!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(A.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s<this.networkControllers.length&&(this.networkControllers[s].startLoad(e,t),!(!this.started||!this.networkControllers));s++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Y.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Y.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Y.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=db()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.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 abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){y6(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let n=0;n<s;n++)if(e[n].maxBitrate>=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let n;if(t===-1&&e!=null&&e.length?n=e.length-1:n=t,s)for(let r=n;r--;){const o=e[r].attrs["HDCP-LEVEL"];if(o&&o<=s)return r}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!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}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const s=Mg(t);return Fg(e,s,navigator.mediaCapabilities)}}as.defaultConfig=void 0;var oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function K1(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function b9(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function s(){return this instanceof s?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(s){var n=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return i[s]}})}),t}var V1={exports:{}};function _9(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var No={exports:{}};const I9=new Proxy({},{get(i,e){throw new Error(`Module "" has been externalized for browser compatibility. Cannot access ".${e}" in client code. See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),C9=Object.freeze(Object.defineProperty({__proto__:null,default:I9},Symbol.toStringTag,{value:"Module"})),L9=b9(C9);var Of;function he(){return Of||(Of=1,function(i,e){(function(t,s){i.exports=s()})(oe,function(){var t=t||function(s,n){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof oe<"u"&&oe.crypto&&(r=oe.crypto),!r&&typeof _9=="function")try{r=L9}catch{}var o=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function v(){}return function(x){var E;return v.prototype=x,E=new v,v.prototype=null,E}}(),c={},l=c.lib={},u=l.Base=function(){return{extend:function(v){var x=a(this);return v&&x.mixIn(v),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var x in v)v.hasOwnProperty(x)&&(this[x]=v[x]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),f=l.WordArray=u.extend({init:function(v,x){v=this.words=v||[],x!=n?this.sigBytes=x:this.sigBytes=v.length*4},toString:function(v){return(v||d).stringify(this)},concat:function(v){var x=this.words,E=v.words,S=this.sigBytes,T=v.sigBytes;if(this.clamp(),S%4)for(var _=0;_<T;_++){var I=E[_>>>2]>>>24-_%4*8&255;x[S+_>>>2]|=I<<24-(S+_)%4*8}else for(var R=0;R<T;R+=4)x[S+R>>>2]=E[R>>>2];return this.sigBytes+=T,this},clamp:function(){var v=this.words,x=this.sigBytes;v[x>>>2]&=4294967295<<32-x%4*8,v.length=s.ceil(x/4)},clone:function(){var v=u.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var x=[],E=0;E<v;E+=4)x.push(o());return new f.init(x,v)}}),h=c.enc={},d=h.Hex={stringify:function(v){for(var x=v.words,E=v.sigBytes,S=[],T=0;T<E;T++){var _=x[T>>>2]>>>24-T%4*8&255;S.push((_>>>4).toString(16)),S.push((_&15).toString(16))}return S.join("")},parse:function(v){for(var x=v.length,E=[],S=0;S<x;S+=2)E[S>>>3]|=parseInt(v.substr(S,2),16)<<24-S%8*4;return new f.init(E,x/2)}},p=h.Latin1={stringify:function(v){for(var x=v.words,E=v.sigBytes,S=[],T=0;T<E;T++){var _=x[T>>>2]>>>24-T%4*8&255;S.push(String.fromCharCode(_))}return S.join("")},parse:function(v){for(var x=v.length,E=[],S=0;S<x;S++)E[S>>>2]|=(v.charCodeAt(S)&255)<<24-S%4*8;return new f.init(E,x)}},m=h.Utf8={stringify:function(v){try{return decodeURIComponent(escape(p.stringify(v)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(v){return p.parse(unescape(encodeURIComponent(v)))}},g=l.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=m.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var x,E=this._data,S=E.words,T=E.sigBytes,_=this.blockSize,I=_*4,R=T/I;v?R=s.ceil(R):R=s.max((R|0)-this._minBufferSize,0);var b=R*_,L=s.min(b*4,T);if(b){for(var k=0;k<b;k+=_)this._doProcessBlock(S,k);x=S.splice(0,b),E.sigBytes-=L}return new f.init(x,L)},clone:function(){var v=u.clone.call(this);return v._data=this._data.clone(),v},_minBufferSize:0});l.Hasher=g.extend({cfg:u.extend(),init:function(v){this.cfg=this.cfg.extend(v),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(v){return this._append(v),this._process(),this},finalize:function(v){v&&this._append(v);var x=this._doFinalize();return x},blockSize:16,_createHelper:function(v){return function(x,E){return new v.init(E).finalize(x)}},_createHmacHelper:function(v){return function(x,E){return new y.HMAC.init(v,E).finalize(x)}}});var y=c.algo={};return c}(Math);return t})}(No)),No.exports}var Uo={exports:{}},Mf;function ro(){return Mf||(Mf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){return function(s){var n=t,r=n.lib,o=r.Base,a=r.WordArray,c=n.x64={};c.Word=o.extend({init:function(l,u){this.high=l,this.low=u}}),c.WordArray=o.extend({init:function(l,u){l=this.words=l||[],u!=s?this.sigBytes=u:this.sigBytes=l.length*8},toX32:function(){for(var l=this.words,u=l.length,f=[],h=0;h<u;h++){var d=l[h];f.push(d.high),f.push(d.low)}return a.create(f,this.sigBytes)},clone:function(){for(var l=o.clone.call(this),u=l.words=this.words.slice(0),f=u.length,h=0;h<f;h++)u[h]=u[h].clone();return l}})}(),t})}(Uo)),Uo.exports}var $o={exports:{}},Nf;function D9(){return Nf||(Nf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){return function(){if(typeof ArrayBuffer=="function"){var s=t,n=s.lib,r=n.WordArray,o=r.init,a=r.init=function(c){if(c instanceof ArrayBuffer&&(c=new Uint8Array(c)),(c instanceof Int8Array||typeof Uint8ClampedArray<"u"&&c instanceof Uint8ClampedArray||c instanceof Int16Array||c instanceof Uint16Array||c instanceof Int32Array||c instanceof Uint32Array||c instanceof Float32Array||c instanceof Float64Array)&&(c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),c instanceof Uint8Array){for(var l=c.byteLength,u=[],f=0;f<l;f++)u[f>>>2]|=c[f]<<24-f%4*8;o.call(this,u,l)}else o.apply(this,arguments)};a.prototype=r}}(),t.lib.WordArray})}($o)),$o.exports}var Ho={exports:{}},Uf;function R9(){return Uf||(Uf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.WordArray,o=s.enc;o.Utf16=o.Utf16BE={stringify:function(c){for(var l=c.words,u=c.sigBytes,f=[],h=0;h<u;h+=2){var d=l[h>>>2]>>>16-h%4*8&65535;f.push(String.fromCharCode(d))}return f.join("")},parse:function(c){for(var l=c.length,u=[],f=0;f<l;f++)u[f>>>1]|=c.charCodeAt(f)<<16-f%2*16;return r.create(u,l*2)}},o.Utf16LE={stringify:function(c){for(var l=c.words,u=c.sigBytes,f=[],h=0;h<u;h+=2){var d=a(l[h>>>2]>>>16-h%4*8&65535);f.push(String.fromCharCode(d))}return f.join("")},parse:function(c){for(var l=c.length,u=[],f=0;f<l;f++)u[f>>>1]|=a(c.charCodeAt(f)<<16-f%2*16);return r.create(u,l*2)}};function a(c){return c<<8&4278255360|c>>>8&16711935}}(),t.enc.Utf16})}(Ho)),Ho.exports}var Go={exports:{}},$f;function Ys(){return $f||($f=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.WordArray,o=s.enc;o.Base64={stringify:function(c){var l=c.words,u=c.sigBytes,f=this._map;c.clamp();for(var h=[],d=0;d<u;d+=3)for(var p=l[d>>>2]>>>24-d%4*8&255,m=l[d+1>>>2]>>>24-(d+1)%4*8&255,g=l[d+2>>>2]>>>24-(d+2)%4*8&255,y=p<<16|m<<8|g,v=0;v<4&&d+v*.75<u;v++)h.push(f.charAt(y>>>6*(3-v)&63));var x=f.charAt(64);if(x)for(;h.length%4;)h.push(x);return h.join("")},parse:function(c){var l=c.length,u=this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var h=0;h<u.length;h++)f[u.charCodeAt(h)]=h}var d=u.charAt(64);if(d){var p=c.indexOf(d);p!==-1&&(l=p)}return a(c,l,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(c,l,u){for(var f=[],h=0,d=0;d<l;d++)if(d%4){var p=u[c.charCodeAt(d-1)]<<d%4*2,m=u[c.charCodeAt(d)]>>>6-d%4*2,g=p|m;f[h>>>2]|=g<<24-h%4*8,h++}return r.create(f,h)}}(),t.enc.Base64})}(Go)),Go.exports}var Ko={exports:{}},Hf;function w9(){return Hf||(Hf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.WordArray,o=s.enc;o.Base64url={stringify:function(c,l){l===void 0&&(l=!0);var u=c.words,f=c.sigBytes,h=l?this._safe_map:this._map;c.clamp();for(var d=[],p=0;p<f;p+=3)for(var m=u[p>>>2]>>>24-p%4*8&255,g=u[p+1>>>2]>>>24-(p+1)%4*8&255,y=u[p+2>>>2]>>>24-(p+2)%4*8&255,v=m<<16|g<<8|y,x=0;x<4&&p+x*.75<f;x++)d.push(h.charAt(v>>>6*(3-x)&63));var E=h.charAt(64);if(E)for(;d.length%4;)d.push(E);return d.join("")},parse:function(c,l){l===void 0&&(l=!0);var u=c.length,f=l?this._safe_map:this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var d=0;d<f.length;d++)h[f.charCodeAt(d)]=d}var p=f.charAt(64);if(p){var m=c.indexOf(p);m!==-1&&(u=m)}return a(c,u,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(c,l,u){for(var f=[],h=0,d=0;d<l;d++)if(d%4){var p=u[c.charCodeAt(d-1)]<<d%4*2,m=u[c.charCodeAt(d)]>>>6-d%4*2,g=p|m;f[h>>>2]|=g<<24-h%4*8,h++}return r.create(f,h)}}(),t.enc.Base64url})}(Ko)),Ko.exports}var Vo={exports:{}},Gf;function Xs(){return Gf||(Gf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){return function(s){var n=t,r=n.lib,o=r.WordArray,a=r.Hasher,c=n.algo,l=[];(function(){for(var m=0;m<64;m++)l[m]=s.abs(s.sin(m+1))*4294967296|0})();var u=c.MD5=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,g){for(var y=0;y<16;y++){var v=g+y,x=m[v];m[v]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}var E=this._hash.words,S=m[g+0],T=m[g+1],_=m[g+2],I=m[g+3],R=m[g+4],b=m[g+5],L=m[g+6],k=m[g+7],M=m[g+8],N=m[g+9],F=m[g+10],O=m[g+11],K=m[g+12],B=m[g+13],G=m[g+14],H=m[g+15],C=E[0],D=E[1],P=E[2],w=E[3];C=f(C,D,P,w,S,7,l[0]),w=f(w,C,D,P,T,12,l[1]),P=f(P,w,C,D,_,17,l[2]),D=f(D,P,w,C,I,22,l[3]),C=f(C,D,P,w,R,7,l[4]),w=f(w,C,D,P,b,12,l[5]),P=f(P,w,C,D,L,17,l[6]),D=f(D,P,w,C,k,22,l[7]),C=f(C,D,P,w,M,7,l[8]),w=f(w,C,D,P,N,12,l[9]),P=f(P,w,C,D,F,17,l[10]),D=f(D,P,w,C,O,22,l[11]),C=f(C,D,P,w,K,7,l[12]),w=f(w,C,D,P,B,12,l[13]),P=f(P,w,C,D,G,17,l[14]),D=f(D,P,w,C,H,22,l[15]),C=h(C,D,P,w,T,5,l[16]),w=h(w,C,D,P,L,9,l[17]),P=h(P,w,C,D,O,14,l[18]),D=h(D,P,w,C,S,20,l[19]),C=h(C,D,P,w,b,5,l[20]),w=h(w,C,D,P,F,9,l[21]),P=h(P,w,C,D,H,14,l[22]),D=h(D,P,w,C,R,20,l[23]),C=h(C,D,P,w,N,5,l[24]),w=h(w,C,D,P,G,9,l[25]),P=h(P,w,C,D,I,14,l[26]),D=h(D,P,w,C,M,20,l[27]),C=h(C,D,P,w,B,5,l[28]),w=h(w,C,D,P,_,9,l[29]),P=h(P,w,C,D,k,14,l[30]),D=h(D,P,w,C,K,20,l[31]),C=d(C,D,P,w,b,4,l[32]),w=d(w,C,D,P,M,11,l[33]),P=d(P,w,C,D,O,16,l[34]),D=d(D,P,w,C,G,23,l[35]),C=d(C,D,P,w,T,4,l[36]),w=d(w,C,D,P,R,11,l[37]),P=d(P,w,C,D,k,16,l[38]),D=d(D,P,w,C,F,23,l[39]),C=d(C,D,P,w,B,4,l[40]),w=d(w,C,D,P,S,11,l[41]),P=d(P,w,C,D,I,16,l[42]),D=d(D,P,w,C,L,23,l[43]),C=d(C,D,P,w,N,4,l[44]),w=d(w,C,D,P,K,11,l[45]),P=d(P,w,C,D,H,16,l[46]),D=d(D,P,w,C,_,23,l[47]),C=p(C,D,P,w,S,6,l[48]),w=p(w,C,D,P,k,10,l[49]),P=p(P,w,C,D,G,15,l[50]),D=p(D,P,w,C,b,21,l[51]),C=p(C,D,P,w,K,6,l[52]),w=p(w,C,D,P,I,10,l[53]),P=p(P,w,C,D,F,15,l[54]),D=p(D,P,w,C,T,21,l[55]),C=p(C,D,P,w,M,6,l[56]),w=p(w,C,D,P,H,10,l[57]),P=p(P,w,C,D,L,15,l[58]),D=p(D,P,w,C,B,21,l[59]),C=p(C,D,P,w,R,6,l[60]),w=p(w,C,D,P,O,10,l[61]),P=p(P,w,C,D,_,15,l[62]),D=p(D,P,w,C,N,21,l[63]),E[0]=E[0]+C|0,E[1]=E[1]+D|0,E[2]=E[2]+P|0,E[3]=E[3]+w|0},_doFinalize:function(){var m=this._data,g=m.words,y=this._nDataBytes*8,v=m.sigBytes*8;g[v>>>5]|=128<<24-v%32;var x=s.floor(y/4294967296),E=y;g[(v+64>>>9<<4)+15]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,g[(v+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,m.sigBytes=(g.length+1)*4,this._process();for(var S=this._hash,T=S.words,_=0;_<4;_++){var I=T[_];T[_]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360}return S},clone:function(){var m=a.clone.call(this);return m._hash=this._hash.clone(),m}});function f(m,g,y,v,x,E,S){var T=m+(g&y|~g&v)+x+S;return(T<<E|T>>>32-E)+g}function h(m,g,y,v,x,E,S){var T=m+(g&v|y&~v)+x+S;return(T<<E|T>>>32-E)+g}function d(m,g,y,v,x,E,S){var T=m+(g^y^v)+x+S;return(T<<E|T>>>32-E)+g}function p(m,g,y,v,x,E,S){var T=m+(y^(g|~v))+x+S;return(T<<E|T>>>32-E)+g}n.MD5=a._createHelper(u),n.HmacMD5=a._createHmacHelper(u)}(Math),t.MD5})}(Vo)),Vo.exports}var jo={exports:{}},Kf;function j1(){return Kf||(Kf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.WordArray,o=n.Hasher,a=s.algo,c=[],l=a.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,f){for(var h=this._hash.words,d=h[0],p=h[1],m=h[2],g=h[3],y=h[4],v=0;v<80;v++){if(v<16)c[v]=u[f+v]|0;else{var x=c[v-3]^c[v-8]^c[v-14]^c[v-16];c[v]=x<<1|x>>>31}var E=(d<<5|d>>>27)+y+c[v];v<20?E+=(p&m|~p&g)+1518500249:v<40?E+=(p^m^g)+1859775393:v<60?E+=(p&m|p&g|m&g)-1894007588:E+=(p^m^g)-899497514,y=g,g=m,m=p<<30|p>>>2,p=d,d=E}h[0]=h[0]+d|0,h[1]=h[1]+p|0,h[2]=h[2]+m|0,h[3]=h[3]+g|0,h[4]=h[4]+y|0},_doFinalize:function(){var u=this._data,f=u.words,h=this._nDataBytes*8,d=u.sigBytes*8;return f[d>>>5]|=128<<24-d%32,f[(d+64>>>9<<4)+14]=Math.floor(h/4294967296),f[(d+64>>>9<<4)+15]=h,u.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});s.SHA1=o._createHelper(l),s.HmacSHA1=o._createHmacHelper(l)}(),t.SHA1})}(jo)),jo.exports}var qo={exports:{}},Vf;function Qc(){return Vf||(Vf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){return function(s){var n=t,r=n.lib,o=r.WordArray,a=r.Hasher,c=n.algo,l=[],u=[];(function(){function d(y){for(var v=s.sqrt(y),x=2;x<=v;x++)if(!(y%x))return!1;return!0}function p(y){return(y-(y|0))*4294967296|0}for(var m=2,g=0;g<64;)d(m)&&(g<8&&(l[g]=p(s.pow(m,1/2))),u[g]=p(s.pow(m,1/3)),g++),m++})();var f=[],h=c.SHA256=a.extend({_doReset:function(){this._hash=new o.init(l.slice(0))},_doProcessBlock:function(d,p){for(var m=this._hash.words,g=m[0],y=m[1],v=m[2],x=m[3],E=m[4],S=m[5],T=m[6],_=m[7],I=0;I<64;I++){if(I<16)f[I]=d[p+I]|0;else{var R=f[I-15],b=(R<<25|R>>>7)^(R<<14|R>>>18)^R>>>3,L=f[I-2],k=(L<<15|L>>>17)^(L<<13|L>>>19)^L>>>10;f[I]=b+f[I-7]+k+f[I-16]}var M=E&S^~E&T,N=g&y^g&v^y&v,F=(g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22),O=(E<<26|E>>>6)^(E<<21|E>>>11)^(E<<7|E>>>25),K=_+O+M+u[I]+f[I],B=F+N;_=T,T=S,S=E,E=x+K|0,x=v,v=y,y=g,g=K+B|0}m[0]=m[0]+g|0,m[1]=m[1]+y|0,m[2]=m[2]+v|0,m[3]=m[3]+x|0,m[4]=m[4]+E|0,m[5]=m[5]+S|0,m[6]=m[6]+T|0,m[7]=m[7]+_|0},_doFinalize:function(){var d=this._data,p=d.words,m=this._nDataBytes*8,g=d.sigBytes*8;return p[g>>>5]|=128<<24-g%32,p[(g+64>>>9<<4)+14]=s.floor(m/4294967296),p[(g+64>>>9<<4)+15]=m,d.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});n.SHA256=a._createHelper(h),n.HmacSHA256=a._createHmacHelper(h)}(Math),t.SHA256})}(qo)),qo.exports}var Wo={exports:{}},jf;function P9(){return jf||(jf=1,function(i,e){(function(t,s,n){i.exports=s(he(),Qc())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.WordArray,o=s.algo,a=o.SHA256,c=o.SHA224=a.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var l=a._doFinalize.call(this);return l.sigBytes-=4,l}});s.SHA224=a._createHelper(c),s.HmacSHA224=a._createHmacHelper(c)}(),t.SHA224})}(Wo)),Wo.exports}var zo={exports:{}},qf;function q1(){return qf||(qf=1,function(i,e){(function(t,s,n){i.exports=s(he(),ro())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.Hasher,o=s.x64,a=o.Word,c=o.WordArray,l=s.algo;function u(){return a.create.apply(a,arguments)}var f=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],h=[];(function(){for(var p=0;p<80;p++)h[p]=u()})();var d=l.SHA512=r.extend({_doReset:function(){this._hash=new c.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(p,m){for(var g=this._hash.words,y=g[0],v=g[1],x=g[2],E=g[3],S=g[4],T=g[5],_=g[6],I=g[7],R=y.high,b=y.low,L=v.high,k=v.low,M=x.high,N=x.low,F=E.high,O=E.low,K=S.high,B=S.low,G=T.high,H=T.low,C=_.high,D=_.low,P=I.high,w=I.low,W=R,z=b,ne=L,ee=k,pe=M,fe=N,_e=F,ot=O,Ie=K,Ke=B,Li=G,le=H,Te=C,Fe=D,yt=P,Ve=w,Oe=0;Oe<80;Oe++){var Ce,vt,$t=h[Oe];if(Oe<16)vt=$t.high=p[m+Oe*2]|0,Ce=$t.low=p[m+Oe*2+1]|0;else{var Di=h[Oe-15],ut=Di.high,Yt=Di.low,ao=(ut>>>1|Yt<<31)^(ut>>>8|Yt<<24)^ut>>>7,Ri=(Yt>>>1|ut<<31)^(Yt>>>8|ut<<24)^(Yt>>>7|ut<<25),wi=h[Oe-2],ft=wi.high,Pi=wi.low,Fm=(ft>>>19|Pi<<13)^(ft<<3|Pi>>>29)^ft>>>6,cu=(Pi>>>19|ft<<13)^(Pi<<3|ft>>>29)^(Pi>>>6|ft<<26),uu=h[Oe-7],Om=uu.high,Mm=uu.low,fu=h[Oe-16],Nm=fu.high,hu=fu.low;Ce=Ri+Mm,vt=ao+Om+(Ce>>>0<Ri>>>0?1:0),Ce=Ce+cu,vt=vt+Fm+(Ce>>>0<cu>>>0?1:0),Ce=Ce+hu,vt=vt+Nm+(Ce>>>0<hu>>>0?1:0),$t.high=vt,$t.low=Ce}var Um=Ie&Li^~Ie&Te,du=Ke&le^~Ke&Fe,$m=W&ne^W&pe^ne&pe,Hm=z&ee^z&fe^ee&fe,Gm=(W>>>28|z<<4)^(W<<30|z>>>2)^(W<<25|z>>>7),pu=(z>>>28|W<<4)^(z<<30|W>>>2)^(z<<25|W>>>7),Km=(Ie>>>14|Ke<<18)^(Ie>>>18|Ke<<14)^(Ie<<23|Ke>>>9),Vm=(Ke>>>14|Ie<<18)^(Ke>>>18|Ie<<14)^(Ke<<23|Ie>>>9),gu=f[Oe],jm=gu.high,mu=gu.low,at=Ve+Vm,Xt=yt+Km+(at>>>0<Ve>>>0?1:0),at=at+du,Xt=Xt+Um+(at>>>0<du>>>0?1:0),at=at+mu,Xt=Xt+jm+(at>>>0<mu>>>0?1:0),at=at+Ce,Xt=Xt+vt+(at>>>0<Ce>>>0?1:0),xu=pu+Hm,qm=Gm+$m+(xu>>>0<pu>>>0?1:0);yt=Te,Ve=Fe,Te=Li,Fe=le,Li=Ie,le=Ke,Ke=ot+at|0,Ie=_e+Xt+(Ke>>>0<ot>>>0?1:0)|0,_e=pe,ot=fe,pe=ne,fe=ee,ne=W,ee=z,z=at+xu|0,W=Xt+qm+(z>>>0<at>>>0?1:0)|0}b=y.low=b+z,y.high=R+W+(b>>>0<z>>>0?1:0),k=v.low=k+ee,v.high=L+ne+(k>>>0<ee>>>0?1:0),N=x.low=N+fe,x.high=M+pe+(N>>>0<fe>>>0?1:0),O=E.low=O+ot,E.high=F+_e+(O>>>0<ot>>>0?1:0),B=S.low=B+Ke,S.high=K+Ie+(B>>>0<Ke>>>0?1:0),H=T.low=H+le,T.high=G+Li+(H>>>0<le>>>0?1:0),D=_.low=D+Fe,_.high=C+Te+(D>>>0<Fe>>>0?1:0),w=I.low=w+Ve,I.high=P+yt+(w>>>0<Ve>>>0?1:0)},_doFinalize:function(){var p=this._data,m=p.words,g=this._nDataBytes*8,y=p.sigBytes*8;m[y>>>5]|=128<<24-y%32,m[(y+128>>>10<<5)+30]=Math.floor(g/4294967296),m[(y+128>>>10<<5)+31]=g,p.sigBytes=m.length*4,this._process();var v=this._hash.toX32();return v},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p},blockSize:1024/32});s.SHA512=r._createHelper(d),s.HmacSHA512=r._createHmacHelper(d)}(),t.SHA512})}(zo)),zo.exports}var Qo={exports:{}},Wf;function k9(){return Wf||(Wf=1,function(i,e){(function(t,s,n){i.exports=s(he(),ro(),q1())})(oe,function(t){return function(){var s=t,n=s.x64,r=n.Word,o=n.WordArray,a=s.algo,c=a.SHA512,l=a.SHA384=c.extend({_doReset:function(){this._hash=new o.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var u=c._doFinalize.call(this);return u.sigBytes-=16,u}});s.SHA384=c._createHelper(l),s.HmacSHA384=c._createHmacHelper(l)}(),t.SHA384})}(Qo)),Qo.exports}var Yo={exports:{}},zf;function B9(){return zf||(zf=1,function(i,e){(function(t,s,n){i.exports=s(he(),ro())})(oe,function(t){return function(s){var n=t,r=n.lib,o=r.WordArray,a=r.Hasher,c=n.x64,l=c.Word,u=n.algo,f=[],h=[],d=[];(function(){for(var g=1,y=0,v=0;v<24;v++){f[g+5*y]=(v+1)*(v+2)/2%64;var x=y%5,E=(2*g+3*y)%5;g=x,y=E}for(var g=0;g<5;g++)for(var y=0;y<5;y++)h[g+5*y]=y+(2*g+3*y)%5*5;for(var S=1,T=0;T<24;T++){for(var _=0,I=0,R=0;R<7;R++){if(S&1){var b=(1<<R)-1;b<32?I^=1<<b:_^=1<<b-32}S&128?S=S<<1^113:S<<=1}d[T]=l.create(_,I)}})();var p=[];(function(){for(var g=0;g<25;g++)p[g]=l.create()})();var m=u.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var g=this._state=[],y=0;y<25;y++)g[y]=new l.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(g,y){for(var v=this._state,x=this.blockSize/2,E=0;E<x;E++){var S=g[y+2*E],T=g[y+2*E+1];S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360;var _=v[E];_.high^=T,_.low^=S}for(var I=0;I<24;I++){for(var R=0;R<5;R++){for(var b=0,L=0,k=0;k<5;k++){var _=v[R+5*k];b^=_.high,L^=_.low}var M=p[R];M.high=b,M.low=L}for(var R=0;R<5;R++)for(var N=p[(R+4)%5],F=p[(R+1)%5],O=F.high,K=F.low,b=N.high^(O<<1|K>>>31),L=N.low^(K<<1|O>>>31),k=0;k<5;k++){var _=v[R+5*k];_.high^=b,_.low^=L}for(var B=1;B<25;B++){var b,L,_=v[B],G=_.high,H=_.low,C=f[B];C<32?(b=G<<C|H>>>32-C,L=H<<C|G>>>32-C):(b=H<<C-32|G>>>64-C,L=G<<C-32|H>>>64-C);var D=p[h[B]];D.high=b,D.low=L}var P=p[0],w=v[0];P.high=w.high,P.low=w.low;for(var R=0;R<5;R++)for(var k=0;k<5;k++){var B=R+5*k,_=v[B],W=p[B],z=p[(R+1)%5+5*k],ne=p[(R+2)%5+5*k];_.high=W.high^~z.high&ne.high,_.low=W.low^~z.low&ne.low}var _=v[0],ee=d[I];_.high^=ee.high,_.low^=ee.low}},_doFinalize:function(){var g=this._data,y=g.words;this._nDataBytes*8;var v=g.sigBytes*8,x=this.blockSize*32;y[v>>>5]|=1<<24-v%32,y[(s.ceil((v+1)/x)*x>>>5)-1]|=128,g.sigBytes=y.length*4,this._process();for(var E=this._state,S=this.cfg.outputLength/8,T=S/8,_=[],I=0;I<T;I++){var R=E[I],b=R.high,L=R.low;b=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,L=(L<<8|L>>>24)&16711935|(L<<24|L>>>8)&4278255360,_.push(L),_.push(b)}return new o.init(_,S)},clone:function(){for(var g=a.clone.call(this),y=g._state=this._state.slice(0),v=0;v<25;v++)y[v]=y[v].clone();return g}});n.SHA3=a._createHelper(m),n.HmacSHA3=a._createHmacHelper(m)}(Math),t.SHA3})}(Yo)),Yo.exports}var Xo={exports:{}},Qf;function F9(){return Qf||(Qf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){/** @preserve
- (c) 2012 by Cédric Mesnil. All rights reserved.
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */return function(s){var n=t,r=n.lib,o=r.WordArray,a=r.Hasher,c=n.algo,l=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),f=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),h=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),p=o.create([1352829926,1548603684,1836072691,2053994217,0]),m=c.RIPEMD160=a.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(T,_){for(var I=0;I<16;I++){var R=_+I,b=T[R];T[R]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}var L=this._hash.words,k=d.words,M=p.words,N=l.words,F=u.words,O=f.words,K=h.words,B,G,H,C,D,P,w,W,z,ne;P=B=L[0],w=G=L[1],W=H=L[2],z=C=L[3],ne=D=L[4];for(var ee,I=0;I<80;I+=1)ee=B+T[_+N[I]]|0,I<16?ee+=g(G,H,C)+k[0]:I<32?ee+=y(G,H,C)+k[1]:I<48?ee+=v(G,H,C)+k[2]:I<64?ee+=x(G,H,C)+k[3]:ee+=E(G,H,C)+k[4],ee=ee|0,ee=S(ee,O[I]),ee=ee+D|0,B=D,D=C,C=S(H,10),H=G,G=ee,ee=P+T[_+F[I]]|0,I<16?ee+=E(w,W,z)+M[0]:I<32?ee+=x(w,W,z)+M[1]:I<48?ee+=v(w,W,z)+M[2]:I<64?ee+=y(w,W,z)+M[3]:ee+=g(w,W,z)+M[4],ee=ee|0,ee=S(ee,K[I]),ee=ee+ne|0,P=ne,ne=z,z=S(W,10),W=w,w=ee;ee=L[1]+H+z|0,L[1]=L[2]+C+ne|0,L[2]=L[3]+D+P|0,L[3]=L[4]+B+w|0,L[4]=L[0]+G+W|0,L[0]=ee},_doFinalize:function(){var T=this._data,_=T.words,I=this._nDataBytes*8,R=T.sigBytes*8;_[R>>>5]|=128<<24-R%32,_[(R+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,T.sigBytes=(_.length+1)*4,this._process();for(var b=this._hash,L=b.words,k=0;k<5;k++){var M=L[k];L[k]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return b},clone:function(){var T=a.clone.call(this);return T._hash=this._hash.clone(),T}});function g(T,_,I){return T^_^I}function y(T,_,I){return T&_|~T&I}function v(T,_,I){return(T|~_)^I}function x(T,_,I){return T&I|_&~I}function E(T,_,I){return T^(_|~I)}function S(T,_){return T<<_|T>>>32-_}n.RIPEMD160=a._createHelper(m),n.HmacRIPEMD160=a._createHmacHelper(m)}(),t.RIPEMD160})}(Xo)),Xo.exports}var Jo={exports:{}},Yf;function Yc(){return Yf||(Yf=1,function(i,e){(function(t,s){i.exports=s(he())})(oe,function(t){(function(){var s=t,n=s.lib,r=n.Base,o=s.enc,a=o.Utf8,c=s.algo;c.HMAC=r.extend({init:function(l,u){l=this._hasher=new l.init,typeof u=="string"&&(u=a.parse(u));var f=l.blockSize,h=f*4;u.sigBytes>h&&(u=l.finalize(u)),u.clamp();for(var d=this._oKey=u.clone(),p=this._iKey=u.clone(),m=d.words,g=p.words,y=0;y<f;y++)m[y]^=1549556828,g[y]^=909522486;d.sigBytes=p.sigBytes=h,this.reset()},reset:function(){var l=this._hasher;l.reset(),l.update(this._iKey)},update:function(l){return this._hasher.update(l),this},finalize:function(l){var u=this._hasher,f=u.finalize(l);u.reset();var h=u.finalize(this._oKey.clone().concat(f));return h}})})()})}(Jo)),Jo.exports}var Zo={exports:{}},Xf;function O9(){return Xf||(Xf=1,function(i,e){(function(t,s,n){i.exports=s(he(),Qc(),Yc())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.Base,o=n.WordArray,a=s.algo,c=a.SHA256,l=a.HMAC,u=a.PBKDF2=r.extend({cfg:r.extend({keySize:128/32,hasher:c,iterations:25e4}),init:function(f){this.cfg=this.cfg.extend(f)},compute:function(f,h){for(var d=this.cfg,p=l.create(d.hasher,f),m=o.create(),g=o.create([1]),y=m.words,v=g.words,x=d.keySize,E=d.iterations;y.length<x;){var S=p.update(h).finalize(g);p.reset();for(var T=S.words,_=T.length,I=S,R=1;R<E;R++){I=p.finalize(I),p.reset();for(var b=I.words,L=0;L<_;L++)T[L]^=b[L]}m.concat(S),v[0]++}return m.sigBytes=x*4,m}});s.PBKDF2=function(f,h,d){return u.create(d).compute(f,h)}}(),t.PBKDF2})}(Zo)),Zo.exports}var ea={exports:{}},Jf;function As(){return Jf||(Jf=1,function(i,e){(function(t,s,n){i.exports=s(he(),j1(),Yc())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.Base,o=n.WordArray,a=s.algo,c=a.MD5,l=a.EvpKDF=r.extend({cfg:r.extend({keySize:128/32,hasher:c,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,f){for(var h,d=this.cfg,p=d.hasher.create(),m=o.create(),g=m.words,y=d.keySize,v=d.iterations;g.length<y;){h&&p.update(h),h=p.update(u).finalize(f),p.reset();for(var x=1;x<v;x++)h=p.finalize(h),p.reset();m.concat(h)}return m.sigBytes=y*4,m}});s.EvpKDF=function(u,f,h){return l.create(h).compute(u,f)}}(),t.EvpKDF})}(ea)),ea.exports}var ta={exports:{}},Zf;function Ge(){return Zf||(Zf=1,function(i,e){(function(t,s,n){i.exports=s(he(),As())})(oe,function(t){t.lib.Cipher||function(s){var n=t,r=n.lib,o=r.Base,a=r.WordArray,c=r.BufferedBlockAlgorithm,l=n.enc;l.Utf8;var u=l.Base64,f=n.algo,h=f.EvpKDF,d=r.Cipher=c.extend({cfg:o.extend(),createEncryptor:function(b,L){return this.create(this._ENC_XFORM_MODE,b,L)},createDecryptor:function(b,L){return this.create(this._DEC_XFORM_MODE,b,L)},init:function(b,L,k){this.cfg=this.cfg.extend(k),this._xformMode=b,this._key=L,this.reset()},reset:function(){c.reset.call(this),this._doReset()},process:function(b){return this._append(b),this._process()},finalize:function(b){b&&this._append(b);var L=this._doFinalize();return L},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function b(L){return typeof L=="string"?R:T}return function(L){return{encrypt:function(k,M,N){return b(M).encrypt(L,k,M,N)},decrypt:function(k,M,N){return b(M).decrypt(L,k,M,N)}}}}()});r.StreamCipher=d.extend({_doFinalize:function(){var b=this._process(!0);return b},blockSize:1});var p=n.mode={},m=r.BlockCipherMode=o.extend({createEncryptor:function(b,L){return this.Encryptor.create(b,L)},createDecryptor:function(b,L){return this.Decryptor.create(b,L)},init:function(b,L){this._cipher=b,this._iv=L}}),g=p.CBC=function(){var b=m.extend();b.Encryptor=b.extend({processBlock:function(k,M){var N=this._cipher,F=N.blockSize;L.call(this,k,M,F),N.encryptBlock(k,M),this._prevBlock=k.slice(M,M+F)}}),b.Decryptor=b.extend({processBlock:function(k,M){var N=this._cipher,F=N.blockSize,O=k.slice(M,M+F);N.decryptBlock(k,M),L.call(this,k,M,F),this._prevBlock=O}});function L(k,M,N){var F,O=this._iv;O?(F=O,this._iv=s):F=this._prevBlock;for(var K=0;K<N;K++)k[M+K]^=F[K]}return b}(),y=n.pad={},v=y.Pkcs7={pad:function(b,L){for(var k=L*4,M=k-b.sigBytes%k,N=M<<24|M<<16|M<<8|M,F=[],O=0;O<M;O+=4)F.push(N);var K=a.create(F,M);b.concat(K)},unpad:function(b){var L=b.words[b.sigBytes-1>>>2]&255;b.sigBytes-=L}};r.BlockCipher=d.extend({cfg:d.cfg.extend({mode:g,padding:v}),reset:function(){var b;d.reset.call(this);var L=this.cfg,k=L.iv,M=L.mode;this._xformMode==this._ENC_XFORM_MODE?b=M.createEncryptor:(b=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==b?this._mode.init(this,k&&k.words):(this._mode=b.call(M,this,k&&k.words),this._mode.__creator=b)},_doProcessBlock:function(b,L){this._mode.processBlock(b,L)},_doFinalize:function(){var b,L=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(L.pad(this._data,this.blockSize),b=this._process(!0)):(b=this._process(!0),L.unpad(b)),b},blockSize:128/32});var x=r.CipherParams=o.extend({init:function(b){this.mixIn(b)},toString:function(b){return(b||this.formatter).stringify(this)}}),E=n.format={},S=E.OpenSSL={stringify:function(b){var L,k=b.ciphertext,M=b.salt;return M?L=a.create([1398893684,1701076831]).concat(M).concat(k):L=k,L.toString(u)},parse:function(b){var L,k=u.parse(b),M=k.words;return M[0]==1398893684&&M[1]==1701076831&&(L=a.create(M.slice(2,4)),M.splice(0,4),k.sigBytes-=16),x.create({ciphertext:k,salt:L})}},T=r.SerializableCipher=o.extend({cfg:o.extend({format:S}),encrypt:function(b,L,k,M){M=this.cfg.extend(M);var N=b.createEncryptor(k,M),F=N.finalize(L),O=N.cfg;return x.create({ciphertext:F,key:k,iv:O.iv,algorithm:b,mode:O.mode,padding:O.padding,blockSize:b.blockSize,formatter:M.format})},decrypt:function(b,L,k,M){M=this.cfg.extend(M),L=this._parse(L,M.format);var N=b.createDecryptor(k,M).finalize(L.ciphertext);return N},_parse:function(b,L){return typeof b=="string"?L.parse(b,this):b}}),_=n.kdf={},I=_.OpenSSL={execute:function(b,L,k,M,N){if(M||(M=a.random(64/8)),N)var F=h.create({keySize:L+k,hasher:N}).compute(b,M);else var F=h.create({keySize:L+k}).compute(b,M);var O=a.create(F.words.slice(L),k*4);return F.sigBytes=L*4,x.create({key:F,iv:O,salt:M})}},R=r.PasswordBasedCipher=T.extend({cfg:T.cfg.extend({kdf:I}),encrypt:function(b,L,k,M){M=this.cfg.extend(M);var N=M.kdf.execute(k,b.keySize,b.ivSize,M.salt,M.hasher);M.iv=N.iv;var F=T.encrypt.call(this,b,L,N.key,M);return F.mixIn(N),F},decrypt:function(b,L,k,M){M=this.cfg.extend(M),L=this._parse(L,M.format);var N=M.kdf.execute(k,b.keySize,b.ivSize,L.salt,M.hasher);M.iv=N.iv;var F=T.decrypt.call(this,b,L,N.key,M);return F}})}()})}(ta)),ta.exports}var sa={exports:{}},eh;function M9(){return eh||(eh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.mode.CFB=function(){var s=t.lib.BlockCipherMode.extend();s.Encryptor=s.extend({processBlock:function(r,o){var a=this._cipher,c=a.blockSize;n.call(this,r,o,c,a),this._prevBlock=r.slice(o,o+c)}}),s.Decryptor=s.extend({processBlock:function(r,o){var a=this._cipher,c=a.blockSize,l=r.slice(o,o+c);n.call(this,r,o,c,a),this._prevBlock=l}});function n(r,o,a,c){var l,u=this._iv;u?(l=u.slice(0),this._iv=void 0):l=this._prevBlock,c.encryptBlock(l,0);for(var f=0;f<a;f++)r[o+f]^=l[f]}return s}(),t.mode.CFB})}(sa)),sa.exports}var ia={exports:{}},th;function N9(){return th||(th=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.mode.CTR=function(){var s=t.lib.BlockCipherMode.extend(),n=s.Encryptor=s.extend({processBlock:function(r,o){var a=this._cipher,c=a.blockSize,l=this._iv,u=this._counter;l&&(u=this._counter=l.slice(0),this._iv=void 0);var f=u.slice(0);a.encryptBlock(f,0),u[c-1]=u[c-1]+1|0;for(var h=0;h<c;h++)r[o+h]^=f[h]}});return s.Decryptor=n,s}(),t.mode.CTR})}(ia)),ia.exports}var na={exports:{}},sh;function U9(){return sh||(sh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){/** @preserve
- * Counter block mode compatible with Dr Brian Gladman fileenc.c
- * derived from CryptoJS.mode.CTR
- * Jan Hruby jhruby.web@gmail.com
- */return t.mode.CTRGladman=function(){var s=t.lib.BlockCipherMode.extend();function n(a){if((a>>24&255)===255){var c=a>>16&255,l=a>>8&255,u=a&255;c===255?(c=0,l===255?(l=0,u===255?u=0:++u):++l):++c,a=0,a+=c<<16,a+=l<<8,a+=u}else a+=1<<24;return a}function r(a){return(a[0]=n(a[0]))===0&&(a[1]=n(a[1])),a}var o=s.Encryptor=s.extend({processBlock:function(a,c){var l=this._cipher,u=l.blockSize,f=this._iv,h=this._counter;f&&(h=this._counter=f.slice(0),this._iv=void 0),r(h);var d=h.slice(0);l.encryptBlock(d,0);for(var p=0;p<u;p++)a[c+p]^=d[p]}});return s.Decryptor=o,s}(),t.mode.CTRGladman})}(na)),na.exports}var ra={exports:{}},ih;function $9(){return ih||(ih=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.mode.OFB=function(){var s=t.lib.BlockCipherMode.extend(),n=s.Encryptor=s.extend({processBlock:function(r,o){var a=this._cipher,c=a.blockSize,l=this._iv,u=this._keystream;l&&(u=this._keystream=l.slice(0),this._iv=void 0),a.encryptBlock(u,0);for(var f=0;f<c;f++)r[o+f]^=u[f]}});return s.Decryptor=n,s}(),t.mode.OFB})}(ra)),ra.exports}var oa={exports:{}},nh;function H9(){return nh||(nh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.mode.ECB=function(){var s=t.lib.BlockCipherMode.extend();return s.Encryptor=s.extend({processBlock:function(n,r){this._cipher.encryptBlock(n,r)}}),s.Decryptor=s.extend({processBlock:function(n,r){this._cipher.decryptBlock(n,r)}}),s}(),t.mode.ECB})}(oa)),oa.exports}var aa={exports:{}},rh;function G9(){return rh||(rh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.pad.AnsiX923={pad:function(s,n){var r=s.sigBytes,o=n*4,a=o-r%o,c=r+a-1;s.clamp(),s.words[c>>>2]|=a<<24-c%4*8,s.sigBytes+=a},unpad:function(s){var n=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=n}},t.pad.Ansix923})}(aa)),aa.exports}var la={exports:{}},oh;function K9(){return oh||(oh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.pad.Iso10126={pad:function(s,n){var r=n*4,o=r-s.sigBytes%r;s.concat(t.lib.WordArray.random(o-1)).concat(t.lib.WordArray.create([o<<24],1))},unpad:function(s){var n=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=n}},t.pad.Iso10126})}(la)),la.exports}var ca={exports:{}},ah;function V9(){return ah||(ah=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.pad.Iso97971={pad:function(s,n){s.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(s,n)},unpad:function(s){t.pad.ZeroPadding.unpad(s),s.sigBytes--}},t.pad.Iso97971})}(ca)),ca.exports}var ua={exports:{}},lh;function j9(){return lh||(lh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.pad.ZeroPadding={pad:function(s,n){var r=n*4;s.clamp(),s.sigBytes+=r-(s.sigBytes%r||r)},unpad:function(s){for(var n=s.words,r=s.sigBytes-1,r=s.sigBytes-1;r>=0;r--)if(n[r>>>2]>>>24-r%4*8&255){s.sigBytes=r+1;break}}},t.pad.ZeroPadding})}(ua)),ua.exports}var fa={exports:{}},ch;function q9(){return ch||(ch=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}(fa)),fa.exports}var ha={exports:{}},uh;function W9(){return uh||(uh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ge())})(oe,function(t){return function(s){var n=t,r=n.lib,o=r.CipherParams,a=n.enc,c=a.Hex,l=n.format;l.Hex={stringify:function(u){return u.ciphertext.toString(c)},parse:function(u){var f=c.parse(u);return o.create({ciphertext:f})}}}(),t.format.Hex})}(ha)),ha.exports}var da={exports:{}},fh;function z9(){return fh||(fh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ys(),Xs(),As(),Ge())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.BlockCipher,o=s.algo,a=[],c=[],l=[],u=[],f=[],h=[],d=[],p=[],m=[],g=[];(function(){for(var x=[],E=0;E<256;E++)E<128?x[E]=E<<1:x[E]=E<<1^283;for(var S=0,T=0,E=0;E<256;E++){var _=T^T<<1^T<<2^T<<3^T<<4;_=_>>>8^_&255^99,a[S]=_,c[_]=S;var I=x[S],R=x[I],b=x[R],L=x[_]*257^_*16843008;l[S]=L<<24|L>>>8,u[S]=L<<16|L>>>16,f[S]=L<<8|L>>>24,h[S]=L;var L=b*16843009^R*65537^I*257^S*16843008;d[_]=L<<24|L>>>8,p[_]=L<<16|L>>>16,m[_]=L<<8|L>>>24,g[_]=L,S?(S=I^x[x[x[b^I]]],T^=x[x[T]]):S=T=1}})();var y=[0,1,2,4,8,16,32,64,128,27,54],v=o.AES=r.extend({_doReset:function(){var x;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var E=this._keyPriorReset=this._key,S=E.words,T=E.sigBytes/4,_=this._nRounds=T+6,I=(_+1)*4,R=this._keySchedule=[],b=0;b<I;b++)b<T?R[b]=S[b]:(x=R[b-1],b%T?T>6&&b%T==4&&(x=a[x>>>24]<<24|a[x>>>16&255]<<16|a[x>>>8&255]<<8|a[x&255]):(x=x<<8|x>>>24,x=a[x>>>24]<<24|a[x>>>16&255]<<16|a[x>>>8&255]<<8|a[x&255],x^=y[b/T|0]<<24),R[b]=R[b-T]^x);for(var L=this._invKeySchedule=[],k=0;k<I;k++){var b=I-k;if(k%4)var x=R[b];else var x=R[b-4];k<4||b<=4?L[k]=x:L[k]=d[a[x>>>24]]^p[a[x>>>16&255]]^m[a[x>>>8&255]]^g[a[x&255]]}}},encryptBlock:function(x,E){this._doCryptBlock(x,E,this._keySchedule,l,u,f,h,a)},decryptBlock:function(x,E){var S=x[E+1];x[E+1]=x[E+3],x[E+3]=S,this._doCryptBlock(x,E,this._invKeySchedule,d,p,m,g,c);var S=x[E+1];x[E+1]=x[E+3],x[E+3]=S},_doCryptBlock:function(x,E,S,T,_,I,R,b){for(var L=this._nRounds,k=x[E]^S[0],M=x[E+1]^S[1],N=x[E+2]^S[2],F=x[E+3]^S[3],O=4,K=1;K<L;K++){var B=T[k>>>24]^_[M>>>16&255]^I[N>>>8&255]^R[F&255]^S[O++],G=T[M>>>24]^_[N>>>16&255]^I[F>>>8&255]^R[k&255]^S[O++],H=T[N>>>24]^_[F>>>16&255]^I[k>>>8&255]^R[M&255]^S[O++],C=T[F>>>24]^_[k>>>16&255]^I[M>>>8&255]^R[N&255]^S[O++];k=B,M=G,N=H,F=C}var B=(b[k>>>24]<<24|b[M>>>16&255]<<16|b[N>>>8&255]<<8|b[F&255])^S[O++],G=(b[M>>>24]<<24|b[N>>>16&255]<<16|b[F>>>8&255]<<8|b[k&255])^S[O++],H=(b[N>>>24]<<24|b[F>>>16&255]<<16|b[k>>>8&255]<<8|b[M&255])^S[O++],C=(b[F>>>24]<<24|b[k>>>16&255]<<16|b[M>>>8&255]<<8|b[N&255])^S[O++];x[E]=B,x[E+1]=G,x[E+2]=H,x[E+3]=C},keySize:256/32});s.AES=r._createHelper(v)}(),t.AES})}(da)),da.exports}var pa={exports:{}},hh;function Q9(){return hh||(hh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ys(),Xs(),As(),Ge())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.WordArray,o=n.BlockCipher,a=s.algo,c=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],l=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],f=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=a.DES=o.extend({_doReset:function(){for(var y=this._key,v=y.words,x=[],E=0;E<56;E++){var S=c[E]-1;x[E]=v[S>>>5]>>>31-S%32&1}for(var T=this._subKeys=[],_=0;_<16;_++){for(var I=T[_]=[],R=u[_],E=0;E<24;E++)I[E/6|0]|=x[(l[E]-1+R)%28]<<31-E%6,I[4+(E/6|0)]|=x[28+(l[E+24]-1+R)%28]<<31-E%6;I[0]=I[0]<<1|I[0]>>>31;for(var E=1;E<7;E++)I[E]=I[E]>>>(E-1)*4+3;I[7]=I[7]<<5|I[7]>>>27}for(var b=this._invSubKeys=[],E=0;E<16;E++)b[E]=T[15-E]},encryptBlock:function(y,v){this._doCryptBlock(y,v,this._subKeys)},decryptBlock:function(y,v){this._doCryptBlock(y,v,this._invSubKeys)},_doCryptBlock:function(y,v,x){this._lBlock=y[v],this._rBlock=y[v+1],p.call(this,4,252645135),p.call(this,16,65535),m.call(this,2,858993459),m.call(this,8,16711935),p.call(this,1,1431655765);for(var E=0;E<16;E++){for(var S=x[E],T=this._lBlock,_=this._rBlock,I=0,R=0;R<8;R++)I|=f[R][((_^S[R])&h[R])>>>0];this._lBlock=_,this._rBlock=T^I}var b=this._lBlock;this._lBlock=this._rBlock,this._rBlock=b,p.call(this,1,1431655765),m.call(this,8,16711935),m.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),y[v]=this._lBlock,y[v+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function p(y,v){var x=(this._lBlock>>>y^this._rBlock)&v;this._rBlock^=x,this._lBlock^=x<<y}function m(y,v){var x=(this._rBlock>>>y^this._lBlock)&v;this._lBlock^=x,this._rBlock^=x<<y}s.DES=o._createHelper(d);var g=a.TripleDES=o.extend({_doReset:function(){var y=this._key,v=y.words;if(v.length!==2&&v.length!==4&&v.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var x=v.slice(0,2),E=v.length<4?v.slice(0,2):v.slice(2,4),S=v.length<6?v.slice(0,2):v.slice(4,6);this._des1=d.createEncryptor(r.create(x)),this._des2=d.createEncryptor(r.create(E)),this._des3=d.createEncryptor(r.create(S))},encryptBlock:function(y,v){this._des1.encryptBlock(y,v),this._des2.decryptBlock(y,v),this._des3.encryptBlock(y,v)},decryptBlock:function(y,v){this._des3.decryptBlock(y,v),this._des2.encryptBlock(y,v),this._des1.decryptBlock(y,v)},keySize:192/32,ivSize:64/32,blockSize:64/32});s.TripleDES=o._createHelper(g)}(),t.TripleDES})}(pa)),pa.exports}var ga={exports:{}},dh;function Y9(){return dh||(dh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ys(),Xs(),As(),Ge())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.StreamCipher,o=s.algo,a=o.RC4=r.extend({_doReset:function(){for(var u=this._key,f=u.words,h=u.sigBytes,d=this._S=[],p=0;p<256;p++)d[p]=p;for(var p=0,m=0;p<256;p++){var g=p%h,y=f[g>>>2]>>>24-g%4*8&255;m=(m+d[p]+y)%256;var v=d[p];d[p]=d[m],d[m]=v}this._i=this._j=0},_doProcessBlock:function(u,f){u[f]^=c.call(this)},keySize:256/32,ivSize:0});function c(){for(var u=this._S,f=this._i,h=this._j,d=0,p=0;p<4;p++){f=(f+1)%256,h=(h+u[f])%256;var m=u[f];u[f]=u[h],u[h]=m,d|=u[(u[f]+u[h])%256]<<24-p*8}return this._i=f,this._j=h,d}s.RC4=r._createHelper(a);var l=o.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var u=this.cfg.drop;u>0;u--)c.call(this)}});s.RC4Drop=r._createHelper(l)}(),t.RC4})}(ga)),ga.exports}var ma={exports:{}},ph;function X9(){return ph||(ph=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ys(),Xs(),As(),Ge())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.StreamCipher,o=s.algo,a=[],c=[],l=[],u=o.Rabbit=r.extend({_doReset:function(){for(var h=this._key.words,d=this.cfg.iv,p=0;p<4;p++)h[p]=(h[p]<<8|h[p]>>>24)&16711935|(h[p]<<24|h[p]>>>8)&4278255360;var m=this._X=[h[0],h[3]<<16|h[2]>>>16,h[1],h[0]<<16|h[3]>>>16,h[2],h[1]<<16|h[0]>>>16,h[3],h[2]<<16|h[1]>>>16],g=this._C=[h[2]<<16|h[2]>>>16,h[0]&4294901760|h[1]&65535,h[3]<<16|h[3]>>>16,h[1]&4294901760|h[2]&65535,h[0]<<16|h[0]>>>16,h[2]&4294901760|h[3]&65535,h[1]<<16|h[1]>>>16,h[3]&4294901760|h[0]&65535];this._b=0;for(var p=0;p<4;p++)f.call(this);for(var p=0;p<8;p++)g[p]^=m[p+4&7];if(d){var y=d.words,v=y[0],x=y[1],E=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,S=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,T=E>>>16|S&4294901760,_=S<<16|E&65535;g[0]^=E,g[1]^=T,g[2]^=S,g[3]^=_,g[4]^=E,g[5]^=T,g[6]^=S,g[7]^=_;for(var p=0;p<4;p++)f.call(this)}},_doProcessBlock:function(h,d){var p=this._X;f.call(this),a[0]=p[0]^p[5]>>>16^p[3]<<16,a[1]=p[2]^p[7]>>>16^p[5]<<16,a[2]=p[4]^p[1]>>>16^p[7]<<16,a[3]=p[6]^p[3]>>>16^p[1]<<16;for(var m=0;m<4;m++)a[m]=(a[m]<<8|a[m]>>>24)&16711935|(a[m]<<24|a[m]>>>8)&4278255360,h[d+m]^=a[m]},blockSize:128/32,ivSize:64/32});function f(){for(var h=this._X,d=this._C,p=0;p<8;p++)c[p]=d[p];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<c[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<c[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<c[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<c[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<c[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<c[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<c[6]>>>0?1:0)|0,this._b=d[7]>>>0<c[7]>>>0?1:0;for(var p=0;p<8;p++){var m=h[p]+d[p],g=m&65535,y=m>>>16,v=((g*g>>>17)+g*y>>>15)+y*y,x=((m&4294901760)*m|0)+((m&65535)*m|0);l[p]=v^x}h[0]=l[0]+(l[7]<<16|l[7]>>>16)+(l[6]<<16|l[6]>>>16)|0,h[1]=l[1]+(l[0]<<8|l[0]>>>24)+l[7]|0,h[2]=l[2]+(l[1]<<16|l[1]>>>16)+(l[0]<<16|l[0]>>>16)|0,h[3]=l[3]+(l[2]<<8|l[2]>>>24)+l[1]|0,h[4]=l[4]+(l[3]<<16|l[3]>>>16)+(l[2]<<16|l[2]>>>16)|0,h[5]=l[5]+(l[4]<<8|l[4]>>>24)+l[3]|0,h[6]=l[6]+(l[5]<<16|l[5]>>>16)+(l[4]<<16|l[4]>>>16)|0,h[7]=l[7]+(l[6]<<8|l[6]>>>24)+l[5]|0}s.Rabbit=r._createHelper(u)}(),t.Rabbit})}(ma)),ma.exports}var xa={exports:{}},gh;function J9(){return gh||(gh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ys(),Xs(),As(),Ge())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.StreamCipher,o=s.algo,a=[],c=[],l=[],u=o.RabbitLegacy=r.extend({_doReset:function(){var h=this._key.words,d=this.cfg.iv,p=this._X=[h[0],h[3]<<16|h[2]>>>16,h[1],h[0]<<16|h[3]>>>16,h[2],h[1]<<16|h[0]>>>16,h[3],h[2]<<16|h[1]>>>16],m=this._C=[h[2]<<16|h[2]>>>16,h[0]&4294901760|h[1]&65535,h[3]<<16|h[3]>>>16,h[1]&4294901760|h[2]&65535,h[0]<<16|h[0]>>>16,h[2]&4294901760|h[3]&65535,h[1]<<16|h[1]>>>16,h[3]&4294901760|h[0]&65535];this._b=0;for(var g=0;g<4;g++)f.call(this);for(var g=0;g<8;g++)m[g]^=p[g+4&7];if(d){var y=d.words,v=y[0],x=y[1],E=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,S=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,T=E>>>16|S&4294901760,_=S<<16|E&65535;m[0]^=E,m[1]^=T,m[2]^=S,m[3]^=_,m[4]^=E,m[5]^=T,m[6]^=S,m[7]^=_;for(var g=0;g<4;g++)f.call(this)}},_doProcessBlock:function(h,d){var p=this._X;f.call(this),a[0]=p[0]^p[5]>>>16^p[3]<<16,a[1]=p[2]^p[7]>>>16^p[5]<<16,a[2]=p[4]^p[1]>>>16^p[7]<<16,a[3]=p[6]^p[3]>>>16^p[1]<<16;for(var m=0;m<4;m++)a[m]=(a[m]<<8|a[m]>>>24)&16711935|(a[m]<<24|a[m]>>>8)&4278255360,h[d+m]^=a[m]},blockSize:128/32,ivSize:64/32});function f(){for(var h=this._X,d=this._C,p=0;p<8;p++)c[p]=d[p];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<c[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<c[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<c[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<c[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<c[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<c[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<c[6]>>>0?1:0)|0,this._b=d[7]>>>0<c[7]>>>0?1:0;for(var p=0;p<8;p++){var m=h[p]+d[p],g=m&65535,y=m>>>16,v=((g*g>>>17)+g*y>>>15)+y*y,x=((m&4294901760)*m|0)+((m&65535)*m|0);l[p]=v^x}h[0]=l[0]+(l[7]<<16|l[7]>>>16)+(l[6]<<16|l[6]>>>16)|0,h[1]=l[1]+(l[0]<<8|l[0]>>>24)+l[7]|0,h[2]=l[2]+(l[1]<<16|l[1]>>>16)+(l[0]<<16|l[0]>>>16)|0,h[3]=l[3]+(l[2]<<8|l[2]>>>24)+l[1]|0,h[4]=l[4]+(l[3]<<16|l[3]>>>16)+(l[2]<<16|l[2]>>>16)|0,h[5]=l[5]+(l[4]<<8|l[4]>>>24)+l[3]|0,h[6]=l[6]+(l[5]<<16|l[5]>>>16)+(l[4]<<16|l[4]>>>16)|0,h[7]=l[7]+(l[6]<<8|l[6]>>>24)+l[5]|0}s.RabbitLegacy=r._createHelper(u)}(),t.RabbitLegacy})}(xa)),xa.exports}var ya={exports:{}},mh;function Z9(){return mh||(mh=1,function(i,e){(function(t,s,n){i.exports=s(he(),Ys(),Xs(),As(),Ge())})(oe,function(t){return function(){var s=t,n=s.lib,r=n.BlockCipher,o=s.algo;const a=16,c=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],l=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function f(g,y){let v=y>>24&255,x=y>>16&255,E=y>>8&255,S=y&255,T=g.sbox[0][v]+g.sbox[1][x];return T=T^g.sbox[2][E],T=T+g.sbox[3][S],T}function h(g,y,v){let x=y,E=v,S;for(let T=0;T<a;++T)x=x^g.pbox[T],E=f(g,x)^E,S=x,x=E,E=S;return S=x,x=E,E=S,E=E^g.pbox[a],x=x^g.pbox[a+1],{left:x,right:E}}function d(g,y,v){let x=y,E=v,S;for(let T=a+1;T>1;--T)x=x^g.pbox[T],E=f(g,x)^E,S=x,x=E,E=S;return S=x,x=E,E=S,E=E^g.pbox[1],x=x^g.pbox[0],{left:x,right:E}}function p(g,y,v){for(let _=0;_<4;_++){g.sbox[_]=[];for(let I=0;I<256;I++)g.sbox[_][I]=l[_][I]}let x=0;for(let _=0;_<a+2;_++)g.pbox[_]=c[_]^y[x],x++,x>=v&&(x=0);let E=0,S=0,T=0;for(let _=0;_<a+2;_+=2)T=h(g,E,S),E=T.left,S=T.right,g.pbox[_]=E,g.pbox[_+1]=S;for(let _=0;_<4;_++)for(let I=0;I<256;I+=2)T=h(g,E,S),E=T.left,S=T.right,g.sbox[_][I]=E,g.sbox[_][I+1]=S;return!0}var m=o.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var g=this._keyPriorReset=this._key,y=g.words,v=g.sigBytes/4;p(u,y,v)}},encryptBlock:function(g,y){var v=h(u,g[y],g[y+1]);g[y]=v.left,g[y+1]=v.right},decryptBlock:function(g,y){var v=d(u,g[y],g[y+1]);g[y]=v.left,g[y+1]=v.right},blockSize:64/32,keySize:128/32,ivSize:64/32});s.Blowfish=r._createHelper(m)}(),t.Blowfish})}(ya)),ya.exports}(function(i,e){(function(t,s,n){i.exports=s(he(),ro(),D9(),R9(),Ys(),w9(),Xs(),j1(),Qc(),P9(),q1(),k9(),B9(),F9(),Yc(),O9(),As(),Ge(),M9(),N9(),U9(),$9(),H9(),G9(),K9(),V9(),j9(),q9(),W9(),z9(),Q9(),Y9(),X9(),J9(),Z9())})(oe,function(t){return t})})(V1);var e7=V1.exports;const t7=K1(e7),s7={"^u--(.*)":"@/uni_modules/uview-plus/components/u-$1/u-$1.vue","^up-(.*)":"@/uni_modules/uview-plus/components/u-$1/u-$1.vue","^u-([^-].*)":"@/uni_modules/uview-plus/components/u-$1/u-$1.vue"},i7=[{path:"pages/home/index",style:{navigationBarTitleText:"",enablePullDownRefresh:!1}},{path:"pages/home/living",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/user/index",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/list/index",style:{navigationBarTitleText:"直播列表",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}},{path:"pages/home/live",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/games/index",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/auth/login",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/auth/findpass",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/auth/h5WxLogin",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/auth/loginIndex",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/auth/register",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}}],n7=[{root:"pages_shop",pages:[{path:"cart",style:{navigationBarTitleText:"购物车","app-plus":{titleNView:!1}}},{path:"goods",style:{navigationBarTitleText:"商品详情",enablePullDownRefresh:!1}},{path:"store",style:{navigationBarTitleText:"",enablePullDownRefresh:!1,navigationStyle:"custom",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}},{path:"order",style:{navigationBarTitleText:"我的订单",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}},{path:"confirmCreateOrder",style:{navigationBarTitleText:"确认订单",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}},{path:"paymentOrder",style:{navigationBarTitleText:"支付订单",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}},{path:"confirmPackageOrder",style:{navigationBarTitleText:"确认支付",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}},{path:"storeOrder",style:{navigationBarTitleText:"订单",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}},{path:"refundOrder",style:{navigationBarTitleText:"申请售后",enablePullDownRefresh:!1}},{path:"refundOrderProduct",style:{navigationBarTitleText:"订单售后",enablePullDownRefresh:!1}},{path:"storeOrderRefundList",style:{navigationBarTitleText:"我的售后",enablePullDownRefresh:!1,navigationBarBackgroundColor:"#ffffff",navigationBarTextStyle:"black"}},{path:"storeOrderRefundDetails",style:{navigationBarTitleText:"售后详情",enablePullDownRefresh:!1,navigationBarBackgroundColor:"#FF5C03",navigationBarTextStyle:"white"}},{path:"storeOrderRefundSubmit",style:{navigationBarTitleText:"提交售后",navigationBarTextStyle:"black",navigationBarBackgroundColor:"#ffffff"}},{path:"success",style:{navigationBarTitleText:"支付成功",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}},{path:"storeOrderDelivery",style:{navigationBarTitleText:"物流信息",enablePullDownRefresh:!1}}]},{root:"pages_user",pages:[{path:"address",style:{navigationBarTitleText:"收货地址","app-plus":{titleNView:!1}}},{path:"integral",style:{navigationBarTitleText:"我的芳华币",enablePullDownRefresh:!1,navigationBarBackgroundColor:"#ffffff",navigationBarTextStyle:"black"}},{path:"integralGoodsList",style:{navigationBarTitleText:"芳华币商城",enablePullDownRefresh:!1,navigationBarBackgroundColor:"#ffffff",navigationBarTextStyle:"black"}},{path:"addAddress",style:{navigationBarTitleText:"新建收货地址",navigationBarTextStyle:"black","app-plus":{bounce:"none"}}}]}],r7={navigationBarTextStyle:"black",navigationBarTitleText:"【S直播】",navigationBarBackgroundColor:"#f5f5f5",backgroundColor:"#f7f8fa"},o7={},a7={color:"#AEAEAE",selectedColor:"#000000",fontSize:"12px",borderStyle:"black",backgroundColor:"#fff",list:[{pagePath:"pages/list/index",iconPath:"/static/tabBar/query.png",selectedIconPath:"/static/tabBar/query_active.png",text:"列表"},{pagePath:"pages/games/index",iconPath:"/static/tabBar/pulverize.png",selectedIconPath:"/static/tabBar/pulverize_active.png",text:"合同粉碎"},{pagePath:"pages/user/index",iconPath:"/static/tabBar/user.png",selectedIconPath:"/static/tabBar/user_active.png",text:"我的"}]},W1={custom:s7,pages:i7,subPackages:n7,globalStyle:r7,uniIdRouter:o7,tabBar:a7};var l7=[];function c7(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Mt(i,e,t){return i(t={path:e,exports:{},require:function(s,n){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(n==null&&t.path)}},t.exports),t.exports}var u7=Mt(function(i,e){var t;i.exports=(t=t||function(s,n){var r=Object.create||function(){function g(){}return function(y){var v;return g.prototype=y,v=new g,g.prototype=null,v}}(),o={},a=o.lib={},c=a.Base={extend:function(g){var y=r(this);return g&&y.mixIn(g),y.hasOwnProperty("init")&&this.init!==y.init||(y.init=function(){y.$super.init.apply(this,arguments)}),y.init.prototype=y,y.$super=this,y},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var y in g)g.hasOwnProperty(y)&&(this[y]=g[y]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}},l=a.WordArray=c.extend({init:function(g,y){g=this.words=g||[],this.sigBytes=y!=n?y:4*g.length},toString:function(g){return(g||f).stringify(this)},concat:function(g){var y=this.words,v=g.words,x=this.sigBytes,E=g.sigBytes;if(this.clamp(),x%4)for(var S=0;S<E;S++){var T=v[S>>>2]>>>24-S%4*8&255;y[x+S>>>2]|=T<<24-(x+S)%4*8}else for(S=0;S<E;S+=4)y[x+S>>>2]=v[S>>>2];return this.sigBytes+=E,this},clamp:function(){var g=this.words,y=this.sigBytes;g[y>>>2]&=4294967295<<32-y%4*8,g.length=s.ceil(y/4)},clone:function(){var g=c.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var y,v=[],x=function(T){var _=987654321,I=4294967295;return function(){var R=((_=36969*(65535&_)+(_>>16)&I)<<16)+(T=18e3*(65535&T)+(T>>16)&I)&I;return R/=4294967296,(R+=.5)*(s.random()>.5?1:-1)}},E=0;E<g;E+=4){var S=x(4294967296*(y||s.random()));y=987654071*S(),v.push(4294967296*S()|0)}return new l.init(v,g)}}),u=o.enc={},f=u.Hex={stringify:function(g){for(var y=g.words,v=g.sigBytes,x=[],E=0;E<v;E++){var S=y[E>>>2]>>>24-E%4*8&255;x.push((S>>>4).toString(16)),x.push((15&S).toString(16))}return x.join("")},parse:function(g){for(var y=g.length,v=[],x=0;x<y;x+=2)v[x>>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new l.init(v,y/2)}},h=u.Latin1={stringify:function(g){for(var y=g.words,v=g.sigBytes,x=[],E=0;E<v;E++){var S=y[E>>>2]>>>24-E%4*8&255;x.push(String.fromCharCode(S))}return x.join("")},parse:function(g){for(var y=g.length,v=[],x=0;x<y;x++)v[x>>>2]|=(255&g.charCodeAt(x))<<24-x%4*8;return new l.init(v,y)}},d=u.Utf8={stringify:function(g){try{return decodeURIComponent(escape(h.stringify(g)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(g){return h.parse(unescape(encodeURIComponent(g)))}},p=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=d.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var y=this._data,v=y.words,x=y.sigBytes,E=this.blockSize,S=x/(4*E),T=(S=g?s.ceil(S):s.max((0|S)-this._minBufferSize,0))*E,_=s.min(4*T,x);if(T){for(var I=0;I<T;I+=E)this._doProcessBlock(v,I);var R=v.splice(0,T);y.sigBytes-=_}return new l.init(R,_)},clone:function(){var g=c.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0});a.Hasher=p.extend({cfg:c.extend(),init:function(g){this.cfg=this.cfg.extend(g),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(g){return this._append(g),this._process(),this},finalize:function(g){return g&&this._append(g),this._doFinalize()},blockSize:16,_createHelper:function(g){return function(y,v){return new g.init(v).finalize(y)}},_createHmacHelper:function(g){return function(y,v){return new m.HMAC.init(g,v).finalize(y)}}});var m=o.algo={};return o}(Math),t)}),ps=u7,f7=(Mt(function(i,e){var t;i.exports=(t=ps,function(s){var n=t,r=n.lib,o=r.WordArray,a=r.Hasher,c=n.algo,l=[];(function(){for(var m=0;m<64;m++)l[m]=4294967296*s.abs(s.sin(m+1))|0})();var u=c.MD5=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,g){for(var y=0;y<16;y++){var v=g+y,x=m[v];m[v]=16711935&(x<<8|x>>>24)|4278255360&(x<<24|x>>>8)}var E=this._hash.words,S=m[g+0],T=m[g+1],_=m[g+2],I=m[g+3],R=m[g+4],b=m[g+5],L=m[g+6],k=m[g+7],M=m[g+8],N=m[g+9],F=m[g+10],O=m[g+11],K=m[g+12],B=m[g+13],G=m[g+14],H=m[g+15],C=E[0],D=E[1],P=E[2],w=E[3];C=f(C,D,P,w,S,7,l[0]),w=f(w,C,D,P,T,12,l[1]),P=f(P,w,C,D,_,17,l[2]),D=f(D,P,w,C,I,22,l[3]),C=f(C,D,P,w,R,7,l[4]),w=f(w,C,D,P,b,12,l[5]),P=f(P,w,C,D,L,17,l[6]),D=f(D,P,w,C,k,22,l[7]),C=f(C,D,P,w,M,7,l[8]),w=f(w,C,D,P,N,12,l[9]),P=f(P,w,C,D,F,17,l[10]),D=f(D,P,w,C,O,22,l[11]),C=f(C,D,P,w,K,7,l[12]),w=f(w,C,D,P,B,12,l[13]),P=f(P,w,C,D,G,17,l[14]),C=h(C,D=f(D,P,w,C,H,22,l[15]),P,w,T,5,l[16]),w=h(w,C,D,P,L,9,l[17]),P=h(P,w,C,D,O,14,l[18]),D=h(D,P,w,C,S,20,l[19]),C=h(C,D,P,w,b,5,l[20]),w=h(w,C,D,P,F,9,l[21]),P=h(P,w,C,D,H,14,l[22]),D=h(D,P,w,C,R,20,l[23]),C=h(C,D,P,w,N,5,l[24]),w=h(w,C,D,P,G,9,l[25]),P=h(P,w,C,D,I,14,l[26]),D=h(D,P,w,C,M,20,l[27]),C=h(C,D,P,w,B,5,l[28]),w=h(w,C,D,P,_,9,l[29]),P=h(P,w,C,D,k,14,l[30]),C=d(C,D=h(D,P,w,C,K,20,l[31]),P,w,b,4,l[32]),w=d(w,C,D,P,M,11,l[33]),P=d(P,w,C,D,O,16,l[34]),D=d(D,P,w,C,G,23,l[35]),C=d(C,D,P,w,T,4,l[36]),w=d(w,C,D,P,R,11,l[37]),P=d(P,w,C,D,k,16,l[38]),D=d(D,P,w,C,F,23,l[39]),C=d(C,D,P,w,B,4,l[40]),w=d(w,C,D,P,S,11,l[41]),P=d(P,w,C,D,I,16,l[42]),D=d(D,P,w,C,L,23,l[43]),C=d(C,D,P,w,N,4,l[44]),w=d(w,C,D,P,K,11,l[45]),P=d(P,w,C,D,H,16,l[46]),C=p(C,D=d(D,P,w,C,_,23,l[47]),P,w,S,6,l[48]),w=p(w,C,D,P,k,10,l[49]),P=p(P,w,C,D,G,15,l[50]),D=p(D,P,w,C,b,21,l[51]),C=p(C,D,P,w,K,6,l[52]),w=p(w,C,D,P,I,10,l[53]),P=p(P,w,C,D,F,15,l[54]),D=p(D,P,w,C,T,21,l[55]),C=p(C,D,P,w,M,6,l[56]),w=p(w,C,D,P,H,10,l[57]),P=p(P,w,C,D,L,15,l[58]),D=p(D,P,w,C,B,21,l[59]),C=p(C,D,P,w,R,6,l[60]),w=p(w,C,D,P,O,10,l[61]),P=p(P,w,C,D,_,15,l[62]),D=p(D,P,w,C,N,21,l[63]),E[0]=E[0]+C|0,E[1]=E[1]+D|0,E[2]=E[2]+P|0,E[3]=E[3]+w|0},_doFinalize:function(){var m=this._data,g=m.words,y=8*this._nDataBytes,v=8*m.sigBytes;g[v>>>5]|=128<<24-v%32;var x=s.floor(y/4294967296),E=y;g[15+(v+64>>>9<<4)]=16711935&(x<<8|x>>>24)|4278255360&(x<<24|x>>>8),g[14+(v+64>>>9<<4)]=16711935&(E<<8|E>>>24)|4278255360&(E<<24|E>>>8),m.sigBytes=4*(g.length+1),this._process();for(var S=this._hash,T=S.words,_=0;_<4;_++){var I=T[_];T[_]=16711935&(I<<8|I>>>24)|4278255360&(I<<24|I>>>8)}return S},clone:function(){var m=a.clone.call(this);return m._hash=this._hash.clone(),m}});function f(m,g,y,v,x,E,S){var T=m+(g&y|~g&v)+x+S;return(T<<E|T>>>32-E)+g}function h(m,g,y,v,x,E,S){var T=m+(g&v|y&~v)+x+S;return(T<<E|T>>>32-E)+g}function d(m,g,y,v,x,E,S){var T=m+(g^y^v)+x+S;return(T<<E|T>>>32-E)+g}function p(m,g,y,v,x,E,S){var T=m+(y^(g|~v))+x+S;return(T<<E|T>>>32-E)+g}n.MD5=a._createHelper(u),n.HmacMD5=a._createHmacHelper(u)}(Math),t.MD5)}),Mt(function(i,e){var t;i.exports=(t=ps,void function(){var s=t,n=s.lib.Base,r=s.enc.Utf8;s.algo.HMAC=n.extend({init:function(o,a){o=this._hasher=new o.init,typeof a=="string"&&(a=r.parse(a));var c=o.blockSize,l=4*c;a.sigBytes>l&&(a=o.finalize(a)),a.clamp();for(var u=this._oKey=a.clone(),f=this._iKey=a.clone(),h=u.words,d=f.words,p=0;p<c;p++)h[p]^=1549556828,d[p]^=909522486;u.sigBytes=f.sigBytes=l,this.reset()},reset:function(){var o=this._hasher;o.reset(),o.update(this._iKey)},update:function(o){return this._hasher.update(o),this},finalize:function(o){var a=this._hasher,c=a.finalize(o);return a.reset(),a.finalize(this._oKey.clone().concat(c))}})}())}),Mt(function(i,e){i.exports=ps.HmacMD5})),h7=Mt(function(i,e){i.exports=ps.enc.Utf8}),d7=Mt(function(i,e){var t;i.exports=(t=ps,function(){var s=t,n=s.lib.WordArray;function r(o,a,c){for(var l=[],u=0,f=0;f<a;f++)if(f%4){var h=c[o.charCodeAt(f-1)]<<f%4*2,d=c[o.charCodeAt(f)]>>>6-f%4*2;l[u>>>2]|=(h|d)<<24-u%4*8,u++}return n.create(l,u)}s.enc.Base64={stringify:function(o){var a=o.words,c=o.sigBytes,l=this._map;o.clamp();for(var u=[],f=0;f<c;f+=3)for(var h=(a[f>>>2]>>>24-f%4*8&255)<<16|(a[f+1>>>2]>>>24-(f+1)%4*8&255)<<8|a[f+2>>>2]>>>24-(f+2)%4*8&255,d=0;d<4&&f+.75*d<c;d++)u.push(l.charAt(h>>>6*(3-d)&63));var p=l.charAt(64);if(p)for(;u.length%4;)u.push(p);return u.join("")},parse:function(o){var a=o.length,c=this._map,l=this._reverseMap;if(!l){l=this._reverseMap=[];for(var u=0;u<c.length;u++)l[c.charCodeAt(u)]=u}var f=c.charAt(64);if(f){var h=o.indexOf(f);h!==-1&&(a=h)}return r(o,a,l)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64)});const z1="uni_id_token",Q1="uni_id_token_expired",p7="uniIdToken",Nr={DEFAULT:"FUNCTION",FUNCTION:"FUNCTION",OBJECT:"OBJECT",CLIENT_DB:"CLIENT_DB"},xh="pending",g7="fulfilled",yh="rejected";function dn(i){return Object.prototype.toString.call(i).slice(8,-1).toLowerCase()}function Y1(i){return dn(i)==="object"}function X1(i){return typeof i=="function"}function m7(i){return function(){try{return i.apply(i,arguments)}catch(e){console.error(e)}}}const vh="REJECTED",J1="NOT_PENDING";class Xc{constructor({createPromise:e,retryRule:t=vh}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case vh:return this.status===yh;case J1:return this.status!==xh}}exec(){return this.needRetry?(this.status=xh,this.promise=this.createPromise().then(e=>(this.status=g7,Promise.resolve(e)),e=>(this.status=yh,Promise.reject(e))),this.promise):this.promise}}class x7{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const s=this._callback[e];if(!s)return;const n=function(r,o){for(let a=r.length-1;a>=0;a--)if(r[a]===o)return a;return-1}(s,t);s.splice(n,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const s=this._callback[e];if(s)for(let n=0;n<s.length;n++)s[n](...t)}}function Jc(i){return i&&typeof i=="string"?JSON.parse(i):i}const y7=!0,v7="mp-weixin",E7=Jc(l7),Ti=v7,A7=Jc(""),Z1=Jc("[]")||[];let S7="";try{S7="__UNI__90F7D71"}catch{}let va={};function Gs(i,e={}){var t,s;return t=va,s=i,Object.prototype.hasOwnProperty.call(t,s)||(va[i]=e),va[i]}const em=["invoke","success","fail","complete"],Ot=Gs("_globalUniCloudInterceptor");function tm(i,e){Ot[i]||(Ot[i]={}),Y1(e)&&Object.keys(e).forEach(t=>{em.indexOf(t)>-1&&function(s,n,r){let o=Ot[s][n];o||(o=Ot[s][n]=[]),o.indexOf(r)===-1&&X1(r)&&o.push(r)}(i,t,e[t])})}function T7(i,e){Ot[i]||(Ot[i]={}),Y1(e)?Object.keys(e).forEach(t=>{em.indexOf(t)>-1&&function(s,n,r){const o=Ot[s][n];if(!o)return;const a=o.indexOf(r);a>-1&&o.splice(a,1)}(i,t,e[t])}):delete Ot[i]}function st(i,e){return i&&i.length!==0?i.reduce((t,s)=>t.then(()=>s(e)),Promise.resolve()):Promise.resolve()}function it(i,e){return Ot[i]&&Ot[i][e]||[]}function b7(i){tm("callObject",i)}const Ea=Gs("_globalUniCloudListener"),Re={RESPONSE:"response",NEED_LOGIN:"needLogin",REFRESH_TOKEN:"refreshToken"},ls={CLIENT_DB:"clientdb",CLOUD_FUNCTION:"cloudfunction",CLOUD_OBJECT:"cloudobject"};function bn(i){return Ea[i]||(Ea[i]=[]),Ea[i]}function Aa(i,e){const t=bn(i);t.includes(e)||t.push(e)}function Sa(i,e){const t=bn(i),s=t.indexOf(e);s!==-1&&t.splice(s,1)}function mt(i,e){const t=bn(i);for(let s=0;s<t.length;s++)(0,t[s])(e)}let Ta,ba=!1;function sm(){return Ta||(Ta=new Promise(i=>{ba&&i(),function e(){if(typeof getCurrentPages=="function"){const t=getCurrentPages();t&&t[0]&&(ba=!0,i())}ba||setTimeout(()=>{e()},30)}()}),Ta)}function im(i){const e={};for(const t in i){const s=i[t];X1(s)&&(e[t]=m7(s))}return e}class Q extends Error{constructor(e){const t=e.message||e.errMsg||"unknown system error";super(t),this.errMsg=t,this.code=this.errCode=e.code||e.errCode||"SYSTEM_ERROR",this.errSubject=this.subject=e.subject||e.errSubject,this.cause=e.cause,this.requestId=e.requestId}toJson(e=0){if(!(e>=10))return e++,{errCode:this.errCode,errMsg:this.errMsg,errSubject:this.errSubject,cause:this.cause&&this.cause.toJson?this.cause.toJson(e):this.cause}}}var we={request:i=>X.request(i),uploadFile:i=>X.uploadFile(i),setStorageSync:(i,e)=>X.setStorageSync(i,e),getStorageSync:i=>X.getStorageSync(i),removeStorageSync:i=>X.removeStorageSync(i),clearStorageSync:()=>X.clearStorageSync(),connectSocket:i=>X.connectSocket(i)};function nm(i){return i&&nm(i.__v_raw)||i}function pn(){return{token:we.getStorageSync(z1)||we.getStorageSync(p7),tokenExpired:we.getStorageSync(Q1)}}function rm({token:i,tokenExpired:e}={}){i&&we.setStorageSync(z1,i),e&&we.setStorageSync(Q1,e)}let _a,zn;function gn(){return _a||(_a=hs.canIUse("getAppBaseInfo")&&hs.canIUse("getDeviceInfo")?{...X.getAppBaseInfo(),...X.getDeviceInfo()}:X.getSystemInfoSync()),_a}function _7(){let i,e;try{if(X.getLaunchOptionsSync){if(X.getLaunchOptionsSync.toString().indexOf("not yet implemented")>-1)return;const{scene:t,channel:s}=X.getLaunchOptionsSync();i=s,e=t}}catch{}return{channel:i,scene:e}}let Ml={};function Nl(){const i=X.getLocale&&X.getLocale()||"en";if(zn)return{...Ml,...zn,locale:i,LOCALE:i};const e=gn(),{deviceId:t,osName:s,uniPlatform:n,appId:r}=e,o=["appId","appLanguage","appName","appVersion","appVersionCode","appWgtVersion","browserName","browserVersion","deviceBrand","deviceId","deviceModel","deviceType","osName","osVersion","romName","romVersion","ua","hostName","hostVersion","uniPlatform","uniRuntimeVersion","uniRuntimeVersionCode","uniCompilerVersion","uniCompilerVersionCode"];for(const a in e)Object.hasOwnProperty.call(e,a)&&o.indexOf(a)===-1&&delete e[a];return zn={PLATFORM:n,OS:s,APPID:r,DEVICEID:t,..._7(),...e},{...Ml,...zn,locale:i,LOCALE:i}}var ui={sign:function(i,e){let t="";return Object.keys(i).sort().forEach(function(s){i[s]&&(t=t+"&"+s+"="+i[s])}),t=t.slice(1),f7(t,e).toString()},wrappedRequest:function(i,e){return new Promise((t,s)=>{e(Object.assign(i,{complete(n){n||(n={});const r=n.data&&n.data.header&&n.data.header["x-serverless-request-id"]||n.header&&n.header["request-id"];if(!n.statusCode||n.statusCode>=400){const a=n.data&&n.data.error&&n.data.error.code||"SYS_ERR",c=n.data&&n.data.error&&n.data.error.message||n.errMsg||"request:fail";return s(new Q({code:a,message:c,requestId:r}))}const o=n.data;if(o.error)return s(new Q({code:o.error.code,message:o.error.message,requestId:r}));o.result=o.data,o.requestId=r,delete o.data,t(o)}}))})},toBase64:function(i){return d7.stringify(h7.parse(i))}},I7=class{constructor(i){["spaceId","clientSecret"].forEach(e=>{if(!Object.prototype.hasOwnProperty.call(i,e))throw new Error(`${e} required`)}),this.config=Object.assign({},{endpoint:i.spaceId.indexOf("mp-")===0?"https://api.next.bspapp.com":"https://api.bspapp.com"},i),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId,this.adapter=we,this._getAccessTokenPromiseHub=new Xc({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then(e=>{if(!e.result||!e.result.accessToken)throw new Q({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)}),retryRule:J1})}get hasAccessToken(){return!!this.accessToken}setAccessToken(i){this.accessToken=i}requestWrapped(i){return ui.wrappedRequest(i,this.adapter.request)}requestAuth(i){return this.requestWrapped(i)}request(i,e){return Promise.resolve().then(()=>this.hasAccessToken?e?this.requestWrapped(i):this.requestWrapped(i).catch(t=>new Promise((s,n)=>{!t||t.code!=="GATEWAY_INVALID_TOKEN"&&t.code!=="InvalidParameter.InvalidToken"?n(t):s()}).then(()=>this.getAccessToken()).then(()=>{const s=this.rebuildRequest(i);return this.request(s,!0)})):this.getAccessToken().then(()=>{const t=this.rebuildRequest(i);return this.request(t,!0)}))}rebuildRequest(i){const e=Object.assign({},i);return e.data.token=this.accessToken,e.header["x-basement-token"]=this.accessToken,e.header["x-serverless-sign"]=ui.sign(e.data,this.config.clientSecret),e}setupRequest(i,e){const t=Object.assign({},i,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};return e!=="auth"&&(t.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=ui.sign(t,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:t,dataType:"json",header:s}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(i){const e={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:i.name,functionArgs:i.data||{}})};return this.request({...this.setupRequest(e),timeout:i.timeout})}getOSSUploadOptionsFromPath(i){const e={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(i)};return this.request(this.setupRequest(e))}uploadFileToOSS({url:i,formData:e,name:t,filePath:s,fileType:n,onUploadProgress:r}){return new Promise((o,a)=>{const c=this.adapter.uploadFile({url:i,formData:e,name:t,filePath:s,fileType:n,header:{"X-OSS-server-side-encrpytion":"AES256"},success(l){l&&l.statusCode<400?o(l):a(new Q({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(l){a(new Q({code:l.code||"UPLOAD_FAILED",message:l.message||l.errMsg||"文件上传失败"}))}});typeof r=="function"&&c&&typeof c.onProgressUpdate=="function"&&c.onProgressUpdate(l=>{r({loaded:l.totalBytesSent,total:l.totalBytesExpectedToSend})})})}reportOSSUpload(i){const e={method:"serverless.file.resource.report",params:JSON.stringify(i)};return this.request(this.setupRequest(e))}async uploadFile({filePath:i,cloudPath:e,fileType:t="image",cloudPathAsRealPath:s=!1,onUploadProgress:n,config:r}){if(dn(e)!=="string")throw new Q({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(e=e.trim()))throw new Q({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(e))throw new Q({code:"INVALID_PARAM",message:"cloudPath不合法"});const o=r&&r.envType||this.config.envType;if(s&&(e[0]!=="/"&&(e="/"+e),e.indexOf("\\")>-1))throw new Q({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:o,filename:s?e.split("/").pop():e,fileId:s?e:void 0})).result,c="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:l,accessKeyId:u,signature:f,host:h,ossPath:d,id:p,policy:m,ossCallbackUrl:g}=a,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:u,Signature:f,host:h,id:p,key:d,policy:m,success_action_status:200};if(l&&(y["x-oss-security-token"]=l),g){const x=JSON.stringify({callbackUrl:g,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=ui.toBase64(x)}const v={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:i,fileType:t};if(await this.uploadFileToOSS(Object.assign({},v,{onUploadProgress:n})),g)return{success:!0,filePath:i,fileID:c};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:i,fileID:c};throw new Q({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:i}={}){return new Promise((e,t)=>{Array.isArray(i)&&i.length!==0||t(new Q({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),this.getFileInfo({fileList:i}).then(s=>{e({fileList:i.map((n,r)=>{const o=s.fileList[r];return{fileID:n,tempFileURL:o&&o.url||n}})})})})}async getFileInfo({fileList:i}={}){if(!Array.isArray(i)||i.length===0)throw new Q({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const e={method:"serverless.file.resource.info",params:JSON.stringify({id:i.map(t=>t.split("?")[0]).join(",")})};return{fileList:(await this.request(this.setupRequest(e))).result}}},C7={init(i){const e=new I7(i),t={signInAnonymously:function(){return e.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return e.auth=function(){return t},e.customAuth=e.auth,e}};const L7=typeof location<"u"&&location.protocol==="http:"?"http:":"https:";var Eh;(function(i){i.local="local",i.none="none",i.session="session"})(Eh||(Eh={}));var D7=function(){},R7=Mt(function(i,e){var t;i.exports=(t=ps,function(s){var n=t,r=n.lib,o=r.WordArray,a=r.Hasher,c=n.algo,l=[],u=[];(function(){function d(y){for(var v=s.sqrt(y),x=2;x<=v;x++)if(!(y%x))return!1;return!0}function p(y){return 4294967296*(y-(0|y))|0}for(var m=2,g=0;g<64;)d(m)&&(g<8&&(l[g]=p(s.pow(m,.5))),u[g]=p(s.pow(m,1/3)),g++),m++})();var f=[],h=c.SHA256=a.extend({_doReset:function(){this._hash=new o.init(l.slice(0))},_doProcessBlock:function(d,p){for(var m=this._hash.words,g=m[0],y=m[1],v=m[2],x=m[3],E=m[4],S=m[5],T=m[6],_=m[7],I=0;I<64;I++){if(I<16)f[I]=0|d[p+I];else{var R=f[I-15],b=(R<<25|R>>>7)^(R<<14|R>>>18)^R>>>3,L=f[I-2],k=(L<<15|L>>>17)^(L<<13|L>>>19)^L>>>10;f[I]=b+f[I-7]+k+f[I-16]}var M=g&y^g&v^y&v,N=(g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22),F=_+((E<<26|E>>>6)^(E<<21|E>>>11)^(E<<7|E>>>25))+(E&S^~E&T)+u[I]+f[I];_=T,T=S,S=E,E=x+F|0,x=v,v=y,y=g,g=F+(N+M)|0}m[0]=m[0]+g|0,m[1]=m[1]+y|0,m[2]=m[2]+v|0,m[3]=m[3]+x|0,m[4]=m[4]+E|0,m[5]=m[5]+S|0,m[6]=m[6]+T|0,m[7]=m[7]+_|0},_doFinalize:function(){var d=this._data,p=d.words,m=8*this._nDataBytes,g=8*d.sigBytes;return p[g>>>5]|=128<<24-g%32,p[14+(g+64>>>9<<4)]=s.floor(m/4294967296),p[15+(g+64>>>9<<4)]=m,d.sigBytes=4*p.length,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});n.SHA256=a._createHelper(h),n.HmacSHA256=a._createHmacHelper(h)}(Math),t.SHA256)}),Ul=R7,om=Mt(function(i,e){i.exports=ps.HmacSHA256});const _n=()=>{let i;if(!Promise){i=()=>{},i.promise={};const t=()=>{throw new Q({message:'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'})};return Object.defineProperty(i.promise,"then",{get:t}),Object.defineProperty(i.promise,"catch",{get:t}),i}const e=new Promise((t,s)=>{i=(n,r)=>n?s(n):t(r)});return i.promise=e,i};function w7(i){return i===void 0}function P7(i){return Object.prototype.toString.call(i)==="[object Null]"}function Ah(i=""){return i.replace(/([\s\S]+)\s+(请前往云开发AI小助手查看问题:.*)/,"$1")}function Sh(i=32){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let s=0;s<i;s++)t+=e.charAt(Math.floor(62*Math.random()));return t}var Th;function k7(i){const e=(t=i,Object.prototype.toString.call(t)==="[object Array]"?i:[i]);var t;for(const s of e){const{isMatch:n,genAdapter:r,runtime:o}=s;if(n())return{adapter:r(),runtime:o}}}(function(i){i.WEB="web",i.WX_MP="wx_mp"})(Th||(Th={}));const ze={adapter:null,runtime:void 0},B7=["anonymousUuidKey"];class Ia extends D7{constructor(){super(),ze.adapter.root.tcbObject||(ze.adapter.root.tcbObject={})}setItem(e,t){ze.adapter.root.tcbObject[e]=t}getItem(e){return ze.adapter.root.tcbObject[e]}removeItem(e){delete ze.adapter.root.tcbObject[e]}clear(){delete ze.adapter.root.tcbObject}}function bh(i,e){switch(i){case"local":return e.localStorage||new Ia;case"none":return new Ia;default:return e.sessionStorage||new Ia}}class _h{constructor(e){if(!this._storage){this._persistence=ze.adapter.primaryStorage||e.persistence,this._storage=bh(this._persistence,ze.adapter);const t=`access_token_${e.env}`,s=`access_token_expire_${e.env}`,n=`refresh_token_${e.env}`,r=`anonymous_uuid_${e.env}`,o=`login_type_${e.env}`,a="device_id",c=`token_type_${e.env}`,l=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n,anonymousUuidKey:r,loginTypeKey:o,userInfoKey:l,deviceIdKey:a,tokenTypeKey:c}}}updatePersistence(e){if(e===this._persistence)return;const t=this._persistence==="local";this._persistence=e;const s=bh(e,ze.adapter);for(const n in this.keys){const r=this.keys[n];if(t&&B7.includes(n))continue;const o=this._storage.getItem(r);w7(o)||P7(o)||(s.setItem(r,o),this._storage.removeItem(r))}this._storage=s}setStore(e,t,s){if(!this._storage)return;const n={version:s||"localCachev1",content:t},r=JSON.stringify(n);try{this._storage.setItem(e,r)}catch(o){throw o}}getStore(e,t){try{if(!this._storage)return}catch{return""}t=t||"localCachev1";const s=this._storage.getItem(e);return s&&s.indexOf(t)>=0?JSON.parse(s).content:""}removeStore(e){this._storage.removeItem(e)}}const am={},lm={};function Ci(i){return am[i]}class cm{constructor(e,t){this.data=t||null,this.name=e}}class F7 extends cm{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const Zc=new class{constructor(){this._listeners={}}on(i,e){return function(t,s,n){n[t]=n[t]||[],n[t].push(s)}(i,e,this._listeners),this}off(i,e){return function(t,s,n){if(n&&n[t]){const r=n[t].indexOf(s);r!==-1&&n[t].splice(r,1)}}(i,e,this._listeners),this}fire(i,e){if(i instanceof F7)return console.error(i.error),this;const t=typeof i=="string"?new cm(i,e||{}):i,s=t.name;if(this._listens(s)){t.target=this;const n=this._listeners[s]?[...this._listeners[s]]:[];for(const r of n)r.call(this,t)}return this}_listens(i){return this._listeners[i]&&this._listeners[i].length>0}};function ss(i,e){Zc.on(i,e)}function nt(i,e={}){Zc.fire(i,e)}function O7(i,e){Zc.off(i,e)}const bi="loginStateChanged",um="loginStateExpire",gs="loginTypeChanged",$l="anonymousConverted",fm="refreshAccessToken";var Be;(function(i){i.ANONYMOUS="ANONYMOUS",i.WECHAT="WECHAT",i.WECHAT_PUBLIC="WECHAT-PUBLIC",i.WECHAT_OPEN="WECHAT-OPEN",i.CUSTOM="CUSTOM",i.EMAIL="EMAIL",i.USERNAME="USERNAME",i.NULL="NULL"})(Be||(Be={}));class M7{constructor(){this._fnPromiseMap=new Map}async run(e,t){let s=this._fnPromiseMap.get(e);return s||(s=new Promise(async(n,r)=>{try{await this._runIdlePromise();const o=t();n(await o)}catch(o){r(o)}finally{this._fnPromiseMap.delete(e)}}),this._fnPromiseMap.set(e,s)),s}_runIdlePromise(){return Promise.resolve()}}class N7{constructor(e){this._singlePromise=new M7,this._cache=Ci(e.env),this._baseURL=`https://${e.env}.ap-shanghai.tcb-api.tencentcloudapi.com`,this._reqClass=new ze.adapter.reqClass({timeout:e.timeout,timeoutMsg:`请求在${e.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]})}_getDeviceId(){if(this._deviceID)return this._deviceID;const{deviceIdKey:e}=this._cache.keys;let t=this._cache.getStore(e);return typeof t=="string"&&t.length>=16&&t.length<=48||(t=Sh(),this._cache.setStore(e,t)),this._deviceID=t,t}async _request(e,t,s={}){const n={"x-request-id":Sh(),"x-device-id":this._getDeviceId()};if(s.withAccessToken){const{tokenTypeKey:r}=this._cache.keys,o=await this.getAccessToken(),a=this._cache.getStore(r);n.authorization=`${a} ${o}`}return this._reqClass[s.method==="get"?"get":"post"]({url:`${this._baseURL}${e}`,data:t,headers:n})}async _fetchAccessToken(){const{loginTypeKey:e,accessTokenKey:t,accessTokenExpireKey:s,tokenTypeKey:n}=this._cache.keys,r=this._cache.getStore(e);if(r&&r!==Be.ANONYMOUS)throw new Q({code:"INVALID_OPERATION",message:"非匿名登录不支持刷新 access token"});const o=await this._singlePromise.run("fetchAccessToken",async()=>(await this._request("/auth/v1/signin/anonymously",{},{method:"post"})).data),{access_token:a,expires_in:c,token_type:l}=o;return this._cache.setStore(n,l),this._cache.setStore(t,a),this._cache.setStore(s,Date.now()+1e3*c),a}isAccessTokenExpired(e,t){let s=!0;return e&&t&&(s=t<Date.now()),s}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t}=this._cache.keys,s=this._cache.getStore(e),n=this._cache.getStore(t);return this.isAccessTokenExpired(s,n)?this._fetchAccessToken():s}async refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,loginTypeKey:s}=this._cache.keys;return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.setStore(s,Be.ANONYMOUS),this.getAccessToken()}async getUserInfo(){return this._singlePromise.run("getUserInfo",async()=>(await this._request("/auth/v1/user/me",{},{withAccessToken:!0,method:"get"})).data)}}const Ih=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],U7={"X-SDK-Version":"1.3.5"};function Ca(i,e,t){const s=i[e];i[e]=function(n){const r={},o={};t.forEach(c=>{const{data:l,headers:u}=c.call(i,n);Object.assign(r,l),Object.assign(o,u)});const a=n.data;return a&&(()=>{var c;if(c=a,Object.prototype.toString.call(c)!=="[object FormData]")n.data={...a,...r};else for(const l in r)a.append(l,r[l])})(),n.headers={...n.headers||{},...o},s.call(i,n)}}function La(){const i=Math.random().toString(16).slice(2);return{data:{seqId:i},headers:{...U7,"x-seqid":i}}}class $7{constructor(e={}){var t;this.config=e,this._reqClass=new ze.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=Ci(this.config.env),this._localCache=(t=this.config.env,lm[t]),this.oauth=new N7(this.config),Ca(this._reqClass,"post",[La]),Ca(this._reqClass,"upload",[La]),Ca(this._reqClass,"download",[La])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(s){t=s}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s,loginTypeKey:n,anonymousUuidKey:r}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let o=this._cache.getStore(s);if(!o)throw new Q({message:"未登录CloudBase"});const a={refresh_token:o},c=await this.request("auth.fetchAccessTokenWithRefreshToken",a);if(c.data.code){const{code:l}=c.data;if(l==="SIGN_PARAM_INVALID"||l==="REFRESH_TOKEN_EXPIRED"||l==="INVALID_REFRESH_TOKEN"){if(this._cache.getStore(n)===Be.ANONYMOUS&&l==="INVALID_REFRESH_TOKEN"){const u=this._cache.getStore(r),f=this._cache.getStore(s),h=await this.send("auth.signInAnonymously",{anonymous_uuid:u,refresh_token:f});return this.setRefreshToken(h.refresh_token),this._refreshAccessToken()}nt(um),this._cache.removeStore(s)}throw new Q({code:c.data.code,message:`刷新access token失败:${c.data.code}`})}if(c.data.access_token)return nt(fm),this._cache.setStore(e,c.data.access_token),this._cache.setStore(t,c.data.access_token_expire+Date.now()),{accessToken:c.data.access_token,accessTokenExpire:c.data.access_token_expire};c.data.refresh_token&&(this._cache.removeStore(s),this._cache.setStore(s,c.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s}=this._cache.keys;if(!this._cache.getStore(s))throw new Q({message:"refresh token不存在,登录状态异常"});let n=this._cache.getStore(e),r=this._cache.getStore(t),o=!0;return this._shouldRefreshAccessTokenHook&&!await this._shouldRefreshAccessTokenHook(n,r)&&(o=!1),(!n||!r||r<Date.now())&&o?this.refreshAccessToken():{accessToken:n,accessTokenExpire:r}}async request(e,t,s){const n=`x-tcb-trace_${this.config.env}`;let r="application/x-www-form-urlencoded";const o={action:e,env:this.config.env,dataVersion:"2019-08-16",...t};let a;if(Ih.indexOf(e)===-1&&(this._cache.keys,o.access_token=await this.oauth.getAccessToken()),e==="storage.uploadFile"){a=new FormData;for(let y in a)a.hasOwnProperty(y)&&a[y]!==void 0&&a.append(y,o[y]);r="multipart/form-data"}else{r="application/json",a={};for(let y in o)o[y]!==void 0&&(a[y]=o[y])}let c={headers:{"content-type":r}};s&&s.timeout&&(c.timeout=s.timeout),s&&s.onUploadProgress&&(c.onUploadProgress=s.onUploadProgress);const l=this._localCache.getStore(n);l&&(c.headers["X-TCB-Trace"]=l);const{parse:u,inQuery:f,search:h}=t;let d={env:this.config.env};u&&(d.parse=!0),f&&(d={...f,...d});let p=function(y,v,x={}){const E=/\?/.test(v);let S="";for(let T in x)S===""?!E&&(v+="?"):S+="&",S+=`${T}=${encodeURIComponent(x[T])}`;return/^http(s)?\:\/\//.test(v+=S)?v:`${y}${v}`}(L7,"//tcb-api.tencentcloudapi.com/web",d);h&&(p+=h);const m=await this.post({url:p,data:a,...c}),g=m.header&&m.header["x-tcb-trace"];if(g&&this._localCache.setStore(n,g),Number(m.status)!==200&&Number(m.statusCode)!==200||!m.data)throw new Q({code:"NETWORK_ERROR",message:"network request error"});return m}async send(e,t={},s={}){const n=await this.request(e,t,{...s,onUploadProgress:t.onUploadProgress});if((n.data.code==="ACCESS_TOKEN_DISABLED"||n.data.code==="ACCESS_TOKEN_EXPIRED")&&Ih.indexOf(e)===-1){await this.oauth.refreshAccessToken();const r=await this.request(e,t,{...s,onUploadProgress:t.onUploadProgress});if(r.data.code)throw new Q({code:r.data.code,message:Ah(r.data.message)});return r.data}if(n.data.code)throw new Q({code:n.data.code,message:Ah(n.data.message)});return n.data}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(s),this._cache.setStore(n,e)}}const hm={};function Qt(i){return hm[i]}class oo{constructor(e){this.config=e,this._cache=Ci(e.env),this._request=Qt(e.env)}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(s),this._cache.setStore(n,e)}setAccessToken(e,t){const{accessTokenKey:s,accessTokenExpireKey:n}=this._cache.keys;this._cache.setStore(s,e),this._cache.setStore(n,t)}async refreshUserInfo(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e)}}class H7{constructor(e){if(!e)throw new Q({code:"PARAM_ERROR",message:"envId is not defined"});this._envId=e,this._cache=Ci(this._envId),this._request=Qt(this._envId),this.setUserInfo()}linkWithTicket(e){if(typeof e!="string")throw new Q({code:"PARAM_ERROR",message:"ticket must be string"});return this._request.send("auth.linkWithTicket",{ticket:e})}linkWithRedirect(e){e.signInWithRedirect()}updatePassword(e,t){return this._request.send("auth.updatePassword",{oldPassword:t,newPassword:e})}updateEmail(e){return this._request.send("auth.updateEmail",{newEmail:e})}updateUsername(e){if(typeof e!="string")throw new Q({code:"PARAM_ERROR",message:"username must be a string"});return this._request.send("auth.updateUsername",{username:e})}async getLinkedUidList(){const{data:e}=await this._request.send("auth.getLinkedUidList",{});let t=!1;const{users:s}=e;return s.forEach(n=>{n.wxOpenId&&n.wxPublicId&&(t=!0)}),{users:s,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:s,avatarUrl:n,province:r,country:o,city:a}=e,{data:c}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:s,avatarUrl:n,province:r,country:o,city:a});this.setLocalUserInfo(c)}async refresh(){const e=await this._request.oauth.getUserInfo();return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach(s=>{this[s]=t[s]}),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class In{constructor(e){if(!e)throw new Q({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=Ci(e);const{refreshTokenKey:t,accessTokenKey:s,accessTokenExpireKey:n}=this._cache.keys,r=this._cache.getStore(t),o=this._cache.getStore(s),a=this._cache.getStore(n);this.credential={refreshToken:r,accessToken:o,accessTokenExpire:a},this.user=new H7(e)}get isAnonymousAuth(){return this.loginType===Be.ANONYMOUS}get isCustomAuth(){return this.loginType===Be.CUSTOM}get isWeixinAuth(){return this.loginType===Be.WECHAT||this.loginType===Be.WECHAT_OPEN||this.loginType===Be.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class Da extends oo{async signIn(){this._cache.updatePersistence("local"),await this._request.oauth.getAccessToken(),nt(bi),nt(gs,{env:this.config.env,loginType:Be.ANONYMOUS,persistence:"local"});const e=new In(this.config.env);return await e.user.refresh(),e}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:s}=this._cache.keys,n=this._cache.getStore(t),r=this._cache.getStore(s),o=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:n,refresh_token:r,ticket:e});if(o.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(o.refresh_token),await this._request.refreshAccessToken(),nt($l,{env:this.config.env}),nt(gs,{loginType:Be.CUSTOM,persistence:"local"}),{credential:{refreshToken:o.refresh_token}};throw new Q({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:s}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(s,Be.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class Ch extends oo{async signIn(e){if(typeof e!="string")throw new Q({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,s=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(s.refresh_token)return this.setRefreshToken(s.refresh_token),await this._request.refreshAccessToken(),nt(bi),nt(gs,{env:this.config.env,loginType:Be.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new In(this.config.env);throw new Q({message:"自定义登录失败"})}}class Lh extends oo{async signIn(e,t){if(typeof e!="string")throw new Q({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:s}=this._cache.keys,n=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:r,access_token:o,access_token_expire:a}=n;if(r)return this.setRefreshToken(r),o&&a?this.setAccessToken(o,a):await this._request.refreshAccessToken(),await this.refreshUserInfo(),nt(bi),nt(gs,{env:this.config.env,loginType:Be.EMAIL,persistence:this.config.persistence}),new In(this.config.env);throw n.code?new Q({code:n.code,message:`邮箱登录失败: ${n.message}`}):new Q({message:"邮箱登录失败"})}async activate(e){return this._request.send("auth.activateEndUserMail",{token:e})}async resetPasswordWithToken(e,t){return this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})}}class Dh extends oo{async signIn(e,t){if(typeof e!="string")throw new Q({code:"PARAM_ERROR",message:"username must be a string"});typeof t!="string"&&(t="",console.warn("password is empty"));const{refreshTokenKey:s}=this._cache.keys,n=await this._request.send("auth.signIn",{loginType:Be.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:r,access_token_expire:o,access_token:a}=n;if(r)return this.setRefreshToken(r),a&&o?this.setAccessToken(a,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),nt(bi),nt(gs,{env:this.config.env,loginType:Be.USERNAME,persistence:this.config.persistence}),new In(this.config.env);throw n.code?new Q({code:n.code,message:`用户名密码登录失败: ${n.message}`}):new Q({message:"用户名密码登录失败"})}}class G7{constructor(e){this.config=e,this._cache=Ci(e.env),this._request=Qt(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),ss(gs,this._onLoginTypeChanged)}get currentUser(){const e=this.hasLoginState();return e&&e.user||null}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}anonymousAuthProvider(){return new Da(this.config)}customAuthProvider(){return new Ch(this.config)}emailAuthProvider(){return new Lh(this.config)}usernameAuthProvider(){return new Dh(this.config)}async signInAnonymously(){return new Da(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new Lh(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new Dh(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new Da(this.config)),ss($l,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===Be.ANONYMOUS)throw new Q({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:s}=this._cache.keys,n=this._cache.getStore(e);if(!n)return;const r=await this._request.send("auth.logout",{refresh_token:n});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(s),nt(bi),nt(gs,{env:this.config.env,loginType:Be.NULL,persistence:this.config.persistence}),r}async signUpWithEmailAndPassword(e,t){return this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})}async sendPasswordResetEmail(e){return this._request.send("auth.sendPasswordResetEmail",{email:e})}onLoginStateChanged(e){ss(bi,()=>{const s=this.hasLoginState();e.call(this,s)});const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){ss(um,e.bind(this))}onAccessTokenRefreshed(e){ss(fm,e.bind(this))}onAnonymousConverted(e){ss($l,e.bind(this))}onLoginTypeChanged(e){ss(gs,()=>{const t=this.hasLoginState();e.call(this,t)})}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{accessTokenKey:e,accessTokenExpireKey:t}=this._cache.keys,s=this._cache.getStore(e),n=this._cache.getStore(t);return this._request.oauth.isAccessTokenExpired(s,n)?null:new In(this.config.env)}async isUsernameRegistered(e){if(typeof e!="string")throw new Q({code:"PARAM_ERROR",message:"username must be a string"});const{data:t}=await this._request.send("auth.isUsernameRegistered",{username:e});return t&&t.isRegistered}getLoginState(){return Promise.resolve(this.hasLoginState())}async signInWithTicket(e){return new Ch(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then(e=>e.code?e:{...e.data,requestId:e.seqId})}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,s=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+s}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:s,env:n}=e.data;n===this.config.env&&(this._cache.updatePersistence(s),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const K7=function(i,e){e=e||_n();const t=Qt(this.config.env),{cloudPath:s,filePath:n,onUploadProgress:r,fileType:o="image"}=i;return t.send("storage.getUploadMetadata",{path:s}).then(a=>{const{data:{url:c,authorization:l,token:u,fileId:f,cosFileId:h},requestId:d}=a,p={key:s,signature:l,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":u};t.upload({url:c,data:p,file:n,name:s,fileType:o,onUploadProgress:r}).then(m=>{m.statusCode===201?e(null,{fileID:f,requestId:d}):e(new Q({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${m.data}`}))}).catch(m=>{e(m)})}).catch(a=>{e(a)}),e.promise},V7=function(i,e){e=e||_n();const t=Qt(this.config.env),{cloudPath:s}=i;return t.send("storage.getUploadMetadata",{path:s}).then(n=>{e(null,n)}).catch(n=>{e(n)}),e.promise},j7=function({fileList:i},e){if(e=e||_n(),!i||!Array.isArray(i))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let s of i)if(!s||typeof s!="string")return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const t={fileid_list:i};return Qt(this.config.env).send("storage.batchDeleteFile",t).then(s=>{s.code?e(null,s):e(null,{fileList:s.data.delete_list,requestId:s.requestId})}).catch(s=>{e(s)}),e.promise},dm=function({fileList:i},e){e=e||_n(),i&&Array.isArray(i)||e(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let t=[];for(let n of i)typeof n=="object"?(n.hasOwnProperty("fileID")&&n.hasOwnProperty("maxAge")||e(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),t.push({fileid:n.fileID,max_age:n.maxAge})):typeof n=="string"?t.push({fileid:n}):e(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const s={file_list:t};return Qt(this.config.env).send("storage.batchGetDownloadUrl",s).then(n=>{n.code?e(null,n):e(null,{fileList:n.data.download_list,requestId:n.requestId})}).catch(n=>{e(n)}),e.promise},q7=async function({fileID:i},e){const t=(await dm.call(this,{fileList:[{fileID:i,maxAge:600}]})).fileList[0];if(t.code!=="SUCCESS")return e?e(t):new Promise(r=>{r(t)});const s=Qt(this.config.env);let n=t.download_url;if(n=encodeURI(n),!e)return s.download({url:n});e(await s.download({url:n}))},W7=function({name:i,data:e,query:t,parse:s,search:n,timeout:r},o){const a=o||_n();let c;try{c=e?JSON.stringify(e):""}catch(u){return Promise.reject(u)}if(!i)return Promise.reject(new Q({code:"PARAM_ERROR",message:"函数名不能为空"}));const l={inQuery:t,parse:s,search:n,function_name:i,request_data:c};return Qt(this.config.env).send("functions.invokeFunction",l,{timeout:r}).then(u=>{if(u.code)a(null,u);else{let f=u.data.response_data;if(s)a(null,{result:f,requestId:u.requestId});else try{f=JSON.parse(u.data.response_data),a(null,{result:f,requestId:u.requestId})}catch{a(new Q({message:"response data must be json"}))}}return a.promise}).catch(u=>{a(u)}),a.promise},Rh={timeout:15e3,persistence:"session"},wh=6e5,Ph={};class eu{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(ze.adapter||(this.requestClient=new ze.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...Rh,...e},!0){case this.config.timeout>wh:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=wh;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new eu(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||ze.adapter.primaryStorage||Rh.persistence;var s;return t!==this.config.persistence&&(this.config.persistence=t),function(n){const{env:r}=n;am[r]=new _h(n),lm[r]=new _h({...n,persistence:"local"})}(this.config),s=this.config,hm[s.env]=new $7(s),this.authObj=new G7(this.config),this.authObj}on(e,t){return ss.apply(this,[e,t])}off(e,t){return O7.apply(this,[e,t])}callFunction(e,t){return W7.apply(this,[e,t])}deleteFile(e,t){return j7.apply(this,[e,t])}getTempFileURL(e,t){return dm.apply(this,[e,t])}downloadFile(e,t){return q7.apply(this,[e,t])}uploadFile(e,t){return K7.apply(this,[e,t])}getUploadMetadata(e,t){return V7.apply(this,[e,t])}registerExtension(e){Ph[e.name]=e}async invokeExtension(e,t){const s=Ph[e];if(!s)throw new Q({message:`扩展${e} 必须先注册`});return await s.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:s}=k7(e)||{};t&&(ze.adapter=t),s&&(ze.runtime=s)}}var pm=new eu;function Ra(i,e,t){t===void 0&&(t={});var s=/\?/.test(e),n="";for(var r in t)n===""?!s&&(e+="?"):n+="&",n+=r+"="+encodeURIComponent(t[r]);return/^http(s)?:\/\//.test(e+=n)?e:""+i+e}class z7{get(e){const{url:t,data:s,headers:n,timeout:r}=e;return new Promise((o,a)=>{we.request({url:Ra("https:",t),data:s,method:"GET",header:n,timeout:r,success(c){o(c)},fail(c){a(c)}})})}post(e){const{url:t,data:s,headers:n,timeout:r}=e;return new Promise((o,a)=>{we.request({url:Ra("https:",t),data:s,method:"POST",header:n,timeout:r,success(c){o(c)},fail(c){a(c)}})})}upload(e){return new Promise((t,s)=>{const{url:n,file:r,data:o,headers:a,fileType:c}=e,l=we.uploadFile({url:Ra("https:",n),name:"file",formData:Object.assign({},o),filePath:r,fileType:c,header:a,success(u){const f={statusCode:u.statusCode,data:u.data||{}};u.statusCode===200&&o.success_action_status&&(f.statusCode=parseInt(o.success_action_status,10)),t(f)},fail(u){s(new Error(u.errMsg||"uploadFile:fail"))}});typeof e.onUploadProgress=="function"&&l&&typeof l.onProgressUpdate=="function"&&l.onProgressUpdate(u=>{e.onUploadProgress({loaded:u.totalBytesSent,total:u.totalBytesExpectedToSend})})})}}const Q7={setItem(i,e){we.setStorageSync(i,e)},getItem:i=>we.getStorageSync(i),removeItem(i){we.removeStorageSync(i)},clear(){we.clearStorageSync()}};var Y7={genAdapter:function(){return{root:{},reqClass:z7,localStorage:Q7,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};pm.useAdapters(Y7);const tu=pm,X7=tu.init;tu.init=function(i){i.env=i.spaceId;const e=X7.call(this,i);e.config.provider="tencent",e.config.spaceId=i.spaceId;const t=e.auth;return e.auth=function(s){const n=t.call(this,s);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach(r=>{var o;n[r]=(o=n[r],function(a){a=a||{};const{success:c,fail:l,complete:u}=im(a);if(!(c||l||u))return o.call(this,a);o.call(this,a).then(f=>{c&&c(f),u&&u(f)},f=>{l&&l(f),u&&u(f)})}).bind(n)}),n},e.customAuth=e.auth,e};var kh=tu;async function J7(i,e){const t=`http://${i}:${e}/system/ping`;try{const n=await(s={url:t,timeout:500},new Promise((r,o)=>{we.request({...s,success(a){r(a)},fail(a){o(a)}})}));return!(!n.data||n.data.code!==0)}catch{return!1}var s}async function gm(i,e){let t;for(let s=0;s<i.length;s++){const n=i[s];if(await J7(n,e)){t=n;break}}return{address:t,port:e}}const Z7={"serverless.file.resource.generateProximalSign":"storage/generate-proximal-sign","serverless.file.resource.report":"storage/report","serverless.file.resource.delete":"storage/delete","serverless.file.resource.getTempFileURL":"storage/get-temp-file-url"};var e_=class{constructor(i){if(["spaceId","clientSecret"].forEach(e=>{if(!Object.prototype.hasOwnProperty.call(i,e))throw new Error(`${e} required`)}),!i.endpoint)throw new Error("集群空间未配置ApiEndpoint,配置后需要重新关联服务空间后生效");this.config=Object.assign({},i),this.config.provider="dcloud",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.adapter=we}async request(i,e=!0){const t=e;return i=t?await this.setupLocalRequest(i):this.setupRequest(i),Promise.resolve().then(()=>t?this.requestLocal(i):ui.wrappedRequest(i,this.adapter.request))}requestLocal(i){return new Promise((e,t)=>{this.adapter.request(Object.assign(i,{complete(s){if(s||(s={}),!s.statusCode||s.statusCode>=400){const n=s.data&&s.data.code||"SYS_ERR",r=s.data&&s.data.message||"request:fail";return t(new Q({code:n,message:r}))}e({success:!0,result:s.data})}}))})}setupRequest(i){const e=Object.assign({},i,{spaceId:this.config.spaceId,timestamp:Date.now()}),t={"Content-Type":"application/json"};t["x-serverless-sign"]=ui.sign(e,this.config.clientSecret);const s=Nl();t["x-client-info"]=encodeURIComponent(JSON.stringify(s));const{token:n}=pn();return t["x-client-token"]=n,{url:this.config.requestUrl,method:"POST",data:e,dataType:"json",header:JSON.parse(JSON.stringify(t))}}async setupLocalRequest(i){const e=Nl(),{token:t}=pn(),s=Object.assign({},i,{spaceId:this.config.spaceId,timestamp:Date.now(),clientInfo:e,token:t}),{address:n,servePort:r}=this.__dev__&&this.__dev__.debugInfo||{},{address:o}=await gm(n,r);return{url:`http://${o}:${r}/${Z7[i.method]}`,method:"POST",data:s,dataType:"json",header:JSON.parse(JSON.stringify({"Content-Type":"application/json"}))}}callFunction(i){const e={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:i.name,functionArgs:i.data||{}})};return this.request(e,!1)}getUploadFileOptions(i){const e={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(i)};return this.request(e)}reportUploadFile(i){const e={method:"serverless.file.resource.report",params:JSON.stringify(i)};return this.request(e)}uploadFile({filePath:i,cloudPath:e,fileType:t="image",onUploadProgress:s}){if(!e)throw new Q({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let n;return this.getUploadFileOptions({cloudPath:e}).then(r=>{const{url:o,formData:a,name:c}=r.result;return n=r.result.fileUrl,new Promise((l,u)=>{const f=this.adapter.uploadFile({url:o,formData:a,name:c,filePath:i,fileType:t,success(h){h&&h.statusCode<400?l(h):u(new Q({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(h){u(new Q({code:h.code||"UPLOAD_FAILED",message:h.message||h.errMsg||"文件上传失败"}))}});typeof s=="function"&&f&&typeof f.onProgressUpdate=="function"&&f.onProgressUpdate(h=>{s({loaded:h.totalBytesSent,total:h.totalBytesExpectedToSend})})})}).then(()=>this.reportUploadFile({cloudPath:e})).then(r=>new Promise((o,a)=>{r.success?o({success:!0,filePath:i,fileID:n}):a(new Q({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))}deleteFile({fileList:i}){const e={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:i})};return this.request(e).then(t=>{if(t.success)return t.result;throw new Q({code:"DELETE_FILE_FAILED",message:"删除文件失败"})})}getTempFileURL({fileList:i,maxAge:e}={}){if(!Array.isArray(i)||i.length===0)throw new Q({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:i,maxAge:e})};return this.request(t).then(s=>{if(s.success)return{fileList:s.result.fileList.map(n=>({fileID:n.fileID,tempFileURL:n.tempFileURL}))};throw new Q({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})})}},Bh={init(i){const e=new e_(i),t={signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!1)}};return e.auth=function(){return t},e.customAuth=e.auth,e}},Qi=Mt(function(i,e){i.exports=ps.enc.Hex});function mm(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var e=16*Math.random()|0;return(i==="x"?e:3&e|8).toString(16)})}function xm(i="",e={}){const{data:t,functionName:s,method:n,headers:r,signHeaderKeys:o=[],config:a}=e,c=String(Date.now()),l=mm(),u=Object.assign({},r,{"x-from-app-id":a.spaceAppId,"x-from-env-id":a.spaceId,"x-to-env-id":a.spaceId,"x-from-instance-id":c,"x-from-function-name":s,"x-client-timestamp":c,"x-alipay-source":"client","x-request-id":l,"x-alipay-callid":l,"x-trace-id":l}),f=["x-from-app-id","x-from-env-id","x-to-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp"].concat(o),[h="",d=""]=i.split("?")||[],p=function(m){const g="HMAC-SHA256",y=m.signedHeaders.join(";"),v=m.signedHeaders.map(I=>`${I.toLowerCase()}:${m.headers[I]}
- `).join(""),x=Ul(m.body).toString(Qi),E=`${m.method.toUpperCase()}
- ${m.path}
- ${m.query}
- ${v}
- ${y}
- ${x}
- `,S=Ul(E).toString(Qi),T=`${g}
- ${m.timestamp}
- ${S}
- `,_=om(T,m.secretKey).toString(Qi);return`${g} Credential=${m.secretId}, SignedHeaders=${y}, Signature=${_}`}({path:h,query:d,method:n,headers:u,timestamp:c,body:JSON.stringify(t),secretId:a.accessKey,secretKey:a.secretKey,signedHeaders:f.sort()});return{url:`${a.endpoint}${i}`,headers:Object.assign({},u,{Authorization:p})}}function ym({url:i,data:e,method:t="POST",headers:s={},timeout:n}){return new Promise((r,o)=>{we.request({url:i,method:t,data:typeof e=="object"?JSON.stringify(e):e,header:s,dataType:"json",timeout:n,complete:(a={})=>{const c=s["x-trace-id"]||"";if(!a.statusCode||a.statusCode>=400){const{message:l,errMsg:u,trace_id:f}=a.data||{};return o(new Q({code:"SYS_ERR",message:l||u||"request:fail",requestId:f||c}))}r({status:a.statusCode,data:a.data,headers:a.header,requestId:c})}})})}function Fh(i,e){const{path:t,data:s,method:n="GET"}=i,{url:r,headers:o}=xm(t,{functionName:"",data:s,method:n,headers:{"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":Date.now()+6e4},signHeaderKeys:["x-data-api-type","x-expire-timestamp"],config:e});return ym({url:r,data:s,method:n,headers:o}).then(a=>{const c=a.data||{};if(!c.success)throw new Q({code:a.errCode,message:a.errMsg,requestId:a.requestId});return c.data||{}}).catch(a=>{throw new Q({code:a.errCode,message:a.errMsg,requestId:a.requestId})})}function t_(i=""){const e=i.trim().replace(/^cloud:\/\//,""),t=e.indexOf("/");if(t<=0)throw new Q({code:"INVALID_PARAM",message:"fileID不合法"});const s=e.substring(0,t),n=e.substring(t+1);return s!==this.config.spaceId&&console.warn("file ".concat(i," does not belong to env ").concat(this.config.spaceId)),n}function s_(i=""){return"cloud://".concat(this.config.spaceId,"/").concat(i.replace(/^\/+/,""))}class i_{constructor(e){this.config=e}signedURL(e,t={}){const s=`/ws/function/${e}`,n=this.config.wsEndpoint.replace(/^ws(s)?:\/\//,""),r=Object.assign({},t,{accessKeyId:this.config.accessKey,signatureNonce:mm(),timestamp:""+Date.now()}),o=[s,["accessKeyId","authorization","signatureNonce","timestamp"].sort().map(function(u){return r[u]?"".concat(u,"=").concat(r[u]):null}).filter(Boolean).join("&"),`host:${n}`].join(`
- `),a=["HMAC-SHA256",Ul(o).toString(Qi)].join(`
- `),c=om(a,this.config.secretKey).toString(Qi),l=Object.keys(r).map(u=>`${u}=${encodeURIComponent(r[u])}`).join("&");return`${this.config.wsEndpoint}${s}?${l}&signature=${c}`}}var n_=class{constructor(i){if(["spaceId","spaceAppId","accessKey","secretKey"].forEach(e=>{if(!Object.prototype.hasOwnProperty.call(i,e))throw new Error(`${e} required`)}),i.endpoint){if(typeof i.endpoint!="string")throw new Error("endpoint must be string");if(!/^https:\/\//.test(i.endpoint))throw new Error("endpoint must start with https://");i.endpoint=i.endpoint.replace(/\/$/,"")}this.config=Object.assign({},i,{endpoint:i.endpoint||`https://${i.spaceId}.api-hz.cloudbasefunction.cn`,wsEndpoint:i.wsEndpoint||`wss://${i.spaceId}.api-hz.cloudbasefunction.cn`}),this._websocket=new i_(this.config)}callFunction(i){return function(e,t){const{name:s,data:n,async:r=!1,timeout:o}=e,a="POST",c={"x-to-function-name":s};r&&(c["x-function-invoke-type"]="async");const{url:l,headers:u}=xm("/functions/invokeFunction",{functionName:s,data:n,method:a,headers:c,signHeaderKeys:["x-to-function-name"],config:t});return ym({url:l,data:n,method:a,headers:u,timeout:o}).then(f=>{let h=0;if(r){const d=f.data||{};h=d.errCode==="200"?0:d.errCode,f.data=d.data||{},f.errMsg=d.errMsg}if(h!==0)throw new Q({code:h,message:f.errMsg,requestId:f.requestId});return{errCode:h,success:h===0,requestId:f.requestId,result:f.data}}).catch(f=>{throw new Q({code:f.errCode,message:f.errMsg,requestId:f.requestId})})}(i,this.config)}uploadFileToOSS({url:i,filePath:e,fileType:t,formData:s,onUploadProgress:n}){return new Promise((r,o)=>{const a=we.uploadFile({url:i,filePath:e,fileType:t,formData:s,name:"file",success(c){c&&c.statusCode<400?r(c):o(new Q({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(c){o(new Q({code:c.code||"UPLOAD_FAILED",message:c.message||c.errMsg||"文件上传失败"}))}});typeof n=="function"&&a&&typeof a.onProgressUpdate=="function"&&a.onProgressUpdate(c=>{n({loaded:c.totalBytesSent,total:c.totalBytesExpectedToSend})})})}async uploadFile({filePath:i,cloudPath:e="",fileType:t="image",onUploadProgress:s}){if(dn(e)!=="string")throw new Q({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(e=e.trim()))throw new Q({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(e))throw new Q({code:"INVALID_PARAM",message:"cloudPath不合法"});const n=await Fh({path:"/".concat(e.replace(/^\//,""),"?post_url")},this.config),{file_id:r,upload_url:o,form_data:a}=n,c=a&&a.reduce((l,u)=>(l[u.key]=u.value,l),{});return this.uploadFileToOSS({url:o,filePath:i,fileType:t,formData:c,onUploadProgress:s}).then(()=>({fileID:r}))}async getTempFileURL({fileList:i}){return new Promise((e,t)=>{(!i||i.length<0)&&e({code:"INVALID_PARAM",message:"fileList不能为空数组"}),i.length>50&&e({code:"INVALID_PARAM",message:"fileList数组长度不能超过50"});const s=[];for(const n of i){let r;dn(n)!=="string"&&e({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});try{r=t_.call(this,n)}catch(o){console.warn(o.errCode,o.errMsg),r=n}s.push({file_id:r,expire:600})}Fh({path:"/?download_url",data:{file_list:s},method:"POST"},this.config).then(n=>{const{file_list:r=[]}=n;e({fileList:r.map(o=>({fileID:s_.call(this,o.file_id),tempFileURL:o.download_url}))})}).catch(n=>t(n))})}async connectWebSocket(i){const{name:e,query:t}=i;return we.connectSocket({url:this._websocket.signedURL(e,t),complete:()=>{}})}},r_={init:i=>{i.provider="alipay";const e=new n_(i);return e.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},e}};function vm({data:i}){let e;e=Nl();const t=JSON.parse(JSON.stringify(i||{}));if(Object.assign(t,{clientInfo:e}),!t.uniIdToken){const{token:s}=pn();s&&(t.uniIdToken=s)}return t}async function Oh(i={}){await this.__dev__.initLocalNetwork();const{localAddress:e,localPort:t}=this.__dev__,s={aliyun:"aliyun",tencent:"tcb",alipay:"alipay",dcloud:"dcloud"}[this.config.provider],n=this.config.spaceId,r=`http://${e}:${t}/system/check-function`,o=`http://${e}:${t}/cloudfunctions/${i.name}`;return new Promise((a,c)=>{we.request({method:"POST",url:r,data:{name:i.name,platform:Ti,provider:s,spaceId:n},timeout:3e3,success(l){a(l)},fail(){a({data:{code:"NETWORK_ERROR",message:"连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。"}})}})}).then(({data:a}={})=>{const{code:c,message:l}=a||{};return{code:c===0?0:c||"SYS_ERR",message:l||"SYS_ERR"}}).then(({code:a,message:c})=>{if(a!==0){switch(a){case"MODULE_ENCRYPTED":console.error(`此云函数(${i.name})依赖加密公共模块不可本地调试,自动切换为云端已部署的云函数`);break;case"FUNCTION_ENCRYPTED":console.error(`此云函数(${i.name})已加密不可本地调试,自动切换为云端已部署的云函数`);break;case"ACTION_ENCRYPTED":console.error(c||"需要访问加密的uni-clientDB-action,自动切换为云端环境");break;case"NETWORK_ERROR":console.error(c||"连接本地调试服务失败,请检查客户端是否和主机在同一局域网下");break;case"SWITCH_TO_CLOUD":break;default:{const l=`检测本地调试服务出现错误:${c},请检查网络环境或重启客户端再试`;throw console.error(l),new Error(l)}}return this._callCloudFunction(i)}return new Promise((l,u)=>{const f=vm.call(this,{data:i.data});we.request({method:"POST",url:o,data:{provider:s,platform:Ti,param:f},timeout:i.timeout,success:({statusCode:h,data:d}={})=>!h||h>=400?u(new Q({code:d.code||"SYS_ERR",message:d.message||"request:fail"})):l({result:d}),fail(h){u(new Q({code:h.code||h.errCode||"SYS_ERR",message:h.message||h.errMsg||"request:fail"}))}})})})}const o_=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var Em=/[\\^$.*+?()[\]{}|]/g,a_=RegExp(Em.source);function Mh(i,e,t){return i.replace(new RegExp((s=e)&&a_.test(s)?s.replace(Em,"\\$&"):s,"g"),t);var s}const cs={NONE:"none",REQUEST:"request",RESPONSE:"response",BOTH:"both"},Nh="_globalUniCloudStatus",Am="_globalUniCloudSecureNetworkCache__{spaceId}",l_="uni-secure-network",su={SYSTEM_ERROR:{code:2e4,message:"System error"},APP_INFO_INVALID:{code:20101,message:"Invalid client"},GET_ENCRYPT_KEY_FAILED:{code:20102,message:"Get encrypt key failed"}};function Sm(i){const{errSubject:e,subject:t,errCode:s,errMsg:n,code:r,message:o,cause:a}=i||{};return new Q({subject:e||t||l_,code:s||r||su.SYSTEM_ERROR.code,message:n||o,cause:a})}class c_{constructor({secretType:e,uniCloudIns:t}={}){this.clientType="",this.secretType=e||cs.NONE,this.uniCloudIns=t;const{provider:s,spaceId:n}=this.uniCloudIns.config;var r;this.provider=s,this.spaceId=n,this.scopedGlobalCache=(r=this.uniCloudIns,Gs(Am.replace("{spaceId}",r.config.spaceId)))}getSystemInfo(){return this._systemInfo||(this._systemInfo=gn()),this._systemInfo}get appId(){return this.getSystemInfo().appId}get deviceId(){return this.getSystemInfo().deviceId}async encryptData(e){return this.secretType===cs.NONE?e:this.platformEncryptData(e)}async decryptResult(e){if(this.secretType===cs.NONE)return e;const{errCode:t,errMsg:s,content:n}=e||{};return t||!n?e:this.secretType===cs.REQUEST?n:this.platformDecryptResult(e)}wrapVerifyClientCallFunction(e){const t=this;return async function({name:s,data:n={}}={}){await t.prepare(),(n=JSON.parse(JSON.stringify(n)))._uniCloudOptions=await t.platformGetSignOption();let r=await e({name:s,data:n});return t.isClientKeyNotFound(r)&&(await t.prepare({forceUpdate:!0}),n._uniCloudOptions=await t.platformGetSignOption(),r=await e({name:s,data:n})),r}}wrapEncryptDataCallFunction(e){const t=this;return async function({name:s,data:n={}}={}){await t.prepare();const r=await t.encryptData(n);let o=await e({name:s,data:r});if(t.isClientKeyNotFound(o)){await t.prepare({forceUpdate:!0});const a=await t.encryptData(n);o=await e({name:s,data:a})}return o.result=await t.decryptResult(o.result),o}}}/*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */function Hl(i){return parseInt(i)===i}function Uh(i){if(!Hl(i.length))return!1;for(var e=0;e<i.length;e++)if(!Hl(i[e])||i[e]<0||i[e]>255)return!1;return!0}function qe(i,e){if(i.buffer&&i.name==="Uint8Array")return e&&(i=i.slice?i.slice():Array.prototype.slice.call(i)),i;if(Array.isArray(i)){if(!Uh(i))throw new Error("Array contains invalid value: "+i);return new Uint8Array(i)}if(Hl(i.length)&&Uh(i))return new Uint8Array(i);throw new Error("unsupported array-like object")}function je(i){return new Uint8Array(i)}function Xe(i,e,t,s,n){s==null&&n==null||(i=i.slice?i.slice(s,n):Array.prototype.slice.call(i,s,n)),e.set(i,t)}var wa,u_={toBytes:function(i){var e=[],t=0;for(i=encodeURI(i);t<i.length;){var s=i.charCodeAt(t++);s===37?(e.push(parseInt(i.substr(t,2),16)),t+=2):e.push(s)}return qe(e)},fromBytes:function(i){for(var e=[],t=0;t<i.length;){var s=i[t];s<128?(e.push(String.fromCharCode(s)),t++):s>191&&s<224?(e.push(String.fromCharCode((31&s)<<6|63&i[t+1])),t+=2):(e.push(String.fromCharCode((15&s)<<12|(63&i[t+1])<<6|63&i[t+2])),t+=3)}return e.join("")}},f_=(wa="0123456789abcdef",{toBytes:function(i){for(var e=[],t=0;t<i.length;t+=2)e.push(parseInt(i.substr(t,2),16));return e},fromBytes:function(i){for(var e=[],t=0;t<i.length;t++){var s=i[t];e.push(wa[(240&s)>>4]+wa[15&s])}return e.join("")}}),h_={16:10,24:12,32:14},d_=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],dt=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Qn=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p_=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],g_=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],m_=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],x_=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y_=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],v_=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],E_=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],A_=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],S_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],T_=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],b_=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],__=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Pa(i){for(var e=[],t=0;t<i.length;t+=4)e.push(i[t]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3]);return e}class Ss{constructor(e){if(!(this instanceof Ss))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:qe(e,!0)}),this._prepare()}_prepare(){var e=h_[this.key.length];if(e==null)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var s,n=4*(e+1),r=this.key.length/4,o=Pa(this.key);for(t=0;t<r;t++)s=t>>2,this._Ke[s][t%4]=o[t],this._Kd[e-s][t%4]=o[t];for(var a,c=0,l=r;l<n;){if(a=o[r-1],o[0]^=dt[a>>16&255]<<24^dt[a>>8&255]<<16^dt[255&a]<<8^dt[a>>24&255]^d_[c]<<24,c+=1,r!=8)for(t=1;t<r;t++)o[t]^=o[t-1];else{for(t=1;t<r/2;t++)o[t]^=o[t-1];for(a=o[r/2-1],o[r/2]^=dt[255&a]^dt[a>>8&255]<<8^dt[a>>16&255]<<16^dt[a>>24&255]<<24,t=r/2+1;t<r;t++)o[t]^=o[t-1]}for(t=0;t<r&&l<n;)u=l>>2,f=l%4,this._Ke[u][f]=o[t],this._Kd[e-u][f]=o[t++],l++}for(var u=1;u<e;u++)for(var f=0;f<4;f++)a=this._Kd[u][f],this._Kd[u][f]=S_[a>>24&255]^T_[a>>16&255]^b_[a>>8&255]^__[255&a]}encrypt(e){if(e.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,s=[0,0,0,0],n=Pa(e),r=0;r<4;r++)n[r]^=this._Ke[0][r];for(var o=1;o<t;o++){for(r=0;r<4;r++)s[r]=p_[n[r]>>24&255]^g_[n[(r+1)%4]>>16&255]^m_[n[(r+2)%4]>>8&255]^x_[255&n[(r+3)%4]]^this._Ke[o][r];n=s.slice()}var a,c=je(16);for(r=0;r<4;r++)a=this._Ke[t][r],c[4*r]=255&(dt[n[r]>>24&255]^a>>24),c[4*r+1]=255&(dt[n[(r+1)%4]>>16&255]^a>>16),c[4*r+2]=255&(dt[n[(r+2)%4]>>8&255]^a>>8),c[4*r+3]=255&(dt[255&n[(r+3)%4]]^a);return c}decrypt(e){if(e.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,s=[0,0,0,0],n=Pa(e),r=0;r<4;r++)n[r]^=this._Kd[0][r];for(var o=1;o<t;o++){for(r=0;r<4;r++)s[r]=y_[n[r]>>24&255]^v_[n[(r+3)%4]>>16&255]^E_[n[(r+2)%4]>>8&255]^A_[255&n[(r+1)%4]]^this._Kd[o][r];n=s.slice()}var a,c=je(16);for(r=0;r<4;r++)a=this._Kd[t][r],c[4*r]=255&(Qn[n[r]>>24&255]^a>>24),c[4*r+1]=255&(Qn[n[(r+3)%4]>>16&255]^a>>16),c[4*r+2]=255&(Qn[n[(r+2)%4]>>8&255]^a>>8),c[4*r+3]=255&(Qn[255&n[(r+1)%4]]^a);return c}}class iu{constructor(e){if(!(this instanceof iu))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Ss(e)}encrypt(e){if((e=qe(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=je(e.length),s=je(16),n=0;n<e.length;n+=16)Xe(e,s,0,n,n+16),Xe(s=this._aes.encrypt(s),t,n);return t}decrypt(e){if((e=qe(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=je(e.length),s=je(16),n=0;n<e.length;n+=16)Xe(e,s,0,n,n+16),Xe(s=this._aes.decrypt(s),t,n);return t}}class nu{constructor(e,t){if(!(this instanceof nu))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(t.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=je(16);this._lastCipherblock=qe(t,!0),this._aes=new Ss(e)}encrypt(e){if((e=qe(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=je(e.length),s=je(16),n=0;n<e.length;n+=16){Xe(e,s,0,n,n+16);for(var r=0;r<16;r++)s[r]^=this._lastCipherblock[r];this._lastCipherblock=this._aes.encrypt(s),Xe(this._lastCipherblock,t,n)}return t}decrypt(e){if((e=qe(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=je(e.length),s=je(16),n=0;n<e.length;n+=16){Xe(e,s,0,n,n+16),s=this._aes.decrypt(s);for(var r=0;r<16;r++)t[n+r]=s[r]^this._lastCipherblock[r];Xe(e,this._lastCipherblock,0,n,n+16)}return t}}class ru{constructor(e,t,s){if(!(this instanceof ru))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(t.length!=16)throw new Error("invalid initialation vector size (must be 16 size)")}else t=je(16);s||(s=1),this.segmentSize=s,this._shiftRegister=qe(t,!0),this._aes=new Ss(e)}encrypt(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,s=qe(e,!0),n=0;n<s.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var r=0;r<this.segmentSize;r++)s[n+r]^=t[r];Xe(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Xe(s,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return s}decrypt(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,s=qe(e,!0),n=0;n<s.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var r=0;r<this.segmentSize;r++)s[n+r]^=t[r];Xe(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Xe(e,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return s}}class ou{constructor(e,t){if(!(this instanceof ou))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(t.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=je(16);this._lastPrecipher=qe(t,!0),this._lastPrecipherIndex=16,this._aes=new Ss(e)}encrypt(e){for(var t=qe(e,!0),s=0;s<t.length;s++)this._lastPrecipherIndex===16&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[s]^=this._lastPrecipher[this._lastPrecipherIndex++];return t}decrypt(e){return this.encrypt(e)}}class mn{constructor(e){if(!(this instanceof mn))throw Error("Counter must be instanitated with `new`");e===0||e||(e=1),typeof e=="number"?(this._counter=je(16),this.setValue(e)):this.setBytes(e)}setValue(e){if(typeof e!="number"||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)}setBytes(e){if((e=qe(e,!0)).length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e}increment(){for(var e=15;e>=0;e--){if(this._counter[e]!==255){this._counter[e]++;break}this._counter[e]=0}}}class au{constructor(e,t){if(!(this instanceof au))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof mn||(t=new mn(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Ss(e)}encrypt(e){for(var t=qe(e,!0),s=0;s<t.length;s++)this._remainingCounterIndex===16&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[s]^=this._remainingCounter[this._remainingCounterIndex++];return t}decrypt(e){return this.encrypt(e)}}var us={AES:Ss,Counter:mn,ModeOfOperation:{ecb:iu,cbc:nu,cfb:ru,ofb:ou,ctr:au},utils:{hex:f_,utf8:u_},padding:{pkcs7:{pad:function(i){var e=16-(i=qe(i,!0)).length%16,t=je(i.length+e);Xe(i,t);for(var s=i.length;s<t.length;s++)t[s]=e;return t},strip:function(i){if((i=qe(i,!0)).length<16)throw new Error("PKCS#7 invalid length");var e=i[i.length-1];if(e>16)throw new Error("PKCS#7 padding byte out of range");for(var t=i.length-e,s=0;s<e;s++)if(i[t+s]!==e)throw new Error("PKCS#7 invalid padding byte");var n=je(t);return Xe(i,n,0,0,t),n}}},_arrayTest:{coerceArray:qe,createArray:je,copyArray:Xe}};function $h(i,e,t){const s=new Uint8Array(X.base64ToArrayBuffer(e)),n=us.utils.utf8.toBytes(t),r=us.utils.utf8.toBytes(i),o=new us.ModeOfOperation.cbc(s,n),a=us.padding.pkcs7.pad(r),c=o.encrypt(a);return X.arrayBufferToBase64(c)}let Gl,Oi=null;class I_ extends c_{constructor(e){super(e),this.clientType="mp-weixin",this.userEncryptKey=null}isLogin(){return!!this.scopedGlobalCache.mpWeixinCode||!!this.scopedGlobalCache.mpWeixinOpenid}async prepare(){if(!this.isLogin()){if(!this.scopedGlobalCache.initPromise)throw new Error("`uniCloud.initSecureNetworkByWeixin` has not yet been called");if(await this.scopedGlobalCache.initPromise,!this.isLogin())throw new Error("uniCloud.initSecureNetworkByWeixin` has not yet been called or successfully excuted")}}async getUserEncryptKey(){if(this.userEncryptKey)return this.userEncryptKey;if(Oi&&Oi.expireTime){const e=Date.now();if(Oi.expireTime-e>0)return this.userEncryptKey=Oi,this.userEncryptKey}return new Promise((e,t)=>{X.getUserCryptoManager().getLatestUserKey({success:s=>{Oi=s,this.userEncryptKey=s,e(this.userEncryptKey)},fail:s=>{t(Sm({...su.GET_ENCRYPT_KEY_FAILED,cause:s}))}})})}getWxAppId(){return hs.getAccountInfoSync().miniProgram.appId}async platformGetSignOption(){const{encryptKey:e,iv:t,version:s}=await this.getUserEncryptKey();return{verifyClientSign:$h(JSON.stringify({data:JSON.stringify({}),appId:this.appId,deviceId:this.deviceId,wxAppId:this.getWxAppId(),simulator:gn().platform==="devtools",timestamp:Date.now()}),e,t),encryptKeyId:s,mpWeixinCode:this.scopedGlobalCache.mpWeixinCode,mpWeixinOpenid:this.scopedGlobalCache.mpWeixinOpenid}}async platformEncryptData(e){const{encryptKey:t,iv:s,version:n}=await this.getUserEncryptKey(),r={secretType:this.secretType,encryptKeyId:n,mpWeixinCode:this.scopedGlobalCache.mpWeixinCode,mpWeixinOpenid:this.scopedGlobalCache.mpWeixinOpenid};return this.secretType===cs.RESPONSE?{content:e,_uniCloudOptions:r}:{content:$h(JSON.stringify({data:JSON.stringify(e),appId:this.appId,deviceId:this.deviceId,wxAppId:this.getWxAppId(),simulator:gn().platform==="devtools",timestamp:Date.now()}),t,s),_uniCloudOptions:r}}async platformDecryptResult(e){const{content:t}=e,{encryptKey:s,iv:n}=await this.getUserEncryptKey();return JSON.parse(function(r,o,a){const c=new Uint8Array(X.base64ToArrayBuffer(r)),l=new Uint8Array(X.base64ToArrayBuffer(o)),u=us.utils.utf8.toBytes(a),f=new us.ModeOfOperation.cbc(l,u),h=us.padding.pkcs7.strip(f.decrypt(c));return us.utils.utf8.fromBytes(h)}(t,s,n))}isClientKeyNotFound(){return!1}}function Hh({secretType:i}={}){return i===cs.REQUEST||i===cs.RESPONSE||i===cs.BOTH}function Gh({name:i,data:e={}}={}){return Ti==="app"}function C_({provider:i,spaceId:e,functionName:t}={}){const{appId:s,uniPlatform:n,osName:r}=gn();let o=n;n==="app"&&(o=r);const a=function({provider:f,spaceId:h}={}){const d=E7;if(!d)return{};f=function(m){return m==="tencent"?"tcb":m}(f);const p=d.find(m=>m.provider===f&&m.spaceId===h);return p&&p.config}({provider:i,spaceId:e});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},l=Object.keys(c);if(l.length===0)return!0;const u=function(f,h){let d,p,m;for(let g=0;g<f.length;g++){const y=f[g];y!==h?y!=="*"?y.split(",").map(v=>v.trim()).indexOf(h)>-1&&(p=y):m=y:d=y}return d||p||m}(l,t);if(!u)return!1;if((c[u]||[]).find((f={})=>f.appId===s&&(f.platform||"").toLowerCase()===o.toLowerCase()))return!0;throw console.error(`此应用[appId: ${s}, platform: ${o}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),Sm(su.APP_INFO_INVALID)}function Kh({functionName:i,result:e,logPvd:t}){if(this.__dev__.debugLog&&e&&e.requestId){const s=JSON.stringify({spaceId:this.config.spaceId,functionName:i,requestId:e.requestId});console.log(`[${t}-request]${s}[/${t}-request]`)}}function L_(i){const e=i.callFunction,t=function(s){const n=s.name;s.data=vm.call(i,{data:s.data});const r={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay",dcloud:"dcloud"}[this.config.provider],o=Hh(s),a=Gh(s),c=o||a;return e.call(this,s).then(l=>(l.errCode=0,!c&&Kh.call(this,{functionName:n,result:l,logPvd:r}),Promise.resolve(l)),l=>(!c&&Kh.call(this,{functionName:n,result:l,logPvd:r}),l&&l.message&&(l.message=function({message:u="",extraInfo:f={},formatter:h=[]}={}){for(let d=0;d<h.length;d++){const{rule:p,content:m,mode:g}=h[d],y=u.match(p);if(!y)continue;let v=m;for(let x=1;x<y.length;x++)v=Mh(v,`{$${x}}`,y[x]);for(const x in f)v=Mh(v,`{${x}}`,f[x]);return g==="replace"?v:u+v}return u}({message:`[${s.name}]: ${l.message}`,formatter:o_,extraInfo:{functionName:n}})),Promise.reject(l)))};i.callFunction=function(s){const{provider:n,spaceId:r}=i.config,o=s.name;let a,c;return s.data=s.data||{},i.__dev__.debugInfo&&!i.__dev__.debugInfo.forceRemote&&Z1?(i._callCloudFunction||(i._callCloudFunction=t,i._callLocalFunction=Oh),a=Oh):a=t,a=a.bind(i),Gh(s)||(function({name:l,data:u={}}){return l==="uni-id-co"&&u.method==="secureNetworkHandshakeByWeixin"}(s)?c=a.call(i,s):Hh(s)?c=new Gl({secretType:s.secretType,uniCloudIns:i}).wrapEncryptDataCallFunction(t.bind(i))(s):C_({provider:n,spaceId:r,functionName:o})?c=new Gl({secretType:s.secretType,uniCloudIns:i}).wrapVerifyClientCallFunction(t.bind(i))(s):c=a(s)),Object.defineProperty(c,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),c.then(l=>l)}}Gl=I_;const Tm=Symbol("CLIENT_DB_INTERNAL");function Ur(i,e){return i.then="DoNotReturnProxyWithAFunctionNamedThen",i._internalType=Tm,i.inspect=null,i.__v_raw=void 0,new Proxy(i,{get(t,s,n){if(s==="_uniClient")return null;if(typeof s=="symbol")return t[s];if(s in t||typeof s!="string"){const r=t[s];return typeof r=="function"?r.bind(t):r}return e.get(t,s,n)}})}function Vh(i){return{on:(e,t)=>{i[e]=i[e]||[],i[e].indexOf(t)>-1||i[e].push(t)},off:(e,t)=>{i[e]=i[e]||[];const s=i[e].indexOf(t);s!==-1&&i[e].splice(s,1)}}}const D_=["db.Geo","db.command","command.aggregate"];function bm(i,e){return D_.indexOf(`${i}.${e}`)>-1}function Os(i){switch(dn(i=nm(i))){case"array":return i.map(e=>Os(e));case"object":return i._internalType===Tm||Object.keys(i).forEach(e=>{i[e]=Os(i[e])}),i;case"regexp":return{$regexp:{source:i.source,flags:i.flags}};case"date":return{$date:i.toISOString()};default:return i}}function Mi(i){return i&&i.content&&i.content.$method}class R_{constructor(e,t,s){this.content=e,this.prevStage=t||null,this.udb=null,this._database=s}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map(s=>({$method:s.$method,$param:Os(s.$param)}))}}toString(){return JSON.stringify(this.toJSON())}getAction(){const e=this.toJSON().$db.find(t=>t.$method==="action");return e&&e.$param&&e.$param[0]}getCommand(){return{$db:this.toJSON().$db.filter(e=>e.$method!=="action")}}get isAggregate(){let e=this;for(;e;){const t=Mi(e),s=Mi(e.prevStage);if(t==="aggregate"&&s==="collection"||t==="pipeline")return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if(Mi(e)==="command")return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=Mi(e),s=Mi(e.prevStage);if(t==="aggregate"&&s==="command")return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return xn({$method:e,$param:Os(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const s=this.getAction(),n=this.getCommand();if(n.$db.push({$method:e,$param:Os(t)}),y7){const r=n.$db.find(a=>a.$method==="collection"),o=r&&r.$param;o&&o.length===1&&typeof r.$param[0]=="string"&&r.$param[0].indexOf(",")>-1&&console.warn(`检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。
- - 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp
- - 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。`)}return this._database._callCloudFunction({action:s,command:n})}}function xn(i,e,t){return Ur(new R_(i,e,t),{get(s,n){let r="db";return s&&s.content&&(r=s.content.$method),bm(r,n)?xn({$method:n},s,t):function(){return xn({$method:n,$param:Os(Array.from(arguments))},s,t)}}})}function ka({path:i,method:e}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...i.map(t=>({$method:t})),{$method:e,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}class w_{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=Gs("_globalUniCloudDatabaseCallback")),t||(this.auth=Vh(this._authCallBacks)),this._isJQL=t,Object.assign(this,Vh(this._dbCallBacks)),this.env=Ur({},{get:(s,n)=>({$env:n})}),this.Geo=Ur({},{get:(s,n)=>ka({path:["Geo"],method:n})}),this.serverDate=ka({path:[],method:"serverDate"}),this.RegExp=ka({path:[],method:"RegExp"})}getCloudEnv(e){if(typeof e!="string"||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const s=this._dbCallBacks;s[e]&&s[e].forEach(n=>{n(...t)})}_callbackAuth(e,t){const s=this._authCallBacks;s[e]&&s[e].forEach(n=>{n(...t)})}multiSend(){const e=Array.from(arguments),t=e.map(s=>{const n=s.getAction(),r=s.getCommand();if(r.$db[r.$db.length-1].$method!=="getTemp")throw new Error("multiSend只支持子命令内使用getTemp");return{action:n,command:r}});return this._callCloudFunction({multiCommand:t,queryList:e})}}function jh(i,e={}){return Ur(new i(e),{get:(t,s)=>bm("db",s)?xn({$method:s},null,t):function(){return xn({$method:s,$param:Os(Array.from(arguments))},null,t)}})}class qh extends w_{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:s,queryList:n}){function r(f,h){if(s&&n)for(let d=0;d<n.length;d++){const p=n[d];p.udb&&typeof p.udb.setResult=="function"&&(h?p.udb.setResult(h):p.udb.setResult(f.result.dataList[d]))}}const o=this,a=this._isJQL?"databaseForJQL":"database";function c(f){return o._callback("error",[f]),st(it(a,"fail"),f).then(()=>st(it(a,"complete"),f)).then(()=>(r(null,f),mt(Re.RESPONSE,{type:ls.CLIENT_DB,content:f}),Promise.reject(f)))}const l=st(it(a,"invoke")),u=this._uniClient;return l.then(()=>u.callFunction({name:"DCloud-clientDB",type:Nr.CLIENT_DB,data:{action:e,command:t,multiCommand:s}})).then(f=>{const{code:h,message:d,token:p,tokenExpired:m,systemInfo:g=[]}=f.result;if(g)for(let v=0;v<g.length;v++){const{level:x,message:E,detail:S}=g[v];let T="[System Info]"+E;S&&(T=`${T}
- 详细信息:${S}`),(console[x]||console.log)(T)}if(h)return c(new Q({code:h,message:d,requestId:f.requestId}));f.result.errCode=f.result.errCode||f.result.code,f.result.errMsg=f.result.errMsg||f.result.message,p&&m&&(rm({token:p,tokenExpired:m}),this._callbackAuth("refreshToken",[{token:p,tokenExpired:m}]),this._callback("refreshToken",[{token:p,tokenExpired:m}]),mt(Re.REFRESH_TOKEN,{token:p,tokenExpired:m}));const y=[{prop:"affectedDocs",tips:"affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"},{prop:"code",tips:"code不再推荐使用,请使用errCode替代"},{prop:"message",tips:"message不再推荐使用,请使用errMsg替代"}];for(let v=0;v<y.length;v++){const{prop:x,tips:E}=y[v];if(x in f.result){const S=f.result[x];Object.defineProperty(f.result,x,{get:()=>(console.warn(E),S)})}}return function(v){return st(it(a,"success"),v).then(()=>st(it(a,"complete"),v)).then(()=>{r(v,null);const x=o._parseResult(v);return mt(Re.RESPONSE,{type:ls.CLIENT_DB,content:x}),Promise.resolve(x)})}(f)},f=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(f.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),c(new Q({code:f.code||"SYSTEM_ERROR",message:f.message,requestId:f.requestId}))))}}const Rs="token无效,跳转登录页面",_m="token过期,跳转登录页面",Im={TOKEN_INVALID_TOKEN_EXPIRED:_m,TOKEN_INVALID_INVALID_CLIENTID:Rs,TOKEN_INVALID:Rs,TOKEN_INVALID_WRONG_TOKEN:Rs,TOKEN_INVALID_ANONYMOUS_USER:Rs},P_={"uni-id-token-expired":_m,"uni-id-check-token-failed":Rs,"uni-id-token-not-exist":Rs,"uni-id-check-device-feature-failed":Rs},Kl={...Im,...P_,default:"用户未登录或登录状态过期,自动跳转登录页面"};function Wh(i,e){let t="";return t=i?`${i}/${e}`:e,t.replace(/^\//,"")}function zh(i=[],e=""){const t=[],s=[];return i.forEach(n=>{n.needLogin===!0?t.push(Wh(e,n.path)):n.needLogin===!1&&s.push(Wh(e,n.path))}),{needLoginPage:t,notNeedLoginPage:s}}function yn(i){return i.split("?")[0].replace(/^\//,"")}function lu(){return function(i){let e=i&&i.$page&&i.$page.fullPath;return e?(e.charAt(0)!=="/"&&(e="/"+e),e):""}(function(){const i=getCurrentPages();return i[i.length-1]}())}function Cm(){return yn(lu())}function k_(i="",e={}){if(!i||!(e&&e.list&&e.list.length))return!1;const t=e.list,s=yn(i);return t.some(n=>n.pagePath===s)}const B_=!!W1.uniIdRouter,{loginPage:vn,routerNeedLogin:F_,resToLogin:O_,needLoginPage:Lm,notNeedLoginPage:M_,loginPageInTabBar:N_}=function({pages:i=[],subPackages:e=[],uniIdRouter:t={},tabBar:s={}}=W1){const{loginPage:n,needLogin:r=[],resToLogin:o=!0}=t,{needLoginPage:a,notNeedLoginPage:c}=zh(i),{needLoginPage:l,notNeedLoginPage:u}=function(f=[]){const h=[],d=[];return f.forEach(p=>{const{root:m,pages:g=[]}=p,{needLoginPage:y,notNeedLoginPage:v}=zh(g,m);h.push(...y),d.push(...v)}),{needLoginPage:h,notNeedLoginPage:d}}(e);return{loginPage:n,routerNeedLogin:r,resToLogin:o,needLoginPage:[...a,...l],notNeedLoginPage:[...c,...u],loginPageInTabBar:k_(n,s)}}();if(Lm.indexOf(vn)>-1)throw new Error(`Login page [${vn}] should not be "needLogin", please check your pages.json`);function Dm(i){const e=Cm();if(i.charAt(0)==="/")return i;const[t,s]=i.split("?"),n=t.replace(/^\//,"").split("/"),r=e.split("/");r.pop();for(let o=0;o<n.length;o++){const a=n[o];a===".."?r.pop():a!=="."&&r.push(a)}return r[0]===""&&r.shift(),"/"+r.join("/")+(s?"?"+s:"")}function U_(i){const e=yn(Dm(i));return!(M_.indexOf(e)>-1)&&(Lm.indexOf(e)>-1||F_.some(t=>function(s,n){return new RegExp(n).test(s)}(i,t)))}function Rm({redirect:i}){const e=yn(i),t=yn(vn);return Cm()!==t&&e!==t}function Vl({api:i,redirect:e}={}){if(!e||!Rm({redirect:e}))return;const t=function(n,r){return n.charAt(0)!=="/"&&(n="/"+n),r?n.indexOf("?")>-1?n+`&uniIdRedirectUrl=${encodeURIComponent(r)}`:n+`?uniIdRedirectUrl=${encodeURIComponent(r)}`:n}(vn,e);N_?i!=="navigateTo"&&i!=="redirectTo"||(i="switchTab"):i==="switchTab"&&(i="navigateTo");const s={navigateTo:X.navigateTo,redirectTo:X.redirectTo,switchTab:X.switchTab,reLaunch:X.reLaunch};setTimeout(()=>{s[i]({url:t})},0)}function Qh({url:i}={}){const e={abortLoginPageJump:!1,autoToLoginPage:!1},t=function(){const{token:s,tokenExpired:n}=pn();let r;if(s){if(n<Date.now()){const o="uni-id-token-expired";r={errCode:o,errMsg:Kl[o]}}}else{const o="uni-id-check-token-failed";r={errCode:o,errMsg:Kl[o]}}return r}();if(U_(i)&&t){if(t.uniIdRedirectUrl=i,bn(Re.NEED_LOGIN).length>0)return setTimeout(()=>{mt(Re.NEED_LOGIN,t)},0),e.abortLoginPageJump=!0,e;e.autoToLoginPage=!0}return e}function $_(){(function(){const e=lu(),{abortLoginPageJump:t,autoToLoginPage:s}=Qh({url:e});t||s&&Vl({api:"redirectTo",redirect:e})})();const i=["navigateTo","redirectTo","reLaunch","switchTab"];for(let e=0;e<i.length;e++){const t=i[e];X.addInterceptor(t,{invoke(s){const{abortLoginPageJump:n,autoToLoginPage:r}=Qh({url:s.url});return n?s:r?(Vl({api:t,redirect:Dm(s.url)}),!1):s}})}}function H_(){this.onResponse(i=>{const{type:e,content:t}=i;let s=!1;switch(e){case"cloudobject":s=function(n){if(typeof n!="object")return!1;const{errCode:r}=n||{};return r in Kl}(t);break;case"clientdb":s=function(n){if(typeof n!="object")return!1;const{errCode:r}=n||{};return r in Im}(t)}s&&function(n={}){const r=bn(Re.NEED_LOGIN);sm().then(()=>{const o=lu();if(o&&Rm({redirect:o}))return r.length>0?mt(Re.NEED_LOGIN,Object.assign({uniIdRedirectUrl:o},n)):void(vn&&Vl({api:"navigateTo",redirect:o}))})}(t)})}function G_(i){(function(e){e.onResponse=function(t){Aa(Re.RESPONSE,t)},e.offResponse=function(t){Sa(Re.RESPONSE,t)}})(i),function(e){e.onNeedLogin=function(t){Aa(Re.NEED_LOGIN,t)},e.offNeedLogin=function(t){Sa(Re.NEED_LOGIN,t)},B_&&(Gs(Nh).needLoginInit||(Gs(Nh).needLoginInit=!0,sm().then(()=>{$_.call(e)}),O_&&H_.call(e)))}(i),function(e){e.onRefreshToken=function(t){Aa(Re.REFRESH_TOKEN,t)},e.offRefreshToken=function(t){Sa(Re.REFRESH_TOKEN,t)}}(i)}let wm;const Yn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",K_=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function V_(){const i=pn().token||"",e=i.split(".");if(!i||e.length!==3)return{uid:null,role:[],permission:[],tokenExpired:0};let t;try{t=JSON.parse((s=e[1],decodeURIComponent(wm(s).split("").map(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)}).join(""))))}catch(n){throw new Error("获取当前用户信息出错,详细错误信息为:"+n.message)}var s;return t.tokenExpired=1e3*t.exp,delete t.exp,delete t.iat,t}wm=typeof atob!="function"?function(i){if(i=String(i).replace(/[\t\n\f\r ]+/g,""),!K_.test(i))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var e;i+="==".slice(2-(3&i.length));for(var t,s,n="",r=0;r<i.length;)e=Yn.indexOf(i.charAt(r++))<<18|Yn.indexOf(i.charAt(r++))<<12|(t=Yn.indexOf(i.charAt(r++)))<<6|(s=Yn.indexOf(i.charAt(r++))),n+=t===64?String.fromCharCode(e>>16&255):s===64?String.fromCharCode(e>>16&255,e>>8&255):String.fromCharCode(e>>16&255,e>>8&255,255&e);return n}:atob;var j_=Mt(function(i,e){Object.defineProperty(e,"__esModule",{value:!0});const t="chooseAndUploadFile:ok",s="chooseAndUploadFile:fail";function n(o,a){return o.tempFiles.forEach((c,l)=>{c.name||(c.name=c.path.substring(c.path.lastIndexOf("/")+1)),a&&(c.fileType=a),c.cloudPath=Date.now()+"_"+l+c.name.substring(c.name.lastIndexOf("."))}),o.tempFilePaths||(o.tempFilePaths=o.tempFiles.map(c=>c.path)),o}function r(o,a,{onChooseFile:c,onUploadProgress:l}){return a.then(u=>{if(c){const f=c(u);if(f!==void 0)return Promise.resolve(f).then(h=>h===void 0?u:h)}return u}).then(u=>u===!1?{errMsg:t,tempFilePaths:[],tempFiles:[]}:function(f,h,d=5,p){(h=Object.assign({},h)).errMsg=t;const m=h.tempFiles,g=m.length;let y=0;return new Promise(v=>{for(;y<d;)x();function x(){const E=y++;if(E>=g)return void(!m.find(T=>!T.url&&!T.errMsg)&&v(h));const S=m[E];f.uploadFile({provider:S.provider,filePath:S.path,cloudPath:S.cloudPath,fileType:S.fileType,cloudPathAsRealPath:S.cloudPathAsRealPath,onUploadProgress(T){T.index=E,T.tempFile=S,T.tempFilePath=S.path,p&&p(T)}}).then(T=>{S.url=T.fileID,E<g&&x()}).catch(T=>{S.errMsg=T.errMsg||T.message,E<g&&x()})}})}(o,u,5,l))}e.initChooseAndUploadFile=function(o){return function(a={type:"all"}){return a.type==="image"?r(o,function(c){const{count:l,sizeType:u,sourceType:f=["album","camera"],extension:h}=c;return new Promise((d,p)=>{X.chooseImage({count:l,sizeType:u,sourceType:f,extension:h,success(m){d(n(m,"image"))},fail(m){p({errMsg:m.errMsg.replace("chooseImage:fail",s)})}})})}(a),a):a.type==="video"?r(o,function(c){const{camera:l,compressed:u,maxDuration:f,sourceType:h=["album","camera"],extension:d}=c;return new Promise((p,m)=>{X.chooseVideo({camera:l,compressed:u,maxDuration:f,sourceType:h,extension:d,success(g){const{tempFilePath:y,duration:v,size:x,height:E,width:S}=g;p(n({errMsg:"chooseVideo:ok",tempFilePaths:[y],tempFiles:[{name:g.tempFile&&g.tempFile.name||"",path:y,size:x,type:g.tempFile&&g.tempFile.type||"",width:S,height:E,duration:v,fileType:"video",cloudPath:""}]},"video"))},fail(g){m({errMsg:g.errMsg.replace("chooseVideo:fail",s)})}})})}(a),a):r(o,function(c){const{count:l,extension:u}=c;return new Promise((f,h)=>{let d=X.chooseFile;if(typeof hs<"u"&&typeof hs.chooseMessageFile=="function"&&(d=hs.chooseMessageFile),typeof d!="function")return h({errMsg:s+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});d({type:"all",count:l,extension:u,success(p){f(n(p))},fail(p){h({errMsg:p.errMsg.replace("chooseFile:fail",s)})}})})}(a),a)}}}),q_=c7(j_);const W_={auto:"auto",onready:"onready",manual:"manual"};function Pm(i){return{props:{localdata:{type:Array,default:()=>[]},options:{type:[Object,Array],default:()=>({})},spaceInfo:{type:Object,default:()=>({})},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:()=>({mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{},mixinDatacomError:null}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch(()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach(t=>{e.push(this[t])}),e},(e,t)=>{if(this.loadtime===W_.manual)return;let s=!1;const n=[];for(let r=2;r<e.length;r++)e[r]!==t[r]&&(n.push(e[r]),s=!0);e[0]!==t[0]&&(this.mixinDatacomPage.current=this.pageCurrent),this.mixinDatacomPage.size=this.pageSize,this.onMixinDatacomPropsChange(s,n)})},methods:{onMixinDatacomPropsChange(e,t){},mixinDatacomEasyGet({getone:e=!1,success:t,fail:s}={}){this.mixinDatacomLoading||(this.mixinDatacomLoading=!0,this.mixinDatacomErrorMessage="",this.mixinDatacomError=null,this.mixinDatacomGet().then(n=>{this.mixinDatacomLoading=!1;const{data:r,count:o}=n.result;this.getcount&&(this.mixinDatacomPage.count=o),this.mixinDatacomHasMore=r.length<this.pageSize;const a=e?r.length?r[0]:void 0:r;this.mixinDatacomResData=a,t&&t(a)}).catch(n=>{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=n,this.mixinDatacomError=n,s&&s(n)}))},mixinDatacomGet(e={}){let t;e=e||{},t=typeof __uniX<"u"&&__uniX?i.databaseForJQL(this.spaceInfo):i.database(this.spaceInfo);const s=e.action||this.action;s&&(t=t.action(s));const n=e.collection||this.collection;t=Array.isArray(n)?t.collection(...n):t.collection(n);const r=e.where||this.where;r&&Object.keys(r).length&&(t=t.where(r));const o=e.field||this.field;o&&(t=t.field(o));const a=e.foreignKey||this.foreignKey;a&&(t=t.foreignKey(a));const c=e.groupby||this.groupby;c&&(t=t.groupBy(c));const l=e.groupField||this.groupField;l&&(t=t.groupField(l)),(e.distinct!==void 0?e.distinct:this.distinct)===!0&&(t=t.distinct());const u=e.orderby||this.orderby;u&&(t=t.orderBy(u));const f=e.pageCurrent!==void 0?e.pageCurrent:this.mixinDatacomPage.current,h=e.pageSize!==void 0?e.pageSize:this.mixinDatacomPage.size,d=e.getcount!==void 0?e.getcount:this.getcount,p=e.gettree!==void 0?e.gettree:this.gettree,m=e.gettreepath!==void 0?e.gettreepath:this.gettreepath,g={getCount:d},y={limitLevel:e.limitlevel!==void 0?e.limitlevel:this.limitlevel,startWith:e.startwith!==void 0?e.startwith:this.startwith};return p&&(g.getTree=y),m&&(g.getTreePath=y),t=t.skip(h*(f-1)).limit(h).get(g),t}}}}function z_(i){return function(e,t={}){t=function(c,l={}){return c.customUI=l.customUI||c.customUI,c.parseSystemError=l.parseSystemError||c.parseSystemError,Object.assign(c.loadingOptions,l.loadingOptions),Object.assign(c.errorOptions,l.errorOptions),typeof l.secretMethods=="object"&&(c.secretMethods=l.secretMethods),c}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},t);const{customUI:s,loadingOptions:n,errorOptions:r,parseSystemError:o}=t,a=!s;return new Proxy({},{get(c,l){switch(l){case"toString":return"[object UniCloudObject]";case"toJSON":return{}}return function({fn:u,interceptorName:f,getCallbackArgs:h}={}){return async function(...d){const p=h?h({params:d}):{};let m,g;try{return await st(it(f,"invoke"),{...p}),m=await u(...d),await st(it(f,"success"),{...p,result:m}),m}catch(y){throw g=y,await st(it(f,"fail"),{...p,error:g}),g}finally{await st(it(f,"complete"),g?{...p,error:g}:{...p,result:m})}}}({fn:async function u(...f){let h;a&&X.showLoading({title:n.title,mask:n.mask});const d={name:e,type:Nr.OBJECT,data:{method:l,params:f}};typeof t.secretMethods=="object"&&function(x,E){const S=E.data.method,T=x.secretMethods||{},_=T[S]||T["*"];_&&(E.secretType=_)}(t,d);let p=!1;try{h=await i.callFunction(d)}catch(x){p=!0,h={result:new Q(x)}}const{errSubject:m,errCode:g,errMsg:y,newToken:v}=h.result||{};if(a&&X.hideLoading(),v&&v.token&&v.tokenExpired&&(rm(v),mt(Re.REFRESH_TOKEN,{...v})),g){let x=y;if(p&&o&&(x=(await o({objectName:e,methodName:l,params:f,errSubject:m,errCode:g,errMsg:y})).errMsg||y),a)if(r.type==="toast")X.showToast({title:x,icon:"none"});else{if(r.type!=="modal")throw new Error(`Invalid errorOptions.type: ${r.type}`);{const{confirm:S}=await async function({title:T,content:_,showCancel:I,cancelText:R,confirmText:b}={}){return new Promise((L,k)=>{X.showModal({title:T,content:_,showCancel:I,cancelText:R,confirmText:b,success(M){L(M)},fail(){L({confirm:!1,cancel:!0})}})})}({title:"提示",content:x,showCancel:r.retry,cancelText:"取消",confirmText:r.retry?"重试":"确定"});if(r.retry&&S)return u(...f)}}const E=new Q({subject:m,code:g,message:y,requestId:h.requestId});throw E.detail=h.result,mt(Re.RESPONSE,{type:ls.CLOUD_OBJECT,content:E}),E}return mt(Re.RESPONSE,{type:ls.CLOUD_OBJECT,content:h.result}),h.result},interceptorName:"callObject",getCallbackArgs:function({params:u}={}){return{objectName:e,methodName:l,params:u}}})}})}}function km(i){return Gs(Am.replace("{spaceId}",i.config.spaceId))}async function Q_({openid:i,callLoginByWeixin:e=!1}={}){const t=km(this);if(i&&e)throw new Error("[SecureNetwork] openid and callLoginByWeixin cannot be passed at the same time");if(i)return t.mpWeixinOpenid=i,{};const s=await new Promise((r,o)=>{X.login({success(a){r(a.code)},fail(a){o(new Error(a.errMsg))}})});return await this.importObject("uni-id-co",{customUI:!0}).secureNetworkHandshakeByWeixin({code:s,callLoginByWeixin:e}),t.mpWeixinCode=s,{code:s}}async function Y_(i){const e=km(this);return e.initPromise||(e.initPromise=Q_.call(this,i).then(t=>t).catch(t=>{throw delete e.initPromise,t})),e.initPromise}function X_(i){return function({openid:e,callLoginByWeixin:t=!1}={}){return Y_.call(i,{openid:e,callLoginByWeixin:t})}}function J_(i){(function(e){Ml=e})(i)}function Yh(i){const e=hs.canIUse("getAppBaseInfo"),t={getAppBaseInfo:e?X.getAppBaseInfo:X.getSystemInfo,getPushClientId:X.getPushClientId};return function(s){return new Promise((n,r)=>{e&&i==="getAppBaseInfo"?n(t[i]()):t[i]({...s,success(o){n(o)},fail(o){r(o)}})})}}class Z_ extends x7{constructor(){super(),this._uniPushMessageCallback=this._receivePushMessage.bind(this),this._currentMessageId=-1,this._payloadQueue=[]}init(){return Promise.all([Yh("getAppBaseInfo")(),Yh("getPushClientId")()]).then(([{appId:e}={},{cid:t}={}]=[])=>{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()},e=>{throw this.emit("error",e),this.close(),e})}async open(){return this.init()}_isUniCloudSSE(e){if(e.type!=="receive")return!1;const t=e&&e.data&&e.data.payload;return!(!t||t.channel!=="UNI_CLOUD_SSE"||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:s,messageId:n,message:r}=t;this._payloadQueue.push({action:s,messageId:n,message:r}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find(t=>t.messageId===this._currentMessageId+1);if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:s,message:n}=e;t==="end"?this._end({messageId:s,message:n}):t==="message"&&this._appendMessage({messageId:s,message:n})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){X.onPushMessage(this._uniPushMessageCallback)}_destroy(){X.offPushMessage(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}async function eI(i){const e=i.__dev__;if(!e.debugInfo)return;const{address:t,servePort:s}=e.debugInfo,{address:n}=await gm(t,s);if(n)return e.localAddress=n,void(e.localPort=s);const r=console.warn;let o="";if(e.debugInfo.initialLaunchType==="remote"?(e.debugInfo.forceRemote=!0,o=`当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。
- - 如果不使用uniCloud本地调试服务,请直接忽略此信息。
- - 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。`):o=`无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。
- - 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。`,o+=`
- - 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试
- - 检查系统防火墙是否拦截了HBuilderX自带的nodejs
- - 检查是否错误的使用拦截器修改uni.request方法的参数`,Ti.indexOf("mp-")===0&&(o+=`
- - 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp`),!e.debugInfo.forceRemote)throw new Error(o);r(o)}function tI(i){i._initPromiseHub||(i._initPromiseHub=new Xc({createPromise:function(){let e=Promise.resolve();var t;t=1,e=new Promise(n=>{setTimeout(()=>{n()},t)});const s=i.auth();return e.then(()=>s.getLoginState()).then(n=>n?Promise.resolve():s.signInAnonymously())}}))}const sI={tcb:kh,tencent:kh,aliyun:C7,private:Bh,dcloud:Bh,alipay:r_};let Et=new class{init(i){let e={};const t=sI[i.provider];if(!t)throw new Error("未提供正确的provider参数");return e=t.init(i),function(s){const n={};s.__dev__=n,n.debugLog=Ti==="mp-harmony";const r=A7;r&&!r.code&&(n.debugInfo=r);const o=new Xc({createPromise:function(){return eI(s)}});n.initLocalNetwork=function(){return o.exec()}}(e),tI(e),L_(e),function(s){const n=s.uploadFile;s.uploadFile=function(r){return n.call(this,r)}}(e),function(s){s.database=function(n){if(n&&Object.keys(n).length>0)return s.init(n).database();if(this._database)return this._database;const r=jh(qh,{uniClient:s});return this._database=r,r},s.databaseForJQL=function(n){if(n&&Object.keys(n).length>0)return s.init(n).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const r=jh(qh,{uniClient:s,isJQL:!0});return this._databaseForJQL=r,r}}(e),function(s){s.getCurrentUserInfo=V_,s.chooseAndUploadFile=q_.initChooseAndUploadFile(s),Object.assign(s,{get mixinDatacom(){return Pm(s)}}),s.SSEChannel=Z_,s.initSecureNetworkByWeixin=X_(s),s.setCustomClientInfo=J_,s.importObject=z_(s)}(e),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach(s=>{if(!e[s])return;const n=e[s];e[s]=function(){return n.apply(e,Array.from(arguments))},e[s]=function(r,o){return function(a){let c=!1;o==="callFunction"&&(c=(a&&a.type||Nr.DEFAULT)!==Nr.DEFAULT);const l=o==="callFunction"&&!c,u=this._initPromiseHub.exec();a=a||{};const{success:f,fail:h,complete:d}=im(a),p=u.then(()=>c?Promise.resolve():st(it(o,"invoke"),a)).then(()=>r.call(this,a)).then(m=>c?Promise.resolve(m):st(it(o,"success"),m).then(()=>st(it(o,"complete"),m)).then(()=>(l&&mt(Re.RESPONSE,{type:ls.CLOUD_FUNCTION,content:m}),Promise.resolve(m))),m=>c?Promise.reject(m):st(it(o,"fail"),m).then(()=>st(it(o,"complete"),m)).then(()=>(mt(Re.RESPONSE,{type:ls.CLOUD_FUNCTION,content:m}),Promise.reject(m))));if(!(f||h||d))return p;p.then(m=>{f&&f(m),d&&d(m),l&&mt(Re.RESPONSE,{type:ls.CLOUD_FUNCTION,content:m})},m=>{h&&h(m),d&&d(m),l&&mt(Re.RESPONSE,{type:ls.CLOUD_FUNCTION,content:m})})}}(e[s],s).bind(e)}),e.init=this.init,e}};(()=>{const i=Z1;let e={};if(i&&i.length===1)e=i[0],Et=Et.init(e),Et._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile"],s=["database","getCurrentUserInfo","importObject"];let n;n=i&&i.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",[...t,...s].forEach(r=>{Et[r]=function(){if(console.error(n),s.indexOf(r)===-1)return Promise.reject(new Q({code:"SYS_ERR",message:n}));console.error(n)}})}Object.assign(Et,{get mixinDatacom(){return Pm(Et)}}),G_(Et),Et.addInterceptor=tm,Et.removeInterceptor=T7,Et.interceptObject=b7})();var iI=Et,Bm={exports:{}};(function(i,e){(function(t,s){i.exports=s()})(oe,function(){var t=1e3,s=6e4,n=36e5,r="millisecond",o="second",a="minute",c="hour",l="day",u="week",f="month",h="quarter",d="year",p="date",m="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var F=["th","st","nd","rd"],O=N%100;return"["+N+(F[(O-20)%10]||F[O]||F[0])+"]"}},x=function(N,F,O){var K=String(N);return!K||K.length>=F?N:""+Array(F+1-K.length).join(O)+N},E={s:x,z:function(N){var F=-N.utcOffset(),O=Math.abs(F),K=Math.floor(O/60),B=O%60;return(F<=0?"+":"-")+x(K,2,"0")+":"+x(B,2,"0")},m:function N(F,O){if(F.date()<O.date())return-N(O,F);var K=12*(O.year()-F.year())+(O.month()-F.month()),B=F.clone().add(K,f),G=O-B<0,H=F.clone().add(K+(G?-1:1),f);return+(-(K+(O-B)/(G?B-H:H-B))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:f,y:d,w:u,d:l,D:p,h:c,m:a,s:o,ms:r,Q:h}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},S="en",T={};T[S]=v;var _="$isDayjsObject",I=function(N){return N instanceof k||!(!N||!N[_])},R=function N(F,O,K){var B;if(!F)return S;if(typeof F=="string"){var G=F.toLowerCase();T[G]&&(B=G),O&&(T[G]=O,B=G);var H=F.split("-");if(!B&&H.length>1)return N(H[0])}else{var C=F.name;T[C]=F,B=C}return!K&&B&&(S=B),B||!K&&S},b=function(N,F){if(I(N))return N.clone();var O=typeof F=="object"?F:{};return O.date=N,O.args=arguments,new k(O)},L=E;L.l=R,L.i=I,L.w=function(N,F){return b(N,{locale:F.$L,utc:F.$u,x:F.$x,$offset:F.$offset})};var k=function(){function N(O){this.$L=R(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[_]=!0}var F=N.prototype;return F.parse=function(O){this.$d=function(K){var B=K.date,G=K.utc;if(B===null)return new Date(NaN);if(L.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var H=B.match(g);if(H){var C=H[2]-1||0,D=(H[7]||"0").substring(0,3);return G?new Date(Date.UTC(H[1],C,H[3]||1,H[4]||0,H[5]||0,H[6]||0,D)):new Date(H[1],C,H[3]||1,H[4]||0,H[5]||0,H[6]||0,D)}}return new Date(B)}(O),this.init()},F.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},F.$utils=function(){return L},F.isValid=function(){return this.$d.toString()!==m},F.isSame=function(O,K){var B=b(O);return this.startOf(K)<=B&&B<=this.endOf(K)},F.isAfter=function(O,K){return b(O)<this.startOf(K)},F.isBefore=function(O,K){return this.endOf(K)<b(O)},F.$g=function(O,K,B){return L.u(O)?this[K]:this.set(B,O)},F.unix=function(){return Math.floor(this.valueOf()/1e3)},F.valueOf=function(){return this.$d.getTime()},F.startOf=function(O,K){var B=this,G=!!L.u(K)||K,H=L.p(O),C=function(pe,fe){var _e=L.w(B.$u?Date.UTC(B.$y,fe,pe):new Date(B.$y,fe,pe),B);return G?_e:_e.endOf(l)},D=function(pe,fe){return L.w(B.toDate()[pe].apply(B.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(fe)),B)},P=this.$W,w=this.$M,W=this.$D,z="set"+(this.$u?"UTC":"");switch(H){case d:return G?C(1,0):C(31,11);case f:return G?C(1,w):C(0,w+1);case u:var ne=this.$locale().weekStart||0,ee=(P<ne?P+7:P)-ne;return C(G?W-ee:W+(6-ee),w);case l:case p:return D(z+"Hours",0);case c:return D(z+"Minutes",1);case a:return D(z+"Seconds",2);case o:return D(z+"Milliseconds",3);default:return this.clone()}},F.endOf=function(O){return this.startOf(O,!1)},F.$set=function(O,K){var B,G=L.p(O),H="set"+(this.$u?"UTC":""),C=(B={},B[l]=H+"Date",B[p]=H+"Date",B[f]=H+"Month",B[d]=H+"FullYear",B[c]=H+"Hours",B[a]=H+"Minutes",B[o]=H+"Seconds",B[r]=H+"Milliseconds",B)[G],D=G===l?this.$D+(K-this.$W):K;if(G===f||G===d){var P=this.clone().set(p,1);P.$d[C](D),P.init(),this.$d=P.set(p,Math.min(this.$D,P.daysInMonth())).$d}else C&&this.$d[C](D);return this.init(),this},F.set=function(O,K){return this.clone().$set(O,K)},F.get=function(O){return this[L.p(O)]()},F.add=function(O,K){var B,G=this;O=Number(O);var H=L.p(K),C=function(w){var W=b(G);return L.w(W.date(W.date()+Math.round(w*O)),G)};if(H===f)return this.set(f,this.$M+O);if(H===d)return this.set(d,this.$y+O);if(H===l)return C(1);if(H===u)return C(7);var D=(B={},B[a]=s,B[c]=n,B[o]=t,B)[H]||1,P=this.$d.getTime()+O*D;return L.w(P,this)},F.subtract=function(O,K){return this.add(-1*O,K)},F.format=function(O){var K=this,B=this.$locale();if(!this.isValid())return B.invalidDate||m;var G=O||"YYYY-MM-DDTHH:mm:ssZ",H=L.z(this),C=this.$H,D=this.$m,P=this.$M,w=B.weekdays,W=B.months,z=B.meridiem,ne=function(fe,_e,ot,Ie){return fe&&(fe[_e]||fe(K,G))||ot[_e].slice(0,Ie)},ee=function(fe){return L.s(C%12||12,fe,"0")},pe=z||function(fe,_e,ot){var Ie=fe<12?"AM":"PM";return ot?Ie.toLowerCase():Ie};return G.replace(y,function(fe,_e){return _e||function(ot){switch(ot){case"YY":return String(K.$y).slice(-2);case"YYYY":return L.s(K.$y,4,"0");case"M":return P+1;case"MM":return L.s(P+1,2,"0");case"MMM":return ne(B.monthsShort,P,W,3);case"MMMM":return ne(W,P);case"D":return K.$D;case"DD":return L.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return ne(B.weekdaysMin,K.$W,w,2);case"ddd":return ne(B.weekdaysShort,K.$W,w,3);case"dddd":return w[K.$W];case"H":return String(C);case"HH":return L.s(C,2,"0");case"h":return ee(1);case"hh":return ee(2);case"a":return pe(C,D,!0);case"A":return pe(C,D,!1);case"m":return String(D);case"mm":return L.s(D,2,"0");case"s":return String(K.$s);case"ss":return L.s(K.$s,2,"0");case"SSS":return L.s(K.$ms,3,"0");case"Z":return H}return null}(fe)||H.replace(":","")})},F.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},F.diff=function(O,K,B){var G,H=this,C=L.p(K),D=b(O),P=(D.utcOffset()-this.utcOffset())*s,w=this-D,W=function(){return L.m(H,D)};switch(C){case d:G=W()/12;break;case f:G=W();break;case h:G=W()/3;break;case u:G=(w-P)/6048e5;break;case l:G=(w-P)/864e5;break;case c:G=w/n;break;case a:G=w/s;break;case o:G=w/t;break;default:G=w}return B?G:L.a(G)},F.daysInMonth=function(){return this.endOf(f).$D},F.$locale=function(){return T[this.$L]},F.locale=function(O,K){if(!O)return this.$L;var B=this.clone(),G=R(O,K,!0);return G&&(B.$L=G),B},F.clone=function(){return L.w(this.$d,this)},F.toDate=function(){return new Date(this.valueOf())},F.toJSON=function(){return this.isValid()?this.toISOString():null},F.toISOString=function(){return this.$d.toISOString()},F.toString=function(){return this.$d.toUTCString()},N}(),M=k.prototype;return b.prototype=M,[["$ms",r],["$s",o],["$m",a],["$H",c],["$W",l],["$M",f],["$y",d],["$D",p]].forEach(function(N){M[N[1]]=function(F){return this.$g(F,N[0],N[1])}}),b.extend=function(N,F){return N.$i||(N(F,k,b),N.$i=!0),b},b.locale=R,b.isDayjs=I,b.unix=function(N){return b(1e3*N)},b.en=T[S],b.Ls=T,b.p={},b})})(Bm);var nI=Bm.exports;const rI=K1(nI);exports.CryptoJS=t7;exports.Hls=as;exports._export_sfc=Wm;exports.createSSRApp=f3;exports.createStore=T4;exports.dayjs=rI;exports.e=r3;exports.f=i3;exports.index=X;exports.n=o3;exports.nextTick$1=lc;exports.o=s3;exports.p=l3;exports.resolveComponent=mv;exports.s=n3;exports.sr=c3;exports.t=a3;exports.tr=iI;exports.useStore=f4;exports.uviewPlus=BS;
|