123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- "use strict";const Np=(s,e)=>{const t=s.__vccOpts||s;for(const[n,i]of e)t[n]=i;return t};/**
- * @vue/shared v3.4.21
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
- * @license MIT
- **/function sn(s,e){const t=new Set(s.split(","));return e?n=>t.has(n.toLowerCase()):n=>t.has(n)}const Se=Object.freeze({}),Fl=Object.freeze([]),we=()=>{},Up=()=>!1,Sf=s=>s.charCodeAt(0)===111&&s.charCodeAt(1)===110&&(s.charCodeAt(2)>122||s.charCodeAt(2)<97),Bl=s=>s.startsWith("onUpdate:"),le=Object.assign,ar=(s,e)=>{const t=s.indexOf(e);t>-1&&s.splice(t,1)},$p=Object.prototype.hasOwnProperty,Y=(s,e)=>$p.call(s,e),z=Array.isArray,fs=s=>pt(s)==="[object Map]",xf=s=>pt(s)==="[object Set]",K=s=>typeof s=="function",ge=s=>typeof s=="string",nn=s=>typeof s=="symbol",ue=s=>s!==null&&typeof s=="object",qn=s=>(ue(s)||K(s))&&K(s.then)&&K(s.catch),Ef=Object.prototype.toString,pt=s=>Ef.call(s),lr=s=>pt(s).slice(8,-1),Re=s=>pt(s)==="[object Object]",xa=s=>ge(s)&&s!=="NaN"&&s[0]!=="-"&&""+parseInt(s,10)===s,Tf=sn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Gp=sn("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),cr=s=>{const e=Object.create(null);return t=>e[t]||(e[t]=s(t))},Hp=/-(\w)/g,St=cr(s=>s.replace(Hp,(e,t)=>t?t.toUpperCase():"")),jp=/\B([A-Z])/g,ys=cr(s=>s.replace(jp,"-$1").toLowerCase()),Ss=cr(s=>s.charAt(0).toUpperCase()+s.slice(1)),ss=cr(s=>s?`on${Ss(s)}`:""),Wt=(s,e)=>!Object.is(s,e),vi=(s,e)=>{for(let t=0;t<s.length;t++)s[t](e)},Kp=(s,e,t)=>{Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value:t})},Vp=s=>{const e=parseFloat(s);return isNaN(e)?s:e};function vf(s){if(z(s)){const e={};for(let t=0;t<s.length;t++){const n=s[t],i=ge(n)?zp(n):vf(n);if(i)for(const r in i)e[r]=i[r]}return e}else if(ge(s)||ue(s))return s}const qp=/;(?![^(]*\))/g,Wp=/:([^]+)/,Qp=/\/\*[^]*?\*\//g;function zp(s){const e={};return s.replace(Qp,"").split(qp).forEach(t=>{if(t){const n=t.split(Wp);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function Af(s){let e="";if(ge(s))e=s;else if(z(s))for(let t=0;t<s.length;t++){const n=Af(s[t]);n&&(e+=n+" ")}else if(ue(s))for(const t in s)s[t]&&(e+=t+" ");return e.trim()}const Yp=s=>ge(s)?s:s==null?"":z(s)||ue(s)&&(s.toString===Ef||!K(s.toString))?JSON.stringify(s,bf,2):String(s),bf=(s,e)=>e&&e.__v_isRef?bf(s,e.value):fs(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[n,i],r)=>(t[wr(n,r)+" =>"]=i,t),{})}:xf(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>wr(t))}:nn(e)?wr(e):ue(e)&&!z(e)&&!Re(e)?String(e):e,wr=(s,e="")=>{var t;return nn(s)?`Symbol(${(t=s.description)!=null?t:e})`:s},Xp="d",ur="onShow",fr="onHide",If="onLaunch",xs="onError",_f="onThemeChange",wf="onPageNotFound",Rf="onUnhandledRejection",Jp="onExit",Wn="onLoad",Ea="onReady",Ta="onUnload",Lf="onInit",Cf="onSaveExitState",Pf="onResize",Df="onBackPress",kf="onPageScroll",va="onTabItemTap",Aa="onReachBottom",ba="onPullDownRefresh",Of="onShareTimeline",Ff="onShareChat",Ia="onAddToFavorites",Bf="onShareAppMessage",Mf="onNavigationBarButtonTap",Nf="onNavigationBarSearchInputClicked",Uf="onNavigationBarSearchInputChanged",$f="onNavigationBarSearchInputConfirmed",Gf="onNavigationBarSearchInputFocusChanged",Zp="virtualHostStyle",eg="virtualHostClass",tg="virtualHostHidden",yo="virtualHostId";function sg(s){return s.indexOf("/")===0}function ng(s){return sg(s)?s:"/"+s}const ig=(s,e)=>{let t;for(let n=0;n<s.length;n++)t=s[n](e);return t};function Hf(s,e=null){let t;return(...n)=>(s&&(t=s.apply(e,n),s=null),t)}function jf(s,e){if(!ge(e))return;e=e.replace(/\[(\d+)\]/g,".$1");const t=e.split(".");let n=t[0];return s||(s={}),t.length===1?s[n]:jf(s[n],t.slice(1).join("."))}function Kf(s){let e={};return Re(s)&&Object.keys(s).sort().forEach(t=>{const n=t;e[n]=s[n]}),Object.keys(e)?e:s}const rg=/:/g;function og(s){return St(s.replace(rg,"-"))}const ag=encodeURIComponent;function lg(s,e=ag){const t=s?Object.keys(s).map(n=>{let i=s[n];return typeof i===void 0||i===null?i="":Re(i)&&(i=JSON.stringify(i)),e(n)+"="+e(i)}).filter(n=>n.length>0).join("&"):null;return t?`?${t}`:""}const cg=[Lf,Wn,ur,fr,Ta,Df,kf,va,Aa,ba,Of,Bf,Ff,Ia,Cf,Mf,Nf,Uf,$f,Gf];function ug(s){return cg.indexOf(s)>-1}const Vf=[ur,fr,If,xs,_f,wf,Rf,Jp,Lf,Wn,Ea,Ta,Pf,Df,kf,va,Aa,ba,Of,Ia,Bf,Ff,Cf,Mf,Nf,Uf,$f,Gf],So={onPageScroll:1,onShareAppMessage:2,onShareTimeline:4};function qf(s,e,t=!0){return t&&!K(e)?!1:Vf.indexOf(s)>-1?!0:s.indexOf("on")===0}let xo;const Wf=[];function fg(s){if(xo)return s(xo);Wf.push(s)}function hg(s){xo=s,Wf.forEach(e=>e(s))}const dg=Hf((s,e)=>e(s)),Qf=function(){};Qf.prototype={_id:1,on:function(s,e,t){var n=this.e||(this.e={});return(n[s]||(n[s]=[])).push({fn:e,ctx:t,_id:this._id}),this._id++},once:function(s,e,t){var n=this;function i(){n.off(s,i),e.apply(t,arguments)}return i._=e,this.on(s,i,t)},emit:function(s){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[s]||[]).slice(),n=0,i=t.length;for(n;n<i;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(s,e){var t=this.e||(this.e={}),n=t[s],i=[];if(n&&e){for(var r=n.length-1;r>=0;r--)if(n[r].fn===e||n[r].fn._===e||n[r]._id===e){n.splice(r,1);break}i=n}return i.length?t[s]=i:delete t[s],this}};var pg=Qf;const Rr="zh-Hans",Ml="zh-Hant",_n="en",gg="fr",mg="es";function yg(s,e){return!!e.find(t=>s.indexOf(t)!==-1)}function Sg(s,e){return e.find(t=>s.indexOf(t)===0)}function zf(s,e){if(!s)return;if(s=s.trim().replace(/_/g,"-"),e&&e[s])return s;if(s=s.toLowerCase(),s==="chinese")return Rr;if(s.indexOf("zh")===0)return s.indexOf("-hans")>-1?Rr:s.indexOf("-hant")>-1||yg(s,["-tw","-hk","-mo","-cht"])?Ml:Rr;let t=[_n,gg,mg];e&&Object.keys(e).length>0&&(t=Object.keys(e));const n=Sg(s,t);if(n)return n}function xg(){var s;let e="";{const t=((s=wx.getAppBaseInfo)===null||s===void 0?void 0:s.call(wx))||wx.getSystemInfoSync(),n=t&&t.language?t.language:_n;e=zf(n)||_n}return e}function Eg(s,e){console.warn(`${s}: ${e}`)}function Nl(s,e,t,n){n||(n=Eg);for(const i in t){const r=vg(i,e[i],t[i],!Y(e,i));ge(r)&&n(s,r)}}function Tg(s,e,t,n){if(!t)return;if(!z(t))return Nl(s,e[0]||Object.create(null),t,n);const i=t.length,r=e.length;for(let o=0;o<i;o++){const a=t[o],l=Object.create(null);r>o&&(l[a.name]=e[o]),Nl(s,l,{[a.name]:a},n)}}function vg(s,e,t,n){Re(t)||(t={type:t});const{type:i,required:r,validator:o}=t;if(r&&n)return'Missing required args: "'+s+'"';if(!(e==null&&!r)){if(i!=null){let a=!1;const l=z(i)?i:[i],c=[];for(let u=0;u<l.length&&!a;u++){const{valid:f,expectedType:h}=bg(e,l[u]);c.push(h||""),a=f}if(!a)return Ig(s,e,c)}if(o)return o(e)}}const Ag=sn("String,Number,Boolean,Function,Symbol");function bg(s,e){let t;const n=_g(e);if(Ag(n)){const i=typeof s;t=i===n.toLowerCase(),!t&&i==="object"&&(t=s instanceof e)}else n==="Object"?t=ue(s):n==="Array"?t=z(s):t=s instanceof e;return{valid:t,expectedType:n}}function Ig(s,e,t){let n=`Invalid args: type check failed for args "${s}". Expected ${t.map(Ss).join(", ")}`;const i=t[0],r=lr(e),o=Ul(e,i),a=Ul(e,r);return t.length===1&&$l(i)&&!wg(i,r)&&(n+=` with value ${o}`),n+=`, got ${r} `,$l(r)&&(n+=`with value ${a}.`),n}function _g(s){const e=s&&s.toString().match(/^\s*function (\w+)/);return e?e[1]:""}function Ul(s,e){return e==="String"?`"${s}"`:e==="Number"?`${Number(s)}`:`${s}`}function $l(s){return["string","number","boolean"].some(t=>s.toLowerCase()===t)}function wg(...s){return s.some(e=>e.toLowerCase()==="boolean")}function Rg(s){return function(){try{return s.apply(s,arguments)}catch(e){console.error(e)}}}let Lg=1;const Eo={};function Cg(s,e,t,n=!1){return Eo[s]={name:e,keepAlive:n,callback:t},s}function Yf(s,e,t){if(typeof s=="number"){const n=Eo[s];if(n)return n.keepAlive||delete Eo[s],n.callback(e,t)}return e}const Pg="success",Dg="fail",kg="complete";function Og(s){const e={};for(const t in s){const n=s[t];K(n)&&(e[t]=Rg(n),delete s[t])}return e}function Fg(s,e){return!s||s.indexOf(":fail")===-1?e+":ok":e+s.substring(s.indexOf(":fail"))}function Bg(s,e={},{beforeAll:t,beforeSuccess:n}={}){Re(e)||(e={});const{success:i,fail:r,complete:o}=Og(e),a=K(i),l=K(r),c=K(o),u=Lg++;return Cg(u,s,f=>{f=f||{},f.errMsg=Fg(f.errMsg,s),K(t)&&t(f),f.errMsg===s+":ok"?(K(n)&&n(f,e),a&&i(f)):l&&r(f),c&&o(f)}),u}const Mg="success",Ng="fail",Ug="complete",qs={},Ws={};function $g(s,e){return function(t){return s(t,e)||t}}function Xf(s,e,t){let n=!1;for(let i=0;i<s.length;i++){const r=s[i];if(n)n=Promise.resolve($g(r,t));else{const o=r(e,t);if(qn(o)&&(n=Promise.resolve(o)),o===!1)return{then(){},catch(){}}}}return n||{then(i){return i(e)},catch(){}}}function Gl(s,e={}){return[Mg,Ng,Ug].forEach(t=>{const n=s[t];if(!z(n))return;const i=e[t];e[t]=function(o){Xf(n,o,e).then(a=>K(i)&&i(a)||a)}}),e}function Di(s,e){const t=[];z(qs.returnValue)&&t.push(...qs.returnValue);const n=Ws[s];return n&&z(n.returnValue)&&t.push(...n.returnValue),t.forEach(i=>{e=i(e)||e}),e}function Hl(s){const e=Object.create(null);Object.keys(qs).forEach(n=>{n!=="returnValue"&&(e[n]=qs[n].slice())});const t=Ws[s];return t&&Object.keys(t).forEach(n=>{n!=="returnValue"&&(e[n]=(e[n]||[]).concat(t[n]))}),e}function ki(s,e,t,n){const i=Hl(s);return i&&Object.keys(i).length?z(i.invoke)?Xf(i.invoke,t).then(o=>e(Gl(Hl(s),o),...n)):e(Gl(i,t),...n):e(t,...n)}function Gg(s){return!!(Re(s)&&[Pg,Dg,kg].find(e=>K(s[e])))}function Hg(s,e){return(t={},...n)=>Gg(t)?Di(s,ki(s,e,le({},t),n)):Di(s,new Promise((i,r)=>{ki(s,e,le({},t,{success:i,fail:r}),n)}))}function jg(s,e){s[0]}function Kg(s,e,t){const n={errMsg:e+":ok"};return Yf(s,le(t||{},n))}function jl(s,e,t,n={}){const i=e+":fail";let r="";t?t.indexOf(i)===0?r=t:r=i+" "+t:r=i,delete n.errCode;let o=le({errMsg:r},n);return Yf(s,o)}function Jf(s,e,t,n){Tg(s,e,t);const i=jg(e);if(i)return i}function Vg(s){return!s||ge(s)?s:s.stack?((typeof globalThis>"u"||!globalThis.harmonyChannel)&&console.error(s.message+`
- `+s.stack),s.message):s}function qg(s,e,t,n){return i=>{const r=Bg(s,i,n),o=Jf(s,[i],t);return o?jl(r,s,o):e(i,{resolve:a=>Kg(r,s,a),reject:(a,l)=>jl(r,s,Vg(a),l)})}}function Wg(s,e,t,n){return(...i)=>{const r=Jf(s,i,t);if(r)throw new Error(r);return e.apply(null,i)}}function Qg(s,e,t,n){return qg(s,e,t,n)}function vs(s,e,t,n){return Wg(s,e,t)}function zg(s,e,t,n){return Hg(s,Qg(s,e,t,n))}const Yg="upx2px",Xg=[{name:"upx",type:[Number,String],required:!0}],Jg=1e-4,Zg=750;let Zf=!1,To=0,eh=0;function em(){var s,e;let t,n,i;{const r=((s=wx.getWindowInfo)===null||s===void 0?void 0:s.call(wx))||wx.getSystemInfoSync(),o=((e=wx.getDeviceInfo)===null||e===void 0?void 0:e.call(wx))||wx.getSystemInfoSync();t=r.windowWidth,n=r.pixelRatio,i=o.platform}To=t,eh=n,Zf=i==="ios"}const Kl=vs(Yg,(s,e)=>{if(To===0&&em(),s=Number(s),s===0)return 0;let t=e||To,n=s/Zg*t;return n<0&&(n=-n),n=Math.floor(n+Jg),n===0&&(eh===1||!Zf?n=1:n=.5),s<0?-n:n},Xg);function tm(s,e,...t){e&&t.push(e),console[s].apply(console,t)}const sm="addInterceptor",nm="removeInterceptor",th=[{name:"method",type:[String,Object],required:!0}],im=th;function Vl(s,e){Object.keys(e).forEach(t=>{K(e[t])&&(s[t]=rm(s[t],e[t]))})}function ql(s,e){!s||!e||Object.keys(e).forEach(t=>{const n=s[t],i=e[t];z(n)&&K(i)&&ar(n,i)})}function rm(s,e){const t=e?s?s.concat(e):z(e)?e:[e]:s;return t&&om(t)}function om(s){const e=[];for(let t=0;t<s.length;t++)e.indexOf(s[t])===-1&&e.push(s[t]);return e}const am=vs(sm,(s,e)=>{ge(s)&&Re(e)?Vl(Ws[s]||(Ws[s]={}),e):Re(s)&&Vl(qs,s)},th),lm=vs(nm,(s,e)=>{ge(s)?Re(e)?ql(Ws[s],e):delete Ws[s]:Re(s)&&ql(qs,s)},im),cm={},um="$on",sh=[{name:"event",type:String,required:!0},{name:"callback",type:Function,required:!0}],fm="$once",hm=sh,dm="$off",pm=[{name:"event",type:[String,Array]},{name:"callback",type:[Function,Number]}],gm="$emit",mm=[{name:"event",type:String,required:!0}];class ym{constructor(){this.$emitter=new pg}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 Qs=new ym,Sm=vs(um,(s,e)=>(Qs.on(s,e),()=>Qs.off(s,e)),sh),xm=vs(fm,(s,e)=>(Qs.once(s,e),()=>Qs.off(s,e)),hm),Em=vs(dm,(s,e)=>{z(s)||(s=s?[s]:[]),s.forEach(t=>{Qs.off(t,e)})},pm),Tm=vs(gm,(s,...e)=>{Qs.emit(s,...e)},mm);let Sn,vo,Ao;function Wl(s){try{return JSON.parse(s)}catch{}return s}function vm(s){if(s.type==="enabled")Ao=!0;else if(s.type==="clientId")Sn=s.cid,vo=s.errMsg,nh(Sn,s.errMsg);else if(s.type==="pushMsg"){const e={type:"receive",data:Wl(s.message)};for(let t=0;t<Ht.length;t++){const n=Ht[t];if(n(e),e.stopped)break}}else s.type==="click"&&Ht.forEach(e=>{e({type:"click",data:Wl(s.message)})})}const bo=[];function nh(s,e){bo.forEach(t=>{t(s,e)}),bo.length=0}const Am="getPushClientId",bm=zg(Am,(s,{resolve:e,reject:t})=>{Promise.resolve().then(()=>{typeof Ao>"u"&&(Ao=!1,Sn="",vo="uniPush is not enabled"),bo.push((n,i)=>{n?e({cid:n}):t(i)}),typeof Sn<"u"&&nh(Sn,vo)})}),Ht=[],Im=s=>{Ht.indexOf(s)===-1&&Ht.push(s)},_m=s=>{if(!s)Ht.length=0;else{const e=Ht.indexOf(s);e>-1&&Ht.splice(e,1)}},wm=/^\$|__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/,Rm=/^create|Manager$/,Lm=["createBLEConnection"],Cm=["request","downloadFile","uploadFile","connectSocket"],Pm=["createBLEConnection"],Dm=/^on|^off/;function Ai(s){return Rm.test(s)&&Lm.indexOf(s)===-1}function ih(s){return wm.test(s)&&Pm.indexOf(s)===-1}function km(s){return Dm.test(s)&&s!=="onPush"}function Ql(s){return Cm.indexOf(s)!==-1}function Om(s){return!(Ai(s)||ih(s)||km(s))}Promise.prototype.finally||(Promise.prototype.finally=function(s){const e=this.constructor;return this.then(t=>e.resolve(s&&s()).then(()=>t),t=>e.resolve(s&&s()).then(()=>{throw t}))});function Lr(s,e){return!Om(s)||!K(e)?e:function(n={},...i){return K(n.success)||K(n.fail)||K(n.complete)?Di(s,ki(s,e,le({},n),i)):Di(s,new Promise((r,o)=>{ki(s,e,le({},n,{success:r,fail:o}),i)}))}}const Fm=["success","fail","cancel","complete"];function Bm(s){function e(i,r,o){return function(a){return r(n(i,a,o))}}function t(i,r,o={},a={},l=!1){if(Re(r)){const c=l===!0?r:{};K(o)&&(o=o(r,c)||{});for(const u in r)if(Y(o,u)){let f=o[u];K(f)&&(f=f(r[u],r,c)),f?ge(f)?c[f]=r[u]:Re(f)&&(c[f.name?f.name:u]=f.value):console.warn(`微信小程序 ${i} 暂不支持 ${u}`)}else if(Fm.indexOf(u)!==-1){const f=r[u];K(f)&&(c[u]=e(i,f,a))}else!l&&!Y(c,u)&&(c[u]=r[u]);return c}else K(r)&&(K(o)&&o(r,{}),r=e(i,r,a));return r}function n(i,r,o,a=!1){return K(s.returnValue)&&(r=s.returnValue(i,r)),t(i,r,o,{},a||!1)}return function(r,o){const a=Y(s,r);if(!a&&typeof wx[r]!="function")return o;const l=a||K(s.returnValue)||Ai(r)||Ql(r),c=a||K(o);if(!a&&!o)return function(){console.error(`微信小程序 暂不支持${r}`)};if(!l||!c)return o;const u=s[r];return function(f,h){let d=u||{};K(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(Ai(r)||Ql(r))&&m&&!m.__v_skip&&(m.__v_skip=!0),ih(r)?n(r,m,d.returnValue,Ai(r)):m}}}const Oi=()=>{const s=K(getApp)&&getApp({allowDefault:!0});return s&&s.$vm?s.$vm.$locale:xg()},Mm=s=>{const e=K(getApp)&&getApp();return e&&e.$vm.$locale!==s?(e.$vm.$locale=s,Io.forEach(n=>n({locale:s})),!0):!1},Io=[],Nm=s=>{Io.indexOf(s)===-1&&Io.push(s)};typeof global<"u"&&(global.getLocale=Oi);const zl="__DC_STAT_UUID";let Cs;function rh(s=wx){return function(t,n){Cs=Cs||s.getStorageSync(zl),Cs||(Cs=Date.now()+""+Math.floor(Math.random()*1e7),wx.setStorage({key:zl,data:Cs})),n.deviceId=Cs}}function oh(s,e){if(s.safeArea){const t=s.safeArea;e.safeAreaInsets={top:t.top,left:t.left,right:s.windowWidth-t.right,bottom:s.screenHeight-t.bottom}}}function ah(s,e){let t="",n="";switch(t=s.split(" ")[0]||e,n=s.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:n}}function Um(s,e){const{brand:t="",model:n="",system:i="",language:r="",theme:o,version:a,platform:l,fontSizeSetting:c,SDKVersion:u,pixelRatio:f,deviceOrientation:h}=s,{osName:d,osVersion:p}=ah(i,l);let m=a,g=lh(s,n),y=ch(t),E=fh(s),x=h,T=f,v=u;const A=(r||"").replace(/_/g,"-"),b={appId:"__UNI__90F7D71",appName:"签约",appVersion:"1.0.0",appVersionCode:100,appLanguage:uh(A),uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75",uniPlatform:"mp-weixin",deviceBrand:y,deviceModel:n,deviceType:g,devicePixelRatio:T,deviceOrientation:x,osName:d,osVersion:p,hostTheme:o,hostVersion:m,hostLanguage:A,hostName:E,hostSDKVersion:v,hostFontSizeSetting:c,windowTop:0,windowBottom:0,osLanguage:void 0,osTheme:void 0,ua:void 0,hostPackageName:void 0,browserName:void 0,browserVersion:void 0,isUniAppX:!1};le(e,b)}function lh(s,e){let t=s.deviceType||"phone";{const n={ipad:"pad",windows:"pc",mac:"pc"},i=Object.keys(n),r=e.toLowerCase();for(let o=0;o<i.length;o++){const a=i[o];if(r.indexOf(a)!==-1){t=n[a];break}}}return t}function ch(s){let e=s;return e&&(e=e.toLowerCase()),e}function uh(s){return Oi?Oi():s}function fh(s){let t=s.hostName||"WeChat";return s.environment?t=s.environment:s.host&&s.host.env&&(t=s.host.env),t}const hh={returnValue:(s,e)=>{oh(s,e),rh()(s,e),Um(s,e)}},$m=hh,Gm={},Hm={args(s,e){let t=parseInt(s.current);if(isNaN(t))return;const n=s.urls;if(!z(n))return;const i=n.length;if(i)return t<0?t=0:t>=i&&(t=i-1),t>0?(e.current=n[t],e.urls=n.filter((r,o)=>o<t?r!==n[t]:!0)):e.current=n[0],{indicator:!1,loop:!1}}},jm={args(s,e){e.alertText=s.title}},Km={returnValue:(s,e)=>{const{brand:t,model:n,system:i="",platform:r=""}=s;let o=lh(s,n),a=ch(t);rh()(s,e);const{osName:l,osVersion:c}=ah(i,r);e=Kf(le(e,{deviceType:o,deviceBrand:a,deviceModel:n,osName:l,osVersion:c}))}},Vm={returnValue:(s,e)=>{const{version:t,language:n,SDKVersion:i,theme:r}=s;let o=fh(s),a=(n||"").replace(/_/g,"-");const l={hostVersion:t,hostLanguage:a,hostName:o,hostSDKVersion:i,hostTheme:r,appId:"__UNI__90F7D71",appName:"签约",appVersion:"1.0.0",appVersionCode:100,appLanguage:uh(a),isUniAppX:!1,uniPlatform:"mp-weixin",uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75"};le(e,l)}},qm={returnValue:(s,e)=>{oh(s,e),e=Kf(le(e,{windowTop:0,windowBottom:0}))}},Wm={returnValue:function(s,e){const{locationReducedAccuracy:t}=s;e.locationAccuracy="unsupported",t===!0?e.locationAccuracy="reduced":t===!1&&(e.locationAccuracy="full")}},Qm={args(s){const e=getApp({allowDefault:!0})||{};e.$vm?Is(xs,s,e.$vm.$):(wx.$onErrorHandlers||(wx.$onErrorHandlers=[]),wx.$onErrorHandlers.push(s))}},zm={args(s){const e=getApp({allowDefault:!0})||{};if(e.$vm){if(s.__weh){const t=e.$vm.$[xs];if(t){const n=t.indexOf(s.__weh);n>-1&&t.splice(n,1)}}}else{if(!wx.$onErrorHandlers)return;const t=wx.$onErrorHandlers.findIndex(n=>n===s);t!==-1&&wx.$onErrorHandlers.splice(t,1)}}},dh={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)")}}},Ym=dh,Yl={$on:Sm,$off:Em,$once:xm,$emit:Tm,upx2px:Kl,rpx2px:Kl,interceptors:cm,addInterceptor:am,removeInterceptor:lm,onCreateVueApp:fg,invokeCreateVueAppHook:hg,getLocale:Oi,setLocale:Mm,onLocaleChange:Nm,getPushClientId:bm,onPushMessage:Im,offPushMessage:_m,invokePushCallback:vm,__f__:tm};function Xm(s,e,t=wx){const n=Bm(e),i={get(r,o){return Y(r,o)?r[o]:Y(s,o)?Lr(o,s[o]):Y(Yl,o)?Lr(o,Yl[o]):Lr(o,n(o,t[o]))}};return new Proxy({},i)}function Jm(s){return function({service:t,success:n,fail:i,complete:r}){let o;s[t]?(o={errMsg:"getProvider:ok",service:t,provider:s[t]},K(n)&&n(o)):(o={errMsg:"getProvider:fail:服务["+t+"]不存在"},K(i)&&i(o)),K(r)&&r(o)}}const Zm=["qy","env","error","version","lanDebug","cloud","serviceMarket","router","worklet","__webpack_require_UNI_MP_PLUGIN__"],e1=["lanDebug","router","worklet"],Xl=wx.getLaunchOptionsSync?wx.getLaunchOptionsSync():null;function t1(s){return Xl&&Xl.scene===1154&&e1.includes(s)?!1:Zm.indexOf(s)>-1||typeof wx[s]=="function"}function ph(){const s={};for(const e in wx)t1(e)&&(s[e]=wx[e]);return typeof globalThis<"u"&&typeof requireMiniProgram>"u"&&(globalThis.wx=s),s}const s1=["__route__","__wxExparserNodeId__","__wxWebviewId__"],n1=Jm({oauth:["weixin"],share:["weixin"],payment:["wxpay"],push:["weixin"]});function i1(s){const e=Object.create(null);return s1.forEach(t=>{e[t]=s[t]}),e}function r1(){const s=Ne.createSelectorQuery(),e=s.in;return s.in=function(n){return n.$scope?e.call(this,n.$scope):e.call(this,i1(n))},s}const Ne=ph();Ne.canIUse("getAppBaseInfo")||(Ne.getAppBaseInfo=Ne.getSystemInfoSync);Ne.canIUse("getWindowInfo")||(Ne.getWindowInfo=Ne.getSystemInfoSync);Ne.canIUse("getDeviceInfo")||(Ne.getDeviceInfo=Ne.getSystemInfoSync);let Fi=Ne.getAppBaseInfo&&Ne.getAppBaseInfo();Fi||(Fi=Ne.getSystemInfoSync());const Jl=Fi?Fi.host:null,o1=Jl&&Jl.env==="SAAASDK"?Ne.miniapp.shareVideoMessage:Ne.shareVideoMessage;var a1=Object.freeze({__proto__:null,createSelectorQuery:r1,getProvider:n1,shareVideoMessage:o1});const l1={args(s,e){s.compressedHeight&&!e.compressHeight&&(e.compressHeight=s.compressedHeight),s.compressedWidth&&!e.compressWidth&&(e.compressWidth=s.compressedWidth)}};var c1=Object.freeze({__proto__:null,compressImage:l1,getAppAuthorizeSetting:Wm,getAppBaseInfo:Vm,getDeviceInfo:Km,getSystemInfo:hh,getSystemInfoSync:$m,getWindowInfo:qm,offError:zm,onError:Qm,onSocketMessage:Ym,onSocketOpen:dh,previewImage:Hm,redirectTo:Gm,showActionSheet:jm});const jt=ph();var W=Xm(a1,c1,jt);/**
- * @dcloudio/uni-mp-vue v3.4.21
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
- * @license MIT
- **/function Qt(s,...e){console.warn(`[Vue warn] ${s}`,...e)}let nt;class gh{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=nt,!e&&nt&&(this.index=(nt.scopes||(nt.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=nt;try{return nt=this,e()}finally{nt=t}}else Qt("cannot run an inactive effect scope.")}on(){nt=this}off(){nt=this.parent}stop(e){if(this._active){let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0,this._active=!1}}}function u1(s){return new gh(s)}function f1(s,e=nt){e&&e.active&&e.effects.push(s)}function h1(){return nt}let hs;class _a{constructor(e,t,n,i){this.fn=e,this.trigger=t,this.scheduler=n,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,f1(this,i)}get dirty(){if(this._dirtyLevel===2||this._dirtyLevel===3){this._dirtyLevel=1,As();for(let e=0;e<this._depsLength;e++){const t=this.deps[e];if(t.computed&&(d1(t.computed),this._dirtyLevel>=4))break}this._dirtyLevel===1&&(this._dirtyLevel=0),bs()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=Kt,t=hs;try{return Kt=!0,hs=this,this._runnings++,Zl(this),this.fn()}finally{ec(this),this._runnings--,hs=t,Kt=e}}stop(){var e;this.active&&(Zl(this),ec(this),(e=this.onStop)==null||e.call(this),this.active=!1)}}function d1(s){return s.value}function Zl(s){s._trackId++,s._depsLength=0}function ec(s){if(s.deps.length>s._depsLength){for(let e=s._depsLength;e<s.deps.length;e++)mh(s.deps[e],s);s.deps.length=s._depsLength}}function mh(s,e){const t=s.get(e);t!==void 0&&e._trackId!==t&&(s.delete(e),s.size===0&&s.cleanup())}let Kt=!0,_o=0;const yh=[];function As(){yh.push(Kt),Kt=!1}function bs(){const s=yh.pop();Kt=s===void 0?!0:s}function wa(){_o++}function Ra(){for(_o--;!_o&&wo.length;)wo.shift()()}function Sh(s,e,t){var n;if(e.get(s)!==s._trackId){e.set(s,s._trackId);const i=s.deps[s._depsLength];i!==e?(i&&mh(i,s),s.deps[s._depsLength++]=e):s._depsLength++,(n=s.onTrack)==null||n.call(s,le({effect:s},t))}}const wo=[];function xh(s,e,t){var n;wa();for(const i of s.keys()){let r;i._dirtyLevel<e&&(r??(r=s.get(i)===i._trackId))&&(i._shouldSchedule||(i._shouldSchedule=i._dirtyLevel===0),i._dirtyLevel=e),i._shouldSchedule&&(r??(r=s.get(i)===i._trackId))&&((n=i.onTrigger)==null||n.call(i,le({effect:i},t)),i.trigger(),(!i._runnings||i.allowRecurse)&&i._dirtyLevel!==2&&(i._shouldSchedule=!1,i.scheduler&&wo.push(i.scheduler)))}Ra()}const Eh=(s,e)=>{const t=new Map;return t.cleanup=s,t.computed=e,t},Ro=new WeakMap,ds=Symbol("iterate"),Lo=Symbol("Map key iterate");function Fe(s,e,t){if(Kt&&hs){let n=Ro.get(s);n||Ro.set(s,n=new Map);let i=n.get(t);i||n.set(t,i=Eh(()=>n.delete(t))),Sh(hs,i,{target:s,type:e,key:t})}}function bt(s,e,t,n,i,r){const o=Ro.get(s);if(!o)return;let a=[];if(e==="clear")a=[...o.values()];else if(t==="length"&&z(s)){const l=Number(n);o.forEach((c,u)=>{(u==="length"||!nn(u)&&u>=l)&&a.push(c)})}else switch(t!==void 0&&a.push(o.get(t)),e){case"add":z(s)?xa(t)&&a.push(o.get("length")):(a.push(o.get(ds)),fs(s)&&a.push(o.get(Lo)));break;case"delete":z(s)||(a.push(o.get(ds)),fs(s)&&a.push(o.get(Lo)));break;case"set":fs(s)&&a.push(o.get(ds));break}wa();for(const l of a)l&&xh(l,4,{target:s,type:e,key:t,newValue:n,oldValue:i,oldTarget:r});Ra()}const p1=sn("__proto__,__v_isRef,__isVue"),Th=new Set(Object.getOwnPropertyNames(Symbol).filter(s=>s!=="arguments"&&s!=="caller").map(s=>Symbol[s]).filter(nn)),tc=g1();function g1(){const s={};return["includes","indexOf","lastIndexOf"].forEach(e=>{s[e]=function(...t){const n=ie(this);for(let r=0,o=this.length;r<o;r++)Fe(n,"get",r+"");const i=n[e](...t);return i===-1||i===!1?n[e](...t.map(ie)):i}}),["push","pop","shift","unshift","splice"].forEach(e=>{s[e]=function(...t){As(),wa();const n=ie(this)[e].apply(this,t);return Ra(),bs(),n}}),s}function m1(s){const e=ie(this);return Fe(e,"has",s),e.hasOwnProperty(s)}class vh{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){const i=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return r;if(t==="__v_raw")return n===(i?r?Lh:Rh:r?wh:_h).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){if(o&&Y(tc,t))return Reflect.get(tc,t,n);if(t==="hasOwnProperty")return m1}const a=Reflect.get(e,t,n);return(nn(t)?Th.has(t):p1(t))||(i||Fe(e,"get",t),r)?a:Ue(a)?o&&xa(t)?a:a.value:ue(a)?i?Ch(a):pr(a):a}}class Ah extends vh{constructor(e=!1){super(!1,e)}set(e,t,n,i){let r=e[t];if(!this._isShallow){const l=zs(r);if(!Bi(n)&&!zs(n)&&(r=ie(r),n=ie(n)),!z(e)&&Ue(r)&&!Ue(n))return l?!1:(r.value=n,!0)}const o=z(e)&&xa(t)?Number(t)<e.length:Y(e,t),a=Reflect.set(e,t,n,i);return e===ie(i)&&(o?Wt(n,r)&&bt(e,"set",t,n,r):bt(e,"add",t,n)),a}deleteProperty(e,t){const n=Y(e,t),i=e[t],r=Reflect.deleteProperty(e,t);return r&&n&&bt(e,"delete",t,void 0,i),r}has(e,t){const n=Reflect.has(e,t);return(!nn(t)||!Th.has(t))&&Fe(e,"has",t),n}ownKeys(e){return Fe(e,"iterate",z(e)?"length":ds),Reflect.ownKeys(e)}}class bh extends vh{constructor(e=!1){super(!0,e)}set(e,t){return Qt(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return Qt(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const y1=new Ah,S1=new bh,x1=new Ah(!0),E1=new bh(!0),La=s=>s,hr=s=>Reflect.getPrototypeOf(s);function ti(s,e,t=!1,n=!1){s=s.__v_raw;const i=ie(s),r=ie(e);t||(Wt(e,r)&&Fe(i,"get",e),Fe(i,"get",r));const{has:o}=hr(i),a=n?La:t?Pa:wn;if(o.call(i,e))return a(s.get(e));if(o.call(i,r))return a(s.get(r));s!==i&&s.get(e)}function si(s,e=!1){const t=this.__v_raw,n=ie(t),i=ie(s);return e||(Wt(s,i)&&Fe(n,"has",s),Fe(n,"has",i)),s===i?t.has(s):t.has(s)||t.has(i)}function ni(s,e=!1){return s=s.__v_raw,!e&&Fe(ie(s),"iterate",ds),Reflect.get(s,"size",s)}function sc(s){s=ie(s);const e=ie(this);return hr(e).has.call(e,s)||(e.add(s),bt(e,"add",s,s)),this}function nc(s,e){e=ie(e);const t=ie(this),{has:n,get:i}=hr(t);let r=n.call(t,s);r?Ih(t,n,s):(s=ie(s),r=n.call(t,s));const o=i.call(t,s);return t.set(s,e),r?Wt(e,o)&&bt(t,"set",s,e,o):bt(t,"add",s,e),this}function ic(s){const e=ie(this),{has:t,get:n}=hr(e);let i=t.call(e,s);i?Ih(e,t,s):(s=ie(s),i=t.call(e,s));const r=n?n.call(e,s):void 0,o=e.delete(s);return i&&bt(e,"delete",s,void 0,r),o}function rc(){const s=ie(this),e=s.size!==0,t=fs(s)?new Map(s):new Set(s),n=s.clear();return e&&bt(s,"clear",void 0,void 0,t),n}function ii(s,e){return function(n,i){const r=this,o=r.__v_raw,a=ie(o),l=e?La:s?Pa:wn;return!s&&Fe(a,"iterate",ds),o.forEach((c,u)=>n.call(i,l(c),l(u),r))}}function ri(s,e,t){return function(...n){const i=this.__v_raw,r=ie(i),o=fs(r),a=s==="entries"||s===Symbol.iterator&&o,l=s==="keys"&&o,c=i[s](...n),u=t?La:e?Pa:wn;return!e&&Fe(r,"iterate",l?Lo:ds),{next(){const{value:f,done:h}=c.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function Lt(s){return function(...e){{const t=e[0]?`on key "${e[0]}" `:"";Qt(`${Ss(s)} operation ${t}failed: target is readonly.`,ie(this))}return s==="delete"?!1:s==="clear"?void 0:this}}function T1(){const s={get(r){return ti(this,r)},get size(){return ni(this)},has:si,add:sc,set:nc,delete:ic,clear:rc,forEach:ii(!1,!1)},e={get(r){return ti(this,r,!1,!0)},get size(){return ni(this)},has:si,add:sc,set:nc,delete:ic,clear:rc,forEach:ii(!1,!0)},t={get(r){return ti(this,r,!0)},get size(){return ni(this,!0)},has(r){return si.call(this,r,!0)},add:Lt("add"),set:Lt("set"),delete:Lt("delete"),clear:Lt("clear"),forEach:ii(!0,!1)},n={get(r){return ti(this,r,!0,!0)},get size(){return ni(this,!0)},has(r){return si.call(this,r,!0)},add:Lt("add"),set:Lt("set"),delete:Lt("delete"),clear:Lt("clear"),forEach:ii(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{s[r]=ri(r,!1,!1),t[r]=ri(r,!0,!1),e[r]=ri(r,!1,!0),n[r]=ri(r,!0,!0)}),[s,t,e,n]}const[v1,A1,b1,I1]=T1();function dr(s,e){const t=e?s?I1:b1:s?A1:v1;return(n,i,r)=>i==="__v_isReactive"?!s:i==="__v_isReadonly"?s:i==="__v_raw"?n:Reflect.get(Y(t,i)&&i in n?t:n,i,r)}const _1={get:dr(!1,!1)},w1={get:dr(!1,!0)},R1={get:dr(!0,!1)},L1={get:dr(!0,!0)};function Ih(s,e,t){const n=ie(t);if(n!==t&&e.call(s,n)){const i=lr(s);Qt(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="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 _h=new WeakMap,wh=new WeakMap,Rh=new WeakMap,Lh=new WeakMap;function C1(s){switch(s){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function P1(s){return s.__v_skip||!Object.isExtensible(s)?0:C1(lr(s))}function pr(s){return zs(s)?s:gr(s,!1,y1,_1,_h)}function D1(s){return gr(s,!1,x1,w1,wh)}function Ch(s){return gr(s,!0,S1,R1,Rh)}function Ms(s){return gr(s,!0,E1,L1,Lh)}function gr(s,e,t,n,i){if(!ue(s))return Qt(`value cannot be made reactive: ${String(s)}`),s;if(s.__v_raw&&!(e&&s.__v_isReactive))return s;const r=i.get(s);if(r)return r;const o=P1(s);if(o===0)return s;const a=new Proxy(s,o===2?n:t);return i.set(s,a),a}function Hs(s){return zs(s)?Hs(s.__v_raw):!!(s&&s.__v_isReactive)}function zs(s){return!!(s&&s.__v_isReadonly)}function Bi(s){return!!(s&&s.__v_isShallow)}function k1(s){return Hs(s)||zs(s)}function ie(s){const e=s&&s.__v_raw;return e?ie(e):s}function Ca(s){return Object.isExtensible(s)&&Kp(s,"__v_skip",!0),s}const wn=s=>ue(s)?pr(s):s,Pa=s=>ue(s)?Ch(s):s,O1="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 Ph{constructor(e,t,n,i){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new _a(()=>e(this._value),()=>bi(this,this.effect._dirtyLevel===2?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=n}get value(){const e=ie(this);return(!e._cacheable||e.effect.dirty)&&Wt(e._value,e._value=e.effect.run())&&bi(e,4),Dh(e),e.effect._dirtyLevel>=2&&(this._warnRecursive&&Qt(O1,`
- getter: `,this.getter),bi(e,2)),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function F1(s,e,t=!1){let n,i;const r=K(s);r?(n=s,i=()=>{Qt("Write operation failed: computed value is readonly")}):(n=s.get,i=s.set);const o=new Ph(n,i,r||!i,t);return e&&!t&&(o.effect.onTrack=e.onTrack,o.effect.onTrigger=e.onTrigger),o}function Dh(s){var e;Kt&&hs&&(s=ie(s),Sh(hs,(e=s.dep)!=null?e:s.dep=Eh(()=>s.dep=void 0,s instanceof Ph?s:void 0),{target:s,type:"get",key:"value"}))}function bi(s,e=4,t){s=ie(s);const n=s.dep;n&&xh(n,e,{target:s,type:"set",key:"value",newValue:t})}function Ue(s){return!!(s&&s.__v_isRef===!0)}function B1(s){return M1(s,!1)}function M1(s,e){return Ue(s)?s:new N1(s,e)}class N1{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:ie(e),this._value=t?e:wn(e)}get value(){return Dh(this),this._value}set value(e){const t=this.__v_isShallow||Bi(e)||zs(e);e=t?e:ie(e),Wt(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:wn(e),bi(this,4,e))}}function kh(s){return Ue(s)?s.value:s}const U1={get:(s,e,t)=>kh(Reflect.get(s,e,t)),set:(s,e,t,n)=>{const i=s[e];return Ue(i)&&!Ue(t)?(i.value=t,!0):Reflect.set(s,e,t,n)}};function Oh(s){return Hs(s)?s:new Proxy(s,U1)}const ps=[];function Da(s){ps.push(s)}function ka(){ps.pop()}function Q(s,...e){As();const t=ps.length?ps[ps.length-1].component:null,n=t&&t.appContext.config.warnHandler,i=$1();if(n)It(n,t,11,[s+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,i.map(({vnode:r})=>`at <${xr(t,r.type)}>`).join(`
- `),i]);else{const r=[`[Vue warn]: ${s}`,...e];i.length&&r.push(`
- `,...G1(i)),console.warn(...r)}bs()}function $1(){let s=ps[ps.length-1];if(!s)return[];const e=[];for(;s;){const t=e[0];t&&t.vnode===s?t.recurseCount++:e.push({vnode:s,recurseCount:0});const n=s.component&&s.component.parent;s=n&&n.vnode}return e}function G1(s){const e=[];return s.forEach((t,n)=>{e.push(...n===0?[]:[`
- `],...H1(t))}),e}function H1({vnode:s,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",n=s.component?s.component.parent==null:!1,i=` at <${xr(s.component,s.type,n)}`,r=">"+t;return s.props?[i,...j1(s.props),r]:[i+r]}function j1(s){const e=[],t=Object.keys(s);return t.slice(0,3).forEach(n=>{e.push(...Fh(n,s[n]))}),t.length>3&&e.push(" ..."),e}function Fh(s,e,t){return ge(e)?(e=JSON.stringify(e),t?e:[`${s}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${s}=${e}`]:Ue(e)?(e=Fh(s,ie(e.value),!0),t?e:[`${s}=Ref<`,e,">"]):K(e)?[`${s}=fn${e.name?`<${e.name}>`:""}`]:(e=ie(e),t?e:[`${s}=`,e])}const Oa={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 It(s,e,t,n){try{return n?s(...n):s()}catch(i){mr(i,e,t)}}function zt(s,e,t,n){if(K(s)){const r=It(s,e,t,n);return r&&qn(r)&&r.catch(o=>{mr(o,e,t)}),r}const i=[];for(let r=0;r<s.length;r++)i.push(zt(s[r],e,t,n));return i}function mr(s,e,t,n=!0){const i=e?e.vnode:null;if(e){let r=e.parent;const o=e.proxy,a=Oa[t]||t;for(;r;){const c=r.ec;if(c){for(let u=0;u<c.length;u++)if(c[u](s,o,a)===!1)return}r=r.parent}const l=e.appContext.config.errorHandler;if(l){It(l,null,10,[s,o,a]);return}}Bh(s,t,i,n)}function Bh(s,e,t,n=!0){{const i=Oa[e]||e;t&&Da(t),Q(`Unhandled error${i?` during execution of ${i}`:""}`),t&&ka(),console.error(s)}}let Rn=!1,Co=!1;const _e=[];let ht=0;const js=[];let Tt=null,Ft=0;const Mh=Promise.resolve();let Fa=null;const K1=100;function Ba(s){const e=Fa||Mh;return s?e.then(this?s.bind(this):s):e}function V1(s){let e=ht+1,t=_e.length;for(;e<t;){const n=e+t>>>1,i=_e[n],r=Ln(i);r<s||r===s&&i.pre?e=n+1:t=n}return e}function Mi(s){(!_e.length||!_e.includes(s,Rn&&s.allowRecurse?ht+1:ht))&&(s.id==null?_e.push(s):_e.splice(V1(s.id),0,s),Nh())}function Nh(){!Rn&&!Co&&(Co=!0,Fa=Mh.then(Gh))}function q1(s){return _e.indexOf(s)>-1}function W1(s){const e=_e.indexOf(s);e>ht&&_e.splice(e,1)}function Uh(s){z(s)?js.push(...s):(!Tt||!Tt.includes(s,s.allowRecurse?Ft+1:Ft))&&js.push(s),Nh()}function $h(s,e,t=Rn?ht+1:0){for(e=e||new Map;t<_e.length;t++){const n=_e[t];if(n&&n.pre){if(Ma(e,n))continue;_e.splice(t,1),t--,n()}}}function Q1(s){if(js.length){const e=[...new Set(js)].sort((t,n)=>Ln(t)-Ln(n));if(js.length=0,Tt){Tt.push(...e);return}for(Tt=e,s=s||new Map,Ft=0;Ft<Tt.length;Ft++)Ma(s,Tt[Ft])||Tt[Ft]();Tt=null,Ft=0}}const Ln=s=>s.id==null?1/0:s.id,z1=(s,e)=>{const t=Ln(s)-Ln(e);if(t===0){if(s.pre&&!e.pre)return-1;if(e.pre&&!s.pre)return 1}return t};function Gh(s){Co=!1,Rn=!0,s=s||new Map,_e.sort(z1);const e=t=>Ma(s,t);try{for(ht=0;ht<_e.length;ht++){const t=_e[ht];if(t&&t.active!==!1){if(e(t))continue;It(t,null,14)}}}finally{ht=0,_e.length=0,Q1(s),Rn=!1,Fa=null,(_e.length||js.length)&&Gh(s)}}function Ma(s,e){if(!s.has(e))s.set(e,1);else{const t=s.get(e);if(t>K1){const n=e.ownerInstance,i=n&&Ha(n.type);return mr(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. 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 s.set(e,t+1)}}let dt,dn=[],Po=!1;function yr(s,...e){dt?dt.emit(s,...e):Po||dn.push({event:s,args:e})}function Hh(s,e){var t,n;dt=s,dt?(dt.enabled=!0,dn.forEach(({event:i,args:r})=>dt.emit(i,...r)),dn=[]):typeof window<"u"&&window.HTMLElement&&!((n=(t=window.navigator)==null?void 0:t.userAgent)!=null&&n.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(r=>{Hh(r,e)}),setTimeout(()=>{dt||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Po=!0,dn=[])},3e3)):(Po=!0,dn=[])}function Y1(s,e){yr("app:init",s,e,{Fragment:Gy,Text:Hy,Comment:jy,Static:Ky})}const X1=Na("component:added"),J1=Na("component:updated"),Z1=Na("component:removed"),ey=s=>{dt&&typeof dt.cleanupBuffer=="function"&&!dt.cleanupBuffer(s)&&Z1(s)};/*! #__NO_SIDE_EFFECTS__ */function Na(s){return e=>{yr(s,e.appContext.app,e.uid,e.uid===0?void 0:e.parent?e.parent.uid:0,e)}}const ty=jh("perf:start"),sy=jh("perf:end");function jh(s){return(e,t,n)=>{yr(s,e.appContext.app,e.uid,e,t,n)}}function ny(s,e,t){yr("component:emit",s.appContext.app,s,e,t)}function iy(s,e,...t){if(s.isUnmounted)return;const n=s.vnode.props||Se;{const{emitsOptions:u,propsOptions:[f]}=s;if(u)if(!(e in u))(!f||!(ss(e)in f))&&Q(`Component emitted event "${e}" but it is neither declared in the emits option nor as an "${ss(e)}" prop.`);else{const h=u[e];K(h)&&(h(...t)||Q(`Invalid event arguments: event validation failed for event "${e}".`))}}let i=t;const r=e.startsWith("update:"),o=r&&e.slice(7);if(o&&o in n){const u=`${o==="modelValue"?"model":o}Modifiers`,{number:f,trim:h}=n[u]||Se;h&&(i=t.map(d=>ge(d)?d.trim():d)),f&&(i=t.map(Vp))}ny(s,e,i);{const u=e.toLowerCase();u!==e&&n[ss(u)]&&Q(`Event "${u}" is emitted in component ${xr(s,s.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 "${ys(e)}" instead of "${e}".`)}let a,l=n[a=ss(e)]||n[a=ss(St(e))];!l&&r&&(l=n[a=ss(ys(e))]),l&&zt(l,s,6,i);const c=n[a+"Once"];if(c){if(!s.emitted)s.emitted={};else if(s.emitted[a])return;s.emitted[a]=!0,zt(c,s,6,i)}}function Kh(s,e,t=!1){const n=e.emitsCache,i=n.get(s);if(i!==void 0)return i;const r=s.emits;let o={},a=!1;if(!K(s)){const l=c=>{const u=Kh(c,e,!0);u&&(a=!0,le(o,u))};!t&&e.mixins.length&&e.mixins.forEach(l),s.extends&&l(s.extends),s.mixins&&s.mixins.forEach(l)}return!r&&!a?(ue(s)&&n.set(s,null),null):(z(r)?r.forEach(l=>o[l]=null):le(o,r),ue(s)&&n.set(s,o),o)}function Vh(s,e){return!s||!Sf(e)?!1:(e=e.slice(2).replace(/Once$/,""),Y(s,e[0].toLowerCase()+e.slice(1))||Y(s,ys(e))||Y(s,e))}let Es=null;function oc(s){const e=Es;return Es=s,s&&s.type.__scopeId,e}const Do="components";function ry(s,e){return oy(Do,s,!0,e)||s}function oy(s,e,t=!0,n=!1){const i=Es||ve;if(i){const r=i.type;if(s===Do){const a=Ha(r,!1);if(a&&(a===e||a===St(e)||a===Ss(St(e))))return r}const o=ac(i[s]||r[s],e)||ac(i.appContext[s],e);if(!o&&n)return r;if(t&&!o){const a=s===Do?`
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.`:"";Q(`Failed to resolve ${s.slice(0,-1)}: ${e}${a}`)}return o}else Q(`resolve${Ss(s.slice(0,-1))} can only be used in render() or setup().`)}function ac(s,e){return s&&(s[e]||s[St(e)]||s[Ss(St(e))])}const oi={};function xn(s,e,t){return K(e)||Q("`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."),qh(s,e,t)}function qh(s,e,{immediate:t,deep:n,flush:i,once:r,onTrack:o,onTrigger:a}=Se){if(e&&r){const A=e;e=(...b)=>{A(...b),v()}}n!==void 0&&typeof n=="number"&&Q('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&&Q('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),n!==void 0&&Q('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),r!==void 0&&Q('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const l=A=>{Q("Invalid watch source: ",A,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},c=ve,u=A=>n===!0?A:Ns(A,n===!1?1:void 0);let f,h=!1,d=!1;if(Ue(s)?(f=()=>s.value,h=Bi(s)):Hs(s)?(f=()=>u(s),h=!0):z(s)?(d=!0,h=s.some(A=>Hs(A)||Bi(A)),f=()=>s.map(A=>{if(Ue(A))return A.value;if(Hs(A))return u(A);if(K(A))return It(A,c,2);l(A)})):K(s)?e?f=()=>It(s,c,2):f=()=>(p&&p(),zt(s,c,3,[m])):(f=we,l(s)),e&&n){const A=f;f=()=>Ns(A())}let p,m=A=>{p=x.onStop=()=>{It(A,c,4),p=x.onStop=void 0}},g=d?new Array(s.length).fill(oi):oi;const y=()=>{if(!(!x.active||!x.dirty))if(e){const A=x.run();(n||h||(d?A.some((b,I)=>Wt(b,g[I])):Wt(A,g)))&&(p&&p(),zt(e,c,3,[A,g===oi?void 0:d&&g[0]===oi?[]:g,m]),g=A)}else x.run()};y.allowRecurse=!!e;let E;i==="sync"?E=y:i==="post"?E=()=>yc(y,c&&c.suspense):(y.pre=!0,c&&(y.id=c.uid),E=()=>Mi(y));const x=new _a(f,we,E),T=h1(),v=()=>{x.stop(),T&&ar(T.effects,x)};return x.onTrack=o,x.onTrigger=a,e?t?y():g=x.run():i==="post"?yc(x.run.bind(x),c&&c.suspense):x.run(),v}function ay(s,e,t){const n=this.proxy,i=ge(s)?s.includes(".")?Wh(n,s):()=>n[s]:s.bind(n,n);let r;K(e)?r=e:(r=e.handler,t=e);const o=Qn(this),a=qh(i,r.bind(n),t);return o(),a}function Wh(s,e){const t=e.split(".");return()=>{let n=s;for(let i=0;i<t.length&&n;i++)n=n[t[i]];return n}}function Ns(s,e,t=0,n){if(!ue(s)||s.__v_skip)return s;if(e&&e>0){if(t>=e)return s;t++}if(n=n||new Set,n.has(s))return s;if(n.add(s),Ue(s))Ns(s.value,e,t,n);else if(z(s))for(let i=0;i<s.length;i++)Ns(s[i],e,t,n);else if(xf(s)||fs(s))s.forEach(i=>{Ns(i,e,t,n)});else if(Re(s))for(const i in s)Ns(s[i],e,t,n);return s}function Qh(s){Gp(s)&&Q("Do not use built-in directive ids as custom directive id: "+s)}function zh(){return{app:null,config:{isNativeTag:Up,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 ly=0;function cy(s,e){return function(n,i=null){K(n)||(n=le({},n)),i!=null&&!ue(i)&&(Q("root props passed to app.mount() must be an object."),i=null);const r=zh(),o=new WeakSet,a=r.app={_uid:ly++,_component:n,_props:i,_container:null,_context:r,_instance:null,version:ad,get config(){return r.config},set config(l){Q("app.config cannot be replaced. Modify individual options instead.")},use(l,...c){return o.has(l)?Q("Plugin has already been applied to target app."):l&&K(l.install)?(o.add(l),l.install(a,...c)):K(l)?(o.add(l),l(a,...c)):Q('A plugin must either be a function or an object with an "install" function.'),a},mixin(l){return r.mixins.includes(l)?Q("Mixin has already been applied to target app"+(l.name?`: ${l.name}`:"")):r.mixins.push(l),a},component(l,c){return Uo(l,r.config),c?(r.components[l]&&Q(`Component "${l}" has already been registered in target app.`),r.components[l]=c,a):r.components[l]},directive(l,c){return Qh(l),c?(r.directives[l]&&Q(`Directive "${l}" has already been registered in target app.`),r.directives[l]=c,a):r.directives[l]},mount(){},unmount(){},provide(l,c){return l in r.provides&&Q(`App already provides property with key "${String(l)}". It will be overwritten with the new value.`),r.provides[l]=c,a},runWithContext(l){const c=En;En=a;try{return l()}finally{En=c}}};return a}}let En=null;function uy(s,e){if(!ve)Q("provide() can only be used inside setup().");else{let t=ve.provides;const n=ve.parent&&ve.parent.provides;n===t&&(t=ve.provides=Object.create(n)),t[s]=e,ve.type.mpType==="app"&&ve.appContext.app.provide(s,e)}}function Ii(s,e,t=!1){const n=ve||Es;if(n||En){const i=n?n.parent==null?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:En._context.provides;if(i&&s in i)return i[s];if(arguments.length>1)return t&&K(e)?e.call(n&&n.proxy):e;Q(`injection "${String(s)}" not found.`)}else Q("inject() can only be used inside setup() or functional components.")}const fy=s=>s.type.__isKeepAlive;function hy(s,e){Yh(s,"a",e)}function dy(s,e){Yh(s,"da",e)}function Yh(s,e,t=ve){const n=s.__wdc||(s.__wdc=()=>{let i=t;for(;i;){if(i.isDeactivated)return;i=i.parent}return s()});if(Is(e,n,t),t){let i=t.parent;for(;i&&i.parent;)fy(i.parent.vnode)&&py(n,e,t,i),i=i.parent}}function py(s,e,t,n){const i=Is(e,s,n,!0);Xh(()=>{ar(n[e],i)},t)}function Is(s,e,t=ve,n=!1){if(t){ug(s)&&(t=t.root);const i=t[s]||(t[s]=[]),r=e.__weh||(e.__weh=(...o)=>{if(t.isUnmounted)return;As();const a=Qn(t),l=zt(e,t,s,o);return a(),bs(),l});return n?i.unshift(r):i.push(r),r}else{const i=ss((Oa[s]||s.replace(/^on/,"")).replace(/ hook$/,""));Q(`${i} 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 _t=s=>(e,t=ve)=>(!Ga||s==="sp")&&Is(s,(...n)=>e(...n),t),gy=_t("bm"),yy=_t("m"),Sy=_t("bu"),xy=_t("u"),Ua=_t("bum"),Xh=_t("um"),Ey=_t("sp"),Ty=_t("rtg"),vy=_t("rtc");function Ay(s,e=ve){Is("ec",s,e)}const ko=s=>s?id(s)?zn(s)||s.proxy:ko(s.parent):null;function by(s){return s}const Cn=le(Object.create(null),{$:by,$el:s=>s.__$el||(s.__$el={}),$data:s=>s.data,$props:s=>Ms(s.props),$attrs:s=>Ms(s.attrs),$slots:s=>Ms(s.slots),$refs:s=>Ms(s.refs),$parent:s=>ko(s.parent),$root:s=>ko(s.root),$emit:s=>s.emit,$options:s=>ed(s),$forceUpdate:s=>s.f||(s.f=()=>{s.effect.dirty=!0,Mi(s.update)}),$watch:s=>ay.bind(s)}),$a=s=>s==="_"||s==="$",Cr=(s,e)=>s!==Se&&!s.__isScriptSetup&&Y(s,e),Jh={get({_:s},e){const{ctx:t,setupState:n,data:i,props:r,accessCache:o,type:a,appContext:l}=s;if(e==="__isVue")return!0;let c;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return n[e];case 2:return i[e];case 4:return t[e];case 3:return r[e]}else{if(Cr(n,e))return o[e]=1,n[e];if(i!==Se&&Y(i,e))return o[e]=2,i[e];if((c=s.propsOptions[0])&&Y(c,e))return o[e]=3,r[e];if(t!==Se&&Y(t,e))return o[e]=4,t[e];Oo&&(o[e]=0)}}const u=Cn[e];let f,h;if(u)return(e==="$attrs"||e==="$slots")&&Fe(s,"get",e),u(s);if((f=a.__cssModules)&&(f=f[e]))return f;if(t!==Se&&Y(t,e))return o[e]=4,t[e];if(h=l.config.globalProperties,Y(h,e))return h[e];Es&&(!ge(e)||e.indexOf("__v")!==0)&&(i!==Se&&$a(e[0])&&Y(i,e)?Q(`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.`):s===Es&&Q(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))},set({_:s},e,t){const{data:n,setupState:i,ctx:r}=s;return Cr(i,e)?(i[e]=t,!0):i.__isScriptSetup&&Y(i,e)?(Q(`Cannot mutate <script setup> binding "${e}" from Options API.`),!1):n!==Se&&Y(n,e)?(n[e]=t,!0):Y(s.props,e)?(Q(`Attempting to mutate prop "${e}". Props are readonly.`),!1):e[0]==="$"&&e.slice(1)in s?(Q(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`),!1):(e in s.appContext.config.globalProperties?Object.defineProperty(r,e,{enumerable:!0,configurable:!0,value:t}):r[e]=t,!0)},has({_:{data:s,setupState:e,accessCache:t,ctx:n,appContext:i,propsOptions:r}},o){let a;return!!t[o]||s!==Se&&Y(s,o)||Cr(e,o)||(a=r[0])&&Y(a,o)||Y(n,o)||Y(Cn,o)||Y(i.config.globalProperties,o)},defineProperty(s,e,t){return t.get!=null?s._.accessCache[e]=0:Y(t,"value")&&this.set(s,e,t.value,null),Reflect.defineProperty(s,e,t)}};Jh.ownKeys=s=>(Q("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(s));function Iy(s){const e={};return Object.defineProperty(e,"_",{configurable:!0,enumerable:!1,get:()=>s}),Object.keys(Cn).forEach(t=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get:()=>Cn[t](s),set:we})}),e}function _y(s){const{ctx:e,propsOptions:[t]}=s;t&&Object.keys(t).forEach(n=>{Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>s.props[n],set:we})})}function wy(s){const{ctx:e,setupState:t}=s;Object.keys(ie(t)).forEach(n=>{if(!t.__isScriptSetup){if($a(n[0])){Q(`setup() return property ${JSON.stringify(n)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);return}Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>t[n],set:we})}})}function lc(s){return z(s)?s.reduce((e,t)=>(e[t]=null,e),{}):s}function Ry(){const s=Object.create(null);return(e,t)=>{s[t]?Q(`${e} property "${t}" is already defined in ${s[t]}.`):s[t]=e}}let Oo=!0;function Ly(s){const e=ed(s),t=s.proxy,n=s.ctx;Oo=!1,e.beforeCreate&&cc(e.beforeCreate,s,"bc");const{data:i,computed:r,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:h,beforeUpdate:d,updated:p,activated:m,deactivated:g,beforeDestroy:y,beforeUnmount:E,destroyed:x,unmounted:T,render:v,renderTracked:A,renderTriggered:b,errorCaptured:I,serverPrefetch:C,expose:_,inheritAttrs:D,components:H,directives:V,filters:$}=e,B=Ry();{const[G]=s.propsOptions;if(G)for(const M in G)B("Props",M)}function F(){c&&Cy(c,n,B)}if(F(),o)for(const G in o){const M=o[G];K(M)?(Object.defineProperty(n,G,{value:M.bind(t),configurable:!0,enumerable:!0,writable:!0}),B("Methods",G)):Q(`Method "${G}" has type "${typeof M}" in the component definition. Did you reference the function correctly?`)}if(i){K(i)||Q("The data option must be a function. Plain object usage is no longer supported.");const G=i.call(t,t);if(qn(G)&&Q("data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>."),!ue(G))Q("data() should return an object.");else{s.data=pr(G);for(const M in G)B("Data",M),$a(M[0])||Object.defineProperty(n,M,{configurable:!0,enumerable:!0,get:()=>G[M],set:we})}}if(Oo=!0,r)for(const G in r){const M=r[G],w=K(M)?M.bind(t,t):K(M.get)?M.get.bind(t,t):we;w===we&&Q(`Computed property "${G}" has no getter.`);const R=!K(M)&&K(M.set)?M.set.bind(t):()=>{Q(`Write operation failed: computed property "${G}" is readonly.`)},P=od({get:w,set:R});Object.defineProperty(n,G,{enumerable:!0,configurable:!0,get:()=>P.value,set:O=>P.value=O}),B("Computed",G)}if(a)for(const G in a)Zh(a[G],n,t,G);function U(){if(l){const G=K(l)?l.call(t):l;Reflect.ownKeys(G).forEach(M=>{uy(M,G[M])})}}U(),u&&cc(u,s,"c");function k(G,M){z(M)?M.forEach(w=>G(w.bind(t))):M&&G(M.bind(t))}if(k(gy,f),k(yy,h),k(Sy,d),k(xy,p),k(hy,m),k(dy,g),k(Ay,I),k(vy,A),k(Ty,b),k(Ua,E),k(Xh,T),k(Ey,C),z(_))if(_.length){const G=s.exposed||(s.exposed={});_.forEach(M=>{Object.defineProperty(G,M,{get:()=>t[M],set:w=>t[M]=w})})}else s.exposed||(s.exposed={});v&&s.render===we&&(s.render=v),D!=null&&(s.inheritAttrs=D),H&&(s.components=H),V&&(s.directives=V),s.ctx.$onApplyOptions&&s.ctx.$onApplyOptions(e,s,t)}function Cy(s,e,t=we){z(s)&&(s=Fo(s));for(const n in s){const i=s[n];let r;ue(i)?"default"in i?r=Ii(i.from||n,i.default,!0):r=Ii(i.from||n):r=Ii(i),Ue(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r,t("Inject",n)}}function cc(s,e,t){zt(z(s)?s.map(n=>n.bind(e.proxy)):s.bind(e.proxy),e,t)}function Zh(s,e,t,n){const i=n.includes(".")?Wh(t,n):()=>t[n];if(ge(s)){const r=e[s];K(r)?xn(i,r):Q(`Invalid watch handler specified by key "${s}"`,r)}else if(K(s))xn(i,s.bind(t));else if(ue(s))if(z(s))s.forEach(r=>Zh(r,e,t,n));else{const r=K(s.handler)?s.handler.bind(t):e[s.handler];K(r)?xn(i,r,s):Q(`Invalid watch handler specified by key "${s.handler}"`,r)}else Q(`Invalid watch option: "${n}"`,s)}function ed(s){const e=s.type,{mixins:t,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=s.appContext,a=r.get(e);let l;return a?l=a:!i.length&&!t&&!n?l=e:(l={},i.length&&i.forEach(c=>Ni(l,c,o,!0)),Ni(l,e,o)),ue(e)&&r.set(e,l),l}function Ni(s,e,t,n=!1){const{mixins:i,extends:r}=e;r&&Ni(s,r,t,!0),i&&i.forEach(o=>Ni(s,o,t,!0));for(const o in e)if(n&&o==="expose")Q('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const a=Py[o]||t&&t[o];s[o]=a?a(s[o],e[o]):e[o]}return s}const Py={data:uc,props:fc,emits:fc,methods:pn,computed:pn,beforeCreate:Be,created:Be,beforeMount:Be,mounted:Be,beforeUpdate:Be,updated:Be,beforeDestroy:Be,beforeUnmount:Be,destroyed:Be,unmounted:Be,activated:Be,deactivated:Be,errorCaptured:Be,serverPrefetch:Be,components:pn,directives:pn,watch:ky,provide:uc,inject:Dy};function uc(s,e){return e?s?function(){return le(K(s)?s.call(this,this):s,K(e)?e.call(this,this):e)}:e:s}function Dy(s,e){return pn(Fo(s),Fo(e))}function Fo(s){if(z(s)){const e={};for(let t=0;t<s.length;t++)e[s[t]]=s[t];return e}return s}function Be(s,e){return s?[...new Set([].concat(s,e))]:e}function pn(s,e){return s?le(Object.create(null),s,e):e}function fc(s,e){return s?z(s)&&z(e)?[...new Set([...s,...e])]:le(Object.create(null),lc(s),lc(e??{})):e}function ky(s,e){if(!s)return e;if(!e)return s;const t=le(Object.create(null),s);for(const n in e)t[n]=Be(s[n],e[n]);return t}function Oy(s,e,t,n=!1){const i={},r={};s.propsDefaults=Object.create(null),td(s,e,i,r);for(const o in s.propsOptions[0])o in i||(i[o]=void 0);nd(e||{},i,s),t?s.props=n?i:D1(i):s.type.props?s.props=i:s.props=r,s.attrs=r}function Fy(s,e,t,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=s,a=ie(i),[l]=s.propsOptions;let c=!1;if(!void 0&&(n||o>0)&&!(o&16)){if(o&8){const u=s.vnode.dynamicProps;for(let f=0;f<u.length;f++){let h=u[f];if(Vh(s.emitsOptions,h))continue;const d=e[h];if(l)if(Y(r,h))d!==r[h]&&(r[h]=d,c=!0);else{const p=St(h);i[p]=Bo(l,a,p,d,s,!1)}else d!==r[h]&&(r[h]=d,c=!0)}}}else{td(s,e,i,r)&&(c=!0);let u;for(const f in a)(!e||!Y(e,f)&&((u=ys(f))===f||!Y(e,u)))&&(l?t&&(t[f]!==void 0||t[u]!==void 0)&&(i[f]=Bo(l,a,f,void 0,s,!0)):delete i[f]);if(r!==a)for(const f in r)(!e||!Y(e,f))&&(delete r[f],c=!0)}c&&bt(s,"set","$attrs"),nd(e||{},i,s)}function td(s,e,t,n){const[i,r]=s.propsOptions;let o=!1,a;if(e)for(let l in e){if(Tf(l))continue;const c=e[l];let u;i&&Y(i,u=St(l))?!r||!r.includes(u)?t[u]=c:(a||(a={}))[u]=c:Vh(s.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(r){const l=ie(t),c=a||Se;for(let u=0;u<r.length;u++){const f=r[u];t[f]=Bo(i,l,f,c[f],s,!Y(c,f))}}return o}function Bo(s,e,t,n,i,r){const o=s[t];if(o!=null){const a=Y(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&K(l)){const{propsDefaults:c}=i;if(t in c)n=c[t];else{const u=Qn(i);n=c[t]=l.call(null,e),u()}}else n=l}o[0]&&(r&&!a?n=!1:o[1]&&(n===""||n===ys(t))&&(n=!0))}return n}function sd(s,e,t=!1){const n=e.propsCache,i=n.get(s);if(i)return i;const r=s.props,o={},a=[];let l=!1;if(!K(s)){const u=f=>{l=!0;const[h,d]=sd(f,e,!0);le(o,h),d&&a.push(...d)};!t&&e.mixins.length&&e.mixins.forEach(u),s.extends&&u(s.extends),s.mixins&&s.mixins.forEach(u)}if(!r&&!l)return ue(s)&&n.set(s,Fl),Fl;if(z(r))for(let u=0;u<r.length;u++){ge(r[u])||Q("props must be strings when using array syntax.",r[u]);const f=St(r[u]);hc(f)&&(o[f]=Se)}else if(r){ue(r)||Q("invalid props options",r);for(const u in r){const f=St(u);if(hc(f)){const h=r[u],d=o[f]=z(h)||K(h)?{type:h}:le({},h);if(d){const p=pc(Boolean,d.type),m=pc(String,d.type);d[0]=p>-1,d[1]=m<0||p<m,(p>-1||Y(d,"default"))&&a.push(f)}}}}const c=[o,a];return ue(s)&&n.set(s,c),c}function hc(s){return s[0]!=="$"&&!Tf(s)?!0:(Q(`Invalid prop name: "${s}" is a reserved property.`),!1)}function Mo(s){return s===null?"null":typeof s=="function"?s.name||"":typeof s=="object"&&s.constructor&&s.constructor.name||""}function dc(s,e){return Mo(s)===Mo(e)}function pc(s,e){return z(e)?e.findIndex(t=>dc(t,s)):K(e)&&dc(e,s)?0:-1}function nd(s,e,t){const n=ie(e),i=t.propsOptions[0];for(const r in i){let o=i[r];o!=null&&By(r,n[r],o,Ms(n),!Y(s,r)&&!Y(s,ys(r)))}}function By(s,e,t,n,i){const{type:r,required:o,validator:a,skipCheck:l}=t;if(o&&i){Q('Missing required prop: "'+s+'"');return}if(!(e==null&&!o)){if(r!=null&&r!==!0&&!l){let c=!1;const u=z(r)?r:[r],f=[];for(let h=0;h<u.length&&!c;h++){const{valid:d,expectedType:p}=Ny(e,u[h]);f.push(p||""),c=d}if(!c){Q(Uy(s,e,f));return}}a&&!a(e,n)&&Q('Invalid prop: custom validator check failed for prop "'+s+'".')}}const My=sn("String,Number,Boolean,Function,Symbol,BigInt");function Ny(s,e){let t;const n=Mo(e);if(My(n)){const i=typeof s;t=i===n.toLowerCase(),!t&&i==="object"&&(t=s instanceof e)}else n==="Object"?t=ue(s):n==="Array"?t=z(s):n==="null"?t=s===null:t=s instanceof e;return{valid:t,expectedType:n}}function Uy(s,e,t){if(t.length===0)return`Prop type [] for prop "${s}" won't match anything. Did you mean to use type Array instead?`;let n=`Invalid prop: type check failed for prop "${s}". Expected ${t.map(Ss).join(" | ")}`;const i=t[0],r=lr(e),o=gc(e,i),a=gc(e,r);return t.length===1&&mc(i)&&!$y(i,r)&&(n+=` with value ${o}`),n+=`, got ${r} `,mc(r)&&(n+=`with value ${a}.`),n}function gc(s,e){return e==="String"?`"${s}"`:e==="Number"?`${Number(s)}`:`${s}`}function mc(s){return["string","number","boolean"].some(t=>s.toLowerCase()===t)}function $y(...s){return s.some(e=>e.toLowerCase()==="boolean")}let ln,Mt;function Ui(s,e){s.appContext.config.performance&&Gi()&&Mt.mark(`vue-${e}-${s.uid}`),ty(s,e,Gi()?Mt.now():Date.now())}function $i(s,e){if(s.appContext.config.performance&&Gi()){const t=`vue-${e}-${s.uid}`,n=t+":end";Mt.mark(n),Mt.measure(`<${xr(s,s.type)}> ${e}`,t,n),Mt.clearMarks(t),Mt.clearMarks(n)}sy(s,e,Gi()?Mt.now():Date.now())}function Gi(){return ln!==void 0||(typeof window<"u"&&window.performance?(ln=!0,Mt=window.performance):ln=!1),ln}const yc=Uh,Gy=Symbol.for("v-fgt"),Hy=Symbol.for("v-txt"),jy=Symbol.for("v-cmt"),Ky=Symbol.for("v-stc");function Vy(s){return s?s.__v_isVNode===!0:!1}const qy="__vInternal";function Wy(s){return s?k1(s)||qy in s?le({},s):s:null}const Qy=zh();let zy=0;function Yy(s,e,t){const n=s.type,i=(e?e.appContext:s.appContext)||Qy,r={uid:zy++,vnode:s,type:n,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,scope:new gh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:sd(n,i),emitsOptions:Kh(n,i),emit:null,emitted:null,propsDefaults:Se,inheritAttrs:n.inheritAttrs,ctx:Se,data:Se,props:Se,attrs:Se,slots:Se,refs:Se,setupState:Se,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=Iy(r),r.root=e?e.root:r,r.emit=iy.bind(null,r),s.ce&&s.ce(r),r}let ve=null;const Sr=()=>ve||Es;let Hi,No;Hi=s=>{ve=s},No=s=>{Ga=s};const Qn=s=>{const e=ve;return Hi(s),s.scope.on(),()=>{s.scope.off(),Hi(e)}},Sc=()=>{ve&&ve.scope.off(),Hi(null)},Xy=sn("slot,component");function Uo(s,{isNativeTag:e}){(Xy(s)||e(s))&&Q("Do not use built-in or reserved HTML elements as component id: "+s)}function id(s){return s.vnode.shapeFlag&4}let Ga=!1;function Jy(s,e=!1){e&&No(e);const{props:t}=s.vnode,n=id(s);Oy(s,t,n,e);const i=n?Zy(s,e):void 0;return e&&No(!1),i}function Zy(s,e){const t=s.type;{if(t.name&&Uo(t.name,s.appContext.config),t.components){const i=Object.keys(t.components);for(let r=0;r<i.length;r++)Uo(i[r],s.appContext.config)}if(t.directives){const i=Object.keys(t.directives);for(let r=0;r<i.length;r++)Qh(i[r])}t.compilerOptions&&s2()&&Q('"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.')}s.accessCache=Object.create(null),s.proxy=Ca(new Proxy(s.ctx,Jh)),_y(s);const{setup:n}=t;if(n){const i=s.setupContext=n.length>1?r2(s):null,r=Qn(s);As();const o=It(n,s,0,[Ms(s.props),i]);bs(),r(),qn(o)?(o.then(Sc,Sc),Q("setup() returned a Promise, but the version of Vue you are using does not support it yet.")):e2(s,o,e)}else rd(s,e)}function e2(s,e,t){K(e)?s.render=e:ue(e)?(Vy(e)&&Q("setup() should not return VNodes directly - return a render function instead."),s.devtoolsRawSetupState=e,s.setupState=Oh(e),wy(s)):e!==void 0&&Q(`setup() should return an object. Received: ${e===null?"null":typeof e}`),rd(s,t)}let t2;const s2=()=>!t2;function rd(s,e,t){const n=s.type;s.render||(s.render=n.render||we);{const i=Qn(s);As();try{Ly(s)}finally{bs(),i()}}!n.render&&s.render===we&&!e&&(n.template?Q('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".'):Q("Component is missing template or render function."))}function n2(s){return s.attrsProxy||(s.attrsProxy=new Proxy(s.attrs,{get(e,t){return Fe(s,"get","$attrs"),e[t]},set(){return Q("setupContext.attrs is readonly."),!1},deleteProperty(){return Q("setupContext.attrs is readonly."),!1}}))}function i2(s){return s.slotsProxy||(s.slotsProxy=new Proxy(s.slots,{get(e,t){return Fe(s,"get","$slots"),e[t]}}))}function r2(s){return Object.freeze({get attrs(){return n2(s)},get slots(){return i2(s)},get emit(){return(t,...n)=>s.emit(t,...n)},expose:t=>{if(s.exposed&&Q("expose() should be called only once per setup()."),t!=null){let n=typeof t;n==="object"&&(z(t)?n="array":Ue(t)&&(n="ref")),n!=="object"&&Q(`expose() should be passed a plain object, received ${n}.`)}s.exposed=t||{}}})}function zn(s){if(s.exposed)return s.exposeProxy||(s.exposeProxy=new Proxy(Oh(Ca(s.exposed)),{get(e,t){return t in e?e[t]:s.proxy[t]},has(e,t){return t in e||t in Cn}}))}const o2=/(?:^|[-_])(\w)/g,a2=s=>s.replace(o2,e=>e.toUpperCase()).replace(/[-_]/g,"");function Ha(s,e=!0){return K(s)?s.displayName||s.name:s.name||e&&s.__name}function xr(s,e,t=!1){let n=Ha(e);if(!n&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(n=i[1])}if(!n&&s&&s.parent){const i=r=>{for(const o in r)if(r[o]===e)return o};n=i(s.components||s.parent.type.components)||i(s.appContext.components)}return n?a2(n):t?"App":"Anonymous"}const od=(s,e)=>{const t=F1(s,e,Ga);{const n=Sr();n&&n.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t},ad="3.4.21",ja=Q;function ji(s){return kh(s)}const rs="[object Array]",os="[object Object]";function ld(s,e){const t={};return $o(s,e),_i(s,e,"",t),t}function $o(s,e){if(s=ji(s),s===e)return;const t=pt(s),n=pt(e);if(t==os&&n==os)for(let i in e){const r=s[i];r===void 0?s[i]=null:$o(r,e[i])}else t==rs&&n==rs&&s.length>=e.length&&e.forEach((i,r)=>{$o(s[r],i)})}function _i(s,e,t,n){if(s=ji(s),s===e)return;const i=pt(s),r=pt(e);if(i==os)if(r!=os||Object.keys(s).length<Object.keys(e).length)Ct(n,t,s);else for(let o in s){const a=ji(s[o]),l=e[o],c=pt(a),u=pt(l);if(c!=rs&&c!=os)a!=l&&Ct(n,(t==""?"":t+".")+o,a);else if(c==rs)u!=rs||a.length<l.length?Ct(n,(t==""?"":t+".")+o,a):a.forEach((f,h)=>{_i(f,l[h],(t==""?"":t+".")+o+"["+h+"]",n)});else if(c==os)if(u!=os||Object.keys(a).length<Object.keys(l).length)Ct(n,(t==""?"":t+".")+o,a);else for(let f in a)_i(a[f],l[f],(t==""?"":t+".")+o+"."+f,n)}else i==rs?r!=rs||s.length<e.length?Ct(n,t,s):s.forEach((o,a)=>{_i(o,e[a],t+"["+a+"]",n)}):Ct(n,t,s)}function Ct(s,e,t){s[e]=t}function l2(s){return _e.includes(s.update)}function xc(s){const t=s.ctx.__next_tick_callbacks;if(t&&t.length){const n=t.slice(0);t.length=0;for(let i=0;i<n.length;i++)n[i]()}}function Go(s,e){const t=s.ctx;if(!t.__next_tick_pending&&!l2(s))return Ba(e&&e.bind(s.proxy));let n;return t.__next_tick_callbacks||(t.__next_tick_callbacks=[]),t.__next_tick_callbacks.push(()=>{e?It(e.bind(s.proxy),s,14):n&&n(s.proxy)}),new Promise(i=>{n=i})}function Ho(s,e){s=ji(s);const t=typeof s;if(t==="object"&&s!==null){let n=e.get(s);if(typeof n<"u")return n;if(z(s)){const i=s.length;n=new Array(i),e.set(s,n);for(let r=0;r<i;r++)n[r]=Ho(s[r],e)}else{n={},e.set(s,n);for(const i in s)Y(s,i)&&(n[i]=Ho(s[i],e))}return n}if(t!=="symbol")return s}function c2(s){return Ho(s,typeof WeakMap<"u"?new WeakMap:new Map)}function u2(s,e){const t=s.data,n=Object.create(null);return e.forEach(i=>{n[i]=t[i]}),n}function Ec(s,e,t){if(!e)return;e=c2(e),e.$eS=s.$eS||{},e.$eA=s.$eA||{};const n=s.ctx,i=n.mpType;if(i==="page"||i==="component"){e.r0=1;const r=n.$scope,o=Object.keys(e),a=ld(e,t||u2(r,o));Object.keys(a).length?(n.__next_tick_pending=!0,r.setData(a,()=>{n.__next_tick_pending=!1,xc(s)}),$h()):xc(s)}}function f2(s){s.globalProperties.$nextTick=function(t){return Go(this.$,t)}}function h2(s,e,t){e.appContext.config.globalProperties.$applyOptions(s,e,t);const n=s.computed;if(n){const i=Object.keys(n);if(i.length){const r=e.ctx;r.$computedKeys||(r.$computedKeys=[]),r.$computedKeys.push(...i)}}delete e.ctx.$onApplyOptions}function cd(s,e=!1){const{setupState:t,$templateRefs:n,$templateUniElementRefs:i,ctx:{$scope:r,$mpPlatform:o}}=s;if(o==="mp-alipay"||!r||!n&&!i)return;if(e){n&&n.forEach(u=>cn(u,null,t)),i&&i.forEach(u=>cn(u,null,t));return}const a=o==="mp-baidu"||o==="mp-toutiao",l=u=>{if(u.length===0)return[];const f=(r.selectAllComponents(".r")||[]).concat(r.selectAllComponents(".r-i-f")||[]);return u.filter(h=>{const d=p2(f,h.i);return a&&d===null?!0:(cn(h,d,t),!1)})},c=()=>{if(n){const u=l(n);u.length&&s.proxy&&s.proxy.$scope&&s.proxy.$scope.setData({r1:1},()=>{l(u)})}};i&&i.length&&Go(s,()=>{i.forEach(u=>{z(u.v)?u.v.forEach(f=>{cn(u,f,t)}):cn(u,u.v,t)})}),r._$setRef?r._$setRef(c):Go(s,c)}function d2(s){return ue(s)&&Ca(s),s}function p2(s,e){const t=s.find(n=>n&&(n.properties||n.props).uI===e);if(t){const n=t.$vm;return n?zn(n.$)||n:d2(t)}return null}function cn({r:s,f:e},t,n){if(K(s))s(t,{});else{const i=ge(s),r=Ue(s);if(i||r)if(e){if(!r)return;z(s.value)||(s.value=[]);const o=s.value;if(o.indexOf(t)===-1){if(o.push(t),!t)return;t.$&&Ua(()=>ar(o,t),t.$)}}else i?Y(n,s)&&(n[s]=t):Ue(s)?s.value=t:Tc(s);else Tc(s)}}function Tc(s){ja("Invalid template ref type:",s,`(${typeof s})`)}const jo=Uh;function vc(s,e){const t=s.component=Yy(s,e.parentComponent,null);return t.renderer=e.mpType?e.mpType:"component",t.ctx.$onApplyOptions=h2,t.ctx.$children=[],e.mpType==="app"&&(t.render=we),e.onBeforeSetup&&e.onBeforeSetup(t,e),Da(s),Ui(t,"mount"),Ui(t,"init"),Jy(t),$i(t,"init"),e.parentComponent&&t.proxy&&e.parentComponent.ctx.$children.push(zn(t)||t.proxy),S2(t),ka(),$i(t,"mount"),t.proxy}const g2=s=>{let e;for(const t in s)(t==="class"||t==="style"||Sf(t))&&((e||(e={}))[t]=s[t]);return e};function Ac(s){const{type:e,vnode:t,proxy:n,withProxy:i,props:r,propsOptions:[o],slots:a,attrs:l,emit:c,render:u,renderCache:f,data:h,setupState:d,ctx:p,uid:m,appContext:{app:{config:{globalProperties:{pruneComponentPropsCache:g}}}},inheritAttrs:y}=s;s.$uniElementIds=new Map,s.$templateRefs=[],s.$templateUniElementRefs=[],s.$templateUniElementStyles={},s.$ei=0,g(m),s.__counter=s.__counter===0?1:0;let E;const x=oc(s);try{if(t.shapeFlag&4){bc(y,r,o,l);const T=i||n;E=u.call(T,T,f,r,d,h,p)}else{bc(y,r,o,e.props?l:g2(l));const T=e;E=T.length>1?T(r,{attrs:l,slots:a,emit:c}):T(r,null)}}catch(T){mr(T,s,1),E=!1}return cd(s),oc(x),E}function bc(s,e,t,n){if(e&&n&&s!==!1){const i=Object.keys(n).filter(r=>r!=="class"&&r!=="style");if(!i.length)return;t&&i.some(Bl)?i.forEach(r=>{(!Bl(r)||!(r.slice(9)in t))&&(e[r]=n[r])}):i.forEach(r=>e[r]=n[r])}}const m2=s=>{As(),$h(),bs()};function y2(){const s=this.$scopedSlotsData;if(!s||s.length===0)return;const e=this.ctx.$scope,t=e.data,n=Object.create(null);s.forEach(({path:i,index:r,data:o})=>{const a=jf(t,i),l=ge(r)?`${i}.${r}`:`${i}[${r}]`;if(typeof a>"u"||typeof a[r]>"u")n[l]=o;else{const c=ld(o,a[r]);Object.keys(c).forEach(u=>{n[l+"."+u]=c[u]})}}),s.length=0,Object.keys(n).length&&e.setData(n)}function Pr({effect:s,update:e},t){s.allowRecurse=e.allowRecurse=t}function S2(s){const e=y2.bind(s);s.$updateScopedSlots=()=>Ba(()=>Mi(e));const t=()=>{if(!s.isMounted)Ua(()=>{cd(s,!0)},s),Ui(s,"patch"),Ec(s,Ac(s)),$i(s,"patch"),X1(s);else{const{next:r,bu:o,u:a}=s;Da(r||s.vnode),Pr(s,!1),m2(),o&&vi(o),Pr(s,!0),Ui(s,"patch"),Ec(s,Ac(s)),$i(s,"patch"),a&&jo(a),J1(s),ka()}},n=s.effect=new _a(t,we,()=>Mi(i),s.scope),i=s.update=()=>{n.dirty&&n.run()};i.id=s.uid,Pr(s,!0),n.onTrack=s.rtc?r=>vi(s.rtc,r):void 0,n.onTrigger=s.rtg?r=>vi(s.rtg,r):void 0,i.ownerInstance=s,i()}function x2(s){const{bum:e,scope:t,update:n,um:i}=s;e&&vi(e);{const r=s.parent;if(r){const o=r.ctx.$children,a=zn(s)||s.proxy,l=o.indexOf(a);l>-1&&o.splice(l,1)}}t.stop(),n&&(n.active=!1),i&&jo(i),jo(()=>{s.isUnmounted=!0}),ey(s)}const E2=cy();function T2(){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 v2(s,e=null){const t=T2();t.__VUE__=!0,Hh(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const n=E2(s,e),i=n._context;f2(i.config);const r=l=>(l.appContext=i,l.shapeFlag=6,l),o=function(c,u){return vc(r(c),u)},a=function(c){return c&&x2(c.$)};return n.mount=function(){s.render=we;const c=vc(r({type:s}),{mpType:"app",mpInstance:null,parentComponent:null,slots:[],props:null});return n._instance=c.$,Y1(n,ad),c.$app=n,c.$createComponent=o,c.$destroyComponent=a,i.$appInstance=c,c},n.unmount=function(){ja("Cannot unmount an app.")},n}function Ic(s,e,t,n){K(e)&&Is(s,e.bind(t),n)}function A2(s,e,t){const n=s.mpType||t.$mpType;!n||n==="component"||n==="page"&&e.renderer==="component"||Object.keys(s).forEach(i=>{if(qf(i,s[i],!1)){const r=s[i];z(r)?r.forEach(o=>Ic(i,o,t,e)):Ic(i,r,t,e)}})}function b2(s,e,t){A2(s,e,t)}function I2(s,e,t){return s[e]=t}function _2(s,...e){const t=this[s];return t?t(...e):(console.error(`method ${s} not found`),null)}function w2(s){const e=s.config.errorHandler;return function(n,i,r){e&&e(n,i,r);const o=s._instance;if(!o||!o.proxy)throw n;o[xs]?o.proxy.$callHook(xs,n):Bh(n,r,i?i.$.vnode:null,!1)}}function R2(s,e){return s?[...new Set([].concat(s,e))]:e}function L2(s){Vf.forEach(e=>{s[e]=R2})}let Ko;const ai="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",C2=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;typeof atob!="function"?Ko=function(s){if(s=String(s).replace(/[\t\n\f\r ]+/g,""),!C2.test(s))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");s+="==".slice(2-(s.length&3));for(var e,t="",n,i,r=0;r<s.length;)e=ai.indexOf(s.charAt(r++))<<18|ai.indexOf(s.charAt(r++))<<12|(n=ai.indexOf(s.charAt(r++)))<<6|(i=ai.indexOf(s.charAt(r++))),t+=n===64?String.fromCharCode(e>>16&255):i===64?String.fromCharCode(e>>16&255,e>>8&255):String.fromCharCode(e>>16&255,e>>8&255,e&255);return t}:Ko=atob;function P2(s){return decodeURIComponent(Ko(s).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))}function Dr(){const s=W.getStorageSync("uni_id_token")||"",e=s.split(".");if(!s||e.length!==3)return{uid:null,role:[],permission:[],tokenExpired:0};let t;try{t=JSON.parse(P2(e[1]))}catch(n){throw new Error("获取当前用户信息出错,详细错误信息为:"+n.message)}return t.tokenExpired=t.exp*1e3,delete t.exp,delete t.iat,t}function D2(s){s.uniIDHasRole=function(e){const{role:t}=Dr();return t.indexOf(e)>-1},s.uniIDHasPermission=function(e){const{permission:t}=Dr();return this.uniIDHasRole("admin")||t.indexOf(e)>-1},s.uniIDTokenValid=function(){const{tokenExpired:e}=Dr();return e>Date.now()}}function k2(s){const e=s.config;e.errorHandler=dg(s,w2),L2(e.optionMergeStrategies);const t=e.globalProperties;D2(t),t.$set=I2,t.$applyOptions=b2,t.$callMethod=_2,W.invokeCreateVueAppHook(s)}const Pn=Object.create(null);function O2(s){const{uid:e,__counter:t}=Sr(),n=(Pn[e]||(Pn[e]=[])).push(Wy(s))-1;return e+","+n+","+t}function ud(s){delete Pn[s]}function Ka(s){if(!s)return;const[e,t]=s.split(",");if(Pn[e])return Pn[e][parseInt(t)]}var F2={install(s){k2(s),s.config.globalProperties.pruneComponentPropsCache=ud;const e=s.mount;s.mount=function(n){const i=e.call(s,n),r=B2();return r?r(i):typeof createMiniProgramApp<"u"&&createMiniProgramApp(i),i}}};function B2(){const s="createApp";if(typeof global<"u"&&typeof global[s]<"u")return global[s];if(typeof my<"u")return my[s]}function M2(s){return ge(s)?s:N2(vf(s))}function N2(s){let e="";if(!s||ge(s))return e;for(const t in s)e+=`${t.startsWith("--")?t:ys(t)}:${s[t]};`;return e}function U2(s,e){const t=Sr(),n=t.ctx,i=typeof e<"u"&&(n.$mpPlatform==="mp-weixin"||n.$mpPlatform==="mp-qq"||n.$mpPlatform==="mp-xhs")&&(ge(e)||typeof e=="number")?"_"+e:"",r="e"+t.$ei+++i,o=n.$scope;if(!s)return delete o[r],r;const a=o[r];return a?a.value=s:o[r]=$2(s,t),r}function $2(s,e){const t=n=>{H2(n);let i=[n];e&&e.ctx.$getTriggerEventDetail&&typeof n.detail=="number"&&(n.detail=e.ctx.$getTriggerEventDetail(n.detail)),n.detail&&n.detail.__args__&&(i=n.detail.__args__);const r=t.value,o=()=>zt(j2(n,r),e,5,i),a=n.target,l=a&&a.dataset?String(a.dataset.eventsync)==="true":!1;if(G2.includes(n.type)&&!l)setTimeout(o);else{const c=o();return n.type==="input"&&(z(c)||qn(c))?void 0:c}};return t.value=s,t}const G2=["tap","longpress","longtap","transitionend","animationstart","animationiteration","animationend","touchforcechange"];function H2(s,e){s.type&&s.target&&(s.preventDefault=we,s.stopPropagation=we,s.stopImmediatePropagation=we,Y(s,"detail")||(s.detail={}),Y(s,"markerId")&&(s.detail=typeof s.detail=="object"?s.detail:{},s.detail.markerId=s.markerId),Re(s.detail)&&Y(s.detail,"checked")&&!Y(s.detail,"value")&&(s.detail.value=s.detail.checked),Re(s.detail)&&(s.target=le({},s.target,s.detail)))}function j2(s,e){if(z(e)){const t=s.stopImmediatePropagation;return s.stopImmediatePropagation=()=>{t&&t.call(s),s._stopped=!0},e.map(n=>i=>!i._stopped&&n(i))}else return e}function K2(s,e){let t;if(z(s)||ge(s)){t=new Array(s.length);for(let n=0,i=s.length;n<i;n++)t[n]=e(s[n],n,n)}else if(typeof s=="number"){if(!Number.isInteger(s))return ja(`The v-for range expect an integer value but got ${s}.`),[];t=new Array(s);for(let n=0;n<s;n++)t[n]=e(n+1,n,n)}else if(ue(s))if(s[Symbol.iterator])t=Array.from(s,(n,i)=>e(n,i,i));else{const n=Object.keys(s);t=new Array(n.length);for(let i=0,r=n.length;i<r;i++){const o=n[i];t[i]=e(s[o],o,i)}}else t=[];return t}function V2(s,e,t={}){const{$templateRefs:n}=Sr();n.push({i:e,r:s,k:t.k,f:t.f})}const q2=(s,e)=>U2(s,e),W2=(s,e)=>K2(s,e),Q2=s=>M2(s),z2=(s,...e)=>le(s,...e),Y2=s=>Af(s),X2=s=>Yp(s),J2=s=>O2(s),Z2=(s,e,t)=>V2(s,e,t);function e3(s,e=null){return s&&(s.mpType="app"),v2(s,e).use(F2)}const t3=e3;function s3(s,e){if(!s)return;const t=s.split(","),n=t.length;n===1?e._$vueId=t[0]:n===2&&(e._$vueId=t[0],e._$vuePid=t[1])}const n3=["externalClasses"];function i3(s,e){n3.forEach(t=>{Y(e,t)&&(s[t]=e[t])})}const r3=/_(.*)_worklet_factory_/;function o3(s,e){e&&Object.keys(e).forEach(t=>{const n=t.match(r3);if(n){const i=n[1];s[t]=e[t],s[i]=e[i]}})}function a3(s,e){z(e)&&e.forEach(t=>{s[t]=function(n){return this.$vm[t](n)}})}function l3(s,e,t){s.selectAllComponents(e).forEach(i=>{const r=i.properties.uR;t[r]=i.$vm||i})}function c3(s,e){Object.defineProperty(s,"refs",{get(){const t={};return l3(e,".r",t),e.selectAllComponents(".r-i-f").forEach(i=>{const r=i.properties.uR;r&&(t[r]||(t[r]=[]),t[r].push(i.$vm||i))}),t}})}function fd(s,e){const t=s.$children;for(let i=t.length-1;i>=0;i--){const r=t[i];if(r.$scope._$vueId===e)return r}let n;for(let i=t.length-1;i>=0;i--)if(n=fd(t[i],e),n)return n}function u3(){var s;let e="";{const t=((s=wx.getAppBaseInfo)===null||s===void 0?void 0:s.call(wx))||wx.getSystemInfoSync(),n=t&&t.language?t.language:_n;e=zf(n)||_n}return e}const f3=["createSelectorQuery","createIntersectionObserver","selectAllComponents","selectComponent"];function h3(s,e){return function(n,...i){const r=e.$scope;if(r&&n){const o={__args__:i};r.triggerEvent(n,o)}return s.apply(this,[n,...i])}}function hd(s,e){const t=s.ctx;t.mpType=e.mpType,t.$mpType=e.mpType,t.$mpPlatform="mp-weixin",t.$scope=e.mpInstance,Object.defineProperties(t,{[yo]:{get(){const n=this.$scope.data[yo];return n===void 0?"":n}}}),t.$mp={},t._self={},s.slots={},z(e.slots)&&e.slots.length&&(e.slots.forEach(n=>{s.slots[n]=!0}),s.slots[Xp]&&(s.slots.default=!0)),t.getOpenerEventChannel=function(){return e.mpInstance.getOpenerEventChannel()},t.$hasHook=g3,t.$callHook=dd,s.emit=h3(s.emit,t)}function d3(s,e){hd(s,e);const t=s.ctx;f3.forEach(n=>{t[n]=function(...i){const r=t.$scope;if(r&&r[n])return r[n].apply(r,i)}})}function p3(s,e,t){const n=s.ctx;t.forEach(i=>{Y(e,i)&&(s[i]=n[i]=e[i])})}function g3(s){const e=this.$[s];return!!(e&&e.length)}function dd(s,e){s==="mounted"&&(dd.call(this,"bm"),this.$.isMounted=!0,s="m");const t=this.$[s];return t&&ig(t,e)}const m3=[Wn,ur,fr,Ta,Pf,va,Aa,ba,Ia];function Vo(s,e=new Set){if(s){Object.keys(s).forEach(t=>{qf(t,s[t])&&e.add(t)});{const{extends:t,mixins:n}=s;n&&n.forEach(i=>Vo(i,e)),t&&Vo(t,e)}}return e}function Va(s,e,t){t.indexOf(e)===-1&&!Y(s,e)&&(s[e]=function(n){return this.$vm&&this.$vm.$callHook(e,n)})}const pd=[Ea];function qa(s,e,t=pd){e.forEach(n=>Va(s,n,t))}function gd(s,e,t=pd){Vo(e).forEach(n=>Va(s,n,t))}function y3(s,e){if(!e)return;Object.keys(So).forEach(n=>{e&So[n]&&Va(s,n,[])})}const S3=Hf(()=>{const s=[],e=K(getApp)&&getApp({allowDefault:!0});if(e&&e.$vm&&e.$vm.$){const t=e.$vm.$.appContext.mixins;if(z(t)){const n=Object.keys(So);t.forEach(i=>{n.forEach(r=>{Y(i,r)&&!s.includes(r)&&s.push(r)})})}}return s});function x3(s){qa(s,S3())}const E3=[ur,fr,xs,_f,wf,Rf];function Wa(s,e){const t=s.$,n={globalData:s.$options&&s.$options.globalData||{},$vm:s,onLaunch(o){this.$vm=s;const a=t.ctx;this.$vm&&a.$scope&&a.$callHook||(hd(t,{mpType:"app",mpInstance:this,slots:[]}),a.globalData=this.globalData,s.$callHook(If,o))}},i=wx.$onErrorHandlers;i&&(i.forEach(o=>{Is(xs,o,t)}),i.length=0),A3(s);const r=s.$.type;qa(n,E3),gd(n,r);{const o=r.methods;o&&le(n,o)}return n}function T3(s){return function(t){return App(Wa(t))}}function v3(s){return function(t){const n=Wa(t),i=K(getApp)&&getApp({allowDefault:!0});if(!i)return;t.$.ctx.$scope=i;const r=i.globalData;r&&Object.keys(n.globalData).forEach(o=>{Y(r,o)||(r[o]=n.globalData[o])}),Object.keys(n).forEach(o=>{Y(i,o)||(i[o]=n[o])}),md(n,t)}}function md(s,e){if(K(s.onLaunch)){const t=wx.getLaunchOptionsSync&&wx.getLaunchOptionsSync();s.onLaunch(t)}K(s.onShow)&&wx.onAppShow&&wx.onAppShow(t=>{e.$callHook("onShow",t)}),K(s.onHide)&&wx.onAppHide&&wx.onAppHide(t=>{e.$callHook("onHide",t)})}function A3(s){const e=B1(u3());Object.defineProperty(s,"$locale",{get(){return e.value},set(t){e.value=t}})}const yd=["eO","uR","uRIF","uI","uT","uP","uS"];function b3(s,e=!1){const t={};if(!e){let n=function(i){const r=Object.create(null);i&&i.forEach(o=>{r[o]=!0}),this.setData({$slots:r})};yd.forEach(i=>{t[i]={type:null,value:""}}),t.uS={type:null,value:[]},t.uS.observer=n}return s.behaviors&&s.behaviors.includes("wx://form-field")&&((!s.properties||!s.properties.name)&&(t.name={type:null,value:""}),(!s.properties||!s.properties.value)&&(t.value={type:null,value:""})),t}function I3(s){const e={};return s&&s.virtualHost&&(e[Zp]={type:null,value:""},e[eg]={type:null,value:""},e[tg]={type:null,value:""},e[yo]={type:null,value:""}),e}function Sd(s){s.properties||(s.properties={}),le(s.properties,b3(s),I3(s.options))}const _3=[String,Number,Boolean,Object,Array,null];function w3(s,e){return z(s)&&s.length===1?s[0]:s}function _c(s,e){const t=w3(s);return _3.indexOf(t)!==-1?t:null}function R3({properties:s},e){z(e)?e.forEach(t=>{s[t]={type:String,value:""}}):Re(e)&&Object.keys(e).forEach(t=>{const n=e[t];if(Re(n)){let i=n.default;K(i)&&(i=i());const r=n.type;n.type=_c(r),s[t]={type:n.type,value:i}}else s[t]={type:_c(n)}})}function L3(s,e){return(e?C3(s):Ka(s.uP))||{}}function C3(s){const e={};return Re(s)&&Object.keys(s).forEach(t=>{yd.indexOf(t)===-1&&(e[t]=s[t])}),e}function P3(s){const e=s.$options;z(e.behaviors)&&e.behaviors.includes("uni://form-field")&&s.$watch("modelValue",()=>{s.$scope&&s.$scope.setData({name:s.name,value:s.modelValue})},{immediate:!0})}function D3(s){return{}}function xd(s){const e=function(){const n=this.properties.uP;n&&(this.$vm?O3(n,this.$vm.$):this.properties.uT==="m"&&k3(n,this))};s.observers||(s.observers={}),s.observers.uP=e}function k3(s,e){const t=e.properties,n=Ka(s)||{};Ed(t,n,!1)&&e.setData(n)}function O3(s,e){const t=ie(e.props),n=Ka(s)||{};Ed(t,n)&&(Fy(e,n,t,!1),q1(e.update)&&W1(e.update),e.update())}function Ed(s,e,t=!0){const n=Object.keys(e);if(t&&n.length!==Object.keys(s).length)return!0;for(let i=0;i<n.length;i++){const r=n[i];if(e[r]!==s[r])return!0}return!1}function F3(s){const e=s.behaviors;let t=s.props;t||(s.props=t=[]);const n=[];return z(e)&&e.forEach(i=>{n.push(i.replace("uni://","wx://")),i==="uni://form-field"&&(z(t)?(t.push("name"),t.push("modelValue")):(t.name={type:String,default:""},t.modelValue={type:[String,Number,Boolean,Array,Object,Date],default:""}))}),n}function B3(s,e){s.data=D3(),s.behaviors=F3(e)}function Td(s,{parse:e,mocks:t,isPage:n,isPageInProject:i,initRelation:r,handleLink:o,initLifetimes:a}){s=s.default||s;const l={multipleSlots:!0,addGlobalClass:!0,pureDataPattern:/^uP$/};z(s.mixins)&&s.mixins.forEach(u=>{ue(u.options)&&le(l,u.options)}),s.options&&le(l,s.options);const c={options:l,lifetimes:a({mocks:t,isPage:n,initRelation:r,vueOptions:s}),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 B3(c,s),Sd(c),xd(c),i3(c,s),a3(c.methods,s.wxsCallMethods),o3(c.methods,s.methods),e&&e(c,{handleLink:o}),c}function M3(s){return function(t){return Component(Td(t,s))}}let kr,Or;function vd(){return getApp().$vm}function N3(s,e){kr||(kr=vd().$createComponent);const t=kr(s,e);return zn(t.$)||t}function U3(s){return Or||(Or=vd().$destroyComponent),Or(s)}function $3(s,e){const{parse:t,mocks:n,isPage:i,initRelation:r,handleLink:o,initLifetimes:a}=e,l=Td(s,{mocks:n,isPage:i,isPageInProject:!0,initRelation:r,handleLink:o,initLifetimes:a});R3(l,(s.default||s).props);const c=l.methods;return c.onLoad=function(u){return this.options=u,this.$page={fullPath:ng(this.route+lg(u))},this.$vm&&this.$vm.$callHook(Wn,u)},qa(c,m3),gd(c,s),y3(c,s.__runtimeHooks),x3(c),t&&t(l,{handleLink:o}),l}function G3(s){return function(t){return Component($3(t,s))}}function H3(s){return function(t){md(Wa(t),t)}}const j3=Page,K3=Component;function wc(s){const e=s.triggerEvent,t=function(n,...i){return e.apply(s,[og(n),...i])};try{s.triggerEvent=t}catch{s._triggerEvent=t}}function Ad(s,e,t){const n=e[s];n?e[s]=function(...i){return wc(this),n.apply(this,i)}:e[s]=function(){wc(this)}}Page=function(s){return Ad(Wn,s),j3(s)};Component=function(s){return Ad("created",s),s.properties&&s.properties.uP||(Sd(s),xd(s)),K3(s)};function V3({mocks:s,isPage:e,initRelation:t,vueOptions:n}){return{attached(){let i=this.properties;s3(i.uI,this);const r={vuePid:this._$vuePid};t(this,r);const o=this,a=e(o);let l=i;this.$vm=N3({type:n,props:L3(l,a)},{mpType:a?"page":"component",mpInstance:o,slots:i.uS||{},parentComponent:r.parent&&r.parent.$,onBeforeSetup(c,u){c3(c,o),p3(c,o,s),d3(c,u)}}),a||P3(this.$vm)},ready(){this.$vm&&(this.$vm.$callHook("mounted"),this.$vm.$callHook(Ea))},detached(){this.$vm&&(ud(this.$vm.$.uid),U3(this.$vm))}}}const q3=["__route__","__wxExparserNodeId__","__wxWebviewId__"];function W3(s){return!!s.route}function Q3(s,e){s.triggerEvent("__l",e)}function z3(s){const e=s.detail||s.value,t=e.vuePid;let n;t&&(n=fd(this.$vm,t)),n||(n=this.$vm),e.parent=n}var bd=Object.freeze({__proto__:null,handleLink:z3,initLifetimes:V3,initRelation:Q3,isPage:W3,mocks:q3});const Y3=T3(),X3=G3(bd),J3=M3(bd),Z3=H3(),eS=v3();wx.createApp=global.createApp=Y3,wx.createPage=X3,wx.createComponent=J3,wx.createPluginApp=global.createPluginApp=Z3,wx.createSubpackageApp=global.createSubpackageApp=eS;/*!
- * vuex v4.1.0
- * (c) 2022 Evan You
- * @license MIT
- */var Id="store";function tS(s){return s===void 0&&(s=null),Ii(s!==null?s:Id)}function _s(s,e){Object.keys(s).forEach(function(t){return e(s[t],t)})}function sS(s){return s!==null&&typeof s=="object"}function nS(s){return s&&typeof s.then=="function"}function ot(s,e){if(!s)throw new Error("[vuex] "+e)}function iS(s,e){return function(){return s(e)}}function _d(s,e,t){return e.indexOf(s)<0&&(t&&t.prepend?e.unshift(s):e.push(s)),function(){var n=e.indexOf(s);n>-1&&e.splice(n,1)}}function wd(s,e){s._actions=Object.create(null),s._mutations=Object.create(null),s._wrappedGetters=Object.create(null),s._modulesNamespaceMap=Object.create(null);var t=s.state;Er(s,t,[],s._modules.root,!0),Qa(s,t,e)}function Qa(s,e,t){var n=s._state,i=s._scope;s.getters={},s._makeLocalGettersCache=Object.create(null);var r=s._wrappedGetters,o={},a={},l=u1(!0);l.run(function(){_s(r,function(c,u){o[u]=iS(c,s),a[u]=od(function(){return o[u]()}),Object.defineProperty(s.getters,u,{get:function(){return a[u].value},enumerable:!0})})}),s._state=pr({data:e}),s._scope=l,s.strict&&uS(s),n&&t&&s._withCommit(function(){n.data=null}),i&&i.stop()}function Er(s,e,t,n,i){var r=!t.length,o=s._modules.getNamespace(t);if(n.namespaced&&(s._modulesNamespaceMap[o]&&console.error("[vuex] duplicate namespace "+o+" for the namespaced module "+t.join("/")),s._modulesNamespaceMap[o]=n),!r&&!i){var a=za(e,t.slice(0,-1)),l=t[t.length-1];s._withCommit(function(){l in a&&console.warn('[vuex] state field "'+l+'" was overridden by a module with the same name at "'+t.join(".")+'"'),a[l]=n.state})}var c=n.context=rS(s,o,t);n.forEachMutation(function(u,f){var h=o+f;aS(s,h,u,c)}),n.forEachAction(function(u,f){var h=u.root?f:o+f,d=u.handler||u;lS(s,h,d,c)}),n.forEachGetter(function(u,f){var h=o+f;cS(s,h,u,c)}),n.forEachChild(function(u,f){Er(s,e,t.concat(f),u,i)})}function rS(s,e,t){var n=e==="",i={dispatch:n?s.dispatch:function(r,o,a){var l=Ki(r,o,a),c=l.payload,u=l.options,f=l.type;if((!u||!u.root)&&(f=e+f,!s._actions[f])){console.error("[vuex] unknown local action type: "+l.type+", global type: "+f);return}return s.dispatch(f,c)},commit:n?s.commit:function(r,o,a){var l=Ki(r,o,a),c=l.payload,u=l.options,f=l.type;if((!u||!u.root)&&(f=e+f,!s._mutations[f])){console.error("[vuex] unknown local mutation type: "+l.type+", global type: "+f);return}s.commit(f,c,u)}};return Object.defineProperties(i,{getters:{get:n?function(){return s.getters}:function(){return oS(s,e)}},state:{get:function(){return za(s.state,t)}}}),i}function oS(s,e){if(!s._makeLocalGettersCache[e]){var t={},n=e.length;Object.keys(s.getters).forEach(function(i){if(i.slice(0,n)===e){var r=i.slice(n);Object.defineProperty(t,r,{get:function(){return s.getters[i]},enumerable:!0})}}),s._makeLocalGettersCache[e]=t}return s._makeLocalGettersCache[e]}function aS(s,e,t,n){var i=s._mutations[e]||(s._mutations[e]=[]);i.push(function(o){t.call(s,n.state,o)})}function lS(s,e,t,n){var i=s._actions[e]||(s._actions[e]=[]);i.push(function(o){var a=t.call(s,{dispatch:n.dispatch,commit:n.commit,getters:n.getters,state:n.state,rootGetters:s.getters,rootState:s.state},o);return nS(a)||(a=Promise.resolve(a)),s._devtoolHook?a.catch(function(l){throw s._devtoolHook.emit("vuex:error",l),l}):a})}function cS(s,e,t,n){if(s._wrappedGetters[e]){console.error("[vuex] duplicate getter key: "+e);return}s._wrappedGetters[e]=function(r){return t(n.state,n.getters,r.state,r.getters)}}function uS(s){xn(function(){return s._state.data},function(){ot(s._committing,"do not mutate vuex store state outside mutation handlers.")},{deep:!0,flush:"sync"})}function za(s,e){return e.reduce(function(t,n){return t[n]},s)}function Ki(s,e,t){return sS(s)&&s.type&&(t=e,e=s,s=s.type),ot(typeof s=="string","expects string as the type, but found "+typeof s+"."),{type:s,payload:e,options:t}}var at=function(e,t){this.runtime=t,this._children=Object.create(null),this._rawModule=e;var n=e.state;this.state=(typeof n=="function"?n():n)||{}},Rd={namespaced:{configurable:!0}};Rd.namespaced.get=function(){return!!this._rawModule.namespaced};at.prototype.addChild=function(e,t){this._children[e]=t};at.prototype.removeChild=function(e){delete this._children[e]};at.prototype.getChild=function(e){return this._children[e]};at.prototype.hasChild=function(e){return e in this._children};at.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)};at.prototype.forEachChild=function(e){_s(this._children,e)};at.prototype.forEachGetter=function(e){this._rawModule.getters&&_s(this._rawModule.getters,e)};at.prototype.forEachAction=function(e){this._rawModule.actions&&_s(this._rawModule.actions,e)};at.prototype.forEachMutation=function(e){this._rawModule.mutations&&_s(this._rawModule.mutations,e)};Object.defineProperties(at.prototype,Rd);var ws=function(e){this.register([],e,!1)};ws.prototype.get=function(e){return e.reduce(function(t,n){return t.getChild(n)},this.root)};ws.prototype.getNamespace=function(e){var t=this.root;return e.reduce(function(n,i){return t=t.getChild(i),n+(t.namespaced?i+"/":"")},"")};ws.prototype.update=function(e){Ld([],this.root,e)};ws.prototype.register=function(e,t,n){var i=this;n===void 0&&(n=!0),Cd(e,t);var r=new at(t,n);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&&_s(t.modules,function(a,l){i.register(e.concat(l),a,n)})};ws.prototype.unregister=function(e){var t=this.get(e.slice(0,-1)),n=e[e.length-1],i=t.getChild(n);if(!i){console.warn("[vuex] trying to unregister module '"+n+"', which is not registered");return}i.runtime&&t.removeChild(n)};ws.prototype.isRegistered=function(e){var t=this.get(e.slice(0,-1)),n=e[e.length-1];return t?t.hasChild(n):!1};function Ld(s,e,t){if(Cd(s,t),e.update(t),t.modules)for(var n in t.modules){if(!e.getChild(n)){console.warn("[vuex] trying to add a new module '"+n+"' on hot reloading, manual reload is needed");return}Ld(s.concat(n),e.getChild(n),t.modules[n])}}var Rc={assert:function(s){return typeof s=="function"},expected:"function"},fS={assert:function(s){return typeof s=="function"||typeof s=="object"&&typeof s.handler=="function"},expected:'function or object with "handler" function'},Lc={getters:Rc,mutations:Rc,actions:fS};function Cd(s,e){Object.keys(Lc).forEach(function(t){if(e[t]){var n=Lc[t];_s(e[t],function(i,r){ot(n.assert(i),hS(s,t,r,i,n.expected))})}})}function hS(s,e,t,n,i){var r=e+" should be "+i+' but "'+e+"."+t+'"';return s.length>0&&(r+=' in module "'+s.join(".")+'"'),r+=" is "+JSON.stringify(n)+".",r}function dS(s){return new Ve(s)}var Ve=function s(e){var t=this;e===void 0&&(e={}),ot(typeof Promise<"u","vuex requires a Promise polyfill in this browser."),ot(this instanceof s,"store must be called with the new operator.");var n=e.plugins;n===void 0&&(n=[]);var i=e.strict;i===void 0&&(i=!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 ws(e),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._makeLocalGettersCache=Object.create(null),this._scope=null,this._devtools=r;var o=this,a=this,l=a.dispatch,c=a.commit;this.dispatch=function(h,d){return l.call(o,h,d)},this.commit=function(h,d,p){return c.call(o,h,d,p)},this.strict=i;var u=this._modules.root.state;Er(this,u,[],this._modules.root),Qa(this,u),n.forEach(function(f){return f(t)})},Ya={state:{configurable:!0}};Ve.prototype.install=function(e,t){e.provide(t||Id,this),e.config.globalProperties.$store=this,this._devtools!==void 0&&this._devtools};Ya.state.get=function(){return this._state.data};Ya.state.set=function(s){ot(!1,"use store.replaceState() to explicit replace store state.")};Ve.prototype.commit=function(e,t,n){var i=this,r=Ki(e,t,n),o=r.type,a=r.payload,l=r.options,c={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(c,i.state)}),l&&l.silent&&console.warn("[vuex] mutation type: "+o+". Silent option has been removed. Use the filter functionality in the vue-devtools")};Ve.prototype.dispatch=function(e,t){var n=this,i=Ki(e,t),r=i.type,o=i.payload,a={type:r,payload:o},l=this._actions[r];if(!l){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,n.state)})}catch(u){console.warn("[vuex] error in before action subscribers: "),console.error(u)}var c=l.length>1?Promise.all(l.map(function(u){return u(o)})):l[0](o);return new Promise(function(u,f){c.then(function(h){try{n._actionSubscribers.filter(function(d){return d.after}).forEach(function(d){return d.after(a,n.state)})}catch(d){console.warn("[vuex] error in after action subscribers: "),console.error(d)}u(h)},function(h){try{n._actionSubscribers.filter(function(d){return d.error}).forEach(function(d){return d.error(a,n.state,h)})}catch(d){console.warn("[vuex] error in error action subscribers: "),console.error(d)}f(h)})})};Ve.prototype.subscribe=function(e,t){return _d(e,this._subscribers,t)};Ve.prototype.subscribeAction=function(e,t){var n=typeof e=="function"?{before:e}:e;return _d(n,this._actionSubscribers,t)};Ve.prototype.watch=function(e,t,n){var i=this;return ot(typeof e=="function","store.watch only accepts a function."),xn(function(){return e(i.state,i.getters)},t,Object.assign({},n))};Ve.prototype.replaceState=function(e){var t=this;this._withCommit(function(){t._state.data=e})};Ve.prototype.registerModule=function(e,t,n){n===void 0&&(n={}),typeof e=="string"&&(e=[e]),ot(Array.isArray(e),"module path must be a string or an Array."),ot(e.length>0,"cannot register the root module by using registerModule."),this._modules.register(e,t),Er(this,this.state,e,this._modules.get(e),n.preserveState),Qa(this,this.state)};Ve.prototype.unregisterModule=function(e){var t=this;typeof e=="string"&&(e=[e]),ot(Array.isArray(e),"module path must be a string or an Array."),this._modules.unregister(e),this._withCommit(function(){var n=za(t.state,e.slice(0,-1));delete n[e[e.length-1]]}),wd(this)};Ve.prototype.hasModule=function(e){return typeof e=="string"&&(e=[e]),ot(Array.isArray(e),"module path must be a string or an Array."),this._modules.isRegistered(e)};Ve.prototype.hotUpdate=function(e){this._modules.update(e),wd(this,!0)};Ve.prototype._withCommit=function(e){var t=this._committing;this._committing=!0,e(),this._committing=t};Object.defineProperties(Ve.prototype,Ya);const Pd=s=>s;function pS(s){return/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(s)}function gS(s){return/^1[23456789]\d{9}$/.test(s)}function mS(s){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(s)}function yS(s){if(!s)return!1;if(typeof s=="number")return s.toString().length!==10&&s.toString().length!==13?!1:!isNaN(new Date(s).getTime());if(typeof s=="string"){const e=Number(s);if(!isNaN(e)&&(e.toString().length===10||e.toString().length===13))return!isNaN(new Date(e).getTime());if(s.length<10||s.length>19||!/^\d{4}[-\/]\d{2}[-\/]\d{2}( \d{1,2}:\d{2}(:\d{2})?)?$/.test(s))return!1;const n=new Date(s);return!isNaN(n.getTime())}return!1}function SS(s){return/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(s)}function Vi(s){return/^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(s)}function xS(s){return typeof s=="string"}function ES(s){return/^\d+$/.test(s)}function TS(s){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(s)}function vS(s){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 s.length===7?t.test(s):s.length===8?e.test(s):!1}function AS(s){return/^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(s)}function bS(s){return/^[\u4e00-\u9fa5]+$/gi.test(s)}function IS(s){return/^[a-zA-Z]*$/.test(s)}function _S(s){return/^[0-9a-zA-Z]*$/g.test(s)}function wS(s,e){return s.indexOf(e)>=0}function RS(s,e){return s>=e[0]&&s<=e[1]}function LS(s,e){return s.length>=e[0]&&s.length<=e[1]}function CS(s){return/^\d{3,4}-\d{7,8}(-\d{3,4})?$/.test(s)}function qo(s){switch(typeof s){case"undefined":return!0;case"string":if(s.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g,"").length==0)return!0;break;case"boolean":if(!s)return!0;break;case"number":if(s===0||isNaN(s))return!0;break;case"object":if(s===null||s.length===0)return!0;for(const e in s)return!1;return!0}return!1}function PS(s){if(typeof s=="string")try{const e=JSON.parse(s);return!!(typeof e=="object"&&e)}catch{return!1}return!1}function Dd(s){return typeof Array.isArray=="function"?Array.isArray(s):Object.prototype.toString.call(s)==="[object Array]"}function DS(s){return Object.prototype.toString.call(s)==="[object Object]"}function kS(s){return Object.prototype.toString.call(s)==="[object Promise]"}function OS(s,e=6){return new RegExp(`^\\d{${e}}$`).test(s)}function Wo(s){return typeof s=="function"}function FS(s){return kS(s)&&Wo(s.then)&&Wo(s.catch)}function BS(s){const e=s.split("?")[0];return/\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i.test(e)}function MS(s){return/\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i.test(s)}function NS(s){return s&&Object.prototype.toString.call(s)==="[object RegExp]"}const kd={email:pS,mobile:gS,url:mS,date:yS,dateISO:SS,number:Vi,digits:ES,idCard:TS,carNo:vS,amount:AS,chinese:bS,letter:IS,enOrNum:_S,contains:wS,range:RS,rangeLength:LS,empty:qo,isEmpty:qo,jsonString:PS,landline:CS,object:DS,array:Dd,code:OS,func:Wo,promise:FS,video:MS,image:BS,regExp:NS,string:xS};function Od(s,e=15){return+parseFloat(Number(s).toPrecision(e))}function Dn(s){const e=s.toString().split(/[eE]/),t=(e[0].split(".")[1]||"").length-+(e[1]||0);return t>0?t:0}function qi(s){if(s.toString().indexOf("e")===-1)return Number(s.toString().replace(".",""));const e=Dn(s);return e>0?Od(Number(s)*Math.pow(10,e)):Number(s)}function Qo(s){(s>Number.MAX_SAFE_INTEGER||s<Number.MIN_SAFE_INTEGER)&&console.warn(`${s} 超出了精度限制,结果可能不正确`)}function Fd(s,e){const[t,n,...i]=s;let r=e(t,n);return i.forEach(o=>{r=e(r,o)}),r}function Wi(...s){if(s.length>2)return Fd(s,Wi);const[e,t]=s,n=qi(e),i=qi(t),r=Dn(e)+Dn(t),o=n*i;return Qo(o),o/Math.pow(10,r)}function Bd(...s){if(s.length>2)return Fd(s,Bd);const[e,t]=s,n=qi(e),i=qi(t);return Qo(n),Qo(i),Wi(n/i,Od(Math.pow(10,Dn(t)-Dn(e))))}function US(s,e){const t=Math.pow(10,e);let n=Bd(Math.round(Math.abs(Wi(s,t))),t);return s<0&&n!==0&&(n=Wi(n,-1)),n}const zo="3";console.log(`
- %c uview-plus V${zo} %c https://ijry.github.io/uview-plus/
- `,"color: #ffffff; background: #3c9cff; padding:5px 0;","color: #3c9cff;background: #ffffff; padding:5px 0;");const Rs={v:zo,version:zo,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 $S(s=0,e=0,t=0){return Math.max(s,Math.min(e,Number(t)))}function GS(s,e=!1){return Vi(s)?e?`${s}px`:Number(s):/(rpx|upx)$/.test(s)?e?`${W.upx2px(parseInt(s))}px`:Number(W.upx2px(parseInt(s))):e?`${parseInt(s)}px`:parseInt(s)}function HS(s=30){return new Promise(e=>{setTimeout(()=>{e()},s)})}function jS(){return W.getDeviceInfo().platform.toLowerCase()}function Md(){return W.getSystemInfoSync()}function KS(){let s={};return s=Md(),s}function VS(s,e){if(s>=0&&e>0&&e>=s){const t=e-s+1;return Math.floor(Math.random()*t+s)}return 0}function qS(s=32,e=!0,t=null){const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[];if(t=t||n.length,s)for(let r=0;r<s;r++)i[r]=n[0|Math.random()*t];else{let r;i[8]=i[13]=i[18]=i[23]="-",i[14]="4";for(let o=0;o<36;o++)i[o]||(r=0|Math.random()*16,i[o]=n[o==19?r&3|8:r])}return e?(i.shift(),`u${i.join("")}`):i.join("")}function Qi(s=void 0){let e=this.$parent;for(;e;)if(s=s.replace(/up-([a-zA-Z0-9-_]+)/g,"u-$1"),e.$options&&e.$options.name!==s)e=e.$parent;else return e;return!1}function WS(s,e="object"){if(qo(s)||typeof s=="object"&&e==="object"||e==="string"&&typeof s=="string")return s;if(e==="object"){s=gn(s);const n=s.split(";"),i={};for(let r=0;r<n.length;r++)if(n[r]){const o=n[r].split(":");i[gn(o[0])]=gn(o[1])}return i}let t="";return typeof s=="object"&&s.forEach((n,i)=>{const r=i.replace(/([A-Z])/g,"-$1").toLowerCase();t+=`${r}:${n};`}),gn(t)}function QS(s="auto",e=""){return e||(e=Rs.unit||"px"),e=="rpx"&&Vi(String(s))&&(s=s*2),s=String(s),Vi(s)?`${s}${e}`:s}function Xa(s){if([null,void 0,NaN,!1].includes(s)||typeof s!="object"&&typeof s!="function")return s;const e=Dd(s)?[]:{};for(const t in s)s.hasOwnProperty(t)&&(e[t]=typeof s[t]=="object"?Xa(s[t]):s[t]);return e}function kn(s={},e={}){let t=Xa(s);if(typeof t!="object"||typeof e!="object")return!1;for(const n in e)e.hasOwnProperty(n)&&(n in t?e[n]==null||typeof t[n]!="object"||typeof e[n]!="object"?t[n]=e[n]:t[n].concat&&e[n].concat?t[n]=t[n].concat(e[n]):t[n]=kn(t[n],e[n]):t[n]=e[n]);return t}function Us(s,e={}){if(typeof s!="object"||typeof e!="object")return!1;for(const t in e)e.hasOwnProperty(t)&&(t in s?e[t]==null||typeof s[t]!="object"||typeof e[t]!="object"?s[t]=e[t]:s[t].concat&&e[t].concat?s[t]=s[t].concat(e[t]):s[t]=Us(s[t],e[t]):s[t]=e[t]);return s}function zS(s){console.error(`uView提示:${s}`)}function YS(s=[]){return s.sort(()=>Math.random()-.5)}String.prototype.padStart||(String.prototype.padStart=function(s,e=" "){if(Object.prototype.toString.call(e)!=="[object String]")throw new TypeError("fillString must be String");const t=this;if(t.length>=s)return String(t);const n=s-t.length;let i=Math.ceil(n/e.length);for(;i>>=1;)e+=e,i===1&&(e+=e);return e.slice(0,n)+t});function Nd(s=null,e="yyyy-mm-dd"){let t;s?/^\d{10}$/.test(s.toString().trim())?t=new Date(s*1e3):typeof s=="string"&&/^\d+$/.test(s.trim())?t=new Date(Number(s)):typeof s=="string"&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(s)?t=new Date(s):t=new Date(typeof s=="string"?s.replace(/-/g,"/"):s):t=new Date;const n={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 i in n){const[r]=new RegExp(`${i}+`).exec(e)||[];if(r){const o=i==="y"&&r.length===2?2:0;e=e.replace(r,n[i].slice(o))}}return e}function XS(s=null,e="yyyy-mm-dd"){s==null&&(s=Number(new Date)),s=parseInt(s),s.toString().length==10&&(s*=1e3);let t=new Date().getTime()-s;t=parseInt(t/1e3);let n="";switch(!0){case t<300:n="刚刚";break;case(t>=300&&t<3600):n=`${parseInt(t/60)}分钟前`;break;case(t>=3600&&t<86400):n=`${parseInt(t/3600)}小时前`;break;case(t>=86400&&t<2592e3):n=`${parseInt(t/86400)}天前`;break;default:e===!1?t>=2592e3&&t<365*86400?n=`${parseInt(t/(86400*30))}个月前`:n=`${parseInt(t/(86400*365))}年前`:n=Nd(s,e)}return n}function gn(s,e="both"){return s=String(s),e=="both"?s.replace(/^\s+|\s+$/g,""):e=="left"?s.replace(/^\s*/,""):e=="right"?s.replace(/(\s*$)/g,""):e=="all"?s.replace(/\s+/g,""):s}function Yo(s={},e=!0,t="brackets"){const n=e?"?":"",i=[];["indices","brackets","repeat","comma"].indexOf(t)==-1&&(t="brackets");for(const r in s){const o=s[r];if(!(["",void 0,null].indexOf(o)>=0))if(o.constructor===Array)switch(t){case"indices":for(let l=0;l<o.length;l++)i.push(`${r}[${l}]=${o[l]}`);break;case"brackets":o.forEach(l=>{i.push(`${r}[]=${l}`)});break;case"repeat":o.forEach(l=>{i.push(`${r}=${l}`)});break;case"comma":let a="";o.forEach(l=>{a+=(a?",":"")+l}),i.push(`${r}=${a}`);break;default:o.forEach(l=>{i.push(`${r}[]=${l}`)})}else i.push(`${r}=${o}`)}return i.length?n+i.join("&"):""}function JS(s,e=2e3){W.showToast({title:String(s),icon:"none",duration:e})}function ZS(s="success",e=!1){["primary","info","error","warning","success"].indexOf(s)==-1&&(s="success");let t="";switch(s){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 ex(s,e=0,t=".",n=","){s=`${s}`.replace(/[^0-9+-Ee.]/g,"");const i=isFinite(+s)?+s:0,r=isFinite(+e)?Math.abs(e):0,o=typeof n>"u"?",":n,a=typeof t>"u"?".":t;let l="";l=(r?US(i,r)+"":`${Math.round(i)}`).split(".");const c=/(-?\d+)(\d{3})/;for(;c.test(l[0]);)l[0]=l[0].replace(c,`$1${o}$2`);return(l[1]||"").length<r&&(l[1]=l[1]||"",l[1]+=new Array(r-l[1].length+1).join("0")),l.join(a)}function tx(s,e=!0){const t=parseInt(s);return e?/s$/.test(s)?s:s>30?`${s}ms`:`${s}s`:/ms$/.test(s)?t:/s$/.test(s)?t>30?t:t*1e3:t}function sx(s){return`00${s}`.slice(-2)}function nx(s,e){const t=Qi.call(s,"u-form-item"),n=Qi.call(s,"u-form");t&&n&&n.validateField(t.prop,()=>{},e)}function ix(s,e){if(typeof s!="object"||s==null||typeof e!="string"||e==="")return"";if(e.indexOf(".")!==-1){const t=e.split(".");let n=s[t[0]]||{};for(let i=1;i<t.length;i++)n&&(n=n[t[i]]);return n}return s[e]}function rx(s,e,t){if(typeof s!="object"||s==null)return;const n=function(i,r,o){if(r.length===1){i[r[0]]=o;return}for(;r.length>1;){const a=r[0];(!i[a]||typeof i[a]!="object")&&(i[a]={}),r.shift(),n(i[a],r,o)}};if(!(typeof e!="string"||e===""))if(e.indexOf(".")!==-1){const i=e.split(".");n(s,i,t)}else s[e]=t}function Ud(){const s=getCurrentPages();return`/${s[s.length-1].route||""}`}function ox(){return getCurrentPages()}function ax(s,e){return e.split(".").reduce((n,i)=>n&&n[i]!==void 0?n[i]:void 0,s)}function lx(s,e=95){const t=cx(s),n=ux(t.r,t.g,t.b),i={h:n.h,s:n.s,l:Math.min(e,95)};return fx(i.h,i.s,i.l)}function cx(s){const e=s.toLowerCase().trim();if(e.startsWith("#")){const n=e.replace("#",""),i=n.length===3?n.split("").map(r=>r+r).join(""):n;return{r:parseInt(i.substring(0,2),16),g:parseInt(i.substring(2,4),16),b:parseInt(i.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 ux(s,e,t){s/=255,e/=255,t/=255;const n=Math.max(s,e,t),i=Math.min(s,e,t);let r,o,a=(n+i)/2;if(n===i)r=o=0;else{const l=n-i;switch(o=a>.5?l/(2-n-i):l/(n+i),n){case s:r=(e-t)/l+(e<t?6:0);break;case e:r=(t-s)/l+2;break;case t:r=(s-e)/l+4;break}r=(r*60).toFixed(1)}return{h:+r,s:+(o*100).toFixed(1),l:+(a*100).toFixed(1)}}function fx(s,e,t){t/=100;const n=e*Math.min(t,1-t)/100,i=r=>{const o=(r+s/30)%12,a=t-n*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*a).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}const ls={range:$S,getPx:GS,sleep:HS,os:jS,sys:Md,getWindowInfo:KS,random:VS,guid:qS,$parent:Qi,addStyle:WS,addUnit:QS,deepClone:Xa,deepMerge:kn,shallowMerge:Us,error:zS,randomArray:YS,timeFormat:Nd,timeFrom:XS,trim:gn,queryParams:Yo,toast:JS,type2icon:ZS,priceFormat:ex,getDuration:tx,padZero:sx,formValidate:nx,getProperty:ix,setProperty:rx,page:Ud,pages:ox,getValueByPath:ax,genLightColor:lx};class hx{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 n="";return/.*\/.*\?.*=.*/.test(e)?(n=Yo(t,!1),e+=`&${n}`):(n=Yo(t),e+=n)}async route(e={},t={}){let n={};typeof e=="string"?(n.url=this.mixinParam(e,t),n.type="navigateTo"):(n=kn(this.config,e),n.url=this.mixinParam(e.url,e.params)),n.url!==Ud()&&(t.intercept&&(this.config.intercept=t.intercept),n.params=t,n=kn(this.config,n),typeof W.$u.routeIntercept=="function"?await new Promise((r,o)=>{W.$u.routeIntercept(n,r)})&&this.openPage(n):this.openPage(n))}openPage(e){const{url:t,type:n,delta:i,animationType:r,animationDuration:o}=e;(e.type=="navigateTo"||e.type=="to")&&W.navigateTo({url:t,animationType:r,animationDuration:o}),(e.type=="redirectTo"||e.type=="redirect")&&W.redirectTo({url:t}),(e.type=="switchTab"||e.type=="tab")&&W.switchTab({url:t}),(e.type=="reLaunch"||e.type=="launch")&&W.reLaunch({url:t}),(e.type=="navigateBack"||e.type=="back")&&W.navigateBack({delta:i})}}const Xo=new hx().route,$d=Pd({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 kn(W.$u,{props:void 0,http:void 0,mixin:void 0})},bem(){return function(s,e,t){const n=`u-${s}--`,i={};return e&&e.map(r=>{i[n+this[r]]=!0}),t&&t.map(r=>{this[r]?i[n+r]=this[r]:delete i[n+r]}),Object.keys(i)}}},methods:{openPage(s="url"){const e=this[s];e&&Xo({type:this.linkType,url:e})},navTo(s="",e="navigateTo"){Xo({type:this.linkType,url:s})},$uGetRect(s,e){return new Promise(t=>{W.createSelectorQuery().in(this)[e?"selectAll":"select"](s).boundingClientRect(n=>{e&&Array.isArray(n)&&n.length&&t(n),!e&&n&&t(n)}).exec()})},getParentData(s=""){this.parent||(this.parent={}),this.parent=Qi.call(this,s),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(s){s&&typeof s.stopPropagation=="function"&&s.stopPropagation()},noop(s){this.preventEvent(s)}},onReachBottom(){W.$emit("uOnReachBottom")},beforeUnmount(){if(this.parent&&kd.array(this.parent.children)){const s=this.parent.children;s.map((e,t)=>{e===this&&s.splice(t,1)})}}}),dx=Pd({options:{virtualHost:!0}});function px(s="rgb(0, 0, 0)",e="rgb(255, 255, 255)",t=10){const n=Jo(s,!1),i=n[0],r=n[1],o=n[2],a=Jo(e,!1),l=a[0],c=a[1],u=a[2],f=(l-i)/t,h=(c-r)/t,d=(u-o)/t,p=[];for(let m=0;m<t;m++){let g=Tn(`rgb(${Math.round(f*m+i)},${Math.round(h*m+r)},${Math.round(d*m+o)})`);m===0&&(g=Tn(s)),m===t-1&&(g=Tn(e)),p.push(g)}return p}function Jo(s,e=!0){const t=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;if(s=String(s).toLowerCase(),s&&t.test(s)){if(s.length===4){let i="#";for(let r=1;r<4;r+=1)i+=s.slice(r,r+1).concat(s.slice(r,r+1));s=i}const n=[];for(let i=1;i<7;i+=2)n.push(parseInt(`0x${s.slice(i,i+2)}`));return e?`rgb(${n[0]},${n[1]},${n[2]})`:n}return/^(rgb|RGB)/.test(s)?s.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",").map(i=>Number(i)):s}function Tn(s){const e=s,t=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;if(/^(rgb|RGB)/.test(e)){const n=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",");let i="#";for(let r=0;r<n.length;r++){let o=Number(n[r]).toString(16);o=String(o).length==1?`0${o}`:o,o==="0"&&(o+=o),i+=o}return i.length!==7&&(i=e),i}if(t.test(e)){const n=e.replace(/#/,"").split("");if(n.length===6)return e;if(n.length===3){let i="#";for(let r=0;r<n.length;r+=1)i+=n[r]+n[r];return i}}else return e}function gx(s,e){s=Tn(s);const t=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;let n=String(s).toLowerCase();if(n&&t.test(n)){if(n.length===4){let r="#";for(let o=1;o<4;o+=1)r+=n.slice(o,o+1).concat(n.slice(o,o+1));n=r}const i=[];for(let r=1;r<7;r+=2)i.push(parseInt(`0x${n.slice(r,r+2)}`));return`rgba(${i.join(",")},${e})`}return n}const li={colorGradient:px,hexToRgb:Jo,rgbToHex:Tn,colorToRgba:gx};let Ps=null;function mx(s,e=500,t=!1){if(Ps!==null&&clearTimeout(Ps),t){const n=!Ps;Ps=setTimeout(()=>{Ps=null},e),n&&typeof s=="function"&&s()}else Ps=setTimeout(()=>{typeof s=="function"&&s()},e)}let Ds;function yx(s,e=500,t=!0){t?Ds||(Ds=!0,typeof s=="function"&&s(),setTimeout(()=>{Ds=!1},e)):Ds||(Ds=!0,setTimeout(()=>{Ds=!1,typeof s=="function"&&s()},e))}function Sx(s,e){var t,n,i;try{t=s.toString().split(".")[1].length}catch{t=0}try{n=e.toString().split(".")[1].length}catch{n=0}return i=Math.pow(10,Math.max(t,n)),(s*i+e*i)/i}function xx(s,e){var t,n,i,r;try{t=s.toString().split(".")[1].length}catch{t=0}try{n=e.toString().split(".")[1].length}catch{n=0}return i=Math.pow(10,Math.max(t,n)),r=t>=n?t:n,Math.abs(((s*i-e*i)/i).toFixed(r))}function Ex(s,e){var t=0,n=s.toString(),i=e.toString();try{t+=n.split(".")[1].length}catch{}try{t+=i.split(".")[1].length}catch{}return Number(n.replace(".",""))*Number(i.replace(".",""))/Math.pow(10,t)}function Tx(s,e){var t,n,i=0,r=0;try{i=s.toString().split(".")[1].length}catch{}try{r=e.toString().split(".")[1].length}catch{}return t=Number(s.toString().replace(".","")),n=Number(e.toString().replace(".","")),xyutil.mul(t/n,Math.pow(10,r-i))}const vx={add:Sx,sub:xx,mul:Ex,div:Tx},Ja={toast:10090,noNetwork:10080,popup:10075,mask:10070,navbar:980,topTips:975,sticky:970,indexListSticky:965},Tr={primary:"#3c9cff",info:"#909399",default:"#909399",warning:"#f9ae3d",error:"#f56c6c",success:"#5ac725",mainColor:"#303133",contentColor:"#606266",tipsColor:"#909399",lightColor:"#c0c4cc",borderColor:"#e4e7ed"},{toString:Gd}=Object.prototype;function Hd(s){return Gd.call(s)==="[object Array]"}function Ax(s){return s!==null&&typeof s=="object"}function bx(s){return Gd.call(s)==="[object Date]"}function Ix(s){return typeof URLSearchParams<"u"&&s instanceof URLSearchParams}function Zo(s,e){if(!(s===null||typeof s>"u"))if(typeof s!="object"&&(s=[s]),Hd(s))for(let t=0,n=s.length;t<n;t++)e.call(null,s[t],t,s);else for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&e.call(null,s[t],t,s)}function _x(s){return Object.prototype.toString.call(s)==="[object Object]"}function ea(){const s={};function e(t,n){typeof s[n]=="object"&&typeof t=="object"?s[n]=ea(s[n],t):typeof t=="object"?s[n]=ea({},t):s[n]=t}for(let t=0,n=arguments.length;t<n;t++)Zo(arguments[t],e);return s}function zi(s){return typeof s>"u"}function Cc(s){return encodeURIComponent(s).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Rx(s,e){if(!e)return s;let t;if(Ix(e))t=e.toString();else{const n=[];Zo(e,(i,r)=>{i===null||typeof i>"u"||(Hd(i)?r=`${r}[]`:i=[i],Zo(i,o=>{bx(o)?o=o.toISOString():Ax(o)&&(o=JSON.stringify(o)),n.push(`${Cc(r)}=${Cc(o)}`)}))}),t=n.join("&")}if(t){const n=s.indexOf("#");n!==-1&&(s=s.slice(0,n)),s+=(s.indexOf("?")===-1?"?":"&")+t}return s}function Lx(s){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function Cx(s,e){return e?`${s.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`:s}function Px(s,e){return s&&!Lx(e)?Cx(s,e):e}function Dx(s,e,t){const{validateStatus:n}=t.config,i=t.statusCode;i&&(!n||n(i))?s(t):e(t)}const Pc=(s,e)=>{const t={};return s.forEach(n=>{zi(e[n])||(t[n]=e[n])}),t},kx=s=>new Promise((e,t)=>{const n=Rx(Px(s.baseURL,s.url),s.params),i={url:n,header:s.header,complete:o=>{s.fullPath=n,o.config=s;try{typeof o.data=="string"&&(o.data=JSON.parse(o.data))}catch{}Dx(e,t,o)}};let r;if(s.method==="UPLOAD"){delete i.header["content-type"],delete i.header["Content-Type"];const o={filePath:s.filePath,name:s.name},a=["formData"];r=W.uploadFile({...i,...o,...Pc(a,s)})}else if(s.method==="DOWNLOAD")r=W.downloadFile(i);else{const o=["data","method","timeout","dataType","responseType"];r=W.request({...i,...Pc(o,s)})}s.getTask&&s.getTask(r,s)}),Ox=s=>kx(s);function On(){this.handlers=[]}On.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1};On.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};On.prototype.forEach=function(e){this.handlers.forEach(t=>{t!==null&&e(t)})};const Dc=(s,e,t)=>{const n={};return s.forEach(i=>{zi(t[i])?zi(e[i])||(n[i]=e[i]):n[i]=t[i]}),n},Fx=(s,e={})=>{const t=e.method||s.method||"GET";let n={baseURL:s.baseURL||"",method:t,url:e.url||"",params:e.params||{},custom:{...s.custom||{},...e.custom||{}},header:ea(s.header||{},e.header||{})};return n={...n,...Dc(["getTask","validateStatus"],s,e)},t==="DOWNLOAD"||(t==="UPLOAD"?(delete n.header["content-type"],delete n.header["Content-Type"],["filePath","name","formData"].forEach(o=>{zi(e[o])||(n[o]=e[o])})):n={...n,...Dc(["data","timeout","dataType","responseType"],s,e)}),n},Bx={baseURL:"",header:{},method:"GET",dataType:"json",responseType:"text",custom:{},timeout:6e4,validateStatus:function(e){return e>=200&&e<300}};var Mx=function(){function s(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 n;try{n=Promise}catch{n=function(){}}function i(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 E(x,T){if(x===null)return null;if(T===0)return x;var v,A;if(typeof x!="object")return x;if(s(x,e))v=new e;else if(s(x,t))v=new t;else if(s(x,n))v=new n(function(F,U){x.then(function(k){F(E(k,T-1))},function(k){U(E(k,T-1))})});else if(i.__isArray(x))v=[];else if(i.__isRegExp(x))v=new RegExp(x.source,c(x)),x.lastIndex&&(v.lastIndex=x.lastIndex);else if(i.__isDate(x))v=new Date(x.getTime());else{if(y&&Buffer.isBuffer(x))return Buffer.from?v=Buffer.from(x):(v=new Buffer(x.length),x.copy(v)),v;s(x,Error)?v=Object.create(x):typeof d>"u"?(A=Object.getPrototypeOf(x),v=Object.create(A)):(v=Object.create(d),A=d)}if(f){var b=m.indexOf(x);if(b!=-1)return g[b];m.push(x),g.push(v)}s(x,e)&&x.forEach(function(F,U){var k=E(U,T-1),G=E(F,T-1);v.set(k,G)}),s(x,t)&&x.forEach(function(F){var U=E(F,T-1);v.add(U)});for(var I in x){var C=Object.getOwnPropertyDescriptor(x,I);C&&(v[I]=E(x[I],T-1));try{var _=Object.getOwnPropertyDescriptor(x,I);if(_.set==="undefined")continue;v[I]=E(x[I],T-1)}catch(F){if(F instanceof TypeError)continue;if(F instanceof ReferenceError)continue}}if(Object.getOwnPropertySymbols)for(var D=Object.getOwnPropertySymbols(x),I=0;I<D.length;I++){var H=D[I],V=Object.getOwnPropertyDescriptor(x,H);V&&!V.enumerable&&!p||(v[H]=E(x[H],T-1),Object.defineProperty(v,H,V))}if(p)for(var $=Object.getOwnPropertyNames(x),I=0;I<$.length;I++){var B=$[I],V=Object.getOwnPropertyDescriptor(x,B);V&&V.enumerable||(v[B]=E(x[B],T-1),Object.defineProperty(v,B,V))}return v}return E(u,h)}i.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)}i.__objToStr=r;function o(u){return typeof u=="object"&&r(u)==="[object Date]"}i.__isDate=o;function a(u){return typeof u=="object"&&r(u)==="[object Array]"}i.__isArray=a;function l(u){return typeof u=="object"&&r(u)==="[object RegExp]"}i.__isRegExp=l;function c(u){var f="";return u.global&&(f+="g"),u.ignoreCase&&(f+="i"),u.multiline&&(f+="m"),f}return i.__getRegExpFlags=c,i}();class Nx{constructor(e={}){_x(e)||(e={},console.warn("设置全局参数必须接收一个Object")),this.config=Mx({...Bx,...e}),this.interceptors={request:new On,response:new On}}setConfig(e){this.config=e(this.config)}middleware(e){e=Fx(this.config,e);const t=[Ox,void 0];let n=Promise.resolve(e);for(this.interceptors.request.forEach(i=>{t.unshift(i.fulfilled,i.rejected)}),this.interceptors.response.forEach(i=>{t.push(i.fulfilled,i.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n}request(e={}){return this.middleware(e)}get(e,t={}){return this.middleware({url:e,method:"GET",...t})}post(e,t,n={}){return this.middleware({url:e,data:t,method:"POST",...n})}put(e,t,n={}){return this.middleware({url:e,data:t,method:"PUT",...n})}delete(e,t,n={}){return this.middleware({url:e,data:t,method:"DELETE",...n})}connect(e,t,n={}){return this.middleware({url:e,data:t,method:"CONNECT",...n})}head(e,t,n={}){return this.middleware({url:e,data:t,method:"HEAD",...n})}options(e,t,n={}){return this.middleware({url:e,data:t,method:"OPTIONS",...n})}trace(e,t,n={}){return this.middleware({url:e,data:t,method:"TRACE",...n})}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 Za=new Nx,Ux={actionSheet:{show:!1,title:"",description:"",actions:[],index:"",cancelText:"",closeOnClickAction:!0,safeAreaInsetBottom:!0,openType:"",closeOnClickOverlay:!0,round:0,wrapMaxHeight:"600px"}},$x={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}},Gx={alert:{title:"",type:"warning",description:"",closable:!1,showIcon:!1,effect:"light",center:!1,fontSize:14,transitionMode:"fade",duration:0,icon:"",value:!0}},Hx={avatar:{src:"",shape:"circle",size:40,mode:"scaleToFill",text:"",bgColor:"#c0c4cc",color:"#ffffff",fontSize:18,icon:"",mpAvatar:!1,randomBgColor:!1,defaultUrl:"",colorIndex:"",name:""}},jx={avatarGroup:{urls:[],maxCount:5,shape:"circle",mode:"scaleToFill",showMore:!0,size:40,keyName:"",gap:.5,extraValue:0}},Kx={backtop:{mode:"circle",icon:"arrow-upward",text:"",duration:100,scrollTop:0,top:400,bottom:100,right:20,zIndex:9,iconStyle:{color:"#909399",fontSize:"19px"}}},Vx={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}},qx={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}},Wx={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:"该日期已禁用"}},Qx={carKeyboard:{random:!1}},zx={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"}},Yx={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:""}},Xx={cellGroup:{title:"",border:!0,customStyle:{}}},Jx={checkbox:{name:"",shape:"",size:"",checkbox:!1,disabled:"",activeColor:"",inactiveColor:"",iconSize:"",iconColor:"",label:"",labelSize:"",labelColor:"",labelDisabled:""}},Zx={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}},eE={circleProgress:{percentage:30}},tE={code:{seconds:60,startText:"获取验证码",changeText:"X秒重新获取",endText:"重新获取",keepRunning:!1,uniqueKey:""}},sE={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}},nE={col:{span:12,offset:0,justify:"start",align:"stretch",textAlign:"left"}},iE={collapse:{value:null,accordion:!1,border:!0}},rE={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:""}},oE={columnNotice:{text:"",icon:"volume",mode:"",color:"#f9ae3d",bgColor:"#fdf6ec",fontSize:14,speed:80,step:!1,duration:1500,disableTouch:!0,justifyContent:"flex-start"}},aE={countDown:{time:0,format:"HH:mm:ss",autoStart:!0,millisecond:!1}},lE={countTo:{startVal:0,endVal:0,duration:2e3,autoplay:!0,decimals:0,useEasing:!0,decimal:".",color:"#606266",fontSize:22,bold:!1,separator:""}},cE={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:{}}},uE={divider:{dashed:!1,hairline:!0,dot:!1,textPosition:"center",text:"",textSize:14,textColor:"#909399",lineColor:"#dcdfe6"}},fE={empty:{icon:"",text:"",textColor:"#c0c4cc",textSize:14,iconColor:"#c0c4cc",iconSize:90,mode:"data",width:160,height:160,show:!0,marginTop:0}},hE={form:{model:{},rules:{},errorType:"message",borderBottom:!0,labelPosition:"left",labelWidth:45,labelAlign:"left",labelStyle:{}}},dE={formItem:{label:"",prop:"",rules:[],borderBottom:"",labelPosition:"",labelWidth:"",rightIcon:"",leftIcon:"",required:!1,leftIconStyle:""}},pE={gap:{bgColor:"transparent",height:20,marginTop:0,marginBottom:0,customStyle:{}}},gE={grid:{col:3,border:!1,align:"left"}},mE={gridItem:{name:null,bgColor:"transparent"}},{color:kc}=Rs,yE={icon:{name:"",color:kc["u-content-color"],size:"16px",bold:!1,index:"",hoverClass:"",customPrefix:"uicon",label:"",labelPos:"right",labelSize:"15px",labelColor:kc["u-content-color"],space:"3px",imgMode:"",width:"",height:"",top:0,stop:!1}},SE={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"}},xE={indexAnchor:{text:"",color:"#606266",size:14,bgColor:"#f1f1f1",height:32}},EE={indexList:{inactiveColor:"#606266",activeColor:"#5677fc",indexList:[],sticky:!0,customNavHeight:0,safeBottomFix:!1}},TE={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:""}},vE={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}},AE={line:{color:"#d6d7d9",length:"100%",direction:"row",hairline:!0,margin:0,dashed:!1}},bE={lineProgress:{activeColor:"#19be6b",inactiveColor:"#ececec",percentage:0,showText:!0,height:12,fromRight:!1}},{color:IE}=Rs,_E={link:{color:IE["u-primary"],fontSize:15,underLine:!1,href:"",mpTips:"链接已复制,请在浏览器打开",lineColor:"",text:""}},wE={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}},RE={listItem:{anchor:""}},{color:Oc}=Rs,LE={loadingIcon:{show:!0,color:Oc["u-tips-color"],textColor:Oc["u-tips-color"],vertical:!1,mode:"spinner",size:24,textSize:15,text:"",timingFunction:"ease-in-out",duration:1200,inactiveColor:""}},CE={loadingPage:{loadingText:"正在加载",image:"",loadingMode:"circle",loading:!1,bgColor:"#ffffff",color:"#C8C8C8",fontSize:19,iconSize:28,loadingColor:"#C8C8C8",zIndex:10}},PE={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}},DE={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:{}}},kE={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:Tr.mainColor,autoBack:!1,titleStyle:""}},OE={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"}},FE={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"}},BE={notify:{top:0,type:"primary",color:"#ffffff",bgColor:"",message:"",duration:3e3,fontSize:15,safeAreaInsetTop:!1}},ME={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}},NE={numberKeyboard:{mode:"number",dotDisabled:!1,random:!1}},UE={overlay:{show:!1,zIndex:10070,duration:300,opacity:.5}},$E={parse:{copyLink:!0,errorImg:"",lazyLoad:!1,loadingImg:"",pauseVideo:!0,previewImg:!0,setTitle:!0,showImgMenu:!0}},GE={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}},HE={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}},jE={radio:{name:"",shape:"",disabled:"",labelDisabled:"",activeColor:"",inactiveColor:"",iconSize:"",labelSize:"",label:"",labelColor:"",size:"",iconColor:"",placement:""}},KE={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"}},VE={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}},qE={readMore:{showHeight:400,toggle:!1,closeText:"展开阅读全文",openText:"收起",color:"#2979ff",fontSize:14,textIndent:"2em",name:""}},WE={row:{gutter:0,justify:"start",align:"center"}},QE={rowNotice:{text:"",icon:"volume",mode:"",color:"#f9ae3d",bgColor:"#fdf6ec",fontSize:14,speed:80}},zE={scrollList:{indicatorWidth:50,indicatorBarWidth:20,indicator:!0,indicatorColor:"#f2f2f2",indicatorActiveColor:"#3c9cff",indicatorStyle:""}},YE={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}},XE={section:{title:"",subTitle:"更多",right:!0,fontSize:15,bold:!0,color:"#303133",subColor:"#909399",showLine:!0,lineColor:"",arrow:!0}},JE={skeleton:{loading:!0,animate:!0,rows:0,rowsWidth:"100%",rowsHeight:18,title:!0,titleWidth:"50%",titleHeight:18,avatar:!1,avatarSize:32,avatarShape:"circle"}},ZE={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"}},eT={statusBar:{bgColor:"transparent",height:0}},tT={steps:{direction:"row",current:0,activeColor:"#3c9cff",inactiveColor:"#969799",activeIcon:"",inactiveIcon:"",dot:!1}},sT={stepsItem:{title:"",desc:"",iconSize:17,error:!1}},nT={sticky:{offsetTop:0,customNavHeight:0,disabled:!1,bgColor:"transparent",zIndex:"",index:""}},iT={subsection:{list:[],current:0,activeColor:"#3c9cff",inactiveColor:"#303133",mode:"button",fontSize:12,bold:!0,bgColor:"#eeeeef",keyName:"name",activeColorKeyName:"activeColorKey",inactiveColorKeyName:"inactiveColorKey",disabled:!1}},rT={swipeAction:{autoClose:!0}},oT={swipeActionItem:{show:!1,closeOnClick:!0,name:"",disabled:!1,threshold:20,autoClose:!0,options:[],duration:300}},aT={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}},lT={swiperIndicator:{length:0,current:0,indicatorActiveColor:"",indicatorInactiveColor:"",indicatorMode:"line"}},cT={switch:{loading:!1,disabled:!1,size:25,activeColor:"#2979ff",inactiveColor:"#ffffff",value:!1,activeValue:!0,inactiveValue:!1,asyncChange:!1,space:0}},uT={tabbar:{value:null,safeAreaInsetBottom:!0,border:!0,zIndex:1,activeColor:"#1989fa",inactiveColor:"#7d7e80",fixed:!0,placeholder:!0}},fT={tabbarItem:{name:null,icon:"",badge:null,dot:!1,text:"",badgeStyle:"top: 6px;right:2px;"}},hT={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:{}}},dT={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}},pT={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}},gT={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}},mT={toast:{zIndex:10090,loading:!1,message:"",icon:"",type:"",loadingMode:"",show:"",overlay:!1,position:"center",params:{},duration:2e3,isTab:!1,url:"",callback:null,back:!1}},yT={toolbar:{show:!0,cancelText:"取消",confirmText:"确认",cancelColor:"#909193",confirmColor:"",title:""}},ST={tooltip:{text:"",copyText:"",size:14,color:"#606266",bgColor:"transparent",direction:"top",zIndex:10071,showCopy:!0,buttons:[],overlay:!0,showToast:!0,popupBgColor:"",triggerMode:"longpress"}},xT={transition:{show:!1,mode:"fade",duration:"300",timingFunction:"ease-out"}},ET={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"}},el={...Ux,...$x,...Gx,...Hx,...jx,...Kx,...Vx,...qx,...Wx,...Qx,...zx,...Yx,...Xx,...Jx,...Zx,...eE,...tE,...sE,...nE,...iE,...rE,...oE,...aE,...lE,...cE,...uE,...fE,...hE,...dE,...pE,...gE,...mE,...yE,...SE,...xE,...EE,...TE,...vE,...AE,...bE,..._E,...wE,...RE,...LE,...CE,...PE,...DE,...kE,...OE,...FE,...BE,...ME,...NE,...UE,...$E,...GE,...HE,...jE,...KE,...VE,...qE,...WE,...QE,...zE,...YE,...XE,...JE,...ZE,...eT,...tT,...sT,...nT,...iT,...rT,...oT,...aT,...lT,...cT,...uT,...fT,...hT,...dT,...pT,...gT,...mT,...yT,...ST,...xT,...ET};function TT(s){Us(Rs,s.config||{}),Us(el,s.props||{}),Us(Tr,s.color||{}),Us(Ja,s.zIndex||{})}if(W&&W.upuiParams){console.log("setting uview-plus");let s=W.upuiParams();s.httpIns&&s.httpIns(Za),s.options&&TT(s.options)}let vr="none";vr="vue3";vr="mp";vr="weixin";const vT=vr;let AT=["primary","success","error","warning","info"];function jd(s){ls.shallowMerge(Rs,s.config||{}),ls.shallowMerge(el,s.props||{}),ls.shallowMerge(Tr,s.color||{}),ls.shallowMerge(Ja,s.zIndex||{})}ls.setConfig=jd;const Fc={route:Xo,date:ls.timeFormat,colorGradient:li.colorGradient,hexToRgb:li.hexToRgb,rgbToHex:li.rgbToHex,colorToRgba:li.colorToRgba,test:kd,type:AT,http:Za,config:Rs,zIndex:Ja,debounce:mx,throttle:yx,calc:vx,mixin:$d,mpMixin:dx,props:el,...ls,color:Tr,platform:vT},bT=(s,e="")=>{if(e){W.upuiParams=e;let t=e();t.httpIns&&t.httpIns(Za),t.options&&jd(t.options)}W.$u=Fc,s.config.globalProperties.$u=Fc,s.mixin($d)},IT={install:bT},_T={"^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"},wT=[{path:"pages/auth/login",style:{navigationBarTitleText:"",navigationBarTextStyle:"black",enablePullDownRefresh:!1,navigationStyle:"custom","app-plus":{bounce:"none"}}},{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/games/index",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"}}}],RT=[{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"}}}]}],LT={navigationBarTextStyle:"black",navigationBarTitleText:"【S直播】",navigationBarBackgroundColor:"#f5f5f5",backgroundColor:"#f7f8fa"},CT={},Kd={custom:_T,pages:wT,subPackages:RT,globalStyle:LT,uniIdRouter:CT};var PT=[];function DT(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function yt(s,e,t){return s(t={path:e,exports:{},require:function(n,i){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(i==null&&t.path)}},t.exports),t.exports}var kT=yt(function(s,e){var t;s.exports=(t=t||function(n,i){var r=Object.create||function(){function g(){}return function(y){var E;return g.prototype=y,E=new g,g.prototype=null,E}}(),o={},a=o.lib={},l=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)}},c=a.WordArray=l.extend({init:function(g,y){g=this.words=g||[],this.sigBytes=y!=i?y:4*g.length},toString:function(g){return(g||f).stringify(this)},concat:function(g){var y=this.words,E=g.words,x=this.sigBytes,T=g.sigBytes;if(this.clamp(),x%4)for(var v=0;v<T;v++){var A=E[v>>>2]>>>24-v%4*8&255;y[x+v>>>2]|=A<<24-(x+v)%4*8}else for(v=0;v<T;v+=4)y[x+v>>>2]=E[v>>>2];return this.sigBytes+=T,this},clamp:function(){var g=this.words,y=this.sigBytes;g[y>>>2]&=4294967295<<32-y%4*8,g.length=n.ceil(y/4)},clone:function(){var g=l.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var y,E=[],x=function(A){var b=987654321,I=4294967295;return function(){var C=((b=36969*(65535&b)+(b>>16)&I)<<16)+(A=18e3*(65535&A)+(A>>16)&I)&I;return C/=4294967296,(C+=.5)*(n.random()>.5?1:-1)}},T=0;T<g;T+=4){var v=x(4294967296*(y||n.random()));y=987654071*v(),E.push(4294967296*v()|0)}return new c.init(E,g)}}),u=o.enc={},f=u.Hex={stringify:function(g){for(var y=g.words,E=g.sigBytes,x=[],T=0;T<E;T++){var v=y[T>>>2]>>>24-T%4*8&255;x.push((v>>>4).toString(16)),x.push((15&v).toString(16))}return x.join("")},parse:function(g){for(var y=g.length,E=[],x=0;x<y;x+=2)E[x>>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new c.init(E,y/2)}},h=u.Latin1={stringify:function(g){for(var y=g.words,E=g.sigBytes,x=[],T=0;T<E;T++){var v=y[T>>>2]>>>24-T%4*8&255;x.push(String.fromCharCode(v))}return x.join("")},parse:function(g){for(var y=g.length,E=[],x=0;x<y;x++)E[x>>>2]|=(255&g.charCodeAt(x))<<24-x%4*8;return new c.init(E,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=l.extend({reset:function(){this._data=new c.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,E=y.words,x=y.sigBytes,T=this.blockSize,v=x/(4*T),A=(v=g?n.ceil(v):n.max((0|v)-this._minBufferSize,0))*T,b=n.min(4*A,x);if(A){for(var I=0;I<A;I+=T)this._doProcessBlock(E,I);var C=E.splice(0,A);y.sigBytes-=b}return new c.init(C,b)},clone:function(){var g=l.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0});a.Hasher=p.extend({cfg:l.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,E){return new g.init(E).finalize(y)}},_createHmacHelper:function(g){return function(y,E){return new m.HMAC.init(g,E).finalize(y)}}});var m=o.algo={};return o}(Math),t)}),Vt=kT,OT=(yt(function(s,e){var t;s.exports=(t=Vt,function(n){var i=t,r=i.lib,o=r.WordArray,a=r.Hasher,l=i.algo,c=[];(function(){for(var m=0;m<64;m++)c[m]=4294967296*n.abs(n.sin(m+1))|0})();var u=l.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 E=g+y,x=m[E];m[E]=16711935&(x<<8|x>>>24)|4278255360&(x<<24|x>>>8)}var T=this._hash.words,v=m[g+0],A=m[g+1],b=m[g+2],I=m[g+3],C=m[g+4],_=m[g+5],D=m[g+6],H=m[g+7],V=m[g+8],$=m[g+9],B=m[g+10],F=m[g+11],U=m[g+12],k=m[g+13],G=m[g+14],M=m[g+15],w=T[0],R=T[1],P=T[2],O=T[3];w=f(w,R,P,O,v,7,c[0]),O=f(O,w,R,P,A,12,c[1]),P=f(P,O,w,R,b,17,c[2]),R=f(R,P,O,w,I,22,c[3]),w=f(w,R,P,O,C,7,c[4]),O=f(O,w,R,P,_,12,c[5]),P=f(P,O,w,R,D,17,c[6]),R=f(R,P,O,w,H,22,c[7]),w=f(w,R,P,O,V,7,c[8]),O=f(O,w,R,P,$,12,c[9]),P=f(P,O,w,R,B,17,c[10]),R=f(R,P,O,w,F,22,c[11]),w=f(w,R,P,O,U,7,c[12]),O=f(O,w,R,P,k,12,c[13]),P=f(P,O,w,R,G,17,c[14]),w=h(w,R=f(R,P,O,w,M,22,c[15]),P,O,A,5,c[16]),O=h(O,w,R,P,D,9,c[17]),P=h(P,O,w,R,F,14,c[18]),R=h(R,P,O,w,v,20,c[19]),w=h(w,R,P,O,_,5,c[20]),O=h(O,w,R,P,B,9,c[21]),P=h(P,O,w,R,M,14,c[22]),R=h(R,P,O,w,C,20,c[23]),w=h(w,R,P,O,$,5,c[24]),O=h(O,w,R,P,G,9,c[25]),P=h(P,O,w,R,I,14,c[26]),R=h(R,P,O,w,V,20,c[27]),w=h(w,R,P,O,k,5,c[28]),O=h(O,w,R,P,b,9,c[29]),P=h(P,O,w,R,H,14,c[30]),w=d(w,R=h(R,P,O,w,U,20,c[31]),P,O,_,4,c[32]),O=d(O,w,R,P,V,11,c[33]),P=d(P,O,w,R,F,16,c[34]),R=d(R,P,O,w,G,23,c[35]),w=d(w,R,P,O,A,4,c[36]),O=d(O,w,R,P,C,11,c[37]),P=d(P,O,w,R,H,16,c[38]),R=d(R,P,O,w,B,23,c[39]),w=d(w,R,P,O,k,4,c[40]),O=d(O,w,R,P,v,11,c[41]),P=d(P,O,w,R,I,16,c[42]),R=d(R,P,O,w,D,23,c[43]),w=d(w,R,P,O,$,4,c[44]),O=d(O,w,R,P,U,11,c[45]),P=d(P,O,w,R,M,16,c[46]),w=p(w,R=d(R,P,O,w,b,23,c[47]),P,O,v,6,c[48]),O=p(O,w,R,P,H,10,c[49]),P=p(P,O,w,R,G,15,c[50]),R=p(R,P,O,w,_,21,c[51]),w=p(w,R,P,O,U,6,c[52]),O=p(O,w,R,P,I,10,c[53]),P=p(P,O,w,R,B,15,c[54]),R=p(R,P,O,w,A,21,c[55]),w=p(w,R,P,O,V,6,c[56]),O=p(O,w,R,P,M,10,c[57]),P=p(P,O,w,R,D,15,c[58]),R=p(R,P,O,w,k,21,c[59]),w=p(w,R,P,O,C,6,c[60]),O=p(O,w,R,P,F,10,c[61]),P=p(P,O,w,R,b,15,c[62]),R=p(R,P,O,w,$,21,c[63]),T[0]=T[0]+w|0,T[1]=T[1]+R|0,T[2]=T[2]+P|0,T[3]=T[3]+O|0},_doFinalize:function(){var m=this._data,g=m.words,y=8*this._nDataBytes,E=8*m.sigBytes;g[E>>>5]|=128<<24-E%32;var x=n.floor(y/4294967296),T=y;g[15+(E+64>>>9<<4)]=16711935&(x<<8|x>>>24)|4278255360&(x<<24|x>>>8),g[14+(E+64>>>9<<4)]=16711935&(T<<8|T>>>24)|4278255360&(T<<24|T>>>8),m.sigBytes=4*(g.length+1),this._process();for(var v=this._hash,A=v.words,b=0;b<4;b++){var I=A[b];A[b]=16711935&(I<<8|I>>>24)|4278255360&(I<<24|I>>>8)}return v},clone:function(){var m=a.clone.call(this);return m._hash=this._hash.clone(),m}});function f(m,g,y,E,x,T,v){var A=m+(g&y|~g&E)+x+v;return(A<<T|A>>>32-T)+g}function h(m,g,y,E,x,T,v){var A=m+(g&E|y&~E)+x+v;return(A<<T|A>>>32-T)+g}function d(m,g,y,E,x,T,v){var A=m+(g^y^E)+x+v;return(A<<T|A>>>32-T)+g}function p(m,g,y,E,x,T,v){var A=m+(y^(g|~E))+x+v;return(A<<T|A>>>32-T)+g}i.MD5=a._createHelper(u),i.HmacMD5=a._createHmacHelper(u)}(Math),t.MD5)}),yt(function(s,e){var t;s.exports=(t=Vt,void function(){var n=t,i=n.lib.Base,r=n.enc.Utf8;n.algo.HMAC=i.extend({init:function(o,a){o=this._hasher=new o.init,typeof a=="string"&&(a=r.parse(a));var l=o.blockSize,c=4*l;a.sigBytes>c&&(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<l;p++)h[p]^=1549556828,d[p]^=909522486;u.sigBytes=f.sigBytes=c,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,l=a.finalize(o);return a.reset(),a.finalize(this._oKey.clone().concat(l))}})}())}),yt(function(s,e){s.exports=Vt.HmacMD5})),FT=yt(function(s,e){s.exports=Vt.enc.Utf8}),BT=yt(function(s,e){var t;s.exports=(t=Vt,function(){var n=t,i=n.lib.WordArray;function r(o,a,l){for(var c=[],u=0,f=0;f<a;f++)if(f%4){var h=l[o.charCodeAt(f-1)]<<f%4*2,d=l[o.charCodeAt(f)]>>>6-f%4*2;c[u>>>2]|=(h|d)<<24-u%4*8,u++}return i.create(c,u)}n.enc.Base64={stringify:function(o){var a=o.words,l=o.sigBytes,c=this._map;o.clamp();for(var u=[],f=0;f<l;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<l;d++)u.push(c.charAt(h>>>6*(3-d)&63));var p=c.charAt(64);if(p)for(;u.length%4;)u.push(p);return u.join("")},parse:function(o){var a=o.length,l=this._map,c=this._reverseMap;if(!c){c=this._reverseMap=[];for(var u=0;u<l.length;u++)c[l.charCodeAt(u)]=u}var f=l.charAt(64);if(f){var h=o.indexOf(f);h!==-1&&(a=h)}return r(o,a,c)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64)});const Vd="uni_id_token",qd="uni_id_token_expired",MT="uniIdToken",Yi={DEFAULT:"FUNCTION",FUNCTION:"FUNCTION",OBJECT:"OBJECT",CLIENT_DB:"CLIENT_DB"},Bc="pending",NT="fulfilled",Mc="rejected";function Fn(s){return Object.prototype.toString.call(s).slice(8,-1).toLowerCase()}function Wd(s){return Fn(s)==="object"}function Qd(s){return typeof s=="function"}function UT(s){return function(){try{return s.apply(s,arguments)}catch(e){console.error(e)}}}const Nc="REJECTED",zd="NOT_PENDING";class tl{constructor({createPromise:e,retryRule:t=Nc}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case Nc:return this.status===Mc;case zd:return this.status!==Bc}}exec(){return this.needRetry?(this.status=Bc,this.promise=this.createPromise().then(e=>(this.status=NT,Promise.resolve(e)),e=>(this.status=Mc,Promise.reject(e))),this.promise):this.promise}}class $T{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 n=this._callback[e];if(!n)return;const i=function(r,o){for(let a=r.length-1;a>=0;a--)if(r[a]===o)return a;return-1}(n,t);n.splice(i,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const n=this._callback[e];if(n)for(let i=0;i<n.length;i++)n[i](...t)}}function sl(s){return s&&typeof s=="string"?JSON.parse(s):s}const GT=!0,HT="mp-weixin",jT=sl(PT),Ys=HT,KT=sl(""),Yd=sl("[]")||[];let VT="";try{VT="__UNI__90F7D71"}catch{}let Fr={};function Ts(s,e={}){var t,n;return t=Fr,n=s,Object.prototype.hasOwnProperty.call(t,n)||(Fr[s]=e),Fr[s]}const Xd=["invoke","success","fail","complete"],gt=Ts("_globalUniCloudInterceptor");function Jd(s,e){gt[s]||(gt[s]={}),Wd(e)&&Object.keys(e).forEach(t=>{Xd.indexOf(t)>-1&&function(n,i,r){let o=gt[n][i];o||(o=gt[n][i]=[]),o.indexOf(r)===-1&&Qd(r)&&o.push(r)}(s,t,e[t])})}function qT(s,e){gt[s]||(gt[s]={}),Wd(e)?Object.keys(e).forEach(t=>{Xd.indexOf(t)>-1&&function(n,i,r){const o=gt[n][i];if(!o)return;const a=o.indexOf(r);a>-1&&o.splice(a,1)}(s,t,e[t])}):delete gt[s]}function Ge(s,e){return s&&s.length!==0?s.reduce((t,n)=>t.then(()=>n(e)),Promise.resolve()):Promise.resolve()}function He(s,e){return gt[s]&>[s][e]||[]}function WT(s){Jd("callObject",s)}const Br=Ts("_globalUniCloudListener"),xe={RESPONSE:"response",NEED_LOGIN:"needLogin",REFRESH_TOKEN:"refreshToken"},Nt={CLIENT_DB:"clientdb",CLOUD_FUNCTION:"cloudfunction",CLOUD_OBJECT:"cloudobject"};function Yn(s){return Br[s]||(Br[s]=[]),Br[s]}function Mr(s,e){const t=Yn(s);t.includes(e)||t.push(e)}function Nr(s,e){const t=Yn(s),n=t.indexOf(e);n!==-1&&t.splice(n,1)}function Ze(s,e){const t=Yn(s);for(let n=0;n<t.length;n++)(0,t[n])(e)}let Ur,$r=!1;function Zd(){return Ur||(Ur=new Promise(s=>{$r&&s(),function e(){if(typeof getCurrentPages=="function"){const t=getCurrentPages();t&&t[0]&&($r=!0,s())}$r||setTimeout(()=>{e()},30)}()}),Ur)}function e0(s){const e={};for(const t in s){const n=s[t];Qd(n)&&(e[t]=UT(n))}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 Ee={request:s=>W.request(s),uploadFile:s=>W.uploadFile(s),setStorageSync:(s,e)=>W.setStorageSync(s,e),getStorageSync:s=>W.getStorageSync(s),removeStorageSync:s=>W.removeStorageSync(s),clearStorageSync:()=>W.clearStorageSync(),connectSocket:s=>W.connectSocket(s)};function t0(s){return s&&t0(s.__v_raw)||s}function Bn(){return{token:Ee.getStorageSync(Vd)||Ee.getStorageSync(MT),tokenExpired:Ee.getStorageSync(qd)}}function s0({token:s,tokenExpired:e}={}){s&&Ee.setStorageSync(Vd,s),e&&Ee.setStorageSync(qd,e)}let Gr,ci;function Mn(){return Gr||(Gr=jt.canIUse("getAppBaseInfo")&&jt.canIUse("getDeviceInfo")?{...W.getAppBaseInfo(),...W.getDeviceInfo()}:W.getSystemInfoSync()),Gr}function QT(){let s,e;try{if(W.getLaunchOptionsSync){if(W.getLaunchOptionsSync.toString().indexOf("not yet implemented")>-1)return;const{scene:t,channel:n}=W.getLaunchOptionsSync();s=n,e=t}}catch{}return{channel:s,scene:e}}let ta={};function sa(){const s=W.getLocale&&W.getLocale()||"en";if(ci)return{...ta,...ci,locale:s,LOCALE:s};const e=Mn(),{deviceId:t,osName:n,uniPlatform:i,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 ci={PLATFORM:i,OS:n,APPID:r,DEVICEID:t,...QT(),...e},{...ta,...ci,locale:s,LOCALE:s}}var $s={sign:function(s,e){let t="";return Object.keys(s).sort().forEach(function(n){s[n]&&(t=t+"&"+n+"="+s[n])}),t=t.slice(1),OT(t,e).toString()},wrappedRequest:function(s,e){return new Promise((t,n)=>{e(Object.assign(s,{complete(i){i||(i={});const r=i.data&&i.data.header&&i.data.header["x-serverless-request-id"]||i.header&&i.header["request-id"];if(!i.statusCode||i.statusCode>=400){const a=i.data&&i.data.error&&i.data.error.code||"SYS_ERR",l=i.data&&i.data.error&&i.data.error.message||i.errMsg||"request:fail";return n(new q({code:a,message:l,requestId:r}))}const o=i.data;if(o.error)return n(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(s){return BT.stringify(FT.parse(s))}},zT=class{constructor(s){["spaceId","clientSecret"].forEach(e=>{if(!Object.prototype.hasOwnProperty.call(s,e))throw new Error(`${e} required`)}),this.config=Object.assign({},{endpoint:s.spaceId.indexOf("mp-")===0?"https://api.next.bspapp.com":"https://api.bspapp.com"},s),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=Ee,this._getAccessTokenPromiseHub=new tl({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:zd})}get hasAccessToken(){return!!this.accessToken}setAccessToken(s){this.accessToken=s}requestWrapped(s){return $s.wrappedRequest(s,this.adapter.request)}requestAuth(s){return this.requestWrapped(s)}request(s,e){return Promise.resolve().then(()=>this.hasAccessToken?e?this.requestWrapped(s):this.requestWrapped(s).catch(t=>new Promise((n,i)=>{!t||t.code!=="GATEWAY_INVALID_TOKEN"&&t.code!=="InvalidParameter.InvalidToken"?i(t):n()}).then(()=>this.getAccessToken()).then(()=>{const n=this.rebuildRequest(s);return this.request(n,!0)})):this.getAccessToken().then(()=>{const t=this.rebuildRequest(s);return this.request(t,!0)}))}rebuildRequest(s){const e=Object.assign({},s);return e.data.token=this.accessToken,e.header["x-basement-token"]=this.accessToken,e.header["x-serverless-sign"]=$s.sign(e.data,this.config.clientSecret),e}setupRequest(s,e){const t=Object.assign({},s,{spaceId:this.config.spaceId,timestamp:Date.now()}),n={"Content-Type":"application/json"};return e!=="auth"&&(t.token=this.accessToken,n["x-basement-token"]=this.accessToken),n["x-serverless-sign"]=$s.sign(t,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:t,dataType:"json",header:n}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(s){const e={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:s.name,functionArgs:s.data||{}})};return this.request({...this.setupRequest(e),timeout:s.timeout})}getOSSUploadOptionsFromPath(s){const e={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(s)};return this.request(this.setupRequest(e))}uploadFileToOSS({url:s,formData:e,name:t,filePath:n,fileType:i,onUploadProgress:r}){return new Promise((o,a)=>{const l=this.adapter.uploadFile({url:s,formData:e,name:t,filePath:n,fileType:i,header:{"X-OSS-server-side-encrpytion":"AES256"},success(c){c&&c.statusCode<400?o(c):a(new q({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(c){a(new q({code:c.code||"UPLOAD_FAILED",message:c.message||c.errMsg||"文件上传失败"}))}});typeof r=="function"&&l&&typeof l.onProgressUpdate=="function"&&l.onProgressUpdate(c=>{r({loaded:c.totalBytesSent,total:c.totalBytesExpectedToSend})})})}reportOSSUpload(s){const e={method:"serverless.file.resource.report",params:JSON.stringify(s)};return this.request(this.setupRequest(e))}async uploadFile({filePath:s,cloudPath:e,fileType:t="image",cloudPathAsRealPath:n=!1,onUploadProgress:i,config:r}){if(Fn(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(n&&(e[0]!=="/"&&(e="/"+e),e.indexOf("\\")>-1))throw new q({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:o,filename:n?e.split("/").pop():e,fileId:n?e:void 0})).result,l="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:c,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(c&&(y["x-oss-security-token"]=c),g){const x=JSON.stringify({callbackUrl:g,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=$s.toBase64(x)}const E={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:s,fileType:t};if(await this.uploadFileToOSS(Object.assign({},E,{onUploadProgress:i})),g)return{success:!0,filePath:s,fileID:l};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:s,fileID:l};throw new q({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:s}={}){return new Promise((e,t)=>{Array.isArray(s)&&s.length!==0||t(new q({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),this.getFileInfo({fileList:s}).then(n=>{e({fileList:s.map((i,r)=>{const o=n.fileList[r];return{fileID:i,tempFileURL:o&&o.url||i}})})})})}async getFileInfo({fileList:s}={}){if(!Array.isArray(s)||s.length===0)throw new q({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const e={method:"serverless.file.resource.info",params:JSON.stringify({id:s.map(t=>t.split("?")[0]).join(",")})};return{fileList:(await this.request(this.setupRequest(e))).result}}},YT={init(s){const e=new zT(s),t={signInAnonymously:function(){return e.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return e.auth=function(){return t},e.customAuth=e.auth,e}};const XT=typeof location<"u"&&location.protocol==="http:"?"http:":"https:";var Uc;(function(s){s.local="local",s.none="none",s.session="session"})(Uc||(Uc={}));var JT=function(){},ZT=yt(function(s,e){var t;s.exports=(t=Vt,function(n){var i=t,r=i.lib,o=r.WordArray,a=r.Hasher,l=i.algo,c=[],u=[];(function(){function d(y){for(var E=n.sqrt(y),x=2;x<=E;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&&(c[g]=p(n.pow(m,.5))),u[g]=p(n.pow(m,1/3)),g++),m++})();var f=[],h=l.SHA256=a.extend({_doReset:function(){this._hash=new o.init(c.slice(0))},_doProcessBlock:function(d,p){for(var m=this._hash.words,g=m[0],y=m[1],E=m[2],x=m[3],T=m[4],v=m[5],A=m[6],b=m[7],I=0;I<64;I++){if(I<16)f[I]=0|d[p+I];else{var C=f[I-15],_=(C<<25|C>>>7)^(C<<14|C>>>18)^C>>>3,D=f[I-2],H=(D<<15|D>>>17)^(D<<13|D>>>19)^D>>>10;f[I]=_+f[I-7]+H+f[I-16]}var V=g&y^g&E^y&E,$=(g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22),B=b+((T<<26|T>>>6)^(T<<21|T>>>11)^(T<<7|T>>>25))+(T&v^~T&A)+u[I]+f[I];b=A,A=v,v=T,T=x+B|0,x=E,E=y,y=g,g=B+($+V)|0}m[0]=m[0]+g|0,m[1]=m[1]+y|0,m[2]=m[2]+E|0,m[3]=m[3]+x|0,m[4]=m[4]+T|0,m[5]=m[5]+v|0,m[6]=m[6]+A|0,m[7]=m[7]+b|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)]=n.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}});i.SHA256=a._createHelper(h),i.HmacSHA256=a._createHmacHelper(h)}(Math),t.SHA256)}),na=ZT,n0=yt(function(s,e){s.exports=Vt.HmacSHA256});const Xn=()=>{let s;if(!Promise){s=()=>{},s.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(s.promise,"then",{get:t}),Object.defineProperty(s.promise,"catch",{get:t}),s}const e=new Promise((t,n)=>{s=(i,r)=>i?n(i):t(r)});return s.promise=e,s};function ev(s){return s===void 0}function tv(s){return Object.prototype.toString.call(s)==="[object Null]"}function $c(s=""){return s.replace(/([\s\S]+)\s+(请前往云开发AI小助手查看问题:.*)/,"$1")}function Gc(s=32){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let n=0;n<s;n++)t+=e.charAt(Math.floor(62*Math.random()));return t}var Hc;function sv(s){const e=(t=s,Object.prototype.toString.call(t)==="[object Array]"?s:[s]);var t;for(const n of e){const{isMatch:i,genAdapter:r,runtime:o}=n;if(i())return{adapter:r(),runtime:o}}}(function(s){s.WEB="web",s.WX_MP="wx_mp"})(Hc||(Hc={}));const Oe={adapter:null,runtime:void 0},nv=["anonymousUuidKey"];class Hr extends JT{constructor(){super(),Oe.adapter.root.tcbObject||(Oe.adapter.root.tcbObject={})}setItem(e,t){Oe.adapter.root.tcbObject[e]=t}getItem(e){return Oe.adapter.root.tcbObject[e]}removeItem(e){delete Oe.adapter.root.tcbObject[e]}clear(){delete Oe.adapter.root.tcbObject}}function jc(s,e){switch(s){case"local":return e.localStorage||new Hr;case"none":return new Hr;default:return e.sessionStorage||new Hr}}class Kc{constructor(e){if(!this._storage){this._persistence=Oe.adapter.primaryStorage||e.persistence,this._storage=jc(this._persistence,Oe.adapter);const t=`access_token_${e.env}`,n=`access_token_expire_${e.env}`,i=`refresh_token_${e.env}`,r=`anonymous_uuid_${e.env}`,o=`login_type_${e.env}`,a="device_id",l=`token_type_${e.env}`,c=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:i,anonymousUuidKey:r,loginTypeKey:o,userInfoKey:c,deviceIdKey:a,tokenTypeKey:l}}}updatePersistence(e){if(e===this._persistence)return;const t=this._persistence==="local";this._persistence=e;const n=jc(e,Oe.adapter);for(const i in this.keys){const r=this.keys[i];if(t&&nv.includes(i))continue;const o=this._storage.getItem(r);ev(o)||tv(o)||(n.setItem(r,o),this._storage.removeItem(r))}this._storage=n}setStore(e,t,n){if(!this._storage)return;const i={version:n||"localCachev1",content:t},r=JSON.stringify(i);try{this._storage.setItem(e,r)}catch(o){throw o}}getStore(e,t){try{if(!this._storage)return}catch{return""}t=t||"localCachev1";const n=this._storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}removeStore(e){this._storage.removeItem(e)}}const i0={},r0={};function rn(s){return i0[s]}class o0{constructor(e,t){this.data=t||null,this.name=e}}class iv extends o0{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const nl=new class{constructor(){this._listeners={}}on(s,e){return function(t,n,i){i[t]=i[t]||[],i[t].push(n)}(s,e,this._listeners),this}off(s,e){return function(t,n,i){if(i&&i[t]){const r=i[t].indexOf(n);r!==-1&&i[t].splice(r,1)}}(s,e,this._listeners),this}fire(s,e){if(s instanceof iv)return console.error(s.error),this;const t=typeof s=="string"?new o0(s,e||{}):s,n=t.name;if(this._listens(n)){t.target=this;const i=this._listeners[n]?[...this._listeners[n]]:[];for(const r of i)r.call(this,t)}return this}_listens(s){return this._listeners[s]&&this._listeners[s].length>0}};function kt(s,e){nl.on(s,e)}function Ke(s,e={}){nl.fire(s,e)}function rv(s,e){nl.off(s,e)}const Xs="loginStateChanged",a0="loginStateExpire",qt="loginTypeChanged",ia="anonymousConverted",l0="refreshAccessToken";var Ae;(function(s){s.ANONYMOUS="ANONYMOUS",s.WECHAT="WECHAT",s.WECHAT_PUBLIC="WECHAT-PUBLIC",s.WECHAT_OPEN="WECHAT-OPEN",s.CUSTOM="CUSTOM",s.EMAIL="EMAIL",s.USERNAME="USERNAME",s.NULL="NULL"})(Ae||(Ae={}));class ov{constructor(){this._fnPromiseMap=new Map}async run(e,t){let n=this._fnPromiseMap.get(e);return n||(n=new Promise(async(i,r)=>{try{await this._runIdlePromise();const o=t();i(await o)}catch(o){r(o)}finally{this._fnPromiseMap.delete(e)}}),this._fnPromiseMap.set(e,n)),n}_runIdlePromise(){return Promise.resolve()}}class av{constructor(e){this._singlePromise=new ov,this._cache=rn(e.env),this._baseURL=`https://${e.env}.ap-shanghai.tcb-api.tencentcloudapi.com`,this._reqClass=new Oe.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=Gc(),this._cache.setStore(e,t)),this._deviceID=t,t}async _request(e,t,n={}){const i={"x-request-id":Gc(),"x-device-id":this._getDeviceId()};if(n.withAccessToken){const{tokenTypeKey:r}=this._cache.keys,o=await this.getAccessToken(),a=this._cache.getStore(r);i.authorization=`${a} ${o}`}return this._reqClass[n.method==="get"?"get":"post"]({url:`${this._baseURL}${e}`,data:t,headers:i})}async _fetchAccessToken(){const{loginTypeKey:e,accessTokenKey:t,accessTokenExpireKey:n,tokenTypeKey:i}=this._cache.keys,r=this._cache.getStore(e);if(r&&r!==Ae.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:l,token_type:c}=o;return this._cache.setStore(i,c),this._cache.setStore(t,a),this._cache.setStore(n,Date.now()+1e3*l),a}isAccessTokenExpired(e,t){let n=!0;return e&&t&&(n=t<Date.now()),n}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t}=this._cache.keys,n=this._cache.getStore(e),i=this._cache.getStore(t);return this.isAccessTokenExpired(n,i)?this._fetchAccessToken():n}async refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,loginTypeKey:n}=this._cache.keys;return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.setStore(n,Ae.ANONYMOUS),this.getAccessToken()}async getUserInfo(){return this._singlePromise.run("getUserInfo",async()=>(await this._request("/auth/v1/user/me",{},{withAccessToken:!0,method:"get"})).data)}}const Vc=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],lv={"X-SDK-Version":"1.3.5"};function jr(s,e,t){const n=s[e];s[e]=function(i){const r={},o={};t.forEach(l=>{const{data:c,headers:u}=l.call(s,i);Object.assign(r,c),Object.assign(o,u)});const a=i.data;return a&&(()=>{var l;if(l=a,Object.prototype.toString.call(l)!=="[object FormData]")i.data={...a,...r};else for(const c in r)a.append(c,r[c])})(),i.headers={...i.headers||{},...o},n.call(s,i)}}function Kr(){const s=Math.random().toString(16).slice(2);return{data:{seqId:s},headers:{...lv,"x-seqid":s}}}class cv{constructor(e={}){var t;this.config=e,this._reqClass=new Oe.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=rn(this.config.env),this._localCache=(t=this.config.env,r0[t]),this.oauth=new av(this.config),jr(this._reqClass,"post",[Kr]),jr(this._reqClass,"upload",[Kr]),jr(this._reqClass,"download",[Kr])}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(n){t=n}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n,loginTypeKey:i,anonymousUuidKey:r}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let o=this._cache.getStore(n);if(!o)throw new q({message:"未登录CloudBase"});const a={refresh_token:o},l=await this.request("auth.fetchAccessTokenWithRefreshToken",a);if(l.data.code){const{code:c}=l.data;if(c==="SIGN_PARAM_INVALID"||c==="REFRESH_TOKEN_EXPIRED"||c==="INVALID_REFRESH_TOKEN"){if(this._cache.getStore(i)===Ae.ANONYMOUS&&c==="INVALID_REFRESH_TOKEN"){const u=this._cache.getStore(r),f=this._cache.getStore(n),h=await this.send("auth.signInAnonymously",{anonymous_uuid:u,refresh_token:f});return this.setRefreshToken(h.refresh_token),this._refreshAccessToken()}Ke(a0),this._cache.removeStore(n)}throw new q({code:l.data.code,message:`刷新access token失败:${l.data.code}`})}if(l.data.access_token)return Ke(l0),this._cache.setStore(e,l.data.access_token),this._cache.setStore(t,l.data.access_token_expire+Date.now()),{accessToken:l.data.access_token,accessTokenExpire:l.data.access_token_expire};l.data.refresh_token&&(this._cache.removeStore(n),this._cache.setStore(n,l.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n}=this._cache.keys;if(!this._cache.getStore(n))throw new q({message:"refresh token不存在,登录状态异常"});let i=this._cache.getStore(e),r=this._cache.getStore(t),o=!0;return this._shouldRefreshAccessTokenHook&&!await this._shouldRefreshAccessTokenHook(i,r)&&(o=!1),(!i||!r||r<Date.now())&&o?this.refreshAccessToken():{accessToken:i,accessTokenExpire:r}}async request(e,t,n){const i=`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(Vc.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 l={headers:{"content-type":r}};n&&n.timeout&&(l.timeout=n.timeout),n&&n.onUploadProgress&&(l.onUploadProgress=n.onUploadProgress);const c=this._localCache.getStore(i);c&&(l.headers["X-TCB-Trace"]=c);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,E,x={}){const T=/\?/.test(E);let v="";for(let A in x)v===""?!T&&(E+="?"):v+="&",v+=`${A}=${encodeURIComponent(x[A])}`;return/^http(s)?\:\/\//.test(E+=v)?E:`${y}${E}`}(XT,"//tcb-api.tencentcloudapi.com/web",d);h&&(p+=h);const m=await this.post({url:p,data:a,...l}),g=m.header&&m.header["x-tcb-trace"];if(g&&this._localCache.setStore(i,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={},n={}){const i=await this.request(e,t,{...n,onUploadProgress:t.onUploadProgress});if((i.data.code==="ACCESS_TOKEN_DISABLED"||i.data.code==="ACCESS_TOKEN_EXPIRED")&&Vc.indexOf(e)===-1){await this.oauth.refreshAccessToken();const r=await this.request(e,t,{...n,onUploadProgress:t.onUploadProgress});if(r.data.code)throw new q({code:r.data.code,message:$c(r.data.message)});return r.data}if(i.data.code)throw new q({code:i.data.code,message:$c(i.data.message)});return i.data}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:i}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(n),this._cache.setStore(i,e)}}const c0={};function wt(s){return c0[s]}class Ar{constructor(e){this.config=e,this._cache=rn(e.env),this._request=wt(e.env)}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:i}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(n),this._cache.setStore(i,e)}setAccessToken(e,t){const{accessTokenKey:n,accessTokenExpireKey:i}=this._cache.keys;this._cache.setStore(n,e),this._cache.setStore(i,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 uv{constructor(e){if(!e)throw new q({code:"PARAM_ERROR",message:"envId is not defined"});this._envId=e,this._cache=rn(this._envId),this._request=wt(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:n}=e;return n.forEach(i=>{i.wxOpenId&&i.wxPublicId&&(t=!0)}),{users:n,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:n,avatarUrl:i,province:r,country:o,city:a}=e,{data:l}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:i,province:r,country:o,city:a});this.setLocalUserInfo(l)}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(n=>{this[n]=t[n]}),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 Jn{constructor(e){if(!e)throw new q({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=rn(e);const{refreshTokenKey:t,accessTokenKey:n,accessTokenExpireKey:i}=this._cache.keys,r=this._cache.getStore(t),o=this._cache.getStore(n),a=this._cache.getStore(i);this.credential={refreshToken:r,accessToken:o,accessTokenExpire:a},this.user=new uv(e)}get isAnonymousAuth(){return this.loginType===Ae.ANONYMOUS}get isCustomAuth(){return this.loginType===Ae.CUSTOM}get isWeixinAuth(){return this.loginType===Ae.WECHAT||this.loginType===Ae.WECHAT_OPEN||this.loginType===Ae.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class Vr extends Ar{async signIn(){this._cache.updatePersistence("local"),await this._request.oauth.getAccessToken(),Ke(Xs),Ke(qt,{env:this.config.env,loginType:Ae.ANONYMOUS,persistence:"local"});const e=new Jn(this.config.env);return await e.user.refresh(),e}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:n}=this._cache.keys,i=this._cache.getStore(t),r=this._cache.getStore(n),o=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:i,refresh_token:r,ticket:e});if(o.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(o.refresh_token),await this._request.refreshAccessToken(),Ke(ia,{env:this.config.env}),Ke(qt,{loginType:Ae.CUSTOM,persistence:"local"}),{credential:{refreshToken:o.refresh_token}};throw new q({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(n,Ae.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class qc extends Ar{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,n=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(n.refresh_token)return this.setRefreshToken(n.refresh_token),await this._request.refreshAccessToken(),Ke(Xs),Ke(qt,{env:this.config.env,loginType:Ae.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new Jn(this.config.env);throw new q({message:"自定义登录失败"})}}class Wc extends Ar{async signIn(e,t){if(typeof e!="string")throw new q({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:n}=this._cache.keys,i=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token:o,access_token_expire:a}=i;if(r)return this.setRefreshToken(r),o&&a?this.setAccessToken(o,a):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Ke(Xs),Ke(qt,{env:this.config.env,loginType:Ae.EMAIL,persistence:this.config.persistence}),new Jn(this.config.env);throw i.code?new q({code:i.code,message:`邮箱登录失败: ${i.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 Qc extends Ar{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:n}=this._cache.keys,i=await this._request.send("auth.signIn",{loginType:Ae.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token_expire:o,access_token:a}=i;if(r)return this.setRefreshToken(r),a&&o?this.setAccessToken(a,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Ke(Xs),Ke(qt,{env:this.config.env,loginType:Ae.USERNAME,persistence:this.config.persistence}),new Jn(this.config.env);throw i.code?new q({code:i.code,message:`用户名密码登录失败: ${i.message}`}):new q({message:"用户名密码登录失败"})}}class fv{constructor(e){this.config=e,this._cache=rn(e.env),this._request=wt(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),kt(qt,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 Vr(this.config)}customAuthProvider(){return new qc(this.config)}emailAuthProvider(){return new Wc(this.config)}usernameAuthProvider(){return new Qc(this.config)}async signInAnonymously(){return new Vr(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new Wc(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new Qc(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new Vr(this.config)),kt(ia,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===Ae.ANONYMOUS)throw new q({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:n}=this._cache.keys,i=this._cache.getStore(e);if(!i)return;const r=await this._request.send("auth.logout",{refresh_token:i});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(n),Ke(Xs),Ke(qt,{env:this.config.env,loginType:Ae.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){kt(Xs,()=>{const n=this.hasLoginState();e.call(this,n)});const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){kt(a0,e.bind(this))}onAccessTokenRefreshed(e){kt(l0,e.bind(this))}onAnonymousConverted(e){kt(ia,e.bind(this))}onLoginTypeChanged(e){kt(qt,()=>{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,n=this._cache.getStore(e),i=this._cache.getStore(t);return this._request.oauth.isAccessTokenExpired(n,i)?null:new Jn(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 qc(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,n=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+n}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:n,env:i}=e.data;i===this.config.env&&(this._cache.updatePersistence(n),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const hv=function(s,e){e=e||Xn();const t=wt(this.config.env),{cloudPath:n,filePath:i,onUploadProgress:r,fileType:o="image"}=s;return t.send("storage.getUploadMetadata",{path:n}).then(a=>{const{data:{url:l,authorization:c,token:u,fileId:f,cosFileId:h},requestId:d}=a,p={key:n,signature:c,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":u};t.upload({url:l,data:p,file:i,name:n,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},dv=function(s,e){e=e||Xn();const t=wt(this.config.env),{cloudPath:n}=s;return t.send("storage.getUploadMetadata",{path:n}).then(i=>{e(null,i)}).catch(i=>{e(i)}),e.promise},pv=function({fileList:s},e){if(e=e||Xn(),!s||!Array.isArray(s))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let n of s)if(!n||typeof n!="string")return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const t={fileid_list:s};return wt(this.config.env).send("storage.batchDeleteFile",t).then(n=>{n.code?e(null,n):e(null,{fileList:n.data.delete_list,requestId:n.requestId})}).catch(n=>{e(n)}),e.promise},u0=function({fileList:s},e){e=e||Xn(),s&&Array.isArray(s)||e(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let t=[];for(let i of s)typeof i=="object"?(i.hasOwnProperty("fileID")&&i.hasOwnProperty("maxAge")||e(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),t.push({fileid:i.fileID,max_age:i.maxAge})):typeof i=="string"?t.push({fileid:i}):e(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const n={file_list:t};return wt(this.config.env).send("storage.batchGetDownloadUrl",n).then(i=>{i.code?e(null,i):e(null,{fileList:i.data.download_list,requestId:i.requestId})}).catch(i=>{e(i)}),e.promise},gv=async function({fileID:s},e){const t=(await u0.call(this,{fileList:[{fileID:s,maxAge:600}]})).fileList[0];if(t.code!=="SUCCESS")return e?e(t):new Promise(r=>{r(t)});const n=wt(this.config.env);let i=t.download_url;if(i=encodeURI(i),!e)return n.download({url:i});e(await n.download({url:i}))},mv=function({name:s,data:e,query:t,parse:n,search:i,timeout:r},o){const a=o||Xn();let l;try{l=e?JSON.stringify(e):""}catch(u){return Promise.reject(u)}if(!s)return Promise.reject(new q({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:t,parse:n,search:i,function_name:s,request_data:l};return wt(this.config.env).send("functions.invokeFunction",c,{timeout:r}).then(u=>{if(u.code)a(null,u);else{let f=u.data.response_data;if(n)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},zc={timeout:15e3,persistence:"session"},Yc=6e5,Xc={};class il{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(Oe.adapter||(this.requestClient=new Oe.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...zc,...e},!0){case this.config.timeout>Yc:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=Yc;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new il(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||Oe.adapter.primaryStorage||zc.persistence;var n;return t!==this.config.persistence&&(this.config.persistence=t),function(i){const{env:r}=i;i0[r]=new Kc(i),r0[r]=new Kc({...i,persistence:"local"})}(this.config),n=this.config,c0[n.env]=new cv(n),this.authObj=new fv(this.config),this.authObj}on(e,t){return kt.apply(this,[e,t])}off(e,t){return rv.apply(this,[e,t])}callFunction(e,t){return mv.apply(this,[e,t])}deleteFile(e,t){return pv.apply(this,[e,t])}getTempFileURL(e,t){return u0.apply(this,[e,t])}downloadFile(e,t){return gv.apply(this,[e,t])}uploadFile(e,t){return hv.apply(this,[e,t])}getUploadMetadata(e,t){return dv.apply(this,[e,t])}registerExtension(e){Xc[e.name]=e}async invokeExtension(e,t){const n=Xc[e];if(!n)throw new q({message:`扩展${e} 必须先注册`});return await n.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:n}=sv(e)||{};t&&(Oe.adapter=t),n&&(Oe.runtime=n)}}var f0=new il;function qr(s,e,t){t===void 0&&(t={});var n=/\?/.test(e),i="";for(var r in t)i===""?!n&&(e+="?"):i+="&",i+=r+"="+encodeURIComponent(t[r]);return/^http(s)?:\/\//.test(e+=i)?e:""+s+e}class yv{get(e){const{url:t,data:n,headers:i,timeout:r}=e;return new Promise((o,a)=>{Ee.request({url:qr("https:",t),data:n,method:"GET",header:i,timeout:r,success(l){o(l)},fail(l){a(l)}})})}post(e){const{url:t,data:n,headers:i,timeout:r}=e;return new Promise((o,a)=>{Ee.request({url:qr("https:",t),data:n,method:"POST",header:i,timeout:r,success(l){o(l)},fail(l){a(l)}})})}upload(e){return new Promise((t,n)=>{const{url:i,file:r,data:o,headers:a,fileType:l}=e,c=Ee.uploadFile({url:qr("https:",i),name:"file",formData:Object.assign({},o),filePath:r,fileType:l,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){n(new Error(u.errMsg||"uploadFile:fail"))}});typeof e.onUploadProgress=="function"&&c&&typeof c.onProgressUpdate=="function"&&c.onProgressUpdate(u=>{e.onUploadProgress({loaded:u.totalBytesSent,total:u.totalBytesExpectedToSend})})})}}const Sv={setItem(s,e){Ee.setStorageSync(s,e)},getItem:s=>Ee.getStorageSync(s),removeItem(s){Ee.removeStorageSync(s)},clear(){Ee.clearStorageSync()}};var xv={genAdapter:function(){return{root:{},reqClass:yv,localStorage:Sv,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};f0.useAdapters(xv);const rl=f0,Ev=rl.init;rl.init=function(s){s.env=s.spaceId;const e=Ev.call(this,s);e.config.provider="tencent",e.config.spaceId=s.spaceId;const t=e.auth;return e.auth=function(n){const i=t.call(this,n);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach(r=>{var o;i[r]=(o=i[r],function(a){a=a||{};const{success:l,fail:c,complete:u}=e0(a);if(!(l||c||u))return o.call(this,a);o.call(this,a).then(f=>{l&&l(f),u&&u(f)},f=>{c&&c(f),u&&u(f)})}).bind(i)}),i},e.customAuth=e.auth,e};var Jc=rl;async function Tv(s,e){const t=`http://${s}:${e}/system/ping`;try{const i=await(n={url:t,timeout:500},new Promise((r,o)=>{Ee.request({...n,success(a){r(a)},fail(a){o(a)}})}));return!(!i.data||i.data.code!==0)}catch{return!1}var n}async function h0(s,e){let t;for(let n=0;n<s.length;n++){const i=s[n];if(await Tv(i,e)){t=i;break}}return{address:t,port:e}}const vv={"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 Av=class{constructor(s){if(["spaceId","clientSecret"].forEach(e=>{if(!Object.prototype.hasOwnProperty.call(s,e))throw new Error(`${e} required`)}),!s.endpoint)throw new Error("集群空间未配置ApiEndpoint,配置后需要重新关联服务空间后生效");this.config=Object.assign({},s),this.config.provider="dcloud",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.adapter=Ee}async request(s,e=!0){const t=e;return s=t?await this.setupLocalRequest(s):this.setupRequest(s),Promise.resolve().then(()=>t?this.requestLocal(s):$s.wrappedRequest(s,this.adapter.request))}requestLocal(s){return new Promise((e,t)=>{this.adapter.request(Object.assign(s,{complete(n){if(n||(n={}),!n.statusCode||n.statusCode>=400){const i=n.data&&n.data.code||"SYS_ERR",r=n.data&&n.data.message||"request:fail";return t(new q({code:i,message:r}))}e({success:!0,result:n.data})}}))})}setupRequest(s){const e=Object.assign({},s,{spaceId:this.config.spaceId,timestamp:Date.now()}),t={"Content-Type":"application/json"};t["x-serverless-sign"]=$s.sign(e,this.config.clientSecret);const n=sa();t["x-client-info"]=encodeURIComponent(JSON.stringify(n));const{token:i}=Bn();return t["x-client-token"]=i,{url:this.config.requestUrl,method:"POST",data:e,dataType:"json",header:JSON.parse(JSON.stringify(t))}}async setupLocalRequest(s){const e=sa(),{token:t}=Bn(),n=Object.assign({},s,{spaceId:this.config.spaceId,timestamp:Date.now(),clientInfo:e,token:t}),{address:i,servePort:r}=this.__dev__&&this.__dev__.debugInfo||{},{address:o}=await h0(i,r);return{url:`http://${o}:${r}/${vv[s.method]}`,method:"POST",data:n,dataType:"json",header:JSON.parse(JSON.stringify({"Content-Type":"application/json"}))}}callFunction(s){const e={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:s.name,functionArgs:s.data||{}})};return this.request(e,!1)}getUploadFileOptions(s){const e={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(s)};return this.request(e)}reportUploadFile(s){const e={method:"serverless.file.resource.report",params:JSON.stringify(s)};return this.request(e)}uploadFile({filePath:s,cloudPath:e,fileType:t="image",onUploadProgress:n}){if(!e)throw new q({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let i;return this.getUploadFileOptions({cloudPath:e}).then(r=>{const{url:o,formData:a,name:l}=r.result;return i=r.result.fileUrl,new Promise((c,u)=>{const f=this.adapter.uploadFile({url:o,formData:a,name:l,filePath:s,fileType:t,success(h){h&&h.statusCode<400?c(h):u(new q({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(h){u(new q({code:h.code||"UPLOAD_FAILED",message:h.message||h.errMsg||"文件上传失败"}))}});typeof n=="function"&&f&&typeof f.onProgressUpdate=="function"&&f.onProgressUpdate(h=>{n({loaded:h.totalBytesSent,total:h.totalBytesExpectedToSend})})})}).then(()=>this.reportUploadFile({cloudPath:e})).then(r=>new Promise((o,a)=>{r.success?o({success:!0,filePath:s,fileID:i}):a(new q({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))}deleteFile({fileList:s}){const e={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:s})};return this.request(e).then(t=>{if(t.success)return t.result;throw new q({code:"DELETE_FILE_FAILED",message:"删除文件失败"})})}getTempFileURL({fileList:s,maxAge:e}={}){if(!Array.isArray(s)||s.length===0)throw new q({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:s,maxAge:e})};return this.request(t).then(n=>{if(n.success)return{fileList:n.result.fileList.map(i=>({fileID:i.fileID,tempFileURL:i.tempFileURL}))};throw new q({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})})}},Zc={init(s){const e=new Av(s),t={signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!1)}};return e.auth=function(){return t},e.customAuth=e.auth,e}},vn=yt(function(s,e){s.exports=Vt.enc.Hex});function d0(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){var e=16*Math.random()|0;return(s==="x"?e:3&e|8).toString(16)})}function p0(s="",e={}){const{data:t,functionName:n,method:i,headers:r,signHeaderKeys:o=[],config:a}=e,l=String(Date.now()),c=d0(),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":l,"x-from-function-name":n,"x-client-timestamp":l,"x-alipay-source":"client","x-request-id":c,"x-alipay-callid":c,"x-trace-id":c}),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=""]=s.split("?")||[],p=function(m){const g="HMAC-SHA256",y=m.signedHeaders.join(";"),E=m.signedHeaders.map(I=>`${I.toLowerCase()}:${m.headers[I]}
- `).join(""),x=na(m.body).toString(vn),T=`${m.method.toUpperCase()}
- ${m.path}
- ${m.query}
- ${E}
- ${y}
- ${x}
- `,v=na(T).toString(vn),A=`${g}
- ${m.timestamp}
- ${v}
- `,b=n0(A,m.secretKey).toString(vn);return`${g} Credential=${m.secretId}, SignedHeaders=${y}, Signature=${b}`}({path:h,query:d,method:i,headers:u,timestamp:l,body:JSON.stringify(t),secretId:a.accessKey,secretKey:a.secretKey,signedHeaders:f.sort()});return{url:`${a.endpoint}${s}`,headers:Object.assign({},u,{Authorization:p})}}function g0({url:s,data:e,method:t="POST",headers:n={},timeout:i}){return new Promise((r,o)=>{Ee.request({url:s,method:t,data:typeof e=="object"?JSON.stringify(e):e,header:n,dataType:"json",timeout:i,complete:(a={})=>{const l=n["x-trace-id"]||"";if(!a.statusCode||a.statusCode>=400){const{message:c,errMsg:u,trace_id:f}=a.data||{};return o(new q({code:"SYS_ERR",message:c||u||"request:fail",requestId:f||l}))}r({status:a.statusCode,data:a.data,headers:a.header,requestId:l})}})})}function eu(s,e){const{path:t,data:n,method:i="GET"}=s,{url:r,headers:o}=p0(t,{functionName:"",data:n,method:i,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 g0({url:r,data:n,method:i,headers:o}).then(a=>{const l=a.data||{};if(!l.success)throw new q({code:a.errCode,message:a.errMsg,requestId:a.requestId});return l.data||{}}).catch(a=>{throw new q({code:a.errCode,message:a.errMsg,requestId:a.requestId})})}function bv(s=""){const e=s.trim().replace(/^cloud:\/\//,""),t=e.indexOf("/");if(t<=0)throw new q({code:"INVALID_PARAM",message:"fileID不合法"});const n=e.substring(0,t),i=e.substring(t+1);return n!==this.config.spaceId&&console.warn("file ".concat(s," does not belong to env ").concat(this.config.spaceId)),i}function Iv(s=""){return"cloud://".concat(this.config.spaceId,"/").concat(s.replace(/^\/+/,""))}class _v{constructor(e){this.config=e}signedURL(e,t={}){const n=`/ws/function/${e}`,i=this.config.wsEndpoint.replace(/^ws(s)?:\/\//,""),r=Object.assign({},t,{accessKeyId:this.config.accessKey,signatureNonce:d0(),timestamp:""+Date.now()}),o=[n,["accessKeyId","authorization","signatureNonce","timestamp"].sort().map(function(u){return r[u]?"".concat(u,"=").concat(r[u]):null}).filter(Boolean).join("&"),`host:${i}`].join(`
- `),a=["HMAC-SHA256",na(o).toString(vn)].join(`
- `),l=n0(a,this.config.secretKey).toString(vn),c=Object.keys(r).map(u=>`${u}=${encodeURIComponent(r[u])}`).join("&");return`${this.config.wsEndpoint}${n}?${c}&signature=${l}`}}var wv=class{constructor(s){if(["spaceId","spaceAppId","accessKey","secretKey"].forEach(e=>{if(!Object.prototype.hasOwnProperty.call(s,e))throw new Error(`${e} required`)}),s.endpoint){if(typeof s.endpoint!="string")throw new Error("endpoint must be string");if(!/^https:\/\//.test(s.endpoint))throw new Error("endpoint must start with https://");s.endpoint=s.endpoint.replace(/\/$/,"")}this.config=Object.assign({},s,{endpoint:s.endpoint||`https://${s.spaceId}.api-hz.cloudbasefunction.cn`,wsEndpoint:s.wsEndpoint||`wss://${s.spaceId}.api-hz.cloudbasefunction.cn`}),this._websocket=new _v(this.config)}callFunction(s){return function(e,t){const{name:n,data:i,async:r=!1,timeout:o}=e,a="POST",l={"x-to-function-name":n};r&&(l["x-function-invoke-type"]="async");const{url:c,headers:u}=p0("/functions/invokeFunction",{functionName:n,data:i,method:a,headers:l,signHeaderKeys:["x-to-function-name"],config:t});return g0({url:c,data:i,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})})}(s,this.config)}uploadFileToOSS({url:s,filePath:e,fileType:t,formData:n,onUploadProgress:i}){return new Promise((r,o)=>{const a=Ee.uploadFile({url:s,filePath:e,fileType:t,formData:n,name:"file",success(l){l&&l.statusCode<400?r(l):o(new q({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(l){o(new q({code:l.code||"UPLOAD_FAILED",message:l.message||l.errMsg||"文件上传失败"}))}});typeof i=="function"&&a&&typeof a.onProgressUpdate=="function"&&a.onProgressUpdate(l=>{i({loaded:l.totalBytesSent,total:l.totalBytesExpectedToSend})})})}async uploadFile({filePath:s,cloudPath:e="",fileType:t="image",onUploadProgress:n}){if(Fn(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 i=await eu({path:"/".concat(e.replace(/^\//,""),"?post_url")},this.config),{file_id:r,upload_url:o,form_data:a}=i,l=a&&a.reduce((c,u)=>(c[u.key]=u.value,c),{});return this.uploadFileToOSS({url:o,filePath:s,fileType:t,formData:l,onUploadProgress:n}).then(()=>({fileID:r}))}async getTempFileURL({fileList:s}){return new Promise((e,t)=>{(!s||s.length<0)&&e({code:"INVALID_PARAM",message:"fileList不能为空数组"}),s.length>50&&e({code:"INVALID_PARAM",message:"fileList数组长度不能超过50"});const n=[];for(const i of s){let r;Fn(i)!=="string"&&e({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});try{r=bv.call(this,i)}catch(o){console.warn(o.errCode,o.errMsg),r=i}n.push({file_id:r,expire:600})}eu({path:"/?download_url",data:{file_list:n},method:"POST"},this.config).then(i=>{const{file_list:r=[]}=i;e({fileList:r.map(o=>({fileID:Iv.call(this,o.file_id),tempFileURL:o.download_url}))})}).catch(i=>t(i))})}async connectWebSocket(s){const{name:e,query:t}=s;return Ee.connectSocket({url:this._websocket.signedURL(e,t),complete:()=>{}})}},Rv={init:s=>{s.provider="alipay";const e=new wv(s);return e.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},e}};function m0({data:s}){let e;e=sa();const t=JSON.parse(JSON.stringify(s||{}));if(Object.assign(t,{clientInfo:e}),!t.uniIdToken){const{token:n}=Bn();n&&(t.uniIdToken=n)}return t}async function tu(s={}){await this.__dev__.initLocalNetwork();const{localAddress:e,localPort:t}=this.__dev__,n={aliyun:"aliyun",tencent:"tcb",alipay:"alipay",dcloud:"dcloud"}[this.config.provider],i=this.config.spaceId,r=`http://${e}:${t}/system/check-function`,o=`http://${e}:${t}/cloudfunctions/${s.name}`;return new Promise((a,l)=>{Ee.request({method:"POST",url:r,data:{name:s.name,platform:Ys,provider:n,spaceId:i},timeout:3e3,success(c){a(c)},fail(){a({data:{code:"NETWORK_ERROR",message:"连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。"}})}})}).then(({data:a}={})=>{const{code:l,message:c}=a||{};return{code:l===0?0:l||"SYS_ERR",message:c||"SYS_ERR"}}).then(({code:a,message:l})=>{if(a!==0){switch(a){case"MODULE_ENCRYPTED":console.error(`此云函数(${s.name})依赖加密公共模块不可本地调试,自动切换为云端已部署的云函数`);break;case"FUNCTION_ENCRYPTED":console.error(`此云函数(${s.name})已加密不可本地调试,自动切换为云端已部署的云函数`);break;case"ACTION_ENCRYPTED":console.error(l||"需要访问加密的uni-clientDB-action,自动切换为云端环境");break;case"NETWORK_ERROR":console.error(l||"连接本地调试服务失败,请检查客户端是否和主机在同一局域网下");break;case"SWITCH_TO_CLOUD":break;default:{const c=`检测本地调试服务出现错误:${l},请检查网络环境或重启客户端再试`;throw console.error(c),new Error(c)}}return this._callCloudFunction(s)}return new Promise((c,u)=>{const f=m0.call(this,{data:s.data});Ee.request({method:"POST",url:o,data:{provider:n,platform:Ys,param:f},timeout:s.timeout,success:({statusCode:h,data:d}={})=>!h||h>=400?u(new q({code:d.code||"SYS_ERR",message:d.message||"request:fail"})):c({result:d}),fail(h){u(new q({code:h.code||h.errCode||"SYS_ERR",message:h.message||h.errMsg||"request:fail"}))}})})})}const Lv=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var y0=/[\\^$.*+?()[\]{}|]/g,Cv=RegExp(y0.source);function su(s,e,t){return s.replace(new RegExp((n=e)&&Cv.test(n)?n.replace(y0,"\\$&"):n,"g"),t);var n}const Ut={NONE:"none",REQUEST:"request",RESPONSE:"response",BOTH:"both"},nu="_globalUniCloudStatus",S0="_globalUniCloudSecureNetworkCache__{spaceId}",Pv="uni-secure-network",ol={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 x0(s){const{errSubject:e,subject:t,errCode:n,errMsg:i,code:r,message:o,cause:a}=s||{};return new q({subject:e||t||Pv,code:n||r||ol.SYSTEM_ERROR.code,message:i||o,cause:a})}class Dv{constructor({secretType:e,uniCloudIns:t}={}){this.clientType="",this.secretType=e||Ut.NONE,this.uniCloudIns=t;const{provider:n,spaceId:i}=this.uniCloudIns.config;var r;this.provider=n,this.spaceId=i,this.scopedGlobalCache=(r=this.uniCloudIns,Ts(S0.replace("{spaceId}",r.config.spaceId)))}getSystemInfo(){return this._systemInfo||(this._systemInfo=Mn()),this._systemInfo}get appId(){return this.getSystemInfo().appId}get deviceId(){return this.getSystemInfo().deviceId}async encryptData(e){return this.secretType===Ut.NONE?e:this.platformEncryptData(e)}async decryptResult(e){if(this.secretType===Ut.NONE)return e;const{errCode:t,errMsg:n,content:i}=e||{};return t||!i?e:this.secretType===Ut.REQUEST?i:this.platformDecryptResult(e)}wrapVerifyClientCallFunction(e){const t=this;return async function({name:n,data:i={}}={}){await t.prepare(),(i=JSON.parse(JSON.stringify(i)))._uniCloudOptions=await t.platformGetSignOption();let r=await e({name:n,data:i});return t.isClientKeyNotFound(r)&&(await t.prepare({forceUpdate:!0}),i._uniCloudOptions=await t.platformGetSignOption(),r=await e({name:n,data:i})),r}}wrapEncryptDataCallFunction(e){const t=this;return async function({name:n,data:i={}}={}){await t.prepare();const r=await t.encryptData(i);let o=await e({name:n,data:r});if(t.isClientKeyNotFound(o)){await t.prepare({forceUpdate:!0});const a=await t.encryptData(i);o=await e({name:n,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 ra(s){return parseInt(s)===s}function iu(s){if(!ra(s.length))return!1;for(var e=0;e<s.length;e++)if(!ra(s[e])||s[e]<0||s[e]>255)return!1;return!0}function Ce(s,e){if(s.buffer&&s.name==="Uint8Array")return e&&(s=s.slice?s.slice():Array.prototype.slice.call(s)),s;if(Array.isArray(s)){if(!iu(s))throw new Error("Array contains invalid value: "+s);return new Uint8Array(s)}if(ra(s.length)&&iu(s))return new Uint8Array(s);throw new Error("unsupported array-like object")}function Le(s){return new Uint8Array(s)}function Me(s,e,t,n,i){n==null&&i==null||(s=s.slice?s.slice(n,i):Array.prototype.slice.call(s,n,i)),e.set(s,t)}var Wr,kv={toBytes:function(s){var e=[],t=0;for(s=encodeURI(s);t<s.length;){var n=s.charCodeAt(t++);n===37?(e.push(parseInt(s.substr(t,2),16)),t+=2):e.push(n)}return Ce(e)},fromBytes:function(s){for(var e=[],t=0;t<s.length;){var n=s[t];n<128?(e.push(String.fromCharCode(n)),t++):n>191&&n<224?(e.push(String.fromCharCode((31&n)<<6|63&s[t+1])),t+=2):(e.push(String.fromCharCode((15&n)<<12|(63&s[t+1])<<6|63&s[t+2])),t+=3)}return e.join("")}},Ov=(Wr="0123456789abcdef",{toBytes:function(s){for(var e=[],t=0;t<s.length;t+=2)e.push(parseInt(s.substr(t,2),16));return e},fromBytes:function(s){for(var e=[],t=0;t<s.length;t++){var n=s[t];e.push(Wr[(240&n)>>4]+Wr[15&n])}return e.join("")}}),Fv={16:10,24:12,32:14},Bv=[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],ze=[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],ui=[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],Mv=[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],Nv=[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],Uv=[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],$v=[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],Gv=[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],Hv=[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],jv=[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],Kv=[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],Vv=[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],qv=[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],Wv=[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],Qv=[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 Qr(s){for(var e=[],t=0;t<s.length;t+=4)e.push(s[t]<<24|s[t+1]<<16|s[t+2]<<8|s[t+3]);return e}class Xt{constructor(e){if(!(this instanceof Xt))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:Ce(e,!0)}),this._prepare()}_prepare(){var e=Fv[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 n,i=4*(e+1),r=this.key.length/4,o=Qr(this.key);for(t=0;t<r;t++)n=t>>2,this._Ke[n][t%4]=o[t],this._Kd[e-n][t%4]=o[t];for(var a,l=0,c=r;c<i;){if(a=o[r-1],o[0]^=ze[a>>16&255]<<24^ze[a>>8&255]<<16^ze[255&a]<<8^ze[a>>24&255]^Bv[l]<<24,l+=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]^=ze[255&a]^ze[a>>8&255]<<8^ze[a>>16&255]<<16^ze[a>>24&255]<<24,t=r/2+1;t<r;t++)o[t]^=o[t-1]}for(t=0;t<r&&c<i;)u=c>>2,f=c%4,this._Ke[u][f]=o[t],this._Kd[e-u][f]=o[t++],c++}for(var u=1;u<e;u++)for(var f=0;f<4;f++)a=this._Kd[u][f],this._Kd[u][f]=Vv[a>>24&255]^qv[a>>16&255]^Wv[a>>8&255]^Qv[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,n=[0,0,0,0],i=Qr(e),r=0;r<4;r++)i[r]^=this._Ke[0][r];for(var o=1;o<t;o++){for(r=0;r<4;r++)n[r]=Mv[i[r]>>24&255]^Nv[i[(r+1)%4]>>16&255]^Uv[i[(r+2)%4]>>8&255]^$v[255&i[(r+3)%4]]^this._Ke[o][r];i=n.slice()}var a,l=Le(16);for(r=0;r<4;r++)a=this._Ke[t][r],l[4*r]=255&(ze[i[r]>>24&255]^a>>24),l[4*r+1]=255&(ze[i[(r+1)%4]>>16&255]^a>>16),l[4*r+2]=255&(ze[i[(r+2)%4]>>8&255]^a>>8),l[4*r+3]=255&(ze[255&i[(r+3)%4]]^a);return l}decrypt(e){if(e.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,n=[0,0,0,0],i=Qr(e),r=0;r<4;r++)i[r]^=this._Kd[0][r];for(var o=1;o<t;o++){for(r=0;r<4;r++)n[r]=Gv[i[r]>>24&255]^Hv[i[(r+3)%4]>>16&255]^jv[i[(r+2)%4]>>8&255]^Kv[255&i[(r+1)%4]]^this._Kd[o][r];i=n.slice()}var a,l=Le(16);for(r=0;r<4;r++)a=this._Kd[t][r],l[4*r]=255&(ui[i[r]>>24&255]^a>>24),l[4*r+1]=255&(ui[i[(r+3)%4]>>16&255]^a>>16),l[4*r+2]=255&(ui[i[(r+2)%4]>>8&255]^a>>8),l[4*r+3]=255&(ui[255&i[(r+1)%4]]^a);return l}}class al{constructor(e){if(!(this instanceof al))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Xt(e)}encrypt(e){if((e=Ce(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Le(e.length),n=Le(16),i=0;i<e.length;i+=16)Me(e,n,0,i,i+16),Me(n=this._aes.encrypt(n),t,i);return t}decrypt(e){if((e=Ce(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=Le(e.length),n=Le(16),i=0;i<e.length;i+=16)Me(e,n,0,i,i+16),Me(n=this._aes.decrypt(n),t,i);return t}}class ll{constructor(e,t){if(!(this instanceof ll))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=Le(16);this._lastCipherblock=Ce(t,!0),this._aes=new Xt(e)}encrypt(e){if((e=Ce(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Le(e.length),n=Le(16),i=0;i<e.length;i+=16){Me(e,n,0,i,i+16);for(var r=0;r<16;r++)n[r]^=this._lastCipherblock[r];this._lastCipherblock=this._aes.encrypt(n),Me(this._lastCipherblock,t,i)}return t}decrypt(e){if((e=Ce(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=Le(e.length),n=Le(16),i=0;i<e.length;i+=16){Me(e,n,0,i,i+16),n=this._aes.decrypt(n);for(var r=0;r<16;r++)t[i+r]=n[r]^this._lastCipherblock[r];Me(e,this._lastCipherblock,0,i,i+16)}return t}}class cl{constructor(e,t,n){if(!(this instanceof cl))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=Le(16);n||(n=1),this.segmentSize=n,this._shiftRegister=Ce(t,!0),this._aes=new Xt(e)}encrypt(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,n=Ce(e,!0),i=0;i<n.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var r=0;r<this.segmentSize;r++)n[i+r]^=t[r];Me(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Me(n,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return n}decrypt(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,n=Ce(e,!0),i=0;i<n.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var r=0;r<this.segmentSize;r++)n[i+r]^=t[r];Me(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Me(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return n}}class ul{constructor(e,t){if(!(this instanceof ul))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=Le(16);this._lastPrecipher=Ce(t,!0),this._lastPrecipherIndex=16,this._aes=new Xt(e)}encrypt(e){for(var t=Ce(e,!0),n=0;n<t.length;n++)this._lastPrecipherIndex===16&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[n]^=this._lastPrecipher[this._lastPrecipherIndex++];return t}decrypt(e){return this.encrypt(e)}}class Nn{constructor(e){if(!(this instanceof Nn))throw Error("Counter must be instanitated with `new`");e===0||e||(e=1),typeof e=="number"?(this._counter=Le(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=Ce(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 fl{constructor(e,t){if(!(this instanceof fl))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Nn||(t=new Nn(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Xt(e)}encrypt(e){for(var t=Ce(e,!0),n=0;n<t.length;n++)this._remainingCounterIndex===16&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[n]^=this._remainingCounter[this._remainingCounterIndex++];return t}decrypt(e){return this.encrypt(e)}}var $t={AES:Xt,Counter:Nn,ModeOfOperation:{ecb:al,cbc:ll,cfb:cl,ofb:ul,ctr:fl},utils:{hex:Ov,utf8:kv},padding:{pkcs7:{pad:function(s){var e=16-(s=Ce(s,!0)).length%16,t=Le(s.length+e);Me(s,t);for(var n=s.length;n<t.length;n++)t[n]=e;return t},strip:function(s){if((s=Ce(s,!0)).length<16)throw new Error("PKCS#7 invalid length");var e=s[s.length-1];if(e>16)throw new Error("PKCS#7 padding byte out of range");for(var t=s.length-e,n=0;n<e;n++)if(s[t+n]!==e)throw new Error("PKCS#7 invalid padding byte");var i=Le(t);return Me(s,i,0,0,t),i}}},_arrayTest:{coerceArray:Ce,createArray:Le,copyArray:Me}};function ru(s,e,t){const n=new Uint8Array(W.base64ToArrayBuffer(e)),i=$t.utils.utf8.toBytes(t),r=$t.utils.utf8.toBytes(s),o=new $t.ModeOfOperation.cbc(n,i),a=$t.padding.pkcs7.pad(r),l=o.encrypt(a);return W.arrayBufferToBase64(l)}let oa,un=null;class zv extends Dv{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(un&&un.expireTime){const e=Date.now();if(un.expireTime-e>0)return this.userEncryptKey=un,this.userEncryptKey}return new Promise((e,t)=>{W.getUserCryptoManager().getLatestUserKey({success:n=>{un=n,this.userEncryptKey=n,e(this.userEncryptKey)},fail:n=>{t(x0({...ol.GET_ENCRYPT_KEY_FAILED,cause:n}))}})})}getWxAppId(){return jt.getAccountInfoSync().miniProgram.appId}async platformGetSignOption(){const{encryptKey:e,iv:t,version:n}=await this.getUserEncryptKey();return{verifyClientSign:ru(JSON.stringify({data:JSON.stringify({}),appId:this.appId,deviceId:this.deviceId,wxAppId:this.getWxAppId(),simulator:Mn().platform==="devtools",timestamp:Date.now()}),e,t),encryptKeyId:n,mpWeixinCode:this.scopedGlobalCache.mpWeixinCode,mpWeixinOpenid:this.scopedGlobalCache.mpWeixinOpenid}}async platformEncryptData(e){const{encryptKey:t,iv:n,version:i}=await this.getUserEncryptKey(),r={secretType:this.secretType,encryptKeyId:i,mpWeixinCode:this.scopedGlobalCache.mpWeixinCode,mpWeixinOpenid:this.scopedGlobalCache.mpWeixinOpenid};return this.secretType===Ut.RESPONSE?{content:e,_uniCloudOptions:r}:{content:ru(JSON.stringify({data:JSON.stringify(e),appId:this.appId,deviceId:this.deviceId,wxAppId:this.getWxAppId(),simulator:Mn().platform==="devtools",timestamp:Date.now()}),t,n),_uniCloudOptions:r}}async platformDecryptResult(e){const{content:t}=e,{encryptKey:n,iv:i}=await this.getUserEncryptKey();return JSON.parse(function(r,o,a){const l=new Uint8Array(W.base64ToArrayBuffer(r)),c=new Uint8Array(W.base64ToArrayBuffer(o)),u=$t.utils.utf8.toBytes(a),f=new $t.ModeOfOperation.cbc(c,u),h=$t.padding.pkcs7.strip(f.decrypt(l));return $t.utils.utf8.fromBytes(h)}(t,n,i))}isClientKeyNotFound(){return!1}}function ou({secretType:s}={}){return s===Ut.REQUEST||s===Ut.RESPONSE||s===Ut.BOTH}function au({name:s,data:e={}}={}){return Ys==="app"}function Yv({provider:s,spaceId:e,functionName:t}={}){const{appId:n,uniPlatform:i,osName:r}=Mn();let o=i;i==="app"&&(o=r);const a=function({provider:f,spaceId:h}={}){const d=jT;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:s,spaceId:e});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const l=a.accessControl.function||{},c=Object.keys(l);if(c.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(E=>E.trim()).indexOf(h)>-1&&(p=y):m=y:d=y}return d||p||m}(c,t);if(!u)return!1;if((l[u]||[]).find((f={})=>f.appId===n&&(f.platform||"").toLowerCase()===o.toLowerCase()))return!0;throw console.error(`此应用[appId: ${n}, platform: ${o}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),x0(ol.APP_INFO_INVALID)}function lu({functionName:s,result:e,logPvd:t}){if(this.__dev__.debugLog&&e&&e.requestId){const n=JSON.stringify({spaceId:this.config.spaceId,functionName:s,requestId:e.requestId});console.log(`[${t}-request]${n}[/${t}-request]`)}}function Xv(s){const e=s.callFunction,t=function(n){const i=n.name;n.data=m0.call(s,{data:n.data});const r={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay",dcloud:"dcloud"}[this.config.provider],o=ou(n),a=au(n),l=o||a;return e.call(this,n).then(c=>(c.errCode=0,!l&&lu.call(this,{functionName:i,result:c,logPvd:r}),Promise.resolve(c)),c=>(!l&&lu.call(this,{functionName:i,result:c,logPvd:r}),c&&c.message&&(c.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 E=m;for(let x=1;x<y.length;x++)E=su(E,`{$${x}}`,y[x]);for(const x in f)E=su(E,`{${x}}`,f[x]);return g==="replace"?E:u+E}return u}({message:`[${n.name}]: ${c.message}`,formatter:Lv,extraInfo:{functionName:i}})),Promise.reject(c)))};s.callFunction=function(n){const{provider:i,spaceId:r}=s.config,o=n.name;let a,l;return n.data=n.data||{},s.__dev__.debugInfo&&!s.__dev__.debugInfo.forceRemote&&Yd?(s._callCloudFunction||(s._callCloudFunction=t,s._callLocalFunction=tu),a=tu):a=t,a=a.bind(s),au(n)||(function({name:c,data:u={}}){return c==="uni-id-co"&&u.method==="secureNetworkHandshakeByWeixin"}(n)?l=a.call(s,n):ou(n)?l=new oa({secretType:n.secretType,uniCloudIns:s}).wrapEncryptDataCallFunction(t.bind(s))(n):Yv({provider:i,spaceId:r,functionName:o})?l=new oa({secretType:n.secretType,uniCloudIns:s}).wrapVerifyClientCallFunction(t.bind(s))(n):l=a(n)),Object.defineProperty(l,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),l.then(c=>c)}}oa=zv;const E0=Symbol("CLIENT_DB_INTERNAL");function Xi(s,e){return s.then="DoNotReturnProxyWithAFunctionNamedThen",s._internalType=E0,s.inspect=null,s.__v_raw=void 0,new Proxy(s,{get(t,n,i){if(n==="_uniClient")return null;if(typeof n=="symbol")return t[n];if(n in t||typeof n!="string"){const r=t[n];return typeof r=="function"?r.bind(t):r}return e.get(t,n,i)}})}function cu(s){return{on:(e,t)=>{s[e]=s[e]||[],s[e].indexOf(t)>-1||s[e].push(t)},off:(e,t)=>{s[e]=s[e]||[];const n=s[e].indexOf(t);n!==-1&&s[e].splice(n,1)}}}const Jv=["db.Geo","db.command","command.aggregate"];function T0(s,e){return Jv.indexOf(`${s}.${e}`)>-1}function gs(s){switch(Fn(s=t0(s))){case"array":return s.map(e=>gs(e));case"object":return s._internalType===E0||Object.keys(s).forEach(e=>{s[e]=gs(s[e])}),s;case"regexp":return{$regexp:{source:s.source,flags:s.flags}};case"date":return{$date:s.toISOString()};default:return s}}function fn(s){return s&&s.content&&s.content.$method}class Zv{constructor(e,t,n){this.content=e,this.prevStage=t||null,this.udb=null,this._database=n}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map(n=>({$method:n.$method,$param:gs(n.$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=fn(e),n=fn(e.prevStage);if(t==="aggregate"&&n==="collection"||t==="pipeline")return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if(fn(e)==="command")return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=fn(e),n=fn(e.prevStage);if(t==="aggregate"&&n==="command")return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return Un({$method:e,$param:gs(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 n=this.getAction(),i=this.getCommand();if(i.$db.push({$method:e,$param:gs(t)}),GT){const r=i.$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:n,command:i})}}function Un(s,e,t){return Xi(new Zv(s,e,t),{get(n,i){let r="db";return n&&n.content&&(r=n.content.$method),T0(r,i)?Un({$method:i},n,t):function(){return Un({$method:i,$param:gs(Array.from(arguments))},n,t)}}})}function zr({path:s,method:e}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...s.map(t=>({$method:t})),{$method:e,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}class e4{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=Ts("_globalUniCloudDatabaseCallback")),t||(this.auth=cu(this._authCallBacks)),this._isJQL=t,Object.assign(this,cu(this._dbCallBacks)),this.env=Xi({},{get:(n,i)=>({$env:i})}),this.Geo=Xi({},{get:(n,i)=>zr({path:["Geo"],method:i})}),this.serverDate=zr({path:[],method:"serverDate"}),this.RegExp=zr({path:[],method:"RegExp"})}getCloudEnv(e){if(typeof e!="string"||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const n=this._dbCallBacks;n[e]&&n[e].forEach(i=>{i(...t)})}_callbackAuth(e,t){const n=this._authCallBacks;n[e]&&n[e].forEach(i=>{i(...t)})}multiSend(){const e=Array.from(arguments),t=e.map(n=>{const i=n.getAction(),r=n.getCommand();if(r.$db[r.$db.length-1].$method!=="getTemp")throw new Error("multiSend只支持子命令内使用getTemp");return{action:i,command:r}});return this._callCloudFunction({multiCommand:t,queryList:e})}}function uu(s,e={}){return Xi(new s(e),{get:(t,n)=>T0("db",n)?Un({$method:n},null,t):function(){return Un({$method:n,$param:gs(Array.from(arguments))},null,t)}})}class fu extends e4{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:n,queryList:i}){function r(f,h){if(n&&i)for(let d=0;d<i.length;d++){const p=i[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 l(f){return o._callback("error",[f]),Ge(He(a,"fail"),f).then(()=>Ge(He(a,"complete"),f)).then(()=>(r(null,f),Ze(xe.RESPONSE,{type:Nt.CLIENT_DB,content:f}),Promise.reject(f)))}const c=Ge(He(a,"invoke")),u=this._uniClient;return c.then(()=>u.callFunction({name:"DCloud-clientDB",type:Yi.CLIENT_DB,data:{action:e,command:t,multiCommand:n}})).then(f=>{const{code:h,message:d,token:p,tokenExpired:m,systemInfo:g=[]}=f.result;if(g)for(let E=0;E<g.length;E++){const{level:x,message:T,detail:v}=g[E];let A="[System Info]"+T;v&&(A=`${A}
- 详细信息:${v}`),(console[x]||console.log)(A)}if(h)return l(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&&(s0({token:p,tokenExpired:m}),this._callbackAuth("refreshToken",[{token:p,tokenExpired:m}]),this._callback("refreshToken",[{token:p,tokenExpired:m}]),Ze(xe.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 E=0;E<y.length;E++){const{prop:x,tips:T}=y[E];if(x in f.result){const v=f.result[x];Object.defineProperty(f.result,x,{get:()=>(console.warn(T),v)})}}return function(E){return Ge(He(a,"success"),E).then(()=>Ge(He(a,"complete"),E)).then(()=>{r(E,null);const x=o._parseResult(E);return Ze(xe.RESPONSE,{type:Nt.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"),l(new q({code:f.code||"SYSTEM_ERROR",message:f.message,requestId:f.requestId}))))}}const cs="token无效,跳转登录页面",v0="token过期,跳转登录页面",A0={TOKEN_INVALID_TOKEN_EXPIRED:v0,TOKEN_INVALID_INVALID_CLIENTID:cs,TOKEN_INVALID:cs,TOKEN_INVALID_WRONG_TOKEN:cs,TOKEN_INVALID_ANONYMOUS_USER:cs},t4={"uni-id-token-expired":v0,"uni-id-check-token-failed":cs,"uni-id-token-not-exist":cs,"uni-id-check-device-feature-failed":cs},aa={...A0,...t4,default:"用户未登录或登录状态过期,自动跳转登录页面"};function hu(s,e){let t="";return t=s?`${s}/${e}`:e,t.replace(/^\//,"")}function du(s=[],e=""){const t=[],n=[];return s.forEach(i=>{i.needLogin===!0?t.push(hu(e,i.path)):i.needLogin===!1&&n.push(hu(e,i.path))}),{needLoginPage:t,notNeedLoginPage:n}}function $n(s){return s.split("?")[0].replace(/^\//,"")}function hl(){return function(s){let e=s&&s.$page&&s.$page.fullPath;return e?(e.charAt(0)!=="/"&&(e="/"+e),e):""}(function(){const s=getCurrentPages();return s[s.length-1]}())}function b0(){return $n(hl())}function s4(s="",e={}){if(!s||!(e&&e.list&&e.list.length))return!1;const t=e.list,n=$n(s);return t.some(i=>i.pagePath===n)}const n4=!!Kd.uniIdRouter,{loginPage:Gn,routerNeedLogin:i4,resToLogin:r4,needLoginPage:I0,notNeedLoginPage:o4,loginPageInTabBar:a4}=function({pages:s=[],subPackages:e=[],uniIdRouter:t={},tabBar:n={}}=Kd){const{loginPage:i,needLogin:r=[],resToLogin:o=!0}=t,{needLoginPage:a,notNeedLoginPage:l}=du(s),{needLoginPage:c,notNeedLoginPage:u}=function(f=[]){const h=[],d=[];return f.forEach(p=>{const{root:m,pages:g=[]}=p,{needLoginPage:y,notNeedLoginPage:E}=du(g,m);h.push(...y),d.push(...E)}),{needLoginPage:h,notNeedLoginPage:d}}(e);return{loginPage:i,routerNeedLogin:r,resToLogin:o,needLoginPage:[...a,...c],notNeedLoginPage:[...l,...u],loginPageInTabBar:s4(i,n)}}();if(I0.indexOf(Gn)>-1)throw new Error(`Login page [${Gn}] should not be "needLogin", please check your pages.json`);function _0(s){const e=b0();if(s.charAt(0)==="/")return s;const[t,n]=s.split("?"),i=t.replace(/^\//,"").split("/"),r=e.split("/");r.pop();for(let o=0;o<i.length;o++){const a=i[o];a===".."?r.pop():a!=="."&&r.push(a)}return r[0]===""&&r.shift(),"/"+r.join("/")+(n?"?"+n:"")}function l4(s){const e=$n(_0(s));return!(o4.indexOf(e)>-1)&&(I0.indexOf(e)>-1||i4.some(t=>function(n,i){return new RegExp(i).test(n)}(s,t)))}function w0({redirect:s}){const e=$n(s),t=$n(Gn);return b0()!==t&&e!==t}function la({api:s,redirect:e}={}){if(!e||!w0({redirect:e}))return;const t=function(i,r){return i.charAt(0)!=="/"&&(i="/"+i),r?i.indexOf("?")>-1?i+`&uniIdRedirectUrl=${encodeURIComponent(r)}`:i+`?uniIdRedirectUrl=${encodeURIComponent(r)}`:i}(Gn,e);a4?s!=="navigateTo"&&s!=="redirectTo"||(s="switchTab"):s==="switchTab"&&(s="navigateTo");const n={navigateTo:W.navigateTo,redirectTo:W.redirectTo,switchTab:W.switchTab,reLaunch:W.reLaunch};setTimeout(()=>{n[s]({url:t})},0)}function pu({url:s}={}){const e={abortLoginPageJump:!1,autoToLoginPage:!1},t=function(){const{token:n,tokenExpired:i}=Bn();let r;if(n){if(i<Date.now()){const o="uni-id-token-expired";r={errCode:o,errMsg:aa[o]}}}else{const o="uni-id-check-token-failed";r={errCode:o,errMsg:aa[o]}}return r}();if(l4(s)&&t){if(t.uniIdRedirectUrl=s,Yn(xe.NEED_LOGIN).length>0)return setTimeout(()=>{Ze(xe.NEED_LOGIN,t)},0),e.abortLoginPageJump=!0,e;e.autoToLoginPage=!0}return e}function c4(){(function(){const e=hl(),{abortLoginPageJump:t,autoToLoginPage:n}=pu({url:e});t||n&&la({api:"redirectTo",redirect:e})})();const s=["navigateTo","redirectTo","reLaunch","switchTab"];for(let e=0;e<s.length;e++){const t=s[e];W.addInterceptor(t,{invoke(n){const{abortLoginPageJump:i,autoToLoginPage:r}=pu({url:n.url});return i?n:r?(la({api:t,redirect:_0(n.url)}),!1):n}})}}function u4(){this.onResponse(s=>{const{type:e,content:t}=s;let n=!1;switch(e){case"cloudobject":n=function(i){if(typeof i!="object")return!1;const{errCode:r}=i||{};return r in aa}(t);break;case"clientdb":n=function(i){if(typeof i!="object")return!1;const{errCode:r}=i||{};return r in A0}(t)}n&&function(i={}){const r=Yn(xe.NEED_LOGIN);Zd().then(()=>{const o=hl();if(o&&w0({redirect:o}))return r.length>0?Ze(xe.NEED_LOGIN,Object.assign({uniIdRedirectUrl:o},i)):void(Gn&&la({api:"navigateTo",redirect:o}))})}(t)})}function f4(s){(function(e){e.onResponse=function(t){Mr(xe.RESPONSE,t)},e.offResponse=function(t){Nr(xe.RESPONSE,t)}})(s),function(e){e.onNeedLogin=function(t){Mr(xe.NEED_LOGIN,t)},e.offNeedLogin=function(t){Nr(xe.NEED_LOGIN,t)},n4&&(Ts(nu).needLoginInit||(Ts(nu).needLoginInit=!0,Zd().then(()=>{c4.call(e)}),r4&&u4.call(e)))}(s),function(e){e.onRefreshToken=function(t){Mr(xe.REFRESH_TOKEN,t)},e.offRefreshToken=function(t){Nr(xe.REFRESH_TOKEN,t)}}(s)}let R0;const fi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h4=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function d4(){const s=Bn().token||"",e=s.split(".");if(!s||e.length!==3)return{uid:null,role:[],permission:[],tokenExpired:0};let t;try{t=JSON.parse((n=e[1],decodeURIComponent(R0(n).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""))))}catch(i){throw new Error("获取当前用户信息出错,详细错误信息为:"+i.message)}var n;return t.tokenExpired=1e3*t.exp,delete t.exp,delete t.iat,t}R0=typeof atob!="function"?function(s){if(s=String(s).replace(/[\t\n\f\r ]+/g,""),!h4.test(s))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var e;s+="==".slice(2-(3&s.length));for(var t,n,i="",r=0;r<s.length;)e=fi.indexOf(s.charAt(r++))<<18|fi.indexOf(s.charAt(r++))<<12|(t=fi.indexOf(s.charAt(r++)))<<6|(n=fi.indexOf(s.charAt(r++))),i+=t===64?String.fromCharCode(e>>16&255):n===64?String.fromCharCode(e>>16&255,e>>8&255):String.fromCharCode(e>>16&255,e>>8&255,255&e);return i}:atob;var p4=yt(function(s,e){Object.defineProperty(e,"__esModule",{value:!0});const t="chooseAndUploadFile:ok",n="chooseAndUploadFile:fail";function i(o,a){return o.tempFiles.forEach((l,c)=>{l.name||(l.name=l.path.substring(l.path.lastIndexOf("/")+1)),a&&(l.fileType=a),l.cloudPath=Date.now()+"_"+c+l.name.substring(l.name.lastIndexOf("."))}),o.tempFilePaths||(o.tempFilePaths=o.tempFiles.map(l=>l.path)),o}function r(o,a,{onChooseFile:l,onUploadProgress:c}){return a.then(u=>{if(l){const f=l(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(E=>{for(;y<d;)x();function x(){const T=y++;if(T>=g)return void(!m.find(A=>!A.url&&!A.errMsg)&&E(h));const v=m[T];f.uploadFile({provider:v.provider,filePath:v.path,cloudPath:v.cloudPath,fileType:v.fileType,cloudPathAsRealPath:v.cloudPathAsRealPath,onUploadProgress(A){A.index=T,A.tempFile=v,A.tempFilePath=v.path,p&&p(A)}}).then(A=>{v.url=A.fileID,T<g&&x()}).catch(A=>{v.errMsg=A.errMsg||A.message,T<g&&x()})}})}(o,u,5,c))}e.initChooseAndUploadFile=function(o){return function(a={type:"all"}){return a.type==="image"?r(o,function(l){const{count:c,sizeType:u,sourceType:f=["album","camera"],extension:h}=l;return new Promise((d,p)=>{W.chooseImage({count:c,sizeType:u,sourceType:f,extension:h,success(m){d(i(m,"image"))},fail(m){p({errMsg:m.errMsg.replace("chooseImage:fail",n)})}})})}(a),a):a.type==="video"?r(o,function(l){const{camera:c,compressed:u,maxDuration:f,sourceType:h=["album","camera"],extension:d}=l;return new Promise((p,m)=>{W.chooseVideo({camera:c,compressed:u,maxDuration:f,sourceType:h,extension:d,success(g){const{tempFilePath:y,duration:E,size:x,height:T,width:v}=g;p(i({errMsg:"chooseVideo:ok",tempFilePaths:[y],tempFiles:[{name:g.tempFile&&g.tempFile.name||"",path:y,size:x,type:g.tempFile&&g.tempFile.type||"",width:v,height:T,duration:E,fileType:"video",cloudPath:""}]},"video"))},fail(g){m({errMsg:g.errMsg.replace("chooseVideo:fail",n)})}})})}(a),a):r(o,function(l){const{count:c,extension:u}=l;return new Promise((f,h)=>{let d=W.chooseFile;if(typeof jt<"u"&&typeof jt.chooseMessageFile=="function"&&(d=jt.chooseMessageFile),typeof d!="function")return h({errMsg:n+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});d({type:"all",count:c,extension:u,success(p){f(i(p))},fail(p){h({errMsg:p.errMsg.replace("chooseFile:fail",n)})}})})}(a),a)}}}),g4=DT(p4);const m4={auto:"auto",onready:"onready",manual:"manual"};function L0(s){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===m4.manual)return;let n=!1;const i=[];for(let r=2;r<e.length;r++)e[r]!==t[r]&&(i.push(e[r]),n=!0);e[0]!==t[0]&&(this.mixinDatacomPage.current=this.pageCurrent),this.mixinDatacomPage.size=this.pageSize,this.onMixinDatacomPropsChange(n,i)})},methods:{onMixinDatacomPropsChange(e,t){},mixinDatacomEasyGet({getone:e=!1,success:t,fail:n}={}){this.mixinDatacomLoading||(this.mixinDatacomLoading=!0,this.mixinDatacomErrorMessage="",this.mixinDatacomError=null,this.mixinDatacomGet().then(i=>{this.mixinDatacomLoading=!1;const{data:r,count:o}=i.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(i=>{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=i,this.mixinDatacomError=i,n&&n(i)}))},mixinDatacomGet(e={}){let t;e=e||{},t=typeof __uniX<"u"&&__uniX?s.databaseForJQL(this.spaceInfo):s.database(this.spaceInfo);const n=e.action||this.action;n&&(t=t.action(n));const i=e.collection||this.collection;t=Array.isArray(i)?t.collection(...i):t.collection(i);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 l=e.groupby||this.groupby;l&&(t=t.groupBy(l));const c=e.groupField||this.groupField;c&&(t=t.groupField(c)),(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 y4(s){return function(e,t={}){t=function(l,c={}){return l.customUI=c.customUI||l.customUI,l.parseSystemError=c.parseSystemError||l.parseSystemError,Object.assign(l.loadingOptions,c.loadingOptions),Object.assign(l.errorOptions,c.errorOptions),typeof c.secretMethods=="object"&&(l.secretMethods=c.secretMethods),l}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},t);const{customUI:n,loadingOptions:i,errorOptions:r,parseSystemError:o}=t,a=!n;return new Proxy({},{get(l,c){switch(c){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 Ge(He(f,"invoke"),{...p}),m=await u(...d),await Ge(He(f,"success"),{...p,result:m}),m}catch(y){throw g=y,await Ge(He(f,"fail"),{...p,error:g}),g}finally{await Ge(He(f,"complete"),g?{...p,error:g}:{...p,result:m})}}}({fn:async function u(...f){let h;a&&W.showLoading({title:i.title,mask:i.mask});const d={name:e,type:Yi.OBJECT,data:{method:c,params:f}};typeof t.secretMethods=="object"&&function(x,T){const v=T.data.method,A=x.secretMethods||{},b=A[v]||A["*"];b&&(T.secretType=b)}(t,d);let p=!1;try{h=await s.callFunction(d)}catch(x){p=!0,h={result:new q(x)}}const{errSubject:m,errCode:g,errMsg:y,newToken:E}=h.result||{};if(a&&W.hideLoading(),E&&E.token&&E.tokenExpired&&(s0(E),Ze(xe.REFRESH_TOKEN,{...E})),g){let x=y;if(p&&o&&(x=(await o({objectName:e,methodName:c,params:f,errSubject:m,errCode:g,errMsg:y})).errMsg||y),a)if(r.type==="toast")W.showToast({title:x,icon:"none"});else{if(r.type!=="modal")throw new Error(`Invalid errorOptions.type: ${r.type}`);{const{confirm:v}=await async function({title:A,content:b,showCancel:I,cancelText:C,confirmText:_}={}){return new Promise((D,H)=>{W.showModal({title:A,content:b,showCancel:I,cancelText:C,confirmText:_,success(V){D(V)},fail(){D({confirm:!1,cancel:!0})}})})}({title:"提示",content:x,showCancel:r.retry,cancelText:"取消",confirmText:r.retry?"重试":"确定"});if(r.retry&&v)return u(...f)}}const T=new q({subject:m,code:g,message:y,requestId:h.requestId});throw T.detail=h.result,Ze(xe.RESPONSE,{type:Nt.CLOUD_OBJECT,content:T}),T}return Ze(xe.RESPONSE,{type:Nt.CLOUD_OBJECT,content:h.result}),h.result},interceptorName:"callObject",getCallbackArgs:function({params:u}={}){return{objectName:e,methodName:c,params:u}}})}})}}function C0(s){return Ts(S0.replace("{spaceId}",s.config.spaceId))}async function S4({openid:s,callLoginByWeixin:e=!1}={}){const t=C0(this);if(s&&e)throw new Error("[SecureNetwork] openid and callLoginByWeixin cannot be passed at the same time");if(s)return t.mpWeixinOpenid=s,{};const n=await new Promise((r,o)=>{W.login({success(a){r(a.code)},fail(a){o(new Error(a.errMsg))}})});return await this.importObject("uni-id-co",{customUI:!0}).secureNetworkHandshakeByWeixin({code:n,callLoginByWeixin:e}),t.mpWeixinCode=n,{code:n}}async function x4(s){const e=C0(this);return e.initPromise||(e.initPromise=S4.call(this,s).then(t=>t).catch(t=>{throw delete e.initPromise,t})),e.initPromise}function E4(s){return function({openid:e,callLoginByWeixin:t=!1}={}){return x4.call(s,{openid:e,callLoginByWeixin:t})}}function T4(s){(function(e){ta=e})(s)}function gu(s){const e=jt.canIUse("getAppBaseInfo"),t={getAppBaseInfo:e?W.getAppBaseInfo:W.getSystemInfo,getPushClientId:W.getPushClientId};return function(n){return new Promise((i,r)=>{e&&s==="getAppBaseInfo"?i(t[s]()):t[s]({...n,success(o){i(o)},fail(o){r(o)}})})}}class v4 extends $T{constructor(){super(),this._uniPushMessageCallback=this._receivePushMessage.bind(this),this._currentMessageId=-1,this._payloadQueue=[]}init(){return Promise.all([gu("getAppBaseInfo")(),gu("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:n,messageId:i,message:r}=t;this._payloadQueue.push({action:n,messageId:i,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:n,message:i}=e;t==="end"?this._end({messageId:n,message:i}):t==="message"&&this._appendMessage({messageId:n,message:i})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){W.onPushMessage(this._uniPushMessageCallback)}_destroy(){W.offPushMessage(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}async function A4(s){const e=s.__dev__;if(!e.debugInfo)return;const{address:t,servePort:n}=e.debugInfo,{address:i}=await h0(t,n);if(i)return e.localAddress=i,void(e.localPort=n);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方法的参数`,Ys.indexOf("mp-")===0&&(o+=`
- - 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp`),!e.debugInfo.forceRemote)throw new Error(o);r(o)}function b4(s){s._initPromiseHub||(s._initPromiseHub=new tl({createPromise:function(){let e=Promise.resolve();var t;t=1,e=new Promise(i=>{setTimeout(()=>{i()},t)});const n=s.auth();return e.then(()=>n.getLoginState()).then(i=>i?Promise.resolve():n.signInAnonymously())}}))}const I4={tcb:Jc,tencent:Jc,aliyun:YT,private:Zc,dcloud:Zc,alipay:Rv};let st=new class{init(s){let e={};const t=I4[s.provider];if(!t)throw new Error("未提供正确的provider参数");return e=t.init(s),function(n){const i={};n.__dev__=i,i.debugLog=Ys==="mp-harmony";const r=KT;r&&!r.code&&(i.debugInfo=r);const o=new tl({createPromise:function(){return A4(n)}});i.initLocalNetwork=function(){return o.exec()}}(e),b4(e),Xv(e),function(n){const i=n.uploadFile;n.uploadFile=function(r){return i.call(this,r)}}(e),function(n){n.database=function(i){if(i&&Object.keys(i).length>0)return n.init(i).database();if(this._database)return this._database;const r=uu(fu,{uniClient:n});return this._database=r,r},n.databaseForJQL=function(i){if(i&&Object.keys(i).length>0)return n.init(i).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const r=uu(fu,{uniClient:n,isJQL:!0});return this._databaseForJQL=r,r}}(e),function(n){n.getCurrentUserInfo=d4,n.chooseAndUploadFile=g4.initChooseAndUploadFile(n),Object.assign(n,{get mixinDatacom(){return L0(n)}}),n.SSEChannel=v4,n.initSecureNetworkByWeixin=E4(n),n.setCustomClientInfo=T4,n.importObject=y4(n)}(e),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach(n=>{if(!e[n])return;const i=e[n];e[n]=function(){return i.apply(e,Array.from(arguments))},e[n]=function(r,o){return function(a){let l=!1;o==="callFunction"&&(l=(a&&a.type||Yi.DEFAULT)!==Yi.DEFAULT);const c=o==="callFunction"&&!l,u=this._initPromiseHub.exec();a=a||{};const{success:f,fail:h,complete:d}=e0(a),p=u.then(()=>l?Promise.resolve():Ge(He(o,"invoke"),a)).then(()=>r.call(this,a)).then(m=>l?Promise.resolve(m):Ge(He(o,"success"),m).then(()=>Ge(He(o,"complete"),m)).then(()=>(c&&Ze(xe.RESPONSE,{type:Nt.CLOUD_FUNCTION,content:m}),Promise.resolve(m))),m=>l?Promise.reject(m):Ge(He(o,"fail"),m).then(()=>Ge(He(o,"complete"),m)).then(()=>(Ze(xe.RESPONSE,{type:Nt.CLOUD_FUNCTION,content:m}),Promise.reject(m))));if(!(f||h||d))return p;p.then(m=>{f&&f(m),d&&d(m),c&&Ze(xe.RESPONSE,{type:Nt.CLOUD_FUNCTION,content:m})},m=>{h&&h(m),d&&d(m),c&&Ze(xe.RESPONSE,{type:Nt.CLOUD_FUNCTION,content:m})})}}(e[n],n).bind(e)}),e.init=this.init,e}};(()=>{const s=Yd;let e={};if(s&&s.length===1)e=s[0],st=st.init(e),st._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile"],n=["database","getCurrentUserInfo","importObject"];let i;i=s&&s.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",[...t,...n].forEach(r=>{st[r]=function(){if(console.error(i),n.indexOf(r)===-1)return Promise.reject(new q({code:"SYS_ERR",message:i}));console.error(i)}})}Object.assign(st,{get mixinDatacom(){return L0(st)}}),f4(st),st.addInterceptor=Jd,st.removeInterceptor=qT,st.interceptObject=WT})();var _4=st;const X=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},w4=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=R4},R4=Number.MAX_SAFE_INTEGER||9007199254740991;let Z=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),N=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",s.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",s.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.ASSET_LIST_LOAD_ERROR="assetListLoadError",s.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",s.ASSET_LIST_PARSING_ERROR="assetListParsingError",s.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.ATTACH_MEDIA_ERROR="attachMediaError",s.UNKNOWN="unknown",s}({}),S=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.MEDIA_ENDED="hlsMediaEnded",s.STALL_RESOLVED="hlsStallResolved",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFERED_TO_END="hlsBufferedToEnd",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s.ASSET_LIST_LOADING="hlsAssetListLoading",s.ASSET_LIST_LOADED="hlsAssetListLoaded",s.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",s.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",s.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",s.INTERSTITIAL_STARTED="hlsInterstitialStarted",s.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",s.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",s.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",s.INTERSTITIAL_ENDED="hlsInterstitialEnded",s.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",s.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",s.EVENT_CUE_ENTER="hlsEventCueEnter",s}({});var At={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},se={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class ks{constructor(e,t=0,n=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_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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 L4{constructor(e,t,n,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ks(e),this.fast_=new ks(t),this.defaultTTFB_=i,this.ttfb_=new ks(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:r}=this;n.halfLife!==e&&(this.slow_=new ks(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new ks(t,i.getEstimate(),i.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new ks(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,i=e/1e3,r=n/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,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 C4(s,e,t){return(e=D4(e))in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function de(){return de=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},de.apply(null,arguments)}function mu(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(s);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),t.push.apply(t,n)}return t}function pe(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mu(Object(t),!0).forEach(function(n){C4(s,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):mu(Object(t)).forEach(function(n){Object.defineProperty(s,n,Object.getOwnPropertyDescriptor(t,n))})}return s}function P4(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function D4(s){var e=P4(s,"string");return typeof e=="symbol"?e:e+""}class lt{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 n=`[${e}]:`;this.trace=ns,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}}const ns=function(){},k4={trace:ns,debug:ns,log:ns,warn:ns,info:ns,error:ns};function O4(){return de({},k4)}const F4=O4(),fe=F4;function Hn(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function B4(s){return typeof self<"u"&&s===self.ManagedMediaSource}function P0(s,e){const t=Object.keys(s),n=Object.keys(e),i=t.length,r=n.length;return!i||!r||i===r&&!t.some(o=>n.indexOf(o)===-1)}function We(s,e=!1){if(typeof TextDecoder<"u"){const c=new TextDecoder("utf-8").decode(s);if(e){const u=c.indexOf("\0");return u!==-1?c.substring(0,u):c}return c.replace(/\0/g,"")}const t=s.length;let n,i,r,o="",a=0;for(;a<t;){if(n=s[a++],n===0&&e)return o;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(n);break;case 12:case 13:i=s[a++],o+=String.fromCharCode((n&31)<<6|i&63);break;case 14:i=s[a++],r=s[a++],o+=String.fromCharCode((n&15)<<12|(i&63)<<6|(r&63)<<0);break}}return o}const as={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let n=s[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}};function M4(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Yr={exports:{}},yu;function N4(){return yu||(yu=1,function(s,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,c,u){if(u=u||{},l=l.trim(),c=c.trim(),!c){if(!u.alwaysNormalize)return l;var f=a.parseURL(l);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(c);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)):c;var d=a.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var p=i.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(l){var c=n.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(r,"");l.length!==(l=l.replace(o,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};s.exports=a})()}(Yr)),Yr.exports}N4();class U4{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 je={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};function qe(s){return s.sn!=="initSegment"}const Su=Math.pow(2,32)-1,$4=[].push,D0={video:1,audio:2,id3:3,text:4};function Ie(s){return String.fromCharCode.apply(null,s)}function k0(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function J(s,e){const t=O0(s,e);return t<0?4294967296+t:t}function xu(s,e){let t=J(s,e);return t*=Math.pow(2,32),t+=J(s,e+4),t}function O0(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function G4(s){const e=s.byteLength;for(let t=0;t<e;){const n=J(s,t);if(n>8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=n>1?t+n:e}return!1}function ne(s,e){const t=[];if(!e.length)return t;const n=s.byteLength;for(let i=0;i<n;){const r=J(s,i),o=Ie(s.subarray(i+4,i+8)),a=r>1?i+r:n;if(o===e[0])if(e.length===1)t.push(s.subarray(i+8,a));else{const l=ne(s.subarray(i+8,a),e.slice(1));l.length&&$4.apply(t,l)}i=a}return t}function H4(s){const e=[],t=s[0];let n=8;const i=J(s,n);n+=4;let r=0,o=0;t===0?(r=J(s,n),o=J(s,n+4),n+=8):(r=xu(s,n),o=xu(s,n+8),n+=16),n+=2;let a=s.length+o;const l=k0(s,n);n+=2;for(let c=0;c<l;c++){let u=n;const f=J(s,u);u+=4;const h=f&2147483647;if((f&2147483648)>>>31===1)return fe.warn("SIDX has hierarchical references (not supported)"),null;const p=J(s,u);u+=4,e.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/i,start:a,end:a+h-1}}),a+=h,u+=4,n=u}return{earliestPresentationTime:r,timescale:i,version:t,referencesCount:l,references:e}}function F0(s){const e=[],t=ne(s,["moov","trak"]);for(let i=0;i<t.length;i++){const r=t[i],o=ne(r,["tkhd"])[0];if(o){let a=o[0];const l=J(o,a===0?12:20),c=ne(r,["mdia","mdhd"])[0];if(c){a=c[0];const u=J(c,a===0?12:20),f=ne(r,["mdia","hdlr"])[0];if(f){const h=Ie(f.subarray(8,12)),d={soun:je.AUDIO,vide:je.VIDEO}[h],p=ne(r,["mdia","minf","stbl","stsd"])[0],m=j4(p);d?(e[l]={timescale:u,type:d,stsd:m},e[d]=pe({timescale:u,id:l},m)):e[l]={timescale:u,type:h,stsd:m}}}}}return ne(s,["moov","mvex","trex"]).forEach(i=>{const r=J(i,4),o=e[r];o&&(o.default={duration:J(i,12),flags:J(i,20)})}),e}function j4(s){const e=s.subarray(8),t=e.subarray(86),n=Ie(e.subarray(4,8));let i=n,r;const o=n==="enca"||n==="encv";if(o){const c=ne(e,[n])[0].subarray(n==="enca"?28:78);ne(c,["sinf"]).forEach(f=>{const h=ne(f,["schm"])[0];if(h){const d=Ie(h.subarray(4,8));if(d==="cbcs"||d==="cenc"){const p=ne(f,["frma"])[0];p&&(i=Ie(p))}}})}const a=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const l=ne(t,["avcC"])[0];l&&l.length>3&&(i+="."+di(l[1])+di(l[2])+di(l[3]),r=hi(a==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const l=ne(e,[n])[0],c=ne(l.subarray(28),["esds"])[0];if(c&&c.length>7){let u=4;if(c[u++]!==3)break;u=Xr(c,u),u+=2;const f=c[u++];if(f&128&&(u+=2),f&64&&(u+=c[u++]),c[u++]!==4)break;u=Xr(c,u);const h=c[u++];if(h===64)i+="."+di(h);else break;if(u+=12,c[u++]!==5)break;u=Xr(c,u);const d=c[u++];let p=(d&248)>>3;p===31&&(p+=1+((d&7)<<3)+((c[u]&224)>>5)),i+="."+p}break}case"hvc1":case"hev1":{const l=ne(t,["hvcC"])[0];if(l&&l.length>12){const c=l[1],u=["","A","B","C"][c>>6],f=c&31,h=J(l,2),d=(c&32)>>5?"H":"L",p=l[12],m=l.subarray(6,12);i+="."+u+f,i+="."+K4(h).toString(16).toUpperCase(),i+="."+d+p;let g="";for(let y=m.length;y--;){const E=m[y];(E||g)&&(g="."+E.toString(16).toUpperCase()+g)}i+=g}r=hi(a=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=hi(i,t)||i;break}case"vp09":{const l=ne(t,["vpcC"])[0];if(l&&l.length>6){const c=l[4],u=l[5],f=l[6]>>4&15;i+="."+ut(c)+"."+ut(u)+"."+ut(f)}break}case"av01":{const l=ne(t,["av1C"])[0];if(l&&l.length>2){const c=l[1]>>>5,u=l[1]&31,f=l[2]>>>7?"H":"M",h=(l[2]&64)>>6,d=(l[2]&32)>>5,p=c===2&&h?d?12:10:h?10:8,m=(l[2]&16)>>4,g=(l[2]&8)>>3,y=(l[2]&4)>>2,E=l[2]&3;i+="."+c+"."+ut(u)+f+"."+ut(p)+"."+m+"."+g+y+E+"."+ut(1)+"."+ut(1)+"."+ut(1)+"."+0,r=hi("dav1",t)}break}}return{codec:i,encrypted:o,supplemental:r}}function hi(s,e){const t=ne(e,["dvvC"]),n=t.length?t[0]:ne(e,["dvcC"])[0];if(n){const i=n[2]>>1&127,r=n[2]<<5&32|n[3]>>3&31;return s+"."+ut(i)+"."+ut(r)}}function K4(s){let e=0;for(let t=0;t<32;t++)e|=(s>>t&1)<<31-t;return e>>>0}function Xr(s,e){const t=e+5;for(;s[e++]&128&&e<t;);return e}function di(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function ut(s){return(s<10?"0":"")+s}function V4(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&ne(s,["moov","trak"]).forEach(i=>{const o=ne(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=ne(o,["enca"]);const l=a.length>0;l||(a=ne(o,["encv"])),a.forEach(c=>{const u=l?c.subarray(28):c.subarray(78);ne(u,["sinf"]).forEach(h=>{const d=q4(h);if(d){const p=d.subarray(8,24);p.some(m=>m!==0)||(fe.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${as.hexDump(p)} -> ${as.hexDump(t)}`),d.set(t,8))}})})}),s}function q4(s){const e=ne(s,["schm"])[0];if(e){const t=Ie(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ne(s,["schi","tenc"])[0]}return null}function W4(s,e,t){const n={},i=ne(s,["moof","traf"]);for(let r=0;r<i.length;r++){const o=i[r],a=ne(o,["tfhd"])[0],l=J(a,4),c=e[l];if(!c)continue;const u=n[l]||(n[l]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type}),f=ne(o,["tfdt"])[0];if(f){const x=f[0];let T=J(f,4);x===1&&(T===Su?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(T*=Su+1,T+=J(f,8))),X(T)&&(!X(u.start)||T<u.start)&&(u.start=T)}const h=c.default,d=J(a,0)|(h==null?void 0:h.flags);let p=(h==null?void 0:h.duration)||0;d&8&&(d&2?p=J(a,12):p=J(a,8));const m=ne(o,["trun"]);let g=u.start||0,y=0,E=p;for(let x=0;x<m.length;x++){const T=m[x],v=J(T,4),A=u.sampleCount;u.sampleCount+=v;const b=T[3]&1,I=T[3]&4,C=T[2]&1,_=T[2]&2,D=T[2]&4,H=T[2]&8;let V=8,$=v;for(b&&(V+=4),I&&v&&(!(T[V+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=A),V+=4,C?(E=J(T,V),V+=4):E=p,_&&(V+=4),H&&(V+=4),g+=E,y+=E,$--);$--;)C?(E=J(T,V),V+=4):E=p,_&&(V+=4),D&&(T[V+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-($+1),u.keyFrameStart=g),V+=4),H&&(V+=4),g+=E,y+=E;!y&&p&&(y+=p*v)}u.duration+=y}if(!Object.keys(n).some(r=>n[r].duration)){let r=1/0,o=0;const a=ne(s,["sidx"]);for(let l=0;l<a.length;l++){const c=H4(a[l]);if(c!=null&&c.references){r=Math.min(r,c.earliestPresentationTime/c.timescale);const u=c.references.reduce((f,h)=>f+h.info.duration||0,0);o=Math.max(o,u+c.earliestPresentationTime/c.timescale)}}o&&X(o)&&Object.keys(n).forEach(l=>{n[l].duration||(n[l].duration=o*n[l].timescale-n[l].start)})}return n}function Q4(s){const e={valid:null,remainder:null},t=ne(s,["moof"]);if(t.length<2)return e.remainder=s,e;const n=t[t.length-1];return e.valid=s.slice(0,n.byteOffset-8),e.remainder=s.slice(n.byteOffset-8),e}function et(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Eu(s,e){const t=[],n=e.samples,i=e.timescale,r=e.id;let o=!1;return ne(n,["moof"]).map(l=>{const c=l.byteOffset-8;ne(l,["traf"]).map(f=>{const h=ne(f,["tfdt"]).map(d=>{const p=d[0];let m=J(d,4);return p===1&&(m*=Math.pow(2,32),m+=J(d,8)),m/i})[0];return h!==void 0&&(s=h),ne(f,["tfhd"]).map(d=>{const p=J(d,4),m=J(d,0)&16777215,g=(m&1)!==0,y=(m&2)!==0,E=(m&8)!==0;let x=0;const T=(m&16)!==0;let v=0;const A=(m&32)!==0;let b=8;p===r&&(g&&(b+=8),y&&(b+=4),E&&(x=J(d,b),b+=4),T&&(v=J(d,b),b+=4),A&&(b+=4),e.type==="video"&&(o=br(e.codec)),ne(f,["trun"]).map(I=>{const C=I[0],_=J(I,0)&16777215,D=(_&1)!==0;let H=0;const V=(_&4)!==0,$=(_&256)!==0;let B=0;const F=(_&512)!==0;let U=0;const k=(_&1024)!==0,G=(_&2048)!==0;let M=0;const w=J(I,4);let R=8;D&&(H=J(I,R),R+=4),V&&(R+=4);let P=H+c;for(let O=0;O<w;O++){if($?(B=J(I,R),R+=4):B=x,F?(U=J(I,R),R+=4):U=v,k&&(R+=4),G&&(C===0?M=J(I,R):M=O0(I,R),R+=4),e.type===je.VIDEO){let ee=0;for(;ee<U;){const te=J(n,P);if(P+=4,z4(o,n[P])){const oe=n.subarray(P,P+te);dl(oe,o?2:1,s+M/i,t)}P+=te,ee+=te+4}}s+=B/i}}))})})}),t}function br(s){if(!s)return!1;const e=s.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function z4(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function dl(s,e,t,n){const i=B0(s);let r=0;r+=e;let o=0,a=0,l=0;for(;r<i.length;){o=0;do{if(r>=i.length)break;l=i[r++],o+=l}while(l===255);a=0;do{if(r>=i.length)break;l=i[r++],a+=l}while(l===255);const c=i.length-r;let u=r;if(a<c)r+=a;else if(a>c){fe.error(`Malformed SEI payload. ${a} is too small, only ${c} bytes left to parse.`);break}if(o===4){if(i[u++]===181){const h=k0(i,u);if(u+=2,h===49){const d=J(i,u);if(u+=4,d===1195456820){const p=i[u++];if(p===3){const m=i[u++],g=31&m,y=64&m,E=y?2+g*3:0,x=new Uint8Array(E);if(y){x[0]=m;for(let T=1;T<E;T++)x[T]=i[u++]}n.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=i[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]=i[u++];n.push({payloadType:o,pts:t,uuid:f.join(""),userData:We(d),userDataBytes:d})}}}function B0(s){const e=s.byteLength,t=[];let n=1;for(;n<e-2;)s[n]===0&&s[n+1]===0&&s[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return s;const i=e-t.length,r=new Uint8Array(i);let o=0;for(n=0;n<i;o++,n++)o===t[0]&&(o++,t.shift()),r[n]=s[o];return r}function Y4(s){const e=s[0];let t="",n="",i=0,r=0,o=0,a=0,l=0,c=0;if(e===0){for(;Ie(s.subarray(c,c+1))!=="\0";)t+=Ie(s.subarray(c,c+1)),c+=1;for(t+=Ie(s.subarray(c,c+1)),c+=1;Ie(s.subarray(c,c+1))!=="\0";)n+=Ie(s.subarray(c,c+1)),c+=1;n+=Ie(s.subarray(c,c+1)),c+=1,i=J(s,12),r=J(s,16),a=J(s,20),l=J(s,24),c=28}else if(e===1){c+=4,i=J(s,c),c+=4;const f=J(s,c);c+=4;const h=J(s,c);for(c+=4,o=2**32*f+h,w4(o)||(o=Number.MAX_SAFE_INTEGER,fe.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=J(s,c),c+=4,l=J(s,c),c+=4;Ie(s.subarray(c,c+1))!=="\0";)t+=Ie(s.subarray(c,c+1)),c+=1;for(t+=Ie(s.subarray(c,c+1)),c+=1;Ie(s.subarray(c,c+1))!=="\0";)n+=Ie(s.subarray(c,c+1)),c+=1;n+=Ie(s.subarray(c,c+1)),c+=1}const u=s.subarray(c,s.byteLength);return{schemeIdUri:t,value:n,timeScale:i,presentationTime:o,presentationTimeDelta:r,eventDuration:a,id:l,payload:u}}const M0=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),ca={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 N0(s,e){const t=ca[e];return!!t&&!!t[s.slice(0,4)]}function X4(s,e,t=!0){return!s.split(",").some(n=>!pl(n,e,t))}function pl(s,e,t=!0){var n;const i=Hn(t);return(n=i==null?void 0:i.isTypeSupported(gl(s,e)))!=null?n:!1}function gl(s,e){return`${e}/mp4;codecs=${s}`}function Tu(s){const e=M0();return s.split(",").reduce((t,n)=>{const r=e&&br(n)?9:ca.video[n];return r?(r*2+t)/(t?3:2):(ca.audio[n]+t)/(t?2:1)},0)}const Jr={};function J4(s,e=!0){if(Jr[s])return Jr[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[s];for(let i=0;i<t.length;i++){var n;if(pl(t[i],"audio",e))return Jr[s]=t[i],t[i];if(t[i]==="mp3"&&(n=Hn(e))!=null&&n.isTypeSupported("audio/mpeg"))return""}return s}const Z4=/flac|opus|mp4a\.40\.34/i;function ua(s,e=!0){return s.replace(Z4,t=>J4(t.toLowerCase(),e))}function eA(s,e){const t=[];if(s){const n=s.split(",");for(let i=0;i<n.length;i++)N0(n[i],"video")||t.push(n[i])}return e&&t.push(e),t.join(",")}function Zr(s,e){if(s&&(s.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(s)!==-1)&&(vu(s,"audio")||vu(s,"video")))return s;if(e){const t=e.split(",");if(t.length>1){if(s){for(let n=t.length;n--;)if(t[n].substring(0,4)===s.substring(0,4))return t[n]}return t[0]}}return e||s}function vu(s,e){return N0(s,e)&&pl(s,e)}function tA(s){if(s.startsWith("av01.")){const e=s.split("."),t=["0","111","01","01","01","0"];for(let n=e.length;n>4&&n<10;n++)e[n]=t[n-4];return e.join(".")}return s}function Au(s){const e=Hn(s)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function fa(s){return s.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const U0={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function sA(s,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:s}}function nA(s,e,t,n,i,r){const o=s.videoCodec,a=s.audioCodec?s.audioGroups:null,l=r==null?void 0:r.audioCodec,c=r==null?void 0:r.channels,u=c?parseInt(c):l?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=>br(h))||s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(n,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(i,8e6))||!!f&&X(u)&&Object.keys(f).some(h=>parseInt(h)>u)}function iA(s,e,t,n={}){const i=s.videoCodec;if(!i&&!s.audioCodec||!t)return Promise.resolve(U0);const r=[],o=rA(s),a=o.length,l=oA(s,e,a>0),c=l.length;for(let u=a||1*c||1;u--;){const f={type:"media-source"};if(a&&(f.video=o[u%a]),c){f.audio=l[u%c];const h=f.audio.bitrate;f.video&&h&&(f.video.bitrate-=h)}r.push(f)}if(i){const u=navigator.userAgent;if(i.split(",").some(f=>br(f))&&M0())return Promise.resolve(sA(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),r))}return Promise.all(r.map(u=>{const f=lA(u);return n[f]||(n[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 rA(s){var e;const t=(e=s.videoCodec)==null?void 0:e.split(","),n=$0(s),i=s.width||640,r=s.height||480,o=s.frameRate||30,a=s.videoRange.toLowerCase();return t?t.map(l=>{const c={contentType:gl(tA(l),"video"),width:i,height:r,bitrate:n,framerate:o};return a!=="sdr"&&(c.transferFunction=a),c}):[]}function oA(s,e,t){var n;const i=(n=s.audioCodec)==null?void 0:n.split(","),r=$0(s);return i&&s.audioGroups?s.audioGroups.reduce((o,a)=>{var l;const c=a?(l=e.groups[a])==null?void 0:l.tracks:null;return c?c.reduce((u,f)=>{if(f.groupId===a){const h=parseFloat(f.channels||"");i.forEach(d=>{const p={contentType:gl(d,"audio"),bitrate:t?aA(d,r):r};h&&(p.channels=""+h),u.push(p)})}return u},o):o},[]):[]}function aA(s,e){if(e<=1)return 1;let t=128e3;return s==="ec-3"?t=768e3:s==="ac-3"&&(t=64e4),Math.min(e/2,t)}function $0(s){return Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)/1e3)*1e3||1}function lA(s){let e="";const{audio:t,video:n}=s;if(n){const i=fa(n.contentType);e+=`${i}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(t){const i=fa(t.contentType);e+=`${n?"_":""}${i}_c${t.channels}`}return e}const bu=["NONE","TYPE-0","TYPE-1",null],cA=["SDR","PQ","HLG"];var wi={No:"",Yes:"YES",v2:"v2"};function Iu(s){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=s,i=n<e/2;return e&&i?t?wi.v2:wi.Yes:wi.No}class _u{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}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 Ji{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(n=>!!n).map(n=>n.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const n=(t=e.supplemental)==null?void 0:t.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.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 wu(this._audioGroups,e)}hasSubtitleGroup(e){return wu(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.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 wu(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function uA(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function fA(s,e){let t=!1,n=[];if(s&&(t=s!=="SDR",n=[s]),e){n=e.allowedVideoRanges||cA.slice(0);const i=n.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&uA(),t||(n=["SDR"])}return{preferHDR:t,allowedVideoRanges:n}}const hA=s=>{const e=new WeakSet;return(t,n)=>{if(s&&(n=s(t,n)),typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}},ye=(s,e)=>JSON.stringify(s,hA(e));function dA(s,e,t,n,i){const r=Object.keys(s),o=n==null?void 0:n.channels,a=n==null?void 0:n.audioCodec,l=i==null?void 0:i.videoCodec,c=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:E,allowedVideoRanges:x}=fA(e,i);for(let I=r.length;I--;){const C=s[r[I]];u||(u=C.channels[2]>0),h=Math.min(h,C.minHeight),d=Math.min(d,C.minFramerate),p=Math.min(p,C.minBitrate),x.filter(D=>C.videoRanges[D]>0).length>0&&(f=!0)}h=X(h)?h:0,d=X(d)?d:0;const T=Math.max(1080,h),v=Math.max(30,d);p=X(p)?p:t,t=Math.max(p,t),f||(e=void 0);const A=r.length>1;return{codecSet:r.reduce((I,C)=>{const _=s[C];if(C===I)return I;if(y=f?x.filter(D=>_.videoRanges[D]>0):[],A){if(_.minBitrate>t)return ct(C,`min bitrate of ${_.minBitrate} > current estimate of ${t}`),I;if(!_.hasDefaultAudio)return ct(C,"no renditions with default or auto-select sound found"),I;if(a&&C.indexOf(a.substring(0,4))%5!==0)return ct(C,`audio codec preference "${a}" not found`),I;if(o&&!c){if(!_.channels[o])return ct(C,`no renditions with ${o} channel sound found (channels options: ${Object.keys(_.channels)})`),I}else if((!a||c)&&u&&_.channels[2]===0)return ct(C,"no renditions with stereo sound found"),I;if(_.minHeight>T)return ct(C,`min resolution of ${_.minHeight} > maximum of ${T}`),I;if(_.minFramerate>v)return ct(C,`min framerate of ${_.minFramerate} > maximum of ${v}`),I;if(!y.some(D=>_.videoRanges[D]>0))return ct(C,`no variants with VIDEO-RANGE of ${ye(y)} found`),I;if(l&&C.indexOf(l.substring(0,4))%5!==0)return ct(C,`video codec preference "${l}" not found`),I;if(_.maxScore<g)return ct(C,`max score of ${_.maxScore} < selected max of ${g}`),I}return I&&(Tu(C)>=Tu(I)||_.fragmentError>s[I].fragmentError)?I:(m=_.minIndex,g=_.maxScore,C)},void 0),videoRanges:y,preferHDR:E,minFramerate:d,minBitrate:p,minIndex:m}}function ct(s,e){fe.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function pA(s){return s.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function gA(s,e,t,n){return s.slice(t,n+1).reduce((i,r,o)=>{if(!r.codecSet)return i;const a=r.audioGroups;let l=i[r.codecSet];l||(i[r.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,r.bitrate);const c=Math.min(r.height,r.width);return l.minHeight=Math.min(l.minHeight,c),l.minFramerate=Math.min(l.minFramerate,r.frameRate),l.minIndex=Math.min(l.minIndex,o),l.maxScore=Math.max(l.maxScore,r.score),l.fragmentError+=r.fragmentError,l.videoRanges[r.videoRange]=(l.videoRanges[r.videoRange]||0)+1,a&&a.forEach(u=>{if(!u)return;const f=e.groups[u];f&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(h=>{l.channels[h]=(l.channels[h]||0)+f.channels[h]}))}),i},{})}function Ru(s){if(!s)return s;const{lang:e,assocLang:t,characteristics:n,channels:i,audioCodec:r}=s;return{lang:e,assocLang:t,characteristics:n,channels:i,audioCodec:r}}function mt(s,e,t){if("attrs"in s){const n=e.indexOf(s);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(ms(s,i,t))return n}return-1}function ms(s,e,t){const{groupId:n,name:i,lang:r,assocLang:o,default:a}=s,l=s.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(r===void 0||mA(r,e.lang))&&(r===void 0||e.assocLang===o)&&(a===void 0||e.default===a)&&(l===void 0||e.forced===l)&&(!("characteristics"in s)||yA(s.characteristics||"",e.characteristics))&&(t===void 0||t(s,e))}function mA(s,e="--"){return s.length===e.length?s===e:s.startsWith(e)||e.startsWith(s)}function yA(s,e=""){const t=s.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function is(s,e){const{audioCodec:t,channels:n}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function SA(s,e,t,n,i){const r=e[n],a=e.reduce((h,d,p)=>{const m=d.uri;return(h[m]||(h[m]=[])).push(p),h},{})[r.uri];a.length>1&&(n=Math.max.apply(Math,a));const l=r.videoRange,c=r.frameRate,u=r.codecSet.substring(0,4),f=Lu(e,n,h=>{if(h.videoRange!==l||h.frameRate!==c||h.codecSet.substring(0,4)!==u)return!1;const d=h.audioGroups,p=t.filter(m=>!d||d.indexOf(m.groupId)!==-1);return mt(s,p,i)>-1});return f>-1?f:Lu(e,n,h=>{const d=h.audioGroups,p=t.filter(m=>!d||d.indexOf(m.groupId)!==-1);return mt(s,p,i)>-1})}function Lu(s,e,t){for(let n=e;n>-1;n--)if(t(s[n]))return n;for(let n=e+1;n<s.length;n++)if(t(s[n]))return n;return-1}function G0(s,e){var t;return!!s&&s!==((t=e.loadLevelObj)==null?void 0:t.uri)}class xA extends lt{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 n;const{fragCurrent:i,partCurrent:r,hls:o}=this,{autoLevelEnabled:a,media:l}=o;if(!i||!l)return;const c=performance.now(),u=r?r.stats:i.stats,f=r?r.duration:i.duration,h=c-u.loading.start,d=o.minAutoLevel,p=i.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&&(l.paused||!l.playbackRate||!l.readyState))return;const E=o.mainForwardBufferInfo;if(!y&&E===null)return;const x=this.bwEstimator.getEstimateTTFB(),T=Math.abs(l.playbackRate);if(h<=Math.max(x,1e3*(f/(T*2))))return;const v=E?E.len/T:0,A=u.loading.first?u.loading.first-u.loading.start:-1,b=u.loaded&&A>-1,I=this.getBwEstimate(),C=o.levels,_=C[p],D=Math.max(u.loaded,Math.round(f*(i.bitrate||_.averageBitrate)/8));let H=b?h-A:h;H<1&&b&&(H=Math.min(h,u.loaded*8/I));const V=b?u.loaded*1e3/H:0,$=x/1e3,B=V?(D-u.loaded)/V:D*8/I+$;if(B<=v)return;const F=V?V*8:I,U=((n=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:n.live)===!0,k=this.hls.config.abrBandWidthUpFactor;let G=Number.POSITIVE_INFINITY,M;for(M=p-1;M>d;M--){const O=C[M].maxBitrate,ee=!C[M].details||U;if(G=this.getTimeToLoadFrag($,F,f*O,ee),G<Math.min(v,f+$))break}if(G>=B||G>f*10)return;b?this.bwEstimator.sample(h-Math.min(x,A),u.loaded):this.bwEstimator.sampleTTFB(h);const w=C[M].maxBitrate;this.getBwEstimate()*k>w&&this.resetEstimator(w);const R=this.findBestLevel(w,d,M,0,v,1,1);R>-1&&(M=R),this.warn(`Fragment ${i.sn}${r?" part "+r.index:""} of level ${p} is loading too slowly;
- Fragment duration: ${i.duration.toFixed(3)}
- Time to underbuffer: ${v.toFixed(3)} s
- Estimated load time for current fragment: ${B.toFixed(3)} s
- Estimated load time for down switch fragment: ${G.toFixed(3)} s
- TTFB estimate: ${A|0} ms
- Current BW estimate: ${X(I)?I|0:"Unknown"} bps
- New BW estimate: ${this.getBwEstimate()|0} bps
- Switching to level ${M} @ ${w|0} bps`),o.nextLoadLevel=o.nextAutoLevel=M,this.clearTimer();const P=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===M&&M>0){const O=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${M>0?"and switching down":""}
- Fragment duration: ${i.duration.toFixed(3)} s
- Time to underbuffer: ${O.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,M>d){let ee=this.findBestLevel(this.hls.levels[d].bitrate,d,M,0,O,1,1);ee===-1&&(ee=d),this.hls.nextLoadLevel=this.hls.nextAutoLevel=ee,this.resetEstimator(this.hls.levels[ee].bitrate)}}};g||B>G*2?P():this.timer=self.setInterval(P,G*1e3),o.trigger(S.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,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 L4(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_LOADED,this.onFragLoaded,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_LOADED,this.onFragLoaded,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(S.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 n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case N.BUFFER_ADD_CODEC_ERROR:case N.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case N.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:i,partCurrent:r}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const o=performance.now(),a=r?r.stats:n.stats,l=o-a.loading.start,c=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&c>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(f,c),a.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,n,i){const r=e+n/t,o=i?e+this.lastLevelLoadSec:0;return r+o}onLevelLoaded(e,t){const n=this.hls.config,{loading:i}=t.stats,r=i.end-i.first;X(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===se.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=n?n.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+i.loaded,l=(o.loaded?o.loaded.duration:0)+r;o.loaded={bytes:a,duration:l},o.realBitrate=Math.round(8*a/l)}if(t.bitrateTest){const r={stats:i,frag:t,part:n,id:t.type};this.onFragBuffered(S.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,r=i!=null&&i.stats.loaded?i.stats:n.stats;if(r.aborted||this.ignoreFragment(n))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(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==se.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,r=this.findBestLevel(n,t,e,0,i,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,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=n&&i?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:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:i,config:r,minAutoLevel:o}=n,a=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),c=this.getStarvationDelay();let u=r.abrBandWidthFactor,f=r.abrBandWidthUpFactor;if(c){const g=this.findBestLevel(l,o,i,c,0,u,f);if(g>=0)return this.rebufferNotice=-1,g}let h=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!c){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(l,o,i,c,h,u,f);if(this.rebufferNotice!==d&&(this.rebufferNotice=d,this.info(`${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`)),d>-1)return d;const p=n.levels[o],m=n.loadLevelObj;return m&&(p==null?void 0:p.bitrate)<m.bitrate?o:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,i,r,o,a){var l;const c=i+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 E=p[f],x=!!((l=this.hls.latestLevelDetails)!=null&&l.live),T=g===-1||u===-1;let v,A="SDR",b=(E==null?void 0:E.frameRate)||0;const{audioPreference:I,videoPreference:C}=y,_=this.audioTracksByGroup||(this.audioTracksByGroup=pA(m));let D=-1;if(T){if(this.firstSelection!==-1)return this.firstSelection;const U=this.codecTiers||(this.codecTiers=gA(p,_,t,n)),k=dA(U,A,e,I,C),{codecSet:G,videoRanges:M,minFramerate:w,minBitrate:R,minIndex:P,preferHDR:O}=k;D=P,v=G,A=O?M[M.length-1]:M[0],b=w,e=Math.max(e,R),this.log(`picked start tier ${ye(k)}`)}else v=E==null?void 0:E.codecSet,A=E==null?void 0:E.videoRange;const H=d?d.duration:h?h.duration:0,V=this.bwEstimator.getEstimateTTFB()/1e3,$=[];for(let U=n;U>=t;U--){var B,F;const k=p[U],G=U>f;if(!k)continue;if(y.useMediaCapabilities&&!k.supportedResult&&!k.supportedPromise){const te=navigator.mediaCapabilities;typeof(te==null?void 0:te.decodingInfo)=="function"&&nA(k,_,A,b,e,I)?(k.supportedPromise=iA(k,_,te,this.supportedCache),k.supportedPromise.then(oe=>{if(!this.hls)return;k.supportedResult=oe;const Te=this.hls.levels,he=Te.indexOf(k);oe.error?this.warn(`MediaCapabilities decodingInfo error: "${oe.error}" for level ${he} ${ye(oe)}`):oe.supported?oe.decodingInfoResults.some(ce=>ce.smooth===!1||ce.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${he} not smooth or powerEfficient: ${ye(oe)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${he} ${ye(oe)}`),he>-1&&Te.length>1&&(this.log(`Removing unsupported level ${he}`),this.hls.removeLevel(he),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):k.supportedResult=U0}if((v&&k.codecSet!==v||A&&k.videoRange!==A||G&&b>k.frameRate||!G&&b>0&&b<k.frameRate||(B=k.supportedResult)!=null&&(F=B.decodingInfoResults)!=null&&F.some(te=>te.smooth===!1))&&(!T||U!==D)){$.push(U);continue}const M=k.details,w=(d?M==null?void 0:M.partTarget:M==null?void 0:M.averagetargetduration)||H;let R;G?R=a*e:R=o*e;const P=H&&i>=H*2&&r===0?k.averageBitrate:k.maxBitrate,O=this.getTimeToLoadFrag(V,R,P*w,M===void 0);if(R>=P&&(U===u||k.loadError===0&&k.fragmentError===0)&&(O<=V||!X(O)||x&&!this.bitrateTestDelay||O<c)){const te=this.forcedAutoLevel;return U!==g&&(te===-1||te!==g)&&($.length&&this.trace(`Skipped level(s) ${$.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${p[$[0]].codecs}" ${p[$[0]].videoRange}; not compatible with "${v}" ${A}`),this.info(`switch candidate:${f}->${U} adjustedbw(${Math.round(R)})-bitrate=${Math.round(R-P)} ttfb:${V.toFixed(1)} avgDuration:${w.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${O.toFixed(1)} firstSelection:${T} codecSet:${k.codecSet} videoRange:${k.videoRange} hls.loadLevel:${g}`)),T&&(this.firstSelection=U),U}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}}const H0={search:function(s,e){let t=0,n=s.length-1,i=null,r=null;for(;t<=n;){i=(t+n)/2|0,r=s[i];const o=e(r);if(o>0)t=i+1;else if(o<0)n=i-1;else return r}return null}};function EA(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!X(e))return null;const n=s[0].programDateTime;if(e<(n||0))return null;const i=s[s.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let r=0;r<s.length;++r){const o=s[r];if(vA(e,t,o))return o}return null}function Js(s,e,t=0,n=0,i=.005){let r=null;if(s){r=e[1+s.sn-e[0].sn]||null;const a=s.endDTS-t;a>0&&a<15e-7&&(t+=15e-7),r&&s.level!==r.level&&r.end<=s.end&&(r=e[2+s.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!s||s.level===r.level)&&Cu(t,n,r)===0||TA(r,s,Math.min(i,n))))return r;const o=H0.search(e,Cu.bind(null,t,n));return o&&(o!==s||!r)?o:r}function TA(s,e,t){if(e&&e.start===0&&e.level<s.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,r)=>(r[0]==="INF"&&(i+=parseFloat(r[1])),i),t);return s.start<=n}return!1}function Cu(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=s?1:t.start-n>s&&t.start?-1:0}function vA(s,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>s}function j0(s,e,t){if(s&&s.startCC<=e&&s.endCC>=e){let n=s.fragments;const{fragmentHint:i}=s;i&&(n=n.concat(i));let r;return H0.search(n,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 Zi(s){switch(s.details){case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_TIMEOUT:case N.LEVEL_LOAD_TIMEOUT:case N.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Pu(s,e){const t=Zi(e);return s.default[`${t?"timeout":"error"}Retry`]}function ml(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function Du(s){return pe(pe({},s),{errorRetry:null,timeoutRetry:null})}function er(s,e,t,n){if(!s)return!1;const i=n==null?void 0:n.code,r=e<s.maxNumRetry&&(AA(i)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,n,r):r}function AA(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}var ke={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},rt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class bA extends lt{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(S.ERROR,this.onError,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(S.ERROR,this.onError,this),e.off(S.ERROR,this.onErrorOut,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.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)===se.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;const i=this.hls,r=t.context;switch(t.details){case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case N.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=jn();return}case N.FRAG_GAP:case N.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ke.SendAlternateToPenaltyBox;return}case N.LEVEL_EMPTY_ERROR:case N.LEVEL_PARSING_ERROR:{var o,a;const c=t.parent===se.MAIN?t.level:i.loadLevel;t.details===N.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(a=o.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:typeof(r==null?void 0:r.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case N.AUDIO_TRACK_LOAD_ERROR:case N.AUDIO_TRACK_LOAD_TIMEOUT:case N.SUBTITLE_LOAD_ERROR:case N.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const c=i.loadLevelObj;if(c&&(r.type===At.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===At.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=ke.SendAlternateToPenaltyBox,t.errorAction.flags=rt.MoveAllAlternatesMatchingHost;return}}return;case N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=i.loadLevelObj,u=c==null?void 0:c.attrs["HDCP-LEVEL"];u?t.errorAction={action:ke.SendAlternateToPenaltyBox,flags:rt.MoveAllAlternatesMatchingHDCP,hdcpLevel:u}:this.keySystemError(t)}return;case N.BUFFER_ADD_CODEC_ERROR:case N.REMUX_ALLOC_ERROR:case N.BUFFER_APPEND_ERROR:if(!t.errorAction){var l;t.errorAction=this.getLevelSwitchAction(t,(l=t.level)!=null?l:i.loadLevel)}return;case N.INTERNAL_EXCEPTION:case N.BUFFER_APPENDING_ERROR:case N.BUFFER_FULL_ERROR:case N.LEVEL_SWITCH_ERROR:case N.BUFFER_STALLED_ERROR:case N.BUFFER_SEEK_OVER_HOLE:case N.BUFFER_NUDGE_ON_STALL:t.errorAction=jn();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 n=this.hls,i=Pu(n.config.playlistLoadPolicy,e),r=this.playlistError++;if(er(i,r,Zi(e),e.response))return{action:ke.RetryRequest,flags:rt.None,retryConfig:i,retryCount:r};const a=this.getLevelSwitchAction(e,t);return i&&(a.retryConfig=i,a.retryCount=r),a}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:r,keyLoadPolicy:o}=t.config,a=Pu(e.details.startsWith("key")?o:r,e),l=t.levels.reduce((u,f)=>u+f.fragmentError,0);if(i&&(e.details!==N.FRAG_GAP&&i.fragmentError++,er(a,l,Zi(e),e.response)))return{action:ke.RetryRequest,flags:rt.None,retryConfig:a,retryCount:l};const c=this.getLevelSwitchAction(e,n);return a&&(c.retryConfig=a,c.retryCount=l),c}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var r,o;const c=e.details;i.loadError++,c===N.BUFFER_APPEND_ERROR&&i.fragmentError++;let u=-1;const{levels:f,loadLevel:h,minAutoLevel:d,maxAutoLevel:p}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);const m=(r=e.frag)==null?void 0:r.type,y=(m===se.AUDIO&&c===N.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===N.BUFFER_ADD_CODEC_ERROR||c===N.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:A})=>i.audioCodec!==A),x=e.sourceBufferName==="video"&&(c===N.BUFFER_ADD_CODEC_ERROR||c===N.BUFFER_APPEND_ERROR)&&f.some(({codecSet:A,audioCodec:b})=>i.codecSet!==A&&i.audioCodec===b),{type:T,groupId:v}=(o=e.context)!=null?o:{};for(let A=f.length;A--;){const b=(A+h)%f.length;if(b!==h&&b>=d&&b<=p&&f[b].loadError===0){var a,l;const I=f[b];if(c===N.FRAG_GAP&&m===se.MAIN&&e.frag){const C=f[b].details;if(C){const _=Js(e.frag,C.fragments,e.frag.start);if(_!=null&&_.gap)continue}}else{if(T===At.AUDIO_TRACK&&I.hasAudioGroup(v)||T===At.SUBTITLE_TRACK&&I.hasSubtitleGroup(v))continue;if(m===se.AUDIO&&(a=i.audioGroups)!=null&&a.some(C=>I.hasAudioGroup(C))||m===se.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(C=>I.hasSubtitleGroup(C))||y&&i.audioCodec===I.audioCodec||!y&&i.audioCodec!==I.audioCodec||x&&i.codecSet===I.codecSet)continue}u=b;break}}if(u>-1&&n.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:ke.SendAlternateToPenaltyBox,flags:rt.None,nextAutoLevel:u}}return{action:ke.SendAlternateToPenaltyBox,flags:rt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case ke.DoNothing:break;case ke.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==N.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,n=e.errorAction;if(!n)return;const{flags:i,hdcpLevel:r,nextAutoLevel:o}=n;switch(i){case rt.None:this.switchLevel(e,o);break;case rt.MoveAllAlternatesMatchingHDCP:r&&(t.maxHdcpLevel=bu[bu.indexOf(r)-1],n.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}n.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===N.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const n=fa(e.mimeType),i=this.hls.levels;for(let r=i.length;r--;)i[r][`${e.sourceBufferName}Codec`]===n&&this.hls.removeLevel(r)}}}function jn(s){const e={action:ke.DoNothing,flags:rt.None};return s&&(e.resolved=!0),e}var Je={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},Yt={cbc:0,ctr:1};class IA{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case Yt.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Yt.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 _A(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?s.slice(0,e-t):s}class wA{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),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=t.getUint32(i*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],r=n[1],o=n[2],a=n[3],l=this.invSubMix,c=l[0],u=l[1],f=l[2],h=l[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 E=d[p],x=d[E],T=d[x];let v=d[y]*257^y*16843008;i[p]=v<<24|v>>>8,r[p]=v<<16|v>>>16,o[p]=v<<8|v>>>24,a[p]=v,v=T*16843009^x*65537^E*257^p*16843008,c[y]=v<<24|v>>>8,u[y]=v<<16|v>>>16,f[y]=v<<8|v>>>24,h[y]=v,p?(p=E^d[d[d[T^E]]],m^=d[d[m]]):p=m=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)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,l;const c=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 E,x;for(a=0;a<o;a++){if(a<r){E=c[a]=t[a];continue}x=E,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]),c[a]=E=(c[a-r]^x)>>>0}for(l=0;l<o;l++)a=o-l,l&3?x=c[a]:x=c[a-4],l<4||a<=4?u[l]=x:u[l]=p[f[x>>>24]]^m[f[x>>>16&255]]^g[f[x>>>8&255]]^y[f[x&255]],u[l]=u[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,r=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,l=a[0],c=a[1],u=a[2],f=a[3],h=this.uint8ArrayToUint32Array_(n);let d=h[0],p=h[1],m=h[2],g=h[3];const y=new Int32Array(e),E=new Int32Array(y.length);let x,T,v,A,b,I,C,_,D,H,V,$,B,F;const U=this.networkToHostOrderSwap;for(;t<y.length;){for(D=U(y[t]),H=U(y[t+1]),V=U(y[t+2]),$=U(y[t+3]),b=D^r[0],I=$^r[1],C=V^r[2],_=H^r[3],B=4,F=1;F<i;F++)x=l[b>>>24]^c[I>>16&255]^u[C>>8&255]^f[_&255]^r[B],T=l[I>>>24]^c[C>>16&255]^u[_>>8&255]^f[b&255]^r[B+1],v=l[C>>>24]^c[_>>16&255]^u[b>>8&255]^f[I&255]^r[B+2],A=l[_>>>24]^c[b>>16&255]^u[I>>8&255]^f[C&255]^r[B+3],b=x,I=T,C=v,_=A,B=B+4;x=o[b>>>24]<<24^o[I>>16&255]<<16^o[C>>8&255]<<8^o[_&255]^r[B],T=o[I>>>24]<<24^o[C>>16&255]<<16^o[_>>8&255]<<8^o[b&255]^r[B+1],v=o[C>>>24]<<24^o[_>>16&255]<<16^o[b>>8&255]<<8^o[I&255]^r[B+2],A=o[_>>>24]<<24^o[b>>16&255]<<16^o[I>>8&255]<<8^o[C&255]^r[B+3],E[t]=U(x^d),E[t+1]=U(A^p),E[t+2]=U(v^m),E[t+3]=U(T^g),d=D,p=H,m=V,g=$,t=t+4}return E.buffer}}class RA{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){const e=LA(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function LA(s){switch(s){case Yt.cbc:return"AES-CBC";case Yt.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${s}`)}}const CA=16;class yl{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 n=self.crypto;n&&(this.subtle=n.subtle||n.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 n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?_A(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n,i){return this.useSoftware?new Promise((r,o)=>{const a=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(a,t,n,i);const l=this.flush();l?r(l.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,i)}softwareDecrypt(e,t,n,i){const{currentIV:r,currentResult:o,remainderData:a}=this;if(i!==Yt.cbc||t.byteLength!==16)return fe.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(e=et(a,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;r&&(n=r);let c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new wA),c.expandKey(t);const u=o;return this.currentResult=c.decrypt(l.buffer,0,n),this.currentIV=l.slice(-16).buffer,u||null}webCryptoDecrypt(e,t,n,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,i));this.key=t,this.fastAesKey=new RA(this.subtle,t,i)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new IA(this.subtle,new Uint8Array(n),i).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(fe.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,n,i)))}onWebCryptoError(e,t,n,i){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,i);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 n=e.length-e.length%CA;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&(fe.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const ku=Math.pow(2,17);class PA{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 n=e.url;if(!n)return Promise.reject(new Ot({type:Z.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,r=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(p=>p[0]==="GAP")){l(Fu(e));return}else e.gap=!1;const c=this.loader=r?new r(i):new o(i),u=Ou(e);e.loader=c;const f=Du(i.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:ku};e.stats=c.stats;const d={onSuccess:(p,m,g,y)=>{this.resetLoader(e,c);let E=p.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(E.slice(0,16)),E=E.slice(16)),a({frag:e,part:null,payload:E,networkDetails:y})},onError:(p,m,g,y)=>{this.resetLoader(e,c),l(new Ot({type:Z.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:pe({url:n,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:g,stats:y}))},onAbort:(p,m,g)=>{this.resetLoader(e,c),l(new Ot({type:Z.NETWORK_ERROR,details:N.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:p}))},onTimeout:(p,m,g)=>{this.resetLoader(e,c),l(new Ot({type:Z.NETWORK_ERROR,details:N.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})),c.load(u,h,d)})}loadPart(e,t,n){this.abort();const i=this.config,r=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(Fu(e,t));return}const c=this.loader=r?new r(i):new o(i),u=Ou(e,t);e.loader=c;const f=Du(i.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ku};t.stats=c.stats,c.load(u,h,{onSuccess:(d,p,m,g)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:d.data,networkDetails:g};n(y),a(y)},onError:(d,p,m,g)=>{this.resetLoader(e,c),l(new Ot({type:Z.NETWORK_ERROR,details:N.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:pe({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,c),l(new Ot({type:Z.NETWORK_ERROR,details:N.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:m,stats:d}))},onTimeout:(d,p,m)=>{this.resetLoader(e,c),l(new Ot({type:Z.NETWORK_ERROR,details:N.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 n=e.stats,i=t.stats,r=i.total;if(n.loaded+=i.loaded,r){const l=Math.round(e.duration/t.duration),c=Math.min(Math.round(n.loaded/r),l),f=(l-c)*Math.round(n.loaded/c);n.total=n.loaded+f}else n.total=Math.max(n.loaded,n.total);const o=n.loading,a=i.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 Ou(s,e=null){const t=e||s,n={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(X(i)&&X(r)){var o;let a=i,l=r;if(s.sn==="initSegment"&&DA((o=s.decryptdata)==null?void 0:o.method)){const c=r-i;c%16&&(l=r+(16-c%16)),i!==0&&(n.resetIV=!0,a=i-16)}n.rangeStart=a,n.rangeEnd=l}return n}function Fu(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),n={type:Z.MEDIA_ERROR,details:N.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(n.part=e),(e||s).stats.aborted=!0,new Ot(n)}function DA(s){return s==="AES-128"||s==="AES-256"}class Ot extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class kA extends lt{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 K0{constructor(e,t,n,i=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=pi(),this.buffering={audio:pi(),video:pi(),audiovideo:pi()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=r,this.partial=o}}function pi(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Bu={length:0,start:()=>0,end:()=>0};class ae{static isBuffered(e,t){if(e){const n=ae.getBuffered(e);for(let i=n.length;i--;)if(t>=n.start(i)&&t<=n.end(i))return!0}return!1}static bufferedRanges(e){if(e){const t=ae.getBuffered(e);return ae.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(e,t,n){if(e){const i=ae.bufferedRanges(e);if(i.length)return ae.bufferedInfo(i,t,n)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((u,f)=>u.start-f.start||f.end-u.end);let i=-1,r=[];if(n)for(let u=0;u<e.length;u++){t>=e[u].start&&t<=e[u].end&&(i=u);const f=r.length;if(f){const h=r[f-1].end;e[u].start-h<n?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,l=t,c=t;for(let u=0;u<r.length;u++){const f=r[u].start,h=r[u].end;if(i===-1&&t>=f&&t<=h&&(i=u),t+n>=f&&t<h)l=f,c=h,o=c-t;else if(t+n<f){a=f;break}}return{len:o,start:l||0,end:c||0,nextStart:a,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||Bu}catch(t){return fe.log("failed to get media.buffered",t),Bu}}}const OA=/\{\$([a-zA-Z0-9-_]+)\}/g;function FA(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(OA,n=>{const i=n.substring(2,n.length-1),r=t==null?void 0:t[i];return r===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):r})}return e}const BA=/^(\d+)x(\d+)$/,Mu=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Zn{constructor(e,t){typeof e=="string"&&(e=Zn.parseAttrList(e,t)),de(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 n=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(i*2,i*2+2),16);return n}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 n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((i,r)=>(i[r.toLowerCase()]=!0,i),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=BA.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n;const i={},r='"';for(Mu.lastIndex=0;(n=Mu.exec(e))!==null;){const o=n[1].trim();let a=n[2];const l=a.indexOf(r)===0&&a.lastIndexOf(r)===a.length-1;let c=!1;if(l)a=a.slice(1,-1);else switch(o){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":c=!0}if(t&&(l||c))a=FA(t,a);else if(!c&&!l)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":fe.warn(`${e}: attribute ${o} is missing quotes`)}i[o]=a}return i}}const MA="com.apple.hls.interstitial";class NA{constructor(e,t,n=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(i=t==null?void 0:t.tagOrder)!=null?i:n,t){const r=t.attr;for(const o in r)if(Object.prototype.hasOwnProperty.call(e,o)&&e[o]!==r[o]){fe.warn(`DATERANGE tag attribute: "${o}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=o;break}e=de(new Zn({}),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"]);X(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?(fe.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(X(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===MA}get isValid(){return!!this.id&&!this._badValueForSameId&&X(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)}}function Sl(s){return s==="AES-128"||s==="AES-256"||s==="AES-256-CTR"}function xl(s){switch(s){case"AES-128":case"AES-256":return Yt.cbc;case"AES-256-CTR":return Yt.ctr;default:throw new Error(`invalid full segment method ${s}`)}}function Nu(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const tr=typeof self<"u"?self:void 0;var me={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Gt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Uu(s){switch(s){case Gt.FAIRPLAY:return me.FAIRPLAY;case Gt.PLAYREADY:return me.PLAYREADY;case Gt.WIDEVINE:return me.WIDEVINE;case Gt.CLEARKEY:return me.CLEARKEY}}function $u(s){switch(s){case me.FAIRPLAY:return Gt.FAIRPLAY;case me.PLAYREADY:return Gt.PLAYREADY;case me.WIDEVINE:return Gt.WIDEVINE;case me.CLEARKEY:return Gt.CLEARKEY}}function eo(s){const{drmSystems:e,widevineLicenseUrl:t}=s,n=e?[me.FAIRPLAY,me.WIDEVINE,me.PLAYREADY,me.CLEARKEY].filter(i=>!!e[i]):[];return!n[me.WIDEVINE]&&t&&n.push(me.WIDEVINE),n}const V0=function(s){return tr!=null&&(s=tr.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function UA(s,e,t,n){let i;switch(s){case me.FAIRPLAY:i=["cenc","sinf"];break;case me.WIDEVINE:case me.PLAYREADY:i=["cenc"];break;case me.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return $A(i,e,t,n)}function $A(s,e,t,n){return[{initDataTypes:s,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function GA(s){var e;return s.sessionType==="persistent-license"||!!((e=s.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function HA(s,e){const t=s.length;if(!t)return;const n=s[t-1],i=e.live?1/0:e.totalduration,r=Object.keys(e.dateRanges);for(let o=r.length;o--;){const a=e.dateRanges[r[o]],l=a.startDate.getTime();a.tagAnchor=n.ref;for(let c=t;c--;){const u=jA(e,l,s,c,i);if(u!==-1){a.tagAnchor=e.fragments[u].ref;break}}}}function jA(s,e,t,n,i){const r=t[n];if(r){const a=r.programDateTime;if(e>=a||n===0){var o;const l=(((o=t[n+1])==null?void 0:o.start)||i)-r.start;if(e<=a+l*1e3){const c=t[n].sn-s.startSN,u=s.fragments;if(u.length>t.length){const h=(t[n+1]||u[u.length-1]).sn-s.startSN;for(let d=h;d>c;d--){const p=u[d].programDateTime;if(e>=p&&e<p+u[d].duration*1e3)return d}}return c}}}return-1}function KA(s,e,t){s.rawProgramDateTime?t.push(s):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime)}function to(s,e){const t=e.startPTS;if(X(t)){let n=0,i;e.sn>s.sn?(n=t-s.start,i=s):(n=s.start-t,i=e),i.duration!==n&&i.setDuration(n)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.setStart(s.start+(s.minEndPTS-s.start)):e.setStart(s.start+s.duration):e.setStart(Math.max(s.start-e.duration,0))}function q0(s,e,t,n,i,r){n-t<=0&&(fe.warn("Fragment should have a positive duration",e),n=t+e.duration,r=i+e.duration);let a=t,l=n;const c=e.startPTS,u=e.endPTS;if(X(c)){const g=Math.abs(c-t);X(e.deltaPTS)?e.deltaPTS=Math.max(g,e.deltaPTS):e.deltaPTS=g,a=Math.max(t,c),t=Math.min(t,c),i=Math.min(i,e.startDTS),l=Math.min(n,u),n=Math.max(n,u),r=Math.max(r,e.endDTS)}const f=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(n-e.start),e.startPTS=t,e.maxStartPTS=a,e.startDTS=i,e.endPTS=n,e.minEndPTS=l,e.endDTS=r;const h=e.sn;if(!s||h<s.startSN||h>s.endSN)return 0;let d;const p=h-s.startSN,m=s.fragments;for(m[p]=e,d=p;d>0;d--)to(m[d],m[d-1]);for(d=p;d<m.length-1;d++)to(m[d],m[d+1]);return s.fragmentHint&&to(m[m.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,f}function VA(s,e){if(s===e)return;let t=null;const n=s.fragments;for(let c=n.length-1;c>=0;c--){const u=n[c].initSegment;if(u){t=u;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let i;QA(s,e,(c,u,f,h)=>{if((!e.startCC||e.skippedSegments)&&u.cc!==c.cc){const d=c.cc-u.cc;for(let p=f;p<h.length;p++)h[p].cc+=d;e.endCC=h[h.length-1].cc}X(c.startPTS)&&X(c.endPTS)&&(u.setStart(u.startPTS=c.startPTS),u.startDTS=c.startDTS,u.maxStartPTS=c.maxStartPTS,u.endPTS=c.endPTS,u.endDTS=c.endDTS,u.minEndPTS=c.minEndPTS,u.setDuration(c.endPTS-c.startPTS),u.duration&&(i=u),e.PTSKnown=e.alignedSliding=!0),c.hasStreams&&(u.elementaryStreams=c.elementaryStreams),u.loader=c.loader,c.hasStats&&(u.stats=c.stats),c.initSegment&&(u.initSegment=c.initSegment,t=c.initSegment)});const r=e.fragments,o=e.fragmentHint?r.concat(e.fragmentHint):r;if(t&&o.forEach(c=>{var u;c&&(!c.initSegment||c.initSegment.relurl===((u=t)==null?void 0:u.relurl))&&(c.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=r.some(c=>!c),e.deltaUpdateFailed){fe.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let c=e.skippedSegments;c--;)r.shift();e.startSN=r[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=qA(s.dateRanges,e));const c=s.fragments.filter(u=>u.rawProgramDateTime);if(s.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u<o.length;u++)o[u].programDateTime===null&&KA(o[u],o[u-1],c);HA(c,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var a;const c=Q0(s,e.startSN-1);e.startCC=(a=c==null?void 0:c.cc)!=null?a:r[0].cc}WA(s.partList,e.partList,(c,u)=>{u.elementaryStreams=c.elementaryStreams,u.stats=c.stats}),i?q0(e,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS):W0(s,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const l=e.advancedDateTime;if(e.advanced&&l){const c=e.edge;e.driftStart||(e.driftStartTime=l,e.driftStart=c),e.driftEndTime=l,e.driftEnd=c}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=s.requestScheduled)}function qA(s,e){const{dateRanges:t,recentlyRemovedDateranges:n}=e,i=de({},s);n&&n.forEach(a=>{delete i[a]});const o=Object.keys(i).length;return o&&Object.keys(t).forEach(a=>{const l=i[a],c=new NA(t[a].attr,l);c.isValid?(i[a]=c,l||(c.tagOrder+=o)):fe.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${ye(t[a].attr)}"`)}),i}function WA(s,e,t){if(s&&e){let n=0;for(let i=0,r=s.length;i<=r;i++){const o=s[i],a=e[i+n];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):n--}}}function QA(s,e,t){const n=e.skippedSegments,i=Math.max(s.startSN,e.startSN)-e.startSN,r=(s.fragmentHint?1:0)+(n?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,o=e.startSN-s.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let c=i;c<=r;c++){const u=l[o+c];let f=a[c];if(n&&!f&&u&&(f=e.fragments[c]=u),u&&f){if(t(u,f,c,a),u.url&&u.url!==f.url){e.playlistParsingError=Gu(`media sequence mismatch ${f.sn}:`,s,e,u,f);return}else if(u.cc!==f.cc){e.playlistParsingError=Gu(`discontinuity sequence mismatch (${u.cc}!=${f.cc})`,s,e,u,f);return}}}}function Gu(s,e,t,n,i){return new Error(`${s} ${i.url}
- Playlist starting @${e.startSN}
- ${e.m3u8}
- Playlist starting @${t.startSN}
- ${t.m3u8}`)}function W0(s,e,t=!0){const n=e.startSN+e.skippedSegments-s.startSN,i=s.fragments,r=n>=0;let o=0;if(r&&n<i.length)o=i[n].start;else if(r&&e.startSN===s.endSN+1)o=s.fragmentEnd;else if(r&&t)o=s.fragmentStart+n*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)o=s.fragmentStart;else return;ha(e,o)}function ha(s,e){if(e){const t=s.fragments;for(let n=s.skippedSegments;n<t.length;n++)t[n].addStart(e);s.fragmentHint&&s.fragmentHint.addStart(e)}}function zA(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const n=s.fragments;if(n.length&&t*4>e){const r=n[n.length-1].duration*1e3;r<t&&(t=r)}}else t/=2;return Math.round(t)}function Q0(s,e,t){if(!s)return null;let n=s.fragments[e-s.startSN];return n||(n=s.fragmentHint,n&&n.sn===e)?n:e<s.startSN&&t&&t.sn===e?t:null}function Hu(s,e,t){return s?z0(s.partList,e,t):null}function z0(s,e,t){if(s)for(let n=s.length;n--;){const i=s[n];if(i.index===t&&i.fragment.sn===e)return i}return null}function YA(s){s.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t)})})}function An(s,e){for(let n=0,i=s.length;n<i;n++){var t;if(((t=s[n])==null?void 0:t.cc)===e)return s[n]}return null}function XA(s,e){return!!(s&&e.startCC<s.endCC&&e.endCC>s.startCC)}function ju(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function Y0(s,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)ju(t[n],s);e.fragmentHint&&ju(e.fragmentHint,s),e.alignedSliding=!0}function JA(s,e){s&&(X0(e,s),!e.alignedSliding&&s&&sr(e,s),!e.alignedSliding&&s&&!e.skippedSegments&&W0(s,e,!1))}function X0(s,e){if(!XA(e,s))return;const t=Math.min(e.endCC,s.endCC),n=An(e.fragments,t),i=An(s.fragments,t);if(!n||!i)return;fe.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const r=n.start-i.start;Y0(r,s)}function sr(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,n=e.fragments;if(!t.length||!n.length)return;let i,r;const o=Math.min(e.endCC,s.endCC);e.startCC<o&&s.startCC<o&&(i=An(n,o),r=An(t,o)),(!i||!r)&&(i=n[Math.floor(n.length/2)],r=An(t,i.cc)||t[Math.floor(t.length/2)]);const a=i.programDateTime,l=r.programDateTime;if(!a||!l)return;const c=(l-a)/1e3-(r.start-i.start);Y0(c,s)}const ZA={toString:function(s){let e="";const t=s.length;for(let n=0;n<t;n++)e+=`[${s.start(n).toFixed(3)}-${s.end(n).toFixed(3)}]`;return e}},j={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 J0 extends kA{constructor(e,t,n,i,r){super(i,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=j.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:l,mediaBuffer:c,state:u}=this,f=l?l.currentTime:0,h=ae.bufferInfo(c||l,f,o.maxBufferHole),d=!h.len;if(this.log(`Media seeking to ${X(f)?f.toFixed(3):f}, state: ${u}, ${d?"out of":"in"} buffer`),this.state===j.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(l){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 PA(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new yl(e.config)}registerListeners(){const{hls:e}=this;e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===j.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=j.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 n=e.end||0,i=this.config.timelineOffset||0;if(n<=i)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=ae.bufferedInfo(r,e.start,0));const o=e.nextStart;if(o&&o>i&&o<t.edge||this.media.currentTime<e.start)return!1;const l=t.partList;if(l!=null&&l.length){const u=l[l.length-1];return ae.isBuffered(this.media,u.start+u.duration/2)}const c=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}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 n=this.media=this.mediaBuffer=t.media;n.removeEventListener("seeking",this.onMediaSeeking),n.removeEventListener("ended",this.onMediaEnded),n.addEventListener("seeking",this.onMediaSeeking),n.addEventListener("ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===j.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(i!==null){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),i.removeEventListener("seeking",this.onMediaSeeking),i.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){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=j.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,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const i=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,n,i).then(r=>{if(!r)return;const o=this.state,a=r.frag;if(this.fragContextChanged(a)){(o===j.FRAG_LOADING||!this.fragCurrent&&o===j.PARSING)&&(this.fragmentTracker.removeFragment(a),this.state=j.IDLE);return}"payload"in r&&(this.log(`Loaded ${a.type} sn: ${a.sn} of ${this.playlistLabel()} ${a.level}`),this.hls.trigger(S.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(`Frag error: ${(r==null?void 0:r.message)||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===Je.APPENDING){const r=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,r),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(a,e.duration))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===Je.PARTIAL&&n.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,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(S.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{const i=n==null?void 0:n.frag;if(!i||this.fragContextChanged(i)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{frag:r,payload:o}=n,a=r.decryptdata;if(o&&o.byteLength>0&&a!=null&&a.key&&a.iv&&Sl(a.method)){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(o),a.key.buffer,a.iv.buffer,xl(a.method)).catch(c=>{throw i.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:N.FRAG_DECRYPT_ERROR,fatal:!1,error:c,reason:c.message,frag:r}),c}).then(c=>{const u=self.performance.now();return i.trigger(S.FRAG_DECRYPTED,{frag:r,payload:c,stats:{tstart:l,tdecrypt:u}}),n.payload=c,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==j.STOPPED&&(this.state=j.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.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 n=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:${n?ZA.toString(ae.getBuffered(n)):"(detached)"})`),qe(e)){var i;if(e.type!==se.SUBTITLE){const o=e.elementaryStreams;if(!Object.keys(o).some(a=>!!o[a])){this.state=j.IDLE;return}}const r=(i=this.levels)==null?void 0:i[e.level];r!=null&&r.fragmentError&&(this.log(`Resetting level fragment error count of ${r.fragmentError} on frag buffered`),r.fragmentError=0)}this.state=j.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:n,part:i,partsLoaded:r}=e,o=!r||r.length===0||r.some(l=>!l),a=new K0(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,i){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=j.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(S.KEY_LOADED,f),this.state===j.KEY_LOADING&&(this.state=j.IDLE),f}),this.hls.trigger(S.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 l=this.fragPrevious;if(qe(e)&&(!l||e.sn!==l.sn)){const f=this.shouldLoadParts(t.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${l==null?void 0:l.sn}->${e.sn}`),this.loadingParts=f)}if(n=Math.max(e.start,n||0),this.loadingParts&&qe(e)){const f=o.partList;if(f&&i){n>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(f,e,n);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(n.toFixed(3))}`),this.nextLoadPosition=d.start+d.duration,this.state=j.FRAG_LOADING;let p;return a?p=a.then(m=>!m||this.fragContextChanged(m.frag)?null:this.doFragPartsLoad(e,d,t,i)).catch(m=>this.handleFragLoadError(m)):p=this.doFragPartsLoad(e,d,t,i).catch(m=>this.handleFragLoadError(m)),this.hls.trigger(S.FRAG_LOADING,{frag:e,part:d,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):p}else if(!e.url||this.loadedEndOfParts(f,n))return Promise.resolve(null)}}if(qe(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${n.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(n.toFixed(3))}`),X(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=j.FRAG_LOADING;const c=this.config.progressive;let u;return c&&a?u=a.then(f=>!f||this.fragContextChanged(f==null?void 0:f.frag)?null:this.fragmentLoader.load(e,i)).catch(f=>this.handleFragLoadError(f)):u=Promise.all([this.fragmentLoader.load(e,c?i:void 0),a]).then(([f])=>(!c&&f&&i&&i(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(S.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):u}doFragPartsLoad(e,t,n,i){return new Promise((r,o)=>{var a;const l=[],c=(a=n.details)==null?void 0:a.partList,u=f=>{this.fragmentLoader.loadPart(e,f,i).then(h=>{l[f.index]=h;const d=h.part;this.hls.trigger(S.FRAG_LOADED,h);const p=Hu(n.details,e.sn,f.index+1)||z0(c,e.sn,f.index+1);if(p)u(p);else return r({frag:e,part:d,partsLoaded:l})}).catch(o)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===N.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(S.ERROR,t)}else this.hls.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:N.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==j.PARSING){!this.fragCurrent&&this.state!==j.STOPPED&&this.state!==j.ERROR&&(this.state=j.IDLE);return}const{frag:n,part:i,level:r}=t,o=self.performance.now();n.stats.parsing.end=o,i&&(i.stats.parsing.end=o);const a=this.getLevelDetails(),c=a&&n.sn>a.endSN||this.shouldLoadParts(a,n.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=c),this.updateLevelTiming(n,i,r,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e!=null&&e.partList){var n;const r=e.partList[0],o=r.end+(((n=e.fragmentHint)==null?void 0:n.duration)||0);if(t>=o){var i;if((this.hls.hasEnoughToStart?((i=this.media)==null?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:r,part:o}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const a=t[i],l=a.details,c=o>-1?Hu(l,r,o):null,u=c?c.fragment:Q0(l,r,n);return u?(n&&n!==u&&(u.stats=n.stats),{frag:u,part:c,level:a}):null}bufferFragmentData(e,t,n,i,r){var o;if(!e||this.state!==j.PARSING)return;const{data1:a,data2:l}=e;let c=a;if(a&&l&&(c=et(a,l)),!((o=c)!=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:n,chunkMeta:i,offset:f,parent:t.type,data:c};if(this.hls.trigger(S.BUFFER_APPENDING,h),e.dropped&&e.independent&&!n){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!ae.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=ae.bufferInfo(t,n,0),r=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),a=Math.max(Math.min(e.start-o,i.end-o),n+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){var n;const i=this.getLoadPosition();if(!X(i))return null;const o=this.lastCurrentTime>i||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,o)}getFwdBufferInfoAtPos(e,t,n,i){const r=ae.bufferInfo(e,t,i);if(r.len===0&&r.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,n);if(o&&(r.nextStart<=o.end||o.gap)){const a=Math.max(Math.min(r.nextStart,o.end)-t,i);return ae.bufferInfo(e,t,a)}}return r}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,i=Math.max(Math.min(e-t,n.maxBufferLength),t),r=Math.max(e-t*3,n.maxMaxBufferLength/2,i);return r>=i?(n.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=se.MAIN){var n;const i=(n=this.fragmentTracker)==null?void 0:n.getAppendedFrag(e,t);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:r}=this,o=n[0].start,a=r.lowLatencyMode&&!!t.partList;let l=null;if(t.live){const f=r.initialLiveManifestSize;if(i<f)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${f})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o){var c;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),l=this.getInitialLiveFragment(t);const h=this.hls.startPosition,d=this.hls.liveSyncPosition,p=l?(h!==-1&&h>=o?h:d)||l.start:e;this.log(`Setting startPosition to ${p} to match start frag at live edge. mainStart: ${h} liveSyncPosition: ${d} frag.start: ${(c=l)==null?void 0:c.start}`),this.startPosition=this.nextLoadPosition=p}}else e<=o&&(l=n[0]);if(!l){const f=this.loadingParts?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,f,t)}let u=this.filterReplacedPrimary(l,t);if(!u&&l){const f=l.sn-t.startSN;u=this.filterReplacedPrimary(n[f+1]||null,t)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===Je.OK||n===Je.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,r){let o=null;if(e.gap&&(o=this.getNextFragment(this.nextLoadPosition,t),o&&!o.gap&&n.nextStart)){const a=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i,0);if(a!==null&&n.len+a.len>=r){const l=o.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,o}get primaryPrefetch(){if(Ku(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(Ku(this.hls.config)&&e.type!==se.SUBTITLE){const n=this.hls.interstitialsManager,i=n==null?void 0:n.bufferingItem;if(i){const o=i.event;if(o){if(o.appendInPlace||Math.abs(e.start-i.start)>1||i.start===0)return null}else if(e.end<=i.start&&(t==null?void 0:t.live)===!1||e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}const r=n==null?void 0:n.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,n){let i=-1,r=!1,o=!0;for(let a=0,l=e.length;a<l;a++){const c=e[a];if(o=o&&!c.independent,i>-1&&n<c.start)break;const u=c.loaded;u?i=-1:(r||c.independent||o)&&c.fragment===t&&(i=a),r=u}return i}loadedEndOfParts(e,t){const n=e[e.length-1];return n&&t>n.start&&n.loaded}getInitialLiveFragment(e){const t=e.fragments,n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=EA(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const r=n.sn+1;if(r>=e.startSN&&r<=e.endSN){const o=t[r-e.startSN];n.cc===o.cc&&(i=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=j0(e,n.cc,n.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(i=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:r}=this,{fragments:o,endSN:a}=n;const{fragmentHint:l}=n,{maxFragLookUpTolerance:c}=i,u=n.partList,f=!!(this.loadingParts&&u!=null&&u.length&&l);f&&l&&!this.bitrateTest&&u[u.length-1].fragment.sn===l.sn&&(o=o.concat(l),a=l.sn);let h;if(e<t){var d;const m=e<this.lastCurrentTime||e>t-c||(d=this.media)!=null&&d.paused||!this.startFragRequested?0:c;h=Js(r,o,e,m)}else h=o[o.length-1];if(h){const p=h.sn-n.startSN,m=this.fragmentTracker.getState(h);if((m===Je.OK||m===Je.PARTIAL&&h.gap)&&(r=h),r&&h.sn===r.sn&&(!f||u[0].fragment.sn>h.sn||!n.live&&!f)&&r&&h.level===r.level){const y=o[p+1];h.sn<a&&this.fragmentTracker.getState(y)!==Je.OK?h=y:h=null}}return h}alignPlaylists(e,t,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const r=e.fragmentStart,o=!t,a=e.alignedSliding&&X(r);if(o||!a&&!r){JA(n,e);const l=e.fragmentStart;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${i}`),l}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);const i=this.timelineOffset;if(n===-1){const r=this.startTimeOffset!==null,o=r?this.startTimeOffset:e.startTimeOffset;o!==null&&X(o)?(n=t+o,o<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${o} found in ${r?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+i}this.nextLoadPosition=n+i}getLoadPosition(){var e;const{media:t}=this;let n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&qe(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!==j.FRAG_LOADING_WAITING_RETRY)&&(this.state=j.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const p=this.getCurrentContext(t.chunkMeta);p&&(t.frag=p.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var i;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const r=t.details===N.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction,{action:a,flags:l,retryCount:c=0,retryConfig:u}=o||{},f=!!o&&!!u,h=f&&a===ke.RetryRequest,d=f&&!o.resolved&&l===rt.MoveAllAlternatesMatchingHost;if(!h&&d&&qe(n)&&!n.endList)this.resetFragmentErrors(e),this.treatAsGap(n),o.resolved=!0;else if((h||d)&&c<u.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const p=ml(u,c);this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${c+1}/${u.maxNumRetry} in ${p}ms`),o.resolved=!0,this.retryDate=self.performance.now()+p,this.state=j.FRAG_LOADING_WAITING_RETRY}else if(u&&o)if(this.resetFragmentErrors(e),c<u.maxNumRetry)!r&&a!==ke.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${c})`);return}else a===ke.SendAlternateToPenaltyBox?this.state=j.WAITING_LEVEL:this.state=j.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===j.PARSING||this.state===j.PARSED){const t=e.frag,n=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,n),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.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 ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===se.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==j.STOPPED&&(this.state=j.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const i=ae.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===j.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==j.STOPPED&&(this.state=j.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,n,i){const r=n.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,c)=>{const u=e.elementaryStreams[c];if(u){const f=u.endPTS-u.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${f})`),l||!1;const h=i?0:q0(r,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS);return this.hls.trigger(S.LEVEL_PTS_UPDATED,{details:r,level:n,drift:h,type:c,frag:e,start:u.startPTS,end:u.endPTS}),!0}return l},!1)){var a;if(n.fragmentError===0&&this.treatAsGap(e,n),((a=this.transmuxer)==null?void 0:a.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(l.message),this.hls.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=j.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(S.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===se.MAIN?"level":"track"}fragInfo(e,t=!0,n){var i,r;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${((i=t&&!n?e.startPTS:(n||e).start)!=null?i:NaN).toFixed(3)}-${((r=t&&!n?e.endPTS:(n||e).end)!=null?r:NaN).toFixed(3)}]${n&&e.type==="main"?"INDEPENDENT="+(n.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 Ku(s){return!!s.interstitialsController&&s.enableInterstitialPlayback!==!1}class e6{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=t6(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function t6(s,e){const t=new Uint8Array(e);let n=0;for(let i=0;i<s.length;i++){const r=s[i];t.set(r,n),n+=r.length}return t}var so={exports:{}},Vu;function s6(){return Vu||(Vu=1,function(s){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function r(l,c,u,f,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new i(u,f||l,h),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],d]:l._events[p].push(d):(l._events[p]=d,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,f;if(this._eventsCount===0)return c;for(f in u=this._events)e.call(u,f)&&c.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=t?t+c:c,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(c){var u=t?t+c:c,f=this._events[u];return f?f.fn?1:f.length:0},a.prototype.emit=function(c,u,f,h,d,p){var m=t?t+c:c;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,E,x;if(g.fn){switch(g.once&&this.removeListener(c,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,E=new Array(y-1);x<y;x++)E[x-1]=arguments[x];g.fn.apply(g.context,E)}else{var T=g.length,v;for(x=0;x<T;x++)switch(g[x].once&&this.removeListener(c,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(!E)for(v=1,E=new Array(y-1);v<y;v++)E[v-1]=arguments[v];g[x].fn.apply(g[x].context,E)}}return!0},a.prototype.on=function(c,u,f){return r(this,c,u,f,!1)},a.prototype.once=function(c,u,f){return r(this,c,u,f,!0)},a.prototype.removeListener=function(c,u,f,h){var d=t?t+c:c;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(c){var u;return c?(u=t?t+c:c,this._events[u]&&o(this,u)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a}(so)),so.exports}var n6=s6(),Z0=M4(n6);const nr="1.6.7",Zs={};function i6(){return typeof __HLS_WORKER_BUNDLE__=="function"}function r6(){const s=Zs[nr];if(s)return s.clientCount++,s;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),i={worker:new self.Worker(t),objectURL:t,clientCount:1};return Zs[nr]=i,i}function o6(s){const e=Zs[s];if(e)return e.clientCount++,e;const t=new self.URL(s,self.location.href).href,i={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Zs[s]=i,i}function a6(s){const e=Zs[s||nr];if(e&&e.clientCount--===1){const{worker:n,objectURL:i}=e;delete Zs[s||nr],i&&self.URL.revokeObjectURL(i),n.terminate()}}function ep(s,e){return e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128}function El(s,e){return e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128}function Ir(s,e){let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t}function Kn(s,e){const t=e;let n=0;for(;El(s,e);){n+=10;const i=Ir(s,e+6);n+=i,ep(s,e+10)&&(n+=10),e+=n}if(n>0)return s.subarray(t,t+n)}function l6(s,e,t,n){const i=[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}`);s.emit(S.ERROR,S.ERROR,{type:Z.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!0,error:d,reason:d.message});return}const a=(r>>6&3)+1,l=e[t+3]>>6&3|(r&1)<<2,c="mp4a.40."+a,u=i[o];let f=o;(a===5||a===29)&&(f-=3);const h=[a<<3|(f&14)>>1,(f&1)<<7|l<<3];return fe.log(`manifest codec:${n}, parsed codec:${c}, channels:${l}, rate:${u} (ADTS object type:${a} sampling index:${o})`),{config:h,samplerate:u,channelCount:l,codec:c,parsedCodec:c,manifestCodec:n}}function tp(s,e){return s[e]===255&&(s[e+1]&246)===240}function sp(s,e){return s[e+1]&1?7:9}function Tl(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function c6(s,e){return e+5<s.length}function ir(s,e){return e+1<s.length&&tp(s,e)}function u6(s,e){return c6(s,e)&&tp(s,e)&&Tl(s,e)<=s.length-e}function f6(s,e){if(ir(s,e)){const t=sp(s,e);if(e+t>=s.length)return!1;const n=Tl(s,e);if(n<=t)return!1;const i=e+n;return i===s.length||ir(s,i)}return!1}function np(s,e,t,n,i){if(!s.samplerate){const r=l6(e,t,n,i);if(!r)return;de(s,r)}}function ip(s){return 1024*9e4/s}function h6(s,e){const t=sp(s,e);if(e+t<=s.length){const n=Tl(s,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function rp(s,e,t,n,i){const r=ip(s.samplerate),o=n+i*r,a=h6(e,t);let l;if(a){const{frameLength:f,headerLength:h}=a,d=h+f,p=Math.max(0,t+d-e.length);p?(l=new Uint8Array(d-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+d);const m={unit:l,pts:o};return p||s.samples.push(m),{sample:m,length:d,missing:p}}const c=e.length-t;return l=new Uint8Array(c),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:o},length:c,missing:-1}}function d6(s,e){return El(s,e)&&Ir(s,e+6)+10<=s.length-e}function p6(s){return s instanceof ArrayBuffer?s:s.byteOffset==0&&s.byteLength==s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer}function no(s,e=0,t=1/0){return g6(s,e,t,Uint8Array)}function g6(s,e,t,n){const i=m6(s);let r=1;"BYTES_PER_ELEMENT"in n&&(r=n.BYTES_PER_ELEMENT);const o=y6(s)?s.byteOffset:0,a=(o+s.byteLength)/r,l=(o+e)/r,c=Math.floor(Math.max(0,Math.min(l,a))),u=Math.floor(Math.min(c+Math.max(t,0),a));return new n(i,c,u-c)}function m6(s){return s instanceof ArrayBuffer?s:s.buffer}function y6(s){return s&&s.buffer instanceof ArrayBuffer&&s.byteLength!==void 0&&s.byteOffset!==void 0}function S6(s){const e={key:s.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(s.size<2)return;if(s.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const n=s.data.subarray(1).indexOf(0);if(n===-1)return;const i=We(no(s.data,1,n)),r=s.data[2+n],o=s.data.subarray(3+n).indexOf(0);if(o===-1)return;const a=We(no(s.data,3+n,o));let l;return i==="-->"?l=We(no(s.data,4+n+o)):l=p6(s.data.subarray(4+n+o)),e.mimeType=i,e.pictureType=r,e.description=a,e.data=l,e}function x6(s){if(s.size<2)return;const e=We(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}}function E6(s){if(s.size<2)return;if(s.type==="TXXX"){let t=1;const n=We(s.data.subarray(t),!0);t+=n.length+1;const i=We(s.data.subarray(t));return{key:s.type,info:n,data:i}}const e=We(s.data.subarray(1));return{key:s.type,info:"",data:e}}function T6(s){if(s.type==="WXXX"){if(s.size<2)return;let t=1;const n=We(s.data.subarray(t),!0);t+=n.length+1;const i=We(s.data.subarray(t));return{key:s.type,info:n,data:i}}const e=We(s.data);return{key:s.type,info:"",data:e}}function v6(s){return s.type==="PRIV"?x6(s):s.type[0]==="W"?T6(s):s.type==="APIC"?S6(s):E6(s)}function A6(s){const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=Ir(s,4),n=10;return{type:e,size:t,data:s.subarray(n,n+t)}}const gi=10,b6=10;function I6(s){let e=0;const t=[];for(;El(s,e);){const n=Ir(s,e+6);s[e+5]>>6&1&&(e+=gi),e+=gi;const i=e+n;for(;e+b6<i;){const r=A6(s.subarray(e)),o=v6(r);o&&t.push(o),e+=r.size+gi}ep(s,e)&&(e+=gi)}return t}function _6(s){return s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp"}function w6(s){if(s.data.byteLength===8){const e=new Uint8Array(s.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}}function vl(s){const e=I6(s);for(let t=0;t<e.length;t++){const n=e[t];if(_6(n))return w6(n)}}let en=function(s){return s.audioId3="org.id3",s.dateRange="com.apple.quicktime.HLS",s.emsg="https://aomedia.org/emsg/ID3",s.misbklv="urn:misb:KLV:bin:1910.1",s}({});function ft(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Al{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,n,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,n){}demux(e,t){this.cachedData&&(e=et(this.cachedData,e),this.cachedData=null);let n=Kn(e,0),i=n?n.length:0,r;const o=this._audioTrack,a=this._id3Track,l=n?vl(n):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&X(l))&&(this.basePTS=R6(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:en.audioId3,duration:Number.POSITIVE_INFINITY});i<c;){if(this.canParse(e,i)){const u=this.appendFrame(o,e,i);u?(this.frameIndex++,this.lastPTS=u.sample.pts,i+=u.length,r=i):i=c}else d6(e,i)?(n=Kn(e,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:en.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,r=i):i++;if(i===c&&r!==c){const u=e.slice(r);this.cachedData?this.cachedData=et(this.cachedData,u):this.cachedData=u}}return{audioTrack:o,videoTrack:ft(),id3Track:a,textTrack:ft()}}demuxSampleAes(e,t,n){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:ft(),id3Track:this._id3Track,textTrack:ft()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const R6=(s,e,t)=>{if(X(s))return s*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};let mi=null;const L6=[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],C6=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],P6=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],D6=[0,1,1,4];function op(s,e,t,n,i){if(t+24>e.length)return;const r=ap(e,t);if(r&&t+r.frameLength<=e.length){const o=r.samplesPerFrame*9e4/r.sampleRate,a=n+i*o,l={unit:e.subarray(t,t+r.frameLength),pts:a,dts:a};return s.config=[],s.channelCount=r.channelCount,s.samplerate=r.sampleRate,s.samples.push(l),{sample:l,length:r.frameLength,missing:0}}}function ap(s,e){const t=s[e+1]>>3&3,n=s[e+1]>>1&3,i=s[e+2]>>4&15,r=s[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&r!==3){const o=s[e+2]>>1&1,a=s[e+3]>>6,l=t===3?3-n:n===3?3:4,c=L6[l*14+i-1]*1e3,f=C6[(t===3?0:t===2?1:2)*3+r],h=a===3?1:2,d=P6[t][n],p=D6[n],m=d*8*p,g=Math.floor(d*c/f+o)*p;if(mi===null){const x=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);mi=x?parseInt(x[1]):0}return!!mi&&mi<=87&&n===2&&c>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:f,channelCount:h,frameLength:g,samplesPerFrame:m}}}function bl(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function lp(s,e){return e+1<s.length&&bl(s,e)}function k6(s,e){return bl(s,e)&&4<=s.length-e}function cp(s,e){if(e+1<s.length&&bl(s,e)){const n=ap(s,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const r=e+i;return r===s.length||lp(s,r)}return!1}class O6 extends Al{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const n=Kn(e,0);let i=(n==null?void 0:n.length)||0;if(cp(e,i))return!1;for(let r=e.length;i<r;i++)if(f6(e,i))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return u6(e,t)}appendFrame(e,t,n){np(e,this.observer,t,n,e.manifestCodec);const i=rp(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const up=(s,e)=>{let t=0,n=5;e+=n;const i=new Uint32Array(1),r=new Uint32Array(1),o=new Uint8Array(1);for(;n>0;){o[0]=s[e];const a=Math.min(n,8),l=8-a;r[0]=4278190080>>>24+l<<l,i[0]=(o[0]&r[0])>>l,t=t?t<<a|i[0]:i[0],e+=1,n-=a}return t};class F6 extends Al{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=fp(e,t,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=Kn(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&vl(t)!==void 0&&up(e,n)<16}}function fp(s,e,t,n,i){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],l=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][l*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,E=new Uint8Array([r<<6|g<<1|y>>2,(y&3)<<6|f<<3|d<<2|l>>4,l<<4&224]),x=1536/a*9e4,T=n+i*x,v=e.subarray(t,t+u);return s.config=E,s.channelCount=m,s.samplerate=a,s.samples.push({unit:v,pts:T}),u}class B6 extends Al{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Kn(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&vl(t)!==void 0&&up(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(cp(e,n))return fe.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return k6(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return op(e,t,n,this.basePTS,this.frameIndex)}}const M6=/\/emsg[-/]ID3/i;class N6{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,n,i){const r=this.videoTrack=ft("video",1),o=this.audioTrack=ft("audio",1),a=this.txtTrack=ft("text",1);if(this.id3Track=ft("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=F0(e);if(l.video){const{id:c,timescale:u,codec:f,supplemental:h}=l.video;r.id=c,r.timescale=a.timescale=u,r.codec=f,r.supplemental=h}if(l.audio){const{id:c,timescale:u,codec:f}=l.audio;o.id=c,o.timescale=u,o.codec=f}a.id=D0.text,r.sampleDuration=0,r.duration=o.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return G4(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=et(this.remainderData,e));const a=Q4(n);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=n;const o=this.extractID3Track(i,t);return r.samples=Eu(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=Eu(e,t),{videoTrack:t,audioTrack:ft(),id3Track:i,textTrack:ft()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=ne(e.samples,["emsg"]);i&&i.forEach(r=>{const o=Y4(r);if(M6.test(o.schemeIdUri)){const a=qu(o,t);let l=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const c=o.payload;n.samples.push({data:c,len:c.byteLength,dts:a,pts:a,type:en.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata&&o.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const a=qu(o,t);n.samples.push({data:o.payload,len:o.payload.byteLength,dts:a,pts:a,type:en.misbklv,duration:Number.POSITIVE_INFINITY})}})}return n}demuxSampleAes(e,t,n){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 qu(s,e){return X(s.presentationTime)?s.presentationTime/s.timeScale:e+s.presentationTimeDelta/s.timeScale}class U6{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new yl(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Yt.cbc)}decryptAacSample(e,t,n){const i=e[t].unit;if(i.length<=16)return;const r=i.subarray(16,i.length-i.length%16),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(o).then(a=>{const l=new Uint8Array(a);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)})}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let i=0;for(let r=32;r<e.length-16;r+=160,i+=16)n.set(e.subarray(r,r+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let r=32;r<e.length-16;r+=160,i+=16)e.set(n.subarray(i,i+16),r);return e}decryptAvcSample(e,t,n,i,r){const o=B0(r.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(l=>{r.data=this.getAvcDecryptedUnit(o,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,i)})}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){i();return}const r=e[t].units;for(;!(n>=r.length);n++){const o=r[n];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,n,i,o),!this.decrypter.isSync()))return}}}}class hp{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const r=n.units;i=r[r.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,i=n.length;if(i){const r=n[i-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){const i=t.byteLength;let r=e.naluState||0;const o=r,a=[];let l=0,c,u,f,h=-1,d=0;for(r===-1&&(h=0,d=this.getNALuType(t,0),r=0,l=1);l<i;){if(c=t[l++],!r){r=c?0:1;continue}if(r===1){r=c?0:2;continue}if(!c)r=3;else if(c===1){if(u=l-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&&l<=4-o&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-o)),u>0&&(p.data=et(p.data,t.subarray(0,u)),p.state=0))}l<i?(f=this.getNALuType(t,l),h=l,d=f,r=0):r=-1}else r=0}if(h>=0&&r>=0){const p={data:t.subarray(h,i),type:d,state:r};a.push(p)}if(a.length===0){const p=this.getLastNalUnit(e.samples);p&&(p.data=et(p.data,t))}return e.naluState=r,a}}class bn{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,n=e.byteLength-t,i=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");i.set(e.subarray(n,n+r)),this.word=new DataView(i.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 n=this.word>>>32-t;if(e>32&&fe.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?n<<t|this.readBits(t):n}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 Wu extends hp{parsePES(e,t,n,i){const r=this.parseNALu(e,n.data,i);let o=this.VideoSample,a,l=!1;n.data=null,o&&r.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),r.forEach(c=>{var u,f;switch(c.type){case 1:{let m=!1;a=!0;const g=c.data;if(l&&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,n.pts,n.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,n.pts,n.dts)),o.key=!0,o.frame=!0;break;case 6:{a=!0,dl(c.data,1,n.pts,t.samples);break}case 7:{var d,p;a=!0,l=!0;const m=c.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 E="avc1.";for(let x=0;x<3;x++){let T=y[x].toString(16);T.length<2&&(T="0"+T),E+=T}e.codec=E}break}case 8:a=!0,e.pps=[c.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,n.pts,n.dts));break;case 12:a=!0;break;default:a=!1;break}o&&a&&o.units.push(c)}),i&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new bn(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,i=8,r;for(let o=0;o<e;o++)i!==0&&(r=t.readEG(),i=(n+r+256)%256),n=i===0?n:i}readSPS(e){const t=new bn(e);let n=0,i=0,r=0,o=0,a,l,c;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 E=u();if(f(5),p(3),u(),g(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){const I=h();if(I===3&&p(1),g(),g(),p(1),d())for(l=I!==3?8:12,c=0;c<l;c++)d()&&(c<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(),c=0;c<a;c++)m();g(),p(1);const T=h(),v=h(),A=f(1);A===0&&p(1),p(1),d()&&(n=h(),i=h(),r=h(),o=h());let b=[1,1];if(d()&&d())switch(u()){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((T+1)*16-n*2-i*2),height:(2-A)*(v+1)*16-(A?2:4)*(r+o),pixelRatio:b}}}class Qu extends hp{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,i){const r=this.parseNALu(e,n.data,i);let o=this.VideoSample,a,l=!1;n.data=null,o&&r.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),r.forEach(c=>{var u,f;switch(c.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,n.pts,n.dts)),o.frame=!0,a=!0;break;case 16:case 17:case 18:case 21:if(a=!0,l){var h;(h=o)!=null&&h.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.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,n.pts,n.dts)),o.key=!0,o.frame=!0;break;case 39:a=!0,dl(c.data,2,n.pts,t.samples);break;case 32:a=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=de(e.params,this.readVPS(c.data)),this.initVPS=c.data),e.vps=[c.data];break;case 33:if(a=!0,l=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],c.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const d=this.readSPS(c.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,c.data,e.vps),o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0;break;case 34:if(a=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const d=this.readPPS(c.data);for(const p in d)e.params[p]=d[p]}this.pushParameterSet(e.pps,c.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,n.pts,n.dts));break;default:a=!1;break}o&&a&&o.units.push(c)}),i&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let n=0;for(let i=0;i<e.byteLength;i++)i>=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(t[n]=e[i],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new bn(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const n=t.readBits(3),i=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:i}}readSPS(e){const t=new bn(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const n=t.readBits(3);t.readBoolean();const i=t.readBits(2),r=t.readBoolean(),o=t.readBits(5),a=t.readUByte(),l=t.readUByte(),c=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(),E=[],x=[];for(let re=0;re<n;re++)E.push(t.readBoolean()),x.push(t.readBoolean());if(n>0)for(let re=n;re<8;re++)t.readBits(2);for(let re=0;re<n;re++)E[re]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),x[re]&&t.readUByte();t.readUEG();const T=t.readUEG();T==3&&t.skipBits(1);const v=t.readUEG(),A=t.readUEG(),b=t.readBoolean();let I=0,C=0,_=0,D=0;b&&(I+=t.readUEG(),C+=t.readUEG(),_+=t.readUEG(),D+=t.readUEG());const H=t.readUEG(),V=t.readUEG(),$=t.readUEG(),B=t.readBoolean();for(let re=B?0:n;re<=n;re++)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 De=0;De<4;De++)for(let Qe=0;Qe<(De===3?2:6);Qe++)if(!t.readBoolean())t.readUEG();else{const tt=Math.min(64,1<<4+(De<<1));De>1&&t.readEG();for(let Ls=0;Ls<tt;Ls++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const k=t.readUEG();let G=0;for(let re=0;re<k;re++){let De=!1;if(re!==0&&(De=t.readBoolean()),De){re===k&&t.readUEG(),t.readBoolean(),t.readUEG();let Qe=0;for(let Zt=0;Zt<=G;Zt++){const tt=t.readBoolean();let Ls=!1;tt||(Ls=t.readBoolean()),(tt||Ls)&&Qe++}G=Qe}else{const Qe=t.readUEG(),Zt=t.readUEG();G=Qe+Zt;for(let tt=0;tt<Qe;tt++)t.readUEG(),t.readBoolean();for(let tt=0;tt<Zt;tt++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const re=t.readUEG();for(let De=0;De<re;De++){for(let Qe=0;Qe<$+4;Qe++)t.readBits(1);t.readBits(1)}}let w=0,R=1,P=1,O=!0,ee=1,te=0;t.readBoolean(),t.readBoolean();let oe=!1;if(t.readBoolean()){if(t.readBoolean()){const es=t.readUByte(),Cl=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],ei=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];es>0&&es<16?(R=Cl[es-1],P=ei[es-1]):es===255&&(R=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(),oe=t.readBoolean(),oe&&(I+=t.readUEG(),C+=t.readUEG(),_+=t.readUEG(),D+=t.readUEG()),t.readBoolean()&&(ee=t.readBits(32),te=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const ei=t.readBoolean(),Pl=t.readBoolean();let on=!1;(ei||Pl)&&(on=t.readBoolean(),on&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),on&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Dl=0;Dl<=n;Dl++){O=t.readBoolean();const Mp=O||t.readBoolean();let kl=!1;Mp?t.readEG():kl=t.readBoolean();const Ol=kl?1:t.readUEG()+1;if(ei)for(let an=0;an<Ol;an++)t.readUEG(),t.readUEG(),on&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Pl)for(let an=0;an<Ol;an++)t.readUEG(),t.readUEG(),on&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),w=t.readUEG())}let he=v,ce=A;if(b||oe){let re=1,De=1;T===1?re=De=2:T==2&&(re=2),he=v-re*C-re*I,ce=A-De*D-De*_}const Pe=i?["A","B","C"][i]:"",Jt=a<<24|l<<16|c<<8|u;let Rt=0;for(let re=0;re<32;re++)Rt=(Rt|(Jt>>re&1)<<31-re)>>>0;let _r=Rt.toString(16);return o===1&&_r==="2"&&(_r="6"),{codecString:`hvc1.${Pe}${o}.${_r}.${r?"H":"L"}${y}.B0`,params:{general_tier_flag:r,general_profile_idc:o,general_profile_space:i,general_profile_compatibility_flags:[a,l,c,u],general_constraint_indicator_flags:[f,h,d,p,m,g],general_level_idc:y,bit_depth:H+8,bit_depth_luma_minus8:H,bit_depth_chroma_minus8:V,min_spatial_segmentation_idc:w,chroma_format_idc:T,frame_rate:{fixed:O,fps:te/ee}},width:he,height:ce,pixelRatio:[R,P]}}readPPS(e){const t=new bn(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 i=t.readBoolean(),r=t.readBoolean();let o=1;return r&&i?o=0:r?o=3:i&&(o=2),{parallelismType:o}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const be=188;class Bt{constructor(e,t,n,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=i,this.videoParser=null}static probe(e,t){const n=Bt.syncOffset(e);return n>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),n!==-1}static syncOffset(e){const t=e.length;let n=Math.min(be*5,t-be)+1,i=0;for(;i<n;){let r=!1,o=-1,a=0;for(let l=i;l<t;l+=be)if(e[l]===71&&(t-l===be||e[l+be]===71)){if(a++,o===-1&&(o=l,o!==0&&(n=Math.min(o+be*99,e.length-be)+1)),r||(r=da(e,l)===0),r&&a>1&&(o===0&&a>2||l+be>n))return o}else{if(a)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:D0[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Bt.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=Bt.createTrack("audio",i),this._id3Track=Bt.createTrack("id3"),this._txtTrack=Bt.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){n||(this.sampleAes=null);let r;const o=this._videoTrack,a=this._audioTrack,l=this._id3Track,c=this._txtTrack;let u=o.pid,f=o.pesData,h=a.pid,d=l.pid,p=a.pesData,m=l.pesData,g=null,y=this.pmtParsed,E=this._pmtId,x=e.length;if(this.remainderData&&(e=et(this.remainderData,e),x=e.length,this.remainderData=null),x<be&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:c};const T=Math.max(0,Bt.syncOffset(e));x-=(x-T)%be,x<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,x,e.buffer.byteLength-x));let v=0;for(let b=T;b<x;b+=be)if(e[b]===71){const I=!!(e[b+1]&64),C=da(e,b),_=(e[b+3]&48)>>4;let D;if(_>1){if(D=b+5+e[b+4],D===b+be)continue}else D=b+4;switch(C){case u:if(I){if(f&&(r=Os(f,this.logger))){if(this.videoParser===null)switch(o.segmentCodec){case"avc":this.videoParser=new Wu;break;case"hevc":this.videoParser=new Qu;break}this.videoParser!==null&&this.videoParser.parsePES(o,c,r,!1)}f={data:[],size:0}}f&&(f.data.push(e.subarray(D,b+be)),f.size+=b+be-D);break;case h:if(I){if(p&&(r=Os(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(D,b+be)),p.size+=b+be-D);break;case d:I&&(m&&(r=Os(m,this.logger))&&this.parseID3PES(l,r),m={data:[],size:0}),m&&(m.data.push(e.subarray(D,b+be)),m.size+=b+be-D);break;case 0:I&&(D+=e[D]+1),E=this._pmtId=$6(e,D);break;case E:{I&&(D+=e[D]+1);const H=G6(e,D,this.typeSupported,n,this.observer,this.logger);u=H.videoPid,u>0&&(o.pid=u,o.segmentCodec=H.segmentVideoCodec),h=H.audioPid,h>0&&(a.pid=h,a.segmentCodec=H.segmentAudioCodec),d=H.id3Pid,d>0&&(l.pid=d),g!==null&&!y&&(this.logger.warn(`MPEG-TS PMT found at ${b} after unknown PID '${g}'. Backtracking to sync byte @${T} to parse all TS packets.`),g=null,b=T-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=C;break}}else v++;v>0&&pa(this.observer,new Error(`Found ${v} TS packet/s that do not start with 0x47`),void 0,this.logger),o.pesData=f,a.pesData=p,l.pesData=m;const A={audioTrack:a,videoTrack:o,id3Track:l,textTrack:c};return i&&this.extractRemainingSamples(A),A}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:n,id3Track:i,textTrack:r}=e,o=n.pesData,a=t.pesData,l=i.pesData;let c;if(o&&(c=Os(o,this.logger))){if(this.videoParser===null)switch(n.segmentCodec){case"avc":this.videoParser=new Wu;break;case"hevc":this.videoParser=new Qu;break}this.videoParser!==null&&(this.videoParser.parsePES(n,r,c,!0),n.pesData=null)}else n.pesData=o;if(a&&(c=Os(a,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else a!=null&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;l&&(c=Os(l,this.logger))?(this.parseID3PES(i,c),i.pesData=null):i.pesData=l}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),r=this.sampleAes=new U6(this.observer,this.config,t);return this.decrypt(i,r)}decrypt(e,t){return new Promise(n=>{const{audioTrack:i,videoTrack:r}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{n(e)}):n(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{n(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 n=0;const i=this.aacOverFlow;let r=t.data;if(i){this.aacOverFlow=null;const f=i.missing,h=i.sample.unit.byteLength;if(f===-1)r=et(i.sample.unit,r);else{const d=h-f;i.sample.unit.set(r.subarray(0,f),d),e.samples.push(i.sample),n=i.missing}}let o,a;for(o=n,a=r.length;o<a-1&&!ir(r,o);o++);if(o!==n){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",pa(this.observer,new Error(f),h,this.logger),!h)return}np(e,this.observer,r,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const f=ip(e.samplerate);l=i.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,u;for(;o<a;)if(u=rp(e,r,o,l,c),o+=u.length,u.missing){this.aacOverFlow=u;break}else for(c++;o<a-1&&!ir(r,o);o++);}parseMPEGPES(e,t){const n=t.data,i=n.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<i;)if(lp(n,o)){const l=op(e,n,o,a,r);if(l)o+=l.length,r++;else break}else o++}parseAC3PES(e,t){{const n=t.data,i=t.pts;if(i===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const r=n.length;let o=0,a=0,l;for(;a<r&&(l=fp(e,n,a,i,o++))>0;)a+=l}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=de({},t,{type:this._videoTrack?en.emsg:en.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function da(s,e){return((s[e+1]&31)<<8)+s[e+2]}function $6(s,e){return(s[e+10]&31)<<8|s[e+11]}function G6(s,e,t,n,i,r){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=(s[e+1]&15)<<8|s[e+2],l=e+3+a-4,c=(s[e+10]&15)<<8|s[e+11];for(e+=12+c;e<l;){const u=da(s,e),f=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!n){io("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(!n){io("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(!n){io("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(s[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=s[h+1]+2;h+=m,d-=m}}break;case 194:case 135:return pa(i,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 pa(s,e,t,n){n.warn(`parsing error: ${e.message}`),s.emit(S.ERROR,S.ERROR,{type:Z.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function io(s,e){e.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function Os(s,e){let t=0,n,i,r,o,a;const l=s.data;if(!s||s.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=et(l[0],l[1]),l.splice(1,1);if(n=l[0],(n[0]<<16)+(n[1]<<8)+n[2]===1){if(i=(n[4]<<8)+n[5],i&&i>s.size-6)return null;const u=n[7];u&192&&(o=(n[9]&14)*536870912+(n[10]&255)*4194304+(n[11]&254)*16384+(n[12]&255)*128+(n[13]&254)/2,u&64?(a=(n[14]&14)*536870912+(n[15]&255)*4194304+(n[16]&254)*16384+(n[17]&255)*128+(n[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=n[8];let f=r+9;if(s.size<=f)return null;s.size-=f;const h=new Uint8Array(s.size);for(let d=0,p=l.length;d<p;d++){n=l[d];let m=n.byteLength;if(f)if(f>m){f-=m;continue}else n=n.subarray(f),m-=f,f=0;h.set(n,t),t+=m}return i&&(i-=r+3),{data:h,pts:o,dts:a,len:i}}return null}class H6{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 Pt=Math.pow(2,32)-1;class L{static init(){L.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 L.types)L.types.hasOwnProperty(e)&&(L.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]),n=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]);L.HDLR_TYPES={video:t,audio:n};const i=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]);L.STTS=L.STSC=L.STCO=r,L.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),L.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),L.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),L.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]),l=new Uint8Array([0,0,0,1]);L.FTYP=L.box(L.types.ftyp,o,l,o,a),L.DINF=L.box(L.types.dinf,L.box(L.types.dref,i))}static box(e,...t){let n=8,i=t.length;const r=i;for(;i--;)n+=t[i].byteLength;const o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=n&255,o.set(e,4),i=0,n=8;i<r;i++)o.set(t[i],n),n+=t[i].byteLength;return o}static hdlr(e){return L.box(L.types.hdlr,L.HDLR_TYPES[e])}static mdat(e){return L.box(L.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(Pt+1)),i=Math.floor(t%(Pt+1));return L.box(L.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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return L.box(L.types.mdia,L.mdhd(e.timescale||0,e.duration||0),L.hdlr(e.type),L.minf(e))}static mfhd(e){return L.box(L.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"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(e)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(e))}static moof(e,t,n){return L.box(L.types.moof,L.mfhd(e),L.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=L.trak(e[t]);return L.box.apply(null,[L.types.moov,L.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(L.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=L.trex(e[t]);return L.box.apply(null,[L.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(Pt+1)),i=Math.floor(t%(Pt+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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&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 L.box(L.types.mvhd,r)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,r;for(i=0;i<t.length;i++)r=t[i].flags,n[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return L.box(L.types.sdtp,n)}static stbl(e){return L.box(L.types.stbl,L.stsd(e),L.box(L.types.stts,L.STTS),L.box(L.types.stsc,L.STSC),L.box(L.types.stsz,L.STSZ),L.box(L.types.stco,L.STCO))}static avc1(e){let t=[],n=[],i,r,o;for(i=0;i<e.sps.length;i++)r=e.sps[i],o=r.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(r));for(i=0;i<e.pps.length;i++)r=e.pps[i],o=r.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(r));const a=L.box(L.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),l=e.width,c=e.height,u=e.pixelRatio[0],f=e.pixelRatio[1];return L.box(L.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,c>>8&255,c&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,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.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 L.box(L.types.mp4a,L.audioStsd(e),L.box(L.types.esds,L.esds(e)))}static mp3(e){return L.box(L.types[".mp3"],L.audioStsd(e))}static ac3(e){return L.box(L.types["ac-3"],L.audioStsd(e),L.box(L.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return L.box(L.types.stsd,L.STSD,L.mp4a(e));if(t==="ac3"&&e.config)return L.box(L.types.stsd,L.STSD,L.ac3(e));if(t==="mp3"&&e.codec==="mp3")return L.box(L.types.stsd,L.STSD,L.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return L.box(L.types.stsd,L.STSD,L.avc1(e));if(t==="hevc"&&e.vps)return L.box(L.types.stsd,L.STSD,L.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,n=(e.duration||0)*(e.timescale||0),i=e.width||0,r=e.height||0,o=Math.floor(n/(Pt+1)),a=Math.floor(n%(Pt+1));return L.box(L.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,i>>8&255,i&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const n=L.sdtp(e),i=e.id,r=Math.floor(t/(Pt+1)),o=Math.floor(t%(Pt+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),L.box(L.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])),L.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,L.box(L.types.trak,L.tkhd(e),L.mdia(e))}static trex(e){const t=e.id;return L.box(L.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 n=e.samples||[],i=n.length,r=12+16*i,o=new Uint8Array(r);let a,l,c,u,f,h;for(t+=8+r,o.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<i;a++)l=n[a],c=l.duration,u=l.size,f=l.flags,h=l.cts,o.set([c>>>24&255,c>>>16&255,c>>>8&255,c&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 L.box(L.types.trun,o)}static initSegment(e){L.types||L.init();const t=L.moov(e);return et(L.FTYP,t)}static hvc1(e){const t=e.params,n=[e.vps,e.sps,e.pps],i=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),i-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),n.length]);let o=r.length;for(let p=0;p<n.length;p+=1){o+=3;for(let m=0;m<n[p].length;m+=1)o+=2+n[p][m].length}const a=new Uint8Array(o);a.set(r,0),o=r.length;const l=n.length-1;for(let p=0;p<n.length;p+=1){a.set(new Uint8Array([32+p|(p===l?128:0),0,n[p].length]),o),o+=3;for(let m=0;m<n[p].length;m+=1)a.set(new Uint8Array([n[p][m].length>>8,n[p][m].length&255]),o),o+=2,a.set(n[p][m],o),o+=n[p][m].length}const c=L.box(L.types.hvcC,a),u=e.width,f=e.height,h=e.pixelRatio[0],d=e.pixelRatio[1];return L.box(L.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]),c,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,d>>24,d>>16&255,d>>8&255,d&255])))}}L.types=void 0;L.HDLR_TYPES=void 0;L.STTS=void 0;L.STSC=void 0;L.STCO=void 0;L.STSZ=void 0;L.VMHD=void 0;L.SMHD=void 0;L.STSD=void 0;L.FTYP=void 0;L.DINF=void 0;const dp=9e4;function Il(s,e,t=1,n=!1){const i=s*e*t;return n?Math.round(i):i}function j6(s,e,t=1,n=!1){return Il(s,e,1/t,n)}function hn(s,e=!1){return Il(s,1e3,1/dp,e)}function K6(s,e=1){return Il(s,dp,1/e)}const V6=10*1e3,q6=1024,W6=1152,Q6=1536;let Fs=null,ro=null;function zu(s,e,t,n){return{duration:e,size:t,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:s?2:1,isNonSync:s?0:1}}}class Ri extends lt{constructor(e,t,n,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,Fs===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Fs=o?parseInt(o[1]):0}if(ro===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);ro=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 n=e[0].pts,i=e.reduce((r,o)=>{let a=o.pts,l=a-r;return l<-4294967296&&(t=!0,a=Xe(a,n),l=a-r),l>0?r:a},n);return t&&this.debug("PTS rollover detected"),i}remux(e,t,n,i,r,o,a,l){let c,u,f,h,d,p,m=r,g=r;const y=e.pid>-1,E=t.pid>-1,x=t.samples.length,T=e.samples.length>0,v=a&&x>0||x>1;if((!y||T)&&(!E||v)||this.ISGenerated||a){if(this.ISGenerated){var b,I,C,_;const $=this.videoTrackConfig;($&&(t.width!==$.width||t.height!==$.height||((b=t.pixelRatio)==null?void 0:b[0])!==((I=$.pixelRatio)==null?void 0:I[0])||((C=t.pixelRatio)==null?void 0:C[1])!==((_=$.pixelRatio)==null?void 0:_[1]))||!$&&v||this.nextAudioTs===null&&T)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,r,o));const D=this.isVideoContiguous;let H=-1,V;if(v&&(H=z6(t.samples),!D&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,H>0){this.warn(`Dropped ${H} out of ${x} video samples due to a missing keyframe`);const $=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(H),t.dropped+=H,g+=(t.samples[0].pts-$)/t.inputTimeScale,V=g}else H===-1&&(this.warn(`No keyframe found out of ${x} video samples`),p=!1);if(this.ISGenerated){if(T&&v){const $=this.getVideoStartPts(t.samples),F=(Xe(e.samples[0].pts,$)-$)/t.inputTimeScale;m+=Math.max(0,F),g+=Math.max(0,-F)}if(T){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,E||v||l===se.AUDIO?g:void 0),v){const $=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),f=this.generateIS(e,t,r,o)),c=this.remuxVideo(t,g,D,$)}}else v&&(c=this.remuxVideo(t,g,D,0));c&&(c.firstKeyFrame=H,c.independent=H!==-1,c.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(d=pp(n,r,this._initPTS,this._initDTS)),i.samples.length&&(h=gp(i,r,this._initPTS))),{audio:u,video:c,initSegment:f,independent:p,text:h,id3:d}}generateIS(e,t,n,i){const r=e.samples,o=t.samples,a=this.typeSupported,l={},c=this._initPTS;let u=!c||i,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}l.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):L.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(m=e.id,p=e.inputTimeScale,!c||p!==c.timescale?h=d=r[0].pts-Math.round(p*n):u=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:L.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(m=t.id,p=t.inputTimeScale,!c||p!==c.timescale){const g=this.getVideoStartPts(o),y=Math.round(p*n);d=Math.min(d,Xe(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(l).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:h,timescale:p},this._initDTS={baseTime:d,timescale:p}):h=p=void 0,{tracks:l,initPTS:h,timescale:p,trackId:m}}remuxVideo(e,t,n,i){const r=e.inputTimeScale,o=e.samples,a=[],l=o.length,c=this._initPTS,u=c.baseTime*r/c.timescale;let f=this.nextVideoTs,h=8,d=this.videoSampleDuration,p,m,g=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,E=!1;if(!n||f===null){const w=u+t*r,R=o[0].pts-Xe(o[0].dts,o[0].pts);Fs&&f!==null&&Math.abs(w-R-(f+u))<15e3?n=!0:f=w-R-u}const x=f+u;for(let w=0;w<l;w++){const R=o[w];R.pts=Xe(R.pts,x),R.dts=Xe(R.dts,x),R.dts<o[w>0?w-1:w].dts&&(E=!0)}E&&o.sort(function(w,R){const P=w.dts-R.dts,O=w.pts-R.pts;return P||O}),p=o[0].dts,m=o[o.length-1].dts;const T=m-p,v=T?Math.round(T/(l-1)):d||e.inputTimeScale/30;if(n){const w=p-x,R=w>v,P=w<-1;if((R||P)&&(R?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${hn(w,!0)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${hn(-w,!0)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!P||x>=o[0].pts||Fs)){p=x;const O=o[0].pts-w;if(R)o[0].dts=p,o[0].pts=O;else{let ee=!0;for(let te=0;te<o.length&&!(o[te].dts>O&&ee);te++){const oe=o[te].pts;if(o[te].dts-=w,o[te].pts-=w,te<o.length-1){const Te=o[te+1].pts,he=o[te].pts,ce=Te<=he,Pe=Te<=oe;ee=ce==Pe}}}this.log(`Video: Initial PTS/DTS adjusted: ${hn(O,!0)}/${hn(p,!0)}, delta: ${hn(w,!0)} ms`)}}p=Math.max(0,p);let A=0,b=0,I=p;for(let w=0;w<l;w++){const R=o[w],P=R.units,O=P.length;let ee=0;for(let te=0;te<O;te++)ee+=P[te].data.length;b+=ee,A+=O,R.length=ee,R.dts<I?(R.dts=I,I+=v/4|0||1):I=R.dts,g=Math.min(R.pts,g),y=Math.max(R.pts,y)}m=o[l-1].dts;const C=b+4*A+8;let _;try{_=new Uint8Array(C)}catch(w){this.observer.emit(S.ERROR,S.ERROR,{type:Z.MUX_ERROR,details:N.REMUX_ALLOC_ERROR,fatal:!1,error:w,bytes:C,reason:`fail allocating video mdat ${C}`});return}const D=new DataView(_.buffer);D.setUint32(0,C),_.set(L.types.mdat,4);let H=!1,V=Number.POSITIVE_INFINITY,$=Number.POSITIVE_INFINITY,B=Number.NEGATIVE_INFINITY,F=Number.NEGATIVE_INFINITY;for(let w=0;w<l;w++){const R=o[w],P=R.units;let O=0;for(let oe=0,Te=P.length;oe<Te;oe++){const he=P[oe],ce=he.data,Pe=he.data.byteLength;D.setUint32(h,Pe),h+=4,_.set(ce,h),h+=Pe,O+=4+Pe}let ee;if(w<l-1)d=o[w+1].dts-R.dts,ee=o[w+1].pts-R.pts;else{const oe=this.config,Te=w>0?R.dts-o[w-1].dts:v;if(ee=w>0?R.pts-o[w-1].pts:v,oe.stretchShortVideoTrack&&this.nextAudioTs!==null){const he=Math.floor(oe.maxBufferHole*r),ce=(i?g+i*r:this.nextAudioTs+u)-R.pts;ce>he?(d=ce-Te,d<0?d=Te:H=!0,this.log(`It is approximately ${ce/90} ms to the next segment; using duration ${d/90} ms for the last video frame.`)):d=Te}else d=Te}const te=Math.round(R.pts-R.dts);V=Math.min(V,d),B=Math.max(B,d),$=Math.min($,ee),F=Math.max(F,ee),a.push(zu(R.key,d,O,te))}if(a.length){if(Fs){if(Fs<70){const w=a[0].flags;w.dependsOn=2,w.isNonSync=0}}else if(ro&&F-$<B-V&&v/B<.025&&a[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let w=p;for(let R=0,P=a.length;R<P;R++){const O=w+a[R].duration,ee=w+a[R].cts;if(R<P-1){const te=O+a[R+1].cts;a[R].duration=te-ee}else a[R].duration=R?a[R-1].duration:v;a[R].cts=0,w=O}}}d=H||!d?v:d;const U=m+d;this.nextVideoTs=f=U-u,this.videoSampleDuration=d,this.isVideoContiguous=!0;const M={data1:L.moof(e.sequenceNumber++,p,de(e,{samples:a})),data2:_,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,M}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return W6;case"ac3":return Q6;default:return q6}}remuxAudio(e,t,n,i,r){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,l=o/a,c=this.getSamplesPerFrame(e),u=c*l,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 E=f.baseTime*o/f.timescale,x=E+t*o;if(this.isAudioContiguous=n=n||m.length&&y>0&&(i&&Math.abs(x-(y+E))<9e3||Math.abs(Xe(m[0].pts,x)-(y+E))<20*u),m.forEach(function(F){F.pts=Xe(F.pts,x)}),!n||y<0){if(m=m.filter(F=>F.pts>=0),!m.length)return;r===0?y=0:i&&!p?y=Math.max(0,x-E):y=m[0].pts-E}if(e.segmentCodec==="aac"){const F=this.config.maxAudioFramesDrift;for(let U=0,k=y+E;U<m.length;U++){const G=m[U],M=G.pts,w=M-k,R=Math.abs(1e3*w/o);if(w<=-F*u&&p)U===0&&(this.warn(`Audio frame @ ${(M/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*w/o)} ms.`),this.nextAudioTs=y=M-E,k=M);else if(w>=F*u&&R<V6&&p){let P=Math.round(w/u);for(k=M-P*u;k<0&&P&&u;)P--,k+=u;U===0&&(this.nextAudioTs=y=k-E),this.warn(`Injecting ${P} audio frames @ ${((k-E)/o).toFixed(3)}s due to ${Math.round(1e3*w/o)} ms gap.`);for(let O=0;O<P;O++){let ee=H6.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);ee||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),ee=G.unit.subarray()),m.splice(U,0,{unit:ee,pts:k}),k+=u,U++}}G.pts=k,k+=u}}let T=null,v=null,A,b=0,I=m.length;for(;I--;)b+=m[I].unit.byteLength;for(let F=0,U=m.length;F<U;F++){const k=m[F],G=k.unit;let M=k.pts;if(v!==null){const R=d[F-1];R.duration=Math.round((M-v)/l)}else if(n&&e.segmentCodec==="aac"&&(M=y+E),T=M,b>0){b+=g;try{A=new Uint8Array(b)}catch(R){this.observer.emit(S.ERROR,S.ERROR,{type:Z.MUX_ERROR,details:N.REMUX_ALLOC_ERROR,fatal:!1,error:R,bytes:b,reason:`fail allocating audio mdat ${b}`});return}h||(new DataView(A.buffer).setUint32(0,b),A.set(L.types.mdat,4))}else return;A.set(G,g);const w=G.byteLength;g+=w,d.push(zu(!0,c,w,0)),v=M}const C=d.length;if(!C)return;const _=d[d.length-1];y=v-E,this.nextAudioTs=y+l*_.duration;const D=h?new Uint8Array(0):L.moof(e.sequenceNumber++,T/l,de({},e,{samples:d}));e.samples=[];const H=(T-E)/o,V=y/o,B={data1:D,data2:A,startPTS:H,endPTS:V,startDTS:H,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:C};return this.isAudioContiguous=!0,B}}function Xe(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function z6(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function pp(s,e,t,n){const i=s.samples.length;if(!i)return;const r=s.inputTimeScale;for(let a=0;a<i;a++){const l=s.samples[a];l.pts=Xe(l.pts-t.baseTime*r/t.timescale,e*r)/r,l.dts=Xe(l.dts-n.baseTime*r/n.timescale,e*r)/r}const o=s.samples;return s.samples=[],{samples:o}}function gp(s,e,t){const n=s.samples.length;if(!n)return;const i=s.inputTimeScale;for(let o=0;o<n;o++){const a=s.samples[o];a.pts=Xe(a.pts-t.baseTime*i/t.timescale,e*i)/i}s.samples.sort((o,a)=>o.pts-a.pts);const r=s.samples;return s.samples=[],{samples:r}}class Y6 extends lt{constructor(e,t,n,i){super("passthrough-remuxer",i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(V4(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=F0(e);i.audio&&(t=Yu(i.audio,je.AUDIO,this)),i.video&&(n=Yu(i.video,je.VIDEO,this));const r={};i.audio&&i.video?r.audiovideo={container:"video/mp4",codec:t+","+n,supplemental:i.video.supplemental,initSegment:e,id:"main"}:i.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?r.video={container:"video/mp4",codec:n,supplemental:i.video.supplemental,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,n,i,r,o){var a,l;let{initPTS:c,lastEndTime:u}=this;const f={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};X(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),!((l=p)!=null&&l.length))return this.warn("Failed to generate initSegment."),f;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const m=W4(h,p,this),g=p.audio?m[p.audio.id]:null,y=p.video?m[p.video.id]:null,E=yi(y,1/0),x=yi(g,1/0),T=yi(y,0,!0),v=yi(g,0,!0);let A,b=r,I=0;if(g&&(!y||!c&&x<E||c&&c.trackId===p.audio.id)?(d.trackId=p.audio.id,A=g,I=v-x):y&&(d.trackId=p.video.id,A=y,I=T-E),A){const F=A.timescale;b=A.start/F,d.initPTS=A.start-r*F,d.timescale=F,c||(this.initPTS=c={baseTime:d.initPTS,timescale:F,trackId:d.trackId})}(o||!c)&&(X6(c,b,r,I)||d.timescale!==c.timescale)&&(d.initPTS=b-r,d.timescale=1,c&&c.timescale===1&&this.warn(`Adjusting initPTS @${r} from ${c.baseTime/c.timescale} to ${d.initPTS}`),this.initPTS=c={baseTime:d.initPTS,timescale:1});const C=e?b-c.baseTime/c.timescale:u,_=C+I;I>0?this.lastEndTime=_:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const D=!!p.audio,H=!!p.video;let V="";D&&(V+="audio"),H&&(V+="video");const $={data1:h,startPTS:C,startDTS:C,endPTS:_,endDTS:_,type:V,hasAudio:D,hasVideo:H,nb:1,dropped:0};f.audio=D&&!H?$:void 0,f.video=H?$:void 0;const B=y==null?void 0:y.sampleCount;if(B){const F=y.keyFrameIndex,U=F!==-1;$.nb=B,$.dropped=F===0||this.isVideoContiguous?0:U?F:B,$.independent=U,$.firstKeyFrame=F,U&&y.keyFrameStart&&($.firstKeyFramePTS=(y.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(f.independent=U),this.isVideoContiguous||(this.isVideoContiguous=U),$.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${F}/${B} dropped: ${$.dropped} start: ${$.firstKeyFramePTS||"NA"}`)}return f.initSegment=d,f.id3=pp(n,r,c,c),i.samples.length&&(f.text=gp(i,r,c)),f}}function yi(s,e,t=!1){return(s==null?void 0:s.start)!==void 0?(s.start+(t?s.duration:0))/s.timescale:e}function X6(s,e,t,n){if(s===null)return!0;const i=Math.max(n,1),r=e-s.baseTime/s.timescale;return Math.abs(r-t)>i}function Yu(s,e,t){const n=s==null?void 0:s.codec;return n&&n.length>4?n:e===je.AUDIO?n==="ec-3"||n==="ac-3"||n==="alac"?n:n==="fLaC"||n==="Opus"?ua(n,!1):(t.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"):(t.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1")}let vt;try{vt=self.performance.now.bind(self.performance)}catch{vt=Date.now}const Li=[{demux:N6,remux:Y6},{demux:Bt,remux:Ri},{demux:O6,remux:Ri},{demux:B6,remux:Ri}];Li.splice(2,0,{demux:F6,remux:Ri});class Xu{constructor(e,t,n,i,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=n,this.id=r,this.logger=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const r=n.transmuxing;r.executeStart=vt();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:u,trackSwitch:f,accurateTimeOffset:h,timeOffset:d,initSegmentChange:p}=i||a,{audioCodec:m,videoCodec:g,defaultInitPts:y,duration:E,initSegmentData:x}=l,T=J6(o,t);if(T&&Sl(T.method)){const I=this.getDecrypter(),C=xl(T.method);if(I.isSync()){let _=I.softwareDecrypt(o,T.key.buffer,T.iv.buffer,C);if(n.part>-1){const H=I.flush();_=H&&H.buffer}if(!_)return r.executeEnd=vt(),oo(n);o=new Uint8Array(_)}else return this.asyncResult=!0,this.decryptionPromise=I.webCryptoDecrypt(o,T.key.buffer,T.iv.buffer,C).then(_=>{const D=this.push(_,null,n);return this.decryptionPromise=null,D}),this.decryptionPromise}const v=this.needsProbing(u,f);if(v){const I=this.configureTransmuxer(o);if(I)return this.logger.warn(`[transmuxer] ${I.message}`),this.observer.emit(S.ERROR,S.ERROR,{type:Z.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,fatal:!1,error:I,reason:I.message}),r.executeEnd=vt(),oo(n)}(u||f||p||v)&&this.resetInitSegment(x,m,g,E,t),(u||p||v)&&this.resetInitialTimestamp(y),c||this.resetContiguity();const A=this.transmux(o,T,d,h,n);this.asyncResult=rr(A);const b=this.currentTransmuxState;return b.contiguous=!0,b.discontinuity=!1,b.trackSwitch=!1,r.executeEnd=vt(),A}flush(e){const t=e.transmuxing;t.executeStart=vt();const{decrypter:n,currentTransmuxState:i,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(e));const o=[],{timeOffset:a}=i;if(n){const f=n.flush();f&&o.push(this.push(f.buffer,null,e))}const{demuxer:l,remuxer:c}=this;if(!l||!c){t.executeEnd=vt();const f=[oo(e)];return this.asyncResult?Promise.resolve(f):f}const u=l.flush(a);return rr(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,n){const{audioTrack:i,videoTrack:r,id3Track:o,textTrack:a}=t,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===se.MAIN?"level":"track"} ${n.level}`);const u=this.remuxer.remux(i,r,o,a,c,l,!0,this.id);e.push({remuxResult:u,chunkMeta:n}),n.transmuxing.executeEnd=vt()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,r){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,n,i),a.resetInitSegment(e,t,n,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,r){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,n,i,r):o=this.transmuxUnencrypted(e,n,i,r),o}transmuxUnencrypted(e,t,n,i){const{audioTrack:r,videoTrack:o,id3Track:a,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,o,a,l,t,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,r){return this.demuxer.demuxSampleAes(e,t,n).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,n,i,!1,this.id),chunkMeta:r}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i}=this;let r;for(let f=0,h=Li.length;f<h;f++){var o;if((o=Li[f].demux)!=null&&o.probe(e,this.logger)){r=Li[f];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,l=this.remuxer,c=r.remux,u=r.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(n,t,i,this.logger)),(!a||!(a instanceof u))&&(this.demuxer=new u(n,t,i,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 yl(this.config)),e}}function J6(s,e){let t=null;return s.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const oo=s=>({remuxResult:{},chunkMeta:s});function rr(s){return"then"in s&&s.then instanceof Function}class Z6{constructor(e,t,n,i,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=n,this.duration=i,this.defaultInitPts=r||null}}class e5{constructor(e,t,n,i,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=n,this.trackSwitch=i,this.timeOffset=r,this.initSegmentChange=o}}let Ju=0;class t5{constructor(e,t,n,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Ju++,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=l=>{const c=l.data,u=this.hls;if(!(!u||!(c!=null&&c.event)||c.instanceNo!==this.instanceNo))switch(c.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(c.data);break}case"flush":{this.onFlush(c.data);break}case"workerLog":{u.logger[c.data.logType]&&u.logger[c.data.logType](c.data.message);break}default:{c.data=c.data||{},c.data.frag=this.frag,c.data.part=this.part,c.data.id=this.id,u.trigger(c.event,c.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const c=new Error(`${l.message} (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:N.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:c})};const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const o=(l,c)=>{c=c||{},c.frag=this.frag||void 0,l===S.ERROR&&(c=c,c.parent=this.id,c.part=this.part,this.error=c.error),this.hls.trigger(l,c)};this.observer=new Z0,this.observer.on(S.FRAG_DECRYPTED,o),this.observer.on(S.ERROR,o);const a=Au(r.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(r.workerPath||i6()){try{r.workerPath?(l.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=o6(r.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=r6());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:ye(r)})}catch(u){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new Xu(this.observer,a,r,"",t,e.logger)}return}}this.transmuxer=new Xu(this.observer,a,r,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Ju++;const t=this.hls.config,n=Au(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,config:ye(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),a6(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,n,i,r,o,a,l,c,u){var f,h;c.transmuxing.start=self.performance.now();const{instanceNo:d,transmuxer:p}=this,m=o?o.start:r.start,g=r.decryptdata,y=this.frag,E=!(y&&r.cc===y.cc),x=!(y&&c.level===y.level),T=y?c.sn-y.sn:-1,v=this.part?c.part-this.part.index:-1,A=T===0&&c.id>1&&c.id===(y==null?void 0:y.stats.chunkCount),b=!x&&(T===1||T===0&&(v===1||A&&v<=0)),I=self.performance.now();(x||T||r.stats.parsing.start===0)&&(r.stats.parsing.start=I),o&&(v||!b)&&(o.stats.parsing.start=I);const C=!(y&&((f=r.initSegment)==null?void 0:f.url)===((h=y.initSegment)==null?void 0:h.url)),_=new e5(E,b,l,x,m,C);if(!b||E||C){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${c.sn}${c.part>-1?" part: "+c.part:""} ${this.id===se.MAIN?"level":"track"}: ${c.level} id: ${c.id}
- discontinuity: ${E}
- trackSwitch: ${x}
- contiguous: ${b}
- accurateTimeOffset: ${l}
- timeOffset: ${m}
- initSegmentChange: ${C}`);const D=new Z6(n,i,t,a,u);this.configureTransmuxer(D)}if(this.frag=r,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:d,cmd:"demux",data:e,decryptdata:g,chunkMeta:c,state:_},e instanceof ArrayBuffer?[e]:[]);else if(p){const D=p.push(e,g,c,_);rr(D)?D.then(H=>{this.handleTransmuxComplete(H)}).catch(H=>{this.transmuxerError(H,c,"transmuxer-interface push error")}):this.handleTransmuxComplete(D)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(n){const i=n.flush(e);rr(i)?i.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")}):this.handleFlushResult(i,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:N.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Zu=100;class s5 extends J0{constructor(e,t,n){super(e,t,n,"audio-stream-controller",se.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(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(S.BUFFER_RESET,this.onBufferReset,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(S.BUFFER_RESET,this.onBufferReset,this),e.off(S.BUFFER_CREATED,this.onBufferCreated,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:r}){if(n===se.MAIN){const o=t.cc,a=this.fragCurrent;if(this.initPTS[o]={baseTime:i,timescale:r},this.log(`InitPTS for cc: ${o} found from main: ${i}/${r}`),this.mainAnchor=t,this.state===j.WAITING_INIT_PTS){const l=this.waitingData;(!l&&!this.loadingParts||l&&l.frag.cc!==o)&&this.syncWithAnchor(t,l==null?void 0:l.frag)}else!this.hls.hasEnoughToStart&&a&&a.cc!==o?(a.abortRequests(),this.syncWithAnchor(t,a)):this.state===j.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var n;const i=((n=this.mainFragLoading)==null?void 0:n.frag)||null;if(t&&(i==null?void 0:i.cc)===t.cc)return;const r=(i||e).cc,o=this.getLevelDetails(),a=this.getLoadPosition(),l=j0(o,r,a);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===j.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=j.STOPPED;return}const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(Zu),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=j.IDLE):this.state=j.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case j.IDLE:this.doTickIdle();break;case j.WAITING_TRACK:{const{levels:t,trackId:n}=this,i=t==null?void 0:t[n],r=i==null?void 0:i.details;if(r&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(r))break;this.state=j.WAITING_INIT_PTS}break}case j.FRAG_LOADING_WAITING_RETRY:{var e;const t=performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){const{levels:i,trackId:r}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((i==null?void 0:i[r])||null),this.state=j.IDLE}break}case j.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:n,part:i,cache:r,complete:o}=t,a=this.mainAnchor;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.state=j.FRAG_LOADING;const l=r.flush().buffer,c={frag:n,part:i,payload:l,networkDetails:null};this._handleFragmentLoadProgress(c),o&&super._handleFragmentLoadComplete(c)}else a&&a.cc!==t.frag.cc&&this.syncWithAnchor(a,t.frag)}else this.state=j.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:n,media:i,trackId:r}=this,o=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!o.startFragPrefetch)||!(n!=null&&n[r]))return;const a=n[r],l=a.details;if(!l||this.waitForLive(a)||this.waitForCdnTuneIn(l)){this.state=j.WAITING_TRACK,this.startFragRequested=!1;return}const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,je.AUDIO,se.AUDIO));const u=this.getFwdBufferInfo(c,se.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,l)){t.trigger(S.BUFFER_EOS,{type:"audio"}),this.state=j.ENDED;return}const f=u.len,h=t.maxBufferLength,d=l.fragments,p=d[0].start,m=this.getLoadPosition(),g=this.flushing?m:u.end;if(this.switchingTrack&&i){const x=m;l.PTSKnown&&x<p&&(u.end>p||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=p+.05)}if(f>=h&&!this.switchingTrack&&g<d[d.length-1].start)return;let y=this.getNextFragment(g,l);if(y&&this.isLoopLoading(y,g)&&(y=this.getNextFragmentLoopLoading(y,l,u,se.MAIN,h)),!y){this.bufferFlushed=!0;return}let E=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&E&&qe(y)&&!y.endList&&(!l.live||!this.loadingParts&&g<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(E)===Je.OK&&(this.mainFragLoading=E=null),E&&qe(E))){if(y.start>E.end){const T=this.fragmentTracker.getFragAtPos(g,se.MAIN);T&&T.end>E.end&&(E=T,this.mainFragLoading={frag:T,targetBufferTime:null})}if(y.start>E.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(n=>new Ji(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==j.STOPPED&&(this.setInterval(Zu),this.state=j.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 n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(S.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;const{levels:i}=this,{details:r,id:o,groupId:a,track:l}=t;if(!i){this.warn(`Audio tracks reset while loading track ${o} "${l.name}" of "${a}"`);return}const c=this.mainDetails;if(!c||r.endCC>c.endCC||c.expired){this.cachedTrackLoadedData=t,this.state!==j.STOPPED&&(this.state=j.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${o} "${l.name}" of "${a}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const u=i[o];let f=0;if(r.live||(n=u.details)!=null&&n.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||(X0(r,c),r.alignedSliding||sr(r,c),f=r.fragmentStart)}u.details=r,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(c,f),this.hls.trigger(S.AUDIO_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.state===j.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=j.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,payload:r}=e,{config:o,trackId:a,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const c=l[a];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const u=c.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const f=o.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new t5(this.hls,se.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[n.cc],p=(t=n.initSegment)==null?void 0:t.data;if(d!==void 0){const g=i?i.index:-1,y=g!==-1,E=new K0(n.level,n.sn,n.stats.chunkCount,r.byteLength,g,y);h.push(r,p,f,"",n,i,u.totalduration,!1,E,d)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${u.startSN} ,${u.endSN}],track ${a}`);const{cache:m}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new e6,complete:!1};m.push(new Uint8Array(r)),this.state!==j.STOPPED&&(this.state=j.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 n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===se.MAIN&&qe(t.frag)&&(this.mainFragLoading=t,this.state===j.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n.type!==se.AUDIO){!this.audioOnly&&n.type===se.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(qe(n)){this.fragPrevious=n;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(S.AUDIO_TRACK_SWITCHED,pe({},r)))}this.fragBufferedComplete(n,i),this.media&&this.tick()}onError(e,t){var n;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(se.AUDIO,t);break;case N.AUDIO_TRACK_LOAD_ERROR:case N.AUDIO_TRACK_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===At.AUDIO_TRACK&&(this.state=j.IDLE);break;case N.BUFFER_ADD_CODEC_ERROR:case N.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case N.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case N.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==je.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==je.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===j.ENDED&&(this.state=j.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,se.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:c,level:u}=a,{details:f}=u,{audio:h,text:d,id3:p,initSegment:m}=r;if(this.fragContextChanged(l)||!f){this.fragmentTracker.removeFragment(l);return}if(this.state=j.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),m!=null&&m.tracks){const g=l.initSegment||l;this._bufferInitSegment(u,m.tracks,g,o),i.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:n,tracks:m.tracks})}if(h){const{startPTS:g,endPTS:y,startDTS:E,endDTS:x}=h;c&&(c.elementaryStreams[je.AUDIO]={startPTS:g,endPTS:y,startDTS:E,endDTS:x}),l.setElementaryStreamInfo(je.AUDIO,g,y,E,x),this.bufferFragmentData(h,l,c,o)}if(p!=null&&(t=p.samples)!=null&&t.length){const g=de({id:n,frag:l,details:f},p);i.trigger(S.FRAG_PARSING_METADATA,g)}if(d){const g=de({id:n,frag:l,details:f},d);i.trigger(S.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,n,i){if(this.state!==j.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const r=t.audio;r.id=se.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(S.BUFFER_CODECS,t);const a=r.initSegment;if(a!=null&&a.byteLength){const l={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:a};this.hls.trigger(S.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===Je.NOT_LOADED||i===Je.PARTIAL){var r;if(!qe(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=j.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragmentStart!==t.details.fragmentStart&&sr(t.details,o)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:n,assocLang:i,characteristics:r,audioCodec:o,channels:a}=this.bufferedTrack;ms({name:t,lang:n,assocLang:i,characteristics:r,audioCodec:o,channels:a},e,is)||(G0(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(S.AUDIO_TRACK_SWITCHED,pe({},e))}}class mp extends lt{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,n){const i=t==null?void 0:t.renditionReports;if(i){let r=-1;for(let o=0;o<i.length;o++){const a=i[o];let l;try{l=new self.URL(a.URI,t.url).href}catch(c){this.warn(`Could not construct new URL for Rendition Report: ${c}`),l=a.URI||""}if(l===e){r=o;break}else l===e.substring(0,l.length)&&(r=o)}if(r!==-1){const o=i[r],a=parseInt(o["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=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);l>=0&&u>t.partTarget&&(l+=1)}const c=n&&Iu(n);return new _u(a,l>=0?l:void 0,c)}}}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(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}return e}playlistLoaded(e,t,n){const{details:i,stats:r}=t,o=self.performance.now(),a=r.loading.first?Math.max(0,o-r.loading.first):0;i.advancedDateTime=Date.now()-a;const l=this.hls.config.timelineOffset;if(l!==i.appliedTimelineOffset){const u=Math.max(l||0,0);i.appliedTimelineOffset=u,i.fragments.forEach(f=>{f.start=f.playlistOffset+u})}if(i.live||n!=null&&n.live){const u="levelInfo"in t?t.levelInfo:t.track;if(i.reloaded(n),n&&i.fragments.length>0){VA(n,i);const E=i.playlistParsingError;if(E){this.warn(E);const x=this.hls;if(!x.config.ignorePlaylistParsingErrors){var c;const{networkDetails:T}=t;x.trigger(S.ERROR,{type:Z.NETWORK_ERROR,details:N.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:E,reason:E.message,level:t.level||void 0,parent:(c=i.fragments[0])==null?void 0:c.type,networkDetails:T,stats:r});return}i.playlistParsingError=null}}i.requestScheduled===-1&&(i.requestScheduled=r.loading.start);const f=this.hls.mainForwardBufferInfo,h=f?f.end-f.len:0,d=(i.edge-h)*1e3,p=zA(i,d);if(i.requestScheduled+p<o?i.requestScheduled=o:i.requestScheduled+=p,this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),!this.canLoad||!i.live)return;let m,g,y;if(i.canBlockReload&&i.endSN&&i.advanced){const E=this.hls.config.lowLatencyMode,x=i.lastPartSn,T=i.endSN,v=i.lastPartIndex,A=v!==-1,b=x===T;A?b?(g=T+1,y=E?0:v):(g=x,y=E?v+1:i.maxPartIndex):g=T+1;const I=i.age,C=I+i.ageHeader;let _=Math.min(C-i.partTarget,i.targetduration*1.5);if(_>0){if(C>i.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(n!=null&&n.tuneInGoal&&C-i.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${_} with playlist age: ${i.age}`),_=0;else{const D=Math.floor(_/i.targetduration);if(g+=D,y!==void 0){const H=Math.round(_%i.targetduration/i.partTarget);y+=H}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${I.toFixed(2)}s goal: ${_} skip sn ${D} to part ${y}`)}i.tuneInGoal=_}if(m=this.getDeliveryDirectives(i,t.deliveryDirectives,g,y),E||!b){i.requestScheduled=o,this.loadingPlaylist(u,m);return}}else(i.canBlockReload||i.canSkipUntil)&&(m=this.getDeliveryDirectives(i,t.deliveryDirectives,g,y));m&&g!==void 0&&i.canBlockReload&&(i.requestScheduled=r.loading.first+Math.max(p-a*2,p/2)),this.scheduleLoading(u,m,i)}else this.clearTimer()}scheduleLoading(e,t,n){const i=n||e.details;if(!i){this.loadingPlaylist(e,t);return}const r=self.performance.now(),o=i.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,n,i){let r=Iu(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,r=wi.No),new _u(n,i,r)}checkRetry(e){const t=e.details,n=Zi(e),i=e.errorAction,{action:r,retryCount:o=0,retryConfig:a}=i||{},l=!!i&&!!a&&(r===ke.RetryRequest||!i.resolved&&r===ke.SendAlternateToPenaltyBox);if(l){var c;if(o>=a.maxNumRetry)return!1;if(n&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const u=ml(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,i.resolved=!0}return l}}function yp(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Vn(s[t].attrs,e[t].attrs))return!1;return!0}function Vn(s,e,t){const n=s["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>s[i]!==e[i])}function ga(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}class n5 extends mp{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(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(S.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:n,groupId:i,details:r}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.audioGroups||null,i=this.groupIds;let r=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(a=>(i==null?void 0:i.indexOf(a))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!n||n.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 l=this.hls.config.audioPreference;if(!r&&l){const h=mt(l,a,is);if(h>-1)r=a[h];else{const d=mt(l,this.tracks);r=this.tracks[d]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const u={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${n==null?void 0:n.join(",")}`),this.hls.trigger(S.AUDIO_TRACKS_UPDATED,u);const f=this.trackId;if(c!==-1&&f===-1)this.setAudioTrack(c);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(S.ERROR,{type:Z.MEDIA_ERROR,details:N.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}}onError(e,t){t.fatal||!t.context||t.context.type===At.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 n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&ms(e,i,is))return i;const r=mt(e,this.tracksInGroup,is);if(r>-1){const o=this.tracksInGroup[r];return this.setAudioTrack(r),o}else if(i){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=SA(e,t.levels,n,o,is);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=mt(e,n);if(o>-1)return n[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 n=this.currentTrack,i=t[e],r=i.details&&!i.details.live;if(e===this.trackId&&i===n&&r||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(S.AUDIO_TRACK_SWITCHING,pe({},i)),r))return;const o=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||ms(e,i,is)))return n}if(e){const{name:n,lang:i,assocLang:r,characteristics:o,audioCodec:a,channels:l}=e;for(let c=0;c<t.length;c++){const u=t[c];if(ms({name:n,lang:i,assocLang:r,characteristics:o,audioCodec:a,channels:l},u,is))return c}for(let c=0;c<t.length;c++){const u=t[c];if(Vn(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<t.length;c++){const u=t[c];if(Vn(e.attrs,u.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&G0(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,i=e.groupId,r=this.getUrlWithDirectives(e.url,t),o=e.details,a=o==null?void 0:o.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${i}${(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(S.AUDIO_TRACK_LOADING,{url:r,id:n,groupId:i,deliveryDirectives:t||null,track:e})}}class i5{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;const i=this.queues[t];i.push(e),i.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const n={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const n={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const n=(t=e[0])==null?void 0:t.label;(n==="async-blocker"||n==="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 i=t[0];try{i.execute()}catch(r){var n;if(i.onError(r),this.queues===null||this.tracks===null)return;const o=(n=this.tracks[e])==null?void 0:n.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,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const n=(t=this.tracks)==null?void 0:t[e],i=n==null?void 0:n.buffer;return i?`SourceBuffer${i.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(n=>n.label).join(", "))||""}}const ef=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Sp="HlsJsTrackRemovedError";class r5 extends Error{constructor(e){super(e),this.name=Sp}}class o5 extends lt{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=n=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=n=>{const{media:i,mediaSource:r}=this;n&&this.log("Media source opened"),!(!i||!r)&&(r.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(S.MEDIA_ATTACHED,{media:i,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:n,_objectUrl:i}=this;n!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=B4(Hn(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(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.BUFFER_RESET,this.onBufferReset,this),e.on(S.BUFFER_APPENDING,this.onBufferAppending,this),e.on(S.BUFFER_CODECS,this.onBufferCodecs,this),e.on(S.BUFFER_EOS,this.onBufferEos,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.FRAG_PARSED,this.onFragParsed,this),e.on(S.FRAG_CHANGED,this.onFragChanged,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.BUFFER_RESET,this.onBufferReset,this),e.off(S.BUFFER_APPENDING,this.onBufferAppending,this),e.off(S.BUFFER_CODECS,this.onBufferCodecs,this),e.off(S.BUFFER_EOS,this.onBufferEos,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.FRAG_PARSED,this.onFragParsed,this),e.off(S.FRAG_CHANGED,this.onFragChanged,this),e.off(S.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const n={};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 i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===t?de(n,i.tracks):this.sourceBuffers.forEach(r=>{const[o]=r;o&&(n[o]=de({},this.tracks[o]),this.removeBuffer(o)),r[0]=r[1]=null}),{media:e,mediaSource:t,tracks:n}}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 n;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){const n=this.media=t.media,i=Hn(this.appendSource);if(this.transferData=this.overrides=void 0,n&&i){const r=!!t.mediaSource;(r||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const o=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(o),r)this._objectUrl=n.src,this.attachTransferred();else{const a=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{n.removeAttribute("src");const l=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||l&&o instanceof l,tf(n),a5(n,a),n.load()}catch{n.src=a}else n.src=a}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,n;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(n=e.constructor)==null?void 0:n.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 n=this.tracks,i=t.tracks,r=i?Object.keys(i):null,o=r?r.length:0,a=()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()};if(i&&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: ${ye(n,(l,c)=>l==="initSegment"?void 0:c)};
- transfer tracks: ${ye(i,(l,c)=>l==="initSegment"?void 0:c)}}`),!P0(i,n)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,c=this.details,u=Math.max(l,(c==null?void 0:c.fragments[0].start)||0);if(u-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(n)}") start time: ${u} currentTime: ${l}`),this.onMediaDetaching(S.MEDIA_DETACHING,{}),this.onMediaAttaching(S.MEDIA_ATTACHING,t),e.currentTime=u;return}this.transferData=void 0,r.forEach(l=>{const c=l,u=i[c];if(u){const f=u.buffer;if(f){const h=this.fragmentTracker,d=u.id;if(h.hasFragments(d)||h.hasParts(d)){const g=ae.getBuffered(f);h.detectEvictedFragments(c,g,d,null,!0)}const p=ao(c),m=[c,f];this.sourceBuffers[p]=m,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(c),this.trackSourceBuffer(c,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 n=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:r,_objectUrl:o}=this;if(r){if(this.log(`media source ${n?"transferring":"detaching"}`),n)this.sourceBuffers.forEach(([a])=>{a&&this.removeBuffer(a)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const a=r.readyState==="open";try{const l=r.sourceBuffers;for(let c=l.length;c--;)a&&l[c].abort(),r.removeSourceBuffer(l[c]);a&&r.endOfStream()}catch(l){this.warn(`onMediaDetaching: ${l.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}i&&(i.removeEventListener("emptied",this._onMediaEmptied),n||(o&&self.URL.revokeObjectURL(o),this.mediaSrc===o?(i.removeAttribute("src"),this.appendSource&&tf(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(S.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const n=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),n)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(r){this.warn(`onBufferReset ${e}`,r)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[ao(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new i5(this.tracks)}onBufferCodecs(e,t){const n=this.tracks,i=Object.keys(t);this.log(`BUFFER_CODECS: "${i}" (current SB count ${this.sourceBufferCount})`);const r="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),o=!r&&this.sourceBufferCount&&this.media&&i.some(a=>!n[a]);if(r||o){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${i}" SourceBuffers`);return}i.forEach(a=>{var l,c,u;const f=t[a],{id:h,codec:d,levelCodec:p,container:m,metadata:g,supplemental:y}=f;let E=n[a];const x=(l=this.transferData)==null||(c=l.tracks)==null?void 0:c[a],T=x!=null&&x.buffer?x:E,v=(T==null?void 0:T.pendingCodec)||(T==null?void 0:T.codec),A=T==null?void 0:T.levelCodec;E||(E=n[a]={buffer:void 0,listeners:[],codec:d,supplemental:y,container:m,levelCodec:p,metadata:g,id:h});const b=Zr(v,A),I=b==null?void 0:b.replace(ef,"$1");let C=Zr(d,p);const _=(u=C)==null?void 0:u.replace(ef,"$1");C&&b&&I!==_&&(a.slice(0,5)==="audio"&&(C=ua(C,this.appendSource)),this.log(`switching codec ${v} to ${C}`),C!==(E.pendingCodec||E.codec)&&(E.pendingCodec=C),E.container=m,this.appendChangeType(a,m,C))}),(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 n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){const i=`${t};codecs=${n}`,r={label:`change-type=${i}`,execute:()=>{const o=this.tracks[e];if(o){const a=o.buffer;a!=null&&a.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),a.changeType(i),o.codec=n,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 n=e.start,i=n+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(n,se.MAIN))==null?void 0:t.gap)===!0)return;const o={label:"block-audio",execute:()=>{var a;const l=this.tracks.video;(this.lastVideoAppendEnd>i||l!=null&&l.buffer&&ae.isBuffered(l.buffer,i)||((a=this.fragmentTracker.getAppendedFrag(i,se.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:n}=this,{data:i,type:r,parent:o,frag:a,part:l,chunkMeta:c,offset:u}=t,f=c.buffering[r],{sn:h,cc:d}=a,p=self.performance.now();f.start=p;const m=a.stats.buffering,g=l?l.stats.buffering:null;m.start===0&&(m.start=p),g&&g.start===0&&(g.start=p);const y=n.audio;let E=!1;r==="audio"&&(y==null?void 0:y.container)==="audio/mpeg"&&(E=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const x=n.video,T=x==null?void 0:x.buffer;if(T&&h!=="initSegment"){const b=l||a,I=this.blockedAudioAppend;if(r==="audio"&&o!=="main"&&!this.blockedAudioAppend){const _=b.start+b.duration*.05,D=T.buffered,H=this.currentOp("video");!D.length&&!H?this.blockAudio(b):!H&&!ae.isBuffered(T,_)&&this.lastVideoAppendEnd<_&&this.blockAudio(b)}else if(r==="video"){const C=b.end;if(I){const _=I.frag.start;(C>_||C<this.lastVideoAppendEnd||ae.isBuffered(T,_))&&this.unblockAudio()}this.lastVideoAppendEnd=C}}const v=(l||a).start,A={label:`append-${r}`,execute:()=>{var b;f.executeStart=self.performance.now();const I=(b=this.tracks[r])==null?void 0:b.buffer;I&&(E?this.updateTimestampOffset(I,v,.1,r,h,d):u!==void 0&&X(u)&&this.updateTimestampOffset(I,u,1e-6,r,h,d)),this.appendExecutor(i,r)},onStart:()=>{},onComplete:()=>{const b=self.performance.now();f.executeEnd=f.end=b,m.first===0&&(m.first=b),g&&g.first===0&&(g.first=b);const I={};this.sourceBuffers.forEach(([C,_])=>{C&&(I[C]=ae.getBuffered(_))}),this.appendErrors[r]=0,r==="audio"||r==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(S.BUFFER_APPENDED,{type:r,frag:a,part:l,chunkMeta:c,parent:a.type,timeRanges:I})},onError:b=>{var I;const C={type:Z.MEDIA_ERROR,parent:a.type,details:N.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:a,part:l,chunkMeta:c,error:b,err:b,fatal:!1},_=(I=this.media)==null?void 0:I.error;if(b.code===DOMException.QUOTA_EXCEEDED_ERR||b.name=="QuotaExceededError"||"quota"in b)C.details=N.BUFFER_FULL_ERROR;else if(b.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!_)C.errorAction=jn(!0);else if(b.name===Sp&&this.sourceBufferCount===0)C.errorAction=jn(!0);else{const D=++this.appendErrors[r];this.warn(`Failed ${D}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${_||"no media error"})`),(D>=this.hls.config.appendErrorMaxRetry||_)&&(C.fatal=!0)}this.hls.trigger(S.ERROR,C)}};this.append(A,r,this.isPending(this.tracks[r]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(S.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,t){const{type:n,startOffset:i,endOffset:r}=t;n?this.append(this.getFlushOp(n,i,r),n):this.sourceBuffers.forEach(([o])=>{o&&this.append(this.getFlushOp(o,i,r),o)})}onFragParsed(e,t){const{frag:n,part:i}=t,r=[],o=i?i.elementaryStreams:n.elementaryStreams;o[je.AUDIOVIDEO]?r.push("audiovideo"):(o[je.AUDIO]&&r.push("audio"),o[je.VIDEO]&&r.push("video"));const a=()=>{const l=self.performance.now();n.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const c=i?i.stats:n.stats;this.hls.trigger(S.FRAG_BUFFERED,{frag:n,part:i,stats:c,id:n.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(a,r).catch(l=>{this.warn(`Fragment buffered callback ${l}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t,n;return e&&(!((t=this.tracks[e])!=null&&t.ended)||((n=this.tracks[e])==null?void 0:n.ending))})}onBufferEos(e,t){var n;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 i=((n=this.overrides)==null?void 0:n.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([o])=>{var a;return o&&!((a=this.tracks[o])!=null&&a.ended)})&&(i?(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(S.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(S.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===N.BUFFER_APPEND_ERROR&&t.frag){var n;const i=(n=t.errorAction)==null?void 0:n.nextAutoLevel;X(i)&&i!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;const i=e.config,r=n.currentTime,o=t.levelTargetDuration,a=t.live&&i.liveBackBufferLength!==null?i.liveBackBufferLength:i.backBufferLength;if(X(a)&&a>=0){const l=Math.max(a,o),c=Math.floor(r/o)*o-l;this.flushBackBuffer(r,o,c)}if(X(i.frontBufferFlushThreshold)&&i.frontBufferFlushThreshold>0){const l=Math.max(i.maxBufferLength,i.frontBufferFlushThreshold),c=Math.max(l,o),u=Math.floor(r/o)*o+c;this.flushFrontBuffer(r,o,u)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([i,r])=>{if(r){const a=ae.getBuffered(r);if(a.length>0&&n>a.start(0)){var o;this.hls.trigger(S.BACK_BUFFER_REACHED,{bufferEnd:n});const l=this.tracks[i];if((o=this.details)!=null&&o.live)this.hls.trigger(S.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(l!=null&&l.ended){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:i})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([i,r])=>{if(r){const o=ae.getBuffered(r),a=o.length;if(a<2)return;const l=o.start(a-1),c=o.end(a-1);if(n>l||e>=l&&e<=c)return;this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:i})}})}getDurationAndRange(){var e;const{details:t,mediaSource:n}=this;if(!t||!this.media||(n==null?void 0:n.readyState)!=="open")return null;const i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&t.live&&n.setLiveSeekableRange){const c=Math.max(0,t.fragmentStart),u=Math.max(c,i);return{duration:1/0,start:c,end:u}}return{duration:1/0}}const r=(e=this.overrides)==null?void 0:e.duration;if(r)return X(r)?{duration:r}:null;const o=this.media.duration,a=X(n.duration)?n.duration:0;return i>a&&i>o||!X(o)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:n}){const i=this.mediaSource;!this.media||!i||i.readyState!=="open"||(i.duration!==e&&(X(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${n}.`),i.setLiveSeekableRange(t,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${ye(n)}`),this.tracksReady){var i;const r=(i=this.transferData)==null?void 0:i.tracks;r&&Object.keys(r).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,n])=>{if(t){const i=this.tracks[t];e[t]={buffer:n,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(S.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(S.ERROR,{type:Z.MEDIA_ERROR,details:N.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)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 l=this.getTrackCodec(a,o),c=`${a.container};codecs=${l}`;a.codec=l,this.log(`creating sourceBuffer(${c})${this.currentOp(o)?" Queued":""} ${ye(a)}`);try{const u=n.addSourceBuffer(c),f=ao(o),h=[o,u];t[f]=h,a.buffer=u}catch(u){var i;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(o),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[o],this.hls.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:N.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:o,mimeType:c,parent:a.id});return}this.trackSourceBuffer(o,a)}}this.bufferCreated()}getTrackCodec(e,t){const n=e.supplemental;let i=e.codec;n&&(t==="video"||t==="audiovideo")&&X4(n,"video")&&(i=eA(i,n));const r=Zr(i,e.levelCodec);return r?t.slice(0,5)==="audio"?ua(r,this.appendSource):r:""}trackSourceBuffer(e,t){const n=t.buffer;if(!n)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(r,o)=>{const a=o.removedRanges;a!=null&&a.length&&this.hls.trigger(S.BUFFER_FLUSHED,{type:r})})}get mediaSrc(){var e,t;const n=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return n==null?void 0:n.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 n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:N.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const r=this.currentOp(e);r&&r.onError(i)}updateTimestampOffset(e,t,n,i,r,o){const a=t-e.timestampOffset;Math.abs(a)>=n&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${o})`),e.timestampOffset=t)}removeExecutor(e,t,n){const{media:i,mediaSource:r}=this,o=this.tracks[e],a=o==null?void 0:o.buffer;if(!i||!r||!a){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const l=X(i.duration)?i.duration:1/0,c=X(r.duration)?r.duration:1/0,u=Math.max(0,t),f=Math.min(n,l,c);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 n=this.tracks[t],i=n==null?void 0:n.buffer;if(!i)throw new r5(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,i.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:n}=this,i=t.map(o=>this.appendBlocker(o));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(o=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var n;const i=(n=this.tracks[t])==null?void 0:n.buffer;!i||i.updating||this.shiftAndExecuteNext(t)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}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,n){const i=this.tracks[e];if(!i)return;const r=i.buffer;if(!r)return;const o=n.bind(this,e);i.listeners.push({event:t,listener:o}),r.addEventListener(t,o)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const n=t.buffer;n&&(t.listeners.forEach(i=>{n.removeEventListener(i.event,i.listener)}),t.listeners.length=0)}}function tf(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function a5(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}function ao(s){return s==="audio"?1:0}class _l{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(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.BUFFER_CODECS,this.onBufferCodecs,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.BUFFER_CODECS,this.onBufferCodecs,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.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 n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&X(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,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,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 n=t.filter((i,r)=>this.isLevelAllowed(i)&&r<=e);return this.clientRect=null,_l.getMaxLevelByMediaSize(n,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 n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.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(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const i=(a,l)=>l?a.width!==l.width||a.height!==l.height:!0;let r=e.length-1;const o=Math.max(t,n);for(let a=0;a<e.length;a+=1){const l=e[a];if((l.width>=o||l.height>=o)&&i(l,e[a+1])){r=a;break}}return r}}const l5={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},$e=l5,c5={HLS:"h"},u5=c5,f5="CMCD-Object",h5="CMCD-Request",d5="CMCD-Session",p5="CMCD-Status",mn={OBJECT:f5,REQUEST:h5,SESSION:d5,STATUS:p5},g5={[mn.OBJECT]:["br","ab","d","ot","tb","tpb","lb","tab","lab","url"],[mn.REQUEST]:["pb","bl","tbl","dl","ltc","mtp","nor","nrr","rc","sn","sta","su","ttfb","ttfbb","ttlb","cmsdd","cmsds","smrt","df","cs"],[mn.SESSION]:["cid","pr","sf","sid","st","v","msd"],[mn.STATUS]:["bs","bsd","cdn","rtp","bg","pt","ec","e"]};class tn{constructor(e,t){Array.isArray(e)&&(e=e.map(n=>n instanceof tn?n:new tn(n))),this.value=e,this.params=t}}const m5="Dict";function y5(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function S5(s,e,t,n){return new Error(`failed to ${s} "${y5(e)}" as ${t}`,{cause:n})}function xt(s,e,t){return S5("serialize",s,e,t)}class xp{constructor(e){this.description=e}}const sf="Bare Item",x5="Boolean";function E5(s){if(typeof s!="boolean")throw xt(s,x5);return s?"?1":"?0"}function T5(s){return btoa(String.fromCharCode(...s))}const v5="Byte Sequence";function A5(s){if(ArrayBuffer.isView(s)===!1)throw xt(s,v5);return`:${T5(s)}:`}const b5="Integer";function I5(s){return s<-999999999999999||999999999999999<s}function Ep(s){if(I5(s))throw xt(s,b5);return s.toString()}function _5(s){return`@${Ep(s.getTime()/1e3)}`}function Tp(s,e){if(s<0)return-Tp(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const i=Math.floor(s*t);return(i%2===0?i:i+1)/t}else return Math.round(s*t)/t}const w5="Decimal";function R5(s){const e=Tp(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw xt(s,w5);const t=e.toString();return t.includes(".")?t:`${t}.0`}const L5="String",C5=/[\x00-\x1f\x7f]+/;function P5(s){if(C5.test(s))throw xt(s,L5);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function D5(s){return s.description||s.toString().slice(7,-1)}const k5="Token";function nf(s){const e=D5(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw xt(e,k5);return e}function ma(s){switch(typeof s){case"number":if(!X(s))throw xt(s,sf);return Number.isInteger(s)?Ep(s):R5(s);case"string":return P5(s);case"symbol":return nf(s);case"boolean":return E5(s);case"object":if(s instanceof Date)return _5(s);if(s instanceof Uint8Array)return A5(s);if(s instanceof xp)return nf(s);default:throw xt(s,sf)}}const O5="Key";function ya(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw xt(s,O5);return s}function wl(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${ya(e)}`:`;${ya(e)}=${ma(t)}`).join("")}function vp(s){return s instanceof tn?`${ma(s.value)}${wl(s.params)}`:ma(s)}function F5(s){return`(${s.value.map(vp).join(" ")})${wl(s.params)}`}function B5(s,e={whitespace:!0}){if(typeof s!="object")throw xt(s,m5);const t=s instanceof Map?s.entries():Object.entries(s),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,r])=>{r instanceof tn||(r=new tn(r));let o=ya(i);return r.value===!0?o+=wl(r.params):(o+="=",Array.isArray(r.value)?o+=F5(r):o+=vp(r)),o}).join(`,${n}`)}function M5(s,e){return B5(s,e)}function N5(s){return["ot","sf","st","e","sta"].includes(s)}function U5(s){return typeof s=="number"?X(s):s!=null&&s!==""&&s!==!1}function $5(s,e){const t=new URL(s),n=new URL(e);if(t.origin!==n.origin)return s;const i=t.pathname.split("/").slice(1),r=n.pathname.split("/").slice(1,-1);for(;i[0]===r[0];)i.shift(),r.shift();for(;r.length;)r.shift(),i.unshift("..");return i.join("/")}const Ci=s=>Math.round(s),G5=(s,e)=>(e!=null&&e.baseUrl&&(s=$5(s,e.baseUrl)),encodeURIComponent(s)),Si=s=>Ci(s/100)*100,H5={br:Ci,d:Ci,bl:Si,dl:Si,mtp:Si,nor:G5,rtp:Si,tb:Ci};function j5(s,e){const t={};if(s==null||typeof s!="object")return t;const n=Object.keys(s).sort(),i=de({},H5,e==null?void 0:e.formatters),r=e==null?void 0:e.filter;return n.forEach(o=>{if((r==null?void 0:r(o))===!1)return;let a=s[o];const l=i[o];l&&(a=l(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||U5(a)&&(N5(o)&&typeof a=="string"&&(a=new xp(a)),t[o]=a))}),t}function Ap(s,e={}){return s?M5(j5(s,e),de({whitespace:!1},e)):""}function K5(s,e={}){const t={};if(!s)return t;const n=Object.entries(s),i=Object.entries(g5).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),r=n.reduce((o,a)=>{var l,c;const[u,f]=a,h=((l=i.find(d=>d[1].includes(u)))===null||l===void 0?void 0:l[0])||mn.REQUEST;return(c=o[h])!==null&&c!==void 0||(o[h]={}),o[h][u]=f,o},{});return Object.entries(r).reduce((o,[a,l])=>(o[a]=Ap(l,e),o),t)}function V5(s,e,t){return de(s,K5(e,t))}const q5="CMCD";function W5(s,e={}){if(!s)return"";const t=Ap(s,e);return`${q5}=${encodeURIComponent(t)}`}const rf=/CMCD=[^&#]+/;function Q5(s,e,t){const n=W5(e,t);if(!n)return s;if(rf.test(s))return s.replace(rf,n);const i=s.includes("?")?"&":"?";return`${s}${i}${n}`}class z5{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=i=>{try{this.apply(i,{ot:$e.MANIFEST,su:!this.initialized})}catch(r){this.hls.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=i=>{try{const{frag:r,part:o}=i,a=this.hls.levels[r.level],l=this.getObjectType(r),c={d:(o||r).duration*1e3,ot:l};(l===$e.VIDEO||l===$e.AUDIO||l==$e.MUXED)&&(c.br=a.bitrate/1e3,c.tb=this.getTopBandwidth(l)/1e3,c.bl=this.getBufferLength(l));const u=o?this.getNextPart(o):this.getNextFrag(r);u!=null&&u.url&&u.url!==r.url&&(c.nor=u.url),this.apply(i,c)}catch(r){this.hls.logger.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHED,this.onMediaDetached,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHED,this.onMediaDetached,this),e.off(S.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 n,i;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:u5.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){de(t,this.createData());const n=t.ot===$e.INIT||t.ot===$e.VIDEO||t.ot===$e.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((o,a)=>(i.includes(a)&&(o[a]=t[a]),o),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),V5(e.headers,t,r)):e.url=Q5(e.url,t,r)}getNextFrag(e){var t;const n=(t=this.hls.levels[e.level])==null?void 0:t.details;if(n){const i=e.sn-n.startSN;return n.fragments[i+1]}}getNextPart(e){var t,n;const{index:i,fragment:r}=e,o=(t=this.hls.levels[r.level])==null||(n=t.details)==null?void 0:n.partList;if(o){const{sn:a}=r;for(let l=o.length-1;l>=0;l--){const c=o[l];if(c.index===i&&c.fragment.sn===a)return o[l+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return $e.TIMED_TEXT;if(e.sn==="initSegment")return $e.INIT;if(t==="audio")return $e.AUDIO;if(t==="main")return this.hls.audioTracks.length?$e.VIDEO:$e.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===$e.AUDIO)n=i.audioTracks;else{const r=i.maxAutoLevel,o=r>-1?r+1:i.levels.length;n=i.levels.slice(0,o)}return n.forEach(r=>{r.bitrate>t&&(t=r.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,n=e===$e.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:ae.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new n(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,n=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new n(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 Y5=3e5;class X5 extends lt{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(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.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(n=>n!==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:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===ke.SendAlternateToPenaltyBox&&n.flags===rt.MoveAllAlternatesMatchingHost){const i=this.levels;let r=this._pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:l,type:c}=t.context;a&&i?o=this.getPathwayForGroupId(a,c,o):l&&(o=l)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!r&&i&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),n.resolved=this.pathwayId!==o),t.details===N.BUFFER_APPEND_ERROR&&!t.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${i&&i.length} priorities: ${ye(r)} penalized: ${ye(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}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 n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach(r=>{i-n[r]>Y5&&delete n[r]});for(let r=0;r<e.length;r++){const o=e[r];if(o in n)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,l=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,YA(t),this.hls.trigger(S.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[a];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let r=0;r<i.length;r++)if(t===At.AUDIO_TRACK&&i[r].hasAudioGroup(e)||t===At.SUBTITLE_TRACK&&i[r].hasSubtitleGroup(e))return i[r].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};e.forEach(r=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":l}=r;if(t.some(u=>u.pathwayId===o))return;const c=this.getLevelsForPathway(a).map(u=>{const f=new Zn(u.attrs);f["PATHWAY-ID"]=o;const h=f.AUDIO&&`${f.AUDIO}_clone_${o}`,d=f.SUBTITLES&&`${f.SUBTITLES}_clone_${o}`;h&&(n[f.AUDIO]=h,f.AUDIO=h),d&&(i[f.SUBTITLES]=d,f.SUBTITLES=d);const p=bp(u.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),m=new Ji({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(...c),of(this.audioTracks,n,l,o),of(this.subtitleTracks,i,l,o)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+u)}const r={responseType:"json",url:i.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},c={onSuccess:(u,f,h,d)=>{this.log(`Loaded steering manifest: "${i}"`);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,i).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 E={steeringManifest:p,url:i.toString()};this.hls.trigger(S.STEERING_MANIFEST_LOADED,E),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: ${i}`),this.loader.load(r,l,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function of(s,e,t,n){s&&Object.keys(e).forEach(i=>{const r=s.filter(o=>o.groupId===i).map(o=>{const a=de({},o);return a.details=void 0,a.attrs=new Zn(a.attrs),a.url=a.attrs.URI=bp(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[i],a.attrs["PATHWAY-ID"]=n,a});s.push(...r)})}function bp(s,e,t,n){const{HOST:i,PARAMS:r,[t]:o}=n;let a;e&&(a=o==null?void 0:o[e],a&&(s=a));const l=new self.URL(s);return i&&!a&&(l.host=i),r&&Object.keys(r).sort().forEach(c=>{c&&l.searchParams.set(c,r[c])}),l.href}function us(s,e,t){Gs(s,e,t),s.addEventListener(e,t)}function Gs(s,e,t){s.removeEventListener(e,t)}class Ks extends lt{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=Ks.CDMCleanupPromise?[Ks.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(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(S.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(S.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===me.WIDEVINE&&n)return n}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,n=t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(o,a,l)=>!!o&&l.indexOf(o)===a,i=t.map(o=>o.audioCodec).filter(n),r=t.map(o=>o.videoCodec).filter(n);return i.length+r.length===0&&r.push("avc1.42e01e"),new Promise((o,a)=>{const l=c=>{const u=c.shift();this.getMediaKeysPromise(u,i,r).then(f=>o({keySystem:u,mediaKeys:f})).catch(f=>{c.length?l(c):f instanceof Ye?a(f):a(new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return V0===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,t)}getMediaKeysPromise(e,t,n){const i=UA(e,t,n,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: ${ye(i)}`),o=this.requestMediaKeySystemAccess(e,i);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),o.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const c=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=l.createMediaKeys().then(u=>(this.log(`Media-keys created for "${e}"`),a.hasMediaKeys=!0,c.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:n}){this.log(`Creating key-system session "${t}" keyId: ${as.hexDump(e.keyId||[])}`);const i=n.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,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 as.hexDump(e.keyId)}updateKeySession(e,t){var n;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${as.hexDump(((n=e.decryptdata)==null?void 0:n.keyId)||[])}
- } (data length: ${t&&t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>$u(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:n})=>this.attemptSetMediaKeys(t,n))}selectKeySystem(e){return new Promise((t,n)=>this.getKeySystemSelectionPromise(e).then(({keySystem:i})=>{const r=$u(i);r?t(r):n(new Error(`Unable to find format for key-system "${i}"`))}).catch(n))}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=eo(this.config),n=e.map(Uu).filter(i=>!!i&&t.indexOf(i)!==-1);return this.selectKeySystem(n)}loadKey(e){const t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),i=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let r=this.keyIdToKeySessionPromise[n];return r||(r=this.getKeySystemForKeyPromise(t).then(({keySystem:a,mediaKeys:l})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(a,l).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:a,mediaKeys:l,decryptdata:t}))))),(this.keyIdToKeySessionPromise[n]=r.then(a=>{const l="cenc",c=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(a,l,c,"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 Ye?this.hls.trigger(S.ERROR,e.data):this.hls.trigger(S.ERROR,{type:Z.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){const i=Uu(e.keyFormat),r=i?[i]:eo(this.config);return this.attemptKeySystemAccess(r)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=eo(this.config)),e.length===0)throw new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${ye({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).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(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>n.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,n,i){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,n,e);if(!p)throw new Error("Invalid response from configured generateRequest filter");t=p.initDataType,n=p.initData?p.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(p){var l;if(this.warn(p.message),(l=this.hls)!=null&&l.config.debug)throw p}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${c} (init data type: ${t} length: ${n?n.byteLength:null})`);const u=new Z0,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(E=>{u.eventNames().length?u.emit("error",E):this.handleError(E)}):g==="license-release"?e.keySystem===me.FAIRPLAY&&(this.updateKeySession(e,Nu("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 ${c}`),this.renewKeySession(e))};us(e.mediaKeysSession,"message",f),us(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 Ye({type:Z.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?m(new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.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,n).then(()=>{var p;this.log(`Request generated for key-session "${(p=e.mediaKeysSession)==null?void 0:p.sessionId}" keyId: ${c}`)}).catch(p=>{throw new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.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,n)=>{if(typeof n=="string"&&typeof t=="object"){const i=n;n=t,t=i}this.log(`key status change "${t}" for keyStatuses keyId: ${as.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${as.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,n=t.loader,i=new n(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const l={responseType:"arraybuffer",url:r},c=t.certLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,d,p,m)=>{o(h.data)},onError:(h,d,p,m)=>{a(new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:pe({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${r}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,p)=>{a(new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(h,d,p)=>{a(new Error("aborted"))}};i.load(l,u,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((i,r)=>{e.setServerCertificate(n).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${n==null?void 0:n.byteLength}) on "${t}"`),i(e)}).catch(o=>{r(new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(n,"application/xml"),r=i.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 l=i.querySelector("Challenge"),c=l==null?void 0:l.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return Nu(atob(c))}setupLicenseXHR(e,t,n,i){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,n,i)}).catch(o=>{if(!n.decryptdata)throw o;return e.open("POST",t,!0),r.call(this.hls,e,t,n,i)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((i,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 l=a.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const c=this.config.licenseResponseCallback;if(c)try{l=c.call(this.hls,a,o,e)}catch(u){this.error(u)}i(l)}else{const l=n.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||a.status>=400&&a.status<500)r(new Ye({type:Z.KEY_SYSTEM_ERROR,details:N.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=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(i,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:l,licenseChallenge:c})=>{e.keySystem==me.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(l,c)),l.send(c)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,us(n,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Gs(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,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null;const i=n.length;Ks.CDMCleanupPromise=Promise.all(n.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(S.ERROR,{type:Z.OTHER_ERROR,details:N.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(S.ERROR,{type:Z.OTHER_ERROR,details:N.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${r}`)})}).then(()=>{i&&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 n=t.reduce((i,r)=>(i.indexOf(r.keyFormat)===-1&&i.push(r.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n}=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),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);i>-1&&this.mediaKeySessions.splice(i,1);const{drmSystemOptions:r}=this.config;return(GA(r)?new Promise((a,l)=>{self.setTimeout(()=>l(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(a)}):Promise.resolve()).catch(a=>{var l;this.log(`Could not remove session: ${a}`),(l=this.hls)==null||l.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:N.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${a}`)})}).then(()=>t.close()).catch(a=>{var l;this.log(`Could not close session: ${a}`),(l=this.hls)==null||l.trigger(S.ERROR,{type:Z.OTHER_ERROR,details:N.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${a}`)})})}}}Ks.CDMCleanupPromise=void 0;class Ye 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 J5{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(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const r=i-this.lastTime,o=n-this.lastDroppedFrames,a=t-this.lastDecodedFrames,l=1e3*o/r,c=this.hls;if(c.trigger(S.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:n}),l>0&&o>c.config.fpsDroppedMonitoringThreshold*a){let u=c.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=u)&&(u=u-1,c.trigger(S.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:c.currentLevel}),c.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,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 Z5(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function Ip(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){fe.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,s.addCue(i)}catch(i){fe.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(s.mode=t)}function yn(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues)for(let n=s.cues.length;n--;)e&&s.cues[n].removeEventListener("enter",e),s.removeCue(s.cues[n]);t==="disabled"&&(s.mode=t)}function af(s,e,t,n){const i=s.mode;if(i==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const r=t8(s.cues,e,t);for(let o=0;o<r.length;o++)(!n||n(r[o]))&&s.removeCue(r[o])}i==="disabled"&&(s.mode=i)}function e8(s,e){if(e<=s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let n=0,i=t,r;for(;n<=i;)if(r=Math.floor((i+n)/2),e<s[r].startTime)i=r-1;else if(e>s[r].startTime&&n<t)n=r+1;else return r;return s[n].startTime-e<e-s[i].startTime?n:i}function t8(s,e,t){const n=[],i=e8(s,e);if(i>-1)for(let r=i,o=s.length;r<o;r++){const a=s[r];if(a.startTime>=e&&a.endTime<=t)n.push(a);else if(a.startTime>t)return n}return n}function Pi(s){const e=[];for(let t=0;t<s.length;t++){const n=s[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(s[t])}return e}class s8 extends mp{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 n=Pi(this.media.textTracks);for(let r=0;r<n.length;r++)if(n[r].mode==="hidden")t=n[r];else if(n[r].mode==="showing"){t=n[r];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},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(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(S.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 n=this.media;if(!n)return;const i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;Pi(n.textTracks).forEach(o=>{yn(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:n,groupId:i,details:r}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.subtitleGroups||null,i=this.groupIds;let r=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(u=>!n||n.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=mt(a,o);if(u>-1)r=o[u];else{const f=mt(a,this.tracks);r=this.tracks[f]}}let l=this.findTrackId(r);l===-1&&r&&(l=this.findTrackId(null));const c={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(S.SUBTITLE_TRACKS_UPDATED,c),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const r=t[i];if(!(n&&!r.default||!n&&!e)&&(!e||ms(r,e)))return i}if(e){for(let i=0;i<t.length;i++){const r=t[i];if(Vn(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const r=t[i];if(Vn(e.attrs,r.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(ga(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===At.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 n=this.currentTrack;if(n&&ms(e,n))return n;const i=mt(e,this.tracksInGroup);if(i>-1){const r=this.tracksInGroup[i];return this.setSubtitleTrack(i),r}else{if(n)return null;{const r=mt(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 n=e.id,i=e.groupId,r=this.getUrlWithDirectives(e.url,t),o=e.details,a=o==null?void 0:o.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${i}${(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(S.SUBTITLE_TRACK_LOADING,{url:r,id:n,groupId:i,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Pi(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(r=>ga(n,r))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!=="disabled"&&r!==i&&(r.mode="disabled")}),i){const r=this.subtitleDisplay?"showing":"hidden";i.mode!==r&&(i.mode=r)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!X(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&r)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:o,groupId:a="",name:l,type:c,url:u}=i;this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:l,type:c,url:u});const f=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(f)}}function In(s){let e=5381,t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return(e>>>0).toString()}const Vs=.025;let or=function(s){return s[s.Point=0]="Point",s[s.Range=1]="Range",s}({});function n8(s,e,t){return`${s.identifier}-${t+1}-${In(e)}`}class i8{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 n=this.playoutLimit;return e<=0||isNaN(n)?!1:n===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>n}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 lo(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,n=lo(t,e);return t-n<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=X(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 lo(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)<Vs))}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"?or.Range:or.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 r8(this)}}function lo(s,e){return s-e.start<e.duration/2&&!(Math.abs(s-(e.start+e.duration))<Vs)?e.start:e.start+e.duration}function _p(s,e,t){const n=new self.URL(s,t);return n.protocol!=="data:"&&n.searchParams.set("_HLS_primary_id",e),n}function co(s,e){for(;(t=s.assetList[++e])!=null&&t.error;)var t;return e}function r8(s){return`["${s.identifier}" ${s.cue.pre?"<pre>":s.cue.post?"<post>":""}${s.timelineStart.toFixed(2)}-${s.resumeTime.toFixed(2)}]`}function Bs(s){const e=s.timelineStart,t=s.duration||0;return`["${s.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class o8{constructor(e,t,n,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls.trigger(S.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(t);this.interstitial=n,this.assetItem=i;let o=i.uri;try{o=_p(o,t.primarySessionId).href}catch{}r.loadSource(o);const a=()=>{this.hasDetails=!0};r.once(S.LEVEL_LOADED,a),r.once(S.AUDIO_TRACK_LOADED,a),r.once(S.SUBTITLE_TRACK_LOADED,a),r.on(S.MEDIA_ATTACHING,(l,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on(S.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,r.trigger(S.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 n=this.timelineOffset,i=ae.bufferInfo(e,n,0);return this.getAssetTime(i.end)>=this._bufferedEosTime-.02}reachedPlayout(e){const n=this.interstitial.playoutLimit;return this.startOffset+e>=n}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=ae.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 n=e-t;if(Math.abs(n)>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,n=this.duration;return Math.min(Math.max(0,e-t),n)}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=n=>delete n.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){this.hls.on(e,t)}once(e,t,n){this.hls.once(e,t)}off(e,t,n){this.hls.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Bs(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const lf=.033;class a8 extends lt{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((n,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,n+1):n,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 n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(r=i[n])!=null&&r.event;){var r;n--}return n}findItemIndexAtTime(e,t){const n=this.items;if(n)for(let i=0;i<n.length;i++){let r=n[i];if(t&&t!=="primary"&&(r=r[t]),e===r.start||e>r.start&&e<r.end)return i}return-1}findJumpRestrictedIndex(e,t){const n=this.items;if(n)for(let i=e;i<=t&&n[i];i++){const r=n[i].event;if(r!=null&&r.restrictions.jump&&!r.appendInPlace)return i}return-1}findEventIndex(e){const t=this.items;if(t)for(let i=t.length;i--;){var n;if(((n=t[i].event)==null?void 0:n.identifier)===e)return i}return-1}findAssetIndex(e,t){const n=e.assetList,i=n.length;if(i>1)for(let r=0;r<i;r++){const o=n[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 n=(e=this.items)==null||(t=e[this.length-1])==null?void 0:t.event;if(n){const i=n.assetList,r=i[i.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const n=e.main.details,{dateRanges:i}=n,r=this.events,o=this.parseDateRanges(i,{url:n.url},t),a=Object.keys(i),l=r?r.filter(c=>!a.includes(c.identifier)):[];o.length&&o.sort((c,u)=>{const f=c.cue.pre,h=c.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=c.startTime,g=u.startTime;if(m!==g)return m-g}return c.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=o,l.forEach(c=>{this.removeEvent(c)}),this.updateSchedule(e,l)}updateSchedule(e,t=[]){const n=this.events||[];if(n.length||t.length||this.length<2){const i=this.items,r=this.parseSchedule(n,e);(t.length||(i==null?void 0:i.length)!==r.length||r.some((a,l)=>Math.abs(a.playout.start-i[l].playout.start)>.005||Math.abs(a.playout.end-i[l].playout.end)>.005))&&(this.items=r,this.onScheduleUpdate(t,i))}}parseDateRanges(e,t,n){const i=[],r=Object.keys(e);for(let o=0;o<r.length;o++){const a=r[o],l=e[a];if(l.isInterstitial){let c=this.eventMap[a];c?c.setDateRange(l):(c=new i8(l,t),this.eventMap[a]=c,n===!1&&(c.appendInPlace=n)),i.push(c)}}return i}parseSchedule(e,t){const n=[],i=t.main.details,r=i.live?1/0:i.edge;let o=0;if(e=e.filter(l=>!l.error&&!(l.cue.once&&l.hasPlayed)),e.length){this.resolveOffsets(e,t);let l=0,c=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,E=u.timelineOccupancy===or.Range?y:0,x=u.resumptionOffset,T=(p==null?void 0:p.startTime)===g,v=g+u.cumulativeDuration;let A=m?v+y:g+x;if(h||!d&&g<=0){const I=c;c+=E,u.timelineStart=v;const C=o;o+=y,n.push({event:u,start:v,end:A,playout:{start:C,end:o},integrated:{start:I,end:c}})}else if(g<=r){if(!T){const _=g-l;if(_>lf){const D=l,H=c;c+=_;const V=o;o+=_;const $={previousEvent:e[f-1]||null,nextEvent:u,start:D,end:D+_,playout:{start:V,end:o},integrated:{start:H,end:c}};n.push($)}else _>0&&p&&(p.cumulativeDuration+=_,n[n.length-1].end=g)}d&&(A=v),u.timelineStart=v;const I=c;c+=E;const C=o;o+=y,n.push({event:u,start:v,end:A,playout:{start:C,end:o},integrated:{start:I,end:c}})}else return;const b=u.resumeTime;d||b>r?l=r:l=b}),l<r){var a;const u=l,f=c,h=r-l;c+=h;const d=o;o+=h,n.push({previousEvent:((a=n[n.length-1])==null?void 0:a.event)||null,nextEvent:null,start:l,end:u+h,playout:{start:d,end:o},integrated:{start:f,end:c}})}this.setDurations(r,o,c)}else n.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 n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){const n=t.main.details,i=n.live?1/0:n.edge;let r=0,o=-1;e.forEach((a,l)=>{const c=a.cue.pre,u=a.cue.post,f=c?0:u?i:a.startTime;this.updateAssetDurations(a),o===f?a.cumulativeDuration=r:(r=0,o=f),!u&&a.snapOptions.in&&(a.resumeAnchor=Js(null,n.fragments,a.startOffset+a.resumptionOffset,0,0)||void 0),a.appendInPlace&&!a.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(a,t)||(a.appendInPlace=!1)),!a.appendInPlace&&l+1<e.length&&e[l+1].startTime-e[l].resumeTime<lf&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${a}`));const d=X(a.resumeOffset)?a.resumeOffset:a.duration;r+=d})}primaryCanResumeInPlaceAt(e,t){const n=e.resumeTime,i=e.startTime+e.resumptionOffset;return Math.abs(n-i)>Vs?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${i}`),!1):t?!Object.keys(t).some(o=>{const a=t[o].details,l=a.edge;if(n>=l)return this.log(`"${e.identifier}" resumption ${n} past ${o} playlist end ${l}`),!1;const c=Js(null,a.fragments,n);if(!c)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${o} playlist (${a.fragStart}-${a.fragmentEnd})`),!0;const u=o==="audio"?.175:0;return Math.abs(c.start-n)<Vs+u||Math.abs(c.end-n)<Vs+u?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${o} fragment bounds (${c.start}-${c.end} sn: ${c.sn} cc: ${c.cc})`),!0)}):(this.log(`"${e.identifier}" resumption ${n} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let n=0,i=!1,r=!1;e.assetList.forEach((o,a)=>{const l=t+n;o.startOffset=n,o.timelineStart=l,i||(i=o.duration===null),r||(r=!!o.error);const c=o.error?0:o.duration||0;n+=c}),i&&!r?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Dt(s){return`[${s.event?'"'+s.event.identifier+'"':"primary"}: ${s.start.toFixed(2)}-${s.end.toFixed(2)}]`}class l8{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const n=e.assetListUrl;let i;try{i=_p(n,this.hls.sessionId,e.baseUrl)}catch(h){const d=this.assignAssetListError(e,N.ASSET_LIST_LOAD_ERROR,h,n);this.hls.trigger(S.ERROR,d);return}t&&i.protocol!=="data:"&&i.searchParams.set("_HLS_start_offset",""+t);const r=this.hls.config,o=r.loader,a=new o(r),l={responseType:"json",url:i.href},c=r.interstitialAssetListLoadPolicy.default,u={loadPolicy:c,timeout:c.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 E=this.assignAssetListError(e,N.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),p.url,d,m);this.hls.trigger(S.ERROR,E);return}e.assetListResponse=g,this.hls.trigger(S.ASSET_LIST_LOADED,{event:e,assetListResponse:g,networkDetails:m})},onError:(h,d,p,m)=>{const g=this.assignAssetListError(e,N.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(S.ERROR,g)},onTimeout:(h,d,p)=>{const m=this.assignAssetListError(e,N.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${d.url})`),d.url,h,p);this.hls.trigger(S.ERROR,m)}};return a.load(l,u,f),this.hls.trigger(S.ASSET_LIST_LOADING,{event:e}),a}assignAssetListError(e,t,n,i,r,o){return e.error=n,{type:Z.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:n,networkDetails:o,stats:r}}}function cf(s){s==null||s.play().catch(()=>{})}class c8 extends lt{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 n=this.currentTime;if(n===void 0||this.playbackDisabled)return;const i=n-this.timelinePos;if(Math.abs(i)<1/7056e5)return;const o=i<=-.01;this.timelinePos=n,this.bufferedPos=n;const a=this.playingItem;if(!a){this.checkBuffer();return}if(o&&this.schedule.resetErrorsInRange(n,n-i)&&this.updateSchedule(),this.checkBuffer(),o&&n<a.start||n>=a.end){var l;const h=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(a)&&(l=this.media)!=null&&l.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 c=this.playingAsset;if(!c){if(this.playingLastItem&&this.isInterstitial(a)){const h=a.event.assetList[0];h&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(n,h))}return}const u=c.timelineStart,f=c.duration||0;(o&&n<u||n>=u+f)&&this.setScheduleToAssetAtTime(n,c)},this.onTimeupdate=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;if(n>this.timelinePos)this.timelinePos=n,n>this.bufferedPos&&this.checkBuffer();else return;const i=this.playingItem;if(!i||this.playingLastItem)return;if(n>=i.end){this.timelinePos=i.end;const a=this.findItemIndex(i);this.setSchedulePosition(a+1)}const r=this.playingAsset;if(!r)return;const o=r.timelineStart+(r.duration||0);n>=o&&this.setScheduleToAssetAtTime(n,r)},this.onScheduleUpdate=(n,i)=>{const r=this.schedule,o=this.playingItem,a=r.events||[],l=r.items||[],c=r.durations,u=n.map(p=>p.identifier),f=!!(a.length||u.length);(f||i)&&this.log(`INTERSTITIALS_UPDATED (${a.length}): ${a}
- Schedule: ${l.map(p=>Dt(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)>Vs&&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(n.forEach(p=>{p.assetList.forEach(m=>{this.clearAssetPlayer(m.identifier,null)})}),f||i){if(this.hls.trigger(S.INTERSTITIALS_UPDATED,{events:a.slice(0),schedule:l.slice(0),durations:c,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 l8(e),this.schedule=new a8(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(S.BUFFER_APPENDED,this.onBufferAppended,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(S.MEDIA_ENDED,this.onMediaEnded,this),e.on(S.ERROR,this.onError,this),e.on(S.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(S.BUFFER_CODECS,this.onBufferCodecs,this),e.off(S.BUFFER_APPENDED,this.onBufferAppended,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(S.MEDIA_ENDED,this.onMediaEnded,this),e.off(S.ERROR,this.onError,this),e.off(S.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){Gs(e,"play",this.onPlay),Gs(e,"pause",this.onPause),Gs(e,"seeking",this.onSeeking),Gs(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const n=this.media=t.media;us(n,"seeking",this.onSeeking),us(n,"timeupdate",this.onTimeupdate),us(n,"play",this.onPlay),us(n,"pause",this.onPause)}onMediaAttached(e,t){const n=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!i){this.clearScheduleState();const r=this.findItemIndex(n);this.setSchedulePosition(r)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(this.media=null,!n&&(i&&this.removeMediaListeners(i),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,n=f=>f&&e.getAssetPlayer(f.identifier),i=(f,h,d,p,m)=>{if(f){let g=f[h].start;const y=f.event;if(y){if(h==="playout"||y.timelineOccupancy!==or.Point){const E=n(d);(E==null?void 0:E.interstitial)===y&&(g+=E.assetItem.startOffset+E[m])}}else{const E=p==="bufferedPos"?o():e[p];g+=E-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]},l=(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),E=(p=e.schedule.items)==null?void 0:p[y],x=e.getBufferingPlayer(),T=x==null?void 0:x.interstitial,v=T==null?void 0:T.appendInPlace,A=g&&e.itemsMatch(g,E);if(g&&(v||A)){const I=n(e.playingAsset),C=(I==null?void 0:I.media)||e.primaryMedia;if(C){const _=h==="primary"?C.currentTime:i(g,h,e.playingAsset,"timelinePos","currentTime"),D=f-_,H=(v?_:C.currentTime)+D;if(H>=0&&(!I||v||H<=I.duration)){C.currentTime=H;return}}}if(E){let I=f;if(h!=="primary"){const _=E[h].start,D=f-_;I=E.start+D}const C=!e.isInterstitial(E);if((!e.isInterstitial(g)||g.event.appendInPlace)&&(C||E.event.appendInPlace)){const _=e.media||(v?x==null?void 0:x.media:null);_&&(_.currentTime=I)}else if(g){const _=e.findItemIndex(g);if(y>_){const H=e.schedule.findJumpRestrictedIndex(_+1,y);if(H>_){e.setSchedulePosition(H);return}}let D=0;if(C)e.timelinePos=I,e.checkBuffer();else{var b;const H=E==null||(b=E.event)==null?void 0:b.assetList;if(H){const V=f-(E[h]||E).start;for(let $=H.length;$--;){const B=H[$];if(B.duration&&V>=B.startOffset&&V<B.startOffset+B.duration){D=$;break}}}}e.setSchedulePosition(y,D)}}},c=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const h=t();return e.isInterstitial(h)?h:null},u={get currentTime(){const f=c(),h=e.effectivePlayingItem;return h&&h===f?i(h,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-h.playout.start:0},set currentTime(f){const h=c(),d=e.effectivePlayingItem;d&&d===h&&l(f+d.playout.start,"playout")},get duration(){const f=c();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const h=(f=c())==null?void 0:f.event.assetList;return h?h.map(d=>e.getAssetPlayer(d.identifier)):[]},get playingIndex(){var f;const h=(f=c())==null?void 0:f.event;return h&&e.effectivePlayingAsset?h.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};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 c()?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){l(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 i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){l(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;l(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,n=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!n?!1:this.findItemIndex(t)===n.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t,n;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(t=e.event)!=null&&t.appendInPlace&&(r=this.primaryMedia);const o=(n=r)==null?void 0:n.currentTime;if(!(o===void 0||!X(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 n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){const n=e.interstitial.appendInPlace,i=e.media;if(n&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i){this.detachedData={media:i};return}const r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${ye(r)}`),this.detachedData=r}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var n,i;if(e.media===t)return;let r=null;const o=this.hls,a=e!==o,l=a&&e.interstitial.appendInPlace,c=(n=this.detachedData)==null?void 0:n.mediaSource;let u;if(o.media)l&&(r=o.transferMedia(),this.detachedData=r),u="Primary";else if(c){const d=this.getBufferingPlayer();d?(r=d.transferMedia(),u=`${d}`):u="detached MediaSource"}else u="detached media";if(!r){if(c)r=this.detachedData,this.log(`using detachedData: MediaSource ${ye(r)}`);else if(!this.detachedData||o.media===t){const d=this.playerQueue;d.length>1&&d.forEach(p=>{if(a&&p.interstitial.appendInPlace!==l){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&&((i=r.mediaSource)==null?void 0:i.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 n=this.timelinePos,i=this.effectivePlayingItem;if(n===-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(i&&!this.playingItem){const r=e.findItemIndex(i);this.setSchedulePosition(r)}}advanceAfterAssetEnded(e,t,n){const i=co(e,n);if(!e.isAssetPastPlayoutLimit(i))this.setSchedulePosition(t,i);else{const r=this.schedule.items;if(r){const o=t+1,a=r.length;if(o>=a){this.setSchedulePosition(-1);return}const l=e.resumeTime;this.timelinePos<l&&(this.timelinePos=l,this.checkBuffer()),this.setSchedulePosition(o)}}}setScheduleToAssetAtTime(e,t){const n=this.schedule,i=t.parentIdentifier,r=n.getEvent(i);if(r){const o=n.findEventIndex(i),a=n.findAssetIndex(r,e);this.advanceAfterAssetEnded(r,o,a-1)}}setSchedulePosition(e,t){const n=this.schedule.items;if(!n||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const i=e>=0?n[e]:null,r=this.playingItem,o=this.playingLastItem;if(this.isInterstitial(r)){var a;const c=r.event,u=this.playingAsset,f=u==null?void 0:u.identifier,h=f?this.getAssetPlayer(f):null;if(h&&f&&(!this.eventItemsMatch(r,i)||t!==void 0&&f!==((a=c.assetList)==null?void 0:a[t].identifier))){var l;const d=c.findAssetIndex(u);if(this.log(`INTERSTITIAL_ASSET_ENDED ${d+1}/${c.assetList.length} ${Bs(u)}`),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(S.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:d,event:c,schedule:n.slice(0),scheduleIndex:e,player:h}),r!==this.playingItem){this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(c,this.findItemIndex(this.playingItem),d);return}this.retreiveMediaSource(f,i),h.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&h.detachMedia()}if(!this.eventItemsMatch(r,i)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${c} ${Dt(r)}`),c.hasPlayed=!0,this.hls.trigger(S.INTERSTITIAL_ENDED,{event:c,schedule:n.slice(0),scheduleIndex:e}),c.cue.once)){this.updateSchedule();const d=this.schedule.items;if(i&&d){const p=this.findItemIndex(i);this.advanceSchedule(p,d,t,r,o)}return}}this.advanceSchedule(e,n,t,r,o)}advanceSchedule(e,t,n,i,r){const o=e>=0?t[e]:null,a=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(c=>{const u=c.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 c=o.event;if(n===void 0){n=this.schedule.findAssetIndex(c,this.timelinePos);const d=co(c,n-1);if(c.isAssetPastPlayoutLimit(d)){this.advanceAfterAssetEnded(c,e,n);return}n=d}const u=this.waitingItem;this.assetsBuffered(o,a)||this.setBufferingItem(o);let f=this.preloadAssets(c,n);if(this.eventItemsMatch(o,u||i)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Dt(o)} ${c.appendInPlace?"append in place":""}`),this.hls.trigger(S.INTERSTITIAL_STARTED,{event:c,schedule:t.slice(0),scheduleIndex:e})),!c.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${c}`);return}if(c.assetListLoader&&(c.assetListLoader.destroy(),c.assetListLoader=void 0),!a){this.log(`Waiting for attachMedia to start Interstitial ${c}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const h=c.assetList[n];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(c,e,n||0);return}if(f||(f=this.getAssetPlayer(h.identifier)),f===null||f.destroyed){const d=c.assetList.length;this.warn(`asset ${n+1}/${d} player destroyed ${c}`),f=this.createAssetPlayer(c,h,n)}if(!this.eventItemsMatch(o,this.bufferingItem)&&c.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(f,n,t,e,a),this.shouldPlay&&cf(f.media)}else o!==null?(this.resumePrimary(o,e,i),this.shouldPlay&&cf(this.hls.media)):r&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.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,n){var i;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Dt(e)}`),!((i=this.detachedData)!=null&&i.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.timelinePos=o),this.attachPrimary(o,e)}if(!n)return;const r=this.schedule.items;r&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Dt(e)}`),this.hls.trigger(S.INTERSTITIALS_PRIMARY_RESUMED,{schedule:r.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const n=e.start;if(this.primaryLive){const i=this.primaryDetails;if(t===0)return this.hls.startPosition;if(i&&(n<i.fragmentStart||n>i.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:ae.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,i),n&&this.startLoadingPrimaryAt(e,n)),n||(this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){var n;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs((((n=i.mainForwardBufferInfo)==null?void 0:n.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.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(S.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(S.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1)return;const n=this.hls.levels[t.level],i=pe(pe({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const n=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=pe(pe({},this.altSelection),{},{audio:n});return}const r=pe(pe({},i),{},{audio:n});this.mediaSelection=r}onSubtitleTrackUpdated(e,t){const n=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=pe(pe({},this.altSelection),{},{subtitles:n});return}const r=pe(pe({},i),{},{subtitles:n});this.mediaSelection=r}onAudioTrackSwitching(e,t){const n=Ru(t);this.playerQueue.forEach(i=>i.hls.setAudioOption(t)||i.hls.setAudioOption(n))}onSubtitleTrackSwitch(e,t){const n=Ru(t);this.playerQueue.forEach(i=>i.hls.setSubtitleOption(t)||t.id!==-1&&i.hls.setSubtitleOption(n))}onBufferCodecs(e,t){const n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let i=0;i<t.length;i++){const r=t[i];if(r.cue.post){var n;const o=this.schedule.findEventIndex(r.identifier),a=(n=this.schedule.items)==null?void 0:n[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 n=this.findItemIndex(t);this.setSchedulePosition(n+1)}else this.shouldPlay=!1}updateItem(e,t){const n=this.schedule.items;if(e&&n){const i=this.findItemIndex(e,t);return n[i]||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 n=e.end+.25,i=ae.bufferInfo(this.primaryMedia,n,0);(i.end>n||(i.nextStart||0)>n)&&(this.attachPrimary(n,null),this.flushFrontBuffer(n))}}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 n;return!!t&&(e===t||e.event.identifier===((n=t.event)==null?void 0:n.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 n=ae.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=n.len<1),this.updateBufferedPos(n.end,t,e)}updateBufferedPos(e,t,n){const i=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 l=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var c,u;const f=this.findItemIndex(r),h=Math.min(f+1,t.length-1),d=t[h];if((l===-1&&r&&e>=r.end||(c=d.event)!=null&&c.appendInPlace&&e+.01>=d.start)&&(l=h),h-a>1&&(r==null||(u=r.event)==null?void 0:u.appendInPlace)===!1)return;if(this.bufferedPos=e,l>f&&l>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 n&&o&&!this.itemsMatch(o,r)&&(l===a?this.bufferedToItem(o):l===a+1&&this.bufferedToItem(t[l]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(i=>{const r=this.getAssetPlayer(i.identifier);return!(r!=null&&r.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,n=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:i,events:r}=n;if(!i||!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 l=a?a.remaining:t?t.end-this.timelinePos:0;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Dt(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),this.playbackDisabled||(o?e.event.assetList.forEach(c=>{const u=this.getAssetPlayer(c.identifier);u&&u.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(c=>c.pauseBuffering()))),this.hls.trigger(S.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(e,t=0){const n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;const i=this.detachedData;i?i.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){const n=e.event,i=n.assetList.length===0&&!n.assetListLoader,r=n.cue.once;if(i||!r){const o=this.preloadAssets(n,t);if(o!=null&&o.interstitial.appendInPlace){const a=n.assetList[t],l=this.primaryMedia;a&&l&&this.bufferAssetPlayer(o,l)}}}preloadAssets(e,t){const n=e.assetUrl,i=e.assetList.length,r=i===0&&!e.assetListLoader,o=e.cue.once;if(r){const l=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(l+.25)}let c,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-l;h>0&&(c=Math.round(h*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:i} ${e}${c?` live-start: ${u} start-offset: ${c}`:""}`),n)return this.createAsset(e,0,0,l,e.duration,n);const f=this.assetListLoader.loadAssetList(e,c);f&&(e.assetListLoader=f)}else if(!o&&i){for(let l=t;l<i;l++){const c=e.assetList[l],u=this.getAssetPlayerQueueIndex(c.identifier);(u===-1||this.playerQueue[u].destroyed)&&!c.error&&this.createAssetPlayer(e,c,l)}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(i=>{this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;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 n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,i,r,o){const a={parentIdentifier:e.identifier,identifier:n8(e,o,t),duration:r,startOffset:n,timelineStart:i,uri:o};return this.createAssetPlayer(e,a,t)}createAssetPlayer(e,t,n){const i=this.hls,r=i.userConfig;let o=r.videoPreference;const a=i.loadLevelObj||i.levels[i.currentLevel];(o||a)&&(o=de({},o),a.videoCodec&&(o.videoCodec=a.videoCodec),a.videoRange&&(o.allowedVideoRanges=[a.videoRange]));const l=i.audioTracks[i.audioTrack],c=i.subtitleTracks[i.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const x=this.timelinePos-t.timelineStart;if(x>1){const T=t.duration;T&&x<T&&(u=x)}}const f=t.identifier,h=pe(pe({},r),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:i.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:l||r.audioPreference,subtitlePreference:c||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=de({},d,{contentId:In(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const p=new o8(this.HlsPlayerClass,h,e,t);this.playerQueue.push(p),e.assetList[n]=t;const m=x=>{if(x.live){const A=new Error(`Interstitials MUST be VOD assets ${e}`),b={fatal:!0,type:Z.OTHER_ERROR,details:N.INTERSTITIAL_ASSET_ITEM_ERROR,error:A};this.handleAssetItemError(b,e,this.schedule.findEventIndex(e.identifier),n,A.message);return}const T=x.edge-x.fragmentStart,v=t.duration;(v===null||T>v)&&(this.log(`Interstitial asset "${f}" duration change ${v} > ${T}`),t.duration=T,this.updateSchedule())};p.on(S.LEVEL_UPDATED,(x,{details:T})=>m(T)),p.on(S.LEVEL_PTS_UPDATED,(x,{details:T})=>m(T));const g=(x,T)=>{const v=this.getAssetPlayer(f);if(v&&T.tracks){v.off(S.BUFFER_CODECS,g),v.tracks=T.tracks;const A=this.primaryMedia;this.bufferingAsset===v.assetItem&&A&&!v.media&&this.bufferAssetPlayer(v,A)}};p.on(S.BUFFER_CODECS,g);const y=()=>{var x;const T=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${T}`),!T)return;const v=this.schedule.findEventIndex(e.identifier),A=(x=this.schedule.items)==null?void 0:x[v];if(this.isInterstitial(A)){const I=e.findAssetIndex(t),C=co(e,I);if(!e.isAssetPastPlayoutLimit(C))this.bufferedToItem(A,C);else{var b;const _=(b=this.schedule.items)==null?void 0:b[v+1];_&&this.bufferedToItem(_)}}};p.on(S.BUFFERED_TO_END,y);const E=x=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const v=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,v,x)};return p.once(S.MEDIA_ENDED,E(n)),p.once(S.PLAYOUT_LIMIT_REACHED,E(1/0)),p.on(S.ERROR,(x,T)=>{const v=this.getAssetPlayer(f);if(T.details===N.BUFFER_STALLED_ERROR){if(v!=null&&v.media){const A=v.currentTime,b=v.duration-A;A&&e.appendInPlace&&b/v.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${v.media.currentTime}`),y()):(this.warn(`Stalled at ${A} of ${A+b} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(T,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${T.error} ${e}`)}),p.on(S.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const T=new Error(`Asset player destroyed unexpectedly ${f}`),v={fatal:!0,type:Z.OTHER_ERROR,details:N.INTERSTITIAL_ASSET_ITEM_ERROR,error:T};this.handleAssetItemError(v,e,this.schedule.findEventIndex(e.identifier),n,T.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Bs(t)}`),this.hls.trigger(S.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:p}),p}clearInterstitial(e,t){e.assetList.forEach(n=>{this.clearAssetPlayer(n.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){this.log(`clear asset player "${e}" toSegment: ${t&&Dt(t)}`);const i=this.playerQueue[n];this.transferMediaFromPlayer(i,t),this.playerQueue.splice(n,1),i.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,i,r){const{interstitial:o,assetItem:a,assetId:l}=e,c=o.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=a,(!u||u.identifier!==l)&&(u&&(this.clearAssetPlayer(u.identifier,n[i]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${c} ${Bs(a)}`),this.hls.trigger(S.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:t,event:o,schedule:n.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var n,i;const{interstitial:r,assetItem:o}=e,a=this.schedule.findEventIndex(r.identifier),l=(n=this.schedule.items)==null?void 0:n[a];if(!l)return;this.setBufferingItem(l),this.bufferingAsset=o;const c=this.getBufferingPlayer();if(c===e)return;const u=r.appendInPlace;if(u&&(c==null?void 0:c.interstitial.appendInPlace)===!1)return;const f=(c==null?void 0:c.tracks)||((i=this.detachedData)==null?void 0:i.tracks)||this.requiredTracks;if(u&&o!==this.playingAsset){if(!e.tracks)return;if(f&&!P0(f,e.tracks)){const h=new Error(`Asset ${Bs(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:N.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,n,i,r){if(e.details===N.BUFFER_STALLED_ERROR)return;const o=t.assetList[i];this.warn(`INTERSTITIAL_ASSET_ERROR ${o&&Bs(o)} ${e.error}`);const a=o==null?void 0:o.identifier,l=this.getAssetPlayerQueueIndex(a),c=this.playerQueue[l]||null,u=this.schedule.items,f=de({},e,{fatal:!1,errorAction:jn(!0),asset:o,assetListIndex:i,event:t,schedule:u,scheduleIndex:n,player:c});if(this.hls.trigger(S.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=i;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,n,i)}primaryFallback(e){const t=e.timelineStart,n=this.effectivePlayingItem;if(this.updateSchedule(),n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${n?Dt(n):"<none>"} error: ${e.error}`);let i=this.timelinePos;i===-1&&(i=this.hls.startPosition);const r=this.updateItem(n,i);this.itemsMatch(n,r)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));const o=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(o)}else this.checkStart()}onAssetListLoaded(e,t){var n;const i=t.event,r=i.identifier,o=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(r))return;const a=i.timelineStart,l=i.duration;let c=0;o.forEach((p,m)=>{const g=parseFloat(p.DURATION);this.createAsset(i,m,c,a+c,g,p.URI),c+=g}),i.duration=c,this.log(`Loaded asset-list with duration: ${c} (was: ${l}) ${i}`);const u=this.waitingItem,f=(u==null?void 0:u.event.identifier)===r;this.updateSchedule();const h=(n=this.bufferingItem)==null?void 0:n.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){i.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${i}`),this.primaryFallback(i);return}this.setBufferingItem(m)}this.setSchedulePosition(p)}else if((h==null?void 0:h.identifier)===r&&h.appendInPlace){const p=i.assetList[0],m=this.getAssetPlayer(p.identifier),g=this.primaryMedia;p&&m&&g&&this.bufferAssetPlayer(m,g)}}onError(e,t){switch(t.details){case N.ASSET_LIST_PARSING_ERROR:case N.ASSET_LIST_LOAD_ERROR:case N.ASSET_LIST_LOAD_TIMEOUT:{const n=t.interstitial;n&&this.primaryFallback(n);break}case N.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const uf=500;class u8 extends J0{constructor(e,t,n){super(e,t,n,"subtitle-stream-controller",se.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(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=j.IDLE,this.setInterval(uf),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:n,success:i}=t;if(this.fragContextChanged(n)||(qe(n)&&(this.fragPrevious=n),this.state=j.IDLE),!i)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let o;const a=n.start;for(let c=0;c<r.length;c++)if(a>=r[c].start&&a<=r[c].end){o=r[c];break}const l=n.start+n.duration;o?o.end=l:(o={start:a,end:l},r.push(o)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:n,endOffset:i}=t;if(n===0&&i!==Number.POSITIVE_INFINITY){const r=i-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(n,r,se.SUBTITLE)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===se.SUBTITLE&&(t.details===N.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==j.STOPPED&&(this.state=j.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&yp(this.levels,t)){this.levels=t.map(n=>new Ji(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new Ji(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,se.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==j.STOPPED&&this.setInterval(uf)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,levels:r}=this,{details:o,id:a}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const l=r[a];if(a>=r.length||!l)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 c=0;if(o.live||(n=l.details)!=null&&n.live){if(o.deltaUpdateFailed)return;const f=this.mainDetails;if(!f){this.startFragRequested=!1;return}const h=f.fragments[0];if(!l.details)o.hasProgramDateTime&&f.hasProgramDateTime?(sr(o,f),c=o.fragmentStart):h&&(c=h.start,ha(o,c));else{var u;c=this.alignPlaylists(o,l.details,(u=this.levelLastLoaded)==null?void 0:u.details),c===0&&h&&(c=h.start,ha(o,c))}f&&!this.startFragRequested&&this.setStartPosition(f,c)}l.details=o,this.levelLastLoaded=l,a===i&&(this.hls.trigger(S.SUBTITLE_TRACK_UPDATED,{details:o,id:a,groupId:t.groupId}),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===j.IDLE&&(Js(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,i=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&Sl(i.method)){const o=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer,xl(i.method)).catch(a=>{throw r.trigger(S.ERROR,{type:Z.MEDIA_ERROR,details:N.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const l=performance.now();r.trigger(S.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:l}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=j.IDLE})}}doTick(){if(!this.media){this.state=j.IDLE;return}if(this.state===j.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;const{config:i}=this,r=this.getLoadPosition(),o=ae.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,i.maxBufferHole),{end:a,len:l}=o,c=n.details,u=this.hls.maxBufferLength+c.levelTargetDuration;if(l>u)return;const f=c.fragments,h=f.length,d=c.edge;let p=null;const m=this.fragPrevious;if(a<d){const E=i.maxFragLookUpTolerance,x=a>d-E?0:E;p=Js(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,n.details),!p)return;const g=p.sn-c.startSN,y=f[g-1];if(y&&y.cc===p.cc&&this.fragmentTracker.getState(y)===Je.NOT_LOADED&&(p=y),this.fragmentTracker.getState(p)===Je.NOT_LOADED){const E=this.mapToInitFragWhenRequired(p);E&&this.loadFragment(E,n,a)}}}loadFragment(e,t,n){qe(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new f8(this.tracksBuffered[this.currentTrackId]||[])}}class f8{constructor(e){this.buffered=void 0;const t=(n,i,r)=>{if(i=i>>>0,i>r-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${r})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}const h8={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},wp=s=>String.fromCharCode(h8[s]||s),it=15,Et=100,d8={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},p8={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g8={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},m8={25:2,26:4,29:6,30:8,31:10,27:13,28:15},y8=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class S8{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;fe.log(`${this.time} [${e}] ${n}`)}}}const ts=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class Rp{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 n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}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 x8{constructor(){this.uchar=" ",this.penState=new Rp}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 E8{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Rp,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Et;t++)this.chars.push(new x8);this.logger=e}equals(e){for(let t=0;t<Et;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Et;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Et;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>Et&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Et)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].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=wp(e);if(this.pos>=Et){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<Et;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 n=0;n<Et;n++){const i=this.chars[n].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class uo{constructor(e){this.rows=[],this.currRow=it-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<it;t++)this.rows.push(new E8(e));this.logger=e}reset(){for(let e=0;e<it;e++)this.rows[e].clear();this.currRow=it-1}equals(e){let t=!0;for(let n=0;n<it;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<it;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<it;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 = "+ye(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<it;a++)this.rows[a].clear();const r=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[r].cueStartTime,l=this.logger.time;if(a!==null&&l!==null&&a<l)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(o.rows[r+c])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const r=e.indent,o=Math.max(r-1,0);n.setCursor(e.indent),e.color=n.chars[o].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+ye(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 n="",i=-1;for(let r=0;r<it;r++){const o=this.rows[r].getTextString();o&&(i=r+1,e?t.push("Row "+i+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
- `)),n}getTextAndFormat(){return this.rows}}class ff{constructor(e,t,n){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 uo(n),this.nonDisplayedMemory=new uo(n),this.lastOutputScreen=new uo(n),this.currRollUpRow=this.displayedMemory.rows[it-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[it-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 n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);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 n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}this.logger.log(2,"MIDROW: "+ye(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 hf{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=v8(),this.logger=void 0;const i=this.logger=new S8;this.channels=[null,new ff(e,t,i),new ff(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const i=t[n]&127,r=t[n+1]&127;let o=!1,a=null;if(i===0&&r===0)continue;this.logger.log(3,()=>"["+ts([t[n],t[n+1]])+"] -> ("+ts([i,r])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(T8(i,r,l)){xi(null,null,l),this.logger.log(3,()=>"Repeated command ("+ts([i,r])+") is dropped");continue}xi(i,r,this.cmdHistory),o=this.parseCmd(i,r),o||(o=this.parseMidrow(i,r)),o||(o=this.parsePAC(i,r)),o||(o=this.parseBackgroundAttributes(i,r))}else xi(null,null,l);if(!o&&(a=this.parseChars(i,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([i,r])+" orig: "+ts([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(n||i))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 n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+ts([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,r=(e===16||e===24)&&t>=64&&t<=95;if(!(i||r))return!1;const o=e<=23?1:2;t>=64&&t<=95?n=o===1?d8[e]:g8[e]:n=o===1?p8[e]:m8[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(n,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,t){let n,i=null,r=null;if(e>=25?(n=2,r=e-8):(n=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 '"+wp(o)+"' in channel "+n),i=[o]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+ts(i).join(",")),i}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(n||i))return!1;let r;const o={};e===16||e===24?(r=Math.floor((t-32)/2),o.background=y8[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()}xi(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function xi(s,e,t){t.a=s,t.b=e}function T8(s,e,t){return t.a===s&&t.b===e}function v8(){return{a:null,b:null}}var Rl=function(){if(tr!=null&&tr.VTTCue)return self.VTTCue;const s=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,l){if(typeof l!="string"||!Array.isArray(a))return!1;const c=l.toLowerCase();return~a.indexOf(c)?c:!1}function n(a){return t(s,a)}function i(a){return t(e,a)}function r(a,...l){let c=1;for(;c<arguments.length;c++){const u=arguments[c];for(const f in u)a[f]=u[f]}return a}function o(a,l,c){const u=this,f={enumerable:!0};u.hasBeenReset=!1;let h="",d=!1,p=a,m=l,g=c,y=null,E="",x=!0,T="auto",v="start",A=50,b="middle",I=50,C="middle";Object.defineProperty(u,"id",r({},f,{get:function(){return h},set:function(_){h=""+_}})),Object.defineProperty(u,"pauseOnExit",r({},f,{get:function(){return d},set:function(_){d=!!_}})),Object.defineProperty(u,"startTime",r({},f,{get:function(){return p},set:function(_){if(typeof _!="number")throw new TypeError("Start time must be set to a number.");p=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",r({},f,{get:function(){return m},set:function(_){if(typeof _!="number")throw new TypeError("End time must be set to a number.");m=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",r({},f,{get:function(){return g},set:function(_){g=""+_,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",r({},f,{get:function(){return y},set:function(_){y=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",r({},f,{get:function(){return E},set:function(_){const D=n(_);if(D===!1)throw new SyntaxError("An invalid or illegal string was specified.");E=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",r({},f,{get:function(){return x},set:function(_){x=!!_,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",r({},f,{get:function(){return T},set:function(_){if(typeof _!="number"&&_!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");T=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",r({},f,{get:function(){return v},set:function(_){const D=i(_);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");v=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",r({},f,{get:function(){return A},set:function(_){if(_<0||_>100)throw new Error("Position must be between 0 and 100.");A=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",r({},f,{get:function(){return b},set:function(_){const D=i(_);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");b=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",r({},f,{get:function(){return I},set:function(_){if(_<0||_>100)throw new Error("Size must be between 0 and 100.");I=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",r({},f,{get:function(){return C},set:function(_){const D=i(_);if(!D)throw new SyntaxError("An invalid or illegal string was specified.");C=D,this.hasBeenReset=!0}})),u.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class A8{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Lp(s){function e(n,i,r,o){return(n|0)*3600+(i|0)*60+(r|0)+parseFloat(o||0)}const t=s.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 b8{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function Cp(s,e,t,n){const i=n?s.split(n):[s];for(const r in i){if(typeof i[r]!="string")continue;const o=i[r].split(t);if(o.length!==2)continue;const a=o[0],l=o[1];e(a,l)}}const Sa=new Rl(0,0,""),Ei=Sa.align==="middle"?"middle":"center";function I8(s,e,t){const n=s;function i(){const a=Lp(s);if(a===null)throw new Error("Malformed timestamp: "+n);return s=s.replace(/^[^\sa-zA-Z-]+/,""),a}function r(a,l){const c=new b8;Cp(a,function(h,d){let p;switch(h){case"region":for(let m=t.length-1;m>=0;m--)if(t[m].id===d){c.set(h,t[m].region);break}break;case"vertical":c.alt(h,d,["rl","lr"]);break;case"line":p=d.split(","),c.integer(h,p[0]),c.percent(h,p[0])&&c.set("snapToLines",!1),c.alt(h,p[0],["auto"]),p.length===2&&c.alt("lineAlign",p[1],["start",Ei,"end"]);break;case"position":p=d.split(","),c.percent(h,p[0]),p.length===2&&c.alt("positionAlign",p[1],["start",Ei,"end","line-left","line-right","auto"]);break;case"size":c.percent(h,d);break;case"align":c.alt(h,d,["start",Ei,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let u=c.get("line","auto");u==="auto"&&Sa.line===-1&&(u=-1),l.line=u,l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100),l.align=c.get("align",Ei);let f=c.get("position","auto");f==="auto"&&Sa.position===50&&(f=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=f}function o(){s=s.replace(/^\s+/,"")}if(o(),e.startTime=i(),o(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);s=s.slice(3),o(),e.endTime=i(),o(),r(s,e)}function Pp(s){return s.replace(/<br(?: \/)?>/gi,`
- `)}class _8{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new A8,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 n(){let r=t.buffer,o=0;for(r=Pp(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 i(r){Cp(r,function(o,a){},/:/)}try{let r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;r=n();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=n(),t.state){case"HEADER":/:/.test(r)?i(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 Rl(0,0,""),t.state="CUE",r.indexOf("-->")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{I8(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 w8=/\r\n|\n\r|\n|\r/g,fo=function(e,t,n=0){return e.slice(n,n+t.length)===t},R8=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!X(t)||!X(n)||!X(i)||!X(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*i,t+=60*60*1e3*r,t};function Ll(s,e,t){return In(s.toString())+In(e.toString())+In(t)}const L8=function(e,t,n){let i=e[t],r=e[i.prevCC];if(!r||!r.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(o=r)!=null&&o.new;){var o;e.ccOffset+=i.start-r.start,i.new=!1,i=r,r=e[i.prevCC]}e.presentationOffset=n};function C8(s,e,t,n,i,r,o){const a=new _8,l=We(new Uint8Array(s)).trim().replace(w8,`
- `).split(`
- `),c=[],u=e?K6(e.baseTime,e.timescale):0;let f="00:00.000",h=0,d=0,p,m=!0;a.oncue=function(g){const y=t[n];let E=t.ccOffset;const x=(h-u)/9e4;if(y!=null&&y.new&&(d!==void 0?E=t.ccOffset=y.start:L8(t,n,x)),x){if(!e){p=new Error("Missing initPTS for VTT MPEGTS");return}E=x-t.presentationOffset}const T=g.endTime-g.startTime,v=Xe((g.startTime+E-d)*9e4,i*9e4)/9e4;g.startTime=Math.max(v,0),g.endTime=Math.max(v+T,0);const A=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(A)),g.id||(g.id=Ll(g.startTime,g.endTime,A)),g.endTime>0&&c.push(g)},a.onparsingerror=function(g){p=g},a.onflush=function(){if(p){o(p);return}r(c)},l.forEach(g=>{if(m)if(fo(g,"X-TIMESTAMP-MAP=")){m=!1,g.slice(16).split(",").forEach(y=>{fo(y,"LOCAL:")?f=y.slice(6):fo(y,"MPEGTS:")&&(h=parseInt(y.slice(7)))});try{d=R8(f)/1e3}catch(y){p=y}return}else g===""&&(m=!1);a.parse(g+`
- `)}),a.flush()}const ho="stpp.ttml.im1t",Dp=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,kp=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,P8={left:"start",center:"center",right:"end",start:"start",end:"end"};function df(s,e,t,n){const i=ne(new Uint8Array(s),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const r=i.map(a=>We(a)),o=j6(e.baseTime,1,e.timescale);try{r.forEach(a=>t(D8(a,o)))}catch(a){n(a)}}function D8(s,e){const i=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(r).reduce((f,h)=>(f[h]=i.getAttribute(`ttp:${h}`)||r[h],f),{}),a=i.getAttribute("xml:space")!=="preserve",l=pf(po(i,"styling","style")),c=pf(po(i,"layout","region")),u=po(i,"body","[begin]");return[].map.call(u,f=>{const h=Op(f,a);if(!h||!f.hasAttribute("begin"))return null;const d=mo(f.getAttribute("begin"),o),p=mo(f.getAttribute("dur"),o);let m=mo(f.getAttribute("end"),o);if(d===null)throw gf(f);if(m===null){if(p===null)throw gf(f);m=d+p}const g=new Rl(d-e,m-e,h);g.id=Ll(g.startTime,g.endTime,g.text);const y=c[f.getAttribute("region")],E=l[f.getAttribute("style")],x=k8(y,E,l),{textAlign:T}=x;if(T){const v=P8[T];v&&(g.lineAlign=v),g.align=T}return de(g,x),g}).filter(f=>f!==null)}function po(s,e,t){const n=s.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function pf(s){return s.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function Op(s,e){return[].slice.call(s.childNodes).reduce((t,n,i)=>{var r;return n.nodeName==="br"&&i?t+`
- `:(r=n.childNodes)!=null&&r.length?Op(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function k8(s,e,t){const n="http://www.w3.org/ns/ttml#styling";let i=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(i=t[o]),r.reduce((a,l)=>{const c=go(e,n,l)||go(s,n,l)||go(i,n,l);return c&&(a[l]=c),a},{})}function go(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function gf(s){return new Error(`Could not parse ttml timestamp ${s}`)}function mo(s,e){if(!s)return null;let t=Lp(s);return t===null&&(Dp.test(s)?t=O8(s,e):kp.test(s)&&(t=F8(s,e))),t}function O8(s,e){const t=Dp.exec(s),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function F8(s,e){const t=kp.exec(s),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class Ti{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,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class B8{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=yf(),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(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_LOADED,this.onFragLoaded,this),e.on(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(S.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_LOADED,this.onFragLoaded,this),e.off(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(S.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Ti(this,"textTrack1"),t=new Ti(this,"textTrack2"),n=new Ti(this,"textTrack3"),i=new Ti(this,"textTrack4");this.cea608Parser1=new hf(1,e,t),this.cea608Parser2=new hf(3,n,i)}addCues(e,t,n,i,r){let o=!1;for(let a=r.length;a--;){const l=r[a],c=M8(l[0],l[1],t,n);if(c>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],n),o=!0,c/(n-t)>.5))return}if(o||r.push([t,n]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,n,i)}else{const a=this.Cues.newCue(null,t,n,i);this.hls.trigger(S.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:r}){const{unparsedVttFrags:o}=this;n===se.MAIN&&(this.initPTS[t.cc]={baseTime:i,timescale:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.initPTS[a.frag.cc]?this.onFragLoaded(S.FRAG_LOADED,a):this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const r=n.textTracks[i];if(mf(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:n,media:i}=this,{label:r,languageCode:o}=t[e],a=this.getExistingTrack(r,o);if(a)n[e]=a,yn(n[e]),Z5(n[e],i);else{const l=this.createTextTrack("captions",r,o);l&&(l[e]=!0,n[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,i={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const n=!!t.transferMedia;if(this.media=null,n)return;const{captionsTracks:i}=this;Object.keys(i).forEach(r=>{yn(i[r]),delete i[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=yf(),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 n=0;n<t.length;n++)yn(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(r=>r.textCodec===ho);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(yp(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,a=o?Pi(o.textTracks):null;if(this.tracks.forEach((l,c)=>{let u;if(a){let f=null;for(let h=0;h<a.length;h++)if(a[h]&&mf(a[h],l)){f=a[h],a[h]=null;break}f&&(u=f)}if(u)yn(u);else{const f=Fp(l);u=this.createTextTrack(f,l.name,l.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),a!=null&&a.length){const l=a.filter(c=>c!==null).map(c=>c.label);l.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const r=`textTrack${i[1]}`,o=this.captionsProperties[r];o&&(o.label=n.name,n.lang&&(o.languageCode=n.lang),o.media=n)})}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===se.MAIN){var n,i;const{cea608Parser1:r,cea608Parser2:o,lastSn:a}=this,{cc:l,sn:c}=t.frag,u=(n=(i=t.part)==null?void 0:i.index)!=null?n:-1;r&&o&&(c!==a+1||c===a&&u!==this.lastPartIndex+1||l!==this.lastCc)&&(r.reset(),o.reset()),this.lastCc=l,this.lastSn=c,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:n,payload:i}=t;if(n.type===se.SUBTITLE)if(i.byteLength){const r=n.decryptdata,o="stats"in t;if(r==null||!r.encrypted||o){const a=this.tracks[n.level],l=this.vttCCs;l[n.cc]||(l[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),a&&a.textCodec===ho?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;df(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{n.logger.log(`Failed to parse IMSC1: ${i}`),n.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:r,unparsedVttFrags:o}=this,a=r.length-1;if(!r[n.cc]&&a===-1){o.push(e);return}const l=this.hls,c=(t=n.initSegment)!=null&&t.data?et(n.initSegment.data,new Uint8Array(i)).buffer:i;C8(c,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,u=>{this._appendCues(u,n.level),l.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},u=>{const f=u.message==="Missing initPTS for VTT MPEGTS";f?o.push(e):this._fallbackToIMSC1(n,i),l.logger.log(`Failed to parse VTT cue: ${u}`),!(f&&a>n.cc)&&l.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:u})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||df(t,this.initPTS[e.cc],()=>{n.textCodec=ho,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(r=>Ip(i,r))}else{const i=this.tracks[t];if(!i)return;const r=i.default?"default":"subtitles"+t;n.trigger(S.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===se.SUBTITLE&&this.onFragLoaded(S.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:i}=t;if(!(n.type===se.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let r=0;r<i.length;r++){const o=i[r].bytes;if(o){this.cea608Parser1||this.initCea608Parsers();const a=this.extractCea608Data(o);this.cea608Parser1.addData(i[r].pts,a[0]),this.cea608Parser2.addData(i[r].pts,a[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:r}){const{media:o}=this;if(!(!o||o.currentTime<n)){if(!r||r==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(l=>af(a[l],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>af(a[l],t,i))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let i=2;for(let r=0;r<n;r++){const o=e[i++],a=127&e[i++],l=127&e[i++];if(a===0&&l===0)continue;if((4&o)!==0){const u=3&o;(u===0||u===1)&&(t[u].push(a),t[u].push(l))}}return t}}function Fp(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function mf(s,e){return!!s&&s.kind===Fp(e)&&ga(e,s)}function M8(s,e,t,n){return Math.min(e,n)-Math.max(s,t)}function yf(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const N8=/\s/,U8={newCue(s,e,t,n){const i=[];let r,o,a,l,c;const u=self.VTTCue||self.TextTrackCue;for(let h=0;h<n.rows.length;h++)if(r=n.rows[h],a=!0,l=0,c="",!r.isEmpty()){var f;for(let m=0;m<r.chars.length;m++)N8.test(r.chars[m].uchar)&&a?l++:(c+=r.chars[m].uchar,a=!1);r.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const d=Pp(c.trim()),p=Ll(e,t,d);s!=null&&(f=s.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(l*8/32)*10),i.push(o))}return s&&i.length&&(i.sort((h,d)=>h.line==="auto"||d.line==="auto"?0:h.line>8&&d.line>8?d.line-h.line:h.line-d.line),i.forEach(h=>Ip(s,h))),i}},$8=/^age:\s*[\d.]+\s*$/im;class G8{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 U4,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,n){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=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return r(n,t.url)}).catch(o=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),r(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(o=>{var a;(a=this.callbacks)==null||a.onError({code:n.status,text:o.message},t,n,i)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:o}=n.loadPolicy;if(i)for(const a in i)e.setRequestHeader(a,i[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),n.timeout=r&&X(r)?r:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,r=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.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-(n.loading.first-n.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const c=t.status,u=t.responseType==="text"?t.responseText:null;if(c>=200&&c<300){const p=u??t.response;if(p!=null){var o,a;n.loading.end=Math.max(self.performance.now(),n.loading.first);const m=t.responseType==="arraybuffer"?p.byteLength:p.length;n.loaded=n.total=m,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);const g=(o=this.callbacks)==null?void 0:o.onProgress;g&&g(n,e,p,t);const y={url:t.responseURL,data:p,code:c};(a=this.callbacks)==null||a.onSuccess(y,n,e,t);return}}const f=r.loadPolicy.errorRetry,h=n.retry,d={url:e.url,data:void 0,code:c};if(er(f,h,!1,d))this.retry(f);else{var l;fe.error(`${c} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:c,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(er(e,t,!0))this.retry(e);else{var n;fe.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=ml(e,n.retry),n.retry++,fe.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.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&&$8.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 H8={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null};pe(pe({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:G8,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:xA,bufferController:o5,capLevelController:_l,errorController:bA,fpsController:J5,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:V0,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:H8},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},j8()),{},{subtitleStreamController:u8,subtitleTrackController:s8,timelineController:B8,audioStreamController:s5,audioTrackController:n5,emeController:Ks,cmcdController:z5,contentSteeringController:X5,interstitialsController:c8});function j8(){return{cueHandler:U8,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 K8(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}(()=>{const s=K8();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();var V8=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function q8(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Bp={exports:{}};(function(s,e){(function(t,n){s.exports=n()})(V8,function(){var t=1e3,n=6e4,i=36e5,r="millisecond",o="second",a="minute",l="hour",c="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,E={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($){var B=["th","st","nd","rd"],F=$%100;return"["+$+(B[(F-20)%10]||B[F]||B[0])+"]"}},x=function($,B,F){var U=String($);return!U||U.length>=B?$:""+Array(B+1-U.length).join(F)+$},T={s:x,z:function($){var B=-$.utcOffset(),F=Math.abs(B),U=Math.floor(F/60),k=F%60;return(B<=0?"+":"-")+x(U,2,"0")+":"+x(k,2,"0")},m:function $(B,F){if(B.date()<F.date())return-$(F,B);var U=12*(F.year()-B.year())+(F.month()-B.month()),k=B.clone().add(U,f),G=F-k<0,M=B.clone().add(U+(G?-1:1),f);return+(-(U+(F-k)/(G?k-M:M-k))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:f,y:d,w:u,d:c,D:p,h:l,m:a,s:o,ms:r,Q:h}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},v="en",A={};A[v]=E;var b="$isDayjsObject",I=function($){return $ instanceof H||!(!$||!$[b])},C=function $(B,F,U){var k;if(!B)return v;if(typeof B=="string"){var G=B.toLowerCase();A[G]&&(k=G),F&&(A[G]=F,k=G);var M=B.split("-");if(!k&&M.length>1)return $(M[0])}else{var w=B.name;A[w]=B,k=w}return!U&&k&&(v=k),k||!U&&v},_=function($,B){if(I($))return $.clone();var F=typeof B=="object"?B:{};return F.date=$,F.args=arguments,new H(F)},D=T;D.l=C,D.i=I,D.w=function($,B){return _($,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var H=function(){function $(F){this.$L=C(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[b]=!0}var B=$.prototype;return B.parse=function(F){this.$d=function(U){var k=U.date,G=U.utc;if(k===null)return new Date(NaN);if(D.u(k))return new Date;if(k instanceof Date)return new Date(k);if(typeof k=="string"&&!/Z$/i.test(k)){var M=k.match(g);if(M){var w=M[2]-1||0,R=(M[7]||"0").substring(0,3);return G?new Date(Date.UTC(M[1],w,M[3]||1,M[4]||0,M[5]||0,M[6]||0,R)):new Date(M[1],w,M[3]||1,M[4]||0,M[5]||0,M[6]||0,R)}}return new Date(k)}(F),this.init()},B.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},B.$utils=function(){return D},B.isValid=function(){return this.$d.toString()!==m},B.isSame=function(F,U){var k=_(F);return this.startOf(U)<=k&&k<=this.endOf(U)},B.isAfter=function(F,U){return _(F)<this.startOf(U)},B.isBefore=function(F,U){return this.endOf(U)<_(F)},B.$g=function(F,U,k){return D.u(F)?this[U]:this.set(k,F)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(F,U){var k=this,G=!!D.u(U)||U,M=D.p(F),w=function(he,ce){var Pe=D.w(k.$u?Date.UTC(k.$y,ce,he):new Date(k.$y,ce,he),k);return G?Pe:Pe.endOf(c)},R=function(he,ce){return D.w(k.toDate()[he].apply(k.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(ce)),k)},P=this.$W,O=this.$M,ee=this.$D,te="set"+(this.$u?"UTC":"");switch(M){case d:return G?w(1,0):w(31,11);case f:return G?w(1,O):w(0,O+1);case u:var oe=this.$locale().weekStart||0,Te=(P<oe?P+7:P)-oe;return w(G?ee-Te:ee+(6-Te),O);case c:case p:return R(te+"Hours",0);case l:return R(te+"Minutes",1);case a:return R(te+"Seconds",2);case o:return R(te+"Milliseconds",3);default:return this.clone()}},B.endOf=function(F){return this.startOf(F,!1)},B.$set=function(F,U){var k,G=D.p(F),M="set"+(this.$u?"UTC":""),w=(k={},k[c]=M+"Date",k[p]=M+"Date",k[f]=M+"Month",k[d]=M+"FullYear",k[l]=M+"Hours",k[a]=M+"Minutes",k[o]=M+"Seconds",k[r]=M+"Milliseconds",k)[G],R=G===c?this.$D+(U-this.$W):U;if(G===f||G===d){var P=this.clone().set(p,1);P.$d[w](R),P.init(),this.$d=P.set(p,Math.min(this.$D,P.daysInMonth())).$d}else w&&this.$d[w](R);return this.init(),this},B.set=function(F,U){return this.clone().$set(F,U)},B.get=function(F){return this[D.p(F)]()},B.add=function(F,U){var k,G=this;F=Number(F);var M=D.p(U),w=function(O){var ee=_(G);return D.w(ee.date(ee.date()+Math.round(O*F)),G)};if(M===f)return this.set(f,this.$M+F);if(M===d)return this.set(d,this.$y+F);if(M===c)return w(1);if(M===u)return w(7);var R=(k={},k[a]=n,k[l]=i,k[o]=t,k)[M]||1,P=this.$d.getTime()+F*R;return D.w(P,this)},B.subtract=function(F,U){return this.add(-1*F,U)},B.format=function(F){var U=this,k=this.$locale();if(!this.isValid())return k.invalidDate||m;var G=F||"YYYY-MM-DDTHH:mm:ssZ",M=D.z(this),w=this.$H,R=this.$m,P=this.$M,O=k.weekdays,ee=k.months,te=k.meridiem,oe=function(ce,Pe,Jt,Rt){return ce&&(ce[Pe]||ce(U,G))||Jt[Pe].slice(0,Rt)},Te=function(ce){return D.s(w%12||12,ce,"0")},he=te||function(ce,Pe,Jt){var Rt=ce<12?"AM":"PM";return Jt?Rt.toLowerCase():Rt};return G.replace(y,function(ce,Pe){return Pe||function(Jt){switch(Jt){case"YY":return String(U.$y).slice(-2);case"YYYY":return D.s(U.$y,4,"0");case"M":return P+1;case"MM":return D.s(P+1,2,"0");case"MMM":return oe(k.monthsShort,P,ee,3);case"MMMM":return oe(ee,P);case"D":return U.$D;case"DD":return D.s(U.$D,2,"0");case"d":return String(U.$W);case"dd":return oe(k.weekdaysMin,U.$W,O,2);case"ddd":return oe(k.weekdaysShort,U.$W,O,3);case"dddd":return O[U.$W];case"H":return String(w);case"HH":return D.s(w,2,"0");case"h":return Te(1);case"hh":return Te(2);case"a":return he(w,R,!0);case"A":return he(w,R,!1);case"m":return String(R);case"mm":return D.s(R,2,"0");case"s":return String(U.$s);case"ss":return D.s(U.$s,2,"0");case"SSS":return D.s(U.$ms,3,"0");case"Z":return M}return null}(ce)||M.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(F,U,k){var G,M=this,w=D.p(U),R=_(F),P=(R.utcOffset()-this.utcOffset())*n,O=this-R,ee=function(){return D.m(M,R)};switch(w){case d:G=ee()/12;break;case f:G=ee();break;case h:G=ee()/3;break;case u:G=(O-P)/6048e5;break;case c:G=(O-P)/864e5;break;case l:G=O/i;break;case a:G=O/n;break;case o:G=O/t;break;default:G=O}return k?G:D.a(G)},B.daysInMonth=function(){return this.endOf(f).$D},B.$locale=function(){return A[this.$L]},B.locale=function(F,U){if(!F)return this.$L;var k=this.clone(),G=C(F,U,!0);return G&&(k.$L=G),k},B.clone=function(){return D.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},$}(),V=H.prototype;return _.prototype=V,[["$ms",r],["$s",o],["$m",a],["$H",l],["$W",c],["$M",f],["$y",d],["$D",p]].forEach(function($){V[$[1]]=function(B){return this.$g(B,$[0],$[1])}}),_.extend=function($,B){return $.$i||($(B,H,_),$.$i=!0),_},_.locale=C,_.isDayjs=I,_.unix=function($){return _(1e3*$)},_.en=A[v],_.Ls=A,_.p={},_})})(Bp);var W8=Bp.exports;const Q8=q8(W8);exports._export_sfc=Np;exports.createSSRApp=t3;exports.createStore=dS;exports.dayjs=Q8;exports.e=z2;exports.f=W2;exports.index=W;exports.n=Y2;exports.nextTick$1=Ba;exports.o=q2;exports.p=J2;exports.resolveComponent=ry;exports.s=Q2;exports.sr=Z2;exports.t=X2;exports.tr=_4;exports.useStore=tS;exports.uviewPlus=IT;
|