You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
922 KiB
126 lines
922 KiB
!(function(){var zo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[2524],{70557:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return H}});var K=O(72308),te=O(59301),ue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M862 465.3h-81c-4.6 0-9 2-12.1 5.5L550 723.1V160c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v563.1L255.1 470.8c-3-3.5-7.4-5.5-12.1-5.5h-81c-6.8 0-10.5 8.1-6 13.2L487.9 861a31.96 31.96 0 0048.3 0L868 478.5c4.5-5.2.8-13.2-6-13.2z"}}]},name:"arrow-down",theme:"outlined"},J=ue,D=O(7657),g=function(W,x){return te.createElement(D.Z,(0,K.Z)({},W,{ref:x,icon:J}))},ee=te.forwardRef(g),H=ee},84105:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return H}});var K=O(72308),te=O(59301),ue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},J=ue,D=O(7657),g=function(W,x){return te.createElement(D.Z,(0,K.Z)({},W,{ref:x,icon:J}))},ee=te.forwardRef(g),H=ee},18785:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return H}});var K=O(72308),te=O(59301),ue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},J=ue,D=O(7657),g=function(W,x){return te.createElement(D.Z,(0,K.Z)({},W,{ref:x,icon:J}))},ee=te.forwardRef(g),H=ee},35593:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return it}});var K=O(77321),te=O(52487),ue=O(74416),J=O(43403),D=O(92310),g=O.n(D),ee=O(29301),H=O(76846),l=O(96452),W=O(6089),x=O(80402),v=O(34280),_=O(49658),b=O(59301),T=O(72308),B=O(77900),U=O(8654);function F(_e){var be=_e.prefixCls,ve=_e.align,Be=_e.arrow,je=_e.arrowPos,Z=Be||{},se=Z.className,de=Z.content,we=je.x,ke=we===void 0?0:we,Ze=je.y,ot=Ze===void 0?0:Ze,pt=b.useRef();if(!ve||!ve.points)return null;var st={position:"absolute"};if(ve.autoArrow!==!1){var Rt=ve.points[0],Ut=ve.points[1],ct=Rt[0],Ct=Rt[1],Ot=Ut[0],Mt=Ut[1];ct===Ot||!["t","b"].includes(ct)?st.top=ot:ct==="t"?st.top=0:st.bottom=0,Ct===Mt||!["l","r"].includes(Ct)?st.left=ke:Ct==="l"?st.left=0:st.right=0}return b.createElement("div",{ref:pt,className:g()("".concat(be,"-arrow"),se),style:st},de)}function I(_e){var be=_e.prefixCls,ve=_e.open,Be=_e.zIndex,je=_e.mask,Z=_e.motion;return je?b.createElement(B.default,(0,T.Z)({},Z,{motionAppear:!0,visible:ve,removeOnLeave:!0}),function(se){var de=se.className;return b.createElement("div",{style:{zIndex:Be},className:g()("".concat(be,"-mask"),de)})}):null}var M=b.memo(function(_e){var be=_e.children;return be},function(_e,be){return be.cache}),j=M,C=b.forwardRef(function(_e,be){var ve=_e.popup,Be=_e.className,je=_e.prefixCls,Z=_e.style,se=_e.target,de=_e.onVisibleChanged,we=_e.open,ke=_e.keepDom,Ze=_e.fresh,ot=_e.onClick,pt=_e.mask,st=_e.arrow,Rt=_e.arrowPos,Ut=_e.align,ct=_e.motion,Ct=_e.maskMotion,Ot=_e.forceRender,Mt=_e.getPopupContainer,Xe=_e.autoDestroy,xi=_e.portal,bt=_e.zIndex,Le=_e.onMouseEnter,Ne=_e.onMouseLeave,Ke=_e.onPointerEnter,Nt=_e.ready,lt=_e.offsetX,Et=_e.offsetY,kt=_e.offsetR,gt=_e.offsetB,nt=_e.onAlign,xt=_e.onPrepare,at=_e.stretch,St=_e.targetWidth,ci=_e.targetHeight,ai=typeof ve=="function"?ve():ve,Si=we||ke,$t=(Mt==null?void 0:Mt.length)>0,Jt=b.useState(!Mt||!$t),Mi=(0,te.Z)(Jt,2),Di=Mi[0],tn=Mi[1];if((0,v.Z)(function(){!Di&&$t&&se&&tn(!0)},[Di,$t,se]),!Di)return null;var Ci="auto",hi={left:"-1000vw",top:"-1000vh",right:Ci,bottom:Ci};if(Nt||!we){var qt,wi=Ut.points,Qi=Ut.dynamicInset||((qt=Ut._experimental)===null||qt===void 0?void 0:qt.dynamicInset),Vi=Qi&&wi[0][1]==="r",fn=Qi&&wi[0][0]==="b";Vi?(hi.right=kt,hi.left=Ci):(hi.left=lt,hi.right=Ci),fn?(hi.bottom=gt,hi.top=Ci):(hi.top=Et,hi.bottom=Ci)}var Ti={};return at&&(at.includes("height")&&ci?Ti.height=ci:at.includes("minHeight")&&ci&&(Ti.minHeight=ci),at.includes("width")&&St?Ti.width=St:at.includes("minWidth")&&St&&(Ti.minWidth=St)),we||(Ti.pointerEvents="none"),b.createElement(xi,{open:Ot||Si,getContainer:Mt&&function(){return Mt(se)},autoDestroy:Xe},b.createElement(I,{prefixCls:je,open:we,zIndex:bt,mask:pt,motion:Ct}),b.createElement(ee.Z,{onResize:nt,disabled:!we},function(Ji){return b.createElement(B.default,(0,T.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Ot,leavedClassName:"".concat(je,"-hidden")},ct,{onAppearPrepare:xt,onEnterPrepare:xt,visible:we,onVisibleChanged:function(Ni){var nn;ct==null||(nn=ct.onVisibleChanged)===null||nn===void 0||nn.call(ct,Ni),de(Ni)}}),function(qi,Ni){var nn=qi.className,Vt=qi.style,sn=g()(je,nn,Be);return b.createElement("div",{ref:(0,U.sQ)(Ji,be,Ni),className:sn,style:(0,K.Z)((0,K.Z)((0,K.Z)((0,K.Z)({"--arrow-x":"".concat(Rt.x||0,"px"),"--arrow-y":"".concat(Rt.y||0,"px")},hi),Ti),Vt),{},{boxSizing:"border-box",zIndex:bt},Z),onMouseEnter:Le,onMouseLeave:Ne,onPointerEnter:Ke,onClick:ot},st&&b.createElement(F,{prefixCls:je,arrow:st,arrowPos:Rt,align:Ut}),b.createElement(j,{cache:!we&&!Ze},ai))})}))}),$=C,X=b.forwardRef(function(_e,be){var ve=_e.children,Be=_e.getTriggerDOMNode,je=(0,U.Yr)(ve),Z=b.useCallback(function(de){(0,U.mH)(be,Be?Be(de):de)},[Be]),se=(0,U.x1)(Z,ve.ref);return je?b.cloneElement(ve,{ref:se}):ve}),Y=X,fe=b.createContext(null),ye=fe;function ae(_e){return _e?Array.isArray(_e)?_e:[_e]:[]}function Q(_e,be,ve,Be){return b.useMemo(function(){var je=ae(ve!=null?ve:be),Z=ae(Be!=null?Be:be),se=new Set(je),de=new Set(Z);return _e&&(se.has("hover")&&(se.delete("hover"),se.add("click")),de.has("hover")&&(de.delete("hover"),de.add("click"))),[se,de]},[_e,be,ve,Be])}var R=O(29194);function A(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ve=arguments.length>2?arguments[2]:void 0;return ve?_e[0]===be[0]:_e[0]===be[0]&&_e[1]===be[1]}function L(_e,be,ve,Be){for(var je=ve.points,Z=Object.keys(_e),se=0;se<Z.length;se+=1){var de,we=Z[se];if(A((de=_e[we])===null||de===void 0?void 0:de.points,je,Be))return"".concat(be,"-placement-").concat(we)}return""}function S(_e,be,ve,Be){return be||(ve?{motionName:"".concat(_e,"-").concat(ve)}:Be?{motionName:Be}:null)}function G(_e){return _e.ownerDocument.defaultView}function P(_e){for(var be=[],ve=_e==null?void 0:_e.parentElement,Be=["hidden","scroll","clip","auto"];ve;){var je=G(ve).getComputedStyle(ve),Z=je.overflowX,se=je.overflowY,de=je.overflow;[Z,se,de].some(function(we){return Be.includes(we)})&&be.push(ve),ve=ve.parentElement}return be}function p(_e){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(_e)?be:_e}function d(_e){return p(parseFloat(_e),0)}function N(_e,be){var ve=(0,K.Z)({},_e);return(be||[]).forEach(function(Be){if(!(Be instanceof HTMLBodyElement||Be instanceof HTMLHtmlElement)){var je=G(Be).getComputedStyle(Be),Z=je.overflow,se=je.overflowClipMargin,de=je.borderTopWidth,we=je.borderBottomWidth,ke=je.borderLeftWidth,Ze=je.borderRightWidth,ot=Be.getBoundingClientRect(),pt=Be.offsetHeight,st=Be.clientHeight,Rt=Be.offsetWidth,Ut=Be.clientWidth,ct=d(de),Ct=d(we),Ot=d(ke),Mt=d(Ze),Xe=p(Math.round(ot.width/Rt*1e3)/1e3),xi=p(Math.round(ot.height/pt*1e3)/1e3),bt=(Rt-Ut-Ot-Mt)*Xe,Le=(pt-st-ct-Ct)*xi,Ne=ct*xi,Ke=Ct*xi,Nt=Ot*Xe,lt=Mt*Xe,Et=0,kt=0;if(Z==="clip"){var gt=d(se);Et=gt*Xe,kt=gt*xi}var nt=ot.x+Nt-Et,xt=ot.y+Ne-kt,at=nt+ot.width+2*Et-Nt-lt-bt,St=xt+ot.height+2*kt-Ne-Ke-Le;ve.left=Math.max(ve.left,nt),ve.top=Math.max(ve.top,xt),ve.right=Math.min(ve.right,at),ve.bottom=Math.min(ve.bottom,St)}}),ve}function V(_e){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ve="".concat(be),Be=ve.match(/^(.*)\%$/);return Be?_e*(parseFloat(Be[1])/100):parseFloat(ve)}function oe(_e,be){var ve=be||[],Be=(0,te.Z)(ve,2),je=Be[0],Z=Be[1];return[V(_e.width,je),V(_e.height,Z)]}function xe(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[_e[0],_e[1]]}function Oe(_e,be){var ve=be[0],Be=be[1],je,Z;return ve==="t"?Z=_e.y:ve==="b"?Z=_e.y+_e.height:Z=_e.y+_e.height/2,Be==="l"?je=_e.x:Be==="r"?je=_e.x+_e.width:je=_e.x+_e.width/2,{x:je,y:Z}}function Me(_e,be){var ve={t:"b",b:"t",l:"r",r:"l"};return _e.map(function(Be,je){return je===be?ve[Be]||"c":Be}).join("")}function We(_e,be,ve,Be,je,Z,se){var de=b.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:je[Be]||{}}),we=(0,te.Z)(de,2),ke=we[0],Ze=we[1],ot=b.useRef(0),pt=b.useMemo(function(){return be?P(be):[]},[be]),st=b.useRef({}),Rt=function(){st.current={}};_e||Rt();var Ut=(0,W.Z)(function(){if(be&&ve&&_e){let ji=function(Pi,_n){var vn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sn,an=ai.x+Pi,Ki=ai.y+_n,Yt=an+qt,Xi=Ki+hi,zn=Math.max(an,vn.left),ts=Math.max(Ki,vn.top),is=Math.min(Yt,vn.right),Bn=Math.min(Xi,vn.bottom);return Math.max(0,(is-zn)*(Bn-ts))},Sn=function(){Bi=ai.y+Je,mi=Bi+hi,Ft=ai.x+Ye,zi=Ft+qt};var Ot,Mt,Xe=be,xi=Xe.ownerDocument,bt=G(Xe),Le=bt.getComputedStyle(Xe),Ne=Le.width,Ke=Le.height,Nt=Le.position,lt=Xe.style.left,Et=Xe.style.top,kt=Xe.style.right,gt=Xe.style.bottom,nt=Xe.style.overflow,xt=(0,K.Z)((0,K.Z)({},je[Be]),Z),at=xi.createElement("div");(Ot=Xe.parentElement)===null||Ot===void 0||Ot.appendChild(at),at.style.left="".concat(Xe.offsetLeft,"px"),at.style.top="".concat(Xe.offsetTop,"px"),at.style.position=Nt,at.style.height="".concat(Xe.offsetHeight,"px"),at.style.width="".concat(Xe.offsetWidth,"px"),Xe.style.left="0",Xe.style.top="0",Xe.style.right="auto",Xe.style.bottom="auto",Xe.style.overflow="hidden";var St;if(Array.isArray(ve))St={x:ve[0],y:ve[1],width:0,height:0};else{var ci=ve.getBoundingClientRect();St={x:ci.x,y:ci.y,width:ci.width,height:ci.height}}var ai=Xe.getBoundingClientRect(),Si=xi.documentElement,$t=Si.clientWidth,Jt=Si.clientHeight,Mi=Si.scrollWidth,Di=Si.scrollHeight,tn=Si.scrollTop,Ci=Si.scrollLeft,hi=ai.height,qt=ai.width,wi=St.height,Qi=St.width,Vi={left:0,top:0,right:$t,bottom:Jt},fn={left:-Ci,top:-tn,right:Mi-Ci,bottom:Di-tn},Ti=xt.htmlRegion,Ji="visible",qi="visibleFirst";Ti!=="scroll"&&Ti!==qi&&(Ti=Ji);var Ni=Ti===qi,nn=N(fn,pt),Vt=N(Vi,pt),sn=Ti===Ji?Vt:nn,Oi=Ni?Vt:sn;Xe.style.left="auto",Xe.style.top="auto",Xe.style.right="0",Xe.style.bottom="0";var on=Xe.getBoundingClientRect();Xe.style.left=lt,Xe.style.top=Et,Xe.style.right=kt,Xe.style.bottom=gt,Xe.style.overflow=nt,(Mt=Xe.parentElement)===null||Mt===void 0||Mt.removeChild(at);var yi=p(Math.round(qt/parseFloat(Ne)*1e3)/1e3),ei=p(Math.round(hi/parseFloat(Ke)*1e3)/1e3);if(yi===0||ei===0||(0,H.Sh)(ve)&&!(0,R.Z)(ve))return;var kn=xt.offset,gi=xt.targetOffset,Qt=oe(ai,kn),ln=(0,te.Z)(Qt,2),ii=ln[0],mt=ln[1],pe=oe(St,gi),ne=(0,te.Z)(pe,2),Ae=ne[0],Ce=ne[1];St.x-=Ae,St.y-=Ce;var Te=xt.points||[],Ue=(0,te.Z)(Te,2),Pe=Ue[0],ut=Ue[1],Tt=xe(ut),re=xe(Pe),At=Oe(St,Tt),wt=Oe(ai,re),Gt=(0,K.Z)({},xt),Ye=At.x-wt.x+ii,Je=At.y-wt.y+mt,ni=ji(Ye,Je),si=ji(Ye,Je,Vt),di=Oe(St,["t","l"]),ti=Oe(ai,["t","l"]),Kt=Oe(St,["b","r"]),Ht=Oe(ai,["b","r"]),Bt=xt.overflow||{},oi=Bt.adjustX,Ii=Bt.adjustY,li=Bt.shiftX,ri=Bt.shiftY,jt=function(_n){return typeof _n=="boolean"?_n:_n>=0},Bi,mi,Ft,zi;Sn();var Gi=jt(Ii),Hi=re[0]===Tt[0];if(Gi&&re[0]==="t"&&(mi>Oi.bottom||st.current.bt)){var _i=Je;Hi?_i-=hi-wi:_i=di.y-Ht.y-mt;var Zi=ji(Ye,_i),dn=ji(Ye,_i,Vt);Zi>ni||Zi===ni&&(!Ni||dn>=si)?(st.current.bt=!0,Je=_i,mt=-mt,Gt.points=[Me(re,0),Me(Tt,0)]):st.current.bt=!1}if(Gi&&re[0]==="b"&&(Bi<Oi.top||st.current.tb)){var vi=Je;Hi?vi+=hi-wi:vi=Kt.y-ti.y-mt;var wn=ji(Ye,vi),On=ji(Ye,vi,Vt);wn>ni||wn===ni&&(!Ni||On>=si)?(st.current.tb=!0,Je=vi,mt=-mt,Gt.points=[Me(re,0),Me(Tt,0)]):st.current.tb=!1}var En=jt(oi),gn=re[1]===Tt[1];if(En&&re[1]==="l"&&(zi>Oi.right||st.current.rl)){var un=Ye;gn?un-=qt-Qi:un=di.x-Ht.x-ii;var Yi=ji(un,Je),rn=ji(un,Je,Vt);Yi>ni||Yi===ni&&(!Ni||rn>=si)?(st.current.rl=!0,Ye=un,ii=-ii,Gt.points=[Me(re,1),Me(Tt,1)]):st.current.rl=!1}if(En&&re[1]==="r"&&(Ft<Oi.left||st.current.lr)){var pn=Ye;gn?pn+=qt-Qi:pn=Kt.x-ti.x-ii;var In=ji(pn,Je),Ui=ji(pn,Je,Vt);In>ni||In===ni&&(!Ni||Ui>=si)?(st.current.lr=!0,Ye=pn,ii=-ii,Gt.points=[Me(re,1),Me(Tt,1)]):st.current.lr=!1}Sn();var Ai=li===!0?0:li;typeof Ai=="number"&&(Ft<Vt.left&&(Ye-=Ft-Vt.left-ii,St.x+Qi<Vt.left+Ai&&(Ye+=St.x-Vt.left+Qi-Ai)),zi>Vt.right&&(Ye-=zi-Vt.right-ii,St.x>Vt.right-Ai&&(Ye+=St.x-Vt.right+Ai)));var Wi=ri===!0?0:ri;typeof Wi=="number"&&(Bi<Vt.top&&(Je-=Bi-Vt.top-mt,St.y+wi<Vt.top+Wi&&(Je+=St.y-Vt.top+wi-Wi)),mi>Vt.bottom&&(Je-=mi-Vt.bottom-mt,St.y>Vt.bottom-Wi&&(Je+=St.y-Vt.bottom+Wi)));var en=ai.x+Ye,Rn=en+qt,_t=ai.y+Je,bn=_t+hi,Ln=St.x,xn=Ln+Qi,Hn=St.y,Wn=Hn+wi,qn=Math.max(en,Ln),Mn=Math.min(Rn,xn),Zt=(qn+Mn)/2,as=Zt-en,jn=Math.max(_t,Hn),Vn=Math.min(bn,Wn),es=(jn+Vn)/2,Nn=es-_t;se==null||se(be,Gt);var Fn=on.right-ai.x-(Ye+ai.width),mn=on.bottom-ai.y-(Je+ai.height);Ze({ready:!0,offsetX:Ye/yi,offsetY:Je/ei,offsetR:Fn/yi,offsetB:mn/ei,arrowX:as/yi,arrowY:Nn/ei,scaleX:yi,scaleY:ei,align:Gt})}}),ct=function(){ot.current+=1;var Mt=ot.current;Promise.resolve().then(function(){ot.current===Mt&&Ut()})},Ct=function(){Ze(function(Mt){return(0,K.Z)((0,K.Z)({},Mt),{},{ready:!1})})};return(0,v.Z)(Ct,[Be]),(0,v.Z)(function(){_e||Ct()},[_e]),[ke.ready,ke.offsetX,ke.offsetY,ke.offsetR,ke.offsetB,ke.arrowX,ke.arrowY,ke.scaleX,ke.scaleY,ke.align,ct]}var rt=O(80702);function ft(_e,be,ve,Be,je){(0,v.Z)(function(){if(_e&&be&&ve){let ot=function(){Be(),je()};var Z=be,se=ve,de=P(Z),we=P(se),ke=G(se),Ze=new Set([ke].concat((0,rt.Z)(de),(0,rt.Z)(we)));return Ze.forEach(function(pt){pt.addEventListener("scroll",ot,{passive:!0})}),ke.addEventListener("resize",ot,{passive:!0}),Be(),function(){Ze.forEach(function(pt){pt.removeEventListener("scroll",ot),ke.removeEventListener("resize",ot)})}}},[_e,be,ve])}var ze=O(48736),dt=O(16089);function Fe(_e,be,ve,Be,je,Z,se,de){var we=b.useRef(_e),ke=b.useRef(!1);we.current!==_e&&(ke.current=!0,we.current=_e),b.useEffect(function(){var Ze=(0,dt.Z)(function(){ke.current=!1});return function(){dt.Z.cancel(Ze)}},[_e]),b.useEffect(function(){if(be&&Be&&(!je||Z)){var Ze=function(){var Nt=!1,lt=function(gt){var nt=gt.target;Nt=se(nt)},Et=function(gt){var nt=gt.target;!ke.current&&we.current&&!Nt&&!se(nt)&&de(!1)};return[lt,Et]},ot=Ze(),pt=(0,te.Z)(ot,2),st=pt[0],Rt=pt[1],Ut=Ze(),ct=(0,te.Z)(Ut,2),Ct=ct[0],Ot=ct[1],Mt=G(Be);Mt.addEventListener("mousedown",st,!0),Mt.addEventListener("click",Rt,!0),Mt.addEventListener("contextmenu",Rt,!0);var Xe=(0,l.A)(ve);if(Xe&&(Xe.addEventListener("mousedown",Ct,!0),Xe.addEventListener("click",Ot,!0),Xe.addEventListener("contextmenu",Ot,!0)),0)var xi,bt,Le,Ne;return function(){Mt.removeEventListener("mousedown",st,!0),Mt.removeEventListener("click",Rt,!0),Mt.removeEventListener("contextmenu",Rt,!0),Xe&&(Xe.removeEventListener("mousedown",Ct,!0),Xe.removeEventListener("click",Ot,!0),Xe.removeEventListener("contextmenu",Ot,!0))}}},[be,ve,Be,je,Z])}var qe=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function Wt(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:J.Z,be=b.forwardRef(function(ve,Be){var je=ve.prefixCls,Z=je===void 0?"rc-trigger-popup":je,se=ve.children,de=ve.action,we=de===void 0?"hover":de,ke=ve.showAction,Ze=ve.hideAction,ot=ve.popupVisible,pt=ve.defaultPopupVisible,st=ve.onPopupVisibleChange,Rt=ve.afterPopupVisibleChange,Ut=ve.mouseEnterDelay,ct=ve.mouseLeaveDelay,Ct=ct===void 0?.1:ct,Ot=ve.focusDelay,Mt=ve.blurDelay,Xe=ve.mask,xi=ve.maskClosable,bt=xi===void 0?!0:xi,Le=ve.getPopupContainer,Ne=ve.forceRender,Ke=ve.autoDestroy,Nt=ve.destroyPopupOnHide,lt=ve.popup,Et=ve.popupClassName,kt=ve.popupStyle,gt=ve.popupPlacement,nt=ve.builtinPlacements,xt=nt===void 0?{}:nt,at=ve.popupAlign,St=ve.zIndex,ci=ve.stretch,ai=ve.getPopupClassNameFromAlign,Si=ve.fresh,$t=ve.alignPoint,Jt=ve.onPopupClick,Mi=ve.onPopupAlign,Di=ve.arrow,tn=ve.popupMotion,Ci=ve.maskMotion,hi=ve.popupTransitionName,qt=ve.popupAnimation,wi=ve.maskTransitionName,Qi=ve.maskAnimation,Vi=ve.className,fn=ve.getTriggerDOMNode,Ti=(0,ue.Z)(ve,qe),Ji=Ke||Nt||!1,qi=b.useState(!1),Ni=(0,te.Z)(qi,2),nn=Ni[0],Vt=Ni[1];(0,v.Z)(function(){Vt((0,_.Z)())},[]);var sn=b.useRef({}),Oi=b.useContext(ye),on=b.useMemo(function(){return{registerSubPopup:function(It,ki){sn.current[It]=ki,Oi==null||Oi.registerSubPopup(It,ki)}}},[Oi]),yi=(0,x.Z)(),ei=b.useState(null),kn=(0,te.Z)(ei,2),gi=kn[0],Qt=kn[1],ln=(0,W.Z)(function(Qe){(0,H.Sh)(Qe)&&gi!==Qe&&Qt(Qe),Oi==null||Oi.registerSubPopup(yi,Qe)}),ii=b.useState(null),mt=(0,te.Z)(ii,2),pe=mt[0],ne=mt[1],Ae=b.useRef(null),Ce=(0,W.Z)(function(Qe){(0,H.Sh)(Qe)&&pe!==Qe&&(ne(Qe),Ae.current=Qe)}),Te=b.Children.only(se),Ue=(Te==null?void 0:Te.props)||{},Pe={},ut=(0,W.Z)(function(Qe){var It,ki,$i=pe;return($i==null?void 0:$i.contains(Qe))||((It=(0,l.A)($i))===null||It===void 0?void 0:It.host)===Qe||Qe===$i||(gi==null?void 0:gi.contains(Qe))||((ki=(0,l.A)(gi))===null||ki===void 0?void 0:ki.host)===Qe||Qe===gi||Object.values(sn.current).some(function(ui){return(ui==null?void 0:ui.contains(Qe))||Qe===ui})}),Tt=S(Z,tn,qt,hi),re=S(Z,Ci,Qi,wi),At=b.useState(pt||!1),wt=(0,te.Z)(At,2),Gt=wt[0],Ye=wt[1],Je=ot!=null?ot:Gt,ni=(0,W.Z)(function(Qe){ot===void 0&&Ye(Qe)});(0,v.Z)(function(){Ye(ot||!1)},[ot]);var si=b.useRef(Je);si.current=Je;var di=b.useRef([]);di.current=[];var ti=(0,W.Z)(function(Qe){var It;ni(Qe),((It=di.current[di.current.length-1])!==null&&It!==void 0?It:Je)!==Qe&&(di.current.push(Qe),st==null||st(Qe))}),Kt=b.useRef(),Ht=function(){clearTimeout(Kt.current)},Bt=function(It){var ki=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Ht(),ki===0?ti(It):Kt.current=setTimeout(function(){ti(It)},ki*1e3)};b.useEffect(function(){return Ht},[]);var oi=b.useState(!1),Ii=(0,te.Z)(oi,2),li=Ii[0],ri=Ii[1];(0,v.Z)(function(Qe){(!Qe||Je)&&ri(!0)},[Je]);var jt=b.useState(null),Bi=(0,te.Z)(jt,2),mi=Bi[0],Ft=Bi[1],zi=b.useState([0,0]),Gi=(0,te.Z)(zi,2),Hi=Gi[0],_i=Gi[1],Zi=function(It){_i([It.clientX,It.clientY])},dn=We(Je,gi,$t?Hi:pe,gt,xt,at,Mi),vi=(0,te.Z)(dn,11),wn=vi[0],On=vi[1],En=vi[2],gn=vi[3],un=vi[4],Yi=vi[5],rn=vi[6],pn=vi[7],In=vi[8],Ui=vi[9],Ai=vi[10],Wi=Q(nn,we,ke,Ze),en=(0,te.Z)(Wi,2),Rn=en[0],_t=en[1],bn=Rn.has("click"),Ln=_t.has("click")||_t.has("contextMenu"),xn=(0,W.Z)(function(){li||Ai()}),Hn=function(){si.current&&$t&&Ln&&Bt(!1)};ft(Je,pe,gi,xn,Hn),(0,v.Z)(function(){xn()},[Hi,gt]),(0,v.Z)(function(){Je&&!(xt!=null&&xt[gt])&&xn()},[JSON.stringify(at)]);var Wn=b.useMemo(function(){var Qe=L(xt,Z,Ui,$t);return g()(Qe,ai==null?void 0:ai(Ui))},[Ui,ai,xt,Z,$t]);b.useImperativeHandle(Be,function(){return{nativeElement:Ae.current,forceAlign:xn}});var qn=b.useState(0),Mn=(0,te.Z)(qn,2),Zt=Mn[0],as=Mn[1],jn=b.useState(0),Vn=(0,te.Z)(jn,2),es=Vn[0],Nn=Vn[1],Fn=function(){if(ci&&pe){var It=pe.getBoundingClientRect();as(It.width),Nn(It.height)}},mn=function(){Fn(),xn()},ji=function(It){ri(!1),Ai(),Rt==null||Rt(It)},Sn=function(){return new Promise(function(It){Fn(),Ft(function(){return It})})};(0,v.Z)(function(){mi&&(Ai(),mi(),Ft(null))},[mi]);function Pi(Qe,It,ki,$i){Pe[Qe]=function(ui){var Zn;$i==null||$i(ui),Bt(It,ki);for(var Yn=arguments.length,ys=new Array(Yn>1?Yn-1:0),os=1;os<Yn;os++)ys[os-1]=arguments[os];(Zn=Ue[Qe])===null||Zn===void 0||Zn.call.apply(Zn,[Ue,ui].concat(ys))}}(bn||Ln)&&(Pe.onClick=function(Qe){var It;si.current&&Ln?Bt(!1):!si.current&&bn&&(Zi(Qe),Bt(!0));for(var ki=arguments.length,$i=new Array(ki>1?ki-1:0),ui=1;ui<ki;ui++)$i[ui-1]=arguments[ui];(It=Ue.onClick)===null||It===void 0||It.call.apply(It,[Ue,Qe].concat($i))}),Fe(Je,Ln,pe,gi,Xe,bt,ut,Bt);var _n=Rn.has("hover"),vn=_t.has("hover"),an,Ki;_n&&(Pi("onMouseEnter",!0,Ut,function(Qe){Zi(Qe)}),Pi("onPointerEnter",!0,Ut,function(Qe){Zi(Qe)}),an=function(It){(Je||li)&&gi!==null&&gi!==void 0&&gi.contains(It.target)&&Bt(!0,Ut)},$t&&(Pe.onMouseMove=function(Qe){var It;(It=Ue.onMouseMove)===null||It===void 0||It.call(Ue,Qe)})),vn&&(Pi("onMouseLeave",!1,Ct),Pi("onPointerLeave",!1,Ct),Ki=function(){Bt(!1,Ct)}),Rn.has("focus")&&Pi("onFocus",!0,Ot),_t.has("focus")&&Pi("onBlur",!1,Mt),Rn.has("contextMenu")&&(Pe.onContextMenu=function(Qe){var It;si.current&&_t.has("contextMenu")?Bt(!1):(Zi(Qe),Bt(!0)),Qe.preventDefault();for(var ki=arguments.length,$i=new Array(ki>1?ki-1:0),ui=1;ui<ki;ui++)$i[ui-1]=arguments[ui];(It=Ue.onContextMenu)===null||It===void 0||It.call.apply(It,[Ue,Qe].concat($i))}),Vi&&(Pe.className=g()(Ue.className,Vi));var Yt=(0,K.Z)((0,K.Z)({},Ue),Pe),Xi={},zn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];zn.forEach(function(Qe){Ti[Qe]&&(Xi[Qe]=function(){for(var It,ki=arguments.length,$i=new Array(ki),ui=0;ui<ki;ui++)$i[ui]=arguments[ui];(It=Yt[Qe])===null||It===void 0||It.call.apply(It,[Yt].concat($i)),Ti[Qe].apply(Ti,$i)})});var ts=b.cloneElement(Te,(0,K.Z)((0,K.Z)({},Yt),Xi)),is={x:Yi,y:rn},Bn=Di?(0,K.Z)({},Di!==!0?Di:{}):null;return b.createElement(b.Fragment,null,b.createElement(ee.Z,{disabled:!Je,ref:Ce,onResize:mn},b.createElement(Y,{getTriggerDOMNode:fn},ts)),b.createElement(ye.Provider,{value:on},b.createElement($,{portal:_e,ref:ln,prefixCls:Z,popup:lt,className:g()(Et,Wn),style:kt,target:pe,onMouseEnter:an,onMouseLeave:Ki,onPointerEnter:an,zIndex:St,open:Je,keepDom:li,fresh:Si,onClick:Jt,mask:Xe,motion:Tt,maskMotion:re,onVisibleChanged:ji,onPrepare:Sn,forceRender:Ne,autoDestroy:Ji,getPopupContainer:Le,align:Ui,arrow:Bn,arrowPos:is,ready:wn,offsetX:On,offsetY:En,offsetR:gn,offsetB:un,onAlign:xn,stretch:ci,targetWidth:Zt/pn,targetHeight:es/In})))});return be}var it=Wt(J.Z)},86878:function(tt,Ie,O){"use strict";O.r(Ie),O.d(Ie,{default:function(){return bt}});var K=O(955),te=O(6848),ue=O(12563),J=O(93948),D=O(28103),g=O(71418),ee=O(66104),H=O(57809),l=O(79817),W=O(43418),x=O(59301),v=O(89070),_=O(36371),b=O(83312),T=O(86248),B=O(25775),U=Object.defineProperty,F=Object.defineProperties,I=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,$=(Le,Ne,Ke)=>Ne in Le?U(Le,Ne,{enumerable:!0,configurable:!0,writable:!0,value:Ke}):Le[Ne]=Ke,X=(Le,Ne)=>{for(var Ke in Ne||(Ne={}))j.call(Ne,Ke)&&$(Le,Ke,Ne[Ke]);if(M)for(var Ke of M(Ne))C.call(Ne,Ke)&&$(Le,Ke,Ne[Ke]);return Le},Y=(Le,Ne)=>F(Le,I(Ne)),fe=(Le,Ne,Ke)=>new Promise((Nt,lt)=>{var Et=nt=>{try{gt(Ke.next(nt))}catch(xt){lt(xt)}},kt=nt=>{try{gt(Ke.throw(nt))}catch(xt){lt(xt)}},gt=nt=>nt.done?Nt(nt.value):Promise.resolve(nt.value).then(Et,kt);gt((Ke=Ke.apply(Le,Ne)).next())});const ye=[{name:"\u6839\u8282\u70B9",src:"/images/one.svg",color:"#CC7CF5"},{name:"\u8BFE\u7A0B",src:"/images/kc.svg",color:"#3241F7"},{name:"\u7AE0\u8282",src:"/images/zj.svg",color:"#5e54e7"},{name:"\u77E5\u8BC6\u70B9",src:"/images/zsd.svg",color:"#FFDF55"},{name:"\u5B9E\u8BAD",src:"/images/sx.svg",color:"#4E9DFF"},{name:"\u4F5C\u4E1A",src:"/images/zy.svg",color:"#445DF3"},{name:"\u89C6\u9891",src:"/images/sp.svg",color:"#6BC4DE"},{name:"\u8BFE\u4EF6",src:"/images/fj.svg",color:"#6BDE73"},{name:"\u8BD5\u5377",src:"/images/sj.svg",color:"#2D9534"},{name:"\u5176\u4ED6",src:"/images/qt.svg",color:"#2D947C"}],ae=(Le,Ne)=>{const Ke={};let Nt=null;return Le.forEach(lt=>{Ke[lt.properties.uuid]=Y(X({},lt),{id:lt.properties.uuid,children:[]})}),Ne.forEach(lt=>{const Et=Ke[lt.startNodeUuid],kt=Ke[lt.endNodeUuid];Et&&(Et.id=Et.properties.uuid),Et&&kt&&Et.children.push(kt)}),Le.forEach(lt=>{!Ne.some(kt=>kt.endNodeUuid===lt.properties.uuid)&&(Nt=Ke[lt.properties.uuid])}),Nt},Q=(Le,Ne)=>{const Ke=Le.getParentData(Ne.id,"tree");return Ke?Ne.style.x>Ke.style.x?"right":"left":"center"};var A=({loading:Le,nodes:Ne=[],relationships:Ke=[]})=>{const Nt=(0,x.useRef)(null),lt=(0,x.useRef)(),Et=(0,x.useRef)(0);(0,x.useEffect)(()=>{(Ne==null?void 0:Ne.length)>0&&kt()},[]);const kt=()=>fe(void 0,null,function*(){var nt,xt,at;const St=ae(Ne==null?void 0:Ne.map(($t,Jt)=>{var Mi,Di,tn,Ci,hi;return Y(X({},$t),{key:Jt,title:(Mi=$t==null?void 0:$t.properties)==null?void 0:Mi.name,newcolor:parseInt((Di=$t==null?void 0:$t.properties)==null?void 0:Di.color)===1?"#CC7CF5":((tn=ye==null?void 0:ye.find(qt=>{var wi;return(qt==null?void 0:qt.name)===((wi=$t==null?void 0:$t.properties)==null?void 0:wi.nodeType)}))==null?void 0:tn.color)||"#2D947C",colornodeType:parseInt((Ci=$t==null?void 0:$t.properties)==null?void 0:Ci.color)===1?"\u6839\u8282\u70B9":((hi=ye==null?void 0:ye.find(qt=>{var wi;return(qt==null?void 0:qt.name)===((wi=$t==null?void 0:$t.properties)==null?void 0:wi.nodeType)}))==null?void 0:hi.name)||"\u5176\u4ED6"})}),Ke==null?void 0:Ke.filter($t=>$t.type==="\u5305\u542B"));lt!=null&<.current&&((nt=lt==null?void 0:lt.current)==null||nt.destroy());const ci=(0,B.RN)(St),ai=(xt=ci.nodes)==null?void 0:xt.filter(($t,Jt,Mi)=>Jt===Mi.findIndex(Di=>Di.id===$t.id)),Si=(at=ci.edges)==null?void 0:at.filter(($t,Jt,Mi)=>Jt===Mi.findIndex(Di=>Di.source===$t.source&&Di.target===$t.target));gt({nodes:ai,edges:Si})}),gt=nt=>{var xt,at;lt.current=null,lt.current=new B.kJ({container:Nt.current,autoResize:!0,autoFit:{type:((xt=nt==null?void 0:nt.nodes)==null?void 0:xt.length)>20?"view":"center",options:{direction:"both",when:"always"}},animation:!(((at=nt==null?void 0:nt.nodes)==null?void 0:at.length)>300),data:nt,node:{style:{labelText:St=>St.title,labelFill:"#333333",fill:St=>St.newcolor,labelBackground:!1,labelPlacement:function(St){const ci=Q(this,St);return ci==="center"?"right":ci},ports:[{placement:"right"},{placement:"left"}]},animation:{enter:!1}},edge:{type:"cubic-horizontal",animation:{enter:!1}},layout:{type:"mindmap",direction:"H",getHeight:()=>32,getWidth:()=>32,getVGap:()=>4,getHGap:()=>80,getSide:St=>(Et.current++,Et.current%2==0?"left":"right")},behaviors:["zoom-canvas","collapse-expand","drag-canvas"]}),lt.current.render()};return x.createElement("div",{style:{height:"100%"}},x.createElement(g.Z,{spinning:Le,className:"mt60 w100",tip:"\u52A0\u8F7D\u4E2D..."}),x.createElement("div",{style:{height:"100%"},ref:Nt}))},L=O(85057),S=O(99064),G=O(3294),P=O(23210),p={NextAbility:"NextAbility___wLOPq",AnchorDomStyle:"AnchorDomStyle___CG1xj",AnchorDom:"AnchorDom___jjRxi"},d="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA1lJREFUWEfFl09oXFUUxn/nvTEpbXXRos4bgwgGRYtZCIILhQSFtgEjgnShCNJV05pMqQstpV1UjW6seY1pFERB6EYEJVJbRMmALgqCixTFlgoupjOjUhdNo0068z65w0ycmcxMJmbk3e39zne+d/69c40Oz45P1PPnbwxZxEgkHjQjJUg5c4OcRM4zfpLH7LY7mftxjy13Qm1rge6ZVnK5yLEInkfctha+fG9c8+B0T4Ljvx6wQjublgL6T6r3L3EkEoeALR05Xg1a9IwTm403Lo/bUjOOpgLcV98o8hni0f/ouN7MOL8pwTPNorFKQN+kBkrGGYm+rjivkJiR9T2Gs2N2oZa3ToD78qUi33fbedWhE9Gb4JHaSKwIcDm/LjJdC3ur8BnntxqD1ZpYEZAKdTwSR7sZ9lZcnvFaLm3HKi0M5aK7yeUNVPt6dS9uuoV+l4pyBFKhTkVidL0sG8F7xkwubfvNTbiref7oeMhsxGt9+V/bHnC7BVPaqRLnusW7Hh7z2WWpUNOR2N/W0Jj3jBcRd0fi8zqsMW/iKYzDEvs8n6cxslGJjxAD7Xg945QlJzUHDLbuGj72U+zL7rG/g0k9Jvi2FpvwGcqOWSYI9abEqwaP5w/ad6n3tVk3eE/ihTYiMhaEuihx3yqQIYwDhXGbcXfJk3qWiA+BW1ewxheFtI3cO6M7FpfKXeTuFvDYWxi3Tyt2o4jpMlvDMeOSJUMtILY2EfBNIW1PDs4pcfECbyni5QZM0fN5KDdmPwehZlz462rMOHH/AK9khqyYDPU14okmPq63FGDGuXzadt/1rrZHRU4LdtYSVNsomNYDusk8kGgQ8JXn89yVl+xqEOqsxK4mqVhonQIo4jNSGLOzkiwIOWQwIehxYd7SS/8vo/Z7MtQsrggrx2BZxpH8OG+bmZJT2k2J2UaB5SlYTkG7IjRk8M62gMNuw0mGGkacMXg9f9CO9k1psFjCFfG/x2fYiS5vUAUm5PaJJvmvGGRcG645BQ1+8Dz2lowUJb40mJTHBMLltr7VfIY9UVDEB4KH12zD2AdR7KPYhaiTNKxnxHaCXfkZOXDsv+NKFOJbSJyA2FeyaipiW0qrhRPrWl4VEevDpCoi1qdZbR/H9jhtHCb/1/P8H/hZr0qiHgOCAAAAAElFTkSuQmCC",N="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA/1JREFUWEe1l19oW2UYxp/nNMmWdO1cZmcSW3TYKWwKoh3MmdBVUOmEDSeINvNGGEwRLwRR0Y12FHF44c2qTvEuCaNCRS+KiJiQP512eOFFB3XzX7FNXVnLlrRL8+e8ck6XmS45OUc9O5fnfO/7/L7n/b7vvB9h8dk1OuVaLF3po1QOqMBOEgGBBLRwgnMimFOA88KWr7zOzfGpZ3cVraSm2aC7Ryd9xVLxuCoSBqTdbPzad14lJeba6DnxxzM92WYxhgDd4xc2rCxl31YFrwFotSZcN2qZ5AetW3zDF/fvWG2UoyGANutCcfULQPb8R+GbwvjDBrf76UZu1AF0RiYeqKA8LkCnPeLXiwLOKg48Nftc6KfavOsAtJmvFgvn7BavChKcdbndu2uduAGg1Ty/OJ+wz3YD/4jJjYGu3t/7thfWdtD1JxBNnlAFx+y03SgXyeFsOKRr6QBri65w0Wi1EyiAvGaUUASbAVGswhNccbnd3VopdIBANP2hKupLBtuk0N6mbJs+GMwZCfijqXEAPSLS8S8gTmcPh45SO+EuFxcXjA4ZkkvZcMjbLLE/kvrY4VBOlSvqd9YhmNvq8t5Of3TiSZHy103qZQ4QTUYgzAO4SyiPQ9BixQkq7GcgkhpRIS//H4DaWF8kqR29PisACpWP6Iuk4oDsu0UAywQ+BRkUkZ56DSboj6amReReKwAyiV4Qz9eNJcbYg2+09zccIPIk+7MDoXTgzNmH1HLpx5vjSP5MXzSZg2CTFQArtuoAxKaquA4VTb0HkTcagOe1ElwFpM0OgEER5XQ0dQkKD2cHQvrC9kfSbwnUdxvnZ862Egw9LN9+EsucEshZCPo7OtqPLCzkXjUW1xuZaVsWoTZzXZwS02reOTrRXSlVPheRB5uWjYzbsg190fSxFiA9Gw7GzW2vQSJHbDmIfJHUZ0fDwSODpNq85uv9UBTlCVuOYl8sdZICHwTXBHgREKfpjiGu3Hmfp8P8Z0SsOkH/TDi0ZJRUWwOJBJRf59JtJcGfAvGYA3BkPhx6xdLvGESZgrJZUiEcEDjMxoHIu+nq/m1gz1//NCSR9JAK9bhpsB0DyMH5cGhIS7W+JVvKxiF4xA6NJgdbxuv0Pla9uKxrSrfHvr+jIMVzIui6FRAEZzweZfcvhx69VM1f15Z3ncncX65Uxu2G0MSdCvfPDASnaifX8GKiO6EWxwTYa4cTJDMet3KoduaGDlQ/6K1a+fKbELze7G/ZHJA5kO9vdW45aXRZNb2c3jOW2ba8Iu8Q6gsC3GbFEa2PFGGk1cPhRrM2LUEjkX1xcVyYT/WqKg8A2CmAn4B+PRdgjoDWip1XqHy5w783meij6bmhxf4NftTdgSGLQUwAAAAASUVORK5CYII=",V="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAsVJREFUWEfFl0tIVGEUx39nZsxoKpGISlqmC42gxwxCEApBUhC0iR7bMLRyhrZRC6Ntecc0CtoVRRshkbKN0iJ0RmtRBj0WLUKLoEAz0po5cWe4zdWZO/czJuauzz3n9/3P6/sE02/qwSp+fm5FM4dRbUSlDqEu+7syjeg0Iq+RwENWbxqh6eiiiWvxNZrq28z870vASdD1vvZZA5kF7hIOddN05lOpf7wB3iWq+aYXED2PEjYLvMxKmEflKrVyhfquhWI+igPkTj0A2vxPgQt+kjHCoSPF1CgEmOzZQVqGQLeWJ7jjRT4SCBxkz7mXbr9LAXInT5U/uAsiHIq4lcgD5HI+Wj7ZvfSTMWqlxamJPEDS6ga9WF7ZPSEuE43ZnUUOwJb+x6/3ntUujBOqPsbOjg+egBNWK6qDRh1jd8eaqm12KnIASasftMPTuXCKSPy2rzrPr+8jnR5Cda2vLXKDaKxTsCfc/MyXkkNGAieIdN3zdwqkevei6UfAutL2Mkt4y0ZhsvcA6fTjksYrAbAdTSaaSeuw7+QMBtuECauPjHaWFcB2lkrE0cy1kn4D0i+kekZQWsoOMJHoIJPpL+2XUSFpvQFtMAZIWneA7Xl7HSQaL2xfEwDkrZCy5nyr1l0DKasdJT+mg7xgd2yg4AAmACLfVw4wcbMGqCqqWM3CIvVd9ioGEwCYM0yBHCcSu591nLLGUY16pGyYaLzNHCCbApMidAMkdqIUv5gE5OvfbWeigNhFaNSGSwD2o7KhqAIhmWHX2afGCmTb0GgQuQCSPc+ASFEAkSdEYoeMAbKDyGgUuwCM5rFJETqj2GgZyWkisVumsXPF6jcJnWVkG/uuY3lFMNhOpsp7HbvpMgsNoPaGbSyequXrOKdCBS8kNkDFr2ROKip2KXWSVdFruQNR0YeJA1HRp5m7dyr2OF3ewP/pef4HW7pxo3nDj9QAAAAASUVORK5CYII=",oe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA75JREFUWEe1l19sU2UYxn9v2dwGzmSoEZJtRhY1StAQtN2YkEUiYOL/C6LhQtPWLQwXwXAlRKsXcjMUJQzFrUaCesGFjptBREJ0iXQmXOGCIQKJZDH4Z2Jm6UZ7HnNqCx30z2ktJ2lz8p3ned7ne8/7ft/5DI9Xb5dunonzJLDSgWVAi0GTjGlgIvM76RPDzXP5NnLMkl6krRSoe7naUileF7yAaCiFd5+bMYn4pL6Rd3Z/Y38U4xQ0EInId/4QbzhiG2KOl8DXYgwu4mP7mhb61x2wVD6NvAb6Vuj2+AyfSTxWSeDrOMaRulrW7Rm1yTwmZw+FOrQUh4MSzVUJnhUxTtfVsnbPqJ3J1Z2Vge4u3ZaMc8ItsKoGv2riVE0j7XuP2MWrQ5k7953/MsKIxOobEjwjanBozZ08ka2JKxkItyviOLx5I4NntX3GK4Mx253uGPfPbbVkip8qrfayTRsX6htoGzhmU2kDoYCGJIJehAx+NzgsuF+w1AunACYSHbO3zF3hEpe44GWRMWPKxAODY3Y2bdyvZ4B+QVu5Rsw4OxSzRRYK6HmJLzwKHI6O2dpcbN/jqotPsgmxVaLRo04a5jMedA18KNHjkfhldMyey4ft7dKC6Utsl3gxW1ulNH0+tlnQrzHg4VLgzPOCBrL8YKce4jLvA8tLaZqx383ArxJ3lAJ7NXDFSLtew2FHUV3jqIX8Sgjqqm0g013jEvcV1DZOWTCguJcOKDcDLj7o18/AokIGDH50MzAhWFjNDLid8c+f7EBsLKZrxtduDYxKdFbLwMsdejaVor/YzLOxDD61sF8fOND3fw10d2hJ0mEn4lGPWu46sMXCAT3tiK88kYyj0ZitysVuXKVbE1O8Legpdy+pNe6xzPtyl+JbSpowEjVG597jdiLSpZrzCXolIhJNJbnXAozxaMwWpzejYEDvITZ5EjESBj9I3A0s8MTJA/IZmwdjtvO/7XiFFiZnOIOor1SwLJ5xrrWVeyMHbCb3g2SD4zBQllCFYJvD+qHv7XOXPuubMOzXfgfWV6jrjWbsi8bM3bDS1ywDW1Zr3uRfxASLvamVhzLj+Nz5dO0aMfc0db0BdyTs112OMYxYUp58cXQ6+E08tes7+y0XmfdgsrlDDX87DEi8VBUTxr558+nOnXnBDOQGDPsVcox3Pa0R+Zwa58zH1mzB5YeUmOKGR9R0OcmrEiHPpyVj3AcfN7cy4LZasRAlT8dZsiTraaczKVaasUyixYwmxDTGBGIC42QNDH8Us9NeX92/T9xk1NzUiXsAAAAASUVORK5CYII=",xe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAYCAYAAADpnJ2CAAAAAXNSR0IArs4c6QAAAu5JREFUSEvlll1IU2EYx//PcW6JSuRFBRVB1I2Qtk3dh1JSXiVRF1bQXaFUBJ5tFFGCLLywTbTtUAwREoIKvIgI+iAqL3Jf0jYUpKsIiogkAsv8aOs8dWyT09zcZnrVe/m+/+f/4/2/7/ucQyhg1I+4ymeLdK0AtQHYQkT3E0LCPVbnmMjXhvIR1o72bvuZ0LSDuA2g9Wk1TIwHMsuuWL09mMtvWeAev6dWEMgBoAWAJpcZGC8Bdkct4kMQcSb9UiA7BUOo4gjAdgANOSEZBMQ0IUN2C9qSu5Ga03G1ZBFYNdZTWjSjPUUMGwg7VgJaWkPvwehLlM4PjFdf+K6sU+OwU/NVV2EH8SUAG1YHtMTlM5jcpNV5yBjwnmDC7TUCpds6qXL4RlmJLjHItHAx1nDw47m54mOLZ2gMS80sczeA3atIjYPxFIRmInRGzGLX37eUmYxBbwsTdQCo/gfwPAM3hQRflYuFMmKeyAxUEWpC3oMyQ7lIhTyNWQYPyCy7x6yOD4qdPiRV5gVMsfcEvFaBcB7AYQBCll3PMMinJbknbLZ9UmvyBur917fHrOfepTqGIdC3E6QRAT4JoDRpOkuALy5rXeP1ZyfBTPqwdJyYy6MW24CiMYQkM5iDOSM1Br0+APuZIJUk5m75Gy5+UwwahwfXTWmn6gTCJi3k50Gr48tCdEGpiQAXwAYmdMfM4uUqv2+jRvgxAmAXAW/lOJmy9lIFyMCZ5E6mwbhDJPdHLPaoOjJj8JqBIbgANKXmU0BjyNPATC8AFP9ulVMyUW2+QDXjNUAjAE8riQHYl36uKaAybwx6WxnoFwiHXpnFRysB5nwtauAfqMcUsdjCC700W3VapDkhakE6UL32PwMDUicTXykoy6SYQGLE0i5lqs0a6dGhoaI3Wz/2giAWAGUm7oqZRGf+vxhp7vqA9wAJ6ARj73JgBkYB6ohZ2p8tp8vrr00xSPZU5ZtpAmMzEbQMmgQQAfO9qFV8kk8SvwBkMTigdig/4QAAAABJRU5ErkJggg==",Oe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAABBRJREFUSEu1ln1MVXUYx7/fc87FQbRaL7PwZZZRDQTOhRxj1mLZqFz9Q8tVWyb34tVirbmsVpvOWfOPXNqGJl7kMvSfbNnLHyWbWfSuw+s95zIYTd0QFGvZ1gvG4J7ze+pc4h0uBLff38/z/Tx7fs8bMctnbuzI1RJOuRCLoSQHhAOyi1Rd4vraYo35HWOlSkLnr3PdvvUUVAJSBGAQwheZilcS6s1S7pUXIGqdCPJS2RJoJbV6QcanwOAmgWyGSPZYH4I90wLNoP0sRXaKIGeWSZjKrEWjvp8Gom7CPQfy50nAkpD4XCe+DyIb5gECyFO3XpN1/7Ha3IHiQNtaJe4RAC3jgB5MOfHPROTBecH+dSb4xS3ZWWsuX716AoJV0FgzDmgGrAMQhNIBG9EgvkvCyD8zaSwbAfqD1jOicCitsDFipPZGLFK4LQks29yT2f/br2cBLPp/gBTd51sUDeddTgKLA/bLSuStNMMugTQgsjCpq3G91VDUlAT6q+y4QArSBSTh6DTKHbhlULLL0yV4MtZYVMaVgfjtCVHn0wVLihNbYhHz7ZJQ+1I3kbgwrG2Qd9MftAKi0JA2IPGRFTErt28X7eNu+xgEFcPaGvVK+gPWVhHsSAuQ/FE3skuj4eW/+6vsnQJ5bdxoI16iP2DvF5FN8waSF3XDWBUN53cXV1uVysXRiZoE9tIMWHshqJkPkMQVzdDui4YLO0tCdrHroAUi104CknU0g/aW4UqaE5Tsg64/YNWvaL0nYN/lQr4Rwc1TaZHY5qX0cRH5YK4wQ9MeO32woMWrSJVwvhXIkum0qCFILypHpPO/Ar00AvojsUjB6dLqtoUDSn0NkTtT6fioLU82vhmwT0KkdLZQb5FqPlYM/Vn7Utdxjs8EI9gWaywqHAIG7WooqZ8NkGCnkalVtL5b0JP8M8HxVGkc7UG+ciZStCsJLK22Fw+40jMTkOCHGdlZVadqc//wqlE50jxdgUzQupR5/Y25P+xZ0j80SwPxHSJq67Sf7R1MwKuxiLnbs0n2mWLTxJslRbGsizWYh5NjryzYfkO/OF1e35A8ISKrJ0YHQ19r1Rd8742rTy7E35w4QVJmhghbEXPjsI3Xh89DyT6SX93xcOHqc83xwyLy1IgB8QuA3QsyFrw3MDBYJ5CHZkr9qC8/14zCNdEwE6PAKuvLf46bck3Hk2cOmkeeeF/0s81xb1LcO1vhKe3Iet0orBkLS6bUDNg/eUuS8OWTaoUS9zkvgLnCSPQK+bq3bKecNv4qu3tSWZN9BPcAGXWUwUcFEhJISaogSHSA2iFNv6k2Gs75a9oCMoPxpynqHQAZAG0Ijmq+7CZvxYx1WrmhPd91Vb5QboPIMggMaOyl4KLyGS3WgTzvJprx/Q3wmMIl7X6GaAAAAABJRU5ErkJggg==",Me="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAstJREFUSEu9lk1oE1EQx2de06xNxaNSxS+wYltMNi0iBXsSBE/tQawnIZugXtpKUS9VCGgvFgKxF9EkRfHQFA/tSRC9qKAFm2SDKdoKSgVrPUqamK8deSFbt+km2bTb7imZN/v/vbdvvhA0j9MlTzKGk3NB+7TWrv3dfe3Lgb/Z9EsiIMRd56KhEz8r+erZUTU63fJZUugVIH5raba1vRhvzei9IEqxMBBc5GsIGI5OOC7VDSzBAgBwpCiE+JxZGgfnHrUva8U6PXKPUqA3WlsDQs9cSHxnFIr8MxJQ/4YXEJOMkScSEMN8zeslNr0U/whETq0vAkZ6D9tPeb2oGIFilzveVyDyAdHRMqEZQbBe//Cw7Tu3i27ZAwo91r0XRE805AgaAnKn8wOLwq/V1DMiusD/M2zoj4ROTqkCpwcW92SSqUUA2qsrirgiNNuOz463/qkFXQuarivzLYV8bgEJXkcnHH3r7s4ljylAN6qKIY7FQo5bhoHcsdMT67dahFn1MxZt7sQxRcknAMhaXQyzjFk6IsGOr9X81k6o58RhRPmnRNRda+el6H6PaLlcDaoLLN7Zauo2EAzVPln5VjALCH6h2XZP707XAXnozyzFXQQwCkT7jJyqog/iCgKM9B6yT2hT5n/QSLEzCqGfgDq3BCp7mecpQxpSiwM6pc/7gTI+3eQ3kczLIKAwjKIr9gkAOkzUriaVQKcUSxBB+44BebtJZ9M+tQNsGxhhqsnaNLwWNMVOoIC/vDhveQOIUcZgKBJwvC3mqlaw2BF+xCVQYLRi3TS8A/wNDEb6DtpDummh1eGJn0um7igAg5tJfAbwoHG37W7NxC/fvHh1vhVzuSfbXtrWdYqdLN4qWJTk+0B00/T2VEmwVMwXKtbXzTTgWsHnlGQ3EfFBa8OD9Y4YtWB83bQhyghM9TFlTKwHyH1NGYTrgW511P8HVz1GsEaaZFwAAAAASUVORK5CYII=",We="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAYAAAB2+A+pAAAAAXNSR0IArs4c6QAAB/FJREFUSEuVV1uInVcV/vblv51z5nIyk2ScZJI0GfCCYttJAjYv+iS+2BfxoVoFNUwKxQsK5tLWiTH44A2hD+1QUExRtNUmTdpYseiLIqKGChVJ0lwmaZO5ZObMnPv5915L1v7PxKTSgjMc/nP+/e/17bXWt9a3fnWcT21+P0+8ulNtfJ9iNg4ERvGn+lcNBVLwS9xYvsQLs4+Yjz0mS9/hV7fsckPPblcjeytIMmJSJAvBQLHbQCOCRoPz9mu9+eP7B6aOh9Vf0l/PbUH13lW00EIPPXgQh+23wQ0MYlhkiFFCjPM0/7t52z5wnxs/V0Iy1OYcHXbImUBc4CqWj4aFRqIiVFSCTEXuT7ww+Y3s/qvqZXqtt4RGtMB1rKGNDnL42z4X57ZskCJGmRNUkKKMBG24xZjsxhb30OQcbXLoEYW9AigmFBtEMCghQlWVMGYGMOfWDj86vPu76mf0Z3+ZF/WbWMEKt9AOwHd4zECECAnFKAs4MpQ4hmELSUuLcjQpR4c8euTBrMIHpKHFYzYY1ClGVRkTZggO/OxXqnseVt+nV/ILfMPO8QqWVRMdlmAzlEIwoEnBcoSYIyQcoYQECUXQbOCZ0SVC2zv0mOAZIJKNKoAq0ojYoqJSjOkKtpsqMp385ODI3i+ob9HJ7nm+GV/lW1hBC12Vg9fJQWLAQJEKHlqyIdeWIhjWIFZwxAHQExeesgb7IszCSIsoRGqTqmCnrWJYp888sWnffnWQn2+d9zeza2oFdW4HcgmL108sIRMPJG9Mushf/0CFZwIg94vwyvr6M7IOMsgQYVSXsd0MY9SUZo9u3jetvkm/alykxfIN1NBUnR96Vv+ySJQmUsJmeNlrOc+ZmfiDuaevCnPFMy2hRPS6UfGPYxI4IZNV8BrkNXvy8lyUIP76ECe7tkVDqOps9tjYvml1kJ5fu8yLA4uoo63zzwPmnEWqbK5V3C8px5ZzeO7m/sNdl58Q9or3FhYpR3+MsvhrpV7Jyx4LHQrYwbJjYupQFCv9ZEWlH9liKhg0SQF8mH5du0bLQ5JfyW2GBBVOEbOFYRPy1mMfmLtGXaxRD02fh/xKiVU4QRUlDKg01HkEG8Iuue+SR8t75MSBG5t1BWUdzR4bf2BaPUYvLL/Fy9U17krPejJC/I+EYhPDak1KkdbscuYuO9fk3t6mcwfkAEwqsHxIZRcqSL+X6ZgyJLJHGzLwmqjjmbqOIsX6SMxm64jJUDbJ7MzY3gC8dJNqI03kqJnO5Fn15Tdut623ffnk6onJju9cqFMeWCylNaDSX5ze+NmH3mmP3H947rcnU9gHN+gUqY5nj44LsH9hYYHqG5vckzCtZpwuDnJqSipRmpUigjCdVn3Pr1J3dMm1hiXcEkrpYFVd5hGULw+rjCs6MoFc0tiJucnkGy7XXe/vEYZXdSZtc3Zm655p9bg/eWOR6mMNzhGTxSBKGJbuhCTkWBgsfbhGXSz5JhZ8G2uuG2o34xgjqozNegAjOsOAFm6YUH45Mxo+x5qTzialIcCFxzNbp6bVE+7Um/NUH69TFw54yiI+N4DUxlBakZFezz1P1IF3Te93N113/+pt4ATDunRxQCU/kIOWlTWGrAa0dDXqefIt8gakDlk2W4pQJ7MzE/dNq8fdi3MLvj4h4aup3uTZdPodc/yJ2k93+R4uiieOpAIiDKjSz8+Mf/oz75bjz136/cmY7YOjNkOq7ezMRPD49JUFV9++Sl0YmJUE8UJFJTqhSIuySC57RNTyOa1yb9OK61TrXsilAvCQLvEGnV0c4oRTFekYUVHHDO56oqZ3uut5lyGtRmyKzMR9j3un31jwjZ0r1IFmMZYE0qQsFWkDe4s6dlhxHaz4bqhNuZ8gwrDKsEGXMKRSlJTUsQl1LLXb8YSGE7kErNIYtQlKJio8PtJ98cK8b0wuUTN4J1tTTpBIA4GBsDoXBRJwIYvPgyJ5AiKyoXEM6v5hgyQIsA7r3T54OKQxGIukju3s0Yk90+pI5/S/3/Rr7533jSDmskmkTP5FgaQ1ivxJm+x6jzYRemKVjTwRIiMdK4VIpxy1EA3pgjkhOKOVEuJhPC5jKEpmj4rHhztnXp9ztQ+85dYgjcERIZgMclgokbRNKavch9yBPIcDBVGQKYPF02KPCIcoW7En1HPwdtjE2BqXscGmT89smzqgDrbP/POaq33oqqthlXrBM/YqnFzaohgXfRUgqc9g0Mt9EXoD0z/AumavS6LoMXHhbaq0AGJbUsFIlD39bQE+1Hrp3Jyr3XvVrWLZt9Hujy/ibWGkr7HB+7vv/VeXi2lDfhd6LE1Ehi7Ra6BsIoxECXbEAlwqgI80z/5tztWmrrgabvWBRWtFU4MRAYP8FqPFVHHbuIw5d4l/EWYZEZllfJJngYoA2wT3pINyferott2PqEP1l59bpNanJNS3XAdt7wOTJdgSvnUgIVOYevuHCTnuR0SukpLg9fp4K0NbmKuBsrYYjTLsSCoo22T62MTUrHq0eWqcHE4u+Ob9t/K2kWnRSy4F/A7DMsRJzkOO7xjohExCxkAqqOBlmOn7HhuoEOpRm3aqUfybH+14IHS59ZcFfJT/YAfQCEPH0vX2+svE/3TCUq52K9InQHq7hv6LUupLa2nnUvHgVgDX+1f5fR2jZmfAmHrPVGdGFS8adwG/W699+9pDV175YsLmmYb3u5+b/Pjf/5+968/+B+0PhllE845BAAAAAElFTkSuQmCC",rt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAcCAYAAAAAwr0iAAAAAXNSR0IArs4c6QAABflJREFUSEu1V2tsFUUUPmdmdu+j997SQp9AEULCDxNDCCAEQoqC0R/8IRSIVqIYH7GAT2JMNKlEo4bSFowEEyXBBJUS/5AYRB4lijxU4iMSE5CWh214lL7uo3t356Ezu/e2hVsSkrrJ7s7snJ35zjnfOXMG4bbr8rkvdsVLZ9UzKxZVSiKABFA5IQS8/YcRfX8skFBBCxEQiRJuOj108/zOitlr3hg5xaj5Lvz6SV35lEX7vGwSBXdASQ6g/NVHLp1vB8CGJxkhZf7TfQQkDKgVBmpH5eClU/OrFzx7dlilEXAu/b5nbzgx+XHu9Iv0rb+35lcHAAL0TuWV/k7MDP4TjMGI7iilpG6bQbsmWjr9CRYuhmxf53uV8556qyCAjt8+PcCs+AqeHfBmzHnOvou172mo83BjbShxXzsLJ0AMDXxcteDpDQUBXDy782tCQiuFl/Zmzt80fgAONtbaicp2YheBctPbqxe98HJBABfObN9PWHiVEp43c/6GcQNw6dt3llqximOEhUC5mZbqJQ2vjgGgtY3SSB0CeNPnPj9uAC4feX+ZFS07jEhAeemW6iUbxwBwurWNWbE6goRPm7PeuidH30W463jTchop+05HlHQGm6trN71WmAOnW9uoFa8j1OI1s9eNG4Duo82P0Hj5IZAChJNqqa4dwwUXtQXsRB0hNp86u35cAbB4xSElBSgn2VI5FoCO0zvaqB373wCAlNoFdwFwckcbDWkOMD51zvi6gMXKD4GSIJzB5qraDYU50Hlq+z7CoqsRCa+Z+8y4uaDryIfLraJKQ0LlZporal8sDKDjZGsbEluHoUJkV6xwMbVCMYYsTAgyk4oRUYHSLy1lvvg7glJKCyiQgDoNC66Ul+XCSXGZHaRKyhpEBsCdbRVLG14vnIpPNO8DIKulyAKlIWChBLBQHCiLACHM31yQmFsp4QB3U3oiyiLFCtHSPjZaamSCg/SGQA4lQThJAOEBsghQ4E1lSzduHgPAtq+U4Gu4M2g2VSQhoFYEKLUBkQaLUwPGS/VsDcPQriFFQ4zFtrDwhFVm99QgDBAJimdBuo5ZXINnkWJtr6aK5S8VBtD5Y/OX0nXXeplekJ6TX5Bq7ZEC0SCIBmADYXbeKkpwUNwzC2kQqLdiA0SA4twoQ6wwsKJJQAlrKnu4YQwLtH9Qz73MYukMZBV3OAihzN4qEAljABKRUIqUWoQQi4CiqLdbCUKhEFIKLlFyBUIpCQAMpDEKYRQpK2IYTYSRhA9UPfrKNwVdMF6p917mGVVkXDzeNM9C9iZ3Bz3luVwKVxFjT2IKDZ/72gUEASlhWn9lAsA8wdc+iAi/REEFSJmNYEUYsaMWKviobFlD+x0WUOca7evigauKO+U80wfCy/h+1TGncqVWEAWgI8Fvm8ovYD9qw8vRJRzqmoky0LUAjZZoLvQk7MxkvH+1awDmkHT/vOdzFpnwpJu6ATzTD0qHkPD8ksqPd3MHevm1XmABnQm0EXwJkxN8Sf0OiEvtKNBIMbB4ua6K9pYsXFufB/DPiZ0LQqXTfnCT15mbvA5iqB+ENwQohFncLy19ILkElP+mx3IVcCBr/si3dTjrojQCNJIAligHK17BMXltYdHidb+Yea/9sf+C8tyZTv9V4MmbILJJP361BkYbP+vlQRj9RpbfowHm5InJjbpIpYA05AOITQKrZLIGdD42d8Us7P7psy0sMvFtp+8KuANdwFO9INy0yWSGfwGAPAvMpMMaBr1cQvbfhraBQ3TbALCAWlGgsVKwJlQBK50CMtO3BXv+Oph2kzeiTm/Hn7L32mbwklnPlQqopvPoSydjHd25y7T4WDJ6YISsoAjERitcRDFR9i4rn/Egi08cxK4zu4+C4A95g90pN9XzPXpZT0rpaxCQL8fU3BkAdUgGLvDjIEfNHGFzFgik8ucDCykNUVpUspiVVBcjYcf+s3IjuXo0slspuVJm0yEwxFM65SHRjFN625OIavhgYowb+HcUP3InqBEENGcUqYFoPmlCMH1C6iOUHUg8dmv9v8OxoyB3PgAEAAAAAElFTkSuQmCC",ft="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAHCFJREFUeF7tnQuUXVV5x//fvnfiK6wiUFnSaoNgYiHknjuDCgUUQXloaAUMVnyAAl1VYQGhEsOcmY5zz81LeSnEqsEHal0SAV0EQQooBQVfzLkYYjNCibLEUhFTSX3M3Hv+7bm5CZkwk9nnfe65+6zFmknyfd/e33/vH+e1z7cF5khEgSU3sPToZsz30FoAkfkA9gXUXMLbSyBzAexFYO7237kXgPbfdTrzDIBtgDxDcJu0f0fnd/UM4Pl//g3IcYXS5oMWYHz9GdJKJJEeDyo9nn/k9Bc6fFmfYD48zKf/E1wA+D9xUOTgwQI8CmAckM1CjENhfJIY32jL48HCGOtdFTCABJwP1RU8xPO845SoN5A8DsDeAUOkbb5VRO726H1bKXX32GWyKe0OdHN7BpBZRq9/JQ/2PBwLzzsGIscAOLCbBxzAYyDvhVL3KoXvPLhcHunyfBLtvgFkGnkrNZ4g4p0MqKMBHp7oCGQeXH4EePeR6rbGkNyReXdy1gEDSGdArNHJo6jUYoEsBrAwZ+OUVnc2EtwgnrfBHe77blqN5rmdngakOsoKS1gsxGKCR+R5oNLum0AeoGCDtLBhbFgaabefl/Z6DpDqah7AJpaQPEWA4/MyEHnuB4G7ROQWKWP92DJ5Is99jbtvPQOItZLz0PTOhci5APaPW8geifckyHUoq3XuctnSCzkXHpDKCs6XVhuMcwDs0wuDmkKOT4O8jiW1rnGZjKfQXmZNFBaQRXUuVN5OMPy31OaIX4FtPiieUuseGpSN8YfPPmLhAFlUZ78izgHoX0rNyV7inujBBCDrPMF1Dw3Kg0XKuDCAHDrCfeb04VKSy4o0QN2Wi4isnpjEmodH5Olu6/t0/S0EIJbDsyC4FOQhRRiUrs9BZBOINa4tX+j2XLoaEGslX80WlwlwercPRBH7T+BGKclqd7n8sFvz60pADhnh3Oc9ezll7jPyPfsm/MuuP01izaYR8Zfpd9XRdYBUHb6jfZ8hqHSV0r3eWaLhgzJmy1e6SYquAWTeCJ+/d9m7HJAPdJPApq+7K8C1W5vqki0j8sdu0KYrAOkfnRjwpHw5BK/vBlFNH2dRgLhHsXnJg8Nzfpx3rXIPSLXefA+pLgewX97FNP0LpMBTIt4lY4Pl6wN5pWyca0Asp7UakEtT1sQ0l6oCXOPapdy+u8olIO31Ux6vAPCWVMfKNJaVArdSydI8ruvKHSAVh6cK2nDMy2q0TLuZKLCFkKUNW27OpPUZGs0VIFadZ4P8XJ4EMn1JWQGR97qD8vmUW52xudwAUnF4voCfyIswph/ZKUDIBQ1brsmuB8+2nAtAqg4/THBlHgQxfciHAgJZPmbLqqx7kzkgVq11BUQuzloI034OFSCvdIdKS7PsWaaAWA5vAehXETGHUWCm2+QNri2nZCVPZoBYjre5U6Izq9xNu92jwLhrK7+ka+pHJoBYjsfUMzUNdr0Crq1Sn6+pN2g5fALgS7t+tEwCGSggv3JtOSDNhlMFxHI8/3vlapoJmrYKp8CYa6v+tLJKDRDL4a0A35xWYqadIisg33RtSWUZUiqAVJzWdQJ5X5GHzOSWrgIEP9uwS36ts0SPxAGxanQgHEw0CxO8NxWg1N0hsZNMPlFAKk7rfIGY5SNJjmCPxyZ4QcMuJbYsJTFAOqtyb+rx8TPpp6AAIacltQo4EUA633N8yyxZT2F2mCZ8BbZQyYlJfE+SCCCW420wHzuZmZuyAre6top92VLsgJjPZFOeFqa5XRSI//PdWAHpFFjo+nKTZs51rwIi3llxFoKIDZB2aR5Vvt1UH+neyVWQnj+lvOZJcZUUigWQdlG3Em83dasKMsW6PQ3inq0tOSmO4nSxAGI5rWtNxcNun1VF6z/Xunbpg1GzigxIu1Yu+K9RO2L8jQJxKyCQM6PWAo4EiF9lfU6J95lC0nEPrYkXiwJEY6IlR0epKh8JkGqdoySHYknGBDEKJKCAiNTGBmU4bOjQgPib16DF+8w+gGGlN34pKTCBkhwddhOf0IBUHO9rZmenlIbYNBNJAX+nq4at3hYmSChA2nsCgrmpfhcmcePTawrI2WH2TAwMiL+bbF8f7jUbZvbaBOvyfEU2TU7imKC77wYGpFrnKrPVcpdPlh7tfnsLuEH5cJD0AwGyqM5+ReZ+V6AgAhjb3lLAExl4aFD84iFaRyBALIfXAkx3j0DyI1qZZGBEYIGI+AXN/P9emEEXgjb5CICfkXxEgKeDOmvZK0V43rPzyv+zf/h/t+PfdrXZ/e9E/G32jtVqK5SRrHVt0X7Drg3IojoXds4eqW67nEWxsKC6V1c88+de64WnichpAE4I6p+oPTEGJTcqDzc9OCQ/TbStGIJbjvftZAHBROcsslGnu9qAWLXWVRC5UCdonDbdAMiu+bbfD3m4DORb49QhRCwX9D7iDpW/HsI3M5cUAAHIq92h0kU6SWoB0vmE1r/3mKsTNE6bbgNkR+6W07oIkH8GsHeceujFkqvQxEfcEdmqZ58fq1QAAbZRyYDOJ7pagFi11hqIfCgLGbsVEF8rq04LxJcAHpqednKGa8v69NqLt6WUAPHPIh91h0qzbhA7KyDWSs5Dq/3kap94pdCL1s2A+Bm+ZgX3nfBwTxqQUMkpjcvErwfQtUdqgPgPKUoy4C6XLXsSa3ZAai0HIpkVfut2QHZectW870FwZFIztyRywI8H5VdJxU8rboqA+GeRujtU2mPhuT0CUl3NAzhJ/5nx/mkJtHs7RQGkfcmV1BOaF8mL3Yu7735jujmVmEbTT+AnpU/6x5bJEzPN7z0CYtV5IcirsoLDb7dIgBw7wvLWMv8tzseYLEl/Y7mMZTlGcbadMiCAyEXuoFwdCpCK490pwPFxChA0VpEAaZ9FanwlpA3JXwXVYnd7Kjm9cZkUqnpl2oAQuKthqzcGBqQ6ygoV3aiDGNW/aIB0IDkPwk9H0ybYG+FobaXnnTYgfmbiiTU2LI3pspzxEsuqcxCkk54007dUREDakNS5HmSobxQAPCp98ro9XTtnPW5h288CEIjY7qDUAwFSdXg/wSPCJhqXX1EBqTo8nOAPw+gk4PvH7NK/hPHNu08WgAjkgTFbpn3COO0ZxBqdPAqq5H9Om/lRVEA6Z5EvgzwzoMjjL3ihWPcvlT8E9OsK8ywAaQvjtY52h/u+u7tI0wJScVorBcHWzSelfpEBqdR5opB+NUr9Q2i7g6VpLwf0g+TXMitACK5q2KXlWoBYjvcTAAvzIGORAfH1rTjeLwR4ma7W9KS/MVycx7q7550VIAA2urY6bFZAKjWeIEJ/b49cHEUHxHJ4B8A3aYr9e9dWL9K07UqzDAEBKSc2huSOXYV7ziWWVWtdAZGL86Ju0QGp1PkxIS/R0ZuCHzcG1eE6tt1qkyUgIK90h0pLZwHEewCC1+ZF4KIDUnU4TGh/Nfkd11ZvyMvYJNGPbAHB990hNeXJ7ZQziDXCeSjzsSQSDxuz8IDUOURyVFMfA4imUKHNmnKgO/LsCt+pgIw2z4RSXw4dPAHHogNScVq2QGqa0hlANIUKbeZ573SHyzuLsU8FpM5rQGp/0B66EwEciw6I5fAygLqPbQ0gAeZOKFORa91BOX+H71RAHG8zgPmhAifkVHhAaq3lEFmhKZ8BRFOoCGbjrq38KjXtYycglRHOlzJ9QHJ1FB2QSp3LhFylKboBRFOoKGZsyoLGiIxPAcSq81yQn4kSOAnfogNiOa1LAVmtqZ0BRFOoSGYi57mDsm4qILXWVyFyRqTACTgXHxD+E8CPakpnANEUKpIZeYM7VHr7VEAcz6+09+JIgRNwLjog1TovIfkxTekMIJpCRTT7rWurdpGS9j3IQocvK4O/iBg0EfeiA1JxWksFcrmmeAYQTaGimjUhL99oy+NtQKp1Hk/yzqhBk/AvOiCWw4sAXqmpnQFEU6ioZiLyxrFBuWs7IDW+n8K1UYMm4V94QGqtCyGiWxjDAJLEJJsmplA+MDYkn2wDYjn+/8H8/5Pl7yg6INU6LyD5cU3lDSCaQkU3k6tcWy7uAOJ9E8DJ0YPGH6HogFSc1vkC+YSmcgYQTaFiMLvNtdWbdwDi7xtxUAxBYw9RdEAsx99vxd93ReswgGjJFIvRo66tDpYlN7D0s3E2YwmZQJCiAxLw/s8AksAcmynkK+dLWfpr/GtPuCnFdgM1VXRAKk7rHwXySU1RDCCaQsVhpiiHiFVrvhWibo4jYBIxCg9Inf8g5Kc0tTOAaAoVixm9UyXgWqBY2g0SpOiAWLXmeRClW2XRABJk8kS25TIfkNWAzLqRSOS2QgYoOiDVGs+hsL0wTuMwgGiIFJ8J10gmO9cGyKDogFTqzfcJ1XWakhhANIWKx0zWSsVpXS+Qd8cTMP4oRQfEqvNskJ/TVO7brq2O07TtSrNMizbsphjBL4rleH75/FPzqmbhAXF4FsDP6+kvd7q26NbQ0guZM6s8AfL/df1u9gHx96qYcX+ErPUrOiBVh+8meL2OzgL51pgtJ+nYdqtNzgC5UyqOd78AmVdxn2lAiw5Ipc53CflFzQndXv6gaduVZnkChMAD/k36TwDmog7vdCNadEAsp/lOQH1JazYTG9whdYqWbZca5QkQQDb6l1j+NriRtwNLajyKDkjV4TsI7qzDNIuO33Bt9daktM5D3HwBgp/7gDwFYN88iNOLZ5DqaPPvqdRXdPQX4qaxIXW6jm232uQMkN/4gPwJwJy8Clr0M0ilzjOE/Kqm/utdW+WusIZm37XMcgbIhAFEa9iSM7IcLgF4g2YLBhBNoWIyawNiLrFiUjNMmKrD0wl+TdPXAKIpVExm7Ussc5Mek5phwlRqPE2EN2r6GkA0hYrJzL9JN495YxIzVJiK0zxVoPzVDDqHAURHpdhsZKN5URibmOECWQ7/DuDXNb0NIJpCxWHWeVFolprEIWbYGNVa828p6hua/gYQTaFiMrvTLFaMScmwYSo1LhbhLZr+BhBNoWIyu9ksd49JybBhrDrfAnKDpr8BRFOoOMw6y939kjN+6Zl8HkV/UVit82SSfl0yncMAoqNSbDay1nxyG5uY4QL113iSJ7xN09sAoilUPGbtT24DbeAST7sBohT9DFKpT54oLN2uKYkBRFOoeMz8og2m7E88WoaMYtX5JpB3aLobQDSFisXML/tjCsfFImXoINXa5BspJf+rTp3DAKKjUkw27cJxpvRoTGqGDLOoxuOU8C5NdwOIplBxmLVLj/qBLMczxavjUDREjEqdbxDybk1XA4imUDGYbS9e3QHEbH8Qg6JhQlRX8PX0+B1NXwOIplAxmO26/YHZQCcGQUOFqDp8HcF7NJ0NIJpCRTfbZQOdgCX4o7cdIELRH/MuGp08RqnSv2tKYgDRFCqq2ZQt2MwmnlHlDO9vreBR8HifZgQDiKZQUc2mbOJptoGOKmd4f8uZ/Bug9F3NCAYQTaGimk3ZBrpzo/40gBdHDRy3f9EvsfodHuGB92vqZgDRFCqi2W9dW+3jx2g/xWoDUmt9FSK5q5hRdEAWjfK1SvEBzQE1gGgKFcmMvMEdKr19KiB1ngvyM5ECJ+BcdECslXw1WvyBpnQGEE2hIpmJnOcOSnvPlp1nkMoI50uZmyMFTsC56IBUHR5O8Iea0hlANIWKYsamLGiMyPgUQDr3IT4g86MEj9u36ID0j04MeKr8I03dDCCaQkUwG3dttWCH/84zSBuQOq8B+cEIwWN3LToglVFWRfFBTeEMIJpChTYTudYdlPOnB2S0eSaU+nLo4Ak4Fh0Qqz5hgeUxTekMIJpChTbzvHe6w+WdxcSnnkFGOA9lPhY6eAKORQekv85FHtnQlM4AoilUaLOmHOiOiF9MsX1MAaR9mVXzHoDgtaEbiNmx6IAcNsrDSooPacpmANEUKpQZ8X13SE3ZTGoaQFpXQOTiUA0k4FR0QCqjPFQUN2pKZwDRFCqUGXmlO1RauqvvcwCp1HiCCL8VqoEEnIoOSHUFD6HHhzWlM4BoChXGjJQTG0My5fPn5wDSvsxyvJ8AyMW2bEUHZGAFX9Xy+FPNATWAaAoVwmyja6vDdvebFpCK01opkA+HaCR2l6IDsqjGBUr4H5rCGUA0hQpqRnBVwy4t1wLEGp08CqqkuwQ7aF8C2RcdkMrIH+dLeY7uCgYDSKDZE8DYax3tDvc9Z1X1tGcQP2zV4f0EM98euuiA9K/kwV6LP9McSgOIplBBzATywJgtR07nMyMgVp2DIJ0gDSVhW3RABmo8qCX0i2boHAYQHZWC2ojY7qDUAwFSHWWFim7QtuK2Lzogi2o8UAn/U1M3A4imUEHMxBNrbFimfVk74xnEb6DieHcKcHyQxuK2LTog1krOQ0t79YIBJOYJRuCuhq3eOFPYPQJi1XkhyKti7lOgcEUHZGAVX95q8ueaohhANIXSNhO5yB2Uq0MBUl3NAzjZXmm6v3aDMRsWHZCA9QAMIPHOryelT/rHlskToQDxnaxay4HIYLz90o9WdEAWjfz+L1X5+Y9rKmIA0RRKy4ysu0Mle0+2e7zEagOy/Rr5xwDaH7GnfRQdkM5Z+peauhpANIXSMHsaJRlwlz+7cnc6n1kB6ZxF1kDkQxqNxm5SdEAG6nxpi5zxFL+boAaQuGYY+VF3qHTpbOG0AKms4Hzx2meRubMFjPvfiw7Iwjr3L5P/pambAURTqFnMtlHJQOOy7d+dR7rE2uFs1VpXQeTC2QLG/e9FB2TRCF+iynxSUzcDiKZQezQjr3aHShfphNI6g/iBFtW5ULF9FpmjEzgum6IDMvAx7tf6I3+tqZcBRFOoPZhNeCIDDw2K1jc42oC070Wc9HfELTogr1nBfSc8PqU57gYQTaFmNpO1ri3ahUkCAbKozv7OWSRyN3UDFB2QQ0f+Z5++8l6/0dTDAKIp1ExmnbOHbhWZ536TPlv71TpXkVw2m11s/05+JLZYcQQSbAW5Baq0BZPY4o7I1ihhrRHujTJ/qxkjMiBLlrD0aD8O9DwcSM97hQAv1Ww7HTOR1wM4NonGRGT12GCw75wCnUH8Th86wn36+nAvyEOSSKILY/qAbAH4sIj6fqs1+YOHhud8XzePgVX8s1aTupAFAsR/+qg8DHiCASEHQLwCgpfr9q1QdiKbJidxzMMj4hdp1z4CA9K5FzkL4Oe1W+k5Q/E/gLpFgFvGbNnj5jgLVnOvF0zyd5oSzQpIe+kKcRoEpwF8nWbcHjCTs11bvhA00VCA+I1UHO9rApwetMEetP8BRK52B2VnMbJdNThkhHPnlPmMpi4zAuIXf/A87wKBvCuL91Wa/c/EjMCNDVu9LUzjoQHpVCX3P8tN9bFvmCTz4CPETZTW5a7d971d+zMwwhe2yvxfzT4+B5CKw78AcL6AfrnM1F/kavY7S7MJlORod7noFgif0tfQgPhRqnWOkhzKMvtua5v03tcYKn9uR7+PvIIv+MPv+XvNPKYAUl3BI0F8luSrNP17zkxEamODMhw28UiAtC8PSrwPgkrYDvSi364VNA7+OJ8393f8o6YOOwHpX8HTPI83avr1phnRmGjJ0ZtGZFtYASIB0j6LOHwHwWmvr8N2qkf8bnVttXjgU+xr/ZoTmjm3AbFqzfMg6tOaPj1rJpAzx2z5ShQBIgPiN245rWsB+UCUjvSkr8hIaT+sCAKIeFKnol+e5kU9qZl20lzr2iXtN+YzhY0FkHkjfP7eJd4Ogf+SxxwBFNi7KX1by5zUdFkP8JeAaC2004xZPDPinq0tOWnLiOheus6oQSyA+NE7OyXdDmC/4imeXEZuU0pWmS3NFtaDOBiCqqZ9L5o9pbzmSQ8Oz/EX1kY+YgOkfT9Sb76HVIFfxkTOoosD+GvNLMejZgrrASzRtO1JMxHvrLHB8vVxJR8rIJ37kdWAzPqlVlwJ9FgcA8geB5xrXLsU6zrB2AHZDom3AcBbemzyppGuAWRmldtPBeMehEQA6Xyi6+8xMi/uDvd0POK/IXhJT2swffJbqOREnU9og2qXCCB+JyoOTxXwpqAdMvZGgaAKEHJaw5abg/rp2CcGyHZIWucL5BM6HTE2RoEwChC8oGGXrgnjq+OTKCDt+5EaHQgzKzynI4Kx6VIFKHV3SPZY+C1qZokD0jmTXCeQ90XtrPE3CuxQgOBnG3bpnKQVSQWQ9pnE4a0A35x0QiZ+Lygg33RtSeUpaWqAbIfE8z+WN2+Be2EOJ5fjmGur/uTCT42cKiCdM8kTAPNVKCAttU07ERWQX7m2HBAxSCD31AHpnEl0l1YESsYYF1uBLEpAZQJIBxK/sMH8Yg+pyS4mBcZdWy2IKVagMJkB0rncugVg7MsDAilgjHOugGxwbTklq05mCkgbklrrCohcnJUApt0cK0Be6Q6VlmbZw8wB8ZOvOvwwwZVZCmHazpcCAlk+ZsuqrHuVC0B8ESoO/dI1ZllK1jMiB+0TckHDlsSWjwRJMTeAtC+36jwb5M6SOEESMbYFUUDkve6g5KZqZ64A6ZxJ/FXAV5il8gWZ8PppbCFkaVKrcvW7MdUyd4C0Idm+5ZsPSSrLCcKKZ/xiU+BWKlmaxPccUXuYS0B2JGU5LfP5btQRzr1//J/JxplyrgFpP+HaXgjiclMtJc5hz0Wsp0S8S+IssJBEVrkHxE+6XVJIypebultJTIEMYhL3KDYvias0T5IZdAUgvgDt4nRl73JTwTHJ6ZBGbK7d2lSXxFHULY3edg0gO8Ro1wL2t4AzBbPTmB/xtUE02lugRayVG1+H9CJ1HSB+Wn5V+ef14dLOXolmfxK9sc7KasIH40+TWBOlynpWne9KQHY+5VrJV7PFZWanq6ymz57b9Xd2kpKsDrt5TR6y6mpAnn0czLMguNRsLJqHKQVAZBOINWH2BMxJBju7UQhA/Gz83XfnPHvZlTede6Y//uXUxCTWBN1NNq8CFQaQHQIvqrNfEecAPNfsn5jatJsAZJ0nuO6hQfHrDhTmKBwgu4CyUHneuRDxS8OYzS2TmbLbQF7nKbXuoUHZmEwT2UYtLCA7ZG2v62rtBGWfbOUuTOtP+2CwpNblcf1UnCoXHpBdnnjNQ7MNin/ptX+cIvZQrCdBrkNZrXOXy5ZeyLtnANkxmNXVPIBNLCF5igDH98IgR82RwF0icouUsX5smTwRNV43+fccILsOTnWUFZawWIjFBI/opoFLuq8CeYCCDdLChrFhaSTdXl7j9zQguw6KNTp5FJVaLBC/ysrCvA5Ywv3aSHCDeN4Gd7jP30m35w8DyDRToFLjCSLeyYA6GuDhxZ4l8iPAu49UtzWG5I5i5xo8OwPILJr1r+TBnodj4XnHQOQYAAcGlzlXHo+BvBdK3asUvvPgcnkkV73LWWcMIAEHpLqCh3ied5wS9QaSxwHYO2CItM23isjdHr1vK6XuHrtMNqXdgW5uzwAScfQWOnxZn2A+PMyn/xP0S2T6JVUPihg6qPujAMYB2SzEOBTGJ4nxjbY8HjSQsX9WAQNIQrNhyQ0sPboZ8z20FkDEB2ZfQM0lvL0E4r/Z34vA3O2/c6/O237/p388A2AbIM8Q3Cbt39H5XT0DeP6ffwNyXKG0+aAFGF9/hrQSSqWnw/4f5GnaW9nfPLQAAAAASUVORK5CYII=",ze=Object.defineProperty,dt=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,qe=Object.getOwnPropertySymbols,Wt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,_e=(Le,Ne,Ke)=>Ne in Le?ze(Le,Ne,{enumerable:!0,configurable:!0,writable:!0,value:Ke}):Le[Ne]=Ke,be=(Le,Ne)=>{for(var Ke in Ne||(Ne={}))Wt.call(Ne,Ke)&&_e(Le,Ke,Ne[Ke]);if(qe)for(var Ke of qe(Ne))it.call(Ne,Ke)&&_e(Le,Ke,Ne[Ke]);return Le},ve=(Le,Ne)=>dt(Le,Fe(Ne));const Be={\u5B9E\u8BAD:d,\u8BD5\u5377:N,\u8BFE\u4EF6:V,\u89C6\u9891:oe,\u4E3B\u80FD\u529B:Oe,\u5B50\u80FD\u529B:Me,\u77E5\u8BC6\u70B9:We,\u8D44\u6E90:rt,\u603B\u6570:xe,\u6559\u6750:ft};var Z=({type:Le,ImgProps:Ne})=>x.createElement("img",ve(be({src:(Be==null?void 0:Be[Le])||(Be==null?void 0:Be.\u8BFE\u4EF6)},Ne),{width:"16rem",style:be({width:"16rem"},(Ne==null?void 0:Ne.style)||{})})),se=O(89076),de=O(71839),we=O(94941),ke=Object.defineProperty,Ze=Object.defineProperties,ot=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,Ut=(Le,Ne,Ke)=>Ne in Le?ke(Le,Ne,{enumerable:!0,configurable:!0,writable:!0,value:Ke}):Le[Ne]=Ke,ct=(Le,Ne)=>{for(var Ke in Ne||(Ne={}))st.call(Ne,Ke)&&Ut(Le,Ke,Ne[Ke]);if(pt)for(var Ke of pt(Ne))Rt.call(Ne,Ke)&&Ut(Le,Ke,Ne[Ke]);return Le},Ct=(Le,Ne)=>Ze(Le,ot(Ne)),Ot=(Le,Ne,Ke)=>new Promise((Nt,lt)=>{var Et=nt=>{try{gt(Ke.next(nt))}catch(xt){lt(xt)}},kt=nt=>{try{gt(Ke.throw(nt))}catch(xt){lt(xt)}},gt=nt=>nt.done?Nt(nt.value):Promise.resolve(nt.value).then(Et,kt);gt((Ke=Ke.apply(Le,Ne)).next())});const Mt=({children:Le,cout:Ne=1})=>{const Ke=(0,x.useRef)(null),[Nt,lt]=(0,x.useState)(0),[Et,kt]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{Ke.current&&setTimeout(()=>{const gt=(0,K.ZR)(Ke.current,"rem",1);lt(gt)},500)},[Ke.current]),x.createElement("div",{className:"relative flex item-end "},x.createElement("div",{style:{height:Et?"auto":`${Ne*23.25}rem`,overflow:"hidden"}},x.createElement("div",{ref:Ke,style:{fontSize:"14rem"}},Le)),Nt>=Ne*23.25&&x.createElement("div",{className:"current c-blue",style:{whiteSpace:"nowrap"},onClick:()=>{kt(!Et)}},Et?"\u6536\u8D77":"\u5C55\u793A"))},Xe=({DataProps:Le,pathsDetail:Ne,getUrl:Ke})=>{var Nt,lt,Et,kt;const{detail:gt}=Ne,[nt,xt]=(0,x.useState)(!1);return x.createElement("div",{id:`${Le==null?void 0:Le.id}`,className:"bg-white",style:{borderRadius:"4rem",padding:"15rem 30rem 30rem"}},x.createElement("div",{style:{color:"#3061D0"}},x.createElement(Z,{type:"\u5B50\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u5B50\u80FD\u529B"),x.createElement("div",{className:"c-grey-333 flex item-center",style:{fontSize:"14rem",margin:"20rem 0 10rem 0",gap:"10rem"}},x.createElement(te.Z,{title:Le==null?void 0:Le.name},x.createElement("div",{className:"multi_ellipsis1 minW-0"},Le==null?void 0:Le.name)),x.createElement("div",{className:"flex item-center",style:{gap:"5rem"}},(Nt=Le==null?void 0:Le.ability_tags)==null?void 0:Nt.map(at=>x.createElement(ue.default,{color:"orange",style:{fontSize:"12rem"}},at)))),(Le==null?void 0:Le.description)&&x.createElement("div",{style:{padding:"12rem",background:"#F6F7F9"}},x.createElement(Mt,null,Le==null?void 0:Le.description)),x.createElement("div",{className:"flex item-center justify-center w-full",style:{margin:"20rem 0",padding:"12rem",background:"linear-gradient( 180deg, #ECF3FF 0%, rgba(255,255,255,0) 100%)"}},"\u8986\u76D6 ",x.createElement(Z,{type:"\u77E5\u8BC6\u70B9",ImgProps:{style:{margin:"0 5rem"}}})," ",Le==null?void 0:Le.knowledge_count,"\u4E2A\u77E5\u8BC6\u70B9",x.createElement("span",{style:{marginLeft:"40rem"}},x.createElement(Z,{type:"\u8D44\u6E90",ImgProps:{style:{marginRight:"5rem"}}}),Le==null?void 0:Le.resource_count,"\u4E2A\u8D44\u6E90\u6570")),x.createElement("div",{style:{marginBottom:"10rem"}},x.createElement(Z,{type:"\u77E5\u8BC6\u70B9",ImgProps:{style:{marginRight:"5rem"}}}),"\u8986\u76D6\u77E5\u8BC6\u70B9",Le==null?void 0:Le.knowledge_count,"\u4E2A"),x.createElement("div",{style:{height:"320rem",background:"#F6F7F9"}},x.createElement(A,{loading:!1,nodes:Le==null?void 0:Le.nodes,relationships:Le==null?void 0:Le.relationships})),x.createElement("div",{style:{margin:"30rem 0 10rem"}},x.createElement(Z,{type:"\u8D44\u6E90",ImgProps:{style:{marginRight:"5rem"}}}),"\u8986\u76D6\u8D44\u6E90\u6570",Le==null?void 0:Le.resource_count,"\u4E2A"),x.createElement("div",{className:"flex-wrap",style:{gap:"10rem",display:"grid",gridTemplateColumns:"1fr 1fr"}},(kt=((lt=Le==null?void 0:Le.resource_knowledge_graphs)==null?void 0:lt.length)>4&&!nt?(Et=Le==null?void 0:Le.resource_knowledge_graphs)==null?void 0:Et.slice(0,4):Le==null?void 0:Le.resource_knowledge_graphs)==null?void 0:kt.map(at=>x.createElement("div",{key:at==null?void 0:at.id,className:"flex relative current",style:{gap:"10rem",padding:"25rem",background:"#f6f6f6",borderRadius:"10rem"},onClick:()=>Ot(void 0,null,function*(){yield Ke==null?void 0:Ke(at)})},!(gt!=null&>.can_managed)&&x.createElement("div",{className:"absolute c-white",style:{top:0,right:0,padding:"2rem 10rem",borderRadius:"0 10rem 0 10rem",color:(at==null?void 0:at.complete_rate)!=100&&"#7C3100",background:(at==null?void 0:at.complete_rate)!=100?"#FFC86B":"#37AD83"}},(at==null?void 0:at.complete_rate)==100?"\u5DF2\u5B8C\u6210":"\u672A\u5B8C\u6210"),x.createElement(J.Z,{type:"circle",percent:at==null?void 0:at.complete_rate,size:60,status:"success",format:St=>`${St}%`,strokeWidth:10}),x.createElement(Z,{type:at==null?void 0:at.node_type,ImgProps:{style:{width:"16rem",height:"16rem",marginTop:"3rem"}}}),x.createElement("div",{className:"flex-1 minW-0"},x.createElement(te.Z,{title:at==null?void 0:at.name,placement:"topLeft"},x.createElement("div",{className:"multi_ellipsis1 c-grey-333 blod",style:{fontSize:"16rem"}},at==null?void 0:at.name)),x.createElement("div",{className:"c-grey-333",style:{marginTop:"10rem",fontSize:"14rem"}},"\u77E5\u8BC6\u70B9\uFF1A",(at==null?void 0:at.knowledge_text)||"--"),(gt==null?void 0:gt.can_managed)&&x.createElement("div",{className:"flex flex-wrap item-center v-grey-666",style:{marginTop:"20rem",fontSize:"12rem",gap:"10rem"}},x.createElement("div",null,"\u5B66\u4E60\u4EBA\u6570\uFF1A",at==null?void 0:at.study_count,"\u4EBA"),x.createElement("div",null,"\u638C\u63E1\u4EBA\u6570\uFF1A",at==null?void 0:at.complete_count,"\u4EBA"),x.createElement("div",null,"\u638C\u63E1\u7387\uFF1A",at==null?void 0:at.complete_rate,"%")))))),(Le==null?void 0:Le.resource_knowledge_graphs.length)>4&&x.createElement("div",{className:"flex item-center justify-center",style:{padding:"0 220rem"},onClick:()=>{xt(!nt)}},x.createElement(D.Z,{style:{borderColor:"#3061D0",marginBottom:"0rem",cursor:"pointer"},dashed:!0},x.createElement("span",{style:{color:"#3061D0"}},nt?"\u70B9\u51FB\u6536\u8D77":"\u70B9\u51FB\u5C55\u5F00\u66F4\u591A"))))},xi=({pathsDetail:Le,dispatch:Ne,user:Ke})=>{var Nt,lt,Et,kt,gt,nt,xt,at,St,ci,ai,Si,$t,Jt,Mi,Di,tn,Ci,hi,qt,wi,Qi,Vi,fn,Ti,Ji,qi,Ni,nn,Vt,sn,Oi,on;const{detail:yi}=Le,ei=(0,v.useParams)(),[kn]=(0,v.useSearchParams)(),[gi,Qt]=(0,x.useState)({}),[ln,ii]=(0,x.useState)({id:null,open:!1,resourceUrl:""}),[,mt,pe,ne]=(0,b.U)(T.Ju,{subject_id:ei.pathId,id:ei==null?void 0:ei.abilityId}),[Ae,Ce]=(0,x.useState)([{name:"\u638C\u63E1\u738759%\u4EE5\u4E0B",value:0,itemStyle:{color:"rgb(6,110,247)"}},{name:"\u638C\u63E1\u738760%\uFF5E79%",value:0,itemStyle:{color:"rgb(6,234,230)"}},{name:"\u638C\u63E1\u738780%\uFF5E100%",value:0,itemStyle:{color:"rgb(223,209,38)"}}]),Te=new URLSearchParams(window.location.search),Ue=()=>Ot(void 0,null,function*(){const re=yield pe({subject_id:ei==null?void 0:ei.pathId,id:ei==null?void 0:ei.abilityId})}),Pe=re=>Ne({type:"userDetail/logWatchHistory",payload:ct({},re)});function ut(re){return Ot(this,null,function*(){var At,wt,Gt;let Ye=yield(0,S.ZP)("/api/knowledge/v2/get_container_type.json",{method:"get",params:{url:re==null?void 0:re.resourceUrl}});if(localStorage.setItem("container_type_tupu",Ye==null?void 0:Ye.container_type),(Ye==null?void 0:Ye.status)===0){if((re==null?void 0:re.node_type)=="\u8BD5\u5377"){const Je=yield(0,we.Mb)({categoryId:Ye==null?void 0:Ye.examination_bank_id});Je!=null&&Je.exercise_id&&(0,K.xg)(`/classrooms/coursesId/exercise/${Je.exercise_id}/${(At=Ke.userInfo)==null?void 0:At.login}/initate_answer`);return}(Ye==null?void 0:Ye.container_type)==="video"?ii({id:Ye==null?void 0:Ye.id,open:!0,resourceUrl:re==null?void 0:re.resourceUrl}):(Ye==null?void 0:Ye.container_type)==="att"?Qt({url:G.Z.API_SERVER+((wt=Ye==null?void 0:Ye.attachment)==null?void 0:wt.url),file_type:(Gt=Ye==null?void 0:Ye.attachment)==null?void 0:Gt.file_type}):window.open(re==null?void 0:re.resourceUrl)}})}const Tt=re=>Ot(void 0,null,function*(){(re==null?void 0:re.resourceOrigin)===3?(0,K.xg)(re==null?void 0:re.resourceUrl):ut(re),!(yi!=null&&yi.can_managed)&&(yield(0,S.ZP)("/api/subject_knowledge/create_study.json",{method:"post",body:{subject_id:ei==null?void 0:ei.pathId,uuid:(re==null?void 0:re.last_knowledge_uuid)||(re==null?void 0:re.knowledge_uuid)}}))});return(0,x.useEffect)(()=>{var re,At;if((ne==null?void 0:ne.status)==0&&(yi!=null&&yi.can_managed)){const wt=(At=Object==null?void 0:Object.entries(((re=ne==null?void 0:ne.data)==null?void 0:re.study_grasp_hash)||{}))==null?void 0:At.map(([Gt,Ye],Je)=>({name:Gt,value:Ye,itemStyle:Ae[Je].itemStyle}));Ce(wt)}},[yi==null?void 0:yi.can_managed,ne]),(0,x.useEffect)(()=>{Ue()},[ei==null?void 0:ei.abilityId]),(0,x.useEffect)(()=>{Ne({type:"pathsDetail/getKnowledgeGraphs",payload:{graphable_type:kn.get("type")=="classrooms"?"course":"subject",graphable_id:ei==null?void 0:ei.pathId}}),Te.set("tabs","5")},[]),(0,x.useEffect)(()=>(Ne({type:"globalSetting/footerToggle",payload:!1}),()=>{Ne({type:"globalSetting/footerToggle",payload:!0})}),[]),x.createElement(g.Z,{spinning:mt},x.createElement("div",{className:"ml-auto mr-auto",style:{width:"1200rem",paddingTop:"15rem"}},x.createElement(ee.Z,{style:{fontSize:"14rem",marginBottom:"20rem"},items:[{title:x.createElement("a",{className:"flex item-center",style:{fontSize:"14rem"},onClick:()=>{v.history.push(`/knowledgegraph/${ei.pathId}?${Te}`)}},x.createElement(te.Z,{title:"\u8FD4\u56DE"},x.createElement("i",{className:"iconfont icon-fanhui1",style:{fontSize:"14rem",marginRight:"20rem"}})),"\u80FD\u529B\u56FE\u8C31")},{title:"\u80FD\u529B\u8BE6\u60C5"}]}),x.createElement("div",{className:"w-full flex"},x.createElement("div",{className:"sticky flex flex-col",style:{width:"240rem",borderRadius:"4rem 0 0 4rem",maxHeight:"100vh",overflowY:"auto",overflowX:"hidden",top:0,background:"#F6F7F9"}},x.createElement("div",{style:{padding:"20rem"}},x.createElement("div",{className:"c-grey-333",style:{fontSize:"16rem"}},"\u80FD\u529B\u76EE\u6807\u56FE\u8C31"),x.createElement("div",{className:"w-full",style:{height:"200rem",marginTop:"20rem"}},x.createElement(se.Z,{isShow:!0,className:"c-grey-333",DataProps:((Nt=ne==null?void 0:ne.data)==null?void 0:Nt.ability_goals)||[],baifenbi:1/2,style:{backgroundSize:"auto 100%",height:"100%",width:"100%"}}))),x.createElement("div",{style:{padding:"10rem 20rem 20rem"}},x.createElement("div",{className:"c-grey-333",style:{fontSize:"16rem"}},"\u76EE\u5F55\u5BFC\u822A"),x.createElement(H.default,{className:"w-full",value:Number(ei==null?void 0:ei.abilityId),style:{marginTop:"10rem"},onChange:re=>{v.history.push(`/knowledgegraph/${ei.pathId}/abilityMap/detail/${re}?${Te}`)},options:((Et=(lt=ne==null?void 0:ne.data)==null?void 0:lt.ability_goals)==null?void 0:Et.map(re=>({label:re==null?void 0:re.name,value:re==null?void 0:re.id})))||[],size:"large"})),x.createElement(l.default,{className:p.AnchorDomStyle,items:(gt=(kt=ne==null?void 0:ne.data)==null?void 0:kt.children_ability_goals)==null?void 0:gt.map(re=>{var At;return{key:re==null?void 0:re.id,href:`#${re==null?void 0:re.id}`,title:x.createElement("div",{className:`current relative ${p.AnchorDom}`},x.createElement("div",{className:"flex item-center",style:{gap:"10rem"}},x.createElement("div",{className:"flex-1 minW-0 multi_ellipsis1 c-grey-333",style:{fontSize:"14rem"}},re==null?void 0:re.name),x.createElement("span",{style:{color:"#464F66",fontSize:"12rem"}},yi!=null&&yi.can_managed?x.createElement(x.Fragment,null,x.createElement("span",{className:"iconfont icon-a-60-kejian",style:{marginRight:"5rem",fontSize:"12rem"}}),re==null?void 0:re.knowledge_count):x.createElement("span",{style:{color:"#00C088"}},x.createElement("span",{className:"iconfont icon-xuesheng2",style:{marginRight:"5rem",fontSize:"12rem"}}),(re==null?void 0:re.grasp_rate)||0,"%"))),x.createElement("div",{className:"flex flex-wrap",style:{gap:"5rem",marginTop:"10rem"}},(At=re==null?void 0:re.ability_tags)==null?void 0:At.map(wt=>x.createElement(ue.default,{color:"orange",style:{fontSize:"12rem"},key:wt},wt))),x.createElement("div",{className:"multi_ellipsis2",style:{marginTop:"20rem",color:"#464F66",fontSize:"12rem"}},re==null?void 0:re.description))}})})),x.createElement("div",{className:"flex-1 minW-0 flex flex-col",style:{gap:"20rem"}},x.createElement("div",{className:"bg-white relative",style:{borderRadius:"4rem",padding:"15rem 30rem 30rem"}},((xt=(nt=ne==null?void 0:ne.data)==null?void 0:nt.next_ability_goal)==null?void 0:xt.id)&&x.createElement("div",{className:"absolute current",style:{right:0,top:0},onClick:()=>{var re,At;v.history.push(`/knowledgegraph/${ei.pathId}/abilityMap/detail/${(At=(re=ne==null?void 0:ne.data)==null?void 0:re.next_ability_goal)==null?void 0:At.id}?${Te}`)}},x.createElement("div",{className:p.NextAbility},x.createElement("div",{className:"multi_ellipsis1"},(St=(at=ne==null?void 0:ne.data)==null?void 0:at.next_ability_goal)==null?void 0:St.name),x.createElement("div",null,x.createElement("span",{className:"iconfont icon-you2",style:{fontSize:"14rem"}})))),x.createElement("div",{style:{color:"#3061D0"}},x.createElement(Z,{type:"\u4E3B\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u4E3B\u80FD\u529B"),x.createElement("div",{className:"c-grey-333 blod",style:{fontSize:"14rem",margin:"20rem 0 10rem 0"}},(ci=ne==null?void 0:ne.data)==null?void 0:ci.name),((ai=ne==null?void 0:ne.data)==null?void 0:ai.description)&&x.createElement("div",{style:{padding:"12rem",background:"#F6F7F9"}},x.createElement(Mt,null,(Si=ne==null?void 0:ne.data)==null?void 0:Si.description)),(yi==null?void 0:yi.can_managed)&&x.createElement(x.Fragment,null,x.createElement("div",{className:"flex",style:{marginTop:"20rem",gap:"20rem"}},[{title:"\u5E73\u5747\u4E3B\u80FD\u529B\u638C\u63E1\u7387",value:($t=ne==null?void 0:ne.data)==null?void 0:$t.children_ability_goal_grasp_rate,unit:"%",img:O(46016),bg:"#E3F1FF"},{title:"\u8986\u76D6\u77E5\u8BC6\u70B9",value:(Jt=ne==null?void 0:ne.data)==null?void 0:Jt.total_knowledge_count,unit:"\u4E2A",img:O(99755),bg:"#F1FDEF",ProgressTitle:"\u5360\u603B\u77E5\u8BC6\u70B9",percent:(Mi=ne==null?void 0:ne.data)==null?void 0:Mi.knowledge_rate,trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u8986\u76D6\u8D44\u6E90\u6570",value:(Di=ne==null?void 0:ne.data)==null?void 0:Di.total_resource_count,unit:"\u4E2A",img:O(92691),bg:"#FFF9F4",ProgressTitle:"\u5360\u603B\u8D44\u6E90\u6570",percent:(tn=ne==null?void 0:ne.data)==null?void 0:tn.resource_rate,trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((re,At)=>x.createElement("div",{key:At,className:"flex-1 minW-0 relative",style:{borderRadius:"6rem",background:re==null?void 0:re.bg,padding:"20rem 30rem"}},x.createElement("img",{src:re==null?void 0:re.img,width:"43rem",height:"43rem",className:"absolute",style:{right:"30rem",top:"20rem"}}),x.createElement("div",{className:"c-grey-666",style:{fontSize:"14rem"}},re==null?void 0:re.title),x.createElement("div",{className:"c-grey-333 blod",style:{marginTop:"10rem",fontSize:"26rem",lineHeight:"26rem"}},re==null?void 0:re.value,x.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),(re==null?void 0:re.ProgressTitle)&&x.createElement("div",{className:"c-grey-666",style:{fontSize:"12rem",marginTop:"20rem"}},x.createElement("div",null,re==null?void 0:re.ProgressTitle,re==null?void 0:re.percent,"%"),x.createElement(J.Z,{percent:re==null?void 0:re.percent,showInfo:!1,trailColor:re==null?void 0:re.trailColor,strokeColor:re==null?void 0:re.strokeColor,style:{marginBottom:"0",marginLeft:"0"}}))))),x.createElement("div",{className:"c-grey-333",style:{margin:"40rem 0 30rem 0",fontSize:"14rem"}},"\u5B66\u4E60\u7EDF\u8BA1"),x.createElement("div",{className:"flex"},x.createElement("div",{className:"minW-0 flex flex-col",style:{gap:"13rem",width:"200rem"}},[{title:"\u5B66\u4E60\u4EBA\u6570",value:(Ci=ne==null?void 0:ne.data)==null?void 0:Ci.study_count,unit:"",img:O(37426),bg:"rgba(68, 95, 232, 0.1)"},{title:"\u5B66\u4E60\u5B8C\u6210\u7387",value:(hi=ne==null?void 0:ne.data)==null?void 0:hi.complete_rate,unit:"%",img:O(19150),bg:"rgba(182, 129, 0, .1)"},{title:"\u5B66\u4E60\u638C\u63E1\u7387",value:(qt=ne==null?void 0:ne.data)==null?void 0:qt.grasp_rate,unit:"%",img:O(55303),bg:"rgba(6, 145, 127, .1)"}].map((re,At)=>x.createElement("div",{key:At,className:"relative",style:{borderRadius:"6rem",padding:"20rem",background:re==null?void 0:re.bg}},x.createElement("div",{style:{fontSize:"14rem"}},re==null?void 0:re.title),x.createElement("div",{className:"blod",style:{fontSize:"26rem"}},re==null?void 0:re.value,x.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),x.createElement("img",{className:"absolute",style:{right:"6rem",bottom:"6rem"},height:"35rem",src:re==null?void 0:re.img})))),x.createElement("div",{className:"flex-1 minW-0"},x.createElement(_.Z,{dataSource:Ae,legend:{top:null,icon:"roundRect",bottom:10,itemWidth:14,itemGap:50,left:"center",formatter:re=>re}})))),!(yi!=null&&yi.can_managed)&&x.createElement(x.Fragment,null,x.createElement("div",{className:"flex item-center",style:{gap:"20rem",marginTop:"20rem"}},[{title:"\u8986\u76D6\u77E5\u8BC6\u70B9",value:(wi=ne==null?void 0:ne.data)==null?void 0:wi.total_knowledge_count,unit:"\u4E2A",percent:(Qi=ne==null?void 0:ne.data)==null?void 0:Qi.knowledge_rate,percenttitle:"\u5360\u603B\u77E5\u8BC6\u70B9",trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u8986\u76D6\u8D44\u6E90\u6570",value:(Vi=ne==null?void 0:ne.data)==null?void 0:Vi.total_resource_count,unit:"\u4E2A",percent:(fn=ne==null?void 0:ne.data)==null?void 0:fn.resource_rate,percenttitle:"\u5360\u603B\u8D44\u6E90\u6570",trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((re,At)=>x.createElement("div",{key:At,className:"flex-1 minW-0 flex justify-between c-grey-333",style:{gap:"20rem",background:"#F6F7F9",borderRadius:"6rem",padding:"30rem 60rem"}},x.createElement("div",{className:"flex flex-col justify-between"},x.createElement("div",{style:{fontSize:"14rem",whiteSpace:"nowrap"}},re==null?void 0:re.title),x.createElement("div",{className:"blod",style:{fontSize:"26rem"}},re==null?void 0:re.value,x.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit))),x.createElement("div",{className:"relative",style:{width:"133rem",height:"75rem"}},x.createElement(J.Z,{type:"dashboard",percent:re==null?void 0:re.percent,gapDegree:178,strokeWidth:10,className:"absolute",style:{right:0,top:0},trailColor:re==null?void 0:re.trailColor,strokeColor:re==null?void 0:re.strokeColor,strokeLinecap:"round",format:wt=>x.createElement("div",{className:"c-grey-333",style:{fontSize:"12rem",textAlign:"center",marginTop:"-35rem"}},wt,"%",x.createElement("br",null),x.createElement("br",null),re==null?void 0:re.percenttitle)}))))),x.createElement("div",{className:"c-grey-333 blod",style:{margin:"40rem 0 30rem 0",fontSize:"14rem"}},"\u5B66\u4E60\u7EDF\u8BA1"),x.createElement("div",{className:"flex",style:{marginTop:"20rem",gap:"20rem"}},[{title:"\u4E3B\u80FD\u529B\u638C\u63E1\u7387",value:(Ti=ne==null?void 0:ne.data)==null?void 0:Ti.children_ability_goal_grasp_rate,unit:"%",img:O(46016),bg:"#E3F1FF"},{title:"\u5DF2\u638C\u63E1\u77E5\u8BC6\u70B9",value:((Ji=ne==null?void 0:ne.data)==null?void 0:Ji.knowledge_grasp_count)||0,unit:"\u4E2A",img:O(99755),bg:"#F1FDEF",ProgressTitle:"\u77E5\u8BC6\u70B9\u638C\u63E1\u7387",percent:((qi=ne==null?void 0:ne.data)==null?void 0:qi.knowledge_grasp_rate)||0,trailColor:"rgba(50, 199, 145, .1)",strokeColor:"#32C791"},{title:"\u5DF2\u5B8C\u6210\u8D44\u6E90\u6570",value:((Ni=ne==null?void 0:ne.data)==null?void 0:Ni.resource_complete_count)||0,unit:"\u4E2A",img:O(92691),bg:"#FFF9F4",ProgressTitle:"\u5B8C\u6210\u8D44\u6E90\u7387",percent:((nn=ne==null?void 0:ne.data)==null?void 0:nn.resource_complete_rate)||0,trailColor:"rgba(236, 159, 48, 0.10)",strokeColor:"#EC9F30"}].map((re,At)=>x.createElement("div",{key:At,className:"flex-1 minW-0 relative",style:{borderRadius:"6rem",background:re==null?void 0:re.bg,padding:"20rem 30rem"}},x.createElement("img",{src:re==null?void 0:re.img,width:"43rem",height:"43rem",className:"absolute",style:{right:"30rem",top:"20rem"}}),x.createElement("div",{className:"c-grey-666",style:{fontSize:"14rem"}},re==null?void 0:re.title),x.createElement("div",{className:"c-grey-333 blod",style:{marginTop:"10rem",fontSize:"26rem",lineHeight:"26rem"}},re==null?void 0:re.value,x.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),(re==null?void 0:re.ProgressTitle)&&x.createElement("div",{className:"c-grey-666",style:{fontSize:"12rem",marginTop:"20rem"}},x.createElement("div",null,re==null?void 0:re.ProgressTitle,re==null?void 0:re.percent,"%"),x.createElement(J.Z,{percent:re==null?void 0:re.percent,showInfo:!1,trailColor:re==null?void 0:re.trailColor,strokeColor:re==null?void 0:re.strokeColor,style:{marginBottom:"0",marginLeft:"0"}}))))),x.createElement("div",{className:"c-grey-333 blod",style:{margin:"30rem 0 10rem 0",fontSize:"14rem"}},"\u5F00\u59CB\u5B66\u4E60"),x.createElement("div",{className:"flex flex-col",style:{gap:"10rem"}},(sn=(Vt=ne==null?void 0:ne.data)==null?void 0:Vt.children_ability_goals)==null?void 0:sn.map(re=>x.createElement("div",{key:re==null?void 0:re.id,className:"flex item-center",style:{gap:"20rem",padding:"20rem",background:"#F6F7F9",borderRadius:"6rem"}},x.createElement("div",{className:"flex-1 minW-0 flex flex-col"},x.createElement("div",{className:"flex",style:{gap:"10rem"}},x.createElement("div",{style:{color:"#3061D0"}},x.createElement(Z,{type:"\u5B50\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u5B50\u80FD\u529B"),x.createElement(te.Z,{title:re==null?void 0:re.name,placement:"topLeft"},x.createElement("div",{className:"multi_ellipsis1"},re==null?void 0:re.name))),x.createElement("div",{className:"flex item-center",style:{gap:"10rem",marginTop:"15rem",fontSize:"14rem"}},x.createElement(ue.default,{color:"orange",style:{fontSize:"12rem",lineHeight:"1.5"}},"\u8282\u70B9"),x.createElement("span",{className:"c-grey-333"},re==null?void 0:re.last_knowledge_name),re!=null&&re.is_complete?x.createElement("span",{className:"c-green"},"\uFF08\u5DF2\u638C\u63E1\uFF09"):x.createElement("span",{className:"c-grey-666"},"\uFF08\u672A\u638C\u63E1\uFF09"))),x.createElement(L.op,{onClick:()=>Ot(void 0,null,function*(){yield Tt(re)})},(re==null?void 0:re.complete_rate)==0?"\u5F00\u59CB\u5B66\u4E60":"\u7EE7\u7EED\u5B66\u4E60")))))),(on=(Oi=ne==null?void 0:ne.data)==null?void 0:Oi.children_ability_goals)==null?void 0:on.map(re=>x.createElement(Xe,{key:re==null?void 0:re.id,DataProps:re,pathsDetail:Le,getUrl:Tt}))))),x.createElement(W.default,{open:ln==null?void 0:ln.open,title:"\u89C6\u9891",width:800,centered:!0,onCancel:()=>{ii(Ct(ct({},ln),{open:!1}))},onOk:()=>{ii(Ct(ct({},ln),{open:!1}))}},x.createElement(de.Z,{allow_skip:!0,videoId:ln.id,toLog:!0,src:ln==null?void 0:ln.resourceUrl,logWatchHistory:re=>Pe(Ct(ct({},re),{container_type:localStorage.getItem("container_type_tupu")}))})),x.createElement(P.Z,{close:!0,style:{zIndex:1300,background:"rgba(1, 10, 35, 0.5)"},data:gi==null?void 0:gi.url,type:gi==null?void 0:gi.file_type,disabledDownload:!0,onClose:()=>Qt({})}))};var bt=(0,v.connect)(({pathsDetail:Le,user:Ne})=>({pathsDetail:Le,user:Ne}))(xi)},36785:function(tt,Ie,O){"use strict";O.d(Ie,{o2:function(){return D},yT:function(){return g}});var K=O(80702),te=O(33166);const ue=te.i.map(ee=>`${ee}-inverse`),J=["success","processing","error","default","warning"];function D(ee){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat((0,K.Z)(ue),(0,K.Z)(te.i)).includes(ee):te.i.includes(ee)}function g(ee){return J.includes(ee)}},79676:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return g}});var K=O(19447);function te(ee,H,l,W){if(W===!1)return{adjustX:!1,adjustY:!1};const x=W&&typeof W=="object"?W:{},v={};switch(ee){case"top":case"bottom":v.shiftX=H.dropdownArrowOffset*2+l;break;case"left":case"right":v.shiftY=H.dropdownArrowOffsetVertical*2+l;break}const _=Object.assign(Object.assign({},v),x);return _.shiftX||(_.adjustX=!0),_.shiftY||(_.adjustY=!0),_}const ue={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},J={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},D=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function g(ee){const{arrowWidth:H,autoAdjustOverflow:l,arrowPointAtCenter:W,offset:x,borderRadius:v,visibleFirst:_}=ee,b=H/2,T={};return Object.keys(ue).forEach(B=>{const U=W&&J[B]||ue[B],F=Object.assign(Object.assign({},U),{offset:[0,0]});switch(T[B]=F,D.has(B)&&(F.autoArrow=!1),B){case"top":case"topLeft":case"topRight":F.offset[1]=-b-x;break;case"bottom":case"bottomLeft":case"bottomRight":F.offset[1]=b+x;break;case"left":case"leftTop":case"leftBottom":F.offset[0]=-b-x;break;case"right":case"rightTop":case"rightBottom":F.offset[0]=b+x;break}const I=(0,K.fS)({contentRadius:v,limitVerticalRadius:!0});if(W)switch(B){case"topLeft":case"bottomLeft":F.offset[0]=-I.dropdownArrowOffset-b;break;case"topRight":case"bottomRight":F.offset[0]=I.dropdownArrowOffset+b;break;case"leftTop":case"rightTop":F.offset[1]=-I.dropdownArrowOffset-b;break;case"leftBottom":case"rightBottom":F.offset[1]=I.dropdownArrowOffset+b;break}F.overflow=te(B,I,H,l),_&&(F.htmlRegion="visibleFirst")}),T}},19080:function(tt,Ie,O){"use strict";O.d(Ie,{F:function(){return D},Z:function(){return J}});var K=O(92310),te=O.n(K);const ue=null;function J(g,ee,H){return te()({[`${g}-status-success`]:ee==="success",[`${g}-status-warning`]:ee==="warning",[`${g}-status-error`]:ee==="error",[`${g}-status-validating`]:ee==="validating",[`${g}-has-feedback`]:H})}const D=(g,ee)=>ee||g},27666:function(tt,Ie,O){"use strict";var K=O(80702),te=O(16089);function ue(J){let D;const g=H=>()=>{D=null,J.apply(void 0,(0,K.Z)(H))},ee=function(){if(D==null){for(var H=arguments.length,l=new Array(H),W=0;W<H;W++)l[W]=arguments[W];D=(0,te.Z)(g(l))}};return ee.cancel=()=>{te.Z.cancel(D),D=null},ee}Ie.Z=ue},81228:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return X}});var K=O(96949),te=O(55090),ue=O(77205),J=O(38793),D=O(59301),g=O(92310),ee=O.n(g),H=O(29301),l=O(2738),W=O(27666),x=O(36355),v=O(83116),_=O(37613);const b=Y=>{const{componentCls:fe}=Y;return{[fe]:{position:"fixed",zIndex:Y.zIndexPopup}}};var T=(0,v.Z)("Affix",Y=>{const fe=(0,_.TS)(Y,{zIndexPopup:Y.zIndexBase+10});return[b(fe)]});function B(Y){return Y!==window?Y.getBoundingClientRect():{top:0,bottom:window.innerHeight}}function U(Y,fe,ye){if(ye!==void 0&&fe.top>Y.top-ye)return ye+fe.top}function F(Y,fe,ye){if(ye!==void 0&&fe.bottom<Y.bottom+ye){const ae=window.innerHeight-fe.bottom;return ye+ae}}const I=["resize","scroll","touchstart","touchmove","touchend","pageshow","load"];function M(){return typeof window!="undefined"?window:null}var j;(function(Y){Y[Y.None=0]="None",Y[Y.Prepare=1]="Prepare"})(j||(j={}));let C=function(Y){(0,ue.Z)(ye,Y);var fe=(0,J.Z)(ye);function ye(){var ae;return(0,K.Z)(this,ye),ae=fe.apply(this,arguments),ae.state={status:j.None,lastAffix:!1,prevTarget:null},ae.placeholderNodeRef=(0,D.createRef)(),ae.fixedNodeRef=(0,D.createRef)(),ae.addListeners=()=>{const Q=ae.getTargetFunc(),R=Q==null?void 0:Q(),{prevTarget:A}=ae.state;A!==R&&(I.forEach(L=>{A==null||A.removeEventListener(L,ae.lazyUpdatePosition),R==null||R.addEventListener(L,ae.lazyUpdatePosition)}),ae.updatePosition(),ae.setState({prevTarget:R}))},ae.removeListeners=()=>{ae.timer&&(clearTimeout(ae.timer),ae.timer=null);const{prevTarget:Q}=ae.state,R=ae.getTargetFunc(),A=R==null?void 0:R();I.forEach(L=>{A==null||A.removeEventListener(L,ae.lazyUpdatePosition),Q==null||Q.removeEventListener(L,ae.lazyUpdatePosition)}),ae.updatePosition.cancel(),ae.lazyUpdatePosition.cancel()},ae.getOffsetTop=()=>{const{offsetBottom:Q,offsetTop:R}=ae.props;return Q===void 0&&R===void 0?0:R},ae.getOffsetBottom=()=>ae.props.offsetBottom,ae.measure=()=>{const{status:Q,lastAffix:R}=ae.state,{onChange:A}=ae.props,L=ae.getTargetFunc();if(Q!==j.Prepare||!ae.fixedNodeRef.current||!ae.placeholderNodeRef.current||!L)return;const S=ae.getOffsetTop(),G=ae.getOffsetBottom(),P=L();if(P){const p={status:j.None},d=B(ae.placeholderNodeRef.current);if(d.top===0&&d.left===0&&d.width===0&&d.height===0)return;const N=B(P),V=U(d,N,S),oe=F(d,N,G);V!==void 0?(p.affixStyle={position:"fixed",top:V,width:d.width,height:d.height},p.placeholderStyle={width:d.width,height:d.height}):oe!==void 0&&(p.affixStyle={position:"fixed",bottom:oe,width:d.width,height:d.height},p.placeholderStyle={width:d.width,height:d.height}),p.lastAffix=!!p.affixStyle,A&&R!==p.lastAffix&&A(p.lastAffix),ae.setState(p)}},ae.prepareMeasure=()=>{ae.setState({status:j.Prepare,affixStyle:void 0,placeholderStyle:void 0})},ae.updatePosition=(0,W.Z)(()=>{ae.prepareMeasure()}),ae.lazyUpdatePosition=(0,W.Z)(()=>{const Q=ae.getTargetFunc(),{affixStyle:R}=ae.state;if(Q&&R){const A=ae.getOffsetTop(),L=ae.getOffsetBottom(),S=Q();if(S&&ae.placeholderNodeRef.current){const G=B(S),P=B(ae.placeholderNodeRef.current),p=U(P,G,A),d=F(P,G,L);if(p!==void 0&&R.top===p||d!==void 0&&R.bottom===d)return}}ae.prepareMeasure()}),ae}return(0,te.Z)(ye,[{key:"getTargetFunc",value:function(){const{getTargetContainer:Q}=this.context,{target:R}=this.props;return R!==void 0?R:Q!=null?Q:M}},{key:"componentDidMount",value:function(){this.timer=setTimeout(this.addListeners)}},{key:"componentDidUpdate",value:function(Q){this.addListeners(),(Q.offsetTop!==this.props.offsetTop||Q.offsetBottom!==this.props.offsetBottom)&&this.updatePosition(),this.measure()}},{key:"componentWillUnmount",value:function(){this.removeListeners()}},{key:"render",value:function(){const{affixStyle:Q,placeholderStyle:R}=this.state,{affixPrefixCls:A,rootClassName:L,children:S}=this.props,G=ee()(Q&&L,{[A]:!!Q});let P=(0,l.Z)(this.props,["prefixCls","offsetTop","offsetBottom","target","onChange","affixPrefixCls","rootClassName"]);return D.createElement(H.Z,{onResize:this.updatePosition},D.createElement("div",Object.assign({},P,{ref:this.placeholderNodeRef}),Q&&D.createElement("div",{style:R,"aria-hidden":"true"}),D.createElement("div",{className:G,ref:this.fixedNodeRef,style:Q},D.createElement(H.Z,{onResize:this.updatePosition},S))))}}]),ye}(D.Component);C.contextType=x.E_;var X=(0,D.forwardRef)((Y,fe)=>{const{prefixCls:ye,rootClassName:ae}=Y,{getPrefixCls:Q}=(0,D.useContext)(x.E_),R=Q("affix",ye),[A,L]=T(R),S=Object.assign(Object.assign({},Y),{affixPrefixCls:R,rootClassName:ee()(ae,L)});return A(D.createElement(C,Object.assign({},S,{ref:fe})))})},79817:function(tt,Ie,O){"use strict";O.d(Ie,{default:function(){return ae}});var K=O(80702),te=O(92310),ue=O.n(te),J=O(70425),D=O(59301),g=O(16722),ee=O(13845),H=O(68031),l=O(81228),W=O(36355),v=D.createContext(void 0),b=Q=>{const{href:R,title:A,prefixCls:L,children:S,className:G,target:P,replace:p}=Q,d=D.useContext(v),{registerLink:N,unregisterLink:V,scrollTo:oe,onClick:xe,activeLink:Oe,direction:Me}=d||{};D.useEffect(()=>(N==null||N(R),()=>{V==null||V(R)}),[R]);const We=qe=>{p&&(qe.preventDefault(),window.location.replace(R)),xe==null||xe(qe,{title:A,href:R}),oe==null||oe(R)},{getPrefixCls:rt}=D.useContext(W.E_),ft=rt("anchor",L),ze=Oe===R,dt=ue()(`${ft}-link`,G,{[`${ft}-link-active`]:ze}),Fe=ue()(`${ft}-link-title`,{[`${ft}-link-title-active`]:ze});return D.createElement("div",{className:dt},D.createElement("a",{className:Fe,href:R,title:typeof A=="string"?A:"",target:P,onClick:We},A),Me!=="horizontal"?S:null)},T=O(17313),B=O(83116),U=O(37613);const F=Q=>{const{componentCls:R,holderOffsetBlock:A,motionDurationSlow:L,lineWidthBold:S,colorPrimary:G,lineType:P,colorSplit:p}=Q;return{[`${R}-wrapper`]:{marginBlockStart:-A,paddingBlockStart:A,[R]:Object.assign(Object.assign({},(0,T.Wf)(Q)),{position:"relative",paddingInlineStart:S,[`${R}-link`]:{paddingBlock:Q.linkPaddingBlock,paddingInline:`${Q.linkPaddingInlineStart}px 0`,"&-title":Object.assign(Object.assign({},T.vS),{position:"relative",display:"block",marginBlockEnd:Q.anchorTitleBlock,color:Q.colorText,transition:`all ${Q.motionDurationSlow}`,"&:only-child":{marginBlockEnd:0}}),[`&-active > ${R}-link-title`]:{color:Q.colorPrimary},[`${R}-link`]:{paddingBlock:Q.anchorPaddingBlockSecondary}}}),[`&:not(${R}-wrapper-horizontal)`]:{[R]:{"&::before":{position:"absolute",insetInlineStart:0,top:0,height:"100%",borderInlineStart:`${S}px ${P} ${p}`,content:'" "'},[`${R}-ink`]:{position:"absolute",insetInlineStart:0,display:"none",transform:"translateY(-50%)",transition:`top ${L} ease-in-out`,width:S,backgroundColor:G,[`&${R}-ink-visible`]:{display:"inline-block"}}}},[`${R}-fixed ${R}-ink ${R}-ink`]:{display:"none"}}}},I=Q=>{const{componentCls:R,motionDurationSlow:A,lineWidthBold:L,colorPrimary:S}=Q;return{[`${R}-wrapper-horizontal`]:{position:"relative","&::before":{position:"absolute",left:{_skip_check_:!0,value:0},right:{_skip_check_:!0,value:0},bottom:0,borderBottom:`1px ${Q.lineType} ${Q.colorSplit}`,content:'" "'},[R]:{overflowX:"scroll",position:"relative",display:"flex",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},[`${R}-link:first-of-type`]:{paddingInline:0},[`${R}-ink`]:{position:"absolute",bottom:0,transition:`left ${A} ease-in-out, width ${A} ease-in-out`,height:L,backgroundColor:S}}}}};var M=(0,B.Z)("Anchor",Q=>{const{fontSize:R,fontSizeLG:A,paddingXXS:L}=Q,S=(0,U.TS)(Q,{holderOffsetBlock:L,anchorPaddingBlockSecondary:L/2,anchorTitleBlock:R/14*3,anchorBallSize:A/2});return[F(S),I(S)]},Q=>({linkPaddingBlock:Q.paddingXXS,linkPaddingInlineStart:Q.padding}));function j(){return window}function C(Q,R){if(!Q.getClientRects().length)return 0;const A=Q.getBoundingClientRect();return A.width||A.height?R===window?(R=Q.ownerDocument.documentElement,A.top-R.clientTop):A.top-R.getBoundingClientRect().top:A.top}const $=/#([\S ]+)$/,X=Q=>{var R;const{rootClassName:A,anchorPrefixCls:L,className:S,style:G,offsetTop:P,affix:p=!0,showInkInFixed:d=!1,children:N,items:V,direction:oe="vertical",bounds:xe,targetOffset:Oe,onClick:Me,onChange:We,getContainer:rt,getCurrentAnchor:ft,replace:ze}=Q,[dt,Fe]=D.useState([]),[qe,Wt]=D.useState(null),it=D.useRef(qe),_e=D.useRef(null),be=D.useRef(null),ve=D.useRef(!1),{direction:Be,getTargetContainer:je,anchor:Z}=D.useContext(W.E_),se=(R=rt!=null?rt:je)!==null&&R!==void 0?R:j,de=JSON.stringify(dt),we=(0,J.useEvent)(bt=>{dt.includes(bt)||Fe(Le=>[].concat((0,K.Z)(Le),[bt]))}),ke=(0,J.useEvent)(bt=>{dt.includes(bt)&&Fe(Le=>Le.filter(Ne=>Ne!==bt))}),Ze=()=>{var bt;const Le=(bt=_e.current)===null||bt===void 0?void 0:bt.querySelector(`.${L}-link-title-active`);if(Le&&be.current){const{style:Ne}=be.current,Ke=oe==="horizontal";Ne.top=Ke?"":`${Le.offsetTop+Le.clientHeight/2}px`,Ne.height=Ke?"":`${Le.clientHeight}px`,Ne.left=Ke?`${Le.offsetLeft}px`:"",Ne.width=Ke?`${Le.clientWidth}px`:"",Ke&&(0,g.Z)(Le,{scrollMode:"if-needed",block:"nearest"})}},ot=function(bt){let Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;const Ke=[],Nt=se();return bt.forEach(lt=>{const Et=$.exec(lt==null?void 0:lt.toString());if(!Et)return;const kt=document.getElementById(Et[1]);if(kt){const gt=C(kt,Nt);gt<Le+Ne&&Ke.push({link:lt,top:gt})}}),Ke.length?Ke.reduce((Et,kt)=>kt.top>Et.top?kt:Et).link:""},pt=(0,J.useEvent)(bt=>{if(it.current===bt)return;const Le=typeof ft=="function"?ft(bt):bt;Wt(Le),it.current=Le,We==null||We(bt)}),st=D.useCallback(()=>{if(ve.current)return;const bt=ot(dt,Oe!==void 0?Oe:P||0,xe);pt(bt)},[de,Oe,P]),Rt=D.useCallback(bt=>{pt(bt);const Le=$.exec(bt);if(!Le)return;const Ne=document.getElementById(Le[1]);if(!Ne)return;const Ke=se(),Nt=(0,ee.Z)(Ke,!0),lt=C(Ne,Ke);let Et=Nt+lt;Et-=Oe!==void 0?Oe:P||0,ve.current=!0,(0,H.Z)(Et,{getContainer:se,callback(){ve.current=!1}})},[Oe,P]),Ut=ue()(A,`${L}-wrapper`,{[`${L}-wrapper-horizontal`]:oe==="horizontal",[`${L}-rtl`]:Be==="rtl"},S,Z==null?void 0:Z.className),ct=ue()(L,{[`${L}-fixed`]:!p&&!d}),Ct=ue()(`${L}-ink`,{[`${L}-ink-visible`]:qe}),Ot=Object.assign(Object.assign({maxHeight:P?`calc(100vh - ${P}px)`:"100vh"},Z==null?void 0:Z.style),G),Mt=bt=>Array.isArray(bt)?bt.map(Le=>D.createElement(b,Object.assign({replace:ze},Le,{key:Le.key}),oe==="vertical"&&Mt(Le.children))):null,Xe=D.createElement("div",{ref:_e,className:Ut,style:Ot},D.createElement("div",{className:ct},D.createElement("span",{className:Ct,ref:be}),"items"in Q?Mt(V):N));D.useEffect(()=>{const bt=se();return st(),bt==null||bt.addEventListener("scroll",st),()=>{bt==null||bt.removeEventListener("scroll",st)}},[de]),D.useEffect(()=>{typeof ft=="function"&&pt(ft(it.current||""))},[ft]),D.useEffect(()=>{Ze()},[oe,ft,de,qe]);const xi=D.useMemo(()=>({registerLink:we,unregisterLink:ke,scrollTo:Rt,activeLink:qe,onClick:Me,direction:oe}),[qe,Me,Rt,oe]);return D.createElement(v.Provider,{value:xi},p?D.createElement(l.Z,{offsetTop:P,target:se},Xe):Xe)};var fe=Q=>{const{prefixCls:R,rootClassName:A}=Q,{getPrefixCls:L}=D.useContext(W.E_),S=L("anchor",R),[G,P]=M(S);return G(D.createElement(X,Object.assign({},Q,{rootClassName:ue()(P,A),anchorPrefixCls:S})))};const ye=fe;ye.Link=b;var ae=ye},66104:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return L}});var K=O(92310),te=O.n(K),ue=O(11592),J=O(26112),D=O(59301),g=O(92343),ee=O(36355),H=O(84105),l=O(91857);const W=S=>{let{children:G}=S;const{getPrefixCls:P}=D.useContext(ee.E_),p=P("breadcrumb");return D.createElement("li",{className:`${p}-separator`,"aria-hidden":"true"},G===""?G:G||"/")};W.__ANT_BREADCRUMB_SEPARATOR=!0;var x=W,v=function(S,G){var P={};for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&G.indexOf(p)<0&&(P[p]=S[p]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,p=Object.getOwnPropertySymbols(S);d<p.length;d++)G.indexOf(p[d])<0&&Object.prototype.propertyIsEnumerable.call(S,p[d])&&(P[p[d]]=S[p[d]]);return P};function _(S,G){if(S.title===void 0||S.title===null)return null;const P=Object.keys(G).join("|");return typeof S.title=="object"?S.title:String(S.title).replace(new RegExp(`:(${P})`,"g"),(p,d)=>G[d]||p)}function b(S,G,P,p){if(P==null)return null;const{className:d,onClick:N}=G,V=v(G,["className","onClick"]),oe=Object.assign(Object.assign({},(0,J.Z)(V,{data:!0,aria:!0})),{onClick:N});return p!==void 0?D.createElement("a",Object.assign({},oe,{className:te()(`${S}-link`,d),href:p}),P):D.createElement("span",Object.assign({},oe,{className:te()(`${S}-link`,d)}),P)}function T(S,G){return(p,d,N,V,oe)=>{if(G)return G(p,d,N,V);const xe=_(p,d);return b(S,p,xe,oe)}}var B=function(S,G){var P={};for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&G.indexOf(p)<0&&(P[p]=S[p]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,p=Object.getOwnPropertySymbols(S);d<p.length;d++)G.indexOf(p[d])<0&&Object.prototype.propertyIsEnumerable.call(S,p[d])&&(P[p[d]]=S[p[d]]);return P};const U=S=>{const{prefixCls:G,separator:P="/",children:p,menu:d,overlay:N,dropdownProps:V,href:oe}=S,Oe=(Me=>{if(d||N){const We=Object.assign({},V);if(d){const rt=d||{},{items:ft}=rt,ze=B(rt,["items"]);We.menu=Object.assign(Object.assign({},ze),{items:ft==null?void 0:ft.map((dt,Fe)=>{var{key:qe,title:Wt,label:it,path:_e}=dt,be=B(dt,["key","title","label","path"]);let ve=it!=null?it:Wt;return _e&&(ve=D.createElement("a",{href:`${oe}${_e}`},ve)),Object.assign(Object.assign({},be),{key:qe!=null?qe:Fe,label:ve})})})}else N&&(We.overlay=N);return D.createElement(l.Z,Object.assign({placement:"bottom"},We),D.createElement("span",{className:`${G}-overlay-link`},Me,D.createElement(H.Z,null)))}return Me})(p);return Oe!=null?D.createElement(D.Fragment,null,D.createElement("li",null,Oe),P&&D.createElement(x,null,P)):null},F=S=>{const{prefixCls:G,children:P,href:p}=S,d=B(S,["prefixCls","children","href"]),{getPrefixCls:N}=D.useContext(ee.E_),V=N("breadcrumb",G);return D.createElement(U,Object.assign({},d,{prefixCls:V}),b(V,d,P,p))};F.__ANT_BREADCRUMB_ITEM=!0;var I=F,M=O(17313),j=O(83116),C=O(37613);const $=S=>{const{componentCls:G,iconCls:P}=S;return{[G]:Object.assign(Object.assign({},(0,M.Wf)(S)),{color:S.itemColor,fontSize:S.fontSize,[P]:{fontSize:S.iconFontSize},ol:{display:"flex",flexWrap:"wrap",margin:0,padding:0,listStyle:"none"},a:Object.assign({color:S.linkColor,transition:`color ${S.motionDurationMid}`,padding:`0 ${S.paddingXXS}px`,borderRadius:S.borderRadiusSM,height:S.lineHeight*S.fontSize,display:"inline-block",marginInline:-S.marginXXS,"&:hover":{color:S.linkHoverColor,backgroundColor:S.colorBgTextHover}},(0,M.Qy)(S)),"li:last-child":{color:S.lastItemColor},[`${G}-separator`]:{marginInline:S.separatorMargin,color:S.separatorColor},[`${G}-link`]:{[`
|
|
> ${P} + span,
|
|
> ${P} + a
|
|
`]:{marginInlineStart:S.marginXXS}},[`${G}-overlay-link`]:{borderRadius:S.borderRadiusSM,height:S.lineHeight*S.fontSize,display:"inline-block",padding:`0 ${S.paddingXXS}px`,marginInline:-S.marginXXS,[`> ${P}`]:{marginInlineStart:S.marginXXS,fontSize:S.fontSizeIcon},"&:hover":{color:S.linkHoverColor,backgroundColor:S.colorBgTextHover,a:{color:S.linkHoverColor}},a:{"&:hover":{backgroundColor:"transparent"}}},[`&${S.componentCls}-rtl`]:{direction:"rtl"}})}};var X=(0,j.Z)("Breadcrumb",S=>{const G=(0,C.TS)(S,{});return[$(G)]},S=>({itemColor:S.colorTextDescription,lastItemColor:S.colorText,iconFontSize:S.fontSize,linkColor:S.colorTextDescription,linkHoverColor:S.colorText,separatorColor:S.colorTextDescription,separatorMargin:S.marginXS})),Y=function(S,G){var P={};for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&G.indexOf(p)<0&&(P[p]=S[p]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,p=Object.getOwnPropertySymbols(S);d<p.length;d++)G.indexOf(p[d])<0&&Object.prototype.propertyIsEnumerable.call(S,p[d])&&(P[p[d]]=S[p[d]]);return P};function fe(S){const{breadcrumbName:G,children:P}=S,p=Y(S,["breadcrumbName","children"]),d=Object.assign({title:G},p);return P&&(d.menu={items:P.map(N=>{var{breadcrumbName:V}=N,oe=Y(N,["breadcrumbName"]);return Object.assign(Object.assign({},oe),{title:V})})}),d}function ye(S,G){return(0,D.useMemo)(()=>S||(G?G.map(fe):null),[S,G])}var ae=function(S,G){var P={};for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&G.indexOf(p)<0&&(P[p]=S[p]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,p=Object.getOwnPropertySymbols(S);d<p.length;d++)G.indexOf(p[d])<0&&Object.prototype.propertyIsEnumerable.call(S,p[d])&&(P[p[d]]=S[p[d]]);return P};const Q=(S,G)=>{if(G===void 0)return G;let P=(G||"").replace(/^\//,"");return Object.keys(S).forEach(p=>{P=P.replace(`:${p}`,S[p])}),P},R=S=>{const{prefixCls:G,separator:P="/",style:p,className:d,rootClassName:N,routes:V,items:oe,children:xe,itemRender:Oe,params:Me={}}=S,We=ae(S,["prefixCls","separator","style","className","rootClassName","routes","items","children","itemRender","params"]),{getPrefixCls:rt,direction:ft,breadcrumb:ze}=D.useContext(ee.E_);let dt;const Fe=rt("breadcrumb",G),[qe,Wt]=X(Fe),it=ye(oe,V),_e=T(Fe,Oe);if(it&&it.length>0){const Be=[],je=oe||V;dt=it.map((Z,se)=>{const{path:de,key:we,type:ke,menu:Ze,overlay:ot,onClick:pt,className:st,separator:Rt,dropdownProps:Ut}=Z,ct=Q(Me,de);ct!==void 0&&Be.push(ct);const Ct=we!=null?we:se;if(ke==="separator")return D.createElement(x,{key:Ct},Rt);const Ot={},Mt=se===it.length-1;Ze?Ot.menu=Ze:ot&&(Ot.overlay=ot);let{href:Xe}=Z;return Be.length&&ct!==void 0&&(Xe=`#/${Be.join("/")}`),D.createElement(U,Object.assign({key:Ct},Ot,(0,J.Z)(Z,{data:!0,aria:!0}),{className:st,dropdownProps:Ut,href:Xe,separator:Mt?"":P,onClick:pt,prefixCls:Fe}),_e(Z,Me,je,Be,Xe))})}else if(xe){const Be=(0,ue.Z)(xe).length;dt=(0,ue.Z)(xe).map((je,Z)=>{if(!je)return je;const se=Z===Be-1;return(0,g.Tm)(je,{separator:se?"":P,key:Z})})}const be=te()(Fe,ze==null?void 0:ze.className,{[`${Fe}-rtl`]:ft==="rtl"},d,N,Wt),ve=Object.assign(Object.assign({},ze==null?void 0:ze.style),p);return qe(D.createElement("nav",Object.assign({className:be,style:ve},We),D.createElement("ol",null,dt)))};R.Item=I,R.Separator=x;var A=R,L=A},9937:function(tt,Ie,O){"use strict";O.d(Ie,{M1:function(){return ee},TM:function(){return j},Xy:function(){return H},bi:function(){return x},e5:function(){return M},ik:function(){return v},nz:function(){return D},pU:function(){return g},s7:function(){return _},x0:function(){return W}});var K=O(17313),te=O(74207),ue=O(37613),J=O(83116);const D=C=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:C,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),g=C=>({borderColor:C.hoverBorderColor}),ee=C=>({borderColor:C.activeBorderColor,boxShadow:C.activeShadow,outline:0}),H=C=>({color:C.colorTextDisabled,backgroundColor:C.colorBgContainerDisabled,borderColor:C.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"&:hover":Object.assign({},g((0,ue.TS)(C,{hoverBorderColor:C.colorBorder})))}),l=C=>{const{paddingBlockLG:$,fontSizeLG:X,lineHeightLG:Y,borderRadiusLG:fe,paddingInlineLG:ye}=C;return{padding:`${$}px ${ye}px`,fontSize:X,lineHeight:Y,borderRadius:fe}},W=C=>({padding:`${C.paddingBlockSM}px ${C.paddingInlineSM}px`,borderRadius:C.borderRadiusSM}),x=(C,$)=>{const{componentCls:X,colorError:Y,colorWarning:fe,errorActiveShadow:ye,warningActiveShadow:ae,colorErrorBorderHover:Q,colorWarningBorderHover:R}=C;return{[`&-status-error:not(${$}-disabled):not(${$}-borderless)${$}`]:{borderColor:Y,"&:hover":{borderColor:Q},"&:focus, &-focused":Object.assign({},ee((0,ue.TS)(C,{activeBorderColor:Y,activeShadow:ye}))),[`${X}-prefix, ${X}-suffix`]:{color:Y}},[`&-status-warning:not(${$}-disabled):not(${$}-borderless)${$}`]:{borderColor:fe,"&:hover":{borderColor:R},"&:focus, &-focused":Object.assign({},ee((0,ue.TS)(C,{activeBorderColor:fe,activeShadow:ae}))),[`${X}-prefix, ${X}-suffix`]:{color:fe}}}},v=C=>Object.assign(Object.assign({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:`${C.paddingBlock}px ${C.paddingInline}px`,color:C.colorText,fontSize:C.fontSize,lineHeight:C.lineHeight,backgroundColor:C.colorBgContainer,backgroundImage:"none",borderWidth:C.lineWidth,borderStyle:C.lineType,borderColor:C.colorBorder,borderRadius:C.borderRadius,transition:`all ${C.motionDurationMid}`},D(C.colorTextPlaceholder)),{"&:hover":Object.assign({},g(C)),"&:focus, &-focused":Object.assign({},ee(C)),"&-disabled, &[disabled]":Object.assign({},H(C)),"&-borderless":{"&, &:hover, &:focus, &-focused, &-disabled, &[disabled]":{backgroundColor:"transparent",border:"none",boxShadow:"none"}},"textarea&":{maxWidth:"100%",height:"auto",minHeight:C.controlHeight,lineHeight:C.lineHeight,verticalAlign:"bottom",transition:`all ${C.motionDurationSlow}, height 0s`,resize:"vertical"},"&-lg":Object.assign({},l(C)),"&-sm":Object.assign({},W(C)),"&-rtl":{direction:"rtl"},"&-textarea-rtl":{direction:"rtl"}}),_=C=>{const{componentCls:$,antCls:X}=C;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:C.paddingXS,"&:last-child":{paddingInlineEnd:0}},[`&-lg ${$}, &-lg > ${$}-group-addon`]:Object.assign({},l(C)),[`&-sm ${$}, &-sm > ${$}-group-addon`]:Object.assign({},W(C)),[`&-lg ${X}-select-single ${X}-select-selector`]:{height:C.controlHeightLG},[`&-sm ${X}-select-single ${X}-select-selector`]:{height:C.controlHeightSM},[`> ${$}`]:{display:"table-cell","&:not(:first-child):not(:last-child)":{borderRadius:0}},[`${$}-group`]:{"&-addon, &-wrap":{display:"table-cell",width:1,whiteSpace:"nowrap",verticalAlign:"middle","&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:"block !important"},"&-addon":{position:"relative",padding:`0 ${C.paddingInline}px`,color:C.colorText,fontWeight:"normal",fontSize:C.fontSize,textAlign:"center",backgroundColor:C.colorFillAlter,border:`${C.lineWidth}px ${C.lineType} ${C.colorBorder}`,borderRadius:C.borderRadius,transition:`all ${C.motionDurationSlow}`,lineHeight:1,[`${X}-select`]:{margin:`-${C.paddingBlock+1}px -${C.paddingInline}px`,[`&${X}-select-single:not(${X}-select-customize-input)`]:{[`${X}-select-selector`]:{backgroundColor:"inherit",border:`${C.lineWidth}px ${C.lineType} transparent`,boxShadow:"none"}},"&-open, &-focused":{[`${X}-select-selector`]:{color:C.colorPrimary}}},[`${X}-cascader-picker`]:{margin:`-9px -${C.paddingInline}px`,backgroundColor:"transparent",[`${X}-cascader-input`]:{textAlign:"start",border:0,boxShadow:"none"}}},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}},[`${$}`]:{width:"100%",marginBottom:0,textAlign:"inherit","&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1,[`${$}-search-with-button &`]:{zIndex:0}}},[`> ${$}:first-child, ${$}-group-addon:first-child`]:{borderStartEndRadius:0,borderEndEndRadius:0,[`${X}-select ${X}-select-selector`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${$}-affix-wrapper`]:{[`&:not(:first-child) ${$}`]:{borderStartStartRadius:0,borderEndStartRadius:0},[`&:not(:last-child) ${$}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${$}:last-child, ${$}-group-addon:last-child`]:{borderStartStartRadius:0,borderEndStartRadius:0,[`${X}-select ${X}-select-selector`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`${$}-affix-wrapper`]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0,[`${$}-search &`]:{borderStartStartRadius:C.borderRadius,borderEndStartRadius:C.borderRadius}},[`&:not(:first-child), ${$}-search &:not(:first-child)`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`&${$}-group-compact`]:Object.assign(Object.assign({display:"block"},(0,K.dF)()),{[`${$}-group-addon, ${$}-group-wrap, > ${$}`]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:C.lineWidth,"&:hover":{zIndex:1},"&:focus":{zIndex:1}}},"& > *":{display:"inline-block",float:"none",verticalAlign:"top",borderRadius:0},[`
|
|
& > ${$}-affix-wrapper,
|
|
& > ${$}-number-affix-wrapper,
|
|
& > ${X}-picker-range
|
|
`]:{display:"inline-flex"},"& > *:not(:last-child)":{marginInlineEnd:-C.lineWidth,borderInlineEndWidth:C.lineWidth},[`${$}`]:{float:"none"},[`& > ${X}-select > ${X}-select-selector,
|
|
& > ${X}-select-auto-complete ${$},
|
|
& > ${X}-cascader-picker ${$},
|
|
& > ${$}-group-wrapper ${$}`]:{borderInlineEndWidth:C.lineWidth,borderRadius:0,"&:hover":{zIndex:1},"&:focus":{zIndex:1}},[`& > ${X}-select-focused`]:{zIndex:1},[`& > ${X}-select > ${X}-select-arrow`]:{zIndex:1},[`& > *:first-child,
|
|
& > ${X}-select:first-child > ${X}-select-selector,
|
|
& > ${X}-select-auto-complete:first-child ${$},
|
|
& > ${X}-cascader-picker:first-child ${$}`]:{borderStartStartRadius:C.borderRadius,borderEndStartRadius:C.borderRadius},[`& > *:last-child,
|
|
& > ${X}-select:last-child > ${X}-select-selector,
|
|
& > ${X}-cascader-picker:last-child ${$},
|
|
& > ${X}-cascader-picker-focused:last-child ${$}`]:{borderInlineEndWidth:C.lineWidth,borderStartEndRadius:C.borderRadius,borderEndEndRadius:C.borderRadius},[`& > ${X}-select-auto-complete ${$}`]:{verticalAlign:"top"},[`${$}-group-wrapper + ${$}-group-wrapper`]:{marginInlineStart:-C.lineWidth,[`${$}-affix-wrapper`]:{borderRadius:0}},[`${$}-group-wrapper:not(:last-child)`]:{[`&${$}-search > ${$}-group`]:{[`& > ${$}-group-addon > ${$}-search-button`]:{borderRadius:0},[`& > ${$}`]:{borderStartStartRadius:C.borderRadius,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:C.borderRadius}}}})}},b=C=>{const{componentCls:$,controlHeightSM:X,lineWidth:Y}=C,ye=(X-Y*2-16)/2;return{[$]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,K.Wf)(C)),v(C)),x(C,$)),{'&[type="color"]':{height:C.controlHeight,[`&${$}-lg`]:{height:C.controlHeightLG},[`&${$}-sm`]:{height:X,paddingTop:ye,paddingBottom:ye}},'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration':{"-webkit-appearance":"none"}})}},T=C=>{const{componentCls:$}=C;return{[`${$}-clear-icon`]:{margin:0,color:C.colorTextQuaternary,fontSize:C.fontSizeIcon,verticalAlign:-1,cursor:"pointer",transition:`color ${C.motionDurationSlow}`,"&:hover":{color:C.colorTextTertiary},"&:active":{color:C.colorText},"&-hidden":{visibility:"hidden"},"&-has-suffix":{margin:`0 ${C.inputAffixPadding}px`}}}},B=C=>{const{componentCls:$,inputAffixPadding:X,colorTextDescription:Y,motionDurationSlow:fe,colorIcon:ye,colorIconHover:ae,iconCls:Q}=C;return{[`${$}-affix-wrapper`]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},v(C)),{display:"inline-flex",[`&:not(${$}-affix-wrapper-disabled):hover`]:Object.assign(Object.assign({},g(C)),{zIndex:1,[`${$}-search-with-button &`]:{zIndex:0}}),"&-focused, &:focus":{zIndex:1},"&-disabled":{[`${$}[disabled]`]:{background:"transparent"}},[`> input${$}`]:{padding:0,fontSize:"inherit",border:"none",borderRadius:0,outline:"none","&::-ms-reveal":{display:"none"},"&:focus":{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${$}`]:{"&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center","> *:not(:last-child)":{marginInlineEnd:C.paddingXS}},"&-show-count-suffix":{color:Y},"&-show-count-has-suffix":{marginInlineEnd:C.paddingXXS},"&-prefix":{marginInlineEnd:X},"&-suffix":{marginInlineStart:X}}}),T(C)),{[`${Q}${$}-password-icon`]:{color:ye,cursor:"pointer",transition:`all ${fe}`,"&:hover":{color:ae}}}),x(C,`${$}-affix-wrapper`))}},U=C=>{const{componentCls:$,colorError:X,colorWarning:Y,borderRadiusLG:fe,borderRadiusSM:ye}=C;return{[`${$}-group`]:Object.assign(Object.assign(Object.assign({},(0,K.Wf)(C)),_(C)),{"&-rtl":{direction:"rtl"},"&-wrapper":{display:"inline-block",width:"100%",textAlign:"start",verticalAlign:"top","&-rtl":{direction:"rtl"},"&-lg":{[`${$}-group-addon`]:{borderRadius:fe,fontSize:C.fontSizeLG}},"&-sm":{[`${$}-group-addon`]:{borderRadius:ye}},"&-status-error":{[`${$}-group-addon`]:{color:X,borderColor:X}},"&-status-warning":{[`${$}-group-addon`]:{color:Y,borderColor:Y}},"&-disabled":{[`${$}-group-addon`]:Object.assign({},H(C))},[`&:not(${$}-compact-first-item):not(${$}-compact-last-item)${$}-compact-item`]:{[`${$}, ${$}-group-addon`]:{borderRadius:0}},[`&:not(${$}-compact-last-item)${$}-compact-first-item`]:{[`${$}, ${$}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${$}-compact-first-item)${$}-compact-last-item`]:{[`${$}, ${$}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}})}},F=C=>{const{componentCls:$,antCls:X}=C,Y=`${$}-search`;return{[Y]:{[`${$}`]:{"&:hover, &:focus":{borderColor:C.colorPrimaryHover,[`+ ${$}-group-addon ${Y}-button:not(${X}-btn-primary)`]:{borderInlineStartColor:C.colorPrimaryHover}}},[`${$}-affix-wrapper`]:{borderRadius:0},[`${$}-lg`]:{lineHeight:C.lineHeightLG-2e-4},[`> ${$}-group`]:{[`> ${$}-group-addon:last-child`]:{insetInlineStart:-1,padding:0,border:0,[`${Y}-button`]:{paddingTop:0,paddingBottom:0,borderStartStartRadius:0,borderStartEndRadius:C.borderRadius,borderEndEndRadius:C.borderRadius,borderEndStartRadius:0,boxShadow:"none"},[`${Y}-button:not(${X}-btn-primary)`]:{color:C.colorTextDescription,"&:hover":{color:C.colorPrimaryHover},"&:active":{color:C.colorPrimaryActive},[`&${X}-btn-loading::before`]:{insetInlineStart:0,insetInlineEnd:0,insetBlockStart:0,insetBlockEnd:0}}}},[`${Y}-button`]:{height:C.controlHeight,"&:hover, &:focus":{zIndex:1}},[`&-large ${Y}-button`]:{height:C.controlHeightLG},[`&-small ${Y}-button`]:{height:C.controlHeightSM},"&-rtl":{direction:"rtl"},[`&${$}-compact-item`]:{[`&:not(${$}-compact-last-item)`]:{[`${$}-group-addon`]:{[`${$}-search-button`]:{marginInlineEnd:-C.lineWidth,borderRadius:0}}},[`&:not(${$}-compact-first-item)`]:{[`${$},${$}-affix-wrapper`]:{borderRadius:0}},[`> ${$}-group-addon ${$}-search-button,
|
|
> ${$},
|
|
${$}-affix-wrapper`]:{"&:hover,&:focus,&:active":{zIndex:2}},[`> ${$}-affix-wrapper-focused`]:{zIndex:2}}}}},I=C=>{const{componentCls:$,paddingLG:X}=C,Y=`${$}-textarea`;return{[Y]:{position:"relative","&-show-count":{[`> ${$}`]:{height:"100%"},[`${$}-data-count`]:{position:"absolute",bottom:-C.fontSize*C.lineHeight,insetInlineEnd:0,color:C.colorTextDescription,whiteSpace:"nowrap",pointerEvents:"none"}},"&-allow-clear":{[`> ${$}`]:{paddingInlineEnd:X}},[`&-affix-wrapper${Y}-has-feedback`]:{[`${$}`]:{paddingInlineEnd:X}},[`&-affix-wrapper${$}-affix-wrapper`]:{padding:0,[`> textarea${$}`]:{fontSize:"inherit",border:"none",outline:"none","&:focus":{boxShadow:"none !important"}},[`${$}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${$}-clear-icon`]:{position:"absolute",insetInlineEnd:C.paddingXS,insetBlockStart:C.paddingXS},[`${Y}-suffix`]:{position:"absolute",top:0,insetInlineEnd:C.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}}}}};function M(C){return(0,ue.TS)(C,{inputAffixPadding:C.paddingXXS})}const j=C=>{const{controlHeight:$,fontSize:X,lineHeight:Y,lineWidth:fe,controlHeightSM:ye,controlHeightLG:ae,fontSizeLG:Q,lineHeightLG:R,paddingSM:A,controlPaddingHorizontalSM:L,controlPaddingHorizontal:S,colorFillAlter:G,colorPrimaryHover:P,controlOutlineWidth:p,controlOutline:d,colorErrorOutline:N,colorWarningOutline:V}=C;return{paddingBlock:Math.max(Math.round(($-X*Y)/2*10)/10-fe,3),paddingBlockSM:Math.max(Math.round((ye-X*Y)/2*10)/10-fe,0),paddingBlockLG:Math.ceil((ae-Q*R)/2*10)/10-fe,paddingInline:A-fe,paddingInlineSM:L-fe,paddingInlineLG:S-fe,addonBg:G,activeBorderColor:P,hoverBorderColor:P,activeShadow:`0 0 0 ${p}px ${d}`,errorActiveShadow:`0 0 0 ${p}px ${N}`,warningActiveShadow:`0 0 0 ${p}px ${V}`}};Ie.ZP=(0,J.Z)("Input",C=>{const $=(0,ue.TS)(C,M(C));return[b($),I($),B($),U($),F($),(0,te.c)($)]},j)},8378:function(tt,Ie){"use strict";const O=K=>({[K.componentCls]:{[`${K.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${K.motionDurationMid} ${K.motionEaseInOut},
|
|
opacity ${K.motionDurationMid} ${K.motionEaseInOut} !important`}},[`${K.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${K.motionDurationMid} ${K.motionEaseInOut},
|
|
opacity ${K.motionDurationMid} ${K.motionEaseInOut} !important`}}});Ie.Z=O},92899:function(tt,Ie,O){"use strict";O.d(Ie,{Fm:function(){return v}});var K=O(93083),te=O(95406);const ue=new K.Keyframes("antMoveDownIn",{"0%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),J=new K.Keyframes("antMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0}}),D=new K.Keyframes("antMoveLeftIn",{"0%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),g=new K.Keyframes("antMoveLeftOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),ee=new K.Keyframes("antMoveRightIn",{"0%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),H=new K.Keyframes("antMoveRightOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),l=new K.Keyframes("antMoveUpIn",{"0%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),W=new K.Keyframes("antMoveUpOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0}}),x={"move-up":{inKeyframes:l,outKeyframes:W},"move-down":{inKeyframes:ue,outKeyframes:J},"move-left":{inKeyframes:D,outKeyframes:g},"move-right":{inKeyframes:ee,outKeyframes:H}},v=(_,b)=>{const{antCls:T}=_,B=`${T}-${b}`,{inKeyframes:U,outKeyframes:F}=x[b];return[(0,te.R)(B,U,F,_.motionDurationMid),{[`
|
|
${B}-enter,
|
|
${B}-appear
|
|
`]:{opacity:0,animationTimingFunction:_.motionEaseOutCirc},[`${B}-leave`]:{animationTimingFunction:_.motionEaseInOutCirc}}]}},13826:function(tt,Ie,O){"use strict";O.d(Ie,{Qt:function(){return D},Uw:function(){return J},fJ:function(){return ue},ly:function(){return g},oN:function(){return v}});var K=O(93083),te=O(95406);const ue=new K.Keyframes("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),J=new K.Keyframes("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),D=new K.Keyframes("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),g=new K.Keyframes("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),ee=new K.Keyframes("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),H=new K.Keyframes("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}}),l=new K.Keyframes("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),W=new K.Keyframes("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}}),x={"slide-up":{inKeyframes:ue,outKeyframes:J},"slide-down":{inKeyframes:D,outKeyframes:g},"slide-left":{inKeyframes:ee,outKeyframes:H},"slide-right":{inKeyframes:l,outKeyframes:W}},v=(_,b)=>{const{antCls:T}=_,B=`${T}-${b}`,{inKeyframes:U,outKeyframes:F}=x[b];return[(0,te.R)(B,U,F,_.motionDurationMid),{[`
|
|
${B}-enter,
|
|
${B}-appear
|
|
`]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:_.motionEaseOutQuint,"&-prepare":{transform:"scale(1)"}},[`${B}-leave`]:{animationTimingFunction:_.motionEaseInQuint}}]}},19447:function(tt,Ie,O){"use strict";O.d(Ie,{ZP:function(){return D},fS:function(){return ue},qN:function(){return te}});var K=O(47585);const te=8;function ue(g){const ee=te,{contentRadius:H,limitVerticalRadius:l}=g,W=H>12?H+2:12;return{dropdownArrowOffset:W,dropdownArrowOffsetVertical:l?ee:W}}function J(g,ee){return g?ee:{}}function D(g,ee){const{componentCls:H,sizePopupArrow:l,borderRadiusXS:W,borderRadiusOuter:x,boxShadowPopoverArrow:v}=g,{colorBg:_,contentRadius:b=g.borderRadiusLG,limitVerticalRadius:T,arrowDistance:B=0,arrowPlacement:U={left:!0,right:!0,top:!0,bottom:!0}}=ee,{dropdownArrowOffsetVertical:F,dropdownArrowOffset:I}=ue({contentRadius:b,limitVerticalRadius:T});return{[H]:Object.assign(Object.assign(Object.assign(Object.assign({[`${H}-arrow`]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},(0,K.r)(l,W,x,_,v)),{"&:before":{background:_}})]},J(!!U.top,{[[`&-placement-top ${H}-arrow`,`&-placement-topLeft ${H}-arrow`,`&-placement-topRight ${H}-arrow`].join(",")]:{bottom:B,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top ${H}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},[`&-placement-topLeft ${H}-arrow`]:{left:{_skip_check_:!0,value:I}},[`&-placement-topRight ${H}-arrow`]:{right:{_skip_check_:!0,value:I}}})),J(!!U.bottom,{[[`&-placement-bottom ${H}-arrow`,`&-placement-bottomLeft ${H}-arrow`,`&-placement-bottomRight ${H}-arrow`].join(",")]:{top:B,transform:"translateY(-100%)"},[`&-placement-bottom ${H}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},[`&-placement-bottomLeft ${H}-arrow`]:{left:{_skip_check_:!0,value:I}},[`&-placement-bottomRight ${H}-arrow`]:{right:{_skip_check_:!0,value:I}}})),J(!!U.left,{[[`&-placement-left ${H}-arrow`,`&-placement-leftTop ${H}-arrow`,`&-placement-leftBottom ${H}-arrow`].join(",")]:{right:{_skip_check_:!0,value:B},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left ${H}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop ${H}-arrow`]:{top:F},[`&-placement-leftBottom ${H}-arrow`]:{bottom:F}})),J(!!U.right,{[[`&-placement-right ${H}-arrow`,`&-placement-rightTop ${H}-arrow`,`&-placement-rightBottom ${H}-arrow`].join(",")]:{left:{_skip_check_:!0,value:B},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right ${H}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop ${H}-arrow`]:{top:F},[`&-placement-rightBottom ${H}-arrow`]:{bottom:F}}))}}},47585:function(tt,Ie,O){"use strict";O.d(Ie,{r:function(){return K}});const K=(te,ue,J,D,g)=>{const ee=te/2,H=0,l=ee,W=J*1/Math.sqrt(2),x=ee-J*(1-1/Math.sqrt(2)),v=ee-ue*(1/Math.sqrt(2)),_=J*(Math.sqrt(2)-1)+ue*(1/Math.sqrt(2)),b=2*ee-v,T=_,B=2*ee-W,U=x,F=2*ee-H,I=l,M=ee*Math.sqrt(2)+J*(Math.sqrt(2)-2),j=J*(Math.sqrt(2)-1);return{pointerEvents:"none",width:te,height:te,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:te,height:te/2,background:D,clipPath:{_multi_value_:!0,value:[`polygon(${j}px 100%, 50% ${j}px, ${2*ee-j}px 100%, ${j}px 100%)`,`path('M ${H} ${l} A ${J} ${J} 0 0 0 ${W} ${x} L ${v} ${_} A ${ue} ${ue} 0 0 1 ${b} ${T} L ${B} ${U} A ${J} ${J} 0 0 0 ${F} ${I} Z')`]},content:'""'},"&::after":{content:'""',position:"absolute",width:M,height:M,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${ue}px 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:g,zIndex:0,background:"transparent"}}}},12563:function(tt,Ie,O){"use strict";O.d(Ie,{default:function(){return ae}});var K=O(59301),te=O(99267),ue=O(92310),J=O.n(ue),D=O(36785),g=O(47729),ee=O(14088),H=O(36355),l=O(17313),W=O(37613),x=O(83116);const v=Q=>{const{paddingXXS:R,lineWidth:A,tagPaddingHorizontal:L,componentCls:S}=Q,G=L-A,P=R-A;return{[S]:Object.assign(Object.assign({},(0,l.Wf)(Q)),{display:"inline-block",height:"auto",marginInlineEnd:Q.marginXS,paddingInline:G,fontSize:Q.tagFontSize,lineHeight:Q.tagLineHeight,whiteSpace:"nowrap",background:Q.defaultBg,border:`${Q.lineWidth}px ${Q.lineType} ${Q.colorBorder}`,borderRadius:Q.borderRadiusSM,opacity:1,transition:`all ${Q.motionDurationMid}`,textAlign:"start",position:"relative",[`&${S}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:Q.defaultColor},[`${S}-close-icon`]:{marginInlineStart:P,color:Q.colorTextDescription,fontSize:Q.tagIconSize,cursor:"pointer",transition:`all ${Q.motionDurationMid}`,"&:hover":{color:Q.colorTextHeading}},[`&${S}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${Q.iconCls}-close, ${Q.iconCls}-close:hover`]:{color:Q.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${S}-checkable-checked):hover`]:{color:Q.colorPrimary,backgroundColor:Q.colorFillSecondary},"&:active, &-checked":{color:Q.colorTextLightSolid},"&-checked":{backgroundColor:Q.colorPrimary,"&:hover":{backgroundColor:Q.colorPrimaryHover}},"&:active":{backgroundColor:Q.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${Q.iconCls} + span, > span + ${Q.iconCls}`]:{marginInlineStart:G}}),[`${S}-borderless`]:{borderColor:"transparent",background:Q.tagBorderlessBg}}},_=Q=>{const{lineWidth:R,fontSizeIcon:A}=Q,L=Q.fontSizeSM,S=`${Q.lineHeightSM*L}px`;return(0,W.TS)(Q,{tagFontSize:L,tagLineHeight:S,tagIconSize:A-2*R,tagPaddingHorizontal:8,tagBorderlessBg:Q.colorFillTertiary})},b=Q=>({defaultBg:Q.colorFillQuaternary,defaultColor:Q.colorText});var T=(0,x.Z)("Tag",Q=>{const R=_(Q);return v(R)},b),B=function(Q,R){var A={};for(var L in Q)Object.prototype.hasOwnProperty.call(Q,L)&&R.indexOf(L)<0&&(A[L]=Q[L]);if(Q!=null&&typeof Object.getOwnPropertySymbols=="function")for(var S=0,L=Object.getOwnPropertySymbols(Q);S<L.length;S++)R.indexOf(L[S])<0&&Object.prototype.propertyIsEnumerable.call(Q,L[S])&&(A[L[S]]=Q[L[S]]);return A},F=Q=>{const{prefixCls:R,style:A,className:L,checked:S,onChange:G,onClick:P}=Q,p=B(Q,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:d,tag:N}=K.useContext(H.E_),V=We=>{G==null||G(!S),P==null||P(We)},oe=d("tag",R),[xe,Oe]=T(oe),Me=J()(oe,`${oe}-checkable`,{[`${oe}-checkable-checked`]:S},N==null?void 0:N.className,L,Oe);return xe(K.createElement("span",Object.assign({},p,{style:Object.assign(Object.assign({},A),N==null?void 0:N.style),className:Me,onClick:V})))},I=O(45157);const M=Q=>(0,I.Z)(Q,(R,A)=>{let{textColor:L,lightBorderColor:S,lightColor:G,darkColor:P}=A;return{[`${Q.componentCls}-${R}`]:{color:L,background:G,borderColor:S,"&-inverse":{color:Q.colorTextLightSolid,background:P,borderColor:P},[`&${Q.componentCls}-borderless`]:{borderColor:"transparent"}}}});var j=(0,x.b)(["Tag","preset"],Q=>{const R=_(Q);return M(R)},b);function C(Q){return typeof Q!="string"?Q:Q.charAt(0).toUpperCase()+Q.slice(1)}const $=(Q,R,A)=>{const L=C(A);return{[`${Q.componentCls}-${R}`]:{color:Q[`color${A}`],background:Q[`color${L}Bg`],borderColor:Q[`color${L}Border`],[`&${Q.componentCls}-borderless`]:{borderColor:"transparent"}}}};var X=(0,x.b)(["Tag","status"],Q=>{const R=_(Q);return[$(R,"success","Success"),$(R,"processing","Info"),$(R,"error","Error"),$(R,"warning","Warning")]},b),Y=function(Q,R){var A={};for(var L in Q)Object.prototype.hasOwnProperty.call(Q,L)&&R.indexOf(L)<0&&(A[L]=Q[L]);if(Q!=null&&typeof Object.getOwnPropertySymbols=="function")for(var S=0,L=Object.getOwnPropertySymbols(Q);S<L.length;S++)R.indexOf(L[S])<0&&Object.prototype.propertyIsEnumerable.call(Q,L[S])&&(A[L[S]]=Q[L[S]]);return A};const fe=(Q,R)=>{const{prefixCls:A,className:L,rootClassName:S,style:G,children:P,icon:p,color:d,onClose:N,closeIcon:V,closable:oe,bordered:xe=!0}=Q,Oe=Y(Q,["prefixCls","className","rootClassName","style","children","icon","color","onClose","closeIcon","closable","bordered"]),{getPrefixCls:Me,direction:We,tag:rt}=K.useContext(H.E_),[ft,ze]=K.useState(!0);K.useEffect(()=>{"visible"in Oe&&ze(Oe.visible)},[Oe.visible]);const dt=(0,D.o2)(d),Fe=(0,D.yT)(d),qe=dt||Fe,Wt=Object.assign(Object.assign({backgroundColor:d&&!qe?d:void 0},rt==null?void 0:rt.style),G),it=Me("tag",A),[_e,be]=T(it),ve=J()(it,rt==null?void 0:rt.className,{[`${it}-${d}`]:qe,[`${it}-has-color`]:d&&!qe,[`${it}-hidden`]:!ft,[`${it}-rtl`]:We==="rtl",[`${it}-borderless`]:!xe},L,S,be),Be=ke=>{ke.stopPropagation(),N==null||N(ke),!ke.defaultPrevented&&ze(!1)},[,je]=(0,g.Z)(oe,V,ke=>ke===null?K.createElement(te.Z,{className:`${it}-close-icon`,onClick:Be}):K.createElement("span",{className:`${it}-close-icon`,onClick:Be},ke),null,!1),Z=typeof Oe.onClick=="function"||P&&P.type==="a",se=p||null,de=se?K.createElement(K.Fragment,null,se,P&&K.createElement("span",null,P)):P,we=K.createElement("span",Object.assign({},Oe,{ref:R,className:ve,style:Wt}),de,je,dt&&K.createElement(j,{key:"preset",prefixCls:it}),Fe&&K.createElement(X,{key:"status",prefixCls:it}));return _e(Z?K.createElement(ee.Z,{component:"Tag"},we):we)},ye=K.forwardRef(fe);ye.CheckableTag=F;var ae=ye},33166:function(tt,Ie,O){"use strict";O.d(Ie,{i:function(){return K}});const K=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"]},45157:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return te}});var K=O(33166);function te(ue,J){return K.i.reduce((D,g)=>{const ee=ue[`${g}1`],H=ue[`${g}3`],l=ue[`${g}6`],W=ue[`${g}7`];return Object.assign(Object.assign({},D),J(g,{lightColor:ee,lightBorderColor:H,darkColor:l,textColor:W}))},{})}},6848:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return ae}});var K=O(59301),te=O(92310),ue=O.n(te),J=O(55477),D=O(18929),g=O(62892),ee=O(79676),H=O(92343),l=O(36355),W=O(33234),x=O(88088),v=O(17313),_=O(29878),b=O(19447),T=O(45157),B=O(37613),U=O(83116);const F=Q=>{const{componentCls:R,tooltipMaxWidth:A,tooltipColor:L,tooltipBg:S,tooltipBorderRadius:G,zIndexPopup:P,controlHeight:p,boxShadowSecondary:d,paddingSM:N,paddingXS:V,tooltipRadiusOuter:oe}=Q;return[{[R]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,v.Wf)(Q)),{position:"absolute",zIndex:P,display:"block",width:"max-content",maxWidth:A,visibility:"visible",transformOrigin:"var(--arrow-x, 50%) var(--arrow-y, 50%)","&-hidden":{display:"none"},"--antd-arrow-background-color":S,[`${R}-inner`]:{minWidth:p,minHeight:p,padding:`${N/2}px ${V}px`,color:L,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:S,borderRadius:G,boxShadow:d,boxSizing:"border-box"},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${R}-inner`]:{borderRadius:Math.min(G,b.qN)}},[`${R}-content`]:{position:"relative"}}),(0,T.Z)(Q,(xe,Oe)=>{let{darkColor:Me}=Oe;return{[`&${R}-${xe}`]:{[`${R}-inner`]:{backgroundColor:Me},[`${R}-arrow`]:{"--antd-arrow-background-color":Me}}}})),{"&-rtl":{direction:"rtl"}})},(0,b.ZP)((0,B.TS)(Q,{borderRadiusOuter:oe}),{colorBg:"var(--antd-arrow-background-color)",contentRadius:G,limitVerticalRadius:!0}),{[`${R}-pure`]:{position:"relative",maxWidth:"none",margin:Q.sizePopupArrow}}]};var I=(Q,R)=>(0,U.Z)("Tooltip",L=>{if(R===!1)return[];const{borderRadius:S,colorTextLightSolid:G,colorBgDefault:P,borderRadiusOuter:p}=L,d=(0,B.TS)(L,{tooltipMaxWidth:250,tooltipColor:G,tooltipBorderRadius:S,tooltipBg:P,tooltipRadiusOuter:p>4?4:p});return[F(d),(0,_._y)(L,"zoom-big-fast")]},L=>{let{zIndexPopupBase:S,colorBgSpotlight:G}=L;return{zIndexPopup:S+70,colorBgDefault:G}},{resetStyle:!1})(Q),M=O(36785);function j(Q,R){const A=(0,M.o2)(R),L=ue()({[`${Q}-${R}`]:R&&A}),S={},G={};return R&&!A&&(S.background=R,G["--antd-arrow-background-color"]=R),{className:L,overlayStyle:S,arrowStyle:G}}var $=Q=>{const{prefixCls:R,className:A,placement:L="top",title:S,color:G,overlayInnerStyle:P}=Q,{getPrefixCls:p}=K.useContext(l.E_),d=p("tooltip",R),[N,V]=I(d,!0),oe=j(d,G),xe=oe.arrowStyle,Oe=Object.assign(Object.assign({},P),oe.overlayStyle),Me=ue()(V,d,`${d}-pure`,`${d}-placement-${L}`,A,oe.className);return N(K.createElement("div",{className:Me,style:xe},K.createElement("div",{className:`${d}-arrow`}),K.createElement(J.G,Object.assign({},Q,{className:V,prefixCls:d,overlayInnerStyle:Oe}),S)))},X=function(Q,R){var A={};for(var L in Q)Object.prototype.hasOwnProperty.call(Q,L)&&R.indexOf(L)<0&&(A[L]=Q[L]);if(Q!=null&&typeof Object.getOwnPropertySymbols=="function")for(var S=0,L=Object.getOwnPropertySymbols(Q);S<L.length;S++)R.indexOf(L[S])<0&&Object.prototype.propertyIsEnumerable.call(Q,L[S])&&(A[L[S]]=Q[L[S]]);return A};const Y=(Q,R)=>{const A={},L=Object.assign({},Q);return R.forEach(S=>{Q&&S in Q&&(A[S]=Q[S],delete L[S])}),{picked:A,omitted:L}};function fe(Q,R){const A=Q.type;if((A.__ANT_BUTTON===!0||Q.type==="button")&&Q.props.disabled||A.__ANT_SWITCH===!0&&(Q.props.disabled||Q.props.loading)||A.__ANT_RADIO===!0&&Q.props.disabled){const{picked:L,omitted:S}=Y(Q.props.style,["position","left","right","top","bottom","float","display","zIndex"]),G=Object.assign(Object.assign({display:"inline-block"},L),{cursor:"not-allowed",width:Q.props.block?"100%":void 0}),P=Object.assign(Object.assign({},S),{pointerEvents:"none"}),p=(0,H.Tm)(Q,{style:P,className:null});return K.createElement("span",{style:G,className:ue()(Q.props.className,`${R}-disabled-compatible-wrapper`)},p)}return Q}const ye=K.forwardRef((Q,R)=>{var A,L;const{prefixCls:S,openClassName:G,getTooltipContainer:P,overlayClassName:p,color:d,overlayInnerStyle:N,children:V,afterOpenChange:oe,afterVisibleChange:xe,destroyTooltipOnHide:Oe,arrow:Me=!0,title:We,overlay:rt,builtinPlacements:ft,arrowPointAtCenter:ze=!1,autoAdjustOverflow:dt=!0}=Q,Fe=!!Me,[,qe]=(0,x.Z)(),{getPopupContainer:Wt,getPrefixCls:it,direction:_e}=K.useContext(l.E_),be=K.useRef(null),ve=()=>{var gt;(gt=be.current)===null||gt===void 0||gt.forceAlign()};K.useImperativeHandle(R,()=>({forceAlign:ve,forcePopupAlign:()=>{ve()}}));const[Be,je]=(0,D.Z)(!1,{value:(A=Q.open)!==null&&A!==void 0?A:Q.visible,defaultValue:(L=Q.defaultOpen)!==null&&L!==void 0?L:Q.defaultVisible}),Z=!We&&!rt&&We!==0,se=gt=>{var nt,xt;je(Z?!1:gt),Z||((nt=Q.onOpenChange)===null||nt===void 0||nt.call(Q,gt),(xt=Q.onVisibleChange)===null||xt===void 0||xt.call(Q,gt))},de=K.useMemo(()=>{var gt,nt;let xt=ze;return typeof Me=="object"&&(xt=(nt=(gt=Me.pointAtCenter)!==null&>!==void 0?gt:Me.arrowPointAtCenter)!==null&&nt!==void 0?nt:ze),ft||(0,ee.Z)({arrowPointAtCenter:xt,autoAdjustOverflow:dt,arrowWidth:Fe?qe.sizePopupArrow:0,borderRadius:qe.borderRadius,offset:qe.marginXXS,visibleFirst:!0})},[ze,Me,ft,qe]),we=K.useMemo(()=>We===0?We:rt||We||"",[rt,We]),ke=K.createElement(W.BR,null,typeof we=="function"?we():we),{getPopupContainer:Ze,placement:ot="top",mouseEnterDelay:pt=.1,mouseLeaveDelay:st=.1,overlayStyle:Rt,rootClassName:Ut}=Q,ct=X(Q,["getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName"]),Ct=it("tooltip",S),Ot=it(),Mt=Q["data-popover-inject"];let Xe=Be;!("open"in Q)&&!("visible"in Q)&&Z&&(Xe=!1);const xi=fe((0,H.l$)(V)&&!(0,H.M2)(V)?V:K.createElement("span",null,V),Ct),bt=xi.props,Le=!bt.className||typeof bt.className=="string"?ue()(bt.className,G||`${Ct}-open`):bt.className,[Ne,Ke]=I(Ct,!Mt),Nt=j(Ct,d),lt=Nt.arrowStyle,Et=Object.assign(Object.assign({},N),Nt.overlayStyle),kt=ue()(p,{[`${Ct}-rtl`]:_e==="rtl"},Nt.className,Ut,Ke);return Ne(K.createElement(J.Z,Object.assign({},ct,{showArrow:Fe,placement:ot,mouseEnterDelay:pt,mouseLeaveDelay:st,prefixCls:Ct,overlayClassName:kt,overlayStyle:Object.assign(Object.assign({},lt),Rt),getTooltipContainer:Ze||P||Wt,ref:be,builtinPlacements:de,overlay:ke,visible:Xe,onVisibleChange:se,afterVisibleChange:oe!=null?oe:xe,overlayInnerStyle:Et,arrowContent:K.createElement("span",{className:`${Ct}-arrow-content`}),motion:{motionName:(0,g.m)(Ot,"zoom-big-fast",Q.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!Oe}),Xe?(0,H.Tm)(xi,{className:Le}):xi))});ye._InternalPanelDoNotUseOrYouWillBeFired=$;var ae=ye},25769:function(tt,Ie,O){"use strict";var K=O(98040),te={"text/plain":"Text","text/html":"Url",default:"Text"},ue="Copy to clipboard: #{key}, Enter";function J(g){var ee=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return g.replace(/#{\s*key\s*}/g,ee)}function D(g,ee){var H,l,W,x,v,_,b=!1;ee||(ee={}),H=ee.debug||!1;try{W=K(),x=document.createRange(),v=document.getSelection(),_=document.createElement("span"),_.textContent=g,_.ariaHidden="true",_.style.all="unset",_.style.position="fixed",_.style.top=0,_.style.clip="rect(0, 0, 0, 0)",_.style.whiteSpace="pre",_.style.webkitUserSelect="text",_.style.MozUserSelect="text",_.style.msUserSelect="text",_.style.userSelect="text",_.addEventListener("copy",function(B){if(B.stopPropagation(),ee.format)if(B.preventDefault(),typeof B.clipboardData=="undefined"){H&&console.warn("unable to use e.clipboardData"),H&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var U=te[ee.format]||te.default;window.clipboardData.setData(U,g)}else B.clipboardData.clearData(),B.clipboardData.setData(ee.format,g);ee.onCopy&&(B.preventDefault(),ee.onCopy(B.clipboardData))}),document.body.appendChild(_),x.selectNodeContents(_),v.addRange(x);var T=document.execCommand("copy");if(!T)throw new Error("copy command was unsuccessful");b=!0}catch(B){H&&console.error("unable to copy using execCommand: ",B),H&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ee.format||"text",g),ee.onCopy&&ee.onCopy(window.clipboardData),b=!0}catch(U){H&&console.error("unable to copy using clipboardData: ",U),H&&console.error("falling back to prompt"),l=J("message"in ee?ee.message:ue),window.prompt(l,g)}}finally{v&&(typeof v.removeRange=="function"?v.removeRange(x):v.removeAllRanges()),_&&document.body.removeChild(_),W()}return b}tt.exports=D},53184:function(tt,Ie,O){"use strict";var K,te;function ue(J,D,g){var ee=function(H,l){return J.js_beautify(H,l)};return ee.js=J.js_beautify,ee.css=D.css_beautify,ee.html=g.html_beautify,ee.js_beautify=J.js_beautify,ee.css_beautify=D.css_beautify,ee.html_beautify=g.html_beautify,ee}K=[O(58553),O(87804),O(40998)],te=function(J,D,g){return ue(J,D,g)}.apply(Ie,K),te!==void 0&&(tt.exports=te)},87804:function(tt,Ie){var O,K;(function(){var te;(function(){"use strict";var J=[,,function(H){function l(v){this.__parent=v,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var v=new l(this.__parent);return v.set_indent(this.__indent_count,this.__alignment_count),v},l.prototype.item=function(v){return v<0?this.__items[this.__items.length+v]:this.__items[v]},l.prototype.has_match=function(v){for(var _=this.__items.length-1;_>=0;_--)if(this.__items[_].match(v))return!0;return!1},l.prototype.set_indent=function(v,_){this.is_empty()&&(this.__indent_count=v||0,this.__alignment_count=_||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},l.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var v=this.__parent.current_line;return v.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),v.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),v.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,v.__items[0]===" "&&(v.__items.splice(0,1),v.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(v){this.__items.push(v);var _=v.lastIndexOf(`
|
|
`);_!==-1?this.__character_count=v.length-_:this.__character_count+=v.length},l.prototype.pop=function(){var v=null;return this.is_empty()||(v=this.__items.pop(),this.__character_count-=v.length),v},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var v="";return this.is_empty()?this.__parent.indent_empty_lines&&(v=this.__parent.get_indent_string(this.__indent_count)):(v=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),v+=this.__items.join("")),v};function W(v,_){this.__cache=[""],this.__indent_size=v.indent_size,this.__indent_string=v.indent_char,v.indent_with_tabs||(this.__indent_string=new Array(v.indent_size+1).join(v.indent_char)),_=_||"",v.indent_level>0&&(_=new Array(v.indent_level+1).join(this.__indent_string)),this.__base_string=_,this.__base_string_length=_.length}W.prototype.get_indent_size=function(v,_){var b=this.__base_string_length;return _=_||0,v<0&&(b=0),b+=v*this.__indent_size,b+=_,b},W.prototype.get_indent_string=function(v,_){var b=this.__base_string;return _=_||0,v<0&&(v=0,b=""),_+=v*this.__indent_size,this.__ensure_cache(_),b+=this.__cache[_],b},W.prototype.__ensure_cache=function(v){for(;v>=this.__cache.length;)this.__add_column()},W.prototype.__add_column=function(){var v=this.__cache.length,_=0,b="";this.__indent_size&&v>=this.__indent_size&&(_=Math.floor(v/this.__indent_size),v-=_*this.__indent_size,b=new Array(_+1).join(this.__indent_string)),v&&(b+=new Array(v+1).join(" ")),this.__cache.push(b)};function x(v,_){this.__indent_cache=new W(v,_),this.raw=!1,this._end_with_newline=v.end_with_newline,this.indent_size=v.indent_size,this.wrap_line_length=v.wrap_line_length,this.indent_empty_lines=v.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}x.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},x.prototype.get_line_number=function(){return this.__lines.length},x.prototype.get_indent_string=function(v,_){return this.__indent_cache.get_indent_string(v,_)},x.prototype.get_indent_size=function(v,_){return this.__indent_cache.get_indent_size(v,_)},x.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},x.prototype.add_new_line=function(v){return this.is_empty()||!v&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},x.prototype.get_code=function(v){this.trim(!0);var _=this.current_line.pop();_&&(_[_.length-1]===`
|
|
`&&(_=_.replace(/\n+$/g,"")),this.current_line.push(_)),this._end_with_newline&&this.__add_outputline();var b=this.__lines.join(`
|
|
`);return v!==`
|
|
`&&(b=b.replace(/[\n]/g,v)),b},x.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},x.prototype.set_indent=function(v,_){return v=v||0,_=_||0,this.next_line.set_indent(v,_),this.__lines.length>1?(this.current_line.set_indent(v,_),!0):(this.current_line.set_indent(),!1)},x.prototype.add_raw_token=function(v){for(var _=0;_<v.newlines;_++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(v.whitespace_before),this.current_line.push(v.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},x.prototype.add_token=function(v){this.__add_space_before_token(),this.current_line.push(v),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},x.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},x.prototype.remove_indent=function(v){for(var _=this.__lines.length;v<_;)this.__lines[v]._remove_indent(),v++;this.current_line._remove_wrap_indent()},x.prototype.trim=function(v){for(v=v===void 0?!1:v,this.current_line.trim();v&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},x.prototype.just_added_newline=function(){return this.current_line.is_empty()},x.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},x.prototype.ensure_empty_line_above=function(v,_){for(var b=this.__lines.length-2;b>=0;){var T=this.__lines[b];if(T.is_empty())break;if(T.item(0).indexOf(v)!==0&&T.item(-1)!==_){this.__lines.splice(b+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}b--}},H.exports.Output=x},,,,function(H){function l(v,_){this.raw_options=W(v,_),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(v,_){var b=this.raw_options[v],T=_||[];return typeof b=="object"?b!==null&&typeof b.concat=="function"&&(T=b.concat()):typeof b=="string"&&(T=b.split(/[^a-zA-Z0-9_\/\-]+/)),T},l.prototype._get_boolean=function(v,_){var b=this.raw_options[v],T=b===void 0?!!_:!!b;return T},l.prototype._get_characters=function(v,_){var b=this.raw_options[v],T=_||"";return typeof b=="string"&&(T=b.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),T},l.prototype._get_number=function(v,_){var b=this.raw_options[v];_=parseInt(_,10),isNaN(_)&&(_=0);var T=parseInt(b,10);return isNaN(T)&&(T=_),T},l.prototype._get_selection=function(v,_,b){var T=this._get_selection_list(v,_,b);if(T.length!==1)throw new Error("Invalid Option Value: The option '"+v+`' can only be one of the following values:
|
|
`+_+`
|
|
You passed in: '`+this.raw_options[v]+"'");return T[0]},l.prototype._get_selection_list=function(v,_,b){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(b=b||[_[0]],!this._is_valid_selection(b,_))throw new Error("Invalid Default Value!");var T=this._get_array(v,b);if(!this._is_valid_selection(T,_))throw new Error("Invalid Option Value: The option '"+v+`' can contain only the following values:
|
|
`+_+`
|
|
You passed in: '`+this.raw_options[v]+"'");return T},l.prototype._is_valid_selection=function(v,_){return v.length&&_.length&&!v.some(function(b){return _.indexOf(b)===-1})};function W(v,_){var b={};v=x(v);var T;for(T in v)T!==_&&(b[T]=v[T]);if(_&&v[_])for(T in v[_])b[T]=v[_][T];return b}function x(v){var _={},b;for(b in v){var T=b.replace(/-/g,"_");_[T]=v[b]}return _}H.exports.Options=l,H.exports.normalizeOpts=x,H.exports.mergeOpts=W},,function(H){var l=RegExp.prototype.hasOwnProperty("sticky");function W(x){this.__input=x||"",this.__input_length=this.__input.length,this.__position=0}W.prototype.restart=function(){this.__position=0},W.prototype.back=function(){this.__position>0&&(this.__position-=1)},W.prototype.hasNext=function(){return this.__position<this.__input_length},W.prototype.next=function(){var x=null;return this.hasNext()&&(x=this.__input.charAt(this.__position),this.__position+=1),x},W.prototype.peek=function(x){var v=null;return x=x||0,x+=this.__position,x>=0&&x<this.__input_length&&(v=this.__input.charAt(x)),v},W.prototype.__match=function(x,v){x.lastIndex=v;var _=x.exec(this.__input);return _&&!(l&&x.sticky)&&_.index!==v&&(_=null),_},W.prototype.test=function(x,v){return v=v||0,v+=this.__position,v>=0&&v<this.__input_length?!!this.__match(x,v):!1},W.prototype.testChar=function(x,v){var _=this.peek(v);return x.lastIndex=0,_!==null&&x.test(_)},W.prototype.match=function(x){var v=this.__match(x,this.__position);return v?this.__position+=v[0].length:v=null,v},W.prototype.read=function(x,v,_){var b="",T;return x&&(T=this.match(x),T&&(b+=T[0])),v&&(T||!x)&&(b+=this.readUntil(v,_)),b},W.prototype.readUntil=function(x,v){var _="",b=this.__position;x.lastIndex=this.__position;var T=x.exec(this.__input);return T?(b=T.index,v&&(b+=T[0].length)):b=this.__input_length,_=this.__input.substring(this.__position,b),this.__position=b,_},W.prototype.readUntilAfter=function(x){return this.readUntil(x,!0)},W.prototype.get_regexp=function(x,v){var _=null,b="g";return v&&l&&(b="y"),typeof x=="string"&&x!==""?_=new RegExp(x,b):x&&(_=new RegExp(x.source,b)),_},W.prototype.get_literal_regexp=function(x){return RegExp(x.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},W.prototype.peekUntilAfter=function(x){var v=this.__position,_=this.readUntilAfter(x);return this.__position=v,_},W.prototype.lookBack=function(x){var v=this.__position-1;return v>=x.length&&this.__input.substring(v-x.length,v).toLowerCase()===x},H.exports.InputScanner=W},,,,,function(H){function l(W,x){W=typeof W=="string"?W:W.source,x=typeof x=="string"?x:x.source,this.__directives_block_pattern=new RegExp(W+/ beautify( \w+[:]\w+)+ /.source+x,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(W+/\sbeautify\signore:end\s/.source+x,"g")}l.prototype.get_directives=function(W){if(!W.match(this.__directives_block_pattern))return null;var x={};this.__directive_pattern.lastIndex=0;for(var v=this.__directive_pattern.exec(W);v;)x[v[1]]=v[2],v=this.__directive_pattern.exec(W);return x},l.prototype.readIgnored=function(W){return W.readUntilAfter(this.__directives_end_ignore_pattern)},H.exports.Directives=l},,function(H,l,W){var x=W(16).Beautifier,v=W(17).Options;function _(b,T){var B=new x(b,T);return B.beautify()}H.exports=_,H.exports.defaultOptions=function(){return new v}},function(H,l,W){var x=W(17).Options,v=W(2).Output,_=W(8).InputScanner,b=W(13).Directives,T=new b(/\/\*/,/\*\//),B=/\r\n|[\r\n]/,U=/\r\n|[\r\n]/g,F=/\s/,I=/(?:\s|\n)+/g,M=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,j=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function C($,X){this._source_text=$||"",this._options=new x(X),this._ch=null,this._input=null,this.NESTED_AT_RULE={page:!0,"font-face":!0,keyframes:!0,media:!0,supports:!0,document:!0},this.CONDITIONAL_GROUP_RULE={media:!0,supports:!0,document:!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}C.prototype.eatString=function($){var X="";for(this._ch=this._input.next();this._ch;){if(X+=this._ch,this._ch==="\\")X+=this._input.next();else if($.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return X},C.prototype.eatWhitespace=function($){for(var X=F.test(this._input.peek()),Y=0;F.test(this._input.peek());)this._ch=this._input.next(),$&&this._ch===`
|
|
`&&(Y===0||Y<this._options.max_preserve_newlines)&&(Y++,this._output.add_new_line(!0));return X},C.prototype.foundNestedPseudoClass=function(){for(var $=0,X=1,Y=this._input.peek(X);Y;){if(Y==="{")return!0;if(Y==="(")$+=1;else if(Y===")"){if($===0)return!1;$-=1}else if(Y===";"||Y==="}")return!1;X++,Y=this._input.peek(X)}return!1},C.prototype.print_string=function($){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token($)},C.prototype.preserveSingleSpace=function($){$&&(this._output.space_before_token=!0)},C.prototype.indent=function(){this._indentLevel++},C.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},C.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var $=this._source_text,X=this._options.eol;X==="auto"&&(X=`
|
|
`,$&&B.test($||"")&&(X=$.match(B)[0])),$=$.replace(U,`
|
|
`);var Y=$.match(/^[\t ]*/)[0];this._output=new v(this._options,Y),this._input=new _($),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var fe=0,ye=!1,ae=!1,Q=!1,R=!1,A=!1,L=this._ch,S=!1,G,P,p;G=this._input.read(I),P=G!=="",p=L,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),L=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var d=this._input.read(M),N=T.get_directives(d);N&&N.ignore==="start"&&(d+=T.readIgnored(this._input)),this.print_string(d),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(j)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(P),this.print_string(this._ch);var V=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);V.match(/[ :]$/)&&(V=this.eatString(": ").replace(/\s+$/,""),this.print_string(V),this._output.space_before_token=!0),fe===0&&V.indexOf(":")!==-1&&(ae=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(P),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var oe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);oe.match(/[ :]$/)&&(oe=this.eatString(": ").replace(/\s+$/,""),this.print_string(oe),this._output.space_before_token=!0),fe===0&&oe.indexOf(":")!==-1?(ae=!0,this.indent()):oe in this.NESTED_AT_RULE?(this._nestedLevel+=1,oe in this.CONDITIONAL_GROUP_RULE&&(Q=!0)):fe===0&&!ae&&(R=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(P),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")ae&&(ae=!1,this.outdent()),R=!1,Q?(Q=!1,ye=this._indentLevel>=this._nestedLevel):ye=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&ye&&this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(p==="("?this._output.space_before_token=!1:p!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),p==="{"&&this._output.trim(!0),ae&&(this.outdent(),ae=!1),this.print_string(this._ch),ye=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&this._input.peek()!=="}"&&this._output.add_new_line(!0),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var xe=0;xe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;xe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[xe])){S=!0;break}(ye||Q)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!R&&fe===0?(this.print_string(":"),ae||(ae=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Oe=p==='"'||p==="'";this.preserveSingleSpace(Oe||P),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")S=!1,fe===0?(ae&&(this.outdent(),ae=!1),R=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),fe++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),fe&&(fe--,this.outdent()));else{var Me=!1;this._input.lookBack("with")&&(Me=!0),this.preserveSingleSpace(P||Me),this.print_string(this._ch),ae&&p==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),A=!0):(this.eatWhitespace(),fe++,this.indent())}else if(this._ch===")")fe&&(fe--,this.outdent()),A&&this._input.peek()===";"&&this._options.selector_separator_newline&&(A=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!ae||A)&&fe===0&&!R?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!ae&&fe===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&F.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(P),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),F.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var We=p==='"'||p==="'";this.preserveSingleSpace(We||P),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&S&&this._output.add_new_line()}var rt=this._output.get_code(X);return rt},H.exports.Beautifier=C},function(H,l,W){var x=W(6).Options;function v(_){x.call(this,_,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var b=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||b;var T=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var B=0;B<T.length;B++)T[B]!=="expand"?this.brace_style="collapse":this.brace_style=T[B]}v.prototype=new x,H.exports.Options=v}],D={};function g(H){var l=D[H];if(l!==void 0)return l.exports;var W=D[H]={exports:{}};return J[H](W,W.exports,g),W.exports}var ee=g(15);te=ee})();var ue=te;O=[],K=function(){return{css_beautify:ue}}.apply(Ie,O),K!==void 0&&(tt.exports=K)})()},40998:function(tt,Ie,O){var K,te;(function(){var ue;(function(){"use strict";var ee=[,,function(x){function v(T){this.__parent=T,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}v.prototype.clone_empty=function(){var T=new v(this.__parent);return T.set_indent(this.__indent_count,this.__alignment_count),T},v.prototype.item=function(T){return T<0?this.__items[this.__items.length+T]:this.__items[T]},v.prototype.has_match=function(T){for(var B=this.__items.length-1;B>=0;B--)if(this.__items[B].match(T))return!0;return!1},v.prototype.set_indent=function(T,B){this.is_empty()&&(this.__indent_count=T||0,this.__alignment_count=B||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},v.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},v.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},v.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var T=this.__parent.current_line;return T.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),T.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),T.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,T.__items[0]===" "&&(T.__items.splice(0,1),T.__character_count-=1),!0}return!1},v.prototype.is_empty=function(){return this.__items.length===0},v.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},v.prototype.push=function(T){this.__items.push(T);var B=T.lastIndexOf(`
|
|
`);B!==-1?this.__character_count=T.length-B:this.__character_count+=T.length},v.prototype.pop=function(){var T=null;return this.is_empty()||(T=this.__items.pop(),this.__character_count-=T.length),T},v.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},v.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},v.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},v.prototype.toString=function(){var T="";return this.is_empty()?this.__parent.indent_empty_lines&&(T=this.__parent.get_indent_string(this.__indent_count)):(T=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),T+=this.__items.join("")),T};function _(T,B){this.__cache=[""],this.__indent_size=T.indent_size,this.__indent_string=T.indent_char,T.indent_with_tabs||(this.__indent_string=new Array(T.indent_size+1).join(T.indent_char)),B=B||"",T.indent_level>0&&(B=new Array(T.indent_level+1).join(this.__indent_string)),this.__base_string=B,this.__base_string_length=B.length}_.prototype.get_indent_size=function(T,B){var U=this.__base_string_length;return B=B||0,T<0&&(U=0),U+=T*this.__indent_size,U+=B,U},_.prototype.get_indent_string=function(T,B){var U=this.__base_string;return B=B||0,T<0&&(T=0,U=""),B+=T*this.__indent_size,this.__ensure_cache(B),U+=this.__cache[B],U},_.prototype.__ensure_cache=function(T){for(;T>=this.__cache.length;)this.__add_column()},_.prototype.__add_column=function(){var T=this.__cache.length,B=0,U="";this.__indent_size&&T>=this.__indent_size&&(B=Math.floor(T/this.__indent_size),T-=B*this.__indent_size,U=new Array(B+1).join(this.__indent_string)),T&&(U+=new Array(T+1).join(" ")),this.__cache.push(U)};function b(T,B){this.__indent_cache=new _(T,B),this.raw=!1,this._end_with_newline=T.end_with_newline,this.indent_size=T.indent_size,this.wrap_line_length=T.wrap_line_length,this.indent_empty_lines=T.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new v(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}b.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},b.prototype.get_line_number=function(){return this.__lines.length},b.prototype.get_indent_string=function(T,B){return this.__indent_cache.get_indent_string(T,B)},b.prototype.get_indent_size=function(T,B){return this.__indent_cache.get_indent_size(T,B)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(T){return this.is_empty()||!T&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(T){this.trim(!0);var B=this.current_line.pop();B&&(B[B.length-1]===`
|
|
`&&(B=B.replace(/\n+$/g,"")),this.current_line.push(B)),this._end_with_newline&&this.__add_outputline();var U=this.__lines.join(`
|
|
`);return T!==`
|
|
`&&(U=U.replace(/[\n]/g,T)),U},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(T,B){return T=T||0,B=B||0,this.next_line.set_indent(T,B),this.__lines.length>1?(this.current_line.set_indent(T,B),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(T){for(var B=0;B<T.newlines;B++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(T.whitespace_before),this.current_line.push(T.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},b.prototype.add_token=function(T){this.__add_space_before_token(),this.current_line.push(T),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},b.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},b.prototype.remove_indent=function(T){for(var B=this.__lines.length;T<B;)this.__lines[T]._remove_indent(),T++;this.current_line._remove_wrap_indent()},b.prototype.trim=function(T){for(T=T===void 0?!1:T,this.current_line.trim();T&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},b.prototype.just_added_newline=function(){return this.current_line.is_empty()},b.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},b.prototype.ensure_empty_line_above=function(T,B){for(var U=this.__lines.length-2;U>=0;){var F=this.__lines[U];if(F.is_empty())break;if(F.item(0).indexOf(T)!==0&&F.item(-1)!==B){this.__lines.splice(U+1,0,new v(this)),this.previous_line=this.__lines[this.__lines.length-2];break}U--}},x.exports.Output=b},function(x){function v(_,b,T,B){this.type=_,this.text=b,this.comments_before=null,this.newlines=T||0,this.whitespace_before=B||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}x.exports.Token=v},,,function(x){function v(T,B){this.raw_options=_(T,B),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}v.prototype._get_array=function(T,B){var U=this.raw_options[T],F=B||[];return typeof U=="object"?U!==null&&typeof U.concat=="function"&&(F=U.concat()):typeof U=="string"&&(F=U.split(/[^a-zA-Z0-9_\/\-]+/)),F},v.prototype._get_boolean=function(T,B){var U=this.raw_options[T],F=U===void 0?!!B:!!U;return F},v.prototype._get_characters=function(T,B){var U=this.raw_options[T],F=B||"";return typeof U=="string"&&(F=U.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),F},v.prototype._get_number=function(T,B){var U=this.raw_options[T];B=parseInt(B,10),isNaN(B)&&(B=0);var F=parseInt(U,10);return isNaN(F)&&(F=B),F},v.prototype._get_selection=function(T,B,U){var F=this._get_selection_list(T,B,U);if(F.length!==1)throw new Error("Invalid Option Value: The option '"+T+`' can only be one of the following values:
|
|
`+B+`
|
|
You passed in: '`+this.raw_options[T]+"'");return F[0]},v.prototype._get_selection_list=function(T,B,U){if(!B||B.length===0)throw new Error("Selection list cannot be empty.");if(U=U||[B[0]],!this._is_valid_selection(U,B))throw new Error("Invalid Default Value!");var F=this._get_array(T,U);if(!this._is_valid_selection(F,B))throw new Error("Invalid Option Value: The option '"+T+`' can contain only the following values:
|
|
`+B+`
|
|
You passed in: '`+this.raw_options[T]+"'");return F},v.prototype._is_valid_selection=function(T,B){return T.length&&B.length&&!T.some(function(U){return B.indexOf(U)===-1})};function _(T,B){var U={};T=b(T);var F;for(F in T)F!==B&&(U[F]=T[F]);if(B&&T[B])for(F in T[B])U[F]=T[B][F];return U}function b(T){var B={},U;for(U in T){var F=U.replace(/-/g,"_");B[F]=T[U]}return B}x.exports.Options=v,x.exports.normalizeOpts=b,x.exports.mergeOpts=_},,function(x){var v=RegExp.prototype.hasOwnProperty("sticky");function _(b){this.__input=b||"",this.__input_length=this.__input.length,this.__position=0}_.prototype.restart=function(){this.__position=0},_.prototype.back=function(){this.__position>0&&(this.__position-=1)},_.prototype.hasNext=function(){return this.__position<this.__input_length},_.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},_.prototype.peek=function(b){var T=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(T=this.__input.charAt(b)),T},_.prototype.__match=function(b,T){b.lastIndex=T;var B=b.exec(this.__input);return B&&!(v&&b.sticky)&&B.index!==T&&(B=null),B},_.prototype.test=function(b,T){return T=T||0,T+=this.__position,T>=0&&T<this.__input_length?!!this.__match(b,T):!1},_.prototype.testChar=function(b,T){var B=this.peek(T);return b.lastIndex=0,B!==null&&b.test(B)},_.prototype.match=function(b){var T=this.__match(b,this.__position);return T?this.__position+=T[0].length:T=null,T},_.prototype.read=function(b,T,B){var U="",F;return b&&(F=this.match(b),F&&(U+=F[0])),T&&(F||!b)&&(U+=this.readUntil(T,B)),U},_.prototype.readUntil=function(b,T){var B="",U=this.__position;b.lastIndex=this.__position;var F=b.exec(this.__input);return F?(U=F.index,T&&(U+=F[0].length)):U=this.__input_length,B=this.__input.substring(this.__position,U),this.__position=U,B},_.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},_.prototype.get_regexp=function(b,T){var B=null,U="g";return T&&v&&(U="y"),typeof b=="string"&&b!==""?B=new RegExp(b,U):b&&(B=new RegExp(b.source,U)),B},_.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},_.prototype.peekUntilAfter=function(b){var T=this.__position,B=this.readUntilAfter(b);return this.__position=T,B},_.prototype.lookBack=function(b){var T=this.__position-1;return T>=b.length&&this.__input.substring(T-b.length,T).toLowerCase()===b},x.exports.InputScanner=_},function(x,v,_){var b=_(8).InputScanner,T=_(3).Token,B=_(10).TokenStream,U=_(11).WhitespacePattern,F={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},I=function(M,j){this._input=new b(M),this._options=j||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new U(this._input)};I.prototype.tokenize=function(){this._input.restart(),this.__tokens=new B,this._reset();for(var M,j=new T(F.START,""),C=null,$=[],X=new B;j.type!==F.EOF;){for(M=this._get_next_token(j,C);this._is_comment(M);)X.add(M),M=this._get_next_token(j,C);X.isEmpty()||(M.comments_before=X,X=new B),M.parent=C,this._is_opening(M)?($.push(C),C=M):C&&this._is_closing(M,C)&&(M.opened=C,C.closed=M,C=$.pop(),M.parent=C),M.previous=j,j.next=M,this.__tokens.add(M),j=M}return this.__tokens},I.prototype._is_first_token=function(){return this.__tokens.isEmpty()},I.prototype._reset=function(){},I.prototype._get_next_token=function(M,j){this._readWhitespace();var C=this._input.read(/.+/g);return C?this._create_token(F.RAW,C):this._create_token(F.EOF,"")},I.prototype._is_comment=function(M){return!1},I.prototype._is_opening=function(M){return!1},I.prototype._is_closing=function(M,j){return!1},I.prototype._create_token=function(M,j){var C=new T(M,j,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return C},I.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},x.exports.Tokenizer=I,x.exports.TOKEN=F},function(x){function v(_){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=_}v.prototype.restart=function(){this.__position=0},v.prototype.isEmpty=function(){return this.__tokens_length===0},v.prototype.hasNext=function(){return this.__position<this.__tokens_length},v.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__tokens[this.__position],this.__position+=1),_},v.prototype.peek=function(_){var b=null;return _=_||0,_+=this.__position,_>=0&&_<this.__tokens_length&&(b=this.__tokens[_]),b},v.prototype.add=function(_){this.__parent_token&&(_.parent=this.__parent_token),this.__tokens.push(_),this.__tokens_length+=1},x.exports.TokenStream=v},function(x,v,_){var b=_(12).Pattern;function T(B,U){b.call(this,B,U),U?this._line_regexp=this._input.get_regexp(U._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}T.prototype=new b,T.prototype.__set_whitespace_patterns=function(B,U){B+="\\t ",U+="\\n\\r",this._match_pattern=this._input.get_regexp("["+B+U+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+U+"]")},T.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var B=this._input.read(this._match_pattern);if(B===" ")this.whitespace_before_token=" ";else if(B){var U=this.__split(this._newline_regexp,B);this.newline_count=U.length-1,this.whitespace_before_token=U[this.newline_count]}return B},T.prototype.matching=function(B,U){var F=this._create();return F.__set_whitespace_patterns(B,U),F._update(),F},T.prototype._create=function(){return new T(this._input,this)},T.prototype.__split=function(B,U){B.lastIndex=0;for(var F=0,I=[],M=B.exec(U);M;)I.push(U.substring(F,M.index)),F=M.index+M[0].length,M=B.exec(U);return F<U.length?I.push(U.substring(F,U.length)):I.push(""),I},x.exports.WhitespacePattern=T},function(x){function v(_,b){this._input=_,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,b&&(this._starting_pattern=this._input.get_regexp(b._starting_pattern,!0),this._match_pattern=this._input.get_regexp(b._match_pattern,!0),this._until_pattern=this._input.get_regexp(b._until_pattern),this._until_after=b._until_after)}v.prototype.read=function(){var _=this._input.read(this._starting_pattern);return(!this._starting_pattern||_)&&(_+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),_},v.prototype.read_match=function(){return this._input.match(this._match_pattern)},v.prototype.until_after=function(_){var b=this._create();return b._until_after=!0,b._until_pattern=this._input.get_regexp(_),b._update(),b},v.prototype.until=function(_){var b=this._create();return b._until_after=!1,b._until_pattern=this._input.get_regexp(_),b._update(),b},v.prototype.starting_with=function(_){var b=this._create();return b._starting_pattern=this._input.get_regexp(_,!0),b._update(),b},v.prototype.matching=function(_){var b=this._create();return b._match_pattern=this._input.get_regexp(_,!0),b._update(),b},v.prototype._create=function(){return new v(this._input,this)},v.prototype._update=function(){},x.exports.Pattern=v},function(x){function v(_,b){_=typeof _=="string"?_:_.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp(_+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(_+/\sbeautify\signore:end\s/.source+b,"g")}v.prototype.get_directives=function(_){if(!_.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var T=this.__directive_pattern.exec(_);T;)b[T[1]]=T[2],T=this.__directive_pattern.exec(_);return b},v.prototype.readIgnored=function(_){return _.readUntilAfter(this.__directives_end_ignore_pattern)},x.exports.Directives=v},function(x,v,_){var b=_(12).Pattern,T={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function B(U,F){b.call(this,U,F),this.__template_pattern=null,this._disabled=Object.assign({},T),this._excluded=Object.assign({},T),F&&(this.__template_pattern=this._input.get_regexp(F.__template_pattern),this._excluded=Object.assign(this._excluded,F._excluded),this._disabled=Object.assign(this._disabled,F._disabled));var I=new b(U);this.__patterns={handlebars_comment:I.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:I.starting_with(/{{{/).until_after(/}}}/),handlebars:I.starting_with(/{{/).until_after(/}}/),php:I.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:I.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:I.starting_with(/{%/).until_after(/%}/),django_value:I.starting_with(/{{/).until_after(/}}/),django_comment:I.starting_with(/{#/).until_after(/#}/),smarty:I.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:I.starting_with(/{\*/).until_after(/\*}/),smarty_literal:I.starting_with(/{literal}/).until_after(/{\/literal}/)}}B.prototype=new b,B.prototype._create=function(){return new B(this._input,this)},B.prototype._update=function(){this.__set_templated_pattern()},B.prototype.disable=function(U){var F=this._create();return F._disabled[U]=!0,F._update(),F},B.prototype.read_options=function(U){var F=this._create();for(var I in T)F._disabled[I]=U.templating.indexOf(I)===-1;return F._update(),F},B.prototype.exclude=function(U){var F=this._create();return F._excluded[U]=!0,F._update(),F},B.prototype.read=function(){var U="";this._match_pattern?U=this._input.read(this._starting_pattern):U=this._input.read(this._starting_pattern,this.__template_pattern);for(var F=this._read_template();F;)this._match_pattern?F+=this._input.read(this._match_pattern):F+=this._input.readUntil(this.__template_pattern),U+=F,F=this._read_template();return this._until_after&&(U+=this._input.readUntilAfter(this._until_pattern)),U},B.prototype.__set_templated_pattern=function(){var U=[];this._disabled.php||U.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||U.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||U.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||U.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(U.push(this.__patterns.django._starting_pattern.source),U.push(this.__patterns.django_value._starting_pattern.source),U.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||U.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&U.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+U.join("|")+")")},B.prototype._read_template=function(){var U="",F=this._input.peek();if(F==="<"){var I=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&I==="?"&&(U=U||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&I==="%"&&(U=U||this.__patterns.erb.read())}else F==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(U=U||this.__patterns.handlebars_comment.read(),U=U||this.__patterns.handlebars_unescaped.read(),U=U||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(U=U||this.__patterns.django_value.read()),this._excluded.django||(U=U||this.__patterns.django_comment.read(),U=U||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(U=U||this.__patterns.smarty_comment.read(),U=U||this.__patterns.smarty_literal.read(),U=U||this.__patterns.smarty.read()));return U},x.exports.TemplatablePattern=B},,,,function(x,v,_){var b=_(19).Beautifier,T=_(20).Options;function B(U,F,I,M){var j=new b(U,F,I,M);return j.beautify()}x.exports=B,x.exports.defaultOptions=function(){return new T}},function(x,v,_){var b=_(20).Options,T=_(2).Output,B=_(21).Tokenizer,U=_(21).TOKEN,F=/\r\n|[\r\n]/,I=/\r\n|[\r\n]/g,M=function(R,A){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=R.max_preserve_newlines,this.preserve_newlines=R.preserve_newlines,this._output=new T(R,A)};M.prototype.current_line_has_match=function(R){return this._output.current_line.has_match(R)},M.prototype.set_space_before_token=function(R,A){this._output.space_before_token=R,this._output.non_breaking_space=A},M.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},M.prototype.add_raw_token=function(R){this._output.add_raw_token(R)},M.prototype.print_preserved_newlines=function(R){var A=0;R.type!==U.TEXT&&R.previous.type!==U.TEXT&&(A=R.newlines?1:0),this.preserve_newlines&&(A=R.newlines<this.max_preserve_newlines+1?R.newlines:this.max_preserve_newlines+1);for(var L=0;L<A;L++)this.print_newline(L>0);return A!==0},M.prototype.traverse_whitespace=function(R){return R.whitespace_before||R.newlines?(this.print_preserved_newlines(R)||(this._output.space_before_token=!0),!0):!1},M.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},M.prototype.print_newline=function(R){this._output.add_new_line(R)},M.prototype.print_token=function(R){R.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(R.text))},M.prototype.indent=function(){this.indent_level++},M.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},M.prototype.get_full_indent=function(R){return R=this.indent_level+(R||0),R<1?"":this._output.get_indent_string(R)};var j=function(R){for(var A=null,L=R.next;L.type!==U.EOF&&R.closed!==L;){if(L.type===U.ATTRIBUTE&&L.text==="type"){L.next&&L.next.type===U.EQUALS&&L.next.next&&L.next.next.type===U.VALUE&&(A=L.next.next.text);break}L=L.next}return A},C=function(R,A){var L=null,S=null;return A.closed?(R==="script"?L="text/javascript":R==="style"&&(L="text/css"),L=j(A)||L,L.search("text/css")>-1?S="css":L.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?S="javascript":L.search(/(text|application|dojo)\/(x-)?(html)/)>-1?S="html":L.search(/test\/null/)>-1&&(S="null"),S):null};function $(R,A){return A.indexOf(R)!==-1}function X(R,A,L){this.parent=R||null,this.tag=A?A.tag_name:"",this.indent_level=L||0,this.parser_token=A||null}function Y(R){this._printer=R,this._current_frame=null}Y.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},Y.prototype.record_tag=function(R){var A=new X(this._current_frame,R,this._printer.indent_level);this._current_frame=A},Y.prototype._try_pop_frame=function(R){var A=null;return R&&(A=R.parser_token,this._printer.indent_level=R.indent_level,this._current_frame=R.parent),A},Y.prototype._get_frame=function(R,A){for(var L=this._current_frame;L&&R.indexOf(L.tag)===-1;){if(A&&A.indexOf(L.tag)!==-1){L=null;break}L=L.parent}return L},Y.prototype.try_pop=function(R,A){var L=this._get_frame([R],A);return this._try_pop_frame(L)},Y.prototype.indent_to_tag=function(R){var A=this._get_frame(R);A&&(this._printer.indent_level=A.indent_level)};function fe(R,A,L,S){this._source_text=R||"",A=A||{},this._js_beautify=L,this._css_beautify=S,this._tag_stack=null;var G=new b(A,"html");this._options=G,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,5)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,8)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}fe.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var R=this._source_text,A=this._options.eol;this._options.eol==="auto"&&(A=`
|
|
`,R&&F.test(R)&&(A=R.match(F)[0])),R=R.replace(I,`
|
|
`);var L=R.match(/^[\t ]*/)[0],S={text:"",type:""},G=new ye(this._options),P=new M(this._options,L),p=new B(R,this._options).tokenize();this._tag_stack=new Y(P);for(var d=null,N=p.next();N.type!==U.EOF;)N.type===U.TAG_OPEN||N.type===U.COMMENT?(d=this._handle_tag_open(P,N,G,S,p),G=d):N.type===U.ATTRIBUTE||N.type===U.EQUALS||N.type===U.VALUE||N.type===U.TEXT&&!G.tag_complete?d=this._handle_inside_tag(P,N,G,S):N.type===U.TAG_CLOSE?d=this._handle_tag_close(P,N,G):N.type===U.TEXT?d=this._handle_text(P,N,G):N.type===U.CONTROL_FLOW_OPEN?d=this._handle_control_flow_open(P,N):N.type===U.CONTROL_FLOW_CLOSE?d=this._handle_control_flow_close(P,N):P.add_raw_token(N),S=d,N=p.next();var V=P._output.get_code(A);return V},fe.prototype._handle_control_flow_open=function(R,A){var L={text:A.text,type:A.type};return R.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),A.newlines?R.print_preserved_newlines(A):R.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),R.print_token(A),R.indent(),L},fe.prototype._handle_control_flow_close=function(R,A){var L={text:A.text,type:A.type};return R.deindent(),A.newlines?R.print_preserved_newlines(A):R.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),R.print_token(A),L},fe.prototype._handle_tag_close=function(R,A,L){var S={text:A.text,type:A.type};return R.alignment_size=0,L.tag_complete=!0,R.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),L.is_unformatted?R.add_raw_token(A):(L.tag_start_char==="<"&&(R.set_space_before_token(A.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&L.has_wrapped_attrs&&R.print_newline(!1)),R.print_token(A)),L.indent_content&&!(L.is_unformatted||L.is_content_unformatted)&&(R.indent(),L.indent_content=!1),!L.is_inline_element&&!(L.is_unformatted||L.is_content_unformatted)&&R.set_wrap_point(),S},fe.prototype._handle_inside_tag=function(R,A,L,S){var G=L.has_wrapped_attrs,P={text:A.text,type:A.type};return R.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),L.is_unformatted?R.add_raw_token(A):L.tag_start_char==="{"&&A.type===U.TEXT?R.print_preserved_newlines(A)?(A.newlines=0,R.add_raw_token(A)):R.print_token(A):(A.type===U.ATTRIBUTE?R.set_space_before_token(!0):(A.type===U.EQUALS||A.type===U.VALUE&&A.previous.type===U.EQUALS)&&R.set_space_before_token(!1),A.type===U.ATTRIBUTE&&L.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(R.traverse_whitespace(A),G=G||A.newlines!==0),this._is_wrap_attributes_force&&L.attr_count>=this._options.wrap_attributes_min_attrs&&(S.type!==U.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(R.print_newline(!1),G=!0)),R.print_token(A),G=G||R.previous_token_wrapped(),L.has_wrapped_attrs=G),P},fe.prototype._handle_text=function(R,A,L){var S={text:A.text,type:"TK_CONTENT"};return L.custom_beautifier_name?this._print_custom_beatifier_text(R,A,L):L.is_unformatted||L.is_content_unformatted?R.add_raw_token(A):(R.traverse_whitespace(A),R.print_token(A)),S},fe.prototype._print_custom_beatifier_text=function(R,A,L){var S=this;if(A.text!==""){var G=A.text,P,p=1,d="",N="";L.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?P=this._js_beautify:L.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?P=this._css_beautify:L.custom_beautifier_name==="html"&&(P=function(We,rt){var ft=new fe(We,rt,S._js_beautify,S._css_beautify);return ft.beautify()}),this._options.indent_scripts==="keep"?p=0:this._options.indent_scripts==="separate"&&(p=-R.indent_level);var V=R.get_full_indent(p);if(G=G.replace(/\n[ \t]*$/,""),L.custom_beautifier_name!=="html"&&G[0]==="<"&&G.match(/^(<!--|<!\[CDATA\[)/)){var oe=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(G);if(!oe){R.add_raw_token(A);return}d=V+oe[1]+`
|
|
`,G=oe[4],oe[5]&&(N=V+oe[5]),G=G.replace(/\n[ \t]*$/,""),(oe[2]||oe[3].indexOf(`
|
|
`)!==-1)&&(oe=oe[3].match(/[ \t]+$/),oe&&(A.whitespace_before=oe[0]))}if(G)if(P){var xe=function(){this.eol=`
|
|
`};xe.prototype=this._options.raw_options;var Oe=new xe;G=P(V+G,Oe)}else{var Me=A.whitespace_before;Me&&(G=G.replace(new RegExp(`
|
|
(`+Me+")?","g"),`
|
|
`)),G=V+G.replace(/\n/g,`
|
|
`+V)}d&&(G?G=d+G+`
|
|
`+N:G=d+N),R.print_newline(!1),G&&(A.text=G,A.whitespace_before="",A.newlines=0,R.add_raw_token(A),R.print_newline(!0))}},fe.prototype._handle_tag_open=function(R,A,L,S,G){var P=this._get_tag_open_token(A);if((L.is_unformatted||L.is_content_unformatted)&&!L.is_empty_element&&A.type===U.TAG_OPEN&&!P.is_start_tag?(R.add_raw_token(A),P.start_tag_token=this._tag_stack.try_pop(P.tag_name)):(R.traverse_whitespace(A),this._set_tag_position(R,A,P,L,S),P.is_inline_element||R.set_wrap_point(),R.print_token(A)),P.is_start_tag&&this._is_wrap_attributes_force){var p=0,d;do d=G.peek(p),d.type===U.ATTRIBUTE&&(P.attr_count+=1),p+=1;while(d.type!==U.EOF&&d.type!==U.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(P.alignment_size=A.text.length+1),!P.tag_complete&&!P.is_unformatted&&(R.alignment_size=P.alignment_size),P};var ye=function(R,A,L){if(this.parent=A||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!L)this.tag_complete=!0;else{var S;this.tag_start_char=L.text[0],this.text=L.text,this.tag_start_char==="<"?(S=L.text.match(/^<([^\s>]*)/),this.tag_check=S?S[1]:""):(S=L.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=S?S[1]:"",(L.text.startsWith("{{#>")||L.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&L.next!==null?this.tag_check=L.next.text.split(" ")[0]:this.tag_check=L.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),L.type===U.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||L.closed&&L.closed.text==="/>";var G=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(G=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!R.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(G)))}};fe.prototype._get_tag_open_token=function(R){var A=new ye(this._options,this._tag_stack.get_parser_token(),R);return A.alignment_size=this._options.wrap_attributes_indent_size,A.is_end_tag=A.is_end_tag||$(A.tag_check,this._options.void_elements),A.is_empty_element=A.tag_complete||A.is_start_tag&&A.is_end_tag,A.is_unformatted=!A.tag_complete&&$(A.tag_check,this._options.unformatted),A.is_content_unformatted=!A.is_empty_element&&$(A.tag_check,this._options.content_unformatted),A.is_inline_element=$(A.tag_name,this._options.inline)||this._options.inline_custom_elements&&A.tag_name.includes("-")||A.tag_start_char==="{",A},fe.prototype._set_tag_position=function(R,A,L,S,G){if(L.is_empty_element||(L.is_end_tag?L.start_tag_token=this._tag_stack.try_pop(L.tag_name):(this._do_optional_end_element(L)&&(L.is_inline_element||R.print_newline(!1)),this._tag_stack.record_tag(L),(L.tag_name==="script"||L.tag_name==="style")&&!(L.is_unformatted||L.is_content_unformatted)&&(L.custom_beautifier_name=C(L.tag_check,A)))),$(L.tag_check,this._options.extra_liners)&&(R.print_newline(!1),R._output.just_added_blankline()||R.print_newline(!0)),L.is_empty_element){if(L.tag_start_char==="{"&&L.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),L.indent_content=!0;var P=R.current_line_has_match(/{{#if/);P||R.print_newline(!1)}L.tag_name==="!--"&&G.type===U.TAG_CLOSE&&S.is_end_tag&&L.text.indexOf(`
|
|
`)===-1||(L.is_inline_element||L.is_unformatted||R.print_newline(!1),this._calcluate_parent_multiline(R,L))}else if(L.is_end_tag){var p=!1;p=L.start_tag_token&&L.start_tag_token.multiline_content,p=p||!L.is_inline_element&&!(S.is_inline_element||S.is_unformatted)&&!(G.type===U.TAG_CLOSE&&L.start_tag_token===S)&&G.type!=="TK_CONTENT",(L.is_content_unformatted||L.is_unformatted)&&(p=!1),p&&R.print_newline(!1)}else L.indent_content=!L.custom_beautifier_name,L.tag_start_char==="<"&&(L.tag_name==="html"?L.indent_content=this._options.indent_inner_html:L.tag_name==="head"?L.indent_content=this._options.indent_head_inner_html:L.tag_name==="body"&&(L.indent_content=this._options.indent_body_inner_html)),!(L.is_inline_element||L.is_unformatted)&&(G.type!=="TK_CONTENT"||L.is_content_unformatted)&&R.print_newline(!1),this._calcluate_parent_multiline(R,L)},fe.prototype._calcluate_parent_multiline=function(R,A){A.parent&&R._output.just_added_newline()&&!((A.is_inline_element||A.is_unformatted)&&A.parent.is_inline_element)&&(A.parent.multiline_content=!0)};var ae=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","menu","nav","ol","p","pre","section","table","ul"],Q=["a","audio","del","ins","map","noscript","video"];fe.prototype._do_optional_end_element=function(R){var A=null;if(!(R.is_empty_element||!R.is_start_tag||!R.parent)){if(R.tag_name==="body")A=A||this._tag_stack.try_pop("head");else if(R.tag_name==="li")A=A||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(R.tag_name==="dd"||R.tag_name==="dt")A=A||this._tag_stack.try_pop("dt",["dl"]),A=A||this._tag_stack.try_pop("dd",["dl"]);else if(R.parent.tag_name==="p"&&ae.indexOf(R.tag_name)!==-1){var L=R.parent.parent;(!L||Q.indexOf(L.tag_name)===-1)&&(A=A||this._tag_stack.try_pop("p"))}else R.tag_name==="rp"||R.tag_name==="rt"?(A=A||this._tag_stack.try_pop("rt",["ruby","rtc"]),A=A||this._tag_stack.try_pop("rp",["ruby","rtc"])):R.tag_name==="optgroup"?A=A||this._tag_stack.try_pop("optgroup",["select"]):R.tag_name==="option"?A=A||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):R.tag_name==="colgroup"?A=A||this._tag_stack.try_pop("caption",["table"]):R.tag_name==="thead"?(A=A||this._tag_stack.try_pop("caption",["table"]),A=A||this._tag_stack.try_pop("colgroup",["table"])):R.tag_name==="tbody"||R.tag_name==="tfoot"?(A=A||this._tag_stack.try_pop("caption",["table"]),A=A||this._tag_stack.try_pop("colgroup",["table"]),A=A||this._tag_stack.try_pop("thead",["table"]),A=A||this._tag_stack.try_pop("tbody",["table"])):R.tag_name==="tr"?(A=A||this._tag_stack.try_pop("caption",["table"]),A=A||this._tag_stack.try_pop("colgroup",["table"]),A=A||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(R.tag_name==="th"||R.tag_name==="td")&&(A=A||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),A=A||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return R.parent=this._tag_stack.get_parser_token(),A}},x.exports.Beautifier=fe},function(x,v,_){var b=_(6).Options;function T(B){b.call(this,B,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_min_attrs=this._get_number("wrap_attributes_min_attrs",2),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.inline_custom_elements=this._get_boolean("inline_custom_elements",!0),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}T.prototype=new b,x.exports.Options=T},function(x,v,_){var b=_(9).Tokenizer,T=_(9).TOKEN,B=_(13).Directives,U=_(14).TemplatablePattern,F=_(12).Pattern,I={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",CONTROL_FLOW_OPEN:"TK_CONTROL_FLOW_OPEN",CONTROL_FLOW_CLOSE:"TK_CONTROL_FLOW_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:T.START,RAW:T.RAW,EOF:T.EOF},M=new B(/<\!--/,/-->/),j=function(C,$){b.call(this,C,$),this._current_tag_name="";var X=new U(this._input).read_options(this._options),Y=new F(this._input);if(this.__patterns={word:X.until(/[\n\r\t <]/),word_control_flow_close_excluded:X.until(/[\n\r\t <}]/),single_quote:X.until_after(/'/),double_quote:X.until_after(/"/),attribute:X.until(/[\n\r\t =>]|\/>/),element_name:X.until(/[\n\r\t >\/]/),angular_control_flow_start:Y.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:Y.starting_with(/{{!--/).until_after(/--}}/),handlebars:Y.starting_with(/{{/).until_after(/}}/),handlebars_open:Y.until(/[\n\r\t }]/),handlebars_raw_close:Y.until(/}}/),comment:Y.starting_with(/<!--/).until_after(/-->/),cdata:Y.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:Y.starting_with(/<!\[/).until_after(/]>/),processing:Y.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars"),this.__patterns.word_control_flow_close_excluded=this.__patterns.word_control_flow_close_excluded.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var fe=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=Y.matching(fe).until_after(fe)}};j.prototype=new b,j.prototype._is_comment=function(C){return!1},j.prototype._is_opening=function(C){return C.type===I.TAG_OPEN||C.type===I.CONTROL_FLOW_OPEN},j.prototype._is_closing=function(C,$){return C.type===I.TAG_CLOSE&&$&&((C.text===">"||C.text==="/>")&&$.text[0]==="<"||C.text==="}}"&&$.text[0]==="{"&&$.text[1]==="{")||C.type===I.CONTROL_FLOW_CLOSE&&C.text==="}"&&$.text.endsWith("{")},j.prototype._reset=function(){this._current_tag_name=""},j.prototype._get_next_token=function(C,$){var X=null;this._readWhitespace();var Y=this._input.peek();return Y===null?this._create_token(I.EOF,""):(X=X||this._read_open_handlebars(Y,$),X=X||this._read_attribute(Y,C,$),X=X||this._read_close(Y,$),X=X||this._read_script_and_style(Y,C),X=X||this._read_control_flows(Y,$),X=X||this._read_raw_content(Y,C,$),X=X||this._read_content_word(Y,$),X=X||this._read_comment_or_cdata(Y),X=X||this._read_processing(Y),X=X||this._read_open(Y,$),X=X||this._create_token(I.UNKNOWN,this._input.next()),X)},j.prototype._read_comment_or_cdata=function(C){var $=null,X=null,Y=null;if(C==="<"){var fe=this._input.peek(1);fe==="!"&&(X=this.__patterns.comment.read(),X?(Y=M.get_directives(X),Y&&Y.ignore==="start"&&(X+=M.readIgnored(this._input))):X=this.__patterns.cdata.read()),X&&($=this._create_token(I.COMMENT,X),$.directives=Y)}return $},j.prototype._read_processing=function(C){var $=null,X=null,Y=null;if(C==="<"){var fe=this._input.peek(1);(fe==="!"||fe==="?")&&(X=this.__patterns.conditional_comment.read(),X=X||this.__patterns.processing.read()),X&&($=this._create_token(I.COMMENT,X),$.directives=Y)}return $},j.prototype._read_open=function(C,$){var X=null,Y=null;return(!$||$.type===I.CONTROL_FLOW_OPEN)&&C==="<"&&(X=this._input.next(),this._input.peek()==="/"&&(X+=this._input.next()),X+=this.__patterns.element_name.read(),Y=this._create_token(I.TAG_OPEN,X)),Y},j.prototype._read_open_handlebars=function(C,$){var X=null,Y=null;return(!$||$.type===I.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&C==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(X=this.__patterns.handlebars_comment.read(),X=X||this.__patterns.handlebars.read(),Y=this._create_token(I.COMMENT,X)):(X=this.__patterns.handlebars_open.read(),Y=this._create_token(I.TAG_OPEN,X))),Y},j.prototype._read_control_flows=function(C,$){var X="",Y=null;if(!this._options.templating.includes("angular"))return Y;if(C==="@"){if(X=this.__patterns.angular_control_flow_start.read(),X==="")return Y;for(var fe=X.endsWith("(")?1:0,ye=0;!(X.endsWith("{")&&fe===ye);){var ae=this._input.next();if(ae===null)break;ae==="("?fe++:ae===")"&&ye++,X+=ae}Y=this._create_token(I.CONTROL_FLOW_OPEN,X)}else C==="}"&&$&&$.type===I.CONTROL_FLOW_OPEN&&(X=this._input.next(),Y=this._create_token(I.CONTROL_FLOW_CLOSE,X));return Y},j.prototype._read_close=function(C,$){var X=null,Y=null;return $&&$.type===I.TAG_OPEN&&($.text[0]==="<"&&(C===">"||C==="/"&&this._input.peek(1)===">")?(X=this._input.next(),C==="/"&&(X+=this._input.next()),Y=this._create_token(I.TAG_CLOSE,X)):$.text[0]==="{"&&C==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),Y=this._create_token(I.TAG_CLOSE,"}}"))),Y},j.prototype._read_attribute=function(C,$,X){var Y=null,fe="";if(X&&X.text[0]==="<")if(C==="=")Y=this._create_token(I.EQUALS,this._input.next());else if(C==='"'||C==="'"){var ye=this._input.next();C==='"'?ye+=this.__patterns.double_quote.read():ye+=this.__patterns.single_quote.read(),Y=this._create_token(I.VALUE,ye)}else fe=this.__patterns.attribute.read(),fe&&($.type===I.EQUALS?Y=this._create_token(I.VALUE,fe):Y=this._create_token(I.ATTRIBUTE,fe));return Y},j.prototype._is_content_unformatted=function(C){return this._options.void_elements.indexOf(C)===-1&&(this._options.content_unformatted.indexOf(C)!==-1||this._options.unformatted.indexOf(C)!==-1)},j.prototype._read_raw_content=function(C,$,X){var Y="";if(X&&X.text[0]==="{")Y=this.__patterns.handlebars_raw_close.read();else if($.type===I.TAG_CLOSE&&$.opened.text[0]==="<"&&$.text[0]!=="/"){var fe=$.opened.text.substr(1).toLowerCase();this._is_content_unformatted(fe)&&(Y=this._input.readUntil(new RegExp("</"+fe+"[\\n\\r\\t ]*?>","ig")))}return Y?this._create_token(I.TEXT,Y):null},j.prototype._read_script_and_style=function(C,$){if($.type===I.TAG_CLOSE&&$.opened.text[0]==="<"&&$.text[0]!=="/"){var X=$.opened.text.substr(1).toLowerCase();if(X==="script"||X==="style"){var Y=this._read_comment_or_cdata(C);if(Y)return Y.type=I.TEXT,Y;var fe=this._input.readUntil(new RegExp("</"+X+"[\\n\\r\\t ]*?>","ig"));if(fe)return this._create_token(I.TEXT,fe)}}return null},j.prototype._read_content_word=function(C,$){var X="";return this._options.unformatted_content_delimiter&&C===this._options.unformatted_content_delimiter[0]&&(X=this.__patterns.unformatted_content_delimiter.read()),X||(X=$&&$.type===I.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),X?this._create_token(I.TEXT,X):null},x.exports.Tokenizer=j,x.exports.TOKEN=I}],H={};function l(x){var v=H[x];if(v!==void 0)return v.exports;var _=H[x]={exports:{}};return ee[x](_,_.exports,l),_.exports}var W=l(18);ue=W})();var J=ue;if(1)K=[O,O(58553),O(87804)],te=function(ee){var H=O(58553),l=O(87804);return{html_beautify:function(W,x){return J(W,x,H.js_beautify,l.css_beautify)}}}.apply(Ie,K),te!==void 0&&(tt.exports=te);else var D,g})()},58553:function(tt,Ie){var O,K;(function(){var te;(function(){"use strict";var J=[function(H,l,W){var x=W(1).Beautifier,v=W(5).Options;function _(b,T){var B=new x(b,T);return B.beautify()}H.exports=_,H.exports.defaultOptions=function(){return new v}},function(H,l,W){var x=W(2).Output,v=W(3).Token,_=W(4),b=W(5).Options,T=W(7).Tokenizer,B=W(7).line_starters,U=W(7).positionable_operators,F=W(7).TOKEN;function I(d,N){return N.indexOf(d)!==-1}function M(d){return d.replace(/^\s+/g,"")}function j(d){for(var N={},V=0;V<d.length;V++)N[d[V].replace(/-/g,"_")]=d[V];return N}function C(d,N){return d&&d.type===F.RESERVED&&d.text===N}function $(d,N){return d&&d.type===F.RESERVED&&I(d.text,N)}var X=["case","return","do","if","throw","else","await","break","continue","async"],Y=["before-newline","after-newline","preserve-newline"],fe=j(Y),ye=[fe.before_newline,fe.preserve_newline],ae={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Q(d,N){N.multiline_frame||N.mode===ae.ForInitializer||N.mode===ae.Conditional||d.remove_indent(N.start_line_index)}function R(d){d=d.replace(_.allLineBreaks,`
|
|
`);for(var N=[],V=d.indexOf(`
|
|
`);V!==-1;)N.push(d.substring(0,V)),d=d.substring(V+1),V=d.indexOf(`
|
|
`);return d.length&&N.push(d),N}function A(d){return d===ae.ArrayLiteral}function L(d){return I(d,[ae.Expression,ae.ForInitializer,ae.Conditional])}function S(d,N){for(var V=0;V<d.length;V++){var oe=d[V].trim();if(oe.charAt(0)!==N)return!1}return!0}function G(d,N){for(var V=0,oe=d.length,xe;V<oe;V++)if(xe=d[V],xe&&xe.indexOf(N)!==0)return!1;return!0}function P(d,N){N=N||{},this._source_text=d||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new b(N)}P.prototype.create_flags=function(d,N){var V=0;d&&(V=d.indentation_level,!this._output.just_added_newline()&&d.line_indent_level>V&&(V=d.line_indent_level));var oe={mode:N,parent:d,last_token:d?d.last_token:new v(F.START_BLOCK,""),last_word:d?d.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:V,alignment:0,line_indent_level:d?d.line_indent_level:V,start_line_index:this._output.get_line_number(),ternary_depth:0};return oe},P.prototype._reset=function(d){var N=d.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new x(this._options,N),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(ae.BlockStatement);var V=new T(d,this._options);return this._tokens=V.tokenize(),d},P.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var d,N=this._reset(this._source_text),V=this._options.eol;this._options.eol==="auto"&&(V=`
|
|
`,N&&_.lineBreak.test(N||"")&&(V=N.match(_.lineBreak)[0]));for(var oe=this._tokens.next();oe;)this.handle_token(oe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=oe,oe=this._tokens.next();return d=this._output.get_code(V),d},P.prototype.handle_token=function(d,N){d.type===F.START_EXPR?this.handle_start_expr(d):d.type===F.END_EXPR?this.handle_end_expr(d):d.type===F.START_BLOCK?this.handle_start_block(d):d.type===F.END_BLOCK?this.handle_end_block(d):d.type===F.WORD?this.handle_word(d):d.type===F.RESERVED?this.handle_word(d):d.type===F.SEMICOLON?this.handle_semicolon(d):d.type===F.STRING?this.handle_string(d):d.type===F.EQUALS?this.handle_equals(d):d.type===F.OPERATOR?this.handle_operator(d):d.type===F.COMMA?this.handle_comma(d):d.type===F.BLOCK_COMMENT?this.handle_block_comment(d,N):d.type===F.COMMENT?this.handle_comment(d,N):d.type===F.DOT?this.handle_dot(d):d.type===F.EOF?this.handle_eof(d):d.type===F.UNKNOWN?this.handle_unknown(d,N):this.handle_unknown(d,N)},P.prototype.handle_whitespace_and_comments=function(d,N){var V=d.newlines,oe=this._options.keep_array_indentation&&A(this._flags.mode);if(d.comments_before)for(var xe=d.comments_before.next();xe;)this.handle_whitespace_and_comments(xe,N),this.handle_token(xe,N),xe=d.comments_before.next();if(oe)for(var Oe=0;Oe<V;Oe+=1)this.print_newline(Oe>0,N);else if(this._options.max_preserve_newlines&&V>this._options.max_preserve_newlines&&(V=this._options.max_preserve_newlines),this._options.preserve_newlines&&V>1){this.print_newline(!1,N);for(var Me=1;Me<V;Me+=1)this.print_newline(!0,N)}};var p=["async","break","continue","return","throw","yield"];P.prototype.allow_wrap_or_preserved_newline=function(d,N){if(N=N===void 0?!1:N,!this._output.just_added_newline()){var V=this._options.preserve_newlines&&d.newlines||N,oe=I(this._flags.last_token.text,U)||I(d.text,U);if(oe){var xe=I(this._flags.last_token.text,U)&&I(this._options.operator_position,ye)||I(d.text,U);V=V&&xe}if(V)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if($(this._flags.last_token,p))return;this._output.set_wrap_point()}}},P.prototype.print_newline=function(d,N){if(!N&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==F.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var V=this._tokens.peek();this._flags.mode===ae.Statement&&!(this._flags.if_block&&C(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(d)&&(this._flags.multiline_frame=!0)},P.prototype.print_token_line_indentation=function(d){this._output.just_added_newline()&&(this._options.keep_array_indentation&&d.newlines&&(d.text==="["||A(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(d.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},P.prototype.print_token=function(d){if(this._output.raw){this._output.add_raw_token(d);return}if(this._options.comma_first&&d.previous&&d.previous.type===F.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var N=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(N),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(d),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(d),this._output.non_breaking_space=!0,this._output.add_token(d.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},P.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},P.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},P.prototype.set_mode=function(d){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,d),this._flags=this.create_flags(this._previous_flags,d),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},P.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===ae.Statement&&Q(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},P.prototype.start_of_object_property=function(){return this._flags.parent.mode===ae.ObjectLiteral&&this._flags.mode===ae.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||$(this._flags.last_token,["get","set"]))},P.prototype.start_of_statement=function(d){var N=!1;return N=N||$(this._flags.last_token,["var","let","const"])&&d.type===F.WORD,N=N||C(this._flags.last_token,"do"),N=N||!(this._flags.parent.mode===ae.ObjectLiteral&&this._flags.mode===ae.Statement)&&$(this._flags.last_token,p)&&!d.newlines,N=N||C(this._flags.last_token,"else")&&!(C(d,"if")&&!d.comments_before),N=N||this._flags.last_token.type===F.END_EXPR&&(this._previous_flags.mode===ae.ForInitializer||this._previous_flags.mode===ae.Conditional),N=N||this._flags.last_token.type===F.WORD&&this._flags.mode===ae.BlockStatement&&!this._flags.in_case&&!(d.text==="--"||d.text==="++")&&this._last_last_text!=="function"&&d.type!==F.WORD&&d.type!==F.RESERVED,N=N||this._flags.mode===ae.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||$(this._flags.last_token,["get","set"])),N?(this.set_mode(ae.Statement),this.indent(),this.handle_whitespace_and_comments(d,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(d,$(d,["do","for","if","while"])),!0):!1},P.prototype.handle_start_expr=function(d){this.start_of_statement(d)||this.handle_whitespace_and_comments(d);var N=ae.Expression;if(d.text==="["){if(this._flags.last_token.type===F.WORD||this._flags.last_token.text===")"){$(this._flags.last_token,B)&&(this._output.space_before_token=!0),this.print_token(d),this.set_mode(N),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}N=ae.ArrayLiteral,A(this._flags.mode)&&(this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline()),I(this._flags.last_token.type,[F.START_EXPR,F.END_EXPR,F.WORD,F.OPERATOR,F.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===F.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,N=ae.ForInitializer):I(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,N=ae.Conditional):I(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&d.whitespace_before===""?this._output.space_before_token=!1:(I(this._flags.last_token.text,B)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===F.EQUALS||this._flags.last_token.type===F.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(d);else if(this._flags.last_token.type===F.WORD){this._output.space_before_token=!1;var V=this._tokens.peek(-3);if(this._options.space_after_named_function&&V){var oe=this._tokens.peek(-4);$(V,["async","function"])||V.text==="*"&&$(oe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===ae.ObjectLiteral?(V.text==="{"||V.text===","||V.text==="*"&&(oe.text==="{"||oe.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(d);(this._flags.last_token.type===F.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===ae.ObjectLiteral&&I(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===F.START_BLOCK?this.print_newline():(this._flags.last_token.type===F.END_EXPR||this._flags.last_token.type===F.START_EXPR||this._flags.last_token.type===F.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===F.COMMA)&&this.allow_wrap_or_preserved_newline(d,d.newlines),this.print_token(d),this.set_mode(N),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},P.prototype.handle_end_expr=function(d){for(;this._flags.mode===ae.Statement;)this.restore_mode();this.handle_whitespace_and_comments(d),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(d,d.text==="]"&&A(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===F.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(d),this.restore_mode(),Q(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===ae.Conditional&&(this._previous_flags.mode=ae.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},P.prototype.handle_start_block=function(d){this.handle_whitespace_and_comments(d);var N=this._tokens.peek(),V=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===F.END_EXPR?(this.set_mode(ae.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(ae.BlockStatement):V&&(I(V.text,[":",","])&&I(N.type,[F.STRING,F.WORD,F.RESERVED])||I(N.text,["get","set","..."])&&I(V.type,[F.WORD,F.RESERVED]))?I(this._last_last_text,["class","interface"])&&!I(V.text,[":",","])?this.set_mode(ae.BlockStatement):this.set_mode(ae.ObjectLiteral):this._flags.last_token.type===F.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(ae.BlockStatement):I(this._flags.last_token.type,[F.EQUALS,F.START_EXPR,F.COMMA,F.OPERATOR])||$(this._flags.last_token,["return","throw","import","default"])?this.set_mode(ae.ObjectLiteral):this.set_mode(ae.BlockStatement),this._flags.last_token&&$(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var oe=!N.comments_before&&N.text==="}",xe=oe&&this._flags.last_word==="function"&&this._flags.last_token.type===F.END_EXPR;if(this._options.brace_preserve_inline){var Oe=0,Me=null;this._flags.inline_frame=!0;do if(Oe+=1,Me=this._tokens.peek(Oe-1),Me.newlines){this._flags.inline_frame=!1;break}while(Me.type!==F.EOF&&!(Me.type===F.END_BLOCK&&Me.opened===d))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&d.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==F.OPERATOR&&(xe||this._flags.last_token.type===F.EQUALS||$(this._flags.last_token,X)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(A(this._previous_flags.mode)&&(this._flags.last_token.type===F.START_EXPR||this._flags.last_token.type===F.COMMA)&&((this._flags.last_token.type===F.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(d),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==F.OPERATOR&&this._flags.last_token.type!==F.START_EXPR&&(I(this._flags.last_token.type,[F.START_BLOCK,F.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(d),this.indent(),!oe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},P.prototype.handle_end_block=function(d){for(this.handle_whitespace_and_comments(d);this._flags.mode===ae.Statement;)this.restore_mode();var N=this._flags.last_token.type===F.START_BLOCK;this._flags.inline_frame&&!N?this._output.space_before_token=!0:this._options.brace_style==="expand"?N||this.print_newline():N||(A(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(d)},P.prototype.handle_word=function(d){if(d.type===F.RESERVED){if(I(d.text,["set","get"])&&this._flags.mode!==ae.ObjectLiteral)d.type=F.WORD;else if(d.text==="import"&&I(this._tokens.peek().text,["(","."]))d.type=F.WORD;else if(I(d.text,["as","from"])&&!this._flags.import_block)d.type=F.WORD;else if(this._flags.mode===ae.ObjectLiteral){var N=this._tokens.peek();N.text===":"&&(d.type=F.WORD)}}if(this.start_of_statement(d)?$(this._flags.last_token,["var","let","const"])&&d.type===F.WORD&&(this._flags.declaration_statement=!0):d.newlines&&!L(this._flags.mode)&&(this._flags.last_token.type!==F.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==F.EQUALS&&(this._options.preserve_newlines||!$(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(d),this.print_newline()):this.handle_whitespace_and_comments(d),this._flags.do_block&&!this._flags.do_while)if(C(d,"while")){this._output.space_before_token=!0,this.print_token(d),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&C(d,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===ae.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&$(d,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(d),this._flags.in_case=!0;return}if((this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR||this._flags.last_token.type===F.EQUALS||this._flags.last_token.type===F.OPERATOR)&&!this.start_of_object_property()&&!(I(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===ae.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(d),C(d,"function")){(I(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(I(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===F.OPERATOR))&&!this._output.just_added_blankline()&&!d.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===F.RESERVED||this._flags.last_token.type===F.WORD?$(this._flags.last_token,["get","set","new","export"])||$(this._flags.last_token,p)?this._output.space_before_token=!0:C(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===F.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(L(this._flags.mode)||A(this._flags.mode))||this.print_newline(),this.print_token(d),this._flags.last_word=d.text;return}var V="NONE";if(this._flags.last_token.type===F.END_BLOCK?this._previous_flags.inline_frame?V="SPACE":$(d,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&d.newlines?V="NEWLINE":(V="SPACE",this._output.space_before_token=!0):V="NEWLINE":this._flags.last_token.type===F.SEMICOLON&&this._flags.mode===ae.BlockStatement?V="NEWLINE":this._flags.last_token.type===F.SEMICOLON&&L(this._flags.mode)?V="SPACE":this._flags.last_token.type===F.STRING?V="NEWLINE":this._flags.last_token.type===F.RESERVED||this._flags.last_token.type===F.WORD||this._flags.last_token.text==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===ae.ObjectLiteral&&I(this._last_last_text,["{",","]))?V="SPACE":this._flags.last_token.type===F.START_BLOCK?this._flags.inline_frame?V="SPACE":V="NEWLINE":this._flags.last_token.type===F.END_EXPR&&(this._output.space_before_token=!0,V="NEWLINE"),$(d,B)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?V="SPACE":V="NEWLINE"),$(d,["else","catch","finally"]))if((!(this._flags.last_token.type===F.END_BLOCK&&this._previous_flags.mode===ae.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&d.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var oe=this._output.current_line;oe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else V==="NEWLINE"?$(this._flags.last_token,X)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&$(d,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==F.END_EXPR?(this._flags.last_token.type!==F.START_EXPR||!$(d,["var","let","const"]))&&this._flags.last_token.text!==":"&&(C(d,"if")&&C(d.previous,"else")?this._output.space_before_token=!0:this.print_newline()):$(d,B)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&A(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():V==="SPACE"&&(this._output.space_before_token=!0);d.previous&&(d.previous.type===F.WORD||d.previous.type===F.RESERVED)&&(this._output.space_before_token=!0),this.print_token(d),this._flags.last_word=d.text,d.type===F.RESERVED&&(d.text==="do"?this._flags.do_block=!0:d.text==="if"?this._flags.if_block=!0:d.text==="import"?this._flags.import_block=!0:this._flags.import_block&&C(d,"from")&&(this._flags.import_block=!1))},P.prototype.handle_semicolon=function(d){this.start_of_statement(d)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(d);for(var N=this._tokens.peek();this._flags.mode===ae.Statement&&!(this._flags.if_block&&C(N,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(d)},P.prototype.handle_string=function(d){d.text.startsWith("`")&&d.newlines===0&&d.whitespace_before===""&&(d.previous.text===")"||this._flags.last_token.type===F.WORD)||(this.start_of_statement(d)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(d),this._flags.last_token.type===F.RESERVED||this._flags.last_token.type===F.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR||this._flags.last_token.type===F.EQUALS||this._flags.last_token.type===F.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(d):d.text.startsWith("`")&&this._flags.last_token.type===F.END_EXPR&&(d.previous.text==="]"||d.previous.text===")")&&d.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(d)},P.prototype.handle_equals=function(d){this.start_of_statement(d)||this.handle_whitespace_and_comments(d),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(d),this._output.space_before_token=!0},P.prototype.handle_comma=function(d){this.handle_whitespace_and_comments(d,!0),this.print_token(d),this._output.space_before_token=!0,this._flags.declaration_statement?(L(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(d)):this._flags.mode===ae.ObjectLiteral||this._flags.mode===ae.Statement&&this._flags.parent.mode===ae.ObjectLiteral?(this._flags.mode===ae.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(d)},P.prototype.handle_operator=function(d){var N=d.text==="*"&&($(this._flags.last_token,["function","yield"])||I(this._flags.last_token.type,[F.START_BLOCK,F.COMMA,F.END_BLOCK,F.SEMICOLON])),V=I(d.text,["-","+"])&&(I(this._flags.last_token.type,[F.START_BLOCK,F.START_EXPR,F.EQUALS,F.OPERATOR])||I(this._flags.last_token.text,B)||this._flags.last_token.text===",");if(!this.start_of_statement(d)){var oe=!N;this.handle_whitespace_and_comments(d,oe)}if(d.text==="*"&&this._flags.last_token.type===F.DOT){this.print_token(d);return}if(d.text==="::"){this.print_token(d);return}if(I(d.text,["-","+"])&&this.start_of_object_property()){this.print_token(d);return}if(this._flags.last_token.type===F.OPERATOR&&I(this._options.operator_position,ye)&&this.allow_wrap_or_preserved_newline(d),d.text===":"&&this._flags.in_case){this.print_token(d),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==F.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var xe=!0,Oe=!0,Me=!1;if(d.text===":"?this._flags.ternary_depth===0?xe=!1:(this._flags.ternary_depth-=1,Me=!0):d.text==="?"&&(this._flags.ternary_depth+=1),!V&&!N&&this._options.preserve_newlines&&I(d.text,U)){var We=d.text===":",rt=We&&Me,ft=We&&!Me;switch(this._options.operator_position){case fe.before_newline:this._output.space_before_token=!ft,this.print_token(d),(!We||rt)&&this.allow_wrap_or_preserved_newline(d),this._output.space_before_token=!0;return;case fe.after_newline:this._output.space_before_token=!0,!We||rt?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(d):this._output.space_before_token=!1,this.print_token(d),this._output.space_before_token=!0;return;case fe.preserve_newline:ft||this.allow_wrap_or_preserved_newline(d),xe=!(this._output.just_added_newline()||ft),this._output.space_before_token=xe,this.print_token(d),this._output.space_before_token=!0;return}}if(N){this.allow_wrap_or_preserved_newline(d),xe=!1;var ze=this._tokens.peek();Oe=ze&&I(ze.type,[F.WORD,F.RESERVED])}else if(d.text==="...")this.allow_wrap_or_preserved_newline(d),xe=this._flags.last_token.type===F.START_BLOCK,Oe=!1;else if(I(d.text,["--","++","!","~"])||V){if((this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR)&&this.allow_wrap_or_preserved_newline(d),xe=!1,Oe=!1,d.newlines&&(d.text==="--"||d.text==="++"||d.text==="~")){var dt=$(this._flags.last_token,X)&&d.newlines;dt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(dt,!0)}this._flags.last_token.text===";"&&L(this._flags.mode)&&(xe=!0),this._flags.last_token.type===F.RESERVED?xe=!0:this._flags.last_token.type===F.END_EXPR?xe=!(this._flags.last_token.text==="]"&&(d.text==="--"||d.text==="++")):this._flags.last_token.type===F.OPERATOR&&(xe=I(d.text,["--","-","++","+"])&&I(this._flags.last_token.text,["--","-","++","+"]),I(d.text,["+","-"])&&I(this._flags.last_token.text,["--","++"])&&(Oe=!0)),(this._flags.mode===ae.BlockStatement&&!this._flags.inline_frame||this._flags.mode===ae.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||xe,this.print_token(d),this._output.space_before_token=Oe},P.prototype.handle_block_comment=function(d,N){if(this._output.raw){this._output.add_raw_token(d),d.directives&&d.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(d.directives){this.print_newline(!1,N),this.print_token(d),d.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!_.newline.test(d.text)&&!d.newlines){this._output.space_before_token=!0,this.print_token(d),this._output.space_before_token=!0;return}else this.print_block_commment(d,N)},P.prototype.print_block_commment=function(d,N){var V=R(d.text),oe,xe=!1,Oe=!1,Me=d.whitespace_before,We=Me.length;if(this.print_newline(!1,N),this.print_token_line_indentation(d),this._output.add_token(V[0]),this.print_newline(!1,N),V.length>1){for(V=V.slice(1),xe=S(V,"*"),Oe=G(V,Me),xe&&(this._flags.alignment=1),oe=0;oe<V.length;oe++)xe?(this.print_token_line_indentation(d),this._output.add_token(M(V[oe]))):Oe&&V[oe]?(this.print_token_line_indentation(d),this._output.add_token(V[oe].substring(We))):(this._output.current_line.set_indent(-1),this._output.add_token(V[oe])),this.print_newline(!1,N);this._flags.alignment=0}},P.prototype.handle_comment=function(d,N){d.newlines?this.print_newline(!1,N):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(d),this.print_newline(!1,N)},P.prototype.handle_dot=function(d){this.start_of_statement(d)||this.handle_whitespace_and_comments(d,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),$(this._flags.last_token,X)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(d,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(d)},P.prototype.handle_unknown=function(d,N){this.print_token(d),d.text[d.text.length-1]===`
|
|
`&&this.print_newline(!1,N)},P.prototype.handle_eof=function(d){for(;this._flags.mode===ae.Statement;)this.restore_mode();this.handle_whitespace_and_comments(d)},H.exports.Beautifier=P},function(H){function l(v){this.__parent=v,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var v=new l(this.__parent);return v.set_indent(this.__indent_count,this.__alignment_count),v},l.prototype.item=function(v){return v<0?this.__items[this.__items.length+v]:this.__items[v]},l.prototype.has_match=function(v){for(var _=this.__items.length-1;_>=0;_--)if(this.__items[_].match(v))return!0;return!1},l.prototype.set_indent=function(v,_){this.is_empty()&&(this.__indent_count=v||0,this.__alignment_count=_||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},l.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var v=this.__parent.current_line;return v.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),v.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),v.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,v.__items[0]===" "&&(v.__items.splice(0,1),v.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(v){this.__items.push(v);var _=v.lastIndexOf(`
|
|
`);_!==-1?this.__character_count=v.length-_:this.__character_count+=v.length},l.prototype.pop=function(){var v=null;return this.is_empty()||(v=this.__items.pop(),this.__character_count-=v.length),v},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var v="";return this.is_empty()?this.__parent.indent_empty_lines&&(v=this.__parent.get_indent_string(this.__indent_count)):(v=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),v+=this.__items.join("")),v};function W(v,_){this.__cache=[""],this.__indent_size=v.indent_size,this.__indent_string=v.indent_char,v.indent_with_tabs||(this.__indent_string=new Array(v.indent_size+1).join(v.indent_char)),_=_||"",v.indent_level>0&&(_=new Array(v.indent_level+1).join(this.__indent_string)),this.__base_string=_,this.__base_string_length=_.length}W.prototype.get_indent_size=function(v,_){var b=this.__base_string_length;return _=_||0,v<0&&(b=0),b+=v*this.__indent_size,b+=_,b},W.prototype.get_indent_string=function(v,_){var b=this.__base_string;return _=_||0,v<0&&(v=0,b=""),_+=v*this.__indent_size,this.__ensure_cache(_),b+=this.__cache[_],b},W.prototype.__ensure_cache=function(v){for(;v>=this.__cache.length;)this.__add_column()},W.prototype.__add_column=function(){var v=this.__cache.length,_=0,b="";this.__indent_size&&v>=this.__indent_size&&(_=Math.floor(v/this.__indent_size),v-=_*this.__indent_size,b=new Array(_+1).join(this.__indent_string)),v&&(b+=new Array(v+1).join(" ")),this.__cache.push(b)};function x(v,_){this.__indent_cache=new W(v,_),this.raw=!1,this._end_with_newline=v.end_with_newline,this.indent_size=v.indent_size,this.wrap_line_length=v.wrap_line_length,this.indent_empty_lines=v.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}x.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},x.prototype.get_line_number=function(){return this.__lines.length},x.prototype.get_indent_string=function(v,_){return this.__indent_cache.get_indent_string(v,_)},x.prototype.get_indent_size=function(v,_){return this.__indent_cache.get_indent_size(v,_)},x.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},x.prototype.add_new_line=function(v){return this.is_empty()||!v&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},x.prototype.get_code=function(v){this.trim(!0);var _=this.current_line.pop();_&&(_[_.length-1]===`
|
|
`&&(_=_.replace(/\n+$/g,"")),this.current_line.push(_)),this._end_with_newline&&this.__add_outputline();var b=this.__lines.join(`
|
|
`);return v!==`
|
|
`&&(b=b.replace(/[\n]/g,v)),b},x.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},x.prototype.set_indent=function(v,_){return v=v||0,_=_||0,this.next_line.set_indent(v,_),this.__lines.length>1?(this.current_line.set_indent(v,_),!0):(this.current_line.set_indent(),!1)},x.prototype.add_raw_token=function(v){for(var _=0;_<v.newlines;_++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(v.whitespace_before),this.current_line.push(v.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},x.prototype.add_token=function(v){this.__add_space_before_token(),this.current_line.push(v),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},x.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},x.prototype.remove_indent=function(v){for(var _=this.__lines.length;v<_;)this.__lines[v]._remove_indent(),v++;this.current_line._remove_wrap_indent()},x.prototype.trim=function(v){for(v=v===void 0?!1:v,this.current_line.trim();v&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},x.prototype.just_added_newline=function(){return this.current_line.is_empty()},x.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},x.prototype.ensure_empty_line_above=function(v,_){for(var b=this.__lines.length-2;b>=0;){var T=this.__lines[b];if(T.is_empty())break;if(T.item(0).indexOf(v)!==0&&T.item(-1)!==_){this.__lines.splice(b+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}b--}},H.exports.Output=x},function(H){function l(W,x,v,_){this.type=W,this.text=x,this.comments_before=null,this.newlines=v||0,this.whitespace_before=_||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}H.exports.Token=l},function(H,l){var W="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",x="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",v="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",_="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",b="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",T="(?:"+b+"|["+W+v+"])",B="(?:"+b+"|["+x+v+_+"])*";l.identifier=new RegExp(T+B,"g"),l.identifierStart=new RegExp(T),l.identifierMatch=new RegExp("(?:"+b+"|["+x+v+_+"])+");var U=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;l.newline=/[\n\r\u2028\u2029]/,l.lineBreak=new RegExp(`\r
|
|
|`+l.newline.source),l.allLineBreaks=new RegExp(l.lineBreak.source,"g")},function(H,l,W){var x=W(6).Options,v=["before-newline","after-newline","preserve-newline"];function _(b){x.call(this,b,"js");var T=this.raw_options.brace_style||null;T==="expand-strict"?this.raw_options.brace_style="expand":T==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var B=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var U=0;U<B.length;U++)B[U]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=B[U];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",v),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}_.prototype=new x,H.exports.Options=_},function(H){function l(v,_){this.raw_options=W(v,_),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(v,_){var b=this.raw_options[v],T=_||[];return typeof b=="object"?b!==null&&typeof b.concat=="function"&&(T=b.concat()):typeof b=="string"&&(T=b.split(/[^a-zA-Z0-9_\/\-]+/)),T},l.prototype._get_boolean=function(v,_){var b=this.raw_options[v],T=b===void 0?!!_:!!b;return T},l.prototype._get_characters=function(v,_){var b=this.raw_options[v],T=_||"";return typeof b=="string"&&(T=b.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),T},l.prototype._get_number=function(v,_){var b=this.raw_options[v];_=parseInt(_,10),isNaN(_)&&(_=0);var T=parseInt(b,10);return isNaN(T)&&(T=_),T},l.prototype._get_selection=function(v,_,b){var T=this._get_selection_list(v,_,b);if(T.length!==1)throw new Error("Invalid Option Value: The option '"+v+`' can only be one of the following values:
|
|
`+_+`
|
|
You passed in: '`+this.raw_options[v]+"'");return T[0]},l.prototype._get_selection_list=function(v,_,b){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(b=b||[_[0]],!this._is_valid_selection(b,_))throw new Error("Invalid Default Value!");var T=this._get_array(v,b);if(!this._is_valid_selection(T,_))throw new Error("Invalid Option Value: The option '"+v+`' can contain only the following values:
|
|
`+_+`
|
|
You passed in: '`+this.raw_options[v]+"'");return T},l.prototype._is_valid_selection=function(v,_){return v.length&&_.length&&!v.some(function(b){return _.indexOf(b)===-1})};function W(v,_){var b={};v=x(v);var T;for(T in v)T!==_&&(b[T]=v[T]);if(_&&v[_])for(T in v[_])b[T]=v[_][T];return b}function x(v){var _={},b;for(b in v){var T=b.replace(/-/g,"_");_[T]=v[b]}return _}H.exports.Options=l,H.exports.normalizeOpts=x,H.exports.mergeOpts=W},function(H,l,W){var x=W(8).InputScanner,v=W(9).Tokenizer,_=W(9).TOKEN,b=W(13).Directives,T=W(4),B=W(12).Pattern,U=W(14).TemplatablePattern;function F(S,G){return G.indexOf(S)!==-1}var I={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:_.START,RAW:_.RAW,EOF:_.EOF},M=new b(/\/\*/,/\*\//),j=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,C=/[0-9]/,$=/[^\d\.]/,X=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),Y=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";Y=Y.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),Y="\\?\\.(?!\\d) "+Y,Y=Y.replace(/ /g,"|");var fe=new RegExp(Y),ye="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),ae=ye.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Q=new RegExp("^(?:"+ae.join("|")+")$"),R,A=function(S,G){v.call(this,S,G),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var P=new B(this._input),p=new U(this._input).read_options(this._options);this.__patterns={template:p,identifier:p.starting_with(T.identifier).matching(T.identifierMatch),number:P.matching(j),punct:P.matching(fe),comment:P.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:P.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:P.matching(/<!--/),html_comment_end:P.matching(/-->/),include:P.starting_with(/#include/).until_after(T.lineBreak),shebang:P.starting_with(/#!/).until_after(T.lineBreak),xml:P.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:p.until(/['\\\n\r\u2028\u2029]/),double_quote:p.until(/["\\\n\r\u2028\u2029]/),template_text:p.until(/[`\\$]/),template_expression:p.until(/[`}\\]/)}};A.prototype=new v,A.prototype._is_comment=function(S){return S.type===I.COMMENT||S.type===I.BLOCK_COMMENT||S.type===I.UNKNOWN},A.prototype._is_opening=function(S){return S.type===I.START_BLOCK||S.type===I.START_EXPR},A.prototype._is_closing=function(S,G){return(S.type===I.END_BLOCK||S.type===I.END_EXPR)&&G&&(S.text==="]"&&G.text==="["||S.text===")"&&G.text==="("||S.text==="}"&&G.text==="{")},A.prototype._reset=function(){R=!1},A.prototype._get_next_token=function(S,G){var P=null;this._readWhitespace();var p=this._input.peek();return p===null?this._create_token(I.EOF,""):(P=P||this._read_non_javascript(p),P=P||this._read_string(p),P=P||this._read_pair(p,this._input.peek(1)),P=P||this._read_word(S),P=P||this._read_singles(p),P=P||this._read_comment(p),P=P||this._read_regexp(p,S),P=P||this._read_xml(p,S),P=P||this._read_punctuation(),P=P||this._create_token(I.UNKNOWN,this._input.next()),P)},A.prototype._read_word=function(S){var G;if(G=this.__patterns.identifier.read(),G!=="")return G=G.replace(T.allLineBreaks,`
|
|
`),!(S.type===I.DOT||S.type===I.RESERVED&&(S.text==="set"||S.text==="get"))&&Q.test(G)?(G==="in"||G==="of")&&(S.type===I.WORD||S.type===I.STRING)?this._create_token(I.OPERATOR,G):this._create_token(I.RESERVED,G):this._create_token(I.WORD,G);if(G=this.__patterns.number.read(),G!=="")return this._create_token(I.WORD,G)},A.prototype._read_singles=function(S){var G=null;return S==="("||S==="["?G=this._create_token(I.START_EXPR,S):S===")"||S==="]"?G=this._create_token(I.END_EXPR,S):S==="{"?G=this._create_token(I.START_BLOCK,S):S==="}"?G=this._create_token(I.END_BLOCK,S):S===";"?G=this._create_token(I.SEMICOLON,S):S==="."&&$.test(this._input.peek(1))?G=this._create_token(I.DOT,S):S===","&&(G=this._create_token(I.COMMA,S)),G&&this._input.next(),G},A.prototype._read_pair=function(S,G){var P=null;return S==="#"&&G==="{"&&(P=this._create_token(I.START_BLOCK,S+G)),P&&(this._input.next(),this._input.next()),P},A.prototype._read_punctuation=function(){var S=this.__patterns.punct.read();if(S!=="")return S==="="?this._create_token(I.EQUALS,S):S==="?."?this._create_token(I.DOT,S):this._create_token(I.OPERATOR,S)},A.prototype._read_non_javascript=function(S){var G="";if(S==="#"){if(this._is_first_token()&&(G=this.__patterns.shebang.read(),G))return this._create_token(I.UNKNOWN,G.trim()+`
|
|
`);if(G=this.__patterns.include.read(),G)return this._create_token(I.UNKNOWN,G.trim()+`
|
|
`);S=this._input.next();var P="#";if(this._input.hasNext()&&this._input.testChar(C)){do S=this._input.next(),P+=S;while(this._input.hasNext()&&S!=="#"&&S!=="=");return S==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(P+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(P+="{}",this._input.next(),this._input.next())),this._create_token(I.WORD,P)}this._input.back()}else if(S==="<"&&this._is_first_token()){if(G=this.__patterns.html_comment_start.read(),G){for(;this._input.hasNext()&&!this._input.testChar(T.newline);)G+=this._input.next();return R=!0,this._create_token(I.COMMENT,G)}}else if(R&&S==="-"&&(G=this.__patterns.html_comment_end.read(),G))return R=!1,this._create_token(I.COMMENT,G);return null},A.prototype._read_comment=function(S){var G=null;if(S==="/"){var P="";if(this._input.peek(1)==="*"){P=this.__patterns.block_comment.read();var p=M.get_directives(P);p&&p.ignore==="start"&&(P+=M.readIgnored(this._input)),P=P.replace(T.allLineBreaks,`
|
|
`),G=this._create_token(I.BLOCK_COMMENT,P),G.directives=p}else this._input.peek(1)==="/"&&(P=this.__patterns.comment.read(),G=this._create_token(I.COMMENT,P))}return G},A.prototype._read_string=function(S){if(S==="`"||S==="'"||S==='"'){var G=this._input.next();return this.has_char_escapes=!1,S==="`"?G+=this._read_string_recursive("`",!0,"${"):G+=this._read_string_recursive(S),this.has_char_escapes&&this._options.unescape_strings&&(G=L(G)),this._input.peek()===S&&(G+=this._input.next()),G=G.replace(T.allLineBreaks,`
|
|
`),this._create_token(I.STRING,G)}return null},A.prototype._allow_regexp_or_xml=function(S){return S.type===I.RESERVED&&F(S.text,["return","case","throw","else","do","typeof","yield"])||S.type===I.END_EXPR&&S.text===")"&&S.opened.previous.type===I.RESERVED&&F(S.opened.previous.text,["if","while","for"])||F(S.type,[I.COMMENT,I.START_EXPR,I.START_BLOCK,I.START,I.END_BLOCK,I.OPERATOR,I.EQUALS,I.EOF,I.SEMICOLON,I.COMMA])},A.prototype._read_regexp=function(S,G){if(S==="/"&&this._allow_regexp_or_xml(G)){for(var P=this._input.next(),p=!1,d=!1;this._input.hasNext()&&(p||d||this._input.peek()!==S)&&!this._input.testChar(T.newline);)P+=this._input.peek(),p?p=!1:(p=this._input.peek()==="\\",this._input.peek()==="["?d=!0:this._input.peek()==="]"&&(d=!1)),this._input.next();return this._input.peek()===S&&(P+=this._input.next(),P+=this._input.read(T.identifier)),this._create_token(I.STRING,P)}return null},A.prototype._read_xml=function(S,G){if(this._options.e4x&&S==="<"&&this._allow_regexp_or_xml(G)){var P="",p=this.__patterns.xml.read_match();if(p){for(var d=p[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),N=d.indexOf("{")===0,V=0;p;){var oe=!!p[1],xe=p[2],Oe=!!p[p.length-1]||xe.slice(0,8)==="![CDATA[";if(!Oe&&(xe===d||N&&xe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(oe?--V:++V),P+=p[0],V<=0)break;p=this.__patterns.xml.read_match()}return p||(P+=this._input.match(/[\s\S]*/g)[0]),P=P.replace(T.allLineBreaks,`
|
|
`),this._create_token(I.STRING,P)}}return null};function L(S){for(var G="",P=0,p=new x(S),d=null;p.hasNext();)if(d=p.match(/([\s]|[^\\]|\\\\)+/g),d&&(G+=d[0]),p.peek()==="\\"){if(p.next(),p.peek()==="x")d=p.match(/x([0-9A-Fa-f]{2})/g);else if(p.peek()==="u")d=p.match(/u([0-9A-Fa-f]{4})/g),d||(d=p.match(/u\{([0-9A-Fa-f]+)\}/g));else{G+="\\",p.hasNext()&&(G+=p.next());continue}if(!d||(P=parseInt(d[1],16),P>126&&P<=255&&d[0].indexOf("x")===0))return S;P>=0&&P<32||P>1114111?G+="\\"+d[0]:P===34||P===39||P===92?G+="\\"+String.fromCharCode(P):G+=String.fromCharCode(P)}return G}A.prototype._read_string_recursive=function(S,G,P){var p,d;S==="'"?d=this.__patterns.single_quote:S==='"'?d=this.__patterns.double_quote:S==="`"?d=this.__patterns.template_text:S==="}"&&(d=this.__patterns.template_expression);for(var N=d.read(),V="";this._input.hasNext();){if(V=this._input.next(),V===S||!G&&T.newline.test(V)){this._input.back();break}else V==="\\"&&this._input.hasNext()?(p=this._input.peek(),p==="x"||p==="u"?this.has_char_escapes=!0:p==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),V+=this._input.next()):P&&(P==="${"&&V==="$"&&this._input.peek()==="{"&&(V+=this._input.next()),P===V&&(S==="`"?V+=this._read_string_recursive("}",G,"`"):V+=this._read_string_recursive("`",G,"${"),this._input.hasNext()&&(V+=this._input.next())));V+=d.read(),N+=V}return N},H.exports.Tokenizer=A,H.exports.TOKEN=I,H.exports.positionable_operators=X.slice(),H.exports.line_starters=ye.slice()},function(H){var l=RegExp.prototype.hasOwnProperty("sticky");function W(x){this.__input=x||"",this.__input_length=this.__input.length,this.__position=0}W.prototype.restart=function(){this.__position=0},W.prototype.back=function(){this.__position>0&&(this.__position-=1)},W.prototype.hasNext=function(){return this.__position<this.__input_length},W.prototype.next=function(){var x=null;return this.hasNext()&&(x=this.__input.charAt(this.__position),this.__position+=1),x},W.prototype.peek=function(x){var v=null;return x=x||0,x+=this.__position,x>=0&&x<this.__input_length&&(v=this.__input.charAt(x)),v},W.prototype.__match=function(x,v){x.lastIndex=v;var _=x.exec(this.__input);return _&&!(l&&x.sticky)&&_.index!==v&&(_=null),_},W.prototype.test=function(x,v){return v=v||0,v+=this.__position,v>=0&&v<this.__input_length?!!this.__match(x,v):!1},W.prototype.testChar=function(x,v){var _=this.peek(v);return x.lastIndex=0,_!==null&&x.test(_)},W.prototype.match=function(x){var v=this.__match(x,this.__position);return v?this.__position+=v[0].length:v=null,v},W.prototype.read=function(x,v,_){var b="",T;return x&&(T=this.match(x),T&&(b+=T[0])),v&&(T||!x)&&(b+=this.readUntil(v,_)),b},W.prototype.readUntil=function(x,v){var _="",b=this.__position;x.lastIndex=this.__position;var T=x.exec(this.__input);return T?(b=T.index,v&&(b+=T[0].length)):b=this.__input_length,_=this.__input.substring(this.__position,b),this.__position=b,_},W.prototype.readUntilAfter=function(x){return this.readUntil(x,!0)},W.prototype.get_regexp=function(x,v){var _=null,b="g";return v&&l&&(b="y"),typeof x=="string"&&x!==""?_=new RegExp(x,b):x&&(_=new RegExp(x.source,b)),_},W.prototype.get_literal_regexp=function(x){return RegExp(x.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},W.prototype.peekUntilAfter=function(x){var v=this.__position,_=this.readUntilAfter(x);return this.__position=v,_},W.prototype.lookBack=function(x){var v=this.__position-1;return v>=x.length&&this.__input.substring(v-x.length,v).toLowerCase()===x},H.exports.InputScanner=W},function(H,l,W){var x=W(8).InputScanner,v=W(3).Token,_=W(10).TokenStream,b=W(11).WhitespacePattern,T={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},B=function(U,F){this._input=new x(U),this._options=F||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new b(this._input)};B.prototype.tokenize=function(){this._input.restart(),this.__tokens=new _,this._reset();for(var U,F=new v(T.START,""),I=null,M=[],j=new _;F.type!==T.EOF;){for(U=this._get_next_token(F,I);this._is_comment(U);)j.add(U),U=this._get_next_token(F,I);j.isEmpty()||(U.comments_before=j,j=new _),U.parent=I,this._is_opening(U)?(M.push(I),I=U):I&&this._is_closing(U,I)&&(U.opened=I,I.closed=U,I=M.pop(),U.parent=I),U.previous=F,F.next=U,this.__tokens.add(U),F=U}return this.__tokens},B.prototype._is_first_token=function(){return this.__tokens.isEmpty()},B.prototype._reset=function(){},B.prototype._get_next_token=function(U,F){this._readWhitespace();var I=this._input.read(/.+/g);return I?this._create_token(T.RAW,I):this._create_token(T.EOF,"")},B.prototype._is_comment=function(U){return!1},B.prototype._is_opening=function(U){return!1},B.prototype._is_closing=function(U,F){return!1},B.prototype._create_token=function(U,F){var I=new v(U,F,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return I},B.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},H.exports.Tokenizer=B,H.exports.TOKEN=T},function(H){function l(W){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=W}l.prototype.restart=function(){this.__position=0},l.prototype.isEmpty=function(){return this.__tokens_length===0},l.prototype.hasNext=function(){return this.__position<this.__tokens_length},l.prototype.next=function(){var W=null;return this.hasNext()&&(W=this.__tokens[this.__position],this.__position+=1),W},l.prototype.peek=function(W){var x=null;return W=W||0,W+=this.__position,W>=0&&W<this.__tokens_length&&(x=this.__tokens[W]),x},l.prototype.add=function(W){this.__parent_token&&(W.parent=this.__parent_token),this.__tokens.push(W),this.__tokens_length+=1},H.exports.TokenStream=l},function(H,l,W){var x=W(12).Pattern;function v(_,b){x.call(this,_,b),b?this._line_regexp=this._input.get_regexp(b._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}v.prototype=new x,v.prototype.__set_whitespace_patterns=function(_,b){_+="\\t ",b+="\\n\\r",this._match_pattern=this._input.get_regexp("["+_+b+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+b+"]")},v.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var _=this._input.read(this._match_pattern);if(_===" ")this.whitespace_before_token=" ";else if(_){var b=this.__split(this._newline_regexp,_);this.newline_count=b.length-1,this.whitespace_before_token=b[this.newline_count]}return _},v.prototype.matching=function(_,b){var T=this._create();return T.__set_whitespace_patterns(_,b),T._update(),T},v.prototype._create=function(){return new v(this._input,this)},v.prototype.__split=function(_,b){_.lastIndex=0;for(var T=0,B=[],U=_.exec(b);U;)B.push(b.substring(T,U.index)),T=U.index+U[0].length,U=_.exec(b);return T<b.length?B.push(b.substring(T,b.length)):B.push(""),B},H.exports.WhitespacePattern=v},function(H){function l(W,x){this._input=W,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,x&&(this._starting_pattern=this._input.get_regexp(x._starting_pattern,!0),this._match_pattern=this._input.get_regexp(x._match_pattern,!0),this._until_pattern=this._input.get_regexp(x._until_pattern),this._until_after=x._until_after)}l.prototype.read=function(){var W=this._input.read(this._starting_pattern);return(!this._starting_pattern||W)&&(W+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),W},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function(W){var x=this._create();return x._until_after=!0,x._until_pattern=this._input.get_regexp(W),x._update(),x},l.prototype.until=function(W){var x=this._create();return x._until_after=!1,x._until_pattern=this._input.get_regexp(W),x._update(),x},l.prototype.starting_with=function(W){var x=this._create();return x._starting_pattern=this._input.get_regexp(W,!0),x._update(),x},l.prototype.matching=function(W){var x=this._create();return x._match_pattern=this._input.get_regexp(W,!0),x._update(),x},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},H.exports.Pattern=l},function(H){function l(W,x){W=typeof W=="string"?W:W.source,x=typeof x=="string"?x:x.source,this.__directives_block_pattern=new RegExp(W+/ beautify( \w+[:]\w+)+ /.source+x,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(W+/\sbeautify\signore:end\s/.source+x,"g")}l.prototype.get_directives=function(W){if(!W.match(this.__directives_block_pattern))return null;var x={};this.__directive_pattern.lastIndex=0;for(var v=this.__directive_pattern.exec(W);v;)x[v[1]]=v[2],v=this.__directive_pattern.exec(W);return x},l.prototype.readIgnored=function(W){return W.readUntilAfter(this.__directives_end_ignore_pattern)},H.exports.Directives=l},function(H,l,W){var x=W(12).Pattern,v={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function _(b,T){x.call(this,b,T),this.__template_pattern=null,this._disabled=Object.assign({},v),this._excluded=Object.assign({},v),T&&(this.__template_pattern=this._input.get_regexp(T.__template_pattern),this._excluded=Object.assign(this._excluded,T._excluded),this._disabled=Object.assign(this._disabled,T._disabled));var B=new x(b);this.__patterns={handlebars_comment:B.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:B.starting_with(/{{{/).until_after(/}}}/),handlebars:B.starting_with(/{{/).until_after(/}}/),php:B.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:B.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:B.starting_with(/{%/).until_after(/%}/),django_value:B.starting_with(/{{/).until_after(/}}/),django_comment:B.starting_with(/{#/).until_after(/#}/),smarty:B.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:B.starting_with(/{\*/).until_after(/\*}/),smarty_literal:B.starting_with(/{literal}/).until_after(/{\/literal}/)}}_.prototype=new x,_.prototype._create=function(){return new _(this._input,this)},_.prototype._update=function(){this.__set_templated_pattern()},_.prototype.disable=function(b){var T=this._create();return T._disabled[b]=!0,T._update(),T},_.prototype.read_options=function(b){var T=this._create();for(var B in v)T._disabled[B]=b.templating.indexOf(B)===-1;return T._update(),T},_.prototype.exclude=function(b){var T=this._create();return T._excluded[b]=!0,T._update(),T},_.prototype.read=function(){var b="";this._match_pattern?b=this._input.read(this._starting_pattern):b=this._input.read(this._starting_pattern,this.__template_pattern);for(var T=this._read_template();T;)this._match_pattern?T+=this._input.read(this._match_pattern):T+=this._input.readUntil(this.__template_pattern),b+=T,T=this._read_template();return this._until_after&&(b+=this._input.readUntilAfter(this._until_pattern)),b},_.prototype.__set_templated_pattern=function(){var b=[];this._disabled.php||b.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||b.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||b.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||b.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(b.push(this.__patterns.django._starting_pattern.source),b.push(this.__patterns.django_value._starting_pattern.source),b.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||b.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&b.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+b.join("|")+")")},_.prototype._read_template=function(){var b="",T=this._input.peek();if(T==="<"){var B=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&B==="?"&&(b=b||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&B==="%"&&(b=b||this.__patterns.erb.read())}else T==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(b=b||this.__patterns.handlebars_comment.read(),b=b||this.__patterns.handlebars_unescaped.read(),b=b||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(b=b||this.__patterns.django_value.read()),this._excluded.django||(b=b||this.__patterns.django_comment.read(),b=b||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(b=b||this.__patterns.smarty_comment.read(),b=b||this.__patterns.smarty_literal.read(),b=b||this.__patterns.smarty.read()));return b},H.exports.TemplatablePattern=_}],D={};function g(H){var l=D[H];if(l!==void 0)return l.exports;var W=D[H]={exports:{}};return J[H](W,W.exports,g),W.exports}var ee=g(0);te=ee})();var ue=te;O=[],K=function(){return{js_beautify:ue}}.apply(Ie,O),K!==void 0&&(tt.exports=K)})()},75918:function(tt,Ie,O){"use strict";O.d(Ie,{Wi:function(){return g},Z0:function(){return ee},aU:function(){return D},eZ:function(){return l},wY:function(){return H}});var K=O(4348),te=O(69323),ue=O(13268),J=function(W,x,v,_){function b(T){return T instanceof v?T:new v(function(B){B(T)})}return new(v||(v=Promise))(function(T,B){function U(M){try{I(_.next(M))}catch(j){B(j)}}function F(M){try{I(_.throw(M))}catch(j){B(j)}}function I(M){M.done?T(M.value):b(M.value).then(U,F)}I((_=_.apply(W,x||[])).next())})};class D extends te.JT{constructor(x,v="",_="",b=!0,T){super(),this._onDidChange=this._register(new K.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=x,this._label=v,this._cssClass=_,this._enabled=b,this._actionCallback=T}get id(){return this._id}get label(){return this._label}set label(x){this._setLabel(x)}_setLabel(x){this._label!==x&&(this._label=x,this._onDidChange.fire({label:x}))}get tooltip(){return this._tooltip||""}set tooltip(x){this._setTooltip(x)}_setTooltip(x){this._tooltip!==x&&(this._tooltip=x,this._onDidChange.fire({tooltip:x}))}get class(){return this._cssClass}set class(x){this._setClass(x)}_setClass(x){this._cssClass!==x&&(this._cssClass=x,this._onDidChange.fire({class:x}))}get enabled(){return this._enabled}set enabled(x){this._setEnabled(x)}_setEnabled(x){this._enabled!==x&&(this._enabled=x,this._onDidChange.fire({enabled:x}))}get checked(){return this._checked}set checked(x){this._setChecked(x)}_setChecked(x){this._checked!==x&&(this._checked=x,this._onDidChange.fire({checked:x}))}run(x,v){return J(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(x))})}}class g extends te.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new K.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new K.Q5),this.onDidRun=this._onDidRun.event}run(x,v){return J(this,void 0,void 0,function*(){if(!x.enabled)return;this._onBeforeRun.fire({action:x});let _;try{yield this.runAction(x,v)}catch(b){_=b}this._onDidRun.fire({action:x,error:_})})}runAction(x,v){return J(this,void 0,void 0,function*(){yield x.run(v)})}}class ee extends D{constructor(x){super(ee.ID,x,x?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ee.ID="vs.actions.separator";class H{constructor(x,v,_,b){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=x,this.label=v,this.class=b,this._actions=_}get actions(){return this._actions}dispose(){}run(){return J(this,void 0,void 0,function*(){})}}class l extends D{constructor(){super(l.ID,ue.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(tt,Ie,O){"use strict";O.d(Ie,{ok:function(){return K}});function K(te,ue){if(!te)throw new Error(ue?`Assertion failed (${ue})`:"Assertion Failed")}},52615:function(tt,Ie,O){"use strict";O.d(Ie,{CM:function(){return D},JL:function(){return g},dT:function(){return H},fK:function(){return J},lA:function(){return ee}});var K=O(4348);class te{constructor(){this._icons=new Map,this._onDidRegister=new K.Q5}add(W){const x=this._icons.get(W.id);x?W.description?x.description=W.description:console.error(`Duplicate registration of codicon ${W.id}`):(this._icons.set(W.id,W),this._onDidRegister.fire(W))}get(W){return this._icons.get(W)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const ue=new te,J=ue;function D(l,W){return new ee(l,W)}function g(l){return l?l.replace(/\$\((.*?)\)/g,(W,x)=>` ${x} `).trim():""}class ee{constructor(W,x,v){this.id=W,this.definition=x,this.description=v,ue.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var H;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const W=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function x(b){if(b instanceof ee)return["codicon","codicon-"+b.id];const T=W.exec(b.id);if(!T)return x(ee.error);let[,B,U]=T;const F=["codicon","codicon-"+B];return U&&F.push("codicon-modifier-"+U.substr(1)),F}l.asClassNameArray=x;function v(b){return x(b).join(" ")}l.asClassName=v;function _(b){return"."+x(b).join(".")}l.asCSSSelector=_})(H||(H={})),function(l){l.add=new l("add",{fontCharacter:"\\ea60"}),l.plus=new l("plus",l.add.definition),l.gistNew=new l("gist-new",l.add.definition),l.repoCreate=new l("repo-create",l.add.definition),l.lightbulb=new l("lightbulb",{fontCharacter:"\\ea61"}),l.lightBulb=new l("light-bulb",{fontCharacter:"\\ea61"}),l.repo=new l("repo",{fontCharacter:"\\ea62"}),l.repoDelete=new l("repo-delete",{fontCharacter:"\\ea62"}),l.gistFork=new l("gist-fork",{fontCharacter:"\\ea63"}),l.repoForked=new l("repo-forked",{fontCharacter:"\\ea63"}),l.gitPullRequest=new l("git-pull-request",{fontCharacter:"\\ea64"}),l.gitPullRequestAbandoned=new l("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),l.recordKeys=new l("record-keys",{fontCharacter:"\\ea65"}),l.keyboard=new l("keyboard",{fontCharacter:"\\ea65"}),l.tag=new l("tag",{fontCharacter:"\\ea66"}),l.tagAdd=new l("tag-add",{fontCharacter:"\\ea66"}),l.tagRemove=new l("tag-remove",{fontCharacter:"\\ea66"}),l.person=new l("person",{fontCharacter:"\\ea67"}),l.personFollow=new l("person-follow",{fontCharacter:"\\ea67"}),l.personOutline=new l("person-outline",{fontCharacter:"\\ea67"}),l.personFilled=new l("person-filled",{fontCharacter:"\\ea67"}),l.gitBranch=new l("git-branch",{fontCharacter:"\\ea68"}),l.gitBranchCreate=new l("git-branch-create",{fontCharacter:"\\ea68"}),l.gitBranchDelete=new l("git-branch-delete",{fontCharacter:"\\ea68"}),l.sourceControl=new l("source-control",{fontCharacter:"\\ea68"}),l.mirror=new l("mirror",{fontCharacter:"\\ea69"}),l.mirrorPublic=new l("mirror-public",{fontCharacter:"\\ea69"}),l.star=new l("star",{fontCharacter:"\\ea6a"}),l.starAdd=new l("star-add",{fontCharacter:"\\ea6a"}),l.starDelete=new l("star-delete",{fontCharacter:"\\ea6a"}),l.starEmpty=new l("star-empty",{fontCharacter:"\\ea6a"}),l.comment=new l("comment",{fontCharacter:"\\ea6b"}),l.commentAdd=new l("comment-add",{fontCharacter:"\\ea6b"}),l.alert=new l("alert",{fontCharacter:"\\ea6c"}),l.warning=new l("warning",{fontCharacter:"\\ea6c"}),l.search=new l("search",{fontCharacter:"\\ea6d"}),l.searchSave=new l("search-save",{fontCharacter:"\\ea6d"}),l.logOut=new l("log-out",{fontCharacter:"\\ea6e"}),l.signOut=new l("sign-out",{fontCharacter:"\\ea6e"}),l.logIn=new l("log-in",{fontCharacter:"\\ea6f"}),l.signIn=new l("sign-in",{fontCharacter:"\\ea6f"}),l.eye=new l("eye",{fontCharacter:"\\ea70"}),l.eyeUnwatch=new l("eye-unwatch",{fontCharacter:"\\ea70"}),l.eyeWatch=new l("eye-watch",{fontCharacter:"\\ea70"}),l.circleFilled=new l("circle-filled",{fontCharacter:"\\ea71"}),l.primitiveDot=new l("primitive-dot",{fontCharacter:"\\ea71"}),l.closeDirty=new l("close-dirty",{fontCharacter:"\\ea71"}),l.debugBreakpoint=new l("debug-breakpoint",{fontCharacter:"\\ea71"}),l.debugBreakpointDisabled=new l("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),l.debugHint=new l("debug-hint",{fontCharacter:"\\ea71"}),l.primitiveSquare=new l("primitive-square",{fontCharacter:"\\ea72"}),l.edit=new l("edit",{fontCharacter:"\\ea73"}),l.pencil=new l("pencil",{fontCharacter:"\\ea73"}),l.info=new l("info",{fontCharacter:"\\ea74"}),l.issueOpened=new l("issue-opened",{fontCharacter:"\\ea74"}),l.gistPrivate=new l("gist-private",{fontCharacter:"\\ea75"}),l.gitForkPrivate=new l("git-fork-private",{fontCharacter:"\\ea75"}),l.lock=new l("lock",{fontCharacter:"\\ea75"}),l.mirrorPrivate=new l("mirror-private",{fontCharacter:"\\ea75"}),l.close=new l("close",{fontCharacter:"\\ea76"}),l.removeClose=new l("remove-close",{fontCharacter:"\\ea76"}),l.x=new l("x",{fontCharacter:"\\ea76"}),l.repoSync=new l("repo-sync",{fontCharacter:"\\ea77"}),l.sync=new l("sync",{fontCharacter:"\\ea77"}),l.clone=new l("clone",{fontCharacter:"\\ea78"}),l.desktopDownload=new l("desktop-download",{fontCharacter:"\\ea78"}),l.beaker=new l("beaker",{fontCharacter:"\\ea79"}),l.microscope=new l("microscope",{fontCharacter:"\\ea79"}),l.vm=new l("vm",{fontCharacter:"\\ea7a"}),l.deviceDesktop=new l("device-desktop",{fontCharacter:"\\ea7a"}),l.file=new l("file",{fontCharacter:"\\ea7b"}),l.fileText=new l("file-text",{fontCharacter:"\\ea7b"}),l.more=new l("more",{fontCharacter:"\\ea7c"}),l.ellipsis=new l("ellipsis",{fontCharacter:"\\ea7c"}),l.kebabHorizontal=new l("kebab-horizontal",{fontCharacter:"\\ea7c"}),l.mailReply=new l("mail-reply",{fontCharacter:"\\ea7d"}),l.reply=new l("reply",{fontCharacter:"\\ea7d"}),l.organization=new l("organization",{fontCharacter:"\\ea7e"}),l.organizationFilled=new l("organization-filled",{fontCharacter:"\\ea7e"}),l.organizationOutline=new l("organization-outline",{fontCharacter:"\\ea7e"}),l.newFile=new l("new-file",{fontCharacter:"\\ea7f"}),l.fileAdd=new l("file-add",{fontCharacter:"\\ea7f"}),l.newFolder=new l("new-folder",{fontCharacter:"\\ea80"}),l.fileDirectoryCreate=new l("file-directory-create",{fontCharacter:"\\ea80"}),l.trash=new l("trash",{fontCharacter:"\\ea81"}),l.trashcan=new l("trashcan",{fontCharacter:"\\ea81"}),l.history=new l("history",{fontCharacter:"\\ea82"}),l.clock=new l("clock",{fontCharacter:"\\ea82"}),l.folder=new l("folder",{fontCharacter:"\\ea83"}),l.fileDirectory=new l("file-directory",{fontCharacter:"\\ea83"}),l.symbolFolder=new l("symbol-folder",{fontCharacter:"\\ea83"}),l.logoGithub=new l("logo-github",{fontCharacter:"\\ea84"}),l.markGithub=new l("mark-github",{fontCharacter:"\\ea84"}),l.github=new l("github",{fontCharacter:"\\ea84"}),l.terminal=new l("terminal",{fontCharacter:"\\ea85"}),l.console=new l("console",{fontCharacter:"\\ea85"}),l.repl=new l("repl",{fontCharacter:"\\ea85"}),l.zap=new l("zap",{fontCharacter:"\\ea86"}),l.symbolEvent=new l("symbol-event",{fontCharacter:"\\ea86"}),l.error=new l("error",{fontCharacter:"\\ea87"}),l.stop=new l("stop",{fontCharacter:"\\ea87"}),l.variable=new l("variable",{fontCharacter:"\\ea88"}),l.symbolVariable=new l("symbol-variable",{fontCharacter:"\\ea88"}),l.array=new l("array",{fontCharacter:"\\ea8a"}),l.symbolArray=new l("symbol-array",{fontCharacter:"\\ea8a"}),l.symbolModule=new l("symbol-module",{fontCharacter:"\\ea8b"}),l.symbolPackage=new l("symbol-package",{fontCharacter:"\\ea8b"}),l.symbolNamespace=new l("symbol-namespace",{fontCharacter:"\\ea8b"}),l.symbolObject=new l("symbol-object",{fontCharacter:"\\ea8b"}),l.symbolMethod=new l("symbol-method",{fontCharacter:"\\ea8c"}),l.symbolFunction=new l("symbol-function",{fontCharacter:"\\ea8c"}),l.symbolConstructor=new l("symbol-constructor",{fontCharacter:"\\ea8c"}),l.symbolBoolean=new l("symbol-boolean",{fontCharacter:"\\ea8f"}),l.symbolNull=new l("symbol-null",{fontCharacter:"\\ea8f"}),l.symbolNumeric=new l("symbol-numeric",{fontCharacter:"\\ea90"}),l.symbolNumber=new l("symbol-number",{fontCharacter:"\\ea90"}),l.symbolStructure=new l("symbol-structure",{fontCharacter:"\\ea91"}),l.symbolStruct=new l("symbol-struct",{fontCharacter:"\\ea91"}),l.symbolParameter=new l("symbol-parameter",{fontCharacter:"\\ea92"}),l.symbolTypeParameter=new l("symbol-type-parameter",{fontCharacter:"\\ea92"}),l.symbolKey=new l("symbol-key",{fontCharacter:"\\ea93"}),l.symbolText=new l("symbol-text",{fontCharacter:"\\ea93"}),l.symbolReference=new l("symbol-reference",{fontCharacter:"\\ea94"}),l.goToFile=new l("go-to-file",{fontCharacter:"\\ea94"}),l.symbolEnum=new l("symbol-enum",{fontCharacter:"\\ea95"}),l.symbolValue=new l("symbol-value",{fontCharacter:"\\ea95"}),l.symbolRuler=new l("symbol-ruler",{fontCharacter:"\\ea96"}),l.symbolUnit=new l("symbol-unit",{fontCharacter:"\\ea96"}),l.activateBreakpoints=new l("activate-breakpoints",{fontCharacter:"\\ea97"}),l.archive=new l("archive",{fontCharacter:"\\ea98"}),l.arrowBoth=new l("arrow-both",{fontCharacter:"\\ea99"}),l.arrowDown=new l("arrow-down",{fontCharacter:"\\ea9a"}),l.arrowLeft=new l("arrow-left",{fontCharacter:"\\ea9b"}),l.arrowRight=new l("arrow-right",{fontCharacter:"\\ea9c"}),l.arrowSmallDown=new l("arrow-small-down",{fontCharacter:"\\ea9d"}),l.arrowSmallLeft=new l("arrow-small-left",{fontCharacter:"\\ea9e"}),l.arrowSmallRight=new l("arrow-small-right",{fontCharacter:"\\ea9f"}),l.arrowSmallUp=new l("arrow-small-up",{fontCharacter:"\\eaa0"}),l.arrowUp=new l("arrow-up",{fontCharacter:"\\eaa1"}),l.bell=new l("bell",{fontCharacter:"\\eaa2"}),l.bold=new l("bold",{fontCharacter:"\\eaa3"}),l.book=new l("book",{fontCharacter:"\\eaa4"}),l.bookmark=new l("bookmark",{fontCharacter:"\\eaa5"}),l.debugBreakpointConditionalUnverified=new l("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),l.debugBreakpointConditional=new l("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),l.debugBreakpointConditionalDisabled=new l("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),l.debugBreakpointDataUnverified=new l("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),l.debugBreakpointData=new l("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),l.debugBreakpointDataDisabled=new l("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),l.debugBreakpointLogUnverified=new l("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),l.debugBreakpointLog=new l("debug-breakpoint-log",{fontCharacter:"\\eaab"}),l.debugBreakpointLogDisabled=new l("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),l.briefcase=new l("briefcase",{fontCharacter:"\\eaac"}),l.broadcast=new l("broadcast",{fontCharacter:"\\eaad"}),l.browser=new l("browser",{fontCharacter:"\\eaae"}),l.bug=new l("bug",{fontCharacter:"\\eaaf"}),l.calendar=new l("calendar",{fontCharacter:"\\eab0"}),l.caseSensitive=new l("case-sensitive",{fontCharacter:"\\eab1"}),l.check=new l("check",{fontCharacter:"\\eab2"}),l.checklist=new l("checklist",{fontCharacter:"\\eab3"}),l.chevronDown=new l("chevron-down",{fontCharacter:"\\eab4"}),l.dropDownButton=new l("drop-down-button",l.chevronDown.definition),l.chevronLeft=new l("chevron-left",{fontCharacter:"\\eab5"}),l.chevronRight=new l("chevron-right",{fontCharacter:"\\eab6"}),l.chevronUp=new l("chevron-up",{fontCharacter:"\\eab7"}),l.chromeClose=new l("chrome-close",{fontCharacter:"\\eab8"}),l.chromeMaximize=new l("chrome-maximize",{fontCharacter:"\\eab9"}),l.chromeMinimize=new l("chrome-minimize",{fontCharacter:"\\eaba"}),l.chromeRestore=new l("chrome-restore",{fontCharacter:"\\eabb"}),l.circleOutline=new l("circle-outline",{fontCharacter:"\\eabc"}),l.debugBreakpointUnverified=new l("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),l.circleSlash=new l("circle-slash",{fontCharacter:"\\eabd"}),l.circuitBoard=new l("circuit-board",{fontCharacter:"\\eabe"}),l.clearAll=new l("clear-all",{fontCharacter:"\\eabf"}),l.clippy=new l("clippy",{fontCharacter:"\\eac0"}),l.closeAll=new l("close-all",{fontCharacter:"\\eac1"}),l.cloudDownload=new l("cloud-download",{fontCharacter:"\\eac2"}),l.cloudUpload=new l("cloud-upload",{fontCharacter:"\\eac3"}),l.code=new l("code",{fontCharacter:"\\eac4"}),l.collapseAll=new l("collapse-all",{fontCharacter:"\\eac5"}),l.colorMode=new l("color-mode",{fontCharacter:"\\eac6"}),l.commentDiscussion=new l("comment-discussion",{fontCharacter:"\\eac7"}),l.compareChanges=new l("compare-changes",{fontCharacter:"\\eafd"}),l.creditCard=new l("credit-card",{fontCharacter:"\\eac9"}),l.dash=new l("dash",{fontCharacter:"\\eacc"}),l.dashboard=new l("dashboard",{fontCharacter:"\\eacd"}),l.database=new l("database",{fontCharacter:"\\eace"}),l.debugContinue=new l("debug-continue",{fontCharacter:"\\eacf"}),l.debugDisconnect=new l("debug-disconnect",{fontCharacter:"\\ead0"}),l.debugPause=new l("debug-pause",{fontCharacter:"\\ead1"}),l.debugRestart=new l("debug-restart",{fontCharacter:"\\ead2"}),l.debugStart=new l("debug-start",{fontCharacter:"\\ead3"}),l.debugStepInto=new l("debug-step-into",{fontCharacter:"\\ead4"}),l.debugStepOut=new l("debug-step-out",{fontCharacter:"\\ead5"}),l.debugStepOver=new l("debug-step-over",{fontCharacter:"\\ead6"}),l.debugStop=new l("debug-stop",{fontCharacter:"\\ead7"}),l.debug=new l("debug",{fontCharacter:"\\ead8"}),l.deviceCameraVideo=new l("device-camera-video",{fontCharacter:"\\ead9"}),l.deviceCamera=new l("device-camera",{fontCharacter:"\\eada"}),l.deviceMobile=new l("device-mobile",{fontCharacter:"\\eadb"}),l.diffAdded=new l("diff-added",{fontCharacter:"\\eadc"}),l.diffIgnored=new l("diff-ignored",{fontCharacter:"\\eadd"}),l.diffModified=new l("diff-modified",{fontCharacter:"\\eade"}),l.diffRemoved=new l("diff-removed",{fontCharacter:"\\eadf"}),l.diffRenamed=new l("diff-renamed",{fontCharacter:"\\eae0"}),l.diff=new l("diff",{fontCharacter:"\\eae1"}),l.discard=new l("discard",{fontCharacter:"\\eae2"}),l.editorLayout=new l("editor-layout",{fontCharacter:"\\eae3"}),l.emptyWindow=new l("empty-window",{fontCharacter:"\\eae4"}),l.exclude=new l("exclude",{fontCharacter:"\\eae5"}),l.extensions=new l("extensions",{fontCharacter:"\\eae6"}),l.eyeClosed=new l("eye-closed",{fontCharacter:"\\eae7"}),l.fileBinary=new l("file-binary",{fontCharacter:"\\eae8"}),l.fileCode=new l("file-code",{fontCharacter:"\\eae9"}),l.fileMedia=new l("file-media",{fontCharacter:"\\eaea"}),l.filePdf=new l("file-pdf",{fontCharacter:"\\eaeb"}),l.fileSubmodule=new l("file-submodule",{fontCharacter:"\\eaec"}),l.fileSymlinkDirectory=new l("file-symlink-directory",{fontCharacter:"\\eaed"}),l.fileSymlinkFile=new l("file-symlink-file",{fontCharacter:"\\eaee"}),l.fileZip=new l("file-zip",{fontCharacter:"\\eaef"}),l.files=new l("files",{fontCharacter:"\\eaf0"}),l.filter=new l("filter",{fontCharacter:"\\eaf1"}),l.flame=new l("flame",{fontCharacter:"\\eaf2"}),l.foldDown=new l("fold-down",{fontCharacter:"\\eaf3"}),l.foldUp=new l("fold-up",{fontCharacter:"\\eaf4"}),l.fold=new l("fold",{fontCharacter:"\\eaf5"}),l.folderActive=new l("folder-active",{fontCharacter:"\\eaf6"}),l.folderOpened=new l("folder-opened",{fontCharacter:"\\eaf7"}),l.gear=new l("gear",{fontCharacter:"\\eaf8"}),l.gift=new l("gift",{fontCharacter:"\\eaf9"}),l.gistSecret=new l("gist-secret",{fontCharacter:"\\eafa"}),l.gist=new l("gist",{fontCharacter:"\\eafb"}),l.gitCommit=new l("git-commit",{fontCharacter:"\\eafc"}),l.gitCompare=new l("git-compare",{fontCharacter:"\\eafd"}),l.gitMerge=new l("git-merge",{fontCharacter:"\\eafe"}),l.githubAction=new l("github-action",{fontCharacter:"\\eaff"}),l.githubAlt=new l("github-alt",{fontCharacter:"\\eb00"}),l.globe=new l("globe",{fontCharacter:"\\eb01"}),l.grabber=new l("grabber",{fontCharacter:"\\eb02"}),l.graph=new l("graph",{fontCharacter:"\\eb03"}),l.gripper=new l("gripper",{fontCharacter:"\\eb04"}),l.heart=new l("heart",{fontCharacter:"\\eb05"}),l.home=new l("home",{fontCharacter:"\\eb06"}),l.horizontalRule=new l("horizontal-rule",{fontCharacter:"\\eb07"}),l.hubot=new l("hubot",{fontCharacter:"\\eb08"}),l.inbox=new l("inbox",{fontCharacter:"\\eb09"}),l.issueClosed=new l("issue-closed",{fontCharacter:"\\eba4"}),l.issueReopened=new l("issue-reopened",{fontCharacter:"\\eb0b"}),l.issues=new l("issues",{fontCharacter:"\\eb0c"}),l.italic=new l("italic",{fontCharacter:"\\eb0d"}),l.jersey=new l("jersey",{fontCharacter:"\\eb0e"}),l.json=new l("json",{fontCharacter:"\\eb0f"}),l.kebabVertical=new l("kebab-vertical",{fontCharacter:"\\eb10"}),l.key=new l("key",{fontCharacter:"\\eb11"}),l.law=new l("law",{fontCharacter:"\\eb12"}),l.lightbulbAutofix=new l("lightbulb-autofix",{fontCharacter:"\\eb13"}),l.linkExternal=new l("link-external",{fontCharacter:"\\eb14"}),l.link=new l("link",{fontCharacter:"\\eb15"}),l.listOrdered=new l("list-ordered",{fontCharacter:"\\eb16"}),l.listUnordered=new l("list-unordered",{fontCharacter:"\\eb17"}),l.liveShare=new l("live-share",{fontCharacter:"\\eb18"}),l.loading=new l("loading",{fontCharacter:"\\eb19"}),l.location=new l("location",{fontCharacter:"\\eb1a"}),l.mailRead=new l("mail-read",{fontCharacter:"\\eb1b"}),l.mail=new l("mail",{fontCharacter:"\\eb1c"}),l.markdown=new l("markdown",{fontCharacter:"\\eb1d"}),l.megaphone=new l("megaphone",{fontCharacter:"\\eb1e"}),l.mention=new l("mention",{fontCharacter:"\\eb1f"}),l.milestone=new l("milestone",{fontCharacter:"\\eb20"}),l.mortarBoard=new l("mortar-board",{fontCharacter:"\\eb21"}),l.move=new l("move",{fontCharacter:"\\eb22"}),l.multipleWindows=new l("multiple-windows",{fontCharacter:"\\eb23"}),l.mute=new l("mute",{fontCharacter:"\\eb24"}),l.noNewline=new l("no-newline",{fontCharacter:"\\eb25"}),l.note=new l("note",{fontCharacter:"\\eb26"}),l.octoface=new l("octoface",{fontCharacter:"\\eb27"}),l.openPreview=new l("open-preview",{fontCharacter:"\\eb28"}),l.package_=new l("package",{fontCharacter:"\\eb29"}),l.paintcan=new l("paintcan",{fontCharacter:"\\eb2a"}),l.pin=new l("pin",{fontCharacter:"\\eb2b"}),l.play=new l("play",{fontCharacter:"\\eb2c"}),l.run=new l("run",{fontCharacter:"\\eb2c"}),l.plug=new l("plug",{fontCharacter:"\\eb2d"}),l.preserveCase=new l("preserve-case",{fontCharacter:"\\eb2e"}),l.preview=new l("preview",{fontCharacter:"\\eb2f"}),l.project=new l("project",{fontCharacter:"\\eb30"}),l.pulse=new l("pulse",{fontCharacter:"\\eb31"}),l.question=new l("question",{fontCharacter:"\\eb32"}),l.quote=new l("quote",{fontCharacter:"\\eb33"}),l.radioTower=new l("radio-tower",{fontCharacter:"\\eb34"}),l.reactions=new l("reactions",{fontCharacter:"\\eb35"}),l.references=new l("references",{fontCharacter:"\\eb36"}),l.refresh=new l("refresh",{fontCharacter:"\\eb37"}),l.regex=new l("regex",{fontCharacter:"\\eb38"}),l.remoteExplorer=new l("remote-explorer",{fontCharacter:"\\eb39"}),l.remote=new l("remote",{fontCharacter:"\\eb3a"}),l.remove=new l("remove",{fontCharacter:"\\eb3b"}),l.replaceAll=new l("replace-all",{fontCharacter:"\\eb3c"}),l.replace=new l("replace",{fontCharacter:"\\eb3d"}),l.repoClone=new l("repo-clone",{fontCharacter:"\\eb3e"}),l.repoForcePush=new l("repo-force-push",{fontCharacter:"\\eb3f"}),l.repoPull=new l("repo-pull",{fontCharacter:"\\eb40"}),l.repoPush=new l("repo-push",{fontCharacter:"\\eb41"}),l.report=new l("report",{fontCharacter:"\\eb42"}),l.requestChanges=new l("request-changes",{fontCharacter:"\\eb43"}),l.rocket=new l("rocket",{fontCharacter:"\\eb44"}),l.rootFolderOpened=new l("root-folder-opened",{fontCharacter:"\\eb45"}),l.rootFolder=new l("root-folder",{fontCharacter:"\\eb46"}),l.rss=new l("rss",{fontCharacter:"\\eb47"}),l.ruby=new l("ruby",{fontCharacter:"\\eb48"}),l.saveAll=new l("save-all",{fontCharacter:"\\eb49"}),l.saveAs=new l("save-as",{fontCharacter:"\\eb4a"}),l.save=new l("save",{fontCharacter:"\\eb4b"}),l.screenFull=new l("screen-full",{fontCharacter:"\\eb4c"}),l.screenNormal=new l("screen-normal",{fontCharacter:"\\eb4d"}),l.searchStop=new l("search-stop",{fontCharacter:"\\eb4e"}),l.server=new l("server",{fontCharacter:"\\eb50"}),l.settingsGear=new l("settings-gear",{fontCharacter:"\\eb51"}),l.settings=new l("settings",{fontCharacter:"\\eb52"}),l.shield=new l("shield",{fontCharacter:"\\eb53"}),l.smiley=new l("smiley",{fontCharacter:"\\eb54"}),l.sortPrecedence=new l("sort-precedence",{fontCharacter:"\\eb55"}),l.splitHorizontal=new l("split-horizontal",{fontCharacter:"\\eb56"}),l.splitVertical=new l("split-vertical",{fontCharacter:"\\eb57"}),l.squirrel=new l("squirrel",{fontCharacter:"\\eb58"}),l.starFull=new l("star-full",{fontCharacter:"\\eb59"}),l.starHalf=new l("star-half",{fontCharacter:"\\eb5a"}),l.symbolClass=new l("symbol-class",{fontCharacter:"\\eb5b"}),l.symbolColor=new l("symbol-color",{fontCharacter:"\\eb5c"}),l.symbolConstant=new l("symbol-constant",{fontCharacter:"\\eb5d"}),l.symbolEnumMember=new l("symbol-enum-member",{fontCharacter:"\\eb5e"}),l.symbolField=new l("symbol-field",{fontCharacter:"\\eb5f"}),l.symbolFile=new l("symbol-file",{fontCharacter:"\\eb60"}),l.symbolInterface=new l("symbol-interface",{fontCharacter:"\\eb61"}),l.symbolKeyword=new l("symbol-keyword",{fontCharacter:"\\eb62"}),l.symbolMisc=new l("symbol-misc",{fontCharacter:"\\eb63"}),l.symbolOperator=new l("symbol-operator",{fontCharacter:"\\eb64"}),l.symbolProperty=new l("symbol-property",{fontCharacter:"\\eb65"}),l.wrench=new l("wrench",{fontCharacter:"\\eb65"}),l.wrenchSubaction=new l("wrench-subaction",{fontCharacter:"\\eb65"}),l.symbolSnippet=new l("symbol-snippet",{fontCharacter:"\\eb66"}),l.tasklist=new l("tasklist",{fontCharacter:"\\eb67"}),l.telescope=new l("telescope",{fontCharacter:"\\eb68"}),l.textSize=new l("text-size",{fontCharacter:"\\eb69"}),l.threeBars=new l("three-bars",{fontCharacter:"\\eb6a"}),l.thumbsdown=new l("thumbsdown",{fontCharacter:"\\eb6b"}),l.thumbsup=new l("thumbsup",{fontCharacter:"\\eb6c"}),l.tools=new l("tools",{fontCharacter:"\\eb6d"}),l.triangleDown=new l("triangle-down",{fontCharacter:"\\eb6e"}),l.triangleLeft=new l("triangle-left",{fontCharacter:"\\eb6f"}),l.triangleRight=new l("triangle-right",{fontCharacter:"\\eb70"}),l.triangleUp=new l("triangle-up",{fontCharacter:"\\eb71"}),l.twitter=new l("twitter",{fontCharacter:"\\eb72"}),l.unfold=new l("unfold",{fontCharacter:"\\eb73"}),l.unlock=new l("unlock",{fontCharacter:"\\eb74"}),l.unmute=new l("unmute",{fontCharacter:"\\eb75"}),l.unverified=new l("unverified",{fontCharacter:"\\eb76"}),l.verified=new l("verified",{fontCharacter:"\\eb77"}),l.versions=new l("versions",{fontCharacter:"\\eb78"}),l.vmActive=new l("vm-active",{fontCharacter:"\\eb79"}),l.vmOutline=new l("vm-outline",{fontCharacter:"\\eb7a"}),l.vmRunning=new l("vm-running",{fontCharacter:"\\eb7b"}),l.watch=new l("watch",{fontCharacter:"\\eb7c"}),l.whitespace=new l("whitespace",{fontCharacter:"\\eb7d"}),l.wholeWord=new l("whole-word",{fontCharacter:"\\eb7e"}),l.window=new l("window",{fontCharacter:"\\eb7f"}),l.wordWrap=new l("word-wrap",{fontCharacter:"\\eb80"}),l.zoomIn=new l("zoom-in",{fontCharacter:"\\eb81"}),l.zoomOut=new l("zoom-out",{fontCharacter:"\\eb82"}),l.listFilter=new l("list-filter",{fontCharacter:"\\eb83"}),l.listFlat=new l("list-flat",{fontCharacter:"\\eb84"}),l.listSelection=new l("list-selection",{fontCharacter:"\\eb85"}),l.selection=new l("selection",{fontCharacter:"\\eb85"}),l.listTree=new l("list-tree",{fontCharacter:"\\eb86"}),l.debugBreakpointFunctionUnverified=new l("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),l.debugBreakpointFunction=new l("debug-breakpoint-function",{fontCharacter:"\\eb88"}),l.debugBreakpointFunctionDisabled=new l("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),l.debugStackframeActive=new l("debug-stackframe-active",{fontCharacter:"\\eb89"}),l.debugStackframeDot=new l("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),l.debugStackframe=new l("debug-stackframe",{fontCharacter:"\\eb8b"}),l.debugStackframeFocused=new l("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),l.debugBreakpointUnsupported=new l("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),l.symbolString=new l("symbol-string",{fontCharacter:"\\eb8d"}),l.debugReverseContinue=new l("debug-reverse-continue",{fontCharacter:"\\eb8e"}),l.debugStepBack=new l("debug-step-back",{fontCharacter:"\\eb8f"}),l.debugRestartFrame=new l("debug-restart-frame",{fontCharacter:"\\eb90"}),l.callIncoming=new l("call-incoming",{fontCharacter:"\\eb92"}),l.callOutgoing=new l("call-outgoing",{fontCharacter:"\\eb93"}),l.menu=new l("menu",{fontCharacter:"\\eb94"}),l.expandAll=new l("expand-all",{fontCharacter:"\\eb95"}),l.feedback=new l("feedback",{fontCharacter:"\\eb96"}),l.groupByRefType=new l("group-by-ref-type",{fontCharacter:"\\eb97"}),l.ungroupByRefType=new l("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),l.account=new l("account",{fontCharacter:"\\eb99"}),l.bellDot=new l("bell-dot",{fontCharacter:"\\eb9a"}),l.debugConsole=new l("debug-console",{fontCharacter:"\\eb9b"}),l.library=new l("library",{fontCharacter:"\\eb9c"}),l.output=new l("output",{fontCharacter:"\\eb9d"}),l.runAll=new l("run-all",{fontCharacter:"\\eb9e"}),l.syncIgnored=new l("sync-ignored",{fontCharacter:"\\eb9f"}),l.pinned=new l("pinned",{fontCharacter:"\\eba0"}),l.githubInverted=new l("github-inverted",{fontCharacter:"\\eba1"}),l.debugAlt=new l("debug-alt",{fontCharacter:"\\eb91"}),l.serverProcess=new l("server-process",{fontCharacter:"\\eba2"}),l.serverEnvironment=new l("server-environment",{fontCharacter:"\\eba3"}),l.pass=new l("pass",{fontCharacter:"\\eba4"}),l.stopCircle=new l("stop-circle",{fontCharacter:"\\eba5"}),l.playCircle=new l("play-circle",{fontCharacter:"\\eba6"}),l.record=new l("record",{fontCharacter:"\\eba7"}),l.debugAltSmall=new l("debug-alt-small",{fontCharacter:"\\eba8"}),l.vmConnect=new l("vm-connect",{fontCharacter:"\\eba9"}),l.cloud=new l("cloud",{fontCharacter:"\\ebaa"}),l.merge=new l("merge",{fontCharacter:"\\ebab"}),l.exportIcon=new l("export",{fontCharacter:"\\ebac"}),l.graphLeft=new l("graph-left",{fontCharacter:"\\ebad"}),l.magnet=new l("magnet",{fontCharacter:"\\ebae"}),l.notebook=new l("notebook",{fontCharacter:"\\ebaf"}),l.redo=new l("redo",{fontCharacter:"\\ebb0"}),l.checkAll=new l("check-all",{fontCharacter:"\\ebb1"}),l.pinnedDirty=new l("pinned-dirty",{fontCharacter:"\\ebb2"}),l.passFilled=new l("pass-filled",{fontCharacter:"\\ebb3"}),l.circleLargeFilled=new l("circle-large-filled",{fontCharacter:"\\ebb4"}),l.circleLargeOutline=new l("circle-large-outline",{fontCharacter:"\\ebb5"}),l.combine=new l("combine",{fontCharacter:"\\ebb6"}),l.gather=new l("gather",{fontCharacter:"\\ebb6"}),l.table=new l("table",{fontCharacter:"\\ebb7"}),l.variableGroup=new l("variable-group",{fontCharacter:"\\ebb8"}),l.typeHierarchy=new l("type-hierarchy",{fontCharacter:"\\ebb9"}),l.typeHierarchySub=new l("type-hierarchy-sub",{fontCharacter:"\\ebba"}),l.typeHierarchySuper=new l("type-hierarchy-super",{fontCharacter:"\\ebbb"}),l.gitPullRequestCreate=new l("git-pull-request-create",{fontCharacter:"\\ebbc"}),l.runAbove=new l("run-above",{fontCharacter:"\\ebbd"}),l.runBelow=new l("run-below",{fontCharacter:"\\ebbe"}),l.notebookTemplate=new l("notebook-template",{fontCharacter:"\\ebbf"}),l.debugRerun=new l("debug-rerun",{fontCharacter:"\\ebc0"}),l.workspaceTrusted=new l("workspace-trusted",{fontCharacter:"\\ebc1"}),l.workspaceUntrusted=new l("workspace-untrusted",{fontCharacter:"\\ebc2"}),l.workspaceUnspecified=new l("workspace-unspecified",{fontCharacter:"\\ebc3"}),l.terminalCmd=new l("terminal-cmd",{fontCharacter:"\\ebc4"}),l.terminalDebian=new l("terminal-debian",{fontCharacter:"\\ebc5"}),l.terminalLinux=new l("terminal-linux",{fontCharacter:"\\ebc6"}),l.terminalPowershell=new l("terminal-powershell",{fontCharacter:"\\ebc7"}),l.terminalTmux=new l("terminal-tmux",{fontCharacter:"\\ebc8"}),l.terminalUbuntu=new l("terminal-ubuntu",{fontCharacter:"\\ebc9"}),l.terminalBash=new l("terminal-bash",{fontCharacter:"\\ebca"}),l.arrowSwap=new l("arrow-swap",{fontCharacter:"\\ebcb"}),l.copy=new l("copy",{fontCharacter:"\\ebcc"}),l.personAdd=new l("person-add",{fontCharacter:"\\ebcd"}),l.filterFilled=new l("filter-filled",{fontCharacter:"\\ebce"}),l.wand=new l("wand",{fontCharacter:"\\ebcf"}),l.debugLineByLine=new l("debug-line-by-line",{fontCharacter:"\\ebd0"}),l.inspect=new l("inspect",{fontCharacter:"\\ebd1"}),l.layers=new l("layers",{fontCharacter:"\\ebd2"}),l.layersDot=new l("layers-dot",{fontCharacter:"\\ebd3"}),l.layersActive=new l("layers-active",{fontCharacter:"\\ebd4"}),l.compass=new l("compass",{fontCharacter:"\\ebd5"}),l.compassDot=new l("compass-dot",{fontCharacter:"\\ebd6"}),l.compassActive=new l("compass-active",{fontCharacter:"\\ebd7"}),l.azure=new l("azure",{fontCharacter:"\\ebd8"}),l.issueDraft=new l("issue-draft",{fontCharacter:"\\ebd9"}),l.gitPullRequestClosed=new l("git-pull-request-closed",{fontCharacter:"\\ebda"}),l.gitPullRequestDraft=new l("git-pull-request-draft",{fontCharacter:"\\ebdb"}),l.debugAll=new l("debug-all",{fontCharacter:"\\ebdc"}),l.debugCoverage=new l("debug-coverage",{fontCharacter:"\\ebdd"}),l.runErrors=new l("run-errors",{fontCharacter:"\\ebde"}),l.folderLibrary=new l("folder-library",{fontCharacter:"\\ebdf"}),l.debugContinueSmall=new l("debug-continue-small",{fontCharacter:"\\ebe0"}),l.beakerStop=new l("beaker-stop",{fontCharacter:"\\ebe1"}),l.graphLine=new l("graph-line",{fontCharacter:"\\ebe2"}),l.graphScatter=new l("graph-scatter",{fontCharacter:"\\ebe3"}),l.pieChart=new l("pie-chart",{fontCharacter:"\\ebe4"}),l.bracket=new l("bracket",l.json.definition),l.bracketDot=new l("bracket-dot",{fontCharacter:"\\ebe5"}),l.bracketError=new l("bracket-error",{fontCharacter:"\\ebe6"}),l.lockSmall=new l("lock-small",{fontCharacter:"\\ebe7"}),l.azureDevops=new l("azure-devops",{fontCharacter:"\\ebe8"}),l.verifiedFilled=new l("verified-filled",{fontCharacter:"\\ebe9"})}(ee||(ee={}))},79881:function(tt,Ie,O){"use strict";O.d(Ie,{B8:function(){return x},Cp:function(){return J},F0:function(){return H},L6:function(){return W},VV:function(){return ee},b1:function(){return l},dL:function(){return ue},ri:function(){return D}});class K{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(_){setTimeout(()=>{throw _.stack?new Error(_.message+`
|
|
|
|
`+_.stack):_},0)}}emit(_){this.listeners.forEach(b=>{b(_)})}onUnexpectedError(_){this.unexpectedErrorHandler(_),this.emit(_)}onUnexpectedExternalError(_){this.unexpectedErrorHandler(_)}}const te=new K;function ue(v){ee(v)||te.onUnexpectedError(v)}function J(v){ee(v)||te.onUnexpectedExternalError(v)}function D(v){if(v instanceof Error){let{name:_,message:b}=v;const T=v.stacktrace||v.stack;return{$isError:!0,name:_,message:b,stack:T}}return v}const g="Canceled";function ee(v){return v instanceof Error&&v.name===g&&v.message===g}function H(){const v=new Error(g);return v.name=v.message,v}function l(v){return v?new Error(`Illegal argument: ${v}`):new Error("Illegal argument")}function W(v){return v?new Error(`Illegal state: ${v}`):new Error("Illegal state")}class x extends Error{constructor(_){super("NotSupported"),_&&(this.message=_)}}},4348:function(tt,Ie,O){"use strict";O.d(Ie,{D0:function(){return x},E7:function(){return v},K3:function(){return W},Q5:function(){return l},ZD:function(){return _},ju:function(){return D}});var K=O(79881),te=O(69323),ue=O(34502),J=O(95830),D;(function(b){b.None=()=>te.JT.None;function T(L){return(S,G=null,P)=>{let p=!1,d;return d=L(N=>{if(!p)return d?d.dispose():p=!0,S.call(G,N)},null,P),p&&d.dispose(),d}}b.once=T;function B(L,S){return C((G,P=null,p)=>L(d=>G.call(P,S(d)),null,p))}b.map=B;function U(L,S){return C((G,P=null,p)=>L(d=>{S(d),G.call(P,d)},null,p))}b.forEach=U;function F(L,S){return C((G,P=null,p)=>L(d=>S(d)&&G.call(P,d),null,p))}b.filter=F;function I(L){return L}b.signal=I;function M(...L){return(S,G=null,P)=>(0,te.F8)(...L.map(p=>p(d=>S.call(G,d),null,P)))}b.any=M;function j(L,S,G){let P=G;return B(L,p=>(P=S(P,p),P))}b.reduce=j;function C(L){let S;const G=new l({onFirstListenerAdd(){S=L(G.fire,G)},onLastListenerRemove(){S.dispose()}});return G.event}function $(L,S,G=100,P=!1,p){let d,N,V,oe=0;const xe=new l({leakWarningThreshold:p,onFirstListenerAdd(){d=L(Oe=>{oe++,N=S(N,Oe),P&&!V&&(xe.fire(N),N=void 0),clearTimeout(V),V=setTimeout(()=>{const Me=N;N=void 0,V=void 0,(!P||oe>1)&&xe.fire(Me),oe=0},G)})},onLastListenerRemove(){d.dispose()}});return xe.event}b.debounce=$;function X(L,S=(G,P)=>G===P){let G=!0,P;return F(L,p=>{const d=G||!S(p,P);return G=!1,P=p,d})}b.latch=X;function Y(L,S){return[b.filter(L,S),b.filter(L,G=>!S(G))]}b.split=Y;function fe(L,S=!1,G=[]){let P=G.slice(),p=L(V=>{P?P.push(V):N.fire(V)});const d=()=>{P&&P.forEach(V=>N.fire(V)),P=null},N=new l({onFirstListenerAdd(){p||(p=L(V=>N.fire(V)))},onFirstListenerDidAdd(){P&&(S?setTimeout(d):d())},onLastListenerRemove(){p&&p.dispose(),p=null}});return N.event}b.buffer=fe;class ye{constructor(S){this.event=S}map(S){return new ye(B(this.event,S))}forEach(S){return new ye(U(this.event,S))}filter(S){return new ye(F(this.event,S))}reduce(S,G){return new ye(j(this.event,S,G))}latch(){return new ye(X(this.event))}debounce(S,G=100,P=!1,p){return new ye($(this.event,S,G,P,p))}on(S,G,P){return this.event(S,G,P)}once(S,G,P){return T(this.event)(S,G,P)}}function ae(L){return new ye(L)}b.chain=ae;function Q(L,S,G=P=>P){const P=(...V)=>N.fire(G(...V)),p=()=>L.on(S,P),d=()=>L.removeListener(S,P),N=new l({onFirstListenerAdd:p,onLastListenerRemove:d});return N.event}b.fromNodeEventEmitter=Q;function R(L,S,G=P=>P){const P=(...V)=>N.fire(G(...V)),p=()=>L.addEventListener(S,P),d=()=>L.removeEventListener(S,P),N=new l({onFirstListenerAdd:p,onLastListenerRemove:d});return N.event}b.fromDOMEventEmitter=R;function A(L){return new Promise(S=>T(L)(S))}b.toPromise=A})(D||(D={}));class g{constructor(T){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${T}_${g._idPool++}`}start(T){this._stopWatch=new J.G(!0),this._listenerCount=T}stop(){if(this._stopWatch){const T=this._stopWatch.elapsed();this._elapsedOverall+=T,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${T.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}g._idPool=0;let ee=-1;class H{constructor(T,B=Math.random().toString(18).slice(2,5)){this.customThreshold=T,this.name=B,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(T){let B=ee;if(typeof this.customThreshold=="number"&&(B=this.customThreshold),B<=0||T<B)return;this._stacks||(this._stacks=new Map);const U=new Error().stack.split(`
|
|
`).slice(3).join(`
|
|
`),F=this._stacks.get(U)||0;if(this._stacks.set(U,F+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=B*.5;let I,M=0;for(const[j,C]of this._stacks)(!I||M<C)&&(I=j,M=C);console.warn(`[${this.name}] potential listener LEAK detected, having ${T} listeners already. MOST frequent listener (${M}):`),console.warn(I)}return()=>{const I=this._stacks.get(U)||0;this._stacks.set(U,I-1)}}}class l{constructor(T){var B;this._disposed=!1,this._options=T,this._leakageMon=ee>0?new H(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((B=this._options)===null||B===void 0)&&B._profName?new g(this._options._profName):void 0}get event(){return this._event||(this._event=(T,B,U)=>{var F;this._listeners||(this._listeners=new ue.S);const I=this._listeners.isEmpty();I&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const M=this._listeners.push(B?[T,B]:T);I&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,T,B);const j=(F=this._leakageMon)===null||F===void 0?void 0:F.check(this._listeners.size),C=(0,te.OF)(()=>{j&&j(),this._disposed||(M(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return U instanceof te.SL?U.add(C):Array.isArray(U)&&U.push(C),C}),this._event}fire(T){var B,U;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new ue.S);for(let F of this._listeners)this._deliveryQueue.push([F,T]);for((B=this._perfMon)===null||B===void 0||B.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[F,I]=this._deliveryQueue.shift();try{typeof F=="function"?F.call(void 0,I):F[0].call(F[1],I)}catch(M){(0,K.dL)(M)}}(U=this._perfMon)===null||U===void 0||U.stop()}}dispose(){var T,B,U,F,I;this._disposed||(this._disposed=!0,(T=this._listeners)===null||T===void 0||T.clear(),(B=this._deliveryQueue)===null||B===void 0||B.clear(),(F=(U=this._options)===null||U===void 0?void 0:U.onLastListenerRemove)===null||F===void 0||F.call(U),(I=this._leakageMon)===null||I===void 0||I.dispose())}}class W extends l{constructor(T){super(T),this._isPaused=0,this._eventQueue=new ue.S,this._mergeFn=T==null?void 0:T.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const T=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(T))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(T){this._listeners&&(this._isPaused!==0?this._eventQueue.push(T):super.fire(T))}}class x extends W{constructor(T){var B;super(T),this._delay=(B=T.delay)!==null&&B!==void 0?B:100}fire(T){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(T)}}class v{constructor(){this.buffers=[]}wrapEvent(T){return(B,U,F)=>T(I=>{const M=this.buffers[this.buffers.length-1];M?M.push(()=>B.call(U,I)):B.call(U,I)},void 0,F)}bufferEvents(T){const B=[];this.buffers.push(B);const U=T();return this.buffers.pop(),B.forEach(F=>F()),U}}class _{constructor(){this.listening=!1,this.inputEvent=D.None,this.inputEventListener=te.JT.None,this.emitter=new l({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(T){this.inputEvent=T,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=T(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(tt,Ie,O){"use strict";O.d(Ie,{I:function(){return K}});function K(te){const ue=this;let J=!1,D;return function(){return J||(J=!0,D=te.apply(ue,arguments)),D}}},88226:function(tt,Ie,O){"use strict";O.d(Ie,{$:function(){return K}});var K;(function(te){function ue(M){return M&&typeof M=="object"&&typeof M[Symbol.iterator]=="function"}te.is=ue;const J=Object.freeze([]);function D(){return J}te.empty=D;function*g(M){yield M}te.single=g;function ee(M){return M||J}te.from=ee;function H(M){return!M||M[Symbol.iterator]().next().done===!0}te.isEmpty=H;function l(M){return M[Symbol.iterator]().next().value}te.first=l;function W(M,j){for(const C of M)if(j(C))return!0;return!1}te.some=W;function x(M,j){for(const C of M)if(j(C))return C}te.find=x;function*v(M,j){for(const C of M)j(C)&&(yield C)}te.filter=v;function*_(M,j){let C=0;for(const $ of M)yield j($,C++)}te.map=_;function*b(...M){for(const j of M)for(const C of j)yield C}te.concat=b;function*T(M){for(const j of M)for(const C of j)yield C}te.concatNested=T;function B(M,j,C){let $=C;for(const X of M)$=j($,X);return $}te.reduce=B;function*U(M,j,C=M.length){for(j<0&&(j+=M.length),C<0?C+=M.length:C>M.length&&(C=M.length);j<C;j++)yield M[j]}te.slice=U;function F(M,j=Number.POSITIVE_INFINITY){const C=[];if(j===0)return[C,M];const $=M[Symbol.iterator]();for(let X=0;X<j;X++){const Y=$.next();if(Y.done)return[C,te.empty()];C.push(Y.value)}return[C,{[Symbol.iterator](){return $}}]}te.consume=F;function I(M,j,C=($,X)=>$===X){const $=M[Symbol.iterator](),X=j[Symbol.iterator]();for(;;){const Y=$.next(),fe=X.next();if(Y.done!==fe.done)return!1;if(Y.done)return!0;if(!C(Y.value,fe.value))return!1}}te.equals=I})(K||(K={}))},69323:function(tt,Ie,O){"use strict";O.d(Ie,{B9:function(){return _},F8:function(){return b},JT:function(){return U},Jz:function(){return I},OF:function(){return T},SL:function(){return B},Wf:function(){return v},XK:function(){return F},dk:function(){return W}});var K=O(17845),te=O(88226);const ue=!1;let J=null;function D(M){J=M}if(ue){const M="__is_disposable_tracked__";D(new class{trackDisposable(j){const C=new Error("Potentially leaked disposable").stack;setTimeout(()=>{j[M]||console.log(C)},3e3)}setParent(j,C){if(j&&j!==U.None)try{j[M]=!0}catch($){}}markAsDisposed(j){if(j&&j!==U.None)try{j[M]=!0}catch(C){}}markAsSingleton(j){}})}function g(M){return J==null||J.trackDisposable(M),M}function ee(M){J==null||J.markAsDisposed(M)}function H(M,j){J==null||J.setParent(M,j)}function l(M,j){if(J)for(const C of M)J.setParent(C,j)}function W(M){return J==null||J.markAsSingleton(M),M}class x extends Error{constructor(j){super(`Encountered errors while disposing of store. Errors: [${j.join(", ")}]`),this.errors=j}}function v(M){return typeof M.dispose=="function"&&M.dispose.length===0}function _(M){if(te.$.is(M)){let j=[];for(const C of M)if(C)try{C.dispose()}catch($){j.push($)}if(j.length===1)throw j[0];if(j.length>1)throw new x(j);return Array.isArray(M)?[]:M}else if(M)return M.dispose(),M}function b(...M){const j=T(()=>_(M));return l(M,j),j}function T(M){const j=g({dispose:(0,K.I)(()=>{ee(j),M()})});return j}class B{constructor(){this._toDispose=new Set,this._isDisposed=!1,g(this)}dispose(){this._isDisposed||(ee(this),this._isDisposed=!0,this.clear())}clear(){try{_(this._toDispose.values())}finally{this._toDispose.clear()}}add(j){if(!j)return j;if(j===this)throw new Error("Cannot register a disposable on itself!");return H(j,this),this._isDisposed?B.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(j),j}}B.DISABLE_DISPOSED_WARNING=!1;class U{constructor(){this._store=new B,g(this),H(this._store,this)}dispose(){ee(this),this._store.dispose()}_register(j){if(j===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(j)}}U.None=Object.freeze({dispose(){}});class F{constructor(){this._isDisposed=!1,g(this)}get value(){return this._isDisposed?void 0:this._value}set value(j){var C;this._isDisposed||j===this._value||((C=this._value)===null||C===void 0||C.dispose(),j&&H(j,this),this._value=j)}clear(){this.value=void 0}dispose(){var j;this._isDisposed=!0,ee(this),(j=this._value)===null||j===void 0||j.dispose(),this._value=void 0}clearAndLeak(){const j=this._value;return this._value=void 0,j&&H(j,null),j}}class I{constructor(j){this.object=j}dispose(){}}},34502:function(tt,Ie,O){"use strict";O.d(Ie,{S:function(){return te}});class K{constructor(J){this.element=J,this.next=K.Undefined,this.prev=K.Undefined}}K.Undefined=new K(void 0);class te{constructor(){this._first=K.Undefined,this._last=K.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===K.Undefined}clear(){let J=this._first;for(;J!==K.Undefined;){const D=J.next;J.prev=K.Undefined,J.next=K.Undefined,J=D}this._first=K.Undefined,this._last=K.Undefined,this._size=0}unshift(J){return this._insert(J,!1)}push(J){return this._insert(J,!0)}_insert(J,D){const g=new K(J);if(this._first===K.Undefined)this._first=g,this._last=g;else if(D){const H=this._last;this._last=g,g.prev=H,H.next=g}else{const H=this._first;this._first=g,g.next=H,H.prev=g}this._size+=1;let ee=!1;return()=>{ee||(ee=!0,this._remove(g))}}shift(){if(this._first!==K.Undefined){const J=this._first.element;return this._remove(this._first),J}}pop(){if(this._last!==K.Undefined){const J=this._last.element;return this._remove(this._last),J}}_remove(J){if(J.prev!==K.Undefined&&J.next!==K.Undefined){const D=J.prev;D.next=J.next,J.next.prev=D}else J.prev===K.Undefined&&J.next===K.Undefined?(this._first=K.Undefined,this._last=K.Undefined):J.next===K.Undefined?(this._last=this._last.prev,this._last.next=K.Undefined):J.prev===K.Undefined&&(this._first=this._first.next,this._first.prev=K.Undefined);this._size-=1}*[Symbol.iterator](){let J=this._first;for(;J!==K.Undefined;)yield J.element,J=J.next}}},23345:function(tt,Ie,O){"use strict";O.d(Ie,{$L:function(){return $},ED:function(){return I},IJ:function(){return j},OS:function(){return ye},WE:function(){return Y},dz:function(){return M},gn:function(){return X},li:function(){return T},r:function(){return R},tY:function(){return C},xS:function(){return fe}});var K=O(97671),te;const ue="en";let J=!1,D=!1,g=!1,ee=!1,H=!1,l=!1,W=!1,x,v=null,_=null,b;const T=typeof self=="object"?self:typeof O.g=="object"?O.g:{};let B;typeof T.vscode!="undefined"&&typeof T.vscode.process!="undefined"?B=T.vscode.process:typeof K!="undefined"&&(B=K);const U=typeof((te=B==null?void 0:B.versions)===null||te===void 0?void 0:te.electron)=="string"&&B.type==="renderer";if(typeof navigator=="object"&&!U)b=navigator.userAgent,J=b.indexOf("Windows")>=0,D=b.indexOf("Macintosh")>=0,W=(b.indexOf("Macintosh")>=0||b.indexOf("iPad")>=0||b.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,g=b.indexOf("Linux")>=0,l=!0,x=navigator.language,v=x;else if(typeof B=="object"){J=B.platform==="win32",D=B.platform==="darwin",g=B.platform==="linux",ee=g&&!!B.env.SNAP&&!!B.env.SNAP_REVISION,x=ue,v=ue;const A=B.env.VSCODE_NLS_CONFIG;if(A)try{const L=JSON.parse(A),S=L.availableLanguages["*"];x=L.locale,v=S||ue,_=L._translationsConfigFile}catch(L){}H=!0}else console.error("Unable to resolve platform.");let F=0;D?F=1:J?F=3:g&&(F=2);const I=J,M=D,j=g,C=H,$=l,X=W,Y=b,fe=function(){if(T.setImmediate)return T.setImmediate.bind(T);if(typeof T.postMessage=="function"&&!T.importScripts){let S=[];T.addEventListener("message",P=>{if(P.data&&P.data.vscodeSetImmediateId)for(let p=0,d=S.length;p<d;p++){const N=S[p];if(N.id===P.data.vscodeSetImmediateId){S.splice(p,1),N.callback();return}}});let G=0;return P=>{const p=++G;S.push({id:p,callback:P}),T.postMessage({vscodeSetImmediateId:p},"*")}}if(typeof(B==null?void 0:B.nextTick)=="function")return B.nextTick.bind(B);const L=Promise.resolve();return S=>L.then(S)}(),ye=D||W?2:J?1:3;let ae=!0,Q=!1;function R(){if(!Q){Q=!0;const A=new Uint8Array(2);A[0]=1,A[1]=2,ae=new Uint16Array(A.buffer)[0]===513}return ae}},95830:function(tt,Ie,O){"use strict";O.d(Ie,{G:function(){return ue}});var K=O(23345);const te=K.li.performance&&typeof K.li.performance.now=="function";class ue{constructor(D){this._highResolution=te&&D,this._startTime=this._now(),this._stopTime=-1}static create(D=!0){return new ue(D)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?K.li.performance.now():Date.now()}}},82983:function(tt,Ie,O){"use strict";O.d(Ie,{$i:function(){return oe},C8:function(){return rt},GF:function(){return x},HO:function(){return G},IO:function(){return v},K7:function(){return We},Kw:function(){return dt},LC:function(){return T},Mh:function(){return fe},P1:function(){return ye},PJ:function(){return Fe},Qe:function(){return xe},R1:function(){return W},RP:function(){return N},S6:function(){return qe},TT:function(){return I},Ut:function(){return p},V8:function(){return B},WU:function(){return ue},YK:function(){return Q},YU:function(){return J},ZG:function(){return ae},ZH:function(){return A},ab:function(){return Oe},c1:function(){return ft},df:function(){return $},ec:function(){return D},fi:function(){return Wt},fy:function(){return g},j3:function(){return ee},j_:function(){return j},m5:function(){return K},mK:function(){return C},mr:function(){return _},oH:function(){return be},oL:function(){return H},ok:function(){return Y},ow:function(){return U},qq:function(){return X},qu:function(){return F},rL:function(){return R},uS:function(){return ze},un:function(){return l},uq:function(){return b},vH:function(){return S},xe:function(){return Me},zY:function(){return M}});function K(Z){return!Z||typeof Z!="string"?!0:Z.trim().length===0}const te=/{(\d+)}/g;function ue(Z,...se){return se.length===0?Z:Z.replace(te,function(de,we){const ke=parseInt(we,10);return isNaN(ke)||ke<0||ke>=se.length?de:se[ke]})}function J(Z){return Z.replace(/[<>&]/g,function(se){switch(se){case"<":return"<";case">":return">";case"&":return"&";default:return se}})}function D(Z){return Z.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function g(Z,se=" "){const de=ee(Z,se);return H(de,se)}function ee(Z,se){if(!Z||!se)return Z;const de=se.length;if(de===0||Z.length===0)return Z;let we=0;for(;Z.indexOf(se,we)===we;)we=we+de;return Z.substring(we)}function H(Z,se){if(!Z||!se)return Z;const de=se.length,we=Z.length;if(de===0||we===0)return Z;let ke=we,Ze=-1;for(;Ze=Z.lastIndexOf(se,ke-1),!(Ze===-1||Ze+de!==ke);){if(Ze===0)return"";ke=Ze}return Z.substring(0,ke)}function l(Z){return Z.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function W(Z){return Z.replace(/\*/g,"")}function x(Z,se,de={}){if(!Z)throw new Error("Cannot create regex from empty string");se||(Z=D(Z)),de.wholeWord&&(/\B/.test(Z.charAt(0))||(Z="\\b"+Z),/\B/.test(Z.charAt(Z.length-1))||(Z=Z+"\\b"));let we="";return de.global&&(we+="g"),de.matchCase||(we+="i"),de.multiline&&(we+="m"),de.unicode&&(we+="u"),new RegExp(Z,we)}function v(Z){return Z.source==="^"||Z.source==="^$"||Z.source==="$"||Z.source==="^\\s*$"?!1:!!(Z.exec("")&&Z.lastIndex===0)}function _(Z){return(Z.global?"g":"")+(Z.ignoreCase?"i":"")+(Z.multiline?"m":"")+(Z.unicode?"u":"")}function b(Z){return Z.split(/\r\n|\r|\n/)}function T(Z){for(let se=0,de=Z.length;se<de;se++){const we=Z.charCodeAt(se);if(we!==32&&we!==9)return se}return-1}function B(Z,se=0,de=Z.length){for(let we=se;we<de;we++){const ke=Z.charCodeAt(we);if(ke!==32&&ke!==9)return Z.substring(se,we)}return Z.substring(se,de)}function U(Z,se=Z.length-1){for(let de=se;de>=0;de--){const we=Z.charCodeAt(de);if(we!==32&&we!==9)return de}return-1}function F(Z,se){return Z<se?-1:Z>se?1:0}function I(Z,se,de=0,we=Z.length,ke=0,Ze=se.length){for(;de<we&&ke<Ze;de++,ke++){let st=Z.charCodeAt(de),Rt=se.charCodeAt(ke);if(st<Rt)return-1;if(st>Rt)return 1}const ot=we-de,pt=Ze-ke;return ot<pt?-1:ot>pt?1:0}function M(Z,se){return j(Z,se,0,Z.length,0,se.length)}function j(Z,se,de=0,we=Z.length,ke=0,Ze=se.length){for(;de<we&&ke<Ze;de++,ke++){let st=Z.charCodeAt(de),Rt=se.charCodeAt(ke);if(st===Rt)continue;if(st>=128||Rt>=128)return I(Z.toLowerCase(),se.toLowerCase(),de,we,ke,Ze);C(st)&&(st-=32),C(Rt)&&(Rt-=32);const Ut=st-Rt;if(Ut!==0)return Ut}const ot=we-de,pt=Ze-ke;return ot<pt?-1:ot>pt?1:0}function C(Z){return Z>=97&&Z<=122}function $(Z){return Z>=65&&Z<=90}function X(Z,se){return Z.length===se.length&&j(Z,se)===0}function Y(Z,se){const de=se.length;return se.length>Z.length?!1:j(Z,se,0,de)===0}function fe(Z,se){let de,we=Math.min(Z.length,se.length);for(de=0;de<we;de++)if(Z.charCodeAt(de)!==se.charCodeAt(de))return de;return we}function ye(Z,se){let de,we=Math.min(Z.length,se.length);const ke=Z.length-1,Ze=se.length-1;for(de=0;de<we;de++)if(Z.charCodeAt(ke-de)!==se.charCodeAt(Ze-de))return de;return we}function ae(Z){return 55296<=Z&&Z<=56319}function Q(Z){return 56320<=Z&&Z<=57343}function R(Z,se){return(Z-55296<<10)+(se-56320)+65536}function A(Z,se,de){const we=Z.charCodeAt(de);if(ae(we)&&de+1<se){const ke=Z.charCodeAt(de+1);if(Q(ke))return R(we,ke)}return we}function L(Z,se){const de=Z.charCodeAt(se-1);if(Q(de)&&se>1){const we=Z.charCodeAt(se-2);if(ae(we))return R(we,de)}return de}function S(Z,se){const de=it.getInstance(),we=se,ke=Z.length,Ze=A(Z,ke,se);se+=Ze>=65536?2:1;let ot=de.getGraphemeBreakType(Ze);for(;se<ke;){const pt=A(Z,ke,se),st=de.getGraphemeBreakType(pt);if(Wt(ot,st))break;se+=pt>=65536?2:1,ot=st}return se-we}function G(Z,se){const de=it.getInstance(),we=se,ke=L(Z,se);se-=ke>=65536?2:1;let Ze=de.getGraphemeBreakType(ke);for(;se>0;){const ot=L(Z,se),pt=de.getGraphemeBreakType(ot);if(Wt(pt,Ze))break;se-=ot>=65536?2:1,Ze=pt}return we-se}const P=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function p(Z){return P.test(Z)}const d=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function N(Z){return d.test(Z)}const V=/^[\t\n\r\x20-\x7E]*$/;function oe(Z){return V.test(Z)}const xe=/[\u2028\u2029]/;function Oe(Z){return xe.test(Z)}function Me(Z){for(let se=0,de=Z.length;se<de;se++)if(We(Z.charCodeAt(se)))return!0;return!1}function We(Z){return Z=+Z,Z>=11904&&Z<=55215||Z>=63744&&Z<=64255||Z>=65281&&Z<=65374}function rt(Z){return Z>=127462&&Z<=127487||Z===8986||Z===8987||Z===9200||Z===9203||Z>=9728&&Z<=10175||Z===11088||Z===11093||Z>=127744&&Z<=128591||Z>=128640&&Z<=128764||Z>=128992&&Z<=129003||Z>=129280&&Z<=129535||Z>=129648&&Z<=129750}const ft="\uFEFF";function ze(Z){return!!(Z&&Z.length>0&&Z.charCodeAt(0)===65279)}function dt(Z,se=!1){return Z?(se&&(Z=Z.replace(/\\./g,"")),Z.toLowerCase()!==Z):!1}function Fe(Z){return Z=Z%(2*26),Z<26?String.fromCharCode(97+Z):String.fromCharCode(65+Z-26)}function qe(Z){return it.getInstance().getGraphemeBreakType(Z)}function Wt(Z,se){return Z===0?se!==5&&se!==7:Z===2&&se===3?!1:Z===4||Z===2||Z===3||se===4||se===2||se===3?!0:!(Z===8&&(se===8||se===9||se===11||se===12)||(Z===11||Z===9)&&(se===9||se===10)||(Z===12||Z===10)&&se===10||se===5||se===13||se===7||Z===1||Z===13&&se===14||Z===6&&se===6)}class it{constructor(){this._data=_e()}static getInstance(){return it._INSTANCE||(it._INSTANCE=new it),it._INSTANCE}getGraphemeBreakType(se){if(se<32)return se===10?3:se===13?2:4;if(se<127)return 0;const de=this._data,we=de.length/3;let ke=1;for(;ke<=we;)if(se<de[3*ke])ke=2*ke;else if(se>de[3*ke+1])ke=2*ke+1;else return de[3*ke+2];return 0}}it._INSTANCE=null;function _e(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function be(Z,se){if(Z===0)return 0;const de=ve(Z,se);if(de!==void 0)return de;const we=L(se,Z);return Z-=Be(we),Z}function ve(Z,se){let de=L(se,Z);for(Z-=Be(de);je(de)||de===65039||de===8419;){if(Z===0)return;de=L(se,Z),Z-=Be(de)}if(rt(de)){if(Z>=0){const we=L(se,Z);we===8205&&(Z-=Be(we))}return Z}}function Be(Z){return Z>=65536?2:1}function je(Z){return 127995<=Z&&Z<=127999}},72999:function(tt,Ie,O){"use strict";O.d(Ie,{$E:function(){return T},$K:function(){return ee},D8:function(){return v},HD:function(){return te},IU:function(){return B},Jp:function(){return H},Kn:function(){return ue},cW:function(){return W},f6:function(){return U},hj:function(){return J},jn:function(){return D},kJ:function(){return K},mf:function(){return x},o8:function(){return g},p_:function(){return l},vE:function(){return F}});function K(I){return Array.isArray(I)}function te(I){return typeof I=="string"}function ue(I){return typeof I=="object"&&I!==null&&!Array.isArray(I)&&!(I instanceof RegExp)&&!(I instanceof Date)}function J(I){return typeof I=="number"&&!isNaN(I)}function D(I){return I===!0||I===!1}function g(I){return typeof I=="undefined"}function ee(I){return!H(I)}function H(I){return g(I)||I===null}function l(I,M){if(!I)throw new Error(M?`Unexpected type, expected '${M}'`:"Unexpected type")}function W(I){if(H(I))throw new Error("Assertion Failed: argument is undefined or null");return I}function x(I){return typeof I=="function"}function v(I,M){const j=Math.min(I.length,M.length);for(let C=0;C<j;C++)_(I[C],M[C])}function _(I,M){if(te(M)){if(typeof I!==M)throw new Error(`argument does not match constraint: typeof ${M}`)}else if(x(M)){try{if(I instanceof M)return}catch(j){}if(!H(I)&&I.constructor===M||M.length===1&&M.call(void 0,I)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function b(I){let M=[],j=Object.getPrototypeOf(I);for(;Object.prototype!==j;)M=M.concat(Object.getOwnPropertyNames(j)),j=Object.getPrototypeOf(j);return M}function T(I){const M=[];for(const j of b(I))typeof I[j]=="function"&&M.push(j);return M}function B(I,M){const j=$=>function(){const X=Array.prototype.slice.call(arguments,0);return M($,X)};let C={};for(const $ of I)C[$]=j($);return C}function U(I){return I===null?void 0:I}function F(I,M="Unreachable"){throw new Error(M)}},13268:function(tt,Ie,O){"use strict";O.d(Ie,{N:function(){return te}});function K(ue,J){let D;return J.length===0?D=ue:D=ue.replace(/\{(\d+)\}/g,function(g,ee){const H=ee[0];return typeof J[H]!="undefined"?J[H]:g}),D}function te(ue,J,...D){return K(J,D)}},96236:function(tt,Ie,O){"use strict";O.d(Ie,{BH:function(){return B},NZ:function(){return U},U8:function(){return F},co:function(){return T},eH:function(){return b},vr:function(){return _}});var K=O(75918),te=O(52615),ue=O(4348),J=O(88226),D=O(69323),g=O(34502),ee=O(35884),H=O(90689),l=O(16925),W=O(49055),x=function(I,M,j,C){var $=arguments.length,X=$<3?M:C===null?C=Object.getOwnPropertyDescriptor(M,j):C,Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(I,M,j,C);else for(var fe=I.length-1;fe>=0;fe--)(Y=I[fe])&&(X=($<3?Y(X):$>3?Y(M,j,X):Y(M,j))||X);return $>3&&X&&Object.defineProperty(M,j,X),X},v=function(I,M){return function(j,C){M(j,C,I)}};function _(I){return I.command!==void 0}class b{constructor(M){this.id=b._idPool++,this._debugName=M}}b._idPool=0,b.CommandPalette=new b("CommandPalette"),b.EditorContext=new b("EditorContext"),b.SimpleEditorContext=new b("SimpleEditorContext"),b.EditorContextCopy=new b("EditorContextCopy"),b.EditorContextPeek=new b("EditorContextPeek"),b.MenubarEditMenu=new b("MenubarEditMenu"),b.MenubarCopy=new b("MenubarCopy"),b.MenubarGoMenu=new b("MenubarGoMenu"),b.MenubarSelectionMenu=new b("MenubarSelectionMenu"),b.InlineCompletionsActions=new b("InlineCompletionsActions");const T=(0,l.yh)("menuService"),B=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new ue.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:I=>I===b.CommandPalette}}addCommand(I){return this.addCommands(J.$.single(I))}addCommands(I){for(const M of I)this._commands.set(M.id,M);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,D.OF)(()=>{let M=!1;for(const j of I)M=this._commands.delete(j.id)||M;M&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(I){return this._commands.get(I)}getCommands(){const I=new Map;return this._commands.forEach((M,j)=>I.set(j,M)),I}appendMenuItem(I,M){return this.appendMenuItems(J.$.single({id:I,item:M}))}appendMenuItems(I){const M=new Set,j=new g.S;for(const{id:C,item:$}of I){let X=this._menuItems.get(C);X||(X=new g.S,this._menuItems.set(C,X)),j.push(X.push($)),M.add(C)}return this._onDidChangeMenu.fire(M),(0,D.OF)(()=>{if(j.size>0){for(let C of j)C();this._onDidChangeMenu.fire(M),j.clear()}})}getMenuItems(I){let M;return this._menuItems.has(I)?M=[...this._menuItems.get(I)]:M=[],I===b.CommandPalette&&this._appendImplicitItems(M),M}_appendImplicitItems(I){const M=new Set;for(const j of I)_(j)&&(M.add(j.command.id),j.alt&&M.add(j.alt.id));this._commands.forEach((j,C)=>{M.has(C)||I.push({command:j})})}};class U extends K.wY{constructor(M,j,C,$){super(`submenuitem.${M.submenu.id}`,typeof M.title=="string"?M.title:M.title.value,[],"submenu"),this.item=M,this._menuService=j,this._contextKeyService=C,this._options=$}get actions(){const M=[],j=this._menuService.createMenu(this.item.submenu,this._contextKeyService),C=j.getActions(this._options);j.dispose();for(const[,$]of C)$.length>0&&(M.push(...$),M.push(new K.Z0));return M.length&&M.pop(),M}}let F=class Zo{constructor(M,j,C,$,X){var Y,fe;if(this._commandService=X,this.id=M.id,this.label=C!=null&&C.renderShortTitle&&M.shortTitle?typeof M.shortTitle=="string"?M.shortTitle:M.shortTitle.value:typeof M.title=="string"?M.title:M.title.value,this.tooltip=(fe=typeof M.tooltip=="string"?M.tooltip:(Y=M.tooltip)===null||Y===void 0?void 0:Y.value)!==null&&fe!==void 0?fe:"",this.enabled=!M.precondition||$.contextMatchesRules(M.precondition),this.checked=void 0,M.toggled){const ye=M.toggled.condition?M.toggled:{condition:M.toggled};this.checked=$.contextMatchesRules(ye.condition),this.checked&&ye.tooltip&&(this.tooltip=typeof ye.tooltip=="string"?ye.tooltip:ye.tooltip.value),ye.title&&(this.label=typeof ye.title=="string"?ye.title:ye.title.value)}this.item=M,this.alt=j?new Zo(j,void 0,C,$,X):void 0,this._options=C,W.kS.isThemeIcon(M.icon)&&(this.class=te.dT.asClassName(M.icon))}dispose(){}run(...M){var j,C;let $=[];return!((j=this._options)===null||j===void 0)&&j.arg&&($=[...$,this._options.arg]),!((C=this._options)===null||C===void 0)&&C.shouldForwardArgs&&($=[...$,...M]),this._commandService.executeCommand(this.id,...$)}};F=x([v(3,H.i6),v(4,ee.H)],F)},35884:function(tt,Ie,O){"use strict";O.d(Ie,{H:function(){return ee},P:function(){return H}});var K=O(4348),te=O(88226),ue=O(69323),J=O(34502),D=O(72999),g=O(16925);const ee=(0,g.yh)("commandService"),H=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new K.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,W){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!W)throw new Error("invalid command");return this.registerCommand({id:l,handler:W})}if(l.description){const T=[];for(let U of l.description.args)T.push(U.constraint);const B=l.handler;l.handler=function(U,...F){return(0,D.D8)(F,T),B(U,...F)}}const{id:x}=l;let v=this._commands.get(x);v||(v=new J.S,this._commands.set(x,v));let _=v.unshift(l),b=(0,ue.OF)(()=>{_();const T=this._commands.get(x);T!=null&&T.isEmpty()&&this._commands.delete(x)});return this._onDidRegisterCommand.fire(x),b}registerCommandAlias(l,W){return H.registerCommand(l,(x,...v)=>x.get(ee).executeCommand(W,...v))}getCommand(l){const W=this._commands.get(l);if(!(!W||W.isEmpty()))return te.$.first(W)}getCommands(){const l=new Map;for(const W of this._commands.keys()){const x=this.getCommand(W);x&&l.set(W,x)}return l}};H.registerCommand("noop",()=>{})},90689:function(tt,Ie,O){"use strict";O.d(Ie,{Ao:function(){return ee},Eq:function(){return R},Fb:function(){return H},K8:function(){return S},i6:function(){return Q},uy:function(){return ae}});var K=O(23345),te=O(82983),ue=O(16925);let J=K.WE||"";const D=new Map;D.set("false",!1),D.set("true",!0),D.set("isMac",K.dz),D.set("isLinux",K.IJ),D.set("isWindows",K.ED),D.set("isWeb",K.$L),D.set("isMacNative",K.dz&&!K.$L),D.set("isEdge",J.indexOf("Edg/")>=0),D.set("isFirefox",J.indexOf("Firefox")>=0),D.set("isChrome",J.indexOf("Chrome")>=0),D.set("isSafari",J.indexOf("Safari")>=0);const g=Object.prototype.hasOwnProperty;class ee{static has(p){return v.create(p)}static equals(p,d){return _.create(p,d)}static regex(p,d){return $.create(p,d)}static not(p){return U.create(p)}static and(...p){return fe.create(p,null)}static or(...p){return ye.create(p,null,!0)}static deserialize(p,d=!1){if(p)return this._deserializeOrExpression(p,d)}static _deserializeOrExpression(p,d){let N=p.split("||");return ye.create(N.map(V=>this._deserializeAndExpression(V,d)),null,!0)}static _deserializeAndExpression(p,d){let N=p.split("&&");return fe.create(N.map(V=>this._deserializeOne(V,d)),null)}static _deserializeOne(p,d){if(p=p.trim(),p.indexOf("!=")>=0){let N=p.split("!=");return B.create(N[0].trim(),this._deserializeValue(N[1],d))}if(p.indexOf("==")>=0){let N=p.split("==");return _.create(N[0].trim(),this._deserializeValue(N[1],d))}if(p.indexOf("=~")>=0){let N=p.split("=~");return $.create(N[0].trim(),this._deserializeRegexValue(N[1],d))}if(p.indexOf(" in ")>=0){let N=p.split(" in ");return b.create(N[0].trim(),N[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(p)){const N=p.split(">=");return M.create(N[0].trim(),N[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(p)){const N=p.split(">");return I.create(N[0].trim(),N[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(p)){const N=p.split("<=");return C.create(N[0].trim(),N[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(p)){const N=p.split("<");return j.create(N[0].trim(),N[1].trim())}return/^\!\s*/.test(p)?U.create(p.substr(1).trim()):v.create(p)}static _deserializeValue(p,d){if(p=p.trim(),p==="true")return!0;if(p==="false")return!1;let N=/^'([^']*)'$/.exec(p);return N?N[1].trim():p}static _deserializeRegexValue(p,d){if((0,te.m5)(p)){if(d)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let N=p.indexOf("/"),V=p.lastIndexOf("/");if(N===V||N<0){if(d)throw new Error(`bad regexp-value '${p}', missing /-enclosure`);return console.warn(`bad regexp-value '${p}', missing /-enclosure`),null}let oe=p.slice(N+1,V),xe=p[V+1]==="i"?"i":"";try{return new RegExp(oe,xe)}catch(Oe){if(d)throw new Error(`bad regexp-value '${p}', parse error: ${Oe}`);return console.warn(`bad regexp-value '${p}', parse error: ${Oe}`),null}}}function H(P,p){const d=P?P.substituteConstants():void 0,N=p?p.substituteConstants():void 0;return!d&&!N?!0:!d||!N?!1:d.equals(N)}function l(P,p){return P.cmp(p)}class W{constructor(){this.type=0}cmp(p){return this.type-p.type}equals(p){return p.type===this.type}substituteConstants(){return this}evaluate(p){return!1}serialize(){return"false"}keys(){return[]}negate(){return x.INSTANCE}}W.INSTANCE=new W;class x{constructor(){this.type=1}cmp(p){return this.type-p.type}equals(p){return p.type===this.type}substituteConstants(){return this}evaluate(p){return!0}serialize(){return"true"}keys(){return[]}negate(){return W.INSTANCE}}x.INSTANCE=new x;class v{constructor(p,d){this.key=p,this.negated=d,this.type=2}static create(p,d=null){const N=D.get(p);return typeof N=="boolean"?N?x.INSTANCE:W.INSTANCE:new v(p,d)}cmp(p){return p.type!==this.type?this.type-p.type:A(this.key,p.key)}equals(p){return p.type===this.type?this.key===p.key:!1}substituteConstants(){const p=D.get(this.key);return typeof p=="boolean"?p?x.INSTANCE:W.INSTANCE:this}evaluate(p){return!!p.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=U.create(this.key,this)),this.negated}}class _{constructor(p,d,N){this.key=p,this.value=d,this.negated=N,this.type=4}static create(p,d,N=null){if(typeof d=="boolean")return d?v.create(p,N):U.create(p,N);const V=D.get(p);return typeof V=="boolean"?d===(V?"true":"false")?x.INSTANCE:W.INSTANCE:new _(p,d,N)}cmp(p){return p.type!==this.type?this.type-p.type:L(this.key,this.value,p.key,p.value)}equals(p){return p.type===this.type?this.key===p.key&&this.value===p.value:!1}substituteConstants(){const p=D.get(this.key);if(typeof p=="boolean"){const d=p?"true":"false";return this.value===d?x.INSTANCE:W.INSTANCE}return this}evaluate(p){return p.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=B.create(this.key,this.value,this)),this.negated}}class b{constructor(p,d){this.key=p,this.valueKey=d,this.type=10,this.negated=null}static create(p,d){return new b(p,d)}cmp(p){return p.type!==this.type?this.type-p.type:L(this.key,this.valueKey,p.key,p.valueKey)}equals(p){return p.type===this.type?this.key===p.key&&this.valueKey===p.valueKey:!1}substituteConstants(){return this}evaluate(p){const d=p.getValue(this.valueKey),N=p.getValue(this.key);return Array.isArray(d)?d.indexOf(N)>=0:typeof N=="string"&&typeof d=="object"&&d!==null?g.call(d,N):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=T.create(this)),this.negated}}class T{constructor(p){this._actual=p,this.type=11}static create(p){return new T(p)}cmp(p){return p.type!==this.type?this.type-p.type:this._actual.cmp(p._actual)}equals(p){return p.type===this.type?this._actual.equals(p._actual):!1}substituteConstants(){return this}evaluate(p){return!this._actual.evaluate(p)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class B{constructor(p,d,N){this.key=p,this.value=d,this.negated=N,this.type=5}static create(p,d,N=null){if(typeof d=="boolean")return d?U.create(p,N):v.create(p,N);const V=D.get(p);return typeof V=="boolean"?d===(V?"true":"false")?W.INSTANCE:x.INSTANCE:new B(p,d,N)}cmp(p){return p.type!==this.type?this.type-p.type:L(this.key,this.value,p.key,p.value)}equals(p){return p.type===this.type?this.key===p.key&&this.value===p.value:!1}substituteConstants(){const p=D.get(this.key);if(typeof p=="boolean"){const d=p?"true":"false";return this.value===d?W.INSTANCE:x.INSTANCE}return this}evaluate(p){return p.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=_.create(this.key,this.value,this)),this.negated}}class U{constructor(p,d){this.key=p,this.negated=d,this.type=3}static create(p,d=null){const N=D.get(p);return typeof N=="boolean"?N?W.INSTANCE:x.INSTANCE:new U(p,d)}cmp(p){return p.type!==this.type?this.type-p.type:A(this.key,p.key)}equals(p){return p.type===this.type?this.key===p.key:!1}substituteConstants(){const p=D.get(this.key);return typeof p=="boolean"?p?W.INSTANCE:x.INSTANCE:this}evaluate(p){return!p.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=v.create(this.key,this)),this.negated}}function F(P,p){if(typeof P=="string"){const d=parseFloat(P);isNaN(d)||(P=d)}return typeof P=="string"||typeof P=="number"?p(P):W.INSTANCE}class I{constructor(p,d,N){this.key=p,this.value=d,this.negated=N,this.type=12}static create(p,d,N=null){return F(d,V=>new I(p,V,N))}cmp(p){return p.type!==this.type?this.type-p.type:L(this.key,this.value,p.key,p.value)}equals(p){return p.type===this.type?this.key===p.key&&this.value===p.value:!1}substituteConstants(){return this}evaluate(p){return typeof this.value=="string"?!1:parseFloat(p.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=C.create(this.key,this.value,this)),this.negated}}class M{constructor(p,d,N){this.key=p,this.value=d,this.negated=N,this.type=13}static create(p,d,N=null){return F(d,V=>new M(p,V,N))}cmp(p){return p.type!==this.type?this.type-p.type:L(this.key,this.value,p.key,p.value)}equals(p){return p.type===this.type?this.key===p.key&&this.value===p.value:!1}substituteConstants(){return this}evaluate(p){return typeof this.value=="string"?!1:parseFloat(p.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=j.create(this.key,this.value,this)),this.negated}}class j{constructor(p,d,N){this.key=p,this.value=d,this.negated=N,this.type=14}static create(p,d,N=null){return F(d,V=>new j(p,V,N))}cmp(p){return p.type!==this.type?this.type-p.type:L(this.key,this.value,p.key,p.value)}equals(p){return p.type===this.type?this.key===p.key&&this.value===p.value:!1}substituteConstants(){return this}evaluate(p){return typeof this.value=="string"?!1:parseFloat(p.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=M.create(this.key,this.value,this)),this.negated}}class C{constructor(p,d,N){this.key=p,this.value=d,this.negated=N,this.type=15}static create(p,d,N=null){return F(d,V=>new C(p,V,N))}cmp(p){return p.type!==this.type?this.type-p.type:L(this.key,this.value,p.key,p.value)}equals(p){return p.type===this.type?this.key===p.key&&this.value===p.value:!1}substituteConstants(){return this}evaluate(p){return typeof this.value=="string"?!1:parseFloat(p.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=I.create(this.key,this.value,this)),this.negated}}class ${constructor(p,d){this.key=p,this.regexp=d,this.type=7,this.negated=null}static create(p,d){return new $(p,d)}cmp(p){if(p.type!==this.type)return this.type-p.type;if(this.key<p.key)return-1;if(this.key>p.key)return 1;const d=this.regexp?this.regexp.source:"",N=p.regexp?p.regexp.source:"";return d<N?-1:d>N?1:0}equals(p){if(p.type===this.type){const d=this.regexp?this.regexp.source:"",N=p.regexp?p.regexp.source:"";return this.key===p.key&&d===N}return!1}substituteConstants(){return this}evaluate(p){let d=p.getValue(this.key);return this.regexp?this.regexp.test(d):!1}serialize(){const p=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${p}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=X.create(this)),this.negated}}class X{constructor(p){this._actual=p,this.type=8}static create(p){return new X(p)}cmp(p){return p.type!==this.type?this.type-p.type:this._actual.cmp(p._actual)}equals(p){return p.type===this.type?this._actual.equals(p._actual):!1}substituteConstants(){return this}evaluate(p){return!this._actual.evaluate(p)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function Y(P){let p=null;for(let d=0,N=P.length;d<N;d++){const V=P[d].substituteConstants();if(P[d]!==V&&p===null){p=[];for(let oe=0;oe<d;oe++)p[oe]=P[oe]}p!==null&&(p[d]=V)}return p===null?P:p}class fe{constructor(p,d){this.expr=p,this.negated=d,this.type=6}static create(p,d){return fe._normalizeArr(p,d)}cmp(p){if(p.type!==this.type)return this.type-p.type;if(this.expr.length<p.expr.length)return-1;if(this.expr.length>p.expr.length)return 1;for(let d=0,N=this.expr.length;d<N;d++){const V=l(this.expr[d],p.expr[d]);if(V!==0)return V}return 0}equals(p){if(p.type===this.type){if(this.expr.length!==p.expr.length)return!1;for(let d=0,N=this.expr.length;d<N;d++)if(!this.expr[d].equals(p.expr[d]))return!1;return!0}return!1}substituteConstants(){const p=Y(this.expr);return p===this.expr?this:fe.create(p,this.negated)}evaluate(p){for(let d=0,N=this.expr.length;d<N;d++)if(!this.expr[d].evaluate(p))return!1;return!0}static _normalizeArr(p,d){const N=[];let V=!1;for(const oe of p)if(oe){if(oe.type===1){V=!0;continue}if(oe.type===0)return W.INSTANCE;if(oe.type===6){N.push(...oe.expr);continue}N.push(oe)}if(N.length===0&&V)return x.INSTANCE;if(N.length!==0){if(N.length===1)return N[0];N.sort(l);for(let oe=1;oe<N.length;oe++)N[oe-1].equals(N[oe])&&(N.splice(oe,1),oe--);if(N.length===1)return N[0];for(;N.length>1;){const oe=N[N.length-1];if(oe.type!==9)break;N.pop();const xe=N.pop(),Oe=N.length===0,Me=ye.create(oe.expr.map(We=>fe.create([We,xe],null)),null,Oe);Me&&(N.push(Me),N.sort(l))}return N.length===1?N[0]:new fe(N,d)}}serialize(){return this.expr.map(p=>p.serialize()).join(" && ")}keys(){const p=[];for(let d of this.expr)p.push(...d.keys());return p}negate(){if(!this.negated){const p=[];for(let d of this.expr)p.push(d.negate());this.negated=ye.create(p,this,!0)}return this.negated}}class ye{constructor(p,d){this.expr=p,this.negated=d,this.type=9}static create(p,d,N){return ye._normalizeArr(p,d,N)}cmp(p){if(p.type!==this.type)return this.type-p.type;if(this.expr.length<p.expr.length)return-1;if(this.expr.length>p.expr.length)return 1;for(let d=0,N=this.expr.length;d<N;d++){const V=l(this.expr[d],p.expr[d]);if(V!==0)return V}return 0}equals(p){if(p.type===this.type){if(this.expr.length!==p.expr.length)return!1;for(let d=0,N=this.expr.length;d<N;d++)if(!this.expr[d].equals(p.expr[d]))return!1;return!0}return!1}substituteConstants(){const p=Y(this.expr);return p===this.expr?this:ye.create(p,this.negated,!1)}evaluate(p){for(let d=0,N=this.expr.length;d<N;d++)if(this.expr[d].evaluate(p))return!0;return!1}static _normalizeArr(p,d,N){let V=[],oe=!1;if(p){for(let xe=0,Oe=p.length;xe<Oe;xe++){const Me=p[xe];if(Me){if(Me.type===0){oe=!0;continue}if(Me.type===1)return x.INSTANCE;if(Me.type===9){V=V.concat(Me.expr);continue}V.push(Me)}}if(V.length===0&&oe)return W.INSTANCE;V.sort(l)}if(V.length!==0){if(V.length===1)return V[0];for(let xe=1;xe<V.length;xe++)V[xe-1].equals(V[xe])&&(V.splice(xe,1),xe--);if(V.length===1)return V[0];if(N){for(let xe=0;xe<V.length;xe++)for(let Oe=xe+1;Oe<V.length;Oe++)S(V[xe],V[Oe])&&(V.splice(Oe,1),Oe--);if(V.length===1)return V[0]}return new ye(V,d)}}serialize(){return this.expr.map(p=>p.serialize()).join(" || ")}keys(){const p=[];for(let d of this.expr)p.push(...d.keys());return p}negate(){if(!this.negated){let p=[];for(let d of this.expr)p.push(d.negate());for(;p.length>1;){const d=p.shift(),N=p.shift(),V=[];for(const xe of G(d))for(const Oe of G(N))V.push(fe.create([xe,Oe],null));const oe=p.length===0;p.unshift(ye.create(V,null,oe))}this.negated=p[0]}return this.negated}}class ae extends v{constructor(p,d,N){super(p,null),this._defaultValue=d,typeof N=="object"?ae._info.push(Object.assign(Object.assign({},N),{key:p})):N!==!0&&ae._info.push({key:p,description:N,type:d!=null?typeof d:void 0})}static all(){return ae._info.values()}bindTo(p){return p.createKey(this.key,this._defaultValue)}getValue(p){return p.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(p){return _.create(this.key,p)}}ae._info=[];const Q=(0,ue.yh)("contextKeyService"),R="setContext";function A(P,p){return P<p?-1:P>p?1:0}function L(P,p,d,N){return P<d?-1:P>d?1:p<N?-1:p>N?1:0}function S(P,p){if(p.type===6&&P.type!==9&&P.type!==6){for(const V of p.expr)if(P.equals(V))return!0}const d=P.negate(),N=G(d).concat(G(p));N.sort(l);for(let V=0;V<N.length;V++){const xe=N[V].negate();for(let Oe=V+1;Oe<N.length;Oe++){const Me=N[Oe];if(xe.equals(Me))return!0}}return!1}function G(P){return P.type===9?P.expr:[P]}},16925:function(tt,Ie,O){"use strict";O.d(Ie,{I8:function(){return K},TG:function(){return te},jt:function(){return D},yh:function(){return J}});var K;(function(g){g.serviceIds=new Map,g.DI_TARGET="$di$target",g.DI_DEPENDENCIES="$di$dependencies";function ee(H){return H[g.DI_DEPENDENCIES]||[]}g.getServiceDependencies=ee})(K||(K={}));const te=J("instantiationService");function ue(g,ee,H,l){ee[K.DI_TARGET]===ee?ee[K.DI_DEPENDENCIES].push({id:g,index:H,optional:l}):(ee[K.DI_DEPENDENCIES]=[{id:g,index:H,optional:l}],ee[K.DI_TARGET]=ee)}function J(g){if(K.serviceIds.has(g))return K.serviceIds.get(g);const ee=function(H,l,W){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ue(ee,H,W,!1)};return ee.toString=()=>g,K.serviceIds.set(g,ee),ee}function D(g){return function(ee,H,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");ue(g,ee,l,!0)}}},44650:function(tt,Ie,O){"use strict";O.d(Ie,{B:function(){return J}});var K=O(76068),te=O(72999);class ue{constructor(){this.data=new Map}add(g,ee){K.ok(te.HD(g)),K.ok(te.Kn(ee)),K.ok(!this.data.has(g),"There is already an extension with this id"),this.data.set(g,ee)}as(g){return this.data.get(g)||null}}const J=new ue},66213:function(tt,Ie,O){"use strict";O.d(Ie,{e:function(){return K}});var K;(function(te){te.DARK="dark",te.LIGHT="light",te.HIGH_CONTRAST="hc"})(K||(K={}))},49055:function(tt,Ie,O){"use strict";O.d(Ie,{EN:function(){return l},IP:function(){return v},Ic:function(){return T},XE:function(){return ee},bB:function(){return B},kS:function(){return W},m6:function(){return x}});var K=O(52615),te=O(4348),ue=O(69323),J=O(16925),D=O(44650),g=O(66213);const ee=(0,J.yh)("themeService");var H;(function(U){function F(I){return I&&typeof I=="object"&&typeof I.id=="string"}U.isThemeColor=F})(H||(H={}));function l(U){return{id:U}}var W;(function(U){function F(X){return X&&typeof X=="object"&&typeof X.id=="string"&&(typeof X.color=="undefined"||H.isThemeColor(X.color))}U.isThemeIcon=F;const I=new RegExp(`^\\$\\((${K.dT.iconNameExpression}(?:${K.dT.iconModifierExpression})?)\\)$`);function M(X){const Y=I.exec(X);if(!Y)return;let[,fe]=Y;return{id:fe}}U.fromString=M;function j(X,Y){let fe=X.id;const ye=fe.lastIndexOf("~");return ye!==-1&&(fe=fe.substring(0,ye)),Y&&(fe=`${fe}~${Y}`),{id:fe}}U.modify=j;function C(X,Y){var fe,ye;return X.id===Y.id&&((fe=X.color)===null||fe===void 0?void 0:fe.id)===((ye=Y.color)===null||ye===void 0?void 0:ye.id)}U.isEqual=C;function $(X,Y){return{id:X.id,color:Y?l(Y):void 0}}U.asThemeIcon=$,U.asClassNameArray=K.dT.asClassNameArray,U.asClassName=K.dT.asClassName,U.asCSSSelector=K.dT.asCSSSelector})(W||(W={}));function x(U){switch(U){case g.e.DARK:return"vs-dark";case g.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const v={ThemingContribution:"base.contributions.theming"};class _{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new te.Q5}onColorThemeChange(F){return this.themingParticipants.push(F),this.onThemingParticipantAddedEmitter.fire(F),(0,ue.OF)(()=>{const I=this.themingParticipants.indexOf(F);this.themingParticipants.splice(I,1)})}getThemingParticipants(){return this.themingParticipants}}let b=new _;D.B.add(v.ThemingContribution,b);function T(U){return b.onColorThemeChange(U)}class B extends ue.JT{constructor(F){super(),this.themeService=F,this.theme=F.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(I=>this.onThemeChange(I)))}onThemeChange(F){this.theme=F,this.updateStyles()}updateStyles(){}}},31561:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return X}});var K=O(72308),te=O(49618),ue=O(52487),J=O(74416),D=O(35593),g=O(92310),ee=O.n(g),H=O(8654),l=O(59301),W=O(10228),x=O(16089),v=W.Z.ESC,_=W.Z.TAB;function b(Y){var fe=Y.visible,ye=Y.triggerRef,ae=Y.onVisibleChange,Q=Y.autoFocus,R=Y.overlayRef,A=l.useRef(!1),L=function(){if(fe){var p,d;(p=ye.current)===null||p===void 0||(d=p.focus)===null||d===void 0||d.call(p),ae==null||ae(!1)}},S=function(){var p;return(p=R.current)!==null&&p!==void 0&&p.focus?(R.current.focus(),A.current=!0,!0):!1},G=function(p){switch(p.keyCode){case v:L();break;case _:{var d=!1;A.current||(d=S()),d?p.preventDefault():L();break}}};l.useEffect(function(){return fe?(window.addEventListener("keydown",G),Q&&(0,x.Z)(S,3),function(){window.removeEventListener("keydown",G),A.current=!1}):function(){A.current=!1}},[fe])}var T=(0,l.forwardRef)(function(Y,fe){var ye=Y.overlay,ae=Y.arrow,Q=Y.prefixCls,R=(0,l.useMemo)(function(){var L;return typeof ye=="function"?L=ye():L=ye,L},[ye]),A=(0,H.sQ)(fe,R==null?void 0:R.ref);return l.createElement(l.Fragment,null,ae&&l.createElement("div",{className:"".concat(Q,"-arrow")}),l.cloneElement(R,{ref:(0,H.Yr)(R)?A:void 0}))}),B=T,U={adjustX:1,adjustY:1},F=[0,0],I={topLeft:{points:["bl","tl"],overflow:U,offset:[0,-4],targetOffset:F},top:{points:["bc","tc"],overflow:U,offset:[0,-4],targetOffset:F},topRight:{points:["br","tr"],overflow:U,offset:[0,-4],targetOffset:F},bottomLeft:{points:["tl","bl"],overflow:U,offset:[0,4],targetOffset:F},bottom:{points:["tc","bc"],overflow:U,offset:[0,4],targetOffset:F},bottomRight:{points:["tr","br"],overflow:U,offset:[0,4],targetOffset:F}},M=I,j=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function C(Y,fe){var ye,ae=Y.arrow,Q=ae===void 0?!1:ae,R=Y.prefixCls,A=R===void 0?"rc-dropdown":R,L=Y.transitionName,S=Y.animation,G=Y.align,P=Y.placement,p=P===void 0?"bottomLeft":P,d=Y.placements,N=d===void 0?M:d,V=Y.getPopupContainer,oe=Y.showAction,xe=Y.hideAction,Oe=Y.overlayClassName,Me=Y.overlayStyle,We=Y.visible,rt=Y.trigger,ft=rt===void 0?["hover"]:rt,ze=Y.autoFocus,dt=Y.overlay,Fe=Y.children,qe=Y.onVisibleChange,Wt=(0,J.Z)(Y,j),it=l.useState(),_e=(0,ue.Z)(it,2),be=_e[0],ve=_e[1],Be="visible"in Y?We:be,je=l.useRef(null),Z=l.useRef(null),se=l.useRef(null);l.useImperativeHandle(fe,function(){return je.current});var de=function(ct){ve(ct),qe==null||qe(ct)};b({visible:Be,triggerRef:se,onVisibleChange:de,autoFocus:ze,overlayRef:Z});var we=function(ct){var Ct=Y.onOverlayClick;ve(!1),Ct&&Ct(ct)},ke=function(){return l.createElement(B,{ref:Z,overlay:dt,prefixCls:A,arrow:Q})},Ze=function(){return typeof dt=="function"?ke:ke()},ot=function(){var ct=Y.minOverlayWidthMatchTrigger,Ct=Y.alignPoint;return"minOverlayWidthMatchTrigger"in Y?ct:!Ct},pt=function(){var ct=Y.openClassName;return ct!==void 0?ct:"".concat(A,"-open")},st=l.cloneElement(Fe,{className:ee()((ye=Fe.props)===null||ye===void 0?void 0:ye.className,Be&&pt()),ref:(0,H.Yr)(Fe)?(0,H.sQ)(se,Fe.ref):void 0}),Rt=xe;return!Rt&&ft.indexOf("contextMenu")!==-1&&(Rt=["click"]),l.createElement(D.Z,(0,K.Z)({builtinPlacements:N},Wt,{prefixCls:A,ref:je,popupClassName:ee()(Oe,(0,te.Z)({},"".concat(A,"-show-arrow"),Q)),popupStyle:Me,action:ft,showAction:oe,hideAction:Rt,popupPlacement:p,popupAlign:G,popupTransitionName:L,popupAnimation:S,popupVisible:Be,stretch:ot()?"minWidth":"",popup:Ze(),onPopupVisibleChange:de,onPopupClick:we,getPopupContainer:V}),st)}var $=l.forwardRef(C),X=$},93681:function(tt,Ie,O){"use strict";O.r(Ie),O.d(Ie,{BaseInput:function(){return W},default:function(){return I}});var K=O(72308),te=O(77321),ue=O(49618),J=O(62853),D=O(92310),g=O.n(D),ee=O(59301),H=O(5643),l=function(j){var C,$,X=j.inputElement,Y=j.prefixCls,fe=j.prefix,ye=j.suffix,ae=j.addonBefore,Q=j.addonAfter,R=j.className,A=j.style,L=j.disabled,S=j.readOnly,G=j.focused,P=j.triggerFocus,p=j.allowClear,d=j.value,N=j.handleReset,V=j.hidden,oe=j.classes,xe=j.classNames,Oe=j.dataAttrs,Me=j.styles,We=j.components,rt=(We==null?void 0:We.affixWrapper)||"span",ft=(We==null?void 0:We.groupWrapper)||"span",ze=(We==null?void 0:We.wrapper)||"span",dt=(We==null?void 0:We.groupAddon)||"span",Fe=(0,ee.useRef)(null),qe=function(ke){var Ze;(Ze=Fe.current)!==null&&Ze!==void 0&&Ze.contains(ke.target)&&(P==null||P())},Wt=function(){var ke;if(!p)return null;var Ze=!L&&!S&&d,ot="".concat(Y,"-clear-icon"),pt=(0,J.Z)(p)==="object"&&p!==null&&p!==void 0&&p.clearIcon?p.clearIcon:"\u2716";return ee.createElement("span",{onClick:N,onMouseDown:function(Rt){return Rt.preventDefault()},className:g()(ot,(ke={},(0,ue.Z)(ke,"".concat(ot,"-hidden"),!Ze),(0,ue.Z)(ke,"".concat(ot,"-has-suffix"),!!ye),ke)),role:"button",tabIndex:-1},pt)},it=(0,ee.cloneElement)(X,{value:d,hidden:V,className:g()((C=X.props)===null||C===void 0?void 0:C.className,!(0,H.X3)(j)&&!(0,H.He)(j)&&R)||null,style:(0,te.Z)((0,te.Z)({},($=X.props)===null||$===void 0?void 0:$.style),!(0,H.X3)(j)&&!(0,H.He)(j)?A:{})});if((0,H.X3)(j)){var _e,be="".concat(Y,"-affix-wrapper"),ve=g()(be,(_e={},(0,ue.Z)(_e,"".concat(be,"-disabled"),L),(0,ue.Z)(_e,"".concat(be,"-focused"),G),(0,ue.Z)(_e,"".concat(be,"-readonly"),S),(0,ue.Z)(_e,"".concat(be,"-input-with-clear-btn"),ye&&p&&d),_e),!(0,H.He)(j)&&R,oe==null?void 0:oe.affixWrapper,xe==null?void 0:xe.affixWrapper),Be=(ye||p)&&ee.createElement("span",{className:g()("".concat(Y,"-suffix"),xe==null?void 0:xe.suffix),style:Me==null?void 0:Me.suffix},Wt(),ye);it=ee.createElement(rt,(0,K.Z)({className:ve,style:(0,te.Z)((0,te.Z)({},(0,H.He)(j)?void 0:A),Me==null?void 0:Me.affixWrapper),hidden:!(0,H.He)(j)&&V,onClick:qe},Oe==null?void 0:Oe.affixWrapper,{ref:Fe}),fe&&ee.createElement("span",{className:g()("".concat(Y,"-prefix"),xe==null?void 0:xe.prefix),style:Me==null?void 0:Me.prefix},fe),(0,ee.cloneElement)(X,{value:d,hidden:null}),Be)}if((0,H.He)(j)){var je="".concat(Y,"-group"),Z="".concat(je,"-addon"),se=g()("".concat(Y,"-wrapper"),je,oe==null?void 0:oe.wrapper),de=g()("".concat(Y,"-group-wrapper"),R,oe==null?void 0:oe.group);return ee.createElement(ft,{className:de,style:A,hidden:V},ee.createElement(ze,{className:se},ae&&ee.createElement(dt,{className:Z},ae),(0,ee.cloneElement)(it,{hidden:null}),Q&&ee.createElement(dt,{className:Z},Q)))}return it},W=l,x=O(80702),v=O(52487),_=O(74416),b=O(18929),T=O(2738),B=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","type","classes","classNames","styles"],U=(0,ee.forwardRef)(function(M,j){var C=M.autoComplete,$=M.onChange,X=M.onFocus,Y=M.onBlur,fe=M.onPressEnter,ye=M.onKeyDown,ae=M.prefixCls,Q=ae===void 0?"rc-input":ae,R=M.disabled,A=M.htmlSize,L=M.className,S=M.maxLength,G=M.suffix,P=M.showCount,p=M.type,d=p===void 0?"text":p,N=M.classes,V=M.classNames,oe=M.styles,xe=(0,_.Z)(M,B),Oe=(0,b.Z)(M.defaultValue,{value:M.value}),Me=(0,v.Z)(Oe,2),We=Me[0],rt=Me[1],ft=(0,ee.useState)(!1),ze=(0,v.Z)(ft,2),dt=ze[0],Fe=ze[1],qe=(0,ee.useRef)(null),Wt=function(de){qe.current&&(0,H.nH)(qe.current,de)};(0,ee.useImperativeHandle)(j,function(){return{focus:Wt,blur:function(){var de;(de=qe.current)===null||de===void 0||de.blur()},setSelectionRange:function(de,we,ke){var Ze;(Ze=qe.current)===null||Ze===void 0||Ze.setSelectionRange(de,we,ke)},select:function(){var de;(de=qe.current)===null||de===void 0||de.select()},input:qe.current}}),(0,ee.useEffect)(function(){Fe(function(se){return se&&R?!1:se})},[R]);var it=function(de){M.value===void 0&&rt(de.target.value),qe.current&&(0,H.rJ)(qe.current,de,$)},_e=function(de){fe&&de.key==="Enter"&&fe(de),ye==null||ye(de)},be=function(de){Fe(!0),X==null||X(de)},ve=function(de){Fe(!1),Y==null||Y(de)},Be=function(de){rt(""),Wt(),qe.current&&(0,H.rJ)(qe.current,de,$)},je=function(){var de=(0,T.Z)(M,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","classes","htmlSize","styles","classNames"]);return ee.createElement("input",(0,K.Z)({autoComplete:C},de,{onChange:it,onFocus:be,onBlur:ve,onKeyDown:_e,className:g()(Q,(0,ue.Z)({},"".concat(Q,"-disabled"),R),V==null?void 0:V.input),style:oe==null?void 0:oe.input,ref:qe,size:A,type:d}))},Z=function(){var de=Number(S)>0;if(G||P){var we=(0,H.D7)(We),ke=(0,x.Z)(we).length,Ze=(0,J.Z)(P)==="object"?P.formatter({value:we,count:ke,maxLength:S}):"".concat(ke).concat(de?" / ".concat(S):"");return ee.createElement(ee.Fragment,null,!!P&&ee.createElement("span",{className:g()("".concat(Q,"-show-count-suffix"),(0,ue.Z)({},"".concat(Q,"-show-count-has-suffix"),!!G),V==null?void 0:V.count),style:(0,te.Z)({},oe==null?void 0:oe.count)},Ze),G)}return null};return ee.createElement(W,(0,K.Z)({},xe,{prefixCls:Q,className:L,inputElement:je(),handleReset:Be,value:(0,H.D7)(We),focused:dt,triggerFocus:Wt,suffix:Z(),disabled:R,classes:N,classNames:V,styles:oe}))}),F=U,I=F},5643:function(tt,Ie,O){"use strict";O.d(Ie,{D7:function(){return D},He:function(){return K},X3:function(){return te},nH:function(){return J},rJ:function(){return ue}});function K(g){return!!(g.addonBefore||g.addonAfter)}function te(g){return!!(g.prefix||g.suffix||g.allowClear)}function ue(g,ee,H,l){if(H){var W=ee;if(ee.type==="click"){var x=g.cloneNode(!0);W=Object.create(ee,{target:{value:x},currentTarget:{value:x}}),x.value="",H(W);return}if(l!==void 0){W=Object.create(ee,{target:{value:g},currentTarget:{value:g}}),g.value=l,H(W);return}H(W)}}function J(g,ee){if(g){g.focus(ee);var H=ee||{},l=H.cursor;if(l){var W=g.value.length;switch(l){case"start":g.setSelectionRange(0,0);break;case"end":g.setSelectionRange(W,W);break;default:g.setSelectionRange(0,W)}}}}function D(g){return typeof g=="undefined"||g===null?"":String(g)}},15285:function(tt,Ie,O){"use strict";O.d(Ie,{iz:function(){return Oi},ck:function(){return nt},BW:function(){return sn},sN:function(){return nt},Wd:function(){return Ji},ZP:function(){return mt},Xl:function(){return ye}});var K=O(72308),te=O(49618),ue=O(77321),J=O(80702),D=O(52487),g=O(74416),ee=O(92310),H=O.n(ee),l=O(11780),W=O(18929),x=O(13697),v=O(48736),_=O(59301),b=O(4676),T=_.createContext(null);function B(pe,ne){return pe===void 0?null:"".concat(pe,"-").concat(ne)}function U(pe){var ne=_.useContext(T);return B(ne,pe)}var F=O(80547),I=["children","locked"],M=_.createContext(null);function j(pe,ne){var Ae=(0,ue.Z)({},pe);return Object.keys(ne).forEach(function(Ce){var Te=ne[Ce];Te!==void 0&&(Ae[Ce]=Te)}),Ae}function C(pe){var ne=pe.children,Ae=pe.locked,Ce=(0,g.Z)(pe,I),Te=_.useContext(M),Ue=(0,F.Z)(function(){return j(Te,Ce)},[Te,Ce],function(Pe,ut){return!Ae&&(Pe[0]!==ut[0]||!(0,x.Z)(Pe[1],ut[1],!0))});return _.createElement(M.Provider,{value:Ue},ne)}var $=[],X=_.createContext(null);function Y(){return _.useContext(X)}var fe=_.createContext($);function ye(pe){var ne=_.useContext(fe);return _.useMemo(function(){return pe!==void 0?[].concat((0,J.Z)(ne),[pe]):ne},[ne,pe])}var ae=_.createContext(null),Q=_.createContext({}),R=Q,A=O(29194);function L(pe){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,A.Z)(pe)){var Ae=pe.nodeName.toLowerCase(),Ce=["input","select","textarea","button"].includes(Ae)||pe.isContentEditable||Ae==="a"&&!!pe.getAttribute("href"),Te=pe.getAttribute("tabindex"),Ue=Number(Te),Pe=null;return Te&&!Number.isNaN(Ue)?Pe=Ue:Ce&&Pe===null&&(Pe=0),Ce&&pe.disabled&&(Pe=null),Pe!==null&&(Pe>=0||ne&&Pe<0)}return!1}function S(pe){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ae=(0,J.Z)(pe.querySelectorAll("*")).filter(function(Ce){return L(Ce,ne)});return L(pe,ne)&&Ae.unshift(pe),Ae}var G=null;function P(){G=document.activeElement}function p(){G=null}function d(){if(G)try{G.focus()}catch(pe){}}function N(pe,ne){if(ne.keyCode===9){var Ae=S(pe),Ce=Ae[ne.shiftKey?0:Ae.length-1],Te=Ce===document.activeElement||pe===document.activeElement;if(Te){var Ue=Ae[ne.shiftKey?Ae.length-1:0];Ue.focus(),ne.preventDefault()}}}var V=O(10228),oe=O(16089),xe=V.Z.LEFT,Oe=V.Z.RIGHT,Me=V.Z.UP,We=V.Z.DOWN,rt=V.Z.ENTER,ft=V.Z.ESC,ze=V.Z.HOME,dt=V.Z.END,Fe=[Me,We,xe,Oe];function qe(pe,ne,Ae,Ce){var Te,Ue,Pe,ut,Tt="prev",re="next",At="children",wt="parent";if(pe==="inline"&&Ce===rt)return{inlineTrigger:!0};var Gt=(Te={},(0,te.Z)(Te,Me,Tt),(0,te.Z)(Te,We,re),Te),Ye=(Ue={},(0,te.Z)(Ue,xe,Ae?re:Tt),(0,te.Z)(Ue,Oe,Ae?Tt:re),(0,te.Z)(Ue,We,At),(0,te.Z)(Ue,rt,At),Ue),Je=(Pe={},(0,te.Z)(Pe,Me,Tt),(0,te.Z)(Pe,We,re),(0,te.Z)(Pe,rt,At),(0,te.Z)(Pe,ft,wt),(0,te.Z)(Pe,xe,Ae?At:wt),(0,te.Z)(Pe,Oe,Ae?wt:At),Pe),ni={inline:Gt,horizontal:Ye,vertical:Je,inlineSub:Gt,horizontalSub:Je,verticalSub:Je},si=(ut=ni["".concat(pe).concat(ne?"":"Sub")])===null||ut===void 0?void 0:ut[Ce];switch(si){case Tt:return{offset:-1,sibling:!0};case re:return{offset:1,sibling:!0};case wt:return{offset:-1,sibling:!1};case At:return{offset:1,sibling:!1};default:return null}}function Wt(pe){for(var ne=pe;ne;){if(ne.getAttribute("data-menu-list"))return ne;ne=ne.parentElement}return null}function it(pe,ne){for(var Ae=pe||document.activeElement;Ae;){if(ne.has(Ae))return Ae;Ae=Ae.parentElement}return null}function _e(pe,ne){var Ae=S(pe,!0);return Ae.filter(function(Ce){return ne.has(Ce)})}function be(pe,ne,Ae){var Ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!pe)return null;var Te=_e(pe,ne),Ue=Te.length,Pe=Te.findIndex(function(ut){return Ae===ut});return Ce<0?Pe===-1?Pe=Ue-1:Pe-=1:Ce>0&&(Pe+=1),Pe=(Pe+Ue)%Ue,Te[Pe]}var ve=function(ne,Ae){var Ce=new Set,Te=new Map,Ue=new Map;return ne.forEach(function(Pe){var ut=document.querySelector("[data-menu-id='".concat(B(Ae,Pe),"']"));ut&&(Ce.add(ut),Ue.set(ut,Pe),Te.set(Pe,ut))}),{elements:Ce,key2element:Te,element2key:Ue}};function Be(pe,ne,Ae,Ce,Te,Ue,Pe,ut,Tt,re){var At=_.useRef(),wt=_.useRef();wt.current=ne;var Gt=function(){oe.Z.cancel(At.current)};return _.useEffect(function(){return function(){Gt()}},[]),function(Ye){var Je=Ye.which;if([].concat(Fe,[rt,ft,ze,dt]).includes(Je)){var ni=Ue(),si=ve(ni,Ce),di=si,ti=di.elements,Kt=di.key2element,Ht=di.element2key,Bt=Kt.get(ne),oi=it(Bt,ti),Ii=Ht.get(oi),li=qe(pe,Pe(Ii,!0).length===1,Ae,Je);if(!li&&Je!==ze&&Je!==dt)return;(Fe.includes(Je)||[ze,dt].includes(Je))&&Ye.preventDefault();var ri=function(_i){if(_i){var Zi=_i,dn=_i.querySelector("a");dn!=null&&dn.getAttribute("href")&&(Zi=dn);var vi=Ht.get(_i);ut(vi),Gt(),At.current=(0,oe.Z)(function(){wt.current===vi&&Zi.focus()})}};if([ze,dt].includes(Je)||li.sibling||!oi){var jt;!oi||pe==="inline"?jt=Te.current:jt=Wt(oi);var Bi,mi=_e(jt,ti);Je===ze?Bi=mi[0]:Je===dt?Bi=mi[mi.length-1]:Bi=be(jt,ti,oi,li.offset),ri(Bi)}else if(li.inlineTrigger)Tt(Ii);else if(li.offset>0)Tt(Ii,!0),Gt(),At.current=(0,oe.Z)(function(){si=ve(ni,Ce);var Hi=oi.getAttribute("aria-controls"),_i=document.getElementById(Hi),Zi=be(_i,si.elements);ri(Zi)},5);else if(li.offset<0){var Ft=Pe(Ii,!0),zi=Ft[Ft.length-2],Gi=Kt.get(zi);Tt(zi,!1),ri(Gi)}}re==null||re(Ye)}}function je(pe){Promise.resolve().then(pe)}var Z="__RC_UTIL_PATH_SPLIT__",se=function(ne){return ne.join(Z)},de=function(ne){return ne.split(Z)},we="rc-menu-more";function ke(){var pe=_.useState({}),ne=(0,D.Z)(pe,2),Ae=ne[1],Ce=(0,_.useRef)(new Map),Te=(0,_.useRef)(new Map),Ue=_.useState([]),Pe=(0,D.Z)(Ue,2),ut=Pe[0],Tt=Pe[1],re=(0,_.useRef)(0),At=(0,_.useRef)(!1),wt=function(){At.current||Ae({})},Gt=(0,_.useCallback)(function(Kt,Ht){var Bt=se(Ht);Te.current.set(Bt,Kt),Ce.current.set(Kt,Bt),re.current+=1;var oi=re.current;je(function(){oi===re.current&&wt()})},[]),Ye=(0,_.useCallback)(function(Kt,Ht){var Bt=se(Ht);Te.current.delete(Bt),Ce.current.delete(Kt)},[]),Je=(0,_.useCallback)(function(Kt){Tt(Kt)},[]),ni=(0,_.useCallback)(function(Kt,Ht){var Bt=Ce.current.get(Kt)||"",oi=de(Bt);return Ht&&ut.includes(oi[0])&&oi.unshift(we),oi},[ut]),si=(0,_.useCallback)(function(Kt,Ht){return Kt.some(function(Bt){var oi=ni(Bt,!0);return oi.includes(Ht)})},[ni]),di=function(){var Ht=(0,J.Z)(Ce.current.keys());return ut.length&&Ht.push(we),Ht},ti=(0,_.useCallback)(function(Kt){var Ht="".concat(Ce.current.get(Kt)).concat(Z),Bt=new Set;return(0,J.Z)(Te.current.keys()).forEach(function(oi){oi.startsWith(Ht)&&Bt.add(Te.current.get(oi))}),Bt},[]);return _.useEffect(function(){return function(){At.current=!0}},[]),{registerPath:Gt,unregisterPath:Ye,refreshOverflowKeys:Je,isSubPathKey:si,getKeyPath:ni,getKeys:di,getSubPathKeys:ti}}function Ze(pe){var ne=_.useRef(pe);ne.current=pe;var Ae=_.useCallback(function(){for(var Ce,Te=arguments.length,Ue=new Array(Te),Pe=0;Pe<Te;Pe++)Ue[Pe]=arguments[Pe];return(Ce=ne.current)===null||Ce===void 0?void 0:Ce.call.apply(Ce,[ne].concat(Ue))},[]);return pe?Ae:void 0}var ot=Math.random().toFixed(5).toString().slice(2),pt=0;function st(pe){var ne=(0,W.Z)(pe,{value:pe}),Ae=(0,D.Z)(ne,2),Ce=Ae[0],Te=Ae[1];return _.useEffect(function(){pt+=1;var Ue="".concat(ot,"-").concat(pt);Te("rc-menu-uuid-".concat(Ue))},[]),Ce}var Rt=O(96949),Ut=O(55090),ct=O(77205),Ct=O(38793),Ot=O(2738),Mt=O(8654);function Xe(pe,ne,Ae,Ce){var Te=_.useContext(M),Ue=Te.activeKey,Pe=Te.onActive,ut=Te.onInactive,Tt={active:Ue===pe};return ne||(Tt.onMouseEnter=function(re){Ae==null||Ae({key:pe,domEvent:re}),Pe(pe)},Tt.onMouseLeave=function(re){Ce==null||Ce({key:pe,domEvent:re}),ut(pe)}),Tt}function xi(pe){var ne=_.useContext(M),Ae=ne.mode,Ce=ne.rtl,Te=ne.inlineIndent;if(Ae!=="inline")return null;var Ue=pe;return Ce?{paddingRight:Ue*Te}:{paddingLeft:Ue*Te}}function bt(pe){var ne=pe.icon,Ae=pe.props,Ce=pe.children,Te;return ne===null||ne===!1?null:(typeof ne=="function"?Te=_.createElement(ne,(0,ue.Z)({},Ae)):typeof ne!="boolean"&&(Te=ne),Te||Ce||null)}var Le=["item"];function Ne(pe){var ne=pe.item,Ae=(0,g.Z)(pe,Le);return Object.defineProperty(Ae,"item",{get:function(){return(0,v.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),ne}}),Ae}var Ke=["title","attribute","elementRef"],Nt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],lt=["active"],Et=function(pe){(0,ct.Z)(Ae,pe);var ne=(0,Ct.Z)(Ae);function Ae(){return(0,Rt.Z)(this,Ae),ne.apply(this,arguments)}return(0,Ut.Z)(Ae,[{key:"render",value:function(){var Te=this.props,Ue=Te.title,Pe=Te.attribute,ut=Te.elementRef,Tt=(0,g.Z)(Te,Ke),re=(0,Ot.Z)(Tt,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,v.ZP)(!Pe,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),_.createElement(l.Z.Item,(0,K.Z)({},Pe,{title:typeof Ue=="string"?Ue:void 0},re,{ref:ut}))}}]),Ae}(_.Component),kt=_.forwardRef(function(pe,ne){var Ae,Ce=pe.style,Te=pe.className,Ue=pe.eventKey,Pe=pe.warnKey,ut=pe.disabled,Tt=pe.itemIcon,re=pe.children,At=pe.role,wt=pe.onMouseEnter,Gt=pe.onMouseLeave,Ye=pe.onClick,Je=pe.onKeyDown,ni=pe.onFocus,si=(0,g.Z)(pe,Nt),di=U(Ue),ti=_.useContext(M),Kt=ti.prefixCls,Ht=ti.onItemClick,Bt=ti.disabled,oi=ti.overflowDisabled,Ii=ti.itemIcon,li=ti.selectedKeys,ri=ti.onActive,jt=_.useContext(R),Bi=jt._internalRenderMenuItem,mi="".concat(Kt,"-item"),Ft=_.useRef(),zi=_.useRef(),Gi=Bt||ut,Hi=(0,Mt.x1)(ne,zi),_i=ye(Ue),Zi=function(Ai){return{key:Ue,keyPath:(0,J.Z)(_i).reverse(),item:Ft.current,domEvent:Ai}},dn=Tt||Ii,vi=Xe(Ue,Gi,wt,Gt),wn=vi.active,On=(0,g.Z)(vi,lt),En=li.includes(Ue),gn=xi(_i.length),un=function(Ai){if(!Gi){var Wi=Zi(Ai);Ye==null||Ye(Ne(Wi)),Ht(Wi)}},Yi=function(Ai){if(Je==null||Je(Ai),Ai.which===V.Z.ENTER){var Wi=Zi(Ai);Ye==null||Ye(Ne(Wi)),Ht(Wi)}},rn=function(Ai){ri(Ue),ni==null||ni(Ai)},pn={};pe.role==="option"&&(pn["aria-selected"]=En);var In=_.createElement(Et,(0,K.Z)({ref:Ft,elementRef:Hi,role:At===null?"none":At||"menuitem",tabIndex:ut?null:-1,"data-menu-id":oi&&di?null:di},si,On,pn,{component:"li","aria-disabled":ut,style:(0,ue.Z)((0,ue.Z)({},gn),Ce),className:H()(mi,(Ae={},(0,te.Z)(Ae,"".concat(mi,"-active"),wn),(0,te.Z)(Ae,"".concat(mi,"-selected"),En),(0,te.Z)(Ae,"".concat(mi,"-disabled"),Gi),Ae),Te),onClick:un,onKeyDown:Yi,onFocus:rn}),re,_.createElement(bt,{props:(0,ue.Z)((0,ue.Z)({},pe),{},{isSelected:En}),icon:dn}));return Bi&&(In=Bi(In,pe,{selected:En})),In});function gt(pe,ne){var Ae=pe.eventKey,Ce=Y(),Te=ye(Ae);return _.useEffect(function(){if(Ce)return Ce.registerPath(Ae,Te),function(){Ce.unregisterPath(Ae,Te)}},[Te]),Ce?null:_.createElement(kt,(0,K.Z)({},pe,{ref:ne}))}var nt=_.forwardRef(gt),xt=["className","children"],at=function(ne,Ae){var Ce=ne.className,Te=ne.children,Ue=(0,g.Z)(ne,xt),Pe=_.useContext(M),ut=Pe.prefixCls,Tt=Pe.mode,re=Pe.rtl;return _.createElement("ul",(0,K.Z)({className:H()(ut,re&&"".concat(ut,"-rtl"),"".concat(ut,"-sub"),"".concat(ut,"-").concat(Tt==="inline"?"inline":"vertical"),Ce),role:"menu"},Ue,{"data-menu-list":!0,ref:Ae}),Te)},St=_.forwardRef(at);St.displayName="SubMenuList";var ci=St,ai=O(11592);function Si(pe,ne){return(0,ai.Z)(pe).map(function(Ae,Ce){if(_.isValidElement(Ae)){var Te,Ue,Pe=Ae.key,ut=(Te=(Ue=Ae.props)===null||Ue===void 0?void 0:Ue.eventKey)!==null&&Te!==void 0?Te:Pe,Tt=ut==null;Tt&&(ut="tmp_key-".concat([].concat((0,J.Z)(ne),[Ce]).join("-")));var re={key:ut,eventKey:ut};return _.cloneElement(Ae,re)}return Ae})}var $t=O(35593),Jt={adjustX:1,adjustY:1},Mi={topLeft:{points:["bl","tl"],overflow:Jt},topRight:{points:["br","tr"],overflow:Jt},bottomLeft:{points:["tl","bl"],overflow:Jt},bottomRight:{points:["tr","br"],overflow:Jt},leftTop:{points:["tr","tl"],overflow:Jt},leftBottom:{points:["br","bl"],overflow:Jt},rightTop:{points:["tl","tr"],overflow:Jt},rightBottom:{points:["bl","br"],overflow:Jt}},Di={topLeft:{points:["bl","tl"],overflow:Jt},topRight:{points:["br","tr"],overflow:Jt},bottomLeft:{points:["tl","bl"],overflow:Jt},bottomRight:{points:["tr","br"],overflow:Jt},rightTop:{points:["tr","tl"],overflow:Jt},rightBottom:{points:["br","bl"],overflow:Jt},leftTop:{points:["tl","tr"],overflow:Jt},leftBottom:{points:["bl","br"],overflow:Jt}},tn=null;function Ci(pe,ne,Ae){if(ne)return ne;if(Ae)return Ae[pe]||Ae.other}var hi={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function qt(pe){var ne=pe.prefixCls,Ae=pe.visible,Ce=pe.children,Te=pe.popup,Ue=pe.popupStyle,Pe=pe.popupClassName,ut=pe.popupOffset,Tt=pe.disabled,re=pe.mode,At=pe.onVisibleChange,wt=_.useContext(M),Gt=wt.getPopupContainer,Ye=wt.rtl,Je=wt.subMenuOpenDelay,ni=wt.subMenuCloseDelay,si=wt.builtinPlacements,di=wt.triggerSubMenuAction,ti=wt.forceSubMenuRender,Kt=wt.rootClassName,Ht=wt.motion,Bt=wt.defaultMotions,oi=_.useState(!1),Ii=(0,D.Z)(oi,2),li=Ii[0],ri=Ii[1],jt=Ye?(0,ue.Z)((0,ue.Z)({},Di),si):(0,ue.Z)((0,ue.Z)({},Mi),si),Bi=hi[re],mi=Ci(re,Ht,Bt),Ft=_.useRef(mi);re!=="inline"&&(Ft.current=mi);var zi=(0,ue.Z)((0,ue.Z)({},Ft.current),{},{leavedClassName:"".concat(ne,"-hidden"),removeOnLeave:!1,motionAppear:!0}),Gi=_.useRef();return _.useEffect(function(){return Gi.current=(0,oe.Z)(function(){ri(Ae)}),function(){oe.Z.cancel(Gi.current)}},[Ae]),_.createElement($t.Z,{prefixCls:ne,popupClassName:H()("".concat(ne,"-popup"),(0,te.Z)({},"".concat(ne,"-rtl"),Ye),Pe,Kt),stretch:re==="horizontal"?"minWidth":null,getPopupContainer:Gt,builtinPlacements:jt,popupPlacement:Bi,popupVisible:li,popup:Te,popupStyle:Ue,popupAlign:ut&&{offset:ut},action:Tt?[]:[di],mouseEnterDelay:Je,mouseLeaveDelay:ni,onPopupVisibleChange:At,forceRender:ti,popupMotion:zi,fresh:!0},Ce)}var wi=O(77900);function Qi(pe){var ne=pe.id,Ae=pe.open,Ce=pe.keyPath,Te=pe.children,Ue="inline",Pe=_.useContext(M),ut=Pe.prefixCls,Tt=Pe.forceSubMenuRender,re=Pe.motion,At=Pe.defaultMotions,wt=Pe.mode,Gt=_.useRef(!1);Gt.current=wt===Ue;var Ye=_.useState(!Gt.current),Je=(0,D.Z)(Ye,2),ni=Je[0],si=Je[1],di=Gt.current?Ae:!1;_.useEffect(function(){Gt.current&&si(!1)},[wt]);var ti=(0,ue.Z)({},Ci(Ue,re,At));Ce.length>1&&(ti.motionAppear=!1);var Kt=ti.onVisibleChanged;return ti.onVisibleChanged=function(Ht){return!Gt.current&&!Ht&&si(!0),Kt==null?void 0:Kt(Ht)},ni?null:_.createElement(C,{mode:Ue,locked:!Gt.current},_.createElement(wi.default,(0,K.Z)({visible:di},ti,{forceRender:Tt,removeOnLeave:!1,leavedClassName:"".concat(ut,"-hidden")}),function(Ht){var Bt=Ht.className,oi=Ht.style;return _.createElement(ci,{id:ne,className:Bt,style:oi},Te)}))}var Vi=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],fn=["active"],Ti=function(ne){var Ae,Ce=ne.style,Te=ne.className,Ue=ne.title,Pe=ne.eventKey,ut=ne.warnKey,Tt=ne.disabled,re=ne.internalPopupClose,At=ne.children,wt=ne.itemIcon,Gt=ne.expandIcon,Ye=ne.popupClassName,Je=ne.popupOffset,ni=ne.popupStyle,si=ne.onClick,di=ne.onMouseEnter,ti=ne.onMouseLeave,Kt=ne.onTitleClick,Ht=ne.onTitleMouseEnter,Bt=ne.onTitleMouseLeave,oi=(0,g.Z)(ne,Vi),Ii=U(Pe),li=_.useContext(M),ri=li.prefixCls,jt=li.mode,Bi=li.openKeys,mi=li.disabled,Ft=li.overflowDisabled,zi=li.activeKey,Gi=li.selectedKeys,Hi=li.itemIcon,_i=li.expandIcon,Zi=li.onItemClick,dn=li.onOpenChange,vi=li.onActive,wn=_.useContext(R),On=wn._internalRenderSubMenuItem,En=_.useContext(ae),gn=En.isSubPathKey,un=ye(),Yi="".concat(ri,"-submenu"),rn=mi||Tt,pn=_.useRef(),In=_.useRef(),Ui=wt!=null?wt:Hi,Ai=Gt!=null?Gt:_i,Wi=Bi.includes(Pe),en=!Ft&&Wi,Rn=gn(Gi,Pe),_t=Xe(Pe,rn,Ht,Bt),bn=_t.active,Ln=(0,g.Z)(_t,fn),xn=_.useState(!1),Hn=(0,D.Z)(xn,2),Wn=Hn[0],qn=Hn[1],Mn=function(Ki){rn||qn(Ki)},Zt=function(Ki){Mn(!0),di==null||di({key:Pe,domEvent:Ki})},as=function(Ki){Mn(!1),ti==null||ti({key:Pe,domEvent:Ki})},jn=_.useMemo(function(){return bn||(jt!=="inline"?Wn||gn([zi],Pe):!1)},[jt,bn,zi,Wn,Pe,gn]),Vn=xi(un.length),es=function(Ki){rn||(Kt==null||Kt({key:Pe,domEvent:Ki}),jt==="inline"&&dn(Pe,!Wi))},Nn=Ze(function(an){si==null||si(Ne(an)),Zi(an)}),Fn=function(Ki){jt!=="inline"&&dn(Pe,Ki)},mn=function(){vi(Pe)},ji=Ii&&"".concat(Ii,"-popup"),Sn=_.createElement("div",(0,K.Z)({role:"menuitem",style:Vn,className:"".concat(Yi,"-title"),tabIndex:rn?null:-1,ref:pn,title:typeof Ue=="string"?Ue:null,"data-menu-id":Ft&&Ii?null:Ii,"aria-expanded":en,"aria-haspopup":!0,"aria-controls":ji,"aria-disabled":rn,onClick:es,onFocus:mn},Ln),Ue,_.createElement(bt,{icon:jt!=="horizontal"?Ai:void 0,props:(0,ue.Z)((0,ue.Z)({},ne),{},{isOpen:en,isSubMenu:!0})},_.createElement("i",{className:"".concat(Yi,"-arrow")}))),Pi=_.useRef(jt);if(jt!=="inline"&&un.length>1?Pi.current="vertical":Pi.current=jt,!Ft){var _n=Pi.current;Sn=_.createElement(qt,{mode:_n,prefixCls:Yi,visible:!re&&en&&jt!=="inline",popupClassName:Ye,popupOffset:Je,popupStyle:ni,popup:_.createElement(C,{mode:_n==="horizontal"?"vertical":_n},_.createElement(ci,{id:ji,ref:In},At)),disabled:rn,onVisibleChange:Fn},Sn)}var vn=_.createElement(l.Z.Item,(0,K.Z)({role:"none"},oi,{component:"li",style:Ce,className:H()(Yi,"".concat(Yi,"-").concat(jt),Te,(Ae={},(0,te.Z)(Ae,"".concat(Yi,"-open"),en),(0,te.Z)(Ae,"".concat(Yi,"-active"),jn),(0,te.Z)(Ae,"".concat(Yi,"-selected"),Rn),(0,te.Z)(Ae,"".concat(Yi,"-disabled"),rn),Ae)),onMouseEnter:Zt,onMouseLeave:as}),Sn,!Ft&&_.createElement(Qi,{id:ji,open:en,keyPath:un},At));return On&&(vn=On(vn,ne,{selected:Rn,active:jn,open:en,disabled:rn})),_.createElement(C,{onItemClick:Nn,mode:jt==="horizontal"?"vertical":jt,itemIcon:Ui,expandIcon:Ai},vn)};function Ji(pe){var ne=pe.eventKey,Ae=pe.children,Ce=ye(ne),Te=Si(Ae,Ce),Ue=Y();_.useEffect(function(){if(Ue)return Ue.registerPath(ne,Ce),function(){Ue.unregisterPath(ne,Ce)}},[Ce]);var Pe;return Ue?Pe=Te:Pe=_.createElement(Ti,pe,Te),_.createElement(fe.Provider,{value:Ce},Pe)}var qi=O(62853),Ni=["className","title","eventKey","children"],nn=["children"],Vt=function(ne){var Ae=ne.className,Ce=ne.title,Te=ne.eventKey,Ue=ne.children,Pe=(0,g.Z)(ne,Ni),ut=_.useContext(M),Tt=ut.prefixCls,re="".concat(Tt,"-item-group");return _.createElement("li",(0,K.Z)({role:"presentation"},Pe,{onClick:function(wt){return wt.stopPropagation()},className:H()(re,Ae)}),_.createElement("div",{role:"presentation",className:"".concat(re,"-title"),title:typeof Ce=="string"?Ce:void 0},Ce),_.createElement("ul",{role:"group",className:"".concat(re,"-list")},Ue))};function sn(pe){var ne=pe.children,Ae=(0,g.Z)(pe,nn),Ce=ye(Ae.eventKey),Te=Si(ne,Ce),Ue=Y();return Ue?Te:_.createElement(Vt,(0,Ot.Z)(Ae,["warnKey"]),Te)}function Oi(pe){var ne=pe.className,Ae=pe.style,Ce=_.useContext(M),Te=Ce.prefixCls,Ue=Y();return Ue?null:_.createElement("li",{role:"separator",className:H()("".concat(Te,"-item-divider"),ne),style:Ae})}var on=["label","children","key","type"];function yi(pe){return(pe||[]).map(function(ne,Ae){if(ne&&(0,qi.Z)(ne)==="object"){var Ce=ne,Te=Ce.label,Ue=Ce.children,Pe=Ce.key,ut=Ce.type,Tt=(0,g.Z)(Ce,on),re=Pe!=null?Pe:"tmp-".concat(Ae);return Ue||ut==="group"?ut==="group"?_.createElement(sn,(0,K.Z)({key:re},Tt,{title:Te}),yi(Ue)):_.createElement(Ji,(0,K.Z)({key:re},Tt,{title:Te}),yi(Ue)):ut==="divider"?_.createElement(Oi,(0,K.Z)({key:re},Tt)):_.createElement(nt,(0,K.Z)({key:re},Tt),Te)}return null}).filter(function(ne){return ne})}function ei(pe,ne,Ae){var Ce=pe;return ne&&(Ce=yi(ne)),Si(Ce,Ae)}var kn=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem"],gi=[],Qt=_.forwardRef(function(pe,ne){var Ae,Ce,Te=pe,Ue=Te.prefixCls,Pe=Ue===void 0?"rc-menu":Ue,ut=Te.rootClassName,Tt=Te.style,re=Te.className,At=Te.tabIndex,wt=At===void 0?0:At,Gt=Te.items,Ye=Te.children,Je=Te.direction,ni=Te.id,si=Te.mode,di=si===void 0?"vertical":si,ti=Te.inlineCollapsed,Kt=Te.disabled,Ht=Te.disabledOverflow,Bt=Te.subMenuOpenDelay,oi=Bt===void 0?.1:Bt,Ii=Te.subMenuCloseDelay,li=Ii===void 0?.1:Ii,ri=Te.forceSubMenuRender,jt=Te.defaultOpenKeys,Bi=Te.openKeys,mi=Te.activeKey,Ft=Te.defaultActiveFirst,zi=Te.selectable,Gi=zi===void 0?!0:zi,Hi=Te.multiple,_i=Hi===void 0?!1:Hi,Zi=Te.defaultSelectedKeys,dn=Te.selectedKeys,vi=Te.onSelect,wn=Te.onDeselect,On=Te.inlineIndent,En=On===void 0?24:On,gn=Te.motion,un=Te.defaultMotions,Yi=Te.triggerSubMenuAction,rn=Yi===void 0?"hover":Yi,pn=Te.builtinPlacements,In=Te.itemIcon,Ui=Te.expandIcon,Ai=Te.overflowedIndicator,Wi=Ai===void 0?"...":Ai,en=Te.overflowedIndicatorPopupClassName,Rn=Te.getPopupContainer,_t=Te.onClick,bn=Te.onOpenChange,Ln=Te.onKeyDown,xn=Te.openAnimation,Hn=Te.openTransitionName,Wn=Te._internalRenderMenuItem,qn=Te._internalRenderSubMenuItem,Mn=(0,g.Z)(Te,kn),Zt=_.useMemo(function(){return ei(Ye,Gt,gi)},[Ye,Gt]),as=_.useState(!1),jn=(0,D.Z)(as,2),Vn=jn[0],es=jn[1],Nn=_.useRef(),Fn=st(ni),mn=Je==="rtl",ji=(0,W.Z)(jt,{value:Bi,postState:function(Ei){return Ei||gi}}),Sn=(0,D.Z)(ji,2),Pi=Sn[0],_n=Sn[1],vn=function(Ei){var Ri=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function cn(){_n(Ei),bn==null||bn(Ei)}Ri?(0,b.flushSync)(cn):cn()},an=_.useState(Pi),Ki=(0,D.Z)(an,2),Yt=Ki[0],Xi=Ki[1],zn=_.useRef(!1),ts=_.useMemo(function(){return(di==="inline"||di==="vertical")&&ti?["vertical",ti]:[di,!1]},[di,ti]),is=(0,D.Z)(ts,2),Bn=is[0],Qe=is[1],It=Bn==="inline",ki=_.useState(Bn),$i=(0,D.Z)(ki,2),ui=$i[0],Zn=$i[1],Yn=_.useState(Qe),ys=(0,D.Z)(Yn,2),os=ys[0],sr=ys[1];_.useEffect(function(){Zn(Bn),sr(Qe),zn.current&&(It?_n(Yt):vn(gi))},[Bn,Qe]);var Cr=_.useState(0),ws=(0,D.Z)(Cr,2),Is=ws[0],Un=ws[1],Rs=Is>=Zt.length-1||ui!=="horizontal"||Ht;_.useEffect(function(){It&&Xi(Pi)},[Pi]),_.useEffect(function(){return zn.current=!0,function(){zn.current=!1}},[]);var ls=ke(),$s=ls.registerPath,Gs=ls.unregisterPath,rr=ls.refreshOverflowKeys,Ks=ls.isSubPathKey,Or=ls.getKeyPath,Ls=ls.getKeys,ar=ls.getSubPathKeys,or=_.useMemo(function(){return{registerPath:$s,unregisterPath:Gs}},[$s,Gs]),Xn=_.useMemo(function(){return{isSubPathKey:Ks}},[Ks]);_.useEffect(function(){rr(Rs?gi:Zt.slice(Is+1).map(function(Fi){return Fi.key}))},[Is,Rs]);var lr=(0,W.Z)(mi||Ft&&((Ae=Zt[0])===null||Ae===void 0?void 0:Ae.key),{value:mi}),Ds=(0,D.Z)(lr,2),ds=Ds[0],Hs=Ds[1],Pr=Ze(function(Fi){Hs(Fi)}),kr=Ze(function(){Hs(void 0)});(0,_.useImperativeHandle)(ne,function(){return{list:Nn.current,focus:function(Ei){var Ri,cn=Ls(),Tn=ve(cn,Fn),De=Tn.elements,xs=Tn.key2element,dr=Tn.element2key,zs=_e(Nn.current,De),pr=ds!=null?ds:zs[0]?dr.get(zs[0]):(Ri=Zt.find(function(Br){return!Br.props.disabled}))===null||Ri===void 0?void 0:Ri.key,us=xs.get(pr);if(pr&&us){var Cs;us==null||(Cs=us.focus)===null||Cs===void 0||Cs.call(us,Ei)}}}});var Mr=(0,W.Z)(Zi||[],{value:dn,postState:function(Ei){return Array.isArray(Ei)?Ei:Ei==null?gi:[Ei]}}),Ws=(0,D.Z)(Mr,2),Es=Ws[0],js=Ws[1],ur=function(Ei){if(Gi){var Ri=Ei.key,cn=Es.includes(Ri),Tn;_i?cn?Tn=Es.filter(function(xs){return xs!==Ri}):Tn=[].concat((0,J.Z)(Es),[Ri]):Tn=[Ri],js(Tn);var De=(0,ue.Z)((0,ue.Z)({},Ei),{},{selectedKeys:Tn});cn?wn==null||wn(De):vi==null||vi(De)}!_i&&Pi.length&&ui!=="inline"&&vn(gi)},Nr=Ze(function(Fi){_t==null||_t(Ne(Fi)),ur(Fi)}),Vs=Ze(function(Fi,Ei){var Ri=Pi.filter(function(Tn){return Tn!==Fi});if(Ei)Ri.push(Fi);else if(ui!=="inline"){var cn=ar(Fi);Ri=Ri.filter(function(Tn){return!cn.has(Tn)})}(0,x.Z)(Pi,Ri,!0)||vn(Ri,!0)}),cr=function(Ei,Ri){var cn=Ri!=null?Ri:!Pi.includes(Ei);Vs(Ei,cn)},hr=Be(ui,ds,mn,Fn,Nn,Ls,Or,Hs,cr,Ln);_.useEffect(function(){es(!0)},[]);var bs=_.useMemo(function(){return{_internalRenderMenuItem:Wn,_internalRenderSubMenuItem:qn}},[Wn,qn]),Fr=ui!=="horizontal"||Ht?Zt:Zt.map(function(Fi,Ei){return _.createElement(C,{key:Fi.key,overflowDisabled:Ei>Is},Fi)}),fr=_.createElement(l.Z,(0,K.Z)({id:ni,ref:Nn,prefixCls:"".concat(Pe,"-overflow"),component:"ul",itemComponent:nt,className:H()(Pe,"".concat(Pe,"-root"),"".concat(Pe,"-").concat(ui),re,(Ce={},(0,te.Z)(Ce,"".concat(Pe,"-inline-collapsed"),os),(0,te.Z)(Ce,"".concat(Pe,"-rtl"),mn),Ce),ut),dir:Je,style:Tt,role:"menu",tabIndex:wt,data:Fr,renderRawItem:function(Ei){return Ei},renderRawRest:function(Ei){var Ri=Ei.length,cn=Ri?Zt.slice(-Ri):null;return _.createElement(Ji,{eventKey:we,title:Wi,disabled:Rs,internalPopupClose:Ri===0,popupClassName:en},cn)},maxCount:ui!=="horizontal"||Ht?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Ei){Un(Ei)},onKeyDown:hr},Mn));return _.createElement(R.Provider,{value:bs},_.createElement(T.Provider,{value:Fn},_.createElement(C,{prefixCls:Pe,rootClassName:ut,mode:ui,openKeys:Pi,rtl:mn,disabled:Kt,motion:Vn?gn:null,defaultMotions:Vn?un:null,activeKey:ds,onActive:Pr,onInactive:kr,selectedKeys:Es,inlineIndent:En,subMenuOpenDelay:oi,subMenuCloseDelay:li,forceSubMenuRender:ri,builtinPlacements:pn,triggerSubMenuAction:rn,getPopupContainer:Rn,itemIcon:In,expandIcon:Ui,onItemClick:Nr,onOpenChange:Vs},_.createElement(ae.Provider,{value:Xn},fr),_.createElement("div",{style:{display:"none"},"aria-hidden":!0},_.createElement(X.Provider,{value:or},Zt)))))}),ln=Qt,ii=ln;ii.Item=nt,ii.SubMenu=Ji,ii.ItemGroup=sn,ii.Divider=Oi;var mt=ii},11780:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return P}});var K=O(72308),te=O(77321),ue=O(52487),J=O(74416),D=O(59301),g=O(92310),ee=O.n(g),H=O(29301),l=O(34280),W=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],x=void 0;function v(p,d){var N=p.prefixCls,V=p.invalidate,oe=p.item,xe=p.renderItem,Oe=p.responsive,Me=p.responsiveDisabled,We=p.registerSize,rt=p.itemKey,ft=p.className,ze=p.style,dt=p.children,Fe=p.display,qe=p.order,Wt=p.component,it=Wt===void 0?"div":Wt,_e=(0,J.Z)(p,W),be=Oe&&!Fe;function ve(de){We(rt,de)}D.useEffect(function(){return function(){ve(null)}},[]);var Be=xe&&oe!==x?xe(oe,{index:qe}):dt,je;V||(je={opacity:be?0:1,height:be?0:x,overflowY:be?"hidden":x,order:Oe?qe:x,pointerEvents:be?"none":x,position:be?"absolute":x});var Z={};be&&(Z["aria-hidden"]=!0);var se=D.createElement(it,(0,K.Z)({className:ee()(!V&&N,ft),style:(0,te.Z)((0,te.Z)({},je),ze)},Z,_e,{ref:d}),Be);return Oe&&(se=D.createElement(H.Z,{onResize:function(we){var ke=we.offsetWidth;ve(ke)},disabled:Me},se)),se}var _=D.forwardRef(v);_.displayName="Item";var b=_,T=O(6089),B=O(4676),U=O(16089);function F(p){if(typeof MessageChannel=="undefined")(0,U.Z)(p);else{var d=new MessageChannel;d.port1.onmessage=function(){return p()},d.port2.postMessage(void 0)}}function I(){var p=D.useRef(null),d=function(V){p.current||(p.current=[],F(function(){(0,B.unstable_batchedUpdates)(function(){p.current.forEach(function(oe){oe()}),p.current=null})})),p.current.push(V)};return d}function M(p,d){var N=D.useState(d),V=(0,ue.Z)(N,2),oe=V[0],xe=V[1],Oe=(0,T.Z)(function(Me){p(function(){xe(Me)})});return[oe,Oe]}var j=D.createContext(null),C=["component"],$=["className"],X=["className"],Y=function(d,N){var V=D.useContext(j);if(!V){var oe=d.component,xe=oe===void 0?"div":oe,Oe=(0,J.Z)(d,C);return D.createElement(xe,(0,K.Z)({},Oe,{ref:N}))}var Me=V.className,We=(0,J.Z)(V,$),rt=d.className,ft=(0,J.Z)(d,X);return D.createElement(j.Provider,{value:null},D.createElement(b,(0,K.Z)({ref:N,className:ee()(Me,rt)},We,ft)))},fe=D.forwardRef(Y);fe.displayName="RawItem";var ye=fe,ae=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Q="responsive",R="invalidate";function A(p){return"+ ".concat(p.length," ...")}function L(p,d){var N=p.prefixCls,V=N===void 0?"rc-overflow":N,oe=p.data,xe=oe===void 0?[]:oe,Oe=p.renderItem,Me=p.renderRawItem,We=p.itemKey,rt=p.itemWidth,ft=rt===void 0?10:rt,ze=p.ssr,dt=p.style,Fe=p.className,qe=p.maxCount,Wt=p.renderRest,it=p.renderRawRest,_e=p.suffix,be=p.component,ve=be===void 0?"div":be,Be=p.itemComponent,je=p.onVisibleChange,Z=(0,J.Z)(p,ae),se=ze==="full",de=I(),we=M(de,null),ke=(0,ue.Z)(we,2),Ze=ke[0],ot=ke[1],pt=Ze||0,st=M(de,new Map),Rt=(0,ue.Z)(st,2),Ut=Rt[0],ct=Rt[1],Ct=M(de,0),Ot=(0,ue.Z)(Ct,2),Mt=Ot[0],Xe=Ot[1],xi=M(de,0),bt=(0,ue.Z)(xi,2),Le=bt[0],Ne=bt[1],Ke=M(de,0),Nt=(0,ue.Z)(Ke,2),lt=Nt[0],Et=Nt[1],kt=(0,D.useState)(null),gt=(0,ue.Z)(kt,2),nt=gt[0],xt=gt[1],at=(0,D.useState)(null),St=(0,ue.Z)(at,2),ci=St[0],ai=St[1],Si=D.useMemo(function(){return ci===null&&se?Number.MAX_SAFE_INTEGER:ci||0},[ci,Ze]),$t=(0,D.useState)(!1),Jt=(0,ue.Z)($t,2),Mi=Jt[0],Di=Jt[1],tn="".concat(V,"-item"),Ci=Math.max(Mt,Le),hi=qe===Q,qt=xe.length&&hi,wi=qe===R,Qi=qt||typeof qe=="number"&&xe.length>qe,Vi=(0,D.useMemo)(function(){var mt=xe;return qt?Ze===null&&se?mt=xe:mt=xe.slice(0,Math.min(xe.length,pt/ft)):typeof qe=="number"&&(mt=xe.slice(0,qe)),mt},[xe,ft,Ze,qe,qt]),fn=(0,D.useMemo)(function(){return qt?xe.slice(Si+1):xe.slice(Vi.length)},[xe,Vi,qt,Si]),Ti=(0,D.useCallback)(function(mt,pe){var ne;return typeof We=="function"?We(mt):(ne=We&&(mt==null?void 0:mt[We]))!==null&&ne!==void 0?ne:pe},[We]),Ji=(0,D.useCallback)(Oe||function(mt){return mt},[Oe]);function qi(mt,pe,ne){ci===mt&&(pe===void 0||pe===nt)||(ai(mt),ne||(Di(mt<xe.length-1),je==null||je(mt)),pe!==void 0&&xt(pe))}function Ni(mt,pe){ot(pe.clientWidth)}function nn(mt,pe){ct(function(ne){var Ae=new Map(ne);return pe===null?Ae.delete(mt):Ae.set(mt,pe),Ae})}function Vt(mt,pe){Ne(pe),Xe(Le)}function sn(mt,pe){Et(pe)}function Oi(mt){return Ut.get(Ti(Vi[mt],mt))}(0,l.Z)(function(){if(pt&&typeof Ci=="number"&&Vi){var mt=lt,pe=Vi.length,ne=pe-1;if(!pe){qi(0,null);return}for(var Ae=0;Ae<pe;Ae+=1){var Ce=Oi(Ae);if(se&&(Ce=Ce||0),Ce===void 0){qi(Ae-1,void 0,!0);break}if(mt+=Ce,ne===0&&mt<=pt||Ae===ne-1&&mt+Oi(ne)<=pt){qi(ne,null);break}else if(mt+Ci>pt){qi(Ae-1,mt-Ce-lt+Le);break}}_e&&Oi(0)+lt>pt&&xt(null)}},[pt,Ut,Le,lt,Ti,Vi]);var on=Mi&&!!fn.length,yi={};nt!==null&&qt&&(yi={position:"absolute",left:nt,top:0});var ei={prefixCls:tn,responsive:qt,component:Be,invalidate:wi},kn=Me?function(mt,pe){var ne=Ti(mt,pe);return D.createElement(j.Provider,{key:ne,value:(0,te.Z)((0,te.Z)({},ei),{},{order:pe,item:mt,itemKey:ne,registerSize:nn,display:pe<=Si})},Me(mt,pe))}:function(mt,pe){var ne=Ti(mt,pe);return D.createElement(b,(0,K.Z)({},ei,{order:pe,key:ne,item:mt,renderItem:Ji,itemKey:ne,registerSize:nn,display:pe<=Si}))},gi={order:on?Si:Number.MAX_SAFE_INTEGER,className:"".concat(tn,"-rest"),registerSize:Vt,display:on},Qt=Wt||A,ln=it?D.createElement(j.Provider,{value:(0,te.Z)((0,te.Z)({},ei),gi)},it(fn)):D.createElement(b,(0,K.Z)({},ei,gi),typeof Qt=="function"?Qt(fn):Qt),ii=D.createElement(ve,(0,K.Z)({className:ee()(!wi&&V,Fe),style:dt,ref:d},Z),Vi.map(kn),Qi?ln:null,_e&&D.createElement(b,(0,K.Z)({},ei,{responsive:hi,responsiveDisabled:!qt,order:Si,className:"".concat(tn,"-suffix"),registerSize:sn,display:!0,style:yi}),_e));return hi?D.createElement(H.Z,{onResize:Ni,disabled:!qt},ii):ii}var S=D.forwardRef(L);S.displayName="Overflow",S.Item=ye,S.RESPONSIVE=Q,S.INVALIDATE=R;var G=S,P=G},29301:function(tt,Ie,O){"use strict";O.d(Ie,{Z:function(){return R}});var K=O(72308),te=O(59301),ue=O(11592),J=O(48736),D=O(77321),g=O(62853),ee=O(76846),H=O(8654),l=te.createContext(null);function W(A){var L=A.children,S=A.onBatchResize,G=te.useRef(0),P=te.useRef([]),p=te.useContext(l),d=te.useCallback(function(N,V,oe){G.current+=1;var xe=G.current;P.current.push({size:N,element:V,data:oe}),Promise.resolve().then(function(){xe===G.current&&(S==null||S(P.current),P.current=[])}),p==null||p(N,V,oe)},[S,p]);return te.createElement(l.Provider,{value:d},L)}var x=O(76374),v=new Map;function _(A){A.forEach(function(L){var S,G=L.target;(S=v.get(G))===null||S===void 0||S.forEach(function(P){return P(G)})})}var b=new x.Z(_),T=null,B=null;function U(A,L){v.has(A)||(v.set(A,new Set),b.observe(A)),v.get(A).add(L)}function F(A,L){v.has(A)&&(v.get(A).delete(L),v.get(A).size||(b.unobserve(A),v.delete(A)))}var I=O(96949),M=O(55090),j=O(77205),C=O(38793),$=function(A){(0,j.Z)(S,A);var L=(0,C.Z)(S);function S(){return(0,I.Z)(this,S),L.apply(this,arguments)}return(0,M.Z)(S,[{key:"render",value:function(){return this.props.children}}]),S}(te.Component);function X(A,L){var S=A.children,G=A.disabled,P=te.useRef(null),p=te.useRef(null),d=te.useContext(l),N=typeof S=="function",V=N?S(P):S,oe=te.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),xe=!N&&te.isValidElement(V)&&(0,H.Yr)(V),Oe=xe?(0,H.C4)(V):null,Me=(0,H.x1)(Oe,P),We=function(){var dt;return(0,ee.ZP)(P.current)||(P.current&&(0,g.Z)(P.current)==="object"?(0,ee.ZP)((dt=P.current)===null||dt===void 0?void 0:dt.nativeElement):null)||(0,ee.ZP)(p.current)};te.useImperativeHandle(L,function(){return We()});var rt=te.useRef(A);rt.current=A;var ft=te.useCallback(function(ze){var dt=rt.current,Fe=dt.onResize,qe=dt.data,Wt=ze.getBoundingClientRect(),it=Wt.width,_e=Wt.height,be=ze.offsetWidth,ve=ze.offsetHeight,Be=Math.floor(it),je=Math.floor(_e);if(oe.current.width!==Be||oe.current.height!==je||oe.current.offsetWidth!==be||oe.current.offsetHeight!==ve){var Z={width:Be,height:je,offsetWidth:be,offsetHeight:ve};oe.current=Z;var se=be===Math.round(it)?it:be,de=ve===Math.round(_e)?_e:ve,we=(0,D.Z)((0,D.Z)({},Z),{},{offsetWidth:se,offsetHeight:de});d==null||d(we,ze,qe),Fe&&Promise.resolve().then(function(){Fe(we,ze)})}},[]);return te.useEffect(function(){var ze=We();return ze&&!G&&U(ze,ft),function(){return F(ze,ft)}},[P.current,G]),te.createElement($,{ref:p},xe?te.cloneElement(V,{ref:Me}):V)}var Y=te.forwardRef(X),fe=Y,ye="rc-observer-key";function ae(A,L){var S=A.children,G=typeof S=="function"?[S]:(0,ue.Z)(S);return G.map(function(P,p){var d=(P==null?void 0:P.key)||"".concat(ye,"-").concat(p);return te.createElement(fe,(0,K.Z)({},A,{key:d,ref:p===0?L:void 0}),P)})}var Q=te.forwardRef(ae);Q.Collection=W;var R=Q},55477:function(tt,Ie,O){"use strict";O.d(Ie,{G:function(){return _},Z:function(){return U}});var K=O(72308),te=O(77321),ue=O(74416),J=O(35593),D=O(59301),g={shiftX:64,adjustY:1},ee={adjustX:1,shiftY:!0},H=[0,0],l={left:{points:["cr","cl"],overflow:ee,offset:[-4,0],targetOffset:H},right:{points:["cl","cr"],overflow:ee,offset:[4,0],targetOffset:H},top:{points:["bc","tc"],overflow:g,offset:[0,-4],targetOffset:H},bottom:{points:["tc","bc"],overflow:g,offset:[0,4],targetOffset:H},topLeft:{points:["bl","tl"],overflow:g,offset:[0,-4],targetOffset:H},leftTop:{points:["tr","tl"],overflow:ee,offset:[-4,0],targetOffset:H},topRight:{points:["br","tr"],overflow:g,offset:[0,-4],targetOffset:H},rightTop:{points:["tl","tr"],overflow:ee,offset:[4,0],targetOffset:H},bottomRight:{points:["tr","br"],overflow:g,offset:[0,4],targetOffset:H},rightBottom:{points:["bl","br"],overflow:ee,offset:[4,0],targetOffset:H},bottomLeft:{points:["tl","bl"],overflow:g,offset:[0,4],targetOffset:H},leftBottom:{points:["br","bl"],overflow:ee,offset:[-4,0],targetOffset:H}},W=null,x=O(92310),v=O.n(x);function _(F){var I=F.children,M=F.prefixCls,j=F.id,C=F.overlayInnerStyle,$=F.className,X=F.style;return D.createElement("div",{className:v()("".concat(M,"-content"),$),style:X},D.createElement("div",{className:"".concat(M,"-inner"),id:j,role:"tooltip",style:C},typeof I=="function"?I():I))}var b=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow"],T=function(I,M){var j=I.overlayClassName,C=I.trigger,$=C===void 0?["hover"]:C,X=I.mouseEnterDelay,Y=X===void 0?0:X,fe=I.mouseLeaveDelay,ye=fe===void 0?.1:fe,ae=I.overlayStyle,Q=I.prefixCls,R=Q===void 0?"rc-tooltip":Q,A=I.children,L=I.onVisibleChange,S=I.afterVisibleChange,G=I.transitionName,P=I.animation,p=I.motion,d=I.placement,N=d===void 0?"right":d,V=I.align,oe=V===void 0?{}:V,xe=I.destroyTooltipOnHide,Oe=xe===void 0?!1:xe,Me=I.defaultVisible,We=I.getTooltipContainer,rt=I.overlayInnerStyle,ft=I.arrowContent,ze=I.overlay,dt=I.id,Fe=I.showArrow,qe=Fe===void 0?!0:Fe,Wt=(0,ue.Z)(I,b),it=(0,D.useRef)(null);(0,D.useImperativeHandle)(M,function(){return it.current});var _e=(0,te.Z)({},Wt);"visible"in I&&(_e.popupVisible=I.visible);var be=function(){return D.createElement(_,{key:"content",prefixCls:R,id:dt,overlayInnerStyle:rt},ze)};return D.createElement(J.Z,(0,K.Z)({popupClassName:j,prefixCls:R,popup:be,action:$,builtinPlacements:l,popupPlacement:N,ref:it,popupAlign:oe,getPopupContainer:We,onPopupVisibleChange:L,afterPopupVisibleChange:S,popupTransitionName:G,popupAnimation:P,popupMotion:p,defaultPopupVisible:Me,autoDestroy:Oe,mouseLeaveDelay:ye,popupStyle:ae,mouseEnterDelay:Y,arrow:qe},_e),A)},B=(0,D.forwardRef)(T),U=B},49658:function(tt,Ie){"use strict";Ie.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var O=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(O)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(O==null?void 0:O.substr(0,4))}},83145:function(tt,Ie,O){"use strict";Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.CopyToClipboard=void 0;var K=ue(O(59301)),te=ue(O(25769));function ue(I){return I&&I.__esModule?I:{default:I}}function J(I){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?J=function(j){return typeof j}:J=function(j){return j&&typeof Symbol=="function"&&j.constructor===Symbol&&j!==Symbol.prototype?"symbol":typeof j},J(I)}function D(I,M){var j=Object.keys(I);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(I);M&&(C=C.filter(function($){return Object.getOwnPropertyDescriptor(I,$).enumerable})),j.push.apply(j,C)}return j}function g(I){for(var M=1;M<arguments.length;M++){var j=arguments[M]!=null?arguments[M]:{};M%2?D(j,!0).forEach(function(C){U(I,C,j[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(j)):D(j).forEach(function(C){Object.defineProperty(I,C,Object.getOwnPropertyDescriptor(j,C))})}return I}function ee(I,M){if(I==null)return{};var j=H(I,M),C,$;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(I);for($=0;$<X.length;$++)C=X[$],!(M.indexOf(C)>=0)&&Object.prototype.propertyIsEnumerable.call(I,C)&&(j[C]=I[C])}return j}function H(I,M){if(I==null)return{};var j={},C=Object.keys(I),$,X;for(X=0;X<C.length;X++)$=C[X],!(M.indexOf($)>=0)&&(j[$]=I[$]);return j}function l(I,M){if(!(I instanceof M))throw new TypeError("Cannot call a class as a function")}function W(I,M){for(var j=0;j<M.length;j++){var C=M[j];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(I,C.key,C)}}function x(I,M,j){return M&&W(I.prototype,M),j&&W(I,j),I}function v(I,M){return M&&(J(M)==="object"||typeof M=="function")?M:b(I)}function _(I){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(j){return j.__proto__||Object.getPrototypeOf(j)},_(I)}function b(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}function T(I,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(M&&M.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),M&&B(I,M)}function B(I,M){return B=Object.setPrototypeOf||function(C,$){return C.__proto__=$,C},B(I,M)}function U(I,M,j){return M in I?Object.defineProperty(I,M,{value:j,enumerable:!0,configurable:!0,writable:!0}):I[M]=j,I}var F=function(I){T(M,I);function M(){var j,C;l(this,M);for(var $=arguments.length,X=new Array($),Y=0;Y<$;Y++)X[Y]=arguments[Y];return C=v(this,(j=_(M)).call.apply(j,[this].concat(X))),U(b(C),"onClick",function(fe){var ye=C.props,ae=ye.text,Q=ye.onCopy,R=ye.children,A=ye.options,L=K.default.Children.only(R),S=(0,te.default)(ae,A);Q&&Q(ae,S),L&&L.props&&typeof L.props.onClick=="function"&&L.props.onClick(fe)}),C}return x(M,[{key:"render",value:function(){var C=this.props,$=C.text,X=C.onCopy,Y=C.options,fe=C.children,ye=ee(C,["text","onCopy","options","children"]),ae=K.default.Children.only(fe);return K.default.cloneElement(ae,g({},ye,{onClick:this.onClick}))}}]),M}(K.default.PureComponent);Ie.CopyToClipboard=F,U(F,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(tt,Ie,O){"use strict";var K=O(83145),te=K.CopyToClipboard;te.CopyToClipboard=te,tt.exports=te},76374:function(tt,Ie,O){"use strict";var K=function(){if(typeof Map!="undefined")return Map;function R(A,L){var S=-1;return A.some(function(G,P){return G[0]===L?(S=P,!0):!1}),S}return function(){function A(){this.__entries__=[]}return Object.defineProperty(A.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),A.prototype.get=function(L){var S=R(this.__entries__,L),G=this.__entries__[S];return G&&G[1]},A.prototype.set=function(L,S){var G=R(this.__entries__,L);~G?this.__entries__[G][1]=S:this.__entries__.push([L,S])},A.prototype.delete=function(L){var S=this.__entries__,G=R(S,L);~G&&S.splice(G,1)},A.prototype.has=function(L){return!!~R(this.__entries__,L)},A.prototype.clear=function(){this.__entries__.splice(0)},A.prototype.forEach=function(L,S){S===void 0&&(S=null);for(var G=0,P=this.__entries__;G<P.length;G++){var p=P[G];L.call(S,p[1],p[0])}},A}()}(),te=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,ue=function(){return typeof O.g!="undefined"&&O.g.Math===Math?O.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),J=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(ue):function(R){return setTimeout(function(){return R(Date.now())},1e3/60)}}(),D=2;function g(R,A){var L=!1,S=!1,G=0;function P(){L&&(L=!1,R()),S&&d()}function p(){J(P)}function d(){var N=Date.now();if(L){if(N-G<D)return;S=!0}else L=!0,S=!1,setTimeout(p,A);G=N}return d}var ee=20,H=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",W=function(){function R(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=g(this.refresh.bind(this),ee)}return R.prototype.addObserver=function(A){~this.observers_.indexOf(A)||this.observers_.push(A),this.connected_||this.connect_()},R.prototype.removeObserver=function(A){var L=this.observers_,S=L.indexOf(A);~S&&L.splice(S,1),!L.length&&this.connected_&&this.disconnect_()},R.prototype.refresh=function(){var A=this.updateObservers_();A&&this.refresh()},R.prototype.updateObservers_=function(){var A=this.observers_.filter(function(L){return L.gatherActive(),L.hasActive()});return A.forEach(function(L){return L.broadcastActive()}),A.length>0},R.prototype.connect_=function(){!te||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},R.prototype.disconnect_=function(){!te||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},R.prototype.onTransitionEnd_=function(A){var L=A.propertyName,S=L===void 0?"":L,G=H.some(function(P){return!!~S.indexOf(P)});G&&this.refresh()},R.getInstance=function(){return this.instance_||(this.instance_=new R),this.instance_},R.instance_=null,R}(),x=function(R,A){for(var L=0,S=Object.keys(A);L<S.length;L++){var G=S[L];Object.defineProperty(R,G,{value:A[G],enumerable:!1,writable:!1,configurable:!0})}return R},v=function(R){var A=R&&R.ownerDocument&&R.ownerDocument.defaultView;return A||ue},_=$(0,0,0,0);function b(R){return parseFloat(R)||0}function T(R){for(var A=[],L=1;L<arguments.length;L++)A[L-1]=arguments[L];return A.reduce(function(S,G){var P=R["border-"+G+"-width"];return S+b(P)},0)}function B(R){for(var A=["top","right","bottom","left"],L={},S=0,G=A;S<G.length;S++){var P=G[S],p=R["padding-"+P];L[P]=b(p)}return L}function U(R){var A=R.getBBox();return $(0,0,A.width,A.height)}function F(R){var A=R.clientWidth,L=R.clientHeight;if(!A&&!L)return _;var S=v(R).getComputedStyle(R),G=B(S),P=G.left+G.right,p=G.top+G.bottom,d=b(S.width),N=b(S.height);if(S.boxSizing==="border-box"&&(Math.round(d+P)!==A&&(d-=T(S,"left","right")+P),Math.round(N+p)!==L&&(N-=T(S,"top","bottom")+p)),!M(R)){var V=Math.round(d+P)-A,oe=Math.round(N+p)-L;Math.abs(V)!==1&&(d-=V),Math.abs(oe)!==1&&(N-=oe)}return $(G.left,G.top,d,N)}var I=function(){return typeof SVGGraphicsElement!="undefined"?function(R){return R instanceof v(R).SVGGraphicsElement}:function(R){return R instanceof v(R).SVGElement&&typeof R.getBBox=="function"}}();function M(R){return R===v(R).document.documentElement}function j(R){return te?I(R)?U(R):F(R):_}function C(R){var A=R.x,L=R.y,S=R.width,G=R.height,P=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,p=Object.create(P.prototype);return x(p,{x:A,y:L,width:S,height:G,top:L,right:A+S,bottom:G+L,left:A}),p}function $(R,A,L,S){return{x:R,y:A,width:L,height:S}}var X=function(){function R(A){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=$(0,0,0,0),this.target=A}return R.prototype.isActive=function(){var A=j(this.target);return this.contentRect_=A,A.width!==this.broadcastWidth||A.height!==this.broadcastHeight},R.prototype.broadcastRect=function(){var A=this.contentRect_;return this.broadcastWidth=A.width,this.broadcastHeight=A.height,A},R}(),Y=function(){function R(A,L){var S=C(L);x(this,{target:A,contentRect:S})}return R}(),fe=function(){function R(A,L,S){if(this.activeObservations_=[],this.observations_=new K,typeof A!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=A,this.controller_=L,this.callbackCtx_=S}return R.prototype.observe=function(A){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(A instanceof v(A).Element))throw new TypeError('parameter 1 is not of type "Element".');var L=this.observations_;L.has(A)||(L.set(A,new X(A)),this.controller_.addObserver(this),this.controller_.refresh())}},R.prototype.unobserve=function(A){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(A instanceof v(A).Element))throw new TypeError('parameter 1 is not of type "Element".');var L=this.observations_;L.has(A)&&(L.delete(A),L.size||this.controller_.removeObserver(this))}},R.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},R.prototype.gatherActive=function(){var A=this;this.clearActive(),this.observations_.forEach(function(L){L.isActive()&&A.activeObservations_.push(L)})},R.prototype.broadcastActive=function(){if(this.hasActive()){var A=this.callbackCtx_,L=this.activeObservations_.map(function(S){return new Y(S.target,S.broadcastRect())});this.callback_.call(A,L,A),this.clearActive()}},R.prototype.clearActive=function(){this.activeObservations_.splice(0)},R.prototype.hasActive=function(){return this.activeObservations_.length>0},R}(),ye=typeof WeakMap!="undefined"?new WeakMap:new K,ae=function(){function R(A){if(!(this instanceof R))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var L=W.getInstance(),S=new fe(A,L,this);ye.set(this,S)}return R}();["observe","unobserve","disconnect"].forEach(function(R){ae.prototype[R]=function(){var A;return(A=ye.get(this))[R].apply(A,arguments)}});var Q=function(){return typeof ue.ResizeObserver!="undefined"?ue.ResizeObserver:ae}();Ie.Z=Q},98040:function(tt){tt.exports=function(){var Ie=document.getSelection();if(!Ie.rangeCount)return function(){};for(var O=document.activeElement,K=[],te=0;te<Ie.rangeCount;te++)K.push(Ie.getRangeAt(te));switch(O.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":O.blur();break;default:O=null;break}return Ie.removeAllRanges(),function(){Ie.type==="Caret"&&Ie.removeAllRanges(),Ie.rangeCount||K.forEach(function(ue){Ie.addRange(ue)}),O&&O.focus()}}},65157:function(tt,Ie,O){"use strict";O.d(Ie,{ZP:function(){return _s}});const K=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},te=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=ue},ue=Number.MAX_SAFE_INTEGER||9007199254740991;let J=function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a}({}),D=function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a}({}),g=function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a}({});var ee={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},H={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class l{constructor(e,t=0,i=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_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*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 W{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new l(e),this.fast_=new l(t),this.defaultTTFB_=n,this.ttfb_=new l(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new l(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new l(t,n.getEstimate(),n.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new l(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,n=e/1e3,s=i/n;this.fast_.sample(n,s),this.slow_.sample(n,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,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 x(a,e,t){return(e=B(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function v(){return v=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(a[i]=t[i])}return a},v.apply(null,arguments)}function _(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,i)}return t}function b(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_(Object(t),!0).forEach(function(i){x(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):_(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function T(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var i=t.call(a,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function B(a){var e=T(a,"string");return typeof e=="symbol"?e:e+""}class U{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 i=`[${e}]:`;this.trace=F,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const F=function(){},I={trace:F,debug:F,log:F,warn:F,info:F,error:F};function M(){return v({},I)}function j(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):F}function C(a,e,t){return e[a]?e[a].bind(e):j(a,t)}const $=M();function X(a,e,t){const i=M();if(typeof console=="object"&&a===!0||typeof a=="object"){const n=["debug","log","info","warn","error"];n.forEach(s=>{i[s]=C(s,a,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.0`)}catch(s){return M()}n.forEach(s=>{$[s]=C(s,a)})}else v($,i);return i}const Y=$;function fe(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function ye(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function ae(a,e){const t=Object.keys(a),i=Object.keys(e),n=t.length,s=i.length;return!n||!s||n===s&&!t.some(r=>i.indexOf(r)===-1)}function Q(a,e=!1){if(typeof TextDecoder!="undefined"){const u=new TextDecoder("utf-8").decode(a);if(e){const h=u.indexOf("\0");return h!==-1?u.substring(0,h):u}return u.replace(/\0/g,"")}const t=a.length;let i,n,s,r="",o=0;for(;o<t;){if(i=a[o++],i===0&&e)return r;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(i);break;case 12:case 13:n=a[o++],r+=String.fromCharCode((i&31)<<6|n&63);break;case 14:n=a[o++],s=a[o++],r+=String.fromCharCode((i&15)<<12|(n&63)<<6|(s&63)<<0);break}}return r}const R={hexDump:function(a){let e="";for(let t=0;t<a.length;t++){let i=a[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}};function A(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var L={exports:{}},S;function G(){return S||(S=1,function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,u,h){if(h=h||{},c=c.trim(),u=u.trim(),!u){if(!h.alwaysNormalize)return c;var f=o.parseURL(c);if(!f)throw new Error("Error trying to parse base URL.");return f.path=o.normalizePath(f.path),o.buildURLFromParts(f)}var m=o.parseURL(u);if(!m)throw new Error("Error trying to parse relative URL.");if(m.scheme)return h.alwaysNormalize?(m.path=o.normalizePath(m.path),o.buildURLFromParts(m)):u;var E=o.parseURL(c);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var y=n.exec(E.path);E.netLoc=y[1],E.path=y[2]}E.netLoc&&!E.path&&(E.path="/");var w={scheme:E.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(w.netLoc=E.netLoc,m.path[0]!=="/"))if(!m.path)w.path=E.path,m.params||(w.params=E.params,m.query||(w.query=E.query));else{var k=E.path,z=k.substring(0,k.lastIndexOf("/")+1)+m.path;w.path=o.normalizePath(z)}return w.path===null&&(w.path=h.alwaysNormalize?o.normalizePath(m.path):m.path),o.buildURLFromParts(w)},parseURL:function(c){var u=i.exec(c);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(s,"");c.length!==(c=c.replace(r,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};a.exports=o})()}(L)),L.exports}var P=G();class p{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 d={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class N{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,Me(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let n;i.length===1?n=(t==null?void 0:t.byteRangeEndOffset)||0:n=parseInt(i[1]),this._byteRange=[n,parseInt(i[0])+n]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[d.AUDIO]:null,[d.VIDEO]:null,[d.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new p),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=P.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[d.AUDIO]=null,e[d.VIDEO]=null,e[d.AUDIOVIDEO]=null}}function V(a){return a.sn!=="initSegment"}class oe extends N{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange){const e=this.byteRange[0],t=this.byteRange[1];if(K(e)&&K(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=K(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!K(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return V(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,n,s,r=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:s,partial:r};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,i),c.startDTS=Math.min(c.startDTS,n),c.endDTS=Math.max(c.endDTS,s)}}class xe extends N{constructor(e,t,i,n,s){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const r=e.enumeratedString("BYTERANGE");r&&this.setByteRange(r,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Oe(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||Oe(t,e)}}function Me(a,e){const t=Oe(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const We=Math.pow(2,32)-1,rt=[].push,ft={video:1,audio:2,id3:3,text:4};function ze(a){return String.fromCharCode.apply(null,a)}function dt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function Fe(a,e){const t=Wt(a,e);return t<0?4294967296+t:t}function qe(a,e){let t=Fe(a,e);return t*=Math.pow(2,32),t+=Fe(a,e+4),t}function Wt(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function it(a,e,t){a[e]=t>>24,a[e+1]=t>>16&255,a[e+2]=t>>8&255,a[e+3]=t&255}function _e(a){const e=a.byteLength;for(let t=0;t<e;){const i=Fe(a,t);if(i>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=i>1?t+i:e}return!1}function be(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=Fe(a,n),r=ze(a.subarray(n+4,n+8)),o=s>1?n+s:i;if(r===e[0])if(e.length===1)t.push(a.subarray(n+8,o));else{const c=be(a.subarray(n+8,o),e.slice(1));c.length&&rt.apply(t,c)}n=o}return t}function ve(a){const e=[],t=a[0];let i=8;const n=Fe(a,i);i+=4;let s=0,r=0;t===0?(s=Fe(a,i),r=Fe(a,i+4),i+=8):(s=qe(a,i),r=qe(a,i+8),i+=16),i+=2;let o=a.length+r;const c=dt(a,i);i+=2;for(let u=0;u<c;u++){let h=i;const f=Fe(a,h);h+=4;const m=f&2147483647;if((f&2147483648)>>>31===1)return Y.warn("SIDX has hierarchical references (not supported)"),null;const y=Fe(a,h);h+=4,e.push({referenceSize:m,subsegmentDuration:y,info:{duration:y/n,start:o,end:o+m-1}}),o+=m,h+=4,i=h}return{earliestPresentationTime:s,timescale:n,version:t,referencesCount:c,references:e}}function Be(a){const e=[],t=be(a,["moov","trak"]);for(let n=0;n<t.length;n++){const s=t[n],r=be(s,["tkhd"])[0];if(r){let o=r[0];const c=Fe(r,o===0?12:20),u=be(s,["mdia","mdhd"])[0];if(u){o=u[0];const h=Fe(u,o===0?12:20),f=be(s,["mdia","hdlr"])[0];if(f){const m=ze(f.subarray(8,12)),E={soun:d.AUDIO,vide:d.VIDEO}[m],y=be(s,["mdia","minf","stbl","stsd"])[0],w=je(y);E?(e[c]={timescale:h,type:E,stsd:w},e[E]=b({timescale:h,id:c},w)):e[c]={timescale:h,type:m,stsd:w}}}}}return be(a,["moov","mvex","trex"]).forEach(n=>{const s=Fe(n,4),r=e[s];r&&(r.default={duration:Fe(n,12),flags:Fe(n,20)})}),e}function je(a){const e=a.subarray(8),t=e.subarray(86),i=ze(e.subarray(4,8));let n=i,s;const r=i==="enca"||i==="encv";if(r){const u=be(e,[i])[0].subarray(i==="enca"?28:78);be(u,["sinf"]).forEach(f=>{const m=be(f,["schm"])[0];if(m){const E=ze(m.subarray(4,8));if(E==="cbcs"||E==="cenc"){const y=be(f,["frma"])[0];y&&(n=ze(y))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=be(t,["avcC"])[0];n+="."+de(c[1])+de(c[2])+de(c[3]),s=Z(o==="avc1"?"dva1":"dvav",t);break}case"mp4a":{const c=be(e,[i])[0],u=be(c.subarray(28),["esds"])[0];if(u&&u.length>7){let h=4;if(u[h++]!==3)break;h=se(u,h),h+=2;const f=u[h++];if(f&128&&(h+=2),f&64&&(h+=u[h++]),u[h++]!==4)break;h=se(u,h);const m=u[h++];if(m===64)n+="."+de(m);else break;if(h+=12,u[h++]!==5)break;h=se(u,h);const E=u[h++];let y=(E&248)>>3;y===31&&(y+=1+((E&7)<<3)+((u[h]&224)>>5)),n+="."+y}break}case"hvc1":case"hev1":{const c=be(t,["hvcC"]);if(c){const u=c[0],h=u[1],f=["","A","B","C"][h>>6],m=h&31,E=Fe(u,2),y=(h&32)>>5?"H":"L",w=u[12],k=u.subarray(6,12);n+="."+f+m,n+="."+E.toString(16).toUpperCase(),n+="."+y+w;let z="";for(let ie=k.length;ie--;){const q=k[ie];(q||z)&&(z="."+q.toString(16).toUpperCase()+z)}n+=z}s=Z(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=Z(n,t)||n;break}case"vp09":{const c=be(t,["vpcC"])[0],u=c[4],h=c[5],f=c[6]>>4&15;n+="."+we(u)+"."+we(h)+"."+we(f);break}case"av01":{const c=be(t,["av1C"])[0],u=c[1]>>>5,h=c[1]&31,f=c[2]>>>7?"H":"M",m=(c[2]&64)>>6,E=(c[2]&32)>>5,y=u===2&&m?E?12:10:m?10:8,w=(c[2]&16)>>4,k=(c[2]&8)>>3,z=(c[2]&4)>>2,ie=c[2]&3;n+="."+u+"."+we(h)+f+"."+we(y)+"."+w+"."+k+z+ie+"."+we(1)+"."+we(1)+"."+we(1)+"."+0,s=Z("dav1",t);break}}return{codec:n,encrypted:r,supplemental:s}}function Z(a,e){const t=be(e,["dvvC"]),i=t.length?t[0]:be(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return a+"."+we(n)+"."+we(s)}}function se(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function de(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function we(a){return(a<10?"0":"")+a}function ke(a,e){if(!a||!e)return a;const t=e.keyId;return t&&e.isCommonEncryption&&be(a,["moov","trak"]).forEach(n=>{const r=be(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=be(r,["enca"]);const c=o.length>0;c||(o=be(r,["encv"])),o.forEach(u=>{const h=c?u.subarray(28):u.subarray(78);be(h,["sinf"]).forEach(m=>{const E=Ze(m);if(E){const y=E.subarray(8,24);y.some(w=>w!==0)||(Y.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${R.hexDump(y)} -> ${R.hexDump(t)}`),E.set(t,8))}})})}),a}function Ze(a){const e=be(a,["schm"])[0];if(e){const t=ze(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return be(a,["schi","tenc"])[0]}return null}function ot(a,e){return be(e,["moof","traf"]).reduce((t,i)=>{const n=be(i,["tfdt"])[0],s=n[0],r=be(i,["tfhd"]).reduce((o,c)=>{const u=Fe(c,4),h=a[u];if(h){let f=Fe(n,4);if(s===1){if(f===We)return Y.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;f*=We+1,f+=Fe(n,8)}const m=h.timescale||9e4,E=f/m;if(K(E)&&(o===null||E<o))return E}return o},null);return r!==null&&K(r)&&(t===null||r<t)?r:t},null)}function pt(a,e){let t=0,i=0,n=0;const s=be(a,["moof","traf"]);for(let r=0;r<s.length;r++){const o=s[r],c=be(o,["tfhd"])[0],u=Fe(c,4),h=e[u];if(!h)continue;const f=h.default,m=Fe(c,0)|(f==null?void 0:f.flags);let E=f==null?void 0:f.duration;m&8&&(m&2?E=Fe(c,12):E=Fe(c,8));const y=h.timescale||9e4,w=be(o,["trun"]);for(let k=0;k<w.length;k++){if(t=st(w[k]),!t&&E){const z=Fe(w[k],4);t=E*z}h.type===d.VIDEO?i+=t/y:h.type===d.AUDIO&&(n+=t/y)}}if(i===0&&n===0){let r=1/0,o=0,c=0;const u=be(a,["sidx"]);for(let h=0;h<u.length;h++){const f=ve(u[h]);if(f!=null&&f.references){r=Math.min(r,f.earliestPresentationTime/f.timescale);const m=f.references.reduce((E,y)=>E+y.info.duration||0,0);o=Math.max(o,m+f.earliestPresentationTime/f.timescale),c=o-r}}if(c&&K(c))return c}return i||n}function st(a){const e=Fe(a,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const n=Fe(a,4);for(let s=0;s<n;s++){if(e&256){const r=Fe(a,t);i+=r,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function Rt(a,e,t){be(e,["moof","traf"]).forEach(i=>{be(i,["tfhd"]).forEach(n=>{const s=Fe(n,4),r=a[s];if(!r)return;const o=r.timescale||9e4;be(i,["tfdt"]).forEach(c=>{const u=c[0],h=t*o;if(h){let f=Fe(c,4);if(u===0)f-=h,f=Math.max(f,0),it(c,4,f);else{f*=Math.pow(2,32),f+=Fe(c,8),f-=h,f=Math.max(f,0);const m=Math.floor(f/(We+1)),E=Math.floor(f%(We+1));it(c,4,m),it(c,8,E)}}})})})}function Ut(a){const e={valid:null,remainder:null},t=be(a,["moof"]);if(t.length<2)return e.remainder=a,e;const i=t[t.length-1];return e.valid=a.slice(0,i.byteOffset-8),e.remainder=a.slice(i.byteOffset-8),e}function ct(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Ct(a,e){const t=[],i=e.samples,n=e.timescale,s=e.id;let r=!1;return be(i,["moof"]).map(c=>{const u=c.byteOffset-8;be(c,["traf"]).map(f=>{const m=be(f,["tfdt"]).map(E=>{const y=E[0];let w=Fe(E,4);return y===1&&(w*=Math.pow(2,32),w+=Fe(E,8)),w/n})[0];return m!==void 0&&(a=m),be(f,["tfhd"]).map(E=>{const y=Fe(E,4),w=Fe(E,0)&16777215,k=(w&1)!==0,z=(w&2)!==0,ie=(w&8)!==0;let q=0;const le=(w&16)!==0;let ce=0;const Se=(w&32)!==0;let he=8;y===s&&(k&&(he+=8),z&&(he+=4),ie&&(q=Fe(E,he),he+=4),le&&(ce=Fe(E,he),he+=4),Se&&(he+=4),e.type==="video"&&(r=Ot(e.codec)),be(f,["trun"]).map(Ee=>{const Re=Ee[0],ge=Fe(Ee,0)&16777215,$e=(ge&1)!==0;let Ve=0;const Xt=(ge&4)!==0,Lt=(ge&256)!==0;let vt=0;const et=(ge&512)!==0;let yt=0;const ht=(ge&1024)!==0,Ge=(ge&2048)!==0;let He=0;const Pt=Fe(Ee,4);let Dt=8;$e&&(Ve=Fe(Ee,Dt),Dt+=4),Xt&&(Dt+=4);let zt=Ve+u;for(let fi=0;fi<Pt;fi++){if(Lt?(vt=Fe(Ee,Dt),Dt+=4):vt=q,et?(yt=Fe(Ee,Dt),Dt+=4):yt=ce,ht&&(Dt+=4),Ge&&(Re===0?He=Fe(Ee,Dt):He=Wt(Ee,Dt),Dt+=4),e.type===d.VIDEO){let bi=0;for(;bi<yt;){const Li=Fe(i,zt);if(zt+=4,Mt(r,i[zt])){const An=i.subarray(zt,zt+Li);Xe(An,r?2:1,a+He/n,t)}zt+=Li,bi+=Li+4}}a+=vt/n}}))})})}),t}function Ot(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Mt(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Xe(a,e,t,i){const n=xi(a);let s=0;s+=e;let r=0,o=0,c=0;for(;s<n.length;){r=0;do{if(s>=n.length)break;c=n[s++],r+=c}while(c===255);o=0;do{if(s>=n.length)break;c=n[s++],o+=c}while(c===255);const u=n.length-s;let h=s;if(o<u)s+=o;else if(o>u){Y.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[h++]===181){const m=dt(n,h);if(h+=2,m===49){const E=Fe(n,h);if(h+=4,E===1195456820){const y=n[h++];if(y===3){const w=n[h++],k=31&w,z=64&w,ie=z?2+k*3:0,q=new Uint8Array(ie);if(z){q[0]=w;for(let le=1;le<ie;le++)q[le]=n[h++]}i.push({type:y,payloadType:r,pts:t,bytes:q})}}}}}else if(r===5&&o>16){const f=[];for(let y=0;y<16;y++){const w=n[h++].toString(16);f.push(w.length==1?"0"+w:w),(y===3||y===5||y===7||y===9)&&f.push("-")}const m=o-16,E=new Uint8Array(m);for(let y=0;y<m;y++)E[y]=n[h++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:Q(E),userDataBytes:E})}}}function xi(a){const e=a.byteLength,t=[];let i=1;for(;i<e-2;)a[i]===0&&a[i+1]===0&&a[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return a;const n=e-t.length,s=new Uint8Array(n);let r=0;for(i=0;i<n;r++,i++)r===t[0]&&(r++,t.shift()),s[i]=a[r];return s}function bt(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;ze(a.subarray(u,u+1))!=="\0";)t+=ze(a.subarray(u,u+1)),u+=1;for(t+=ze(a.subarray(u,u+1)),u+=1;ze(a.subarray(u,u+1))!=="\0";)i+=ze(a.subarray(u,u+1)),u+=1;i+=ze(a.subarray(u,u+1)),u+=1,n=Fe(a,12),s=Fe(a,16),o=Fe(a,20),c=Fe(a,24),u=28}else if(e===1){u+=4,n=Fe(a,u),u+=4;const f=Fe(a,u);u+=4;const m=Fe(a,u);for(u+=4,r=zo(2,32)*f+m,te(r)||(r=Number.MAX_SAFE_INTEGER,Y.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Fe(a,u),u+=4,c=Fe(a,u),u+=4;ze(a.subarray(u,u+1))!=="\0";)t+=ze(a.subarray(u,u+1)),u+=1;for(t+=ze(a.subarray(u,u+1)),u+=1;ze(a.subarray(u,u+1))!=="\0";)i+=ze(a.subarray(u,u+1)),u+=1;i+=ze(a.subarray(u,u+1)),u+=1}const h=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:i,timeScale:n,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:c,payload:h}}function Le(a,...e){const t=e.length;let i=8,n=t;for(;n--;)i+=e[n].byteLength;const s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=i&255,s.set(a,4),n=0,i=8;n<t;n++)s.set(e[n],i),i+=e[n].byteLength;return s}function Ne(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let i,n;i=0,n=new Uint8Array;let s;i>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const r=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(r.buffer).setUint32(0,t.byteLength,!1),Le([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t||new Uint8Array)}function Ke(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let i=0;for(;i+32<t;){const n=new DataView(a,i),s=Nt(n);e.push(s),i+=s.size}}return e}function Nt(a){const e=a.getUint32(0),t=a.byteOffset,i=a.byteLength;if(i<e)return{offset:t,size:i};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const s=a.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const r=a.buffer,o=R.hexDump(new Uint8Array(r,t+12,16)),c=a.getUint32(28);let u=null,h=null;if(s===0){if(e-32<c||c<22)return{offset:t,size:e};h=new Uint8Array(r,t+32,c)}else if(s===1){if(!c||i<t+32+c*16+16)return{offset:t,size:e};u=[];for(let f=0;f<c;f++)u.push(new Uint8Array(r,t+32+f*16,16))}return{version:s,systemId:o,kids:u,data:h,offset:t,size:e}}const lt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Et={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 kt(a,e){const t=Et[e];return!!t&&!!t[a.slice(0,4)]}function gt(a,e,t=!0){return!a.split(",").some(i=>!nt(i,e,t))}function nt(a,e,t=!0){var i;const n=fe(t);return(i=n==null?void 0:n.isTypeSupported(xt(a,e)))!=null?i:!1}function xt(a,e){return`${e}/mp4;codecs=${a}`}function at(a){if(a){const e=a.substring(0,4);return Et.video[e]}return 2}function St(a){const e=lt();return a.split(",").reduce((t,i)=>{const s=e&&Ot(i)?9:Et.video[i];return s?(s*2+t)/(t?3:2):(Et.audio[i]+t)/(t?2:1)},0)}const ci={};function ai(a,e=!0){if(ci[a])return ci[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let n=0;n<t.length;n++){var i;if(nt(t[n],"audio",e))return ci[a]=t[n],t[n];if(t[n]==="mp3"&&(i=fe(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const Si=/flac|opus|mp4a\.40\.34/i;function $t(a,e=!0){return a.replace(Si,t=>ai(t.toLowerCase(),e))}function Jt(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)kt(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function Mi(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let i=t.length;i--;)if(t[i].substring(0,4)===a.substring(0,4))return t[i]}return t[0]}}return e||a}function Di(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");if(i.length>2){let n=i.shift()+".";n+=parseInt(i.shift()).toString(16),n+=("000"+parseInt(i.shift()).toString(16)).slice(-4),e[t]=n}}return e.join(",")}function tn(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return a}function Ci(a){const e=fe(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function hi(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const qt={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function wi(a,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:a}}const Qi={};function Vi(a,e,t,i,n,s){const r=a.audioCodec?a.audioGroups:null,o=s==null?void 0:s.audioCodec,c=s==null?void 0:s.channels,u=c?parseInt(c):o?1/0:2;let h=null;if(r!=null&&r.length)try{r.length===1&&r[0]?h=e.groups[r[0]].channels:h=r.reduce((f,m)=>{if(m){const E=e.groups[m];if(!E)throw new Error(`Audio track group ${m} not found`);Object.keys(E.channels).forEach(y=>{f[y]=(f[y]||0)+E.channels[y]})}return f},{2:0})}catch(f){return!0}return a.videoCodec!==void 0&&(a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(i,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(n,8e6))||!!h&&K(u)&&Object.keys(h).some(f=>parseInt(f)>u)}function fn(a,e,t){const i=a.videoCodec,n=a.audioCodec;if(!i&&!n||!t)return Promise.resolve(qt);const s=[];if(i){const r={width:a.width,height:a.height,bitrate:Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)),framerate:a.frameRate||30},o=a.videoRange;o!=="SDR"&&(r.transferFunction=o.toLowerCase());const c=i.split(","),u=navigator.userAgent;if(c.some(h=>Ot(h))&<())return Promise.resolve(wi(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${u})`),s));s.push.apply(s,c.map(h=>({type:"media-source",video:b(b({},r),{},{contentType:xt(tn(h),"video")})})))}return n&&a.audioGroups&&a.audioGroups.forEach(r=>{var o;r&&((o=e.groups[r])==null||o.tracks.forEach(c=>{if(c.groupId===r){const u=c.channels||"",h=parseFloat(u);K(h)&&h>2&&s.push.apply(s,n.split(",").map(f=>({type:"media-source",audio:{contentType:xt(f,"audio"),channels:""+h}})))}}))}),Promise.all(s.map(r=>{const o=Ti(r);return Qi[o]||(Qi[o]=t.decodingInfo(r))})).then(r=>({supported:!r.some(o=>!o.supported),configurations:s,decodingInfoResults:r})).catch(r=>({supported:!1,configurations:s,decodingInfoResults:[],error:r}))}function Ti(a){const{audio:e,video:t}=a,i=t||e;if(i){const n=hi(i.contentType);if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${n}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${n}`}return""}const Ji=["NONE","TYPE-0","TYPE-1",null];function qi(a){return Ji.indexOf(a)>-1}const Ni=["SDR","PQ","HLG"];function nn(a){return!!a&&Ni.indexOf(a)>-1}var Vt={No:"",Yes:"YES",v2:"v2"};function sn(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?Vt.v2:Vt.Yes:Vt.No}class Oi{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}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 on{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(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.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 yi(this._audioGroups,e)}hasSubtitleGroup(e){return yi(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.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 yi(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function ei(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function kn(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||Ni.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&ei(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const gi=a=>{const e=new WeakSet;return(t,i)=>{if(a&&(i=a(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},Qt=(a,e)=>JSON.stringify(a,gi(e));function ln(a,e,t,i,n){const s=Object.keys(a),r=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,c=n==null?void 0:n.videoCodec,u=r&&parseInt(r)===2;let h=!1,f=!1,m=1/0,E=1/0,y=1/0,w=1/0,k=0,z=[];const{preferHDR:ie,allowedVideoRanges:q}=kn(e,n);for(let Ee=s.length;Ee--;){const Re=a[s[Ee]];h||(h=Re.channels[2]>0),m=Math.min(m,Re.minHeight),E=Math.min(E,Re.minFramerate),y=Math.min(y,Re.minBitrate),q.filter($e=>Re.videoRanges[$e]>0).length>0&&(f=!0)}m=K(m)?m:0,E=K(E)?E:0;const le=Math.max(1080,m),ce=Math.max(30,E);y=K(y)?y:t,t=Math.max(y,t),f||(e=void 0);const Se=s.length>1;return{codecSet:s.reduce((Ee,Re)=>{const ge=a[Re];if(Re===Ee)return Ee;if(z=f?q.filter($e=>ge.videoRanges[$e]>0):[],Se){if(ge.minBitrate>t)return ii(Re,`min bitrate of ${ge.minBitrate} > current estimate of ${t}`),Ee;if(!ge.hasDefaultAudio)return ii(Re,"no renditions with default or auto-select sound found"),Ee;if(o&&Re.indexOf(o.substring(0,4))%5!==0)return ii(Re,`audio codec preference "${o}" not found`),Ee;if(r&&!u){if(!ge.channels[r])return ii(Re,`no renditions with ${r} channel sound found (channels options: ${Object.keys(ge.channels)})`),Ee}else if((!o||u)&&h&&ge.channels[2]===0)return ii(Re,"no renditions with stereo sound found"),Ee;if(ge.minHeight>le)return ii(Re,`min resolution of ${ge.minHeight} > maximum of ${le}`),Ee;if(ge.minFramerate>ce)return ii(Re,`min framerate of ${ge.minFramerate} > maximum of ${ce}`),Ee;if(!z.some($e=>ge.videoRanges[$e]>0))return ii(Re,`no variants with VIDEO-RANGE of ${Qt(z)} found`),Ee;if(c&&Re.indexOf(c.substring(0,4))%5!==0)return ii(Re,`video codec preference "${c}" not found`),Ee;if(ge.maxScore<k)return ii(Re,`max score of ${ge.maxScore} < selected max of ${k}`),Ee}return Ee&&(St(Re)>=St(Ee)||ge.fragmentError>a[Ee].fragmentError)?Ee:(w=ge.minIndex,k=ge.maxScore,Re)},void 0),videoRanges:z,preferHDR:ie,minFramerate:E,minBitrate:y,minIndex:w}}function ii(a,e){Y.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function mt(a){return a.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function pe(a,e,t,i){return a.slice(t,i+1).reduce((n,s,r)=>{if(!s.codecSet)return n;const o=s.audioGroups;let c=n[s.codecSet];c||(n[s.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,s.bitrate);const u=Math.min(s.height,s.width);return c.minHeight=Math.min(c.minHeight,u),c.minFramerate=Math.min(c.minFramerate,s.frameRate),c.minIndex=Math.min(c.minIndex,r),c.maxScore=Math.max(c.maxScore,s.score),c.fragmentError+=s.fragmentError,c.videoRanges[s.videoRange]=(c.videoRanges[s.videoRange]||0)+1,o&&o.forEach(h=>{if(!h)return;const f=e.groups[h];f&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(m=>{c.channels[m]=(c.channels[m]||0)+f.channels[m]}))}),n},{})}function ne(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:s}=a;return{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:s}}function Ae(a,e,t){if("attrs"in a){const i=e.indexOf(a);if(i!==-1)return i}for(let i=0;i<e.length;i++){const n=e[i];if(Ce(a,n,t))return i}return-1}function Ce(a,e,t){const{groupId:i,name:n,lang:s,assocLang:r,default:o}=a,c=a.forced;return(i===void 0||e.groupId===i)&&(n===void 0||e.name===n)&&(s===void 0||Te(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||Ue(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function Te(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function Ue(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function Pe(a,e){const{audioCodec:t,channels:i}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function ut(a,e,t,i,n){const s=e[i],o=e.reduce((m,E,y)=>{const w=E.uri;return(m[w]||(m[w]=[])).push(y),m},{})[s.uri];o.length>1&&(i=Math.max.apply(Math,o));const c=s.videoRange,u=s.frameRate,h=s.codecSet.substring(0,4),f=Tt(e,i,m=>{if(m.videoRange!==c||m.frameRate!==u||m.codecSet.substring(0,4)!==h)return!1;const E=m.audioGroups,y=t.filter(w=>!E||E.indexOf(w.groupId)!==-1);return Ae(a,y,n)>-1});return f>-1?f:Tt(e,i,m=>{const E=m.audioGroups,y=t.filter(w=>!E||E.indexOf(w.groupId)!==-1);return Ae(a,y,n)>-1})}function Tt(a,e,t){for(let i=e;i>-1;i--)if(t(a[i]))return i;for(let i=e+1;i<a.length;i++)if(t(a[i]))return i;return-1}function re(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class At extends U{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.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:n,partCurrent:s,hls:r}=this,{autoLevelEnabled:o,media:c}=r;if(!n||!c)return;const u=performance.now(),h=s?s.stats:n.stats,f=s?s.duration:n.duration,m=u-h.loading.start,E=r.minAutoLevel,y=n.level,w=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||y<=E){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const k=w>-1&&w!==y,z=!!t||k;if(!z&&(c.paused||!c.playbackRate||!c.readyState))return;const ie=r.mainForwardBufferInfo;if(!z&&ie===null)return;const q=this.bwEstimator.getEstimateTTFB(),le=Math.abs(c.playbackRate);if(m<=Math.max(q,1e3*(f/(le*2))))return;const ce=ie?ie.len/le:0,Se=h.loading.first?h.loading.first-h.loading.start:-1,he=h.loaded&&Se>-1,Ee=this.getBwEstimate(),Re=r.levels,ge=Re[y],$e=Math.max(h.loaded,Math.round(f*(n.bitrate||ge.averageBitrate)/8));let Ve=he?m-Se:m;Ve<1&&he&&(Ve=Math.min(m,h.loaded*8/Ee));const Xt=he?h.loaded*1e3/Ve:0,Lt=q/1e3,vt=Xt?($e-h.loaded)/Xt:$e*8/Ee+Lt;if(vt<=ce)return;const et=Xt?Xt*8:Ee,yt=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,ht=this.hls.config.abrBandWidthUpFactor;let Ge=Number.POSITIVE_INFINITY,He;for(He=y-1;He>E;He--){const fi=Re[He].maxBitrate,bi=!Re[He].details||yt;if(Ge=this.getTimeToLoadFrag(Lt,et,f*fi,bi),Ge<Math.min(ce,f+Lt))break}if(Ge>=vt||Ge>f*10)return;he?this.bwEstimator.sample(m-Math.min(q,Se),h.loaded):this.bwEstimator.sampleTTFB(m);const Pt=Re[He].maxBitrate;this.getBwEstimate()*ht>Pt&&this.resetEstimator(Pt);const Dt=this.findBestLevel(Pt,E,He,0,ce,1,1);Dt>-1&&(He=Dt),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${y} is loading too slowly;
|
|
Fragment duration: ${n.duration.toFixed(3)}
|
|
Time to underbuffer: ${ce.toFixed(3)} s
|
|
Estimated load time for current fragment: ${vt.toFixed(3)} s
|
|
Estimated load time for down switch fragment: ${Ge.toFixed(3)} s
|
|
TTFB estimate: ${Se|0} ms
|
|
Current BW estimate: ${K(Ee)?Ee|0:"Unknown"} bps
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
Switching to level ${He} @ ${Pt|0} bps`),r.nextLoadLevel=r.nextAutoLevel=He,this.clearTimer();const zt=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===He&&He>0){const fi=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${He>0?"and switching down":""}
|
|
Fragment duration: ${n.duration.toFixed(3)} s
|
|
Time to underbuffer: ${fi.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,He>E){let bi=this.findBestLevel(this.hls.levels[E].bitrate,E,He,0,fi,1,1);bi===-1&&(bi=E),this.hls.nextLoadLevel=this.hls.nextAutoLevel=bi,this.resetEstimator(this.hls.levels[bi].bitrate)}}};k||vt>Ge*2?zt():this.timer=self.setInterval(zt,Ge*1e3),r.trigger(g.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:s,stats:h})},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 W(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(g.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var n;this.fragCurrent=i,this.partCurrent=(n=t.part)!=null?n:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case D.BUFFER_ADD_CODEC_ERROR:case D.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case D.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:n,partCurrent:s}=this;if(i&&n&&i.sn===n.sn&&i.level===n.level){const r=performance.now(),o=s?s.stats:i.stats,c=r-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(f,u),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,i,n){const s=e+i/t,r=n?e+this.lastLevelLoadSec:0;return s+r}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,s=n.end-n.first;K(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===H.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+n.loaded,c=(r.loaded?r.loaded.duration:0)+s;r.loaded={bytes:o,duration:c},r.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const s={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered(g.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,s=n!=null&&n.stats.loaded?n.stats:i.stats;if(s.aborted||this.ignoreFragment(i))return;const r=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(r,s.loaded),s.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==H.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,s=this.findBestLevel(i,t,e,0,n,1,1);if(s>-1)return s;const r=this.hls.firstLevel,o=Math.min(Math.max(r,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${r} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=i&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,s)&&r[e].loadError<=r[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:s,minAutoLevel:r}=i,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let h=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(u){const k=this.findBestLevel(c,r,n,u,0,h,f);if(k>=0)return this.rebufferNotice=-1,k}let m=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const k=this.bitrateTestDelay;k&&(m=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-k,this.info(`bitrate test took ${Math.round(1e3*k)}ms, set first fragment max fetchDuration to ${Math.round(1e3*m)} ms`),h=f=1)}const E=this.findBestLevel(c,r,n,u,m,h,f);if(this.rebufferNotice!==E&&(this.rebufferNotice=E,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${E}`)),E>-1)return E;const y=i.levels[r],w=i.loadLevelObj;return w&&(y==null?void 0:y.bitrate)<w.bitrate?r:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,n,s,r,o){var c;const u=n+s,h=this.lastLoadedFragLevel,f=h===-1?this.hls.firstLevel:h,{fragCurrent:m,partCurrent:E}=this,{levels:y,allAudioTracks:w,loadLevel:k,config:z}=this.hls;if(y.length===1)return 0;const ie=y[f],q=!!((c=this.hls.latestLevelDetails)!=null&&c.live),le=k===-1||h===-1;let ce,Se="SDR",he=(ie==null?void 0:ie.frameRate)||0;const{audioPreference:Ee,videoPreference:Re}=z,ge=this.audioTracksByGroup||(this.audioTracksByGroup=mt(w));let $e=-1;if(le){if(this.firstSelection!==-1)return this.firstSelection;const et=this.codecTiers||(this.codecTiers=pe(y,ge,t,i)),yt=ln(et,Se,e,Ee,Re),{codecSet:ht,videoRanges:Ge,minFramerate:He,minBitrate:Pt,minIndex:Dt,preferHDR:zt}=yt;$e=Dt,ce=ht,Se=zt?Ge[Ge.length-1]:Ge[0],he=He,e=Math.max(e,Pt),this.log(`picked start tier ${Qt(yt)}`)}else ce=ie==null?void 0:ie.codecSet,Se=ie==null?void 0:ie.videoRange;const Ve=E?E.duration:m?m.duration:0,Xt=this.bwEstimator.getEstimateTTFB()/1e3,Lt=[];for(let et=i;et>=t;et--){var vt;const yt=y[et],ht=et>f;if(!yt)continue;if(z.useMediaCapabilities&&!yt.supportedResult&&!yt.supportedPromise){const bi=navigator.mediaCapabilities;typeof(bi==null?void 0:bi.decodingInfo)=="function"&&(Vi(yt,ge,Se,he,e,Ee)||Ot(yt.videoCodec))?(yt.supportedPromise=fn(yt,ge,bi),yt.supportedPromise.then(Li=>{if(!this.hls)return;yt.supportedResult=Li;const An=this.hls.levels,Cn=An.indexOf(yt);Li.error?this.warn(`MediaCapabilities decodingInfo error: "${Li.error}" for level ${Cn} ${Qt(Li)}`):Li.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Cn} ${Qt(Li)}`),Cn>-1&&An.length>1&&(this.log(`Removing unsupported level ${Cn}`),this.hls.removeLevel(Cn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):yt.supportedResult=qt}if((ce&&yt.codecSet!==ce||Se&&yt.videoRange!==Se||ht&&he>yt.frameRate||!ht&&he>0&&he<yt.frameRate||yt.supportedResult&&!((vt=yt.supportedResult.decodingInfoResults)!=null&&vt[0].smooth))&&(!le||et!==$e)){Lt.push(et);continue}const Ge=yt.details,He=(E?Ge==null?void 0:Ge.partTarget:Ge==null?void 0:Ge.averagetargetduration)||Ve;let Pt;ht?Pt=o*e:Pt=r*e;const Dt=Ve&&n>=Ve*2&&s===0?yt.averageBitrate:yt.maxBitrate,zt=this.getTimeToLoadFrag(Xt,Pt,Dt*He,Ge===void 0);if(Pt>=Dt&&(et===h||yt.loadError===0&&yt.fragmentError===0)&&(zt<=Xt||!K(zt)||q&&!this.bitrateTestDelay||zt<u)){const bi=this.forcedAutoLevel;return et!==k&&(bi===-1||bi!==k)&&(Lt.length&&this.trace(`Skipped level(s) ${Lt.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${y[Lt[0]].codecs}" ${y[Lt[0]].videoRange}; not compatible with "${ce}" ${Se}`),this.info(`switch candidate:${f}->${et} adjustedbw(${Math.round(Pt)})-bitrate=${Math.round(Pt-Dt)} ttfb:${Xt.toFixed(1)} avgDuration:${He.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${zt.toFixed(1)} firstSelection:${le} codecSet:${yt.codecSet} videoRange:${yt.videoRange} hls.loadLevel:${k}`)),le&&(this.firstSelection=et),et}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const wt={search:function(a,e){let t=0,i=a.length-1,n=null,s=null;for(;t<=i;){n=(t+i)/2|0,s=a[n];const r=e(s);if(r>0)t=n+1;else if(r<0)i=n-1;else return s}return null}};function Gt(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!K(e))return null;const i=a[0].programDateTime;if(e<(i||0))return null;const n=a[a.length-1].endProgramDateTime;if(e>=(n||0))return null;t=t||0;for(let s=0;s<a.length;++s){const r=a[s];if(si(e,t,r))return r}return null}function Ye(a,e,t=0,i=0,n=.005){let s=null;if(a){s=e[1+a.sn-e[0].sn]||null;const o=a.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),s&&a.level!==s.level&&s.end<=a.end&&(s=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!a||a.level===s.level)&&ni(t,i,s)===0||Je(s,a,Math.min(n,i))))return s;const r=wt.search(e,ni.bind(null,t,i));return r&&(r!==a||!s)?r:s}function Je(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((n,s)=>(s[0]==="INF"&&(n+=parseFloat(s[1])),n),t);return a.start<=i}return!1}function ni(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=a?1:t.start-i>a&&t.start?-1:0}function si(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function di(a,e){return wt.search(a,t=>t.cc<e?1:t.cc>e?-1:0)}function ti(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){const i=t.start,n=t.end;let s=a.fragments;if(!t.relurl){const{fragmentHint:r}=a;r&&(s=s.concat(r))}return wt.search(s,r=>r.cc<e||r.end<=i?1:r.cc>e||r.start>=n?-1:0)}return null}function Kt(a){switch(a.details){case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_TIMEOUT:case D.LEVEL_LOAD_TIMEOUT:case D.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ht(a,e){const t=Kt(e);return a.default[`${t?"timeout":"error"}Retry`]}function Bt(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function oi(a){return b(b({},a),{errorRetry:null,timeoutRetry:null})}function Ii(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(li(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function li(a){return a===0&&navigator.onLine===!1||!!a&&(a<400||a>499)}var ri={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},jt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Bi extends U{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(g.ERROR,this.onError,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.ERROR,this.onError,this),e.off(g.ERROR,this.onErrorOut,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.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)===H.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const n=this.hls,s=t.context;switch(t.details){case D.FRAG_LOAD_ERROR:case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_ERROR:case D.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case D.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=mi();return}case D.FRAG_GAP:case D.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ri.SendAlternateToPenaltyBox;return}case D.LEVEL_EMPTY_ERROR:case D.LEVEL_PARSING_ERROR:{var r,o;const u=t.parent===H.MAIN?t.level:n.loadLevel;t.details===D.LEVEL_EMPTY_ERROR&&((r=t.context)!=null&&(o=r.levelDetails)!=null&&o.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,u):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,u))}return;case D.LEVEL_LOAD_ERROR:case D.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case D.AUDIO_TRACK_LOAD_ERROR:case D.AUDIO_TRACK_LOAD_TIMEOUT:case D.SUBTITLE_LOAD_ERROR:case D.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const u=n.loadLevelObj;if(u&&(s.type===ee.AUDIO_TRACK&&u.hasAudioGroup(s.groupId)||s.type===ee.SUBTITLE_TRACK&&u.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=ri.SendAlternateToPenaltyBox,t.errorAction.flags=jt.MoveAllAlternatesMatchingHost;return}}return;case D.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const u=n.loadLevelObj,h=u==null?void 0:u.attrs["HDCP-LEVEL"];h?t.errorAction={action:ri.SendAlternateToPenaltyBox,flags:jt.MoveAllAlternatesMatchingHDCP,hdcpLevel:h}:this.keySystemError(t)}return;case D.BUFFER_ADD_CODEC_ERROR:case D.REMUX_ALLOC_ERROR:case D.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:n.loadLevel)}return;case D.INTERNAL_EXCEPTION:case D.BUFFER_APPENDING_ERROR:case D.BUFFER_FULL_ERROR:case D.LEVEL_SWITCH_ERROR:case D.BUFFER_STALLED_ERROR:case D.BUFFER_SEEK_OVER_HOLE:case D.BUFFER_NUDGE_ON_STALL:t.errorAction=mi();return}t.type===J.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 i=this.hls,n=Ht(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(Ii(n,s,Kt(e),e.response))return{action:ri.RetryRequest,flags:jt.None,retryConfig:n,retryCount:s};const o=this.getLevelSwitchAction(e,t);return n&&(o.retryConfig=n,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:s,keyLoadPolicy:r}=t.config,o=Ht(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((h,f)=>h+f.fragmentError,0);if(n&&(e.details!==D.FRAG_GAP&&n.fragmentError++,Ii(o,c,Kt(e),e.response)))return{action:ri.RetryRequest,flags:jt.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,i);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var s,r;const u=e.details;n.loadError++,u===D.BUFFER_APPEND_ERROR&&n.fragmentError++;let h=-1;const{levels:f,loadLevel:m,minAutoLevel:E,maxAutoLevel:y}=i;i.autoLevelEnabled||(i.loadLevel=-1);const w=(s=e.frag)==null?void 0:s.type,z=(w===H.AUDIO&&u===D.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===D.BUFFER_ADD_CODEC_ERROR||u===D.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:Se})=>n.audioCodec!==Se),q=e.sourceBufferName==="video"&&(u===D.BUFFER_ADD_CODEC_ERROR||u===D.BUFFER_APPEND_ERROR)&&f.some(({codecSet:Se,audioCodec:he})=>n.codecSet!==Se&&n.audioCodec===he),{type:le,groupId:ce}=(r=e.context)!=null?r:{};for(let Se=f.length;Se--;){const he=(Se+m)%f.length;if(he!==m&&he>=E&&he<=y&&f[he].loadError===0){var o,c;const Ee=f[he];if(u===D.FRAG_GAP&&w===H.MAIN&&e.frag){const Re=f[he].details;if(Re){const ge=Ye(e.frag,Re.fragments,e.frag.start);if(ge!=null&&ge.gap)continue}}else{if(le===ee.AUDIO_TRACK&&Ee.hasAudioGroup(ce)||le===ee.SUBTITLE_TRACK&&Ee.hasSubtitleGroup(ce))continue;if(w===H.AUDIO&&(o=n.audioGroups)!=null&&o.some(Re=>Ee.hasAudioGroup(Re))||w===H.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(Re=>Ee.hasSubtitleGroup(Re))||z&&n.audioCodec===Ee.audioCodec||!z&&n.audioCodec!==Ee.audioCodec||q&&n.codecSet===Ee.codecSet)continue}h=he;break}}if(h>-1&&i.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:ri.SendAlternateToPenaltyBox,flags:jt.None,nextAutoLevel:h}}return{action:ri.SendAlternateToPenaltyBox,flags:jt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ri.DoNothing:break;case ri.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==D.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;case ri.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n,hdcpLevel:s,nextAutoLevel:r}=i;switch(n){case jt.None:this.switchLevel(e,r);break;case jt.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=Ji[Ji.indexOf(s)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,r)}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===D.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=hi(e.mimeType),n=this.hls.levels;for(let s=n.length;s--;)n[s][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(s)}}}function mi(a){const e={action:ri.DoNothing,flags:jt.None};return a&&(e.resolved=!0),e}var Ft={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class zi{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let n=i.length;n--;){const s=i[n];if(!s)break;const r=s.end;if(s.start<=e&&r!==null&&e<=r)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:n}=this,s=Object.keys(n);for(let r=s.length;r--;){const o=n[s[r]];if((o==null?void 0:o.body.type)===t&&(!i||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,i,n,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(n==null?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const c=this.fragments[o];if(!c||r>=c.body.sn)return;if(!c.buffered&&(!c.loaded||s)){c.body.type===i&&this.removeFragment(c.body);return}const u=c.range[e];if(u){if(u.time.length===0){this.removeFragment(c.body);return}u.time.some(h=>{const f=!this.isTimeBuffered(h.startPTS,h.endPTS,t);return f&&this.removeFragment(c.body),f})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,n=Hi(i),s=this.fragments[n];if(!s||s.buffered&&i.gap)return;const r=!i.relurl;Object.keys(t).forEach(o=>{const c=i.elementaryStreams[o];if(!c)return;const u=t[o],h=r||c.partial===!0;s.range[o]=this.getBufferedTimes(i,e.part,h,u)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=i.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),Gi(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=Hi(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(e,t,i,n){const s={time:[],partial:i},r=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||r;for(let h=0;h<n.length;h++){const f=n.start(h)-this.bufferPadding,m=n.end(h)+this.bufferPadding;if(u>=f&&c<=m){s.time.push({startPTS:Math.max(r,n.start(h)),endPTS:Math.min(o,n.end(h))});break}else if(r<m&&o>f){const E=Math.max(r,n.start(h)),y=Math.min(o,n.end(h));y>E&&(s.partial=!0,s.time.push({startPTS:E,endPTS:y}))}else if(o<=f)break}return s}getPartialFragment(e){let t=null,i,n,s,r=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const h=c[u];h&&Gi(h)&&(n=h.body.start-o,s=h.body.end+o,e>=n&&e<=s&&(i=Math.min(e-n,s-e),r<=i&&(t=h.body,r=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Gi(t))}getState(e){const t=Hi(e),i=this.fragments[t];return i?i.buffered?Gi(i)?Ft.PARTIAL:Ft.OK:Ft.APPENDING:Ft.NOT_LOADED}isTimeBuffered(e,t,i){let n,s;for(let r=0;r<i.length;r++){if(n=i.start(r)-this.bufferPadding,s=i.end(r)+this.bufferPadding,e>=n&&t<=s)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,s=Hi(i);this.fragments[s]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:s,type:r}=t;if(i.sn==="initSegment")return;const o=i.type;if(n){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(n)}this.timeRanges=s;const c=s[r];this.detectEvictedFragments(r,c,o,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Hi(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const s=t[i[n]];if((s==null?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,n,s){n&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const o=this.fragments[r];if(!o)return;const c=o.body;c.type!==i||n&&!c.gap||c.start<t&&c.end>e&&(o.buffered||s)&&this.removeFragment(c)})}removeFragment(e){const t=Hi(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=i.filter(s=>s.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const i=(e=this.hls)==null||(t=e.latestLevelDetails)==null?void 0:t.partList;i&&i.forEach(n=>n.clearElementaryStreamInfo())}}function Gi(a){var e,t,i;return a.buffered&&(a.body.gap||((e=a.range.video)==null?void 0:e.partial)||((t=a.range.audio)==null?void 0:t.partial)||((i=a.range.audiovideo)==null?void 0:i.partial))}function Hi(a){return`${a.type}_${a.level}_${a.sn}`}var _i={cbc:0,ctr:1};class Zi{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case _i.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case _i.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 dn(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class vi{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),i=new Uint32Array(4);for(let n=0;n<4;n++)i[n]=t.getUint32(n*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],s=i[1],r=i[2],o=i[3],c=this.invSubMix,u=c[0],h=c[1],f=c[2],m=c[3],E=new Uint32Array(256);let y=0,w=0,k=0;for(k=0;k<256;k++)k<128?E[k]=k<<1:E[k]=k<<1^283;for(k=0;k<256;k++){let z=w^w<<1^w<<2^w<<3^w<<4;z=z>>>8^z&255^99,e[y]=z,t[z]=y;const ie=E[y],q=E[ie],le=E[q];let ce=E[z]*257^z*16843008;n[y]=ce<<24|ce>>>8,s[y]=ce<<16|ce>>>16,r[y]=ce<<8|ce>>>24,o[y]=ce,ce=le*16843009^q*65537^ie*257^y*16843008,u[z]=ce<<24|ce>>>8,h[z]=ce<<16|ce>>>16,f[z]=ce<<8|ce>>>24,m[z]=ce,y?(y=ie^E[E[E[le^ie]]],w^=E[E[w]]):y=w=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n<t.length&&i;)i=t[n]===this.key[n],n++;if(i)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const r=this.ksRows=(s+6+1)*4;let o,c;const u=this.keySchedule=new Uint32Array(r),h=this.invKeySchedule=new Uint32Array(r),f=this.sBox,m=this.rcon,E=this.invSubMix,y=E[0],w=E[1],k=E[2],z=E[3];let ie,q;for(o=0;o<r;o++){if(o<s){ie=u[o]=t[o];continue}q=ie,o%s===0?(q=q<<8|q>>>24,q=f[q>>>24]<<24|f[q>>>16&255]<<16|f[q>>>8&255]<<8|f[q&255],q^=m[o/s|0]<<24):s>6&&o%s===4&&(q=f[q>>>24]<<24|f[q>>>16&255]<<16|f[q>>>8&255]<<8|f[q&255]),u[o]=ie=(u[o-s]^q)>>>0}for(c=0;c<r;c++)o=r-c,c&3?q=u[o]:q=u[o-4],c<4||o<=4?h[c]=q:h[c]=y[f[q>>>24]]^w[f[q>>>16&255]]^k[f[q>>>8&255]]^z[f[q&255]],h[c]=h[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const n=this.keySize+6,s=this.invKeySchedule,r=this.invSBox,o=this.invSubMix,c=o[0],u=o[1],h=o[2],f=o[3],m=this.uint8ArrayToUint32Array_(i);let E=m[0],y=m[1],w=m[2],k=m[3];const z=new Int32Array(e),ie=new Int32Array(z.length);let q,le,ce,Se,he,Ee,Re,ge,$e,Ve,Xt,Lt,vt,et;const yt=this.networkToHostOrderSwap;for(;t<z.length;){for($e=yt(z[t]),Ve=yt(z[t+1]),Xt=yt(z[t+2]),Lt=yt(z[t+3]),he=$e^s[0],Ee=Lt^s[1],Re=Xt^s[2],ge=Ve^s[3],vt=4,et=1;et<n;et++)q=c[he>>>24]^u[Ee>>16&255]^h[Re>>8&255]^f[ge&255]^s[vt],le=c[Ee>>>24]^u[Re>>16&255]^h[ge>>8&255]^f[he&255]^s[vt+1],ce=c[Re>>>24]^u[ge>>16&255]^h[he>>8&255]^f[Ee&255]^s[vt+2],Se=c[ge>>>24]^u[he>>16&255]^h[Ee>>8&255]^f[Re&255]^s[vt+3],he=q,Ee=le,Re=ce,ge=Se,vt=vt+4;q=r[he>>>24]<<24^r[Ee>>16&255]<<16^r[Re>>8&255]<<8^r[ge&255]^s[vt],le=r[Ee>>>24]<<24^r[Re>>16&255]<<16^r[ge>>8&255]<<8^r[he&255]^s[vt+1],ce=r[Re>>>24]<<24^r[ge>>16&255]<<16^r[he>>8&255]<<8^r[Ee&255]^s[vt+2],Se=r[ge>>>24]<<24^r[he>>16&255]<<16^r[Ee>>8&255]<<8^r[Re&255]^s[vt+3],ie[t]=yt(q^E),ie[t+1]=yt(Se^y),ie[t+2]=yt(ce^w),ie[t+3]=yt(le^k),E=$e,y=Ve,w=Xt,k=Lt,t=t+4}return ie.buffer}}class wn{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=On(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function On(a){switch(a){case _i.cbc:return"AES-CBC";case _i.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const En=16;class gn{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 i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(i){}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 i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?dn(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,n){return this.useSoftware?new Promise((s,r)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,i,n);const c=this.flush();c?s(c.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:s,currentResult:r,remainderData:o}=this;if(n!==_i.cbc||t.byteLength!==16)return Y.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=ct(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;s&&(i=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new vi),u.expandKey(t);const h=r;return this.currentResult=u.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new wn(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Zi(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(Y.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i,n)))}onWebCryptoError(e,t,i,n){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%En;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(Y.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const un=Math.pow(2,17);class Yi{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 i=e.url;if(!i)return Promise.reject(new Ui({type:J.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(y=>y[0]==="GAP")){c(pn(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),h=rn(e);e.loader=u;const f=oi(n.fragLoadPolicy.default),m={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:un};e.stats=u.stats;const E={onSuccess:(y,w,k,z)=>{this.resetLoader(e,u);let ie=y.data;k.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ie.slice(0,16)),ie=ie.slice(16)),o({frag:e,part:null,payload:ie,networkDetails:z})},onError:(y,w,k,z)=>{this.resetLoader(e,u),c(new Ui({type:J.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:b({url:i,data:void 0},y),error:new Error(`HTTP Error ${y.code} ${y.text}`),networkDetails:k,stats:z}))},onAbort:(y,w,k)=>{this.resetLoader(e,u),c(new Ui({type:J.NETWORK_ERROR,details:D.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:k,stats:y}))},onTimeout:(y,w,k)=>{this.resetLoader(e,u),c(new Ui({type:J.NETWORK_ERROR,details:D.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${m.timeout}ms`),networkDetails:k,stats:y}))}};t&&(E.onProgress=(y,w,k,z)=>t({frag:e,part:null,payload:k,networkDetails:z})),u.load(h,m,E)})}loadPart(e,t,i){this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(pn(e,t));return}const u=this.loader=s?new s(n):new r(n),h=rn(e,t);e.loader=u;const f=oi(n.fragLoadPolicy.default),m={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:un};t.stats=u.stats,u.load(h,m,{onSuccess:(E,y,w,k)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const z={frag:e,part:t,payload:E.data,networkDetails:k};i(z),o(z)},onError:(E,y,w,k)=>{this.resetLoader(e,u),c(new Ui({type:J.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:b({url:h.url,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:w,stats:k}))},onAbort:(E,y,w)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new Ui({type:J.NETWORK_ERROR,details:D.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:w,stats:E}))},onTimeout:(E,y,w)=>{this.resetLoader(e,u),c(new Ui({type:J.NETWORK_ERROR,details:D.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${m.timeout}ms`),networkDetails:w,stats:E}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,s=n.total;if(i.loaded+=n.loaded,s){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(i.loaded/s),c),f=(c-u)*Math.round(i.loaded/u);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);const r=i.loading,o=n.loading;r.start?r.first+=o.first-o.start:(r.start=o.start,r.first=o.first),r.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function rn(a,e=null){const t=e||a,i={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(K(n)&&K(s)){var r;let o=n,c=s;if(a.sn==="initSegment"&&In((r=a.decryptdata)==null?void 0:r.method)){const u=s-n;u%16&&(c=s+(16-u%16)),n!==0&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=c}return i}function pn(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:J.MEDIA_ERROR,details:D.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new Ui(i)}function In(a){return a==="AES-128"||a==="AES-256"}class Ui extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Ai extends U{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 Wi{constructor(e,t,i,n=0,s=-1,r=!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=en(),this.buffering={audio:en(),video:en(),audiovideo:en()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function en(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Rn={length:0,start:()=>0,end:()=>0};class _t{static isBuffered(e,t){if(e){const i=_t.getBuffered(e);for(let n=i.length;n--;)if(t>=i.start(n)&&t<=i.end(n))return!0}return!1}static bufferedRanges(e){if(e){const t=_t.getBuffered(e);return _t.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const n=_t.bufferedRanges(e);if(n.length)return _t.bufferedInfo(n,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((h,f)=>h.start-f.start||f.end-h.end);let n=-1,s=[];if(i)for(let h=0;h<e.length;h++){t>=e[h].start&&t<=e[h].end&&(n=h);const f=s.length;if(f){const m=s[f-1].end;e[h].start-m<i?e[h].end>m&&(s[f-1].end=e[h].end):s.push(e[h])}else s.push(e[h])}else s=e;let r=0,o,c=t,u=t;for(let h=0;h<s.length;h++){const f=s[h].start,m=s[h].end;if(n===-1&&t>=f&&t<=m&&(n=h),t+i>=f&&t<m)c=f,u=m,r=u-t;else if(t+i<f){o=f;break}}return{len:r,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||Rn}catch(t){return Y.log("failed to get media.buffered",t),Rn}}}const bn=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ln(a){return bn.test(a)}function xn(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(bn,i=>{const n=i.substring(2,i.length-1),s=t==null?void 0:t[n];return s===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),i):s})}return e}function Hn(a,e,t){let i=a.variableList;i||(a.variableList=i={});let n,s;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(n))s=r.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(r){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else n=e.NAME,s=e.VALUE;n in i?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):i[n]=s||""}function Wn(a,e,t){const i=e.IMPORT;if(t&&i in t){let n=a.variableList;n||(a.variableList=n={}),n[i]=t[i]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const qn=/^(\d+)x(\d+)$/,Mn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Zt{constructor(e,t){typeof e=="string"&&(e=Zt.parseAttrList(e,t)),v(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 i=new Uint8Array(t.length/2);for(let n=0;n<t.length/2;n++)i[n]=parseInt(t.slice(n*2,n*2+2),16);return i}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 i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((n,s)=>(n[s.toLowerCase()]=!0,n),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=qn.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={},s='"';for(Mn.lastIndex=0;(i=Mn.exec(e))!==null;){const r=i[1].trim();let o=i[2];const c=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let u=!1;if(c)o=o.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(c||u))o=xn(t,o);else if(!u&&!c)switch(r){case"CLOSED-CAPTIONS":if(o==="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":Y.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const as="com.apple.hls.interstitial";function jn(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Vn(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class es{constructor(e,t,i=0){var n;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(n=t==null?void 0:t.tagOrder)!=null?n:i,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){Y.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=v(new Zt({}),s,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 s=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);K(s.getTime())&&(this._endDate=s)}}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?(Y.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(K(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===as}get isValid(){return!!this.id&&!this._badValueForSameId&&K(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const Nn=10;class Fn{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}get hasProgramDateTime(){return this.fragments.length?K(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Nn}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function mn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function ji(a){switch(a){case"AES-128":case"AES-256":return _i.cbc;case"AES-256-CTR":return _i.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function Sn(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Pi(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function _n(a){const e=Pi(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function vn(a){const e=function(i,n,s){const r=i[n];i[n]=i[s],i[s]=r};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function an(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),n=i[i.length-1].split(",");if(n.length===2){const s=n[0]==="base64",r=n[1];s?(i.splice(-1,1),t=Sn(r)):t=_n(r)}}return t}const Ki=typeof self!="undefined"?self:void 0;var Yt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Xi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function zn(a){switch(a){case Xi.FAIRPLAY:return Yt.FAIRPLAY;case Xi.PLAYREADY:return Yt.PLAYREADY;case Xi.WIDEVINE:return Yt.WIDEVINE;case Xi.CLEARKEY:return Yt.CLEARKEY}}var ts={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function is(a){if(a===ts.WIDEVINE)return Yt.WIDEVINE;if(a===ts.PLAYREADY)return Yt.PLAYREADY;if(a===ts.CENC||a===ts.CLEARKEY)return Yt.CLEARKEY}function Bn(a){switch(a){case Yt.FAIRPLAY:return Xi.FAIRPLAY;case Yt.PLAYREADY:return Xi.PLAYREADY;case Yt.WIDEVINE:return Xi.WIDEVINE;case Yt.CLEARKEY:return Xi.CLEARKEY}}function Qe(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[Yt.FAIRPLAY,Yt.WIDEVINE,Yt.PLAYREADY,Yt.CLEARKEY].filter(n=>!!e[n]):[];return!i[Yt.WIDEVINE]&&t&&i.push(Yt.WIDEVINE),i}const It=function(a){return Ki!=null&&(a=Ki.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function ki(a,e,t,i){let n;switch(a){case Yt.FAIRPLAY:n=["cenc","sinf"];break;case Yt.WIDEVINE:case Yt.PLAYREADY:n=["cenc"];break;case Yt.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return $i(n,e,t,i)}function $i(a,e,t,i){return[{initDataTypes:a,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function ui(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const o=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(o){const c=Sn(o).subarray(0,16);return vn(c),c}}return null}let Zn={};class Yn{static clearKeyUriToKeyIdMap(){Zn={}}constructor(e,t,i,n=[1],s=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!mn(e)}isSupported(){if(this.method){if(mn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Xi.FAIRPLAY:case Xi.WIDEVINE:case Xi.PLAYREADY:case Xi.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(mn(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(Y.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=ys(e);return new Yn(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=an(this.uri);if(t)switch(this.keyFormat){case Xi.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Xi.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Ne(i,null,t),this.keyId=ui(t);break}default:{let i=t.subarray(0,16);if(i.length!==16){const n=new Uint8Array(16);n.set(i,16-i.length),i=n}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=Zn[this.uri];if(!i){const n=Object.keys(Zn).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),Zn[this.uri]=i}this.keyId=i}return this}}function ys(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const os=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,sr=/#EXT-X-MEDIA:(.*)/g,Cr=/^#EXT(?:INF|-X-TARGETDURATION):/m,ws=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Is=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Un{static findGroup(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n.id===t)return n}}static resolve(e,t){return P.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Cr.test(e)}static parseMasterPlaylist(e,t){const i=Ln(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];os.lastIndex=0;let r;for(;(r=os.exec(e))!=null;)if(r[1]){var o;const u=new Zt(r[1],n),h=xn(n,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Un.resolve(h,t)},m=u.decimalResolution("RESOLUTION");m&&(f.width=m.width,f.height=m.height),rr(u.CODECS,f);const E=u["SUPPLEMENTAL-CODECS"];E&&(f.supplemental={},rr(E,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),n.levels.push(f)}else if(r[3]){const u=r[3],h=r[4];switch(u){case"SESSION-DATA":{const f=new Zt(h,n),m=f["DATA-ID"];m&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[m]=f);break}case"SESSION-KEY":{const f=$s(h,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):Y.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const f=new Zt(h,n);Hn(n,f,t)}break}case"CONTENT-STEERING":{const f=new Zt(h,n);n.contentSteering={uri:Un.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=Gs(h);break}}}const c=s.length>0&&s.length<n.levels.length;return n.levels=c?s:n.levels,n.levels.length===0&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(e,t,i){let n;const s={},r=i.levels,o={AUDIO:r.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:r.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(sr.lastIndex=0;(n=sr.exec(e))!==null;){const u=new Zt(n[1],i),h=u.TYPE;if(h){const f=o[h],m=s[h]||[];s[h]=m;const E=u.LANGUAGE,y=u["ASSOC-LANGUAGE"],w=u.CHANNELS,k=u.CHARACTERISTICS,z=u["INSTREAM-ID"],ie={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||E||"",type:h,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:E,url:u.URI?Un.resolve(u.URI,t):""};if(y&&(ie.assocLang=y),w&&(ie.channels=w),k&&(ie.characteristics=k),z&&(ie.instreamId=z),f!=null&&f.length){const q=Un.findGroup(f,ie.groupId)||f[0];Ks(ie,q,"audioCodec"),Ks(ie,q,"textCodec")}m.push(ie)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new Fn(t),h=u.fragments,f=[];let m=null,E=0,y=0,w=0,k=0,z=0,ie=null,q=new oe(n,c),le,ce,Se,he=-1,Ee=!1,Re=null,ge;if(ws.lastIndex=0,u.m3u8=e,u.hasVariableRefs=Ln(e),((o=ws.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(le=ws.exec(e))!==null;){Ee&&(Ee=!1,q=new oe(n,c),q.playlistOffset=w,q.start=w,q.sn=E,q.cc=k,z&&(q.bitrate=z),q.level=i,m&&(q.initSegment=m,m.rawProgramDateTime&&(q.rawProgramDateTime=m.rawProgramDateTime,m.rawProgramDateTime=null),Re&&(q.setByteRange(Re),Re=null)));const Lt=le[1];if(Lt){q.duration=parseFloat(Lt);const vt=(" "+le[2]).slice(1);q.title=vt||null,q.tagList.push(vt?["INF",Lt,vt]:["INF",Lt])}else if(le[3]){if(K(q.duration)){q.playlistOffset=w,q.start=w,Se&&or(q,Se,u),q.sn=E,q.level=i,q.cc=k,h.push(q);const vt=(" "+le[3]).slice(1);q.relurl=xn(u,vt),Ls(q,ie,f),ie=q,w+=q.duration,E++,y=0,Ee=!0}}else{if(le=le[0].match(Is),!le){Y.warn("No matches on slow regex match for level playlist!");continue}for(ce=1;ce<le.length&&le[ce]===void 0;ce++);const vt=(" "+le[ce]).slice(1),et=(" "+le[ce+1]).slice(1),yt=le[ce+2]?(" "+le[ce+2]).slice(1):null;switch(vt){case"BYTERANGE":ie?q.setByteRange(et,ie):q.setByteRange(et);break;case"PROGRAM-DATE-TIME":q.rawProgramDateTime=et,q.tagList.push(["PROGRAM-DATE-TIME",et]),he===-1&&(he=h.length);break;case"PLAYLIST-TYPE":u.type&&Xn(u,vt,le),u.type=et.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Xn(u,vt,le):h.length>0&&lr(u,vt,le),E=u.startSN=parseInt(et);break;case"SKIP":{u.skippedSegments&&Xn(u,vt,le);const ht=new Zt(et,u),Ge=ht.decimalInteger("SKIPPED-SEGMENTS");if(K(Ge)){u.skippedSegments+=Ge;for(let Pt=Ge;Pt--;)h.push(null);E+=Ge}const He=ht.enumeratedString("RECENTLY-REMOVED-DATERANGES");He&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(He.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Xn(u,vt,le),u.targetduration=Math.max(parseInt(et),1);break;case"VERSION":u.version!==null&&Xn(u,vt,le),u.version=parseInt(et);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Xn(u,vt,le),u.live=!1;break;case"#":(et||yt)&&q.tagList.push(yt?[et,yt]:[et]);break;case"DISCONTINUITY":k++,q.tagList.push(["DIS"]);break;case"GAP":q.gap=!0,q.tagList.push([vt]);break;case"BITRATE":q.tagList.push([vt,et]),z=parseInt(et)*1e3,K(z)?q.bitrate=z:z=0;break;case"DATERANGE":{const ht=new Zt(et,u),Ge=new es(ht,u.dateRanges[ht.ID],u.dateRangeTagCount);u.dateRangeTagCount++,Ge.isValid||u.skippedSegments?u.dateRanges[Ge.id]=Ge:Y.warn(`Ignoring invalid DATERANGE tag: "${et}"`),q.tagList.push(["EXT-X-DATERANGE",et]);break}case"DEFINE":{{const ht=new Zt(et,u);"IMPORT"in ht?Wn(u,ht,r):Hn(u,ht,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?Xn(u,vt,le):h.length>0&&lr(u,vt,le),u.startCC=k=parseInt(et);break;case"KEY":{const ht=$s(et,t,u);if(ht.isSupported()){if(ht.method==="NONE"){Se=void 0;break}Se||(Se={}),Se[ht.keyFormat]&&(Se=v({},Se)),Se[ht.keyFormat]=ht}else Y.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${et}"`);break}case"START":u.startTimeOffset=Gs(et);break;case"MAP":{const ht=new Zt(et,u);if(q.duration){const Ge=new oe(n,c);ar(Ge,ht,i,Se),m=Ge,q.initSegment=m,m.rawProgramDateTime&&!q.rawProgramDateTime&&(q.rawProgramDateTime=m.rawProgramDateTime)}else{const Ge=q.byteRangeEndOffset;if(Ge){const He=q.byteRangeStartOffset;Re=`${Ge-He}@${He}`}else Re=null;ar(q,ht,i,Se),m=q,Ee=!0}m.cc=k;break}case"SERVER-CONTROL":{ge&&Xn(u,vt,le),ge=new Zt(et),u.canBlockReload=ge.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=ge.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&ge.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=ge.optionalFloat("PART-HOLD-BACK",0),u.holdBack=ge.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&Xn(u,vt,le);const ht=new Zt(et);u.partTarget=ht.decimalFloatingPoint("PART-TARGET");break}case"PART":{let ht=u.partList;ht||(ht=u.partList=[]);const Ge=y>0?ht[ht.length-1]:void 0,He=y++,Pt=new Zt(et,u),Dt=new xe(Pt,q,c,He,Ge);ht.push(Dt),q.duration+=Dt.duration;break}case"PRELOAD-HINT":{const ht=new Zt(et,u);u.preloadHint=ht;break}case"RENDITION-REPORT":{const ht=new Zt(et,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(ht);break}default:Y.warn(`line parsed but not handled: ${le}`);break}}}ie&&!ie.relurl?(h.pop(),w-=ie.duration,u.partList&&(u.fragmentHint=ie)):u.partList&&(Ls(q,ie,f),q.cc=k,u.fragmentHint=q,Se&&or(q,Se,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const $e=h.length,Ve=h[0],Xt=h[$e-1];if(w+=u.skippedSegments*u.targetduration,w>0&&$e&&Xt){u.averagetargetduration=w/$e;const Lt=Xt.sn;u.endSN=Lt!=="initSegment"?Lt:0,u.live||(Xt.endList=!0),Ve&&u.startCC===void 0&&(u.startCC=Ve.cc),he>0&&(Or(h,he),Ve&&f.unshift(Ve))}else u.endSN=0,u.startCC=0;return u.fragmentHint&&(w+=u.fragmentHint.duration),u.totalduration=w,f.length&&u.dateRangeTagCount&&Ve&&Rs(f,u),u.endCC=k,u}}function Rs(a,e){const t=a.length,i=a[t-1],n=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let r=s.length;r--;){const o=e.dateRanges[s[r]],c=o.startDate.getTime();o.tagAnchor=i.ref;for(let u=t;u--;){const h=ls(e,c,a,u,n);if(h!==-1){o.tagAnchor=e.fragments[h].ref;break}}}}function ls(a,e,t,i,n){const s=t[i];if(s){const o=s.programDateTime;if(e>=o||i===0){var r;const c=(((r=t[i+1])==null?void 0:r.start)||n)-s.start;if(e<=o+c*1e3){const u=t[i].sn-a.startSN,h=a.fragments;if(h.length>t.length){const m=(t[i+1]||h[h.length-1]).sn-a.startSN;for(let E=m;E>u;E--){const y=h[E].programDateTime;if(e>=y&&e<y+h[E].duration*1e3)return E}}return u}}}return-1}function $s(a,e,t){var i,n;const s=new Zt(a,t),r=(i=s.METHOD)!=null?i:"",o=s.URI,c=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,h=(n=s.KEYFORMAT)!=null?n:"identity";o&&s.IV&&!c&&Y.error(`Invalid IV: ${s.IV}`);const f=o?Un.resolve(o,e):"",m=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Yn(r,f,h,m,c)}function Gs(a){const t=new Zt(a).decimalFloatingPoint("TIME-OFFSET");return K(t)?t:null}function rr(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>kt(s,i));n.length&&(e[`${i}Codec`]=n.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>n.indexOf(s)===-1))}),e.unknownCodecs=t}function Ks(a,e,t){const i=e[t];i&&(a[t]=i)}function Or(a,e){let t=a[e];for(let i=e;i--;){const n=a[i];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function Ls(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function ar(a,e,t,i){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",i&&(a.levelkeys=i),a.initSegment=null}function or(a,e,t){a.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&i.push(a)}function Xn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function lr(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Ds(a,e){const t=e.startPTS;if(K(t)){let i=0,n;e.sn>a.sn?(i=t-a.start,n=a):(i=a.start-t,n=e),n.duration!==i&&n.setDuration(i)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.setStart(a.start+(a.minEndPTS-a.start)):e.setStart(a.start+a.duration):e.setStart(Math.max(a.start-e.duration,0))}function ds(a,e,t,i,n,s){i-t<=0&&(Y.warn("Fragment should have a positive duration",e),i=t+e.duration,s=n+e.duration);let o=t,c=i;const u=e.startPTS,h=e.endPTS;if(K(u)){const k=Math.abs(u-t);K(e.deltaPTS)?e.deltaPTS=Math.max(k,e.deltaPTS):e.deltaPTS=k,o=Math.max(t,u),t=Math.min(t,u),n=Math.min(n,e.startDTS),c=Math.min(i,h),i=Math.max(i,h),s=Math.max(s,e.endDTS)}const f=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=o,e.startDTS=n,e.endPTS=i,e.minEndPTS=c,e.endDTS=s;const m=e.sn;if(!a||m<a.startSN||m>a.endSN)return 0;let E;const y=m-a.startSN,w=a.fragments;for(w[y]=e,E=y;E>0;E--)Ds(w[E],w[E-1]);for(E=y;E<w.length-1;E++)Ds(w[E],w[E+1]);return a.fragmentHint&&Ds(w[w.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,f}function Hs(a,e){if(a===e)return;let t=null;const i=a.fragments;for(let c=i.length-1;c>=0;c--){const u=i[c].initSegment;if(u){t=u;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let n;Mr(a,e,(c,u,h,f)=>{if(e.skippedSegments&&u.cc!==c.cc){const m=c.cc-u.cc;for(let E=h;E<f.length;E++)f[E].cc+=m}K(c.startPTS)&&K(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&&(n=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 s=e.fragments,r=e.fragmentHint?s.concat(e.fragmentHint):s;if(t&&r.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=s.some(c=>!c),e.deltaUpdateFailed){Y.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let c=e.skippedSegments;c--;)s.shift();e.startSN=s[0].sn}else{e.endCC=s[s.length-1].cc,e.canSkipDateRanges&&(e.dateRanges=Pr(a.dateRanges,e));const c=a.fragments.filter(u=>u.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u<r.length;u++)r[u].programDateTime===null&&Ls(r[u],r[u-1],c);Rs(c,e)}kr(a.partList,e.partList,(c,u)=>{u.elementaryStreams=c.elementaryStreams,u.stats=c.stats}),n?ds(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):Es(a,e),s.length&&(e.totalduration=e.edge-s[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const c=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=c),e.driftEndTime=o,e.driftEnd=c}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function Pr(a,e){const{dateRanges:t,recentlyRemovedDateranges:i}=e,n=v({},a);i&&i.forEach(o=>{delete n[o]});const r=Object.keys(n).length;return r&&Object.keys(t).forEach(o=>{const c=n[o],u=new es(t[o].attr,c);u.isValid?(n[o]=u,c||(u.tagOrder+=r)):Y.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Qt(t[o].attr)}"`)}),n}function kr(a,e,t){if(a&&e){let i=0;for(let n=0,s=a.length;n<=s;n++){const r=a[n],o=e[n+i];r&&o&&r.index===o.index&&r.fragment.sn===o.fragment.sn?t(r,o):i--}}}function Mr(a,e,t){const i=e.skippedSegments,n=Math.max(a.startSN,e.startSN)-e.startSN,s=(a.fragmentHint?1:0)+(i?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,r=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let u=n;u<=s;u++){const h=c[r+u];let f=o[u];if(i&&!f&&h&&(f=e.fragments[u]=h),h&&f){if(t(h,f,u,o),h.url&&h.url!==f.url){e.playlistParsingError=Ws(`media sequence mismatch ${f.sn}:`,a,e,h,f);return}else if(h.cc!==f.cc){e.playlistParsingError=Ws(`discontinuity sequence mismatch (${h.cc}!=${f.cc})`,a,e,h,f);return}}}}function Ws(a,e,t,i,n){return new Error(`${a} ${n.url}
|
|
Playlist starting @${e.startSN}
|
|
${e.m3u8}
|
|
|
|
Playlist starting @${t.startSN}
|
|
${t.m3u8}`)}function Es(a,e,t=!0){const i=e.startSN+e.skippedSegments-a.startSN,n=a.fragments,s=i>=0;let r=0;if(s&&i<n.length)r=n[i].start;else if(s&&e.startSN===a.endSN+1)r=a.fragmentEnd;else if(s&&t)r=a.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)r=a.fragmentStart;else return;js(e,r)}function js(a,e){if(e){const t=a.fragments;for(let i=a.skippedSegments;i<t.length;i++)t[i].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function ur(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const i=a.fragments;if(i.length&&t*4>e){const s=i[i.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function Nr(a,e,t){if(!a)return null;let i=a.fragments[e-a.startSN];return i||(i=a.fragmentHint,i&&i.sn===e)?i:e<a.startSN&&t&&t.sn===e?t:null}function Vs(a,e,t){return a?cr(a.partList,e,t):null}function cr(a,e,t){if(a)for(let i=a.length;i--;){const n=a[i];if(n.index===t&&n.fragment.sn===e)return n}return null}function hr(a){a.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function bs(a,e){for(let i=0,n=a.length;i<n;i++){var t;if(((t=a[i])==null?void 0:t.cc)===e)return a[i]}return null}function Fr(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function fr(a,e){if(a){const t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function Fi(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)fr(t[i],a);e.fragmentHint&&fr(e.fragmentHint,a),e.alignedSliding=!0}function Ei(a,e){a&&(Ri(e,a),!e.alignedSliding&&a&&cn(e,a),!e.alignedSliding&&a&&!e.skippedSegments&&Es(a,e,!1))}function Ri(a,e){if(!Fr(e,a))return;const t=Math.min(e.endCC,a.endCC),i=bs(e.fragments,t),n=bs(a.fragments,t);if(!i||!n)return;Y.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;Fi(s,a)}function cn(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,i=e.fragments;if(!t.length||!i.length)return;let n,s;const r=Math.min(e.endCC,a.endCC);e.startCC<r&&a.startCC<r&&(n=bs(i,r),s=bs(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=bs(t,n.cc)||t[Math.floor(t.length/2)]);const o=n.programDateTime,c=s.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(s.start-n.start);Fi(u,a)}const Tn={toString:function(a){let e="";const t=a.length;for(let i=0;i<t;i++)e+=`[${a.start(i).toFixed(3)}-${a.end(i).toFixed(3)}]`;return e}},De={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class xs extends Ai{constructor(e,t,i,n,s){super(n,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=De.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.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:r,fragCurrent:o,media:c,mediaBuffer:u,state:h}=this,f=c?c.currentTime:0,m=_t.bufferInfo(u||c,f,r.maxBufferHole);if(this.log(`media seeking to ${K(f)?f.toFixed(3):f}, state: ${h}`),this.state===De.ENDED)this.resetLoadingState();else if(o){const E=r.maxFragLookUpTolerance,y=o.start-E,w=o.start+o.duration+E;if(!m.len||w<m.start||y>m.end){const k=f>w;(f<y||k)&&(k&&o.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const E=this.lastCurrentTime;if(f>E&&(this.lastCurrentTime=f),!this.loadingParts){const y=Math.max(m.end,f),w=this.shouldLoadParts(this.getLevelDetails(),y);w&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${y.toFixed(2)}`),this.loadingParts=w)}}!this.hls.hasEnoughToStart&&!m.len&&(this.log(`setting startPosition to ${f} because of seek before start`),this.nextLoadPosition=this.startPosition=f),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new Yi(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new gn(e.config)}registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===De.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=De.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 i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const s=e.nextStart;if(s&&s>n&&s<t.edge||this.media.currentTime<e.start)return!1;const o=t.partList;if(o!=null&&o.length){const u=o[o.length-1];return _t.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 i=this.media=this.mediaBuffer=t.media;i.removeEventListener("seeking",this.onMediaSeeking),i.removeEventListener("ended",this.onMediaEnded),i.addEventListener("seeking",this.onMediaSeeking),i.addEventListener("ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===De.STOPPED&&this.startLoad(n.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(n!==null){if(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),n.removeEventListener("seeking",this.onMediaSeeking),n.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){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=De.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const n=s=>{const r=s.frag;if(this.fragContextChanged(r)){this.warn(`${r.type} sn: ${r.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(r,!1,s.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(r);return}r.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,i,n).then(s=>{if(!s)return;const r=this.state,o=s.frag;if(this.fragContextChanged(o)){(r===De.FRAG_LOADING||!this.fragCurrent&&r===De.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=De.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(g.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===De.STOPPED||this.state===De.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Ft.APPENDING){const s=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,s),o=Math.max(e.duration,r?r.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Ft.PARTIAL&&i.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,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger(g.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const n=i==null?void 0:i.frag;if(!n||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:n}=this,{frag:s,payload:r}=i,o=s.decryptdata;if(r&&r.byteLength>0&&o!=null&&o.key&&o.iv&&mn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,ji(o.method)).catch(u=>{throw n.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const h=self.performance.now();return n.trigger(g.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:c,tdecrypt:h}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===De.STOPPED||this.state===De.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==De.STOPPED&&(this.state=De.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.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 i=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:${i?Tn.toString(_t.getBuffered(i)):"(detached)"})`),V(e)){var n;if(e.type!==H.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=De.IDLE;return}}const s=(n=this.levels)==null?void 0:n[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=De.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:s}=e,r=!s||s.length===0||s.some(c=>!c),o=new Wi(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!r);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){var s;this.fragCurrent=e;const r=t==null?void 0:t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let o=null;e.encrypted&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=De.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(g.KEY_LOADED,f),this.state===De.KEY_LOADING&&(this.state=De.IDLE),f}),this.hls.trigger(g.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&r.encryptedFragments.length&&this.keyLoader.loadClear(e,r.encryptedFragments);const c=this.fragPrevious;if(V(e)&&(!c||e.sn!==c.sn)){const f=this.shouldLoadParts(t.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=f)}if(i=Math.max(e.start,i||0),this.loadingParts&&V(e)){const f=r.partList;if(f&&n){i>e.end&&r.fragmentHint&&(e=r.fragmentHint);const m=this.getNextPart(f,e,i);if(m>-1){const E=f[m];e=this.fragCurrent=E.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${E.index} (${m}/${f.length-1}) of ${this.fragInfo(e,!1,E)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=E.start+E.duration,this.state=De.FRAG_LOADING;let y;return o?y=o.then(w=>!w||this.fragContextChanged(w.frag)?null:this.doFragPartsLoad(e,E,t,n)).catch(w=>this.handleFragLoadError(w)):y=this.doFragPartsLoad(e,E,t,n).catch(w=>this.handleFragLoadError(w)),this.hls.trigger(g.FRAG_LOADING,{frag:e,part:E,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):y}else if(!e.url||this.loadedEndOfParts(f,i))return Promise.resolve(null)}}if(V(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.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} ${r?"["+r.startSN+"-"+r.endSN+"]":""}, target: ${parseFloat(i.toFixed(3))}`),K(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=De.FRAG_LOADING;const u=this.config.progressive;let h;return u&&o?h=o.then(f=>!f||this.fragContextChanged(f==null?void 0:f.frag)?null:this.fragmentLoader.load(e,n)).catch(f=>this.handleFragLoadError(f)):h=Promise.all([this.fragmentLoader.load(e,u?n:void 0),o]).then(([f])=>(!u&&f&&n&&n(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(g.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):h}doFragPartsLoad(e,t,i,n){return new Promise((s,r)=>{var o;const c=[],u=(o=i.details)==null?void 0:o.partList,h=f=>{this.fragmentLoader.loadPart(e,f,n).then(m=>{c[f.index]=m;const E=m.part;this.hls.trigger(g.FRAG_LOADED,m);const y=Vs(i.details,e.sn,f.index+1)||cr(u,e.sn,f.index+1);if(y)h(y);else return s({frag:e,part:E,partsLoaded:c})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===D.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(g.ERROR,t)}else this.hls.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==De.PARSING){!this.fragCurrent&&this.state!==De.STOPPED&&this.state!==De.ERROR&&(this.state=De.IDLE);return}const{frag:i,part:n,level:s}=t,r=self.performance.now();i.stats.parsing.end=r,n&&(n.stats.parsing.end=r);const o=this.getLevelDetails(),u=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(i,n,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e!=null&&e.partList){var i;const s=e.partList[0],r=s.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=r){var n;if((this.hls.hasEnoughToStart?((n=this.media)==null?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:s,part:r}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const o=t[n],c=o.details,u=r>-1?Vs(c,s,r):null,h=u?u.fragment:Nr(c,s,i);return h?(i&&i!==h&&(h.stats=i.stats),{frag:h,part:u,level:o}):null}bufferFragmentData(e,t,i,n,s){var r;if(!e||this.state!==De.PARSING)return;const{data1:o,data2:c}=e;let u=o;if(o&&c&&(u=ct(o,c)),!((r=u)!=null&&r.length))return;const h={type:e.type,frag:t,part:i,chunkMeta:n,parent:t.type,data:u};if(this.hls.trigger(g.BUFFER_APPENDING,h),e.dropped&&e.independent&&!i){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!_t.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=_t.bufferInfo(t,i,0),s=e.duration,r=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),o=Math.max(Math.min(e.start-r,n.end-r),i+r);e.start-o>r&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var i;const n=this.getLoadPosition();if(!K(n))return null;const r=this.lastCurrentTime>n||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,r)}getFwdBufferInfoAtPos(e,t,i,n){const s=_t.bufferInfo(e,t,n);if(s.len===0&&s.nextStart!==void 0){const r=this.fragmentTracker.getBufferedFrag(t,i);if(r&&(s.nextStart<=r.end||r.gap)){const o=Math.max(Math.min(s.nextStart,r.end)-t,n);return _t.bufferInfo(e,t,o)}}return s}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),s=Math.max(e-t*3,i.maxMaxBufferLength/2,n);return s>=n?(i.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=H.MAIN){var i;const n=(i=this.fragmentTracker)==null?void 0:i.getAppendedFrag(e,t);return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:s}=this,r=i[0].start,o=s.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const f=s.initialLiveManifestSize;if(n<f)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${f})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<r){var u;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t,i);const m=this.hls.startPosition,E=this.hls.liveSyncPosition,y=c?(m!==-1&&m>=r?m:E)||c.start:e;this.log(`Setting startPosition to ${y} to match start frag at live edge. mainStart: ${m} liveSyncPosition: ${E} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=y}}else e<=r&&(c=i[0]);if(!c){const f=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,f,t)}let h=this.filterReplacedPrimary(c,t);if(!h&&c){const f=c.sn-t.startSN;h=this.filterReplacedPrimary(i[f+1]||null,t)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===Ft.OK||i===Ft.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,s){let r=null;if(e.gap&&(r=this.getNextFragment(this.nextLoadPosition,t),r&&!r.gap&&i.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(o!==null&&i.len+o.len>=s){const c=r.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if(dr(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(dr(this.hls.config)&&e.type!==H.SUBTITLE){const i=this.hls.interstitialsManager,n=i==null?void 0:i.bufferingItem;if(n){const r=n.event;if(r){if(r.appendInPlace||Math.abs(e.start-n.start)>1||n.start===0)return null}else if(e.end<=n.start&&(t==null?void 0:t.live)===!1||e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}const s=i==null?void 0:i.playerQueue;if(s)for(let r=s.length;r--;){const o=s[r].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.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,i){let n=-1,s=!1,r=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(r=r&&!u.independent,n>-1&&i<u.start)break;const h=u.loaded;h?n=-1:(s||u.independent||r)&&u.fragment===t&&(n=o),s=h}return n}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=Gt(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const s=i.sn+1;if(s>=e.startSN&&s<=e.endSN){const r=t[s-e.startSN];i.cc===r.cc&&(n=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=di(t,i.cc),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:s}=this,{fragments:r,endSN:o}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:u}=n,h=i.partList,f=!!(this.loadingParts&&h!=null&&h.length&&c);f&&c&&!this.bitrateTest&&h[h.length-1].fragment.sn===c.sn&&(r=r.concat(c),o=c.sn);let m;if(e<t){var E;const w=e<this.lastCurrentTime||e>t-u||(E=this.media)!=null&&E.paused||!this.startFragRequested?0:u;m=Ye(s,r,e,w)}else m=r[r.length-1];if(m){const y=m.sn-i.startSN,w=this.fragmentTracker.getState(m);if((w===Ft.OK||w===Ft.PARTIAL&&m.gap)&&(s=m),s&&m.sn===s.sn&&(!f||h[0].fragment.sn>m.sn||!i.live&&!f)&&s&&m.level===s.level){const z=r[y+1];m.sn<o&&this.fragmentTracker.getState(z)!==Ft.OK?m=z:m=null}}return m}alignPlaylists(e,t,i){const n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,r=!t,o=e.alignedSliding&&K(s);if(r||!o&&!s){Ei(i,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),c}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const n=this.timelineOffset;if(i===-1){const s=this.startTimeOffset!==null,r=s?this.startTimeOffset:e.startTimeOffset;r!==null&&K(r)?(i=t+r,r<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${r} found in ${s?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+n}this.nextLoadPosition=i+n}getLoadPosition(){var e;const{media:t}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&V(e)&&e.stats.aborted&&(this.warn(`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!==De.FRAG_LOADING_WAITING_RETRY)&&(this.state=De.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const y=this.getCurrentContext(t.chunkMeta);y&&(t.frag=y.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var n;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const s=t.details===D.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const r=t.errorAction,{action:o,flags:c,retryCount:u=0,retryConfig:h}=r||{},f=!!r&&!!h,m=f&&o===ri.RetryRequest,E=f&&!r.resolved&&c===jt.MoveAllAlternatesMatchingHost;if(!m&&E&&V(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),r.resolved=!0;else if((m||E)&&u<h.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const y=Bt(h,u);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${u+1}/${h.maxNumRetry} in ${y}ms`),r.resolved=!0,this.retryDate=self.performance.now()+y,this.state=De.FRAG_LOADING_WAITING_RETRY}else if(h&&r)if(this.resetFragmentErrors(e),u<h.maxNumRetry)!s&&o!==ri.RemoveAlternatePermanently&&(r.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else o===ri.SendAlternateToPenaltyBox?this.state=De.WAITING_LEVEL:this.state=De.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===De.PARSING||this.state===De.PARSED){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),s=n&&n.len>.5;s&&this.reduceMaxBufferLength(n.len,(t==null?void 0:t.duration)||10);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===H.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==De.STOPPED&&(this.state=De.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=_t.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===De.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==De.STOPPED&&(this.state=De.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,i,n){const s=i.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,u)=>{const h=e.elementaryStreams[u];if(h){const f=h.endPTS-h.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${f})`),c||!1;const m=n?0:ds(s,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS);return this.hls.trigger(g.LEVEL_PTS_UPDATED,{details:s,level:i,drift:m,type:u,frag:e,start:h.startPTS,end:h.endPTS}),!0}return c},!1)){var o;if(i.fragmentError===0&&this.treatAsGap(e,i),((o=this.transmuxer)==null?void 0:o.error)===null){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=De.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(g.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===H.MAIN?"level":"track"}fragInfo(e,t=!0,i){var n,s;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((n=t&&!i?e.startPTS:(i||e).start)!=null?n:NaN).toFixed(3)}-${((s=t&&!i?e.endPTS:(i||e).end)!=null?s:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.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 dr(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class zs{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=pr(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function pr(a,e){const t=new Uint8Array(e);let i=0;for(let n=0;n<a.length;n++){const s=a[n];t.set(s,i),i+=s.length}return t}var us={exports:{}},Cs;function Br(){return Cs||(Cs=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(c,u,h){this.fn=c,this.context=u,this.once=h||!1}function s(c,u,h,f,m){if(typeof h!="function")throw new TypeError("The listener must be a function");var E=new n(h,f||c,m),y=t?t+u:u;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],E]:c._events[y].push(E):(c._events[y]=E,c._eventsCount++),c}function r(c,u){--c._eventsCount===0?c._events=new i:delete c._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],h,f;if(this._eventsCount===0)return u;for(f in h=this._events)e.call(h,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},o.prototype.listeners=function(u){var h=t?t+u:u,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,E=f.length,y=new Array(E);m<E;m++)y[m]=f[m].fn;return y},o.prototype.listenerCount=function(u){var h=t?t+u:u,f=this._events[h];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,h,f,m,E,y){var w=t?t+u:u;if(!this._events[w])return!1;var k=this._events[w],z=arguments.length,ie,q;if(k.fn){switch(k.once&&this.removeListener(u,k.fn,void 0,!0),z){case 1:return k.fn.call(k.context),!0;case 2:return k.fn.call(k.context,h),!0;case 3:return k.fn.call(k.context,h,f),!0;case 4:return k.fn.call(k.context,h,f,m),!0;case 5:return k.fn.call(k.context,h,f,m,E),!0;case 6:return k.fn.call(k.context,h,f,m,E,y),!0}for(q=1,ie=new Array(z-1);q<z;q++)ie[q-1]=arguments[q];k.fn.apply(k.context,ie)}else{var le=k.length,ce;for(q=0;q<le;q++)switch(k[q].once&&this.removeListener(u,k[q].fn,void 0,!0),z){case 1:k[q].fn.call(k[q].context);break;case 2:k[q].fn.call(k[q].context,h);break;case 3:k[q].fn.call(k[q].context,h,f);break;case 4:k[q].fn.call(k[q].context,h,f,m);break;default:if(!ie)for(ce=1,ie=new Array(z-1);ce<z;ce++)ie[ce-1]=arguments[ce];k[q].fn.apply(k[q].context,ie)}}return!0},o.prototype.on=function(u,h,f){return s(this,u,h,f,!1)},o.prototype.once=function(u,h,f){return s(this,u,h,f,!0)},o.prototype.removeListener=function(u,h,f,m){var E=t?t+u:u;if(!this._events[E])return this;if(!h)return r(this,E),this;var y=this._events[E];if(y.fn)y.fn===h&&(!m||y.once)&&(!f||y.context===f)&&r(this,E);else{for(var w=0,k=[],z=y.length;w<z;w++)(y[w].fn!==h||m&&!y[w].once||f&&y[w].context!==f)&&k.push(y[w]);k.length?this._events[E]=k.length===1?k[0]:k:r(this,E)}return this},o.prototype.removeAllListeners=function(u){var h;return u?(h=t?t+u:u,this._events[h]&&r(this,h)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,a.exports=o}(us)),us.exports}var Yo=Br(),Ur=A(Yo);const Zs="1.6.0",Os={};function Xo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Qo(){const a=Os[Zs];if(a)return a.clientCount++,a;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),n={worker:new self.Worker(t),objectURL:t,clientCount:1};return Os[Zs]=n,n}function Jo(a){const e=Os[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,n={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Os[a]=n,n}function qo(a){const e=Os[a||Zs];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete Os[a||Zs],n&&self.URL.revokeObjectURL(n),i.terminate()}}function xa(a,e){return e+10<=a.length&&a[e]===51&&a[e+1]===68&&a[e+2]===73&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function $r(a,e){return e+10<=a.length&&a[e]===73&&a[e+1]===68&&a[e+2]===51&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128}function gr(a,e){let t=0;return t=(a[e]&127)<<21,t|=(a[e+1]&127)<<14,t|=(a[e+2]&127)<<7,t|=a[e+3]&127,t}function Ys(a,e){const t=e;let i=0;for(;$r(a,e);){i+=10;const n=gr(a,e+6);i+=n,xa(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function el(a,e,t,i){const n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[t+2],r=s>>2&15;if(r>12){const E=new Error(`invalid ADTS sampling index:${r}`);a.emit(g.ERROR,g.ERROR,{type:J.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!0,error:E,reason:E.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,h=n[r];let f=r;(o===5||o===29)&&(f-=3);const m=[o<<3|(f&14)>>1,(f&1)<<7|c<<3];return Y.log(`manifest codec:${i}, parsed codec:${u}, channels:${c}, rate:${h} (ADTS object type:${o} sampling index:${r})`),{config:m,samplerate:h,channelCount:c,codec:u,parsedCodec:u,manifestCodec:i}}function Sa(a,e){return a[e]===255&&(a[e+1]&246)===240}function Ta(a,e){return a[e+1]&1?7:9}function Gr(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function tl(a,e){return e+5<a.length}function mr(a,e){return e+1<a.length&&Sa(a,e)}function il(a,e){return tl(a,e)&&Sa(a,e)&&Gr(a,e)<=a.length-e}function nl(a,e){if(mr(a,e)){const t=Ta(a,e);if(e+t>=a.length)return!1;const i=Gr(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||mr(a,n)}return!1}function Aa(a,e,t,i,n){if(!a.samplerate){const s=el(e,t,i,n);if(!s)return;v(a,s)}}function wa(a){return 1024*9e4/a}function sl(a,e){const t=Ta(a,e);if(e+t<=a.length){const i=Gr(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ia(a,e,t,i,n){const s=wa(a.samplerate),r=i+n*s,o=sl(e,t);let c;if(o){const{frameLength:f,headerLength:m}=o,E=m+f,y=Math.max(0,t+E-e.length);y?(c=new Uint8Array(E-m),c.set(e.subarray(t+m,e.length),0)):c=e.subarray(t+m,t+E);const w={unit:c,pts:r};return y||a.samples.push(w),{sample:w,length:E,missing:y}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:r},length:u,missing:-1}}function rl(a,e){return $r(a,e)&&gr(a,e+6)+10<=a.length-e}function al(a){if(a.size<2)return;const e=Q(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function ol(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=Q(a.data.subarray(t),!0);t+=i.length+1;const n=Q(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=Q(a.data.subarray(1));return{key:a.type,info:"",data:e}}function ll(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=Q(a.data.subarray(t),!0);t+=i.length+1;const n=Q(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=Q(a.data);return{key:a.type,info:"",data:e}}function ul(a){return btoa(String.fromCharCode(...a))}function Ra(a,e){if(a<0)return-Ra(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const n=Math.floor(a*t);return(n%2===0?n:n+1)/t}else return Math.round(a*t)/t}function cl(a,e){const t=new URL(a),i=new URL(e);if(t.origin!==i.origin)return a;const n=t.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1);for(;n[0]===s[0];)n.shift(),s.shift();for(;s.length;)s.shift(),n.unshift("..");return n.join("/")}function hl(){try{return crypto.randomUUID()}catch(a){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?s:s&3|8).toString(16)})}}}function fl(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function Kr(a,e=0,t=1/0){return dl(a,e,t,Uint8Array)}function dl(a,e,t,i){const n=pl(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=gl(a)?a.byteOffset:0,o=(r+a.byteLength)/s,c=(r+e)/s,u=Math.floor(Math.max(0,Math.min(c,o))),h=Math.floor(Math.min(u+Math.max(t,0),o));return new i(n,u,h-u)}function pl(a){return a instanceof ArrayBuffer?a:a.buffer}function gl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function ml(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=a.data.subarray(1).indexOf(0);if(i===-1)return;const n=Q(Kr(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=Q(Kr(a.data,3+i,r));let c;return n==="-->"?c=Q(Kr(a.data,4+i+r)):c=fl(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function _l(a){return a.type==="PRIV"?al(a):a.type[0]==="W"?ll(a):a.type==="APIC"?ml(a):ol(a)}function vl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=gr(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const _r=10,yl=10;function La(a){let e=0;const t=[];for(;$r(a,e);){const i=gr(a,e+6);a[e+5]>>6&1&&(e+=_r),e+=_r;const n=e+i;for(;e+yl<n;){const s=vl(a.subarray(e)),r=_l(s);r&&t.push(r),e+=s.size+_r}xa(a,e)&&(e+=_r)}return t}function Da(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function El(a){if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function Hr(a){const e=La(a);for(let t=0;t<e.length;t++){const i=e[t];if(Da(i))return El(i)}}let Pn=function(a){return a.audioId3="org.id3",a.dateRange="com.apple.quicktime.HLS",a.emsg="https://aomedia.org/emsg/ID3",a.misbklv="urn:misb:KLV:bin:1910.1",a}({});function ns(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Wr{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,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=ct(this.cachedData,e),this.cachedData=null);let i=Ys(e,0),n=i?i.length:0,s;const r=this._audioTrack,o=this._id3Track,c=i?Hr(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&K(c))&&(this.basePTS=bl(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Pn.audioId3,duration:Number.POSITIVE_INFINITY});n<u;){if(this.canParse(e,n)){const h=this.appendFrame(r,e,n);h?(this.frameIndex++,this.lastPTS=h.sample.pts,n+=h.length,s=n):n=u}else rl(e,n)?(i=Ys(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Pn.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,s=n):n++;if(n===u&&s!==u){const h=e.slice(s);this.cachedData?this.cachedData=ct(this.cachedData,h):this.cachedData=h}}return{audioTrack:r,videoTrack:ns(),id3Track:o,textTrack:ns()}}demuxSampleAes(e,t,i){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:ns(),id3Track:this._id3Track,textTrack:ns()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const bl=(a,e,t)=>{if(K(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let vr=null;const xl=[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],Sl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Tl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Al=[0,1,1,4];function Ca(a,e,t,i,n){if(t+24>e.length)return;const s=Oa(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=i+n*r,c={unit:e.subarray(t,t+s.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=s.channelCount,a.samplerate=s.sampleRate,a.samples.push(c),{sample:c,length:s.frameLength,missing:0}}}function Oa(a,e){const t=a[e+1]>>3&3,i=a[e+1]>>1&3,n=a[e+2]>>4&15,s=a[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&s!==3){const r=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-i:i===3?3:4,u=xl[c*14+n-1]*1e3,f=Sl[(t===3?0:t===2?1:2)*3+s],m=o===3?1:2,E=Tl[t][i],y=Al[i],w=E*8*y,k=Math.floor(E*u/f+r)*y;if(vr===null){const q=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);vr=q?parseInt(q[1]):0}return!!vr&&vr<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:m,frameLength:k,samplesPerFrame:w}}}function jr(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Pa(a,e){return e+1<a.length&&jr(a,e)}function wl(a,e){return jr(a,e)&&4<=a.length-e}function ka(a,e){if(e+1<a.length&&jr(a,e)){const i=Oa(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||Pa(a,s)}return!1}class Il extends Wr{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=Ys(e,0);let n=(i==null?void 0:i.length)||0;if(ka(e,n))return!1;for(let s=e.length;n<s;n++)if(nl(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return il(e,t)}appendFrame(e,t,i){Aa(e,this.observer,t,i,e.manifestCodec);const n=Ia(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const Ma=(a,e)=>{let t=0,i=5;e+=i;const n=new Uint32Array(1),s=new Uint32Array(1),r=new Uint8Array(1);for(;i>0;){r[0]=a[e];const o=Math.min(i,8),c=8-o;s[0]=4278190080>>>24+c<<c,n[0]=(r[0]&s[0])>>c,t=t?t<<o|n[0]:n[0],e+=1,i-=o}return t};class Rl extends Wr{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const n=Na(e,t,i,this.basePTS,this.frameIndex);if(n!==-1)return{sample:e.samples[e.samples.length-1],length:n,missing:0}}static probe(e){if(!e)return!1;const t=Ys(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Hr(t)!==void 0&&Ma(e,i)<16}}function Na(a,e,t,i,n){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],c=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+s]*2;if(t+h>e.length)return-1;const f=e[t+6]>>5;let m=0;f===2?m+=2:(f&1&&f!==1&&(m+=2),f&4&&(m+=2));const E=(e[t+6]<<8|e[t+7])>>12-m&1,w=[2,1,2,3,3,4,4,5][f]+E,k=e[t+5]>>3,z=e[t+5]&7,ie=new Uint8Array([s<<6|k<<1|z>>2,(z&3)<<6|f<<3|E<<2|c>>4,c<<4&224]),q=1536/o*9e4,le=i+n*q,ce=e.subarray(t,t+h);return a.config=ie,a.channelCount=w,a.samplerate=o,a.samples.push({unit:ce,pts:le}),h}class Ll extends Wr{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Ys(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Hr(t)!==void 0&&Ma(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(ka(e,i))return Y.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return wl(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Ca(e,t,i,this.basePTS,this.frameIndex)}}const Dl=/\/emsg[-/]ID3/i;class Cl{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,i,n){const s=this.videoTrack=ns("video",1),r=this.audioTrack=ns("audio",1),o=this.txtTrack=ns("text",1);if(this.id3Track=ns("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=Be(e);if(c.video){const{id:u,timescale:h,codec:f,supplemental:m}=c.video;s.id=u,s.timescale=o.timescale=h,s.codec=f,s.supplemental=m}if(c.audio){const{id:u,timescale:h,codec:f}=c.audio;r.id=u,r.timescale=h,r.codec=f}o.id=ft.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return _e(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=ct(this.remainderData,e));const o=Ut(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=Ct(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:r,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(t,this.timeOffset);return i.samples=Ct(e,t),{videoTrack:t,audioTrack:ns(),id3Track:n,textTrack:ns()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=be(e.samples,["emsg"]);n&&n.forEach(s=>{const r=bt(s);if(Dl.test(r.schemeIdUri)){const o=Fa(r,t);let c=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=r.payload;i.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Pn.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=Fa(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Pn.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){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 Fa(a,e){return K(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Ol{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new gn(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,_i.cbc)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const s=n.subarray(16,n.length-n.length%16),r=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(r).then(o=>{const c=new Uint8Array(o);n.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)i.set(e.subarray(s,s+16),n);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)e.set(i.subarray(n,n+16),s);return e}decryptAvcSample(e,t,i,n,s){const r=xi(s.data),o=this.getAvcEncryptedData(r);this.decryptBuffer(o.buffer).then(c=>{s.data=this.getAvcDecryptedUnit(r,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)})}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){n();return}const s=e[t].units;for(;!(i>=s.length);i++){const r=s[i];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,i,n,r),!this.decrypter.isSync()))return}}}}class Ba{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,n;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const s=i.units;n=s[s.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,n=i.length;if(n){const s=i[n-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let s=e.naluState||0;const r=s,o=[];let c=0,u,h,f,m=-1,E=0;for(s===-1&&(m=0,E=this.getNALuType(t,0),s=0,c=1);c<n;){if(u=t[c++],!s){s=u?0:1;continue}if(s===1){s=u?0:2;continue}if(!u)s=3;else if(u===1){if(h=c-s-1,m>=0){const y={data:t.subarray(m,h),type:E};o.push(y)}else{const y=this.getLastNalUnit(e.samples);y&&(r&&c<=4-r&&y.state&&(y.data=y.data.subarray(0,y.data.byteLength-r)),h>0&&(y.data=ct(y.data,t.subarray(0,h)),y.state=0))}c<n?(f=this.getNALuType(t,c),m=c,E=f,s=0):s=-1}else s=0}if(m>=0&&s>=0){const y={data:t.subarray(m,n),type:E,state:s};o.push(y)}if(o.length===0){const y=this.getLastNalUnit(e.samples);y&&(y.data=ct(y.data,t))}return e.naluState=s,o}}class Xs{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,i=e.byteLength-t,n=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");n.set(e.subarray(i,i+s)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}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 i=this.word>>>32-t;if(e>32&&Y.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?i<<t|this.readBits(t):i}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 Ua extends Ba{parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var h,f;switch(u.type){case 1:{let w=!1;o=!0;const k=u.data;if(c&&k.length>4){const z=this.readSliceType(k);(z===2||z===4||z===7||z===9)&&(w=!0)}if(w){var m;(m=r)!=null&&m.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.frame=!0,r.key=w;break}case 5:o=!0,(h=r)!=null&&h.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 6:{o=!0,Xe(u.data,1,i.pts,t.samples);break}case 7:{var E,y;o=!0,c=!0;const w=u.data,k=this.readSPS(w);if(!e.sps||e.width!==k.width||e.height!==k.height||((E=e.pixelRatio)==null?void 0:E[0])!==k.pixelRatio[0]||((y=e.pixelRatio)==null?void 0:y[1])!==k.pixelRatio[1]){e.width=k.width,e.height=k.height,e.pixelRatio=k.pixelRatio,e.sps=[w];const z=w.subarray(1,4);let ie="avc1.";for(let q=0;q<3;q++){let le=z[q].toString(16);le.length<2&&(le="0"+le),ie+=le}e.codec=ie}break}case 8:o=!0,e.pps=[u.data];break;case 9:o=!0,e.audFound=!0,(f=r)!=null&&f.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:o=!0;break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Xs(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,n=8,s;for(let r=0;r<e;r++)n!==0&&(s=t.readEG(),n=(i+s+256)%256),i=n===0?i:n}readSPS(e){const t=new Xs(e);let i=0,n=0,s=0,r=0,o,c,u;const h=t.readUByte.bind(t),f=t.readBits.bind(t),m=t.readUEG.bind(t),E=t.readBoolean.bind(t),y=t.skipBits.bind(t),w=t.skipEG.bind(t),k=t.skipUEG.bind(t),z=this.skipScalingList.bind(this);h();const ie=h();if(f(5),y(3),h(),k(),ie===100||ie===110||ie===122||ie===244||ie===44||ie===83||ie===86||ie===118||ie===128){const Ee=m();if(Ee===3&&y(1),k(),k(),y(1),E())for(c=Ee!==3?8:12,u=0;u<c;u++)E()&&(u<6?z(16,t):z(64,t))}k();const q=m();if(q===0)m();else if(q===1)for(y(1),w(),w(),o=m(),u=0;u<o;u++)w();k(),y(1);const le=m(),ce=m(),Se=f(1);Se===0&&y(1),y(1),E()&&(i=m(),n=m(),s=m(),r=m());let he=[1,1];if(E()&&E())switch(h()){case 1:he=[1,1];break;case 2:he=[12,11];break;case 3:he=[10,11];break;case 4:he=[16,11];break;case 5:he=[40,33];break;case 6:he=[24,11];break;case 7:he=[20,11];break;case 8:he=[32,11];break;case 9:he=[80,33];break;case 10:he=[18,11];break;case 11:he=[15,11];break;case 12:he=[64,33];break;case 13:he=[160,99];break;case 14:he=[4,3];break;case 15:he=[3,2];break;case 16:he=[2,1];break;case 255:{he=[h()<<8|h(),h()<<8|h()];break}}return{width:Math.ceil((le+1)*16-i*2-n*2),height:(2-Se)*(ce+1)*16-(Se?2:4)*(s+r),pixelRatio:he}}}class $a extends Ba{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var h,f;switch(u.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var m;(m=r)!=null&&m.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 19:case 20:o=!0,(h=r)!=null&&h.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 39:o=!0,Xe(u.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=v(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(o=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],u.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const E=this.readSPS(u.data);e.width=E.width,e.height=E.height,e.pixelRatio=E.pixelRatio,e.codec=E.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const y in E.params)e.params[y]=E.params[y]}this.pushParameterSet(e.sps,u.data,e.vps),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const E=this.readPPS(u.data);for(const y in E)e.params[y]=E[y]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(f=r)!=null&&f.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n<e.byteLength;n++)n>=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Xs(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:n}}readSPS(e){const t=new Xs(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),s=t.readBoolean(),r=t.readBits(5),o=t.readUByte(),c=t.readUByte(),u=t.readUByte(),h=t.readUByte(),f=t.readUByte(),m=t.readUByte(),E=t.readUByte(),y=t.readUByte(),w=t.readUByte(),k=t.readUByte(),z=t.readUByte(),ie=[],q=[];for(let pi=0;pi<i;pi++)ie.push(t.readBoolean()),q.push(t.readBoolean());if(i>0)for(let pi=i;pi<8;pi++)t.readBits(2);for(let pi=0;pi<i;pi++)ie[pi]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),q[pi]&&t.readUByte();t.readUEG();const le=t.readUEG();le==3&&t.skipBits(1);const ce=t.readUEG(),Se=t.readUEG(),he=t.readBoolean();let Ee=0,Re=0,ge=0,$e=0;he&&(Ee+=t.readUEG(),Re+=t.readUEG(),ge+=t.readUEG(),$e+=t.readUEG());const Ve=t.readUEG(),Xt=t.readUEG(),Lt=t.readUEG(),vt=t.readBoolean();for(let pi=vt?0:i;pi<=i;pi++)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 yn=0;yn<4;yn++)for(let Kn=0;Kn<(yn===3?2:6);Kn++)if(!t.readBoolean())t.readUEG();else{const Jn=Math.min(64,1<<4+(yn<<1));yn>1&&t.readEG();for(let Us=0;Us<Jn;Us++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const ht=t.readUEG();let Ge=0;for(let pi=0;pi<ht;pi++){let yn=!1;if(pi!==0&&(yn=t.readBoolean()),yn){pi===ht&&t.readUEG(),t.readBoolean(),t.readUEG();let Kn=0;for(let Ts=0;Ts<=Ge;Ts++){const Jn=t.readBoolean();let Us=!1;Jn||(Us=t.readBoolean()),(Jn||Us)&&Kn++}Ge=Kn}else{const Kn=t.readUEG(),Ts=t.readUEG();Ge=Kn+Ts;for(let Jn=0;Jn<Kn;Jn++)t.readUEG(),t.readBoolean();for(let Jn=0;Jn<Ts;Jn++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const pi=t.readUEG();for(let yn=0;yn<pi;yn++){for(let Kn=0;Kn<Lt+4;Kn++)t.readBits(1);t.readBits(1)}}let Pt=0,Dt=1,zt=1,fi=!0,bi=1,Li=0;t.readBoolean(),t.readBoolean();let An=!1;if(t.readBoolean()){if(t.readBoolean()){const As=t.readUByte(),Ko=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Dr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];As>0&&As<16?(Dt=Ko[As-1],zt=Dr[As-1]):As===255&&(Dt=t.readBits(16),zt=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(),An=t.readBoolean(),An&&(Ee+=t.readUEG(),Re+=t.readUEG(),ge+=t.readUEG(),$e+=t.readUEG()),t.readBoolean()&&(bi=t.readBits(32),Li=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Dr=t.readBoolean(),Ho=t.readBoolean();let ir=!1;(Dr||Ho)&&(ir=t.readBoolean(),ir&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),ir&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Wo=0;Wo<=i;Wo++){fi=t.readBoolean();const qc=fi||t.readBoolean();let jo=!1;qc?t.readEG():jo=t.readBoolean();const Vo=jo?1:t.readUEG()+1;if(Dr)for(let nr=0;nr<Vo;nr++)t.readUEG(),t.readUEG(),ir&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Ho)for(let nr=0;nr<Vo;nr++)t.readUEG(),t.readUEG(),ir&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Pt=t.readUEG())}let vs=ce,Go=Se;if(he||An){let pi=1,yn=1;le===1?pi=yn=2:le==2&&(pi=2),vs=ce-pi*Re-pi*Ee,Go=Se-yn*$e-yn*ge}const Qc=n?["A","B","C"][n]:"",Jc=o<<24|c<<16|u<<8|h;let Ea=0;for(let pi=0;pi<32;pi++)Ea=(Ea|(Jc>>pi&1)<<31-pi)>>>0;let ba=Ea.toString(16);return r===1&&ba==="2"&&(ba="6"),{codecString:`hvc1.${Qc}${r}.${ba}.${s?"H":"L"}${z}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[o,c,u,h],general_constraint_indicator_flags:[f,m,E,y,w,k],general_level_idc:z,bit_depth:Ve+8,bit_depth_luma_minus8:Ve,bit_depth_chroma_minus8:Xt,min_spatial_segmentation_idc:Pt,chroma_format_idc:le,frame_rate:{fixed:fi,fps:Li/bi}},width:vs,height:Go,pixelRatio:[Dt,zt]}}readPPS(e){const t=new Xs(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),s=t.readBoolean();let r=1;return s&&n?r=0:s?r=3:n&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const hn=188;class ps{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=ps.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(hn*5,t-hn)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=hn)if(e[c]===71&&(t-c===hn||e[c+hn]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+hn*99,e.length-hn)+1)),s||(s=Vr(e,c)===0),s&&o>1&&(r===0&&o>2||c+hn>i))return r}else{if(o)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:ft[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=ps.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=ps.createTrack("audio",n),this._id3Track=ps.createTrack("id3"),this._txtTrack=ps.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){i||(this.sampleAes=null);let s;const r=this._videoTrack,o=this._audioTrack,c=this._id3Track,u=this._txtTrack;let h=r.pid,f=r.pesData,m=o.pid,E=c.pid,y=o.pesData,w=c.pesData,k=null,z=this.pmtParsed,ie=this._pmtId,q=e.length;if(this.remainderData&&(e=ct(this.remainderData,e),q=e.length,this.remainderData=null),q<hn&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const le=Math.max(0,ps.syncOffset(e));q-=(q-le)%hn,q<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,q,e.buffer.byteLength-q));let ce=0;for(let he=le;he<q;he+=hn)if(e[he]===71){const Ee=!!(e[he+1]&64),Re=Vr(e,he),ge=(e[he+3]&48)>>4;let $e;if(ge>1){if($e=he+5+e[he+4],$e===he+hn)continue}else $e=he+4;switch(Re){case h:if(Ee){if(f&&(s=Ps(f,this.logger))){if(this.videoParser===null)switch(r.segmentCodec){case"avc":this.videoParser=new Ua;break;case"hevc":this.videoParser=new $a;break}this.videoParser!==null&&this.videoParser.parsePES(r,u,s,!1)}f={data:[],size:0}}f&&(f.data.push(e.subarray($e,he+hn)),f.size+=he+hn-$e);break;case m:if(Ee){if(y&&(s=Ps(y,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s);break}y={data:[],size:0}}y&&(y.data.push(e.subarray($e,he+hn)),y.size+=he+hn-$e);break;case E:Ee&&(w&&(s=Ps(w,this.logger))&&this.parseID3PES(c,s),w={data:[],size:0}),w&&(w.data.push(e.subarray($e,he+hn)),w.size+=he+hn-$e);break;case 0:Ee&&($e+=e[$e]+1),ie=this._pmtId=Pl(e,$e);break;case ie:{Ee&&($e+=e[$e]+1);const Ve=kl(e,$e,this.typeSupported,i,this.observer,this.logger);h=Ve.videoPid,h>0&&(r.pid=h,r.segmentCodec=Ve.segmentVideoCodec),m=Ve.audioPid,m>0&&(o.pid=m,o.segmentCodec=Ve.segmentAudioCodec),E=Ve.id3Pid,E>0&&(c.pid=E),k!==null&&!z&&(this.logger.warn(`MPEG-TS PMT found at ${he} after unknown PID '${k}'. Backtracking to sync byte @${le} to parse all TS packets.`),k=null,he=le-188),z=this.pmtParsed=!0;break}case 17:case 8191:break;default:k=Re;break}}else ce++;ce>0&&zr(this.observer,new Error(`Found ${ce} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=y,c.pesData=w;const Se={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return n&&this.extractRemainingSamples(Se),Se}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:i,id3Track:n,textTrack:s}=e,r=i.pesData,o=t.pesData,c=n.pesData;let u;if(r&&(u=Ps(r,this.logger))){if(this.videoParser===null)switch(i.segmentCodec){case"avc":this.videoParser=new Ua;break;case"hevc":this.videoParser=new $a;break}this.videoParser!==null&&(this.videoParser.parsePES(i,s,u,!0),i.pesData=null)}else i.pesData=r;if(o&&(u=Ps(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,u);break;case"mp3":this.parseMPEGPES(t,u);break;case"ac3":this.parseAC3PES(t,u);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;c&&(u=Ps(c,this.logger))?(this.parseID3PES(n,u),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new Ol(this.observer,this.config,t);return this.decrypt(n,s)}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:s}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{i(e)}):i(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{i(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 i=0;const n=this.aacOverFlow;let s=t.data;if(n){this.aacOverFlow=null;const f=n.missing,m=n.sample.unit.byteLength;if(f===-1)s=ct(n.sample.unit,s);else{const E=m-f;n.sample.unit.set(s.subarray(0,f),E),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!mr(s,r);r++);if(r!==i){let f;const m=r<o-1;if(m?f=`AAC PES did not start with ADTS header,offset:${r}`:f="No ADTS header found in AAC PES",zr(this.observer,new Error(f),m,this.logger),!m)return}Aa(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(n){const f=wa(e.samplerate);c=n.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,h;for(;r<o;)if(h=Ia(e,s,r,c,u),r+=h.length,h.missing){this.aacOverFlow=h;break}else for(u++;r<o-1&&!mr(s,r);r++);}parseMPEGPES(e,t){const i=t.data,n=i.length;let s=0,r=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<n;)if(Pa(i,r)){const c=Ca(e,i,r,o,s);if(c)r+=c.length,s++;else break}else r++}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(n===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=i.length;let r=0,o=0,c;for(;o<s&&(c=Na(e,i,o,n,r++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=v({},t,{type:this._videoTrack?Pn.emsg:Pn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Vr(a,e){return((a[e+1]&31)<<8)+a[e+2]}function Pl(a,e){return(a[e+10]&31)<<8|a[e+11]}function kl(a,e,t,i,n,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(a[e+1]&15)<<8|a[e+2],c=e+3+o-4,u=(a[e+10]&15)<<8|a[e+11];for(e+=12+u;e<c;){const h=Vr(a,e),f=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){Zr("ADTS AAC",s);break}case 15:r.audioPid===-1&&(r.audioPid=h);break;case 21:r.id3Pid===-1&&(r.id3Pid=h);break;case 219:if(!i){Zr("H.264",s);break}case 27:r.videoPid===-1&&(r.videoPid=h);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=h,r.segmentAudioCodec="mp3");break;case 193:if(!i){Zr("AC-3",s);break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=h,r.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&f>0){let m=e+5,E=f;for(;E>2;){switch(a[m]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=h,r.segmentAudioCodec="ac3");break}const w=a[m+1]+2;m+=w,E-=w}}break;case 194:case 135:return zr(n,new Error("Unsupported EC-3 in M2TS found"),void 0,s),r;case 36:r.videoPid===-1&&(r.videoPid=h,r.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=f+5}return r}function zr(a,e,t,i){i.warn(`parsing error: ${e.message}`),a.emit(g.ERROR,g.ERROR,{type:J.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Zr(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Ps(a,e){let t=0,i,n,s,r,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=ct(c[0],c[1]),c.splice(1,1);if(i=c[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(n=(i[4]<<8)+i[5],n&&n>a.size-6)return null;const h=i[7];h&192&&(r=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,h&64?(o=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,r-o>60*9e4&&(e.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=i[8];let f=s+9;if(a.size<=f)return null;a.size-=f;const m=new Uint8Array(a.size);for(let E=0,y=c.length;E<y;E++){i=c[E];let w=i.byteLength;if(f)if(f>w){f-=w;continue}else i=i.subarray(f),w-=f,f=0;m.set(i,t),t+=w}return n&&(n-=s+3),{data:m,pts:r,dts:o,len:n}}return null}class Ml{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 gs=Math.pow(2,32)-1;class me{static init(){me.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 me.types)me.types.hasOwnProperty(e)&&(me.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]),i=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]);me.HDLR_TYPES={video:t,audio:i};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);me.STTS=me.STSC=me.STCO=s,me.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),me.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),me.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),me.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const r=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);me.FTYP=me.box(me.types.ftyp,r,c,r,o),me.DINF=me.box(me.types.dinf,me.box(me.types.dref,n))}static box(e,...t){let i=8,n=t.length;const s=n;for(;n--;)i+=t[n].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(e,4),n=0,i=8;n<s;n++)r.set(t[n],i),i+=t[n].byteLength;return r}static hdlr(e){return me.box(me.types.hdlr,me.HDLR_TYPES[e])}static mdat(e){return me.box(me.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(gs+1)),n=Math.floor(t%(gs+1));return me.box(me.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,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,85,196,0,0]))}static mdia(e){return me.box(me.types.mdia,me.mdhd(e.timescale||0,e.duration||0),me.hdlr(e.type),me.minf(e))}static mfhd(e){return me.box(me.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"?me.box(me.types.minf,me.box(me.types.smhd,me.SMHD),me.DINF,me.stbl(e)):me.box(me.types.minf,me.box(me.types.vmhd,me.VMHD),me.DINF,me.stbl(e))}static moof(e,t,i){return me.box(me.types.moof,me.mfhd(e),me.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=me.trak(e[t]);return me.box.apply(null,[me.types.moov,me.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(me.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=me.trex(e[t]);return me.box.apply(null,[me.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(gs+1)),n=Math.floor(t%(gs+1)),s=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,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return me.box(me.types.mvhd,s)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,s;for(n=0;n<t.length;n++)s=t[n].flags,i[n+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return me.box(me.types.sdtp,i)}static stbl(e){return me.box(me.types.stbl,me.stsd(e),me.box(me.types.stts,me.STTS),me.box(me.types.stsc,me.STSC),me.box(me.types.stsz,me.STSZ),me.box(me.types.stco,me.STCO))}static avc1(e){let t=[],i=[],n,s,r;for(n=0;n<e.sps.length;n++)s=e.sps[n],r=s.byteLength,t.push(r>>>8&255),t.push(r&255),t=t.concat(Array.prototype.slice.call(s));for(n=0;n<e.pps.length;n++)s=e.pps[n],r=s.byteLength,i.push(r>>>8&255),i.push(r&255),i=i.concat(Array.prototype.slice.call(s));const o=me.box(me.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),c=e.width,u=e.height,h=e.pixelRatio[0],f=e.pixelRatio[1];return me.box(me.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,me.box(me.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),me.box(me.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&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 me.box(me.types.mp4a,me.audioStsd(e),me.box(me.types.esds,me.esds(e)))}static mp3(e){return me.box(me.types[".mp3"],me.audioStsd(e))}static ac3(e){return me.box(me.types["ac-3"],me.audioStsd(e),me.box(me.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return me.box(me.types.stsd,me.STSD,me.mp4a(e));if(t==="ac3"&&e.config)return me.box(me.types.stsd,me.STSD,me.ac3(e));if(t==="mp3"&&e.codec==="mp3")return me.box(me.types.stsd,me.STSD,me.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return me.box(me.types.stsd,me.STSD,me.avc1(e));if(t==="hevc"&&e.vps)return me.box(me.types.stsd,me.STSD,me.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,i=(e.duration||0)*(e.timescale||0),n=e.width||0,s=e.height||0,r=Math.floor(i/(gs+1)),o=Math.floor(i%(gs+1));return me.box(me.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,r>>24,r>>16&255,r>>8&255,r&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,n&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const i=me.sdtp(e),n=e.id,s=Math.floor(t/(gs+1)),r=Math.floor(t%(gs+1));return me.box(me.types.traf,me.box(me.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),me.box(me.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255])),me.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,me.box(me.types.trak,me.tkhd(e),me.mdia(e))}static trex(e){const t=e.id;return me.box(me.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 i=e.samples||[],n=i.length,s=12+16*n,r=new Uint8Array(s);let o,c,u,h,f,m;for(t+=8+s,r.set([e.type==="video"?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<n;o++)c=i[o],u=c.duration,h=c.size,f=c.flags,m=c.cts,r.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,m>>>24&255,m>>>16&255,m>>>8&255,m&255],12+16*o);return me.box(me.types.trun,r)}static initSegment(e){me.types||me.init();const t=me.moov(e);return ct(me.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],n=4,s=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),n-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let r=s.length;for(let y=0;y<i.length;y+=1){r+=3;for(let w=0;w<i[y].length;w+=1)r+=2+i[y][w].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let y=0;y<i.length;y+=1){o.set(new Uint8Array([32+y|(y===c?128:0),0,i[y].length]),r),r+=3;for(let w=0;w<i[y].length;w+=1)o.set(new Uint8Array([i[y][w].length>>8,i[y][w].length&255]),r),r+=2,o.set(i[y][w],r),r+=i[y][w].length}const u=me.box(me.types.hvcC,o),h=e.width,f=e.height,m=e.pixelRatio[0],E=e.pixelRatio[1];return me.box(me.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,h>>8&255,h&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]),u,me.box(me.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),me.box(me.types.pasp,new Uint8Array([m>>24,m>>16&255,m>>8&255,m&255,E>>24,E>>16&255,E>>8&255,E&255])))}}me.types=void 0,me.HDLR_TYPES=void 0,me.STTS=void 0,me.STSC=void 0,me.STCO=void 0,me.STSZ=void 0,me.VMHD=void 0,me.SMHD=void 0,me.STSD=void 0,me.FTYP=void 0,me.DINF=void 0;const Ga=9e4;function Yr(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function Nl(a,e,t=1,i=!1){return Yr(a,e,1/t,i)}function Qs(a,e=!1){return Yr(a,1e3,1/Ga,e)}function Fl(a,e=1){return Yr(a,Ga,1/e)}const Bl=10*1e3,Ul=1024,$l=1152,Gl=1536;let ks=null,Xr=null;function Ka(a,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class yr{constructor(e,t,i,n){if(this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.ISGenerated=!1,ks===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ks=r?parseInt(r[1]):0}if(Xr===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Xr=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((s,r)=>{let o=r.pts,c=o-s;return c<-4294967296&&(t=!0,o=$n(o,i),c=o-s),c>0?s:o},i);return t&&this.logger.debug("PTS rollover detected"),n}remux(e,t,i,n,s,r,o,c){let u,h,f,m,E,y,w=s,k=s;const z=e.pid>-1,ie=t.pid>-1,q=t.samples.length,le=e.samples.length>0,ce=o&&q>0||q>1;if((!z||le)&&(!ie||ce)||this.ISGenerated||o){if(this.ISGenerated){var he,Ee,Re,ge;const Lt=this.videoTrackConfig;(Lt&&(t.width!==Lt.width||t.height!==Lt.height||((he=t.pixelRatio)==null?void 0:he[0])!==((Ee=Lt.pixelRatio)==null?void 0:Ee[0])||((Re=t.pixelRatio)==null?void 0:Re[1])!==((ge=Lt.pixelRatio)==null?void 0:ge[1]))||!Lt&&ce||this.nextAudioPts===null&&le)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const $e=this.isVideoContiguous;let Ve=-1,Xt;if(ce&&(Ve=Kl(t.samples),!$e&&this.config.forceKeyFrameOnDiscontinuity))if(y=!0,Ve>0){this.logger.warn(`[mp4-remuxer]: Dropped ${Ve} out of ${q} video samples due to a missing keyframe`);const Lt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Ve),t.dropped+=Ve,k+=(t.samples[0].pts-Lt)/t.inputTimeScale,Xt=k}else Ve===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${q} video samples`),y=!1);if(this.ISGenerated){if(le&&ce){const Lt=this.getVideoStartPts(t.samples),et=($n(e.samples[0].pts,Lt)-Lt)/t.inputTimeScale;w+=Math.max(0,et),k+=Math.max(0,-et)}if(le){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),h=this.remuxAudio(e,w,this.isAudioContiguous,r,ie||ce||c===H.AUDIO?k:void 0),ce){const Lt=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),f=this.generateIS(e,t,s,r)),u=this.remuxVideo(t,k,$e,Lt)}}else ce&&(u=this.remuxVideo(t,k,$e,0));u&&(u.firstKeyFrame=Ve,u.independent=Ve!==-1,u.firstKeyFramePTS=Xt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(E=Ha(i,s,this._initPTS,this._initDTS)),n.samples.length&&(m=Wa(n,s,this._initPTS))),{audio:h,video:u,initSegment:f,independent:y,text:m,id3:E}}generateIS(e,t,i,n){const s=e.samples,r=t.samples,o=this.typeSupported,c={},u=this._initPTS;let h=!u||n,f="audio/mp4",m,E,y;if(h&&(m=E=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):me.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(y=e.inputTimeScale,!u||y!==u.timescale?m=E=s[0].pts-Math.round(y*i):h=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:me.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(y=t.inputTimeScale,!u||y!==u.timescale){const w=this.getVideoStartPts(r),k=Math.round(y*i);E=Math.min(E,$n(r[0].dts,w)-k),m=Math.min(m,w-k)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,h?(this._initPTS={baseTime:m,timescale:y},this._initDTS={baseTime:E,timescale:y}):m=y=void 0,{tracks:c,initPTS:m,timescale:y}}remuxVideo(e,t,i,n){const s=e.inputTimeScale,r=e.samples,o=[],c=r.length,u=this._initPTS;let h=this.nextAvcDts,f=8,m=this.videoSampleDuration,E,y,w=Number.POSITIVE_INFINITY,k=Number.NEGATIVE_INFINITY,z=!1;if(!i||h===null){const Ge=t*s,He=r[0].pts-$n(r[0].dts,r[0].pts);ks&&h!==null&&Math.abs(Ge-He-h)<15e3?i=!0:h=Ge-He}const ie=u.baseTime*s/u.timescale;for(let Ge=0;Ge<c;Ge++){const He=r[Ge];He.pts=$n(He.pts-ie,h),He.dts=$n(He.dts-ie,h),He.dts<r[Ge>0?Ge-1:Ge].dts&&(z=!0)}z&&r.sort(function(Ge,He){const Pt=Ge.dts-He.dts,Dt=Ge.pts-He.pts;return Pt||Dt}),E=r[0].dts,y=r[r.length-1].dts;const q=y-E,le=q?Math.round(q/(c-1)):m||e.inputTimeScale/30;if(i){const Ge=E-h,He=Ge>le,Pt=Ge<-1;if((He||Pt)&&(He?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Qs(Ge,!0)} ms (${Ge}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Qs(-Ge,!0)} ms (${Ge}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Pt||h>=r[0].pts||ks)){E=h;const Dt=r[0].pts-Ge;if(He)r[0].dts=E,r[0].pts=Dt;else{let zt=!0;for(let fi=0;fi<r.length&&!(r[fi].dts>Dt&&zt);fi++){const bi=r[fi].pts;if(r[fi].dts-=Ge,r[fi].pts-=Ge,fi<r.length-1){const Li=r[fi+1].pts,An=r[fi].pts,Cn=Li<=An,vs=Li<=bi;zt=Cn==vs}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${Qs(Dt,!0)}/${Qs(E,!0)}, delta: ${Qs(Ge,!0)} ms`)}}E=Math.max(0,E);let ce=0,Se=0,he=E;for(let Ge=0;Ge<c;Ge++){const He=r[Ge],Pt=He.units,Dt=Pt.length;let zt=0;for(let fi=0;fi<Dt;fi++)zt+=Pt[fi].data.length;Se+=zt,ce+=Dt,He.length=zt,He.dts<he?(He.dts=he,he+=le/4|0||1):he=He.dts,w=Math.min(He.pts,w),k=Math.max(He.pts,k)}y=r[c-1].dts;const Ee=Se+4*ce+8;let Re;try{Re=new Uint8Array(Ee)}catch(Ge){this.observer.emit(g.ERROR,g.ERROR,{type:J.MUX_ERROR,details:D.REMUX_ALLOC_ERROR,fatal:!1,error:Ge,bytes:Ee,reason:`fail allocating video mdat ${Ee}`});return}const ge=new DataView(Re.buffer);ge.setUint32(0,Ee),Re.set(me.types.mdat,4);let $e=!1,Ve=Number.POSITIVE_INFINITY,Xt=Number.POSITIVE_INFINITY,Lt=Number.NEGATIVE_INFINITY,vt=Number.NEGATIVE_INFINITY;for(let Ge=0;Ge<c;Ge++){const He=r[Ge],Pt=He.units;let Dt=0;for(let bi=0,Li=Pt.length;bi<Li;bi++){const An=Pt[bi],Cn=An.data,vs=An.data.byteLength;ge.setUint32(f,vs),f+=4,Re.set(Cn,f),f+=vs,Dt+=4+vs}let zt;if(Ge<c-1)m=r[Ge+1].dts-He.dts,zt=r[Ge+1].pts-He.pts;else{const bi=this.config,Li=Ge>0?He.dts-r[Ge-1].dts:le;if(zt=Ge>0?He.pts-r[Ge-1].pts:le,bi.stretchShortVideoTrack&&this.nextAudioPts!==null){const An=Math.floor(bi.maxBufferHole*s),Cn=(n?w+n*s:this.nextAudioPts)-He.pts;Cn>An?(m=Cn-Li,m<0?m=Li:$e=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${Cn/90} ms to the next segment; using duration ${m/90} ms for the last video frame.`)):m=Li}else m=Li}const fi=Math.round(He.pts-He.dts);Ve=Math.min(Ve,m),Lt=Math.max(Lt,m),Xt=Math.min(Xt,zt),vt=Math.max(vt,zt),o.push(Ka(He.key,m,Dt,fi))}if(o.length){if(ks){if(ks<70){const Ge=o[0].flags;Ge.dependsOn=2,Ge.isNonSync=0}}else if(Xr&&vt-Xt<Lt-Ve&&le/Lt<.025&&o[0].cts===0){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Ge=E;for(let He=0,Pt=o.length;He<Pt;He++){const Dt=Ge+o[He].duration,zt=Ge+o[He].cts;if(He<Pt-1){const fi=Dt+o[He+1].cts;o[He].duration=fi-zt}else o[He].duration=He?o[He-1].duration:le;o[He].cts=0,Ge=Dt}}}m=$e||!m?le:m,this.nextAvcDts=h=y+m,this.videoSampleDuration=m,this.isVideoContiguous=!0;const ht={data1:me.moof(e.sequenceNumber++,E,v(e,{samples:o})),data2:Re,startPTS:w/s,endPTS:(k+m)/s,startDTS:E/s,endDTS:h/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,ht}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return $l;case"ac3":return Gl;default:return Ul}}remuxAudio(e,t,i,n,s){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,c=r/o,u=this.getSamplesPerFrame(e),h=u*c,f=this._initPTS,m=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,E=[],y=s!==void 0;let w=e.samples,k=m?0:8,z=this.nextAudioPts||-1;const ie=t*r,q=f.baseTime*r/f.timescale;if(this.isAudioContiguous=i=i||w.length&&z>0&&(n&&Math.abs(ie-z)<9e3||Math.abs($n(w[0].pts-q,ie)-z)<20*h),w.forEach(function(et){et.pts=$n(et.pts-q,ie)}),!i||z<0){if(w=w.filter(et=>et.pts>=0),!w.length)return;s===0?z=0:n&&!y?z=Math.max(0,ie):z=w[0].pts}if(e.segmentCodec==="aac"){const et=this.config.maxAudioFramesDrift;for(let yt=0,ht=z;yt<w.length;yt++){const Ge=w[yt],He=Ge.pts,Pt=He-ht,Dt=Math.abs(1e3*Pt/r);if(Pt<=-et*h&&y)yt===0&&(this.logger.warn(`Audio frame @ ${(He/r).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Pt/r)} ms.`),this.nextAudioPts=z=ht=He);else if(Pt>=et*h&&Dt<Bl&&y){let zt=Math.round(Pt/h);ht=He-zt*h,ht<0&&(zt--,ht+=h),yt===0&&(this.nextAudioPts=z=ht),this.logger.warn(`[mp4-remuxer]: Injecting ${zt} audio frame @ ${(ht/r).toFixed(3)}s due to ${Math.round(1e3*Pt/r)} ms gap.`);for(let fi=0;fi<zt;fi++){const bi=Math.max(ht,0);let Li=Ml.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Li||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Li=Ge.unit.subarray()),w.splice(yt,0,{unit:Li,pts:bi}),ht+=h,yt++}}Ge.pts=ht,ht+=h}}let le=null,ce=null,Se,he=0,Ee=w.length;for(;Ee--;)he+=w[Ee].unit.byteLength;for(let et=0,yt=w.length;et<yt;et++){const ht=w[et],Ge=ht.unit;let He=ht.pts;if(ce!==null){const Dt=E[et-1];Dt.duration=Math.round((He-ce)/c)}else if(i&&e.segmentCodec==="aac"&&(He=z),le=He,he>0){he+=k;try{Se=new Uint8Array(he)}catch(Dt){this.observer.emit(g.ERROR,g.ERROR,{type:J.MUX_ERROR,details:D.REMUX_ALLOC_ERROR,fatal:!1,error:Dt,bytes:he,reason:`fail allocating audio mdat ${he}`});return}m||(new DataView(Se.buffer).setUint32(0,he),Se.set(me.types.mdat,4))}else return;Se.set(Ge,k);const Pt=Ge.byteLength;k+=Pt,E.push(Ka(!0,u,Pt,0)),ce=He}const Re=E.length;if(!Re)return;const ge=E[E.length-1];this.nextAudioPts=z=ce+c*ge.duration;const $e=m?new Uint8Array(0):me.moof(e.sequenceNumber++,le/c,v({},e,{samples:E}));e.samples=[];const Ve=le/r,Xt=z/r,vt={data1:$e,data2:Se,startPTS:Ve,endPTS:Xt,startDTS:Ve,endDTS:Xt,type:"audio",hasAudio:!0,hasVideo:!1,nb:Re};return this.isAudioContiguous=!0,vt}}function $n(a,e){let t;if(e===null)return a;for(e<a?t=-8589934592:t=8589934592;Math.abs(a-e)>4294967296;)a+=t;return a}function Kl(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function Ha(a,e,t,i){const n=a.samples.length;if(!n)return;const s=a.inputTimeScale;for(let o=0;o<n;o++){const c=a.samples[o];c.pts=$n(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=$n(c.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function Wa(a,e,t){const i=a.samples.length;if(!i)return;const n=a.inputTimeScale;for(let r=0;r<i;r++){const o=a.samples[r];o.pts=$n(o.pts-t.baseTime*n/t.timescale,e*n)/n}a.samples.sort((r,o)=>r.pts-o.pts);const s=a.samples;return a.samples=[],{samples:s}}class Hl{constructor(e,t,i,n){this.logger=void 0,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.logger=n}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(ke(e,n)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const n=this.initData=Be(e);n.audio&&(t=ja(n.audio,d.AUDIO)),n.video&&(i=ja(n.video,d.VIDEO));const s={};n.audio&&n.video?s.audiovideo={container:"video/mp4",codec:t+","+i,supplemental:n.video.supplemental,initSegment:e,id:"main"}:n.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?s.video={container:"video/mp4",codec:i,supplemental:n.video.supplemental,initSegment:e,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,i,n,s,r){var o,c;let{initPTS:u,lastEndTime:h}=this;const f={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};K(h)||(h=this.lastEndTime=s||0);const m=t.samples;if(!(m!=null&&m.length))return f;const E={initPTS:void 0,timescale:1};let y=this.initData;if((o=y)!=null&&o.length||(this.generateInitSegment(m),y=this.initData),!((c=y)!=null&&c.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(E.tracks=this.initTracks,this.emitInitSegment=!1);const w=pt(m,y),k=ot(y,m),z=k===null?s:k;(r||!u)&&(Wl(u,z,s,w)||E.timescale!==u.timescale)&&(E.initPTS=z-s,u&&u.timescale===1&&this.logger.warn(`Adjusting initPTS @${s} from ${u.baseTime/u.timescale} to ${E.initPTS}`),this.initPTS=u={baseTime:E.initPTS,timescale:1});const ie=e?z-u.baseTime/u.timescale:h,q=ie+w;Rt(y,m,u.baseTime/u.timescale),w>0?this.lastEndTime=q:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const le=!!y.audio,ce=!!y.video;let Se="";le&&(Se+="audio"),ce&&(Se+="video");const he={data1:m,startPTS:ie,startDTS:ie,endPTS:q,endDTS:q,type:Se,hasAudio:le,hasVideo:ce,nb:1,dropped:0};return f.audio=he.type==="audio"?he:void 0,f.video=he.type!=="audio"?he:void 0,f.initSegment=E,f.id3=Ha(i,s,u,u),n.samples.length&&(f.text=Wa(n,s,u)),f}}function Wl(a,e,t,i){if(a===null)return!0;const n=Math.max(i,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>n}function ja(a,e){const t=a==null?void 0:a.codec;return t&&t.length>4?t:e===d.AUDIO?t==="ec-3"||t==="ac-3"||t==="alac"?t:t==="fLaC"||t==="Opus"?$t(t,!1):(Y.warn(`Unhandled audio codec "${t}" in mp4 MAP`),t||"mp4a"):(Y.warn(`Unhandled video codec "${t}" in mp4 MAP`),t||"avc1")}let cs;try{cs=self.performance.now.bind(self.performance)}catch(a){cs=Date.now}const Er=[{demux:Cl,remux:Hl},{demux:ps,remux:yr},{demux:Il,remux:yr},{demux:Ll,remux:yr}];Er.splice(2,0,{demux:Rl,remux:yr});class Va{constructor(e,t,i,n,s,r){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=i,this.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const s=i.transmuxing;s.executeStart=cs();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:u,discontinuity:h,trackSwitch:f,accurateTimeOffset:m,timeOffset:E,initSegmentChange:y}=n||o,{audioCodec:w,videoCodec:k,defaultInitPts:z,duration:ie,initSegmentData:q}=c,le=jl(r,t);if(le&&mn(le.method)){const Ee=this.getDecrypter(),Re=ji(le.method);if(Ee.isSync()){let ge=Ee.softwareDecrypt(r,le.key.buffer,le.iv.buffer,Re);if(i.part>-1){const Ve=Ee.flush();ge=Ve&&Ve.buffer}if(!ge)return s.executeEnd=cs(),Qr(i);r=new Uint8Array(ge)}else return this.asyncResult=!0,this.decryptionPromise=Ee.webCryptoDecrypt(r,le.key.buffer,le.iv.buffer,Re).then(ge=>{const $e=this.push(ge,null,i);return this.decryptionPromise=null,$e}),this.decryptionPromise}const ce=this.needsProbing(h,f);if(ce){const Ee=this.configureTransmuxer(r);if(Ee)return this.logger.warn(`[transmuxer] ${Ee.message}`),this.observer.emit(g.ERROR,g.ERROR,{type:J.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!1,error:Ee,reason:Ee.message}),s.executeEnd=cs(),Qr(i)}(h||f||y||ce)&&this.resetInitSegment(q,w,k,ie,t),(h||y||ce)&&this.resetInitialTimestamp(z),u||this.resetContiguity();const Se=this.transmux(r,le,E,m,i);this.asyncResult=Js(Se);const he=this.currentTransmuxState;return he.contiguous=!0,he.discontinuity=!1,he.trackSwitch=!1,s.executeEnd=cs(),Se}flush(e){const t=e.transmuxing;t.executeStart=cs();const{decrypter:i,currentTransmuxState:n,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const r=[],{timeOffset:o}=n;if(i){const f=i.flush();f&&r.push(this.push(f.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=cs();const f=[Qr(e)];return this.asyncResult?Promise.resolve(f):f}const h=c.flush(o);return Js(h)?(this.asyncResult=!0,h.then(f=>(this.flushRemux(r,f,e),r))):(this.flushRemux(r,h,e),this.asyncResult?Promise.resolve(r):r)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:s,id3Track:r,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===H.MAIN?"level":"track"} ${i.level}`);const h=this.remuxer.remux(n,s,r,o,u,c,!0,this.id);e.push({remuxResult:h,chunkMeta:i}),i.transmuxing.executeEnd=cs()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,s){const{demuxer:r,remuxer:o}=this;!r||!o||(r.resetInitSegment(e,t,i,n),o.resetInitSegment(e,t,i,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,s){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,i,n,s):r=this.transmuxUnencrypted(e,i,n,s),r}transmuxUnencrypted(e,t,i,n){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,r,o,c,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,s){return this.demuxer.demuxSampleAes(e,t,i).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,i,n,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let s;for(let f=0,m=Er.length;f<m;f++){var r;if((r=Er[f].demux)!=null&&r.probe(e,this.logger)){s=Er[f];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,c=this.remuxer,u=s.remux,h=s.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(i,t,n,this.logger)),(!o||!(o instanceof h))&&(this.demuxer=new h(i,t,n,this.logger),this.probe=h.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new gn(this.config)),e}}function jl(a,e){let t=null;return a.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Qr=a=>({remuxResult:{},chunkMeta:a});function Js(a){return"then"in a&&a.then instanceof Function}class Vl{constructor(e,t,i,n,s){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=i,this.duration=n,this.defaultInitPts=s||null}}class zl{constructor(e,t,i,n,s,r){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=i,this.trackSwitch=n,this.timeOffset=s,this.initSegmentChange=r}}let za=0;class Za{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=za++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const u=c.data,h=this.hls;if(!(!h||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var f;const m=(f=this.workerContext)==null?void 0:f.objectURL;m&&self.URL.revokeObjectURL(m);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{h.logger[u.data.logType]&&h.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,h.trigger(u.event,u.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const u=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const r=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===g.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new Ur,this.observer.on(g.FRAG_DECRYPTED,r),this.observer.on(g.ERROR,r);const o=Ci(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||Xo()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=Jo(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=Qo());const{worker:h}=this.workerContext;h.addEventListener("message",this.onWorkerMessage),h.addEventListener("error",this.onWorkerError),h.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:Qt(s)})}catch(h){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new Va(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new Va(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=za++;const t=this.hls.config,i=Ci(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:Qt(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),qo(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,i,n,s,r,o,c,u,h){var f,m;u.transmuxing.start=self.performance.now();const{instanceNo:E,transmuxer:y}=this,w=r?r.start:s.start,k=s.decryptdata,z=this.frag,ie=!(z&&s.cc===z.cc),q=!(z&&u.level===z.level),le=z?u.sn-z.sn:-1,ce=this.part?u.part-this.part.index:-1,Se=le===0&&u.id>1&&u.id===(z==null?void 0:z.stats.chunkCount),he=!q&&(le===1||le===0&&(ce===1||Se&&ce<=0)),Ee=self.performance.now();(q||le||s.stats.parsing.start===0)&&(s.stats.parsing.start=Ee),r&&(ce||!he)&&(r.stats.parsing.start=Ee);const Re=!(z&&((f=s.initSegment)==null?void 0:f.url)===((m=z.initSegment)==null?void 0:m.url)),ge=new zl(ie,he,c,q,w,Re);if(!he||ie||Re){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===H.MAIN?"level":"track"}: ${u.level} id: ${u.id}
|
|
discontinuity: ${ie}
|
|
trackSwitch: ${q}
|
|
contiguous: ${he}
|
|
accurateTimeOffset: ${c}
|
|
timeOffset: ${w}
|
|
initSegmentChange: ${Re}`);const $e=new Vl(i,n,t,o,h);this.configureTransmuxer($e)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:E,cmd:"demux",data:e,decryptdata:k,chunkMeta:u,state:ge},e instanceof ArrayBuffer?[e]:[]);else if(y){const $e=y.push(e,k,u,ge);Js($e)?$e.then(Ve=>{this.handleTransmuxComplete(Ve)}).catch(Ve=>{this.transmuxerError(Ve,u,"transmuxer-interface push error")}):this.handleTransmuxComplete($e)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const n=i.flush(e);Js(n)?n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(n,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Ya=100;class Zl extends xs{constructor(e,t,i){super(e,t,i,"audio-stream-controller",H.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(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(g.BUFFER_RESET,this.onBufferReset,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(g.BUFFER_RESET,this.onBufferReset,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s}){if(i===H.MAIN){const r=t.cc,o=this.fragCurrent;if(this.initPTS[r]={baseTime:n,timescale:s},this.log(`InitPTS for cc: ${r} found from main: ${n}/${s}`),this.mainAnchor=t,this.state===De.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==r)&&(this.nextLoadPosition=this.findSyncFrag(t).start),this.tick()}else!this.hls.hasEnoughToStart&&o&&o.cc!==r?(this.startFragRequested=!1,this.nextLoadPosition=this.findSyncFrag(t).start,o.abortRequests(),this.resetLoadingState()):this.state===De.IDLE&&this.tick()}}findSyncFrag(e){const t=this.getLevelDetails(),i=e.cc;return ti(t,i,e)||t&&di(t.fragments,i)||e}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=De.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Ya),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=De.IDLE):this.state=De.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case De.IDLE:this.doTickIdle();break;case De.WAITING_TRACK:{const{levels:t,trackId:i}=this,n=t==null?void 0:t[i],s=n==null?void 0:n.details;if(s&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(s))break;this.state=De.WAITING_INIT_PTS}break}case De.FRAG_LOADING_WAITING_RETRY:{var e;const t=performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:n,trackId:s}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[s])||null),this.state=De.IDLE}break}case De.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:i,part:n,cache:s,complete:r}=t,o=this.mainAnchor;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.state=De.FRAG_LOADING;const c=s.flush().buffer,u={frag:i,part:n,payload:c,networkDetails:null};this._handleFragmentLoadProgress(u),r&&super._handleFragmentLoadComplete(u)}else o&&o.cc!==t.frag.cc&&(this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${o.cc}`),this.nextLoadPosition=this.findSyncFrag(o).start,this.clearWaitingFragment())}else this.state=De.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.state!==De.STOPPED&&(this.state=De.IDLE))}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:s}=this,r=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||!(i!=null&&i[s]))return;const o=i[s],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=De.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,d.AUDIO,H.AUDIO));const h=this.getFwdBufferInfo(u,H.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,c)){t.trigger(g.BUFFER_EOS,{type:"audio"}),this.state=De.ENDED;return}const f=h.len,m=t.maxBufferLength,E=c.fragments,y=E[0].start,w=this.getLoadPosition(),k=this.flushing?w:h.end;if(this.switchingTrack&&n){const q=w;c.PTSKnown&&q<y&&(h.end>y||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=y+.05)}if(f>=m&&!this.switchingTrack&&k<E[E.length-1].start)return;let z=this.getNextFragment(k,c);if(z&&this.isLoopLoading(z,k)&&(z=this.getNextFragmentLoopLoading(z,c,h,H.MAIN,m)),!z){this.bufferFlushed=!0;return}let ie=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ie&&V(z)&&!z.endList&&(!c.live||!this.loadingParts&&k<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ie)===Ft.OK&&(this.mainFragLoading=ie=null),ie&&V(ie))){if(z.start>ie.end){const le=this.fragmentTracker.getFragAtPos(k,H.MAIN);le&&le.end>ie.end&&(ie=le,this.mainFragLoading={frag:le,targetBufferTime:null})}if(z.start>ie.end)return}this.loadFragment(z,o,k)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new on(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==De.STOPPED&&(this.setInterval(Ya),this.state=De.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 i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(g.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:s,id:r,groupId:o,track:c}=t;if(!n){this.warn(`Audio tracks reset while loading track ${r} "${c.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||s.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==De.STOPPED&&(this.state=De.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${r} "${c.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const h=n[r];let f=0;if(s.live||(i=h.details)!=null&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(h.details){var m;f=this.alignPlaylists(s,h.details,(m=this.levelLastLoaded)==null?void 0:m.details)}s.alignedSliding||(Ri(s,u),s.alignedSliding||cn(s,u),f=s.fragmentStart)}h.details=s,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(g.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===De.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=De.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{config:r,trackId:o,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const u=c[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const h=u.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const f=r.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let m=this.transmuxer;m||(m=this.transmuxer=new Za(this.hls,H.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const E=this.initPTS[i.cc],y=(t=i.initSegment)==null?void 0:t.data;if(E!==void 0){const k=n?n.index:-1,z=k!==-1,ie=new Wi(i.level,i.sn,i.stats.chunkCount,s.byteLength,k,z);m.push(s,y,f,"",i,n,h.totalduration,!1,ie,E)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:w}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new zs,complete:!1};w.push(new Uint8Array(s)),this.state!==De.STOPPED&&(this.state=De.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 i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===H.MAIN&&V(t.frag)&&(this.mainFragLoading=t,this.state===De.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==H.AUDIO){!this.audioOnly&&i.type===H.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(V(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(g.AUDIO_TRACK_SWITCHED,b({},s)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=De.ERROR;return}switch(t.details){case D.FRAG_GAP:case D.FRAG_PARSING_ERROR:case D.FRAG_DECRYPT_ERROR:case D.FRAG_LOAD_ERROR:case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_ERROR:case D.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(H.AUDIO,t);break;case D.AUDIO_TRACK_LOAD_ERROR:case D.AUDIO_TRACK_LOAD_TIMEOUT:case D.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===De.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ee.AUDIO_TRACK&&(this.state=De.IDLE);break;case D.BUFFER_ADD_CODEC_ERROR:case D.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case D.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case D.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==d.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==d.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===De.ENDED&&(this.state=De.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,H.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:s,chunkMeta:r}=e,o=this.getCurrentContext(r);if(!o){this.resetWhenMissingContext(r);return}const{frag:c,part:u,level:h}=o,{details:f}=h,{audio:m,text:E,id3:y,initSegment:w}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=De.PARSING,this.switchingTrack&&m&&this.completeAudioSwitch(this.switchingTrack),w!=null&&w.tracks){const k=c.initSegment||c;this._bufferInitSegment(h,w.tracks,k,r),n.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:k,id:i,tracks:w.tracks})}if(m){const{startPTS:k,endPTS:z,startDTS:ie,endDTS:q}=m;u&&(u.elementaryStreams[d.AUDIO]={startPTS:k,endPTS:z,startDTS:ie,endDTS:q}),c.setElementaryStreamInfo(d.AUDIO,k,z,ie,q),this.bufferFragmentData(m,c,u,r)}if(y!=null&&(t=y.samples)!=null&&t.length){const k=v({id:i,frag:c,details:f},y);n.trigger(g.FRAG_PARSING_METADATA,k)}if(E){const k=v({id:i,frag:c,details:f},E);n.trigger(g.FRAG_PARSING_USERDATA,k)}}_bufferInitSegment(e,t,i,n){if(this.state!==De.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=H.AUDIO;const r=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${r}/${s.codec}]`),r&&r.split(",").length===1&&(s.levelCodec=r),this.hls.trigger(g.BUFFER_CODECS,t);const o=s.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:o};this.hls.trigger(g.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===Ft.NOT_LOADED||n===Ft.PARTIAL){var s;if(!V(e))this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=De.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&cn(t.details,r)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o}=this.bufferedTrack;Ce({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,Pe)||(re(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(g.AUDIO_TRACK_SWITCHED,b({},e))}}class Jr extends U{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,i){const n=t==null?void 0:t.renditionReports;if(n){let s=-1;for(let r=0;r<n.length;r++){const o=n[r];let c;try{c=new self.URL(o.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),c=o.URI||""}if(c===e){s=r;break}else c===e.substring(0,c.length)&&(s=r)}if(s!==-1){const r=n[s],o=parseInt(r["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let c=parseInt(r["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const h=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&h>t.partTarget&&(c+=1)}const u=i&&sn(i);return new Oi(o,c>=0?c:void 0,u)}}}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(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:s}=t,r=self.performance.now(),o=s.loading.first?Math.max(0,r-s.loading.first):0;n.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==n.appliedTimelineOffset){const h=Math.max(c||0,0);n.appliedTimelineOffset=h,n.fragments.forEach(f=>{f.start=f.playlistOffset+h})}if(n.live||i!=null&&i.live){const h="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){Hs(i,n);const ie=n.playlistParsingError;if(ie){this.warn(ie);const q=this.hls;if(!q.config.ignorePlaylistParsingErrors){var u;const{networkDetails:le}=t;q.trigger(g.ERROR,{type:J.NETWORK_ERROR,details:D.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:ie,reason:ie.message,level:t.level||void 0,parent:(u=n.fragments[0])==null?void 0:u.type,networkDetails:le,stats:s});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=s.loading.start);const f=this.hls.mainForwardBufferInfo,m=f?f.end-f.len:0,E=(n.edge-m)*1e3,y=ur(n,E);if(n.requestScheduled+y<r?n.requestScheduled=r:n.requestScheduled+=y,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let w,k,z;if(n.canBlockReload&&n.endSN&&n.advanced){const ie=this.hls.config.lowLatencyMode,q=n.lastPartSn,le=n.endSN,ce=n.lastPartIndex,Se=ce!==-1,he=q===le;Se?he?(k=le+1,z=ie?0:ce):(k=q,z=ie?ce+1:n.maxPartIndex):k=le+1;const Ee=n.age,Re=Ee+n.ageHeader;let ge=Math.min(Re-n.partTarget,n.targetduration*1.5);if(ge>0){if(Re>n.targetduration*3)this.log(`Playlist last advanced ${Ee.toFixed(2)}s ago. Omitting segment and part directives.`),k=void 0,z=void 0;else if(i!=null&&i.tuneInGoal&&Re-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${ge} with playlist age: ${n.age}`),ge=0;else{const $e=Math.floor(ge/n.targetduration);if(k+=$e,z!==void 0){const Ve=Math.round(ge%n.targetduration/n.partTarget);z+=Ve}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${Ee.toFixed(2)}s goal: ${ge} skip sn ${$e} to part ${z}`)}n.tuneInGoal=ge}if(w=this.getDeliveryDirectives(n,t.deliveryDirectives,k,z),ie||!he){n.requestScheduled=r,this.loadingPlaylist(h,w);return}}else(n.canBlockReload||n.canSkipUntil)&&(w=this.getDeliveryDirectives(n,t.deliveryDirectives,k,z));w&&k!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(y-o*2,y/2)),this.scheduleLoading(h,w,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n){this.loadingPlaylist(e,t);return}const s=self.performance.now(),r=n.requestScheduled;if(s>=r){this.loadingPlaylist(e,t);return}const o=r-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,i,n){let s=sn(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=Vt.No),new Oi(i,n,s)}checkRetry(e){const t=e.details,i=Kt(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===ri.RetryRequest||!n.resolved&&s===ri.SendAlternateToPenaltyBox);if(c){var u;if(r>=o.maxNumRetry)return!1;if(i&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=Bt(o,r);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,n.resolved=!0}return c}}function Xa(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!qs(a[t].attrs,e[t].attrs))return!1;return!0}function qs(a,e,t){const i=a["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(n=>a[n]!==e[n])}function qr(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class Yl extends Jr{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(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(g.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:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Audio track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Audio track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(n==null?void 0:n.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(m=>!i||i.indexOf(m.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(m=>m.default)&&(this.selectDefaultTrack=!1),o.forEach((m,E)=>{m.id=E});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const m=Ae(c,o,Pe);if(m>-1)s=o[m];else{const E=Ae(c,this.tracks);s=this.tracks[E]}}let u=this.findTrackId(s);u===-1&&s&&(u=this.findTrackId(null));const h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(g.AUDIO_TRACKS_UPDATED,h);const f=this.trackId;if(u!==-1&&f===-1)this.setAudioTrack(u);else if(o.length&&f===-1){var r;const m=new Error(`No audio track selected for current audio group-ID(s): ${(r=this.groupIds)==null?void 0:r.join(",")} track count: ${o.length}`);this.warn(m.message),this.hls.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:m})}}}onError(e,t){t.fatal||!t.context||t.context.type===ee.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 i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&Ce(e,n,Pe))return n;const s=Ae(e,this.tracksInGroup,Pe);if(s>-1){const r=this.tracksInGroup[s];return this.setAudioTrack(s),r}else if(n){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);const o=ut(e,t.levels,i,r,Pe);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=Ae(e,i);if(r>-1)return i[r]}}}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 i=this.currentTrack,n=t[e],s=n.details&&!n.details.live;if(e===this.trackId&&n===i&&s||(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger(g.AUDIO_TRACK_SWITCHING,b({},n)),s))return;const r=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(!(this.selectDefaultTrack&&!n.default)&&(!e||Ce(e,n,Pe)))return i}if(e){const{name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const h=t[u];if(Ce({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},h,Pe))return u}for(let u=0;u<t.length;u++){const h=t[u];if(qs(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const h=t[u];if(qs(e.attrs,h.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&re(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(g.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}}class Xl{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];n.push(e),n.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(s){var i;if(n.onError(s),this.queues===null||this.tracks===null)return;const r=(i=this.tracks[e])==null?void 0:i.buffer;r!=null&&r.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,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],n=i==null?void 0:i.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const Qa=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Ja="HlsJsTrackRemovedError";class Ql extends Error{constructor(e){super(e),this.name=Ja}}class Jl extends U{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=i=>{var n;this.hls&&((n=this.mediaSource)==null?void 0:n.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:n,mediaSource:s}=this;i&&this.log("Media source opened"),!(!n||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(g.MEDIA_ATTACHED,{media:n,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:n}=this;i!==n&&this.error(`Media element src was set while attaching MediaSource (${n} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=ye(fe(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(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.BUFFER_RESET,this.onBufferReset,this),e.on(g.BUFFER_APPENDING,this.onBufferAppending,this),e.on(g.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.BUFFER_EOS,this.onBufferEos,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.FRAG_PARSED,this.onFragParsed,this),e.on(g.FRAG_CHANGED,this.onFragChanged,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.BUFFER_RESET,this.onBufferReset,this),e.off(g.BUFFER_APPENDING,this.onBufferAppending,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.BUFFER_EOS,this.onBufferEos,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.FRAG_PARSED,this.onFragParsed,this),e.off(g.FRAG_CHANGED,this.onFragChanged,this),e.off(g.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const r=this.isQueued();(s||r)&&this.warn(`Transfering MediaSource with${r?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?v(i,n.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(i[r]=v({},this.tracks[r]),this.removeBuffer(r)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:i}}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 i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media,n=fe(this.appendSource);if(this.transferData=this.overrides=void 0,i&&n){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),s)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&r instanceof c,qa(i),ql(i,o),i.load()}catch(c){i.src=o}else i.src=o}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.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 i=this.tracks,n=t.tracks,s=n?Object.keys(n):null,r=s?s.length:0,o=()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()};if(n&&s&&r){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: ${Qt(i,(c,u)=>c==="initSegment"?void 0:u)};
|
|
transfer tracks: ${Qt(n,(c,u)=>c==="initSegment"?void 0:u)}}`),!ae(n,i)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,u=this.details,h=Math.max(c,(u==null?void 0:u.fragments[0].start)||0);if(h-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${h}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${h} currentTime: ${c}`),this.onMediaDetaching(g.MEDIA_DETACHING,{}),this.onMediaAttaching(g.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,s.forEach(c=>{const u=c,h=n[u];if(h){const f=h.buffer;if(f){const m=this.fragmentTracker,E=h.id;if(m.hasFragments(E)||m.hasParts(E)){const k=_t.getBuffered(f);m.detectEvictedFragments(u,k,E,null,!0)}const y=ea(u),w=[u,f];this.sourceBuffers[y]=w,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,h)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:s,_objectUrl:r}=this;if(s){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=s.readyState==="open";try{const c=s.sourceBuffers;for(let u=c.length;u--;)o&&c[u].abort(),s.removeSourceBuffer(c[u]);o&&s.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(n.removeAttribute("src"),this.appendSource&&qa(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(g.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[ea(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Xl(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),r=!s&&this.sourceBufferCount&&this.media&&n.some(o=>!i[o]);if(s||r){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${n}" SourceBuffers`);return}n.forEach(o=>{var c,u,h;const f=t[o],{id:m,codec:E,levelCodec:y,container:w,metadata:k,supplemental:z}=f;let ie=i[o];const q=(c=this.transferData)==null||(u=c.tracks)==null?void 0:u[o],le=q!=null&&q.buffer?q:ie,ce=(le==null?void 0:le.pendingCodec)||(le==null?void 0:le.codec),Se=le==null?void 0:le.levelCodec;ie||(ie=i[o]={buffer:void 0,listeners:[],codec:E,supplemental:z,container:w,levelCodec:y,metadata:k,id:m});const he=Mi(ce,Se),Ee=he==null?void 0:he.replace(Qa,"$1");let Re=Mi(E,y);const ge=(h=Re)==null?void 0:h.replace(Qa,"$1");Re&&he&&Ee!==ge&&(o.slice(0,5)==="audio"&&(Re=$t(Re,this.appendSource)),this.log(`switching codec ${ce} to ${Re}`),Re!==(ie.pendingCodec||ie.codec)&&(ie.pendingCodec=Re),ie.container=w,this.appendChangeType(o,w,Re))}),(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 i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,s={label:`change-type=${n}`,execute:()=>{const r=this.tracks[e];if(r){const o=r.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),o.changeType(n),r.codec=i,r.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:r=>{this.warn(`Failed to change ${e} SourceBuffer type`,r)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,n=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,H.MAIN))==null?void 0:t.gap)===!0)return;const r={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>n||c!=null&&c.buffer&&_t.isBuffered(c.buffer,n)||((o=this.fragmentTracker.getAppendedFrag(n,H.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:n,type:s,parent:r,frag:o,part:c,chunkMeta:u}=t,h=u.buffering[s],f=o.sn,m=self.performance.now();h.start=m;const E=o.stats.buffering,y=c?c.stats.buffering:null;E.start===0&&(E.start=m),y&&y.start===0&&(y.start=m);const w=i.audio;let k=!1;s==="audio"&&(w==null?void 0:w.container)==="audio/mpeg"&&(k=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const z=this.tracks.video,ie=z==null?void 0:z.buffer;if(ie&&f!=="initSegment"){const ce=c||o,Se=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend){const Ee=ce.start+ce.duration*.05,Re=ie.buffered,ge=this.currentOp("video");!Re.length&&!ge?this.blockAudio(ce):!ge&&!_t.isBuffered(ie,Ee)&&this.lastVideoAppendEnd<Ee&&this.blockAudio(ce)}else if(s==="video"){const he=ce.end;if(Se){const Ee=Se.frag.start;(he>Ee||he<this.lastVideoAppendEnd||_t.isBuffered(ie,Ee))&&this.unblockAudio()}this.lastVideoAppendEnd=he}}const q=(c||o).start,le={label:`append-${s}`,execute:()=>{if(h.executeStart=self.performance.now(),k){const ce=this.tracks[s];if(ce){const Se=ce.buffer;if(Se){const he=q-Se.timestampOffset;Math.abs(he)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${q} (delta: ${he}) sn: ${f})`),Se.timestampOffset=q)}}}this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const ce=self.performance.now();h.executeEnd=h.end=ce,E.first===0&&(E.first=ce),y&&y.first===0&&(y.first=ce);const Se={};this.sourceBuffers.forEach(([he,Ee])=>{he&&(Se[he]=_t.getBuffered(Ee))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(g.BUFFER_APPENDED,{type:s,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:Se})},onError:ce=>{var Se;const he={type:J.MEDIA_ERROR,parent:o.type,details:D.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:ce,err:ce,fatal:!1};if(ce.code===DOMException.QUOTA_EXCEEDED_ERR)he.details=D.BUFFER_FULL_ERROR;else if(ce.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!((Se=this.media)!=null&&Se.error))he.errorAction=mi(!0);else if(ce.name===Ja)this.sourceBufferCount===0?he.errorAction=mi(!0):++this.appendErrors[s];else{const Ee=++this.appendErrors[s];this.warn(`Failed ${Ee}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer`),Ee>=this.hls.config.appendErrorMaxRetry&&(he.fatal=!0)}this.hls.trigger(g.ERROR,he)}};this.append(le,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(g.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:s}=t;i?this.append(this.getFlushOp(i,n,s),i):this.sourceBuffers.forEach(([r])=>{r&&this.append(this.getFlushOp(r,n,s),r)})}onFragParsed(e,t){const{frag:i,part:n}=t,s=[],r=n?n.elementaryStreams:i.elementaryStreams;r[d.AUDIOVIDEO]?s.push("audiovideo"):(r[d.AUDIO]&&s.push("audio"),r[d.VIDEO]&&s.push("video"));const o=()=>{const c=self.performance.now();i.stats.buffering.end=c,n&&(n.stats.buffering.end=c);const u=n?n.stats:i.stats;this.hls.trigger(g.FRAG_BUFFERED,{frag:i,part:n,stats:u,id:i.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(o,s)}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t,i;return e&&(!((t=this.tracks[e])!=null&&t.ended)||((i=this.tracks[e])==null?void 0:i.ending))})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([r])=>{if(r){const o=this.tracks[r];(!t.type||t.type===r)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${r} buffer reached EOS`)))}});const n=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([r])=>{var o;return r&&!((o=this.tracks[r])!=null&&o.ended)})&&(n?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream(),this.hls.trigger(g.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(g.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(){const e=this.getDurationAndRange();e&&this.blockUntilOpen(()=>this.updateMediaSource(e))}onError(e,t){if(t.details===D.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;K(n)&&n!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const n=e.config,s=i.currentTime,r=t.levelTargetDuration,o=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(K(o)&&o>=0){const c=Math.max(o,r),u=Math.floor(s/r)*r-c;this.flushBackBuffer(s,r,u)}if(K(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const c=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),u=Math.max(c,r),h=Math.floor(s/r)*r+u;this.flushFrontBuffer(s,r,h)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const o=_t.getBuffered(s);if(o.length>0&&i>o.start(0)){var r;this.hls.trigger(g.BACK_BUFFER_REACHED,{bufferEnd:i});const c=this.tracks[n];if((r=this.details)!=null&&r.live)this.hls.trigger(g.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(c!=null&&c.ended){this.log(`Cannot flush ${n} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(g.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:n})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const r=_t.getBuffered(s),o=r.length;if(o<2)return;const c=r.start(o-1),u=r.end(o-1);if(i>c||e>=c&&e<=u)return;this.hls.trigger(g.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:n})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||(i==null?void 0:i.readyState)!=="open")return null;const n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&t.live&&i.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),h=Math.max(u,n);return{duration:1/0,start:u,end:h}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return K(s)?{duration:s}:null;const r=this.media.duration,o=K(i.duration)?i.duration:0;return n>o&&n>r||!K(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(K(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),n.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${n.duration}. Setting seekable range to ${t}-${i}.`),n.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Qt(i)}`),this.tracksReady){var n;const s=(n=this.transferData)==null?void 0:n.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger(g.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(g.ERROR,{type:J.MEDIA_ERROR,details:D.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const r=s,o=e[r];if(this.isPending(o)){const c=this.getTrackCodec(o,r),u=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${u})${this.currentOp(r)?" Queued":""} ${Qt(o)}`);try{const h=i.addSourceBuffer(u),f=ea(r),m=[r,h];t[f]=m,o.buffer=h}catch(h){var n;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(r),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[r],this.hls.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,sourceBufferName:r,mimeType:u,parent:o.id});return}this.trackSourceBuffer(r,o)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let n=e.codec;i&&(t==="video"||t==="audiovideo")&>(i,"video")&&(n=Jt(n,i));const s=Mi(n,e.levelCodec);return s?t.slice(0,5)==="audio"?$t(s,this.appendSource):s:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,r)=>{const o=r.removedRanges;o!=null&&o.length&&this.hls.trigger(g.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i==null?void 0:i.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 i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const s=this.currentOp(e);s&&s.onError(n)}removeExecutor(e,t,i){const{media:n,mediaSource:s}=this,r=this.tracks[e],o=r==null?void 0:r.buffer;if(!n||!s||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=K(n.duration)?n.duration:1/0,u=K(s.duration)?s.duration:1/0,h=Math.max(0,t),f=Math.min(i,c,u);f>h&&(!r.ending||r.ended)?(r.ended=!1,this.log(`Removing [${h},${f}] from the ${e} SourceBuffer`),o.remove(h,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=i==null?void 0:i.buffer;if(!n)throw new Ql(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){this.isUpdating()||this.isQueued()?this.blockBuffers(e):e()}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,n=t.map(r=>this.appendBlocker(r));t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(r=>{i===this.operationQueue&&(e(),this.stepOperationQueue(t))})}stepOperationQueue(e){e.forEach(t=>{var i;const n=(i=this.tracks[t])==null?void 0:i.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}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,i){const n=this.tracks[e];if(!n)return;const s=n.buffer;if(!s)return;const r=i.bind(this,e);n.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(n=>{i.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function qa(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function ql(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function ea(a){return a==="audio"?1:0}class ta{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(g.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.BUFFER_CODECS,this.onBufferCodecs,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(g.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.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 i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&K(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,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,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 i=t.filter((n,s)=>this.isLevelAllowed(n)&&s<=e);return this.clientRect=null,ta.getMaxLevelByMediaSize(i,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 i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.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(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const n=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let s=e.length-1;const r=Math.max(t,i);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=r||c.height>=r)&&n(c,e[o+1])){s=o;break}}return s}}const Dn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},eu={HLS:"h"},er={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},tu={[er.OBJECT]:["br","d","ot","tb"],[er.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[er.SESSION]:["cid","pr","sf","sid","st","v"],[er.STATUS]:["bs","rtp"]};class Ms{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Ms?i:new Ms(i))),this.value=e,this.params=t}}const iu="Dict";function nu(a){return Array.isArray(a)?JSON.stringify(a):a instanceof Map?"Map{}":a instanceof Set?"Set{}":typeof a=="object"?JSON.stringify(a):String(a)}function su(a,e,t,i){return new Error(`failed to ${a} "${nu(e)}" as ${t}`,{cause:i})}function ss(a,e,t){return su("serialize",a,e,t)}class eo{constructor(e){this.description=e}}const to="Bare Item",ru="Boolean";function au(a){if(typeof a!="boolean")throw ss(a,ru);return a?"?1":"?0"}const ou="Byte Sequence";function lu(a){if(ArrayBuffer.isView(a)===!1)throw ss(a,ou);return`:${ul(a)}:`}const uu="Integer";function cu(a){return a<-999999999999999||999999999999999<a}function io(a){if(cu(a))throw ss(a,uu);return a.toString()}function hu(a){return`@${io(a.getTime()/1e3)}`}const fu="Decimal";function du(a){const e=Ra(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ss(a,fu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const pu="String",gu=/[\x00-\x1f\x7f]+/;function mu(a){if(gu.test(a))throw ss(a,pu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function _u(a){return a.description||a.toString().slice(7,-1)}const vu="Token";function no(a){const e=_u(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ss(e,vu);return e}function ia(a){switch(typeof a){case"number":if(!K(a))throw ss(a,to);return Number.isInteger(a)?io(a):du(a);case"string":return mu(a);case"symbol":return no(a);case"boolean":return au(a);case"object":if(a instanceof Date)return hu(a);if(a instanceof Uint8Array)return lu(a);if(a instanceof eo)return no(a);default:throw ss(a,to)}}const yu="Key";function na(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw ss(a,yu);return a}function sa(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${na(e)}`:`;${na(e)}=${ia(t)}`).join("")}function so(a){return a instanceof Ms?`${ia(a.value)}${sa(a.params)}`:ia(a)}function Eu(a){return`(${a.value.map(so).join(" ")})${sa(a.params)}`}function bu(a,e={whitespace:!0}){if(typeof a!="object")throw ss(a,iu);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof Ms||(s=new Ms(s));let r=na(n);return s.value===!0?r+=sa(s.params):(r+="=",Array.isArray(s.value)?r+=Eu(s):r+=so(s)),r}).join(`,${i}`)}function xu(a,e){return bu(a,e)}function Su(a){return a==="ot"||a==="sf"||a==="st"}function Tu(a){return typeof a=="number"?K(a):a!=null&&a!==""&&a!==!1}const br=a=>Math.round(a),Au=(a,e)=>(e!=null&&e.baseUrl&&(a=cl(a,e.baseUrl)),encodeURIComponent(a)),xr=a=>br(a/100)*100,wu={br,d:br,bl:xr,dl:xr,mtp:xr,nor:Au,rtp:xr,tb:br};function Iu(a,e){const t={};if(a==null||typeof a!="object")return t;const i=Object.keys(a).sort(),n=v({},wu,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return i.forEach(r=>{if(s!=null&&s(r))return;let o=a[r];const c=n[r];c&&(o=c(o,e)),!(r==="v"&&o===1)&&(r=="pr"&&o===1||Tu(o)&&(Su(r)&&typeof o=="string"&&(o=new eo(o)),t[r]=o))}),t}function ro(a,e={}){return a?xu(Iu(a,e),v({whitespace:!1},e)):""}function Ru(a,e={}){const t={};if(!a)return t;const i=Object.entries(a),n=Object.entries(tu).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=i.reduce((r,o)=>{var c,u;const[h,f]=o,m=((c=n.find(E=>E[1].includes(h)))===null||c===void 0?void 0:c[0])||er.REQUEST;return(u=r[m])!==null&&u!==void 0||(r[m]={}),r[m][h]=f,r},{});return Object.entries(s).reduce((r,[o,c])=>(r[o]=ro(c,e),r),t)}function Lu(a,e,t){return v(a,Ru(e,t))}const Du="CMCD";function Cu(a,e={}){if(!a)return"";const t=ro(a,e);return`${Du}=${encodeURIComponent(t)}`}const ao=/CMCD=[^&#]+/;function Ou(a,e,t){const i=Cu(e,t);if(!i)return a;if(ao.test(a))return a.replace(ao,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Pu{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=n=>{try{this.apply(n,{ot:Dn.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=n=>{try{const{frag:s,part:r}=n,o=this.hls.levels[s.level],c=this.getObjectType(s),u={d:(r||s).duration*1e3,ot:c};(c===Dn.VIDEO||c===Dn.AUDIO||c==Dn.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const h=r?this.getNextPart(r):this.getNextFrag(s);h!=null&&h.url&&h.url!==s.url&&(u.nor=h.url),this.apply(n,u)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHED,this.onMediaDetached,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHED,this.onMediaDetached,this),e.off(g.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 i,n;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:1,sf:eu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){v(t,this.createData());const i=t.ot===Dn.INIT||t.ot===Dn.VIDEO||t.ot===Dn.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((r,o)=>(n.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),Lu(e.headers,t,s)):e.url=Ou(e.url,t,s)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const n=e.sn-i.startSN;return i.fragments[n+1]}}getNextPart(e){var t,i;const{index:n,fragment:s}=e,r=(t=this.hls.levels[s.level])==null||(i=t.details)==null?void 0:i.partList;if(r){const{sn:o}=s;for(let c=r.length-1;c>=0;c--){const u=r[c];if(u.index===n&&u.fragment.sn===o)return r[c+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Dn.TIMED_TEXT;if(e.sn==="initSegment")return Dn.INIT;if(t==="audio")return Dn.AUDIO;if(t==="main")return this.hls.audioTracks.length?Dn.VIDEO:Dn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Dn.AUDIO)i=n.audioTracks;else{const s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;i=n.levels.slice(0,r)}for(const s of i)s.bitrate>t&&(t=s.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===Dn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:_t.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}}const ku=3e5;class Mu extends U{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(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.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(i=>i!==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:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===ri.SendAlternateToPenaltyBox&&i.flags===jt.MoveAllAlternatesMatchingHost){const n=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&n?r=this.getPathwayForGroupId(o,u,r):c&&(r=c)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&n&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${n&&n.length} priorities: ${Qt(s)} penalized: ${Qt(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}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 i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(s=>{n-i[s]>ku&&delete i[s]});for(let s=0;s<e.length;s++){const r=e[s];if(r in i)continue;if(r===this.pathwayId)return;const o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,hr(t),this.hls.trigger(g.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];c&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let s=0;s<n.length;s++)if(t===ee.AUDIO_TRACK&&n[s].hasAudioGroup(e)||t===ee.SUBTITLE_TRACK&&n[s].hasSubtitleGroup(e))return n[s].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},n={};e.forEach(s=>{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":c}=s;if(t.some(h=>h.pathwayId===r))return;const u=this.getLevelsForPathway(o).map(h=>{const f=new Zt(h.attrs);f["PATHWAY-ID"]=r;const m=f.AUDIO&&`${f.AUDIO}_clone_${r}`,E=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;m&&(i[f.AUDIO]=m,f.AUDIO=m),E&&(n[f.SUBTITLES]=E,f.SUBTITLES=E);const y=lo(h.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),w=new on({attrs:f,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:y,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let k=1;k<h.audioGroups.length;k++)w.addGroupId("audio",`${h.audioGroups[k]}_clone_${r}`);if(h.subtitleGroups)for(let k=1;k<h.subtitleGroups.length;k++)w.addGroupId("text",`${h.subtitleGroups[k]}_clone_${r}`);return w});t.push(...u),oo(this.audioTracks,i,c,r),oo(this.subtitleTracks,n,c,r)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let n;try{n=new self.URL(e)}catch(h){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+h)}const s={responseType:"json",url:n.href},r=t.steeringManifestLoadPolicy.default,o=r.errorRetry||r.timeoutRetry||{},c={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(h,f,m,E)=>{this.log(`Loaded steering manifest: "${n}"`);const y=h.data;if((y==null?void 0:y.VERSION)!==1){this.log(`Steering VERSION ${y.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=y.TTL;const{"RELOAD-URI":w,"PATHWAY-CLONES":k,"PATHWAY-PRIORITY":z}=y;if(w)try{this.uri=new self.URL(w,n).href}catch(q){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${w}`);return}this.scheduleRefresh(this.uri||m.url),k&&this.clonePathways(k);const ie={steeringManifest:y,url:n.toString()};this.hls.trigger(g.STEERING_MANIFEST_LOADED,ie),z&&this.updatePathwayPriority(z)},onError:(h,f,m,E)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${f.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let y=this.timeToLoad*1e3;if(h.code===429){const w=this.loader;if(typeof(w==null?void 0:w.getResponseHeader)=="function"){const k=w.getResponseHeader("Retry-After");k&&(y=parseFloat(k)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,y)},onTimeout:(h,f,m)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(s,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const n=(i=this.hls)==null?void 0:i.media;if(n&&!n.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function oo(a,e,t,i){a&&Object.keys(e).forEach(n=>{const s=a.filter(r=>r.groupId===n).map(r=>{const o=v({},r);return o.details=void 0,o.attrs=new Zt(o.attrs),o.url=o.attrs.URI=lo(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[n],o.attrs["PATHWAY-ID"]=i,o});a.push(...s)})}function lo(a,e,t,i){const{HOST:n,PARAMS:s,[t]:r}=i;let o;e&&(o=r==null?void 0:r[e],o&&(a=o));const c=new self.URL(a);return n&&!o&&(c.host=n),s&&Object.keys(s).sort().forEach(u=>{u&&c.searchParams.set(u,s[u])}),c.href}class Ns extends U{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.setMediaKeysQueue=Ns.CDMCleanupPromise?[Ns.CDMCleanupPromise]:[],this.onMediaEncrypted=t=>{const{initDataType:i,initData:n}=t,s=`"${t.type}" event: init data type: "${i}"`;if(this.debug(s),n!==null){if(!this.keyFormatPromise){let r=Object.keys(this.keySystemAccessPromises);r.length||(r=Qe(this.config));const o=r.map(Bn).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=zn(r);let c,u;if(i==="sinf"){if(o!==Yt.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const y=ze(new Uint8Array(n));try{const w=Sn(JSON.parse(y).sinf),k=Ze(w);if(!k)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(k.subarray(8,24)),u=Yt.FAIRPLAY}catch(w){this.warn(`${s} Failed to parse sinf: ${w}`);return}}else{if(o!==Yt.WIDEVINE&&o!==Yt.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const y=Ke(n),w=y.filter(z=>!!z.systemId&&is(z.systemId)===o);w.length>1&&this.warn(`${s} Using first of ${w.length} pssh found for selected key-system ${o}`);const k=w[0];if(!k){y.length===0||y.some(z=>!z.systemId)?this.warn(`${s} contains incomplete or invalid pssh data`):this.log(`ignoring ${s} for ${y.map(z=>is(z.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(u=is(k.systemId),k.version===0&&k.data)if(u===Yt.WIDEVINE){const z=k.data.length-22;c=new Uint8Array(k.data.subarray(z,z+16))}else u===Yt.PLAYREADY&&(c=ui(k.data))}if(!u||!c)return;const h=R.hexDump(c),{keyIdToKeySessionPromise:f,mediaKeySessions:m}=this;let E=f[h];for(let y=0;y<m.length;y++){const w=m[y],k=w.decryptdata;if(!k.keyId)continue;const z=R.hexDump(k.keyId);if(h===z||k.uri.replace(/-/g,"").indexOf(h)!==-1){if(E=f[z],k.pssh)break;delete f[z],k.pssh=new Uint8Array(n),k.keyId=c,E=f[h]=E.then(()=>this.generateRequestWithPreferredKeySession(w,i,n,"encrypted-event-key-match")),E.catch(ie=>this.handleError(ie));break}}if(!E){if(u!==o){this.log(`Ignoring "${t.type}" event with ${u} init data for selected key-system ${o}`);return}E=f[h]=this.getKeySystemSelectionPromise([u]).then(({keySystem:y,mediaKeys:w})=>{var k;this.throwIfDestroyed();const z=new Yn("ISO-23001-7",h,(k=Bn(y))!=null?k:"");return z.pssh=new Uint8Array(n),z.keyId=c,this.attemptSetMediaKeys(y,w).then(()=>{this.throwIfDestroyed();const ie=this.createMediaKeySessionContext({decryptdata:z,keySystem:y,mediaKeys:w});return this.generateRequestWithPreferredKeySession(ie,i,n,"encrypted-event-no-match")})}),E.catch(y=>this.handleError(y))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){const e=this.media;this.unregisterListeners(),this.onMediaDetached(),this._clear(e);const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(g.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(g.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(g.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(g.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(g.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t[e];if(n)return n.licenseUrl;if(e===Yt.WIDEVINE&&i)return i}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,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(r,o,c)=>!!r&&c.indexOf(r)===o,n=t.map(r=>r.audioCodec).filter(i),s=t.map(r=>r.videoCodec).filter(i);return n.length+s.length===0&&s.push("avc1.42e01e"),new Promise((r,o)=>{const c=u=>{const h=u.shift();this.getMediaKeysPromise(h,n,s).then(f=>r({keySystem:h,mediaKeys:f})).catch(f=>{u.length?c(u):f instanceof Gn?o(f):o(new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return It===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return i(e,t)}getMediaKeysPromise(e,t,i){const n=ki(e,t,i,this.config.drmSystemOptions),s=this.keySystemAccessPromises[e];let r=s==null?void 0:s.keySystemAccess;if(!r){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Qt(n)}`),r=this.requestMediaKeySystemAccess(e,n);const o=this.keySystemAccessPromises[e]={keySystemAccess:r};return r.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),r.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const u=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=c.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),u.then(f=>f?this.setMediaKeysServerCertificate(h,e,f):h))),o.mediaKeys.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),o.mediaKeys})}return r.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${R.hexDump(e.keyId||[])}`);const n=i.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,s,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 R.hexDump(e.keyId)}updateKeySession(e,t){var i;const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${R.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
|
|
} (data length: ${t&&t.byteLength})`),n.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const n=Qe(this.config),s=e.map(zn).filter(r=>!!r&&n.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:r})=>{const o=Bn(r);o?t(o):i(new Error(`Unable to find format for key-system "${r}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),n=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);let s=this.keyIdToKeySessionPromise[i];return s||(s=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(o,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:o,mediaKeys:c,decryptdata:t}))))),(this.keyIdToKeySessionPromise[i]=s.then(o=>{const c="cenc",u=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(o,c,u,"playlist-key")})).catch(o=>this.handleError(o))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Gn?this.hls.trigger(g.ERROR,e.data):this.hls.trigger(g.ERROR,{type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=zn(e.keyFormat),s=n?[n]:Qe(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Qe(this.config)),e.length===0)throw new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Qt({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>i.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var s,r;const o=(s=this.config.drmSystems)==null||(r=s[e.keySystem])==null?void 0:r.generateRequest;if(o)try{const y=o.call(this.hls,t,i,e);if(!y)throw new Error("Invalid response from configured generateRequest filter");t=y.initDataType,i=y.initData?y.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(y){var c;if(this.warn(y.message),(c=this.hls)!=null&&c.config.debug)throw y}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const u=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${u} (init data type: ${t} length: ${i?i.byteLength:null})`);const h=new Ur,f=e._onmessage=y=>{const w=e.mediaKeysSession;if(!w){h.emit("error",new Error("invalid state"));return}const{messageType:k,message:z}=y;this.log(`"${k}" message event for session "${w.sessionId}" message size: ${z.byteLength}`),k==="license-request"||k==="license-renewal"?this.renewLicense(e,z).catch(ie=>{h.eventNames().length?h.emit("error",ie):this.handleError(ie)}):k==="license-release"?e.keySystem===Yt.FAIRPLAY&&(this.updateKeySession(e,Pi("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${k}"`)},m=e._onkeystatuseschange=y=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const k=e.keyStatus;h.emit("keyStatus",k),k==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",f),e.mediaKeysSession.addEventListener("keystatuseschange",m);const E=new Promise((y,w)=>{h.on("error",w),h.on("keyStatus",k=>{k.startsWith("usable")?y():k==="output-restricted"?w(new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):k==="internal-error"?w(new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${k}"`)):k==="expired"?w(new Error("key expired while generating request")):this.warn(`unhandled key status change "${k}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var y;this.log(`Request generated for key-session "${(y=e.mediaKeysSession)==null?void 0:y.sessionId}" keyId: ${u}`)}).catch(y=>{throw new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_NO_SESSION,error:y,fatal:!1},`Error generating key-session request: ${y}`)}).then(()=>E).catch(y=>{throw h.removeAllListeners(),this.removeSession(e),y}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${R.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${R.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,n=new i(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,o)=>{const c={responseType:"arraybuffer",url:s},u=t.certLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(m,E,y,w)=>{r(m.data)},onError:(m,E,y,w)=>{o(new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:b({url:c.url,data:void 0},m)},`"${e}" certificate request failed (${s}). Status: ${m.code} (${m.text})`))},onTimeout:(m,E,y)=>{o(new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(m,E,y)=>{o(new Error("aborted"))}};n.load(c,h,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,s)=>{e.setServerCertificate(i).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),n(e)}).catch(r=>{s(new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:n,fatal:!0},n.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=new DOMParser().parseFromString(i,"application/xml"),s=n.querySelectorAll("HttpHeader");if(s.length>0){let h;for(let f=0,m=s.length;f<m;f++){var r,o;h=s[f];const E=(r=h.querySelector("name"))==null?void 0:r.textContent,y=(o=h.querySelector("value"))==null?void 0:o.textContent;E&&y&&e.setRequestHeader(E,y)}}const c=n.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return Pi(atob(u))}setupLicenseXHR(e,t,i,n){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,i,n)}).catch(r=>{if(!i.decryptdata)throw r;return e.open("POST",t,!0),s.call(this.hls,e,t,i,n)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((n,s)=>{const r=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${r}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let c=o.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const u=this.config.licenseResponseCallback;if(u)try{c=u.call(this.hls,o,r,e)}catch(h){this.error(h)}n(c)}else{const c=i.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)s(new Gn({type:J.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:r,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${r}). Status: ${o.status} (${o.statusText})`));else{const h=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(n,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,r,e,t).then(({xhr:c,licenseChallenge:u})=>{e.keySystem==Yt.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null)}_clear(e){var t;const i=this.mediaKeySessions;this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Yn.clearKeyUriToKeyIdMap();const n=i.length;Ns.CDMCleanupPromise=Promise.all(i.map(s=>this.removeSession(s)).concat(e==null||(t=e.setMediaKeys(null))==null?void 0:t.catch(s=>{var r;this.log(`Could not clear media keys: ${s}`),(r=this.hls)==null||r.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).then(()=>{n&&(this.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(s=>{var r;this.log(`Could not close sessions and clear media keys: ${s}`),(r=this.hls)==null||r.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,s)=>(n.indexOf(s.keyFormat)===-1&&n.push(s.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=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),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);return n>-1&&this.mediaKeySessions.splice(n,1),t.remove().catch(s=>{var r;this.log(`Could not remove session: ${s}`),(r=this.hls)==null||r.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${s}`)})}).then(()=>t.close()).catch(s=>{var r;this.log(`Could not close session: ${s}`),(r=this.hls)==null||r.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${s}`)})})}}}Ns.CDMCleanupPromise=void 0;class Gn 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 Nu{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(g.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(g.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(g.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const s=n-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*r/s,u=this.hls;if(u.trigger(g.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),c>0&&r>u.config.fpsDroppedMonitoringThreshold*o){let h=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=h)&&(h=h-1,u.trigger(g.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,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 uo(a,e){let t;try{t=new Event("addtrack")}catch(i){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function co(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(e.id))try{if(a.addCue(e),!a.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){Y.debug(`[texttrack-utils]: ${i}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,a.addCue(n)}catch(n){Y.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function Fs(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let i=a.cues.length;i--;)e&&a.cues[i].removeEventListener("enter",e),a.removeCue(a.cues[i]);t==="disabled"&&(a.mode=t)}function ra(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=Bu(a.cues,e,t);for(let r=0;r<s.length;r++)(!i||i(s[r]))&&a.removeCue(s[r])}n==="disabled"&&(a.mode=n)}function Fu(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let i=0,n=t,s;for(;i<=n;)if(s=Math.floor((n+i)/2),e<a[s].startTime)n=s-1;else if(e>a[s].startTime&&i<t)i=s+1;else return s;return a[i].startTime-e<e-a[n].startTime?i:n}function Bu(a,e,t){const i=[],n=Fu(a,e);if(n>-1)for(let s=n,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function Sr(a){const e=[];for(let t=0;t<a.length;t++){const i=a[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(a[t])}return e}class Uu extends Jr{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 i=Sr(this.media.textTracks);for(let s=0;s<i.length;s++)if(i[s].mode==="hidden")t=i[s];else if(i[s].mode==="showing"){t=i[s];break}const n=this.findTrackForTextTrack(t);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(g.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(g.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 i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;Sr(i.textTracks).forEach(r=>{Fs(r)})}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:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Subtitle track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(r=>(n==null?void 0:n.indexOf(r))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(h=>!i||i.indexOf(h.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(h=>h.default)&&(this.selectDefaultTrack=!1),r.forEach((h,f)=>{h.id=f});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=r;const o=this.hls.config.subtitlePreference;if(!s&&o){this.selectDefaultTrack=!1;const h=Ae(o,r);if(h>-1)s=r[h];else{const f=Ae(o,this.tracks);s=this.tracks[f]}}let c=this.findTrackId(s);c===-1&&s&&(c=this.findTrackId(null));const u={subtitleTracks:r};this.log(`Updating subtitle tracks, ${r.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(g.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const s=t[n];if(!(i&&!s.default||!i&&!e)&&(!e||Ce(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(qs(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(qs(e.attrs,s.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(qr(n,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ee.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 i=this.currentTrack;if(i&&Ce(e,i))return i;const n=Ae(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=Ae(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(g.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Sr(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(s=>qr(i,s))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==n&&(s.mode="disabled")}),n){const s=this.subtitleDisplay?"showing":"hidden";n.mode!==s&&(n.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!K(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger(g.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&s)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:r,groupId:o="",name:c,type:u,url:h}=n;this.hls.trigger(g.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:u,url:h});const f=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(f)}}function tr(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const Bs=.025;let Tr=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function $u(a,e,t){return`${a.identifier}-${t+1}-${tr(e)}`}class Gu{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){if(e>=this.assetList.length)return!0;const t=this.playoutLimit;return e<=0||isNaN(t)?!1:this.assetList[e].startOffset>t}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 aa(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,i=aa(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=K(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 aa(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)<Bs))}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"?Tr.Range:Tr.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 Ku(this)}}function aa(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<Bs)?e.start:e.start+e.duration}function ho(a,e,t){const i=new self.URL(a,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Ku(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function oa(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Hu{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{const u=this.interstitial.playoutLimit,h=this.currentTime;this.startOffset+h>=u&&this.hls.trigger(g.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=n;let r=n.uri;try{r=ho(r,s.sessionId).href}catch(c){}s.loadSource(r);const o=()=>{this.hasDetails=!0};s.once(g.LEVEL_LOADED,o),s.once(g.AUDIO_TRACK_LOADED,o),s.once(g.SUBTITLE_TRACK_LOADED,o),s.on(g.MEDIA_ATTACHING,(c,{media:u})=>{this.removeMediaListeners(),this.mediaAttached=u,this.interstitial.playoutLimit&&u.addEventListener("timeupdate",this.checkPlayout)})}bufferedInPlaceToEnd(e){var t;if(!this.interstitial.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,n=_t.bufferInfo(e,i,0);return this.getAssetTime(n.end)>=this._bufferedEosTime-.02}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=_t.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 i=e-t;if(Math.abs(i)>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,i=this.duration;return Math.min(Math.max(0,e-t),i)}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()}on(e,t,i){this.hls.on(e,t)}once(e,t,i){this.hls.once(e,t)}off(e,t,i){this.hls.off(e,t)}toString(){var e,t;return`HlsAssetPlayer: ${oa(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${(t=this.interstitial)!=null&&t.appendInPlace?"append-in-place":""}`}}const fo=.033;class Wu extends U{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((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i,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 i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(s=n[i])!=null&&s.event;){var s;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;n<i.length;n++){let s=i[n];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return n}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let n=e;n<=t&&i[n];n++){const s=i[n].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return n}return-1}findEventIndex(e){const t=this.items;if(t)for(let n=t.length;n--;){var i;if(((i=t[n].event)==null?void 0:i.identifier)===e)return n}return-1}findAssetIndex(e,t){const i=e.assetList,n=i.length;if(n>1)for(let s=0;s<n;s++){const r=i[s];if(!r.error){const o=r.timelineStart;if(t===o||t>o&&t<o+(r.duration||0))return s}}return 0}get assetIdAtEnd(){var e,t;const i=(e=this.items)==null||(t=e[this.length-1])==null?void 0:t.event;if(i){const n=i.assetList,s=n[n.length-1];if(s)return s.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:n}=i,s=this.events,r=this.parseDateRanges(n,{url:i.url},t),o=Object.keys(n),c=s?s.filter(u=>!o.includes(u.identifier)):[];r.length&&r.sort((u,h)=>{const f=u.cue.pre,m=u.cue.post,E=h.cue.pre,y=h.cue.post;if(f&&!E)return-1;if(E&&!f||m&&!y)return 1;if(y&&!m)return-1;if(!f&&!E&&!m&&!y){const w=u.startTime,k=h.startTime;if(w!==k)return w-k}return u.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=r,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[]){const i=this.events||[];if(i.length||t.length||this.length<2){const n=this.items,s=this.parseSchedule(i,e);(t.length||(n==null?void 0:n.length)!==s.length||s.some((o,c)=>Math.abs(o.playout.start-n[c].playout.start)>.005||Math.abs(o.playout.end-n[c].playout.end)>.005))&&(this.items=s,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,i){const n=[],s=Object.keys(e);for(let r=0;r<s.length;r++){const o=s[r],c=e[o];if(c.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(c):(u=new Gu(c,t),this.eventMap[o]=u,i===!1&&(u.appendInPlace=i)),n.push(u)}}return n}parseSchedule(e,t){const i=[],n=t.main.details,s=n.live?1/0:n.edge;let r=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,u=0;if(e.forEach((h,f)=>{const m=h.cue.pre,E=h.cue.post,y=e[f-1]||null,w=h.appendInPlace,k=E?s:h.startOffset,z=h.duration,ie=h.timelineOccupancy===Tr.Range?z:0,q=h.resumptionOffset,le=(y==null?void 0:y.startTime)===k,ce=k+h.cumulativeDuration;let Se=w?ce+z:k+q;if(m||!E&&k<=0){const Ee=u;u+=ie,h.timelineStart=ce;const Re=r;r+=z,i.push({event:h,start:ce,end:Se,playout:{start:Re,end:r},integrated:{start:Ee,end:u}})}else if(k<=s){if(!le){const ge=k-c;if(ge>fo){const $e=c,Ve=u;u+=ge;const Xt=r;r+=ge;const Lt={previousEvent:e[f-1]||null,nextEvent:h,start:$e,end:$e+ge,playout:{start:Xt,end:r},integrated:{start:Ve,end:u}};i.push(Lt)}else ge>0&&y&&(y.cumulativeDuration+=ge,i[i.length-1].end=k)}E&&(Se=ce),h.timelineStart=ce;const Ee=u;u+=ie;const Re=r;r+=z,i.push({event:h,start:ce,end:Se,playout:{start:Re,end:r},integrated:{start:Ee,end:u}})}else return;const he=h.resumeTime;E||he>s?c=s:c=he}),c<s){var o;const h=c,f=u,m=s-c;u+=m;const E=r;r+=m,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:h+m,playout:{start:E,end:r},integrated:{start:f,end:u}})}this.setDurations(s,r,u)}else i.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,n=i.live?1/0:i.edge;let s=0,r=-1;e.forEach((o,c)=>{const u=o.cue.pre,h=o.cue.post,f=u?0:h?n:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!h&&o.snapOptions.in&&(o.resumeAnchor=Ye(null,i.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<fo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const E=K(o.resumeOffset)?o.resumeOffset:o.duration;s+=E})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>Bs?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1):t?!Object.keys(t).some(r=>{const o=t[r].details,c=o.edge;if(i>=c)return this.log(`"${e.identifier}" resumption ${i} past ${r} playlist end ${c}`),!1;const u=Ye(null,o.fragments,i);if(!u)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${r} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const h=r==="audio"?.175:0;return Math.abs(u.start-i)<Bs+h||Math.abs(u.end-i)<Bs+h?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${r} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)}):(this.log(`"${e.identifier}" resumption ${i} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,n=!1,s=!1;e.assetList.forEach((r,o)=>{const c=t+i;r.startOffset=i,r.timelineStart=c,n||(n=r.duration===null),s||(s=!!r.error);const u=r.error?0:r.duration||0;i+=u}),n&&!s?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function ms(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class ju{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=ho(i,this.hls.sessionId,e.baseUrl)}catch(m){const E=this.assignAssetListError(e,D.ASSET_LIST_LOAD_ERROR,m,i);this.hls.trigger(g.ERROR,E);return}t&&n.protocol!=="data:"&&n.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=s.loader,o=new r(s),c={responseType:"json",url:n.href},u=s.interstitialAssetListLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(m,E,y,w)=>{const k=m.data,z=k==null?void 0:k.ASSETS;if(!Array.isArray(z)){const ie=this.assignAssetListError(e,D.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),y.url,E,w);this.hls.trigger(g.ERROR,ie);return}e.assetListResponse=k,this.hls.trigger(g.ASSET_LIST_LOADED,{event:e,assetListResponse:k,networkDetails:w})},onError:(m,E,y,w)=>{const k=this.assignAssetListError(e,D.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${m.code} ${m.text} (${E.url})`),E.url,w,y);this.hls.trigger(g.ERROR,k)},onTimeout:(m,E,y)=>{const w=this.assignAssetListError(e,D.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${E.url})`),E.url,m,y);this.hls.trigger(g.ERROR,w)}};return o.load(c,h,f),this.hls.trigger(g.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,n,s,r){return e.error=i,{type:J.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function hs(a,e,t){rs(a,e,t),a.addEventListener(e,t)}function rs(a,e,t){a.removeEventListener(e,t)}function po(a){a==null||a.play().catch(()=>{})}class Vu extends U{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 i=this.currentTime;if(i===void 0||this.playbackDisabled)return;const n=i-this.timelinePos;if(Math.abs(n)<1/7056e5)return;const r=n<=-.01;this.timelinePos=i,this.bufferedPos=i;const o=this.playingItem;if(!o){this.checkBuffer();return}if(r&&this.schedule.resetErrorsInRange(i,i-n)&&this.updateSchedule(),this.checkBuffer(),r&&i<o.start||i>=o.end){var c;const m=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r){const E=this.findItemIndex(o);if(m>E){const y=this.schedule.findJumpRestrictedIndex(E+1,m);if(y>E){this.setSchedulePosition(y);return}}}this.setSchedulePosition(m);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const m=o.event.assetList[0];m&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,m))}return}const h=u.timelineStart,f=u.duration||0;(r&&i<h||i>=h+f)&&this.setScheduleToAssetAtTime(i,u)},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const n=this.playingItem;if(!n||this.playingLastItem)return;if(i>=n.end){this.timelinePos=n.end;const o=this.findItemIndex(n);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const r=s.timelineStart+(s.duration||0);i>=r&&this.setScheduleToAssetAtTime(i,s)},this.onScheduleUpdate=(i,n)=>{const s=this.schedule,r=this.playingItem,o=s.events||[],c=s.items||[],u=s.durations,h=i.map(E=>E.identifier),f=!!(o.length||h.length);if(f&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
|
|
Schedule: ${c.map(E=>ms(E))}`),h.length&&this.log(`Removed events ${h}`),this.playerQueue.forEach(E=>{if(E.interstitial.appendInPlace){const y=E.assetItem.timelineStart,w=E.timelineOffset-y;if(w)try{E.timelineOffset=y}catch(k){Math.abs(w)>Bs&&this.warn(`${k} ("${E.assetId}" ${E.timelineOffset}->${y})`)}}}),r){const E=this.updateItem(r,this.timelinePos);this.itemsMatch(r,E)&&(this.playingItem=E,this.waitingItem=this.endedItem=null)}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const m=this.bufferingItem;if(m){const E=this.updateItem(m,this.bufferedPos);this.itemsMatch(m,E)?this.bufferingItem=E:m.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(m.event,null))}if(i.forEach(E=>{E.assetList.forEach(y=>{this.clearAssetPlayer(y.identifier,null)})}),f||n){if(this.hls.trigger(g.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:u,removedIds:h}),this.isInterstitial(r)&&h.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new ju(e),this.schedule=new Wu(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(g.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(g.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(g.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(g.MEDIA_ENDED,this.onMediaEnded,this),e.on(g.ERROR,this.onError,this),e.on(g.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(g.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(g.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(g.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(g.BUFFER_CODECS,this.onBufferCodecs,this),e.off(g.BUFFER_APPENDED,this.onBufferAppended,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(g.MEDIA_ENDED,this.onMediaEnded,this),e.off(g.ERROR,this.onError,this),e.off(g.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){rs(e,"play",this.onPlay),rs(e,"pause",this.onPause),rs(e,"seeking",this.onSeeking),rs(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;hs(i,"seeking",this.onSeeking),hs(i,"timeupdate",this.onTimeupdate),hs(i,"play",this.onPlay),hs(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!n){this.clearScheduleState();const s=this.findItemIndex(i);this.setSchedulePosition(s)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=f=>f&&e.getAssetPlayer(f.identifier),n=(f,m,E,y,w)=>{if(f){let k=f[m].start;const z=f.event;if(z){if(m==="playout"||z.timelineOccupancy!==Tr.Point){const ie=i(E);(ie==null?void 0:ie.interstitial)===z&&(k+=ie.assetItem.startOffset+ie[w])}}else{const ie=y==="bufferedPos"?r():e[y];k+=ie-f.start}return k}return 0},s=(f,m)=>{if(f!==0&&m!=="primary"&&e.schedule.length){var E;const y=e.schedule.findItemIndexAtTime(f),w=(E=e.schedule.items)==null?void 0:E[y];if(w){const k=w[m].start-w.start;return f+k}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var m;return(m=e.primaryDetails)!=null&&m.live?e.primaryDetails.edge:e.schedule.durations[f]},c=(f,m)=>{var E,y;const w=e.effectivePlayingItem;if(w!=null&&(E=w.event)!=null&&E.restrictions.skip)return;e.log(`seek to ${f} "${m}"`);const k=e.effectivePlayingItem,z=e.schedule.findItemIndexAtTime(f,m),ie=(y=e.schedule.items)==null?void 0:y[z],q=e.getBufferingPlayer(),le=q==null?void 0:q.interstitial,ce=le==null?void 0:le.appendInPlace,Se=k&&e.itemsMatch(k,ie);if(k&&(ce||Se)){const Ee=i(e.playingAsset),Re=(Ee==null?void 0:Ee.media)||e.primaryMedia;if(Re){const ge=m==="primary"?Re.currentTime:n(k,m,e.playingAsset,"timelinePos","currentTime"),$e=f-ge,Ve=(ce?ge:Re.currentTime)+$e;if(Ve>=0&&(!Ee||ce||Ve<=Ee.duration)){Re.currentTime=Ve;return}}}if(ie){let Ee=f;if(m!=="primary"){const ge=ie[m].start,$e=f-ge;Ee=ie.start+$e}const Re=!e.isInterstitial(ie);if((!e.isInterstitial(k)||k.event.appendInPlace)&&(Re||ie.event.appendInPlace)){const ge=e.media||(ce?q==null?void 0:q.media:null);ge&&(ge.currentTime=Ee)}else if(k){const ge=e.findItemIndex(k);if(z>ge){const Ve=e.schedule.findJumpRestrictedIndex(ge+1,z);if(Ve>ge){e.setSchedulePosition(Ve);return}}let $e=0;if(Re)e.timelinePos=Ee,e.checkBuffer();else{var he;const Ve=ie==null||(he=ie.event)==null?void 0:he.assetList;if(Ve){const Xt=f-(ie[m]||ie).start;for(let Lt=Ve.length;Lt--;){const vt=Ve[Lt];if(vt.duration&&Xt>=vt.startOffset&&Xt<vt.startOffset+vt.duration){$e=Lt;break}}}}e.setSchedulePosition(z,$e)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const m=t();return e.isInterstitial(m)?m:null},h={get currentTime(){const f=u(),m=e.effectivePlayingItem;return m&&m===f?n(m,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-m.playout.start:0},set currentTime(f){const m=u(),E=e.effectivePlayingItem;E&&E===m&&c(f+E.playout.start,"playout")},get duration(){const f=u();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const m=(f=u())==null?void 0:f.event.assetList;return m?m.map(E=>e.getAssetPlayer(E.identifier)):[]},get playingIndex(){var f;const m=(f=u())==null?void 0:f.event;return m&&e.effectivePlayingAsset?m.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};this.manager={get events(){var f,m;return((f=e.schedule)==null||(m=f.events)==null?void 0:m.slice(0))||[]},get schedule(){var f,m;return((f=e.schedule)==null||(m=f.items)==null?void 0:m.slice(0))||[]},get interstitialPlayer(){return u()?h: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 r()},get currentTime(){const f=e.timelinePos;return f>0?f:0},set currentTime(f){c(f,"primary")},get duration(){return o("primary")},get seekableStart(){var f;return((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){c(f,"integrated")},get duration(){return o("integrated")},get seekableStart(){var f;return s(((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0,"integrated")}},skip:()=>{const f=e.effectivePlayingItem,m=f==null?void 0:f.event;if(m&&!m.restrictions.skip){const E=e.findItemIndex(f);if(m.appendInPlace){const y=f.playout.start+f.event.duration;c(y+.001,"playout")}else e.advanceAfterAssetEnded(m,E,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,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t,i;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let s=this.media;!s&&(e=this.bufferingItem)!=null&&(t=e.event)!=null&&t.appendInPlace&&(s=this.primaryMedia);const r=(i=s)==null?void 0:i.currentTime;if(!(r===void 0||!K(r)))return r}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 i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n){this.detachedData={media:n};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Qt(s)}`),this.detachedData=s}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let s=null;const r=this.hls,o=e!==r,c=o&&e.interstitial.appendInPlace,u=(i=this.detachedData)==null?void 0:i.mediaSource;let h;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),h="Primary";else if(u){const E=this.getBufferingPlayer();E?(s=E.transferMedia(),h=`${E}`):h="detached MediaSource"}else h="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${Qt(s)}`);else if(!this.detachedData||r.media===t){const E=this.playerQueue;E.length>1&&E.forEach(y=>{if(o&&y.interstitial.appendInPlace!==c){const w=y.interstitial;this.clearInterstitial(y.interstitial,null),w.appendInPlace=!1,w.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${w}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=s&&"mediaSource"in s&&((n=s.mediaSource)==null?void 0:n.readyState)!=="closed",m=f&&s?s:t;if(this.log(`${f?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${h}`),m===s){const E=o&&e.assetId===this.schedule.assetIdAtEnd;m.overrides={duration:this.schedule.duration,endOfStream:!o||E,cueRemoval:!o}}e.attachMedia(m)}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 i=this.timelinePos,n=this.effectivePlayingItem;if(i===-1){const s=this.hls.startPosition;if(this.timelinePos=s,t.length&&t[0].cue.pre){const r=e.findEventIndex(t[0].identifier);this.setSchedulePosition(r)}else if(s>=0||!this.primaryLive){const r=this.timelinePos=s>0?s:0,o=e.findItemIndexAtTime(r);this.setSchedulePosition(o)}}else if(n&&!this.playingItem){const s=e.findItemIndex(n);this.setSchedulePosition(s)}}advanceAfterAssetEnded(e,t,i){const n=i+1;if(!e.isAssetPastPlayoutLimit(n)&&!e.assetList[n].error)this.setSchedulePosition(t,n);else{const s=this.schedule.items;if(s){const r=t+1,o=s.length;if(r>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.timelinePos=c,this.checkBuffer()),this.setSchedulePosition(r)}}}setScheduleToAssetAtTime(e,t){const i=this.schedule,n=t.parentIdentifier,s=i.getEvent(n);if(s){const r=i.findEventIndex(n),o=i.findAssetIndex(s,e);this.setSchedulePosition(r,o)}}setSchedulePosition(e,t){const i=this.schedule.items;if(!i||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${t}`);const n=e>=0?i[e]:null,s=this.playingItem,r=this.playingLastItem;if(this.isInterstitial(s)){var o;const u=s.event,h=this.playingAsset,f=h==null?void 0:h.identifier,m=f?this.getAssetPlayer(f):null;if(m&&f&&(!this.eventItemsMatch(s,n)||t!==void 0&&f!==((o=u.assetList)==null?void 0:o[t].identifier))){var c;const E=u.findAssetIndex(h);this.log(`INTERSTITIAL_ASSET_ENDED ${E+1}/${u.assetList.length} ${oa(h)}`),this.endedAsset=h,this.playingAsset=null,this.hls.trigger(g.INTERSTITIAL_ASSET_ENDED,{asset:h,assetListIndex:E,event:u,schedule:i.slice(0),scheduleIndex:e,player:m}),this.retreiveMediaSource(f,n),m.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&m.detachMedia()}if(!this.eventItemsMatch(s,n)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${ms(s)}`),u.hasPlayed=!0,this.hls.trigger(g.INTERSTITIAL_ENDED,{event:u,schedule:i.slice(0),scheduleIndex:e}),u.cue.once)){this.updateSchedule();const E=this.schedule.items;if(n&&E){const y=this.schedule.findItemIndex(n);this.advanceSchedule(y,E,t,s,r)}return}}this.advanceSchedule(e,i,t,s,r)}advanceSchedule(e,t,i,n,s){const r=e>=0?t[e]:null,o=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(u=>{const h=u.interstitial,f=this.schedule.findEventIndex(h.identifier);(f<e||f>e+1)&&this.clearInterstitial(h,r)}),this.isInterstitial(r)){this.timelinePos=Math.min(Math.max(this.timelinePos,r.start),r.end);const u=r.event;i===void 0&&(i=this.schedule.findAssetIndex(u,this.timelinePos));const h=this.waitingItem;this.assetsBuffered(r,o)||this.setBufferingItem(r);let f=this.preloadAssets(u,i);if(this.eventItemsMatch(r,h||n)||(this.waitingItem=r,this.log(`INTERSTITIAL_STARTED ${ms(r)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(g.INTERSTITIAL_STARTED,{event:u,schedule:t.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!o){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=r;const m=u.assetList[i];if(!m){const E=t[e+1],y=this.media;E&&y&&!this.isInterstitial(E)&&y.currentTime<E.start&&(y.currentTime=this.timelinePos=E.start),this.advanceAfterAssetEnded(u,e,i||0);return}if(f||(f=this.getAssetPlayer(m.identifier)),f===null||f.destroyed){const E=u.assetList.length;this.warn(`asset ${i+1}/${E} player destroyed ${u}`),f=this.createAssetPlayer(u,m,i)}if(!this.eventItemsMatch(r,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(m))return;this.startAssetPlayer(f,i,t,e,o),this.shouldPlay&&po(f.media)}else r!==null?(this.resumePrimary(r,e,n),this.shouldPlay&&po(this.hls.media)):s&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e,t;return(e=this.mediaSelection)==null||(t=e.main)==null?void 0:t.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${ms(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let r=this.timelinePos;(r<e.start||r>=e.end)&&(r=this.getPrimaryResumption(e,t),this.timelinePos=r),this.attachPrimary(r,e)}if(!i)return;const s=this.schedule.items;s&&(this.log(`resumed ${ms(e)}`),this.hls.trigger(g.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(i<n.fragmentStart||i>n.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:_t.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs((((i=n.mainForwardBufferInfo)==null?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(g.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(g.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1)return;const i=this.hls.levels[t.level],n=b(b({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=b(b({},this.altSelection),{},{audio:i});return}const s=b(b({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=b(b({},this.altSelection),{},{subtitles:i});return}const s=b(b({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=ne(t);this.playerQueue.forEach(n=>n.hls.setAudioOption(t)||n.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=ne(t);this.playerQueue.forEach(n=>n.hls.setSubtitleOption(t)||t.id!==-1&&n.hls.setSubtitleOption(i))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let n=0;n<t.length;n++){const s=t[n];if(s.cue.post){var i;const r=this.schedule.findEventIndex(s.identifier),o=(i=this.schedule.items)==null?void 0:i[r];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){const i=this.schedule.items;if(e&&i){const n=this.findItemIndex(e,t);return i[n]||null}return null}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 i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.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 i=_t.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,t,e)}updateBufferedPos(e,t,i){const n=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const r=this.playingItem,o=this.findItemIndex(r);let c=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var u,h;const f=this.findItemIndex(s),m=Math.min(f+1,t.length-1),E=t[m];if((c===-1&&s&&e>=s.end||(u=E.event)!=null&&u.appendInPlace&&e+.01>=E.start)&&(c=m),m-o>1&&(s==null||(h=s.event)==null?void 0:h.appendInPlace)===!1)return;if(this.bufferedPos=e,c>f&&c>o)this.bufferedToItem(E);else{const y=this.primaryDetails;this.primaryLive&&y&&e>y.edge-y.targetduration&&E.start<y.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(E)&&this.preloadAssets(E.event,0)}}else i&&r&&!this.itemsMatch(r,s)&&(c===o?this.bufferedToItem(r):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(n=>{const s=this.getAssetPlayer(n.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:n,events:s}=i;if(!n||!s)return t;const r=this.isInterstitial(e),o=this.getBufferingPlayer();if(this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos)),!this.playbackDisabled){const c=o?o.remaining:t?t.end-this.timelinePos:0;this.log(`buffered to boundary ${ms(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),r?e.event.assetList.forEach(u=>{const h=this.getAssetPlayer(u.identifier);h&&h.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering()))}this.hls.trigger(g.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const n=this.detachedData;n?n.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=i.assetList.length===0&&!i.assetListLoader,s=i.cue.once;if(n||!s){const r=this.preloadAssets(i,t);if(r!=null&&r.interstitial.appendInPlace){const o=i.assetList[t],c=this.primaryMedia;o&&c&&this.bufferAssetPlayer(r,c)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,s=n===0&&!e.assetListLoader,r=e.cue.once;if(s){const c=e.timelineStart;if(e.appendInPlace){var o;const m=this.playingItem;!this.isInterstitial(m)&&(m==null||(o=m.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let u,h=0;if(!this.playingItem&&this.primaryLive&&(h=this.hls.startPosition,h===-1&&(h=this.hls.liveSyncPosition||0)),h&&!(e.cue.pre||e.cue.post)){const m=h-c;m>0&&(u=Math.round(m*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${u?` live-start: ${h} start-offset: ${u}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const f=this.assetListLoader.loadAssetList(e,u);f&&(e.assetListLoader=f)}else if(!r&&n){for(let c=t;c<n;c++){const u=e.assetList[c],h=this.getAssetPlayerQueueIndex(u.identifier);(h===-1||this.playerQueue[h].destroyed)&&!u.error&&this.createAssetPlayer(e,u,c)}return this.getAssetPlayer(e.assetList[t].identifier)}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(n=>{this.hls.trigger(g.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:n})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;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 i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,n,s,r){const o={parentIdentifier:e.identifier,identifier:$u(e,r,t),duration:s,startOffset:i,timelineStart:n,uri:r};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,i){this.log(`create HLSAssetPlayer for ${oa(t)}`);const n=this.hls,s=n.userConfig;let r=s.videoPreference;const o=n.loadLevelObj||n.levels[n.currentLevel];(r||o)&&(r=v({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const c=n.audioTracks[n.audioTrack],u=n.subtitleTracks[n.subtitleTrack];let h=0;if(this.primaryLive||e.appendInPlace){const q=this.timelinePos-t.timelineStart;if(q>1){const le=t.duration;le&&q<le&&(h=q)}}const f=t.identifier,m=b(b({},s),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:h,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:r,audioPreference:c||s.audioPreference,subtitlePreference:u||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(m.timelineOffset=t.timelineStart));const E=m.cmcd;E!=null&&E.sessionId&&E.contentId&&(m.cmcd=v({},E,{contentId:tr(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const y=new Hu(this.HlsPlayerClass,m,e,t);this.playerQueue.push(y),e.assetList[i]=t;const w=q=>{if(q.live){const Se=new Error(`Interstitials MUST be VOD assets ${e}`),he={fatal:!0,type:J.OTHER_ERROR,details:D.INTERSTITIAL_ASSET_ITEM_ERROR,error:Se};this.handleAssetItemError(he,e,this.schedule.findEventIndex(e.identifier),i,Se.message);return}const le=q.edge-q.fragmentStart,ce=t.duration;(ce===null||le>ce)&&(this.log(`Interstitial asset "${f}" duration change ${ce} > ${le}`),t.duration=le,this.updateSchedule())};y.on(g.LEVEL_UPDATED,(q,{details:le})=>w(le)),y.on(g.LEVEL_PTS_UPDATED,(q,{details:le})=>w(le));const k=(q,le)=>{const ce=this.getAssetPlayer(f);if(ce&&le.tracks){ce.off(g.BUFFER_CODECS,k),ce.tracks=le.tracks;const Se=this.primaryMedia;this.bufferingAsset===ce.assetItem&&Se&&!ce.media&&this.bufferAssetPlayer(ce,Se)}};y.on(g.BUFFER_CODECS,k);const z=()=>{var q;const le=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${le}`),!le)return;const ce=this.schedule.findEventIndex(e.identifier),Se=e.findAssetIndex(t),he=Se+1,Ee=(q=this.schedule.items)==null?void 0:q[ce];if(this.isInterstitial(Ee))if(Se!==-1&&!e.isAssetPastPlayoutLimit(he)&&!e.assetList[he].error)this.bufferedToItem(Ee,he);else{var Re;const ge=(Re=this.schedule.items)==null?void 0:Re[ce+1];ge&&this.bufferedToItem(ge)}};y.on(g.BUFFERED_TO_END,z);const ie=q=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const ce=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,ce,q)};return y.once(g.MEDIA_ENDED,ie(i)),y.once(g.PLAYOUT_LIMIT_REACHED,ie(1/0)),y.on(g.ERROR,(q,le)=>{const ce=this.getAssetPlayer(f);if(le.details===D.BUFFER_STALLED_ERROR){if(ce!=null&&ce.media){const Se=ce.currentTime,he=ce.duration-Se;Se&&e.appendInPlace&&he/ce.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${ce.media.currentTime}`),z()):(this.warn(`Stalled at ${Se} of ${Se+he} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(le,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${le.error} ${e}`)}),y.on(g.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const le=new Error(`Asset player destroyed unexpectedly ${f}`),ce={fatal:!0,type:J.OTHER_ERROR,details:D.INTERSTITIAL_ASSET_ITEM_ERROR,error:le};this.handleAssetItemError(ce,e,this.schedule.findEventIndex(e.identifier),i,le.message)}),this.hls.trigger(g.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:y}),y}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){this.log(`clearAssetPlayer "${e}" toSegment: ${t&&ms(t)}`);const n=this.playerQueue[i];this.transferMediaFromPlayer(n,t),this.playerQueue.splice(i,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,s){const{interstitial:r,assetItem:o,assetId:c}=e,u=r.assetList.length,h=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!h||h.identifier!==c)&&(h&&(this.clearAssetPlayer(h.identifier,i[n]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${e}`),this.hls.trigger(g.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:r,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var i,n;const{interstitial:s,assetItem:r,assetId:o}=e,c=this.schedule.findEventIndex(s.identifier),u=(i=this.schedule.items)==null?void 0:i[c];if(!u)return;this.setBufferingItem(u),this.bufferingAsset=r;const h=this.getBufferingPlayer();if(h===e)return;const f=s.appendInPlace;if(f&&(h==null?void 0:h.interstitial.appendInPlace)===!1)return;const m=(h==null?void 0:h.tracks)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(f&&r!==this.playingAsset){if(!e.tracks)return;if(m&&!ae(m,e.tracks)){const E=new Error(`Asset "${o}" SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(m)}')`),y={fatal:!0,type:J.OTHER_ERROR,details:D.INTERSTITIAL_ASSET_ITEM_ERROR,error:E},w=s.findAssetIndex(r);this.handleAssetItemError(y,s,c,w,E.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,n,s){if(e.details===D.BUFFER_STALLED_ERROR)return;const r=t.assetList[n]||null;let o=null;if(r){const f=this.getAssetPlayerQueueIndex(r.identifier);o=this.playerQueue[f]||null}const c=this.schedule.items,u=v({},e,{fatal:!1,errorAction:mi(!0),asset:r,assetListIndex:n,event:t,schedule:c,scheduleIndex:i,player:o});if(this.warn(`Asset item error: ${e.error}`),this.hls.trigger(g.INTERSTITIAL_ASSET_ERROR,u),!e.fatal)return;const h=new Error(s);r&&(this.playingAsset!==r&&this.clearAssetPlayer(r.identifier,null),r.error=h),t.assetList.some(f=>!f.error)?t.appendInPlace&&(t.error=h):t.error=h,this.primaryFallback(t)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(this.updateSchedule(),i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${i?ms(i):"<none>"} error: ${e.error}`),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));let n=this.timelinePos;n===-1&&(n=this.hls.startPosition);const s=this.updateItem(i,n);if(this.itemsMatch(i,s))this.clearInterstitial(e,null);else{const r=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(r)}}else this.checkStart()}onAssetListLoaded(e,t){var i;const n=t.event,s=n.identifier,r=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(s))return;const o=n.timelineStart,c=n.duration;let u=0;r.forEach((y,w)=>{const k=parseFloat(y.DURATION);this.createAsset(n,w,u,o+u,k,y.URI),u+=k}),n.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${c}) ${n}`);const h=this.waitingItem,f=(h==null?void 0:h.event.identifier)===s;this.updateSchedule();const m=(i=this.bufferingItem)==null?void 0:i.event;if(f){var E;const y=this.schedule.findEventIndex(s),w=(E=this.schedule.items)==null?void 0:E[y];if(w){if(!this.playingItem&&this.timelinePos>w.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==y){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.primaryFallback(n);return}this.setBufferingItem(w)}this.setSchedulePosition(y)}else if((m==null?void 0:m.identifier)===s&&m.appendInPlace){const y=n.assetList[0],w=this.getAssetPlayer(y.identifier),k=this.primaryMedia;y&&w&&k&&this.bufferAssetPlayer(w,k)}}onError(e,t){switch(t.details){case D.ASSET_LIST_PARSING_ERROR:case D.ASSET_LIST_LOAD_ERROR:case D.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&this.primaryFallback(i);break}case D.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const go=500;class zu extends xs{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",H.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(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(g.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(g.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(g.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=De.IDLE,this.setInterval(go),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:i,success:n}=t;if(V(i)&&(this.fragPrevious=i),this.state=De.IDLE,!n)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const o=i.start;for(let u=0;u<s.length;u++)if(o>=s[u].start&&o<=s[u].end){r=s[u];break}const c=i.start+i.duration;r?r.end=c:(r={start:o,end:c},s.push(r)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(i===0&&n!==Number.POSITIVE_INFINITY){const s=n-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(r=>{for(let o=0;o<r.length;){if(r[o].end<=s){r.shift();continue}else if(r[o].start<s)r[o].start=s;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(i,s,H.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===H.SUBTITLE&&(t.details===D.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==De.STOPPED&&(this.state=De.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Xa(this.levels,t)){this.levels=t.map(i=>new on(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new on(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,H.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const n=this.levels[this.currentTrackId];n!=null&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==De.STOPPED&&this.setInterval(go)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:s}=this,{details:r,id:o}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const c=s[o];if(o>=s.length||!c)return;this.log(`Subtitle track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(r.live||(i=c.details)!=null&&i.live){const f=this.mainDetails;if(r.deltaUpdateFailed||!f)return;const m=f.fragments[0];if(!c.details)r.hasProgramDateTime&&f.hasProgramDateTime?(cn(r,f),u=r.fragmentStart):m&&(u=m.start,js(r,u));else{var h;u=this.alignPlaylists(r,c.details,(h=this.levelLastLoaded)==null?void 0:h.details),u===0&&m&&(u=m.start,js(r,u))}}c.details=r,this.levelLastLoaded=c,o===n&&(this.hls.trigger(g.SUBTITLE_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===De.IDLE&&(Ye(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n!=null&&n.key&&n.iv&&mn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,ji(n.method)).catch(o=>{throw s.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();s.trigger(g.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:r,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=De.IDLE})}}doTick(){if(!this.media){this.state=De.IDLE;return}if(this.state===De.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:n}=this,s=this.getLoadPosition(),r=_t.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:o,len:c}=r,u=i.details,h=this.hls.maxBufferLength+u.levelTargetDuration;if(c>h)return;const f=u.fragments,m=f.length,E=u.edge;let y=null;const w=this.fragPrevious;if(o<E){const ie=n.maxFragLookUpTolerance,q=o>E-ie?0:ie;y=Ye(w,f,Math.max(f[0].start,o),q),!y&&w&&w.start<f[0].start&&(y=f[0])}else y=f[m-1];if(y=this.filterReplacedPrimary(y,i.details),!y)return;const k=y.sn-u.startSN,z=f[k-1];if(z&&z.cc===y.cc&&this.fragmentTracker.getState(z)===Ft.NOT_LOADED&&(y=z),this.fragmentTracker.getState(y)===Ft.NOT_LOADED){const ie=this.mapToInitFragWhenRequired(y);ie&&this.loadFragment(ie,i,o)}}}loadFragment(e,t,i){V(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Zu(this.tracksBuffered[this.currentTrackId]||[])}}class Zu{constructor(e){this.buffered=void 0;const t=(i,n,s)=>{if(n=n>>>0,n>s-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${s})`);return e[n][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const Yu={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},mo=a=>String.fromCharCode(Yu[a]||a),Qn=15,fs=100,Xu={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Qu={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Ju={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},qu={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ec=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class tc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;Y.log(`${this.time} [${e}] ${i}`)}}}const Ss=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class _o{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 i=0;i<t.length;i++){const n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class ic{constructor(){this.uchar=" ",this.penState=new _o}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class nc{constructor(e){this.chars=[],this.pos=0,this.currPenState=new _o,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<fs;t++)this.chars.push(new ic);this.logger=e}equals(e){for(let t=0;t<fs;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<fs;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<fs;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>fs&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=fs)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].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=mo(e);if(this.pos>=fs){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<fs;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 i=0;i<fs;i++){const n=this.chars[i].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class la{constructor(e){this.rows=[],this.currRow=Qn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Qn;t++)this.rows.push(new nc(e));this.logger=e}reset(){for(let e=0;e<Qn;e++)this.rows[e].clear();this.currRow=Qn-1}equals(e){let t=!0;for(let i=0;i<Qn;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Qn;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Qn;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 = "+Qt(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Qn;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const o=r.rows[s].cueStartTime,c=this.logger.time;if(o!==null&&c!==null&&o<c)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(r.rows[s+u])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,r=Math.max(s-1,0);i.setCursor(e.indent),e.color=i.chars[r].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Qt(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 i="",n=-1;for(let s=0;s<Qn;s++){const r=this.rows[s].getTextString();r&&(n=s+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
|
|
`)),i}getTextAndFormat(){return this.rows}}class vo{constructor(e,t,i){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 la(i),this.nonDisplayedMemory=new la(i),this.lastOutputScreen=new la(i),this.currRollUpRow=this.displayedMemory.rows[Qn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Qn-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 i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);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 i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+Qt(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 yo{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=rc(),this.logger=void 0;const n=this.logger=new tc;this.channels=[null,new vo(e,t,n),new vo(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const n=t[i]&127,s=t[i+1]&127;let r=!1,o=null;if(n===0&&s===0)continue;this.logger.log(3,()=>"["+Ss([t[i],t[i+1]])+"] -> ("+Ss([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(sc(n,s,c)){Ar(null,null,c),this.logger.log(3,()=>"Repeated command ("+Ss([n,s])+") is dropped");continue}Ar(n,s,this.cmdHistory),r=this.parseCmd(n,s),r||(r=this.parseMidrow(n,s)),r||(r=this.parsePAC(n,s)),r||(r=this.parseBackgroundAttributes(n,s))}else Ar(null,null,c);if(!r&&(o=this.parseChars(n,s),o)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Ss([n,s])+" orig: "+Ss([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(i||n))return!1;const s=e===20||e===21||e===23?1:2,r=this.channels[s];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=s,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Ss([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(n||s))return!1;const r=e<=23?1:2;t>=64&&t<=95?i=r===1?Xu[e]:Ju[e]:i=r===1?Qu[e]:qu[e];const o=this.channels[r];return o?(o.setPAC(this.interpretPAC(i,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,n.underline=(i&1)===1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((i-16)/2)*4,n}parseChars(e,t){let i,n=null,s=null;if(e>=25?(i=2,s=e-8):(i=1,s=e),s>=17&&s<=19){let r;s===17?r=t+80:s===18?r=t+112:r=t+144,this.logger.log(2,()=>"Special char '"+mo(r)+"' in channel "+i),n=[r]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+Ss(n).join(",")),n}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(i||n))return!1;let s;const r={};e===16||e===24?(s=Math.floor((t-32)/2),r.background=ec[s],t%2===1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Ar(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function Ar(a,e,t){t.a=a,t.b=e}function sc(a,e,t){return t.a===a&&t.b===e}function rc(){return{a:null,b:null}}var ua=function(){if(Ki!=null&&Ki.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,c){if(typeof c!="string"||!Array.isArray(o))return!1;const u=c.toLowerCase();return~o.indexOf(u)?u:!1}function i(o){return t(a,o)}function n(o){return t(e,o)}function s(o,...c){let u=1;for(;u<arguments.length;u++){const h=arguments[u];for(const f in h)o[f]=h[f]}return o}function r(o,c,u){const h=this,f={enumerable:!0};h.hasBeenReset=!1;let m="",E=!1,y=o,w=c,k=u,z=null,ie="",q=!0,le="auto",ce="start",Se=50,he="middle",Ee=50,Re="middle";Object.defineProperty(h,"id",s({},f,{get:function(){return m},set:function(ge){m=""+ge}})),Object.defineProperty(h,"pauseOnExit",s({},f,{get:function(){return E},set:function(ge){E=!!ge}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return y},set:function(ge){if(typeof ge!="number")throw new TypeError("Start time must be set to a number.");y=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",s({},f,{get:function(){return w},set:function(ge){if(typeof ge!="number")throw new TypeError("End time must be set to a number.");w=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",s({},f,{get:function(){return k},set:function(ge){k=""+ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",s({},f,{get:function(){return z},set:function(ge){z=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",s({},f,{get:function(){return ie},set:function(ge){const $e=i(ge);if($e===!1)throw new SyntaxError("An invalid or illegal string was specified.");ie=$e,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",s({},f,{get:function(){return q},set:function(ge){q=!!ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",s({},f,{get:function(){return le},set:function(ge){if(typeof ge!="number"&&ge!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");le=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",s({},f,{get:function(){return ce},set:function(ge){const $e=n(ge);if(!$e)throw new SyntaxError("An invalid or illegal string was specified.");ce=$e,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",s({},f,{get:function(){return Se},set:function(ge){if(ge<0||ge>100)throw new Error("Position must be between 0 and 100.");Se=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",s({},f,{get:function(){return he},set:function(ge){const $e=n(ge);if(!$e)throw new SyntaxError("An invalid or illegal string was specified.");he=$e,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",s({},f,{get:function(){return Ee},set:function(ge){if(ge<0||ge>100)throw new Error("Size must be between 0 and 100.");Ee=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",s({},f,{get:function(){return Re},set:function(ge){const $e=n(ge);if(!$e)throw new SyntaxError("An invalid or illegal string was specified.");Re=$e,this.hasBeenReset=!0}})),h.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class ac{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Eo(a){function e(i,n,s,r){return(i|0)*3600+(n|0)*60+(s|0)+parseFloat(r||0)}const t=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class oc{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function bo(a,e,t,i){const n=i?a.split(i):[a];for(const s in n){if(typeof n[s]!="string")continue;const r=n[s].split(t);if(r.length!==2)continue;const o=r[0],c=r[1];e(o,c)}}const ca=new ua(0,0,""),wr=ca.align==="middle"?"middle":"center";function lc(a,e,t){const i=a;function n(){const o=Eo(a);if(o===null)throw new Error("Malformed timestamp: "+i);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,c){const u=new oc;bo(o,function(m,E){let y;switch(m){case"region":for(let w=t.length-1;w>=0;w--)if(t[w].id===E){u.set(m,t[w].region);break}break;case"vertical":u.alt(m,E,["rl","lr"]);break;case"line":y=E.split(","),u.integer(m,y[0]),u.percent(m,y[0])&&u.set("snapToLines",!1),u.alt(m,y[0],["auto"]),y.length===2&&u.alt("lineAlign",y[1],["start",wr,"end"]);break;case"position":y=E.split(","),u.percent(m,y[0]),y.length===2&&u.alt("positionAlign",y[1],["start",wr,"end","line-left","line-right","auto"]);break;case"size":u.percent(m,E);break;case"align":u.alt(m,E,["start",wr,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let h=u.get("line","auto");h==="auto"&&ca.line===-1&&(h=-1),c.line=h,c.lineAlign=u.get("lineAlign","start"),c.snapToLines=u.get("snapToLines",!0),c.size=u.get("size",100),c.align=u.get("align",wr);let f=u.get("position","auto");f==="auto"&&ca.position===50&&(f=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=f}function r(){a=a.replace(/^\s+/,"")}if(r(),e.startTime=n(),r(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);a=a.slice(3),r(),e.endTime=n(),r(),s(a,e)}function xo(a){return a.replace(/<br(?: \/)?>/gi,`
|
|
`)}class uc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new ac,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let s=t.buffer,r=0;for(s=xo(s);r<s.length&&s[r]!=="\r"&&s[r]!==`
|
|
`;)++r;const o=s.slice(0,r);return s[r]==="\r"&&++r,s[r]===`
|
|
`&&++r,t.buffer=s.slice(r),o}function n(s){bo(s,function(r,o){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=i();const o=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let r=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(r?r=!1:s=i(),t.state){case"HEADER":/:/.test(s)?n(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new ua(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{lc(s,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=s.indexOf("-->")!==-1;if(!s||o&&(r=!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+=s}continue;case"BADCUE":s||(t.state="ID")}}}catch(s){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 cc=/\r\n|\n\r|\n|\r/g,ha=function(e,t,i=0){return e.slice(i,i+t.length)===t},hc=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!K(t)||!K(i)||!K(n)||!K(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*s,t};function fa(a,e,t){return tr(a.toString())+tr(e.toString())+tr(t)}const fc=function(e,t,i){let n=e[t],s=e[n.prevCC];if(!s||!s.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(r=s)!=null&&r.new;){var r;e.ccOffset+=n.start-s.start,n.new=!1,n=s,s=e[n.prevCC]}e.presentationOffset=i};function dc(a,e,t,i,n,s,r){const o=new uc,c=Q(new Uint8Array(a)).trim().replace(cc,`
|
|
`).split(`
|
|
`),u=[],h=e?Fl(e.baseTime,e.timescale):0;let f="00:00.000",m=0,E=0,y,w=!0;o.oncue=function(k){const z=t[i];let ie=t.ccOffset;const q=(m-h)/9e4;if(z!=null&&z.new&&(E!==void 0?ie=t.ccOffset=z.start:fc(t,i,q)),q){if(!e){y=new Error("Missing initPTS for VTT MPEGTS");return}ie=q-t.presentationOffset}const le=k.endTime-k.startTime,ce=$n((k.startTime+ie-E)*9e4,n*9e4)/9e4;k.startTime=Math.max(ce,0),k.endTime=Math.max(ce+le,0);const Se=k.text.trim();k.text=decodeURIComponent(encodeURIComponent(Se)),k.id||(k.id=fa(k.startTime,k.endTime,Se)),k.endTime>0&&u.push(k)},o.onparsingerror=function(k){y=k},o.onflush=function(){if(y){r(y);return}s(u)},c.forEach(k=>{if(w)if(ha(k,"X-TIMESTAMP-MAP=")){w=!1,k.slice(16).split(",").forEach(z=>{ha(z,"LOCAL:")?f=z.slice(6):ha(z,"MPEGTS:")&&(m=parseInt(z.slice(7)))});try{E=hc(f)/1e3}catch(z){y=z}return}else k===""&&(w=!1);o.parse(k+`
|
|
`)}),o.flush()}const da="stpp.ttml.im1t",So=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,To=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,pc={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ao(a,e,t,i){const n=be(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=n.map(o=>Q(o)),r=Nl(e.baseTime,1,e.timescale);try{s.forEach(o=>t(gc(o,r)))}catch(o){i(o)}}function gc(a,e){const n=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(s).reduce((f,m)=>(f[m]=n.getAttribute(`ttp:${m}`)||s[m],f),{}),o=n.getAttribute("xml:space")!=="preserve",c=wo(pa(n,"styling","style")),u=wo(pa(n,"layout","region")),h=pa(n,"body","[begin]");return[].map.call(h,f=>{const m=Io(f,o);if(!m||!f.hasAttribute("begin"))return null;const E=ma(f.getAttribute("begin"),r),y=ma(f.getAttribute("dur"),r);let w=ma(f.getAttribute("end"),r);if(E===null)throw Ro(f);if(w===null){if(y===null)throw Ro(f);w=E+y}const k=new ua(E-e,w-e,m);k.id=fa(k.startTime,k.endTime,k.text);const z=u[f.getAttribute("region")],ie=c[f.getAttribute("style")],q=mc(z,ie,c),{textAlign:le}=q;if(le){const ce=pc[le];ce&&(k.lineAlign=ce),k.align=le}return v(k,q),k}).filter(f=>f!==null)}function pa(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function wo(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Io(a,e){return[].slice.call(a.childNodes).reduce((t,i,n)=>{var s;return i.nodeName==="br"&&n?t+`
|
|
`:(s=i.childNodes)!=null&&s.length?Io(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function mc(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let n=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(n=t[r]),s.reduce((o,c)=>{const u=ga(e,i,c)||ga(a,i,c)||ga(n,i,c);return u&&(o[c]=u),o},{})}function ga(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Ro(a){return new Error(`Could not parse ttml timestamp ${a}`)}function ma(a,e){if(!a)return null;let t=Eo(a);return t===null&&(So.test(a)?t=_c(a,e):To.test(a)&&(t=vc(a,e))),t}function _c(a,e){const t=So.exec(a),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function vc(a,e){const t=To.exec(a),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class Ir{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,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class yc{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=Co(),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(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(g.FRAG_LOADING,this.onFragLoading,this),e.on(g.FRAG_LOADED,this.onFragLoaded,this),e.on(g.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(g.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(g.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(g.FRAG_LOADING,this.onFragLoading,this),e.off(g.FRAG_LOADED,this.onFragLoaded,this),e.off(g.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(g.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(g.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(g.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Ir(this,"textTrack1"),t=new Ir(this,"textTrack2"),i=new Ir(this,"textTrack3"),n=new Ir(this,"textTrack4");this.cea608Parser1=new yo(1,e,t),this.cea608Parser2=new yo(3,i,n)}addCues(e,t,i,n,s){let r=!1;for(let o=s.length;o--;){const c=s[o],u=Ec(c[0],c[1],t,i);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),r=!0,u/(i-t)>.5))return}if(r||s.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,n)}else{const o=this.Cues.newCue(null,t,i,n);this.hls.trigger(g.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s}){const{unparsedVttFrags:r}=this;i===H.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:s}),r.length&&(this.unparsedVttFrags=[],r.forEach(o=>{this.onFragLoaded(g.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const s=i.textTracks[n];if(Do(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:n}=this,{label:s,languageCode:r}=t[e],o=this.getExistingTrack(s,r);if(o)i[e]=o,Fs(i[e]),uo(i[e],n);else{const c=this.createTextTrack("captions",s,r);c&&(c[e]=!0,i[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,n={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(g.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,i){const n=this.media;if(n)return n.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:n}=this;Object.keys(n).forEach(s=>{Fs(n[s]),delete n[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Co(),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 i=0;i<t.length;i++)Fs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(s=>s.textCodec===da);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(Xa(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Sr(r.textTracks):null;if(this.tracks.forEach((c,u)=>{let h;if(o){let f=null;for(let m=0;m<o.length;m++)if(o[m]&&Do(o[m],c)){f=o[m],o[m]=null;break}f&&(h=f)}if(h)Fs(h);else{const f=Lo(c);h=this.createTextTrack(f,c.name,c.lang),h&&(h.mode="disabled")}h&&this.textTracks.push(h)}),o!=null&&o.length){const c=o.filter(u=>u!==null).map(u=>u.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const r=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(g.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const n=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!n)return;const s=`textTrack${n[1]}`,r=this.captionsProperties[s];r&&(r.label=i.name,i.lang&&(r.languageCode=i.lang),r.media=i)})}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===H.MAIN){var i,n;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:c,sn:u}=t.frag,h=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;s&&r&&(u!==o+1||u===o&&h!==this.lastPartIndex+1||c!==this.lastCc)&&(s.reset(),r.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===H.SUBTITLE)if(n.byteLength){const s=i.decryptdata,r="stats"in t;if(s==null||!s.encrypted||r){const o=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===da?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Ao(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),i.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{i.logger.log(`Failed to parse IMSC1: ${n}`),i.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:s,unparsedVttFrags:r}=this,o=s.length-1;if(!s[i.cc]&&o===-1){r.push(e);return}const c=this.hls,u=(t=i.initSegment)!=null&&t.data?ct(i.initSegment.data,new Uint8Array(n)).buffer:n;dc(u,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,h=>{this._appendCues(h,i.level),c.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},h=>{const f=h.message==="Missing initPTS for VTT MPEGTS";f?r.push(e):this._fallbackToIMSC1(i,n),c.logger.log(`Failed to parse VTT cue: ${h}`),!(f&&o>i.cc)&&c.trigger(g.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:h})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Ao(t,this.initPTS[e.cc],()=>{i.textCodec=da,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(s=>co(n,s))}else{const n=this.tracks[t];if(!n)return;const s=n.default?"default":"subtitles"+t;i.trigger(g.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===H.SUBTITLE&&this.onFragLoaded(g.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(!(i.type===H.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let s=0;s<n.length;s++){const r=n[s].bytes;if(r){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(r);this.cea608Parser1.addData(n[s].pts,o[0]),this.cea608Parser2.addData(n[s].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:n,type:s}){const{media:r}=this;if(!(!r||r.currentTime<i)){if(!s||s==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>ra(o[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>ra(o[c],t,n))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let n=2;for(let s=0;s<i;s++){const r=e[n++],o=127&e[n++],c=127&e[n++];if(o===0&&c===0)continue;if((4&r)!==0){const h=3&r;(h===0||h===1)&&(t[h].push(o),t[h].push(c))}}return t}}function Lo(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Do(a,e){return!!a&&a.kind===Lo(e)&&qr(e,a)}function Ec(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function Co(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const bc=/\s/,xc={newCue(a,e,t,i){const n=[];let s,r,o,c,u;const h=self.VTTCue||self.TextTrackCue;for(let m=0;m<i.rows.length;m++)if(s=i.rows[m],o=!0,c=0,u="",!s.isEmpty()){var f;for(let w=0;w<s.chars.length;w++)bc.test(s.chars[w].uchar)&&o?c++:(u+=s.chars[w].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const E=xo(u.trim()),y=fa(e,t,E);a!=null&&(f=a.cues)!=null&&f.getCueById(y)||(r=new h(e,t,E),r.id=y,r.line=m+1,r.align="left",r.position=10+Math.min(80,Math.floor(c*8/32)*10),n.push(r))}return a&&n.length&&(n.sort((m,E)=>m.line==="auto"||E.line==="auto"?0:m.line>8&&E.line>8?E.line-m.line:m.line-E.line),n.forEach(m=>co(a,m))),n}};function Sc(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const Tc=/(\d+)-(\d+)\/(\d+)/;class Oo{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Rc,this.controller=new self.AbortController,this.stats=new p}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const s=Ac(e,this.controller.signal),r=e.responseType==="arraybuffer",o=r?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=c&&K(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(Js(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var m;this.response=this.loader=f;const E=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},u-(E-n.loading.start)),!f.ok){const{status:w,statusText:k}=f;throw new Lc(k||"fetch, bad network response",w,f)}n.loading.first=E,n.total=Ic(f.headers)||n.total;const y=(m=this.callbacks)==null?void 0:m.onProgress;return y&&K(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,y):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var m,E;const y=this.response;if(!y)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const w=f[o];w&&(n.loaded=n.total=w);const k={url:y.url,data:f,code:y.status},z=(m=this.callbacks)==null?void 0:m.onProgress;z&&!K(t.highWaterMark)&&z(n,e,f,y),(E=this.callbacks)==null||E.onSuccess(k,n,e,y)}).catch(f=>{var m;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const E=f&&f.code||0,y=f?f.message:null;(m=this.callbacks)==null||m.onError({code:E,text:y},e,f?f.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,n=0,s){const r=new zs,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return r.dataLength&&s(t,i,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const h=u.value,f=h.length;return t.loaded+=f,f<n||r.dataLength?(r.push(h),r.dataLength>=n&&s(t,i,r.flush().buffer,e)):s(t,i,h.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function Ac(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(v({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function wc(a){const e=Tc.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Ic(a){const e=a.get("Content-Range");if(e){const i=wc(e);if(K(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function Rc(a,e){return new self.Request(a.url,e)}class Lc extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const Dc=/^age:\s*[\d.]+\s*$/im;class Po{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 p,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,i){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=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return s(i,t.url)}).catch(r=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),s(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(r=>{var o;(o=this.callbacks)==null||o.onError({code:i.status,text:r.message},t,i,n)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const n=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:r}=i.loadPolicy;if(n)for(const o in n)e.setRequestHeader(o,n[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=s&&K(s)?s:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,s=this.config;if(!i.aborted&&n>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),n===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const u=t.status,h=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const y=h!=null?h:t.response;if(y!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const w=t.responseType==="arraybuffer"?y.byteLength:y.length;i.loaded=i.total=w,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const k=(r=this.callbacks)==null?void 0:r.onProgress;k&&k(i,e,y,t);const z={url:t.responseURL,data:y,code:u};(o=this.callbacks)==null||o.onSuccess(z,i,e,t);return}}const f=s.loadPolicy.errorRetry,m=i.retry,E={url:e.url,data:void 0,code:u};if(Ii(f,m,!1,E))this.retry(f);else{var c;Y.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Ii(e,t,!0))this.retry(e);else{var i;Y.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Bt(e,i.retry),i.retry++,Y.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.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&&Dc.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 Cc={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Oc=b(b({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,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,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:Po,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:At,bufferController:Jl,capLevelController:ta,errorController:Bi,fpsController:Nu,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:It,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,certLoadPolicy:{default:Cc},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},Pc()),{},{subtitleStreamController:zu,subtitleTrackController:Uu,timelineController:yc,audioStreamController:Zl,audioTrackController:Yl,emeController:Ns,cmcdController:Pu,contentSteeringController:Mu,interstitialsController:Vu});function Pc(){return{cueHandler:xc,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 kc(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=_a(a),n=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(r=>{const o=`${r==="level"?"playlist":r}LoadPolicy`,c=e[o]===void 0,u=[];s.forEach(h=>{const f=`${r}Loading${h}`,m=e[f];if(m!==void 0&&c){u.push(f);const E=i[o].default;switch(e[o]={default:E},h){case"TimeOut":E.maxLoadTimeMs=m,E.maxTimeToFirstByteMs=m;break;case"MaxRetry":E.errorRetry.maxNumRetry=m,E.timeoutRetry.maxNumRetry=m;break;case"RetryDelay":E.errorRetry.retryDelayMs=m,E.timeoutRetry.retryDelayMs=m;break;case"MaxRetryTimeout":E.errorRetry.maxRetryDelayMs=m,E.timeoutRetry.maxRetryDelayMs=m;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${Qt(e[o])}`)}),b(b({},i),e)}function _a(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(_a):Object.keys(a).reduce((e,t)=>(e[t]=_a(a[t]),e),{}):a}function Mc(a,e){const t=a.loader;t!==Oo&&t!==Po?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):Sc()&&(a.loader=Oo,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Rr=2,Nc=.1,Fc=.05,Bc=100;class Uc extends Ai{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(g.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Bc),this.mediaSource=t.mediaSource;const i=this.media=t.media;hs(i,"playing",this.onMediaPlaying),hs(i,"waiting",this.onMediaWaiting),hs(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(rs(i,"playing",this.onMediaPlaying),rs(i,"waiting",this.onMediaWaiting),rs(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const s=(i=this.hls)==null?void 0:i.config;if(!s)return;const{media:r,stalled:o}=this;if(!r)return;const{seeking:c}=r,u=this.seeking&&!c,h=!this.seeking&&c,f=r.paused&&!c||r.ended||r.playbackRate===0;if(this.seeking=c,e!==t){t&&(this.ended=0),this.moved=!0,c||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!f&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(h||u){u&&this.stallResolved(e);return}if(f){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(g.MEDIA_ENDED,{stalled:!1}));return}if(!_t.getBuffered(r).length){this.nudgeRetry=0;return}const m=_t.bufferInfo(r,e,0),E=m.nextStart||0,y=this.fragmentTracker;if(c&&y&&this.hls){const Se=ko(this.hls.inFlightFragments,e),he=m.len>Rr,Ee=!E||Se||E-e>Rr&&!y.getPartialFragment(e);if(he||Ee)return;this.moved=!1}const w=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&y){if(!(m.len>0)&&!E)return;const he=Math.max(E,m.start||0)-e,Re=!!(w!=null&&w.live)?w.targetduration*2:Rr,ge=y.getPartialFragment(e);if(he>0&&(he<=Re||ge)){r.paused||this._trySkipBufferHole(ge);return}}const k=s.detectStallWithCurrentTimeMs,z=self.performance.now(),ie=this.waiting;if(o===null){ie>0&&z-ie<k?this.stalled=ie:this.stalled=z;return}const q=z-o;if(!c&&(q>=k||ie)&&this.hls){var le;if(((le=this.mediaSource)==null?void 0:le.readyState)==="ended"&&!(w!=null&&w.live)&&Math.abs(e-((w==null?void 0:w.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(g.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(m),!this.media||!this.hls)return}const ce=_t.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(ce,q)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(g.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&n&&n.length>1&&e>n.end(0)){const s=_t.bufferedInfo(_t.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=_t.timeRangesToArray(n),o=_t.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=_t.bufferedInfo(r,e,0).bufferedIndex,u=r[o].end,h=r[o+1].start;if((c===-1||c>o)&&h-u<1&&e-u<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${h} buffered index: ${c}`);this.warn(f.message),this.media.currentTime+=1e-6;const m=this.fragmentTracker.getPartialFragment(e)||void 0,E=_t.bufferInfo(this.media,e,0);this.hls.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:m,buffer:E.len,bufferInfo:E})}}}}}_tryFixBufferStall(e,t){var i,n;const{fragmentTracker:s,media:r}=this,o=(i=this.hls)==null?void 0:i.config;if(!r||!s||!o)return;const c=r.currentTime,u=(n=this.hls)==null?void 0:n.latestLevelDetails,h=s.getPartialFragment(c);if((h||u!=null&&u.live&&c<u.fragmentStart)&&(this._trySkipBufferHole(h)||!this.media))return;const f=e.buffered;(f&&f.length>1&&e.len>o.maxBufferHole||e.nextStart&&e.nextStart-c<o.maxBufferHole)&&(t>o.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:s}=this;if(!n&&s!==null&&i&&t){this.stallReported=!0;const r=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Qt(e)})`);this.warn(r.message),t.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,s=(t=this.hls)==null?void 0:t.config;if(!n||!i||!s)return 0;const r=n.currentTime,o=_t.bufferInfo(n,r,0),c=r<o.start?o.start:o.nextStart;if(c&&this.hls){const h=o.len<=s.maxBufferHole,f=o.len>0&&o.len<1&&n.readyState<3,m=c-r;if(m>0&&(h||f)){if(m>s.maxBufferHole){let y=!1;if(r===0){const w=i.getAppendedFrag(0,H.MAIN);w&&c<w.end&&(y=!0)}if(!y){const w=e||i.getAppendedFrag(r,H.MAIN);if(w){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||ko(this.hls.inFlightFragments,c))return 0;let z=!1,ie=w.end;for(;ie<c;){const q=i.getPartialFragment(ie);if(q)ie+=q.duration;else{z=!0;break}}if(z)return 0}}}const E=Math.max(c+Fc,r+Nc);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${E}`),this.moved=!0,n.currentTime=E,!(e!=null&&e.gap)){const y=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${E}`);this.hls.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:e||void 0,buffer:o.len,bufferInfo:o})}return E}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:n}=this,s=t==null?void 0:t.config;if(!i||!s)return 0;const r=i.currentTime;if(this.nudgeRetry++,n<s.nudgeMaxRetry){const o=r+(n+1)*s.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${r} to ${o}`);this.warn(c.message),i.currentTime=o,t.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${r} after ${s.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function ko(a,e){const t=Mo(a.main);if(t&&t.start<=e)return t;const i=Mo(a.audio);return i&&i.start<=e?i:null}function Mo(a){if(!a)return null;switch(a.state){case De.IDLE:case De.STOPPED:case De.ENDED:case De.ERROR:return null}return a.frag}const $c=.25;function va(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function No(a,e,t,i,n){let s=new a(e,t,"");try{s.value=i,n&&(s.type=n)}catch(r){s=new a(e,t,Qt(n?b({type:n},i):i))}return s}const Lr=(()=>{const a=va();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Gc(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Kc{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(g.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e.on(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(g.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Fs(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return uo(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:n}}}=this;if(!i&&!n)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=va();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Pn.emsg&&!i||!n)continue;const u=La(s[o].data);if(u){const h=s[o].pts;let f=h+s[o].duration;f>Lr&&(f=Lr),f-h<=0&&(f=h+$c);for(let E=0;E<u.length;E++){const y=u[E];if(!Da(y)){this.updateId3CueEnds(h,c);const w=No(r,h,f,y,c);w&&this.id3Track.addCue(w)}}}}}updateId3CueEnds(e,t){var i;const n=(i=this.id3Track)==null?void 0:i.cues;if(n)for(let s=n.length;s--;){const r=n[s];r.type===t&&r.startTime<e&&r.endTime===Lr&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=r;if(s&&(o||c)){let u;n==="audio"?u=h=>h.type===Pn.audioId3&&c:n==="video"?u=h=>h.type===Pn.emsg&&o:u=h=>h.type===Pn.audioId3&&c||h.type===Pn.emsg&&o,ra(s,t,i,u)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:i}=this,{dateRanges:n}=e,s=Object.keys(n);let r=this.dateRangeCuesAppended;if(i&&t){var o;if((o=i.cues)!=null&&o.length){const h=Object.keys(r).filter(f=>!s.includes(f));for(let f=h.length;f--;){const m=h[f],E=r[m].cues;delete r[m],Object.keys(E).forEach(y=>{try{const w=E[y];w.removeEventListener("enter",this.onEventCueEnter),i.removeCue(w)}catch(w){}})}}else r=this.dateRangeCuesAppended={}}const c=e.fragments[e.fragments.length-1];if(s.length===0||!K(c==null?void 0:c.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const u=va();for(let h=0;h<s.length;h++){const f=s[h],m=n[f],E=m.startTime,y=r[f],w=(y==null?void 0:y.cues)||{};let k=(y==null?void 0:y.durationKnown)||!1,z=Lr;const{duration:ie,endDate:q}=m;if(q&&ie!==null)z=E+ie,k=!0;else if(m.endOnNext&&!k){const ce=s.reduce((Se,he)=>{if(he!==m.id){const Ee=n[he];if(Ee.class===m.class&&Ee.startDate>m.startDate&&(!Se||m.startDate<Se.startDate))return Ee}return Se},null);ce&&(z=ce.startTime,k=!0)}const le=Object.keys(m.attr);for(let ce=0;ce<le.length;ce++){const Se=le[ce];if(!jn(Se))continue;const he=w[Se];if(he)k&&!y.durationKnown?he.endTime=z:Math.abs(he.startTime-E)>.01&&(he.startTime=E,he.endTime=z);else if(u){let Ee=m.attr[Se];Vn(Se)&&(Ee=Gc(Ee));const ge=No(u,E,z,{key:Se,data:Ee},Pn.dateRange);ge&&(ge.id=f,this.id3Track.addCue(ge),w[Se]=ge,this.hls.config.interstitialsController&&(Se==="X-ASSET-LIST"||Se==="X-ASSET-URL")&&ge.addEventListener("enter",this.onEventCueEnter))}}r[f]={cues:w,dateRange:m,durationKnown:k}}}}class Hc{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||r===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const c=n-o,u=Math.min(this.maxLatency,o+i.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,r)),m=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,E=Math.min(f,Math.max(1,m));this.changeMediaPlaybackRate(t,E)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:s,liveSyncDurationCount:r,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=s!==void 0?s:r*n);const h=n;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,h)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const n=i.edge,s=e-t-this.edgeStalled,r=n-i.totalduration,o=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(r,s),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(g.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(g.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(g.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(g.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===D.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(n=this.targetLatency)==null?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class Wc extends Jr{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this),e.on(g.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this),e.off(g.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],s={},r={};let o=!1,c=!1,u=!1;t.levels.forEach(h=>{var f;const m=h.attrs;let{audioCodec:E,videoCodec:y}=h;E&&(h.audioCodec=E=$t(E,i)||void 0),((f=y)==null?void 0:f.indexOf("avc1"))===0&&(y=h.videoCodec=Di(y));const{width:w,height:k,unknownCodecs:z}=h;let ie=z?z.length:0;if(z)for(let $e=ie;$e--;){const Ve=z[$e];this.isAudioSupported(Ve)?(h.audioCodec=E=E?`${E},${Ve}`:Ve,ie--,Et.audio[E.substring(0,4)]=2):this.isVideoSupported(Ve)&&(h.videoCodec=y=y?`${y},${Ve}`:Ve,ie--,Et.video[y.substring(0,4)]=2)}if(o||(o=!!(w&&k)),c||(c=!!y),u||(u=!!E),ie||E&&!this.isAudioSupported(E)||y&&!this.isVideoSupported(y)){this.log(`Some or all CODECS not supported "${m.CODECS}"`);return}const{CODECS:q,"FRAME-RATE":le,"HDCP-LEVEL":ce,"PATHWAY-ID":Se,RESOLUTION:he,"VIDEO-RANGE":Ee}=m,ge=`${`${Se||"."}-`}${h.bitrate}-${he}-${le}-${q}-${Ee}-${ce}`;if(s[ge])if(s[ge].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const $e=r[ge]+=1;h.attrs["PATHWAY-ID"]=new Array($e+1).join(".");const Ve=this.createLevel(h);s[ge]=Ve,n.push(Ve)}else s[ge].addGroupId("audio",m.AUDIO),s[ge].addGroupId("text",m.SUBTITLES);else{const $e=this.createLevel(h);s[ge]=$e,r[ge]=1,n.push($e)}}),this.filterAndSortMediaOptions(n,t,o,c,u)}createLevel(e){const t=new on(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const n=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(n.message),t.supportedResult=wi(n,[])}return t}isAudioSupported(e){return gt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return gt(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,s){let r=[],o=[],c=e;if((i||n)&&s&&(c=c.filter(({videoCodec:y,videoRange:w,width:k,height:z})=>(!!y||!!(k&&z))&&nn(w))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let y="no level with compatible codecs found in manifest",w=y;t.levels.length&&(w=`one or more CODECS in variant not supported: ${Qt(t.levels.map(z=>z.attrs.CODECS).filter((z,ie,q)=>q.indexOf(z)===ie))}`,this.warn(w),y+=` (${w})`);const k=new Error(y);this.hls.trigger(g.ERROR,{type:J.MEDIA_ERROR,details:D.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:k,reason:w})}});return}t.audioTracks&&(r=t.audioTracks.filter(y=>!y.audioCodec||this.isAudioSupported(y.audioCodec)),Fo(r)),t.subtitles&&(o=t.subtitles,Fo(o));const u=c.slice(0);c.sort((y,w)=>{if(y.attrs["HDCP-LEVEL"]!==w.attrs["HDCP-LEVEL"])return(y.attrs["HDCP-LEVEL"]||"")>(w.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&y.height!==w.height)return y.height-w.height;if(y.frameRate!==w.frameRate)return y.frameRate-w.frameRate;if(y.videoRange!==w.videoRange)return Ni.indexOf(y.videoRange)-Ni.indexOf(w.videoRange);if(y.videoCodec!==w.videoCodec){const k=at(y.videoCodec),z=at(w.videoCodec);if(k!==z)return z-k}if(y.uri===w.uri&&y.codecSet!==w.codecSet){const k=St(y.codecSet),z=St(w.codecSet);if(k!==z)return z-k}return y.averageBitrate!==w.averageBitrate?y.averageBitrate-w.averageBitrate:0});let h=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let y=0;y<u.length;y++)if(u[y].pathwayId===c[0].pathwayId){h=u[y];break}}this._levels=c;for(let y=0;y<c.length;y++)if(c[y]===h){var f;this._firstLevel=y;const w=h.bitrate,k=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${w}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const z=Math.min(w,this.hls.config.abrEwmaDefaultEstimateMax);z>k&&k===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=z)}break}const m=s&&!n,E={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:!m&&r.some(y=>!!y.url)};this.hls.trigger(g.MANIFEST_PARSED,E)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:h,reason:h.message}),f)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,s=n?n.attrs["PATHWAY-ID"]:void 0,r=t[e],o=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,i===e&&n&&s===o)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${o?" with Pathway "+o:""} from level ${i}${s?" with Pathway "+s:""}`);const c={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(g.LEVEL_SWITCHING,c);const u=r.details;if(!u||u.live){const h=this.switchParams(r.uri,n==null?void 0:n.details,u);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(n=>t.indexOf(n)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===ee.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===H.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(s=>!!i[s]))return;const n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:s}=t,r=t.levelInfo;if(!r){var o;this.warn(`Invalid level index ${n}`),(o=t.deliveryDirectives)!=null&&o.skip&&(s.deltaUpdateFailed=!0);return}if(r===this.currentLevel||t.withoutMultiVariant){r.fragmentError===0&&(r.loadError=0);let c=r.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(n,t,c)}else(i=t.deliveryDirectives)!=null&&i.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],r=e.details,o=r==null?void 0:r.age;this.log(`Loading level index ${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${s?" Pathway "+s:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${i}`),this.hls.trigger(g.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((s,r)=>r!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(o=>o.level=-1)),!1));hr(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(g.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(g.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Fo(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function Bo(){return self.SourceBuffer||self.WebKitSourceBuffer}function Uo(){if(!fe())return!1;const e=Bo();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function jc(){if(!Uo())return!1;const a=fe();return typeof(a==null?void 0:a.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(xt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(xt(e,"audio"))))}function Vc(){var a;const e=Bo();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const zc=100;class Zc extends xs{constructor(e,t,i){super(e,t,i,"stream-controller",H.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const n=this.media,s=n?n.currentTime:null;if(s===null||!K(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(n,s,H.MAIN,0);if(r===null||r.len===0){this.warn(`Main forward buffer length at ${s} on "seeked" event ${r?r.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(g.MANIFEST_PARSED,this.onManifestParsed,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.LEVEL_LOADED,this.onLevelLoaded,this),e.on(g.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(g.BUFFER_CREATED,this.onBufferCreated,this),e.on(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(g.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(g.MANIFEST_PARSED,this.onManifestParsed,this),e.off(g.LEVEL_LOADED,this.onLevelLoaded,this),e.off(g.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(g.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(g.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(g.BUFFER_CREATED,this.onBufferCreated,this),e.off(g.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(g.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(zc),this.level=-1,!this.startFragRequested){let s=n.startLevel;s===-1&&(n.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=n.firstAutoLevel),n.nextLoadLevel=s,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=De.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=De.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case De.WAITING_LEVEL:{const{levels:t,level:i}=this,n=t==null?void 0:t[i],s=n==null?void 0:n.details;if(s&&(!s.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(s))break;this.state=De.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=De.IDLE;break}break}case De.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:n,level:s}=this,r=n==null?void 0:n[s];this.resetStartWhenNotLoaded(r||null),this.state=De.IDLE}}break}this.state===De.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(t===null||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[s]))return;const r=i[s],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const w={};this.altAudio===2&&(w.type="video"),this.hls.trigger(g.BUFFER_EOS,w),this.state=De.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const u=r.details;if(!u||this.state===De.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=De.WAITING_LEVEL,this.startFragRequested=!1;return}const h=o.len,f=this.getMaxBufferLength(r.maxBitrate);if(h>=f)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const m=this.backtrackFragment?this.backtrackFragment.start:o.end;let E=this.getNextFragment(m,u);if(this.couldBacktrack&&!this.fragPrevious&&E&&V(E)&&this.fragmentTracker.getState(E)!==Ft.OK){var y;const k=((y=this.backtrackFragment)!=null?y:E).sn-u.startSN,z=u.fragments[k-1];z&&E.cc===z.cc&&(E=z,this.fragmentTracker.removeFragment(z))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(E&&this.isLoopLoading(E,m)){if(!E.gap){const k=this.audioOnly&&!this.altAudio?d.AUDIO:d.VIDEO,z=(k===d.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;z&&this.afterBufferFlushed(z,k,H.MAIN)}E=this.getNextFragmentLoopLoading(E,u,o,H.MAIN,f)}E&&(E.initSegment&&!E.initSegment.data&&!this.bitrateTest&&(E=E.initSegment),this.loadFragment(E,r,m))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===Ft.NOT_LOADED||n===Ft.PARTIAL?V(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,H.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<s.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,c=e[o],u=this.fragLastKbps;u&&this.fragCurrent?i=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:i=0}else i=0;const r=this.getBufferedFrag(t.currentTime+i);if(r){const o=this.followingBufferedFrag(r);if(o){this.abortCurrentFrag();const c=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,h=Math.max(r.end,c+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case De.KEY_LOADING:case De.FRAG_LOADING:case De.FRAG_LOADING_WAITING_RETRY:case De.PARSING:case De.PARSED:this.state=De.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;hs(i,"playing",this.onMediaPlaying),hs(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(rs(i,"playing",this.onMediaPlaying),rs(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(g.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,n=!1;t.levels.forEach(s=>{const r=s.audioCodec;r&&(i=i||r.indexOf("mp4a.40.2")!==-1,n=n||r.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&n&&!Vc(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==De.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=De.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:n,startFragRequested:s}=this,r=t.level,o=t.details,c=o.totalduration;if(!n){this.warn(`Levels were reset while loading level ${r}`);return}this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${c}`);const u=t.levelInfo,h=this.fragCurrent;h&&(this.state===De.FRAG_LOADING||this.state===De.FRAG_LOADING_WAITING_RETRY)&&h.level!==t.level&&h.loader&&this.abortCurrentFrag();let f=0;if(o.live||(i=u.details)!=null&&i.live){var m;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,u.details,(m=this.levelLastLoaded)==null?void 0:m.details)}if(u.details=o,this.levelLastLoaded=u,s||this.setStartPosition(o,f),this.hls.trigger(g.LEVEL_UPDATED,{details:o,level:r}),this.state===De.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=De.IDLE}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const n=this.hls.liveSyncPosition,s=this.getLoadPosition(),r=e.fragmentStart,o=e.edge,c=s>=r-t.maxFragLookUpTolerance&&s<=o;if(n!==null&&i.duration>n&&(s<n||!c)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!c&&i.readyState<4||s<o-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState&&(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),i.currentTime=n))}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=r[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const u=o.videoCodec,h=c.PTSKnown||!c.live,f=(t=i.initSegment)==null?void 0:t.data,m=this._getAudioCodec(o),E=this.transmuxer=this.transmuxer||new Za(this.hls,H.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),y=n?n.index:-1,w=y!==-1,k=new Wi(i.level,i.sn,i.stats.chunkCount,s.byteLength,y,w),z=this.initPTS[i.cc];E.push(s,f,m,u,i,n,c.totalduration,h,k,z)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(re(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(n){this.fragmentTracker.removeAllFragments(),i.once(g.BUFFER_FLUSHED,()=>{var r;(r=this.hls)==null||r.trigger(g.AUDIO_TRACK_SWITCHED,t)}),i.trigger(g.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(g.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=re(t.url,this.hls);if(i){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,s,r=!1;for(const o in i){const c=i[o];if(c.id==="main"){if(s=o,n=c,o==="video"){const u=i[o];u&&(this.videoBuffer=u.buffer)}}else r=!0}r&&n?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,s=i.type===H.MAIN;if(s){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===De.PARSED&&(this.state=De.IDLE);return}const o=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),V(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&_t.getBuffered(r).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=De.ERROR;return}switch(t.details){case D.FRAG_GAP:case D.FRAG_PARSING_ERROR:case D.FRAG_DECRYPT_ERROR:case D.FRAG_LOAD_ERROR:case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_ERROR:case D.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(H.MAIN,t);break;case D.LEVEL_LOAD_ERROR:case D.LEVEL_LOAD_TIMEOUT:case D.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===De.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ee.LEVEL&&(this.state=De.IDLE);break;case D.BUFFER_ADD_CODEC_ERROR:case D.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case D.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case D.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=De.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==d.AUDIO||!this.altAudio){const i=(t===d.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,H.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const n=this.timelineOffset;n&&i&&(i+=n);const s=this.getLevelDetails(),r=_t.getBuffered(e),o=r.length?r.start(0):0,c=o-i,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);c>0&&(c<u||this.loadingParts&&c<2*((s==null?void 0:s.partTarget)||0))&&(this.log(`adjusting start position by ${c} to match buffer start`),i+=c,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:n}=this,s=i==null?void 0:i.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=De.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const r=s.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),n.trigger(g.FRAG_LOADED,i),s.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i=this.playlistType,{hls:n}=this,{remuxResult:s,chunkMeta:r}=e,o=this.getCurrentContext(r);if(!o){this.resetWhenMissingContext(r);return}const{frag:c,part:u,level:h}=o,{video:f,text:m,id3:E,initSegment:y}=s,{details:w}=h,k=this.altAudio?void 0:s.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=De.PARSING,y){if(y!=null&&y.tracks){const q=c.initSegment||c;this._bufferInitSegment(h,y.tracks,q,r),n.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:q,id:i,tracks:y.tracks})}const z=y.initPTS,ie=y.timescale;K(z)&&(this.initPTS[c.cc]={baseTime:z,timescale:ie},n.trigger(g.INIT_PTS_FOUND,{frag:c,id:i,initPTS:z,timescale:ie}))}if(f&&w){const z=w.fragments[c.sn-1-w.startSN],ie=c.sn===w.startSN,q=!z||c.cc>z.cc;if(s.independent!==!1){const{startPTS:le,endPTS:ce,startDTS:Se,endDTS:he}=f;if(u)u.elementaryStreams[f.type]={startPTS:le,endPTS:ce,startDTS:Se,endDTS:he};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!q&&(this.couldBacktrack=!0),f.dropped&&f.independent){const Ee=this.getMainFwdBufferInfo(),Re=(Ee?Ee.end:this.getLoadPosition())+this.config.maxBufferHole,ge=f.firstKeyFramePTS?f.firstKeyFramePTS:le;if(!ie&&Re<ge-this.config.maxBufferHole&&!q){this.backtrack(c);return}else q&&(c.gap=!0);c.setElementaryStreamInfo(f.type,c.start,ce,c.start,he,!0)}else ie&&le-(w.appliedTimelineOffset||0)>Rr&&(c.gap=!0);c.setElementaryStreamInfo(f.type,le,ce,Se,he),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(f,c,u,r,ie||q)}else if(ie||q)c.gap=!0;else{this.backtrack(c);return}}if(k){const{startPTS:z,endPTS:ie,startDTS:q,endDTS:le}=k;u&&(u.elementaryStreams[d.AUDIO]={startPTS:z,endPTS:ie,startDTS:q,endDTS:le}),c.setElementaryStreamInfo(d.AUDIO,z,ie,q,le),this.bufferFragmentData(k,c,u,r)}if(w&&E!=null&&(t=E.samples)!=null&&t.length){const z={id:i,frag:c,details:w,samples:E.samples};n.trigger(g.FRAG_PARSING_METADATA,z)}if(w&&m){const z={id:i,frag:c,details:w,samples:m.samples};n.trigger(g.FRAG_PARSING_USERDATA,z)}}_bufferInitSegment(e,t,i,n){if(this.state!==De.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:s,video:r,audiovideo:o}=t;if(s){let u=Mi(s.codec,e.audioCodec);u==="mp4a"&&(u="mp4a.40.5");const h=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const f=s.metadata;f&&"channelCount"in f&&(f.channelCount||1)!==1&&h.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&h.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),e.audioCodec&&e.audioCodec!==u&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${u}"`),s.levelCodec=u,s.id=H.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${u||""}/${e.audioCodec||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=H.MAIN;const u=r.codec;if((u==null?void 0:u.length)===4)switch(u){case"hvc1":case"hev1":r.codec="hvc1.1.6.L120.90";break;case"av01":r.codec="av01.0.04M.08";break;case"avc1":r.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${r.codec!==u?" parsed-corrected="+r.codec:""}${r.supplemental?" supplemental="+r.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(g.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const f=t[u].initSegment;f!=null&&f.byteLength&&this.hls.trigger(g.BUFFER_APPENDING,{type:u,data:f,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,H.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=De.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(_t.isBuffered(e,i)?t=this.getAppendedFrag(i):_t.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,s=t.level;(!n||t.sn!==n.sn||n.level!==s)&&(this.fragPlaying=t,this.hls.trigger(g.FRAG_CHANGED,{frag:t}),(!n||n.level!==s)&&this.hls.trigger(g.LEVEL_SWITCHED,{level:s}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return K(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(K(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?Ye(null,i.fragments,t):null);if(n){const s=n.programDateTime;if(s!==null){const r=s+(t-n.start)*1e3;return new Date(r)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Yc{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[i].loader;if(n){var t;if(e&&e!==((t=n.context)==null?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=D.KEY_LOAD_ERROR,i,n,s){return new Ui({type:J.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:i,networkDetails:n})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:n}=e;for(let s=0;s<t.length;s++){const r=t[s];if(n<=r.cc&&(i==="initSegment"||r.sn==="initSegment"||i<r.sn)){this.emeController.selectKeySystemFormat(r).then(o=>{r.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const u=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,D.KEY_LOAD_ERROR,u))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,D.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));let o=this.keyUriToKeyInfo[r];if((i=o)!=null&&i.decryptdata.key)return s.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((n=o)!=null&&n.keyLoadPromise){var c;switch((c=o.mediaKeySessionContext)==null?void 0:c.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(u=>(s.key=u.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[r]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,D.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(i);if(n)return(e.keyLoadPromise=n.then(s=>(e.mediaKeySessionContext=s,i))).catch(s=>{throw e.keyLoadPromise=null,s})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=i.loader,s=new n(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((r,o)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=i.keyLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(m,E,y,w)=>{const{frag:k,keyInfo:z,url:ie}=y;if(!k.decryptdata||z!==this.keyUriToKeyInfo[ie])return o(this.createKeyLoadError(k,D.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),w));z.decryptdata.key=k.decryptdata.key=new Uint8Array(m.data),k.keyLoader=null,z.loader=null,r({frag:k,keyInfo:z})},onError:(m,E,y,w)=>{this.resetLoader(E),o(this.createKeyLoadError(t,D.KEY_LOAD_ERROR,new Error(`HTTP Error ${m.code} loading key ${m.text}`),y,b({url:c.url,data:void 0},m)))},onTimeout:(m,E,y)=>{this.resetLoader(E),o(this.createKeyLoadError(t,D.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),y))},onAbort:(m,E,y)=>{this.resetLoader(E),o(this.createKeyLoadError(t,D.INTERNAL_ABORTED,new Error("key loading aborted"),y))}};s.load(c,h,f)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,s=i.loader;t.keyLoader===s&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[n],s&&s.destroy()}}function $o(a){const{type:e}=a;switch(e){case ee.AUDIO_TRACK:return H.AUDIO;case ee.SUBTITLE_TRACK:return H.SUBTITLE;default:return H.MAIN}}function ya(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Xc{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(g.MANIFEST_LOADING,this.onManifestLoading,this),e.on(g.LEVEL_LOADING,this.onLevelLoading,this),e.on(g.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(g.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(g.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(g.MANIFEST_LOADING,this.onManifestLoading,this),e.off(g.LEVEL_LOADING,this.onLevelLoading,this),e.off(g.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(g.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(g.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,s=i||n,r=new s(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ee.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:s,url:r,deliveryDirectives:o,levelInfo:c}=t;this.load({id:i,level:n,pathwayId:s,responseType:"text",type:ee.LEVEL,url:r,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:ee.AUDIO_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:ee.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[ee.LEVEL];if(i){const n=i.context;n&&!t.levels.some(s=>s===n.levelOrTrack)&&(i.abort(),delete this.loaders[ee.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const u=this.hls.logger,h=n.context;if(h&&h.levelOrTrack===e.levelOrTrack&&(h.url===e.url||h.deliveryDirectives&&!e.deliveryDirectives)){h.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${h.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let s;if(e.type===ee.MANIFEST?s=i.manifestLoadPolicy.default:s=v({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),K((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ee.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ee.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ee.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const h=u.partTarget,f=u.targetduration;if(h&&f){const m=Math.max(h*3,f*.8)*1e3;s=v({},s,{maxTimeToFirstByteMs:Math.min(m,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(m,s.maxTimeToFirstByteMs)})}}}const r=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},c={onSuccess:(u,h,f,m)=>{const E=this.getInternalLoader(f);this.resetInternalLoader(f.type);const y=u.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),m||null,h);return}h.parsing.start=performance.now(),Un.isMediaPlaylist(y)||f.type!==ee.MANIFEST?this.handleTrackOrLevelPlaylist(u,h,f,m||null,E):this.handleMasterPlaylist(u,h,f,m)},onError:(u,h,f,m)=>{this.handleNetworkError(h,f,!1,u,m)},onTimeout:(u,h,f)=>{this.handleNetworkError(h,f,!0,void 0,u)}};n.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const s=this.hls,r=e.data,o=ya(e,i),c=Un.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:u,levels:h,sessionData:f,sessionKeys:m,startTimeOffset:E,variableList:y}=c;this.variableList=y;const{AUDIO:w=[],SUBTITLES:k,"CLOSED-CAPTIONS":z}=Un.parseMasterPlaylistMedia(r,o,c);w.length&&!w.some(q=>!q.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),w.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Zt({}),bitrate:0,url:""})),s.trigger(g.MANIFEST_LOADED,{levels:h,audioTracks:w,subtitles:k,captions:z,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:m,startTimeOffset:E,variableList:y})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:o,level:c,type:u}=i,h=ya(e,i),f=K(c)?c:K(o)?o:0,m=$o(i),E=Un.parseLevelPlaylist(e.data,h,f,m,0,this.variableList);if(u===ee.MANIFEST){const y={attrs:new Zt({}),bitrate:0,details:E,name:"",url:h};E.requestScheduled=t.loading.start+ur(E,0),r.trigger(g.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:h,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=E,this.handlePlaylistLoaded(E,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(g.ERROR,{type:J.NETWORK_ERROR,details:D.MANIFEST_PARSING_ERROR,fatal:t.type===ee.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:s})}handleNetworkError(e,t,i=!1,n,s){let r=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===ee.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ee.AUDIO_TRACK||e.type===ee.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let c=D.UNKNOWN,u=!1;const h=this.getInternalLoader(e);switch(e.type){case ee.MANIFEST:c=i?D.MANIFEST_LOAD_TIMEOUT:D.MANIFEST_LOAD_ERROR,u=!0;break;case ee.LEVEL:c=i?D.LEVEL_LOAD_TIMEOUT:D.LEVEL_LOAD_ERROR,u=!1;break;case ee.AUDIO_TRACK:c=i?D.AUDIO_TRACK_LOAD_TIMEOUT:D.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ee.SUBTITLE_TRACK:c=i?D.SUBTITLE_TRACK_LOAD_TIMEOUT:D.SUBTITLE_LOAD_ERROR,u=!1;break}h&&this.resetInternalLoader(e.type);const f={type:J.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:s};if(n){const m=(t==null?void 0:t.url)||e.url;f.response=b({url:m,data:void 0},n)}this.hls.trigger(g.ERROR,f)}handlePlaylistLoaded(e,t,i,n,s,r){const o=this.hls,{type:c,level:u,id:h,groupId:f,deliveryDirectives:m}=n,E=ya(t,n),y=$o(n),w=typeof n.level=="number"&&y===H.MAIN?u:void 0;if(!e.fragments.length){const z=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(g.ERROR,{type:J.NETWORK_ERROR,details:D.LEVEL_EMPTY_ERROR,fatal:!1,url:E,error:z,reason:z.message,response:t,context:n,level:w,parent:y,networkDetails:s,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const k=e.playlistParsingError;if(k){if(this.hls.logger.warn(k),!o.config.ignorePlaylistParsingErrors){o.trigger(g.ERROR,{type:J.NETWORK_ERROR,details:D.LEVEL_PARSING_ERROR,fatal:!1,url:E,error:k,reason:k.message,response:t,context:n,level:w,parent:y,networkDetails:s,stats:i});return}e.playlistParsingError=null}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case ee.MANIFEST:case ee.LEVEL:o.trigger(g.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||o.levels[0],level:w||0,id:h||0,stats:i,networkDetails:s,deliveryDirectives:m,withoutMultiVariant:c===ee.MANIFEST});break;case ee.AUDIO_TRACK:o.trigger(g.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:h||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:m});break;case ee.SUBTITLE_TRACK:o.trigger(g.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:h||0,groupId:f||"",stats:i,networkDetails:s,deliveryDirectives:m});break}}}class _s{static get version(){return Zs}static isMSESupported(){return Uo()}static isSupported(){return jc()}static getMediaSource(){return fe()}static get Events(){return g}static get MetadataSchema(){return Pn}static get ErrorTypes(){return J}static get ErrorDetails(){return D}static get DefaultConfig(){return _s.defaultConfig?_s.defaultConfig:Oc}static set DefaultConfig(e){_s.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ur,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=X(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=kc(_s.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Mc(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=i,u=new o(this),h=this.abrController=new n(this),f=new zi(this),m=i.interstitialsController,E=m?this.interstitialsController=new m(this,_s):null,y=this.bufferController=new s(this,f),w=this.capLevelController=new r(this),k=new c(this),z=new Xc(this),ie=i.contentSteeringController,q=ie?new ie(this):null,le=this.levelController=new Wc(this,q),ce=new Kc(this),Se=new Yc(this.config),he=this.streamController=new Zc(this,f,Se),Ee=this.gapController=new Uc(this,f);w.setStreamController(he),k.setStreamController(he);const Re=[z,le,he];E&&Re.splice(1,0,E),q&&Re.splice(1,0,q),this.networkControllers=Re;const ge=[h,y,Ee,w,k,ce,f];this.audioTrackController=this.createController(i.audioTrackController,Re);const $e=i.audioStreamController;$e&&Re.push(this.audioStreamController=new $e(this,f,Se)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Re);const Ve=i.subtitleStreamController;Ve&&Re.push(this.subtititleStreamController=new Ve(this,f,Se)),this.createController(i.timelineController,ge),Se.emeController=this.emeController=this.createController(i.emeController,ge),this.cmcdController=this.createController(i.cmcdController,ge),this.latencyController=this.createController(Hc,ge),this.coreComponents=ge,Re.push(u);const Xt=u.onErrorOut;typeof Xt=="function"&&this.on(g.ERROR,Xt,u),this.on(g.MANIFEST_LOADED,z.onManifestLoaded,z)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const n=e===g.ERROR;this.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.INTERNAL_EXCEPTION,fatal:n,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(g.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(g.ERROR,{type:J.OTHER_ERROR,details:D.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger(g.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger(g.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(g.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=P.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(g.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[H.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[H.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[H.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=hl()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){qi(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let n=0;n<i;n++)if(e[n].maxBitrate>=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let n;if(t===-1&&e!=null&&e.length?n=e.length-1:n=t,i)for(let s=n;s--;){const r=e[s].attrs["HDCP-LEVEL"];if(r&&r<=i)return s}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=mt(t);return fn(e,i,navigator.mediaCapabilities)}}_s.defaultConfig=void 0}}]);
|
|
}()); |