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
923 KiB
126 lines
923 KiB
!(function(){var zo=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[2524],{70557:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return H}});var K=P(72308),ie=P(59301),ce={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"},q=ce,C=P(7657),g=function(W,b){return ie.createElement(C.Z,(0,K.Z)({},W,{ref:b,icon:q}))},ee=ie.forwardRef(g),H=ee},84105:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return H}});var K=P(72308),ie=P(59301),ce={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"},q=ce,C=P(7657),g=function(W,b){return ie.createElement(C.Z,(0,K.Z)({},W,{ref:b,icon:q}))},ee=ie.forwardRef(g),H=ee},18785:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return H}});var K=P(72308),ie=P(59301),ce={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"},q=ce,C=P(7657),g=function(W,b){return ie.createElement(C.Z,(0,K.Z)({},W,{ref:b,icon:q}))},ee=ie.forwardRef(g),H=ee},35593:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return it}});var K=P(77321),ie=P(52487),ce=P(74416),q=P(43403),C=P(92310),g=P.n(C),ee=P(29301),H=P(76846),l=P(96452),W=P(6089),b=P(80402),v=P(34280),_=P(49658),E=P(59301),T=P(72308),B=P(77900),U=P(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=E.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 E.createElement("div",{ref:pt,className:g()("".concat(be,"-arrow"),se),style:st},de)}function w(_e){var be=_e.prefixCls,ve=_e.open,Be=_e.zIndex,je=_e.mask,Z=_e.motion;return je?E.createElement(B.default,(0,T.Z)({},Z,{motionAppear:!0,visible:ve,removeOnLeave:!0}),function(se){var de=se.className;return E.createElement("div",{style:{zIndex:Be},className:g()("".concat(be,"-mask"),de)})}):null}var M=E.memo(function(_e){var be=_e.children;return be},function(_e,be){return be.cache}),j=M,O=E.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,ui=_e.targetHeight,ai=typeof ve=="function"?ve():ve,Si=we||ke,$t=(Mt==null?void 0:Mt.length)>0,Jt=E.useState(!Mt||!$t),Mi=(0,ie.Z)(Jt,2),Li=Mi[0],tn=Mi[1];if((0,v.Z)(function(){!Li&&$t&&se&&tn(!0)},[Li,$t,se]),!Li)return null;var Di="auto",ci={left:"-1000vw",top:"-1000vh",right:Di,bottom:Di};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?(ci.right=kt,ci.left=Di):(ci.left=lt,ci.right=Di),fn?(ci.bottom=gt,ci.top=Di):(ci.top=Et,ci.bottom=Di)}var Ti={};return at&&(at.includes("height")&&ui?Ti.height=ui:at.includes("minHeight")&&ui&&(Ti.minHeight=ui),at.includes("width")&&St?Ti.width=St:at.includes("minWidth")&&St&&(Ti.minWidth=St)),we||(Ti.pointerEvents="none"),E.createElement(xi,{open:Ot||Si,getContainer:Mt&&function(){return Mt(se)},autoDestroy:Xe},E.createElement(w,{prefixCls:je,open:we,zIndex:bt,mask:pt,motion:Ct}),E.createElement(ee.Z,{onResize:nt,disabled:!we},function(Ji){return E.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 E.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")},ci),Ti),Vt),{},{boxSizing:"border-box",zIndex:bt},Z),onMouseEnter:Le,onMouseLeave:Ne,onPointerEnter:Ke,onClick:ot},st&&E.createElement(F,{prefixCls:je,arrow:st,arrowPos:Rt,align:Ut}),E.createElement(j,{cache:!we&&!Ze},ai))})}))}),$=O,X=E.forwardRef(function(_e,be){var ve=_e.children,Be=_e.getTriggerDOMNode,je=(0,U.Yr)(ve),Z=E.useCallback(function(de){(0,U.mH)(be,Be?Be(de):de)},[Be]),se=(0,U.x1)(Z,ve.ref);return je?E.cloneElement(ve,{ref:se}):ve}),Y=X,fe=E.createContext(null),Ee=fe;function ae(_e){return _e?Array.isArray(_e)?_e:[_e]:[]}function Q(_e,be,ve,Be){return E.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 I=P(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 R(_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 k(_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,ie.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=E.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:je[Be]||{}}),we=(0,ie.Z)(de,2),ke=we[0],Ze=we[1],ot=E.useRef(0),pt=E.useMemo(function(){return be?k(be):[]},[be]),st=E.useRef({}),Rt=function(){st.current={}};_e||Rt();var Ut=(0,W.Z)(function(){if(be&&ve&&_e){let ji=function(Oi,_n){var vn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sn,an=ai.x+Oi,Ki=ai.y+_n,Yt=an+qt,Xi=Ki+ci,zn=Math.max(an,vn.left),es=Math.max(Ki,vn.top),ts=Math.min(Yt,vn.right),Un=Math.min(Xi,vn.bottom);return Math.max(0,(ts-zn)*(Un-es))},Tn=function(){Bi=ai.y+Je,mi=Bi+ci,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 ui=ve.getBoundingClientRect();St={x:ui.x,y:ui.y,width:ui.width,height:ui.height}}var ai=Xe.getBoundingClientRect(),Si=xi.documentElement,$t=Si.clientWidth,Jt=Si.clientHeight,Mi=Si.scrollWidth,Li=Si.scrollHeight,tn=Si.scrollTop,Di=Si.scrollLeft,ci=ai.height,qt=ai.width,wi=St.height,Qi=St.width,Vi={left:0,top:0,right:$t,bottom:Jt},fn={left:-Di,top:-tn,right:Mi-Di,bottom:Li-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,Ci=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 Ei=p(Math.round(qt/parseFloat(Ne)*1e3)/1e3),ei=p(Math.round(ci/parseFloat(Ke)*1e3)/1e3);if(Ei===0||ei===0||(0,H.Sh)(ve)&&!(0,I.Z)(ve))return;var Mn=xt.offset,gi=xt.targetOffset,Qt=oe(ai,Mn),ln=(0,ie.Z)(Qt,2),ii=ln[0],mt=ln[1],pe=oe(St,gi),ne=(0,ie.Z)(pe,2),Ae=ne[0],Ce=ne[1];St.x-=Ae,St.y-=Ce;var Te=xt.points||[],Ue=(0,ie.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;Tn();var Gi=jt(Ii),Hi=re[0]===Tt[0];if(Gi&&re[0]==="t"&&(mi>Ci.bottom||st.current.bt)){var _i=Je;Hi?_i-=ci-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<Ci.top||st.current.tb)){var vi=Je;Hi?vi+=ci-wi:vi=Kt.y-ti.y-mt;var wn=ji(Ye,vi),Pn=ji(Ye,vi,Vt);wn>ni||wn===ni&&(!Ni||Pn>=si)?(st.current.tb=!0,Je=vi,mt=-mt,Gt.points=[Me(re,0),Me(Tt,0)]):st.current.tb=!1}var bn=jt(oi),gn=re[1]===Tt[1];if(bn&&re[1]==="l"&&(zi>Ci.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(bn&&re[1]==="r"&&(Ft<Ci.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}Tn();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,xn=_t+ci,Ln=St.x,Sn=Ln+Qi,Hn=St.y,Wn=Hn+wi,Jn=Math.max(en,Ln),Nn=Math.min(Rn,Sn),Zt=(Jn+Nn)/2,os=Zt-en,jn=Math.max(_t,Hn),Vn=Math.min(xn,Wn),qn=(jn+Vn)/2,Fn=qn-_t;se==null||se(be,Gt);var Bn=on.right-ai.x-(Ye+ai.width),mn=on.bottom-ai.y-(Je+ai.height);Ze({ready:!0,offsetX:Ye/Ei,offsetY:Je/ei,offsetR:Bn/Ei,offsetB:mn/ei,arrowX:os/Ei,arrowY:Fn/ei,scaleX:Ei,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=P(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=k(Z),we=k(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=P(48736),dt=P(16089);function Fe(_e,be,ve,Be,je,Z,se,de){var we=E.useRef(_e),ke=E.useRef(!1);we.current!==_e&&(ke.current=!0,we.current=_e),E.useEffect(function(){var Ze=(0,dt.Z)(function(){ke.current=!1});return function(){dt.Z.cancel(Ze)}},[_e]),E.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,ie.Z)(ot,2),st=pt[0],Rt=pt[1],Ut=Ze(),ct=(0,ie.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]:q.Z,be=E.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,ui=ve.stretch,ai=ve.getPopupClassNameFromAlign,Si=ve.fresh,$t=ve.alignPoint,Jt=ve.onPopupClick,Mi=ve.onPopupAlign,Li=ve.arrow,tn=ve.popupMotion,Di=ve.maskMotion,ci=ve.popupTransitionName,qt=ve.popupAnimation,wi=ve.maskTransitionName,Qi=ve.maskAnimation,Vi=ve.className,fn=ve.getTriggerDOMNode,Ti=(0,ce.Z)(ve,qe),Ji=Ke||Nt||!1,qi=E.useState(!1),Ni=(0,ie.Z)(qi,2),nn=Ni[0],Vt=Ni[1];(0,v.Z)(function(){Vt((0,_.Z)())},[]);var sn=E.useRef({}),Ci=E.useContext(Ee),on=E.useMemo(function(){return{registerSubPopup:function(It,Pi){sn.current[It]=Pi,Ci==null||Ci.registerSubPopup(It,Pi)}}},[Ci]),Ei=(0,b.Z)(),ei=E.useState(null),Mn=(0,ie.Z)(ei,2),gi=Mn[0],Qt=Mn[1],ln=(0,W.Z)(function(Qe){(0,H.Sh)(Qe)&&gi!==Qe&&Qt(Qe),Ci==null||Ci.registerSubPopup(Ei,Qe)}),ii=E.useState(null),mt=(0,ie.Z)(ii,2),pe=mt[0],ne=mt[1],Ae=E.useRef(null),Ce=(0,W.Z)(function(Qe){(0,H.Sh)(Qe)&&pe!==Qe&&(ne(Qe),Ae.current=Qe)}),Te=E.Children.only(se),Ue=(Te==null?void 0:Te.props)||{},Pe={},ut=(0,W.Z)(function(Qe){var It,Pi,$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))||((Pi=(0,l.A)(gi))===null||Pi===void 0?void 0:Pi.host)===Qe||Qe===gi||Object.values(sn.current).some(function(hi){return(hi==null?void 0:hi.contains(Qe))||Qe===hi})}),Tt=S(Z,tn,qt,ci),re=S(Z,Di,Qi,wi),At=E.useState(pt||!1),wt=(0,ie.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=E.useRef(Je);si.current=Je;var di=E.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=E.useRef(),Ht=function(){clearTimeout(Kt.current)},Bt=function(It){var Pi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Ht(),Pi===0?ti(It):Kt.current=setTimeout(function(){ti(It)},Pi*1e3)};E.useEffect(function(){return Ht},[]);var oi=E.useState(!1),Ii=(0,ie.Z)(oi,2),li=Ii[0],ri=Ii[1];(0,v.Z)(function(Qe){(!Qe||Je)&&ri(!0)},[Je]);var jt=E.useState(null),Bi=(0,ie.Z)(jt,2),mi=Bi[0],Ft=Bi[1],zi=E.useState([0,0]),Gi=(0,ie.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,ie.Z)(dn,11),wn=vi[0],Pn=vi[1],bn=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,ie.Z)(Wi,2),Rn=en[0],_t=en[1],xn=Rn.has("click"),Ln=_t.has("click")||_t.has("contextMenu"),Sn=(0,W.Z)(function(){li||Ai()}),Hn=function(){si.current&&$t&&Ln&&Bt(!1)};ft(Je,pe,gi,Sn,Hn),(0,v.Z)(function(){Sn()},[Hi,gt]),(0,v.Z)(function(){Je&&!(xt!=null&&xt[gt])&&Sn()},[JSON.stringify(at)]);var Wn=E.useMemo(function(){var Qe=R(xt,Z,Ui,$t);return g()(Qe,ai==null?void 0:ai(Ui))},[Ui,ai,xt,Z,$t]);E.useImperativeHandle(Be,function(){return{nativeElement:Ae.current,forceAlign:Sn}});var Jn=E.useState(0),Nn=(0,ie.Z)(Jn,2),Zt=Nn[0],os=Nn[1],jn=E.useState(0),Vn=(0,ie.Z)(jn,2),qn=Vn[0],Fn=Vn[1],Bn=function(){if(ui&&pe){var It=pe.getBoundingClientRect();os(It.width),Fn(It.height)}},mn=function(){Bn(),Sn()},ji=function(It){ri(!1),Ai(),Rt==null||Rt(It)},Tn=function(){return new Promise(function(It){Bn(),Ft(function(){return It})})};(0,v.Z)(function(){mi&&(Ai(),mi(),Ft(null))},[mi]);function Oi(Qe,It,Pi,$i){Pe[Qe]=function(hi){var ls;$i==null||$i(hi),Bt(It,Pi);for(var is=arguments.length,Zn=new Array(is>1?is-1:0),ds=1;ds<is;ds++)Zn[ds-1]=arguments[ds];(ls=Ue[Qe])===null||ls===void 0||ls.call.apply(ls,[Ue,hi].concat(Zn))}}(xn||Ln)&&(Pe.onClick=function(Qe){var It;si.current&&Ln?Bt(!1):!si.current&&xn&&(Zi(Qe),Bt(!0));for(var Pi=arguments.length,$i=new Array(Pi>1?Pi-1:0),hi=1;hi<Pi;hi++)$i[hi-1]=arguments[hi];(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&&(Oi("onMouseEnter",!0,Ut,function(Qe){Zi(Qe)}),Oi("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&&(Oi("onMouseLeave",!1,Ct),Oi("onPointerLeave",!1,Ct),Ki=function(){Bt(!1,Ct)}),Rn.has("focus")&&Oi("onFocus",!0,Ot),_t.has("focus")&&Oi("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 Pi=arguments.length,$i=new Array(Pi>1?Pi-1:0),hi=1;hi<Pi;hi++)$i[hi-1]=arguments[hi];(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,Pi=arguments.length,$i=new Array(Pi),hi=0;hi<Pi;hi++)$i[hi]=arguments[hi];(It=Yt[Qe])===null||It===void 0||It.call.apply(It,[Yt].concat($i)),Ti[Qe].apply(Ti,$i)})});var es=E.cloneElement(Te,(0,K.Z)((0,K.Z)({},Yt),Xi)),ts={x:Yi,y:rn},Un=Li?(0,K.Z)({},Li!==!0?Li:{}):null;return E.createElement(E.Fragment,null,E.createElement(ee.Z,{disabled:!Je,ref:Ce,onResize:mn},E.createElement(Y,{getTriggerDOMNode:fn},es)),E.createElement(Ee.Provider,{value:on},E.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:Tn,forceRender:Ne,autoDestroy:Ji,getPopupContainer:Le,align:Ui,arrow:Un,arrowPos:ts,ready:wn,offsetX:Pn,offsetY:bn,offsetR:gn,offsetB:un,onAlign:Sn,stretch:ui,targetWidth:Zt/pn,targetHeight:qn/In})))});return be}var it=Wt(q.Z)},86878:function(tt,Re,P){"use strict";P.r(Re),P.d(Re,{default:function(){return bt}});var K=P(955),ie=P(6848),ce=P(12563),q=P(93948),C=P(28103),g=P(71418),ee=P(66104),H=P(57809),l=P(79817),W=P(43418),b=P(59301),v=P(89070),_=P(36371),E=P(83312),T=P(86248),B=P(25775),U=Object.defineProperty,F=Object.defineProperties,w=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,O=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))O.call(Ne,Ke)&&$(Le,Ke,Ne[Ke]);return Le},Y=(Le,Ne)=>F(Le,w(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 Ee=[{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,b.useRef)(null),lt=(0,b.useRef)(),Et=(0,b.useRef)(0);(0,b.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,Li,tn,Di,ci;return Y(X({},$t),{key:Jt,title:(Mi=$t==null?void 0:$t.properties)==null?void 0:Mi.name,newcolor:parseInt((Li=$t==null?void 0:$t.properties)==null?void 0:Li.color)===1?"#CC7CF5":((tn=Ee==null?void 0:Ee.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((Di=$t==null?void 0:$t.properties)==null?void 0:Di.color)===1?"\u6839\u8282\u70B9":((ci=Ee==null?void 0:Ee.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:ci.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 ui=(0,B.RN)(St),ai=(xt=ui.nodes)==null?void 0:xt.filter(($t,Jt,Mi)=>Jt===Mi.findIndex(Li=>Li.id===$t.id)),Si=(at=ui.edges)==null?void 0:at.filter(($t,Jt,Mi)=>Jt===Mi.findIndex(Li=>Li.source===$t.source&&Li.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 ui=Q(this,St);return ui==="center"?"right":ui},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 b.createElement("div",{style:{height:"100%"}},b.createElement(g.Z,{spinning:Le,className:"mt60 w100",tip:"\u52A0\u8F7D\u4E2D..."}),b.createElement("div",{style:{height:"100%"},ref:Nt}))},R=P(85057),S=P(99064),G=P(3294),k=P(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})=>b.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=P(89076),de=P(71839),we=P(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,b.useRef)(null),[Nt,lt]=(0,b.useState)(0),[Et,kt]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{Ke.current&&setTimeout(()=>{const gt=(0,K.ZR)(Ke.current,"rem",1);lt(gt)},500)},[Ke.current]),b.createElement("div",{className:"relative flex item-end "},b.createElement("div",{style:{height:Et?"auto":`${Ne*23.25}rem`,overflow:"hidden"}},b.createElement("div",{ref:Ke,style:{fontSize:"14rem"}},Le)),Nt>=Ne*23.25&&b.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,b.useState)(!1);return b.createElement("div",{id:`${Le==null?void 0:Le.id}`,className:"bg-white",style:{borderRadius:"4rem",padding:"15rem 30rem 30rem"}},b.createElement("div",{style:{color:"#3061D0"}},b.createElement(Z,{type:"\u5B50\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u5B50\u80FD\u529B"),b.createElement("div",{className:"c-grey-333 flex item-center",style:{fontSize:"14rem",margin:"20rem 0 10rem 0",gap:"10rem"}},b.createElement(ie.Z,{title:Le==null?void 0:Le.name},b.createElement("div",{className:"multi_ellipsis1 minW-0"},Le==null?void 0:Le.name)),b.createElement("div",{className:"flex item-center",style:{gap:"5rem"}},(Nt=Le==null?void 0:Le.ability_tags)==null?void 0:Nt.map(at=>b.createElement(ce.default,{color:"orange",style:{fontSize:"12rem"}},at)))),(Le==null?void 0:Le.description)&&b.createElement("div",{style:{padding:"12rem",background:"#F6F7F9"}},b.createElement(Mt,null,Le==null?void 0:Le.description)),b.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 ",b.createElement(Z,{type:"\u77E5\u8BC6\u70B9",ImgProps:{style:{margin:"0 5rem"}}})," ",Le==null?void 0:Le.knowledge_count,"\u4E2A\u77E5\u8BC6\u70B9",b.createElement("span",{style:{marginLeft:"40rem"}},b.createElement(Z,{type:"\u8D44\u6E90",ImgProps:{style:{marginRight:"5rem"}}}),Le==null?void 0:Le.resource_count,"\u4E2A\u8D44\u6E90\u6570")),b.createElement("div",{style:{marginBottom:"10rem"}},b.createElement(Z,{type:"\u77E5\u8BC6\u70B9",ImgProps:{style:{marginRight:"5rem"}}}),"\u8986\u76D6\u77E5\u8BC6\u70B9",Le==null?void 0:Le.knowledge_count,"\u4E2A"),b.createElement("div",{style:{height:"320rem",background:"#F6F7F9"}},b.createElement(A,{loading:!1,nodes:Le==null?void 0:Le.nodes,relationships:Le==null?void 0:Le.relationships})),b.createElement("div",{style:{margin:"30rem 0 10rem"}},b.createElement(Z,{type:"\u8D44\u6E90",ImgProps:{style:{marginRight:"5rem"}}}),"\u8986\u76D6\u8D44\u6E90\u6570",Le==null?void 0:Le.resource_count,"\u4E2A"),b.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=>b.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)&&b.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"),b.createElement(q.Z,{type:"circle",percent:at==null?void 0:at.complete_rate,size:60,status:"success",format:St=>`${St}%`,strokeWidth:10}),b.createElement(Z,{type:at==null?void 0:at.node_type,ImgProps:{style:{width:"16rem",height:"16rem",marginTop:"3rem"}}}),b.createElement("div",{className:"flex-1 minW-0"},b.createElement(ie.Z,{title:at==null?void 0:at.name,placement:"topLeft"},b.createElement("div",{className:"multi_ellipsis1 c-grey-333 blod",style:{fontSize:"16rem"}},at==null?void 0:at.name)),b.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)&&b.createElement("div",{className:"flex flex-wrap item-center v-grey-666",style:{marginTop:"20rem",fontSize:"12rem",gap:"10rem"}},b.createElement("div",null,"\u5B66\u4E60\u4EBA\u6570\uFF1A",at==null?void 0:at.study_count,"\u4EBA"),b.createElement("div",null,"\u638C\u63E1\u4EBA\u6570\uFF1A",at==null?void 0:at.complete_count,"\u4EBA"),b.createElement("div",null,"\u638C\u63E1\u7387\uFF1A",at==null?void 0:at.complete_rate,"%")))))),(Le==null?void 0:Le.resource_knowledge_graphs.length)>4&&b.createElement("div",{className:"flex item-center justify-center",style:{padding:"0 220rem"},onClick:()=>{xt(!nt)}},b.createElement(C.Z,{style:{borderColor:"#3061D0",marginBottom:"0rem",cursor:"pointer"},dashed:!0},b.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,ui,ai,Si,$t,Jt,Mi,Li,tn,Di,ci,qt,wi,Qi,Vi,fn,Ti,Ji,qi,Ni,nn,Vt,sn,Ci,on;const{detail:Ei}=Le,ei=(0,v.useParams)(),[Mn]=(0,v.useSearchParams)(),[gi,Qt]=(0,b.useState)({}),[ln,ii]=(0,b.useState)({id:null,open:!1,resourceUrl:""}),[,mt,pe,ne]=(0,E.U)(T.Ju,{subject_id:ei.pathId,id:ei==null?void 0:ei.abilityId}),[Ae,Ce]=(0,b.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),!(Ei!=null&&Ei.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,b.useEffect)(()=>{var re,At;if((ne==null?void 0:ne.status)==0&&(Ei!=null&&Ei.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)}},[Ei==null?void 0:Ei.can_managed,ne]),(0,b.useEffect)(()=>{Ue()},[ei==null?void 0:ei.abilityId]),(0,b.useEffect)(()=>{Ne({type:"pathsDetail/getKnowledgeGraphs",payload:{graphable_type:Mn.get("type")=="classrooms"?"course":"subject",graphable_id:ei==null?void 0:ei.pathId}}),Te.set("tabs","5")},[]),(0,b.useEffect)(()=>(Ne({type:"globalSetting/footerToggle",payload:!1}),()=>{Ne({type:"globalSetting/footerToggle",payload:!0})}),[]),b.createElement(g.Z,{spinning:mt},b.createElement("div",{className:"ml-auto mr-auto",style:{width:"1200rem",paddingTop:"15rem"}},b.createElement(ee.Z,{style:{fontSize:"14rem",marginBottom:"20rem"},items:[{title:b.createElement("a",{className:"flex item-center",style:{fontSize:"14rem"},onClick:()=>{v.history.push(`/knowledgegraph/${ei.pathId}?${Te}`)}},b.createElement(ie.Z,{title:"\u8FD4\u56DE"},b.createElement("i",{className:"iconfont icon-fanhui1",style:{fontSize:"14rem",marginRight:"20rem"}})),"\u80FD\u529B\u56FE\u8C31")},{title:"\u80FD\u529B\u8BE6\u60C5"}]}),b.createElement("div",{className:"w-full flex"},b.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"}},b.createElement("div",{style:{padding:"20rem"}},b.createElement("div",{className:"c-grey-333",style:{fontSize:"16rem"}},"\u80FD\u529B\u76EE\u6807\u56FE\u8C31"),b.createElement("div",{className:"w-full",style:{height:"200rem",marginTop:"20rem"}},b.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%"}}))),b.createElement("div",{style:{padding:"10rem 20rem 20rem"}},b.createElement("div",{className:"c-grey-333",style:{fontSize:"16rem"}},"\u76EE\u5F55\u5BFC\u822A"),b.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"})),b.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:b.createElement("div",{className:`current relative ${p.AnchorDom}`},b.createElement("div",{className:"flex item-center",style:{gap:"10rem"}},b.createElement("div",{className:"flex-1 minW-0 multi_ellipsis1 c-grey-333",style:{fontSize:"14rem"}},re==null?void 0:re.name),b.createElement("span",{style:{color:"#464F66",fontSize:"12rem"}},Ei!=null&&Ei.can_managed?b.createElement(b.Fragment,null,b.createElement("span",{className:"iconfont icon-a-60-kejian",style:{marginRight:"5rem",fontSize:"12rem"}}),re==null?void 0:re.knowledge_count):b.createElement("span",{style:{color:"#00C088"}},b.createElement("span",{className:"iconfont icon-xuesheng2",style:{marginRight:"5rem",fontSize:"12rem"}}),(re==null?void 0:re.grasp_rate)||0,"%"))),b.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=>b.createElement(ce.default,{color:"orange",style:{fontSize:"12rem"},key:wt},wt))),b.createElement("div",{className:"multi_ellipsis2",style:{marginTop:"20rem",color:"#464F66",fontSize:"12rem"}},re==null?void 0:re.description))}})})),b.createElement("div",{className:"flex-1 minW-0 flex flex-col",style:{gap:"20rem"}},b.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)&&b.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}`)}},b.createElement("div",{className:p.NextAbility},b.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),b.createElement("div",null,b.createElement("span",{className:"iconfont icon-you2",style:{fontSize:"14rem"}})))),b.createElement("div",{style:{color:"#3061D0"}},b.createElement(Z,{type:"\u4E3B\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u4E3B\u80FD\u529B"),b.createElement("div",{className:"c-grey-333 blod",style:{fontSize:"14rem",margin:"20rem 0 10rem 0"}},(ui=ne==null?void 0:ne.data)==null?void 0:ui.name),((ai=ne==null?void 0:ne.data)==null?void 0:ai.description)&&b.createElement("div",{style:{padding:"12rem",background:"#F6F7F9"}},b.createElement(Mt,null,(Si=ne==null?void 0:ne.data)==null?void 0:Si.description)),(Ei==null?void 0:Ei.can_managed)&&b.createElement(b.Fragment,null,b.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:P(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:P(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:(Li=ne==null?void 0:ne.data)==null?void 0:Li.total_resource_count,unit:"\u4E2A",img:P(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)=>b.createElement("div",{key:At,className:"flex-1 minW-0 relative",style:{borderRadius:"6rem",background:re==null?void 0:re.bg,padding:"20rem 30rem"}},b.createElement("img",{src:re==null?void 0:re.img,width:"43rem",height:"43rem",className:"absolute",style:{right:"30rem",top:"20rem"}}),b.createElement("div",{className:"c-grey-666",style:{fontSize:"14rem"}},re==null?void 0:re.title),b.createElement("div",{className:"c-grey-333 blod",style:{marginTop:"10rem",fontSize:"26rem",lineHeight:"26rem"}},re==null?void 0:re.value,b.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),(re==null?void 0:re.ProgressTitle)&&b.createElement("div",{className:"c-grey-666",style:{fontSize:"12rem",marginTop:"20rem"}},b.createElement("div",null,re==null?void 0:re.ProgressTitle,re==null?void 0:re.percent,"%"),b.createElement(q.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"}}))))),b.createElement("div",{className:"c-grey-333",style:{margin:"40rem 0 30rem 0",fontSize:"14rem"}},"\u5B66\u4E60\u7EDF\u8BA1"),b.createElement("div",{className:"flex"},b.createElement("div",{className:"minW-0 flex flex-col",style:{gap:"13rem",width:"200rem"}},[{title:"\u5B66\u4E60\u4EBA\u6570",value:(Di=ne==null?void 0:ne.data)==null?void 0:Di.study_count,unit:"",img:P(37426),bg:"rgba(68, 95, 232, 0.1)"},{title:"\u5B66\u4E60\u5B8C\u6210\u7387",value:(ci=ne==null?void 0:ne.data)==null?void 0:ci.complete_rate,unit:"%",img:P(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:P(55303),bg:"rgba(6, 145, 127, .1)"}].map((re,At)=>b.createElement("div",{key:At,className:"relative",style:{borderRadius:"6rem",padding:"20rem",background:re==null?void 0:re.bg}},b.createElement("div",{style:{fontSize:"14rem"}},re==null?void 0:re.title),b.createElement("div",{className:"blod",style:{fontSize:"26rem"}},re==null?void 0:re.value,b.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),b.createElement("img",{className:"absolute",style:{right:"6rem",bottom:"6rem"},height:"35rem",src:re==null?void 0:re.img})))),b.createElement("div",{className:"flex-1 minW-0"},b.createElement(_.Z,{dataSource:Ae,legend:{top:null,icon:"roundRect",bottom:10,itemWidth:14,itemGap:50,left:"center",formatter:re=>re}})))),!(Ei!=null&&Ei.can_managed)&&b.createElement(b.Fragment,null,b.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)=>b.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"}},b.createElement("div",{className:"flex flex-col justify-between"},b.createElement("div",{style:{fontSize:"14rem",whiteSpace:"nowrap"}},re==null?void 0:re.title),b.createElement("div",{className:"blod",style:{fontSize:"26rem"}},re==null?void 0:re.value,b.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit))),b.createElement("div",{className:"relative",style:{width:"133rem",height:"75rem"}},b.createElement(q.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=>b.createElement("div",{className:"c-grey-333",style:{fontSize:"12rem",textAlign:"center",marginTop:"-35rem"}},wt,"%",b.createElement("br",null),b.createElement("br",null),re==null?void 0:re.percenttitle)}))))),b.createElement("div",{className:"c-grey-333 blod",style:{margin:"40rem 0 30rem 0",fontSize:"14rem"}},"\u5B66\u4E60\u7EDF\u8BA1"),b.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:P(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:P(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:P(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)=>b.createElement("div",{key:At,className:"flex-1 minW-0 relative",style:{borderRadius:"6rem",background:re==null?void 0:re.bg,padding:"20rem 30rem"}},b.createElement("img",{src:re==null?void 0:re.img,width:"43rem",height:"43rem",className:"absolute",style:{right:"30rem",top:"20rem"}}),b.createElement("div",{className:"c-grey-666",style:{fontSize:"14rem"}},re==null?void 0:re.title),b.createElement("div",{className:"c-grey-333 blod",style:{marginTop:"10rem",fontSize:"26rem",lineHeight:"26rem"}},re==null?void 0:re.value,b.createElement("span",{style:{fontSize:"14rem"}},re==null?void 0:re.unit)),(re==null?void 0:re.ProgressTitle)&&b.createElement("div",{className:"c-grey-666",style:{fontSize:"12rem",marginTop:"20rem"}},b.createElement("div",null,re==null?void 0:re.ProgressTitle,re==null?void 0:re.percent,"%"),b.createElement(q.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"}}))))),b.createElement("div",{className:"c-grey-333 blod",style:{margin:"30rem 0 10rem 0",fontSize:"14rem"}},"\u5F00\u59CB\u5B66\u4E60"),b.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=>b.createElement("div",{key:re==null?void 0:re.id,className:"flex item-center",style:{gap:"20rem",padding:"20rem",background:"#F6F7F9",borderRadius:"6rem"}},b.createElement("div",{className:"flex-1 minW-0 flex flex-col"},b.createElement("div",{className:"flex",style:{gap:"10rem"}},b.createElement("div",{style:{color:"#3061D0"}},b.createElement(Z,{type:"\u5B50\u80FD\u529B",ImgProps:{style:{marginRight:"5rem"}}}),"\u5B50\u80FD\u529B"),b.createElement(ie.Z,{title:re==null?void 0:re.name,placement:"topLeft"},b.createElement("div",{className:"multi_ellipsis1"},re==null?void 0:re.name))),b.createElement("div",{className:"flex item-center",style:{gap:"10rem",marginTop:"15rem",fontSize:"14rem"}},b.createElement(ce.default,{color:"orange",style:{fontSize:"12rem",lineHeight:"1.5"}},"\u8282\u70B9"),b.createElement("span",{className:"c-grey-333"},re==null?void 0:re.last_knowledge_name),re!=null&&re.is_complete?b.createElement("span",{className:"c-green"},"\uFF08\u5DF2\u638C\u63E1\uFF09"):b.createElement("span",{className:"c-grey-666"},"\uFF08\u672A\u638C\u63E1\uFF09"))),b.createElement(R.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=(Ci=ne==null?void 0:ne.data)==null?void 0:Ci.children_ability_goals)==null?void 0:on.map(re=>b.createElement(Xe,{key:re==null?void 0:re.id,DataProps:re,pathsDetail:Le,getUrl:Tt}))))),b.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}))}},b.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")}))})),b.createElement(k.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,Re,P){"use strict";P.d(Re,{o2:function(){return C},yT:function(){return g}});var K=P(80702),ie=P(33166);const ce=ie.i.map(ee=>`${ee}-inverse`),q=["success","processing","error","default","warning"];function C(ee){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat((0,K.Z)(ce),(0,K.Z)(ie.i)).includes(ee):ie.i.includes(ee)}function g(ee){return q.includes(ee)}},79676:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return g}});var K=P(19447);function ie(ee,H,l,W){if(W===!1)return{adjustX:!1,adjustY:!1};const b=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),b);return _.shiftX||(_.adjustX=!0),_.shiftY||(_.adjustY=!0),_}const ce={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"]}},q={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"]}},C=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function g(ee){const{arrowWidth:H,autoAdjustOverflow:l,arrowPointAtCenter:W,offset:b,borderRadius:v,visibleFirst:_}=ee,E=H/2,T={};return Object.keys(ce).forEach(B=>{const U=W&&q[B]||ce[B],F=Object.assign(Object.assign({},U),{offset:[0,0]});switch(T[B]=F,C.has(B)&&(F.autoArrow=!1),B){case"top":case"topLeft":case"topRight":F.offset[1]=-E-b;break;case"bottom":case"bottomLeft":case"bottomRight":F.offset[1]=E+b;break;case"left":case"leftTop":case"leftBottom":F.offset[0]=-E-b;break;case"right":case"rightTop":case"rightBottom":F.offset[0]=E+b;break}const w=(0,K.fS)({contentRadius:v,limitVerticalRadius:!0});if(W)switch(B){case"topLeft":case"bottomLeft":F.offset[0]=-w.dropdownArrowOffset-E;break;case"topRight":case"bottomRight":F.offset[0]=w.dropdownArrowOffset+E;break;case"leftTop":case"rightTop":F.offset[1]=-w.dropdownArrowOffset-E;break;case"leftBottom":case"rightBottom":F.offset[1]=w.dropdownArrowOffset+E;break}F.overflow=ie(B,w,H,l),_&&(F.htmlRegion="visibleFirst")}),T}},19080:function(tt,Re,P){"use strict";P.d(Re,{F:function(){return C},Z:function(){return q}});var K=P(92310),ie=P.n(K);const ce=null;function q(g,ee,H){return ie()({[`${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 C=(g,ee)=>ee||g},27666:function(tt,Re,P){"use strict";var K=P(80702),ie=P(16089);function ce(q){let C;const g=H=>()=>{C=null,q.apply(void 0,(0,K.Z)(H))},ee=function(){if(C==null){for(var H=arguments.length,l=new Array(H),W=0;W<H;W++)l[W]=arguments[W];C=(0,ie.Z)(g(l))}};return ee.cancel=()=>{ie.Z.cancel(C),C=null},ee}Re.Z=ce},81228:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return X}});var K=P(96949),ie=P(55090),ce=P(77205),q=P(38793),C=P(59301),g=P(92310),ee=P.n(g),H=P(29301),l=P(2738),W=P(27666),b=P(36355),v=P(83116),_=P(37613);const E=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[E(fe)]});function B(Y){return Y!==window?Y.getBoundingClientRect():{top:0,bottom:window.innerHeight}}function U(Y,fe,Ee){if(Ee!==void 0&&fe.top>Y.top-Ee)return Ee+fe.top}function F(Y,fe,Ee){if(Ee!==void 0&&fe.bottom<Y.bottom+Ee){const ae=window.innerHeight-fe.bottom;return Ee+ae}}const w=["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 O=function(Y){(0,ce.Z)(Ee,Y);var fe=(0,q.Z)(Ee);function Ee(){var ae;return(0,K.Z)(this,Ee),ae=fe.apply(this,arguments),ae.state={status:j.None,lastAffix:!1,prevTarget:null},ae.placeholderNodeRef=(0,C.createRef)(),ae.fixedNodeRef=(0,C.createRef)(),ae.addListeners=()=>{const Q=ae.getTargetFunc(),I=Q==null?void 0:Q(),{prevTarget:A}=ae.state;A!==I&&(w.forEach(R=>{A==null||A.removeEventListener(R,ae.lazyUpdatePosition),I==null||I.addEventListener(R,ae.lazyUpdatePosition)}),ae.updatePosition(),ae.setState({prevTarget:I}))},ae.removeListeners=()=>{ae.timer&&(clearTimeout(ae.timer),ae.timer=null);const{prevTarget:Q}=ae.state,I=ae.getTargetFunc(),A=I==null?void 0:I();w.forEach(R=>{A==null||A.removeEventListener(R,ae.lazyUpdatePosition),Q==null||Q.removeEventListener(R,ae.lazyUpdatePosition)}),ae.updatePosition.cancel(),ae.lazyUpdatePosition.cancel()},ae.getOffsetTop=()=>{const{offsetBottom:Q,offsetTop:I}=ae.props;return Q===void 0&&I===void 0?0:I},ae.getOffsetBottom=()=>ae.props.offsetBottom,ae.measure=()=>{const{status:Q,lastAffix:I}=ae.state,{onChange:A}=ae.props,R=ae.getTargetFunc();if(Q!==j.Prepare||!ae.fixedNodeRef.current||!ae.placeholderNodeRef.current||!R)return;const S=ae.getOffsetTop(),G=ae.getOffsetBottom(),k=R();if(k){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(k),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&&I!==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:I}=ae.state;if(Q&&I){const A=ae.getOffsetTop(),R=ae.getOffsetBottom(),S=Q();if(S&&ae.placeholderNodeRef.current){const G=B(S),k=B(ae.placeholderNodeRef.current),p=U(k,G,A),d=F(k,G,R);if(p!==void 0&&I.top===p||d!==void 0&&I.bottom===d)return}}ae.prepareMeasure()}),ae}return(0,ie.Z)(Ee,[{key:"getTargetFunc",value:function(){const{getTargetContainer:Q}=this.context,{target:I}=this.props;return I!==void 0?I: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:I}=this.state,{affixPrefixCls:A,rootClassName:R,children:S}=this.props,G=ee()(Q&&R,{[A]:!!Q});let k=(0,l.Z)(this.props,["prefixCls","offsetTop","offsetBottom","target","onChange","affixPrefixCls","rootClassName"]);return C.createElement(H.Z,{onResize:this.updatePosition},C.createElement("div",Object.assign({},k,{ref:this.placeholderNodeRef}),Q&&C.createElement("div",{style:I,"aria-hidden":"true"}),C.createElement("div",{className:G,ref:this.fixedNodeRef,style:Q},C.createElement(H.Z,{onResize:this.updatePosition},S))))}}]),Ee}(C.Component);O.contextType=b.E_;var X=(0,C.forwardRef)((Y,fe)=>{const{prefixCls:Ee,rootClassName:ae}=Y,{getPrefixCls:Q}=(0,C.useContext)(b.E_),I=Q("affix",Ee),[A,R]=T(I),S=Object.assign(Object.assign({},Y),{affixPrefixCls:I,rootClassName:ee()(ae,R)});return A(C.createElement(O,Object.assign({},S,{ref:fe})))})},79817:function(tt,Re,P){"use strict";P.d(Re,{default:function(){return ae}});var K=P(80702),ie=P(92310),ce=P.n(ie),q=P(70425),C=P(59301),g=P(16722),ee=P(13845),H=P(68031),l=P(81228),W=P(36355),v=C.createContext(void 0),E=Q=>{const{href:I,title:A,prefixCls:R,children:S,className:G,target:k,replace:p}=Q,d=C.useContext(v),{registerLink:N,unregisterLink:V,scrollTo:oe,onClick:xe,activeLink:Oe,direction:Me}=d||{};C.useEffect(()=>(N==null||N(I),()=>{V==null||V(I)}),[I]);const We=qe=>{p&&(qe.preventDefault(),window.location.replace(I)),xe==null||xe(qe,{title:A,href:I}),oe==null||oe(I)},{getPrefixCls:rt}=C.useContext(W.E_),ft=rt("anchor",R),ze=Oe===I,dt=ce()(`${ft}-link`,G,{[`${ft}-link-active`]:ze}),Fe=ce()(`${ft}-link-title`,{[`${ft}-link-title-active`]:ze});return C.createElement("div",{className:dt},C.createElement("a",{className:Fe,href:I,title:typeof A=="string"?A:"",target:k,onClick:We},A),Me!=="horizontal"?S:null)},T=P(17313),B=P(83116),U=P(37613);const F=Q=>{const{componentCls:I,holderOffsetBlock:A,motionDurationSlow:R,lineWidthBold:S,colorPrimary:G,lineType:k,colorSplit:p}=Q;return{[`${I}-wrapper`]:{marginBlockStart:-A,paddingBlockStart:A,[I]:Object.assign(Object.assign({},(0,T.Wf)(Q)),{position:"relative",paddingInlineStart:S,[`${I}-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 > ${I}-link-title`]:{color:Q.colorPrimary},[`${I}-link`]:{paddingBlock:Q.anchorPaddingBlockSecondary}}}),[`&:not(${I}-wrapper-horizontal)`]:{[I]:{"&::before":{position:"absolute",insetInlineStart:0,top:0,height:"100%",borderInlineStart:`${S}px ${k} ${p}`,content:'" "'},[`${I}-ink`]:{position:"absolute",insetInlineStart:0,display:"none",transform:"translateY(-50%)",transition:`top ${R} ease-in-out`,width:S,backgroundColor:G,[`&${I}-ink-visible`]:{display:"inline-block"}}}},[`${I}-fixed ${I}-ink ${I}-ink`]:{display:"none"}}}},w=Q=>{const{componentCls:I,motionDurationSlow:A,lineWidthBold:R,colorPrimary:S}=Q;return{[`${I}-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:'" "'},[I]:{overflowX:"scroll",position:"relative",display:"flex",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},[`${I}-link:first-of-type`]:{paddingInline:0},[`${I}-ink`]:{position:"absolute",bottom:0,transition:`left ${A} ease-in-out, width ${A} ease-in-out`,height:R,backgroundColor:S}}}}};var M=(0,B.Z)("Anchor",Q=>{const{fontSize:I,fontSizeLG:A,paddingXXS:R}=Q,S=(0,U.TS)(Q,{holderOffsetBlock:R,anchorPaddingBlockSecondary:R/2,anchorTitleBlock:I/14*3,anchorBallSize:A/2});return[F(S),w(S)]},Q=>({linkPaddingBlock:Q.paddingXXS,linkPaddingInlineStart:Q.padding}));function j(){return window}function O(Q,I){if(!Q.getClientRects().length)return 0;const A=Q.getBoundingClientRect();return A.width||A.height?I===window?(I=Q.ownerDocument.documentElement,A.top-I.clientTop):A.top-I.getBoundingClientRect().top:A.top}const $=/#([\S ]+)$/,X=Q=>{var I;const{rootClassName:A,anchorPrefixCls:R,className:S,style:G,offsetTop:k,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]=C.useState([]),[qe,Wt]=C.useState(null),it=C.useRef(qe),_e=C.useRef(null),be=C.useRef(null),ve=C.useRef(!1),{direction:Be,getTargetContainer:je,anchor:Z}=C.useContext(W.E_),se=(I=rt!=null?rt:je)!==null&&I!==void 0?I:j,de=JSON.stringify(dt),we=(0,q.useEvent)(bt=>{dt.includes(bt)||Fe(Le=>[].concat((0,K.Z)(Le),[bt]))}),ke=(0,q.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(`.${R}-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=O(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,q.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=C.useCallback(()=>{if(ve.current)return;const bt=ot(dt,Oe!==void 0?Oe:k||0,xe);pt(bt)},[de,Oe,k]),Rt=C.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=O(Ne,Ke);let Et=Nt+lt;Et-=Oe!==void 0?Oe:k||0,ve.current=!0,(0,H.Z)(Et,{getContainer:se,callback(){ve.current=!1}})},[Oe,k]),Ut=ce()(A,`${R}-wrapper`,{[`${R}-wrapper-horizontal`]:oe==="horizontal",[`${R}-rtl`]:Be==="rtl"},S,Z==null?void 0:Z.className),ct=ce()(R,{[`${R}-fixed`]:!p&&!d}),Ct=ce()(`${R}-ink`,{[`${R}-ink-visible`]:qe}),Ot=Object.assign(Object.assign({maxHeight:k?`calc(100vh - ${k}px)`:"100vh"},Z==null?void 0:Z.style),G),Mt=bt=>Array.isArray(bt)?bt.map(Le=>C.createElement(E,Object.assign({replace:ze},Le,{key:Le.key}),oe==="vertical"&&Mt(Le.children))):null,Xe=C.createElement("div",{ref:_e,className:Ut,style:Ot},C.createElement("div",{className:ct},C.createElement("span",{className:Ct,ref:be}),"items"in Q?Mt(V):N));C.useEffect(()=>{const bt=se();return st(),bt==null||bt.addEventListener("scroll",st),()=>{bt==null||bt.removeEventListener("scroll",st)}},[de]),C.useEffect(()=>{typeof ft=="function"&&pt(ft(it.current||""))},[ft]),C.useEffect(()=>{Ze()},[oe,ft,de,qe]);const xi=C.useMemo(()=>({registerLink:we,unregisterLink:ke,scrollTo:Rt,activeLink:qe,onClick:Me,direction:oe}),[qe,Me,Rt,oe]);return C.createElement(v.Provider,{value:xi},p?C.createElement(l.Z,{offsetTop:k,target:se},Xe):Xe)};var fe=Q=>{const{prefixCls:I,rootClassName:A}=Q,{getPrefixCls:R}=C.useContext(W.E_),S=R("anchor",I),[G,k]=M(S);return G(C.createElement(X,Object.assign({},Q,{rootClassName:ce()(k,A),anchorPrefixCls:S})))};const Ee=fe;Ee.Link=E;var ae=Ee},66104:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return R}});var K=P(92310),ie=P.n(K),ce=P(11592),q=P(26112),C=P(59301),g=P(92343),ee=P(36355),H=P(84105),l=P(91857);const W=S=>{let{children:G}=S;const{getPrefixCls:k}=C.useContext(ee.E_),p=k("breadcrumb");return C.createElement("li",{className:`${p}-separator`,"aria-hidden":"true"},G===""?G:G||"/")};W.__ANT_BREADCRUMB_SEPARATOR=!0;var b=W,v=function(S,G){var k={};for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&G.indexOf(p)<0&&(k[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])&&(k[p[d]]=S[p[d]]);return k};function _(S,G){if(S.title===void 0||S.title===null)return null;const k=Object.keys(G).join("|");return typeof S.title=="object"?S.title:String(S.title).replace(new RegExp(`:(${k})`,"g"),(p,d)=>G[d]||p)}function E(S,G,k,p){if(k==null)return null;const{className:d,onClick:N}=G,V=v(G,["className","onClick"]),oe=Object.assign(Object.assign({},(0,q.Z)(V,{data:!0,aria:!0})),{onClick:N});return p!==void 0?C.createElement("a",Object.assign({},oe,{className:ie()(`${S}-link`,d),href:p}),k):C.createElement("span",Object.assign({},oe,{className:ie()(`${S}-link`,d)}),k)}function T(S,G){return(p,d,N,V,oe)=>{if(G)return G(p,d,N,V);const xe=_(p,d);return E(S,p,xe,oe)}}var B=function(S,G){var k={};for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&G.indexOf(p)<0&&(k[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])&&(k[p[d]]=S[p[d]]);return k};const U=S=>{const{prefixCls:G,separator:k="/",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=C.createElement("a",{href:`${oe}${_e}`},ve)),Object.assign(Object.assign({},be),{key:qe!=null?qe:Fe,label:ve})})})}else N&&(We.overlay=N);return C.createElement(l.Z,Object.assign({placement:"bottom"},We),C.createElement("span",{className:`${G}-overlay-link`},Me,C.createElement(H.Z,null)))}return Me})(p);return Oe!=null?C.createElement(C.Fragment,null,C.createElement("li",null,Oe),k&&C.createElement(b,null,k)):null},F=S=>{const{prefixCls:G,children:k,href:p}=S,d=B(S,["prefixCls","children","href"]),{getPrefixCls:N}=C.useContext(ee.E_),V=N("breadcrumb",G);return C.createElement(U,Object.assign({},d,{prefixCls:V}),E(V,d,k,p))};F.__ANT_BREADCRUMB_ITEM=!0;var w=F,M=P(17313),j=P(83116),O=P(37613);const $=S=>{const{componentCls:G,iconCls:k}=S;return{[G]:Object.assign(Object.assign({},(0,M.Wf)(S)),{color:S.itemColor,fontSize:S.fontSize,[k]:{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`]:{[`
|
|
> ${k} + span,
|
|
> ${k} + 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,[`> ${k}`]:{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,O.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 k={};for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&G.indexOf(p)<0&&(k[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])&&(k[p[d]]=S[p[d]]);return k};function fe(S){const{breadcrumbName:G,children:k}=S,p=Y(S,["breadcrumbName","children"]),d=Object.assign({title:G},p);return k&&(d.menu={items:k.map(N=>{var{breadcrumbName:V}=N,oe=Y(N,["breadcrumbName"]);return Object.assign(Object.assign({},oe),{title:V})})}),d}function Ee(S,G){return(0,C.useMemo)(()=>S||(G?G.map(fe):null),[S,G])}var ae=function(S,G){var k={};for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&G.indexOf(p)<0&&(k[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])&&(k[p[d]]=S[p[d]]);return k};const Q=(S,G)=>{if(G===void 0)return G;let k=(G||"").replace(/^\//,"");return Object.keys(S).forEach(p=>{k=k.replace(`:${p}`,S[p])}),k},I=S=>{const{prefixCls:G,separator:k="/",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}=C.useContext(ee.E_);let dt;const Fe=rt("breadcrumb",G),[qe,Wt]=X(Fe),it=Ee(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 C.createElement(b,{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("/")}`),C.createElement(U,Object.assign({key:Ct},Ot,(0,q.Z)(Z,{data:!0,aria:!0}),{className:st,dropdownProps:Ut,href:Xe,separator:Mt?"":k,onClick:pt,prefixCls:Fe}),_e(Z,Me,je,Be,Xe))})}else if(xe){const Be=(0,ce.Z)(xe).length;dt=(0,ce.Z)(xe).map((je,Z)=>{if(!je)return je;const se=Z===Be-1;return(0,g.Tm)(je,{separator:se?"":k,key:Z})})}const be=ie()(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(C.createElement("nav",Object.assign({className:be,style:ve},We),C.createElement("ol",null,dt)))};I.Item=w,I.Separator=b;var A=I,R=A},9937:function(tt,Re,P){"use strict";P.d(Re,{M1:function(){return ee},TM:function(){return j},Xy:function(){return H},bi:function(){return b},e5:function(){return M},ik:function(){return v},nz:function(){return C},pU:function(){return g},s7:function(){return _},x0:function(){return W}});var K=P(17313),ie=P(74207),ce=P(37613),q=P(83116);const C=O=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:O,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),g=O=>({borderColor:O.hoverBorderColor}),ee=O=>({borderColor:O.activeBorderColor,boxShadow:O.activeShadow,outline:0}),H=O=>({color:O.colorTextDisabled,backgroundColor:O.colorBgContainerDisabled,borderColor:O.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"&:hover":Object.assign({},g((0,ce.TS)(O,{hoverBorderColor:O.colorBorder})))}),l=O=>{const{paddingBlockLG:$,fontSizeLG:X,lineHeightLG:Y,borderRadiusLG:fe,paddingInlineLG:Ee}=O;return{padding:`${$}px ${Ee}px`,fontSize:X,lineHeight:Y,borderRadius:fe}},W=O=>({padding:`${O.paddingBlockSM}px ${O.paddingInlineSM}px`,borderRadius:O.borderRadiusSM}),b=(O,$)=>{const{componentCls:X,colorError:Y,colorWarning:fe,errorActiveShadow:Ee,warningActiveShadow:ae,colorErrorBorderHover:Q,colorWarningBorderHover:I}=O;return{[`&-status-error:not(${$}-disabled):not(${$}-borderless)${$}`]:{borderColor:Y,"&:hover":{borderColor:Q},"&:focus, &-focused":Object.assign({},ee((0,ce.TS)(O,{activeBorderColor:Y,activeShadow:Ee}))),[`${X}-prefix, ${X}-suffix`]:{color:Y}},[`&-status-warning:not(${$}-disabled):not(${$}-borderless)${$}`]:{borderColor:fe,"&:hover":{borderColor:I},"&:focus, &-focused":Object.assign({},ee((0,ce.TS)(O,{activeBorderColor:fe,activeShadow:ae}))),[`${X}-prefix, ${X}-suffix`]:{color:fe}}}},v=O=>Object.assign(Object.assign({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:`${O.paddingBlock}px ${O.paddingInline}px`,color:O.colorText,fontSize:O.fontSize,lineHeight:O.lineHeight,backgroundColor:O.colorBgContainer,backgroundImage:"none",borderWidth:O.lineWidth,borderStyle:O.lineType,borderColor:O.colorBorder,borderRadius:O.borderRadius,transition:`all ${O.motionDurationMid}`},C(O.colorTextPlaceholder)),{"&:hover":Object.assign({},g(O)),"&:focus, &-focused":Object.assign({},ee(O)),"&-disabled, &[disabled]":Object.assign({},H(O)),"&-borderless":{"&, &:hover, &:focus, &-focused, &-disabled, &[disabled]":{backgroundColor:"transparent",border:"none",boxShadow:"none"}},"textarea&":{maxWidth:"100%",height:"auto",minHeight:O.controlHeight,lineHeight:O.lineHeight,verticalAlign:"bottom",transition:`all ${O.motionDurationSlow}, height 0s`,resize:"vertical"},"&-lg":Object.assign({},l(O)),"&-sm":Object.assign({},W(O)),"&-rtl":{direction:"rtl"},"&-textarea-rtl":{direction:"rtl"}}),_=O=>{const{componentCls:$,antCls:X}=O;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:O.paddingXS,"&:last-child":{paddingInlineEnd:0}},[`&-lg ${$}, &-lg > ${$}-group-addon`]:Object.assign({},l(O)),[`&-sm ${$}, &-sm > ${$}-group-addon`]:Object.assign({},W(O)),[`&-lg ${X}-select-single ${X}-select-selector`]:{height:O.controlHeightLG},[`&-sm ${X}-select-single ${X}-select-selector`]:{height:O.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 ${O.paddingInline}px`,color:O.colorText,fontWeight:"normal",fontSize:O.fontSize,textAlign:"center",backgroundColor:O.colorFillAlter,border:`${O.lineWidth}px ${O.lineType} ${O.colorBorder}`,borderRadius:O.borderRadius,transition:`all ${O.motionDurationSlow}`,lineHeight:1,[`${X}-select`]:{margin:`-${O.paddingBlock+1}px -${O.paddingInline}px`,[`&${X}-select-single:not(${X}-select-customize-input)`]:{[`${X}-select-selector`]:{backgroundColor:"inherit",border:`${O.lineWidth}px ${O.lineType} transparent`,boxShadow:"none"}},"&-open, &-focused":{[`${X}-select-selector`]:{color:O.colorPrimary}}},[`${X}-cascader-picker`]:{margin:`-9px -${O.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:O.borderRadius,borderEndStartRadius:O.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:O.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:-O.lineWidth,borderInlineEndWidth:O.lineWidth},[`${$}`]:{float:"none"},[`& > ${X}-select > ${X}-select-selector,
|
|
& > ${X}-select-auto-complete ${$},
|
|
& > ${X}-cascader-picker ${$},
|
|
& > ${$}-group-wrapper ${$}`]:{borderInlineEndWidth:O.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:O.borderRadius,borderEndStartRadius:O.borderRadius},[`& > *:last-child,
|
|
& > ${X}-select:last-child > ${X}-select-selector,
|
|
& > ${X}-cascader-picker:last-child ${$},
|
|
& > ${X}-cascader-picker-focused:last-child ${$}`]:{borderInlineEndWidth:O.lineWidth,borderStartEndRadius:O.borderRadius,borderEndEndRadius:O.borderRadius},[`& > ${X}-select-auto-complete ${$}`]:{verticalAlign:"top"},[`${$}-group-wrapper + ${$}-group-wrapper`]:{marginInlineStart:-O.lineWidth,[`${$}-affix-wrapper`]:{borderRadius:0}},[`${$}-group-wrapper:not(:last-child)`]:{[`&${$}-search > ${$}-group`]:{[`& > ${$}-group-addon > ${$}-search-button`]:{borderRadius:0},[`& > ${$}`]:{borderStartStartRadius:O.borderRadius,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:O.borderRadius}}}})}},E=O=>{const{componentCls:$,controlHeightSM:X,lineWidth:Y}=O,Ee=(X-Y*2-16)/2;return{[$]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,K.Wf)(O)),v(O)),b(O,$)),{'&[type="color"]':{height:O.controlHeight,[`&${$}-lg`]:{height:O.controlHeightLG},[`&${$}-sm`]:{height:X,paddingTop:Ee,paddingBottom:Ee}},'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration':{"-webkit-appearance":"none"}})}},T=O=>{const{componentCls:$}=O;return{[`${$}-clear-icon`]:{margin:0,color:O.colorTextQuaternary,fontSize:O.fontSizeIcon,verticalAlign:-1,cursor:"pointer",transition:`color ${O.motionDurationSlow}`,"&:hover":{color:O.colorTextTertiary},"&:active":{color:O.colorText},"&-hidden":{visibility:"hidden"},"&-has-suffix":{margin:`0 ${O.inputAffixPadding}px`}}}},B=O=>{const{componentCls:$,inputAffixPadding:X,colorTextDescription:Y,motionDurationSlow:fe,colorIcon:Ee,colorIconHover:ae,iconCls:Q}=O;return{[`${$}-affix-wrapper`]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},v(O)),{display:"inline-flex",[`&:not(${$}-affix-wrapper-disabled):hover`]:Object.assign(Object.assign({},g(O)),{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:O.paddingXS}},"&-show-count-suffix":{color:Y},"&-show-count-has-suffix":{marginInlineEnd:O.paddingXXS},"&-prefix":{marginInlineEnd:X},"&-suffix":{marginInlineStart:X}}}),T(O)),{[`${Q}${$}-password-icon`]:{color:Ee,cursor:"pointer",transition:`all ${fe}`,"&:hover":{color:ae}}}),b(O,`${$}-affix-wrapper`))}},U=O=>{const{componentCls:$,colorError:X,colorWarning:Y,borderRadiusLG:fe,borderRadiusSM:Ee}=O;return{[`${$}-group`]:Object.assign(Object.assign(Object.assign({},(0,K.Wf)(O)),_(O)),{"&-rtl":{direction:"rtl"},"&-wrapper":{display:"inline-block",width:"100%",textAlign:"start",verticalAlign:"top","&-rtl":{direction:"rtl"},"&-lg":{[`${$}-group-addon`]:{borderRadius:fe,fontSize:O.fontSizeLG}},"&-sm":{[`${$}-group-addon`]:{borderRadius:Ee}},"&-status-error":{[`${$}-group-addon`]:{color:X,borderColor:X}},"&-status-warning":{[`${$}-group-addon`]:{color:Y,borderColor:Y}},"&-disabled":{[`${$}-group-addon`]:Object.assign({},H(O))},[`&: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=O=>{const{componentCls:$,antCls:X}=O,Y=`${$}-search`;return{[Y]:{[`${$}`]:{"&:hover, &:focus":{borderColor:O.colorPrimaryHover,[`+ ${$}-group-addon ${Y}-button:not(${X}-btn-primary)`]:{borderInlineStartColor:O.colorPrimaryHover}}},[`${$}-affix-wrapper`]:{borderRadius:0},[`${$}-lg`]:{lineHeight:O.lineHeightLG-2e-4},[`> ${$}-group`]:{[`> ${$}-group-addon:last-child`]:{insetInlineStart:-1,padding:0,border:0,[`${Y}-button`]:{paddingTop:0,paddingBottom:0,borderStartStartRadius:0,borderStartEndRadius:O.borderRadius,borderEndEndRadius:O.borderRadius,borderEndStartRadius:0,boxShadow:"none"},[`${Y}-button:not(${X}-btn-primary)`]:{color:O.colorTextDescription,"&:hover":{color:O.colorPrimaryHover},"&:active":{color:O.colorPrimaryActive},[`&${X}-btn-loading::before`]:{insetInlineStart:0,insetInlineEnd:0,insetBlockStart:0,insetBlockEnd:0}}}},[`${Y}-button`]:{height:O.controlHeight,"&:hover, &:focus":{zIndex:1}},[`&-large ${Y}-button`]:{height:O.controlHeightLG},[`&-small ${Y}-button`]:{height:O.controlHeightSM},"&-rtl":{direction:"rtl"},[`&${$}-compact-item`]:{[`&:not(${$}-compact-last-item)`]:{[`${$}-group-addon`]:{[`${$}-search-button`]:{marginInlineEnd:-O.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}}}}},w=O=>{const{componentCls:$,paddingLG:X}=O,Y=`${$}-textarea`;return{[Y]:{position:"relative","&-show-count":{[`> ${$}`]:{height:"100%"},[`${$}-data-count`]:{position:"absolute",bottom:-O.fontSize*O.lineHeight,insetInlineEnd:0,color:O.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:O.paddingXS,insetBlockStart:O.paddingXS},[`${Y}-suffix`]:{position:"absolute",top:0,insetInlineEnd:O.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}}}}};function M(O){return(0,ce.TS)(O,{inputAffixPadding:O.paddingXXS})}const j=O=>{const{controlHeight:$,fontSize:X,lineHeight:Y,lineWidth:fe,controlHeightSM:Ee,controlHeightLG:ae,fontSizeLG:Q,lineHeightLG:I,paddingSM:A,controlPaddingHorizontalSM:R,controlPaddingHorizontal:S,colorFillAlter:G,colorPrimaryHover:k,controlOutlineWidth:p,controlOutline:d,colorErrorOutline:N,colorWarningOutline:V}=O;return{paddingBlock:Math.max(Math.round(($-X*Y)/2*10)/10-fe,3),paddingBlockSM:Math.max(Math.round((Ee-X*Y)/2*10)/10-fe,0),paddingBlockLG:Math.ceil((ae-Q*I)/2*10)/10-fe,paddingInline:A-fe,paddingInlineSM:R-fe,paddingInlineLG:S-fe,addonBg:G,activeBorderColor:k,hoverBorderColor:k,activeShadow:`0 0 0 ${p}px ${d}`,errorActiveShadow:`0 0 0 ${p}px ${N}`,warningActiveShadow:`0 0 0 ${p}px ${V}`}};Re.ZP=(0,q.Z)("Input",O=>{const $=(0,ce.TS)(O,M(O));return[E($),w($),B($),U($),F($),(0,ie.c)($)]},j)},8378:function(tt,Re){"use strict";const P=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`}}});Re.Z=P},92899:function(tt,Re,P){"use strict";P.d(Re,{Fm:function(){return v}});var K=P(93083),ie=P(95406);const ce=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}}),q=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}}),C=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}}),b={"move-up":{inKeyframes:l,outKeyframes:W},"move-down":{inKeyframes:ce,outKeyframes:q},"move-left":{inKeyframes:C,outKeyframes:g},"move-right":{inKeyframes:ee,outKeyframes:H}},v=(_,E)=>{const{antCls:T}=_,B=`${T}-${E}`,{inKeyframes:U,outKeyframes:F}=b[E];return[(0,ie.R)(B,U,F,_.motionDurationMid),{[`
|
|
${B}-enter,
|
|
${B}-appear
|
|
`]:{opacity:0,animationTimingFunction:_.motionEaseOutCirc},[`${B}-leave`]:{animationTimingFunction:_.motionEaseInOutCirc}}]}},13826:function(tt,Re,P){"use strict";P.d(Re,{Qt:function(){return C},Uw:function(){return q},fJ:function(){return ce},ly:function(){return g},oN:function(){return v}});var K=P(93083),ie=P(95406);const ce=new K.Keyframes("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),q=new K.Keyframes("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),C=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}}),b={"slide-up":{inKeyframes:ce,outKeyframes:q},"slide-down":{inKeyframes:C,outKeyframes:g},"slide-left":{inKeyframes:ee,outKeyframes:H},"slide-right":{inKeyframes:l,outKeyframes:W}},v=(_,E)=>{const{antCls:T}=_,B=`${T}-${E}`,{inKeyframes:U,outKeyframes:F}=b[E];return[(0,ie.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,Re,P){"use strict";P.d(Re,{ZP:function(){return C},fS:function(){return ce},qN:function(){return ie}});var K=P(47585);const ie=8;function ce(g){const ee=ie,{contentRadius:H,limitVerticalRadius:l}=g,W=H>12?H+2:12;return{dropdownArrowOffset:W,dropdownArrowOffsetVertical:l?ee:W}}function q(g,ee){return g?ee:{}}function C(g,ee){const{componentCls:H,sizePopupArrow:l,borderRadiusXS:W,borderRadiusOuter:b,boxShadowPopoverArrow:v}=g,{colorBg:_,contentRadius:E=g.borderRadiusLG,limitVerticalRadius:T,arrowDistance:B=0,arrowPlacement:U={left:!0,right:!0,top:!0,bottom:!0}}=ee,{dropdownArrowOffsetVertical:F,dropdownArrowOffset:w}=ce({contentRadius:E,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,b,_,v)),{"&:before":{background:_}})]},q(!!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:w}},[`&-placement-topRight ${H}-arrow`]:{right:{_skip_check_:!0,value:w}}})),q(!!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:w}},[`&-placement-bottomRight ${H}-arrow`]:{right:{_skip_check_:!0,value:w}}})),q(!!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}})),q(!!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,Re,P){"use strict";P.d(Re,{r:function(){return K}});const K=(ie,ce,q,C,g)=>{const ee=ie/2,H=0,l=ee,W=q*1/Math.sqrt(2),b=ee-q*(1-1/Math.sqrt(2)),v=ee-ce*(1/Math.sqrt(2)),_=q*(Math.sqrt(2)-1)+ce*(1/Math.sqrt(2)),E=2*ee-v,T=_,B=2*ee-W,U=b,F=2*ee-H,w=l,M=ee*Math.sqrt(2)+q*(Math.sqrt(2)-2),j=q*(Math.sqrt(2)-1);return{pointerEvents:"none",width:ie,height:ie,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:ie,height:ie/2,background:C,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 ${q} ${q} 0 0 0 ${W} ${b} L ${v} ${_} A ${ce} ${ce} 0 0 1 ${E} ${T} L ${B} ${U} A ${q} ${q} 0 0 0 ${F} ${w} Z')`]},content:'""'},"&::after":{content:'""',position:"absolute",width:M,height:M,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${ce}px 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:g,zIndex:0,background:"transparent"}}}},12563:function(tt,Re,P){"use strict";P.d(Re,{default:function(){return ae}});var K=P(59301),ie=P(99267),ce=P(92310),q=P.n(ce),C=P(36785),g=P(47729),ee=P(14088),H=P(36355),l=P(17313),W=P(37613),b=P(83116);const v=Q=>{const{paddingXXS:I,lineWidth:A,tagPaddingHorizontal:R,componentCls:S}=Q,G=R-A,k=I-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:k,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:I,fontSizeIcon:A}=Q,R=Q.fontSizeSM,S=`${Q.lineHeightSM*R}px`;return(0,W.TS)(Q,{tagFontSize:R,tagLineHeight:S,tagIconSize:A-2*I,tagPaddingHorizontal:8,tagBorderlessBg:Q.colorFillTertiary})},E=Q=>({defaultBg:Q.colorFillQuaternary,defaultColor:Q.colorText});var T=(0,b.Z)("Tag",Q=>{const I=_(Q);return v(I)},E),B=function(Q,I){var A={};for(var R in Q)Object.prototype.hasOwnProperty.call(Q,R)&&I.indexOf(R)<0&&(A[R]=Q[R]);if(Q!=null&&typeof Object.getOwnPropertySymbols=="function")for(var S=0,R=Object.getOwnPropertySymbols(Q);S<R.length;S++)I.indexOf(R[S])<0&&Object.prototype.propertyIsEnumerable.call(Q,R[S])&&(A[R[S]]=Q[R[S]]);return A},F=Q=>{const{prefixCls:I,style:A,className:R,checked:S,onChange:G,onClick:k}=Q,p=B(Q,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:d,tag:N}=K.useContext(H.E_),V=We=>{G==null||G(!S),k==null||k(We)},oe=d("tag",I),[xe,Oe]=T(oe),Me=q()(oe,`${oe}-checkable`,{[`${oe}-checkable-checked`]:S},N==null?void 0:N.className,R,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})))},w=P(45157);const M=Q=>(0,w.Z)(Q,(I,A)=>{let{textColor:R,lightBorderColor:S,lightColor:G,darkColor:k}=A;return{[`${Q.componentCls}-${I}`]:{color:R,background:G,borderColor:S,"&-inverse":{color:Q.colorTextLightSolid,background:k,borderColor:k},[`&${Q.componentCls}-borderless`]:{borderColor:"transparent"}}}});var j=(0,b.b)(["Tag","preset"],Q=>{const I=_(Q);return M(I)},E);function O(Q){return typeof Q!="string"?Q:Q.charAt(0).toUpperCase()+Q.slice(1)}const $=(Q,I,A)=>{const R=O(A);return{[`${Q.componentCls}-${I}`]:{color:Q[`color${A}`],background:Q[`color${R}Bg`],borderColor:Q[`color${R}Border`],[`&${Q.componentCls}-borderless`]:{borderColor:"transparent"}}}};var X=(0,b.b)(["Tag","status"],Q=>{const I=_(Q);return[$(I,"success","Success"),$(I,"processing","Info"),$(I,"error","Error"),$(I,"warning","Warning")]},E),Y=function(Q,I){var A={};for(var R in Q)Object.prototype.hasOwnProperty.call(Q,R)&&I.indexOf(R)<0&&(A[R]=Q[R]);if(Q!=null&&typeof Object.getOwnPropertySymbols=="function")for(var S=0,R=Object.getOwnPropertySymbols(Q);S<R.length;S++)I.indexOf(R[S])<0&&Object.prototype.propertyIsEnumerable.call(Q,R[S])&&(A[R[S]]=Q[R[S]]);return A};const fe=(Q,I)=>{const{prefixCls:A,className:R,rootClassName:S,style:G,children:k,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,C.o2)(d),Fe=(0,C.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=q()(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},R,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(ie.Z,{className:`${it}-close-icon`,onClick:Be}):K.createElement("span",{className:`${it}-close-icon`,onClick:Be},ke),null,!1),Z=typeof Oe.onClick=="function"||k&&k.type==="a",se=p||null,de=se?K.createElement(K.Fragment,null,se,k&&K.createElement("span",null,k)):k,we=K.createElement("span",Object.assign({},Oe,{ref:I,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)},Ee=K.forwardRef(fe);Ee.CheckableTag=F;var ae=Ee},33166:function(tt,Re,P){"use strict";P.d(Re,{i:function(){return K}});const K=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"]},45157:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return ie}});var K=P(33166);function ie(ce,q){return K.i.reduce((C,g)=>{const ee=ce[`${g}1`],H=ce[`${g}3`],l=ce[`${g}6`],W=ce[`${g}7`];return Object.assign(Object.assign({},C),q(g,{lightColor:ee,lightBorderColor:H,darkColor:l,textColor:W}))},{})}},6848:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return ae}});var K=P(59301),ie=P(92310),ce=P.n(ie),q=P(55477),C=P(18929),g=P(62892),ee=P(79676),H=P(92343),l=P(36355),W=P(33234),b=P(88088),v=P(17313),_=P(29878),E=P(19447),T=P(45157),B=P(37613),U=P(83116);const F=Q=>{const{componentCls:I,tooltipMaxWidth:A,tooltipColor:R,tooltipBg:S,tooltipBorderRadius:G,zIndexPopup:k,controlHeight:p,boxShadowSecondary:d,paddingSM:N,paddingXS:V,tooltipRadiusOuter:oe}=Q;return[{[I]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,v.Wf)(Q)),{position:"absolute",zIndex:k,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,[`${I}-inner`]:{minWidth:p,minHeight:p,padding:`${N/2}px ${V}px`,color:R,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(",")]:{[`${I}-inner`]:{borderRadius:Math.min(G,E.qN)}},[`${I}-content`]:{position:"relative"}}),(0,T.Z)(Q,(xe,Oe)=>{let{darkColor:Me}=Oe;return{[`&${I}-${xe}`]:{[`${I}-inner`]:{backgroundColor:Me},[`${I}-arrow`]:{"--antd-arrow-background-color":Me}}}})),{"&-rtl":{direction:"rtl"}})},(0,E.ZP)((0,B.TS)(Q,{borderRadiusOuter:oe}),{colorBg:"var(--antd-arrow-background-color)",contentRadius:G,limitVerticalRadius:!0}),{[`${I}-pure`]:{position:"relative",maxWidth:"none",margin:Q.sizePopupArrow}}]};var w=(Q,I)=>(0,U.Z)("Tooltip",R=>{if(I===!1)return[];const{borderRadius:S,colorTextLightSolid:G,colorBgDefault:k,borderRadiusOuter:p}=R,d=(0,B.TS)(R,{tooltipMaxWidth:250,tooltipColor:G,tooltipBorderRadius:S,tooltipBg:k,tooltipRadiusOuter:p>4?4:p});return[F(d),(0,_._y)(R,"zoom-big-fast")]},R=>{let{zIndexPopupBase:S,colorBgSpotlight:G}=R;return{zIndexPopup:S+70,colorBgDefault:G}},{resetStyle:!1})(Q),M=P(36785);function j(Q,I){const A=(0,M.o2)(I),R=ce()({[`${Q}-${I}`]:I&&A}),S={},G={};return I&&!A&&(S.background=I,G["--antd-arrow-background-color"]=I),{className:R,overlayStyle:S,arrowStyle:G}}var $=Q=>{const{prefixCls:I,className:A,placement:R="top",title:S,color:G,overlayInnerStyle:k}=Q,{getPrefixCls:p}=K.useContext(l.E_),d=p("tooltip",I),[N,V]=w(d,!0),oe=j(d,G),xe=oe.arrowStyle,Oe=Object.assign(Object.assign({},k),oe.overlayStyle),Me=ce()(V,d,`${d}-pure`,`${d}-placement-${R}`,A,oe.className);return N(K.createElement("div",{className:Me,style:xe},K.createElement("div",{className:`${d}-arrow`}),K.createElement(q.G,Object.assign({},Q,{className:V,prefixCls:d,overlayInnerStyle:Oe}),S)))},X=function(Q,I){var A={};for(var R in Q)Object.prototype.hasOwnProperty.call(Q,R)&&I.indexOf(R)<0&&(A[R]=Q[R]);if(Q!=null&&typeof Object.getOwnPropertySymbols=="function")for(var S=0,R=Object.getOwnPropertySymbols(Q);S<R.length;S++)I.indexOf(R[S])<0&&Object.prototype.propertyIsEnumerable.call(Q,R[S])&&(A[R[S]]=Q[R[S]]);return A};const Y=(Q,I)=>{const A={},R=Object.assign({},Q);return I.forEach(S=>{Q&&S in Q&&(A[S]=Q[S],delete R[S])}),{picked:A,omitted:R}};function fe(Q,I){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:R,omitted:S}=Y(Q.props.style,["position","left","right","top","bottom","float","display","zIndex"]),G=Object.assign(Object.assign({display:"inline-block"},R),{cursor:"not-allowed",width:Q.props.block?"100%":void 0}),k=Object.assign(Object.assign({},S),{pointerEvents:"none"}),p=(0,H.Tm)(Q,{style:k,className:null});return K.createElement("span",{style:G,className:ce()(Q.props.className,`${I}-disabled-compatible-wrapper`)},p)}return Q}const Ee=K.forwardRef((Q,I)=>{var A,R;const{prefixCls:S,openClassName:G,getTooltipContainer:k,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,b.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(I,()=>({forceAlign:ve,forcePopupAlign:()=>{ve()}}));const[Be,je]=(0,C.Z)(!1,{value:(A=Q.open)!==null&&A!==void 0?A:Q.visible,defaultValue:(R=Q.defaultOpen)!==null&&R!==void 0?R: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"?ce()(bt.className,G||`${Ct}-open`):bt.className,[Ne,Ke]=w(Ct,!Mt),Nt=j(Ct,d),lt=Nt.arrowStyle,Et=Object.assign(Object.assign({},N),Nt.overlayStyle),kt=ce()(p,{[`${Ct}-rtl`]:_e==="rtl"},Nt.className,Ut,Ke);return Ne(K.createElement(q.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||k||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))});Ee._InternalPanelDoNotUseOrYouWillBeFired=$;var ae=Ee},25769:function(tt,Re,P){"use strict";var K=P(98040),ie={"text/plain":"Text","text/html":"Url",default:"Text"},ce="Copy to clipboard: #{key}, Enter";function q(g){var ee=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return g.replace(/#{\s*key\s*}/g,ee)}function C(g,ee){var H,l,W,b,v,_,E=!1;ee||(ee={}),H=ee.debug||!1;try{W=K(),b=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=ie[ee.format]||ie.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(_),b.selectNodeContents(_),v.addRange(b);var T=document.execCommand("copy");if(!T)throw new Error("copy command was unsuccessful");E=!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),E=!0}catch(U){H&&console.error("unable to copy using clipboardData: ",U),H&&console.error("falling back to prompt"),l=q("message"in ee?ee.message:ce),window.prompt(l,g)}}finally{v&&(typeof v.removeRange=="function"?v.removeRange(b):v.removeAllRanges()),_&&document.body.removeChild(_),W()}return E}tt.exports=C},53184:function(tt,Re,P){"use strict";var K,ie;function ce(q,C,g){var ee=function(H,l){return q.js_beautify(H,l)};return ee.js=q.js_beautify,ee.css=C.css_beautify,ee.html=g.html_beautify,ee.js_beautify=q.js_beautify,ee.css_beautify=C.css_beautify,ee.html_beautify=g.html_beautify,ee}K=[P(58553),P(87804),P(40998)],ie=function(q,C,g){return ce(q,C,g)}.apply(Re,K),ie!==void 0&&(tt.exports=ie)},87804:function(tt,Re){var P,K;(function(){var ie;(function(){"use strict";var q=[,,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 E=this.__base_string_length;return _=_||0,v<0&&(E=0),E+=v*this.__indent_size,E+=_,E},W.prototype.get_indent_string=function(v,_){var E=this.__base_string;return _=_||0,v<0&&(v=0,E=""),_+=v*this.__indent_size,this.__ensure_cache(_),E+=this.__cache[_],E},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,E="";this.__indent_size&&v>=this.__indent_size&&(_=Math.floor(v/this.__indent_size),v-=_*this.__indent_size,E=new Array(_+1).join(this.__indent_string)),v&&(E+=new Array(v+1).join(" ")),this.__cache.push(E)};function b(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()}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(v,_){return this.__indent_cache.get_indent_string(v,_)},b.prototype.get_indent_size=function(v,_){return this.__indent_cache.get_indent_size(v,_)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(v){return this.is_empty()||!v&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.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 E=this.__lines.join(`
|
|
`);return v!==`
|
|
`&&(E=E.replace(/[\n]/g,v)),E},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.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)},b.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},b.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()},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(v){for(var _=this.__lines.length;v<_;)this.__lines[v]._remove_indent(),v++;this.current_line._remove_wrap_indent()},b.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},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(v,_){for(var E=this.__lines.length-2;E>=0;){var T=this.__lines[E];if(T.is_empty())break;if(T.item(0).indexOf(v)!==0&&T.item(-1)!==_){this.__lines.splice(E+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}E--}},H.exports.Output=b},,,,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 E=this.raw_options[v],T=_||[];return typeof E=="object"?E!==null&&typeof E.concat=="function"&&(T=E.concat()):typeof E=="string"&&(T=E.split(/[^a-zA-Z0-9_\/\-]+/)),T},l.prototype._get_boolean=function(v,_){var E=this.raw_options[v],T=E===void 0?!!_:!!E;return T},l.prototype._get_characters=function(v,_){var E=this.raw_options[v],T=_||"";return typeof E=="string"&&(T=E.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),T},l.prototype._get_number=function(v,_){var E=this.raw_options[v];_=parseInt(_,10),isNaN(_)&&(_=0);var T=parseInt(E,10);return isNaN(T)&&(T=_),T},l.prototype._get_selection=function(v,_,E){var T=this._get_selection_list(v,_,E);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,_,E){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(E=E||[_[0]],!this._is_valid_selection(E,_))throw new Error("Invalid Default Value!");var T=this._get_array(v,E);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(E){return _.indexOf(E)===-1})};function W(v,_){var E={};v=b(v);var T;for(T in v)T!==_&&(E[T]=v[T]);if(_&&v[_])for(T in v[_])E[T]=v[_][T];return E}function b(v){var _={},E;for(E in v){var T=E.replace(/-/g,"_");_[T]=v[E]}return _}H.exports.Options=l,H.exports.normalizeOpts=b,H.exports.mergeOpts=W},,function(H){var l=RegExp.prototype.hasOwnProperty("sticky");function W(b){this.__input=b||"",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 b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},W.prototype.peek=function(b){var v=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(v=this.__input.charAt(b)),v},W.prototype.__match=function(b,v){b.lastIndex=v;var _=b.exec(this.__input);return _&&!(l&&b.sticky)&&_.index!==v&&(_=null),_},W.prototype.test=function(b,v){return v=v||0,v+=this.__position,v>=0&&v<this.__input_length?!!this.__match(b,v):!1},W.prototype.testChar=function(b,v){var _=this.peek(v);return b.lastIndex=0,_!==null&&b.test(_)},W.prototype.match=function(b){var v=this.__match(b,this.__position);return v?this.__position+=v[0].length:v=null,v},W.prototype.read=function(b,v,_){var E="",T;return b&&(T=this.match(b),T&&(E+=T[0])),v&&(T||!b)&&(E+=this.readUntil(v,_)),E},W.prototype.readUntil=function(b,v){var _="",E=this.__position;b.lastIndex=this.__position;var T=b.exec(this.__input);return T?(E=T.index,v&&(E+=T[0].length)):E=this.__input_length,_=this.__input.substring(this.__position,E),this.__position=E,_},W.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},W.prototype.get_regexp=function(b,v){var _=null,E="g";return v&&l&&(E="y"),typeof b=="string"&&b!==""?_=new RegExp(b,E):b&&(_=new RegExp(b.source,E)),_},W.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},W.prototype.peekUntilAfter=function(b){var v=this.__position,_=this.readUntilAfter(b);return this.__position=v,_},W.prototype.lookBack=function(b){var v=this.__position-1;return v>=b.length&&this.__input.substring(v-b.length,v).toLowerCase()===b},H.exports.InputScanner=W},,,,,function(H){function l(W,b){W=typeof W=="string"?W:W.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp(W+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(W+/\sbeautify\signore:end\s/.source+b,"g")}l.prototype.get_directives=function(W){if(!W.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var v=this.__directive_pattern.exec(W);v;)b[v[1]]=v[2],v=this.__directive_pattern.exec(W);return b},l.prototype.readIgnored=function(W){return W.readUntilAfter(this.__directives_end_ignore_pattern)},H.exports.Directives=l},,function(H,l,W){var b=W(16).Beautifier,v=W(17).Options;function _(E,T){var B=new b(E,T);return B.beautify()}H.exports=_,H.exports.defaultOptions=function(){return new v}},function(H,l,W){var b=W(17).Options,v=W(2).Output,_=W(8).InputScanner,E=W(13).Directives,T=new E(/\/\*/,/\*\//),B=/\r\n|[\r\n]/,U=/\r\n|[\r\n]/g,F=/\s/,w=/(?:\s|\n)+/g,M=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,j=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function O($,X){this._source_text=$||"",this._options=new b(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"]}O.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},O.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},O.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},O.prototype.print_string=function($){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token($)},O.prototype.preserveSingleSpace=function($){$&&(this._output.space_before_token=!0)},O.prototype.indent=function(){this._indentLevel++},O.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},O.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,Ee=!1,ae=!1,Q=!1,I=!1,A=!1,R=this._ch,S=!1,G,k,p;G=this._input.read(w),k=G!=="",p=R,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),R=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(k),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(k),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&&(I=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(k),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")ae&&(ae=!1,this.outdent()),I=!1,Q?(Q=!1,Ee=this._indentLevel>=this._nestedLevel):Ee=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&Ee&&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),Ee=!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}(Ee||Q)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!I&&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||k),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),I=!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(k||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&&!I?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(k),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||k),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=O},function(H,l,W){var b=W(6).Options;function v(_){b.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 E=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||E;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 b,H.exports.Options=v}],C={};function g(H){var l=C[H];if(l!==void 0)return l.exports;var W=C[H]={exports:{}};return q[H](W,W.exports,g),W.exports}var ee=g(15);ie=ee})();var ce=ie;P=[],K=function(){return{css_beautify:ce}}.apply(Re,P),K!==void 0&&(tt.exports=K)})()},40998:function(tt,Re,P){var K,ie;(function(){var ce;(function(){"use strict";var ee=[,,function(b){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 E(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()}E.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},E.prototype.get_line_number=function(){return this.__lines.length},E.prototype.get_indent_string=function(T,B){return this.__indent_cache.get_indent_string(T,B)},E.prototype.get_indent_size=function(T,B){return this.__indent_cache.get_indent_size(T,B)},E.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},E.prototype.add_new_line=function(T){return this.is_empty()||!T&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},E.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},E.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},E.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)},E.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},E.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()},E.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(" "))},E.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()},E.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},E.prototype.just_added_newline=function(){return this.current_line.is_empty()},E.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},E.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--}},b.exports.Output=E},function(b){function v(_,E,T,B){this.type=_,this.text=E,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}b.exports.Token=v},,,function(b){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=E(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 E(T){var B={},U;for(U in T){var F=U.replace(/-/g,"_");B[F]=T[U]}return B}b.exports.Options=v,b.exports.normalizeOpts=E,b.exports.mergeOpts=_},,function(b){var v=RegExp.prototype.hasOwnProperty("sticky");function _(E){this.__input=E||"",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 E=null;return this.hasNext()&&(E=this.__input.charAt(this.__position),this.__position+=1),E},_.prototype.peek=function(E){var T=null;return E=E||0,E+=this.__position,E>=0&&E<this.__input_length&&(T=this.__input.charAt(E)),T},_.prototype.__match=function(E,T){E.lastIndex=T;var B=E.exec(this.__input);return B&&!(v&&E.sticky)&&B.index!==T&&(B=null),B},_.prototype.test=function(E,T){return T=T||0,T+=this.__position,T>=0&&T<this.__input_length?!!this.__match(E,T):!1},_.prototype.testChar=function(E,T){var B=this.peek(T);return E.lastIndex=0,B!==null&&E.test(B)},_.prototype.match=function(E){var T=this.__match(E,this.__position);return T?this.__position+=T[0].length:T=null,T},_.prototype.read=function(E,T,B){var U="",F;return E&&(F=this.match(E),F&&(U+=F[0])),T&&(F||!E)&&(U+=this.readUntil(T,B)),U},_.prototype.readUntil=function(E,T){var B="",U=this.__position;E.lastIndex=this.__position;var F=E.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(E){return this.readUntil(E,!0)},_.prototype.get_regexp=function(E,T){var B=null,U="g";return T&&v&&(U="y"),typeof E=="string"&&E!==""?B=new RegExp(E,U):E&&(B=new RegExp(E.source,U)),B},_.prototype.get_literal_regexp=function(E){return RegExp(E.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},_.prototype.peekUntilAfter=function(E){var T=this.__position,B=this.readUntilAfter(E);return this.__position=T,B},_.prototype.lookBack=function(E){var T=this.__position-1;return T>=E.length&&this.__input.substring(T-E.length,T).toLowerCase()===E},b.exports.InputScanner=_},function(b,v,_){var E=_(8).InputScanner,T=_(3).Token,B=_(10).TokenStream,U=_(11).WhitespacePattern,F={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},w=function(M,j){this._input=new E(M),this._options=j||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new U(this._input)};w.prototype.tokenize=function(){this._input.restart(),this.__tokens=new B,this._reset();for(var M,j=new T(F.START,""),O=null,$=[],X=new B;j.type!==F.EOF;){for(M=this._get_next_token(j,O);this._is_comment(M);)X.add(M),M=this._get_next_token(j,O);X.isEmpty()||(M.comments_before=X,X=new B),M.parent=O,this._is_opening(M)?($.push(O),O=M):O&&this._is_closing(M,O)&&(M.opened=O,O.closed=M,O=$.pop(),M.parent=O),M.previous=j,j.next=M,this.__tokens.add(M),j=M}return this.__tokens},w.prototype._is_first_token=function(){return this.__tokens.isEmpty()},w.prototype._reset=function(){},w.prototype._get_next_token=function(M,j){this._readWhitespace();var O=this._input.read(/.+/g);return O?this._create_token(F.RAW,O):this._create_token(F.EOF,"")},w.prototype._is_comment=function(M){return!1},w.prototype._is_opening=function(M){return!1},w.prototype._is_closing=function(M,j){return!1},w.prototype._create_token=function(M,j){var O=new T(M,j,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return O},w.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},b.exports.Tokenizer=w,b.exports.TOKEN=F},function(b){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 E=null;return _=_||0,_+=this.__position,_>=0&&_<this.__tokens_length&&(E=this.__tokens[_]),E},v.prototype.add=function(_){this.__parent_token&&(_.parent=this.__parent_token),this.__tokens.push(_),this.__tokens_length+=1},b.exports.TokenStream=v},function(b,v,_){var E=_(12).Pattern;function T(B,U){E.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 E,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,w=[],M=B.exec(U);M;)w.push(U.substring(F,M.index)),F=M.index+M[0].length,M=B.exec(U);return F<U.length?w.push(U.substring(F,U.length)):w.push(""),w},b.exports.WhitespacePattern=T},function(b){function v(_,E){this._input=_,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,E&&(this._starting_pattern=this._input.get_regexp(E._starting_pattern,!0),this._match_pattern=this._input.get_regexp(E._match_pattern,!0),this._until_pattern=this._input.get_regexp(E._until_pattern),this._until_after=E._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 E=this._create();return E._until_after=!0,E._until_pattern=this._input.get_regexp(_),E._update(),E},v.prototype.until=function(_){var E=this._create();return E._until_after=!1,E._until_pattern=this._input.get_regexp(_),E._update(),E},v.prototype.starting_with=function(_){var E=this._create();return E._starting_pattern=this._input.get_regexp(_,!0),E._update(),E},v.prototype.matching=function(_){var E=this._create();return E._match_pattern=this._input.get_regexp(_,!0),E._update(),E},v.prototype._create=function(){return new v(this._input,this)},v.prototype._update=function(){},b.exports.Pattern=v},function(b){function v(_,E){_=typeof _=="string"?_:_.source,E=typeof E=="string"?E:E.source,this.__directives_block_pattern=new RegExp(_+/ beautify( \w+[:]\w+)+ /.source+E,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(_+/\sbeautify\signore:end\s/.source+E,"g")}v.prototype.get_directives=function(_){if(!_.match(this.__directives_block_pattern))return null;var E={};this.__directive_pattern.lastIndex=0;for(var T=this.__directive_pattern.exec(_);T;)E[T[1]]=T[2],T=this.__directive_pattern.exec(_);return E},v.prototype.readIgnored=function(_){return _.readUntilAfter(this.__directives_end_ignore_pattern)},b.exports.Directives=v},function(b,v,_){var E=_(12).Pattern,T={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function B(U,F){E.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 w=new E(U);this.__patterns={handlebars_comment:w.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:w.starting_with(/{{{/).until_after(/}}}/),handlebars:w.starting_with(/{{/).until_after(/}}/),php:w.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:w.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:w.starting_with(/{%/).until_after(/%}/),django_value:w.starting_with(/{{/).until_after(/}}/),django_comment:w.starting_with(/{#/).until_after(/#}/),smarty:w.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:w.starting_with(/{\*/).until_after(/\*}/),smarty_literal:w.starting_with(/{literal}/).until_after(/{\/literal}/)}}B.prototype=new E,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 w in T)F._disabled[w]=U.templating.indexOf(w)===-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 w=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&w==="?"&&(U=U||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&w==="%"&&(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},b.exports.TemplatablePattern=B},,,,function(b,v,_){var E=_(19).Beautifier,T=_(20).Options;function B(U,F,w,M){var j=new E(U,F,w,M);return j.beautify()}b.exports=B,b.exports.defaultOptions=function(){return new T}},function(b,v,_){var E=_(20).Options,T=_(2).Output,B=_(21).Tokenizer,U=_(21).TOKEN,F=/\r\n|[\r\n]/,w=/\r\n|[\r\n]/g,M=function(I,A){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=I.max_preserve_newlines,this.preserve_newlines=I.preserve_newlines,this._output=new T(I,A)};M.prototype.current_line_has_match=function(I){return this._output.current_line.has_match(I)},M.prototype.set_space_before_token=function(I,A){this._output.space_before_token=I,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(I){this._output.add_raw_token(I)},M.prototype.print_preserved_newlines=function(I){var A=0;I.type!==U.TEXT&&I.previous.type!==U.TEXT&&(A=I.newlines?1:0),this.preserve_newlines&&(A=I.newlines<this.max_preserve_newlines+1?I.newlines:this.max_preserve_newlines+1);for(var R=0;R<A;R++)this.print_newline(R>0);return A!==0},M.prototype.traverse_whitespace=function(I){return I.whitespace_before||I.newlines?(this.print_preserved_newlines(I)||(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(I){this._output.add_new_line(I)},M.prototype.print_token=function(I){I.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(I.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(I){return I=this.indent_level+(I||0),I<1?"":this._output.get_indent_string(I)};var j=function(I){for(var A=null,R=I.next;R.type!==U.EOF&&I.closed!==R;){if(R.type===U.ATTRIBUTE&&R.text==="type"){R.next&&R.next.type===U.EQUALS&&R.next.next&&R.next.next.type===U.VALUE&&(A=R.next.next.text);break}R=R.next}return A},O=function(I,A){var R=null,S=null;return A.closed?(I==="script"?R="text/javascript":I==="style"&&(R="text/css"),R=j(A)||R,R.search("text/css")>-1?S="css":R.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?S="javascript":R.search(/(text|application|dojo)\/(x-)?(html)/)>-1?S="html":R.search(/test\/null/)>-1&&(S="null"),S):null};function $(I,A){return A.indexOf(I)!==-1}function X(I,A,R){this.parent=I||null,this.tag=A?A.tag_name:"",this.indent_level=R||0,this.parser_token=A||null}function Y(I){this._printer=I,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(I){var A=new X(this._current_frame,I,this._printer.indent_level);this._current_frame=A},Y.prototype._try_pop_frame=function(I){var A=null;return I&&(A=I.parser_token,this._printer.indent_level=I.indent_level,this._current_frame=I.parent),A},Y.prototype._get_frame=function(I,A){for(var R=this._current_frame;R&&I.indexOf(R.tag)===-1;){if(A&&A.indexOf(R.tag)!==-1){R=null;break}R=R.parent}return R},Y.prototype.try_pop=function(I,A){var R=this._get_frame([I],A);return this._try_pop_frame(R)},Y.prototype.indent_to_tag=function(I){var A=this._get_frame(I);A&&(this._printer.indent_level=A.indent_level)};function fe(I,A,R,S){this._source_text=I||"",A=A||{},this._js_beautify=R,this._css_beautify=S,this._tag_stack=null;var G=new E(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 I=this._source_text,A=this._options.eol;this._options.eol==="auto"&&(A=`
|
|
`,I&&F.test(I)&&(A=I.match(F)[0])),I=I.replace(w,`
|
|
`);var R=I.match(/^[\t ]*/)[0],S={text:"",type:""},G=new Ee(this._options),k=new M(this._options,R),p=new B(I,this._options).tokenize();this._tag_stack=new Y(k);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(k,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(k,N,G,S):N.type===U.TAG_CLOSE?d=this._handle_tag_close(k,N,G):N.type===U.TEXT?d=this._handle_text(k,N,G):N.type===U.CONTROL_FLOW_OPEN?d=this._handle_control_flow_open(k,N):N.type===U.CONTROL_FLOW_CLOSE?d=this._handle_control_flow_close(k,N):k.add_raw_token(N),S=d,N=p.next();var V=k._output.get_code(A);return V},fe.prototype._handle_control_flow_open=function(I,A){var R={text:A.text,type:A.type};return I.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),A.newlines?I.print_preserved_newlines(A):I.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),I.print_token(A),I.indent(),R},fe.prototype._handle_control_flow_close=function(I,A){var R={text:A.text,type:A.type};return I.deindent(),A.newlines?I.print_preserved_newlines(A):I.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),I.print_token(A),R},fe.prototype._handle_tag_close=function(I,A,R){var S={text:A.text,type:A.type};return I.alignment_size=0,R.tag_complete=!0,I.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),R.is_unformatted?I.add_raw_token(A):(R.tag_start_char==="<"&&(I.set_space_before_token(A.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&R.has_wrapped_attrs&&I.print_newline(!1)),I.print_token(A)),R.indent_content&&!(R.is_unformatted||R.is_content_unformatted)&&(I.indent(),R.indent_content=!1),!R.is_inline_element&&!(R.is_unformatted||R.is_content_unformatted)&&I.set_wrap_point(),S},fe.prototype._handle_inside_tag=function(I,A,R,S){var G=R.has_wrapped_attrs,k={text:A.text,type:A.type};return I.set_space_before_token(A.newlines||A.whitespace_before!=="",!0),R.is_unformatted?I.add_raw_token(A):R.tag_start_char==="{"&&A.type===U.TEXT?I.print_preserved_newlines(A)?(A.newlines=0,I.add_raw_token(A)):I.print_token(A):(A.type===U.ATTRIBUTE?I.set_space_before_token(!0):(A.type===U.EQUALS||A.type===U.VALUE&&A.previous.type===U.EQUALS)&&I.set_space_before_token(!1),A.type===U.ATTRIBUTE&&R.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(I.traverse_whitespace(A),G=G||A.newlines!==0),this._is_wrap_attributes_force&&R.attr_count>=this._options.wrap_attributes_min_attrs&&(S.type!==U.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(I.print_newline(!1),G=!0)),I.print_token(A),G=G||I.previous_token_wrapped(),R.has_wrapped_attrs=G),k},fe.prototype._handle_text=function(I,A,R){var S={text:A.text,type:"TK_CONTENT"};return R.custom_beautifier_name?this._print_custom_beatifier_text(I,A,R):R.is_unformatted||R.is_content_unformatted?I.add_raw_token(A):(I.traverse_whitespace(A),I.print_token(A)),S},fe.prototype._print_custom_beatifier_text=function(I,A,R){var S=this;if(A.text!==""){var G=A.text,k,p=1,d="",N="";R.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?k=this._js_beautify:R.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?k=this._css_beautify:R.custom_beautifier_name==="html"&&(k=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=-I.indent_level);var V=I.get_full_indent(p);if(G=G.replace(/\n[ \t]*$/,""),R.custom_beautifier_name!=="html"&&G[0]==="<"&&G.match(/^(<!--|<!\[CDATA\[)/)){var oe=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(G);if(!oe){I.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(k){var xe=function(){this.eol=`
|
|
`};xe.prototype=this._options.raw_options;var Oe=new xe;G=k(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),I.print_newline(!1),G&&(A.text=G,A.whitespace_before="",A.newlines=0,I.add_raw_token(A),I.print_newline(!0))}},fe.prototype._handle_tag_open=function(I,A,R,S,G){var k=this._get_tag_open_token(A);if((R.is_unformatted||R.is_content_unformatted)&&!R.is_empty_element&&A.type===U.TAG_OPEN&&!k.is_start_tag?(I.add_raw_token(A),k.start_tag_token=this._tag_stack.try_pop(k.tag_name)):(I.traverse_whitespace(A),this._set_tag_position(I,A,k,R,S),k.is_inline_element||I.set_wrap_point(),I.print_token(A)),k.is_start_tag&&this._is_wrap_attributes_force){var p=0,d;do d=G.peek(p),d.type===U.ATTRIBUTE&&(k.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)&&(k.alignment_size=A.text.length+1),!k.tag_complete&&!k.is_unformatted&&(I.alignment_size=k.alignment_size),k};var Ee=function(I,A,R){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="",!R)this.tag_complete=!0;else{var S;this.tag_start_char=R.text[0],this.text=R.text,this.tag_start_char==="<"?(S=R.text.match(/^<([^\s>]*)/),this.tag_check=S?S[1]:""):(S=R.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=S?S[1]:"",(R.text.startsWith("{{#>")||R.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&R.next!==null?this.tag_check=R.next.text.split(" ")[0]:this.tag_check=R.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),R.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||R.closed&&R.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==="{"&&(!I.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(G)))}};fe.prototype._get_tag_open_token=function(I){var A=new Ee(this._options,this._tag_stack.get_parser_token(),I);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(I,A,R,S,G){if(R.is_empty_element||(R.is_end_tag?R.start_tag_token=this._tag_stack.try_pop(R.tag_name):(this._do_optional_end_element(R)&&(R.is_inline_element||I.print_newline(!1)),this._tag_stack.record_tag(R),(R.tag_name==="script"||R.tag_name==="style")&&!(R.is_unformatted||R.is_content_unformatted)&&(R.custom_beautifier_name=O(R.tag_check,A)))),$(R.tag_check,this._options.extra_liners)&&(I.print_newline(!1),I._output.just_added_blankline()||I.print_newline(!0)),R.is_empty_element){if(R.tag_start_char==="{"&&R.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),R.indent_content=!0;var k=I.current_line_has_match(/{{#if/);k||I.print_newline(!1)}R.tag_name==="!--"&&G.type===U.TAG_CLOSE&&S.is_end_tag&&R.text.indexOf(`
|
|
`)===-1||(R.is_inline_element||R.is_unformatted||I.print_newline(!1),this._calcluate_parent_multiline(I,R))}else if(R.is_end_tag){var p=!1;p=R.start_tag_token&&R.start_tag_token.multiline_content,p=p||!R.is_inline_element&&!(S.is_inline_element||S.is_unformatted)&&!(G.type===U.TAG_CLOSE&&R.start_tag_token===S)&&G.type!=="TK_CONTENT",(R.is_content_unformatted||R.is_unformatted)&&(p=!1),p&&I.print_newline(!1)}else R.indent_content=!R.custom_beautifier_name,R.tag_start_char==="<"&&(R.tag_name==="html"?R.indent_content=this._options.indent_inner_html:R.tag_name==="head"?R.indent_content=this._options.indent_head_inner_html:R.tag_name==="body"&&(R.indent_content=this._options.indent_body_inner_html)),!(R.is_inline_element||R.is_unformatted)&&(G.type!=="TK_CONTENT"||R.is_content_unformatted)&&I.print_newline(!1),this._calcluate_parent_multiline(I,R)},fe.prototype._calcluate_parent_multiline=function(I,A){A.parent&&I._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(I){var A=null;if(!(I.is_empty_element||!I.is_start_tag||!I.parent)){if(I.tag_name==="body")A=A||this._tag_stack.try_pop("head");else if(I.tag_name==="li")A=A||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(I.tag_name==="dd"||I.tag_name==="dt")A=A||this._tag_stack.try_pop("dt",["dl"]),A=A||this._tag_stack.try_pop("dd",["dl"]);else if(I.parent.tag_name==="p"&&ae.indexOf(I.tag_name)!==-1){var R=I.parent.parent;(!R||Q.indexOf(R.tag_name)===-1)&&(A=A||this._tag_stack.try_pop("p"))}else I.tag_name==="rp"||I.tag_name==="rt"?(A=A||this._tag_stack.try_pop("rt",["ruby","rtc"]),A=A||this._tag_stack.try_pop("rp",["ruby","rtc"])):I.tag_name==="optgroup"?A=A||this._tag_stack.try_pop("optgroup",["select"]):I.tag_name==="option"?A=A||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):I.tag_name==="colgroup"?A=A||this._tag_stack.try_pop("caption",["table"]):I.tag_name==="thead"?(A=A||this._tag_stack.try_pop("caption",["table"]),A=A||this._tag_stack.try_pop("colgroup",["table"])):I.tag_name==="tbody"||I.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"])):I.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"])):(I.tag_name==="th"||I.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 I.parent=this._tag_stack.get_parser_token(),A}},b.exports.Beautifier=fe},function(b,v,_){var E=_(6).Options;function T(B){E.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 E,b.exports.Options=T},function(b,v,_){var E=_(9).Tokenizer,T=_(9).TOKEN,B=_(13).Directives,U=_(14).TemplatablePattern,F=_(12).Pattern,w={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(O,$){E.call(this,O,$),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 E,j.prototype._is_comment=function(O){return!1},j.prototype._is_opening=function(O){return O.type===w.TAG_OPEN||O.type===w.CONTROL_FLOW_OPEN},j.prototype._is_closing=function(O,$){return O.type===w.TAG_CLOSE&&$&&((O.text===">"||O.text==="/>")&&$.text[0]==="<"||O.text==="}}"&&$.text[0]==="{"&&$.text[1]==="{")||O.type===w.CONTROL_FLOW_CLOSE&&O.text==="}"&&$.text.endsWith("{")},j.prototype._reset=function(){this._current_tag_name=""},j.prototype._get_next_token=function(O,$){var X=null;this._readWhitespace();var Y=this._input.peek();return Y===null?this._create_token(w.EOF,""):(X=X||this._read_open_handlebars(Y,$),X=X||this._read_attribute(Y,O,$),X=X||this._read_close(Y,$),X=X||this._read_script_and_style(Y,O),X=X||this._read_control_flows(Y,$),X=X||this._read_raw_content(Y,O,$),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(w.UNKNOWN,this._input.next()),X)},j.prototype._read_comment_or_cdata=function(O){var $=null,X=null,Y=null;if(O==="<"){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(w.COMMENT,X),$.directives=Y)}return $},j.prototype._read_processing=function(O){var $=null,X=null,Y=null;if(O==="<"){var fe=this._input.peek(1);(fe==="!"||fe==="?")&&(X=this.__patterns.conditional_comment.read(),X=X||this.__patterns.processing.read()),X&&($=this._create_token(w.COMMENT,X),$.directives=Y)}return $},j.prototype._read_open=function(O,$){var X=null,Y=null;return(!$||$.type===w.CONTROL_FLOW_OPEN)&&O==="<"&&(X=this._input.next(),this._input.peek()==="/"&&(X+=this._input.next()),X+=this.__patterns.element_name.read(),Y=this._create_token(w.TAG_OPEN,X)),Y},j.prototype._read_open_handlebars=function(O,$){var X=null,Y=null;return(!$||$.type===w.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&O==="{"&&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(w.COMMENT,X)):(X=this.__patterns.handlebars_open.read(),Y=this._create_token(w.TAG_OPEN,X))),Y},j.prototype._read_control_flows=function(O,$){var X="",Y=null;if(!this._options.templating.includes("angular"))return Y;if(O==="@"){if(X=this.__patterns.angular_control_flow_start.read(),X==="")return Y;for(var fe=X.endsWith("(")?1:0,Ee=0;!(X.endsWith("{")&&fe===Ee);){var ae=this._input.next();if(ae===null)break;ae==="("?fe++:ae===")"&&Ee++,X+=ae}Y=this._create_token(w.CONTROL_FLOW_OPEN,X)}else O==="}"&&$&&$.type===w.CONTROL_FLOW_OPEN&&(X=this._input.next(),Y=this._create_token(w.CONTROL_FLOW_CLOSE,X));return Y},j.prototype._read_close=function(O,$){var X=null,Y=null;return $&&$.type===w.TAG_OPEN&&($.text[0]==="<"&&(O===">"||O==="/"&&this._input.peek(1)===">")?(X=this._input.next(),O==="/"&&(X+=this._input.next()),Y=this._create_token(w.TAG_CLOSE,X)):$.text[0]==="{"&&O==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),Y=this._create_token(w.TAG_CLOSE,"}}"))),Y},j.prototype._read_attribute=function(O,$,X){var Y=null,fe="";if(X&&X.text[0]==="<")if(O==="=")Y=this._create_token(w.EQUALS,this._input.next());else if(O==='"'||O==="'"){var Ee=this._input.next();O==='"'?Ee+=this.__patterns.double_quote.read():Ee+=this.__patterns.single_quote.read(),Y=this._create_token(w.VALUE,Ee)}else fe=this.__patterns.attribute.read(),fe&&($.type===w.EQUALS?Y=this._create_token(w.VALUE,fe):Y=this._create_token(w.ATTRIBUTE,fe));return Y},j.prototype._is_content_unformatted=function(O){return this._options.void_elements.indexOf(O)===-1&&(this._options.content_unformatted.indexOf(O)!==-1||this._options.unformatted.indexOf(O)!==-1)},j.prototype._read_raw_content=function(O,$,X){var Y="";if(X&&X.text[0]==="{")Y=this.__patterns.handlebars_raw_close.read();else if($.type===w.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(w.TEXT,Y):null},j.prototype._read_script_and_style=function(O,$){if($.type===w.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(O);if(Y)return Y.type=w.TEXT,Y;var fe=this._input.readUntil(new RegExp("</"+X+"[\\n\\r\\t ]*?>","ig"));if(fe)return this._create_token(w.TEXT,fe)}}return null},j.prototype._read_content_word=function(O,$){var X="";return this._options.unformatted_content_delimiter&&O===this._options.unformatted_content_delimiter[0]&&(X=this.__patterns.unformatted_content_delimiter.read()),X||(X=$&&$.type===w.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),X?this._create_token(w.TEXT,X):null},b.exports.Tokenizer=j,b.exports.TOKEN=w}],H={};function l(b){var v=H[b];if(v!==void 0)return v.exports;var _=H[b]={exports:{}};return ee[b](_,_.exports,l),_.exports}var W=l(18);ce=W})();var q=ce;if(1)K=[P,P(58553),P(87804)],ie=function(ee){var H=P(58553),l=P(87804);return{html_beautify:function(W,b){return q(W,b,H.js_beautify,l.css_beautify)}}}.apply(Re,K),ie!==void 0&&(tt.exports=ie);else var C,g})()},58553:function(tt,Re){var P,K;(function(){var ie;(function(){"use strict";var q=[function(H,l,W){var b=W(1).Beautifier,v=W(5).Options;function _(E,T){var B=new b(E,T);return B.beautify()}H.exports=_,H.exports.defaultOptions=function(){return new v}},function(H,l,W){var b=W(2).Output,v=W(3).Token,_=W(4),E=W(5).Options,T=W(7).Tokenizer,B=W(7).line_starters,U=W(7).positionable_operators,F=W(7).TOKEN;function w(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 O(d,N){return d&&d.type===F.RESERVED&&d.text===N}function $(d,N){return d&&d.type===F.RESERVED&&w(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),Ee=[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 I(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 R(d){return w(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 k(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 E(N)}k.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},k.prototype._reset=function(d){var N=d.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new b(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},k.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},k.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)},k.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"];k.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=w(this._flags.last_token.text,U)||w(d.text,U);if(oe){var xe=w(this._flags.last_token.text,U)&&w(this._options.operator_position,Ee)||w(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()}}},k.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&&O(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(d)&&(this._flags.multiline_frame=!0)},k.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))},k.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)},k.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},k.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))},k.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)},k.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))},k.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"]))},k.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||O(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||O(this._flags.last_token,"else")&&!(O(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},k.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()),w(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):w(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,N=ae.Conditional):w(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:(w(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==="*"&&(w(this._last_last_text,["function","yield"])||this._flags.mode===ae.ObjectLiteral&&w(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()},k.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)},k.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&&(w(V.text,[":",","])&&w(N.type,[F.STRING,F.WORD,F.RESERVED])||w(N.text,["get","set","..."])&&w(V.type,[F.WORD,F.RESERVED]))?w(this._last_last_text,["class","interface"])&&!w(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):w(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&&(w(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()},k.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)},k.prototype.handle_word=function(d){if(d.type===F.RESERVED){if(w(d.text,["set","get"])&&this._flags.mode!==ae.ObjectLiteral)d.type=F.WORD;else if(d.text==="import"&&w(this._tokens.peek().text,["(","."]))d.type=F.WORD;else if(w(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&&!R(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(O(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&&O(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()&&!(w(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===ae.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(d),O(d,"function")){(w(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(w(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:O(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&&(R(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&&R(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==="*"&&(w(this._last_last_text,["function","yield"])||this._flags.mode===ae.ObjectLiteral&&w(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!==":"&&(O(d,"if")&&O(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&&O(d,"from")&&(this._flags.import_block=!1))},k.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&&O(N,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(d)},k.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)},k.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},k.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?(R(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)},k.prototype.handle_operator=function(d){var N=d.text==="*"&&($(this._flags.last_token,["function","yield"])||w(this._flags.last_token.type,[F.START_BLOCK,F.COMMA,F.END_BLOCK,F.SEMICOLON])),V=w(d.text,["-","+"])&&(w(this._flags.last_token.type,[F.START_BLOCK,F.START_EXPR,F.EQUALS,F.OPERATOR])||w(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(w(d.text,["-","+"])&&this.start_of_object_property()){this.print_token(d);return}if(this._flags.last_token.type===F.OPERATOR&&w(this._options.operator_position,Ee)&&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&&w(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&&w(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(w(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===";"&&R(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=w(d.text,["--","-","++","+"])&&w(this._flags.last_token.text,["--","-","++","+"]),w(d.text,["+","-"])&&w(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},k.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)},k.prototype.print_block_commment=function(d,N){var V=I(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}},k.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)},k.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)},k.prototype.handle_unknown=function(d,N){this.print_token(d),d.text[d.text.length-1]===`
|
|
`&&this.print_newline(!1,N)},k.prototype.handle_eof=function(d){for(;this._flags.mode===ae.Statement;)this.restore_mode();this.handle_whitespace_and_comments(d)},H.exports.Beautifier=k},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 E=this.__base_string_length;return _=_||0,v<0&&(E=0),E+=v*this.__indent_size,E+=_,E},W.prototype.get_indent_string=function(v,_){var E=this.__base_string;return _=_||0,v<0&&(v=0,E=""),_+=v*this.__indent_size,this.__ensure_cache(_),E+=this.__cache[_],E},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,E="";this.__indent_size&&v>=this.__indent_size&&(_=Math.floor(v/this.__indent_size),v-=_*this.__indent_size,E=new Array(_+1).join(this.__indent_string)),v&&(E+=new Array(v+1).join(" ")),this.__cache.push(E)};function b(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()}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(v,_){return this.__indent_cache.get_indent_string(v,_)},b.prototype.get_indent_size=function(v,_){return this.__indent_cache.get_indent_size(v,_)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(v){return this.is_empty()||!v&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.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 E=this.__lines.join(`
|
|
`);return v!==`
|
|
`&&(E=E.replace(/[\n]/g,v)),E},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.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)},b.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},b.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()},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(v){for(var _=this.__lines.length;v<_;)this.__lines[v]._remove_indent(),v++;this.current_line._remove_wrap_indent()},b.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},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(v,_){for(var E=this.__lines.length-2;E>=0;){var T=this.__lines[E];if(T.is_empty())break;if(T.item(0).indexOf(v)!==0&&T.item(-1)!==_){this.__lines.splice(E+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}E--}},H.exports.Output=b},function(H){function l(W,b,v,_){this.type=W,this.text=b,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",b="\\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",E="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",T="(?:"+E+"|["+W+v+"])",B="(?:"+E+"|["+b+v+_+"])*";l.identifier=new RegExp(T+B,"g"),l.identifierStart=new RegExp(T),l.identifierMatch=new RegExp("(?:"+E+"|["+b+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 b=W(6).Options,v=["before-newline","after-newline","preserve-newline"];function _(E){b.call(this,E,"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 b,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 E=this.raw_options[v],T=_||[];return typeof E=="object"?E!==null&&typeof E.concat=="function"&&(T=E.concat()):typeof E=="string"&&(T=E.split(/[^a-zA-Z0-9_\/\-]+/)),T},l.prototype._get_boolean=function(v,_){var E=this.raw_options[v],T=E===void 0?!!_:!!E;return T},l.prototype._get_characters=function(v,_){var E=this.raw_options[v],T=_||"";return typeof E=="string"&&(T=E.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),T},l.prototype._get_number=function(v,_){var E=this.raw_options[v];_=parseInt(_,10),isNaN(_)&&(_=0);var T=parseInt(E,10);return isNaN(T)&&(T=_),T},l.prototype._get_selection=function(v,_,E){var T=this._get_selection_list(v,_,E);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,_,E){if(!_||_.length===0)throw new Error("Selection list cannot be empty.");if(E=E||[_[0]],!this._is_valid_selection(E,_))throw new Error("Invalid Default Value!");var T=this._get_array(v,E);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(E){return _.indexOf(E)===-1})};function W(v,_){var E={};v=b(v);var T;for(T in v)T!==_&&(E[T]=v[T]);if(_&&v[_])for(T in v[_])E[T]=v[_][T];return E}function b(v){var _={},E;for(E in v){var T=E.replace(/-/g,"_");_[T]=v[E]}return _}H.exports.Options=l,H.exports.normalizeOpts=b,H.exports.mergeOpts=W},function(H,l,W){var b=W(8).InputScanner,v=W(9).Tokenizer,_=W(9).TOKEN,E=W(13).Directives,T=W(4),B=W(12).Pattern,U=W(14).TemplatablePattern;function F(S,G){return G.indexOf(S)!==-1}var w={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 E(/\/\*/,/\*\//),j=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,O=/[0-9]/,$=/[^\d\.]/,X=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),Y=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";Y=Y.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),Y="\\?\\.(?!\\d) "+Y,Y=Y.replace(/ /g,"|");var fe=new RegExp(Y),Ee="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),ae=Ee.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Q=new RegExp("^(?:"+ae.join("|")+")$"),I,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 k=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:k.matching(j),punct:k.matching(fe),comment:k.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:k.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:k.matching(/<!--/),html_comment_end:k.matching(/-->/),include:k.starting_with(/#include/).until_after(T.lineBreak),shebang:k.starting_with(/#!/).until_after(T.lineBreak),xml:k.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===w.COMMENT||S.type===w.BLOCK_COMMENT||S.type===w.UNKNOWN},A.prototype._is_opening=function(S){return S.type===w.START_BLOCK||S.type===w.START_EXPR},A.prototype._is_closing=function(S,G){return(S.type===w.END_BLOCK||S.type===w.END_EXPR)&&G&&(S.text==="]"&&G.text==="["||S.text===")"&&G.text==="("||S.text==="}"&&G.text==="{")},A.prototype._reset=function(){I=!1},A.prototype._get_next_token=function(S,G){var k=null;this._readWhitespace();var p=this._input.peek();return p===null?this._create_token(w.EOF,""):(k=k||this._read_non_javascript(p),k=k||this._read_string(p),k=k||this._read_pair(p,this._input.peek(1)),k=k||this._read_word(S),k=k||this._read_singles(p),k=k||this._read_comment(p),k=k||this._read_regexp(p,S),k=k||this._read_xml(p,S),k=k||this._read_punctuation(),k=k||this._create_token(w.UNKNOWN,this._input.next()),k)},A.prototype._read_word=function(S){var G;if(G=this.__patterns.identifier.read(),G!=="")return G=G.replace(T.allLineBreaks,`
|
|
`),!(S.type===w.DOT||S.type===w.RESERVED&&(S.text==="set"||S.text==="get"))&&Q.test(G)?(G==="in"||G==="of")&&(S.type===w.WORD||S.type===w.STRING)?this._create_token(w.OPERATOR,G):this._create_token(w.RESERVED,G):this._create_token(w.WORD,G);if(G=this.__patterns.number.read(),G!=="")return this._create_token(w.WORD,G)},A.prototype._read_singles=function(S){var G=null;return S==="("||S==="["?G=this._create_token(w.START_EXPR,S):S===")"||S==="]"?G=this._create_token(w.END_EXPR,S):S==="{"?G=this._create_token(w.START_BLOCK,S):S==="}"?G=this._create_token(w.END_BLOCK,S):S===";"?G=this._create_token(w.SEMICOLON,S):S==="."&&$.test(this._input.peek(1))?G=this._create_token(w.DOT,S):S===","&&(G=this._create_token(w.COMMA,S)),G&&this._input.next(),G},A.prototype._read_pair=function(S,G){var k=null;return S==="#"&&G==="{"&&(k=this._create_token(w.START_BLOCK,S+G)),k&&(this._input.next(),this._input.next()),k},A.prototype._read_punctuation=function(){var S=this.__patterns.punct.read();if(S!=="")return S==="="?this._create_token(w.EQUALS,S):S==="?."?this._create_token(w.DOT,S):this._create_token(w.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(w.UNKNOWN,G.trim()+`
|
|
`);if(G=this.__patterns.include.read(),G)return this._create_token(w.UNKNOWN,G.trim()+`
|
|
`);S=this._input.next();var k="#";if(this._input.hasNext()&&this._input.testChar(O)){do S=this._input.next(),k+=S;while(this._input.hasNext()&&S!=="#"&&S!=="=");return S==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(k+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(k+="{}",this._input.next(),this._input.next())),this._create_token(w.WORD,k)}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 I=!0,this._create_token(w.COMMENT,G)}}else if(I&&S==="-"&&(G=this.__patterns.html_comment_end.read(),G))return I=!1,this._create_token(w.COMMENT,G);return null},A.prototype._read_comment=function(S){var G=null;if(S==="/"){var k="";if(this._input.peek(1)==="*"){k=this.__patterns.block_comment.read();var p=M.get_directives(k);p&&p.ignore==="start"&&(k+=M.readIgnored(this._input)),k=k.replace(T.allLineBreaks,`
|
|
`),G=this._create_token(w.BLOCK_COMMENT,k),G.directives=p}else this._input.peek(1)==="/"&&(k=this.__patterns.comment.read(),G=this._create_token(w.COMMENT,k))}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=R(G)),this._input.peek()===S&&(G+=this._input.next()),G=G.replace(T.allLineBreaks,`
|
|
`),this._create_token(w.STRING,G)}return null},A.prototype._allow_regexp_or_xml=function(S){return S.type===w.RESERVED&&F(S.text,["return","case","throw","else","do","typeof","yield"])||S.type===w.END_EXPR&&S.text===")"&&S.opened.previous.type===w.RESERVED&&F(S.opened.previous.text,["if","while","for"])||F(S.type,[w.COMMENT,w.START_EXPR,w.START_BLOCK,w.START,w.END_BLOCK,w.OPERATOR,w.EQUALS,w.EOF,w.SEMICOLON,w.COMMA])},A.prototype._read_regexp=function(S,G){if(S==="/"&&this._allow_regexp_or_xml(G)){for(var k=this._input.next(),p=!1,d=!1;this._input.hasNext()&&(p||d||this._input.peek()!==S)&&!this._input.testChar(T.newline);)k+=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&&(k+=this._input.next(),k+=this._input.read(T.identifier)),this._create_token(w.STRING,k)}return null},A.prototype._read_xml=function(S,G){if(this._options.e4x&&S==="<"&&this._allow_regexp_or_xml(G)){var k="",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),k+=p[0],V<=0)break;p=this.__patterns.xml.read_match()}return p||(k+=this._input.match(/[\s\S]*/g)[0]),k=k.replace(T.allLineBreaks,`
|
|
`),this._create_token(w.STRING,k)}}return null};function R(S){for(var G="",k=0,p=new b(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||(k=parseInt(d[1],16),k>126&&k<=255&&d[0].indexOf("x")===0))return S;k>=0&&k<32||k>1114111?G+="\\"+d[0]:k===34||k===39||k===92?G+="\\"+String.fromCharCode(k):G+=String.fromCharCode(k)}return G}A.prototype._read_string_recursive=function(S,G,k){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()):k&&(k==="${"&&V==="$"&&this._input.peek()==="{"&&(V+=this._input.next()),k===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=w,H.exports.positionable_operators=X.slice(),H.exports.line_starters=Ee.slice()},function(H){var l=RegExp.prototype.hasOwnProperty("sticky");function W(b){this.__input=b||"",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 b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},W.prototype.peek=function(b){var v=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(v=this.__input.charAt(b)),v},W.prototype.__match=function(b,v){b.lastIndex=v;var _=b.exec(this.__input);return _&&!(l&&b.sticky)&&_.index!==v&&(_=null),_},W.prototype.test=function(b,v){return v=v||0,v+=this.__position,v>=0&&v<this.__input_length?!!this.__match(b,v):!1},W.prototype.testChar=function(b,v){var _=this.peek(v);return b.lastIndex=0,_!==null&&b.test(_)},W.prototype.match=function(b){var v=this.__match(b,this.__position);return v?this.__position+=v[0].length:v=null,v},W.prototype.read=function(b,v,_){var E="",T;return b&&(T=this.match(b),T&&(E+=T[0])),v&&(T||!b)&&(E+=this.readUntil(v,_)),E},W.prototype.readUntil=function(b,v){var _="",E=this.__position;b.lastIndex=this.__position;var T=b.exec(this.__input);return T?(E=T.index,v&&(E+=T[0].length)):E=this.__input_length,_=this.__input.substring(this.__position,E),this.__position=E,_},W.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},W.prototype.get_regexp=function(b,v){var _=null,E="g";return v&&l&&(E="y"),typeof b=="string"&&b!==""?_=new RegExp(b,E):b&&(_=new RegExp(b.source,E)),_},W.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},W.prototype.peekUntilAfter=function(b){var v=this.__position,_=this.readUntilAfter(b);return this.__position=v,_},W.prototype.lookBack=function(b){var v=this.__position-1;return v>=b.length&&this.__input.substring(v-b.length,v).toLowerCase()===b},H.exports.InputScanner=W},function(H,l,W){var b=W(8).InputScanner,v=W(3).Token,_=W(10).TokenStream,E=W(11).WhitespacePattern,T={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},B=function(U,F){this._input=new b(U),this._options=F||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new E(this._input)};B.prototype.tokenize=function(){this._input.restart(),this.__tokens=new _,this._reset();for(var U,F=new v(T.START,""),w=null,M=[],j=new _;F.type!==T.EOF;){for(U=this._get_next_token(F,w);this._is_comment(U);)j.add(U),U=this._get_next_token(F,w);j.isEmpty()||(U.comments_before=j,j=new _),U.parent=w,this._is_opening(U)?(M.push(w),w=U):w&&this._is_closing(U,w)&&(U.opened=w,w.closed=U,w=M.pop(),U.parent=w),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 w=this._input.read(/.+/g);return w?this._create_token(T.RAW,w):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 w=new v(U,F,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},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 b=null;return W=W||0,W+=this.__position,W>=0&&W<this.__tokens_length&&(b=this.__tokens[W]),b},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 b=W(12).Pattern;function v(_,E){b.call(this,_,E),E?this._line_regexp=this._input.get_regexp(E._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}v.prototype=new b,v.prototype.__set_whitespace_patterns=function(_,E){_+="\\t ",E+="\\n\\r",this._match_pattern=this._input.get_regexp("["+_+E+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+E+"]")},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 E=this.__split(this._newline_regexp,_);this.newline_count=E.length-1,this.whitespace_before_token=E[this.newline_count]}return _},v.prototype.matching=function(_,E){var T=this._create();return T.__set_whitespace_patterns(_,E),T._update(),T},v.prototype._create=function(){return new v(this._input,this)},v.prototype.__split=function(_,E){_.lastIndex=0;for(var T=0,B=[],U=_.exec(E);U;)B.push(E.substring(T,U.index)),T=U.index+U[0].length,U=_.exec(E);return T<E.length?B.push(E.substring(T,E.length)):B.push(""),B},H.exports.WhitespacePattern=v},function(H){function l(W,b){this._input=W,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)}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 b=this._create();return b._until_after=!0,b._until_pattern=this._input.get_regexp(W),b._update(),b},l.prototype.until=function(W){var b=this._create();return b._until_after=!1,b._until_pattern=this._input.get_regexp(W),b._update(),b},l.prototype.starting_with=function(W){var b=this._create();return b._starting_pattern=this._input.get_regexp(W,!0),b._update(),b},l.prototype.matching=function(W){var b=this._create();return b._match_pattern=this._input.get_regexp(W,!0),b._update(),b},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},H.exports.Pattern=l},function(H){function l(W,b){W=typeof W=="string"?W:W.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp(W+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(W+/\sbeautify\signore:end\s/.source+b,"g")}l.prototype.get_directives=function(W){if(!W.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var v=this.__directive_pattern.exec(W);v;)b[v[1]]=v[2],v=this.__directive_pattern.exec(W);return b},l.prototype.readIgnored=function(W){return W.readUntilAfter(this.__directives_end_ignore_pattern)},H.exports.Directives=l},function(H,l,W){var b=W(12).Pattern,v={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function _(E,T){b.call(this,E,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 b(E);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 b,_.prototype._create=function(){return new _(this._input,this)},_.prototype._update=function(){this.__set_templated_pattern()},_.prototype.disable=function(E){var T=this._create();return T._disabled[E]=!0,T._update(),T},_.prototype.read_options=function(E){var T=this._create();for(var B in v)T._disabled[B]=E.templating.indexOf(B)===-1;return T._update(),T},_.prototype.exclude=function(E){var T=this._create();return T._excluded[E]=!0,T._update(),T},_.prototype.read=function(){var E="";this._match_pattern?E=this._input.read(this._starting_pattern):E=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),E+=T,T=this._read_template();return this._until_after&&(E+=this._input.readUntilAfter(this._until_pattern)),E},_.prototype.__set_templated_pattern=function(){var E=[];this._disabled.php||E.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||E.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||E.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||E.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(E.push(this.__patterns.django._starting_pattern.source),E.push(this.__patterns.django_value._starting_pattern.source),E.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||E.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&E.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+E.join("|")+")")},_.prototype._read_template=function(){var E="",T=this._input.peek();if(T==="<"){var B=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&B==="?"&&(E=E||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&B==="%"&&(E=E||this.__patterns.erb.read())}else T==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(E=E||this.__patterns.handlebars_comment.read(),E=E||this.__patterns.handlebars_unescaped.read(),E=E||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(E=E||this.__patterns.django_value.read()),this._excluded.django||(E=E||this.__patterns.django_comment.read(),E=E||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(E=E||this.__patterns.smarty_comment.read(),E=E||this.__patterns.smarty_literal.read(),E=E||this.__patterns.smarty.read()));return E},H.exports.TemplatablePattern=_}],C={};function g(H){var l=C[H];if(l!==void 0)return l.exports;var W=C[H]={exports:{}};return q[H](W,W.exports,g),W.exports}var ee=g(0);ie=ee})();var ce=ie;P=[],K=function(){return{js_beautify:ce}}.apply(Re,P),K!==void 0&&(tt.exports=K)})()},75918:function(tt,Re,P){"use strict";P.d(Re,{Wi:function(){return g},Z0:function(){return ee},aU:function(){return C},eZ:function(){return l},wY:function(){return H}});var K=P(4348),ie=P(69323),ce=P(13268),q=function(W,b,v,_){function E(T){return T instanceof v?T:new v(function(B){B(T)})}return new(v||(v=Promise))(function(T,B){function U(M){try{w(_.next(M))}catch(j){B(j)}}function F(M){try{w(_.throw(M))}catch(j){B(j)}}function w(M){M.done?T(M.value):E(M.value).then(U,F)}w((_=_.apply(W,b||[])).next())})};class C extends ie.JT{constructor(b,v="",_="",E=!0,T){super(),this._onDidChange=this._register(new K.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=b,this._label=v,this._cssClass=_,this._enabled=E,this._actionCallback=T}get id(){return this._id}get label(){return this._label}set label(b){this._setLabel(b)}_setLabel(b){this._label!==b&&(this._label=b,this._onDidChange.fire({label:b}))}get tooltip(){return this._tooltip||""}set tooltip(b){this._setTooltip(b)}_setTooltip(b){this._tooltip!==b&&(this._tooltip=b,this._onDidChange.fire({tooltip:b}))}get class(){return this._cssClass}set class(b){this._setClass(b)}_setClass(b){this._cssClass!==b&&(this._cssClass=b,this._onDidChange.fire({class:b}))}get enabled(){return this._enabled}set enabled(b){this._setEnabled(b)}_setEnabled(b){this._enabled!==b&&(this._enabled=b,this._onDidChange.fire({enabled:b}))}get checked(){return this._checked}set checked(b){this._setChecked(b)}_setChecked(b){this._checked!==b&&(this._checked=b,this._onDidChange.fire({checked:b}))}run(b,v){return q(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(b))})}}class g extends ie.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(b,v){return q(this,void 0,void 0,function*(){if(!b.enabled)return;this._onBeforeRun.fire({action:b});let _;try{yield this.runAction(b,v)}catch(E){_=E}this._onDidRun.fire({action:b,error:_})})}runAction(b,v){return q(this,void 0,void 0,function*(){yield b.run(v)})}}class ee extends C{constructor(b){super(ee.ID,b,b?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ee.ID="vs.actions.separator";class H{constructor(b,v,_,E){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=b,this.label=v,this.class=E,this._actions=_}get actions(){return this._actions}dispose(){}run(){return q(this,void 0,void 0,function*(){})}}class l extends C{constructor(){super(l.ID,ce.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(tt,Re,P){"use strict";P.d(Re,{ok:function(){return K}});function K(ie,ce){if(!ie)throw new Error(ce?`Assertion failed (${ce})`:"Assertion Failed")}},52615:function(tt,Re,P){"use strict";P.d(Re,{CM:function(){return C},JL:function(){return g},dT:function(){return H},fK:function(){return q},lA:function(){return ee}});var K=P(4348);class ie{constructor(){this._icons=new Map,this._onDidRegister=new K.Q5}add(W){const b=this._icons.get(W.id);b?W.description?b.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 ce=new ie,q=ce;function C(l,W){return new ee(l,W)}function g(l){return l?l.replace(/\$\((.*?)\)/g,(W,b)=>` ${b} `).trim():""}class ee{constructor(W,b,v){this.id=W,this.definition=b,this.description=v,ce.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 b(E){if(E instanceof ee)return["codicon","codicon-"+E.id];const T=W.exec(E.id);if(!T)return b(ee.error);let[,B,U]=T;const F=["codicon","codicon-"+B];return U&&F.push("codicon-modifier-"+U.substr(1)),F}l.asClassNameArray=b;function v(E){return b(E).join(" ")}l.asClassName=v;function _(E){return"."+b(E).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,Re,P){"use strict";P.d(Re,{B8:function(){return b},Cp:function(){return q},F0:function(){return H},L6:function(){return W},VV:function(){return ee},b1:function(){return l},dL:function(){return ce},ri:function(){return C}});class K{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(_){setTimeout(()=>{throw _.stack?new Error(_.message+`
|
|
|
|
`+_.stack):_},0)}}emit(_){this.listeners.forEach(E=>{E(_)})}onUnexpectedError(_){this.unexpectedErrorHandler(_),this.emit(_)}onUnexpectedExternalError(_){this.unexpectedErrorHandler(_)}}const ie=new K;function ce(v){ee(v)||ie.onUnexpectedError(v)}function q(v){ee(v)||ie.onUnexpectedExternalError(v)}function C(v){if(v instanceof Error){let{name:_,message:E}=v;const T=v.stacktrace||v.stack;return{$isError:!0,name:_,message:E,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 b extends Error{constructor(_){super("NotSupported"),_&&(this.message=_)}}},4348:function(tt,Re,P){"use strict";P.d(Re,{D0:function(){return b},E7:function(){return v},K3:function(){return W},Q5:function(){return l},ZD:function(){return _},ju:function(){return C}});var K=P(79881),ie=P(69323),ce=P(34502),q=P(95830),C;(function(E){E.None=()=>ie.JT.None;function T(R){return(S,G=null,k)=>{let p=!1,d;return d=R(N=>{if(!p)return d?d.dispose():p=!0,S.call(G,N)},null,k),p&&d.dispose(),d}}E.once=T;function B(R,S){return O((G,k=null,p)=>R(d=>G.call(k,S(d)),null,p))}E.map=B;function U(R,S){return O((G,k=null,p)=>R(d=>{S(d),G.call(k,d)},null,p))}E.forEach=U;function F(R,S){return O((G,k=null,p)=>R(d=>S(d)&&G.call(k,d),null,p))}E.filter=F;function w(R){return R}E.signal=w;function M(...R){return(S,G=null,k)=>(0,ie.F8)(...R.map(p=>p(d=>S.call(G,d),null,k)))}E.any=M;function j(R,S,G){let k=G;return B(R,p=>(k=S(k,p),k))}E.reduce=j;function O(R){let S;const G=new l({onFirstListenerAdd(){S=R(G.fire,G)},onLastListenerRemove(){S.dispose()}});return G.event}function $(R,S,G=100,k=!1,p){let d,N,V,oe=0;const xe=new l({leakWarningThreshold:p,onFirstListenerAdd(){d=R(Oe=>{oe++,N=S(N,Oe),k&&!V&&(xe.fire(N),N=void 0),clearTimeout(V),V=setTimeout(()=>{const Me=N;N=void 0,V=void 0,(!k||oe>1)&&xe.fire(Me),oe=0},G)})},onLastListenerRemove(){d.dispose()}});return xe.event}E.debounce=$;function X(R,S=(G,k)=>G===k){let G=!0,k;return F(R,p=>{const d=G||!S(p,k);return G=!1,k=p,d})}E.latch=X;function Y(R,S){return[E.filter(R,S),E.filter(R,G=>!S(G))]}E.split=Y;function fe(R,S=!1,G=[]){let k=G.slice(),p=R(V=>{k?k.push(V):N.fire(V)});const d=()=>{k&&k.forEach(V=>N.fire(V)),k=null},N=new l({onFirstListenerAdd(){p||(p=R(V=>N.fire(V)))},onFirstListenerDidAdd(){k&&(S?setTimeout(d):d())},onLastListenerRemove(){p&&p.dispose(),p=null}});return N.event}E.buffer=fe;class Ee{constructor(S){this.event=S}map(S){return new Ee(B(this.event,S))}forEach(S){return new Ee(U(this.event,S))}filter(S){return new Ee(F(this.event,S))}reduce(S,G){return new Ee(j(this.event,S,G))}latch(){return new Ee(X(this.event))}debounce(S,G=100,k=!1,p){return new Ee($(this.event,S,G,k,p))}on(S,G,k){return this.event(S,G,k)}once(S,G,k){return T(this.event)(S,G,k)}}function ae(R){return new Ee(R)}E.chain=ae;function Q(R,S,G=k=>k){const k=(...V)=>N.fire(G(...V)),p=()=>R.on(S,k),d=()=>R.removeListener(S,k),N=new l({onFirstListenerAdd:p,onLastListenerRemove:d});return N.event}E.fromNodeEventEmitter=Q;function I(R,S,G=k=>k){const k=(...V)=>N.fire(G(...V)),p=()=>R.addEventListener(S,k),d=()=>R.removeEventListener(S,k),N=new l({onFirstListenerAdd:p,onLastListenerRemove:d});return N.event}E.fromDOMEventEmitter=I;function A(R){return new Promise(S=>T(R)(S))}E.toPromise=A})(C||(C={}));class g{constructor(T){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${T}_${g._idPool++}`}start(T){this._stopWatch=new q.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 w,M=0;for(const[j,O]of this._stacks)(!w||M<O)&&(w=j,M=O);console.warn(`[${this.name}] potential listener LEAK detected, having ${T} listeners already. MOST frequent listener (${M}):`),console.warn(w)}return()=>{const w=this._stacks.get(U)||0;this._stacks.set(U,w-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 ce.S);const w=this._listeners.isEmpty();w&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const M=this._listeners.push(B?[T,B]:T);w&&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),O=(0,ie.OF)(()=>{j&&j(),this._disposed||(M(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return U instanceof ie.SL?U.add(O):Array.isArray(U)&&U.push(O),O}),this._event}fire(T){var B,U;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new ce.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,w]=this._deliveryQueue.shift();try{typeof F=="function"?F.call(void 0,w):F[0].call(F[1],w)}catch(M){(0,K.dL)(M)}}(U=this._perfMon)===null||U===void 0||U.stop()}}dispose(){var T,B,U,F,w;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),(w=this._leakageMon)===null||w===void 0||w.dispose())}}class W extends l{constructor(T){super(T),this._isPaused=0,this._eventQueue=new ce.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 b 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(w=>{const M=this.buffers[this.buffers.length-1];M?M.push(()=>B.call(U,w)):B.call(U,w)},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=C.None,this.inputEventListener=ie.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,Re,P){"use strict";P.d(Re,{I:function(){return K}});function K(ie){const ce=this;let q=!1,C;return function(){return q||(q=!0,C=ie.apply(ce,arguments)),C}}},88226:function(tt,Re,P){"use strict";P.d(Re,{$:function(){return K}});var K;(function(ie){function ce(M){return M&&typeof M=="object"&&typeof M[Symbol.iterator]=="function"}ie.is=ce;const q=Object.freeze([]);function C(){return q}ie.empty=C;function*g(M){yield M}ie.single=g;function ee(M){return M||q}ie.from=ee;function H(M){return!M||M[Symbol.iterator]().next().done===!0}ie.isEmpty=H;function l(M){return M[Symbol.iterator]().next().value}ie.first=l;function W(M,j){for(const O of M)if(j(O))return!0;return!1}ie.some=W;function b(M,j){for(const O of M)if(j(O))return O}ie.find=b;function*v(M,j){for(const O of M)j(O)&&(yield O)}ie.filter=v;function*_(M,j){let O=0;for(const $ of M)yield j($,O++)}ie.map=_;function*E(...M){for(const j of M)for(const O of j)yield O}ie.concat=E;function*T(M){for(const j of M)for(const O of j)yield O}ie.concatNested=T;function B(M,j,O){let $=O;for(const X of M)$=j($,X);return $}ie.reduce=B;function*U(M,j,O=M.length){for(j<0&&(j+=M.length),O<0?O+=M.length:O>M.length&&(O=M.length);j<O;j++)yield M[j]}ie.slice=U;function F(M,j=Number.POSITIVE_INFINITY){const O=[];if(j===0)return[O,M];const $=M[Symbol.iterator]();for(let X=0;X<j;X++){const Y=$.next();if(Y.done)return[O,ie.empty()];O.push(Y.value)}return[O,{[Symbol.iterator](){return $}}]}ie.consume=F;function w(M,j,O=($,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(!O(Y.value,fe.value))return!1}}ie.equals=w})(K||(K={}))},69323:function(tt,Re,P){"use strict";P.d(Re,{B9:function(){return _},F8:function(){return E},JT:function(){return U},Jz:function(){return w},OF:function(){return T},SL:function(){return B},Wf:function(){return v},XK:function(){return F},dk:function(){return W}});var K=P(17845),ie=P(88226);const ce=!1;let q=null;function C(M){q=M}if(ce){const M="__is_disposable_tracked__";C(new class{trackDisposable(j){const O=new Error("Potentially leaked disposable").stack;setTimeout(()=>{j[M]||console.log(O)},3e3)}setParent(j,O){if(j&&j!==U.None)try{j[M]=!0}catch($){}}markAsDisposed(j){if(j&&j!==U.None)try{j[M]=!0}catch(O){}}markAsSingleton(j){}})}function g(M){return q==null||q.trackDisposable(M),M}function ee(M){q==null||q.markAsDisposed(M)}function H(M,j){q==null||q.setParent(M,j)}function l(M,j){if(q)for(const O of M)q.setParent(O,j)}function W(M){return q==null||q.markAsSingleton(M),M}class b 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(ie.$.is(M)){let j=[];for(const O of M)if(O)try{O.dispose()}catch($){j.push($)}if(j.length===1)throw j[0];if(j.length>1)throw new b(j);return Array.isArray(M)?[]:M}else if(M)return M.dispose(),M}function E(...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 O;this._isDisposed||j===this._value||((O=this._value)===null||O===void 0||O.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 w{constructor(j){this.object=j}dispose(){}}},34502:function(tt,Re,P){"use strict";P.d(Re,{S:function(){return ie}});class K{constructor(q){this.element=q,this.next=K.Undefined,this.prev=K.Undefined}}K.Undefined=new K(void 0);class ie{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 q=this._first;for(;q!==K.Undefined;){const C=q.next;q.prev=K.Undefined,q.next=K.Undefined,q=C}this._first=K.Undefined,this._last=K.Undefined,this._size=0}unshift(q){return this._insert(q,!1)}push(q){return this._insert(q,!0)}_insert(q,C){const g=new K(q);if(this._first===K.Undefined)this._first=g,this._last=g;else if(C){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 q=this._first.element;return this._remove(this._first),q}}pop(){if(this._last!==K.Undefined){const q=this._last.element;return this._remove(this._last),q}}_remove(q){if(q.prev!==K.Undefined&&q.next!==K.Undefined){const C=q.prev;C.next=q.next,q.next.prev=C}else q.prev===K.Undefined&&q.next===K.Undefined?(this._first=K.Undefined,this._last=K.Undefined):q.next===K.Undefined?(this._last=this._last.prev,this._last.next=K.Undefined):q.prev===K.Undefined&&(this._first=this._first.next,this._first.prev=K.Undefined);this._size-=1}*[Symbol.iterator](){let q=this._first;for(;q!==K.Undefined;)yield q.element,q=q.next}}},23345:function(tt,Re,P){"use strict";P.d(Re,{$L:function(){return $},ED:function(){return w},IJ:function(){return j},OS:function(){return Ee},WE:function(){return Y},dz:function(){return M},gn:function(){return X},li:function(){return T},r:function(){return I},tY:function(){return O},xS:function(){return fe}});var K=P(97671),ie;const ce="en";let q=!1,C=!1,g=!1,ee=!1,H=!1,l=!1,W=!1,b,v=null,_=null,E;const T=typeof self=="object"?self:typeof P.g=="object"?P.g:{};let B;typeof T.vscode!="undefined"&&typeof T.vscode.process!="undefined"?B=T.vscode.process:typeof K!="undefined"&&(B=K);const U=typeof((ie=B==null?void 0:B.versions)===null||ie===void 0?void 0:ie.electron)=="string"&&B.type==="renderer";if(typeof navigator=="object"&&!U)E=navigator.userAgent,q=E.indexOf("Windows")>=0,C=E.indexOf("Macintosh")>=0,W=(E.indexOf("Macintosh")>=0||E.indexOf("iPad")>=0||E.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,g=E.indexOf("Linux")>=0,l=!0,b=navigator.language,v=b;else if(typeof B=="object"){q=B.platform==="win32",C=B.platform==="darwin",g=B.platform==="linux",ee=g&&!!B.env.SNAP&&!!B.env.SNAP_REVISION,b=ce,v=ce;const A=B.env.VSCODE_NLS_CONFIG;if(A)try{const R=JSON.parse(A),S=R.availableLanguages["*"];b=R.locale,v=S||ce,_=R._translationsConfigFile}catch(R){}H=!0}else console.error("Unable to resolve platform.");let F=0;C?F=1:q?F=3:g&&(F=2);const w=q,M=C,j=g,O=H,$=l,X=W,Y=E,fe=function(){if(T.setImmediate)return T.setImmediate.bind(T);if(typeof T.postMessage=="function"&&!T.importScripts){let S=[];T.addEventListener("message",k=>{if(k.data&&k.data.vscodeSetImmediateId)for(let p=0,d=S.length;p<d;p++){const N=S[p];if(N.id===k.data.vscodeSetImmediateId){S.splice(p,1),N.callback();return}}});let G=0;return k=>{const p=++G;S.push({id:p,callback:k}),T.postMessage({vscodeSetImmediateId:p},"*")}}if(typeof(B==null?void 0:B.nextTick)=="function")return B.nextTick.bind(B);const R=Promise.resolve();return S=>R.then(S)}(),Ee=C||W?2:q?1:3;let ae=!0,Q=!1;function I(){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,Re,P){"use strict";P.d(Re,{G:function(){return ce}});var K=P(23345);const ie=K.li.performance&&typeof K.li.performance.now=="function";class ce{constructor(C){this._highResolution=ie&&C,this._startTime=this._now(),this._stopTime=-1}static create(C=!0){return new ce(C)}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,Re,P){"use strict";P.d(Re,{$i:function(){return oe},C8:function(){return rt},GF:function(){return b},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 Ee},PJ:function(){return Fe},Qe:function(){return xe},R1:function(){return W},RP:function(){return N},S6:function(){return qe},TT:function(){return w},Ut:function(){return p},V8:function(){return B},WU:function(){return ce},YK:function(){return Q},YU:function(){return q},ZG:function(){return ae},ZH:function(){return A},ab:function(){return Oe},c1:function(){return ft},df:function(){return $},ec:function(){return C},fi:function(){return Wt},fy:function(){return g},j3:function(){return ee},j_:function(){return j},m5:function(){return K},mK:function(){return O},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 I},uS:function(){return ze},un:function(){return l},uq:function(){return E},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 ie=/{(\d+)}/g;function ce(Z,...se){return se.length===0?Z:Z.replace(ie,function(de,we){const ke=parseInt(we,10);return isNaN(ke)||ke<0||ke>=se.length?de:se[ke]})}function q(Z){return Z.replace(/[<>&]/g,function(se){switch(se){case"<":return"<";case">":return">";case"&":return"&";default:return se}})}function C(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 b(Z,se,de={}){if(!Z)throw new Error("Cannot create regex from empty string");se||(Z=C(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 E(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 w(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 w(Z.toLowerCase(),se.toLowerCase(),de,we,ke,Ze);O(st)&&(st-=32),O(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 O(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 Ee(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 I(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 I(we,ke)}return we}function R(Z,se){const de=Z.charCodeAt(se-1);if(Q(de)&&se>1){const we=Z.charCodeAt(se-2);if(ae(we))return I(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=R(Z,se);se-=ke>=65536?2:1;let Ze=de.getGraphemeBreakType(ke);for(;se>0;){const ot=R(Z,se),pt=de.getGraphemeBreakType(ot);if(Wt(pt,Ze))break;se-=ot>=65536?2:1,Ze=pt}return we-se}const k=/(?:[\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 k.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=R(se,Z);return Z-=Be(we),Z}function ve(Z,se){let de=R(se,Z);for(Z-=Be(de);je(de)||de===65039||de===8419;){if(Z===0)return;de=R(se,Z),Z-=Be(de)}if(rt(de)){if(Z>=0){const we=R(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,Re,P){"use strict";P.d(Re,{$E:function(){return T},$K:function(){return ee},D8:function(){return v},HD:function(){return ie},IU:function(){return B},Jp:function(){return H},Kn:function(){return ce},cW:function(){return W},f6:function(){return U},hj:function(){return q},jn:function(){return C},kJ:function(){return K},mf:function(){return b},o8:function(){return g},p_:function(){return l},vE:function(){return F}});function K(w){return Array.isArray(w)}function ie(w){return typeof w=="string"}function ce(w){return typeof w=="object"&&w!==null&&!Array.isArray(w)&&!(w instanceof RegExp)&&!(w instanceof Date)}function q(w){return typeof w=="number"&&!isNaN(w)}function C(w){return w===!0||w===!1}function g(w){return typeof w=="undefined"}function ee(w){return!H(w)}function H(w){return g(w)||w===null}function l(w,M){if(!w)throw new Error(M?`Unexpected type, expected '${M}'`:"Unexpected type")}function W(w){if(H(w))throw new Error("Assertion Failed: argument is undefined or null");return w}function b(w){return typeof w=="function"}function v(w,M){const j=Math.min(w.length,M.length);for(let O=0;O<j;O++)_(w[O],M[O])}function _(w,M){if(ie(M)){if(typeof w!==M)throw new Error(`argument does not match constraint: typeof ${M}`)}else if(b(M)){try{if(w instanceof M)return}catch(j){}if(!H(w)&&w.constructor===M||M.length===1&&M.call(void 0,w)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function E(w){let M=[],j=Object.getPrototypeOf(w);for(;Object.prototype!==j;)M=M.concat(Object.getOwnPropertyNames(j)),j=Object.getPrototypeOf(j);return M}function T(w){const M=[];for(const j of E(w))typeof w[j]=="function"&&M.push(j);return M}function B(w,M){const j=$=>function(){const X=Array.prototype.slice.call(arguments,0);return M($,X)};let O={};for(const $ of w)O[$]=j($);return O}function U(w){return w===null?void 0:w}function F(w,M="Unreachable"){throw new Error(M)}},13268:function(tt,Re,P){"use strict";P.d(Re,{N:function(){return ie}});function K(ce,q){let C;return q.length===0?C=ce:C=ce.replace(/\{(\d+)\}/g,function(g,ee){const H=ee[0];return typeof q[H]!="undefined"?q[H]:g}),C}function ie(ce,q,...C){return K(q,C)}},96236:function(tt,Re,P){"use strict";P.d(Re,{BH:function(){return B},NZ:function(){return U},U8:function(){return F},co:function(){return T},eH:function(){return E},vr:function(){return _}});var K=P(75918),ie=P(52615),ce=P(4348),q=P(88226),C=P(69323),g=P(34502),ee=P(35884),H=P(90689),l=P(16925),W=P(49055),b=function(w,M,j,O){var $=arguments.length,X=$<3?M:O===null?O=Object.getOwnPropertyDescriptor(M,j):O,Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(w,M,j,O);else for(var fe=w.length-1;fe>=0;fe--)(Y=w[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(w,M){return function(j,O){M(j,O,w)}};function _(w){return w.command!==void 0}class E{constructor(M){this.id=E._idPool++,this._debugName=M}}E._idPool=0,E.CommandPalette=new E("CommandPalette"),E.EditorContext=new E("EditorContext"),E.SimpleEditorContext=new E("SimpleEditorContext"),E.EditorContextCopy=new E("EditorContextCopy"),E.EditorContextPeek=new E("EditorContextPeek"),E.MenubarEditMenu=new E("MenubarEditMenu"),E.MenubarCopy=new E("MenubarCopy"),E.MenubarGoMenu=new E("MenubarGoMenu"),E.MenubarSelectionMenu=new E("MenubarSelectionMenu"),E.InlineCompletionsActions=new E("InlineCompletionsActions");const T=(0,l.yh)("menuService"),B=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new ce.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:w=>w===E.CommandPalette}}addCommand(w){return this.addCommands(q.$.single(w))}addCommands(w){for(const M of w)this._commands.set(M.id,M);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,C.OF)(()=>{let M=!1;for(const j of w)M=this._commands.delete(j.id)||M;M&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(w){return this._commands.get(w)}getCommands(){const w=new Map;return this._commands.forEach((M,j)=>w.set(j,M)),w}appendMenuItem(w,M){return this.appendMenuItems(q.$.single({id:w,item:M}))}appendMenuItems(w){const M=new Set,j=new g.S;for(const{id:O,item:$}of w){let X=this._menuItems.get(O);X||(X=new g.S,this._menuItems.set(O,X)),j.push(X.push($)),M.add(O)}return this._onDidChangeMenu.fire(M),(0,C.OF)(()=>{if(j.size>0){for(let O of j)O();this._onDidChangeMenu.fire(M),j.clear()}})}getMenuItems(w){let M;return this._menuItems.has(w)?M=[...this._menuItems.get(w)]:M=[],w===E.CommandPalette&&this._appendImplicitItems(M),M}_appendImplicitItems(w){const M=new Set;for(const j of w)_(j)&&(M.add(j.command.id),j.alt&&M.add(j.alt.id));this._commands.forEach((j,O)=>{M.has(O)||w.push({command:j})})}};class U extends K.wY{constructor(M,j,O,$){super(`submenuitem.${M.submenu.id}`,typeof M.title=="string"?M.title:M.title.value,[],"submenu"),this.item=M,this._menuService=j,this._contextKeyService=O,this._options=$}get actions(){const M=[],j=this._menuService.createMenu(this.item.submenu,this._contextKeyService),O=j.getActions(this._options);j.dispose();for(const[,$]of O)$.length>0&&(M.push(...$),M.push(new K.Z0));return M.length&&M.pop(),M}}let F=class Zo{constructor(M,j,O,$,X){var Y,fe;if(this._commandService=X,this.id=M.id,this.label=O!=null&&O.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 Ee=M.toggled.condition?M.toggled:{condition:M.toggled};this.checked=$.contextMatchesRules(Ee.condition),this.checked&&Ee.tooltip&&(this.tooltip=typeof Ee.tooltip=="string"?Ee.tooltip:Ee.tooltip.value),Ee.title&&(this.label=typeof Ee.title=="string"?Ee.title:Ee.title.value)}this.item=M,this.alt=j?new Zo(j,void 0,O,$,X):void 0,this._options=O,W.kS.isThemeIcon(M.icon)&&(this.class=ie.dT.asClassName(M.icon))}dispose(){}run(...M){var j,O;let $=[];return!((j=this._options)===null||j===void 0)&&j.arg&&($=[...$,this._options.arg]),!((O=this._options)===null||O===void 0)&&O.shouldForwardArgs&&($=[...$,...M]),this._commandService.executeCommand(this.id,...$)}};F=b([v(3,H.i6),v(4,ee.H)],F)},35884:function(tt,Re,P){"use strict";P.d(Re,{H:function(){return ee},P:function(){return H}});var K=P(4348),ie=P(88226),ce=P(69323),q=P(34502),C=P(72999),g=P(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,C.D8)(F,T),B(U,...F)}}const{id:b}=l;let v=this._commands.get(b);v||(v=new q.S,this._commands.set(b,v));let _=v.unshift(l),E=(0,ce.OF)(()=>{_();const T=this._commands.get(b);T!=null&&T.isEmpty()&&this._commands.delete(b)});return this._onDidRegisterCommand.fire(b),E}registerCommandAlias(l,W){return H.registerCommand(l,(b,...v)=>b.get(ee).executeCommand(W,...v))}getCommand(l){const W=this._commands.get(l);if(!(!W||W.isEmpty()))return ie.$.first(W)}getCommands(){const l=new Map;for(const W of this._commands.keys()){const b=this.getCommand(W);b&&l.set(W,b)}return l}};H.registerCommand("noop",()=>{})},90689:function(tt,Re,P){"use strict";P.d(Re,{Ao:function(){return ee},Eq:function(){return I},Fb:function(){return H},K8:function(){return S},i6:function(){return Q},uy:function(){return ae}});var K=P(23345),ie=P(82983),ce=P(16925);let q=K.WE||"";const C=new Map;C.set("false",!1),C.set("true",!0),C.set("isMac",K.dz),C.set("isLinux",K.IJ),C.set("isWindows",K.ED),C.set("isWeb",K.$L),C.set("isMacNative",K.dz&&!K.$L),C.set("isEdge",q.indexOf("Edg/")>=0),C.set("isFirefox",q.indexOf("Firefox")>=0),C.set("isChrome",q.indexOf("Chrome")>=0),C.set("isSafari",q.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 Ee.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 Ee.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 E.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 w.create(N[0].trim(),N[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(p)){const N=p.split("<=");return O.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,ie.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(k,p){const d=k?k.substituteConstants():void 0,N=p?p.substituteConstants():void 0;return!d&&!N?!0:!d||!N?!1:d.equals(N)}function l(k,p){return k.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 b.INSTANCE}}W.INSTANCE=new W;class b{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}}b.INSTANCE=new b;class v{constructor(p,d){this.key=p,this.negated=d,this.type=2}static create(p,d=null){const N=C.get(p);return typeof N=="boolean"?N?b.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=C.get(this.key);return typeof p=="boolean"?p?b.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=C.get(p);return typeof V=="boolean"?d===(V?"true":"false")?b.INSTANCE:W.INSTANCE:new _(p,d,N)}cmp(p){return p.type!==this.type?this.type-p.type:R(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=C.get(this.key);if(typeof p=="boolean"){const d=p?"true":"false";return this.value===d?b.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 E{constructor(p,d){this.key=p,this.valueKey=d,this.type=10,this.negated=null}static create(p,d){return new E(p,d)}cmp(p){return p.type!==this.type?this.type-p.type:R(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=C.get(p);return typeof V=="boolean"?d===(V?"true":"false")?W.INSTANCE:b.INSTANCE:new B(p,d,N)}cmp(p){return p.type!==this.type?this.type-p.type:R(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=C.get(this.key);if(typeof p=="boolean"){const d=p?"true":"false";return this.value===d?W.INSTANCE:b.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=C.get(p);return typeof N=="boolean"?N?W.INSTANCE:b.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=C.get(this.key);return typeof p=="boolean"?p?W.INSTANCE:b.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(k,p){if(typeof k=="string"){const d=parseFloat(k);isNaN(d)||(k=d)}return typeof k=="string"||typeof k=="number"?p(k):W.INSTANCE}class w{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 w(p,V,N))}cmp(p){return p.type!==this.type?this.type-p.type:R(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=O.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:R(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:R(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 O{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 O(p,V,N))}cmp(p){return p.type!==this.type?this.type-p.type:R(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=w.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(k){let p=null;for(let d=0,N=k.length;d<N;d++){const V=k[d].substituteConstants();if(k[d]!==V&&p===null){p=[];for(let oe=0;oe<d;oe++)p[oe]=k[oe]}p!==null&&(p[d]=V)}return p===null?k: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 b.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=Ee.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=Ee.create(p,this,!0)}return this.negated}}class Ee{constructor(p,d){this.expr=p,this.negated=d,this.type=9}static create(p,d,N){return Ee._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:Ee.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 b.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 Ee(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(Ee.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,ce.yh)("contextKeyService"),I="setContext";function A(k,p){return k<p?-1:k>p?1:0}function R(k,p,d,N){return k<d?-1:k>d?1:p<N?-1:p>N?1:0}function S(k,p){if(p.type===6&&k.type!==9&&k.type!==6){for(const V of p.expr)if(k.equals(V))return!0}const d=k.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(k){return k.type===9?k.expr:[k]}},16925:function(tt,Re,P){"use strict";P.d(Re,{I8:function(){return K},TG:function(){return ie},jt:function(){return C},yh:function(){return q}});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 ie=q("instantiationService");function ce(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 q(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");ce(ee,H,W,!1)};return ee.toString=()=>g,K.serviceIds.set(g,ee),ee}function C(g){return function(ee,H,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");ce(g,ee,l,!0)}}},44650:function(tt,Re,P){"use strict";P.d(Re,{B:function(){return q}});var K=P(76068),ie=P(72999);class ce{constructor(){this.data=new Map}add(g,ee){K.ok(ie.HD(g)),K.ok(ie.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 q=new ce},66213:function(tt,Re,P){"use strict";P.d(Re,{e:function(){return K}});var K;(function(ie){ie.DARK="dark",ie.LIGHT="light",ie.HIGH_CONTRAST="hc"})(K||(K={}))},49055:function(tt,Re,P){"use strict";P.d(Re,{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 b}});var K=P(52615),ie=P(4348),ce=P(69323),q=P(16925),C=P(44650),g=P(66213);const ee=(0,q.yh)("themeService");var H;(function(U){function F(w){return w&&typeof w=="object"&&typeof w.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 w=new RegExp(`^\\$\\((${K.dT.iconNameExpression}(?:${K.dT.iconModifierExpression})?)\\)$`);function M(X){const Y=w.exec(X);if(!Y)return;let[,fe]=Y;return{id:fe}}U.fromString=M;function j(X,Y){let fe=X.id;const Ee=fe.lastIndexOf("~");return Ee!==-1&&(fe=fe.substring(0,Ee)),Y&&(fe=`${fe}~${Y}`),{id:fe}}U.modify=j;function O(X,Y){var fe,Ee;return X.id===Y.id&&((fe=X.color)===null||fe===void 0?void 0:fe.id)===((Ee=Y.color)===null||Ee===void 0?void 0:Ee.id)}U.isEqual=O;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 b(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 ie.Q5}onColorThemeChange(F){return this.themingParticipants.push(F),this.onThemingParticipantAddedEmitter.fire(F),(0,ce.OF)(()=>{const w=this.themingParticipants.indexOf(F);this.themingParticipants.splice(w,1)})}getThemingParticipants(){return this.themingParticipants}}let E=new _;C.B.add(v.ThemingContribution,E);function T(U){return E.onColorThemeChange(U)}class B extends ce.JT{constructor(F){super(),this.themeService=F,this.theme=F.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(w=>this.onThemeChange(w)))}onThemeChange(F){this.theme=F,this.updateStyles()}updateStyles(){}}},31561:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return X}});var K=P(72308),ie=P(49618),ce=P(52487),q=P(74416),C=P(35593),g=P(92310),ee=P.n(g),H=P(8654),l=P(59301),W=P(10228),b=P(16089),v=W.Z.ESC,_=W.Z.TAB;function E(Y){var fe=Y.visible,Ee=Y.triggerRef,ae=Y.onVisibleChange,Q=Y.autoFocus,I=Y.overlayRef,A=l.useRef(!1),R=function(){if(fe){var p,d;(p=Ee.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=I.current)!==null&&p!==void 0&&p.focus?(I.current.focus(),A.current=!0,!0):!1},G=function(p){switch(p.keyCode){case v:R();break;case _:{var d=!1;A.current||(d=S()),d?p.preventDefault():R();break}}};l.useEffect(function(){return fe?(window.addEventListener("keydown",G),Q&&(0,b.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 Ee=Y.overlay,ae=Y.arrow,Q=Y.prefixCls,I=(0,l.useMemo)(function(){var R;return typeof Ee=="function"?R=Ee():R=Ee,R},[Ee]),A=(0,H.sQ)(fe,I==null?void 0:I.ref);return l.createElement(l.Fragment,null,ae&&l.createElement("div",{className:"".concat(Q,"-arrow")}),l.cloneElement(I,{ref:(0,H.Yr)(I)?A:void 0}))}),B=T,U={adjustX:1,adjustY:1},F=[0,0],w={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=w,j=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function O(Y,fe){var Ee,ae=Y.arrow,Q=ae===void 0?!1:ae,I=Y.prefixCls,A=I===void 0?"rc-dropdown":I,R=Y.transitionName,S=Y.animation,G=Y.align,k=Y.placement,p=k===void 0?"bottomLeft":k,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,q.Z)(Y,j),it=l.useState(),_e=(0,ce.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)};E({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()((Ee=Fe.props)===null||Ee===void 0?void 0:Ee.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(C.Z,(0,K.Z)({builtinPlacements:N},Wt,{prefixCls:A,ref:je,popupClassName:ee()(Oe,(0,ie.Z)({},"".concat(A,"-show-arrow"),Q)),popupStyle:Me,action:ft,showAction:oe,hideAction:Rt,popupPlacement:p,popupAlign:G,popupTransitionName:R,popupAnimation:S,popupVisible:Be,stretch:ot()?"minWidth":"",popup:Ze(),onPopupVisibleChange:de,onPopupClick:we,getPopupContainer:V}),st)}var $=l.forwardRef(O),X=$},93681:function(tt,Re,P){"use strict";P.r(Re),P.d(Re,{BaseInput:function(){return W},default:function(){return w}});var K=P(72308),ie=P(77321),ce=P(49618),q=P(62853),C=P(92310),g=P.n(C),ee=P(59301),H=P(5643),l=function(j){var O,$,X=j.inputElement,Y=j.prefixCls,fe=j.prefix,Ee=j.suffix,ae=j.addonBefore,Q=j.addonAfter,I=j.className,A=j.style,R=j.disabled,S=j.readOnly,G=j.focused,k=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)&&(k==null||k())},Wt=function(){var ke;if(!p)return null;var Ze=!R&&!S&&d,ot="".concat(Y,"-clear-icon"),pt=(0,q.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,ce.Z)(ke,"".concat(ot,"-hidden"),!Ze),(0,ce.Z)(ke,"".concat(ot,"-has-suffix"),!!Ee),ke)),role:"button",tabIndex:-1},pt)},it=(0,ee.cloneElement)(X,{value:d,hidden:V,className:g()((O=X.props)===null||O===void 0?void 0:O.className,!(0,H.X3)(j)&&!(0,H.He)(j)&&I)||null,style:(0,ie.Z)((0,ie.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,ce.Z)(_e,"".concat(be,"-disabled"),R),(0,ce.Z)(_e,"".concat(be,"-focused"),G),(0,ce.Z)(_e,"".concat(be,"-readonly"),S),(0,ce.Z)(_e,"".concat(be,"-input-with-clear-btn"),Ee&&p&&d),_e),!(0,H.He)(j)&&I,oe==null?void 0:oe.affixWrapper,xe==null?void 0:xe.affixWrapper),Be=(Ee||p)&&ee.createElement("span",{className:g()("".concat(Y,"-suffix"),xe==null?void 0:xe.suffix),style:Me==null?void 0:Me.suffix},Wt(),Ee);it=ee.createElement(rt,(0,K.Z)({className:ve,style:(0,ie.Z)((0,ie.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"),I,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,b=P(80702),v=P(52487),_=P(74416),E=P(18929),T=P(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 O=M.autoComplete,$=M.onChange,X=M.onFocus,Y=M.onBlur,fe=M.onPressEnter,Ee=M.onKeyDown,ae=M.prefixCls,Q=ae===void 0?"rc-input":ae,I=M.disabled,A=M.htmlSize,R=M.className,S=M.maxLength,G=M.suffix,k=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,E.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&&I?!1:se})},[I]);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),Ee==null||Ee(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:O},de,{onChange:it,onFocus:be,onBlur:ve,onKeyDown:_e,className:g()(Q,(0,ce.Z)({},"".concat(Q,"-disabled"),I),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||k){var we=(0,H.D7)(We),ke=(0,b.Z)(we).length,Ze=(0,q.Z)(k)==="object"?k.formatter({value:we,count:ke,maxLength:S}):"".concat(ke).concat(de?" / ".concat(S):"");return ee.createElement(ee.Fragment,null,!!k&&ee.createElement("span",{className:g()("".concat(Q,"-show-count-suffix"),(0,ce.Z)({},"".concat(Q,"-show-count-has-suffix"),!!G),V==null?void 0:V.count),style:(0,ie.Z)({},oe==null?void 0:oe.count)},Ze),G)}return null};return ee.createElement(W,(0,K.Z)({},xe,{prefixCls:Q,className:R,inputElement:je(),handleReset:Be,value:(0,H.D7)(We),focused:dt,triggerFocus:Wt,suffix:Z(),disabled:I,classes:N,classNames:V,styles:oe}))}),F=U,w=F},5643:function(tt,Re,P){"use strict";P.d(Re,{D7:function(){return C},He:function(){return K},X3:function(){return ie},nH:function(){return q},rJ:function(){return ce}});function K(g){return!!(g.addonBefore||g.addonAfter)}function ie(g){return!!(g.prefix||g.suffix||g.allowClear)}function ce(g,ee,H,l){if(H){var W=ee;if(ee.type==="click"){var b=g.cloneNode(!0);W=Object.create(ee,{target:{value:b},currentTarget:{value:b}}),b.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 q(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 C(g){return typeof g=="undefined"||g===null?"":String(g)}},15285:function(tt,Re,P){"use strict";P.d(Re,{iz:function(){return Ci},ck:function(){return nt},BW:function(){return sn},sN:function(){return nt},Wd:function(){return Ji},ZP:function(){return mt},Xl:function(){return Ee}});var K=P(72308),ie=P(49618),ce=P(77321),q=P(80702),C=P(52487),g=P(74416),ee=P(92310),H=P.n(ee),l=P(11780),W=P(18929),b=P(13697),v=P(48736),_=P(59301),E=P(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=P(80547),w=["children","locked"],M=_.createContext(null);function j(pe,ne){var Ae=(0,ce.Z)({},pe);return Object.keys(ne).forEach(function(Ce){var Te=ne[Ce];Te!==void 0&&(Ae[Ce]=Te)}),Ae}function O(pe){var ne=pe.children,Ae=pe.locked,Ce=(0,g.Z)(pe,w),Te=_.useContext(M),Ue=(0,F.Z)(function(){return j(Te,Ce)},[Te,Ce],function(Pe,ut){return!Ae&&(Pe[0]!==ut[0]||!(0,b.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 Ee(pe){var ne=_.useContext(fe);return _.useMemo(function(){return pe!==void 0?[].concat((0,q.Z)(ne),[pe]):ne},[ne,pe])}var ae=_.createContext(null),Q=_.createContext({}),I=Q,A=P(29194);function R(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,q.Z)(pe.querySelectorAll("*")).filter(function(Ce){return R(Ce,ne)});return R(pe,ne)&&Ae.unshift(pe),Ae}var G=null;function k(){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=P(10228),oe=P(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,ie.Z)(Te,Me,Tt),(0,ie.Z)(Te,We,re),Te),Ye=(Ue={},(0,ie.Z)(Ue,xe,Ae?re:Tt),(0,ie.Z)(Ue,Oe,Ae?Tt:re),(0,ie.Z)(Ue,We,At),(0,ie.Z)(Ue,rt,At),Ue),Je=(Pe={},(0,ie.Z)(Pe,Me,Tt),(0,ie.Z)(Pe,We,re),(0,ie.Z)(Pe,rt,At),(0,ie.Z)(Pe,ft,wt),(0,ie.Z)(Pe,xe,Ae?At:wt),(0,ie.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,C.Z)(pe,2),Ae=ne[1],Ce=(0,_.useRef)(new Map),Te=(0,_.useRef)(new Map),Ue=_.useState([]),Pe=(0,C.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,q.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,q.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,C.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=P(96949),Ut=P(55090),ct=P(77205),Ct=P(38793),Ot=P(2738),Mt=P(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,ce.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(I),Bi=jt._internalRenderMenuItem,mi="".concat(Kt,"-item"),Ft=_.useRef(),zi=_.useRef(),Gi=Bt||ut,Hi=(0,Mt.x1)(ne,zi),_i=Ee(Ue),Zi=function(Ai){return{key:Ue,keyPath:(0,q.Z)(_i).reverse(),item:Ft.current,domEvent:Ai}},dn=Tt||Ii,vi=Xe(Ue,Gi,wt,Gt),wn=vi.active,Pn=(0,g.Z)(vi,lt),bn=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"]=bn);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,Pn,pn,{component:"li","aria-disabled":ut,style:(0,ce.Z)((0,ce.Z)({},gn),Ce),className:H()(mi,(Ae={},(0,ie.Z)(Ae,"".concat(mi,"-active"),wn),(0,ie.Z)(Ae,"".concat(mi,"-selected"),bn),(0,ie.Z)(Ae,"".concat(mi,"-disabled"),Gi),Ae),Te),onClick:un,onKeyDown:Yi,onFocus:rn}),re,_.createElement(bt,{props:(0,ce.Z)((0,ce.Z)({},pe),{},{isSelected:bn}),icon:dn}));return Bi&&(In=Bi(In,pe,{selected:bn})),In});function gt(pe,ne){var Ae=pe.eventKey,Ce=Y(),Te=Ee(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 ui=St,ai=P(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,q.Z)(ne),[Ce]).join("-")));var re={key:ut,eventKey:ut};return _.cloneElement(Ae,re)}return Ae})}var $t=P(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}},Li={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 Di(pe,ne,Ae){if(ne)return ne;if(Ae)return Ae[pe]||Ae.other}var ci={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,C.Z)(oi,2),li=Ii[0],ri=Ii[1],jt=Ye?(0,ce.Z)((0,ce.Z)({},Li),si):(0,ce.Z)((0,ce.Z)({},Mi),si),Bi=ci[re],mi=Di(re,Ht,Bt),Ft=_.useRef(mi);re!=="inline"&&(Ft.current=mi);var zi=(0,ce.Z)((0,ce.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,ie.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=P(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,C.Z)(Ye,2),ni=Je[0],si=Je[1],di=Gt.current?Ae:!1;_.useEffect(function(){Gt.current&&si(!1)},[wt]);var ti=(0,ce.Z)({},Di(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(O,{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(ui,{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(I),Pn=wn._internalRenderSubMenuItem,bn=_.useContext(ae),gn=bn.isSubPathKey,un=Ee(),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),xn=_t.active,Ln=(0,g.Z)(_t,fn),Sn=_.useState(!1),Hn=(0,C.Z)(Sn,2),Wn=Hn[0],Jn=Hn[1],Nn=function(Ki){rn||Jn(Ki)},Zt=function(Ki){Nn(!0),di==null||di({key:Pe,domEvent:Ki})},os=function(Ki){Nn(!1),ti==null||ti({key:Pe,domEvent:Ki})},jn=_.useMemo(function(){return xn||(jt!=="inline"?Wn||gn([zi],Pe):!1)},[jt,xn,zi,Wn,Pe,gn]),Vn=xi(un.length),qn=function(Ki){rn||(Kt==null||Kt({key:Pe,domEvent:Ki}),jt==="inline"&&dn(Pe,!Wi))},Fn=Ze(function(an){si==null||si(Ne(an)),Zi(an)}),Bn=function(Ki){jt!=="inline"&&dn(Pe,Ki)},mn=function(){vi(Pe)},ji=Ii&&"".concat(Ii,"-popup"),Tn=_.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:qn,onFocus:mn},Ln),Ue,_.createElement(bt,{icon:jt!=="horizontal"?Ai:void 0,props:(0,ce.Z)((0,ce.Z)({},ne),{},{isOpen:en,isSubMenu:!0})},_.createElement("i",{className:"".concat(Yi,"-arrow")}))),Oi=_.useRef(jt);if(jt!=="inline"&&un.length>1?Oi.current="vertical":Oi.current=jt,!Ft){var _n=Oi.current;Tn=_.createElement(qt,{mode:_n,prefixCls:Yi,visible:!re&&en&&jt!=="inline",popupClassName:Ye,popupOffset:Je,popupStyle:ni,popup:_.createElement(O,{mode:_n==="horizontal"?"vertical":_n},_.createElement(ui,{id:ji,ref:In},At)),disabled:rn,onVisibleChange:Bn},Tn)}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,ie.Z)(Ae,"".concat(Yi,"-open"),en),(0,ie.Z)(Ae,"".concat(Yi,"-active"),jn),(0,ie.Z)(Ae,"".concat(Yi,"-selected"),Rn),(0,ie.Z)(Ae,"".concat(Yi,"-disabled"),rn),Ae)),onMouseEnter:Zt,onMouseLeave:os}),Tn,!Ft&&_.createElement(Qi,{id:ji,open:en,keyPath:un},At));return Pn&&(vn=Pn(vn,ne,{selected:Rn,active:jn,open:en,disabled:rn})),_.createElement(O,{onItemClick:Fn,mode:jt==="horizontal"?"vertical":jt,itemIcon:Ui,expandIcon:Ai},vn)};function Ji(pe){var ne=pe.eventKey,Ae=pe.children,Ce=Ee(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=P(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=Ee(Ae.eventKey),Te=Si(ne,Ce),Ue=Y();return Ue?Te:_.createElement(Vt,(0,Ot.Z)(Ae,["warnKey"]),Te)}function Ci(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 Ei(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}),Ei(Ue)):_.createElement(Ji,(0,K.Z)({key:re},Tt,{title:Te}),Ei(Ue)):ut==="divider"?_.createElement(Ci,(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=Ei(ne)),Si(Ce,Ae)}var Mn=["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,Pn=Te.inlineIndent,bn=Pn===void 0?24:Pn,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,xn=Te.onOpenChange,Ln=Te.onKeyDown,Sn=Te.openAnimation,Hn=Te.openTransitionName,Wn=Te._internalRenderMenuItem,Jn=Te._internalRenderSubMenuItem,Nn=(0,g.Z)(Te,Mn),Zt=_.useMemo(function(){return ei(Ye,Gt,gi)},[Ye,Gt]),os=_.useState(!1),jn=(0,C.Z)(os,2),Vn=jn[0],qn=jn[1],Fn=_.useRef(),Bn=st(ni),mn=Je==="rtl",ji=(0,W.Z)(jt,{value:Bi,postState:function(yi){return yi||gi}}),Tn=(0,C.Z)(ji,2),Oi=Tn[0],_n=Tn[1],vn=function(yi){var ki=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function yn(){_n(yi),xn==null||xn(yi)}ki?(0,E.flushSync)(yn):yn()},an=_.useState(Oi),Ki=(0,C.Z)(an,2),Yt=Ki[0],Xi=Ki[1],zn=_.useRef(!1),es=_.useMemo(function(){return(di==="inline"||di==="vertical")&&ti?["vertical",ti]:[di,!1]},[di,ti]),ts=(0,C.Z)(es,2),Un=ts[0],Qe=ts[1],It=Un==="inline",Pi=_.useState(Un),$i=(0,C.Z)(Pi,2),hi=$i[0],ls=$i[1],is=_.useState(Qe),Zn=(0,C.Z)(is,2),ds=Zn[0],tr=Zn[1];_.useEffect(function(){ls(Un),tr(Qe),zn.current&&(It?_n(Yt):vn(gi))},[Un,Qe]);var ir=_.useState(0),nr=(0,C.Z)(ir,2),ps=nr[0],kr=nr[1],Dn=ps>=Zt.length-1||hi!=="horizontal"||Ht;_.useEffect(function(){It&&Xi(Oi)},[Oi]),_.useEffect(function(){return zn.current=!0,function(){zn.current=!1}},[]);var ns=ke(),sr=ns.registerPath,Fs=ns.unregisterPath,rr=ns.refreshOverflowKeys,Bs=ns.isSubPathKey,ar=ns.getKeyPath,or=ns.getKeys,Us=ns.getSubPathKeys,lr=_.useMemo(function(){return{registerPath:sr,unregisterPath:Fs}},[sr,Fs]),ur=_.useMemo(function(){return{isSubPathKey:Bs}},[Bs]);_.useEffect(function(){rr(Dn?gi:Zt.slice(ps+1).map(function(Fi){return Fi.key}))},[ps,Dn]);var Yn=(0,W.Z)(mi||Ft&&((Ae=Zt[0])===null||Ae===void 0?void 0:Ae.key),{value:mi}),$s=(0,C.Z)(Yn,2),us=$s[0],Is=$s[1],Mr=Ze(function(Fi){Is(Fi)}),Nr=Ze(function(){Is(void 0)});(0,_.useImperativeHandle)(ne,function(){return{list:Fn.current,focus:function(yi){var ki,yn=or(),cn=ve(yn,Bn),Rs=cn.elements,De=cn.key2element,Ks=cn.element2key,Hs=_e(Fn.current,Rs),Ws=us!=null?us:Hs[0]?Ks.get(Hs[0]):(ki=Zt.find(function(_r){return!_r.props.disabled}))===null||ki===void 0?void 0:ki.key,xs=De.get(Ws);if(Ws&&xs){var Ss;xs==null||(Ss=xs.focus)===null||Ss===void 0||Ss.call(xs,yi)}}}});var Fr=(0,W.Z)(Zi||[],{value:dn,postState:function(yi){return Array.isArray(yi)?yi:yi==null?gi:[yi]}}),cr=(0,C.Z)(Fr,2),Es=cr[0],hr=cr[1],Gs=function(yi){if(Gi){var ki=yi.key,yn=Es.includes(ki),cn;_i?yn?cn=Es.filter(function(De){return De!==ki}):cn=[].concat((0,q.Z)(Es),[ki]):cn=[ki],hr(cn);var Rs=(0,ce.Z)((0,ce.Z)({},yi),{},{selectedKeys:cn});yn?wn==null||wn(Rs):vi==null||vi(Rs)}!_i&&Oi.length&&hi!=="inline"&&vn(gi)},fr=Ze(function(Fi){_t==null||_t(Ne(Fi)),Gs(Fi)}),dr=Ze(function(Fi,yi){var ki=Oi.filter(function(cn){return cn!==Fi});if(yi)ki.push(Fi);else if(hi!=="inline"){var yn=Us(Fi);ki=ki.filter(function(cn){return!yn.has(cn)})}(0,b.Z)(Oi,ki,!0)||vn(ki,!0)}),pr=function(yi,ki){var yn=ki!=null?ki:!Oi.includes(yi);dr(yi,yn)},gr=Be(hi,us,mn,Bn,Fn,or,ar,Is,pr,Ln);_.useEffect(function(){qn(!0)},[]);var mr=_.useMemo(function(){return{_internalRenderMenuItem:Wn,_internalRenderSubMenuItem:Jn}},[Wn,Jn]),bs=hi!=="horizontal"||Ht?Zt:Zt.map(function(Fi,yi){return _.createElement(O,{key:Fi.key,overflowDisabled:yi>ps},Fi)}),Br=_.createElement(l.Z,(0,K.Z)({id:ni,ref:Fn,prefixCls:"".concat(Pe,"-overflow"),component:"ul",itemComponent:nt,className:H()(Pe,"".concat(Pe,"-root"),"".concat(Pe,"-").concat(hi),re,(Ce={},(0,ie.Z)(Ce,"".concat(Pe,"-inline-collapsed"),ds),(0,ie.Z)(Ce,"".concat(Pe,"-rtl"),mn),Ce),ut),dir:Je,style:Tt,role:"menu",tabIndex:wt,data:bs,renderRawItem:function(yi){return yi},renderRawRest:function(yi){var ki=yi.length,yn=ki?Zt.slice(-ki):null;return _.createElement(Ji,{eventKey:we,title:Wi,disabled:Dn,internalPopupClose:ki===0,popupClassName:en},yn)},maxCount:hi!=="horizontal"||Ht?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(yi){kr(yi)},onKeyDown:gr},Nn));return _.createElement(I.Provider,{value:mr},_.createElement(T.Provider,{value:Bn},_.createElement(O,{prefixCls:Pe,rootClassName:ut,mode:hi,openKeys:Oi,rtl:mn,disabled:Kt,motion:Vn?gn:null,defaultMotions:Vn?un:null,activeKey:us,onActive:Mr,onInactive:Nr,selectedKeys:Es,inlineIndent:bn,subMenuOpenDelay:oi,subMenuCloseDelay:li,forceSubMenuRender:ri,builtinPlacements:pn,triggerSubMenuAction:rn,getPopupContainer:Rn,itemIcon:In,expandIcon:Ui,onItemClick:fr,onOpenChange:dr},_.createElement(ae.Provider,{value:ur},Br),_.createElement("div",{style:{display:"none"},"aria-hidden":!0},_.createElement(X.Provider,{value:lr},Zt)))))}),ln=Qt,ii=ln;ii.Item=nt,ii.SubMenu=Ji,ii.ItemGroup=sn,ii.Divider=Ci;var mt=ii},11780:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return k}});var K=P(72308),ie=P(77321),ce=P(52487),q=P(74416),C=P(59301),g=P(92310),ee=P.n(g),H=P(29301),l=P(34280),W=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],b=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,q.Z)(p,W),be=Oe&&!Fe;function ve(de){We(rt,de)}C.useEffect(function(){return function(){ve(null)}},[]);var Be=xe&&oe!==b?xe(oe,{index:qe}):dt,je;V||(je={opacity:be?0:1,height:be?0:b,overflowY:be?"hidden":b,order:Oe?qe:b,pointerEvents:be?"none":b,position:be?"absolute":b});var Z={};be&&(Z["aria-hidden"]=!0);var se=C.createElement(it,(0,K.Z)({className:ee()(!V&&N,ft),style:(0,ie.Z)((0,ie.Z)({},je),ze)},Z,_e,{ref:d}),Be);return Oe&&(se=C.createElement(H.Z,{onResize:function(we){var ke=we.offsetWidth;ve(ke)},disabled:Me},se)),se}var _=C.forwardRef(v);_.displayName="Item";var E=_,T=P(6089),B=P(4676),U=P(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 w(){var p=C.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=C.useState(d),V=(0,ce.Z)(N,2),oe=V[0],xe=V[1],Oe=(0,T.Z)(function(Me){p(function(){xe(Me)})});return[oe,Oe]}var j=C.createContext(null),O=["component"],$=["className"],X=["className"],Y=function(d,N){var V=C.useContext(j);if(!V){var oe=d.component,xe=oe===void 0?"div":oe,Oe=(0,q.Z)(d,O);return C.createElement(xe,(0,K.Z)({},Oe,{ref:N}))}var Me=V.className,We=(0,q.Z)(V,$),rt=d.className,ft=(0,q.Z)(d,X);return C.createElement(j.Provider,{value:null},C.createElement(E,(0,K.Z)({ref:N,className:ee()(Me,rt)},We,ft)))},fe=C.forwardRef(Y);fe.displayName="RawItem";var Ee=fe,ae=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Q="responsive",I="invalidate";function A(p){return"+ ".concat(p.length," ...")}function R(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,q.Z)(p,ae),se=ze==="full",de=w(),we=M(de,null),ke=(0,ce.Z)(we,2),Ze=ke[0],ot=ke[1],pt=Ze||0,st=M(de,new Map),Rt=(0,ce.Z)(st,2),Ut=Rt[0],ct=Rt[1],Ct=M(de,0),Ot=(0,ce.Z)(Ct,2),Mt=Ot[0],Xe=Ot[1],xi=M(de,0),bt=(0,ce.Z)(xi,2),Le=bt[0],Ne=bt[1],Ke=M(de,0),Nt=(0,ce.Z)(Ke,2),lt=Nt[0],Et=Nt[1],kt=(0,C.useState)(null),gt=(0,ce.Z)(kt,2),nt=gt[0],xt=gt[1],at=(0,C.useState)(null),St=(0,ce.Z)(at,2),ui=St[0],ai=St[1],Si=C.useMemo(function(){return ui===null&&se?Number.MAX_SAFE_INTEGER:ui||0},[ui,Ze]),$t=(0,C.useState)(!1),Jt=(0,ce.Z)($t,2),Mi=Jt[0],Li=Jt[1],tn="".concat(V,"-item"),Di=Math.max(Mt,Le),ci=qe===Q,qt=xe.length&&ci,wi=qe===I,Qi=qt||typeof qe=="number"&&xe.length>qe,Vi=(0,C.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,C.useMemo)(function(){return qt?xe.slice(Si+1):xe.slice(Vi.length)},[xe,Vi,qt,Si]),Ti=(0,C.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,C.useCallback)(Oe||function(mt){return mt},[Oe]);function qi(mt,pe,ne){ui===mt&&(pe===void 0||pe===nt)||(ai(mt),ne||(Li(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 Ci(mt){return Ut.get(Ti(Vi[mt],mt))}(0,l.Z)(function(){if(pt&&typeof Di=="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=Ci(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+Ci(ne)<=pt){qi(ne,null);break}else if(mt+Di>pt){qi(Ae-1,mt-Ce-lt+Le);break}}_e&&Ci(0)+lt>pt&&xt(null)}},[pt,Ut,Le,lt,Ti,Vi]);var on=Mi&&!!fn.length,Ei={};nt!==null&&qt&&(Ei={position:"absolute",left:nt,top:0});var ei={prefixCls:tn,responsive:qt,component:Be,invalidate:wi},Mn=Me?function(mt,pe){var ne=Ti(mt,pe);return C.createElement(j.Provider,{key:ne,value:(0,ie.Z)((0,ie.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 C.createElement(E,(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?C.createElement(j.Provider,{value:(0,ie.Z)((0,ie.Z)({},ei),gi)},it(fn)):C.createElement(E,(0,K.Z)({},ei,gi),typeof Qt=="function"?Qt(fn):Qt),ii=C.createElement(ve,(0,K.Z)({className:ee()(!wi&&V,Fe),style:dt,ref:d},Z),Vi.map(Mn),Qi?ln:null,_e&&C.createElement(E,(0,K.Z)({},ei,{responsive:ci,responsiveDisabled:!qt,order:Si,className:"".concat(tn,"-suffix"),registerSize:sn,display:!0,style:Ei}),_e));return ci?C.createElement(H.Z,{onResize:Ni,disabled:!qt},ii):ii}var S=C.forwardRef(R);S.displayName="Overflow",S.Item=Ee,S.RESPONSIVE=Q,S.INVALIDATE=I;var G=S,k=G},29301:function(tt,Re,P){"use strict";P.d(Re,{Z:function(){return I}});var K=P(72308),ie=P(59301),ce=P(11592),q=P(48736),C=P(77321),g=P(62853),ee=P(76846),H=P(8654),l=ie.createContext(null);function W(A){var R=A.children,S=A.onBatchResize,G=ie.useRef(0),k=ie.useRef([]),p=ie.useContext(l),d=ie.useCallback(function(N,V,oe){G.current+=1;var xe=G.current;k.current.push({size:N,element:V,data:oe}),Promise.resolve().then(function(){xe===G.current&&(S==null||S(k.current),k.current=[])}),p==null||p(N,V,oe)},[S,p]);return ie.createElement(l.Provider,{value:d},R)}var b=P(76374),v=new Map;function _(A){A.forEach(function(R){var S,G=R.target;(S=v.get(G))===null||S===void 0||S.forEach(function(k){return k(G)})})}var E=new b.Z(_),T=null,B=null;function U(A,R){v.has(A)||(v.set(A,new Set),E.observe(A)),v.get(A).add(R)}function F(A,R){v.has(A)&&(v.get(A).delete(R),v.get(A).size||(E.unobserve(A),v.delete(A)))}var w=P(96949),M=P(55090),j=P(77205),O=P(38793),$=function(A){(0,j.Z)(S,A);var R=(0,O.Z)(S);function S(){return(0,w.Z)(this,S),R.apply(this,arguments)}return(0,M.Z)(S,[{key:"render",value:function(){return this.props.children}}]),S}(ie.Component);function X(A,R){var S=A.children,G=A.disabled,k=ie.useRef(null),p=ie.useRef(null),d=ie.useContext(l),N=typeof S=="function",V=N?S(k):S,oe=ie.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),xe=!N&&ie.isValidElement(V)&&(0,H.Yr)(V),Oe=xe?(0,H.C4)(V):null,Me=(0,H.x1)(Oe,k),We=function(){var dt;return(0,ee.ZP)(k.current)||(k.current&&(0,g.Z)(k.current)==="object"?(0,ee.ZP)((dt=k.current)===null||dt===void 0?void 0:dt.nativeElement):null)||(0,ee.ZP)(p.current)};ie.useImperativeHandle(R,function(){return We()});var rt=ie.useRef(A);rt.current=A;var ft=ie.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,C.Z)((0,C.Z)({},Z),{},{offsetWidth:se,offsetHeight:de});d==null||d(we,ze,qe),Fe&&Promise.resolve().then(function(){Fe(we,ze)})}},[]);return ie.useEffect(function(){var ze=We();return ze&&!G&&U(ze,ft),function(){return F(ze,ft)}},[k.current,G]),ie.createElement($,{ref:p},xe?ie.cloneElement(V,{ref:Me}):V)}var Y=ie.forwardRef(X),fe=Y,Ee="rc-observer-key";function ae(A,R){var S=A.children,G=typeof S=="function"?[S]:(0,ce.Z)(S);return G.map(function(k,p){var d=(k==null?void 0:k.key)||"".concat(Ee,"-").concat(p);return ie.createElement(fe,(0,K.Z)({},A,{key:d,ref:p===0?R:void 0}),k)})}var Q=ie.forwardRef(ae);Q.Collection=W;var I=Q},55477:function(tt,Re,P){"use strict";P.d(Re,{G:function(){return _},Z:function(){return U}});var K=P(72308),ie=P(77321),ce=P(74416),q=P(35593),C=P(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,b=P(92310),v=P.n(b);function _(F){var w=F.children,M=F.prefixCls,j=F.id,O=F.overlayInnerStyle,$=F.className,X=F.style;return C.createElement("div",{className:v()("".concat(M,"-content"),$),style:X},C.createElement("div",{className:"".concat(M,"-inner"),id:j,role:"tooltip",style:O},typeof w=="function"?w():w))}var E=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow"],T=function(w,M){var j=w.overlayClassName,O=w.trigger,$=O===void 0?["hover"]:O,X=w.mouseEnterDelay,Y=X===void 0?0:X,fe=w.mouseLeaveDelay,Ee=fe===void 0?.1:fe,ae=w.overlayStyle,Q=w.prefixCls,I=Q===void 0?"rc-tooltip":Q,A=w.children,R=w.onVisibleChange,S=w.afterVisibleChange,G=w.transitionName,k=w.animation,p=w.motion,d=w.placement,N=d===void 0?"right":d,V=w.align,oe=V===void 0?{}:V,xe=w.destroyTooltipOnHide,Oe=xe===void 0?!1:xe,Me=w.defaultVisible,We=w.getTooltipContainer,rt=w.overlayInnerStyle,ft=w.arrowContent,ze=w.overlay,dt=w.id,Fe=w.showArrow,qe=Fe===void 0?!0:Fe,Wt=(0,ce.Z)(w,E),it=(0,C.useRef)(null);(0,C.useImperativeHandle)(M,function(){return it.current});var _e=(0,ie.Z)({},Wt);"visible"in w&&(_e.popupVisible=w.visible);var be=function(){return C.createElement(_,{key:"content",prefixCls:I,id:dt,overlayInnerStyle:rt},ze)};return C.createElement(q.Z,(0,K.Z)({popupClassName:j,prefixCls:I,popup:be,action:$,builtinPlacements:l,popupPlacement:N,ref:it,popupAlign:oe,getPopupContainer:We,onPopupVisibleChange:R,afterPopupVisibleChange:S,popupTransitionName:G,popupAnimation:k,popupMotion:p,defaultPopupVisible:Me,autoDestroy:Oe,mouseLeaveDelay:Ee,popupStyle:ae,mouseEnterDelay:Y,arrow:qe},_e),A)},B=(0,C.forwardRef)(T),U=B},49658:function(tt,Re){"use strict";Re.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var P=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(P)||/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(P==null?void 0:P.substr(0,4))}},83145:function(tt,Re,P){"use strict";Object.defineProperty(Re,"__esModule",{value:!0}),Re.CopyToClipboard=void 0;var K=ce(P(59301)),ie=ce(P(25769));function ce(w){return w&&w.__esModule?w:{default:w}}function q(w){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?q=function(j){return typeof j}:q=function(j){return j&&typeof Symbol=="function"&&j.constructor===Symbol&&j!==Symbol.prototype?"symbol":typeof j},q(w)}function C(w,M){var j=Object.keys(w);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(w);M&&(O=O.filter(function($){return Object.getOwnPropertyDescriptor(w,$).enumerable})),j.push.apply(j,O)}return j}function g(w){for(var M=1;M<arguments.length;M++){var j=arguments[M]!=null?arguments[M]:{};M%2?C(j,!0).forEach(function(O){U(w,O,j[O])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(j)):C(j).forEach(function(O){Object.defineProperty(w,O,Object.getOwnPropertyDescriptor(j,O))})}return w}function ee(w,M){if(w==null)return{};var j=H(w,M),O,$;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(w);for($=0;$<X.length;$++)O=X[$],!(M.indexOf(O)>=0)&&Object.prototype.propertyIsEnumerable.call(w,O)&&(j[O]=w[O])}return j}function H(w,M){if(w==null)return{};var j={},O=Object.keys(w),$,X;for(X=0;X<O.length;X++)$=O[X],!(M.indexOf($)>=0)&&(j[$]=w[$]);return j}function l(w,M){if(!(w instanceof M))throw new TypeError("Cannot call a class as a function")}function W(w,M){for(var j=0;j<M.length;j++){var O=M[j];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(w,O.key,O)}}function b(w,M,j){return M&&W(w.prototype,M),j&&W(w,j),w}function v(w,M){return M&&(q(M)==="object"||typeof M=="function")?M:E(w)}function _(w){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(j){return j.__proto__||Object.getPrototypeOf(j)},_(w)}function E(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function T(w,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(M&&M.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),M&&B(w,M)}function B(w,M){return B=Object.setPrototypeOf||function(O,$){return O.__proto__=$,O},B(w,M)}function U(w,M,j){return M in w?Object.defineProperty(w,M,{value:j,enumerable:!0,configurable:!0,writable:!0}):w[M]=j,w}var F=function(w){T(M,w);function M(){var j,O;l(this,M);for(var $=arguments.length,X=new Array($),Y=0;Y<$;Y++)X[Y]=arguments[Y];return O=v(this,(j=_(M)).call.apply(j,[this].concat(X))),U(E(O),"onClick",function(fe){var Ee=O.props,ae=Ee.text,Q=Ee.onCopy,I=Ee.children,A=Ee.options,R=K.default.Children.only(I),S=(0,ie.default)(ae,A);Q&&Q(ae,S),R&&R.props&&typeof R.props.onClick=="function"&&R.props.onClick(fe)}),O}return b(M,[{key:"render",value:function(){var O=this.props,$=O.text,X=O.onCopy,Y=O.options,fe=O.children,Ee=ee(O,["text","onCopy","options","children"]),ae=K.default.Children.only(fe);return K.default.cloneElement(ae,g({},Ee,{onClick:this.onClick}))}}]),M}(K.default.PureComponent);Re.CopyToClipboard=F,U(F,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(tt,Re,P){"use strict";var K=P(83145),ie=K.CopyToClipboard;ie.CopyToClipboard=ie,tt.exports=ie},76374:function(tt,Re,P){"use strict";var K=function(){if(typeof Map!="undefined")return Map;function I(A,R){var S=-1;return A.some(function(G,k){return G[0]===R?(S=k,!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(R){var S=I(this.__entries__,R),G=this.__entries__[S];return G&&G[1]},A.prototype.set=function(R,S){var G=I(this.__entries__,R);~G?this.__entries__[G][1]=S:this.__entries__.push([R,S])},A.prototype.delete=function(R){var S=this.__entries__,G=I(S,R);~G&&S.splice(G,1)},A.prototype.has=function(R){return!!~I(this.__entries__,R)},A.prototype.clear=function(){this.__entries__.splice(0)},A.prototype.forEach=function(R,S){S===void 0&&(S=null);for(var G=0,k=this.__entries__;G<k.length;G++){var p=k[G];R.call(S,p[1],p[0])}},A}()}(),ie=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,ce=function(){return typeof P.g!="undefined"&&P.g.Math===Math?P.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),q=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(ce):function(I){return setTimeout(function(){return I(Date.now())},1e3/60)}}(),C=2;function g(I,A){var R=!1,S=!1,G=0;function k(){R&&(R=!1,I()),S&&d()}function p(){q(k)}function d(){var N=Date.now();if(R){if(N-G<C)return;S=!0}else R=!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 I(){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 I.prototype.addObserver=function(A){~this.observers_.indexOf(A)||this.observers_.push(A),this.connected_||this.connect_()},I.prototype.removeObserver=function(A){var R=this.observers_,S=R.indexOf(A);~S&&R.splice(S,1),!R.length&&this.connected_&&this.disconnect_()},I.prototype.refresh=function(){var A=this.updateObservers_();A&&this.refresh()},I.prototype.updateObservers_=function(){var A=this.observers_.filter(function(R){return R.gatherActive(),R.hasActive()});return A.forEach(function(R){return R.broadcastActive()}),A.length>0},I.prototype.connect_=function(){!ie||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)},I.prototype.disconnect_=function(){!ie||!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)},I.prototype.onTransitionEnd_=function(A){var R=A.propertyName,S=R===void 0?"":R,G=H.some(function(k){return!!~S.indexOf(k)});G&&this.refresh()},I.getInstance=function(){return this.instance_||(this.instance_=new I),this.instance_},I.instance_=null,I}(),b=function(I,A){for(var R=0,S=Object.keys(A);R<S.length;R++){var G=S[R];Object.defineProperty(I,G,{value:A[G],enumerable:!1,writable:!1,configurable:!0})}return I},v=function(I){var A=I&&I.ownerDocument&&I.ownerDocument.defaultView;return A||ce},_=$(0,0,0,0);function E(I){return parseFloat(I)||0}function T(I){for(var A=[],R=1;R<arguments.length;R++)A[R-1]=arguments[R];return A.reduce(function(S,G){var k=I["border-"+G+"-width"];return S+E(k)},0)}function B(I){for(var A=["top","right","bottom","left"],R={},S=0,G=A;S<G.length;S++){var k=G[S],p=I["padding-"+k];R[k]=E(p)}return R}function U(I){var A=I.getBBox();return $(0,0,A.width,A.height)}function F(I){var A=I.clientWidth,R=I.clientHeight;if(!A&&!R)return _;var S=v(I).getComputedStyle(I),G=B(S),k=G.left+G.right,p=G.top+G.bottom,d=E(S.width),N=E(S.height);if(S.boxSizing==="border-box"&&(Math.round(d+k)!==A&&(d-=T(S,"left","right")+k),Math.round(N+p)!==R&&(N-=T(S,"top","bottom")+p)),!M(I)){var V=Math.round(d+k)-A,oe=Math.round(N+p)-R;Math.abs(V)!==1&&(d-=V),Math.abs(oe)!==1&&(N-=oe)}return $(G.left,G.top,d,N)}var w=function(){return typeof SVGGraphicsElement!="undefined"?function(I){return I instanceof v(I).SVGGraphicsElement}:function(I){return I instanceof v(I).SVGElement&&typeof I.getBBox=="function"}}();function M(I){return I===v(I).document.documentElement}function j(I){return ie?w(I)?U(I):F(I):_}function O(I){var A=I.x,R=I.y,S=I.width,G=I.height,k=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,p=Object.create(k.prototype);return b(p,{x:A,y:R,width:S,height:G,top:R,right:A+S,bottom:G+R,left:A}),p}function $(I,A,R,S){return{x:I,y:A,width:R,height:S}}var X=function(){function I(A){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=$(0,0,0,0),this.target=A}return I.prototype.isActive=function(){var A=j(this.target);return this.contentRect_=A,A.width!==this.broadcastWidth||A.height!==this.broadcastHeight},I.prototype.broadcastRect=function(){var A=this.contentRect_;return this.broadcastWidth=A.width,this.broadcastHeight=A.height,A},I}(),Y=function(){function I(A,R){var S=O(R);b(this,{target:A,contentRect:S})}return I}(),fe=function(){function I(A,R,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_=R,this.callbackCtx_=S}return I.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 R=this.observations_;R.has(A)||(R.set(A,new X(A)),this.controller_.addObserver(this),this.controller_.refresh())}},I.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 R=this.observations_;R.has(A)&&(R.delete(A),R.size||this.controller_.removeObserver(this))}},I.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},I.prototype.gatherActive=function(){var A=this;this.clearActive(),this.observations_.forEach(function(R){R.isActive()&&A.activeObservations_.push(R)})},I.prototype.broadcastActive=function(){if(this.hasActive()){var A=this.callbackCtx_,R=this.activeObservations_.map(function(S){return new Y(S.target,S.broadcastRect())});this.callback_.call(A,R,A),this.clearActive()}},I.prototype.clearActive=function(){this.activeObservations_.splice(0)},I.prototype.hasActive=function(){return this.activeObservations_.length>0},I}(),Ee=typeof WeakMap!="undefined"?new WeakMap:new K,ae=function(){function I(A){if(!(this instanceof I))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var R=W.getInstance(),S=new fe(A,R,this);Ee.set(this,S)}return I}();["observe","unobserve","disconnect"].forEach(function(I){ae.prototype[I]=function(){var A;return(A=Ee.get(this))[I].apply(A,arguments)}});var Q=function(){return typeof ce.ResizeObserver!="undefined"?ce.ResizeObserver:ae}();Re.Z=Q},98040:function(tt){tt.exports=function(){var Re=document.getSelection();if(!Re.rangeCount)return function(){};for(var P=document.activeElement,K=[],ie=0;ie<Re.rangeCount;ie++)K.push(Re.getRangeAt(ie));switch(P.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":P.blur();break;default:P=null;break}return Re.removeAllRanges(),function(){Re.type==="Caret"&&Re.removeAllRanges(),Re.rangeCount||K.forEach(function(ce){Re.addRange(ce)}),P&&P.focus()}}},46284:function(tt,Re,P){"use strict";P.d(Re,{ZP:function(){return vs}});const K=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},ie=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=ce},ce=Number.MAX_SAFE_INTEGER||9007199254740991;let q=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}({}),C=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 b(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 E(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_(Object(t),!0).forEach(function(i){b(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(){},w={trace:F,debug:F,log:F,warn:F,info:F,error:F};function M(){return v({},w)}function j(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):F}function O(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]=O(s,a,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.1`)}catch(s){return M()}n.forEach(s=>{$[s]=O(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 Ee(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 I={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 R={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 y=o.parseURL(c);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var x=n.exec(y.path);y.netLoc=x[1],y.path=x[2]}y.netLoc&&!y.path&&(y.path="/");var D={scheme:y.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(D.netLoc=y.netLoc,m.path[0]!=="/"))if(!m.path)D.path=y.path,m.params||(D.params=y.params,m.query||(D.query=y.query));else{var L=y.path,z=L.substring(0,L.lastIndexOf("/")+1)+m.path;D.path=o.normalizePath(z)}return D.path===null&&(D.path=h.alwaysNormalize?o.normalizePath(m.path):m.path),o.buildURLFromParts(D)},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})()}(R)),R.exports}var k=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=k.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 x=Fe(a,h);h+=4,e.push({referenceSize:m,subsegmentDuration:x,info:{duration:x/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)),y={soun:d.AUDIO,vide:d.VIDEO}[m],x=be(s,["mdia","minf","stbl","stsd"])[0],D=je(x);y?(e[c]={timescale:h,type:y,stsd:D},e[y]=E({timescale:h,id:c},D)):e[c]={timescale:h,type:m,stsd:D}}}}}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 y=ze(m.subarray(4,8));if(y==="cbcs"||y==="cenc"){const x=be(f,["frma"])[0];x&&(n=ze(x))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=be(t,["avcC"])[0];c&&c.length>3&&(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 y=u[h++];let x=(y&248)>>3;x===31&&(x+=1+((y&7)<<3)+((u[h]&224)>>5)),n+="."+x}break}case"hvc1":case"hev1":{const c=be(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],h=["","A","B","C"][u>>6],f=u&31,m=Fe(c,2),y=(u&32)>>5?"H":"L",x=c[12],D=c.subarray(6,12);n+="."+h+f,n+="."+m.toString(16).toUpperCase(),n+="."+y+x;let L="";for(let z=D.length;z--;){const te=D[z];(te||L)&&(L="."+te.toString(16).toUpperCase()+L)}n+=L}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];if(c&&c.length>6){const 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];if(c&&c.length>2){const u=c[1]>>>5,h=c[1]&31,f=c[2]>>>7?"H":"M",m=(c[2]&64)>>6,y=(c[2]&32)>>5,x=u===2&&m?y?12:10:m?10:8,D=(c[2]&16)>>4,L=(c[2]&8)>>3,z=(c[2]&4)>>2,te=c[2]&3;n+="."+u+"."+we(h)+f+"."+we(x)+"."+D+"."+L+z+te+"."+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 y=Ze(m);if(y){const x=y.subarray(8,24);x.some(D=>D!==0)||(Y.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${I.hexDump(x)} -> ${I.hexDump(t)}`),y.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,y=f/m;if(K(y)&&(o===null||y<o))return y}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 y=f==null?void 0:f.duration;m&8&&(m&2?y=Fe(c,12):y=Fe(c,8));const x=h.timescale||9e4,D=be(o,["trun"]);for(let L=0;L<D.length;L++){if(t=st(D[L]),!t&&y){const z=Fe(D[L],4);t=y*z}h.type===d.VIDEO?i+=t/x:h.type===d.AUDIO&&(n+=t/x)}}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((y,x)=>y+x.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)),y=Math.floor(f%(We+1));it(c,4,m),it(c,8,y)}}})})})}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(y=>{const x=y[0];let D=Fe(y,4);return x===1&&(D*=Math.pow(2,32),D+=Fe(y,8)),D/n})[0];return m!==void 0&&(a=m),be(f,["tfhd"]).map(y=>{const x=Fe(y,4),D=Fe(y,0)&16777215,L=(D&1)!==0,z=(D&2)!==0,te=(D&8)!==0;let J=0;const le=(D&16)!==0;let ue=0;const Se=(D&32)!==0;let he=8;x===s&&(L&&(he+=8),z&&(he+=4),te&&(J=Fe(y,he),he+=4),le&&(ue=Fe(y,he),he+=4),Se&&(he+=4),e.type==="video"&&(r=Ot(e.codec)),be(f,["trun"]).map(ye=>{const Ie=ye[0],ge=Fe(ye,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(ye,4);let Dt=8;$e&&(Ve=Fe(ye,Dt),Dt+=4),Xt&&(Dt+=4);let zt=Ve+u;for(let fi=0;fi<Pt;fi++){if(Lt?(vt=Fe(ye,Dt),Dt+=4):vt=J,et?(yt=Fe(ye,Dt),Dt+=4):yt=ue,ht&&(Dt+=4),Ge&&(Ie===0?He=Fe(ye,Dt):He=Wt(ye,Dt),Dt+=4),e.type===d.VIDEO){let bi=0;for(;bi<yt;){const Ri=Fe(i,zt);if(zt+=4,Mt(r,i[zt])){const An=i.subarray(zt,zt+Ri);Xe(An,r?2:1,a+He/n,t)}zt+=Ri,bi+=Ri+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 y=Fe(n,h);if(h+=4,y===1195456820){const x=n[h++];if(x===3){const D=n[h++],L=31&D,z=64&D,te=z?2+L*3:0,J=new Uint8Array(te);if(z){J[0]=D;for(let le=1;le<te;le++)J[le]=n[h++]}i.push({type:x,payloadType:r,pts:t,bytes:J})}}}}}else if(r===5&&o>16){const f=[];for(let x=0;x<16;x++){const D=n[h++].toString(16);f.push(D.length==1?"0"+D:D),(x===3||x===5||x===7||x===9)&&f.push("-")}const m=o-16,y=new Uint8Array(m);for(let x=0;x<m;x++)y[x]=n[h++];i.push({payloadType:r,pts:t,uuid:f.join(""),userData:Q(y),userDataBytes:y})}}}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,ie(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=I.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 ui={};function ai(a,e=!0){if(ui[a])return ui[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 ui[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 Li(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 Di(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 ci(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 y=e.groups[m];if(!y)throw new Error(`Audio track group ${m} not found`);Object.keys(y.channels).forEach(x=>{f[x]=(f[x]||0)+y.channels[x]})}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:E(E({},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=ci(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 Ci{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 Ei(this._audioGroups,e)}hasSubtitleGroup(e){return Ei(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 Ei(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 Mn(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,y=1/0,x=1/0,D=1/0,L=0,z=[];const{preferHDR:te,allowedVideoRanges:J}=Mn(e,n);for(let ye=s.length;ye--;){const Ie=a[s[ye]];h||(h=Ie.channels[2]>0),m=Math.min(m,Ie.minHeight),y=Math.min(y,Ie.minFramerate),x=Math.min(x,Ie.minBitrate),J.filter($e=>Ie.videoRanges[$e]>0).length>0&&(f=!0)}m=K(m)?m:0,y=K(y)?y:0;const le=Math.max(1080,m),ue=Math.max(30,y);x=K(x)?x:t,t=Math.max(x,t),f||(e=void 0);const Se=s.length>1;return{codecSet:s.reduce((ye,Ie)=>{const ge=a[Ie];if(Ie===ye)return ye;if(z=f?J.filter($e=>ge.videoRanges[$e]>0):[],Se){if(ge.minBitrate>t)return ii(Ie,`min bitrate of ${ge.minBitrate} > current estimate of ${t}`),ye;if(!ge.hasDefaultAudio)return ii(Ie,"no renditions with default or auto-select sound found"),ye;if(o&&Ie.indexOf(o.substring(0,4))%5!==0)return ii(Ie,`audio codec preference "${o}" not found`),ye;if(r&&!u){if(!ge.channels[r])return ii(Ie,`no renditions with ${r} channel sound found (channels options: ${Object.keys(ge.channels)})`),ye}else if((!o||u)&&h&&ge.channels[2]===0)return ii(Ie,"no renditions with stereo sound found"),ye;if(ge.minHeight>le)return ii(Ie,`min resolution of ${ge.minHeight} > maximum of ${le}`),ye;if(ge.minFramerate>ue)return ii(Ie,`min framerate of ${ge.minFramerate} > maximum of ${ue}`),ye;if(!z.some($e=>ge.videoRanges[$e]>0))return ii(Ie,`no variants with VIDEO-RANGE of ${Qt(z)} found`),ye;if(c&&Ie.indexOf(c.substring(0,4))%5!==0)return ii(Ie,`video codec preference "${c}" not found`),ye;if(ge.maxScore<L)return ii(Ie,`max score of ${ge.maxScore} < selected max of ${L}`),ye}return ye&&(St(Ie)>=St(ye)||ge.fragmentError>a[ye].fragmentError)?ye:(D=ge.minIndex,L=ge.maxScore,Ie)},void 0),videoRanges:z,preferHDR:te,minFramerate:y,minBitrate:x,minIndex:D}}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,y,x)=>{const D=y.uri;return(m[D]||(m[D]=[])).push(x),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 y=m.audioGroups,x=t.filter(D=>!y||y.indexOf(D.groupId)!==-1);return Ae(a,x,n)>-1});return f>-1?f:Tt(e,i,m=>{const y=m.audioGroups,x=t.filter(D=>!y||y.indexOf(D.groupId)!==-1);return Ae(a,x,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,y=r.minAutoLevel,x=n.level,D=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||x<=y){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const L=D>-1&&D!==x,z=!!t||L;if(!z&&(c.paused||!c.playbackRate||!c.readyState))return;const te=r.mainForwardBufferInfo;if(!z&&te===null)return;const J=this.bwEstimator.getEstimateTTFB(),le=Math.abs(c.playbackRate);if(m<=Math.max(J,1e3*(f/(le*2))))return;const ue=te?te.len/le:0,Se=h.loading.first?h.loading.first-h.loading.start:-1,he=h.loaded&&Se>-1,ye=this.getBwEstimate(),Ie=r.levels,ge=Ie[x],$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/ye));const Xt=he?h.loaded*1e3/Ve:0,Lt=J/1e3,vt=Xt?($e-h.loaded)/Xt:$e*8/ye+Lt;if(vt<=ue)return;const et=Xt?Xt*8:ye,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=x-1;He>y;He--){const fi=Ie[He].maxBitrate,bi=!Ie[He].details||yt;if(Ge=this.getTimeToLoadFrag(Lt,et,f*fi,bi),Ge<Math.min(ue,f+Lt))break}if(Ge>=vt||Ge>f*10)return;he?this.bwEstimator.sample(m-Math.min(J,Se),h.loaded):this.bwEstimator.sampleTTFB(m);const Pt=Ie[He].maxBitrate;this.getBwEstimate()*ht>Pt&&this.resetEstimator(Pt);const Dt=this.findBestLevel(Pt,y,He,0,ue,1,1);Dt>-1&&(He=Dt),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${x} is loading too slowly;
|
|
Fragment duration: ${n.duration.toFixed(3)}
|
|
Time to underbuffer: ${ue.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(ye)?ye|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>y){let bi=this.findBestLevel(this.hls.levels[y].bitrate,y,He,0,fi,1,1);bi===-1&&(bi=y),this.hls.nextLoadLevel=this.hls.nextAutoLevel=bi,this.resetEstimator(this.hls.levels[bi].bitrate)}}};L||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 C.BUFFER_ADD_CODEC_ERROR:case C.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case C.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 L=this.findBestLevel(c,r,n,u,0,h,f);if(L>=0)return this.rebufferNotice=-1,L}let m=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const L=this.bitrateTestDelay;L&&(m=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-L,this.info(`bitrate test took ${Math.round(1e3*L)}ms, set first fragment max fetchDuration to ${Math.round(1e3*m)} ms`),h=f=1)}const y=this.findBestLevel(c,r,n,u,m,h,f);if(this.rebufferNotice!==y&&(this.rebufferNotice=y,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${y}`)),y>-1)return y;const x=i.levels[r],D=i.loadLevelObj;return D&&(x==null?void 0:x.bitrate)<D.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:y}=this,{levels:x,allAudioTracks:D,loadLevel:L,config:z}=this.hls;if(x.length===1)return 0;const te=x[f],J=!!((c=this.hls.latestLevelDetails)!=null&&c.live),le=L===-1||h===-1;let ue,Se="SDR",he=(te==null?void 0:te.frameRate)||0;const{audioPreference:ye,videoPreference:Ie}=z,ge=this.audioTracksByGroup||(this.audioTracksByGroup=mt(D));let $e=-1;if(le){if(this.firstSelection!==-1)return this.firstSelection;const et=this.codecTiers||(this.codecTiers=pe(x,ge,t,i)),yt=ln(et,Se,e,ye,Ie),{codecSet:ht,videoRanges:Ge,minFramerate:He,minBitrate:Pt,minIndex:Dt,preferHDR:zt}=yt;$e=Dt,ue=ht,Se=zt?Ge[Ge.length-1]:Ge[0],he=He,e=Math.max(e,Pt),this.log(`picked start tier ${Qt(yt)}`)}else ue=te==null?void 0:te.codecSet,Se=te==null?void 0:te.videoRange;const Ve=y?y.duration:m?m.duration:0,Xt=this.bwEstimator.getEstimateTTFB()/1e3,Lt=[];for(let et=i;et>=t;et--){var vt;const yt=x[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,ye)||Ot(yt.videoCodec))?(yt.supportedPromise=fn(yt,ge,bi),yt.supportedPromise.then(Ri=>{if(!this.hls)return;yt.supportedResult=Ri;const An=this.hls.levels,On=An.indexOf(yt);Ri.error?this.warn(`MediaCapabilities decodingInfo error: "${Ri.error}" for level ${On} ${Qt(Ri)}`):Ri.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${On} ${Qt(Ri)}`),On>-1&&An.length>1&&(this.log(`Removing unsupported level ${On}`),this.hls.removeLevel(On),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):yt.supportedResult=qt}if((ue&&yt.codecSet!==ue||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=(y?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)||J&&!this.bitrateTestDelay||zt<u)){const bi=this.forcedAutoLevel;return et!==L&&(bi===-1||bi!==L)&&(Lt.length&&this.trace(`Skipped level(s) ${Lt.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${x[Lt[0]].codecs}" ${x[Lt[0]].videoRange}; not compatible with "${ue}" ${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:${L}`)),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 C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_TIMEOUT:case C.LEVEL_LOAD_TIMEOUT:case C.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 E(E({},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 C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case C.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=mi();return}case C.FRAG_GAP:case C.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ri.SendAlternateToPenaltyBox;return}case C.LEVEL_EMPTY_ERROR:case C.LEVEL_PARSING_ERROR:{var r,o;const u=t.parent===H.MAIN?t.level:n.loadLevel;t.details===C.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 C.LEVEL_LOAD_ERROR:case C.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case C.AUDIO_TRACK_LOAD_ERROR:case C.AUDIO_TRACK_LOAD_TIMEOUT:case C.SUBTITLE_LOAD_ERROR:case C.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 C.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 C.BUFFER_ADD_CODEC_ERROR:case C.REMUX_ALLOC_ERROR:case C.BUFFER_APPEND_ERROR:if(!t.errorAction){var c;t.errorAction=this.getLevelSwitchAction(t,(c=t.level)!=null?c:n.loadLevel)}return;case C.INTERNAL_EXCEPTION:case C.BUFFER_APPENDING_ERROR:case C.BUFFER_FULL_ERROR:case C.LEVEL_SWITCH_ERROR:case C.BUFFER_STALLED_ERROR:case C.BUFFER_SEEK_OVER_HOLE:case C.BUFFER_NUDGE_ON_STALL:t.errorAction=mi();return}t.type===q.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!==C.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===C.BUFFER_APPEND_ERROR&&n.fragmentError++;let h=-1;const{levels:f,loadLevel:m,minAutoLevel:y,maxAutoLevel:x}=i;i.autoLevelEnabled||(i.loadLevel=-1);const D=(s=e.frag)==null?void 0:s.type,z=(D===H.AUDIO&&u===C.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===C.BUFFER_ADD_CODEC_ERROR||u===C.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:Se})=>n.audioCodec!==Se),J=e.sourceBufferName==="video"&&(u===C.BUFFER_ADD_CODEC_ERROR||u===C.BUFFER_APPEND_ERROR)&&f.some(({codecSet:Se,audioCodec:he})=>n.codecSet!==Se&&n.audioCodec===he),{type:le,groupId:ue}=(r=e.context)!=null?r:{};for(let Se=f.length;Se--;){const he=(Se+m)%f.length;if(he!==m&&he>=y&&he<=x&&f[he].loadError===0){var o,c;const ye=f[he];if(u===C.FRAG_GAP&&D===H.MAIN&&e.frag){const Ie=f[he].details;if(Ie){const ge=Ye(e.frag,Ie.fragments,e.frag.start);if(ge!=null&&ge.gap)continue}}else{if(le===ee.AUDIO_TRACK&&ye.hasAudioGroup(ue)||le===ee.SUBTITLE_TRACK&&ye.hasSubtitleGroup(ue))continue;if(D===H.AUDIO&&(o=n.audioGroups)!=null&&o.some(Ie=>ye.hasAudioGroup(Ie))||D===H.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(Ie=>ye.hasSubtitleGroup(Ie))||z&&n.audioCodec===ye.audioCodec||!z&&n.audioCodec!==ye.audioCodec||J&&n.codecSet===ye.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!==C.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===C.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=ci(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 y=Math.max(r,n.start(h)),x=Math.min(o,n.end(h));x>y&&(s.partial=!0,s.time.push({startPTS:y,endPTS:x}))}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],y=new Uint32Array(256);let x=0,D=0,L=0;for(L=0;L<256;L++)L<128?y[L]=L<<1:y[L]=L<<1^283;for(L=0;L<256;L++){let z=D^D<<1^D<<2^D<<3^D<<4;z=z>>>8^z&255^99,e[x]=z,t[z]=x;const te=y[x],J=y[te],le=y[J];let ue=y[z]*257^z*16843008;n[x]=ue<<24|ue>>>8,s[x]=ue<<16|ue>>>16,r[x]=ue<<8|ue>>>24,o[x]=ue,ue=le*16843009^J*65537^te*257^x*16843008,u[z]=ue<<24|ue>>>8,h[z]=ue<<16|ue>>>16,f[z]=ue<<8|ue>>>24,m[z]=ue,x?(x=te^y[y[y[le^te]]],D^=y[y[D]]):x=D=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,y=this.invSubMix,x=y[0],D=y[1],L=y[2],z=y[3];let te,J;for(o=0;o<r;o++){if(o<s){te=u[o]=t[o];continue}J=te,o%s===0?(J=J<<8|J>>>24,J=f[J>>>24]<<24|f[J>>>16&255]<<16|f[J>>>8&255]<<8|f[J&255],J^=m[o/s|0]<<24):s>6&&o%s===4&&(J=f[J>>>24]<<24|f[J>>>16&255]<<16|f[J>>>8&255]<<8|f[J&255]),u[o]=te=(u[o-s]^J)>>>0}for(c=0;c<r;c++)o=r-c,c&3?J=u[o]:J=u[o-4],c<4||o<=4?h[c]=J:h[c]=x[f[J>>>24]]^D[f[J>>>16&255]]^L[f[J>>>8&255]]^z[f[J&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 y=m[0],x=m[1],D=m[2],L=m[3];const z=new Int32Array(e),te=new Int32Array(z.length);let J,le,ue,Se,he,ye,Ie,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],ye=Lt^s[1],Ie=Xt^s[2],ge=Ve^s[3],vt=4,et=1;et<n;et++)J=c[he>>>24]^u[ye>>16&255]^h[Ie>>8&255]^f[ge&255]^s[vt],le=c[ye>>>24]^u[Ie>>16&255]^h[ge>>8&255]^f[he&255]^s[vt+1],ue=c[Ie>>>24]^u[ge>>16&255]^h[he>>8&255]^f[ye&255]^s[vt+2],Se=c[ge>>>24]^u[he>>16&255]^h[ye>>8&255]^f[Ie&255]^s[vt+3],he=J,ye=le,Ie=ue,ge=Se,vt=vt+4;J=r[he>>>24]<<24^r[ye>>16&255]<<16^r[Ie>>8&255]<<8^r[ge&255]^s[vt],le=r[ye>>>24]<<24^r[Ie>>16&255]<<16^r[ge>>8&255]<<8^r[he&255]^s[vt+1],ue=r[Ie>>>24]<<24^r[ge>>16&255]<<16^r[he>>8&255]<<8^r[ye&255]^s[vt+2],Se=r[ge>>>24]<<24^r[he>>16&255]<<16^r[ye>>8&255]<<8^r[Ie&255]^s[vt+3],te[t]=yt(J^y),te[t+1]=yt(Se^x),te[t+2]=yt(ue^D),te[t+3]=yt(le^L),y=$e,x=Ve,D=Xt,L=Lt,t=t+4}return te.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=Pn(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Pn(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 bn=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%bn;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:q.NETWORK_ERROR,details:C.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(x=>x[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 y={onSuccess:(x,D,L,z)=>{this.resetLoader(e,u);let te=x.data;L.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(te.slice(0,16)),te=te.slice(16)),o({frag:e,part:null,payload:te,networkDetails:z})},onError:(x,D,L,z)=>{this.resetLoader(e,u),c(new Ui({type:q.NETWORK_ERROR,details:C.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:E({url:i,data:void 0},x),error:new Error(`HTTP Error ${x.code} ${x.text}`),networkDetails:L,stats:z}))},onAbort:(x,D,L)=>{this.resetLoader(e,u),c(new Ui({type:q.NETWORK_ERROR,details:C.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:L,stats:x}))},onTimeout:(x,D,L)=>{this.resetLoader(e,u),c(new Ui({type:q.NETWORK_ERROR,details:C.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${m.timeout}ms`),networkDetails:L,stats:x}))}};t&&(y.onProgress=(x,D,L,z)=>t({frag:e,part:null,payload:L,networkDetails:z})),u.load(h,m,y)})}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:(y,x,D,L)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const z={frag:e,part:t,payload:y.data,networkDetails:L};i(z),o(z)},onError:(y,x,D,L)=>{this.resetLoader(e,u),c(new Ui({type:q.NETWORK_ERROR,details:C.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:E({url:h.url,data:void 0},y),error:new Error(`HTTP Error ${y.code} ${y.text}`),networkDetails:D,stats:L}))},onAbort:(y,x,D)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new Ui({type:q.NETWORK_ERROR,details:C.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:D,stats:y}))},onTimeout:(y,x,D)=>{this.resetLoader(e,u),c(new Ui({type:q.NETWORK_ERROR,details:C.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${m.timeout}ms`),networkDetails:D,stats:y}))}})})}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:q.MEDIA_ERROR,details:C.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 xn=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ln(a){return xn.test(a)}function Sn(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(xn,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 Jn=/^(\d+)x(\d+)$/,Nn=/(.+?)=(".*?"|.*?)(?:,|$)/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=Jn.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(Nn.lastIndex=0;(i=Nn.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=Sn(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 os="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 qn{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===os}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 Fn=10;class Bn{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||Fn}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 Tn(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Oi(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function _n(a){const e=Oi(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=Tn(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 es={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function ts(a){if(a===es.WIDEVINE)return Yt.WIDEVINE;if(a===es.PLAYREADY)return Yt.PLAYREADY;if(a===es.CENC||a===es.CLEARKEY)return Yt.CLEARKEY}function Un(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 Pi(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 hi(a){var e;return a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license"))}function ls(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=Tn(o).subarray(0,16);return vn(c),c}}return null}let is={};class Zn{static clearKeyUriToKeyIdMap(){is={}}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=ds(e);return new Zn(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=ls(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=is[this.uri];if(!i){const n=Object.keys(is).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),is[this.uri]=i}this.keyId=i}return this}}function ds(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const tr=/#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,ir=/#EXT-X-MEDIA:(.*)/g,nr=/^#EXT(?:INF|-X-TARGETDURATION):/m,ps=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),kr=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 Dn{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 k.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return nr.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=[];tr.lastIndex=0;let r;for(;(r=tr.exec(e))!=null;)if(r[1]){var o;const u=new Zt(r[1],n),h=Sn(n,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Dn.resolve(h,t)},m=u.decimalResolution("RESOLUTION");m&&(f.width=m.width,f.height=m.height),Bs(u.CODECS,f);const y=u["SUPPLEMENTAL-CODECS"];y&&(f.supplemental={},Bs(y,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=Fs(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:Dn.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=rr(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(ir.lastIndex=0;(n=ir.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 y=u.LANGUAGE,x=u["ASSOC-LANGUAGE"],D=u.CHANNELS,L=u.CHARACTERISTICS,z=u["INSTREAM-ID"],te={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||y||"",type:h,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:y,url:u.URI?Dn.resolve(u.URI,t):""};if(x&&(te.assocLang=x),D&&(te.channels=D),L&&(te.characteristics=L),z&&(te.instreamId=z),f!=null&&f.length){const J=Dn.findGroup(f,te.groupId)||f[0];ar(te,J,"audioCodec"),ar(te,J,"textCodec")}m.push(te)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new Bn(t),h=u.fragments,f=[];let m=null,y=0,x=0,D=0,L=0,z=0,te=null,J=new oe(n,c),le,ue,Se,he=-1,ye=!1,Ie=null,ge;if(ps.lastIndex=0,u.m3u8=e,u.hasVariableRefs=Ln(e),((o=ps.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(le=ps.exec(e))!==null;){ye&&(ye=!1,J=new oe(n,c),J.playlistOffset=D,J.start=D,J.sn=y,J.cc=L,z&&(J.bitrate=z),J.level=i,m&&(J.initSegment=m,m.rawProgramDateTime&&(J.rawProgramDateTime=m.rawProgramDateTime,m.rawProgramDateTime=null),Ie&&(J.setByteRange(Ie),Ie=null)));const Lt=le[1];if(Lt){J.duration=parseFloat(Lt);const vt=(" "+le[2]).slice(1);J.title=vt||null,J.tagList.push(vt?["INF",Lt,vt]:["INF",Lt])}else if(le[3]){if(K(J.duration)){J.playlistOffset=D,J.start=D,Se&&ur(J,Se,u),J.sn=y,J.level=i,J.cc=L,h.push(J);const vt=(" "+le[3]).slice(1);J.relurl=Sn(u,vt),Us(J,te,f),te=J,D+=J.duration,y++,x=0,ye=!0}}else{if(le=le[0].match(kr),!le){Y.warn("No matches on slow regex match for level playlist!");continue}for(ue=1;ue<le.length&&le[ue]===void 0;ue++);const vt=(" "+le[ue]).slice(1),et=(" "+le[ue+1]).slice(1),yt=le[ue+2]?(" "+le[ue+2]).slice(1):null;switch(vt){case"BYTERANGE":te?J.setByteRange(et,te):J.setByteRange(et);break;case"PROGRAM-DATE-TIME":J.rawProgramDateTime=et,J.tagList.push(["PROGRAM-DATE-TIME",et]),he===-1&&(he=h.length);break;case"PLAYLIST-TYPE":u.type&&Yn(u,vt,le),u.type=et.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Yn(u,vt,le):h.length>0&&$s(u,vt,le),y=u.startSN=parseInt(et);break;case"SKIP":{u.skippedSegments&&Yn(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);y+=Ge}const He=ht.enumeratedString("RECENTLY-REMOVED-DATERANGES");He&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(He.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Yn(u,vt,le),u.targetduration=Math.max(parseInt(et),1);break;case"VERSION":u.version!==null&&Yn(u,vt,le),u.version=parseInt(et);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Yn(u,vt,le),u.live=!1;break;case"#":(et||yt)&&J.tagList.push(yt?[et,yt]:[et]);break;case"DISCONTINUITY":L++,J.tagList.push(["DIS"]);break;case"GAP":J.gap=!0,J.tagList.push([vt]);break;case"BITRATE":J.tagList.push([vt,et]),z=parseInt(et)*1e3,K(z)?J.bitrate=z:z=0;break;case"DATERANGE":{const ht=new Zt(et,u),Ge=new qn(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}"`),J.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?Yn(u,vt,le):h.length>0&&$s(u,vt,le),u.startCC=L=parseInt(et);break;case"KEY":{const ht=Fs(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=rr(et);break;case"MAP":{const ht=new Zt(et,u);if(J.duration){const Ge=new oe(n,c);lr(Ge,ht,i,Se),m=Ge,J.initSegment=m,m.rawProgramDateTime&&!J.rawProgramDateTime&&(J.rawProgramDateTime=m.rawProgramDateTime)}else{const Ge=J.byteRangeEndOffset;if(Ge){const He=J.byteRangeStartOffset;Ie=`${Ge-He}@${He}`}else Ie=null;lr(J,ht,i,Se),m=J,ye=!0}m.cc=L;break}case"SERVER-CONTROL":{ge&&Yn(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&&Yn(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=x>0?ht[ht.length-1]:void 0,He=x++,Pt=new Zt(et,u),Dt=new xe(Pt,J,c,He,Ge);ht.push(Dt),J.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}}}te&&!te.relurl?(h.pop(),D-=te.duration,u.partList&&(u.fragmentHint=te)):u.partList&&(Us(J,te,f),J.cc=L,u.fragmentHint=J,Se&&ur(J,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(D+=u.skippedSegments*u.targetduration,D>0&&$e&&Xt){u.averagetargetduration=D/$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&&(D+=u.fragmentHint.duration),u.totalduration=D,f.length&&u.dateRangeTagCount&&Ve&&ns(f,u),u.endCC=L,u}}function ns(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=sr(e,c,a,u,n);if(h!==-1){o.tagAnchor=e.fragments[h].ref;break}}}}function sr(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 y=m;y>u;y--){const x=h[y].programDateTime;if(e>=x&&e<x+h[y].duration*1e3)return y}}return u}}}return-1}function Fs(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?Dn.resolve(o,e):"",m=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Zn(r,f,h,m,c)}function rr(a){const t=new Zt(a).decimalFloatingPoint("TIME-OFFSET");return K(t)?t:null}function Bs(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 ar(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 Us(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function lr(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 ur(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 Yn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function $s(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function us(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 Is(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 L=Math.abs(u-t);K(e.deltaPTS)?e.deltaPTS=Math.max(L,e.deltaPTS):e.deltaPTS=L,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 y;const x=m-a.startSN,D=a.fragments;for(D[x]=e,y=x;y>0;y--)us(D[y],D[y-1]);for(y=x;y<D.length-1;y++)us(D[y],D[y+1]);return a.fragmentHint&&us(D[D.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,f}function Mr(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;cr(a,e,(c,u,h,f)=>{if(e.skippedSegments&&u.cc!==c.cc){const m=c.cc-u.cc;for(let y=h;y<f.length;y++)f[y].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=Nr(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&&Us(r[u],r[u-1],c);ns(c,e)}Fr(a.partList,e.partList,(c,u)=>{u.elementaryStreams=c.elementaryStreams,u.stats=c.stats}),n?Is(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):hr(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 Nr(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 qn(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 Fr(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 cr(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=Es(`media sequence mismatch ${f.sn}:`,a,e,h,f);return}else if(h.cc!==f.cc){e.playlistParsingError=Es(`discontinuity sequence mismatch (${h.cc}!=${f.cc})`,a,e,h,f);return}}}}function Es(a,e,t,i,n){return new Error(`${a} ${n.url}
|
|
Playlist starting @${e.startSN}
|
|
${e.m3u8}
|
|
|
|
Playlist starting @${t.startSN}
|
|
${t.m3u8}`)}function hr(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;Gs(e,r)}function Gs(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 fr(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 dr(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 pr(a,e,t){return a?gr(a.partList,e,t):null}function gr(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 mr(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 Br(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function Fi(a,e){if(a){const t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function yi(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)Fi(t[i],a);e.fragmentHint&&Fi(e.fragmentHint,a),e.alignedSliding=!0}function ki(a,e){a&&(yn(e,a),!e.alignedSliding&&a&&cn(e,a),!e.alignedSliding&&a&&!e.skippedSegments&&hr(a,e,!1))}function yn(a,e){if(!Br(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;yi(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);yi(u,a)}const Rs={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 Ks 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 y=r.maxFragLookUpTolerance,x=o.start-y,D=o.start+o.duration+y;if(!m.len||D<m.start||x>m.end){const L=f>D;(f<x||L)&&(L&&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 y=this.lastCurrentTime;if(f>y&&(this.lastCurrentTime=f),!this.loadingParts){const x=Math.max(m.end,f),D=this.shouldLoadParts(this.getLevelDetails(),x);D&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${x.toFixed(2)}`),this.loadingParts=D)}}!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:q.MEDIA_ERROR,details:C.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?Rs.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 y=f[m];e=this.fragCurrent=y.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${y.index} (${m}/${f.length-1}) of ${this.fragInfo(e,!1,y)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=y.start+y.duration,this.state=De.FRAG_LOADING;let x;return o?x=o.then(D=>!D||this.fragContextChanged(D.frag)?null:this.doFragPartsLoad(e,y,t,n)).catch(D=>this.handleFragLoadError(D)):x=this.doFragPartsLoad(e,y,t,n).catch(D=>this.handleFragLoadError(D)),this.hls.trigger(g.FRAG_LOADING,{frag:e,part:y,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):x}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 y=m.part;this.hls.trigger(g.FRAG_LOADED,m);const x=pr(i.details,e.sn,f.index+1)||gr(u,e.sn,f.index+1);if(x)h(x);else return s({frag:e,part:y,partsLoaded:c})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===C.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(g.ERROR,t)}else this.hls.trigger(g.ERROR,{type:q.OTHER_ERROR,details:C.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?pr(c,s,r):null,h=u?u.fragment:dr(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,y=this.hls.liveSyncPosition,x=c?(m!==-1&&m>=r?m:y)||c.start:e;this.log(`Setting startPosition to ${x} to match start frag at live edge. mainStart: ${m} liveSyncPosition: ${y} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=x}}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(Hs(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(Hs(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 y;const D=e<this.lastCurrentTime||e>t-u||(y=this.media)!=null&&y.paused||!this.startFragRequested?0:u;m=Ye(s,r,e,D)}else m=r[r.length-1];if(m){const x=m.sn-i.startSN,D=this.fragmentTracker.getState(m);if((D===Ft.OK||D===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[x+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){ki(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 x=this.getCurrentContext(t.chunkMeta);x&&(t.frag=x.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===C.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,y=f&&!r.resolved&&c===jt.MoveAllAlternatesMatchingHost;if(!m&&y&&V(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),r.resolved=!0;else if((m||y)&&u<h.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const x=Bt(h,u);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${u+1}/${h.maxNumRetry} in ${x}ms`),r.resolved=!0,this.retryDate=self.performance.now()+x,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:Is(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:q.MEDIA_ERROR,details:C.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 Hs(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Ws{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=xs(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function xs(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 Ss={exports:{}},_r;function Yo(){return _r||(_r=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 y=new n(h,f||c,m),x=t?t+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],y]:c._events[x].push(y):(c._events[x]=y,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,y=f.length,x=new Array(y);m<y;m++)x[m]=f[m].fn;return x},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,y,x){var D=t?t+u:u;if(!this._events[D])return!1;var L=this._events[D],z=arguments.length,te,J;if(L.fn){switch(L.once&&this.removeListener(u,L.fn,void 0,!0),z){case 1:return L.fn.call(L.context),!0;case 2:return L.fn.call(L.context,h),!0;case 3:return L.fn.call(L.context,h,f),!0;case 4:return L.fn.call(L.context,h,f,m),!0;case 5:return L.fn.call(L.context,h,f,m,y),!0;case 6:return L.fn.call(L.context,h,f,m,y,x),!0}for(J=1,te=new Array(z-1);J<z;J++)te[J-1]=arguments[J];L.fn.apply(L.context,te)}else{var le=L.length,ue;for(J=0;J<le;J++)switch(L[J].once&&this.removeListener(u,L[J].fn,void 0,!0),z){case 1:L[J].fn.call(L[J].context);break;case 2:L[J].fn.call(L[J].context,h);break;case 3:L[J].fn.call(L[J].context,h,f);break;case 4:L[J].fn.call(L[J].context,h,f,m);break;default:if(!te)for(ue=1,te=new Array(z-1);ue<z;ue++)te[ue-1]=arguments[ue];L[J].fn.apply(L[J].context,te)}}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 y=t?t+u:u;if(!this._events[y])return this;if(!h)return r(this,y),this;var x=this._events[y];if(x.fn)x.fn===h&&(!m||x.once)&&(!f||x.context===f)&&r(this,y);else{for(var D=0,L=[],z=x.length;D<z;D++)(x[D].fn!==h||m&&!x[D].once||f&&x[D].context!==f)&&L.push(x[D]);L.length?this._events[y]=L.length===1?L[0]:L:r(this,y)}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}(Ss)),Ss.exports}var Xo=Yo(),Ur=A(Xo);const js="1.6.1",Ls={};function Qo(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Jo(){const a=Ls[js];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 Ls[js]=n,n}function qo(a){const e=Ls[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 Ls[a]=n,n}function el(a){const e=Ls[a||js];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete Ls[a||js],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 vr(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 Vs(a,e){const t=e;let i=0;for(;$r(a,e);){i+=10;const n=vr(a,e+6);i+=n,xa(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function tl(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 y=new Error(`invalid ADTS sampling index:${r}`);a.emit(g.ERROR,g.ERROR,{type:q.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!0,error:y,reason:y.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 il(a,e){return e+5<a.length}function yr(a,e){return e+1<a.length&&Sa(a,e)}function nl(a,e){return il(a,e)&&Sa(a,e)&&Gr(a,e)<=a.length-e}function sl(a,e){if(yr(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||yr(a,n)}return!1}function Aa(a,e,t,i,n){if(!a.samplerate){const s=tl(e,t,i,n);if(!s)return;v(a,s)}}function wa(a){return 1024*9e4/a}function rl(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=rl(e,t);let c;if(o){const{frameLength:f,headerLength:m}=o,y=m+f,x=Math.max(0,t+y-e.length);x?(c=new Uint8Array(y-m),c.set(e.subarray(t+m,e.length),0)):c=e.subarray(t+m,t+y);const D={unit:c,pts:r};return x||a.samples.push(D),{sample:D,length:y,missing:x}}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 al(a,e){return $r(a,e)&&vr(a,e+6)+10<=a.length-e}function ol(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 ll(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 ul(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 cl(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 hl(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 fl(){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 dl(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 pl(a,e,t,Uint8Array)}function pl(a,e,t,i){const n=gl(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=ml(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 gl(a){return a instanceof ArrayBuffer?a:a.buffer}function ml(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function _l(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=dl(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function vl(a){return a.type==="PRIV"?ol(a):a.type[0]==="W"?ul(a):a.type==="APIC"?_l(a):ll(a)}function yl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=vr(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const Er=10,El=10;function La(a){let e=0;const t=[];for(;$r(a,e);){const i=vr(a,e+6);a[e+5]>>6&1&&(e+=Er),e+=Er;const n=e+i;for(;e+El<n;){const s=yl(a.subarray(e)),r=vl(s);r&&t.push(r),e+=s.size+Er}xa(a,e)&&(e+=Er)}return t}function Da(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function bl(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 bl(i)}}let kn=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 ss(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=Vs(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=xl(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:kn.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 al(e,n)?(i=Vs(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:kn.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:ss(),id3Track:o,textTrack:ss()}}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:ss(),id3Track:this._id3Track,textTrack:ss()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const xl=(a,e,t)=>{if(K(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let br=null;const Sl=[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],Tl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Al=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],wl=[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=Sl[c*14+n-1]*1e3,f=Tl[(t===3?0:t===2?1:2)*3+s],m=o===3?1:2,y=Al[t][i],x=wl[i],D=y*8*x,L=Math.floor(y*u/f+r)*x;if(br===null){const J=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);br=J?parseInt(J[1]):0}return!!br&&br<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:m,frameLength:L,samplesPerFrame:D}}}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 Il(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 Rl 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=Vs(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(sl(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return nl(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 Ll 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=Vs(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 y=(e[t+6]<<8|e[t+7])>>12-m&1,D=[2,1,2,3,3,4,4,5][f]+y,L=e[t+5]>>3,z=e[t+5]&7,te=new Uint8Array([s<<6|L<<1|z>>2,(z&3)<<6|f<<3|y<<2|c>>4,c<<4&224]),J=1536/o*9e4,le=i+n*J,ue=e.subarray(t,t+h);return a.config=te,a.channelCount=D,a.samplerate=o,a.samples.push({unit:ue,pts:le}),h}class Dl 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=Vs(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 Il(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Ca(e,t,i,this.basePTS,this.frameIndex)}}const Cl=/\/emsg[-/]ID3/i;class Ol{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=ss("video",1),r=this.audioTrack=ss("audio",1),o=this.txtTrack=ss("text",1);if(this.id3Track=ss("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:ss(),id3Track:n,textTrack:ss()}}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(Cl.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:kn.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:kn.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 Pl{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,y=0;for(s===-1&&(m=0,y=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 x={data:t.subarray(m,h),type:y};o.push(x)}else{const x=this.getLastNalUnit(e.samples);x&&(r&&c<=4-r&&x.state&&(x.data=x.data.subarray(0,x.data.byteLength-r)),h>0&&(x.data=ct(x.data,t.subarray(0,h)),x.state=0))}c<n?(f=this.getNALuType(t,c),m=c,y=f,s=0):s=-1}else s=0}if(m>=0&&s>=0){const x={data:t.subarray(m,n),type:y,state:s};o.push(x)}if(o.length===0){const x=this.getLastNalUnit(e.samples);x&&(x.data=ct(x.data,t))}return e.naluState=s,o}}class zs{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 D=!1;o=!0;const L=u.data;if(c&&L.length>4){const z=this.readSliceType(L);(z===2||z===4||z===7||z===9)&&(D=!0)}if(D){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=D;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 y,x;o=!0,c=!0;const D=u.data,L=this.readSPS(D);if(!e.sps||e.width!==L.width||e.height!==L.height||((y=e.pixelRatio)==null?void 0:y[0])!==L.pixelRatio[0]||((x=e.pixelRatio)==null?void 0:x[1])!==L.pixelRatio[1]){e.width=L.width,e.height=L.height,e.pixelRatio=L.pixelRatio,e.sps=[D];const z=D.subarray(1,4);let te="avc1.";for(let J=0;J<3;J++){let le=z[J].toString(16);le.length<2&&(le="0"+le),te+=le}e.codec=te}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 zs(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 zs(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),y=t.readBoolean.bind(t),x=t.skipBits.bind(t),D=t.skipEG.bind(t),L=t.skipUEG.bind(t),z=this.skipScalingList.bind(this);h();const te=h();if(f(5),x(3),h(),L(),te===100||te===110||te===122||te===244||te===44||te===83||te===86||te===118||te===128){const ye=m();if(ye===3&&x(1),L(),L(),x(1),y())for(c=ye!==3?8:12,u=0;u<c;u++)y()&&(u<6?z(16,t):z(64,t))}L();const J=m();if(J===0)m();else if(J===1)for(x(1),D(),D(),o=m(),u=0;u<o;u++)D();L(),x(1);const le=m(),ue=m(),Se=f(1);Se===0&&x(1),x(1),y()&&(i=m(),n=m(),s=m(),r=m());let he=[1,1];if(y()&&y())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)*(ue+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 y=this.readSPS(u.data);e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.codec=y.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const x in y.params)e.params[x]=y.params[x]}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 y=this.readPPS(u.data);for(const x in y)e.params[x]=y[x]}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 zs(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 zs(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(),y=t.readUByte(),x=t.readUByte(),D=t.readUByte(),L=t.readUByte(),z=t.readUByte(),te=[],J=[];for(let pi=0;pi<i;pi++)te.push(t.readBoolean()),J.push(t.readBoolean());if(i>0)for(let pi=i;pi<8;pi++)t.readBits(2);for(let pi=0;pi<i;pi++)te[pi]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),J[pi]&&t.readUByte();t.readUEG();const le=t.readUEG();le==3&&t.skipBits(1);const ue=t.readUEG(),Se=t.readUEG(),he=t.readBoolean();let ye=0,Ie=0,ge=0,$e=0;he&&(ye+=t.readUEG(),Ie+=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 En=0;En<4;En++)for(let Kn=0;Kn<(En===3?2:6);Kn++)if(!t.readBoolean())t.readUEG();else{const Qn=Math.min(64,1<<4+(En<<1));En>1&&t.readEG();for(let Ns=0;Ns<Qn;Ns++)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 En=!1;if(pi!==0&&(En=t.readBoolean()),En){pi===ht&&t.readUEG(),t.readBoolean(),t.readUEG();let Kn=0;for(let As=0;As<=Ge;As++){const Qn=t.readBoolean();let Ns=!1;Qn||(Ns=t.readBoolean()),(Qn||Ns)&&Kn++}Ge=Kn}else{const Kn=t.readUEG(),As=t.readUEG();Ge=Kn+As;for(let Qn=0;Qn<Kn;Qn++)t.readUEG(),t.readBoolean();for(let Qn=0;Qn<As;Qn++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const pi=t.readUEG();for(let En=0;En<pi;En++){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,Ri=0;t.readBoolean(),t.readBoolean();let An=!1;if(t.readBoolean()){if(t.readBoolean()){const ws=t.readUByte(),Ko=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Pr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];ws>0&&ws<16?(Dt=Ko[ws-1],zt=Pr[ws-1]):ws===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&&(ye+=t.readUEG(),Ie+=t.readUEG(),ge+=t.readUEG(),$e+=t.readUEG()),t.readBoolean()&&(bi=t.readBits(32),Ri=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Pr=t.readBoolean(),Ho=t.readBoolean();let qs=!1;(Pr||Ho)&&(qs=t.readBoolean(),qs&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),qs&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Wo=0;Wo<=i;Wo++){fi=t.readBoolean();const eh=fi||t.readBoolean();let jo=!1;eh?t.readEG():jo=t.readBoolean();const Vo=jo?1:t.readUEG()+1;if(Pr)for(let er=0;er<Vo;er++)t.readUEG(),t.readUEG(),qs&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Ho)for(let er=0;er<Vo;er++)t.readUEG(),t.readUEG(),qs&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Pt=t.readUEG())}let ys=ue,Go=Se;if(he||An){let pi=1,En=1;le===1?pi=En=2:le==2&&(pi=2),ys=ue-pi*Ie-pi*ye,Go=Se-En*$e-En*ge}const Jc=n?["A","B","C"][n]:"",qc=o<<24|c<<16|u<<8|h;let Ea=0;for(let pi=0;pi<32;pi++)Ea=(Ea|(qc>>pi&1)<<31-pi)>>>0;let ba=Ea.toString(16);return r===1&&ba==="2"&&(ba="6"),{codecString:`hvc1.${Jc}${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,y,x,D,L],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:Ri/bi}},width:ys,height:Go,pixelRatio:[Dt,zt]}}readPPS(e){const t=new zs(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 gs{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=gs.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=gs.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=gs.createTrack("audio",n),this._id3Track=gs.createTrack("id3"),this._txtTrack=gs.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,y=c.pid,x=o.pesData,D=c.pesData,L=null,z=this.pmtParsed,te=this._pmtId,J=e.length;if(this.remainderData&&(e=ct(this.remainderData,e),J=e.length,this.remainderData=null),J<hn&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const le=Math.max(0,gs.syncOffset(e));J-=(J-le)%hn,J<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,J,e.buffer.byteLength-J));let ue=0;for(let he=le;he<J;he+=hn)if(e[he]===71){const ye=!!(e[he+1]&64),Ie=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(Ie){case h:if(ye){if(f&&(s=Ds(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(ye){if(x&&(s=Ds(x,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}x={data:[],size:0}}x&&(x.data.push(e.subarray($e,he+hn)),x.size+=he+hn-$e);break;case y:ye&&(D&&(s=Ds(D,this.logger))&&this.parseID3PES(c,s),D={data:[],size:0}),D&&(D.data.push(e.subarray($e,he+hn)),D.size+=he+hn-$e);break;case 0:ye&&($e+=e[$e]+1),te=this._pmtId=kl(e,$e);break;case te:{ye&&($e+=e[$e]+1);const Ve=Ml(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),y=Ve.id3Pid,y>0&&(c.pid=y),L!==null&&!z&&(this.logger.warn(`MPEG-TS PMT found at ${he} after unknown PID '${L}'. Backtracking to sync byte @${le} to parse all TS packets.`),L=null,he=le-188),z=this.pmtParsed=!0;break}case 17:case 8191:break;default:L=Ie;break}}else ue++;ue>0&&zr(this.observer,new Error(`Found ${ue} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=x,c.pesData=D;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=Ds(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=Ds(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=Ds(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 Pl(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 y=m-f;n.sample.unit.set(s.subarray(0,f),y),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!yr(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&&!yr(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?kn.emsg:kn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Vr(a,e){return((a[e+1]&31)<<8)+a[e+2]}function kl(a,e){return(a[e+10]&31)<<8|a[e+11]}function Ml(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,y=f;for(;y>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 D=a[m+1]+2;m+=D,y-=D}}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:q.MEDIA_ERROR,details:C.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 Ds(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 y=0,x=c.length;y<x;y++){i=c[y];let D=i.byteLength;if(f)if(f>D){f-=D;continue}else i=i.subarray(f),D-=f,f=0;m.set(i,t),t+=D}return n&&(n-=s+3),{data:m,pts:r,dts:o,len:n}}return null}class Nl{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 ms=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/(ms+1)),n=Math.floor(t%(ms+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/(ms+1)),n=Math.floor(t%(ms+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/(ms+1)),o=Math.floor(i%(ms+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/(ms+1)),r=Math.floor(t%(ms+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 x=0;x<i.length;x+=1){r+=3;for(let D=0;D<i[x].length;D+=1)r+=2+i[x][D].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let x=0;x<i.length;x+=1){o.set(new Uint8Array([32+x|(x===c?128:0),0,i[x].length]),r),r+=3;for(let D=0;D<i[x].length;D+=1)o.set(new Uint8Array([i[x][D].length>>8,i[x][D].length&255]),r),r+=2,o.set(i[x][D],r),r+=i[x][D].length}const u=me.box(me.types.hvcC,o),h=e.width,f=e.height,m=e.pixelRatio[0],y=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,y>>24,y>>16&255,y>>8&255,y&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 Fl(a,e,t=1,i=!1){return Yr(a,e,1/t,i)}function Zs(a,e=!1){return Yr(a,1e3,1/Ga,e)}function Bl(a,e=1){return Yr(a,Ga,1/e)}const Ul=10*1e3,$l=1024,Gl=1152,Kl=1536;let Cs=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 xr{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,Cs===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Cs=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,y,x,D=s,L=s;const z=e.pid>-1,te=t.pid>-1,J=t.samples.length,le=e.samples.length>0,ue=o&&J>0||J>1;if((!z||le)&&(!te||ue)||this.ISGenerated||o){if(this.ISGenerated){var he,ye,Ie,ge;const Lt=this.videoTrackConfig;(Lt&&(t.width!==Lt.width||t.height!==Lt.height||((he=t.pixelRatio)==null?void 0:he[0])!==((ye=Lt.pixelRatio)==null?void 0:ye[0])||((Ie=t.pixelRatio)==null?void 0:Ie[1])!==((ge=Lt.pixelRatio)==null?void 0:ge[1]))||!Lt&&ue||this.nextAudioPts===null&&le)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const $e=this.isVideoContiguous;let Ve=-1,Xt;if(ue&&(Ve=Hl(t.samples),!$e&&this.config.forceKeyFrameOnDiscontinuity))if(x=!0,Ve>0){this.logger.warn(`[mp4-remuxer]: Dropped ${Ve} out of ${J} video samples due to a missing keyframe`);const Lt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Ve),t.dropped+=Ve,L+=(t.samples[0].pts-Lt)/t.inputTimeScale,Xt=L}else Ve===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${J} video samples`),x=!1);if(this.ISGenerated){if(le&&ue){const Lt=this.getVideoStartPts(t.samples),et=($n(e.samples[0].pts,Lt)-Lt)/t.inputTimeScale;D+=Math.max(0,et),L+=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,D,this.isAudioContiguous,r,te||ue||c===H.AUDIO?L:void 0),ue){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,L,$e,Lt)}}else ue&&(u=this.remuxVideo(t,L,$e,0));u&&(u.firstKeyFrame=Ve,u.independent=Ve!==-1,u.firstKeyFramePTS=Xt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(y=Ha(i,s,this._initPTS,this._initDTS)),n.samples.length&&(m=Wa(n,s,this._initPTS))),{audio:h,video:u,initSegment:f,independent:x,text:m,id3:y}}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,y,x;if(h&&(m=y=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&&(x=e.inputTimeScale,!u||x!==u.timescale?m=y=s[0].pts-Math.round(x*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(x=t.inputTimeScale,!u||x!==u.timescale){const D=this.getVideoStartPts(r),L=Math.round(x*i);y=Math.min(y,$n(r[0].dts,D)-L),m=Math.min(m,D-L)}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:x},this._initDTS={baseTime:y,timescale:x}):m=x=void 0,{tracks:c,initPTS:m,timescale:x}}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,y,x,D=Number.POSITIVE_INFINITY,L=Number.NEGATIVE_INFINITY,z=!1;if(!i||h===null){const Ge=t*s,He=r[0].pts-$n(r[0].dts,r[0].pts);Cs&&h!==null&&Math.abs(Ge-He-h)<15e3?i=!0:h=Ge-He}const te=u.baseTime*s/u.timescale;for(let Ge=0;Ge<c;Ge++){const He=r[Ge];He.pts=$n(He.pts-te,h),He.dts=$n(He.dts-te,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}),y=r[0].dts,x=r[r.length-1].dts;const J=x-y,le=J?Math.round(J/(c-1)):m||e.inputTimeScale/30;if(i){const Ge=y-h,He=Ge>le,Pt=Ge<-1;if((He||Pt)&&(He?this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Zs(Ge,!0)} ms (${Ge}dts) hole between fragments detected at ${t.toFixed(3)}`):this.logger.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Zs(-Ge,!0)} ms (${Ge}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Pt||h>=r[0].pts||Cs)){y=h;const Dt=r[0].pts-Ge;if(He)r[0].dts=y,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 Ri=r[fi+1].pts,An=r[fi].pts,On=Ri<=An,ys=Ri<=bi;zt=On==ys}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${Zs(Dt,!0)}/${Zs(y,!0)}, delta: ${Zs(Ge,!0)} ms`)}}y=Math.max(0,y);let ue=0,Se=0,he=y;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,ue+=Dt,He.length=zt,He.dts<he?(He.dts=he,he+=le/4|0||1):he=He.dts,D=Math.min(He.pts,D),L=Math.max(He.pts,L)}x=r[c-1].dts;const ye=Se+4*ue+8;let Ie;try{Ie=new Uint8Array(ye)}catch(Ge){this.observer.emit(g.ERROR,g.ERROR,{type:q.MUX_ERROR,details:C.REMUX_ALLOC_ERROR,fatal:!1,error:Ge,bytes:ye,reason:`fail allocating video mdat ${ye}`});return}const ge=new DataView(Ie.buffer);ge.setUint32(0,ye),Ie.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,Ri=Pt.length;bi<Ri;bi++){const An=Pt[bi],On=An.data,ys=An.data.byteLength;ge.setUint32(f,ys),f+=4,Ie.set(On,f),f+=ys,Dt+=4+ys}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,Ri=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),On=(n?D+n*s:this.nextAudioPts)-He.pts;On>An?(m=On-Ri,m<0?m=Ri:$e=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${On/90} ms to the next segment; using duration ${m/90} ms for the last video frame.`)):m=Ri}else m=Ri}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(Cs){if(Cs<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=y;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=x+m,this.videoSampleDuration=m,this.isVideoContiguous=!0;const ht={data1:me.moof(e.sequenceNumber++,y,v(e,{samples:o})),data2:Ie,startPTS:D/s,endPTS:(L+m)/s,startDTS:y/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 Gl;case"ac3":return Kl;default:return $l}}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,y=[],x=s!==void 0;let D=e.samples,L=m?0:8,z=this.nextAudioPts||-1;const te=t*r,J=f.baseTime*r/f.timescale;if(this.isAudioContiguous=i=i||D.length&&z>0&&(n&&Math.abs(te-z)<9e3||Math.abs($n(D[0].pts-J,te)-z)<20*h),D.forEach(function(et){et.pts=$n(et.pts-J,te)}),!i||z<0){if(D=D.filter(et=>et.pts>=0),!D.length)return;s===0?z=0:n&&!x?z=Math.max(0,te):z=D[0].pts}if(e.segmentCodec==="aac"){const et=this.config.maxAudioFramesDrift;for(let yt=0,ht=z;yt<D.length;yt++){const Ge=D[yt],He=Ge.pts,Pt=He-ht,Dt=Math.abs(1e3*Pt/r);if(Pt<=-et*h&&x)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<Ul&&x){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 Ri=Nl.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Ri||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ri=Ge.unit.subarray()),D.splice(yt,0,{unit:Ri,pts:bi}),ht+=h,yt++}}Ge.pts=ht,ht+=h}}let le=null,ue=null,Se,he=0,ye=D.length;for(;ye--;)he+=D[ye].unit.byteLength;for(let et=0,yt=D.length;et<yt;et++){const ht=D[et],Ge=ht.unit;let He=ht.pts;if(ue!==null){const Dt=y[et-1];Dt.duration=Math.round((He-ue)/c)}else if(i&&e.segmentCodec==="aac"&&(He=z),le=He,he>0){he+=L;try{Se=new Uint8Array(he)}catch(Dt){this.observer.emit(g.ERROR,g.ERROR,{type:q.MUX_ERROR,details:C.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,L);const Pt=Ge.byteLength;L+=Pt,y.push(Ka(!0,u,Pt,0)),ue=He}const Ie=y.length;if(!Ie)return;const ge=y[y.length-1];this.nextAudioPts=z=ue+c*ge.duration;const $e=m?new Uint8Array(0):me.moof(e.sequenceNumber++,le/c,v({},e,{samples:y}));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:Ie};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 Hl(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 Wl{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 y={initPTS:void 0,timescale:1};let x=this.initData;if((o=x)!=null&&o.length||(this.generateInitSegment(m),x=this.initData),!((c=x)!=null&&c.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(y.tracks=this.initTracks,this.emitInitSegment=!1);const D=pt(m,x),L=ot(x,m),z=L===null?s:L;(r||!u)&&(jl(u,z,s,D)||y.timescale!==u.timescale)&&(y.initPTS=z-s,u&&u.timescale===1&&this.logger.warn(`Adjusting initPTS @${s} from ${u.baseTime/u.timescale} to ${y.initPTS}`),this.initPTS=u={baseTime:y.initPTS,timescale:1});const te=e?z-u.baseTime/u.timescale:h,J=te+D;Rt(x,m,u.baseTime/u.timescale),D>0?this.lastEndTime=J:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const le=!!x.audio,ue=!!x.video;let Se="";le&&(Se+="audio"),ue&&(Se+="video");const he={data1:m,startPTS:te,startDTS:te,endPTS:J,endDTS:J,type:Se,hasAudio:le,hasVideo:ue,nb:1,dropped:0};return f.audio=he.type==="audio"?he:void 0,f.video=he.type!=="audio"?he:void 0,f.initSegment=y,f.id3=Ha(i,s,u,u),n.samples.length&&(f.text=Wa(n,s,u)),f}}function jl(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 Sr=[{demux:Ol,remux:Wl},{demux:gs,remux:xr},{demux:Rl,remux:xr},{demux:Dl,remux:xr}];Sr.splice(2,0,{demux:Ll,remux:xr});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:y,initSegmentChange:x}=n||o,{audioCodec:D,videoCodec:L,defaultInitPts:z,duration:te,initSegmentData:J}=c,le=Vl(r,t);if(le&&mn(le.method)){const ye=this.getDecrypter(),Ie=ji(le.method);if(ye.isSync()){let ge=ye.softwareDecrypt(r,le.key.buffer,le.iv.buffer,Ie);if(i.part>-1){const Ve=ye.flush();ge=Ve&&Ve.buffer}if(!ge)return s.executeEnd=cs(),Qr(i);r=new Uint8Array(ge)}else return this.asyncResult=!0,this.decryptionPromise=ye.webCryptoDecrypt(r,le.key.buffer,le.iv.buffer,Ie).then(ge=>{const $e=this.push(ge,null,i);return this.decryptionPromise=null,$e}),this.decryptionPromise}const ue=this.needsProbing(h,f);if(ue){const ye=this.configureTransmuxer(r);if(ye)return this.logger.warn(`[transmuxer] ${ye.message}`),this.observer.emit(g.ERROR,g.ERROR,{type:q.MEDIA_ERROR,details:C.FRAG_PARSING_ERROR,fatal:!1,error:ye,reason:ye.message}),s.executeEnd=cs(),Qr(i)}(h||f||x||ue)&&this.resetInitSegment(J,D,L,te,t),(h||x||ue)&&this.resetInitialTimestamp(z),u||this.resetContiguity();const Se=this.transmux(r,le,y,m,i);this.asyncResult=Ys(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 Ys(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=Sr.length;f<m;f++){var r;if((r=Sr[f].demux)!=null&&r.probe(e,this.logger)){s=Sr[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 Vl(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 Ys(a){return"then"in a&&a.then instanceof Function}class zl{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:q.OTHER_ERROR,details:C.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=Di(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||Qo()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=qo(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=Jo());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=Di(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),el(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:y,transmuxer:x}=this,D=r?r.start:s.start,L=s.decryptdata,z=this.frag,te=!(z&&s.cc===z.cc),J=!(z&&u.level===z.level),le=z?u.sn-z.sn:-1,ue=this.part?u.part-this.part.index:-1,Se=le===0&&u.id>1&&u.id===(z==null?void 0:z.stats.chunkCount),he=!J&&(le===1||le===0&&(ue===1||Se&&ue<=0)),ye=self.performance.now();(J||le||s.stats.parsing.start===0)&&(s.stats.parsing.start=ye),r&&(ue||!he)&&(r.stats.parsing.start=ye);const Ie=!(z&&((f=s.initSegment)==null?void 0:f.url)===((m=z.initSegment)==null?void 0:m.url)),ge=new Zl(te,he,c,J,D,Ie);if(!he||te||Ie){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: ${te}
|
|
trackSwitch: ${J}
|
|
contiguous: ${he}
|
|
accurateTimeOffset: ${c}
|
|
timeOffset: ${D}
|
|
initSegmentChange: ${Ie}`);const $e=new zl(i,n,t,o,h);this.configureTransmuxer($e)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:y,cmd:"demux",data:e,decryptdata:L,chunkMeta:u,state:ge},e instanceof ArrayBuffer?[e]:[]);else if(x){const $e=x.push(e,L,u,ge);Ys($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);Ys(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:q.MEDIA_ERROR,details:C.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 Yl extends Ks{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,y=c.fragments,x=y[0].start,D=this.getLoadPosition(),L=this.flushing?D:h.end;if(this.switchingTrack&&n){const J=D;c.PTSKnown&&J<x&&(h.end>x||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=x+.05)}if(f>=m&&!this.switchingTrack&&L<y[y.length-1].start)return;let z=this.getNextFragment(L,c);if(z&&this.isLoopLoading(z,L)&&(z=this.getNextFragmentLoopLoading(z,c,h,H.MAIN,m)),!z){this.bufferFlushed=!0;return}let te=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&te&&V(z)&&!z.endList&&(!c.live||!this.loadingParts&&L<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(te)===Ft.OK&&(this.mainFragLoading=te=null),te&&V(te))){if(z.start>te.end){const le=this.fragmentTracker.getFragAtPos(L,H.MAIN);le&&le.end>te.end&&(te=le,this.mainFragLoading={frag:le,targetBufferTime:null})}if(z.start>te.end)return}this.loadFragment(z,o,L)}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||(yn(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 y=this.initPTS[i.cc],x=(t=i.initSegment)==null?void 0:t.data;if(y!==void 0){const L=n?n.index:-1,z=L!==-1,te=new Wi(i.level,i.sn,i.stats.chunkCount,s.byteLength,L,z);m.push(s,x,f,"",i,n,h.totalduration,!1,te,y)}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:D}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Ws,complete:!1};D.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,E({},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 C.FRAG_GAP:case C.FRAG_PARSING_ERROR:case C.FRAG_DECRYPT_ERROR:case C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(H.AUDIO,t);break;case C.AUDIO_TRACK_LOAD_ERROR:case C.AUDIO_TRACK_LOAD_TIMEOUT:case C.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 C.BUFFER_ADD_CODEC_ERROR:case C.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case C.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case C.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:y,id3:x,initSegment:D}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=De.PARSING,this.switchingTrack&&m&&this.completeAudioSwitch(this.switchingTrack),D!=null&&D.tracks){const L=c.initSegment||c;this._bufferInitSegment(h,D.tracks,L,r),n.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:L,id:i,tracks:D.tracks})}if(m){const{startPTS:L,endPTS:z,startDTS:te,endDTS:J}=m;u&&(u.elementaryStreams[d.AUDIO]={startPTS:L,endPTS:z,startDTS:te,endDTS:J}),c.setElementaryStreamInfo(d.AUDIO,L,z,te,J),this.bufferFragmentData(m,c,u,r)}if(x!=null&&(t=x.samples)!=null&&t.length){const L=v({id:i,frag:c,details:f},x);n.trigger(g.FRAG_PARSING_METADATA,L)}if(y){const L=v({id:i,frag:c,details:f},y);n.trigger(g.FRAG_PARSING_USERDATA,L)}}_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,E({},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 Ci(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){Mr(i,n);const te=n.playlistParsingError;if(te){this.warn(te);const J=this.hls;if(!J.config.ignorePlaylistParsingErrors){var u;const{networkDetails:le}=t;J.trigger(g.ERROR,{type:q.NETWORK_ERROR,details:C.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:te,reason:te.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,y=(n.edge-m)*1e3,x=fr(n,y);if(n.requestScheduled+x<r?n.requestScheduled=r:n.requestScheduled+=x,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let D,L,z;if(n.canBlockReload&&n.endSN&&n.advanced){const te=this.hls.config.lowLatencyMode,J=n.lastPartSn,le=n.endSN,ue=n.lastPartIndex,Se=ue!==-1,he=J===le;Se?he?(L=le+1,z=te?0:ue):(L=J,z=te?ue+1:n.maxPartIndex):L=le+1;const ye=n.age,Ie=ye+n.ageHeader;let ge=Math.min(Ie-n.partTarget,n.targetduration*1.5);if(ge>0){if(Ie>n.targetduration*3)this.log(`Playlist last advanced ${ye.toFixed(2)}s ago. Omitting segment and part directives.`),L=void 0,z=void 0;else if(i!=null&&i.tuneInGoal&&Ie-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(L+=$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 ${ye.toFixed(2)}s goal: ${ge} skip sn ${$e} to part ${z}`)}n.tuneInGoal=ge}if(D=this.getDeliveryDirectives(n,t.deliveryDirectives,L,z),te||!he){n.requestScheduled=r,this.loadingPlaylist(h,D);return}}else(n.canBlockReload||n.canSkipUntil)&&(D=this.getDeliveryDirectives(n,t.deliveryDirectives,L,z));D&&L!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(x-o*2,x/2)),this.scheduleLoading(h,D,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 Ci(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(!Xs(a[t].attrs,e[t].attrs))return!1;return!0}function Xs(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 Xl 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,y)=>{m.id=y});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 y=Ae(c,this.tracks);s=this.tracks[y]}}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:q.MEDIA_ERROR,details:C.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,E({},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(Xs(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const h=t[u];if(Xs(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 Ql{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 Jl extends Error{constructor(e){super(e),this.name=Ja}}class ql 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=Ee(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),eu(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,y=h.id;if(m.hasFragments(y)||m.hasParts(y)){const L=_t.getBuffered(f);m.detectEvictedFragments(u,L,y,null,!0)}const x=ea(u),D=[u,f];this.sourceBuffers[x]=D,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 Ql(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:y,levelCodec:x,container:D,metadata:L,supplemental:z}=f;let te=i[o];const J=(c=this.transferData)==null||(u=c.tracks)==null?void 0:u[o],le=J!=null&&J.buffer?J:te,ue=(le==null?void 0:le.pendingCodec)||(le==null?void 0:le.codec),Se=le==null?void 0:le.levelCodec;te||(te=i[o]={buffer:void 0,listeners:[],codec:y,supplemental:z,container:D,levelCodec:x,metadata:L,id:m});const he=Mi(ue,Se),ye=he==null?void 0:he.replace(Qa,"$1");let Ie=Mi(y,x);const ge=(h=Ie)==null?void 0:h.replace(Qa,"$1");Ie&&he&&ye!==ge&&(o.slice(0,5)==="audio"&&(Ie=$t(Ie,this.appendSource)),this.log(`switching codec ${ue} to ${Ie}`),Ie!==(te.pendingCodec||te.codec)&&(te.pendingCodec=Ie),te.container=D,this.appendChangeType(o,D,Ie))}),(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 y=o.stats.buffering,x=c?c.stats.buffering:null;y.start===0&&(y.start=m),x&&x.start===0&&(x.start=m);const D=i.audio;let L=!1;s==="audio"&&(D==null?void 0:D.container)==="audio/mpeg"&&(L=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const z=this.tracks.video,te=z==null?void 0:z.buffer;if(te&&f!=="initSegment"){const ue=c||o,Se=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend){const ye=ue.start+ue.duration*.05,Ie=te.buffered,ge=this.currentOp("video");!Ie.length&&!ge?this.blockAudio(ue):!ge&&!_t.isBuffered(te,ye)&&this.lastVideoAppendEnd<ye&&this.blockAudio(ue)}else if(s==="video"){const he=ue.end;if(Se){const ye=Se.frag.start;(he>ye||he<this.lastVideoAppendEnd||_t.isBuffered(te,ye))&&this.unblockAudio()}this.lastVideoAppendEnd=he}}const J=(c||o).start,le={label:`append-${s}`,execute:()=>{if(h.executeStart=self.performance.now(),L){const ue=this.tracks[s];if(ue){const Se=ue.buffer;if(Se){const he=J-Se.timestampOffset;Math.abs(he)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${J} (delta: ${he}) sn: ${f})`),Se.timestampOffset=J)}}}this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const ue=self.performance.now();h.executeEnd=h.end=ue,y.first===0&&(y.first=ue),x&&x.first===0&&(x.first=ue);const Se={};this.sourceBuffers.forEach(([he,ye])=>{he&&(Se[he]=_t.getBuffered(ye))}),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:ue=>{var Se;const he={type:q.MEDIA_ERROR,parent:o.type,details:C.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:ue,err:ue,fatal:!1},ye=(Se=this.media)==null?void 0:Se.error;if(ue.code===DOMException.QUOTA_EXCEEDED_ERR)he.details=C.BUFFER_FULL_ERROR;else if(ue.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!ye)he.errorAction=mi(!0);else if(ue.name===Ja&&this.sourceBufferCount===0)he.errorAction=mi(!0);else{const Ie=++this.appendErrors[s];this.warn(`Failed ${Ie}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${ye||"no media error"})`),(Ie>=this.hls.config.appendErrorMaxRetry||ye)&&(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).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t,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===C.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:q.MEDIA_ERROR,details:C.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:q.MEDIA_ERROR,details:C.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:q.MEDIA_ERROR,details:C.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 Jl(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(r=>this.appendBlocker(r));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(r=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}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 eu(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 Cn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},tu={HLS:"h"},Qs={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},iu={[Qs.OBJECT]:["br","d","ot","tb"],[Qs.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Qs.SESSION]:["cid","pr","sf","sid","st","v"],[Qs.STATUS]:["bs","rtp"]};class Os{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Os?i:new Os(i))),this.value=e,this.params=t}}const nu="Dict";function su(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 ru(a,e,t,i){return new Error(`failed to ${a} "${su(e)}" as ${t}`,{cause:i})}function rs(a,e,t){return ru("serialize",a,e,t)}class eo{constructor(e){this.description=e}}const to="Bare Item",au="Boolean";function ou(a){if(typeof a!="boolean")throw rs(a,au);return a?"?1":"?0"}const lu="Byte Sequence";function uu(a){if(ArrayBuffer.isView(a)===!1)throw rs(a,lu);return`:${cl(a)}:`}const cu="Integer";function hu(a){return a<-999999999999999||999999999999999<a}function io(a){if(hu(a))throw rs(a,cu);return a.toString()}function fu(a){return`@${io(a.getTime()/1e3)}`}const du="Decimal";function pu(a){const e=Ra(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw rs(a,du);const t=e.toString();return t.includes(".")?t:`${t}.0`}const gu="String",mu=/[\x00-\x1f\x7f]+/;function _u(a){if(mu.test(a))throw rs(a,gu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function vu(a){return a.description||a.toString().slice(7,-1)}const yu="Token";function no(a){const e=vu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw rs(e,yu);return e}function ia(a){switch(typeof a){case"number":if(!K(a))throw rs(a,to);return Number.isInteger(a)?io(a):pu(a);case"string":return _u(a);case"symbol":return no(a);case"boolean":return ou(a);case"object":if(a instanceof Date)return fu(a);if(a instanceof Uint8Array)return uu(a);if(a instanceof eo)return no(a);default:throw rs(a,to)}}const Eu="Key";function na(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw rs(a,Eu);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 Os?`${ia(a.value)}${sa(a.params)}`:ia(a)}function bu(a){return`(${a.value.map(so).join(" ")})${sa(a.params)}`}function xu(a,e={whitespace:!0}){if(typeof a!="object")throw rs(a,nu);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof Os||(s=new Os(s));let r=na(n);return s.value===!0?r+=sa(s.params):(r+="=",Array.isArray(s.value)?r+=bu(s):r+=so(s)),r}).join(`,${i}`)}function Su(a,e){return xu(a,e)}function Tu(a){return a==="ot"||a==="sf"||a==="st"}function Au(a){return typeof a=="number"?K(a):a!=null&&a!==""&&a!==!1}const Tr=a=>Math.round(a),wu=(a,e)=>(e!=null&&e.baseUrl&&(a=hl(a,e.baseUrl)),encodeURIComponent(a)),Ar=a=>Tr(a/100)*100,Iu={br:Tr,d:Tr,bl:Ar,dl:Ar,mtp:Ar,nor:wu,rtp:Ar,tb:Tr};function Ru(a,e){const t={};if(a==null||typeof a!="object")return t;const i=Object.keys(a).sort(),n=v({},Iu,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||Au(o)&&(Tu(r)&&typeof o=="string"&&(o=new eo(o)),t[r]=o))}),t}function ro(a,e={}){return a?Su(Ru(a,e),v({whitespace:!1},e)):""}function Lu(a,e={}){const t={};if(!a)return t;const i=Object.entries(a),n=Object.entries(iu).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(y=>y[1].includes(h)))===null||c===void 0?void 0:c[0])||Qs.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 Du(a,e,t){return v(a,Lu(e,t))}const Cu="CMCD";function Ou(a,e={}){if(!a)return"";const t=ro(a,e);return`${Cu}=${encodeURIComponent(t)}`}const ao=/CMCD=[^&#]+/;function Pu(a,e,t){const i=Ou(e,t);if(!i)return a;if(ao.test(a))return a.replace(ao,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class ku{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:Cn.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===Cn.VIDEO||c===Cn.AUDIO||c==Cn.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:tu.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===Cn.INIT||t.ot===Cn.VIDEO||t.ot===Cn.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={}),Du(e.headers,t,s)):e.url=Pu(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 Cn.TIMED_TEXT;if(e.sn==="initSegment")return Cn.INIT;if(t==="audio")return Cn.AUDIO;if(t==="main")return this.hls.audioTracks.length?Cn.VIDEO:Cn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Cn.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===Cn.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 Mu=3e5;class Nu 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]>Mu&&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,mr(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}`,y=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;m&&(i[f.AUDIO]=m,f.AUDIO=m),y&&(n[f.SUBTITLES]=y,f.SUBTITLES=y);const x=lo(h.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),D=new on({attrs:f,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:x,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let L=1;L<h.audioGroups.length;L++)D.addGroupId("audio",`${h.audioGroups[L]}_clone_${r}`);if(h.subtitleGroups)for(let L=1;L<h.subtitleGroups.length;L++)D.addGroupId("text",`${h.subtitleGroups[L]}_clone_${r}`);return D});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,y)=>{this.log(`Loaded steering manifest: "${n}"`);const x=h.data;if((x==null?void 0:x.VERSION)!==1){this.log(`Steering VERSION ${x.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=x.TTL;const{"RELOAD-URI":D,"PATHWAY-CLONES":L,"PATHWAY-PRIORITY":z}=x;if(D)try{this.uri=new self.URL(D,n).href}catch(J){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${D}`);return}this.scheduleRefresh(this.uri||m.url),L&&this.clonePathways(L);const te={steeringManifest:x,url:n.toString()};this.hls.trigger(g.STEERING_MANIFEST_LOADED,te),z&&this.updatePathwayPriority(z)},onError:(h,f,m,y)=>{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 x=this.timeToLoad*1e3;if(h.code===429){const D=this.loader;if(typeof(D==null?void 0:D.getResponseHeader)=="function"){const L=D.getResponseHeader("Retry-After");L&&(x=parseFloat(L)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,x)},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 Ps 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=Ps.CDMCleanupPromise?[Ps.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(Un).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 x=ze(new Uint8Array(n));try{const D=Tn(JSON.parse(x).sinf),L=Ze(D);if(!L)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(L.subarray(8,24)),u=Yt.FAIRPLAY}catch(D){this.warn(`${s} Failed to parse sinf: ${D}`);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 x=Ke(n),D=x.filter(z=>!!z.systemId&&ts(z.systemId)===o);D.length>1&&this.warn(`${s} Using first of ${D.length} pssh found for selected key-system ${o}`);const L=D[0];if(!L){x.length===0||x.some(z=>!z.systemId)?this.warn(`${s} contains incomplete or invalid pssh data`):this.log(`ignoring ${s} for ${x.map(z=>ts(z.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(u=ts(L.systemId),L.version===0&&L.data)if(u===Yt.WIDEVINE){const z=L.data.length-22;c=new Uint8Array(L.data.subarray(z,z+16))}else u===Yt.PLAYREADY&&(c=ls(L.data))}if(!u||!c)return;const h=I.hexDump(c),{keyIdToKeySessionPromise:f,mediaKeySessions:m}=this;let y=f[h];for(let x=0;x<m.length;x++){const D=m[x],L=D.decryptdata;if(!L.keyId)continue;const z=I.hexDump(L.keyId);if(h===z||L.uri.replace(/-/g,"").indexOf(h)!==-1){if(y=f[z],L.pssh)break;delete f[z],L.pssh=new Uint8Array(n),L.keyId=c,y=f[h]=y.then(()=>this.generateRequestWithPreferredKeySession(D,i,n,"encrypted-event-key-match")),y.catch(te=>this.handleError(te));break}}if(!y){if(u!==o){this.log(`Ignoring "${t.type}" event with ${u} init data for selected key-system ${o}`);return}y=f[h]=this.getKeySystemSelectionPromise([u]).then(({keySystem:x,mediaKeys:D})=>{var L;this.throwIfDestroyed();const z=new Zn("ISO-23001-7",h,(L=Un(x))!=null?L:"");return z.pssh=new Uint8Array(n),z.keyId=c,this.attemptSetMediaKeys(x,D).then(()=>{this.throwIfDestroyed();const te=this.createMediaKeySessionContext({decryptdata:z,keySystem:x,mediaKeys:D});return this.generateRequestWithPreferredKeySession(te,i,n,"encrypted-event-no-match")})}),y.catch(x=>this.handleError(x))}})}},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:q.KEY_SYSTEM_ERROR,details:C.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=Pi(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: ${I.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 I.hexDump(e.keyId)}updateKeySession(e,t){var i;const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${I.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=Un(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:q.KEY_SYSTEM_ERROR,details:C.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:q.KEY_SYSTEM_ERROR,details:C.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 x=o.call(this.hls,t,i,e);if(!x)throw new Error("Invalid response from configured generateRequest filter");t=x.initDataType,i=x.initData?x.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(x){var c;if(this.warn(x.message),(c=this.hls)!=null&&c.config.debug)throw x}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=x=>{const D=e.mediaKeysSession;if(!D){h.emit("error",new Error("invalid state"));return}const{messageType:L,message:z}=x;this.log(`"${L}" message event for session "${D.sessionId}" message size: ${z.byteLength}`),L==="license-request"||L==="license-renewal"?this.renewLicense(e,z).catch(te=>{h.eventNames().length?h.emit("error",te):this.handleError(te)}):L==="license-release"?e.keySystem===Yt.FAIRPLAY&&(this.updateKeySession(e,Oi("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${L}"`)},m=e._onkeystatuseschange=x=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const L=e.keyStatus;h.emit("keyStatus",L),L==="expired"&&(this.warn(`${e.keySystem} expired for key ${u}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",f),e.mediaKeysSession.addEventListener("keystatuseschange",m);const y=new Promise((x,D)=>{h.on("error",D),h.on("keyStatus",L=>{L.startsWith("usable")?x():L==="output-restricted"?D(new Gn({type:q.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):L==="internal-error"?D(new Gn({type:q.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${L}"`)):L==="expired"?D(new Error("key expired while generating request")):this.warn(`unhandled key status change "${L}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var x;this.log(`Request generated for key-session "${(x=e.mediaKeysSession)==null?void 0:x.sessionId}" keyId: ${u}`)}).catch(x=>{throw new Gn({type:q.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_NO_SESSION,error:x,fatal:!1},`Error generating key-session request: ${x}`)}).then(()=>y).catch(x=>{throw h.removeAllListeners(),this.removeSession(e),x}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{if(typeof i=="string"&&typeof t=="object"){const n=i;i=t,t=n}this.log(`key status change "${t}" for keyStatuses keyId: ${I.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${I.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,y,x,D)=>{r(m.data)},onError:(m,y,x,D)=>{o(new Gn({type:q.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:x,response:E({url:c.url,data:void 0},m)},`"${e}" certificate request failed (${s}). Status: ${m.code} (${m.text})`))},onTimeout:(m,y,x)=>{o(new Gn({type:q.KEY_SYSTEM_ERROR,details:C.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:x,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(m,y,x)=>{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:q.KEY_SYSTEM_ERROR,details:C.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:q.KEY_SYSTEM_ERROR,details:C.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 y=(r=h.querySelector("name"))==null?void 0:r.textContent,x=(o=h.querySelector("value"))==null?void 0:o.textContent;y&&x&&e.setRequestHeader(y,x)}}const c=n.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return Oi(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:q.KEY_SYSTEM_ERROR,details:C.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={},Zn.clearKeyUriToKeyIdMap();const n=i.length;Ps.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:q.OTHER_ERROR,details:C.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:q.OTHER_ERROR,details:C.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);n>-1&&this.mediaKeySessions.splice(n,1);const{drmSystemOptions:s}=this.config;return(hi(s)?new Promise((o,c)=>{self.setTimeout(()=>c(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(o)}):Promise.resolve()).catch(o=>{var c;this.log(`Could not remove session: ${o}`),(c=this.hls)==null||c.trigger(g.ERROR,{type:q.OTHER_ERROR,details:C.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${o}`)})}).then(()=>t.close()).catch(o=>{var c;this.log(`Could not close session: ${o}`),(c=this.hls)==null||c.trigger(g.ERROR,{type:q.OTHER_ERROR,details:C.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}}}Ps.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 Fu{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 ks(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=Uu(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 Bu(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 Uu(a,e,t){const i=[],n=Bu(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 wr(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 $u 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=wr(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;wr(i.textTracks).forEach(r=>{ks(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(Xs(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(Xs(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=wr(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 Js(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const Ms=.025;let Ir=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Gu(a,e,t){return`${a.identifier}-${t+1}-${Js(e)}`}class Ku{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)<Ms))}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"?Ir.Range:Ir.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 Hu(this)}}function aa(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<Ms)?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 Hu(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 Wu{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 ju 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,y=h.cue.pre,x=h.cue.post;if(f&&!y)return-1;if(y&&!f||m&&!x)return 1;if(x&&!m)return-1;if(!f&&!y&&!m&&!x){const D=u.startTime,L=h.startTime;if(D!==L)return D-L}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 Ku(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,y=h.cue.post,x=e[f-1]||null,D=h.appendInPlace,L=y?s:h.startOffset,z=h.duration,te=h.timelineOccupancy===Ir.Range?z:0,J=h.resumptionOffset,le=(x==null?void 0:x.startTime)===L,ue=L+h.cumulativeDuration;let Se=D?ue+z:L+J;if(m||!y&&L<=0){const ye=u;u+=te,h.timelineStart=ue;const Ie=r;r+=z,i.push({event:h,start:ue,end:Se,playout:{start:Ie,end:r},integrated:{start:ye,end:u}})}else if(L<=s){if(!le){const ge=L-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&&x&&(x.cumulativeDuration+=ge,i[i.length-1].end=L)}y&&(Se=ue),h.timelineStart=ue;const ye=u;u+=te;const Ie=r;r+=z,i.push({event:h,start:ue,end:Se,playout:{start:Ie,end:r},integrated:{start:ye,end:u}})}else return;const he=h.resumeTime;y||he>s?c=s:c=he}),c<s){var o;const h=c,f=u,m=s-c;u+=m;const y=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:y,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 y=K(o.resumeOffset)?o.resumeOffset:o.duration;s+=y})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>Ms?(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)<Ms+h||Math.abs(u.end-i)<Ms+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 _s(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class Vu{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 y=this.assignAssetListError(e,C.ASSET_LIST_LOAD_ERROR,m,i);this.hls.trigger(g.ERROR,y);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,y,x,D)=>{const L=m.data,z=L==null?void 0:L.ASSETS;if(!Array.isArray(z)){const te=this.assignAssetListError(e,C.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),x.url,y,D);this.hls.trigger(g.ERROR,te);return}e.assetListResponse=L,this.hls.trigger(g.ASSET_LIST_LOADED,{event:e,assetListResponse:L,networkDetails:D})},onError:(m,y,x,D)=>{const L=this.assignAssetListError(e,C.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${m.code} ${m.text} (${y.url})`),y.url,D,x);this.hls.trigger(g.ERROR,L)},onTimeout:(m,y,x)=>{const D=this.assignAssetListError(e,C.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${y.url})`),y.url,m,x);this.hls.trigger(g.ERROR,D)}};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:q.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function hs(a,e,t){as(a,e,t),a.addEventListener(e,t)}function as(a,e,t){a.removeEventListener(e,t)}function po(a){a==null||a.play().catch(()=>{})}class zu 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 y=this.findItemIndex(o);if(m>y){const x=this.schedule.findJumpRestrictedIndex(y+1,m);if(x>y){this.setSchedulePosition(x);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(y=>y.identifier),f=!!(o.length||h.length);if(f&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
|
|
Schedule: ${c.map(y=>_s(y))}`),h.length&&this.log(`Removed events ${h}`),this.playerQueue.forEach(y=>{if(y.interstitial.appendInPlace){const x=y.assetItem.timelineStart,D=y.timelineOffset-x;if(D)try{y.timelineOffset=x}catch(L){Math.abs(D)>Ms&&this.warn(`${L} ("${y.assetId}" ${y.timelineOffset}->${x})`)}}}),r){const y=this.updateItem(r,this.timelinePos);this.itemsMatch(r,y)&&(this.playingItem=y,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 y=this.updateItem(m,this.bufferedPos);this.itemsMatch(m,y)?this.bufferingItem=y:m.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(m.event,null))}if(i.forEach(y=>{y.assetList.forEach(x=>{this.clearAssetPlayer(x.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 Vu(e),this.schedule=new ju(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){as(e,"play",this.onPlay),as(e,"pause",this.onPause),as(e,"seeking",this.onSeeking),as(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,y,x,D)=>{if(f){let L=f[m].start;const z=f.event;if(z){if(m==="playout"||z.timelineOccupancy!==Ir.Point){const te=i(y);(te==null?void 0:te.interstitial)===z&&(L+=te.assetItem.startOffset+te[D])}}else{const te=x==="bufferedPos"?r():e[x];L+=te-f.start}return L}return 0},s=(f,m)=>{if(f!==0&&m!=="primary"&&e.schedule.length){var y;const x=e.schedule.findItemIndexAtTime(f),D=(y=e.schedule.items)==null?void 0:y[x];if(D){const L=D[m].start-D.start;return f+L}}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 y,x;const D=e.effectivePlayingItem;if(D!=null&&(y=D.event)!=null&&y.restrictions.skip)return;e.log(`seek to ${f} "${m}"`);const L=e.effectivePlayingItem,z=e.schedule.findItemIndexAtTime(f,m),te=(x=e.schedule.items)==null?void 0:x[z],J=e.getBufferingPlayer(),le=J==null?void 0:J.interstitial,ue=le==null?void 0:le.appendInPlace,Se=L&&e.itemsMatch(L,te);if(L&&(ue||Se)){const ye=i(e.playingAsset),Ie=(ye==null?void 0:ye.media)||e.primaryMedia;if(Ie){const ge=m==="primary"?Ie.currentTime:n(L,m,e.playingAsset,"timelinePos","currentTime"),$e=f-ge,Ve=(ue?ge:Ie.currentTime)+$e;if(Ve>=0&&(!ye||ue||Ve<=ye.duration)){Ie.currentTime=Ve;return}}}if(te){let ye=f;if(m!=="primary"){const ge=te[m].start,$e=f-ge;ye=te.start+$e}const Ie=!e.isInterstitial(te);if((!e.isInterstitial(L)||L.event.appendInPlace)&&(Ie||te.event.appendInPlace)){const ge=e.media||(ue?J==null?void 0:J.media:null);ge&&(ge.currentTime=ye)}else if(L){const ge=e.findItemIndex(L);if(z>ge){const Ve=e.schedule.findJumpRestrictedIndex(ge+1,z);if(Ve>ge){e.setSchedulePosition(Ve);return}}let $e=0;if(Ie)e.timelinePos=ye,e.checkBuffer();else{var he;const Ve=te==null||(he=te.event)==null?void 0:he.assetList;if(Ve){const Xt=f-(te[m]||te).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(),y=e.effectivePlayingItem;y&&y===m&&c(f+y.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(y=>e.getAssetPlayer(y.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 y=e.findItemIndex(f);if(m.appendInPlace){const x=f.playout.start+f.event.duration;c(x+.001,"playout")}else e.advanceAfterAssetEnded(m,y,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 y=this.getBufferingPlayer();y?(s=y.transferMedia(),h=`${y}`):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 y=this.playerQueue;y.length>1&&y.forEach(x=>{if(o&&x.interstitial.appendInPlace!==c){const D=x.interstitial;this.clearInterstitial(x.interstitial,null),D.appendInPlace=!1,D.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${D}`)}}),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 y=o&&e.assetId===this.schedule.assetIdAtEnd;m.overrides={duration:this.schedule.duration,endOfStream:!o||y,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 y=u.findAssetIndex(h);this.log(`INTERSTITIAL_ASSET_ENDED ${y+1}/${u.assetList.length} ${oa(h)}`),this.endedAsset=h,this.playingAsset=null,this.hls.trigger(g.INTERSTITIAL_ASSET_ENDED,{asset:h,assetListIndex:y,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} ${_s(s)}`),u.hasPlayed=!0,this.hls.trigger(g.INTERSTITIAL_ENDED,{event:u,schedule:i.slice(0),scheduleIndex:e}),u.cue.once)){this.updateSchedule();const y=this.schedule.items;if(n&&y){const x=this.schedule.findItemIndex(n);this.advanceSchedule(x,y,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 ${_s(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 y=t[e+1],x=this.media;y&&x&&!this.isInterstitial(y)&&x.currentTime<y.start&&(x.currentTime=this.timelinePos=y.start),this.advanceAfterAssetEnded(u,e,i||0);return}if(f||(f=this.getAssetPlayer(m.identifier)),f===null||f.destroyed){const y=u.assetList.length;this.warn(`asset ${i+1}/${y} 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 ${_s(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 ${_s(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=E(E({},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=E(E({},this.altSelection),{},{audio:i});return}const s=E(E({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=E(E({},this.altSelection),{},{subtitles:i});return}const s=E(E({},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),y=t[m];if((c===-1&&s&&e>=s.end||(u=y.event)!=null&&u.appendInPlace&&e+.01>=y.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(y);else{const x=this.primaryDetails;this.primaryLive&&x&&e>x.edge-x.targetduration&&y.start<x.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(y)&&this.preloadAssets(y.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 ${_s(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:Gu(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 J=this.timelinePos-t.timelineStart;if(J>1){const le=t.duration;le&&J<le&&(h=J)}}const f=t.identifier,m=E(E({},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 y=m.cmcd;y!=null&&y.sessionId&&y.contentId&&(m.cmcd=v({},y,{contentId:Js(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const x=new Wu(this.HlsPlayerClass,m,e,t);this.playerQueue.push(x),e.assetList[i]=t;const D=J=>{if(J.live){const Se=new Error(`Interstitials MUST be VOD assets ${e}`),he={fatal:!0,type:q.OTHER_ERROR,details:C.INTERSTITIAL_ASSET_ITEM_ERROR,error:Se};this.handleAssetItemError(he,e,this.schedule.findEventIndex(e.identifier),i,Se.message);return}const le=J.edge-J.fragmentStart,ue=t.duration;(ue===null||le>ue)&&(this.log(`Interstitial asset "${f}" duration change ${ue} > ${le}`),t.duration=le,this.updateSchedule())};x.on(g.LEVEL_UPDATED,(J,{details:le})=>D(le)),x.on(g.LEVEL_PTS_UPDATED,(J,{details:le})=>D(le));const L=(J,le)=>{const ue=this.getAssetPlayer(f);if(ue&&le.tracks){ue.off(g.BUFFER_CODECS,L),ue.tracks=le.tracks;const Se=this.primaryMedia;this.bufferingAsset===ue.assetItem&&Se&&!ue.media&&this.bufferAssetPlayer(ue,Se)}};x.on(g.BUFFER_CODECS,L);const z=()=>{var J;const le=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${le}`),!le)return;const ue=this.schedule.findEventIndex(e.identifier),Se=e.findAssetIndex(t),he=Se+1,ye=(J=this.schedule.items)==null?void 0:J[ue];if(this.isInterstitial(ye))if(Se!==-1&&!e.isAssetPastPlayoutLimit(he)&&!e.assetList[he].error)this.bufferedToItem(ye,he);else{var Ie;const ge=(Ie=this.schedule.items)==null?void 0:Ie[ue+1];ge&&this.bufferedToItem(ge)}};x.on(g.BUFFERED_TO_END,z);const te=J=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const ue=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,ue,J)};return x.once(g.MEDIA_ENDED,te(i)),x.once(g.PLAYOUT_LIMIT_REACHED,te(1/0)),x.on(g.ERROR,(J,le)=>{const ue=this.getAssetPlayer(f);if(le.details===C.BUFFER_STALLED_ERROR){if(ue!=null&&ue.media){const Se=ue.currentTime,he=ue.duration-Se;Se&&e.appendInPlace&&he/ue.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${ue.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}`)}),x.on(g.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const le=new Error(`Asset player destroyed unexpectedly ${f}`),ue={fatal:!0,type:q.OTHER_ERROR,details:C.INTERSTITIAL_ASSET_ITEM_ERROR,error:le};this.handleAssetItemError(ue,e,this.schedule.findEventIndex(e.identifier),i,le.message)}),this.hls.trigger(g.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:x}),x}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&&_s(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 y=new Error(`Asset "${o}" SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(m)}')`),x={fatal:!0,type:q.OTHER_ERROR,details:C.INTERSTITIAL_ASSET_ITEM_ERROR,error:y},D=s.findAssetIndex(r);this.handleAssetItemError(x,s,c,D,y.message);return}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,n,s){if(e.details===C.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?_s(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((x,D)=>{const L=parseFloat(x.DURATION);this.createAsset(n,D,u,o+u,L,x.URI),u+=L}),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 y;const x=this.schedule.findEventIndex(s),D=(y=this.schedule.items)==null?void 0:y[x];if(D){if(!this.playingItem&&this.timelinePos>D.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==x){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.primaryFallback(n);return}this.setBufferingItem(D)}this.setSchedulePosition(x)}else if((m==null?void 0:m.identifier)===s&&m.appendInPlace){const x=n.assetList[0],D=this.getAssetPlayer(x.identifier),L=this.primaryMedia;x&&D&&L&&this.bufferAssetPlayer(D,L)}}onError(e,t){switch(t.details){case C.ASSET_LIST_PARSING_ERROR:case C.ASSET_LIST_LOAD_ERROR:case C.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&this.primaryFallback(i);break}case C.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const go=500;class Zu extends Ks{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===C.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,Gs(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,Gs(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:q.MEDIA_ERROR,details:C.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,y=u.edge;let x=null;const D=this.fragPrevious;if(o<y){const te=n.maxFragLookUpTolerance,J=o>y-te?0:te;x=Ye(D,f,Math.max(f[0].start,o),J),!x&&D&&D.start<f[0].start&&(x=f[0])}else x=f[m-1];if(x=this.filterReplacedPrimary(x,i.details),!x)return;const L=x.sn-u.startSN,z=f[L-1];if(z&&z.cc===x.cc&&this.fragmentTracker.getState(z)===Ft.NOT_LOADED&&(x=z),this.fragmentTracker.getState(x)===Ft.NOT_LOADED){const te=this.mapToInitFragWhenRequired(x);te&&this.loadFragment(te,i,o)}}}loadFragment(e,t,i){V(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Yu(this.tracksBuffered[this.currentTrackId]||[])}}class Yu{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 Xu={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(Xu[a]||a),Xn=15,fs=100,Qu={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Ju={17:2,18:4,21:6,22:8,23:10,19:13,20:15},qu={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ec={25:2,26:4,29:6,30:8,31:10,27:13,28:15},tc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class ic{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;Y.log(`${this.time} [${e}] ${i}`)}}}const Ts=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 nc{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 sc{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 nc);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=Xn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Xn;t++)this.rows.push(new sc(e));this.logger=e}reset(){for(let e=0;e<Xn;e++)this.rows[e].clear();this.currRow=Xn-1}equals(e){let t=!0;for(let i=0;i<Xn;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Xn;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Xn;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<Xn;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<Xn;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[Xn-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[Xn-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=ac(),this.logger=void 0;const n=this.logger=new ic;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,()=>"["+Ts([t[i],t[i+1]])+"] -> ("+Ts([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(rc(n,s,c)){Rr(null,null,c),this.logger.log(3,()=>"Repeated command ("+Ts([n,s])+") is dropped");continue}Rr(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 Rr(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 "+Ts([n,s])+" orig: "+Ts([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 ("+Ts([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?Qu[e]:qu[e]:i=r===1?Ju[e]:ec[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 = "+Ts(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=tc[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()}Rr(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 Rr(a,e,t){t.a=a,t.b=e}function rc(a,e,t){return t.a===a&&t.b===e}function ac(){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="",y=!1,x=o,D=c,L=u,z=null,te="",J=!0,le="auto",ue="start",Se=50,he="middle",ye=50,Ie="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 y},set:function(ge){y=!!ge}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return x},set:function(ge){if(typeof ge!="number")throw new TypeError("Start time must be set to a number.");x=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",s({},f,{get:function(){return D},set:function(ge){if(typeof ge!="number")throw new TypeError("End time must be set to a number.");D=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",s({},f,{get:function(){return L},set:function(ge){L=""+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 te},set:function(ge){const $e=i(ge);if($e===!1)throw new SyntaxError("An invalid or illegal string was specified.");te=$e,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",s({},f,{get:function(){return J},set:function(ge){J=!!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 ue},set:function(ge){const $e=n(ge);if(!$e)throw new SyntaxError("An invalid or illegal string was specified.");ue=$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 ye},set:function(ge){if(ge<0||ge>100)throw new Error("Size must be between 0 and 100.");ye=ge,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",s({},f,{get:function(){return Ie},set:function(ge){const $e=n(ge);if(!$e)throw new SyntaxError("An invalid or illegal string was specified.");Ie=$e,this.hasBeenReset=!0}})),h.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class oc{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 lc{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,""),Lr=ca.align==="middle"?"middle":"center";function uc(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 lc;bo(o,function(m,y){let x;switch(m){case"region":for(let D=t.length-1;D>=0;D--)if(t[D].id===y){u.set(m,t[D].region);break}break;case"vertical":u.alt(m,y,["rl","lr"]);break;case"line":x=y.split(","),u.integer(m,x[0]),u.percent(m,x[0])&&u.set("snapToLines",!1),u.alt(m,x[0],["auto"]),x.length===2&&u.alt("lineAlign",x[1],["start",Lr,"end"]);break;case"position":x=y.split(","),u.percent(m,x[0]),x.length===2&&u.alt("positionAlign",x[1],["start",Lr,"end","line-left","line-right","auto"]);break;case"size":u.percent(m,y);break;case"align":u.alt(m,y,["start",Lr,"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",Lr);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 cc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new oc,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{uc(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 hc=/\r\n|\n\r|\n|\r/g,ha=function(e,t,i=0){return e.slice(i,i+t.length)===t},fc=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 Js(a.toString())+Js(e.toString())+Js(t)}const dc=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 pc(a,e,t,i,n,s,r){const o=new cc,c=Q(new Uint8Array(a)).trim().replace(hc,`
|
|
`).split(`
|
|
`),u=[],h=e?Bl(e.baseTime,e.timescale):0;let f="00:00.000",m=0,y=0,x,D=!0;o.oncue=function(L){const z=t[i];let te=t.ccOffset;const J=(m-h)/9e4;if(z!=null&&z.new&&(y!==void 0?te=t.ccOffset=z.start:dc(t,i,J)),J){if(!e){x=new Error("Missing initPTS for VTT MPEGTS");return}te=J-t.presentationOffset}const le=L.endTime-L.startTime,ue=$n((L.startTime+te-y)*9e4,n*9e4)/9e4;L.startTime=Math.max(ue,0),L.endTime=Math.max(ue+le,0);const Se=L.text.trim();L.text=decodeURIComponent(encodeURIComponent(Se)),L.id||(L.id=fa(L.startTime,L.endTime,Se)),L.endTime>0&&u.push(L)},o.onparsingerror=function(L){x=L},o.onflush=function(){if(x){r(x);return}s(u)},c.forEach(L=>{if(D)if(ha(L,"X-TIMESTAMP-MAP=")){D=!1,L.slice(16).split(",").forEach(z=>{ha(z,"LOCAL:")?f=z.slice(6):ha(z,"MPEGTS:")&&(m=parseInt(z.slice(7)))});try{y=fc(f)/1e3}catch(z){x=z}return}else L===""&&(D=!1);o.parse(L+`
|
|
`)}),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)$/,gc={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=Fl(e.baseTime,1,e.timescale);try{s.forEach(o=>t(mc(o,r)))}catch(o){i(o)}}function mc(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 y=ma(f.getAttribute("begin"),r),x=ma(f.getAttribute("dur"),r);let D=ma(f.getAttribute("end"),r);if(y===null)throw Ro(f);if(D===null){if(x===null)throw Ro(f);D=y+x}const L=new ua(y-e,D-e,m);L.id=fa(L.startTime,L.endTime,L.text);const z=u[f.getAttribute("region")],te=c[f.getAttribute("style")],J=_c(z,te,c),{textAlign:le}=J;if(le){const ue=gc[le];ue&&(L.lineAlign=ue),L.align=le}return v(L,J),L}).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 _c(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=vc(a,e):To.test(a)&&(t=yc(a,e))),t}function vc(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 yc(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 Dr{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 Ec{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 Dr(this,"textTrack1"),t=new Dr(this,"textTrack2"),i=new Dr(this,"textTrack3"),n=new Dr(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=bc(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,ks(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=>{ks(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++)ks(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?wr(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)ks(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;pc(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 bc(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 xc=/\s/,Sc={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 D=0;D<s.chars.length;D++)xc.test(s.chars[D].uchar)&&o?c++:(u+=s.chars[D].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const y=xo(u.trim()),x=fa(e,t,y);a!=null&&(f=a.cues)!=null&&f.getCueById(x)||(r=new h(e,t,y),r.id=x,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,y)=>m.line==="auto"||y.line==="auto"?0:m.line>8&&y.line>8?y.line-m.line:m.line-y.line),n.forEach(m=>co(a,m))),n}};function Tc(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const Ac=/(\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||Lc,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=wc(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),(Ys(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var m;this.response=this.loader=f;const y=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-(y-n.loading.start)),!f.ok){const{status:D,statusText:L}=f;throw new Dc(L||"fetch, bad network response",D,f)}n.loading.first=y,n.total=Rc(f.headers)||n.total;const x=(m=this.callbacks)==null?void 0:m.onProgress;return x&&K(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,x):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var m,y;const x=this.response;if(!x)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const D=f[o];D&&(n.loaded=n.total=D);const L={url:x.url,data:f,code:x.status},z=(m=this.callbacks)==null?void 0:m.onProgress;z&&!K(t.highWaterMark)&&z(n,e,f,x),(y=this.callbacks)==null||y.onSuccess(L,n,e,x)}).catch(f=>{var m;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const y=f&&f.code||0,x=f?f.message:null;(m=this.callbacks)==null||m.onError({code:y,text:x},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 Ws,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 wc(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 Ic(a){const e=Ac.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Rc(a){const e=a.get("Content-Range");if(e){const i=Ic(e);if(K(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function Lc(a,e){return new self.Request(a.url,e)}class Dc extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const Cc=/^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 x=h!=null?h:t.response;if(x!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const D=t.responseType==="arraybuffer"?x.byteLength:x.length;i.loaded=i.total=D,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const L=(r=this.callbacks)==null?void 0:r.onProgress;L&&L(i,e,x,t);const z={url:t.responseURL,data:x,code:u};(o=this.callbacks)==null||o.onSuccess(z,i,e,t);return}}const f=s.loadPolicy.errorRetry,m=i.retry,y={url:e.url,data:void 0,code:u};if(Ii(f,m,!1,y))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&&Cc.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 Oc={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Pc=E(E({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:ql,capLevelController:ta,errorController:Bi,fpsController:Fu,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:Oc},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},kc()),{},{subtitleStreamController:Zu,subtitleTrackController:$u,timelineController:Ec,audioStreamController:Yl,audioTrackController:Xl,emeController:Ps,cmcdController:ku,contentSteeringController:Nu,interstitialsController:zu});function kc(){return{cueHandler:Sc,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 Mc(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 y=i[o].default;switch(e[o]={default:y},h){case"TimeOut":y.maxLoadTimeMs=m,y.maxTimeToFirstByteMs=m;break;case"MaxRetry":y.errorRetry.maxNumRetry=m,y.timeoutRetry.maxNumRetry=m;break;case"RetryDelay":y.errorRetry.retryDelayMs=m,y.timeoutRetry.retryDelayMs=m;break;case"MaxRetryTimeout":y.errorRetry.maxRetryDelayMs=m,y.timeoutRetry.maxRetryDelayMs=m;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${Qt(e[o])}`)}),E(E({},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 Nc(a,e){const t=a.loader;t!==Oo&&t!==Po?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):Tc()&&(a.loader=Oo,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Cr=2,Fc=.1,Bc=.05,Uc=100;class $c 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(Uc),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&&(as(i,"playing",this.onMediaPlaying),as(i,"waiting",this.onMediaWaiting),as(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),y=m.nextStart||0,x=this.fragmentTracker;if(c&&x&&this.hls){const Se=ko(this.hls.inFlightFragments,e),he=m.len>Cr,ye=!y||Se||y-e>Cr&&!x.getPartialFragment(e);if(he||ye)return;this.moved=!1}const D=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&x){if(!(m.len>0)&&!y)return;const he=Math.max(y,m.start||0)-e,Ie=!!(D!=null&&D.live)?D.targetduration*2:Cr,ge=x.getPartialFragment(e);if(he>0&&(he<=Ie||ge)){r.paused||this._trySkipBufferHole(ge);return}}const L=s.detectStallWithCurrentTimeMs,z=self.performance.now(),te=this.waiting;if(o===null){te>0&&z-te<L?this.stalled=te:this.stalled=z;return}const J=z-o;if(!c&&(J>=L||te)&&this.hls){var le;if(((le=this.mediaSource)==null?void 0:le.readyState)==="ended"&&!(D!=null&&D.live)&&Math.abs(e-((D==null?void 0:D.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 ue=_t.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(ue,J)}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,y=_t.bufferInfo(this.media,e,0);this.hls.trigger(g.ERROR,{type:q.MEDIA_ERROR,details:C.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:m,buffer:y.len,bufferInfo:y})}}}}}_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:q.MEDIA_ERROR,details:C.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 x=!1;if(r===0){const D=i.getAppendedFrag(0,H.MAIN);D&&c<D.end&&(x=!0)}if(!x){const D=e||i.getAppendedFrag(r,H.MAIN);if(D){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||ko(this.hls.inFlightFragments,c))return 0;let z=!1,te=D.end;for(;te<c;){const J=i.getPartialFragment(te);if(J)te+=J.duration;else{z=!0;break}}if(z)return 0}}}const y=Math.max(c+Bc,r+Fc);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${y}`),this.moved=!0,n.currentTime=y,!(e!=null&&e.gap)){const x=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${y}`);this.hls.trigger(g.ERROR,{type:q.MEDIA_ERROR,details:C.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:x,reason:x.message,frag:e||void 0,buffer:o.len,bufferInfo:o})}return y}}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:q.MEDIA_ERROR,details:C.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:q.MEDIA_ERROR,details:C.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 Gc=.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?E({type:n},i):i))}return s}const Or=(()=>{const a=va();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Kc(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Hc{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&&ks(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===kn.emsg&&!i||!n)continue;const u=La(s[o].data);if(u){const h=s[o].pts;let f=h+s[o].duration;f>Or&&(f=Or),f-h<=0&&(f=h+Gc);for(let y=0;y<u.length;y++){const x=u[y];if(!Da(x)){this.updateId3CueEnds(h,c);const D=No(r,h,f,x,c);D&&this.id3Track.addCue(D)}}}}}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===Or&&(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===kn.audioId3&&c:n==="video"?u=h=>h.type===kn.emsg&&o:u=h=>h.type===kn.audioId3&&c||h.type===kn.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],y=r[m].cues;delete r[m],Object.keys(y).forEach(x=>{try{const D=y[x];D.removeEventListener("enter",this.onEventCueEnter),i.removeCue(D)}catch(D){}})}}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],y=m.startTime,x=r[f],D=(x==null?void 0:x.cues)||{};let L=(x==null?void 0:x.durationKnown)||!1,z=Or;const{duration:te,endDate:J}=m;if(J&&te!==null)z=y+te,L=!0;else if(m.endOnNext&&!L){const ue=s.reduce((Se,he)=>{if(he!==m.id){const ye=n[he];if(ye.class===m.class&&ye.startDate>m.startDate&&(!Se||m.startDate<Se.startDate))return ye}return Se},null);ue&&(z=ue.startTime,L=!0)}const le=Object.keys(m.attr);for(let ue=0;ue<le.length;ue++){const Se=le[ue];if(!jn(Se))continue;const he=D[Se];if(he)L&&!x.durationKnown?he.endTime=z:Math.abs(he.startTime-y)>.01&&(he.startTime=y,he.endTime=z);else if(u){let ye=m.attr[Se];Vn(Se)&&(ye=Kc(ye));const ge=No(u,y,z,{key:Se,data:ye},kn.dateRange);ge&&(ge.id=f,this.id3Track.addCue(ge),D[Se]=ge,this.hls.config.interstitialsController&&(Se==="X-ASSET-LIST"||Se==="X-ASSET-URL")&&ge.addEventListener("enter",this.onEventCueEnter))}}r[f]={cues:D,dateRange:m,durationKnown:L}}}}class Wc{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,y=Math.min(f,Math.max(1,m));this.changeMediaPlaybackRate(t,y)}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===C.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 jc 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:y,videoCodec:x}=h;y&&(h.audioCodec=y=$t(y,i)||void 0),((f=x)==null?void 0:f.indexOf("avc1"))===0&&(x=h.videoCodec=Li(x));const{width:D,height:L,unknownCodecs:z}=h;let te=z?z.length:0;if(z)for(let $e=te;$e--;){const Ve=z[$e];this.isAudioSupported(Ve)?(h.audioCodec=y=y?`${y},${Ve}`:Ve,te--,Et.audio[y.substring(0,4)]=2):this.isVideoSupported(Ve)&&(h.videoCodec=x=x?`${x},${Ve}`:Ve,te--,Et.video[x.substring(0,4)]=2)}if(o||(o=!!(D&&L)),c||(c=!!x),u||(u=!!y),te||y&&!this.isAudioSupported(y)||x&&!this.isVideoSupported(x)){this.log(`Some or all CODECS not supported "${m.CODECS}"`);return}const{CODECS:J,"FRAME-RATE":le,"HDCP-LEVEL":ue,"PATHWAY-ID":Se,RESOLUTION:he,"VIDEO-RANGE":ye}=m,ge=`${`${Se||"."}-`}${h.bitrate}-${he}-${le}-${J}-${ye}-${ue}`;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:L,videoRange:z,width:te,height:J})=>(!!L||!!(te&&J))&&nn(z))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let L="no level with compatible codecs found in manifest",z=L;t.levels.length&&(z=`one or more CODECS in variant not supported: ${Qt(t.levels.map(J=>J.attrs.CODECS).filter((J,le,ue)=>ue.indexOf(J)===le))}`,this.warn(z),L+=` (${z})`);const te=new Error(L);this.hls.trigger(g.ERROR,{type:q.MEDIA_ERROR,details:C.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:te,reason:z})}});return}t.audioTracks&&(r=t.audioTracks.filter(L=>!L.audioCodec||this.isAudioSupported(L.audioCodec)),Fo(r)),t.subtitles&&(o=t.subtitles,Fo(o));const u=c.slice(0);c.sort((L,z)=>{if(L.attrs["HDCP-LEVEL"]!==z.attrs["HDCP-LEVEL"])return(L.attrs["HDCP-LEVEL"]||"")>(z.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&L.height!==z.height)return L.height-z.height;if(L.frameRate!==z.frameRate)return L.frameRate-z.frameRate;if(L.videoRange!==z.videoRange)return Ni.indexOf(L.videoRange)-Ni.indexOf(z.videoRange);if(L.videoCodec!==z.videoCodec){const te=at(L.videoCodec),J=at(z.videoCodec);if(te!==J)return J-te}if(L.uri===z.uri&&L.codecSet!==z.codecSet){const te=St(L.codecSet),J=St(z.codecSet);if(te!==J)return J-te}return L.averageBitrate!==z.averageBitrate?L.averageBitrate-z.averageBitrate:0});let h=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let L=0;L<u.length;L++)if(u[L].pathwayId===c[0].pathwayId){h=u[L];break}}this._levels=c;for(let L=0;L<c.length;L++)if(c[L]===h){var f;this._firstLevel=L;const z=h.bitrate,te=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${z}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const J=Math.min(z,this.hls.config.abrEwmaDefaultEstimateMax);J>te&&te===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=J)}break}const m=s&&!n,y=this.hls.config,x=!!(y.audioStreamController&&y.audioTrackController),D={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:x&&!m&&r.some(L=>!!L.url)};this.hls.trigger(g.MANIFEST_PARSED,D)}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:q.OTHER_ERROR,details:C.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));mr(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 Vc(){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 zc(){var a;const e=Bo();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Zc=100;class Yc extends Ks{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 D={};this.altAudio===2&&(D.type="video"),this.hls.trigger(g.BUFFER_EOS,D),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 y=this.getNextFragment(m,u);if(this.couldBacktrack&&!this.fragPrevious&&y&&V(y)&&this.fragmentTracker.getState(y)!==Ft.OK){var x;const L=((x=this.backtrackFragment)!=null?x:y).sn-u.startSN,z=u.fragments[L-1];z&&y.cc===z.cc&&(y=z,this.fragmentTracker.removeFragment(z))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(y&&this.isLoopLoading(y,m)){if(!y.gap){const L=this.audioOnly&&!this.altAudio?d.AUDIO:d.VIDEO,z=(L===d.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;z&&this.afterBufferFlushed(z,L,H.MAIN)}y=this.getNextFragmentLoopLoading(y,u,o,H.MAIN,f)}y&&(y.initSegment&&!y.initSegment.data&&!this.bitrateTest&&(y=y.initSegment),this.loadFragment(y,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&&(as(i,"playing",this.onMediaPlaying),as(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&&!zc(),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),y=this.transmuxer=this.transmuxer||new Za(this.hls,H.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),x=n?n.index:-1,D=x!==-1,L=new Wi(i.level,i.sn,i.stats.chunkCount,s.byteLength,x,D),z=this.initPTS[i.cc];y.push(s,f,m,u,i,n,c.totalduration,h,L,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 C.FRAG_GAP:case C.FRAG_PARSING_ERROR:case C.FRAG_DECRYPT_ERROR:case C.FRAG_LOAD_ERROR:case C.FRAG_LOAD_TIMEOUT:case C.KEY_LOAD_ERROR:case C.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(H.MAIN,t);break;case C.LEVEL_LOAD_ERROR:case C.LEVEL_LOAD_TIMEOUT:case C.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 C.BUFFER_ADD_CODEC_ERROR:case C.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.resetLoadingState();break;case C.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case C.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:y,initSegment:x}=s,{details:D}=h,L=this.altAudio?void 0:s.audio;if(this.fragContextChanged(c)){this.fragmentTracker.removeFragment(c);return}if(this.state=De.PARSING,x){if(x!=null&&x.tracks){const J=c.initSegment||c;this._bufferInitSegment(h,x.tracks,J,r),n.trigger(g.FRAG_PARSING_INIT_SEGMENT,{frag:J,id:i,tracks:x.tracks})}const z=x.initPTS,te=x.timescale;K(z)&&(this.initPTS[c.cc]={baseTime:z,timescale:te},n.trigger(g.INIT_PTS_FOUND,{frag:c,id:i,initPTS:z,timescale:te}))}if(f&&D){!L&&f.type==="audiovideo"&&this.logMuxedErr(c);const z=D.fragments[c.sn-1-D.startSN],te=c.sn===D.startSN,J=!z||c.cc>z.cc;if(s.independent!==!1){const{startPTS:le,endPTS:ue,startDTS:Se,endDTS:he}=f;if(u)u.elementaryStreams[f.type]={startPTS:le,endPTS:ue,startDTS:Se,endDTS:he};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!J&&(this.couldBacktrack=!0),f.dropped&&f.independent){const ye=this.getMainFwdBufferInfo(),Ie=(ye?ye.end:this.getLoadPosition())+this.config.maxBufferHole,ge=f.firstKeyFramePTS?f.firstKeyFramePTS:le;if(!te&&Ie<ge-this.config.maxBufferHole&&!J){this.backtrack(c);return}else J&&(c.gap=!0);c.setElementaryStreamInfo(f.type,c.start,ue,c.start,he,!0)}else te&&le-(D.appliedTimelineOffset||0)>Cr&&(c.gap=!0);c.setElementaryStreamInfo(f.type,le,ue,Se,he),this.backtrackFragment&&(this.backtrackFragment=c),this.bufferFragmentData(f,c,u,r,te||J)}else if(te||J)c.gap=!0;else{this.backtrack(c);return}}if(L){const{startPTS:z,endPTS:te,startDTS:J,endDTS:le}=L;u&&(u.elementaryStreams[d.AUDIO]={startPTS:z,endPTS:te,startDTS:J,endDTS:le}),c.setElementaryStreamInfo(d.AUDIO,z,te,J,le),this.bufferFragmentData(L,c,u,r)}if(D&&y!=null&&(t=y.samples)!=null&&t.length){const z={id:i,frag:c,details:D,samples:y.samples};n.trigger(g.FRAG_PARSING_METADATA,z)}if(D&&m){const z={id:i,frag:c,details:D,samples:m.samples};n.trigger(g.FRAG_PARSING_USERDATA,z)}}logMuxedErr(e){this.warn(`${V(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==De.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));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 Xc{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=C.KEY_LOAD_ERROR,i,n,s){return new Ui({type:q.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,C.KEY_LOAD_ERROR,u))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,C.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,C.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,y,x,D)=>{const{frag:L,keyInfo:z,url:te}=x;if(!L.decryptdata||z!==this.keyUriToKeyInfo[te])return o(this.createKeyLoadError(L,C.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),D));z.decryptdata.key=L.decryptdata.key=new Uint8Array(m.data),L.keyLoader=null,z.loader=null,r({frag:L,keyInfo:z})},onError:(m,y,x,D)=>{this.resetLoader(y),o(this.createKeyLoadError(t,C.KEY_LOAD_ERROR,new Error(`HTTP Error ${m.code} loading key ${m.text}`),x,E({url:c.url,data:void 0},m)))},onTimeout:(m,y,x)=>{this.resetLoader(y),o(this.createKeyLoadError(t,C.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),x))},onAbort:(m,y,x)=>{this.resetLoader(y),o(this.createKeyLoadError(t,C.INTERNAL_ABORTED,new Error("key loading aborted"),x))}};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 Qc{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 y=this.getInternalLoader(f);this.resetInternalLoader(f.type);const x=u.data;if(x.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),m||null,h);return}h.parsing.start=performance.now(),Dn.isMediaPlaylist(x)||f.type!==ee.MANIFEST?this.handleTrackOrLevelPlaylist(u,h,f,m||null,y):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=Dn.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:y,variableList:x}=c;this.variableList=x;const{AUDIO:D=[],SUBTITLES:L,"CLOSED-CAPTIONS":z}=Dn.parseMasterPlaylistMedia(r,o,c);D.length&&!D.some(J=>!J.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"),D.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:D,subtitles:L,captions:z,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:f,sessionKeys:m,startTimeOffset:y,variableList:x})}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),y=Dn.parseLevelPlaylist(e.data,h,f,m,0,this.variableList);if(u===ee.MANIFEST){const x={attrs:new Zt({}),bitrate:0,details:y,name:"",url:h};y.requestScheduled=t.loading.start+fr(y,0),r.trigger(g.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:h,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=y,this.handlePlaylistLoaded(y,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(g.ERROR,{type:q.NETWORK_ERROR,details:C.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=C.UNKNOWN,u=!1;const h=this.getInternalLoader(e);switch(e.type){case ee.MANIFEST:c=i?C.MANIFEST_LOAD_TIMEOUT:C.MANIFEST_LOAD_ERROR,u=!0;break;case ee.LEVEL:c=i?C.LEVEL_LOAD_TIMEOUT:C.LEVEL_LOAD_ERROR,u=!1;break;case ee.AUDIO_TRACK:c=i?C.AUDIO_TRACK_LOAD_TIMEOUT:C.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ee.SUBTITLE_TRACK:c=i?C.SUBTITLE_TRACK_LOAD_TIMEOUT:C.SUBTITLE_LOAD_ERROR,u=!1;break}h&&this.resetInternalLoader(e.type);const f={type:q.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=E({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,y=ya(t,n),x=$o(n),D=typeof n.level=="number"&&x===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:q.NETWORK_ERROR,details:C.LEVEL_EMPTY_ERROR,fatal:!1,url:y,error:z,reason:z.message,response:t,context:n,level:D,parent:x,networkDetails:s,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const L=e.playlistParsingError;if(L){if(this.hls.logger.warn(L),!o.config.ignorePlaylistParsingErrors){o.trigger(g.ERROR,{type:q.NETWORK_ERROR,details:C.LEVEL_PARSING_ERROR,fatal:!1,url:y,error:L,reason:L.message,response:t,context:n,level:D,parent:x,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:D||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 vs{static get version(){return js}static isMSESupported(){return Uo()}static isSupported(){return Vc()}static getMediaSource(){return fe()}static get Events(){return g}static get MetadataSchema(){return kn}static get ErrorTypes(){return q}static get ErrorDetails(){return C}static get DefaultConfig(){return vs.defaultConfig?vs.defaultConfig:Pc}static set DefaultConfig(e){vs.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=Mc(vs.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Nc(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,y=m?this.interstitialsController=new m(this,vs):null,x=this.bufferController=new s(this,f),D=this.capLevelController=new r(this),L=new c(this),z=new Qc(this),te=i.contentSteeringController,J=te?new te(this):null,le=this.levelController=new jc(this,J),ue=new Hc(this),Se=new Xc(this.config),he=this.streamController=new Yc(this,f,Se),ye=this.gapController=new $c(this,f);D.setStreamController(he),L.setStreamController(he);const Ie=[z,le,he];y&&Ie.splice(1,0,y),J&&Ie.splice(1,0,J),this.networkControllers=Ie;const ge=[h,x,ye,D,L,ue,f];this.audioTrackController=this.createController(i.audioTrackController,Ie);const $e=i.audioStreamController;$e&&Ie.push(this.audioStreamController=new $e(this,f,Se)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Ie);const Ve=i.subtitleStreamController;Ve&&Ie.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(Wc,ge),this.coreComponents=ge,Ie.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:q.OTHER_ERROR,details:C.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:q.OTHER_ERROR,details:C.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=k.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=fl()),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)}}vs.defaultConfig=void 0}}]);
|
|
}()); |