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.
NewEduCoderBuild/p__Classrooms__Lists__Exerc...

1033 lines
991 KiB

!(function(){var el=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[7482],{65030:function(Rt,nt,W){"use strict";W.d(nt,{Z:function(){return qe}});var T=W(27247),fe=W(11913),ke=W(43079),oe=W(43403),H=W(92310),p=W.n(H),ae=W(29301),te=W(76846),l=W(96452),M=W(6089),A=W(80402),g=W(34280),b=W(49658),m=W(59301),x=W(32855),C=W(77900),L=W(8654);function F(ie){var ue=ie.prefixCls,Y=ie.align,xe=ie.arrow,Te=ie.arrowPos,Fe=xe||{},$=Fe.className,se=Fe.content,Se=Te.x,Ie=Se===void 0?0:Se,Oe=Te.y,Ve=Oe===void 0?0:Oe,ut=m.useRef();if(!Y||!Y.points)return null;var He={position:"absolute"};if(Y.autoArrow!==!1){var Ye=Y.points[0],We=Y.points[1],ht=Ye[0],ft=Ye[1],rt=We[0],ve=We[1];ht===rt||!["t","b"].includes(ht)?He.top=Ve:ht==="t"?He.top=0:He.bottom=0,ft===ve||!["l","r"].includes(ft)?He.left=Ie:ft==="l"?He.left=0:He.right=0}return m.createElement("div",{ref:ut,className:p()("".concat(ue,"-arrow"),$),style:He},se)}function w(ie){var ue=ie.prefixCls,Y=ie.open,xe=ie.zIndex,Te=ie.mask,Fe=ie.motion;return Te?m.createElement(C.default,(0,x.Z)({},Fe,{motionAppear:!0,visible:Y,removeOnLeave:!0}),function($){var se=$.className;return m.createElement("div",{style:{zIndex:xe},className:p()("".concat(ue,"-mask"),se)})}):null}var k=m.memo(function(ie){var ue=ie.children;return ue},function(ie,ue){return ue.cache}),N=k,V=m.forwardRef(function(ie,ue){var Y=ie.popup,xe=ie.className,Te=ie.prefixCls,Fe=ie.style,$=ie.target,se=ie.onVisibleChanged,Se=ie.open,Ie=ie.keepDom,Oe=ie.fresh,Ve=ie.onClick,ut=ie.mask,He=ie.arrow,Ye=ie.arrowPos,We=ie.align,ht=ie.motion,ft=ie.maskMotion,rt=ie.forceRender,ve=ie.getPopupContainer,at=ie.autoDestroy,Xe=ie.portal,Ke=ie.zIndex,pt=ie.onMouseEnter,Et=ie.onMouseLeave,ct=ie.onPointerEnter,Dt=ie.onPointerDownCapture,Gt=ie.ready,lt=ie.offsetX,Tt=ie.offsetY,ge=ie.offsetR,de=ie.offsetB,pe=ie.onAlign,P=ie.onPrepare,G=ie.stretch,Q=ie.targetWidth,re=ie.targetHeight,ce=typeof Y=="function"?Y():Y,tt=Se||Ie,it=(ve==null?void 0:ve.length)>0,ot=m.useState(!ve||!it),gt=(0,fe.Z)(ot,2),kt=gt[0],Ut=gt[1];if((0,g.Z)(function(){!kt&&it&&$&&Ut(!0)},[kt,it,$]),!kt)return null;var Bt="auto",bt={left:"-1000vw",top:"-1000vh",right:Bt,bottom:Bt};if(Gt||!Se){var rn,fn=We.points,en=We.dynamicInset||((rn=We._experimental)===null||rn===void 0?void 0:rn.dynamicInset),Qt=en&&fn[0][1]==="r",st=en&&fn[0][0]==="b";Qt?(bt.right=ge,bt.left=Bt):(bt.left=lt,bt.right=Bt),st?(bt.bottom=de,bt.top=Bt):(bt.top=Tt,bt.bottom=Bt)}var je={};return G&&(G.includes("height")&&re?je.height=re:G.includes("minHeight")&&re&&(je.minHeight=re),G.includes("width")&&Q?je.width=Q:G.includes("minWidth")&&Q&&(je.minWidth=Q)),Se||(je.pointerEvents="none"),m.createElement(Xe,{open:rt||tt,getContainer:ve&&function(){return ve($)},autoDestroy:at},m.createElement(w,{prefixCls:Te,open:Se,zIndex:Ke,mask:ut,motion:ft}),m.createElement(ae.Z,{onResize:pe,disabled:!Se},function(dt){return m.createElement(C.default,(0,x.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:rt,leavedClassName:"".concat(Te,"-hidden")},ht,{onAppearPrepare:P,onEnterPrepare:P,visible:Se,onVisibleChanged:function(Wt){var tn;ht==null||(tn=ht.onVisibleChanged)===null||tn===void 0||tn.call(ht,Wt),se(Wt)}}),function(Ft,Wt){var tn=Ft.className,An=Ft.style,yn=p()(Te,tn,xe);return m.createElement("div",{ref:(0,L.sQ)(dt,ue,Wt),className:yn,style:(0,T.Z)((0,T.Z)((0,T.Z)((0,T.Z)({"--arrow-x":"".concat(Ye.x||0,"px"),"--arrow-y":"".concat(Ye.y||0,"px")},bt),je),An),{},{boxSizing:"border-box",zIndex:Ke},Fe),onMouseEnter:pt,onMouseLeave:Et,onPointerEnter:ct,onClick:Ve,onPointerDownCapture:Dt},He&&m.createElement(F,{prefixCls:Te,arrow:He,arrowPos:Ye,align:We}),m.createElement(N,{cache:!Se&&!Oe},ce))})}))}),q=V,le=m.forwardRef(function(ie,ue){var Y=ie.children,xe=ie.getTriggerDOMNode,Te=(0,L.Yr)(Y),Fe=m.useCallback(function(se){(0,L.mH)(ue,xe?xe(se):se)},[xe]),$=(0,L.x1)(Fe,(0,L.C4)(Y));return Te?m.cloneElement(Y,{ref:$}):Y}),ee=le,X=m.createContext(null),_e=X;function ye(ie){return ie?Array.isArray(ie)?ie:[ie]:[]}function Ge(ie,ue,Y,xe){return m.useMemo(function(){var Te=ye(Y!=null?Y:ue),Fe=ye(xe!=null?xe:ue),$=new Set(Te),se=new Set(Fe);return ie&&($.has("hover")&&($.delete("hover"),$.add("click")),se.has("hover")&&(se.delete("hover"),se.add("click"))),[$,se]},[ie,ue,Y,xe])}var U=W(29194);function R(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Y=arguments.length>2?arguments[2]:void 0;return Y?ie[0]===ue[0]:ie[0]===ue[0]&&ie[1]===ue[1]}function O(ie,ue,Y,xe){for(var Te=Y.points,Fe=Object.keys(ie),$=0;$<Fe.length;$+=1){var se,Se=Fe[$];if(R((se=ie[Se])===null||se===void 0?void 0:se.points,Te,xe))return"".concat(ue,"-placement-").concat(Se)}return""}function K(ie,ue,Y,xe){return ue||(Y?{motionName:"".concat(ie,"-").concat(Y)}:xe?{motionName:xe}:null)}function j(ie){return ie.ownerDocument.defaultView}function z(ie){for(var ue=[],Y=ie==null?void 0:ie.parentElement,xe=["hidden","scroll","clip","auto"];Y;){var Te=j(Y).getComputedStyle(Y),Fe=Te.overflowX,$=Te.overflowY,se=Te.overflow;[Fe,$,se].some(function(Se){return xe.includes(Se)})&&ue.push(Y),Y=Y.parentElement}return ue}function y(ie){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(ie)?ue:ie}function _(ie){return y(parseFloat(ie),0)}function I(ie,ue){var Y=(0,T.Z)({},ie);return(ue||[]).forEach(function(xe){if(!(xe instanceof HTMLBodyElement||xe instanceof HTMLHtmlElement)){var Te=j(xe).getComputedStyle(xe),Fe=Te.overflow,$=Te.overflowClipMargin,se=Te.borderTopWidth,Se=Te.borderBottomWidth,Ie=Te.borderLeftWidth,Oe=Te.borderRightWidth,Ve=xe.getBoundingClientRect(),ut=xe.offsetHeight,He=xe.clientHeight,Ye=xe.offsetWidth,We=xe.clientWidth,ht=_(se),ft=_(Se),rt=_(Ie),ve=_(Oe),at=y(Math.round(Ve.width/Ye*1e3)/1e3),Xe=y(Math.round(Ve.height/ut*1e3)/1e3),Ke=(Ye-We-rt-ve)*at,pt=(ut-He-ht-ft)*Xe,Et=ht*Xe,ct=ft*Xe,Dt=rt*at,Gt=ve*at,lt=0,Tt=0;if(Fe==="clip"){var ge=_($);lt=ge*at,Tt=ge*Xe}var de=Ve.x+Dt-lt,pe=Ve.y+Et-Tt,P=de+Ve.width+2*lt-Dt-Gt-Ke,G=pe+Ve.height+2*Tt-Et-ct-pt;Y.left=Math.max(Y.left,de),Y.top=Math.max(Y.top,pe),Y.right=Math.min(Y.right,P),Y.bottom=Math.min(Y.bottom,G)}}),Y}function Z(ie){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Y="".concat(ue),xe=Y.match(/^(.*)\%$/);return xe?ie*(parseFloat(xe[1])/100):parseFloat(Y)}function Ee(ie,ue){var Y=ue||[],xe=(0,fe.Z)(Y,2),Te=xe[0],Fe=xe[1];return[Z(ie.width,Te),Z(ie.height,Fe)]}function Ce(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[ie[0],ie[1]]}function Ue(ie,ue){var Y=ue[0],xe=ue[1],Te,Fe;return Y==="t"?Fe=ie.y:Y==="b"?Fe=ie.y+ie.height:Fe=ie.y+ie.height/2,xe==="l"?Te=ie.x:xe==="r"?Te=ie.x+ie.width:Te=ie.x+ie.width/2,{x:Te,y:Fe}}function Be(ie,ue){var Y={t:"b",b:"t",l:"r",r:"l"};return ie.map(function(xe,Te){return Te===ue?Y[xe]||"c":xe}).join("")}function Ze(ie,ue,Y,xe,Te,Fe,$){var se=m.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Te[xe]||{}}),Se=(0,fe.Z)(se,2),Ie=Se[0],Oe=Se[1],Ve=m.useRef(0),ut=m.useMemo(function(){return ue?z(ue):[]},[ue]),He=m.useRef({}),Ye=function(){He.current={}};ie||Ye();var We=(0,M.Z)(function(){if(ue&&Y&&ie){let Bn=function(ki,ci){var yi=arguments.length>2&&arguments[2]!==void 0?arguments[2]:En,ts=tt.x+ki,Pi=tt.y+ci,dn=ts+st,Ln=Pi+Qt,Wi=Math.max(ts,yi.left),St=Math.max(Pi,yi.top),Nt=Math.min(dn,yi.right),hn=Math.min(Ln,yi.bottom);return Math.max(0,(Nt-Wi)*(hn-St))},vi=function(){un=tt.y+pn,gi=un+Qt,ii=tt.x+ln,Mn=ii+st};var rt,ve,at,Xe,Ke=ue,pt=Ke.ownerDocument,Et=j(Ke),ct=Et.getComputedStyle(Ke),Dt=ct.position,Gt=Ke.style.left,lt=Ke.style.top,Tt=Ke.style.right,ge=Ke.style.bottom,de=Ke.style.overflow,pe=(0,T.Z)((0,T.Z)({},Te[xe]),Fe),P=pt.createElement("div");(rt=Ke.parentElement)===null||rt===void 0||rt.appendChild(P),P.style.left="".concat(Ke.offsetLeft,"px"),P.style.top="".concat(Ke.offsetTop,"px"),P.style.position=Dt,P.style.height="".concat(Ke.offsetHeight,"px"),P.style.width="".concat(Ke.offsetWidth,"px"),Ke.style.left="0",Ke.style.top="0",Ke.style.right="auto",Ke.style.bottom="auto",Ke.style.overflow="hidden";var G;if(Array.isArray(Y))G={x:Y[0],y:Y[1],width:0,height:0};else{var Q,re,ce=Y.getBoundingClientRect();ce.x=(Q=ce.x)!==null&&Q!==void 0?Q:ce.left,ce.y=(re=ce.y)!==null&&re!==void 0?re:ce.top,G={x:ce.x,y:ce.y,width:ce.width,height:ce.height}}var tt=Ke.getBoundingClientRect(),it=Et.getComputedStyle(Ke),ot=it.height,gt=it.width;tt.x=(ve=tt.x)!==null&&ve!==void 0?ve:tt.left,tt.y=(at=tt.y)!==null&&at!==void 0?at:tt.top;var kt=pt.documentElement,Ut=kt.clientWidth,Bt=kt.clientHeight,bt=kt.scrollWidth,rn=kt.scrollHeight,fn=kt.scrollTop,en=kt.scrollLeft,Qt=tt.height,st=tt.width,je=G.height,dt=G.width,Ft={left:0,top:0,right:Ut,bottom:Bt},Wt={left:-en,top:-fn,right:bt-en,bottom:rn-fn},tn=pe.htmlRegion,An="visible",yn="visibleFirst";tn!=="scroll"&&tn!==yn&&(tn=An);var on=tn===yn,wn=I(Wt,ut),zt=I(Ft,ut),En=tn===An?zt:wn,nn=on?zt:En;Ke.style.left="auto",Ke.style.top="auto",Ke.style.right="0",Ke.style.bottom="0";var oi=Ke.getBoundingClientRect();Ke.style.left=Gt,Ke.style.top=lt,Ke.style.right=Tt,Ke.style.bottom=ge,Ke.style.overflow=de,(Xe=Ke.parentElement)===null||Xe===void 0||Xe.removeChild(P);var Ht=y(Math.round(st/parseFloat(gt)*1e3)/1e3),Zt=y(Math.round(Qt/parseFloat(ot)*1e3)/1e3);if(Ht===0||Zt===0||(0,te.Sh)(Y)&&!(0,U.Z)(Y))return;var Pt=pe.offset,bn=pe.targetOffset,qt=Ee(tt,Pt),xn=(0,fe.Z)(qt,2),On=xn[0],Nn=xn[1],Rn=Ee(G,bn),mn=(0,fe.Z)(Rn,2),$t=mn[0],Mt=mn[1];G.x-=$t,G.y-=Mt;var jt=pe.points||[],Vt=(0,fe.Z)(jt,2),kn=Vt[0],Gn=Vt[1],Kn=Ce(Gn),Pn=Ce(kn),In=Ue(G,Kn),ei=Ue(tt,Pn),jn=(0,T.Z)({},pe),ln=In.x-ei.x+On,pn=In.y-ei.y+Nn,Yn=Bn(ln,pn),ti=Bn(ln,pn,zt),Vn=Ue(G,["t","l"]),Bi=Ue(tt,["t","l"]),Ui=Ue(G,["b","r"]),ni=Ue(tt,["b","r"]),wi=pe.overflow||{},qi=wi.adjustX,_n=wi.adjustY,Dn=wi.shiftX,Xi=wi.shiftY,li=function(ci){return typeof ci=="boolean"?ci:ci>=0},un,gi,ii,Mn;vi();var Qi=li(_n),vn=Pn[0]===Kn[0];if(Qi&&Pn[0]==="t"&&(gi>nn.bottom||He.current.bt)){var Di=pn;vn?Di-=Qt-je:Di=Vn.y-ni.y-Nn;var ls=Bn(ln,Di),Ss=Bn(ln,Di,zt);ls>Yn||ls===Yn&&(!on||Ss>=ti)?(He.current.bt=!0,pn=Di,Nn=-Nn,jn.points=[Be(Pn,0),Be(Kn,0)]):He.current.bt=!1}if(Qi&&Pn[0]==="b"&&(un<nn.top||He.current.tb)){var Ri=pn;vn?Ri+=Qt-je:Ri=Ui.y-Bi.y-Nn;var us=Bn(ln,Ri),As=Bn(ln,Ri,zt);us>Yn||us===Yn&&(!on||As>=ti)?(He.current.tb=!0,pn=Ri,Nn=-Nn,jn.points=[Be(Pn,0),Be(Kn,0)]):He.current.tb=!1}var $i=li(qi),Ji=Pn[1]===Kn[1];if($i&&Pn[1]==="l"&&(Mn>nn.right||He.current.rl)){var Ii=ln;Ji?Ii-=st-dt:Ii=Vn.x-ni.x-On;var mi=Bn(Ii,pn),Gi=Bn(Ii,pn,zt);mi>Yn||mi===Yn&&(!on||Gi>=ti)?(He.current.rl=!0,ln=Ii,On=-On,jn.points=[Be(Pn,1),Be(Kn,1)]):He.current.rl=!1}if($i&&Pn[1]==="r"&&(ii<nn.left||He.current.lr)){var Li=ln;Ji?Li+=st-dt:Li=Ui.x-Bi.x-On;var zn=Bn(Li,pn),Ci=Bn(Li,pn,zt);zn>Yn||zn===Yn&&(!on||Ci>=ti)?(He.current.lr=!0,ln=Li,On=-On,jn.points=[Be(Pn,1),Be(Kn,1)]):He.current.lr=!1}vi();var Wn=Dn===!0?0:Dn;typeof Wn=="number"&&(ii<zt.left&&(ln-=ii-zt.left-On,G.x+dt<zt.left+Wn&&(ln+=G.x-zt.left+dt-Wn)),Mn>zt.right&&(ln-=Mn-zt.right-On,G.x>zt.right-Wn&&(ln+=G.x-zt.right+Wn)));var Xn=Xi===!0?0:Xi;typeof Xn=="number"&&(un<zt.top&&(pn-=un-zt.top-Nn,G.y+je<zt.top+Xn&&(pn+=G.y-zt.top+je-Xn)),gi>zt.bottom&&(pn-=gi-zt.bottom-Nn,G.y>zt.bottom-Xn&&(pn+=G.y-zt.bottom+Xn)));var ui=tt.x+ln,Ot=ui+st,Ki=tt.y+pn,cs=Ki+Qt,Vi=G.x,es=Vi+dt,hs=G.y,ws=hs+je,fs=Math.max(ui,Vi),cn=Math.min(Ot,es),Ds=(fs+cn)/2,Rs=Ds-ui,ds=Math.max(Ki,hs),ps=Math.min(cs,ws),Is=(ds+ps)/2,Ls=Is-Ki;$==null||$(ue,jn);var Qn=oi.right-tt.x-(ln+tt.width),zi=oi.bottom-tt.y-(pn+tt.height);Ht===1&&(ln=Math.round(ln),Qn=Math.round(Qn)),Zt===1&&(pn=Math.round(pn),zi=Math.round(zi));var _i={ready:!0,offsetX:ln/Ht,offsetY:pn/Zt,offsetR:Qn/Ht,offsetB:zi/Zt,arrowX:Rs/Ht,arrowY:Ls/Zt,scaleX:Ht,scaleY:Zt,align:jn};Oe(_i)}}),ht=function(){Ve.current+=1;var ve=Ve.current;Promise.resolve().then(function(){Ve.current===ve&&We()})},ft=function(){Oe(function(ve){return(0,T.Z)((0,T.Z)({},ve),{},{ready:!1})})};return(0,g.Z)(ft,[xe]),(0,g.Z)(function(){ie||ft()},[ie]),[Ie.ready,Ie.offsetX,Ie.offsetY,Ie.offsetR,Ie.offsetB,Ie.arrowX,Ie.arrowY,Ie.scaleX,Ie.scaleY,Ie.align,ht]}var et=W(3300);function $e(ie,ue,Y,xe,Te){(0,g.Z)(function(){if(ie&&ue&&Y){let Ve=function(){xe(),Te()};var Fe=ue,$=Y,se=z(Fe),Se=z($),Ie=j($),Oe=new Set([Ie].concat((0,et.Z)(se),(0,et.Z)(Se)));return Oe.forEach(function(ut){ut.addEventListener("scroll",Ve,{passive:!0})}),Ie.addEventListener("resize",Ve,{passive:!0}),xe(),function(){Oe.forEach(function(ut){ut.removeEventListener("scroll",Ve),Ie.removeEventListener("resize",Ve)})}}},[ie,ue,Y])}var be=W(48736);function he(ie,ue,Y,xe,Te,Fe,$,se){var Se=m.useRef(ie);Se.current=ie;var Ie=m.useRef(!1);m.useEffect(function(){if(ue&&xe&&(!Te||Fe)){var Ve=function(){Ie.current=!1},ut=function(at){var Xe;Se.current&&!$(((Xe=at.composedPath)===null||Xe===void 0||(Xe=Xe.call(at))===null||Xe===void 0?void 0:Xe[0])||at.target)&&!Ie.current&&se(!1)},He=j(xe);He.addEventListener("pointerdown",Ve,!0),He.addEventListener("mousedown",ut,!0),He.addEventListener("contextmenu",ut,!0);var Ye=(0,l.A)(Y);if(Ye&&(Ye.addEventListener("mousedown",ut,!0),Ye.addEventListener("contextmenu",ut,!0)),0)var We,ht,ft,rt;return function(){He.removeEventListener("pointerdown",Ve,!0),He.removeEventListener("mousedown",ut,!0),He.removeEventListener("contextmenu",ut,!0),Ye&&(Ye.removeEventListener("mousedown",ut,!0),Ye.removeEventListener("contextmenu",ut,!0))}}},[ue,Y,xe,Te,Fe]);function Oe(){Ie.current=!0}return Oe}var we=["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 Ae(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oe.Z,ue=m.forwardRef(function(Y,xe){var Te=Y.prefixCls,Fe=Te===void 0?"rc-trigger-popup":Te,$=Y.children,se=Y.action,Se=se===void 0?"hover":se,Ie=Y.showAction,Oe=Y.hideAction,Ve=Y.popupVisible,ut=Y.defaultPopupVisible,He=Y.onPopupVisibleChange,Ye=Y.afterPopupVisibleChange,We=Y.mouseEnterDelay,ht=Y.mouseLeaveDelay,ft=ht===void 0?.1:ht,rt=Y.focusDelay,ve=Y.blurDelay,at=Y.mask,Xe=Y.maskClosable,Ke=Xe===void 0?!0:Xe,pt=Y.getPopupContainer,Et=Y.forceRender,ct=Y.autoDestroy,Dt=Y.destroyPopupOnHide,Gt=Y.popup,lt=Y.popupClassName,Tt=Y.popupStyle,ge=Y.popupPlacement,de=Y.builtinPlacements,pe=de===void 0?{}:de,P=Y.popupAlign,G=Y.zIndex,Q=Y.stretch,re=Y.getPopupClassNameFromAlign,ce=Y.fresh,tt=Y.alignPoint,it=Y.onPopupClick,ot=Y.onPopupAlign,gt=Y.arrow,kt=Y.popupMotion,Ut=Y.maskMotion,Bt=Y.popupTransitionName,bt=Y.popupAnimation,rn=Y.maskTransitionName,fn=Y.maskAnimation,en=Y.className,Qt=Y.getTriggerDOMNode,st=(0,ke.Z)(Y,we),je=ct||Dt||!1,dt=m.useState(!1),Ft=(0,fe.Z)(dt,2),Wt=Ft[0],tn=Ft[1];(0,g.Z)(function(){tn((0,b.Z)())},[]);var An=m.useRef({}),yn=m.useContext(_e),on=m.useMemo(function(){return{registerSubPopup:function(Nt,hn){An.current[Nt]=hn,yn==null||yn.registerSubPopup(Nt,hn)}}},[yn]),wn=(0,A.Z)(),zt=m.useState(null),En=(0,fe.Z)(zt,2),nn=En[0],oi=En[1],Ht=m.useRef(null),Zt=(0,M.Z)(function(St){Ht.current=St,(0,te.Sh)(St)&&nn!==St&&oi(St),yn==null||yn.registerSubPopup(wn,St)}),Pt=m.useState(null),bn=(0,fe.Z)(Pt,2),qt=bn[0],xn=bn[1],On=m.useRef(null),Nn=(0,M.Z)(function(St){(0,te.Sh)(St)&&qt!==St&&(xn(St),On.current=St)}),Rn=m.Children.only($),mn=(Rn==null?void 0:Rn.props)||{},$t={},Mt=(0,M.Z)(function(St){var Nt,hn,Sn=qt;return(Sn==null?void 0:Sn.contains(St))||((Nt=(0,l.A)(Sn))===null||Nt===void 0?void 0:Nt.host)===St||St===Sn||(nn==null?void 0:nn.contains(St))||((hn=(0,l.A)(nn))===null||hn===void 0?void 0:hn.host)===St||St===nn||Object.values(An.current).some(function(gn){return(gn==null?void 0:gn.contains(St))||St===gn})}),jt=K(Fe,kt,bt,Bt),Vt=K(Fe,Ut,fn,rn),kn=m.useState(ut||!1),Gn=(0,fe.Z)(kn,2),Kn=Gn[0],Pn=Gn[1],In=Ve!=null?Ve:Kn,ei=(0,M.Z)(function(St){Ve===void 0&&Pn(St)});(0,g.Z)(function(){Pn(Ve||!1)},[Ve]);var jn=m.useRef(In);jn.current=In;var ln=m.useRef([]);ln.current=[];var pn=(0,M.Z)(function(St){var Nt;ei(St),((Nt=ln.current[ln.current.length-1])!==null&&Nt!==void 0?Nt:In)!==St&&(ln.current.push(St),He==null||He(St))}),Yn=m.useRef(),ti=function(){clearTimeout(Yn.current)},Vn=function(Nt){var hn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;ti(),hn===0?pn(Nt):Yn.current=setTimeout(function(){pn(Nt)},hn*1e3)};m.useEffect(function(){return ti},[]);var Bi=m.useState(!1),Ui=(0,fe.Z)(Bi,2),ni=Ui[0],wi=Ui[1];(0,g.Z)(function(St){(!St||In)&&wi(!0)},[In]);var qi=m.useState(null),_n=(0,fe.Z)(qi,2),Dn=_n[0],Xi=_n[1],li=m.useState(null),un=(0,fe.Z)(li,2),gi=un[0],ii=un[1],Mn=function(Nt){ii([Nt.clientX,Nt.clientY])},Qi=Ze(In,nn,tt&&gi!==null?gi:qt,ge,pe,P,ot),vn=(0,fe.Z)(Qi,11),Di=vn[0],ls=vn[1],Ss=vn[2],Ri=vn[3],us=vn[4],As=vn[5],$i=vn[6],Ji=vn[7],Ii=vn[8],mi=vn[9],Gi=vn[10],Li=Ge(Wt,Se,Ie,Oe),zn=(0,fe.Z)(Li,2),Ci=zn[0],Wn=zn[1],Xn=Ci.has("click"),ui=Wn.has("click")||Wn.has("contextMenu"),Ot=(0,M.Z)(function(){ni||Gi()}),Ki=function(){jn.current&&tt&&ui&&Vn(!1)};$e(In,qt,nn,Ot,Ki),(0,g.Z)(function(){Ot()},[gi,ge]),(0,g.Z)(function(){In&&!(pe!=null&&pe[ge])&&Ot()},[JSON.stringify(P)]);var cs=m.useMemo(function(){var St=O(pe,Fe,mi,tt);return p()(St,re==null?void 0:re(mi))},[mi,re,pe,Fe,tt]);m.useImperativeHandle(xe,function(){return{nativeElement:On.current,popupElement:Ht.current,forceAlign:Ot}});var Vi=m.useState(0),es=(0,fe.Z)(Vi,2),hs=es[0],ws=es[1],fs=m.useState(0),cn=(0,fe.Z)(fs,2),Ds=cn[0],Rs=cn[1],ds=function(){if(Q&&qt){var Nt=qt.getBoundingClientRect();ws(Nt.width),Rs(Nt.height)}},ps=function(){ds(),Ot()},Is=function(Nt){wi(!1),Gi(),Ye==null||Ye(Nt)},Ls=function(){return new Promise(function(Nt){ds(),Xi(function(){return Nt})})};(0,g.Z)(function(){Dn&&(Gi(),Dn(),Xi(null))},[Dn]);function Qn(St,Nt,hn,Sn){$t[St]=function(gn){var gs;Sn==null||Sn(gn),Vn(Nt,hn);for(var Cs=arguments.length,ns=new Array(Cs>1?Cs-1:0),Fi=1;Fi<Cs;Fi++)ns[Fi-1]=arguments[Fi];(gs=mn[St])===null||gs===void 0||gs.call.apply(gs,[mn,gn].concat(ns))}}(Xn||ui)&&($t.onClick=function(St){var Nt;jn.current&&ui?Vn(!1):!jn.current&&Xn&&(Mn(St),Vn(!0));for(var hn=arguments.length,Sn=new Array(hn>1?hn-1:0),gn=1;gn<hn;gn++)Sn[gn-1]=arguments[gn];(Nt=mn.onClick)===null||Nt===void 0||Nt.call.apply(Nt,[mn,St].concat(Sn))});var zi=he(In,ui,qt,nn,at,Ke,Mt,Vn),_i=Ci.has("hover"),Bn=Wn.has("hover"),vi,ki;_i&&(Qn("onMouseEnter",!0,We,function(St){Mn(St)}),Qn("onPointerEnter",!0,We,function(St){Mn(St)}),vi=function(Nt){(In||ni)&&nn!==null&&nn!==void 0&&nn.contains(Nt.target)&&Vn(!0,We)},tt&&($t.onMouseMove=function(St){var Nt;(Nt=mn.onMouseMove)===null||Nt===void 0||Nt.call(mn,St)})),Bn&&(Qn("onMouseLeave",!1,ft),Qn("onPointerLeave",!1,ft),ki=function(){Vn(!1,ft)}),Ci.has("focus")&&Qn("onFocus",!0,rt),Wn.has("focus")&&Qn("onBlur",!1,ve),Ci.has("contextMenu")&&($t.onContextMenu=function(St){var Nt;jn.current&&Wn.has("contextMenu")?Vn(!1):(Mn(St),Vn(!0)),St.preventDefault();for(var hn=arguments.length,Sn=new Array(hn>1?hn-1:0),gn=1;gn<hn;gn++)Sn[gn-1]=arguments[gn];(Nt=mn.onContextMenu)===null||Nt===void 0||Nt.call.apply(Nt,[mn,St].concat(Sn))}),en&&($t.className=p()(mn.className,en));var ci=m.useRef(!1);ci.current||(ci.current=Et||In||ni);var yi=(0,T.Z)((0,T.Z)({},mn),$t),ts={},Pi=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Pi.forEach(function(St){st[St]&&(ts[St]=function(){for(var Nt,hn=arguments.length,Sn=new Array(hn),gn=0;gn<hn;gn++)Sn[gn]=arguments[gn];(Nt=yi[St])===null||Nt===void 0||Nt.call.apply(Nt,[yi].concat(Sn)),st[St].apply(st,Sn)})});var dn=m.cloneElement(Rn,(0,T.Z)((0,T.Z)({},yi),ts)),Ln={x:As,y:$i},Wi=gt?(0,T.Z)({},gt!==!0?gt:{}):null;return m.createElement(m.Fragment,null,m.createElement(ae.Z,{disabled:!In,ref:Nn,onResize:ps},m.createElement(ee,{getTriggerDOMNode:Qt},dn)),ci.current&&m.createElement(_e.Provider,{value:on},m.createElement(q,{portal:ie,ref:Zt,prefixCls:Fe,popup:Gt,className:p()(lt,cs),style:Tt,target:qt,onMouseEnter:vi,onMouseLeave:ki,onPointerEnter:vi,zIndex:G,open:In,keepDom:ni,fresh:ce,onClick:it,onPointerDownCapture:zi,mask:at,motion:jt,maskMotion:Vt,onVisibleChanged:Is,onPrepare:Ls,forceRender:Et,autoDestroy:je,getPopupContainer:pt,align:mi,arrow:Wi,arrowPos:Ln,ready:Di,offsetX:ls,offsetY:Ss,offsetR:Ri,offsetB:us,onAlign:Ot,stretch:Q,targetWidth:hs/Ji,targetHeight:Ds/Ii})))});return ue}var qe=Ae(oe.Z)},64885:function(Rt,nt,W){"use strict";W.d(nt,{Z:function(){return m}});var T=W(99571),fe=W(59301),ke=Object.defineProperty,oe=Object.defineProperties,H=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,ae=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,l=(x,C,L)=>C in x?ke(x,C,{enumerable:!0,configurable:!0,writable:!0,value:L}):x[C]=L,M=(x,C)=>{for(var L in C||(C={}))ae.call(C,L)&&l(x,L,C[L]);if(p)for(var L of p(C))te.call(C,L)&&l(x,L,C[L]);return x},A=(x,C)=>oe(x,H(C)),g=(x,C)=>{var L={};for(var F in x)ae.call(x,F)&&C.indexOf(F)<0&&(L[F]=x[F]);if(x!=null&&p)for(var F of p(x))C.indexOf(F)<0&&te.call(x,F)&&(L[F]=x[F]);return L},b=(x,C,L)=>new Promise((F,w)=>{var k=q=>{try{V(L.next(q))}catch(le){w(le)}},N=q=>{try{V(L.throw(q))}catch(le){w(le)}},V=q=>q.done?F(q.value):Promise.resolve(q.value).then(k,N);V((L=L.apply(x,C)).next())});const m=x=>{var C=x,{children:L}=C,F=g(C,["children"]);const[w,k]=(0,fe.useState)(!1);return fe.createElement(T.ZP,A(M({},F),{loading:w,onClick:N=>b(void 0,null,function*(){try{k(!0),yield F.onClick(N),k(!1)}catch(V){console.error(V),k(!1)}})}),L)}},57884:function(Rt,nt,W){"use strict";var T=W(59301),fe=W(93314),ke=W(99571),oe=Object.defineProperty,H=Object.defineProperties,p=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,M=(m,x,C)=>x in m?oe(m,x,{enumerable:!0,configurable:!0,writable:!0,value:C}):m[x]=C,A=(m,x)=>{for(var C in x||(x={}))te.call(x,C)&&M(m,C,x[C]);if(ae)for(var C of ae(x))l.call(x,C)&&M(m,C,x[C]);return m},g=(m,x)=>H(m,p(x));const b=({img:m,buttonProps:x={},styles:C={},customText:L,ButtonText:F,ButtonClick:w,Buttonclass:k,ButtonTwo:N,imgStyles:V,loading:q=!1,className:le=""})=>T.createElement("section",{className:`tc animated fadeIn ${le}`,style:A({color:"#999",margin:"100px auto",visibility:q?"hidden":"visible"},C)},T.createElement("img",{src:m||fe,style:g(A({},V),{pointerEvents:"none",userSelect:"none"})}),T.createElement("p",{className:"mt20 font14"},L||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),F&&T.createElement(ke.ZP,A({className:k,onClick:w},x),F),N&&N);nt.Z=b},41550:function(Rt,nt,W){"use strict";W.d(nt,{Z:function(){return k}});var T=W(59301),fe={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},ke=W(99571),oe=W(70557),H=W(51124),p=W(25399),ae=W(49661),te=W(72664),l=W(57884),M=W(90524),A=W(14794),g=W(59301),b=Object.defineProperty,m=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,L=(N,V,q)=>V in N?b(N,V,{enumerable:!0,configurable:!0,writable:!0,value:q}):N[V]=q,F=(N,V)=>{for(var q in V||(V={}))x.call(V,q)&&L(N,q,V[q]);if(m)for(var q of m(V))C.call(V,q)&&L(N,q,V[q]);return N},w=(N,V,q)=>new Promise((le,ee)=>{var X=Ge=>{try{ye(q.next(Ge))}catch(U){ee(U)}},_e=Ge=>{try{ye(q.throw(Ge))}catch(U){ee(U)}},ye=Ge=>Ge.done?le(Ge.value):Promise.resolve(Ge.value).then(X,_e);ye((q=q.apply(N,V)).next())}),k=({editOffice:N="view",data:V,issaver:q,onSaver:le,theme:ee,type:X,filename:_e,monacoEditor:ye,className:Ge,style:U,close:R,onClose:O,hasMask:K,disabledDownload:j,onImgDimensions:z,showNodata:y,recordInfo:_})=>{const[I,Z]=(0,T.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Ee,Ce]=(0,T.useState)(""),[Ue,Be]=(0,T.useState)(),Ze=window.ENV==="build"?"/react/build":"",et=location.host.startsWith("localhost")?M.Z.PROXY_SERVER:M.Z.API_SERVER,be=10*(1024*1024),he=(0,T.useRef)();V!=null&&V.startsWith("/api")&&X!=="txt"&&(V=M.Z.API_SERVER+V);const we=Y=>Y.substring(Y.lastIndexOf("/")+1).split(".").pop();_e&&ye&&(ye.filename=_e),(0,T.useEffect)(()=>{var Y,xe;const Te=(xe=(Y=document.cookie)==null?void 0:Y.replace(/\s/g,""))==null?void 0:xe.split(";");Te==null||Te.map(Fe=>{let $=Fe.split("=");$[0]==="_educoder_session"&&Ce($[1])})},[]),(0,T.useEffect)(()=>{X==="office"&&(V.indexOf("bigfilescdn.")>-1||V.indexOf("bigfiles1")>-1?Be({url:V,fileType:we(V),model:V.indexOf("model=edit")?"edit":"view"}):qe())},[X,V]);function Ae(Y){return w(this,null,function*(){Y.data.type==="pdfdata"&&(le(Y.data.data),window.removeEventListener("message",Ae,!1)),console.log("mess---:",Y.data)})}const qe=()=>w(void 0,null,function*(){console.log("data:",V);let Y=V;V.startsWith("http")||(Y=location.origin+Y);let xe=new URL(Y).pathname.split("/").pop();const Te=yield(0,te.gJ)({attachment_id:xe});Te.url=et+Te.url,Be(Te)}),ie=()=>{if(V.startsWith("http")||V.startsWith("blob:")){ue();return}(0,ae.Sv)(_e||"educoder",V,_e)},ue=()=>{_&&(0,A.fc)({id:_==null?void 0:_.id,watch_type:1,course_id:_==null?void 0:_.course_id}),(0,ae.Nd)(_e||"educoder",decodeURIComponent(V))};return g.createElement("div",{style:F({},U||{}),className:`${K&&fe.bgBlack} ${X?fe.wrp:"hide"}`},R&&g.createElement("div",{className:fe.close,ref:he},!!z&&g.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>he.current},g.createElement("span",{onClick:()=>{O(),z()}},g.createElement("i",{className:"icon-yulanpizhu"}))),!j&&g.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>he.current},g.createElement("span",{onClick:ue},g.createElement("i",{className:"icon-quxiaozhiding"}))),q&&g.createElement(p.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>he.current},g.createElement("span",{className:"",onClick:()=>{const Y=document.getElementById("pdfiframe");window.addEventListener("message",Ae,!1),setTimeout(()=>{Y.contentWindow.postMessage("getData","*")},300)}},g.createElement("i",{className:"icon-baocun"}))),g.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>he.current},g.createElement("span",{className:"",onClick:()=>{O()}},g.createElement("i",{className:"icon-guanbi1"})))),g.createElement("div",{className:`${fe[Ge]} ${Ge} ${fe.monaco} ${X==="txt"?"show":"hide"}`},X==="txt"&&g.createElement(g.Fragment,null,g.createElement(H.ZP,F({},ye)))),X==="audio"&&g.createElement("audio",{src:`${(V==null?void 0:V.indexOf("http://"))>-1||(V==null?void 0:V.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${V}`,autoPlay:!0}),X==="video"&&g.createElement(g.Fragment,null,(V==null?void 0:V.indexOf("http"))>-1?g.createElement("video",{controls:!0,src:`${V}`,autoPlay:!0}):g.createElement("video",{controls:!0,src:`data:video/mp4;base64,${V}`,autoPlay:!0})),X==="office"&&Ue&&g.createElement("iframe",{src:`${Ze}/office.html?key=${Ue.key}&url=${btoa(Ue.url)}&callbackUrl=${et+(Ue.callbackUrl||"")}&fileType=${Ue.fileType}&title=${Ue.title||""}&model=${N}&officeServer=${M.Z.ONLYOFFICE}&disabledDownload=${!!j}`}),X==="html"&&g.createElement("iframe",{src:V+"&disposition=inline"}),X==="pdf"&&g.createElement("iframe",{id:"pdfiframe",src:`${Ze}/js/pdfview/index.html?filename=${_e||"educoder.pdf"}&url=${encodeURIComponent(V)}&disabledDownload=${!!j}&model=${N}`}),X==="image"&&g.createElement("img",{src:`${(V==null?void 0:V.indexOf("http://"))>-1||(V==null?void 0:V.indexOf("https://"))>-1?"":"data:image/png;base64,"}${V}`}),(X==="other"||X==="download")&&g.createElement(g.Fragment,null,y?g.createElement(l.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:g.createElement(ke.ZP,{icon:g.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:ie,disabled:j},"\u4E0B\u8F7D")}):g.createElement(ke.ZP,{type:"primary",size:"middle",onClick:ie,disabled:j},g.createElement(oe.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")),X==="flowChart"&&g.createElement("div",{className:"embed"},g.createElement("iframe",{src:`/drawio/src/main/webapp/viewer.html?id=${V||""}&gapi=0&od=0&db=0&gh=0&gl=0`,width:"100%",height:"100%",frameBorder:"0"})))}},38394:function(Rt,nt,W){"use strict";W.d(nt,{z:function(){return ye},Z:function(){return Ge}});var T=W(59301),fe=W(88831),ke=W(90290),oe=W(64018),H=W(68535),p=W(90524),ae=W(49661),te=W(15342),l=W(77736),M=W(99571),A=W(1012),g=W(41550),b=W(59301),x=({html:U})=>{const R=(0,T.useRef)(null),O=(0,T.useRef)(null),K=`.markdown-body p {
margin: 0 0 16px 0 !important;
line-height: 28px;
white-space: pre-wrap;
}
ol,
ul,
li {
list-style-type: none
}
ol,
ul,
dl {
margin-bottom: 0px;
}
.markdown-body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
color: #333;
overflow: hidden;
font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", "Monaco", monospace, Tahoma, STXihei, "\u534E\u6587\u7EC6\u9ED1", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "\u5B8B\u4F53", Heiti, "\u9ED1\u4F53", sans-serif;
word-break: break-word;
font-size: 16px;
line-height: 1.6;
white-space: normal;
word-wrap: break-word;
position: relative;
}
.markdown-body ul>li {
list-style-type: disc;
}
.markdown-body ol>li {
list-style-type: decimal;
}
.markdown-body a {
background: transparent;
}
.markdown-body a:active,
.markdown-body a:hover {
outline: 0;
}
.markdown-body strong {
font-weight: bold;
}
.markdown-body h1 {
font-size: 2em;
margin: 0.67em 0;
}
.markdown-body img {
border: 0;
}
.markdown-body hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
.markdown-body pre {
overflow: auto;
}
.markdown-body code,
.markdown-body kbd,
.markdown-body pre {
font-family: "Meiryo UI", "YaHei Consolas Hybrid", Consolas, "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace;
font-size: 1em;
}
.markdown-body input {
color: inherit;
font: inherit;
margin: 0;
}
.markdown-body html input[disabled] {
cursor: default;
}
.markdown-body input {
line-height: normal;
}
.markdown-body input[type="checkbox"] {
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
.markdown-body table {
border-collapse: collapse;
border-spacing: 0;
}
.markdown-body td,
.markdown-body th {
padding: 0;
}
.markdown-body * {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.markdown-body input {
font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}
.markdown-body a {
color: #4183c4;
text-decoration: none;
}
.markdown-body a:hover,
.markdown-body a:active {
text-decoration: underline;
}
.markdown-body hr {
height: 0;
margin: 15px 0;
overflow: hidden;
background: transparent;
border: 0;
border-bottom: 1px solid #ddd;
}
.markdown-body hr:before {
display: table;
content: "";
}
.markdown-body hr:after {
display: table;
clear: both;
content: "";
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 15px;
margin-bottom: 15px;
line-height: 1.1;
}
.markdown-body h1 {
font-size: 30px;
}
.markdown-body h2 {
font-size: 21px;
}
.markdown-body h3 {
font-size: 16px;
}
.markdown-body h4 {
font-size: 14px;
}
.markdown-body h5 {
font-size: 12px;
}
.markdown-body h6 {
font-size: 11px;
}
.markdown-body blockquote {
margin: 0;
}
.markdown-body ul,
.markdown-body ol {
padding: 0;
margin-top: 0;
margin-bottom: 0;
}
ul.linenums,
ol.linenums {
padding: 16px 0 0 56px !important;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 2em;
}
.markdown-body ol ol,
.markdown-body ul ol {
list-style-type: lower-roman;
}
.markdown-body ul ul ol,
.markdown-body ul ol ol,
.markdown-body ol ul ol,
.markdown-body ol ol ol {
list-style-type: lower-alpha;
}
.markdown-body dd {
margin-left: 0;
}
.markdown-body code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 12px;
}
.markdown-body pre {
margin-top: 0;
margin-bottom: 0;
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
.markdown-body .octicon {
font: normal normal 16px octicons-anchor;
line-height: 1;
display: inline-block;
text-decoration: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.markdown-body .octicon-link:before {
content: '\f05c';
}
.markdown-body>*:first-child {
margin-top: 0 !important;
}
.markdown-body>*:last-child {
margin-bottom: 0 !important;
}
.markdown-body .anchor {
position: absolute;
top: 0;
left: 0;
display: block;
padding-right: 6px;
padding-left: 30px;
margin-left: -30px;
}
.markdown-body .anchor:focus {
outline: none;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
position: relative;
margin-top: 1em;
margin-bottom: 16px;
font-weight: bold;
line-height: 1.4;
}
.markdown-body h1 .octicon-link,
.markdown-body h2 .octicon-link,
.markdown-body h3 .octicon-link,
.markdown-body h4 .octicon-link,
.markdown-body h5 .octicon-link,
.markdown-body h6 .octicon-link {
display: none;
color: #000;
vertical-align: middle;
}
.markdown-body h1:hover .anchor,
.markdown-body h2:hover .anchor,
.markdown-body h3:hover .anchor,
.markdown-body h4:hover .anchor,
.markdown-body h5:hover .anchor,
.markdown-body h6:hover .anchor {
padding-left: 8px;
margin-left: -30px;
text-decoration: none;
}
.markdown-body h1:hover .anchor .octicon-link,
.markdown-body h2:hover .anchor .octicon-link,
.markdown-body h3:hover .anchor .octicon-link,
.markdown-body h4:hover .anchor .octicon-link,
.markdown-body h5:hover .anchor .octicon-link,
.markdown-body h6:hover .anchor .octicon-link {
display: inline-block;
}
.markdown-body h1 {
padding-bottom: 0.3em;
font-size: 2.25em;
line-height: 1.2;
border-bottom: 1px solid #eee;
}
.markdown-body h1 .anchor {
line-height: 1;
}
.markdown-body h2 {
padding-bottom: 0.3em;
font-size: 1.75em;
line-height: 1.225;
border-bottom: 1px solid #eee;
}
.markdown-body h2 .anchor {
line-height: 1;
}
.markdown-body h3 {
font-size: 1.5em;
line-height: 1.43;
}
.markdown-body h3 .anchor {
line-height: 1.2;
}
.markdown-body h4 {
font-size: 1.25em;
}
.markdown-body h4 .anchor {
line-height: 1.2;
}
.markdown-body h5 {
font-size: 1em;
}
.markdown-body h5 .anchor {
line-height: 1.1;
}
.markdown-body h6 {
font-size: 1em;
color: #777;
}
.markdown-body h6 .anchor {
line-height: 1.1;
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
}
.markdown-body ul ul,
.markdown-body ul ol,
.markdown-body ol ol,
.markdown-body ol ul {
margin-top: 0;
margin-bottom: 0;
}
.markdown-body li>p {
margin-top: 16px;
}
.markdown-body dl {
padding: 0;
}
.markdown-body dl dt {
padding: 0;
margin-top: 16px;
font-size: 1em;
font-style: italic;
font-weight: bold;
}
.markdown-body dl dd {
padding: 0 16px;
margin-bottom: 16px;
}
.markdown-body blockquote {
padding: 0 15px;
color: #777;
border-left: 4px solid #ddd;
}
.markdown-body blockquote> :first-child {
margin-top: 0;
}
.markdown-body blockquote> :last-child {
margin-bottom: 0;
}
.markdown-body table {
display: block;
width: 100%;
overflow: auto;
word-break: normal;
word-break: keep-all;
}
.markdown-body table th {
font-weight: bold;
text-align: revert;
}
.markdown-body table th,
.markdown-body table td {
padding: 6px 13px;
border: 1px solid #ddd;
}
.markdown-body table tr {
background-color: #fff;
border-top: 1px solid #ccc;
}
.markdown-body table tr:nth-child(2n) {
background-color: #f8f8f8;
}
.markdown-body img {
max-width: 100%;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.markdown-body code {
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
margin: 0;
font-size: 85%;
background-color: rgba(0, 0, 0, 0.04);
border-radius: 3px;
}
.markdown-body code:has(.katex) {
background-color: transparent;
}
.markdown-body code:before,
.markdown-body code:after {
letter-spacing: -0.2em;
content: "\\00a0";
}
.markdown-body pre>code {
padding: 0;
margin: 0;
font-size: 100%;
word-break: normal;
white-space: pre;
background: transparent;
border: 0;
}
.markdown-body .highlight {
margin-bottom: 16px;
}
.markdown-body .highlight pre,
.markdown-body pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f7f7f7;
border-radius: 3px;
}
.markdown-body .highlight pre {
margin-bottom: 0;
word-break: normal;
}
.markdown-body pre {
word-wrap: normal;
}
.markdown-body pre code {
display: inline;
max-width: initial;
padding: 0;
margin: 0;
overflow: initial;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
}
.markdown-body pre code:before,
.markdown-body pre code:after {
content: normal;
}
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body .pl-c {
color: #969896;
}
.markdown-body .pl-c1,
.markdown-body .pl-mdh,
.markdown-body .pl-mm,
.markdown-body .pl-mp,
.markdown-body .pl-mr,
.markdown-body .pl-s1 .pl-v,
.markdown-body .pl-s3,
.markdown-body .pl-sc,
.markdown-body .pl-sv {
color: #0086b3;
}
.markdown-body .pl-e,
.markdown-body .pl-en {
color: #795da3;
}
.markdown-body .pl-s1 .pl-s2,
.markdown-body .pl-smi,
.markdown-body .pl-smp,
.markdown-body .pl-stj,
.markdown-body .pl-vo,
.markdown-body .pl-vpf {
color: #333;
}
.markdown-body .pl-ent {
color: #63a35c;
}
.markdown-body .pl-k,
.markdown-body .pl-s,
.markdown-body .pl-st {
color: #a71d5d;
}
.markdown-body .pl-pds,
.markdown-body .pl-s1,
.markdown-body .pl-s1 .pl-pse .pl-s2,
.markdown-body .pl-sr,
.markdown-body .pl-sr .pl-cce,
.markdown-body .pl-sr .pl-sra,
.markdown-body .pl-sr .pl-sre,
.markdown-body .pl-src {
color: #df5000;
}
.markdown-body .pl-mo,
.markdown-body .pl-v {
color: #1d3e81;
}
.markdown-body .pl-id {
color: #b52a1d;
}
.markdown-body .pl-ii {
background-color: #b52a1d;
color: #f8f8f8;
}
.markdown-body .pl-sr .pl-cce {
color: #63a35c;
font-weight: bold;
}
.markdown-body .pl-ml {
color: #693a17;
}
.markdown-body .pl-mh,
.markdown-body .pl-mh .pl-en,
.markdown-body .pl-ms {
color: #1d3e81;
font-weight: bold;
}
.markdown-body .pl-mq {
color: #008080;
}
.markdown-body .pl-mi {
color: #333;
font-style: italic;
}
.markdown-body .pl-mb {
color: #333;
font-weight: bold;
}
.markdown-body .pl-md,
.markdown-body .pl-mdhf {
background-color: #ffecec;
color: #bd2c00;
}
.markdown-body .pl-mdht,
.markdown-body .pl-mi1 {
background-color: #eaffea;
color: #55a532;
}
.markdown-body .pl-mdr {
color: #795da3;
font-weight: bold;
}
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body .task-list-item {
list-style-type: none;
}
.markdown-body .task-list-item+.task-list-item {
margin-top: 3px;
}
.markdown-body .task-list-item input {
float: left;
margin: 0.3em 0 0.25em -1.6em;
vertical-align: middle;
}
.markdown-body :checked+.radio-label {
z-index: 1;
position: relative;
border-color: #4183c4;
}
/*! Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
.pln {
color: #000
}
/* plain text */
@media screen {
.str {
color: #080
}
/* string content */
.kwd {
color: #008
}
/* a keyword */
.com {
color: #800
}
/* a comment */
.typ {
color: #606
}
/* a type name */
.lit {
color: #066
}
/* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun,
.opn,
.clo {
color: #660
}
.tag {
color: #008
}
/* a markup tag name */
.atn {
color: #606
}
/* a markup attribute name */
.atv {
color: #080
}
/* a markup attribute value */
.dec,
.var {
color: #606
}
/* a declaration; a variable name */
.fun {
color: red
}
/* a function name */
}
/* Use higher contrast and text-weight for printable form. */
@media print,
projection {
.str {
color: #060
}
.kwd {
color: #006;
font-weight: bold
}
.com {
color: #600;
font-style: italic
}
.typ {
color: #404;
font-weight: bold
}
.lit {
color: #044
}
.pun,
.opn,
.clo {
color: #440
}
.tag {
color: #006;
font-weight: bold
}
.atn {
color: #404
}
.atv {
color: #060
}
}
/* Put a border around prettyprinted code snippets. */
pre.prettyprint {
padding: 2px;
/* border: 1px solid #888 */
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0
}
/* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 {
list-style-type: none
}
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 {
background: #eee
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
}`;return(0,T.useEffect)(()=>{const j=R.current.attachShadow({mode:"open"});O.current=document.createElement("div"),O.current.className="markdown-body",O.current.innerHTML=U,j.appendChild(O.current);const z=document.createElement("style");return z.textContent=K,j.appendChild(z),()=>{j.innerHTML=""}},[]),(0,T.useEffect)(()=>{O.current&&(O.current.innerHTML=U)},[U]),b.createElement("div",{ref:R})};function C(U){const R=["onabort","onanimationend","onanimationiteration","onanimationstart","onauxclick","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncopy","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitionend","onvolumechange","onwaiting","onwheel"],O=new RegExp(`\\b(${R.join("|")})\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]*)`,"gi");return U.replace(O,"").trim()}var L={mdBody:"mdBody___raKXb",button:"button___Ch5Pc",previewFlowChart:"previewFlowChart___vY1dq"},F=Object.defineProperty,w=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,V=(U,R,O)=>R in U?F(U,R,{enumerable:!0,configurable:!0,writable:!0,value:O}):U[R]=O,q=(U,R)=>{for(var O in R||(R={}))k.call(R,O)&&V(U,O,R[O]);if(w)for(var O of w(R))N.call(R,O)&&V(U,O,R[O]);return U};const le="@\u2581\u2581@",ee="@\u2581@",X=/<pre[^>]*>/g;function _e(U){let R=document.createElement("div");return R.innerHTML=U,R.childNodes.length===0?"":R.childNodes[0].nodeValue}const ye=(U,R)=>{U=U||"";const O=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,K=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,j=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,z=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return R?U.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(O,(y,_,I,Z,Ee,Ce,Ue)=>{const Be=_||Z||Ce,Ze=I||Ee||Ue||"?";return p.Z.API_SERVER+"/api/attachments/"+Be+Ze+"&t="+(0,ae.Jn)(Be,Date.now())+(y.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(U=U.replace(z,(y,_,I,Z,Ee,Ce,Ue)=>{const Be=_||Z||Ce,Ze=I||Ee||Ue||"?";return p.Z.API_SERVER+"/attachments/download/"+Be+Ze+"&t="+(0,ae.Jn)(Be,Date.now())+(y.indexOf(")")>-1?")":"&")}).replace(O,(y,_,I,Z,Ee,Ce,Ue)=>{const Be=_||Z||Ce,Ze=I||Ee||Ue||"?";return p.Z.API_SERVER+"/api/attachments/"+Be+Ze+"&t="+(0,ae.Jn)(Be,Date.now())+(y.indexOf(")")>-1?")":"&")}).replace(K,(y,_,I,Z,Ee)=>{const Ce=_||Z,Ue=I||Ee||"";return'"'+p.Z.API_SERVER+"/api/attachments/"+Ce+Ue+Ce+Ue+"&t="+(0,ae.Jn)(Ce,Date.now())}).replace(j,(y,_,I,Z,Ee)=>{const Ce=_||Z,Ue=I||Ee||"";return"("+p.Z.API_SERVER+"/files/uploads/"+Ce+Ue+Ce+Ue+"&t="+(0,ae.Jn)(Ce,Date.now())}).replaceAll('src="(','src="').replaceAll("src='(",'src="').replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),U)};var Ge=({value:U="",edit:R=!1,className:O,showTextOnly:K,showLines:j,style:z={},stylesPrev:y={},highlightKeywords:_,showProgramFill:I,isProgramFill:Z,disabledFill:Ee=!1,programFillValue:Ce,openEditor:Ue=()=>{},onFillChange:Be=$e=>{},onFillBlur:Ze=()=>{},onFillFocus:et=()=>{}})=>{let $e=C(String(U||""));const be=(0,T.useRef)(),he=(0,T.useRef)(),[we,Ae]=(0,T.useState)(""),[qe,ie]=(0,T.useState)("office"),[ue,Y]=(0,T.useState)([]),xe=(0,T.useRef)("a"+(0,A.Z)()),Te={},Fe=ve=>/<style[\s\S]*?>/i.test(ve||""),$=(ve,at,Xe)=>{const Ke=document.createElement(ve===ee?"input":"textarea");Ke.style.width="100%",Ke.style.height=ve===ee?"40px":"151px",Ke.rows=5,Ke.spellcheck=!1,Ke.name="edu-program-fill",Ke.placeholder="\u8BF7\u8F93\u5165",Ke.dataset.id=at;const pt=Object.keys(Te).length;return Te[pt]=Ke,`<span class="edu-program-fill-wrap ${ve===ee?"":"show"}" style="width:${ve===ee?"600px":"100%"}" title=${Xe||""}><span>${Ke.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function se(ve){return ve=ve.replace(/!\[.*?\]\(.*?\)/g,""),ve=ve.replace(/\[.*?\]\(.*?\)/g,""),ve=ve.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),ve=ve.replace(/<embed.*?>/g,""),ve=ve.replace(/<img.*?>/g,""),ve=ve.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),ve=ve.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),ve=ve.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),ve=ve.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),ve}const Se=ve=>!K&&Fe($e)?ve:ve.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(at,Xe){let Ke=Xe.replace(/(\n|\r)/g,"").split("}"),pt=[];return Ke.map(Et=>{Et!=""&&pt.push(`.${xe.current} ${Et}`)}),`<style>${pt.join("}")}</style>`}),Ie=(0,T.useMemo)(()=>{try{const Ke=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,pt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Et=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,ct=/\(\/attachments\/download\//g;$e=$e.replace(ct,"("+p.Z.API_SERVER+"/attachments/download/").replace(Ke,"("+p.Z.API_SERVER+"/api/attachments/").replace(pt,'"'+p.Z.API_SERVER+"/api/attachments/").replace(Et,'"'+p.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),be.current.style.display="none"}catch(Ke){}if(I){let Ke=-1;return $e=$e.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,function(pt,Et,ct){var Dt;return++Ke,$(pt,Ke,(Dt=Ce==null?void 0:Ce[Ke])==null?void 0:Dt.value.replaceAll("<","&lt;").replaceAll(">","&gt;"))}),`<pre style="background:#fff;padding:4px">${Se($e||"")}</pre>`}let ve=Se($e);ve=(0,ke.ZP)(ve);const at=(0,ke.ez)();$e.match(/\[TOC\]/)&&(ve=ve.replace("<p>[TOC]</p>",(0,ke.Qv)()),(0,ke.Iy)()),ve=ve.replace(/(__special_katext_id_\d+__)/g,(Ke,pt)=>{const{type:Et,expression:ct}=at[pt];return(0,te.renderToString)(_e(ct)||"",{displayMode:Et==="block",throwOnError:!1,output:"html"})}),ve=ve.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,ke.AL)();const Xe=document.createElement("div");if(Xe.innerHTML=ve,K)return Xe.innerText;if(_){const Ke=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return He(Xe,Ke),Xe.innerHTML}return setTimeout(()=>ht(),500),Xe.innerHTML},[$e,_]);(0,T.useEffect)(()=>{Ye.current&&Ye.current.querySelectorAll(["input","textarea"]).forEach(at=>{at.oninput=Oe,at.onblur=Ve,at.onfocus=ut})},[ue]),(0,T.useEffect)(()=>{var ve,at,Xe,Ke,pt;if(Ce!=null&&Ce.length)try{const Et=Ye.current.querySelectorAll(".edu-program-fill-score"),ct=Ye.current.querySelectorAll('[name="edu-program-fill"]');for(const[Dt,Gt]of ct.entries())Gt.value=((ve=Ce==null?void 0:Ce[Dt])==null?void 0:ve.value)||"",((at=Ce==null?void 0:Ce[Dt])==null?void 0:at.type)==="warning"?Gt.className="program-fill-warning":((Xe=Ce==null?void 0:Ce[Dt])==null?void 0:Xe.type)==="success"?Gt.className="program-fill-success":Gt.className="";for(const[Dt,Gt]of Et.entries())Gt.innerHTML=(Ke=Ce==null?void 0:Ce[Dt])!=null&&Ke.score?`${(pt=Ce==null?void 0:Ce[Dt])==null?void 0:pt.score}\u5206`:"";Y(Ce)}catch(Et){console.log(Et,"error")}},[Ce]);const Oe=ve=>{ue[ve.target.dataset.id]=ue[ve.target.dataset.id]||{},ue[ve.target.dataset.id].value=ve.target.value,Y([...ue]),Be(ue,ve.target.dataset.id)},Ve=ve=>{ue[ve.target.dataset.id]=ue[ve.target.dataset.id]||{},ue[ve.target.dataset.id].value=ve.target.value,Y([...ue]),Ze(ue,ve.target.dataset.id)},ut=ve=>{ue[ve.target.dataset.id]=ue[ve.target.dataset.id]||{},ue[ve.target.dataset.id].value=ve.target.value,Y([...ue]),et(ue,ve.target.dataset.id)};function He(ve,at){return ve.childNodes.forEach(Xe=>{var Ke;if(Xe.childNodes.length>0)He(Xe,at);else if(Xe.nodeName!=="IMG")if(Xe.innerHTML)Xe.innerHTML=(Ke=Xe.innerHTML)==null?void 0:Ke.replace(new RegExp(at,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const pt=document.createElement("span");pt.innerHTML=Xe.textContent.replace(new RegExp(at,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),Xe.replaceWith(pt)}})}const Ye=(0,T.useRef)();ke.jb.WebkitLineClamp=j,j&&(z=q(q({},z),ke.jb));function We(ve){let at=ve.target;if(at.tagName.toUpperCase()==="A"){let Xe=at.getAttribute("href");if(Xe.indexOf("office")>-1)ve.preventDefault(),Ae(Xe),ie("office");else if(Xe.indexOf("application/pdf")>-1)ve.preventDefault(),Ae(Xe),ie("pdf");else if(Xe.indexOf("text/html")>-1)ve.preventDefault(),Ae(Xe),ie("html");else if(Xe.startsWith("#")){ve.preventDefault();let Ke=document.getElementById(Xe.replace("#",""));Ke&&Ke.scrollIntoView(!0)}}}const ht=()=>{var ve;const at=(ve=Ye.current)==null?void 0:ve.querySelectorAll("video");at==null||at.forEach(Xe=>{if(Xe.oncontextmenu=()=>!1,Xe.src.indexOf(".m3u8")>-1&&!Xe.canPlayType("application/vnd.apple.mpegurl")){if(H.ZP.isSupported()){var Ke=new H.ZP;Ke.loadSource(Xe.src),Ke.attachMedia(Xe)}}})};(0,T.useEffect)(()=>{if(Ye.current&&Ie&&Ie.match(X)&&window.PR.prettyPrint(),Ye.current)return Ye.current.addEventListener("click",We),()=>{var ve;(ve=Ye.current)==null||ve.removeEventListener("click",We),(0,ke.AL)(),(0,ke.Iy)()}},[Ie,Ye.current,We]);const ft=ve=>{ve.target.nodeName==="IMG"&&ve.target.className.indexOf("draw-flowchart")>-1?(be.current.style.zIndex=1,be.current.style.display="flex",be.current.style.width=ve.target.clientWidth+"px",be.current.style.height=ve.target.clientHeight+"px",be.current.style.top=ve.target.offsetTop+"px",be.current.style.left=ve.target.offsetLeft+"px",ve.target.id&&(he.current=ve.target.id)):be.current.style.display="none"},rt=()=>{be.current.style.display="none"};return(0,T.useEffect)(()=>{var ve;const at=Xe=>{Xe.preventDefault(),Xe.clipboardData.setData("text",window.getSelection().toString())};return(ve=Ye.current)==null||ve.addEventListener("copy",at),()=>{var Xe;(Xe=Ye.current)==null||Xe.removeEventListener("copy",at)}},[Ye.current]),T.createElement("div",{style:{position:"relative"},onMouseLeave:rt},K&&T.createElement("div",{ref:Ye,className:`${L.mdBody} `},Ie),!K&&!Fe(Ie)&&T.createElement("div",{ref:Ye,style:q({},z),onMouseOver:ft,className:`${O||""} ${Ee?"disabled-fill":""} markdown-body ${L.mdBody} ${xe.current}`,dangerouslySetInnerHTML:{__html:Ie}}),!K&&Fe(Ie)&&T.createElement(x,{html:Ie}),T.createElement("div",{ref:be,className:`${L.button} ${R?"":L.previewFlowChart}`},T.createElement(l.Z,null,T.createElement(M.ZP,{onClick:()=>{R?Ue(he.current):(Ae(he.current),ie("flowChart"))}},R?"\u7F16\u8F91":"\u9884\u89C8"))),T.createElement(g.Z,{close:!0,data:we,type:we!=null&&we.length?qe:"",style:q({},y),onClose:()=>Ae("")}))}},51124:function(Rt,nt,W){"use strict";W.d(nt,{SV:function(){return be},ZP:function(){return $e}});var T=W(59301),fe=W(76374);const ke={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},oe={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},H={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"if",content:["if () {"," $0","}"].join(`
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"include <vector>",content:["#include <vector>"].join(`
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
`)},{label:"include <map>",content:["#include <map>"].join(`
`)},{label:"include <string>",content:["#include <string>"].join(`
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
`)}]},p={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},ae={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],quickKey:[{label:"println",content:["println($0)"].join(`
`)}]};var te=W(53184),l=W.n(te),M=(he,we,Ae)=>new Promise((qe,ie)=>{var ue=Te=>{try{xe(Ae.next(Te))}catch(Fe){ie(Fe)}},Y=Te=>{try{xe(Ae.throw(Te))}catch(Fe){ie(Fe)}},xe=Te=>Te.done?qe(Te.value):Promise.resolve(Te.value).then(ue,Y);xe((Ae=Ae.apply(he,we)).next())});const A={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},g=(he,we,Ae,qe)=>{const ie=we.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:Ae.lineNumber,endColumn:Ae.column});return Array.from(new Set(ie.match(/\b\w{2,}\b/g)||[])).map(Y=>({label:Y,kind:he.languages.CompletionItemKind.Text,insertText:Y,range:qe}))},b=(he,we,Ae,qe)=>{he.languages.registerCompletionItemProvider(we,{provideCompletionItems(ie,ue){const Y=ie.getWordUntilPosition(ue),xe={startLineNumber:ue.lineNumber,endLineNumber:ue.lineNumber,startColumn:Y.startColumn,endColumn:Y.endColumn},Te=ie.getLineContent(ue.lineNumber).substring(Y.startColumn-2,Y.endColumn);return{suggestions:[...g(he,ie,ue,xe),...Ae.map($=>({label:$,kind:he.languages.CompletionItemKind.Keyword,documentation:$,insertText:$,insertTextRules:he.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:xe})),...qe.map($=>({label:$.label,kind:he.languages.CompletionItemKind.Snippet,documentation:$.content,insertText:Te.startsWith("#")?$.content.replace(/#/,""):$.content,insertTextRules:he.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:xe}))]}}})};var m=he=>{A.languages.forEach(we=>{he.languages.registerDocumentFormattingEditProvider(we,{provideDocumentFormattingEdits(Ae){return M(this,null,function*(){const qe=l()(Ae.getValue(),{indent_size:2,indent_char:" ",max_preserve_newlines:2,preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:0,indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1});return[{range:Ae.getFullModelRange(),text:qe}]})}})}),b(he,"java",oe.keywords,oe.quickKey),b(he,"cpp",H.keywords,H.quickKey),b(he,"c",ke.keywords,[]),b(he,"python",p.keywords,p.quickKey),b(he,"scala",ae.keywords,ae.quickKey)};const x="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var C=Object.defineProperty,L=(he,we,Ae)=>we in he?C(he,we,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):he[we]=Ae,F=(he,we,Ae)=>L(he,typeof we!="symbol"?we+"":we,Ae);const w=class tl{constructor(we,Ae,qe){this.placeholder=we,this.editor=Ae,this.monaco=qe,Ae.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return tl.ID}getDomNode(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.style.width="max-content",this.domNode.textContent=this.placeholder,this.domNode.style.fontStyle="initial",this.domNode.style.color="#D7D7D7",this.domNode.style.pointerEvents="none",this.editor.applyFontInfo(this.domNode)),this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}dispose(){this.editor.removeContentWidget(this)}};F(w,"ID","editor.widget.placeholderHint");var N=w,V=W(96236),q=W(6767),le=W(25399),ee=W(89392),X=W(33796),_e=W(56102),ye=Object.defineProperty,Ge=Object.defineProperties,U=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,j=(he,we,Ae)=>we in he?ye(he,we,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):he[we]=Ae,z=(he,we)=>{for(var Ae in we||(we={}))O.call(we,Ae)&&j(he,Ae,we[Ae]);if(R)for(var Ae of R(we))K.call(we,Ae)&&j(he,Ae,we[Ae]);return he},y=(he,we)=>Ge(he,U(we)),_=(he,we)=>{var Ae={};for(var qe in he)O.call(he,qe)&&we.indexOf(qe)<0&&(Ae[qe]=he[qe]);if(he!=null&&R)for(var qe of R(he))we.indexOf(qe)<0&&K.call(he,qe)&&(Ae[qe]=he[qe]);return Ae},I=(he,we,Ae)=>new Promise((qe,ie)=>{var ue=Te=>{try{xe(Ae.next(Te))}catch(Fe){ie(Fe)}},Y=Te=>{try{xe(Ae.throw(Te))}catch(Fe){ie(Fe)}},xe=Te=>Te.done?qe(Te.value):Promise.resolve(Te.value).then(ue,Y);xe((Ae=Ae.apply(he,we)).next())});function Z(he){return/^\d+$/.test(he)?`${he}px`:he}function Ee(){}let Ce=!1;const Ue={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale",solidity:"sol"};function Be(he=[]){let we=he;if(Array.isArray(he)){for(let Ae=0;Ae<he.length;Ae++){let qe=Ue[he[Ae]];if(qe)return qe}return we[0]}return Ue[we]||we}let Ze=null;const et=()=>I(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(he){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",he)}});var $e=he=>{var we=he,{width:Ae="100%",height:qe="100%",value:ie,language:ue="javascript",style:Y={},options:xe={},overrideServices:Te={},theme:Fe="vs-dark",onEditBlur:$,isCopy:se=!1,onSave:Se,autoHeight:Ie=!1,forbidCopy:Oe=!1,onChange:Ve=Ee,editorDidMount:ut=Ee,onFocus:He=Ee,onBreakPoint:Ye=Ee,breakPointValue:We=[],filename:ht="educoder.txt",errorLine:ft,errorContent:rt="",highlightLine:ve,openBreakPoint:at=!1,placeholder:Xe="",showMiniMap:Ke=!0}=we,pt=_(we,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","isCopy","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint","placeholder","showMiniMap"]);const Et=(0,T.useRef)(),ct=(0,T.useRef)({}),Dt=(0,T.useRef)(),Gt=(0,T.useRef)(),lt=(0,T.useRef)([]),Tt=(0,T.useRef)(!1),ge=(0,T.useRef)(),de=(0,T.useRef)(),pe=(0,T.useRef)(!1),[P,G]=(0,T.useState)(!1);function Q(){let st;return Et.current&&(st=new fe.Z(je=>{for(let dt of je)(dt.target.offsetHeight>0||dt.target.offsetWidth>0)&&ct.current.instance.layout()}),st.observe(Et.current)),st}function re(){q.ZP.warning({content:decodeURIComponent(x),key:"monaco-editor-tip"})}const ce=()=>{let st=ct.current.instance;if(ie!=null&&st&&P){const je=st.getModel();je&&ie!==je.getValue()&&(Ce=!0,je.setValue(ie),st.layout(),Ce=!1)}};(0,T.useEffect)(()=>{const st=X.Z.subscribe("formatDocument",je=>{var dt;let Ft=ct.current.instance;(dt=Ft==null?void 0:Ft.getAction)==null||dt.call(Ft,"editor.action.formatDocument").run()});return window.updateMonacoValue=je=>{Ve(je)},st},[]),(0,T.useEffect)(()=>{var st;let je=ct.current.instance;Gt.current&&clearTimeout(Gt.current),Gt.current=setTimeout(()=>{ce()},500),ie&&(ie!=null&&ie.length)&&((st=je==null?void 0:je.updateOptions)==null||st.call(je,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(ie.split(/\r\n|\r|\n/g).length))+3,5)}))},[ie,P,ct.current]),(0,T.useEffect)(()=>{if(ft&&ct.current&&ct.current.instance){let je=ct.current.instance;je.changeViewZones(function(dt){var Ft=document.createElement("div");Ft.style.padding="10px 20px",Ft.style.width="calc(100% - 20px)",Ft.className="my-error-line-wrp",Ft.innerHTML=rt,dt.addZone({afterLineNumber:ft||11,heightInLines:3,domNode:Ft})});var st={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};je.addOverlayWidget(st),je.revealPositionInCenter({lineNumber:20,column:1})}},[ft,ct.current,P]);const tt=(st="",je)=>{if(!st||st.trim()==="")return!0;const Ft=ct.current.instance.getModel().getLineTokens(je);let Wt=!1;for(let tn=0;tn<2;tn++)Ft.getStandardTokenType(tn)===1&&(Wt=!0);return Wt};(0,T.useEffect)(()=>{var st;const je=(st=ct.current)==null?void 0:st.instance;if(je&&P&&Oe){const dt=je.onDidBlurEditorWidget(()=>{pe.current=!1}),Ft=je.onDidFocusEditorText(()=>{pe.current=!0});return()=>{dt.dispose(),Ft.dispose()}}},[ct.current,P,Oe]),(0,T.useEffect)(()=>{var st;if((st=ct.current)!=null&&st.instance&&P&&at){let je=ct.current.instance,dt=je.getModel();if(!dt)return;(()=>{var Ht;let Zt=[],Pt=[];const bn=dt.getAllDecorations();for(let xn of bn)xn.options.className==="highlighted-line"&&(Zt.push((Ht=xn==null?void 0:xn.range)==null?void 0:Ht.startLineNumber),Pt.push(xn==null?void 0:xn.id));if(ve===Zt[0])return;dt.deltaDecorations(Pt,[]);const qt=dt.getLineCount();ve&&ve<=qt&&(je.deltaDecorations([],[{range:new Ze.Range(ve,1,ve,dt.getLineMaxColumn(ve)),options:{isWholeLine:!0,className:"highlighted-line"}}]),je.revealLineInCenter(ve))})();const Wt=(Ht=!1)=>{var Zt;let Pt=[],bn=[];const qt=dt.getAllDecorations();for(let xn of qt)xn.options.linesDecorationsClassName==="breakpoints-select"&&(Pt.push((Zt=xn==null?void 0:xn.range)==null?void 0:Zt.startLineNumber),bn.push(xn==null?void 0:xn.id));if(Ht)return{lines:Pt,ids:bn};Ye(Pt)},tn=Ht=>I(void 0,null,function*(){let Zt={range:new Ze.Range(Ht,1,Ht,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield dt.deltaDecorations([],[Zt]),Wt()}),An=Ht=>I(void 0,null,function*(){let Zt=[];const Pt=je.getLineDecorations(Ht);for(let bn of Pt)bn.options.linesDecorationsClassName==="breakpoints-select"&&Zt.push(bn.id);yield dt.deltaDecorations(Zt,[]),Wt()}),yn=Ht=>{let Zt=je.getLineDecorations(Ht);for(let Pt of Zt)if(Pt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,ee.isEqual)(We,Wt(!0).lines)){dt.deltaDecorations(Wt(!0).ids,[]);const Ht=We.map(Zt=>({range:new Ze.Range(Zt,1,Zt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));dt.deltaDecorations([],Ht)}const on=je.onDidChangeModelContent(Ht=>{let Zt=je.getPosition();if(Zt){let Pt=Zt.lineNumber;clearTimeout(de.current),de.current=setTimeout(()=>{tt(dt.getLineContent(Pt),Pt)?An(Pt):yn(Pt)?(An(Pt),tn(Pt)):Wt()},100)}}),wn=je.onMouseDown(Ht=>{var Zt,Pt,bn;if(Ht.target.detail&&((bn=(Pt=(Zt=Ht.target)==null?void 0:Zt.element)==null?void 0:Pt.className)!=null&&bn.includes("line-numbers"))){let qt=Ht.target.position.lineNumber;if(tt(dt.getLineContent(qt),qt))return;yn(qt)?An(qt):tn(qt)}}),zt=Ht=>{let Zt={range:new Ze.Range(Ht,1,Ht,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};lt.current=je.deltaDecorations(lt.current,[Zt])},En=()=>{lt.current=je.deltaDecorations(lt.current,[])},nn=je.onMouseMove(Ht=>{var Zt,Pt,bn;if(En(),Ht.target.detail&&((bn=(Pt=(Zt=Ht.target)==null?void 0:Zt.element)==null?void 0:Pt.className)!=null&&bn.includes("line-numbers"))){let qt=Ht.target.position.lineNumber;if(tt(dt.getLineContent(qt),qt))return;zt(qt)}}),oi=je.onMouseLeave(()=>{En()});return()=>{on.dispose(),wn.dispose(),nn.dispose(),oi.dispose()}}},[ct.current,P,We,ve,at,ue]),(0,T.useEffect)(()=>{var st;(st=ct.current)!=null&&st.instance&&at&&ct.current.instance.setPosition({lineNumber:0,column:0})},[ve]);function it(){let st=ct.current.instance;if(st){const je=st.getSelection(),dt=ct.current.pastePos||{},Ft=new Ze.Range(dt.startLineNumber||je.endLineNumber,dt.startColumn||je.endColumn,dt.endLineNumber||je.endLineNumber,dt.endColumn||je.endColumn);setTimeout(()=>{st.executeEdits("",[{range:Ft,text:""}])},300)}}function ot(st){(window.navigator.platform.match("Mac")?st.metaKey:st.ctrlKey)&&st.keyCode==83&&(st.preventDefault(),Se())}const gt=()=>{if(Ie&&ct.current.instance){const st=ct.current.instance.getContentHeight();en(st<qe?qe:st)}else en(qe)};function kt(st){var je=document.createEvent("MouseEvents");je.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),st.dispatchEvent(je)}const Ut=st=>{if(!pe.current)return;const{keyCode:je,ctrlKey:dt,metaKey:Ft,target:Wt,type:tn}=st;return(tn==="paste"||(je===67||je===86)&&(Ft||dt))&&Wt.nodeName==="TEXTAREA"&&(re(),st.preventDefault()),!1};function Bt(st,je){var dt=window.URL||window.webkitURL||window,Ft=new Blob([je]),Wt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Wt.href=dt.createObjectURL(Ft),Wt.download=st,kt(Wt)}(0,T.useEffect)(()=>{gt()},[gt]),(0,T.useEffect)(()=>{Et.current&&!P&&Promise.all([W.e(8909),W.e(5028)]).then(W.bind(W,71448)).then(st=>{try{Ze=st,ct.current.instance=Ze.editor.create(Et.current,{value:ie,language:Be(ue),theme:Fe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:Ke||!1}},Te);const je=ct.current.instance;let Wt=[...V.BH._menuItems].find(on=>on[0]._debugName=="EditorContext")[1],tn=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],An=(on,wn)=>{var zt,En;let nn=on._first;do wn.includes((En=(zt=nn.element)==null?void 0:zt.command)==null?void 0:En.id)&&on._remove(nn);while(nn=nn.next)};if(ut(je,Ze),setTimeout(()=>{gt(),ct.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Bt(ht||"educoder.txt",je.getValue())}})},500),ct.current.subscription=je.onDidChangeModelContent(on=>{Tt.current?clearTimeout(ge.current):(gt(),Ve(je.getValue(),on)),ge.current=setTimeout(()=>{Tt.current=!1},500)}),window.Monaco||m(Ze,Be(ue)),Oe&&(An(Wt,tn),Et.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Ut),window.removeEventListener("paste",Ut),window.addEventListener("keydown",Ut),window.addEventListener("paste",Ut)),window.Monaco=Ze,$&&je.onDidBlurEditorWidget(()=>{$(je.getValue())}),He&&je.onDidFocusEditorText(()=>{Oe&&et(),He(je.getValue())}),Oe){et();try{je.onDidPaste(on=>{const wn=je.getSelection(),zt=ct.current.pastePos||{},En=new Ze.Range(zt.startLineNumber||wn.endLineNumber,zt.startColumn||wn.endColumn,zt.endLineNumber||wn.endLineNumber,zt.endColumn||wn.endColumn);je.executeEdits("",[{range:on.range,text:""}])})}catch(on){}}let yn=Q();return Xe&&typeof Xe=="string"&&new N(Xe,je,Ze),G(!0),()=>{const on=ct.current.instance;on.dispose();const wn=on.getModel();wn&&wn.dispose(),ct.current.subscription&&ct.current.subscription.dispose(),yn.unobserve(Et.current)}}catch(je){}})},[]),(0,T.useEffect)(()=>{if(ct.current.instance&&P)return document.addEventListener("keydown",ot,!1),()=>{document.removeEventListener("keydown",ot)}},[Se,P]),(0,T.useEffect)(()=>{let st=ct.current.instance;if(st&&P){let je=Be(ue);Ze.editor.setModelLanguage(st.getModel(),je)}},[ue,P]),(0,T.useEffect)(()=>{ct.current.instance&&P&&Ze.editor.setTheme(Fe)},[Fe,P]),(0,T.useEffect)(()=>{let st=ct.current.instance;Dt.current=xe,st&&P&&(st.updateOptions(z({},xe)),setTimeout(()=>{st.getModel().updateOptions(z({},xe))},200))},[JSON.stringify(xe),P]),(0,T.useEffect)(()=>{let st=ct.current.instance;st&&P&&st.layout()},[Ae,qe,P]);const[bt,rn]=(0,T.useState)(Z(Ae)),[fn,en]=(0,T.useState)(Z(qe)),Qt=y(z({},Y),{width:bt,height:fn,position:"relative"});return T.createElement("div",{className:"my-monaco-editor",ref:Et,style:Qt},se&&T.createElement(_e.CopyToClipboard,{text:ie,onCopy:()=>q.ZP.success("\u590D\u5236\u6210\u529F")},T.createElement(le.Z,{title:"\u590D\u5236\u4EE3\u7801"},T.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},T.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function be({width:he="100%",height:we="100%",original:Ae,modified:qe,language:ie,options:ue={}}){const Y=(0,T.useRef)(),[xe,Te]=(0,T.useState)(null);function Fe(Ie){let Oe;return Y.current&&(Oe=new fe.Z(Ve=>{for(let ut of Ve)(ut.target.offsetHeight>0||ut.target.offsetWidth>0)&&Ie.layout()}),Oe.observe(Y.current)),Oe}(0,T.useEffect)(()=>(Y.current&&Promise.all([W.e(8909),W.e(9404)]).then(W.bind(W,2550)).then(Ie=>{Ze=Ie;const Oe=Ze.editor.createDiffEditor(Y.current,y(z({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},ue),{wordWrap:!0}));Te(Oe);let Ve=Fe(Oe);return()=>{Oe.dispose();const ut=Oe.getModel();ut&&ut.dispose(),Ve.unobserve(Y.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,T.useEffect)(()=>{xe&&xe.setModel({original:Ze.editor.createModel(Ae,ie),modified:Ze.editor.createModel(qe,ie)})},[Ae,qe,ie,xe]);const $=Z(he),se=Z(we),Se={width:$,height:se};return T.createElement("div",{className:"my-diff-editor",ref:Y,style:Se})}},92235:function(Rt,nt,W){"use strict";W.r(nt),W.d(nt,{default:function(){return z}});var T=W(59301),fe=W(77019),ke=W(5269),oe=W(71051),H=W(28284),p=W(458),ae=W(99571),te=W(25399),l=W(62957),M=W(29787),A=W(6767),g=W(37568),b=W(76560),m={bg:"bg___YVx48",title:"title___NM3xC",textOverflow:"textOverflow___gz3GM",wrap:"wrap___if0Ln",infoTitle:"infoTitle___dk7YF",infoValue:"infoValue___kBWqL",itemTitle:"itemTitle___WP88A",circle:"circle___Rq79V",warnText:"warnText___cpZS0",greyText:"greyText___erT_A",linkText:"linkText___YWy1z",whiteList:"whiteList___NvpGC",num:"num___Dq7FU",fixBottom:"fixBottom___WHsNA",backBtn:"backBtn___swiNH",enterBtn:"enterBtn___pk16U",secureInput:"secureInput___D361C"},x=W(72664),C=W(64885),L=W(49661),F=W(56656),w=W.n(F),k=W(82093),N=W(15277),V=W(73331),q=W(98072),le=W(38394),ee=Object.defineProperty,X=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,Ge=(y,_,I)=>_ in y?ee(y,_,{enumerable:!0,configurable:!0,writable:!0,value:I}):y[_]=I,U=(y,_)=>{for(var I in _||(_={}))_e.call(_,I)&&Ge(y,I,_[I]);if(X)for(var I of X(_))ye.call(_,I)&&Ge(y,I,_[I]);return y},R=(y,_,I)=>new Promise((Z,Ee)=>{var Ce=Ze=>{try{Be(I.next(Ze))}catch(et){Ee(et)}},Ue=Ze=>{try{Be(I.throw(Ze))}catch(et){Ee(et)}},Be=Ze=>Ze.done?Z(Ze.value):Promise.resolve(Ze.value).then(Ce,Ue);Be((I=I.apply(y,_)).next())});const O=({title:y,content:_})=>T.createElement("div",{className:"mb20"},T.createElement(fe.Z,{align:"middle",style:{marginBottom:12}},T.createElement(ke.Z,{flex:"20px"},T.createElement("div",{className:m.circle})),T.createElement(ke.Z,null,T.createElement("div",null,y))),T.createElement(fe.Z,{className:"pl20"},_)),K=({value:y,onChange:_,MaxMinutes:I})=>T.createElement(T.Fragment,null,T.createElement("div",{className:"p10 mb20",style:{background:"#F6F7F9"}},"1.\u53EA\u6709\u5F53\u8003\u8BD5\u622A\u6B62\u65F6\u95F4\u665A\u4E8E\u5B66\u751F\u7684\u4EA4\u5377\u622A\u6B62\u65F6\u95F4\u65F6\uFF0C\u624D\u652F\u6301\u5BF9\u5B66\u751F\u8FDB\u884C\u5EF6\u65F6\u64CD\u4F5C\uFF1B",T.createElement("br",null),"2.\u6BCF\u4E2A\u5B66\u751F\u7684\u6700\u5927\u53EF\u5EF6\u65F6\u65F6\u95F4=\u8003\u8BD5\u622A\u6B62\u65F6\u95F4-\u5B66\u751F\u5F53\u524D\u7684\u4EA4\u5377\u622A\u6B62\u65F6\u95F4\u3002",T.createElement("br",null)),T.createElement(oe.Z,{value:y,min:0,precision:0,max:I,style:{width:"100%"},placeholder:`\u6700\u5927\u53EF\u5EF6\u957F\u65F6\u95F4\u4E3A${I}\u5206\u949F\uFF0C\u5728\u5B66\u751F\u5269\u4F59\u65F6\u95F4\u57FA\u7840\u4E0A\u5EF6\u65F6`,addonAfter:"\u5206\u949F",onChange:_}));console.log("---",performance.navigation.type);const j=({user:y,dispatch:_,globalSetting:I})=>{const Z=(0,b.useParams)(),[Ee]=(0,b.useSearchParams)(),[Ce,Ue]=(0,T.useState)(),[Be,Ze]=(0,T.useState)(!1),[et,$e]=(0,T.useState)(!1),[be,he]=(0,T.useState)(!1),[we,Ae]=(0,T.useState)(!1),[qe]=H.default.useForm(),ie=H.default.useWatch("time",qe),ue=(0,T.useMemo)(()=>new WebSocket("ws://localhost:8082"),[]),[,Y,xe,Te]=(0,q.U)(x.n7,{id:Z.categoryId,user_id:Z.login});(0,T.useEffect)(()=>{Ee.get("isShowApply")==="true"&&he(!0)},[Ee.get("isShowApply")]),(0,T.useEffect)(()=>(_({type:"globalSetting/headerFooterToggle",payload:!1}),()=>{_({type:"globalSetting/headerFooterToggle",payload:!0})}),[]),(0,T.useEffect)(()=>{R(void 0,null,function*(){Ze(!0);const Ut=yield(0,x.Cd)(Z);Ze(!1),Ut.status||Ue(Ut)})},[]);const{exercise_name:Fe,exercise_type:$,user_simulate_num:se,simulate_exercise_num:Se,time:Ie,student_id:Oe,screen_open:Ve,screen_num:ut,screen_sec:He,real_name:Ye,id:We,open_camera:ht,inner_ip:ft,public_ip:rt,ip_limit:ve,ip_bind:at,ip_bind_type:Xe,open_phone_video_recording:Ke,identity_verify:pt,user_permission:Et,total_score:ct,question_type_count:Dt,question_count:Gt,screen_shot_open:lt,screen_total_num:Tt,screen_used_num:ge,end_time:de,user_end_time:pe,only_on_client:P,forbid_screen:G,use_white_list:Q,white_list:re=[],exercise_description:ce,forbid_virtual:tt}=(Ce==null?void 0:Ce.exercise)||{},it=Te!=null&&Te.user_end_time?w()(Te==null?void 0:Te.user_end_time).add(1,"minutes"):w()(),ot=w()(Te==null?void 0:Te.user_total_end_time)>it?Math.round(w().duration(w()(Te==null?void 0:Te.user_total_end_time).diff(it.startOf("minute"))).asMinutes()):0,gt=((Te==null?void 0:Te.student_left_minutes)||0)+(ie||0);(0,T.useEffect)(()=>{R(void 0,null,function*(){ge>Tt&&(yield xe({}))})},[ge,Tt]);const kt=()=>{const Ut=Se-se;return Ut>=0?Ut:0};return T.createElement("div",{className:m.bg},T.createElement("div",{className:"edu-container"},T.createElement("div",{className:"pt30"}),T.createElement("div",{className:m.wrap},T.createElement(p.Z,{loading:Be,active:!0,className:"mt20"},T.createElement("div",{className:m.title},Fe),T.createElement(fe.Z,{justify:"center",gutter:30,className:"mb20"},T.createElement(ke.Z,null,T.createElement("span",{className:m.infoTitle},"\u5927\u9898\u6570"),T.createElement("span",{className:m.infoValue},Dt)),T.createElement(ke.Z,null,T.createElement("span",{className:m.infoTitle},"\u5C0F\u9898\u6570"),T.createElement("span",{className:m.infoValue},Gt)),T.createElement(ke.Z,null,T.createElement("span",{className:m.infoTitle},"\u6EE1\u5206"),T.createElement("span",{className:m.infoValue},ct,"\u5206")),T.createElement(ke.Z,null,T.createElement("span",{className:m.infoTitle},"\u8003\u8BD5\u65F6\u957F"),T.createElement("span",{className:m.infoValue},Ie===-1?"\u4E0D\u9650\u65F6\u957F":`${Ie}\u5206\u949F`))),T.createElement(fe.Z,{className:"mb20",align:"middle"},T.createElement(ke.Z,{flex:"20px"},T.createElement("i",{className:"iconfont icon-dangqiankaoshengxinxi font14",style:{color:"#3061D0"}})),T.createElement(ke.Z,null,T.createElement("div",{className:m.itemTitle},"\u5F53\u524D\u8003\u751F\u4FE1\u606F"))),T.createElement(fe.Z,{className:"mb30 pl20"},T.createElement(ke.Z,{flex:"190px",className:`mr20 ${m.textOverflow}`},T.createElement("span",{className:m.infoTitle},"\u59D3\u540D"),T.createElement("span",{title:Ye},Ye)),T.createElement(ke.Z,null,T.createElement("span",{className:m.infoTitle},"\u5B66\u53F7"),T.createElement("span",null,Oe||"--"))),T.createElement(fe.Z,{className:"mb20",align:"middle"},T.createElement(ke.Z,{flex:"20px"},T.createElement("i",{className:"iconfont icon-chengxinkaoshishengming font14",style:{color:"#3061D0"}})),T.createElement(ke.Z,null,T.createElement("div",{className:m.itemTitle},"\u8BDA\u4FE1\u8003\u8BD5\u58F0\u660E"))),T.createElement("div",{className:"mb30 pl20"},T.createElement("p",null,"1.\u8003\u751F\u5728\u8003\u8BD5\u8FC7\u7A0B\u4E2D\u5E94\u81EA\u89C9\u9075\u5B88\u8003\u8BD5\u7EAA\u5F8B\uFF0C\u8BDA\u4FE1\u5E94\u8003\uFF0C\u62D2\u7EDD\u4F5C\u5F0A\u884C\u4E3A\uFF0C\u4FDD\u6301\u826F\u597D\u8003\u8BD5\u79E9\u5E8F\u3002\u5B9E\u65BD\u4F5C\u5F0A\u884C\u4E3A\u4E00\u7ECF\u53D1\u73B0\uFF0C\u5C06\u6309\u5B66\u6821\u8003\u8BD5\u7BA1\u7406\u529E\u6CD5\u4E25\u8083\u5904\u7406\uFF0C\u56E0\u4F5C\u5F0A\u4EA7\u751F\u7684\u4E00\u5207\u540E\u679C\u81EA\u8D1F\u3002"),T.createElement("p",{style:{color:"red"}},"2.\u82E5\u8003\u8BD5\u671F\u95F4\u9047\u5230\u95EE\u9898\uFF0C\u8BF7\u53CA\u65F6\u8DDF\u76D1\u8003\u8001\u5E08\u6C9F\u901A\u89E3\u51B3\uFF0C\u8003\u8BD5\u7ED3\u675F\u4E4B\u540E\u518D\u63D0\u51FA\u95EE\u9898\u89C6\u4E3A\u65E0\u6548\u3002"),T.createElement("p",{style:{color:"red"}},"3.\u5728\u5B8C\u6210\u5B9E\u8BAD\u9898\u3001\u7F16\u7A0B\u9898\u6216\u7A0B\u5E8F\u586B\u7A7A\u9898\u540E\uFF0C\u8BF7\u52A1\u5FC5\u786E\u8BA4\u60A8\u5728\u8003\u8BD5\u9875\u9762\u4E0A\u505C\u7559\u7684\u4EE3\u7801\u662F\u60A8\u6700\u7EC8\u60F3\u8981\u63D0\u4EA4\u7684\u7248\u672C\u3002")),ce&&T.createElement(T.Fragment,null,T.createElement(fe.Z,{className:"mb20",align:"middle"},T.createElement(ke.Z,{flex:"20px"},T.createElement("i",{className:"iconfont icon-kechengxuzhi font14",style:{color:"#3061D0"}})),T.createElement(ke.Z,null,T.createElement("div",{className:m.itemTitle},"\u8BD5\u5377\u987B\u77E5"))),T.createElement("div",{className:"mb30"},T.createElement(le.Z,{style:{fontSize:14,color:"#333",paddingLeft:"20px"},value:ce}))),(ht||Ve||Ke||ve!=="no"||pt)&&T.createElement(fe.Z,{className:"mb20",align:"middle"},T.createElement(ke.Z,{flex:"20px"},T.createElement("i",{className:"iconfont icon-yikaiqifangzuobimoshi font14",style:{color:"#3061D0"}})),T.createElement(ke.Z,null,T.createElement("div",{className:m.itemTitle},"\u5DF2\u5F00\u542F\u9632\u4F5C\u5F0A\u6A21\u5F0F"))),pt&&T.createElement(O,{title:"\u5DF2\u5F00\u542F\u8003\u8BD5\u524D\u4EBA\u8138\u8EAB\u4EFD\u6838\u9A8C",content:T.createElement("div",null,T.createElement("span",{className:m.greyText},"\u8FDB\u5165\u8003\u8BD5\u524D\uFF0C\u8BF7\u5141\u8BB8\u6444\u50CF\u5934\u6388\u6743\uFF0C\u6388\u6743\u540E\u9700\u91C7\u96C6\u7167\u7247\u8BA4\u8BC1\uFF0C\u8BA4\u8BC1\u901A\u8FC7\u5E76\u5F00\u542F\u624B\u673A\u5F55\u5236\u624D\u53EF\u4EE5\u8FDB\u5165\u8003\u8BD5\u3002"),T.createElement("span",{className:m.linkText,onClick:()=>(0,L.xg)("https://www.educoder.net/forums/4459")},"\u65E0\u6CD5\u8C03\u7528\u6444\u50CF\u5934?"))}),Ke&&T.createElement(O,{title:"\u5DF2\u5F00\u542F\u8003\u8BD5\u4E2D\u624B\u673A\u89C6\u9891\u5F55\u5236",content:T.createElement("div",null,T.createElement("span",{className:m.greyText},"\u8FDB\u5165\u8003\u8BD5\u540E\uFF0C\u8BF7\u5141\u8BB8\u6444\u50CF\u5934\u6388\u6743\uFF0C\u6388\u6743\u540E\u6253\u5F00\u6444\u50CF\u5934\u65B9\u53EF\u4F5C\u7B54\uFF01"),T.createElement("span",{className:m.linkText,onClick:()=>(0,L.xg)("https://www.educoder.net/forums/4459")},"\u65E0\u6CD5\u8C03\u7528\u6444\u50CF\u5934?"))}),ht&&T.createElement(O,{title:"\u5DF2\u5F00\u542F\u8003\u8BD5\u4E2D\u62CD\u7167\u76D1\u63A7",content:T.createElement("div",null,T.createElement("span",{className:m.greyText},"\u8FDB\u5165\u8003\u8BD5\u540E\uFF0C\u8BF7\u5141\u8BB8\u6444\u50CF\u5934\u6388\u6743\uFF0C\u6388\u6743\u540E\u6253\u5F00\u6444\u50CF\u5934\u65B9\u53EF\u4F5C\u7B54\uFF01"),T.createElement("span",{className:m.linkText,onClick:()=>(0,L.xg)("https://www.educoder.net/forums/4459")},"\u65E0\u6CD5\u8C03\u7528\u6444\u50CF\u5934?"))}),Ve&&T.createElement(O,{title:"\u5DF2\u5F00\u542F\u5207\u5C4F\u540E\u5F3A\u5236\u4EA4\u5377",content:T.createElement("div",null,T.createElement("span",{className:m.greyText},"\u5207\u5C4F\u8D85\u8FC7",T.createElement("span",{className:m.num},ut),"\u6B21\u5C06\u5F3A\u5236\u4EA4\u5377\uFF0C\u5207\u6362\u5230\u5176\u4ED6\u9875\u9762",T.createElement("span",{className:m.num},He),"\u79D2\u540E\u5373\u5224\u5B9A\u4E3A\u4E00\u6B21\u5207\u5C4F\uFF0C",T.createElement("span",{className:m.num},He*2),"\u79D2\u5219\u5224\u5B9A\u4E3A",T.createElement("span",{className:m.num},"2"),"\u6B21\u5207\u5C4F\uFF0C\u4EE5\u6B64\u7C7B\u63A8\uFF1B\u8003\u8BD5\u8FC7\u7A0B\u4E2D\u8BF7\u52FF\u5207\u6362\u5230\u5176\u4ED6\u9875\u9762\u6216\u9000\u51FA\u5168\u5C4F\u3002"),T.createElement("span",{className:m.linkText,onClick:()=>(0,L.xg)("https://www.educoder.net/forums/4460")},"\u6D4F\u89C8\u5668\u65E0\u6CD5\u81EA\u52A8\u5168\u5C4F\uFF1F"))}),lt&&T.createElement(O,{title:"\u5DF2\u5F00\u542F\u9000\u51FA\u5168\u5C4F\u6216\u5207\u6362\u9875\u9762\u540E\u81EA\u52A8\u622A\u5C4F",content:T.createElement("div",null,T.createElement("span",{className:m.greyText},"\u8001\u5E08\u5DF2\u5F00\u542F\u9000\u51FA\u5168\u5C4F\u6216\u5207\u6362\u9875\u9762\u540E\u81EA\u52A8\u622A\u5C4F\uFF0C\u8003\u751F\u8FDB\u5165\u8003\u8BD5\u4E4B\u540E\u9700\u8981\u9009\u62E9\u4E3B\u5C4F\u5E55\u8FDB\u884C\u5171\u4EAB\uFF0C\u8003\u8BD5\u4F5C\u7B54\u8FC7\u7A0B\u4E2D\u4E5F\u4E0D\u5141\u8BB8\u5173\u95ED\u5C4F\u5E55\u5171\u4EAB\uFF0C\u5426\u5219\u5C06\u4F1A\u76F4\u63A5\u9000\u51FA\u8003\u8BD5\u3002"))}),ve!=="no"&&T.createElement(O,{title:"\u5DF2\u5F00\u542FIP\u8303\u56F4\u9650\u5B9A",content:T.createElement("div",null,T.createElement("span",{className:m.greyText},"IP\u5730\u5740\u4E0D\u5728\u8303\u56F4\u5185\u4E0D\u53EF\u53C2\u52A0\u8003\u8BD5\u3002"),T.createElement("span",{className:m.warnText},"\uFF08\u53EA\u5141\u8BB8\u5728Chrome\u8C37\u6B4C\u6D4F\u89C8\u5668\u4F5C\u7B54\uFF0C\u5E76\u4E14\u9700\u8981\u5B89\u88C5WebRTC Leak Prevent\u63D2\u4EF6\uFF09"),T.createElement("div",null,T.createElement("span",{className:m.linkText,onClick:()=>(0,L.xg)("https://www.educoder.net/forums/4478")},"\u5982\u4F55\u5B89\u88C5WebRTC Leak Prevent\u63D2\u4EF6?")))}),at&&T.createElement(O,{title:"\u5DF2\u5F00\u542F\u8003\u8BD5\u671F\u95F4IP\u7ED1\u5B9A",content:T.createElement("div",null,T.createElement("span",{className:m.greyText},"\u5F53\u60A8\u5F00\u59CB\u8003\u8BD5\u540E\uFF0C\u5C06\u81EA\u52A8\u7ED1\u5B9AIP\uFF0C\u8003\u8BD5\u671F\u95F4\u53EA\u5141\u8BB8\u4F7F\u7528\u552F\u4E00\u7684IP\u8FDB\u5165\u8003\u8BD5\u3002\u5982\u9047\u7279\u6B8A\u60C5\u51B5\uFF0C\u53EF\u5411\u8001\u5E08\u7533\u8BF7\u89E3\u9664IP\u7ED1\u5B9A\u3002"),T.createElement("span",{className:m.warnText},"\uFF08\u53EA\u5141\u8BB8\u5728Chrome\u8C37\u6B4C\u6D4F\u89C8\u5668\u4F5C\u7B54\uFF0C\u5E76\u4E14\u9700\u8981\u5B89\u88C5WebRTC Leak Prevent\u63D2\u4EF6\uFF09"),T.createElement("div",null,T.createElement("span",{className:m.linkText,onClick:()=>(0,L.xg)("https://www.educoder.net/forums/4478")},"\u5982\u4F55\u5B89\u88C5WebRTC Leak Prevent\u63D2\u4EF6?")))}),(G||Q)&&(0,L.WX)()&&T.createElement(T.Fragment,null,T.createElement(fe.Z,{className:"mb20",align:"middle"},T.createElement(ke.Z,{flex:"20px"},T.createElement("i",{className:"iconfont icon-tishi11 font14",style:{color:"#3061D0"}})),T.createElement(ke.Z,null,T.createElement("div",{className:m.itemTitle},"\u6CE8\u610F\u4E8B\u9879"))),G&&T.createElement(O,{title:"\u672C\u6B21\u8003\u8BD5\u5DF2\u8BBE\u7F6E\u7981\u6B62\u5207\u5C4F",content:T.createElement("div",null,T.createElement("span",{className:m.greyText},"\u4E00\u65E6\u8FDB\u5165\u8003\u8BD5\u7B54\u9898\u9875\u9762\uFF0C\u4E0D\u53EF\u5207\u5C4F\u9000\u51FA\u7B54\u9898\u9875\u9762\uFF0C\u5982\u9700\u8981\u9000\u51FA\u7B54\u9898\u9875\u9762\uFF0C"),T.createElement("span",{className:m.linkText,style:{cursor:"default"}},"\u8BF7\u8054\u7CFB\u76D1\u8003\u8001\u5E08/\u8BD5\u5377\u53D1\u5E03\u8005\u586B\u5199\u89E3\u9664\u5207\u5C4F\u7801\u3002"))}),Q&&T.createElement(O,{title:"\u672C\u6B21\u8003\u8BD5\u5DF2\u7ECF\u8BBE\u7F6E\u6253\u5F00\u767D\u540D\u5355\u7A0B\u5E8F\u9650\u5236",content:T.createElement("div",null,T.createElement("div",{className:m.greyText},"\u8FDB\u5165\u8003\u8BD5\u524D\u8BF7\u5148\u5173\u95ED\u975E\u767D\u540D\u5355\u7A0B\u5E8F\uFF0C\u5426\u5219\u8FDB\u5165\u8003\u8BD5\u540E\uFF0C\u7CFB\u7EDF\u5C06\u81EA\u52A8\u5173\u95ED\u975E",T.createElement("span",{style:{cursor:"default"},className:m.linkText},"\u767D\u540D\u5355"),"\u7A0B\u5E8F\uFF0C\u53EF\u6253\u5F00\u7684\u767D\u540D\u5355\u7A0B\u5E8F\u5982\u4E0B\uFF1A"),T.createElement("div",{className:m.whiteList},re==null?void 0:re.map(Ut=>T.createElement("div",null,Ut))))})),P&&!(0,L.WX)()&&T.createElement("div",{className:"ml20",style:{color:"#E53333"}},T.createElement("i",{className:"iconfont icon-tishi11 font14 mr5"}),"\u672C\u6B21\u8003\u8BD5\u8BBE\u7F6E\u4E3A\u5BA2\u6237\u7AEF\u6A21\u5F0F\uFF0C\u4E0D\u53EF\u5728\u7F51\u9875\u7AEF\u8FDB\u884C\u8003\u8BD5\u7B54\u9898\uFF0C\u8BF7\u8FDB\u5165\u5BA2\u6237\u7AEF\u8FDB\u884C\u8003\u8BD5",T.createElement("a",{onClick:()=>{window.open("/download")}},"\u3010\u4E0B\u8F7D\u5BA2\u6237\u7AEF\u3011")),T.createElement("div",{className:m.fixBottom},T.createElement(ae.ZP,{className:m.backBtn,onClick:()=>{if(Ee.get("isShowApply")==="true"){b.history.push(`/classrooms/${Z.coursesId}/exercise/${Z.categoryId}/detail?random=true`);return}b.history.back()}},"\u8FD4\u56DE\u8003\u8BD5\u5217\u8868"),(!P||(0,L.WX)())&&T.createElement(te.Z,{title:$===2&&T.createElement("span",null,"\u672C\u6B21\u8003\u8BD5\u53EF\u91CD\u590D\u8003\u8BD5",Se,"\u6B21\uFF0C\u5269\u4F59",kt(),"\u6B21")},T.createElement(C.Z,{type:"primary",className:`${m.enterBtn} ml20`,onClick:()=>R(void 0,null,function*(){var Ut;if((G||Ve)&&(0,L.WX)()&&localStorage.screenNums>1){l.default.info({title:"\u63D0\u793A",icon:null,centered:!0,content:`\u5F53\u524D\u8003\u8BD5\u5F00\u542F\u4E86\u9632\u5207\u5C4F\u6A21\u5F0F\uFF0C\u7CFB\u7EDF\u68C0\u6D4B\u5230\u60A8\u7684\u7535\u8111\u6709${localStorage.screenNums}\u4E2A\u663E\u793A\u5668\uFF0C\u8BF7\u5148\u79FB\u9664\u6389\u5176\u5B83\u7684\u663E\u793A\u5668\u8BBE\u5907\uFF01`,okText:"\u6211\u77E5\u9053\u4E86"});return}if(tt&&!(0,L.WX)()){l.default.info({title:"\u63D0\u793A",icon:null,centered:!0,content:"\u8BF7\u4F7F\u7528\u5BA2\u6237\u7AEF\u4F5C\u7B54",okText:"\u6211\u77E5\u9053\u4E86"});return}if(!(tt&&(0,L.WX)()&&(ue.send(JSON.stringify({type:"check-virtual-machine"})),(yield new Promise((bt,rn)=>{ue.onmessage=fn=>{var en,Qt;let st=JSON.parse(fn.data);if((st==null?void 0:st.type)==="check-virtual-machine")switch((en=st==null?void 0:st.data)==null?void 0:en.value){case"1":l.default.info({title:"\u63D0\u793A",icon:null,centered:!0,content:"\u68C0\u6D4B\u5230\u60A8\u5F53\u524D\u6B63\u5728\u4F7F\u7528\u865A\u62DF\u673A\u6A21\u5F0F\u53C2\u52A0\u8003\u8BD5\uFF0C\u4E3A\u786E\u4FDD\u8003\u8BD5\u516C\u5E73\u6027\u4E0E\u7CFB\u7EDF\u7A33\u5B9A\u6027\uFF0C\u7981\u6B62\u5728\u865A\u62DF\u673A\u73AF\u5883\u4E2D\u8FDB\u884C\u7B54\u9898\u3002\u8BF7\u9000\u51FA\u865A\u62DF\u673A\uFF0C\u6539\u7528\u672C\u5730\u7535\u8111\u5BA2\u6237\u7AEF\u91CD\u65B0\u8FDB\u5165\u8003\u8BD5\u7CFB\u7EDF\u3002",okText:"\u6211\u77E5\u9053\u4E86"}),rn();break;case"2":l.default.info({content:(Qt=st==null?void 0:st.data)==null?void 0:Qt.message}),rn();break;case"0":bt("0");break}}}))!=="0"))){if(ge>Tt){he(!0);return}localStorage.removeItem("Refresh"),yield(0,L.nr)({inner_ip:ft,public_ip:rt,open_camera:ht,ip_limit:ve,ip_bind:at,ip_bind_type:Xe,exercise_tips:[""],exerciseId:We,screen_open:Ve,forbid_screen:G,screen_num:ut,screen_sec:He,coursesId:Z.coursesId,login:(Ut=y.userInfo)==null?void 0:Ut.login,history:b.history,identity_verify:pt,open_phone_video_recording:Ke,current_status:Et,unlockClose:!0})}})},ge>Tt?"\u7ACB\u5373\u7533\u8BF7\u7EE7\u7EED\u8003\u8BD5":"\u6211\u5DF2\u9605\u8BFB\uFF0C\u8FDB\u5165\u8003\u8BD5"," ")))))),T.createElement(l.default,{centered:!0,title:"\u7533\u8BF7\u7EE7\u7EED\u8003\u8BD5",open:be,onCancel:()=>{he(!1)},onOk:()=>{qe.submit()},confirmLoading:et},T.createElement(M.Z,{spinning:Be||Y},T.createElement(H.default,{layout:"vertical",size:"large",form:qe,onFinish:Ut=>R(void 0,null,function*(){var Bt;let bt=null;if($e(!0),bt=yield(0,k.ZP)(`/api/exercises/${Z==null?void 0:Z.categoryId}/check_key.json`,{method:"post",body:U({},Ut)}),(bt==null?void 0:bt.status)==-1){qe.setFields([{name:"unlock_key",errors:[bt==null?void 0:bt.message]}]),$e(!1);return}bt=yield(0,k.ZP)(`/api/exercises/${Z==null?void 0:Z.categoryId}/continue_exercise.json`,{method:"post",body:U({},Ut)}),(bt==null?void 0:bt.status)===0&&(localStorage.removeItem("Refresh"),A.ZP.success("\u64CD\u4F5C\u6210\u529F\uFF01"),yield(0,L.nr)({inner_ip:ft,public_ip:rt,open_camera:ht,ip_limit:ve,ip_bind:at,ip_bind_type:Xe,exercise_tips:[""],exerciseId:We,screen_open:Ve,screen_num:ut,screen_sec:He,forbid_screen:G,coursesId:Z.coursesId,login:(Bt=y.userInfo)==null?void 0:Bt.login,history:b.history,identity_verify:pt,open_phone_video_recording:Ke,current_status:Et,unlockClose:!0})),$e(!1)})},T.createElement(H.default.Item,{rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u8003\u8BD5\u89E3\u9501\u7801"}],name:"unlock_key",label:"\u7EE7\u7EED\u8003\u8BD5\u9700\u8981\u8F93\u5165\u8003\u8BD5\u89E3\u9501\u7801\uFF08\u76D1\u8003\u8001\u5E08\u63D0\u4F9B\uFF09"},T.createElement(g.default,{autoComplete:"off",className:we?"":m.secureInput,suffix:T.createElement("span",{className:"current",onClick:()=>Ae(!we)},we?T.createElement(N.Z,null):T.createElement(V.Z,null)),placeholder:"\u8BF7\u8F93\u5165\u8003\u8BD5\u89E3\u9501\u7801"})),Ie!==-1?T.createElement(T.Fragment,null,T.createElement(H.default.Item,{name:"time",label:T.createElement("span",null,"\u5EF6\u957F\u65F6\u95F4\uFF08",T.createElement("span",{style:{color:"#9096A3"}},"\u5F53\u524D\u8003\u8BD5\u622A\u6B62\u65F6\u95F4",w()(Te==null?void 0:Te.user_total_end_time).format("YYYY-MM-DD HH:mm")),"\uFF09")},T.createElement(K,{MaxMinutes:ot})),T.createElement("div",{className:"mb20",style:{color:"#FA6400"}},"\u8BE5\u5B66\u751F\u5269\u4F59\u8003\u8BD5\u65F6\u95F4\uFF1A",T.createElement("span",{className:"ml5"},gt),"\u5206\u949F",gt!==0&&(Te==null?void 0:Te.user_end_time)&&T.createElement("span",null,"\uFF0C\u4EA4\u5377\u622A\u6B62\u65F6\u95F4\uFF1A",T.createElement("span",{className:"ml5"},w()(Te==null?void 0:Te.user_end_time).add(ie||0,"m").format("YYYY-MM-DD HH:mm:ss"))))):T.createElement("span",{style:{color:"#F6A53B"}}," \u5F53\u524D\u8003\u8BD5\u672A\u9650\u5236\u8003\u751F\u7B54\u9898\u65F6\u957F\uFF0C\u8003\u8BD5\u622A\u6B62\u65F6\u95F4\u4E3A ",w()(de).format("YYYY-MM-DD HH:mm"))))))};var z=(0,b.connect)(({user:y,globalSetting:_})=>({globalSetting:_,user:y}))(j)},98072:function(Rt,nt,W){"use strict";W.d(nt,{U:function(){return l}});var T=W(59301),fe=Object.defineProperty,ke=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,p=(M,A,g)=>A in M?fe(M,A,{enumerable:!0,configurable:!0,writable:!0,value:g}):M[A]=g,ae=(M,A)=>{for(var g in A||(A={}))oe.call(A,g)&&p(M,g,A[g]);if(ke)for(var g of ke(A))H.call(A,g)&&p(M,g,A[g]);return M},te=(M,A,g)=>new Promise((b,m)=>{var x=F=>{try{L(g.next(F))}catch(w){m(w)}},C=F=>{try{L(g.throw(F))}catch(w){m(w)}},L=F=>F.done?b(F.value):Promise.resolve(F.value).then(x,C);L((g=g.apply(M,A)).next())});function l(M,A){const[g,b]=(0,T.useState)(A),[m,x]=(0,T.useState)(!1),[C,L]=(0,T.useState)();return[g,m,(w,k=!1)=>te(this,null,function*(){const N=k?A:ae(ae({},g),w);x(!0),b(N);const V=yield M(N);return x(!1),L(V),V}),C,L]}},90290:function(Rt,nt,W){"use strict";W.d(nt,{AL:function(){return N},Iy:function(){return A},Qv:function(){return m},ez:function(){return k},jb:function(){return g}});var T=W(32834),fe=W.n(T),ke=W(11690),oe=W.n(ke);let H=1;function p(X,_e){const ye=X.match(/^(\s+)(?:```)/);if(ye===null)return _e;const Ge=ye[1];return _e.split(`
`).map(U=>{const R=U.match(/^\s+/);if(R===null)return U;const[O]=R;return O.length>=Ge.length?U.slice(Ge.length):U}).join(`
`)}let ae=[],te=["<ul>"];const l=new(fe()).Renderer,M=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){ae.length=0,te=["<ul>"]}const g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(X,_e,ye,Ge){if(_e>=X.length||X[_e].level<=ye)return _e;var U=X[_e];Ge.push("<li><a href='#"+H+U.anchor+"'>"+U.text+"</a>"),_e++;var R=[];return _e=b(X,_e,U.level,R),R.length>0&&(Ge.push("<ul>"),R.forEach(function(O){Ge.push(O)}),Ge.push("</ul>")),Ge.push("</li>"),_e=b(X,_e,ye,Ge),_e}function m(){return b(ae,0,0,te),te.push("</ul>"),te.join("")}const x={heading(X){const _e=M.exec(X);if(H+=1,_e)return{type:"heading",raw:_e[0],depth:_e[1].length,text:_e[2]}},fences(X){const _e=this.rules.block.fences.exec(X);if(_e){const ye=_e[0];let Ge=p(ye,_e[3]||"");const U=_e[2]?_e[2].trim():_e[2];if(["latex","katex","math"].indexOf(U)>=0){const R=F(),O=Ge;Ge=R,w[R]={type:"block",expression:O}}return{type:"code",raw:ye,lang:U,text:Ge}}}},C=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let L=0;const F=()=>`__special_katext_id_${L++}__`;let w={};function k(){return w}function N(){L=0,w={}}function V(X){return X=X.replace(C,(_e,ye)=>{const Ge=F();return w[Ge]={type:"inline",expression:ye},Ge}),X}const q=l.listitem;l.listitem=function(X){return q(V(X))};const le=l.paragraph;l.paragraph=function(X){return le(V(X))};const ee=l.tablecell;l.tablecell=function(X,_e){return ee(V(X),_e)},l.code=function(X,_e,ye){const Ge=(_e||"").match(/\S*/)[0];return Ge?["latex","katex","math"].indexOf(Ge)>=0?`<p class='editormd-tex'>${X}</p>`:`<pre class="prettyprint linenums"><code class="language-${_e}">${ye?X:(0,ke.escape)(X,!0)}</code></pre>
`:'<pre class="prettyprint linenums"><code>'+(ye?X:(0,ke.escape)(X,!0))+"</code></pre>"},l.heading=function(X,_e,ye){let Ge=this.options.headerPrefix+ye.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return ae.push({anchor:Ge,level:_e,text:X}),"<h"+_e+' id="'+H+Ge+'">'+X+"</h"+_e+">"},fe().setOptions({silent:!0,gfm:!0,pedantic:!1}),fe().use({tokenizer:x,renderer:l}),nt.ZP=fe()},64018:function(){var Rt,nt,W,T=!1,fe,ke;window.PR_SHOULD_USE_CONTINUATION=!0;var oe,H;(function(){var p=window,ae=["break,continue,do,else,for,if,return,while"],te=[ae,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],l=[te,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[l,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],A=[l,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],g=[l,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],b="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",m=[l,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],x="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",C=[ae,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],L=[ae,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],F=[ae,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[M,g,A,m,x,C,L,F],k=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,N="str",V="kwd",q="com",le="typ",ee="lit",X="pun",_e="pln",ye="tag",Ge="dec",U="src",R="atn",O="atv",K="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z(ue){for(var Y=0,xe=!1,Te=!1,Fe=0,$=ue.length;Fe<$;++Fe){var se=ue[Fe];if(se.ignoreCase)Te=!0;else if(/[a-z]/i.test(se.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){xe=!0,Te=!1;break}}var Se={b:8,t:9,n:10,v:11,f:12,r:13};function Ie(Ye){var We=Ye.charCodeAt(0);if(We!==92)return We;var ht=Ye.charAt(1);return We=Se[ht],We||("0"<=ht&&ht<="7"?parseInt(Ye.substring(1),8):ht==="u"||ht==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function Oe(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var We=String.fromCharCode(Ye);return We==="\\"||We==="-"||We==="]"||We==="^"?"\\"+We:We}function Ve(Ye){var We=Ye.substring(1,Ye.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),ht=[],ft=We[0]==="^",rt=["["];ft&&rt.push("^");for(var ve=ft?1:0,at=We.length;ve<at;++ve){var Xe=We[ve];if(/\\[bdsw]/i.test(Xe))rt.push(Xe);else{var Ke=Ie(Xe),pt;ve+2<at&&We[ve+1]==="-"?(pt=Ie(We[ve+2]),ve+=2):pt=Ke,ht.push([Ke,pt]),pt<65||Ke>122||(pt<65||Ke>90||ht.push([Math.max(65,Ke)|32,Math.min(pt,90)|32]),pt<97||Ke>122||ht.push([Math.max(97,Ke)&-33,Math.min(pt,122)&-33]))}}ht.sort(function(Gt,lt){return Gt[0]-lt[0]||lt[1]-Gt[1]});for(var Et=[],ct=[],ve=0;ve<ht.length;++ve){var Dt=ht[ve];Dt[0]<=ct[1]+1?ct[1]=Math.max(ct[1],Dt[1]):Et.push(ct=Dt)}for(var ve=0;ve<Et.length;++ve){var Dt=Et[ve];rt.push(Oe(Dt[0])),Dt[1]>Dt[0]&&(Dt[1]+1>Dt[0]&&rt.push("-"),rt.push(Oe(Dt[1])))}return rt.push("]"),rt.join("")}function ut(Ye){for(var We=Ye.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),ht=We.length,ft=[],rt=0,ve=0;rt<ht;++rt){var at=We[rt];if(at==="(")++ve;else if(at.charAt(0)==="\\"){var Xe=+at.substring(1);Xe&&(Xe<=ve?ft[Xe]=-1:We[rt]=Oe(Xe))}}for(var rt=1;rt<ft.length;++rt)ft[rt]===-1&&(ft[rt]=++Y);for(var rt=0,ve=0;rt<ht;++rt){var at=We[rt];if(at==="(")++ve,ft[ve]||(We[rt]="(?:");else if(at.charAt(0)==="\\"){var Xe=+at.substring(1);Xe&&Xe<=ve&&(We[rt]="\\"+ft[Xe])}}for(var rt=0;rt<ht;++rt)We[rt]==="^"&&We[rt+1]!=="^"&&(We[rt]="");if(Ye.ignoreCase&&xe)for(var rt=0;rt<ht;++rt){var at=We[rt],Ke=at.charAt(0);at.length>=2&&Ke==="["?We[rt]=Ve(at):Ke!=="\\"&&(We[rt]=at.replace(/[a-zA-Z]/g,function(ct){var Dt=ct.charCodeAt(0);return"["+String.fromCharCode(Dt&-33,Dt|32)+"]"}))}return We.join("")}for(var He=[],Fe=0,$=ue.length;Fe<$;++Fe){var se=ue[Fe];if(se.global||se.multiline)throw new Error(""+se);He.push("(?:"+ut(se)+")")}return new RegExp(He.join("|"),Te?"gi":"g")}function y(ue,Y){var xe=/(?:^|\s)nocode(?:\s|$)/,Te=[],Fe=0,$=[],se=0;function Se(Ie){var Oe=Ie.nodeType;if(Oe==1){if(xe.test(Ie.className))return;for(var Ve=Ie.firstChild;Ve;Ve=Ve.nextSibling)Se(Ve);var ut=Ie.nodeName.toLowerCase();(ut==="br"||ut==="li")&&(Te[se]=`
`,$[se<<1]=Fe++,$[se++<<1|1]=Ie)}else if(Oe==3||Oe==4){var He=Ie.nodeValue;He.length&&(Y?He=He.replace(/\r\n?/g,`
`):He=He.replace(/[ \t\r\n]+/g," "),Te[se]=He,$[se<<1]=Fe,Fe+=He.length,$[se++<<1|1]=Ie)}}return Se(ue),{sourceCode:Te.join("").replace(/\n$/,""),spans:$}}function _(ue,Y,xe,Te,Fe){if(xe){var $={sourceNode:ue,pre:1,langExtension:null,numberLines:null,sourceCode:xe,spans:null,basePos:Y,decorations:null};Te($),Fe.push.apply(Fe,$.decorations)}}var I=/\S/;function Z(ue){for(var Y=void 0,xe=ue.firstChild;xe;xe=xe.nextSibling){var Te=xe.nodeType;Y=Te===1?Y?ue:xe:Te===3&&I.test(xe.nodeValue)?ue:Y}return Y===ue?void 0:Y}function Ee(ue,Y){var xe={},Te;(function(){for(var se=ue.concat(Y),Se=[],Ie={},Oe=0,Ve=se.length;Oe<Ve;++Oe){var ut=se[Oe],He=ut[3];if(He)for(var Ye=He.length;--Ye>=0;)xe[He.charAt(Ye)]=ut;var We=ut[1],ht=""+We;Ie.hasOwnProperty(ht)||(Se.push(We),Ie[ht]=null)}Se.push(/[\0-\uffff]/),Te=z(Se)})();var Fe=Y.length,$=function(se){for(var Se=se.sourceCode,Ie=se.basePos,Oe=se.sourceNode,Ve=[Ie,_e],ut=0,He=Se.match(Te)||[],Ye={},We=0,ht=He.length;We<ht;++We){var ft=He[We],rt=Ye[ft],ve=void 0,at;if(typeof rt=="string")at=!1;else{var Xe=xe[ft.charAt(0)];if(Xe)ve=ft.match(Xe[1]),rt=Xe[0];else{for(var Ke=0;Ke<Fe;++Ke)if(Xe=Y[Ke],ve=ft.match(Xe[1]),ve){rt=Xe[0];break}ve||(rt=_e)}at=rt.length>=5&&rt.substring(0,5)==="lang-",at&&!(ve&&typeof ve[1]=="string")&&(at=!1,rt=U),at||(Ye[ft]=rt)}var pt=ut;if(ut+=ft.length,!at)Ve.push(Ie+pt,rt);else{var Et=ve[1],ct=ft.indexOf(Et),Dt=ct+Et.length;ve[2]&&(Dt=ft.length-ve[2].length,ct=Dt-Et.length);var Gt=rt.substring(5);_(Oe,Ie+pt,ft.substring(0,ct),$,Ve),_(Oe,Ie+pt+ct,Et,be(Gt,Et),Ve),_(Oe,Ie+pt+Dt,ft.substring(Dt),$,Ve)}}se.decorations=Ve};return $}function Ce(ue){var Y=[],xe=[];ue.tripleQuotedStrings?Y.push([N,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ue.multiLineStrings?Y.push([N,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Y.push([N,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ue.verbatimStrings&&xe.push([N,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Te=ue.hashComments;Te&&(ue.cStyleComments?(Te>1?Y.push([q,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Y.push([q,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),xe.push([N,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Y.push([q,/^#[^\r\n]*/,null,"#"])),ue.cStyleComments&&(xe.push([q,/^\/\/[^\r\n]*/,null]),xe.push([q,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=ue.regexLiterals;if(Fe){var $=Fe>1?"":`
\r`,se=$?".":"[\\S\\s]",Se="/(?=[^/*"+$+"])(?:[^/\\x5B\\x5C"+$+"]|\\x5C"+se+"|\\x5B(?:[^\\x5C\\x5D"+$+"]|\\x5C"+se+")*(?:\\x5D|$))+/";xe.push(["lang-regex",RegExp("^"+j+"("+Se+")")])}var Ie=ue.types;Ie&&xe.push([le,Ie]);var Oe=(""+ue.keywords).replace(/^ | $/g,"");Oe.length&&xe.push([V,new RegExp("^(?:"+Oe.replace(/[\s,]+/g,"|")+")\\b"),null]),Y.push([_e,/^\s+/,null,` \r
\xA0`]);var Ve="^.[^\\s\\w.$@'\"`/\\\\]*";return ue.regexLiterals&&(Ve+="(?!s*/)"),xe.push([ee,/^@[a-z_$][a-z_$@0-9]*/i,null],[le,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[_e,/^[a-z_$][a-z_$@0-9]*/i,null],[ee,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[_e,/^\\[\s\S]?/,null],[X,new RegExp(Ve),null]),Ee(Y,xe)}var Ue=Ce({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Be(ue,Y,xe){for(var Te=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,$=ue.ownerDocument,se=$.createElement("li");ue.firstChild;)se.appendChild(ue.firstChild);var Se=[se];function Ie(We){var ht=We.nodeType;if(ht==1&&!Te.test(We.className))if(We.nodeName==="br")Oe(We),We.parentNode&&We.parentNode.removeChild(We);else for(var ft=We.firstChild;ft;ft=ft.nextSibling)Ie(ft);else if((ht==3||ht==4)&&xe){var rt=We.nodeValue,ve=rt.match(Fe);if(ve){var at=rt.substring(0,ve.index);We.nodeValue=at;var Xe=rt.substring(ve.index+ve[0].length);if(Xe){var Ke=We.parentNode;Ke.insertBefore($.createTextNode(Xe),We.nextSibling)}Oe(We),at||We.parentNode.removeChild(We)}}}function Oe(We){for(;!We.nextSibling;)if(We=We.parentNode,!We)return;function ht(ve,at){var Xe=at?ve.cloneNode(!1):ve,Ke=ve.parentNode;if(Ke){var pt=ht(Ke,1),Et=ve.nextSibling;pt.appendChild(Xe);for(var ct=Et;ct;ct=Et)Et=ct.nextSibling,pt.appendChild(ct)}return Xe}for(var ft=ht(We.nextSibling,0),rt;(rt=ft.parentNode)&&rt.nodeType===1;)ft=rt;Se.push(ft)}for(var Ve=0;Ve<Se.length;++Ve)Ie(Se[Ve]);Y===(Y|0)&&Se[0].setAttribute("value",Y);var ut=$.createElement("ol");ut.className="linenums";for(var He=Math.max(0,Y-1|0)||0,Ve=0,Ye=Se.length;Ve<Ye;++Ve)se=Se[Ve],se.className="L"+(Ve+He)%10,se.firstChild||se.appendChild($.createTextNode("\xA0")),ut.appendChild(se);ue.appendChild(ut)}function Ze(ue){var Y=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Y=Y&&+Y[1]<=8;var xe=/\n/g,Te=ue.sourceCode,Fe=Te.length,$=0,se=ue.spans,Se=se.length,Ie=0,Oe=ue.decorations,Ve=Oe.length,ut=0;Oe[Ve]=Fe;var He,Ye;for(Ye=He=0;Ye<Ve;)Oe[Ye]!==Oe[Ye+2]?(Oe[He++]=Oe[Ye++],Oe[He++]=Oe[Ye++]):Ye+=2;for(Ve=He,Ye=He=0;Ye<Ve;){for(var We=Oe[Ye],ht=Oe[Ye+1],ft=Ye+2;ft+2<=Ve&&Oe[ft+1]===ht;)ft+=2;Oe[He++]=We,Oe[He++]=ht,Ye=ft}Ve=Oe.length=He;var rt=ue.sourceNode,ve="";rt&&(ve=rt.style.display,rt.style.display="none");try{for(var at=null;Ie<Se;){var Xe=se[Ie],Ke=se[Ie+2]||Fe,pt=Oe[ut+2]||Fe,ft=Math.min(Ke,pt),Et=se[Ie+1],ct;if(Et.nodeType!==1&&(ct=Te.substring($,ft))){Y&&(ct=ct.replace(xe,"\r")),Et.nodeValue=ct;var Dt=Et.ownerDocument,Gt=Dt.createElement("span");Gt.className=Oe[ut+1];var lt=Et.parentNode;lt.replaceChild(Gt,Et),Gt.appendChild(Et),$<Ke&&(se[Ie+1]=Et=Dt.createTextNode(Te.substring(ft,Ke)),lt.insertBefore(Et,Gt.nextSibling))}$=ft,$>=Ke&&(Ie+=2),$>=pt&&(ut+=2)}}finally{rt&&(rt.style.display=ve)}}var et={};function $e(ue,Y){for(var xe=Y.length;--xe>=0;){var Te=Y[xe];et.hasOwnProperty(Te)?p.console&&console.warn("cannot override language handler %s",Te):et[Te]=ue}}function be(ue,Y){return ue&&et.hasOwnProperty(ue)||(ue=/^\s*</.test(Y)?"default-markup":"default-code"),et[ue]}$e(Ue,["default-code"]),$e(Ee([],[[_e,/^[^<?]+/],[Ge,/^<!\w[^>]*(?:>|$)/],[q,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[X,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),$e(Ee([[_e,/^[\s]+/,null,` \r
`],[O,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[ye,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[X,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),$e(Ee([],[[O,/^[\s\S]+/]]),["uq.val"]),$e(Ce({keywords:M,hashComments:!0,cStyleComments:!0,types:k}),["c","cc","cpp","cxx","cyc","m"]),$e(Ce({keywords:"null,true,false"}),["json"]),$e(Ce({keywords:g,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:k}),["cs"]),$e(Ce({keywords:A,cStyleComments:!0}),["java"]),$e(Ce({keywords:F,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),$e(Ce({keywords:C,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),$e(Ce({keywords:x,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),$e(Ce({keywords:L,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),$e(Ce({keywords:m,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),$e(Ce({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),$e(Ee([],[[N,/^[\s\S]+/]]),["regex"]);function he(ue){var Y=ue.langExtension;try{var xe=y(ue.sourceNode,ue.pre),Te=xe.sourceCode;ue.sourceCode=Te,ue.spans=xe.spans,ue.basePos=0,be(Y,Te)(ue),Ze(ue)}catch(Fe){p.console&&console.log(Fe&&Fe.stack||Fe)}}function we(ue,Y,xe){var Te=xe||!1,Fe=Y||null,$=document.createElement("div");$.innerHTML="<pre>"+ue+"</pre>",$=$.firstChild,Te&&Be($,Te,!0);var se={langExtension:Fe,numberLines:Te,sourceNode:$,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return he(se),$.innerHTML}function Ae(ue,Y){var xe=Y||document.body,Te=xe.ownerDocument||document;function Fe(Xe){return xe.getElementsByTagName(Xe)}for(var $=[Fe("pre"),Fe("code"),Fe("xmp")],se=[],Se=0;Se<$.length;++Se)for(var Ie=0,Oe=$[Se].length;Ie<Oe;++Ie)se.push($[Se][Ie]);$=null;var Ve=Date;Ve.now||(Ve={now:function(){return+new Date}});var ut=0,He=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,We=/\bprettyprinted\b/,ht=/pre|xmp/i,ft=/^code$/i,rt=/^(?:pre|code|xmp)$/i,ve={};function at(){for(var Xe=p.PR_SHOULD_USE_CONTINUATION?Ve.now()+250:1/0;ut<se.length&&Ve.now()<Xe;ut++){for(var Ke=se[ut],pt=ve,Et=Ke;Et=Et.previousSibling;){var ct=Et.nodeType,Dt=(ct===7||ct===8)&&Et.nodeValue;if(Dt?!/^\??prettify\b/.test(Dt):ct!==3||/\S/.test(Et.nodeValue))break;if(Dt){pt={},Dt.replace(/\b(\w+)=([\w:.%+-]+)/g,function(it,ot,gt){pt[ot]=gt});break}}var Gt=Ke.className;if((pt!==ve||Ye.test(Gt))&&!We.test(Gt)){for(var lt=!1,Tt=Ke.parentNode;Tt;Tt=Tt.parentNode){var ge=Tt.tagName;if(rt.test(ge)&&Tt.className&&Ye.test(Tt.className)){lt=!0;break}}if(!lt){Ke.className+=" prettyprinted";var de=pt.lang;if(!de){de=Gt.match(He);var pe;!de&&(pe=Z(Ke))&&ft.test(pe.tagName)&&(de=pe.className.match(He)),de&&(de=de[1])}var P;if(ht.test(Ke.tagName))P=1;else{var G=Ke.currentStyle,Q=Te.defaultView,re=G?G.whiteSpace:Q&&Q.getComputedStyle?Q.getComputedStyle(Ke,null).getPropertyValue("white-space"):0;P=re&&re.substring(0,3)==="pre"}var ce=pt.linenums;(ce=ce==="true"||+ce)||(ce=Gt.match(/\blinenums\b(?::(\d+))?/),ce=ce?ce[1]&&ce[1].length?+ce[1]:!0:!1),ce&&Be(Ke,ce,P);var tt={langExtension:de,sourceNode:Ke,numberLines:ce,pre:P,sourceCode:null,basePos:null,spans:null,decorations:null};he(tt)}}}ut<se.length?p.setTimeout(at,250):typeof ue=="function"&&ue()}at()}var qe=p.PR={createSimpleLexer:Ee,registerLangHandler:$e,sourceDecorator:Ce,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:O,PR_COMMENT:q,PR_DECLARATION:Ge,PR_KEYWORD:V,PR_LITERAL:ee,PR_NOCODE:K,PR_PLAIN:_e,PR_PUNCTUATION:X,PR_SOURCE:U,PR_STRING:N,PR_TAG:ye,PR_TYPE:le,prettyPrintOne:T?p.prettyPrintOne=we:oe=we,prettyPrint:H=T?p.prettyPrint=Ae:H=Ae},ie=p.define;typeof ie=="function"&&ie.amd&&ie("google-code-prettify",[],function(){return qe})})()},25769:function(Rt,nt,W){"use strict";var T=W(98040),fe={"text/plain":"Text","text/html":"Url",default:"Text"},ke="Copy to clipboard: #{key}, Enter";function oe(p){var ae=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,ae)}function H(p,ae){var te,l,M,A,g,b,m=!1;ae||(ae={}),te=ae.debug||!1;try{M=T(),A=document.createRange(),g=document.getSelection(),b=document.createElement("span"),b.textContent=p,b.ariaHidden="true",b.style.all="unset",b.style.position="fixed",b.style.top=0,b.style.clip="rect(0, 0, 0, 0)",b.style.whiteSpace="pre",b.style.webkitUserSelect="text",b.style.MozUserSelect="text",b.style.msUserSelect="text",b.style.userSelect="text",b.addEventListener("copy",function(C){if(C.stopPropagation(),ae.format)if(C.preventDefault(),typeof C.clipboardData=="undefined"){te&&console.warn("unable to use e.clipboardData"),te&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var L=fe[ae.format]||fe.default;window.clipboardData.setData(L,p)}else C.clipboardData.clearData(),C.clipboardData.setData(ae.format,p);ae.onCopy&&(C.preventDefault(),ae.onCopy(C.clipboardData))}),document.body.appendChild(b),A.selectNodeContents(b),g.addRange(A);var x=document.execCommand("copy");if(!x)throw new Error("copy command was unsuccessful");m=!0}catch(C){te&&console.error("unable to copy using execCommand: ",C),te&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ae.format||"text",p),ae.onCopy&&ae.onCopy(window.clipboardData),m=!0}catch(L){te&&console.error("unable to copy using clipboardData: ",L),te&&console.error("falling back to prompt"),l=oe("message"in ae?ae.message:ke),window.prompt(l,p)}}finally{g&&(typeof g.removeRange=="function"?g.removeRange(A):g.removeAllRanges()),b&&document.body.removeChild(b),M()}return m}Rt.exports=H},53184:function(Rt,nt,W){"use strict";var T,fe;function ke(oe,H,p){var ae=function(te,l){return oe.js_beautify(te,l)};return ae.js=oe.js_beautify,ae.css=H.css_beautify,ae.html=p.html_beautify,ae.js_beautify=oe.js_beautify,ae.css_beautify=H.css_beautify,ae.html_beautify=p.html_beautify,ae}T=[W(58553),W(87804),W(40998)],fe=function(oe,H,p){return ke(oe,H,p)}.apply(nt,T),fe!==void 0&&(Rt.exports=fe)},87804:function(Rt,nt){var W,T;(function(){var fe;(function(){"use strict";var oe=[,,function(te){function l(g){this.__parent=g,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 g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var b=this.__items.length-1;b>=0;b--)if(this.__items[b].match(g))return!0;return!1},l.prototype.set_indent=function(g,b){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=b||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 g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__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(g){this.__items.push(g);var b=g.lastIndexOf(`
`);b!==-1?this.__character_count=g.length-b:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},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 g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function M(g,b){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),b=b||"",g.indent_level>0&&(b=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=b,this.__base_string_length=b.length}M.prototype.get_indent_size=function(g,b){var m=this.__base_string_length;return b=b||0,g<0&&(m=0),m+=g*this.__indent_size,m+=b,m},M.prototype.get_indent_string=function(g,b){var m=this.__base_string;return b=b||0,g<0&&(g=0,m=""),b+=g*this.__indent_size,this.__ensure_cache(b),m+=this.__cache[b],m},M.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},M.prototype.__add_column=function(){var g=this.__cache.length,b=0,m="";this.__indent_size&&g>=this.__indent_size&&(b=Math.floor(g/this.__indent_size),g-=b*this.__indent_size,m=new Array(b+1).join(this.__indent_string)),g&&(m+=new Array(g+1).join(" ")),this.__cache.push(m)};function A(g,b){this.__indent_cache=new M(g,b),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.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()}A.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},A.prototype.get_line_number=function(){return this.__lines.length},A.prototype.get_indent_string=function(g,b){return this.__indent_cache.get_indent_string(g,b)},A.prototype.get_indent_size=function(g,b){return this.__indent_cache.get_indent_size(g,b)},A.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},A.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},A.prototype.get_code=function(g){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 m=this.__lines.join(`
`);return g!==`
`&&(m=m.replace(/[\n]/g,g)),m},A.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},A.prototype.set_indent=function(g,b){return g=g||0,b=b||0,this.next_line.set_indent(g,b),this.__lines.length>1?(this.current_line.set_indent(g,b),!0):(this.current_line.set_indent(),!1)},A.prototype.add_raw_token=function(g){for(var b=0;b<g.newlines;b++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},A.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},A.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(" "))},A.prototype.remove_indent=function(g){for(var b=this.__lines.length;g<b;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},A.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&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},A.prototype.just_added_newline=function(){return this.current_line.is_empty()},A.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},A.prototype.ensure_empty_line_above=function(g,b){for(var m=this.__lines.length-2;m>=0;){var x=this.__lines[m];if(x.is_empty())break;if(x.item(0).indexOf(g)!==0&&x.item(-1)!==b){this.__lines.splice(m+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}m--}},te.exports.Output=A},,,,function(te){function l(g,b){this.raw_options=M(g,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"])}l.prototype._get_array=function(g,b){var m=this.raw_options[g],x=b||[];return typeof m=="object"?m!==null&&typeof m.concat=="function"&&(x=m.concat()):typeof m=="string"&&(x=m.split(/[^a-zA-Z0-9_\/\-]+/)),x},l.prototype._get_boolean=function(g,b){var m=this.raw_options[g],x=m===void 0?!!b:!!m;return x},l.prototype._get_characters=function(g,b){var m=this.raw_options[g],x=b||"";return typeof m=="string"&&(x=m.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),x},l.prototype._get_number=function(g,b){var m=this.raw_options[g];b=parseInt(b,10),isNaN(b)&&(b=0);var x=parseInt(m,10);return isNaN(x)&&(x=b),x},l.prototype._get_selection=function(g,b,m){var x=this._get_selection_list(g,b,m);if(x.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+b+`
You passed in: '`+this.raw_options[g]+"'");return x[0]},l.prototype._get_selection_list=function(g,b,m){if(!b||b.length===0)throw new Error("Selection list cannot be empty.");if(m=m||[b[0]],!this._is_valid_selection(m,b))throw new Error("Invalid Default Value!");var x=this._get_array(g,m);if(!this._is_valid_selection(x,b))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+b+`
You passed in: '`+this.raw_options[g]+"'");return x},l.prototype._is_valid_selection=function(g,b){return g.length&&b.length&&!g.some(function(m){return b.indexOf(m)===-1})};function M(g,b){var m={};g=A(g);var x;for(x in g)x!==b&&(m[x]=g[x]);if(b&&g[b])for(x in g[b])m[x]=g[b][x];return m}function A(g){var b={},m;for(m in g){var x=m.replace(/-/g,"_");b[x]=g[m]}return b}te.exports.Options=l,te.exports.normalizeOpts=A,te.exports.mergeOpts=M},,function(te){var l=RegExp.prototype.hasOwnProperty("sticky");function M(A){this.__input=A||"",this.__input_length=this.__input.length,this.__position=0}M.prototype.restart=function(){this.__position=0},M.prototype.back=function(){this.__position>0&&(this.__position-=1)},M.prototype.hasNext=function(){return this.__position<this.__input_length},M.prototype.next=function(){var A=null;return this.hasNext()&&(A=this.__input.charAt(this.__position),this.__position+=1),A},M.prototype.peek=function(A){var g=null;return A=A||0,A+=this.__position,A>=0&&A<this.__input_length&&(g=this.__input.charAt(A)),g},M.prototype.__match=function(A,g){A.lastIndex=g;var b=A.exec(this.__input);return b&&!(l&&A.sticky)&&b.index!==g&&(b=null),b},M.prototype.test=function(A,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(A,g):!1},M.prototype.testChar=function(A,g){var b=this.peek(g);return A.lastIndex=0,b!==null&&A.test(b)},M.prototype.match=function(A){var g=this.__match(A,this.__position);return g?this.__position+=g[0].length:g=null,g},M.prototype.read=function(A,g,b){var m="",x;return A&&(x=this.match(A),x&&(m+=x[0])),g&&(x||!A)&&(m+=this.readUntil(g,b)),m},M.prototype.readUntil=function(A,g){var b="",m=this.__position;A.lastIndex=this.__position;var x=A.exec(this.__input);return x?(m=x.index,g&&(m+=x[0].length)):m=this.__input_length,b=this.__input.substring(this.__position,m),this.__position=m,b},M.prototype.readUntilAfter=function(A){return this.readUntil(A,!0)},M.prototype.get_regexp=function(A,g){var b=null,m="g";return g&&l&&(m="y"),typeof A=="string"&&A!==""?b=new RegExp(A,m):A&&(b=new RegExp(A.source,m)),b},M.prototype.get_literal_regexp=function(A){return RegExp(A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},M.prototype.peekUntilAfter=function(A){var g=this.__position,b=this.readUntilAfter(A);return this.__position=g,b},M.prototype.lookBack=function(A){var g=this.__position-1;return g>=A.length&&this.__input.substring(g-A.length,g).toLowerCase()===A},te.exports.InputScanner=M},,,,,function(te){function l(M,A){M=typeof M=="string"?M:M.source,A=typeof A=="string"?A:A.source,this.__directives_block_pattern=new RegExp(M+/ beautify( \w+[:]\w+)+ /.source+A,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(M+/\sbeautify\signore:end\s/.source+A,"g")}l.prototype.get_directives=function(M){if(!M.match(this.__directives_block_pattern))return null;var A={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(M);g;)A[g[1]]=g[2],g=this.__directive_pattern.exec(M);return A},l.prototype.readIgnored=function(M){return M.readUntilAfter(this.__directives_end_ignore_pattern)},te.exports.Directives=l},,function(te,l,M){var A=M(16).Beautifier,g=M(17).Options;function b(m,x){var C=new A(m,x);return C.beautify()}te.exports=b,te.exports.defaultOptions=function(){return new g}},function(te,l,M){var A=M(17).Options,g=M(2).Output,b=M(8).InputScanner,m=M(13).Directives,x=new m(/\/\*/,/\*\//),C=/\r\n|[\r\n]/,L=/\r\n|[\r\n]/g,F=/\s/,w=/(?:\s|\n)+/g,k=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,N=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function V(q,le){this._source_text=q||"",this._options=new A(le),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"]}V.prototype.eatString=function(q){var le="";for(this._ch=this._input.next();this._ch;){if(le+=this._ch,this._ch==="\\")le+=this._input.next();else if(q.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return le},V.prototype.eatWhitespace=function(q){for(var le=F.test(this._input.peek()),ee=0;F.test(this._input.peek());)this._ch=this._input.next(),q&&this._ch===`
`&&(ee===0||ee<this._options.max_preserve_newlines)&&(ee++,this._output.add_new_line(!0));return le},V.prototype.foundNestedPseudoClass=function(){for(var q=0,le=1,ee=this._input.peek(le);ee;){if(ee==="{")return!0;if(ee==="(")q+=1;else if(ee===")"){if(q===0)return!1;q-=1}else if(ee===";"||ee==="}")return!1;le++,ee=this._input.peek(le)}return!1},V.prototype.print_string=function(q){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(q)},V.prototype.preserveSingleSpace=function(q){q&&(this._output.space_before_token=!0)},V.prototype.indent=function(){this._indentLevel++},V.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},V.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var q=this._source_text,le=this._options.eol;le==="auto"&&(le=`
`,q&&C.test(q||"")&&(le=q.match(C)[0])),q=q.replace(L,`
`);var ee=q.match(/^[\t ]*/)[0];this._output=new g(this._options,ee),this._input=new b(q),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var X=0,_e=!1,ye=!1,Ge=!1,U=!1,R=!1,O=this._ch,K=!1,j,z,y;j=this._input.read(w),z=j!=="",y=O,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),O=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var _=this._input.read(k),I=x.get_directives(_);I&&I.ignore==="start"&&(_+=x.readIgnored(this._input)),this.print_string(_),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(N)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(z),this.print_string(this._ch);var Z=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Z.match(/[ :]$/)&&(Z=this.eatString(": ").replace(/\s+$/,""),this.print_string(Z),this._output.space_before_token=!0),X===0&&Z.indexOf(":")!==-1&&(ye=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(z),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var Ee=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Ee.match(/[ :]$/)&&(Ee=this.eatString(": ").replace(/\s+$/,""),this.print_string(Ee),this._output.space_before_token=!0),X===0&&Ee.indexOf(":")!==-1?(ye=!0,this.indent()):Ee in this.NESTED_AT_RULE?(this._nestedLevel+=1,Ee in this.CONDITIONAL_GROUP_RULE&&(Ge=!0)):X===0&&!ye&&(U=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(z),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")ye&&(ye=!1,this.outdent()),U=!1,Ge?(Ge=!1,_e=this._indentLevel>=this._nestedLevel):_e=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_e&&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)):(y==="("?this._output.space_before_token=!1:y!==","&&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(),y==="{"&&this._output.trim(!0),ye&&(this.outdent(),ye=!1),this.print_string(this._ch),_e=!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 Ce=0;Ce<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Ce++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Ce])){K=!0;break}(_e||Ge)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!U&&X===0?(this.print_string(":"),ye||(ye=!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 Ue=y==='"'||y==="'";this.preserveSingleSpace(Ue||z),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")K=!1,X===0?(ye&&(this.outdent(),ye=!1),U=!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(),X++,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(")")),X&&(X--,this.outdent()));else{var Be=!1;this._input.lookBack("with")&&(Be=!0),this.preserveSingleSpace(z||Be),this.print_string(this._ch),ye&&y==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),R=!0):(this.eatWhitespace(),X++,this.indent())}else if(this._ch===")")X&&(X--,this.outdent()),R&&this._input.peek()===";"&&this._options.selector_separator_newline&&(R=!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&&(!ye||R)&&X===0&&!U?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!ye&&X===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(z),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 Ze=y==='"'||y==="'";this.preserveSingleSpace(Ze||z),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&K&&this._output.add_new_line()}var et=this._output.get_code(le);return et},te.exports.Beautifier=V},function(te,l,M){var A=M(6).Options;function g(b){A.call(this,b,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var m=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||m;var x=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var C=0;C<x.length;C++)x[C]!=="expand"?this.brace_style="collapse":this.brace_style=x[C]}g.prototype=new A,te.exports.Options=g}],H={};function p(te){var l=H[te];if(l!==void 0)return l.exports;var M=H[te]={exports:{}};return oe[te](M,M.exports,p),M.exports}var ae=p(15);fe=ae})();var ke=fe;W=[],T=function(){return{css_beautify:ke}}.apply(nt,W),T!==void 0&&(Rt.exports=T)})()},40998:function(Rt,nt,W){var T,fe;(function(){var ke;(function(){"use strict";var ae=[,,function(A){function g(x){this.__parent=x,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=[]}g.prototype.clone_empty=function(){var x=new g(this.__parent);return x.set_indent(this.__indent_count,this.__alignment_count),x},g.prototype.item=function(x){return x<0?this.__items[this.__items.length+x]:this.__items[x]},g.prototype.has_match=function(x){for(var C=this.__items.length-1;C>=0;C--)if(this.__items[C].match(x))return!0;return!1},g.prototype.set_indent=function(x,C){this.is_empty()&&(this.__indent_count=x||0,this.__alignment_count=C||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},g.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)},g.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},g.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var x=this.__parent.current_line;return x.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),x.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),x.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,x.__items[0]===" "&&(x.__items.splice(0,1),x.__character_count-=1),!0}return!1},g.prototype.is_empty=function(){return this.__items.length===0},g.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},g.prototype.push=function(x){this.__items.push(x);var C=x.lastIndexOf(`
`);C!==-1?this.__character_count=x.length-C:this.__character_count+=x.length},g.prototype.pop=function(){var x=null;return this.is_empty()||(x=this.__items.pop(),this.__character_count-=x.length),x},g.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},g.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},g.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},g.prototype.toString=function(){var x="";return this.is_empty()?this.__parent.indent_empty_lines&&(x=this.__parent.get_indent_string(this.__indent_count)):(x=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),x+=this.__items.join("")),x};function b(x,C){this.__cache=[""],this.__indent_size=x.indent_size,this.__indent_string=x.indent_char,x.indent_with_tabs||(this.__indent_string=new Array(x.indent_size+1).join(x.indent_char)),C=C||"",x.indent_level>0&&(C=new Array(x.indent_level+1).join(this.__indent_string)),this.__base_string=C,this.__base_string_length=C.length}b.prototype.get_indent_size=function(x,C){var L=this.__base_string_length;return C=C||0,x<0&&(L=0),L+=x*this.__indent_size,L+=C,L},b.prototype.get_indent_string=function(x,C){var L=this.__base_string;return C=C||0,x<0&&(x=0,L=""),C+=x*this.__indent_size,this.__ensure_cache(C),L+=this.__cache[C],L},b.prototype.__ensure_cache=function(x){for(;x>=this.__cache.length;)this.__add_column()},b.prototype.__add_column=function(){var x=this.__cache.length,C=0,L="";this.__indent_size&&x>=this.__indent_size&&(C=Math.floor(x/this.__indent_size),x-=C*this.__indent_size,L=new Array(C+1).join(this.__indent_string)),x&&(L+=new Array(x+1).join(" ")),this.__cache.push(L)};function m(x,C){this.__indent_cache=new b(x,C),this.raw=!1,this._end_with_newline=x.end_with_newline,this.indent_size=x.indent_size,this.wrap_line_length=x.wrap_line_length,this.indent_empty_lines=x.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new g(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}m.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},m.prototype.get_line_number=function(){return this.__lines.length},m.prototype.get_indent_string=function(x,C){return this.__indent_cache.get_indent_string(x,C)},m.prototype.get_indent_size=function(x,C){return this.__indent_cache.get_indent_size(x,C)},m.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},m.prototype.add_new_line=function(x){return this.is_empty()||!x&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},m.prototype.get_code=function(x){this.trim(!0);var C=this.current_line.pop();C&&(C[C.length-1]===`
`&&(C=C.replace(/\n+$/g,"")),this.current_line.push(C)),this._end_with_newline&&this.__add_outputline();var L=this.__lines.join(`
`);return x!==`
`&&(L=L.replace(/[\n]/g,x)),L},m.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},m.prototype.set_indent=function(x,C){return x=x||0,C=C||0,this.next_line.set_indent(x,C),this.__lines.length>1?(this.current_line.set_indent(x,C),!0):(this.current_line.set_indent(),!1)},m.prototype.add_raw_token=function(x){for(var C=0;C<x.newlines;C++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(x.whitespace_before),this.current_line.push(x.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},m.prototype.add_token=function(x){this.__add_space_before_token(),this.current_line.push(x),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},m.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(" "))},m.prototype.remove_indent=function(x){for(var C=this.__lines.length;x<C;)this.__lines[x]._remove_indent(),x++;this.current_line._remove_wrap_indent()},m.prototype.trim=function(x){for(x=x===void 0?!1:x,this.current_line.trim();x&&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},m.prototype.just_added_newline=function(){return this.current_line.is_empty()},m.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},m.prototype.ensure_empty_line_above=function(x,C){for(var L=this.__lines.length-2;L>=0;){var F=this.__lines[L];if(F.is_empty())break;if(F.item(0).indexOf(x)!==0&&F.item(-1)!==C){this.__lines.splice(L+1,0,new g(this)),this.previous_line=this.__lines[this.__lines.length-2];break}L--}},A.exports.Output=m},function(A){function g(b,m,x,C){this.type=b,this.text=m,this.comments_before=null,this.newlines=x||0,this.whitespace_before=C||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}A.exports.Token=g},,,function(A){function g(x,C){this.raw_options=b(x,C),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"])}g.prototype._get_array=function(x,C){var L=this.raw_options[x],F=C||[];return typeof L=="object"?L!==null&&typeof L.concat=="function"&&(F=L.concat()):typeof L=="string"&&(F=L.split(/[^a-zA-Z0-9_\/\-]+/)),F},g.prototype._get_boolean=function(x,C){var L=this.raw_options[x],F=L===void 0?!!C:!!L;return F},g.prototype._get_characters=function(x,C){var L=this.raw_options[x],F=C||"";return typeof L=="string"&&(F=L.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),F},g.prototype._get_number=function(x,C){var L=this.raw_options[x];C=parseInt(C,10),isNaN(C)&&(C=0);var F=parseInt(L,10);return isNaN(F)&&(F=C),F},g.prototype._get_selection=function(x,C,L){var F=this._get_selection_list(x,C,L);if(F.length!==1)throw new Error("Invalid Option Value: The option '"+x+`' can only be one of the following values:
`+C+`
You passed in: '`+this.raw_options[x]+"'");return F[0]},g.prototype._get_selection_list=function(x,C,L){if(!C||C.length===0)throw new Error("Selection list cannot be empty.");if(L=L||[C[0]],!this._is_valid_selection(L,C))throw new Error("Invalid Default Value!");var F=this._get_array(x,L);if(!this._is_valid_selection(F,C))throw new Error("Invalid Option Value: The option '"+x+`' can contain only the following values:
`+C+`
You passed in: '`+this.raw_options[x]+"'");return F},g.prototype._is_valid_selection=function(x,C){return x.length&&C.length&&!x.some(function(L){return C.indexOf(L)===-1})};function b(x,C){var L={};x=m(x);var F;for(F in x)F!==C&&(L[F]=x[F]);if(C&&x[C])for(F in x[C])L[F]=x[C][F];return L}function m(x){var C={},L;for(L in x){var F=L.replace(/-/g,"_");C[F]=x[L]}return C}A.exports.Options=g,A.exports.normalizeOpts=m,A.exports.mergeOpts=b},,function(A){var g=RegExp.prototype.hasOwnProperty("sticky");function b(m){this.__input=m||"",this.__input_length=this.__input.length,this.__position=0}b.prototype.restart=function(){this.__position=0},b.prototype.back=function(){this.__position>0&&(this.__position-=1)},b.prototype.hasNext=function(){return this.__position<this.__input_length},b.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__input.charAt(this.__position),this.__position+=1),m},b.prototype.peek=function(m){var x=null;return m=m||0,m+=this.__position,m>=0&&m<this.__input_length&&(x=this.__input.charAt(m)),x},b.prototype.__match=function(m,x){m.lastIndex=x;var C=m.exec(this.__input);return C&&!(g&&m.sticky)&&C.index!==x&&(C=null),C},b.prototype.test=function(m,x){return x=x||0,x+=this.__position,x>=0&&x<this.__input_length?!!this.__match(m,x):!1},b.prototype.testChar=function(m,x){var C=this.peek(x);return m.lastIndex=0,C!==null&&m.test(C)},b.prototype.match=function(m){var x=this.__match(m,this.__position);return x?this.__position+=x[0].length:x=null,x},b.prototype.read=function(m,x,C){var L="",F;return m&&(F=this.match(m),F&&(L+=F[0])),x&&(F||!m)&&(L+=this.readUntil(x,C)),L},b.prototype.readUntil=function(m,x){var C="",L=this.__position;m.lastIndex=this.__position;var F=m.exec(this.__input);return F?(L=F.index,x&&(L+=F[0].length)):L=this.__input_length,C=this.__input.substring(this.__position,L),this.__position=L,C},b.prototype.readUntilAfter=function(m){return this.readUntil(m,!0)},b.prototype.get_regexp=function(m,x){var C=null,L="g";return x&&g&&(L="y"),typeof m=="string"&&m!==""?C=new RegExp(m,L):m&&(C=new RegExp(m.source,L)),C},b.prototype.get_literal_regexp=function(m){return RegExp(m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},b.prototype.peekUntilAfter=function(m){var x=this.__position,C=this.readUntilAfter(m);return this.__position=x,C},b.prototype.lookBack=function(m){var x=this.__position-1;return x>=m.length&&this.__input.substring(x-m.length,x).toLowerCase()===m},A.exports.InputScanner=b},function(A,g,b){var m=b(8).InputScanner,x=b(3).Token,C=b(10).TokenStream,L=b(11).WhitespacePattern,F={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},w=function(k,N){this._input=new m(k),this._options=N||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new L(this._input)};w.prototype.tokenize=function(){this._input.restart(),this.__tokens=new C,this._reset();for(var k,N=new x(F.START,""),V=null,q=[],le=new C;N.type!==F.EOF;){for(k=this._get_next_token(N,V);this._is_comment(k);)le.add(k),k=this._get_next_token(N,V);le.isEmpty()||(k.comments_before=le,le=new C),k.parent=V,this._is_opening(k)?(q.push(V),V=k):V&&this._is_closing(k,V)&&(k.opened=V,V.closed=k,V=q.pop(),k.parent=V),k.previous=N,N.next=k,this.__tokens.add(k),N=k}return this.__tokens},w.prototype._is_first_token=function(){return this.__tokens.isEmpty()},w.prototype._reset=function(){},w.prototype._get_next_token=function(k,N){this._readWhitespace();var V=this._input.read(/.+/g);return V?this._create_token(F.RAW,V):this._create_token(F.EOF,"")},w.prototype._is_comment=function(k){return!1},w.prototype._is_opening=function(k){return!1},w.prototype._is_closing=function(k,N){return!1},w.prototype._create_token=function(k,N){var V=new x(k,N,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return V},w.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},A.exports.Tokenizer=w,A.exports.TOKEN=F},function(A){function g(b){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=b}g.prototype.restart=function(){this.__position=0},g.prototype.isEmpty=function(){return this.__tokens_length===0},g.prototype.hasNext=function(){return this.__position<this.__tokens_length},g.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__tokens[this.__position],this.__position+=1),b},g.prototype.peek=function(b){var m=null;return b=b||0,b+=this.__position,b>=0&&b<this.__tokens_length&&(m=this.__tokens[b]),m},g.prototype.add=function(b){this.__parent_token&&(b.parent=this.__parent_token),this.__tokens.push(b),this.__tokens_length+=1},A.exports.TokenStream=g},function(A,g,b){var m=b(12).Pattern;function x(C,L){m.call(this,C,L),L?this._line_regexp=this._input.get_regexp(L._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}x.prototype=new m,x.prototype.__set_whitespace_patterns=function(C,L){C+="\\t ",L+="\\n\\r",this._match_pattern=this._input.get_regexp("["+C+L+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+L+"]")},x.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var C=this._input.read(this._match_pattern);if(C===" ")this.whitespace_before_token=" ";else if(C){var L=this.__split(this._newline_regexp,C);this.newline_count=L.length-1,this.whitespace_before_token=L[this.newline_count]}return C},x.prototype.matching=function(C,L){var F=this._create();return F.__set_whitespace_patterns(C,L),F._update(),F},x.prototype._create=function(){return new x(this._input,this)},x.prototype.__split=function(C,L){C.lastIndex=0;for(var F=0,w=[],k=C.exec(L);k;)w.push(L.substring(F,k.index)),F=k.index+k[0].length,k=C.exec(L);return F<L.length?w.push(L.substring(F,L.length)):w.push(""),w},A.exports.WhitespacePattern=x},function(A){function g(b,m){this._input=b,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,m&&(this._starting_pattern=this._input.get_regexp(m._starting_pattern,!0),this._match_pattern=this._input.get_regexp(m._match_pattern,!0),this._until_pattern=this._input.get_regexp(m._until_pattern),this._until_after=m._until_after)}g.prototype.read=function(){var b=this._input.read(this._starting_pattern);return(!this._starting_pattern||b)&&(b+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),b},g.prototype.read_match=function(){return this._input.match(this._match_pattern)},g.prototype.until_after=function(b){var m=this._create();return m._until_after=!0,m._until_pattern=this._input.get_regexp(b),m._update(),m},g.prototype.until=function(b){var m=this._create();return m._until_after=!1,m._until_pattern=this._input.get_regexp(b),m._update(),m},g.prototype.starting_with=function(b){var m=this._create();return m._starting_pattern=this._input.get_regexp(b,!0),m._update(),m},g.prototype.matching=function(b){var m=this._create();return m._match_pattern=this._input.get_regexp(b,!0),m._update(),m},g.prototype._create=function(){return new g(this._input,this)},g.prototype._update=function(){},A.exports.Pattern=g},function(A){function g(b,m){b=typeof b=="string"?b:b.source,m=typeof m=="string"?m:m.source,this.__directives_block_pattern=new RegExp(b+/ beautify( \w+[:]\w+)+ /.source+m,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(b+/\sbeautify\signore:end\s/.source+m,"g")}g.prototype.get_directives=function(b){if(!b.match(this.__directives_block_pattern))return null;var m={};this.__directive_pattern.lastIndex=0;for(var x=this.__directive_pattern.exec(b);x;)m[x[1]]=x[2],x=this.__directive_pattern.exec(b);return m},g.prototype.readIgnored=function(b){return b.readUntilAfter(this.__directives_end_ignore_pattern)},A.exports.Directives=g},function(A,g,b){var m=b(12).Pattern,x={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function C(L,F){m.call(this,L,F),this.__template_pattern=null,this._disabled=Object.assign({},x),this._excluded=Object.assign({},x),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 m(L);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}/)}}C.prototype=new m,C.prototype._create=function(){return new C(this._input,this)},C.prototype._update=function(){this.__set_templated_pattern()},C.prototype.disable=function(L){var F=this._create();return F._disabled[L]=!0,F._update(),F},C.prototype.read_options=function(L){var F=this._create();for(var w in x)F._disabled[w]=L.templating.indexOf(w)===-1;return F._update(),F},C.prototype.exclude=function(L){var F=this._create();return F._excluded[L]=!0,F._update(),F},C.prototype.read=function(){var L="";this._match_pattern?L=this._input.read(this._starting_pattern):L=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),L+=F,F=this._read_template();return this._until_after&&(L+=this._input.readUntilAfter(this._until_pattern)),L},C.prototype.__set_templated_pattern=function(){var L=[];this._disabled.php||L.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||L.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||L.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||L.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(L.push(this.__patterns.django._starting_pattern.source),L.push(this.__patterns.django_value._starting_pattern.source),L.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||L.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&L.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+L.join("|")+")")},C.prototype._read_template=function(){var L="",F=this._input.peek();if(F==="<"){var w=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&w==="?"&&(L=L||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&w==="%"&&(L=L||this.__patterns.erb.read())}else F==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(L=L||this.__patterns.handlebars_comment.read(),L=L||this.__patterns.handlebars_unescaped.read(),L=L||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(L=L||this.__patterns.django_value.read()),this._excluded.django||(L=L||this.__patterns.django_comment.read(),L=L||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(L=L||this.__patterns.smarty_comment.read(),L=L||this.__patterns.smarty_literal.read(),L=L||this.__patterns.smarty.read()));return L},A.exports.TemplatablePattern=C},,,,function(A,g,b){var m=b(19).Beautifier,x=b(20).Options;function C(L,F,w,k){var N=new m(L,F,w,k);return N.beautify()}A.exports=C,A.exports.defaultOptions=function(){return new x}},function(A,g,b){var m=b(20).Options,x=b(2).Output,C=b(21).Tokenizer,L=b(21).TOKEN,F=/\r\n|[\r\n]/,w=/\r\n|[\r\n]/g,k=function(U,R){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=U.max_preserve_newlines,this.preserve_newlines=U.preserve_newlines,this._output=new x(U,R)};k.prototype.current_line_has_match=function(U){return this._output.current_line.has_match(U)},k.prototype.set_space_before_token=function(U,R){this._output.space_before_token=U,this._output.non_breaking_space=R},k.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},k.prototype.add_raw_token=function(U){this._output.add_raw_token(U)},k.prototype.print_preserved_newlines=function(U){var R=0;U.type!==L.TEXT&&U.previous.type!==L.TEXT&&(R=U.newlines?1:0),this.preserve_newlines&&(R=U.newlines<this.max_preserve_newlines+1?U.newlines:this.max_preserve_newlines+1);for(var O=0;O<R;O++)this.print_newline(O>0);return R!==0},k.prototype.traverse_whitespace=function(U){return U.whitespace_before||U.newlines?(this.print_preserved_newlines(U)||(this._output.space_before_token=!0),!0):!1},k.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},k.prototype.print_newline=function(U){this._output.add_new_line(U)},k.prototype.print_token=function(U){U.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(U.text))},k.prototype.indent=function(){this.indent_level++},k.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},k.prototype.get_full_indent=function(U){return U=this.indent_level+(U||0),U<1?"":this._output.get_indent_string(U)};var N=function(U){for(var R=null,O=U.next;O.type!==L.EOF&&U.closed!==O;){if(O.type===L.ATTRIBUTE&&O.text==="type"){O.next&&O.next.type===L.EQUALS&&O.next.next&&O.next.next.type===L.VALUE&&(R=O.next.next.text);break}O=O.next}return R},V=function(U,R){var O=null,K=null;return R.closed?(U==="script"?O="text/javascript":U==="style"&&(O="text/css"),O=N(R)||O,O.search("text/css")>-1?K="css":O.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?K="javascript":O.search(/(text|application|dojo)\/(x-)?(html)/)>-1?K="html":O.search(/test\/null/)>-1&&(K="null"),K):null};function q(U,R){return R.indexOf(U)!==-1}function le(U,R,O){this.parent=U||null,this.tag=R?R.tag_name:"",this.indent_level=O||0,this.parser_token=R||null}function ee(U){this._printer=U,this._current_frame=null}ee.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},ee.prototype.record_tag=function(U){var R=new le(this._current_frame,U,this._printer.indent_level);this._current_frame=R},ee.prototype._try_pop_frame=function(U){var R=null;return U&&(R=U.parser_token,this._printer.indent_level=U.indent_level,this._current_frame=U.parent),R},ee.prototype._get_frame=function(U,R){for(var O=this._current_frame;O&&U.indexOf(O.tag)===-1;){if(R&&R.indexOf(O.tag)!==-1){O=null;break}O=O.parent}return O},ee.prototype.try_pop=function(U,R){var O=this._get_frame([U],R);return this._try_pop_frame(O)},ee.prototype.indent_to_tag=function(U){var R=this._get_frame(U);R&&(this._printer.indent_level=R.indent_level)};function X(U,R,O,K){this._source_text=U||"",R=R||{},this._js_beautify=O,this._css_beautify=K,this._tag_stack=null;var j=new m(R,"html");this._options=j,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"}X.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var U=this._source_text,R=this._options.eol;this._options.eol==="auto"&&(R=`
`,U&&F.test(U)&&(R=U.match(F)[0])),U=U.replace(w,`
`);var O=U.match(/^[\t ]*/)[0],K={text:"",type:""},j=new _e(this._options),z=new k(this._options,O),y=new C(U,this._options).tokenize();this._tag_stack=new ee(z);for(var _=null,I=y.next();I.type!==L.EOF;)I.type===L.TAG_OPEN||I.type===L.COMMENT?(_=this._handle_tag_open(z,I,j,K,y),j=_):I.type===L.ATTRIBUTE||I.type===L.EQUALS||I.type===L.VALUE||I.type===L.TEXT&&!j.tag_complete?_=this._handle_inside_tag(z,I,j,K):I.type===L.TAG_CLOSE?_=this._handle_tag_close(z,I,j):I.type===L.TEXT?_=this._handle_text(z,I,j):I.type===L.CONTROL_FLOW_OPEN?_=this._handle_control_flow_open(z,I):I.type===L.CONTROL_FLOW_CLOSE?_=this._handle_control_flow_close(z,I):z.add_raw_token(I),K=_,I=y.next();var Z=z._output.get_code(R);return Z},X.prototype._handle_control_flow_open=function(U,R){var O={text:R.text,type:R.type};return U.set_space_before_token(R.newlines||R.whitespace_before!=="",!0),R.newlines?U.print_preserved_newlines(R):U.set_space_before_token(R.newlines||R.whitespace_before!=="",!0),U.print_token(R),U.indent(),O},X.prototype._handle_control_flow_close=function(U,R){var O={text:R.text,type:R.type};return U.deindent(),R.newlines?U.print_preserved_newlines(R):U.set_space_before_token(R.newlines||R.whitespace_before!=="",!0),U.print_token(R),O},X.prototype._handle_tag_close=function(U,R,O){var K={text:R.text,type:R.type};return U.alignment_size=0,O.tag_complete=!0,U.set_space_before_token(R.newlines||R.whitespace_before!=="",!0),O.is_unformatted?U.add_raw_token(R):(O.tag_start_char==="<"&&(U.set_space_before_token(R.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&O.has_wrapped_attrs&&U.print_newline(!1)),U.print_token(R)),O.indent_content&&!(O.is_unformatted||O.is_content_unformatted)&&(U.indent(),O.indent_content=!1),!O.is_inline_element&&!(O.is_unformatted||O.is_content_unformatted)&&U.set_wrap_point(),K},X.prototype._handle_inside_tag=function(U,R,O,K){var j=O.has_wrapped_attrs,z={text:R.text,type:R.type};return U.set_space_before_token(R.newlines||R.whitespace_before!=="",!0),O.is_unformatted?U.add_raw_token(R):O.tag_start_char==="{"&&R.type===L.TEXT?U.print_preserved_newlines(R)?(R.newlines=0,U.add_raw_token(R)):U.print_token(R):(R.type===L.ATTRIBUTE?U.set_space_before_token(!0):(R.type===L.EQUALS||R.type===L.VALUE&&R.previous.type===L.EQUALS)&&U.set_space_before_token(!1),R.type===L.ATTRIBUTE&&O.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(U.traverse_whitespace(R),j=j||R.newlines!==0),this._is_wrap_attributes_force&&O.attr_count>=this._options.wrap_attributes_min_attrs&&(K.type!==L.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(U.print_newline(!1),j=!0)),U.print_token(R),j=j||U.previous_token_wrapped(),O.has_wrapped_attrs=j),z},X.prototype._handle_text=function(U,R,O){var K={text:R.text,type:"TK_CONTENT"};return O.custom_beautifier_name?this._print_custom_beatifier_text(U,R,O):O.is_unformatted||O.is_content_unformatted?U.add_raw_token(R):(U.traverse_whitespace(R),U.print_token(R)),K},X.prototype._print_custom_beatifier_text=function(U,R,O){var K=this;if(R.text!==""){var j=R.text,z,y=1,_="",I="";O.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?z=this._js_beautify:O.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?z=this._css_beautify:O.custom_beautifier_name==="html"&&(z=function(Ze,et){var $e=new X(Ze,et,K._js_beautify,K._css_beautify);return $e.beautify()}),this._options.indent_scripts==="keep"?y=0:this._options.indent_scripts==="separate"&&(y=-U.indent_level);var Z=U.get_full_indent(y);if(j=j.replace(/\n[ \t]*$/,""),O.custom_beautifier_name!=="html"&&j[0]==="<"&&j.match(/^(<!--|<!\[CDATA\[)/)){var Ee=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(j);if(!Ee){U.add_raw_token(R);return}_=Z+Ee[1]+`
`,j=Ee[4],Ee[5]&&(I=Z+Ee[5]),j=j.replace(/\n[ \t]*$/,""),(Ee[2]||Ee[3].indexOf(`
`)!==-1)&&(Ee=Ee[3].match(/[ \t]+$/),Ee&&(R.whitespace_before=Ee[0]))}if(j)if(z){var Ce=function(){this.eol=`
`};Ce.prototype=this._options.raw_options;var Ue=new Ce;j=z(Z+j,Ue)}else{var Be=R.whitespace_before;Be&&(j=j.replace(new RegExp(`
(`+Be+")?","g"),`
`)),j=Z+j.replace(/\n/g,`
`+Z)}_&&(j?j=_+j+`
`+I:j=_+I),U.print_newline(!1),j&&(R.text=j,R.whitespace_before="",R.newlines=0,U.add_raw_token(R),U.print_newline(!0))}},X.prototype._handle_tag_open=function(U,R,O,K,j){var z=this._get_tag_open_token(R);if((O.is_unformatted||O.is_content_unformatted)&&!O.is_empty_element&&R.type===L.TAG_OPEN&&!z.is_start_tag?(U.add_raw_token(R),z.start_tag_token=this._tag_stack.try_pop(z.tag_name)):(U.traverse_whitespace(R),this._set_tag_position(U,R,z,O,K),z.is_inline_element||U.set_wrap_point(),U.print_token(R)),z.is_start_tag&&this._is_wrap_attributes_force){var y=0,_;do _=j.peek(y),_.type===L.ATTRIBUTE&&(z.attr_count+=1),y+=1;while(_.type!==L.EOF&&_.type!==L.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(z.alignment_size=R.text.length+1),!z.tag_complete&&!z.is_unformatted&&(U.alignment_size=z.alignment_size),z};var _e=function(U,R,O){if(this.parent=R||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="",!O)this.tag_complete=!0;else{var K;this.tag_start_char=O.text[0],this.text=O.text,this.tag_start_char==="<"?(K=O.text.match(/^<([^\s>]*)/),this.tag_check=K?K[1]:""):(K=O.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=K?K[1]:"",(O.text.startsWith("{{#>")||O.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&O.next!==null?this.tag_check=O.next.text.split(" ")[0]:this.tag_check=O.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),O.type===L.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||O.closed&&O.closed.text==="/>";var j=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(j=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!U.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(j)))}};X.prototype._get_tag_open_token=function(U){var R=new _e(this._options,this._tag_stack.get_parser_token(),U);return R.alignment_size=this._options.wrap_attributes_indent_size,R.is_end_tag=R.is_end_tag||q(R.tag_check,this._options.void_elements),R.is_empty_element=R.tag_complete||R.is_start_tag&&R.is_end_tag,R.is_unformatted=!R.tag_complete&&q(R.tag_check,this._options.unformatted),R.is_content_unformatted=!R.is_empty_element&&q(R.tag_check,this._options.content_unformatted),R.is_inline_element=q(R.tag_name,this._options.inline)||this._options.inline_custom_elements&&R.tag_name.includes("-")||R.tag_start_char==="{",R},X.prototype._set_tag_position=function(U,R,O,K,j){if(O.is_empty_element||(O.is_end_tag?O.start_tag_token=this._tag_stack.try_pop(O.tag_name):(this._do_optional_end_element(O)&&(O.is_inline_element||U.print_newline(!1)),this._tag_stack.record_tag(O),(O.tag_name==="script"||O.tag_name==="style")&&!(O.is_unformatted||O.is_content_unformatted)&&(O.custom_beautifier_name=V(O.tag_check,R)))),q(O.tag_check,this._options.extra_liners)&&(U.print_newline(!1),U._output.just_added_blankline()||U.print_newline(!0)),O.is_empty_element){if(O.tag_start_char==="{"&&O.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),O.indent_content=!0;var z=U.current_line_has_match(/{{#if/);z||U.print_newline(!1)}O.tag_name==="!--"&&j.type===L.TAG_CLOSE&&K.is_end_tag&&O.text.indexOf(`
`)===-1||(O.is_inline_element||O.is_unformatted||U.print_newline(!1),this._calcluate_parent_multiline(U,O))}else if(O.is_end_tag){var y=!1;y=O.start_tag_token&&O.start_tag_token.multiline_content,y=y||!O.is_inline_element&&!(K.is_inline_element||K.is_unformatted)&&!(j.type===L.TAG_CLOSE&&O.start_tag_token===K)&&j.type!=="TK_CONTENT",(O.is_content_unformatted||O.is_unformatted)&&(y=!1),y&&U.print_newline(!1)}else O.indent_content=!O.custom_beautifier_name,O.tag_start_char==="<"&&(O.tag_name==="html"?O.indent_content=this._options.indent_inner_html:O.tag_name==="head"?O.indent_content=this._options.indent_head_inner_html:O.tag_name==="body"&&(O.indent_content=this._options.indent_body_inner_html)),!(O.is_inline_element||O.is_unformatted)&&(j.type!=="TK_CONTENT"||O.is_content_unformatted)&&U.print_newline(!1),this._calcluate_parent_multiline(U,O)},X.prototype._calcluate_parent_multiline=function(U,R){R.parent&&U._output.just_added_newline()&&!((R.is_inline_element||R.is_unformatted)&&R.parent.is_inline_element)&&(R.parent.multiline_content=!0)};var ye=["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"],Ge=["a","audio","del","ins","map","noscript","video"];X.prototype._do_optional_end_element=function(U){var R=null;if(!(U.is_empty_element||!U.is_start_tag||!U.parent)){if(U.tag_name==="body")R=R||this._tag_stack.try_pop("head");else if(U.tag_name==="li")R=R||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(U.tag_name==="dd"||U.tag_name==="dt")R=R||this._tag_stack.try_pop("dt",["dl"]),R=R||this._tag_stack.try_pop("dd",["dl"]);else if(U.parent.tag_name==="p"&&ye.indexOf(U.tag_name)!==-1){var O=U.parent.parent;(!O||Ge.indexOf(O.tag_name)===-1)&&(R=R||this._tag_stack.try_pop("p"))}else U.tag_name==="rp"||U.tag_name==="rt"?(R=R||this._tag_stack.try_pop("rt",["ruby","rtc"]),R=R||this._tag_stack.try_pop("rp",["ruby","rtc"])):U.tag_name==="optgroup"?R=R||this._tag_stack.try_pop("optgroup",["select"]):U.tag_name==="option"?R=R||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):U.tag_name==="colgroup"?R=R||this._tag_stack.try_pop("caption",["table"]):U.tag_name==="thead"?(R=R||this._tag_stack.try_pop("caption",["table"]),R=R||this._tag_stack.try_pop("colgroup",["table"])):U.tag_name==="tbody"||U.tag_name==="tfoot"?(R=R||this._tag_stack.try_pop("caption",["table"]),R=R||this._tag_stack.try_pop("colgroup",["table"]),R=R||this._tag_stack.try_pop("thead",["table"]),R=R||this._tag_stack.try_pop("tbody",["table"])):U.tag_name==="tr"?(R=R||this._tag_stack.try_pop("caption",["table"]),R=R||this._tag_stack.try_pop("colgroup",["table"]),R=R||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(U.tag_name==="th"||U.tag_name==="td")&&(R=R||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),R=R||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return U.parent=this._tag_stack.get_parser_token(),R}},A.exports.Beautifier=X},function(A,g,b){var m=b(6).Options;function x(C){m.call(this,C,"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"])}x.prototype=new m,A.exports.Options=x},function(A,g,b){var m=b(9).Tokenizer,x=b(9).TOKEN,C=b(13).Directives,L=b(14).TemplatablePattern,F=b(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:x.START,RAW:x.RAW,EOF:x.EOF},k=new C(/<\!--/,/-->/),N=function(V,q){m.call(this,V,q),this._current_tag_name="";var le=new L(this._input).read_options(this._options),ee=new F(this._input);if(this.__patterns={word:le.until(/[\n\r\t <]/),word_control_flow_close_excluded:le.until(/[\n\r\t <}]/),single_quote:le.until_after(/'/),double_quote:le.until_after(/"/),attribute:le.until(/[\n\r\t =>]|\/>/),element_name:le.until(/[\n\r\t >\/]/),angular_control_flow_start:ee.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:ee.starting_with(/{{!--/).until_after(/--}}/),handlebars:ee.starting_with(/{{/).until_after(/}}/),handlebars_open:ee.until(/[\n\r\t }]/),handlebars_raw_close:ee.until(/}}/),comment:ee.starting_with(/<!--/).until_after(/-->/),cdata:ee.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:ee.starting_with(/<!\[/).until_after(/]>/),processing:ee.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 X=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=ee.matching(X).until_after(X)}};N.prototype=new m,N.prototype._is_comment=function(V){return!1},N.prototype._is_opening=function(V){return V.type===w.TAG_OPEN||V.type===w.CONTROL_FLOW_OPEN},N.prototype._is_closing=function(V,q){return V.type===w.TAG_CLOSE&&q&&((V.text===">"||V.text==="/>")&&q.text[0]==="<"||V.text==="}}"&&q.text[0]==="{"&&q.text[1]==="{")||V.type===w.CONTROL_FLOW_CLOSE&&V.text==="}"&&q.text.endsWith("{")},N.prototype._reset=function(){this._current_tag_name=""},N.prototype._get_next_token=function(V,q){var le=null;this._readWhitespace();var ee=this._input.peek();return ee===null?this._create_token(w.EOF,""):(le=le||this._read_open_handlebars(ee,q),le=le||this._read_attribute(ee,V,q),le=le||this._read_close(ee,q),le=le||this._read_script_and_style(ee,V),le=le||this._read_control_flows(ee,q),le=le||this._read_raw_content(ee,V,q),le=le||this._read_content_word(ee,q),le=le||this._read_comment_or_cdata(ee),le=le||this._read_processing(ee),le=le||this._read_open(ee,q),le=le||this._create_token(w.UNKNOWN,this._input.next()),le)},N.prototype._read_comment_or_cdata=function(V){var q=null,le=null,ee=null;if(V==="<"){var X=this._input.peek(1);X==="!"&&(le=this.__patterns.comment.read(),le?(ee=k.get_directives(le),ee&&ee.ignore==="start"&&(le+=k.readIgnored(this._input))):le=this.__patterns.cdata.read()),le&&(q=this._create_token(w.COMMENT,le),q.directives=ee)}return q},N.prototype._read_processing=function(V){var q=null,le=null,ee=null;if(V==="<"){var X=this._input.peek(1);(X==="!"||X==="?")&&(le=this.__patterns.conditional_comment.read(),le=le||this.__patterns.processing.read()),le&&(q=this._create_token(w.COMMENT,le),q.directives=ee)}return q},N.prototype._read_open=function(V,q){var le=null,ee=null;return(!q||q.type===w.CONTROL_FLOW_OPEN)&&V==="<"&&(le=this._input.next(),this._input.peek()==="/"&&(le+=this._input.next()),le+=this.__patterns.element_name.read(),ee=this._create_token(w.TAG_OPEN,le)),ee},N.prototype._read_open_handlebars=function(V,q){var le=null,ee=null;return(!q||q.type===w.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&V==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(le=this.__patterns.handlebars_comment.read(),le=le||this.__patterns.handlebars.read(),ee=this._create_token(w.COMMENT,le)):(le=this.__patterns.handlebars_open.read(),ee=this._create_token(w.TAG_OPEN,le))),ee},N.prototype._read_control_flows=function(V,q){var le="",ee=null;if(!this._options.templating.includes("angular"))return ee;if(V==="@"){if(le=this.__patterns.angular_control_flow_start.read(),le==="")return ee;for(var X=le.endsWith("(")?1:0,_e=0;!(le.endsWith("{")&&X===_e);){var ye=this._input.next();if(ye===null)break;ye==="("?X++:ye===")"&&_e++,le+=ye}ee=this._create_token(w.CONTROL_FLOW_OPEN,le)}else V==="}"&&q&&q.type===w.CONTROL_FLOW_OPEN&&(le=this._input.next(),ee=this._create_token(w.CONTROL_FLOW_CLOSE,le));return ee},N.prototype._read_close=function(V,q){var le=null,ee=null;return q&&q.type===w.TAG_OPEN&&(q.text[0]==="<"&&(V===">"||V==="/"&&this._input.peek(1)===">")?(le=this._input.next(),V==="/"&&(le+=this._input.next()),ee=this._create_token(w.TAG_CLOSE,le)):q.text[0]==="{"&&V==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),ee=this._create_token(w.TAG_CLOSE,"}}"))),ee},N.prototype._read_attribute=function(V,q,le){var ee=null,X="";if(le&&le.text[0]==="<")if(V==="=")ee=this._create_token(w.EQUALS,this._input.next());else if(V==='"'||V==="'"){var _e=this._input.next();V==='"'?_e+=this.__patterns.double_quote.read():_e+=this.__patterns.single_quote.read(),ee=this._create_token(w.VALUE,_e)}else X=this.__patterns.attribute.read(),X&&(q.type===w.EQUALS?ee=this._create_token(w.VALUE,X):ee=this._create_token(w.ATTRIBUTE,X));return ee},N.prototype._is_content_unformatted=function(V){return this._options.void_elements.indexOf(V)===-1&&(this._options.content_unformatted.indexOf(V)!==-1||this._options.unformatted.indexOf(V)!==-1)},N.prototype._read_raw_content=function(V,q,le){var ee="";if(le&&le.text[0]==="{")ee=this.__patterns.handlebars_raw_close.read();else if(q.type===w.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var X=q.opened.text.substr(1).toLowerCase();this._is_content_unformatted(X)&&(ee=this._input.readUntil(new RegExp("</"+X+"[\\n\\r\\t ]*?>","ig")))}return ee?this._create_token(w.TEXT,ee):null},N.prototype._read_script_and_style=function(V,q){if(q.type===w.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var le=q.opened.text.substr(1).toLowerCase();if(le==="script"||le==="style"){var ee=this._read_comment_or_cdata(V);if(ee)return ee.type=w.TEXT,ee;var X=this._input.readUntil(new RegExp("</"+le+"[\\n\\r\\t ]*?>","ig"));if(X)return this._create_token(w.TEXT,X)}}return null},N.prototype._read_content_word=function(V,q){var le="";return this._options.unformatted_content_delimiter&&V===this._options.unformatted_content_delimiter[0]&&(le=this.__patterns.unformatted_content_delimiter.read()),le||(le=q&&q.type===w.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),le?this._create_token(w.TEXT,le):null},A.exports.Tokenizer=N,A.exports.TOKEN=w}],te={};function l(A){var g=te[A];if(g!==void 0)return g.exports;var b=te[A]={exports:{}};return ae[A](b,b.exports,l),b.exports}var M=l(18);ke=M})();var oe=ke;if(1)T=[W,W(58553),W(87804)],fe=function(ae){var te=W(58553),l=W(87804);return{html_beautify:function(M,A){return oe(M,A,te.js_beautify,l.css_beautify)}}}.apply(nt,T),fe!==void 0&&(Rt.exports=fe);else var H,p})()},58553:function(Rt,nt){var W,T;(function(){var fe;(function(){"use strict";var oe=[function(te,l,M){var A=M(1).Beautifier,g=M(5).Options;function b(m,x){var C=new A(m,x);return C.beautify()}te.exports=b,te.exports.defaultOptions=function(){return new g}},function(te,l,M){var A=M(2).Output,g=M(3).Token,b=M(4),m=M(5).Options,x=M(7).Tokenizer,C=M(7).line_starters,L=M(7).positionable_operators,F=M(7).TOKEN;function w(_,I){return I.indexOf(_)!==-1}function k(_){return _.replace(/^\s+/g,"")}function N(_){for(var I={},Z=0;Z<_.length;Z++)I[_[Z].replace(/-/g,"_")]=_[Z];return I}function V(_,I){return _&&_.type===F.RESERVED&&_.text===I}function q(_,I){return _&&_.type===F.RESERVED&&w(_.text,I)}var le=["case","return","do","if","throw","else","await","break","continue","async"],ee=["before-newline","after-newline","preserve-newline"],X=N(ee),_e=[X.before_newline,X.preserve_newline],ye={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Ge(_,I){I.multiline_frame||I.mode===ye.ForInitializer||I.mode===ye.Conditional||_.remove_indent(I.start_line_index)}function U(_){_=_.replace(b.allLineBreaks,`
`);for(var I=[],Z=_.indexOf(`
`);Z!==-1;)I.push(_.substring(0,Z)),_=_.substring(Z+1),Z=_.indexOf(`
`);return _.length&&I.push(_),I}function R(_){return _===ye.ArrayLiteral}function O(_){return w(_,[ye.Expression,ye.ForInitializer,ye.Conditional])}function K(_,I){for(var Z=0;Z<_.length;Z++){var Ee=_[Z].trim();if(Ee.charAt(0)!==I)return!1}return!0}function j(_,I){for(var Z=0,Ee=_.length,Ce;Z<Ee;Z++)if(Ce=_[Z],Ce&&Ce.indexOf(I)!==0)return!1;return!0}function z(_,I){I=I||{},this._source_text=_||"",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 m(I)}z.prototype.create_flags=function(_,I){var Z=0;_&&(Z=_.indentation_level,!this._output.just_added_newline()&&_.line_indent_level>Z&&(Z=_.line_indent_level));var Ee={mode:I,parent:_,last_token:_?_.last_token:new g(F.START_BLOCK,""),last_word:_?_.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:Z,alignment:0,line_indent_level:_?_.line_indent_level:Z,start_line_index:this._output.get_line_number(),ternary_depth:0};return Ee},z.prototype._reset=function(_){var I=_.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new A(this._options,I),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(ye.BlockStatement);var Z=new x(_,this._options);return this._tokens=Z.tokenize(),_},z.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var _,I=this._reset(this._source_text),Z=this._options.eol;this._options.eol==="auto"&&(Z=`
`,I&&b.lineBreak.test(I||"")&&(Z=I.match(b.lineBreak)[0]));for(var Ee=this._tokens.next();Ee;)this.handle_token(Ee),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Ee,Ee=this._tokens.next();return _=this._output.get_code(Z),_},z.prototype.handle_token=function(_,I){_.type===F.START_EXPR?this.handle_start_expr(_):_.type===F.END_EXPR?this.handle_end_expr(_):_.type===F.START_BLOCK?this.handle_start_block(_):_.type===F.END_BLOCK?this.handle_end_block(_):_.type===F.WORD?this.handle_word(_):_.type===F.RESERVED?this.handle_word(_):_.type===F.SEMICOLON?this.handle_semicolon(_):_.type===F.STRING?this.handle_string(_):_.type===F.EQUALS?this.handle_equals(_):_.type===F.OPERATOR?this.handle_operator(_):_.type===F.COMMA?this.handle_comma(_):_.type===F.BLOCK_COMMENT?this.handle_block_comment(_,I):_.type===F.COMMENT?this.handle_comment(_,I):_.type===F.DOT?this.handle_dot(_):_.type===F.EOF?this.handle_eof(_):_.type===F.UNKNOWN?this.handle_unknown(_,I):this.handle_unknown(_,I)},z.prototype.handle_whitespace_and_comments=function(_,I){var Z=_.newlines,Ee=this._options.keep_array_indentation&&R(this._flags.mode);if(_.comments_before)for(var Ce=_.comments_before.next();Ce;)this.handle_whitespace_and_comments(Ce,I),this.handle_token(Ce,I),Ce=_.comments_before.next();if(Ee)for(var Ue=0;Ue<Z;Ue+=1)this.print_newline(Ue>0,I);else if(this._options.max_preserve_newlines&&Z>this._options.max_preserve_newlines&&(Z=this._options.max_preserve_newlines),this._options.preserve_newlines&&Z>1){this.print_newline(!1,I);for(var Be=1;Be<Z;Be+=1)this.print_newline(!0,I)}};var y=["async","break","continue","return","throw","yield"];z.prototype.allow_wrap_or_preserved_newline=function(_,I){if(I=I===void 0?!1:I,!this._output.just_added_newline()){var Z=this._options.preserve_newlines&&_.newlines||I,Ee=w(this._flags.last_token.text,L)||w(_.text,L);if(Ee){var Ce=w(this._flags.last_token.text,L)&&w(this._options.operator_position,_e)||w(_.text,L);Z=Z&&Ce}if(Z)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(q(this._flags.last_token,y))return;this._output.set_wrap_point()}}},z.prototype.print_newline=function(_,I){if(!I&&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 Z=this._tokens.peek();this._flags.mode===ye.Statement&&!(this._flags.if_block&&V(Z,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(_)&&(this._flags.multiline_frame=!0)},z.prototype.print_token_line_indentation=function(_){this._output.just_added_newline()&&(this._options.keep_array_indentation&&_.newlines&&(_.text==="["||R(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(_.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))},z.prototype.print_token=function(_){if(this._output.raw){this._output.add_raw_token(_);return}if(this._options.comma_first&&_.previous&&_.previous.type===F.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var I=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(I),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(_),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(_),this._output.non_breaking_space=!0,this._output.add_token(_.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},z.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},z.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))},z.prototype.set_mode=function(_){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,_),this._flags=this.create_flags(this._previous_flags,_),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},z.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===ye.Statement&&Ge(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},z.prototype.start_of_object_property=function(){return this._flags.parent.mode===ye.ObjectLiteral&&this._flags.mode===ye.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"]))},z.prototype.start_of_statement=function(_){var I=!1;return I=I||q(this._flags.last_token,["var","let","const"])&&_.type===F.WORD,I=I||V(this._flags.last_token,"do"),I=I||!(this._flags.parent.mode===ye.ObjectLiteral&&this._flags.mode===ye.Statement)&&q(this._flags.last_token,y)&&!_.newlines,I=I||V(this._flags.last_token,"else")&&!(V(_,"if")&&!_.comments_before),I=I||this._flags.last_token.type===F.END_EXPR&&(this._previous_flags.mode===ye.ForInitializer||this._previous_flags.mode===ye.Conditional),I=I||this._flags.last_token.type===F.WORD&&this._flags.mode===ye.BlockStatement&&!this._flags.in_case&&!(_.text==="--"||_.text==="++")&&this._last_last_text!=="function"&&_.type!==F.WORD&&_.type!==F.RESERVED,I=I||this._flags.mode===ye.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"])),I?(this.set_mode(ye.Statement),this.indent(),this.handle_whitespace_and_comments(_,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(_,q(_,["do","for","if","while"])),!0):!1},z.prototype.handle_start_expr=function(_){this.start_of_statement(_)||this.handle_whitespace_and_comments(_);var I=ye.Expression;if(_.text==="["){if(this._flags.last_token.type===F.WORD||this._flags.last_token.text===")"){q(this._flags.last_token,C)&&(this._output.space_before_token=!0),this.print_token(_),this.set_mode(I),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}I=ye.ArrayLiteral,R(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,I=ye.ForInitializer):w(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,I=ye.Conditional):w(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&_.whitespace_before===""?this._output.space_before_token=!1:(w(this._flags.last_token.text,C)||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(_);else if(this._flags.last_token.type===F.WORD){this._output.space_before_token=!1;var Z=this._tokens.peek(-3);if(this._options.space_after_named_function&&Z){var Ee=this._tokens.peek(-4);q(Z,["async","function"])||Z.text==="*"&&q(Ee,["async","function"])?this._output.space_before_token=!0:this._flags.mode===ye.ObjectLiteral?(Z.text==="{"||Z.text===","||Z.text==="*"&&(Ee.text==="{"||Ee.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(_);(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===ye.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(_,_.newlines),this.print_token(_),this.set_mode(I),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},z.prototype.handle_end_expr=function(_){for(;this._flags.mode===ye.Statement;)this.restore_mode();this.handle_whitespace_and_comments(_),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(_,_.text==="]"&&R(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(_),this.restore_mode(),Ge(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===ye.Conditional&&(this._previous_flags.mode=ye.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},z.prototype.handle_start_block=function(_){this.handle_whitespace_and_comments(_);var I=this._tokens.peek(),Z=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===F.END_EXPR?(this.set_mode(ye.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(ye.BlockStatement):Z&&(w(Z.text,[":",","])&&w(I.type,[F.STRING,F.WORD,F.RESERVED])||w(I.text,["get","set","..."])&&w(Z.type,[F.WORD,F.RESERVED]))?w(this._last_last_text,["class","interface"])&&!w(Z.text,[":",","])?this.set_mode(ye.BlockStatement):this.set_mode(ye.ObjectLiteral):this._flags.last_token.type===F.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(ye.BlockStatement):w(this._flags.last_token.type,[F.EQUALS,F.START_EXPR,F.COMMA,F.OPERATOR])||q(this._flags.last_token,["return","throw","import","default"])?this.set_mode(ye.ObjectLiteral):this.set_mode(ye.BlockStatement),this._flags.last_token&&q(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Ee=!I.comments_before&&I.text==="}",Ce=Ee&&this._flags.last_word==="function"&&this._flags.last_token.type===F.END_EXPR;if(this._options.brace_preserve_inline){var Ue=0,Be=null;this._flags.inline_frame=!0;do if(Ue+=1,Be=this._tokens.peek(Ue-1),Be.newlines){this._flags.inline_frame=!1;break}while(Be.type!==F.EOF&&!(Be.type===F.END_BLOCK&&Be.opened===_))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&_.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==F.OPERATOR&&(Ce||this._flags.last_token.type===F.EQUALS||q(this._flags.last_token,le)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(R(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(_),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(_),this.indent(),!Ee&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},z.prototype.handle_end_block=function(_){for(this.handle_whitespace_and_comments(_);this._flags.mode===ye.Statement;)this.restore_mode();var I=this._flags.last_token.type===F.START_BLOCK;this._flags.inline_frame&&!I?this._output.space_before_token=!0:this._options.brace_style==="expand"?I||this.print_newline():I||(R(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(_)},z.prototype.handle_word=function(_){if(_.type===F.RESERVED){if(w(_.text,["set","get"])&&this._flags.mode!==ye.ObjectLiteral)_.type=F.WORD;else if(_.text==="import"&&w(this._tokens.peek().text,["(","."]))_.type=F.WORD;else if(w(_.text,["as","from"])&&!this._flags.import_block)_.type=F.WORD;else if(this._flags.mode===ye.ObjectLiteral){var I=this._tokens.peek();I.text===":"&&(_.type=F.WORD)}}if(this.start_of_statement(_)?q(this._flags.last_token,["var","let","const"])&&_.type===F.WORD&&(this._flags.declaration_statement=!0):_.newlines&&!O(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||!q(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(_),this.print_newline()):this.handle_whitespace_and_comments(_),this._flags.do_block&&!this._flags.do_while)if(V(_,"while")){this._output.space_before_token=!0,this.print_token(_),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&&V(_,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===ye.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&q(_,["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(_),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===ye.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(_),V(_,"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()&&!_.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===F.RESERVED||this._flags.last_token.type===F.WORD?q(this._flags.last_token,["get","set","new","export"])||q(this._flags.last_token,y)?this._output.space_before_token=!0:V(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&&(O(this._flags.mode)||R(this._flags.mode))||this.print_newline(),this.print_token(_),this._flags.last_word=_.text;return}var Z="NONE";if(this._flags.last_token.type===F.END_BLOCK?this._previous_flags.inline_frame?Z="SPACE":q(_,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&_.newlines?Z="NEWLINE":(Z="SPACE",this._output.space_before_token=!0):Z="NEWLINE":this._flags.last_token.type===F.SEMICOLON&&this._flags.mode===ye.BlockStatement?Z="NEWLINE":this._flags.last_token.type===F.SEMICOLON&&O(this._flags.mode)?Z="SPACE":this._flags.last_token.type===F.STRING?Z="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===ye.ObjectLiteral&&w(this._last_last_text,["{",","]))?Z="SPACE":this._flags.last_token.type===F.START_BLOCK?this._flags.inline_frame?Z="SPACE":Z="NEWLINE":this._flags.last_token.type===F.END_EXPR&&(this._output.space_before_token=!0,Z="NEWLINE"),q(_,C)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Z="SPACE":Z="NEWLINE"),q(_,["else","catch","finally"]))if((!(this._flags.last_token.type===F.END_BLOCK&&this._previous_flags.mode===ye.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&_.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var Ee=this._output.current_line;Ee.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Z==="NEWLINE"?q(this._flags.last_token,le)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&q(_,["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||!q(_,["var","let","const"]))&&this._flags.last_token.text!==":"&&(V(_,"if")&&V(_.previous,"else")?this._output.space_before_token=!0:this.print_newline()):q(_,C)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&R(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Z==="SPACE"&&(this._output.space_before_token=!0);_.previous&&(_.previous.type===F.WORD||_.previous.type===F.RESERVED)&&(this._output.space_before_token=!0),this.print_token(_),this._flags.last_word=_.text,_.type===F.RESERVED&&(_.text==="do"?this._flags.do_block=!0:_.text==="if"?this._flags.if_block=!0:_.text==="import"?this._flags.import_block=!0:this._flags.import_block&&V(_,"from")&&(this._flags.import_block=!1))},z.prototype.handle_semicolon=function(_){this.start_of_statement(_)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(_);for(var I=this._tokens.peek();this._flags.mode===ye.Statement&&!(this._flags.if_block&&V(I,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(_)},z.prototype.handle_string=function(_){_.text.startsWith("`")&&_.newlines===0&&_.whitespace_before===""&&(_.previous.text===")"||this._flags.last_token.type===F.WORD)||(this.start_of_statement(_)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(_),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(_):_.text.startsWith("`")&&this._flags.last_token.type===F.END_EXPR&&(_.previous.text==="]"||_.previous.text===")")&&_.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(_)},z.prototype.handle_equals=function(_){this.start_of_statement(_)||this.handle_whitespace_and_comments(_),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(_),this._output.space_before_token=!0},z.prototype.handle_comma=function(_){this.handle_whitespace_and_comments(_,!0),this.print_token(_),this._output.space_before_token=!0,this._flags.declaration_statement?(O(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(_)):this._flags.mode===ye.ObjectLiteral||this._flags.mode===ye.Statement&&this._flags.parent.mode===ye.ObjectLiteral?(this._flags.mode===ye.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(_)},z.prototype.handle_operator=function(_){var I=_.text==="*"&&(q(this._flags.last_token,["function","yield"])||w(this._flags.last_token.type,[F.START_BLOCK,F.COMMA,F.END_BLOCK,F.SEMICOLON])),Z=w(_.text,["-","+"])&&(w(this._flags.last_token.type,[F.START_BLOCK,F.START_EXPR,F.EQUALS,F.OPERATOR])||w(this._flags.last_token.text,C)||this._flags.last_token.text===",");if(!this.start_of_statement(_)){var Ee=!I;this.handle_whitespace_and_comments(_,Ee)}if(_.text==="*"&&this._flags.last_token.type===F.DOT){this.print_token(_);return}if(_.text==="::"){this.print_token(_);return}if(w(_.text,["-","+"])&&this.start_of_object_property()){this.print_token(_);return}if(this._flags.last_token.type===F.OPERATOR&&w(this._options.operator_position,_e)&&this.allow_wrap_or_preserved_newline(_),_.text===":"&&this._flags.in_case){this.print_token(_),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 Ce=!0,Ue=!0,Be=!1;if(_.text===":"?this._flags.ternary_depth===0?Ce=!1:(this._flags.ternary_depth-=1,Be=!0):_.text==="?"&&(this._flags.ternary_depth+=1),!Z&&!I&&this._options.preserve_newlines&&w(_.text,L)){var Ze=_.text===":",et=Ze&&Be,$e=Ze&&!Be;switch(this._options.operator_position){case X.before_newline:this._output.space_before_token=!$e,this.print_token(_),(!Ze||et)&&this.allow_wrap_or_preserved_newline(_),this._output.space_before_token=!0;return;case X.after_newline:this._output.space_before_token=!0,!Ze||et?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(_):this._output.space_before_token=!1,this.print_token(_),this._output.space_before_token=!0;return;case X.preserve_newline:$e||this.allow_wrap_or_preserved_newline(_),Ce=!(this._output.just_added_newline()||$e),this._output.space_before_token=Ce,this.print_token(_),this._output.space_before_token=!0;return}}if(I){this.allow_wrap_or_preserved_newline(_),Ce=!1;var be=this._tokens.peek();Ue=be&&w(be.type,[F.WORD,F.RESERVED])}else if(_.text==="...")this.allow_wrap_or_preserved_newline(_),Ce=this._flags.last_token.type===F.START_BLOCK,Ue=!1;else if(w(_.text,["--","++","!","~"])||Z){if((this._flags.last_token.type===F.COMMA||this._flags.last_token.type===F.START_EXPR)&&this.allow_wrap_or_preserved_newline(_),Ce=!1,Ue=!1,_.newlines&&(_.text==="--"||_.text==="++"||_.text==="~")){var he=q(this._flags.last_token,le)&&_.newlines;he&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(he,!0)}this._flags.last_token.text===";"&&O(this._flags.mode)&&(Ce=!0),this._flags.last_token.type===F.RESERVED?Ce=!0:this._flags.last_token.type===F.END_EXPR?Ce=!(this._flags.last_token.text==="]"&&(_.text==="--"||_.text==="++")):this._flags.last_token.type===F.OPERATOR&&(Ce=w(_.text,["--","-","++","+"])&&w(this._flags.last_token.text,["--","-","++","+"]),w(_.text,["+","-"])&&w(this._flags.last_token.text,["--","++"])&&(Ue=!0)),(this._flags.mode===ye.BlockStatement&&!this._flags.inline_frame||this._flags.mode===ye.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Ce,this.print_token(_),this._output.space_before_token=Ue},z.prototype.handle_block_comment=function(_,I){if(this._output.raw){this._output.add_raw_token(_),_.directives&&_.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(_.directives){this.print_newline(!1,I),this.print_token(_),_.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!b.newline.test(_.text)&&!_.newlines){this._output.space_before_token=!0,this.print_token(_),this._output.space_before_token=!0;return}else this.print_block_commment(_,I)},z.prototype.print_block_commment=function(_,I){var Z=U(_.text),Ee,Ce=!1,Ue=!1,Be=_.whitespace_before,Ze=Be.length;if(this.print_newline(!1,I),this.print_token_line_indentation(_),this._output.add_token(Z[0]),this.print_newline(!1,I),Z.length>1){for(Z=Z.slice(1),Ce=K(Z,"*"),Ue=j(Z,Be),Ce&&(this._flags.alignment=1),Ee=0;Ee<Z.length;Ee++)Ce?(this.print_token_line_indentation(_),this._output.add_token(k(Z[Ee]))):Ue&&Z[Ee]?(this.print_token_line_indentation(_),this._output.add_token(Z[Ee].substring(Ze))):(this._output.current_line.set_indent(-1),this._output.add_token(Z[Ee])),this.print_newline(!1,I);this._flags.alignment=0}},z.prototype.handle_comment=function(_,I){_.newlines?this.print_newline(!1,I):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(_),this.print_newline(!1,I)},z.prototype.handle_dot=function(_){this.start_of_statement(_)||this.handle_whitespace_and_comments(_,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),q(this._flags.last_token,le)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(_,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(_)},z.prototype.handle_unknown=function(_,I){this.print_token(_),_.text[_.text.length-1]===`
`&&this.print_newline(!1,I)},z.prototype.handle_eof=function(_){for(;this._flags.mode===ye.Statement;)this.restore_mode();this.handle_whitespace_and_comments(_)},te.exports.Beautifier=z},function(te){function l(g){this.__parent=g,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 g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var b=this.__items.length-1;b>=0;b--)if(this.__items[b].match(g))return!0;return!1},l.prototype.set_indent=function(g,b){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=b||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 g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__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(g){this.__items.push(g);var b=g.lastIndexOf(`
`);b!==-1?this.__character_count=g.length-b:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},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 g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function M(g,b){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),b=b||"",g.indent_level>0&&(b=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=b,this.__base_string_length=b.length}M.prototype.get_indent_size=function(g,b){var m=this.__base_string_length;return b=b||0,g<0&&(m=0),m+=g*this.__indent_size,m+=b,m},M.prototype.get_indent_string=function(g,b){var m=this.__base_string;return b=b||0,g<0&&(g=0,m=""),b+=g*this.__indent_size,this.__ensure_cache(b),m+=this.__cache[b],m},M.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},M.prototype.__add_column=function(){var g=this.__cache.length,b=0,m="";this.__indent_size&&g>=this.__indent_size&&(b=Math.floor(g/this.__indent_size),g-=b*this.__indent_size,m=new Array(b+1).join(this.__indent_string)),g&&(m+=new Array(g+1).join(" ")),this.__cache.push(m)};function A(g,b){this.__indent_cache=new M(g,b),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.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()}A.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},A.prototype.get_line_number=function(){return this.__lines.length},A.prototype.get_indent_string=function(g,b){return this.__indent_cache.get_indent_string(g,b)},A.prototype.get_indent_size=function(g,b){return this.__indent_cache.get_indent_size(g,b)},A.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},A.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},A.prototype.get_code=function(g){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 m=this.__lines.join(`
`);return g!==`
`&&(m=m.replace(/[\n]/g,g)),m},A.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},A.prototype.set_indent=function(g,b){return g=g||0,b=b||0,this.next_line.set_indent(g,b),this.__lines.length>1?(this.current_line.set_indent(g,b),!0):(this.current_line.set_indent(),!1)},A.prototype.add_raw_token=function(g){for(var b=0;b<g.newlines;b++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},A.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},A.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(" "))},A.prototype.remove_indent=function(g){for(var b=this.__lines.length;g<b;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},A.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&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},A.prototype.just_added_newline=function(){return this.current_line.is_empty()},A.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},A.prototype.ensure_empty_line_above=function(g,b){for(var m=this.__lines.length-2;m>=0;){var x=this.__lines[m];if(x.is_empty())break;if(x.item(0).indexOf(g)!==0&&x.item(-1)!==b){this.__lines.splice(m+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}m--}},te.exports.Output=A},function(te){function l(M,A,g,b){this.type=M,this.text=A,this.comments_before=null,this.newlines=g||0,this.whitespace_before=b||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}te.exports.Token=l},function(te,l){var M="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",A="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",g="\\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",b="\\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",m="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",x="(?:"+m+"|["+M+g+"])",C="(?:"+m+"|["+A+g+b+"])*";l.identifier=new RegExp(x+C,"g"),l.identifierStart=new RegExp(x),l.identifierMatch=new RegExp("(?:"+m+"|["+A+g+b+"])+");var L=/[\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(te,l,M){var A=M(6).Options,g=["before-newline","after-newline","preserve-newline"];function b(m){A.call(this,m,"js");var x=this.raw_options.brace_style||null;x==="expand-strict"?this.raw_options.brace_style="expand":x==="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 C=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var L=0;L<C.length;L++)C[L]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=C[L];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",g),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}b.prototype=new A,te.exports.Options=b},function(te){function l(g,b){this.raw_options=M(g,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"])}l.prototype._get_array=function(g,b){var m=this.raw_options[g],x=b||[];return typeof m=="object"?m!==null&&typeof m.concat=="function"&&(x=m.concat()):typeof m=="string"&&(x=m.split(/[^a-zA-Z0-9_\/\-]+/)),x},l.prototype._get_boolean=function(g,b){var m=this.raw_options[g],x=m===void 0?!!b:!!m;return x},l.prototype._get_characters=function(g,b){var m=this.raw_options[g],x=b||"";return typeof m=="string"&&(x=m.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),x},l.prototype._get_number=function(g,b){var m=this.raw_options[g];b=parseInt(b,10),isNaN(b)&&(b=0);var x=parseInt(m,10);return isNaN(x)&&(x=b),x},l.prototype._get_selection=function(g,b,m){var x=this._get_selection_list(g,b,m);if(x.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+b+`
You passed in: '`+this.raw_options[g]+"'");return x[0]},l.prototype._get_selection_list=function(g,b,m){if(!b||b.length===0)throw new Error("Selection list cannot be empty.");if(m=m||[b[0]],!this._is_valid_selection(m,b))throw new Error("Invalid Default Value!");var x=this._get_array(g,m);if(!this._is_valid_selection(x,b))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+b+`
You passed in: '`+this.raw_options[g]+"'");return x},l.prototype._is_valid_selection=function(g,b){return g.length&&b.length&&!g.some(function(m){return b.indexOf(m)===-1})};function M(g,b){var m={};g=A(g);var x;for(x in g)x!==b&&(m[x]=g[x]);if(b&&g[b])for(x in g[b])m[x]=g[b][x];return m}function A(g){var b={},m;for(m in g){var x=m.replace(/-/g,"_");b[x]=g[m]}return b}te.exports.Options=l,te.exports.normalizeOpts=A,te.exports.mergeOpts=M},function(te,l,M){var A=M(8).InputScanner,g=M(9).Tokenizer,b=M(9).TOKEN,m=M(13).Directives,x=M(4),C=M(12).Pattern,L=M(14).TemplatablePattern;function F(K,j){return j.indexOf(K)!==-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:b.START,RAW:b.RAW,EOF:b.EOF},k=new m(/\/\*/,/\*\//),N=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,V=/[0-9]/,q=/[^\d\.]/,le=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),ee=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";ee=ee.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),ee="\\?\\.(?!\\d) "+ee,ee=ee.replace(/ /g,"|");var X=new RegExp(ee),_e="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),ye=_e.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Ge=new RegExp("^(?:"+ye.join("|")+")$"),U,R=function(K,j){g.call(this,K,j),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var z=new C(this._input),y=new L(this._input).read_options(this._options);this.__patterns={template:y,identifier:y.starting_with(x.identifier).matching(x.identifierMatch),number:z.matching(N),punct:z.matching(X),comment:z.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:z.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:z.matching(/<!--/),html_comment_end:z.matching(/-->/),include:z.starting_with(/#include/).until_after(x.lineBreak),shebang:z.starting_with(/#!/).until_after(x.lineBreak),xml:z.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:y.until(/['\\\n\r\u2028\u2029]/),double_quote:y.until(/["\\\n\r\u2028\u2029]/),template_text:y.until(/[`\\$]/),template_expression:y.until(/[`}\\]/)}};R.prototype=new g,R.prototype._is_comment=function(K){return K.type===w.COMMENT||K.type===w.BLOCK_COMMENT||K.type===w.UNKNOWN},R.prototype._is_opening=function(K){return K.type===w.START_BLOCK||K.type===w.START_EXPR},R.prototype._is_closing=function(K,j){return(K.type===w.END_BLOCK||K.type===w.END_EXPR)&&j&&(K.text==="]"&&j.text==="["||K.text===")"&&j.text==="("||K.text==="}"&&j.text==="{")},R.prototype._reset=function(){U=!1},R.prototype._get_next_token=function(K,j){var z=null;this._readWhitespace();var y=this._input.peek();return y===null?this._create_token(w.EOF,""):(z=z||this._read_non_javascript(y),z=z||this._read_string(y),z=z||this._read_pair(y,this._input.peek(1)),z=z||this._read_word(K),z=z||this._read_singles(y),z=z||this._read_comment(y),z=z||this._read_regexp(y,K),z=z||this._read_xml(y,K),z=z||this._read_punctuation(),z=z||this._create_token(w.UNKNOWN,this._input.next()),z)},R.prototype._read_word=function(K){var j;if(j=this.__patterns.identifier.read(),j!=="")return j=j.replace(x.allLineBreaks,`
`),!(K.type===w.DOT||K.type===w.RESERVED&&(K.text==="set"||K.text==="get"))&&Ge.test(j)?(j==="in"||j==="of")&&(K.type===w.WORD||K.type===w.STRING)?this._create_token(w.OPERATOR,j):this._create_token(w.RESERVED,j):this._create_token(w.WORD,j);if(j=this.__patterns.number.read(),j!=="")return this._create_token(w.WORD,j)},R.prototype._read_singles=function(K){var j=null;return K==="("||K==="["?j=this._create_token(w.START_EXPR,K):K===")"||K==="]"?j=this._create_token(w.END_EXPR,K):K==="{"?j=this._create_token(w.START_BLOCK,K):K==="}"?j=this._create_token(w.END_BLOCK,K):K===";"?j=this._create_token(w.SEMICOLON,K):K==="."&&q.test(this._input.peek(1))?j=this._create_token(w.DOT,K):K===","&&(j=this._create_token(w.COMMA,K)),j&&this._input.next(),j},R.prototype._read_pair=function(K,j){var z=null;return K==="#"&&j==="{"&&(z=this._create_token(w.START_BLOCK,K+j)),z&&(this._input.next(),this._input.next()),z},R.prototype._read_punctuation=function(){var K=this.__patterns.punct.read();if(K!=="")return K==="="?this._create_token(w.EQUALS,K):K==="?."?this._create_token(w.DOT,K):this._create_token(w.OPERATOR,K)},R.prototype._read_non_javascript=function(K){var j="";if(K==="#"){if(this._is_first_token()&&(j=this.__patterns.shebang.read(),j))return this._create_token(w.UNKNOWN,j.trim()+`
`);if(j=this.__patterns.include.read(),j)return this._create_token(w.UNKNOWN,j.trim()+`
`);K=this._input.next();var z="#";if(this._input.hasNext()&&this._input.testChar(V)){do K=this._input.next(),z+=K;while(this._input.hasNext()&&K!=="#"&&K!=="=");return K==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(z+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(z+="{}",this._input.next(),this._input.next())),this._create_token(w.WORD,z)}this._input.back()}else if(K==="<"&&this._is_first_token()){if(j=this.__patterns.html_comment_start.read(),j){for(;this._input.hasNext()&&!this._input.testChar(x.newline);)j+=this._input.next();return U=!0,this._create_token(w.COMMENT,j)}}else if(U&&K==="-"&&(j=this.__patterns.html_comment_end.read(),j))return U=!1,this._create_token(w.COMMENT,j);return null},R.prototype._read_comment=function(K){var j=null;if(K==="/"){var z="";if(this._input.peek(1)==="*"){z=this.__patterns.block_comment.read();var y=k.get_directives(z);y&&y.ignore==="start"&&(z+=k.readIgnored(this._input)),z=z.replace(x.allLineBreaks,`
`),j=this._create_token(w.BLOCK_COMMENT,z),j.directives=y}else this._input.peek(1)==="/"&&(z=this.__patterns.comment.read(),j=this._create_token(w.COMMENT,z))}return j},R.prototype._read_string=function(K){if(K==="`"||K==="'"||K==='"'){var j=this._input.next();return this.has_char_escapes=!1,K==="`"?j+=this._read_string_recursive("`",!0,"${"):j+=this._read_string_recursive(K),this.has_char_escapes&&this._options.unescape_strings&&(j=O(j)),this._input.peek()===K&&(j+=this._input.next()),j=j.replace(x.allLineBreaks,`
`),this._create_token(w.STRING,j)}return null},R.prototype._allow_regexp_or_xml=function(K){return K.type===w.RESERVED&&F(K.text,["return","case","throw","else","do","typeof","yield"])||K.type===w.END_EXPR&&K.text===")"&&K.opened.previous.type===w.RESERVED&&F(K.opened.previous.text,["if","while","for"])||F(K.type,[w.COMMENT,w.START_EXPR,w.START_BLOCK,w.START,w.END_BLOCK,w.OPERATOR,w.EQUALS,w.EOF,w.SEMICOLON,w.COMMA])},R.prototype._read_regexp=function(K,j){if(K==="/"&&this._allow_regexp_or_xml(j)){for(var z=this._input.next(),y=!1,_=!1;this._input.hasNext()&&(y||_||this._input.peek()!==K)&&!this._input.testChar(x.newline);)z+=this._input.peek(),y?y=!1:(y=this._input.peek()==="\\",this._input.peek()==="["?_=!0:this._input.peek()==="]"&&(_=!1)),this._input.next();return this._input.peek()===K&&(z+=this._input.next(),z+=this._input.read(x.identifier)),this._create_token(w.STRING,z)}return null},R.prototype._read_xml=function(K,j){if(this._options.e4x&&K==="<"&&this._allow_regexp_or_xml(j)){var z="",y=this.__patterns.xml.read_match();if(y){for(var _=y[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),I=_.indexOf("{")===0,Z=0;y;){var Ee=!!y[1],Ce=y[2],Ue=!!y[y.length-1]||Ce.slice(0,8)==="![CDATA[";if(!Ue&&(Ce===_||I&&Ce.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Ee?--Z:++Z),z+=y[0],Z<=0)break;y=this.__patterns.xml.read_match()}return y||(z+=this._input.match(/[\s\S]*/g)[0]),z=z.replace(x.allLineBreaks,`
`),this._create_token(w.STRING,z)}}return null};function O(K){for(var j="",z=0,y=new A(K),_=null;y.hasNext();)if(_=y.match(/([\s]|[^\\]|\\\\)+/g),_&&(j+=_[0]),y.peek()==="\\"){if(y.next(),y.peek()==="x")_=y.match(/x([0-9A-Fa-f]{2})/g);else if(y.peek()==="u")_=y.match(/u([0-9A-Fa-f]{4})/g),_||(_=y.match(/u\{([0-9A-Fa-f]+)\}/g));else{j+="\\",y.hasNext()&&(j+=y.next());continue}if(!_||(z=parseInt(_[1],16),z>126&&z<=255&&_[0].indexOf("x")===0))return K;z>=0&&z<32||z>1114111?j+="\\"+_[0]:z===34||z===39||z===92?j+="\\"+String.fromCharCode(z):j+=String.fromCharCode(z)}return j}R.prototype._read_string_recursive=function(K,j,z){var y,_;K==="'"?_=this.__patterns.single_quote:K==='"'?_=this.__patterns.double_quote:K==="`"?_=this.__patterns.template_text:K==="}"&&(_=this.__patterns.template_expression);for(var I=_.read(),Z="";this._input.hasNext();){if(Z=this._input.next(),Z===K||!j&&x.newline.test(Z)){this._input.back();break}else Z==="\\"&&this._input.hasNext()?(y=this._input.peek(),y==="x"||y==="u"?this.has_char_escapes=!0:y==="\r"&&this._input.peek(1)===`
`&&this._input.next(),Z+=this._input.next()):z&&(z==="${"&&Z==="$"&&this._input.peek()==="{"&&(Z+=this._input.next()),z===Z&&(K==="`"?Z+=this._read_string_recursive("}",j,"`"):Z+=this._read_string_recursive("`",j,"${"),this._input.hasNext()&&(Z+=this._input.next())));Z+=_.read(),I+=Z}return I},te.exports.Tokenizer=R,te.exports.TOKEN=w,te.exports.positionable_operators=le.slice(),te.exports.line_starters=_e.slice()},function(te){var l=RegExp.prototype.hasOwnProperty("sticky");function M(A){this.__input=A||"",this.__input_length=this.__input.length,this.__position=0}M.prototype.restart=function(){this.__position=0},M.prototype.back=function(){this.__position>0&&(this.__position-=1)},M.prototype.hasNext=function(){return this.__position<this.__input_length},M.prototype.next=function(){var A=null;return this.hasNext()&&(A=this.__input.charAt(this.__position),this.__position+=1),A},M.prototype.peek=function(A){var g=null;return A=A||0,A+=this.__position,A>=0&&A<this.__input_length&&(g=this.__input.charAt(A)),g},M.prototype.__match=function(A,g){A.lastIndex=g;var b=A.exec(this.__input);return b&&!(l&&A.sticky)&&b.index!==g&&(b=null),b},M.prototype.test=function(A,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(A,g):!1},M.prototype.testChar=function(A,g){var b=this.peek(g);return A.lastIndex=0,b!==null&&A.test(b)},M.prototype.match=function(A){var g=this.__match(A,this.__position);return g?this.__position+=g[0].length:g=null,g},M.prototype.read=function(A,g,b){var m="",x;return A&&(x=this.match(A),x&&(m+=x[0])),g&&(x||!A)&&(m+=this.readUntil(g,b)),m},M.prototype.readUntil=function(A,g){var b="",m=this.__position;A.lastIndex=this.__position;var x=A.exec(this.__input);return x?(m=x.index,g&&(m+=x[0].length)):m=this.__input_length,b=this.__input.substring(this.__position,m),this.__position=m,b},M.prototype.readUntilAfter=function(A){return this.readUntil(A,!0)},M.prototype.get_regexp=function(A,g){var b=null,m="g";return g&&l&&(m="y"),typeof A=="string"&&A!==""?b=new RegExp(A,m):A&&(b=new RegExp(A.source,m)),b},M.prototype.get_literal_regexp=function(A){return RegExp(A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},M.prototype.peekUntilAfter=function(A){var g=this.__position,b=this.readUntilAfter(A);return this.__position=g,b},M.prototype.lookBack=function(A){var g=this.__position-1;return g>=A.length&&this.__input.substring(g-A.length,g).toLowerCase()===A},te.exports.InputScanner=M},function(te,l,M){var A=M(8).InputScanner,g=M(3).Token,b=M(10).TokenStream,m=M(11).WhitespacePattern,x={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},C=function(L,F){this._input=new A(L),this._options=F||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new m(this._input)};C.prototype.tokenize=function(){this._input.restart(),this.__tokens=new b,this._reset();for(var L,F=new g(x.START,""),w=null,k=[],N=new b;F.type!==x.EOF;){for(L=this._get_next_token(F,w);this._is_comment(L);)N.add(L),L=this._get_next_token(F,w);N.isEmpty()||(L.comments_before=N,N=new b),L.parent=w,this._is_opening(L)?(k.push(w),w=L):w&&this._is_closing(L,w)&&(L.opened=w,w.closed=L,w=k.pop(),L.parent=w),L.previous=F,F.next=L,this.__tokens.add(L),F=L}return this.__tokens},C.prototype._is_first_token=function(){return this.__tokens.isEmpty()},C.prototype._reset=function(){},C.prototype._get_next_token=function(L,F){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(x.RAW,w):this._create_token(x.EOF,"")},C.prototype._is_comment=function(L){return!1},C.prototype._is_opening=function(L){return!1},C.prototype._is_closing=function(L,F){return!1},C.prototype._create_token=function(L,F){var w=new g(L,F,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},C.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},te.exports.Tokenizer=C,te.exports.TOKEN=x},function(te){function l(M){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=M}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 M=null;return this.hasNext()&&(M=this.__tokens[this.__position],this.__position+=1),M},l.prototype.peek=function(M){var A=null;return M=M||0,M+=this.__position,M>=0&&M<this.__tokens_length&&(A=this.__tokens[M]),A},l.prototype.add=function(M){this.__parent_token&&(M.parent=this.__parent_token),this.__tokens.push(M),this.__tokens_length+=1},te.exports.TokenStream=l},function(te,l,M){var A=M(12).Pattern;function g(b,m){A.call(this,b,m),m?this._line_regexp=this._input.get_regexp(m._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}g.prototype=new A,g.prototype.__set_whitespace_patterns=function(b,m){b+="\\t ",m+="\\n\\r",this._match_pattern=this._input.get_regexp("["+b+m+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+m+"]")},g.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 m=this.__split(this._newline_regexp,b);this.newline_count=m.length-1,this.whitespace_before_token=m[this.newline_count]}return b},g.prototype.matching=function(b,m){var x=this._create();return x.__set_whitespace_patterns(b,m),x._update(),x},g.prototype._create=function(){return new g(this._input,this)},g.prototype.__split=function(b,m){b.lastIndex=0;for(var x=0,C=[],L=b.exec(m);L;)C.push(m.substring(x,L.index)),x=L.index+L[0].length,L=b.exec(m);return x<m.length?C.push(m.substring(x,m.length)):C.push(""),C},te.exports.WhitespacePattern=g},function(te){function l(M,A){this._input=M,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,A&&(this._starting_pattern=this._input.get_regexp(A._starting_pattern,!0),this._match_pattern=this._input.get_regexp(A._match_pattern,!0),this._until_pattern=this._input.get_regexp(A._until_pattern),this._until_after=A._until_after)}l.prototype.read=function(){var M=this._input.read(this._starting_pattern);return(!this._starting_pattern||M)&&(M+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),M},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function(M){var A=this._create();return A._until_after=!0,A._until_pattern=this._input.get_regexp(M),A._update(),A},l.prototype.until=function(M){var A=this._create();return A._until_after=!1,A._until_pattern=this._input.get_regexp(M),A._update(),A},l.prototype.starting_with=function(M){var A=this._create();return A._starting_pattern=this._input.get_regexp(M,!0),A._update(),A},l.prototype.matching=function(M){var A=this._create();return A._match_pattern=this._input.get_regexp(M,!0),A._update(),A},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},te.exports.Pattern=l},function(te){function l(M,A){M=typeof M=="string"?M:M.source,A=typeof A=="string"?A:A.source,this.__directives_block_pattern=new RegExp(M+/ beautify( \w+[:]\w+)+ /.source+A,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(M+/\sbeautify\signore:end\s/.source+A,"g")}l.prototype.get_directives=function(M){if(!M.match(this.__directives_block_pattern))return null;var A={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(M);g;)A[g[1]]=g[2],g=this.__directive_pattern.exec(M);return A},l.prototype.readIgnored=function(M){return M.readUntilAfter(this.__directives_end_ignore_pattern)},te.exports.Directives=l},function(te,l,M){var A=M(12).Pattern,g={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function b(m,x){A.call(this,m,x),this.__template_pattern=null,this._disabled=Object.assign({},g),this._excluded=Object.assign({},g),x&&(this.__template_pattern=this._input.get_regexp(x.__template_pattern),this._excluded=Object.assign(this._excluded,x._excluded),this._disabled=Object.assign(this._disabled,x._disabled));var C=new A(m);this.__patterns={handlebars_comment:C.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:C.starting_with(/{{{/).until_after(/}}}/),handlebars:C.starting_with(/{{/).until_after(/}}/),php:C.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:C.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:C.starting_with(/{%/).until_after(/%}/),django_value:C.starting_with(/{{/).until_after(/}}/),django_comment:C.starting_with(/{#/).until_after(/#}/),smarty:C.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:C.starting_with(/{\*/).until_after(/\*}/),smarty_literal:C.starting_with(/{literal}/).until_after(/{\/literal}/)}}b.prototype=new A,b.prototype._create=function(){return new b(this._input,this)},b.prototype._update=function(){this.__set_templated_pattern()},b.prototype.disable=function(m){var x=this._create();return x._disabled[m]=!0,x._update(),x},b.prototype.read_options=function(m){var x=this._create();for(var C in g)x._disabled[C]=m.templating.indexOf(C)===-1;return x._update(),x},b.prototype.exclude=function(m){var x=this._create();return x._excluded[m]=!0,x._update(),x},b.prototype.read=function(){var m="";this._match_pattern?m=this._input.read(this._starting_pattern):m=this._input.read(this._starting_pattern,this.__template_pattern);for(var x=this._read_template();x;)this._match_pattern?x+=this._input.read(this._match_pattern):x+=this._input.readUntil(this.__template_pattern),m+=x,x=this._read_template();return this._until_after&&(m+=this._input.readUntilAfter(this._until_pattern)),m},b.prototype.__set_templated_pattern=function(){var m=[];this._disabled.php||m.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||m.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||m.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||m.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(m.push(this.__patterns.django._starting_pattern.source),m.push(this.__patterns.django_value._starting_pattern.source),m.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||m.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&m.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+m.join("|")+")")},b.prototype._read_template=function(){var m="",x=this._input.peek();if(x==="<"){var C=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&C==="?"&&(m=m||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&C==="%"&&(m=m||this.__patterns.erb.read())}else x==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(m=m||this.__patterns.handlebars_comment.read(),m=m||this.__patterns.handlebars_unescaped.read(),m=m||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(m=m||this.__patterns.django_value.read()),this._excluded.django||(m=m||this.__patterns.django_comment.read(),m=m||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(m=m||this.__patterns.smarty_comment.read(),m=m||this.__patterns.smarty_literal.read(),m=m||this.__patterns.smarty.read()));return m},te.exports.TemplatablePattern=b}],H={};function p(te){var l=H[te];if(l!==void 0)return l.exports;var M=H[te]={exports:{}};return oe[te](M,M.exports,p),M.exports}var ae=p(0);fe=ae})();var ke=fe;W=[],T=function(){return{js_beautify:ke}}.apply(nt,W),T!==void 0&&(Rt.exports=T)})()},32834:function(Rt){(function(nt,W){Rt.exports=W()})(this,function(){"use strict";function nt(ge,de){for(var pe=0;pe<de.length;pe++){var P=de[pe];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(ge,P.key,P)}}function W(ge,de,pe){return de&&nt(ge.prototype,de),pe&&nt(ge,pe),ge}function T(ge,de){if(ge){if(typeof ge=="string")return fe(ge,de);var pe=Object.prototype.toString.call(ge).slice(8,-1);if(pe==="Object"&&ge.constructor&&(pe=ge.constructor.name),pe==="Map"||pe==="Set")return Array.from(ge);if(pe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(pe))return fe(ge,de)}}function fe(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var pe=0,P=new Array(de);pe<de;pe++)P[pe]=ge[pe];return P}function ke(ge,de){var pe=typeof Symbol!="undefined"&&ge[Symbol.iterator]||ge["@@iterator"];if(pe)return(pe=pe.call(ge)).next.bind(pe);if(Array.isArray(ge)||(pe=T(ge))||de&&ge&&typeof ge.length=="number"){pe&&(ge=pe);var P=0;return function(){return P>=ge.length?{done:!0}:{done:!1,value:ge[P++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var oe={exports:{}};function H(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function p(ge){oe.exports.defaults=ge}oe.exports={defaults:H(),getDefaults:H,changeDefaults:p};var ae=/[&<>"']/,te=/[&<>"']/g,l=/[<>"']|&(?!#?\w+;)/,M=/[<>"']|&(?!#?\w+;)/g,A={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=function(de){return A[de]};function b(ge,de){if(de){if(ae.test(ge))return ge.replace(te,g)}else if(l.test(ge))return ge.replace(M,g);return ge}var m=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function x(ge){return ge.replace(m,function(de,pe){return pe=pe.toLowerCase(),pe==="colon"?":":pe.charAt(0)==="#"?pe.charAt(1)==="x"?String.fromCharCode(parseInt(pe.substring(2),16)):String.fromCharCode(+pe.substring(1)):""})}var C=/(^|[^\[])\^/g;function L(ge,de){ge=ge.source||ge,de=de||"";var pe={replace:function(G,Q){return Q=Q.source||Q,Q=Q.replace(C,"$1"),ge=ge.replace(G,Q),pe},getRegex:function(){return new RegExp(ge,de)}};return pe}var F=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(ge,de,pe){if(ge){var P;try{P=decodeURIComponent(x(pe)).replace(F,"").toLowerCase()}catch(G){return null}if(P.indexOf("javascript:")===0||P.indexOf("vbscript:")===0||P.indexOf("data:")===0)return null}de&&!w.test(pe)&&(pe=ee(de,pe));try{pe=encodeURI(pe).replace(/%25/g,"%")}catch(G){return null}return pe}var N={},V=/^[^:]+:\/*[^/]*$/,q=/^([^:]+:)[\s\S]*$/,le=/^([^:]+:\/*[^/]*)[\s\S]*$/;function ee(ge,de){N[" "+ge]||(V.test(ge)?N[" "+ge]=ge+"/":N[" "+ge]=Ge(ge,"/",!0)),ge=N[" "+ge];var pe=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?pe?de:ge.replace(q,"$1")+de:de.charAt(0)==="/"?pe?de:ge.replace(le,"$1")+de:ge+de}var X={exec:function(){}};function _e(ge){for(var de=1,pe,P;de<arguments.length;de++){pe=arguments[de];for(P in pe)Object.prototype.hasOwnProperty.call(pe,P)&&(ge[P]=pe[P])}return ge}function ye(ge,de){var pe=ge.replace(/\|/g,function(Q,re,ce){for(var tt=!1,it=re;--it>=0&&ce[it]==="\\";)tt=!tt;return tt?"|":" |"}),P=pe.split(/ \|/),G=0;if(P.length>de)P.splice(de);else for(;P.length<de;)P.push("");for(;G<P.length;G++)P[G]=P[G].trim().replace(/\\\|/g,"|");return P}function Ge(ge,de,pe){var P=ge.length;if(P===0)return"";for(var G=0;G<P;){var Q=ge.charAt(P-G-1);if(Q===de&&!pe)G++;else if(Q!==de&&pe)G++;else break}return ge.substr(0,P-G)}function U(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var pe=ge.length,P=0,G=0;G<pe;G++)if(ge[G]==="\\")G++;else if(ge[G]===de[0])P++;else if(ge[G]===de[1]&&(P--,P<0))return G;return-1}function R(ge){ge&&ge.sanitize&&!ge.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function O(ge,de){if(de<1)return"";for(var pe="";de>1;)de&1&&(pe+=ge),de>>=1,ge+=ge;return pe+ge}var K={escape:b,unescape:x,edit:L,cleanUrl:k,resolveUrl:ee,noopTest:X,merge:_e,splitCells:ye,rtrim:Ge,findClosingBracket:U,checkSanitizeDeprecation:R,repeatString:O},j=oe.exports.defaults,z=K.rtrim,y=K.splitCells,_=K.escape,I=K.findClosingBracket;function Z(ge,de,pe){var P=de.href,G=de.title?_(de.title):null,Q=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:pe,href:P,title:G,text:Q}:{type:"image",raw:pe,href:P,title:G,text:_(Q)}}function Ee(ge,de){var pe=ge.match(/^(\s+)(?:```)/);if(pe===null)return de;var P=pe[1];return de.split(`
`).map(function(G){var Q=G.match(/^\s+/);if(Q===null)return G;var re=Q[0];return re.length>=P.length?G.slice(P.length):G}).join(`
`)}var Ce=function(){function ge(pe){this.options=pe||j}var de=ge.prototype;return de.space=function(P){var G=this.rules.block.newline.exec(P);if(G)return G[0].length>1?{type:"space",raw:G[0]}:{raw:`
`}},de.code=function(P){var G=this.rules.block.code.exec(P);if(G){var Q=G[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:G[0],codeBlockStyle:"indented",text:this.options.pedantic?Q:z(Q,`
`)}}},de.fences=function(P){var G=this.rules.block.fences.exec(P);if(G){var Q=G[0],re=Ee(Q,G[3]||"");return{type:"code",raw:Q,lang:G[2]?G[2].trim():G[2],text:re}}},de.heading=function(P){var G=this.rules.block.heading.exec(P);if(G){var Q=G[2].trim();if(/#$/.test(Q)){var re=z(Q,"#");(this.options.pedantic||!re||/ $/.test(re))&&(Q=re.trim())}return{type:"heading",raw:G[0],depth:G[1].length,text:Q}}},de.nptable=function(P){var G=this.rules.block.nptable.exec(P);if(G){var Q={type:"table",header:y(G[1].replace(/^ *| *\| *$/g,"")),align:G[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:G[3]?G[3].replace(/\n$/,"").split(`
`):[],raw:G[0]};if(Q.header.length===Q.align.length){var re=Q.align.length,ce;for(ce=0;ce<re;ce++)/^ *-+: *$/.test(Q.align[ce])?Q.align[ce]="right":/^ *:-+: *$/.test(Q.align[ce])?Q.align[ce]="center":/^ *:-+ *$/.test(Q.align[ce])?Q.align[ce]="left":Q.align[ce]=null;for(re=Q.cells.length,ce=0;ce<re;ce++)Q.cells[ce]=y(Q.cells[ce],Q.header.length);return Q}}},de.hr=function(P){var G=this.rules.block.hr.exec(P);if(G)return{type:"hr",raw:G[0]}},de.blockquote=function(P){var G=this.rules.block.blockquote.exec(P);if(G){var Q=G[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:G[0],text:Q}}},de.list=function(P){var G=this.rules.block.list.exec(P);if(G){var Q=G[0],re=G[2],ce=re.length>1,tt={type:"list",raw:Q,ordered:ce,start:ce?+re.slice(0,-1):"",loose:!1,items:[]},it=G[0].match(this.rules.block.item),ot=!1,gt,kt,Ut,Bt,bt,rn,fn,en,Qt,st=it.length;Ut=this.rules.block.listItemStart.exec(it[0]);for(var je=0;je<st;je++){if(gt=it[je],Q=gt,this.options.pedantic||(Qt=gt.match(new RegExp("\\n\\s*\\n {0,"+(Ut[0].length-1)+"}\\S")),Qt&&(bt=gt.length-Qt.index+it.slice(je+1).join(`
`).length,tt.raw=tt.raw.substring(0,tt.raw.length-bt),gt=gt.substring(0,Qt.index),Q=gt,st=je+1)),je!==st-1){if(Bt=this.rules.block.listItemStart.exec(it[je+1]),this.options.pedantic?Bt[1].length>Ut[1].length:Bt[1].length>=Ut[0].length||Bt[1].length>3){it.splice(je,2,it[je]+(!this.options.pedantic&&Bt[1].length<Ut[0].length&&!it[je].match(/\n$/)?"":`
`)+it[je+1]),je--,st--;continue}else(!this.options.pedantic||this.options.smartLists?Bt[2][Bt[2].length-1]!==re[re.length-1]:ce===(Bt[2].length===1))&&(bt=it.slice(je+1).join(`
`).length,tt.raw=tt.raw.substring(0,tt.raw.length-bt),je=st-1);Ut=Bt}kt=gt.length,gt=gt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~gt.indexOf(`
`)&&(kt-=gt.length,gt=this.options.pedantic?gt.replace(/^ {1,4}/gm,""):gt.replace(new RegExp("^ {1,"+kt+"}","gm"),"")),gt=z(gt,`
`),je!==st-1&&(Q=Q+`
`),rn=ot||/\n\n(?!\s*$)/.test(Q),je!==st-1&&(ot=Q.slice(-2)===`
`,rn||(rn=ot)),rn&&(tt.loose=!0),this.options.gfm&&(fn=/^\[[ xX]\] /.test(gt),en=void 0,fn&&(en=gt[1]!==" ",gt=gt.replace(/^\[[ xX]\] +/,""))),tt.items.push({type:"list_item",raw:Q,task:fn,checked:en,loose:rn,text:gt})}return tt}},de.html=function(P){var G=this.rules.block.html.exec(P);if(G)return{type:this.options.sanitize?"paragraph":"html",raw:G[0],pre:!this.options.sanitizer&&(G[1]==="pre"||G[1]==="script"||G[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(G[0]):_(G[0]):G[0]}},de.def=function(P){var G=this.rules.block.def.exec(P);if(G){G[3]&&(G[3]=G[3].substring(1,G[3].length-1));var Q=G[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:Q,raw:G[0],href:G[2],title:G[3]}}},de.table=function(P){var G=this.rules.block.table.exec(P);if(G){var Q={type:"table",header:y(G[1].replace(/^ *| *\| *$/g,"")),align:G[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:G[3]?G[3].replace(/\n$/,"").split(`
`):[]};if(Q.header.length===Q.align.length){Q.raw=G[0];var re=Q.align.length,ce;for(ce=0;ce<re;ce++)/^ *-+: *$/.test(Q.align[ce])?Q.align[ce]="right":/^ *:-+: *$/.test(Q.align[ce])?Q.align[ce]="center":/^ *:-+ *$/.test(Q.align[ce])?Q.align[ce]="left":Q.align[ce]=null;for(re=Q.cells.length,ce=0;ce<re;ce++)Q.cells[ce]=y(Q.cells[ce].replace(/^ *\| *| *\| *$/g,""),Q.header.length);return Q}}},de.lheading=function(P){var G=this.rules.block.lheading.exec(P);if(G)return{type:"heading",raw:G[0],depth:G[2].charAt(0)==="="?1:2,text:G[1]}},de.paragraph=function(P){var G=this.rules.block.paragraph.exec(P);if(G)return{type:"paragraph",raw:G[0],text:G[1].charAt(G[1].length-1)===`
`?G[1].slice(0,-1):G[1]}},de.text=function(P){var G=this.rules.block.text.exec(P);if(G)return{type:"text",raw:G[0],text:G[0]}},de.escape=function(P){var G=this.rules.inline.escape.exec(P);if(G)return{type:"escape",raw:G[0],text:_(G[1])}},de.tag=function(P,G,Q){var re=this.rules.inline.tag.exec(P);if(re)return!G&&/^<a /i.test(re[0])?G=!0:G&&/^<\/a>/i.test(re[0])&&(G=!1),!Q&&/^<(pre|code|kbd|script)(\s|>)/i.test(re[0])?Q=!0:Q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(re[0])&&(Q=!1),{type:this.options.sanitize?"text":"html",raw:re[0],inLink:G,inRawBlock:Q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):_(re[0]):re[0]}},de.link=function(P){var G=this.rules.inline.link.exec(P);if(G){var Q=G[2].trim();if(!this.options.pedantic&&/^</.test(Q)){if(!/>$/.test(Q))return;var re=z(Q.slice(0,-1),"\\");if((Q.length-re.length)%2===0)return}else{var ce=I(G[2],"()");if(ce>-1){var tt=G[0].indexOf("!")===0?5:4,it=tt+G[1].length+ce;G[2]=G[2].substring(0,ce),G[0]=G[0].substring(0,it).trim(),G[3]=""}}var ot=G[2],gt="";if(this.options.pedantic){var kt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ot);kt&&(ot=kt[1],gt=kt[3])}else gt=G[3]?G[3].slice(1,-1):"";return ot=ot.trim(),/^</.test(ot)&&(this.options.pedantic&&!/>$/.test(Q)?ot=ot.slice(1):ot=ot.slice(1,-1)),Z(G,{href:ot&&ot.replace(this.rules.inline._escapes,"$1"),title:gt&&gt.replace(this.rules.inline._escapes,"$1")},G[0])}},de.reflink=function(P,G){var Q;if((Q=this.rules.inline.reflink.exec(P))||(Q=this.rules.inline.nolink.exec(P))){var re=(Q[2]||Q[1]).replace(/\s+/g," ");if(re=G[re.toLowerCase()],!re||!re.href){var ce=Q[0].charAt(0);return{type:"text",raw:ce,text:ce}}return Z(Q,re,Q[0])}},de.emStrong=function(P,G,Q){Q===void 0&&(Q="");var re=this.rules.inline.emStrong.lDelim.exec(P);if(re&&!(re[3]&&Q.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var ce=re[1]||re[2]||"";if(!ce||ce&&(Q===""||this.rules.inline.punctuation.exec(Q))){var tt=re[0].length-1,it,ot,gt=tt,kt=0,Ut=re[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(Ut.lastIndex=0,G=G.slice(-1*P.length+tt);(re=Ut.exec(G))!=null;)if(it=re[1]||re[2]||re[3]||re[4]||re[5]||re[6],!!it){if(ot=it.length,re[3]||re[4]){gt+=ot;continue}else if((re[5]||re[6])&&tt%3&&!((tt+ot)%3)){kt+=ot;continue}if(gt-=ot,!(gt>0))return ot=Math.min(ot,ot+gt+kt),Math.min(tt,ot)%2?{type:"em",raw:P.slice(0,tt+re.index+ot+1),text:P.slice(1,tt+re.index+ot)}:{type:"strong",raw:P.slice(0,tt+re.index+ot+1),text:P.slice(2,tt+re.index+ot-1)}}}}},de.codespan=function(P){var G=this.rules.inline.code.exec(P);if(G){var Q=G[2].replace(/\n/g," "),re=/[^ ]/.test(Q),ce=/^ /.test(Q)&&/ $/.test(Q);return re&&ce&&(Q=Q.substring(1,Q.length-1)),Q=_(Q,!0),{type:"codespan",raw:G[0],text:Q}}},de.br=function(P){var G=this.rules.inline.br.exec(P);if(G)return{type:"br",raw:G[0]}},de.del=function(P){var G=this.rules.inline.del.exec(P);if(G)return{type:"del",raw:G[0],text:G[2]}},de.autolink=function(P,G){var Q=this.rules.inline.autolink.exec(P);if(Q){var re,ce;return Q[2]==="@"?(re=_(this.options.mangle?G(Q[1]):Q[1]),ce="mailto:"+re):(re=_(Q[1]),ce=re),{type:"link",raw:Q[0],text:re,href:ce,tokens:[{type:"text",raw:re,text:re}]}}},de.url=function(P,G){var Q;if(Q=this.rules.inline.url.exec(P)){var re,ce;if(Q[2]==="@")re=_(this.options.mangle?G(Q[0]):Q[0]),ce="mailto:"+re;else{var tt;do tt=Q[0],Q[0]=this.rules.inline._backpedal.exec(Q[0])[0];while(tt!==Q[0]);re=_(Q[0]),Q[1]==="www."?ce="http://"+re:ce=re}return{type:"link",raw:Q[0],text:re,href:ce,tokens:[{type:"text",raw:re,text:re}]}}},de.inlineText=function(P,G,Q){var re=this.rules.inline.text.exec(P);if(re){var ce;return G?ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):_(re[0]):re[0]:ce=_(this.options.smartypants?Q(re[0]):re[0]),{type:"text",raw:re[0],text:ce}}},ge}(),Ue=K.noopTest,Be=K.edit,Ze=K.merge,et={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Ue,table:Ue,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};et._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,et._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,et.def=Be(et.def).replace("label",et._label).replace("title",et._title).getRegex(),et.bullet=/(?:[*+-]|\d{1,9}[.)])/,et.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,et.item=Be(et.item,"gm").replace(/bull/g,et.bullet).getRegex(),et.listItemStart=Be(/^( *)(bull) */).replace("bull",et.bullet).getRegex(),et.list=Be(et.list).replace(/bull/g,et.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+et.def.source+")").getRegex(),et._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",et._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,et.html=Be(et.html,"i").replace("comment",et._comment).replace("tag",et._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),et.paragraph=Be(et._paragraph).replace("hr",et.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",et._tag).getRegex(),et.blockquote=Be(et.blockquote).replace("paragraph",et.paragraph).getRegex(),et.normal=Ze({},et),et.gfm=Ze({},et.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),et.gfm.nptable=Be(et.gfm.nptable).replace("hr",et.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",et._tag).getRegex(),et.gfm.table=Be(et.gfm.table).replace("hr",et.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",et._tag).getRegex(),et.pedantic=Ze({},et.normal,{html:Be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",et._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ue,paragraph:Be(et.normal._paragraph).replace("hr",et.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",et.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var $e={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ue,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/\_\_[^_*]*?\*[^_*]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/\*\*[^_*]*?\_[^_*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Ue,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};$e._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",$e.punctuation=Be($e.punctuation).replace(/punctuation/g,$e._punctuation).getRegex(),$e.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,$e.escapedEmSt=/\\\*|\\_/g,$e._comment=Be(et._comment).replace("(?:-->|$)","-->").getRegex(),$e.emStrong.lDelim=Be($e.emStrong.lDelim).replace(/punct/g,$e._punctuation).getRegex(),$e.emStrong.rDelimAst=Be($e.emStrong.rDelimAst,"g").replace(/punct/g,$e._punctuation).getRegex(),$e.emStrong.rDelimUnd=Be($e.emStrong.rDelimUnd,"g").replace(/punct/g,$e._punctuation).getRegex(),$e._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,$e._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,$e._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,$e.autolink=Be($e.autolink).replace("scheme",$e._scheme).replace("email",$e._email).getRegex(),$e._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,$e.tag=Be($e.tag).replace("comment",$e._comment).replace("attribute",$e._attribute).getRegex(),$e._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$e._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,$e._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,$e.link=Be($e.link).replace("label",$e._label).replace("href",$e._href).replace("title",$e._title).getRegex(),$e.reflink=Be($e.reflink).replace("label",$e._label).getRegex(),$e.reflinkSearch=Be($e.reflinkSearch,"g").replace("reflink",$e.reflink).replace("nolink",$e.nolink).getRegex(),$e.normal=Ze({},$e),$e.pedantic=Ze({},$e.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Be(/^!?\[(label)\]\((.*?)\)/).replace("label",$e._label).getRegex(),reflink:Be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$e._label).getRegex()}),$e.gfm=Ze({},$e.normal,{escape:Be($e.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),$e.gfm.url=Be($e.gfm.url,"i").replace("email",$e.gfm._extended_email).getRegex(),$e.breaks=Ze({},$e.gfm,{br:Be($e.br).replace("{2,}","*").getRegex(),text:Be($e.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var be={block:et,inline:$e},he=Ce,we=oe.exports.defaults,Ae=be.block,qe=be.inline,ie=K.repeatString;function ue(ge){return ge.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Y(ge){var de="",pe,P,G=ge.length;for(pe=0;pe<G;pe++)P=ge.charCodeAt(pe),Math.random()>.5&&(P="x"+P.toString(16)),de+="&#"+P+";";return de}var xe=function(){function ge(pe){this.tokens=[],this.tokens.links=Object.create(null),this.options=pe||we,this.options.tokenizer=this.options.tokenizer||new he,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var P={block:Ae.normal,inline:qe.normal};this.options.pedantic?(P.block=Ae.pedantic,P.inline=qe.pedantic):this.options.gfm&&(P.block=Ae.gfm,this.options.breaks?P.inline=qe.breaks:P.inline=qe.gfm),this.tokenizer.rules=P}ge.lex=function(P,G){var Q=new ge(G);return Q.lex(P)},ge.lexInline=function(P,G){var Q=new ge(G);return Q.inlineTokens(P)};var de=ge.prototype;return de.lex=function(P){return P=P.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(P,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(P,G,Q){G===void 0&&(G=[]),Q===void 0&&(Q=!0),this.options.pedantic&&(P=P.replace(/^ +$/gm,""));for(var re,ce,tt,it;P;){if(re=this.tokenizer.space(P)){P=P.substring(re.raw.length),re.type&&G.push(re);continue}if(re=this.tokenizer.code(P)){P=P.substring(re.raw.length),it=G[G.length-1],it&&it.type==="paragraph"?(it.raw+=`
`+re.raw,it.text+=`
`+re.text):G.push(re);continue}if(re=this.tokenizer.fences(P)){P=P.substring(re.raw.length),G.push(re);continue}if(re=this.tokenizer.heading(P)){P=P.substring(re.raw.length),G.push(re);continue}if(re=this.tokenizer.nptable(P)){P=P.substring(re.raw.length),G.push(re);continue}if(re=this.tokenizer.hr(P)){P=P.substring(re.raw.length),G.push(re);continue}if(re=this.tokenizer.blockquote(P)){P=P.substring(re.raw.length),re.tokens=this.blockTokens(re.text,[],Q),G.push(re);continue}if(re=this.tokenizer.list(P)){for(P=P.substring(re.raw.length),tt=re.items.length,ce=0;ce<tt;ce++)re.items[ce].tokens=this.blockTokens(re.items[ce].text,[],!1);G.push(re);continue}if(re=this.tokenizer.html(P)){P=P.substring(re.raw.length),G.push(re);continue}if(Q&&(re=this.tokenizer.def(P))){P=P.substring(re.raw.length),this.tokens.links[re.tag]||(this.tokens.links[re.tag]={href:re.href,title:re.title});continue}if(re=this.tokenizer.table(P)){P=P.substring(re.raw.length),G.push(re);continue}if(re=this.tokenizer.lheading(P)){P=P.substring(re.raw.length),G.push(re);continue}if(Q&&(re=this.tokenizer.paragraph(P))){P=P.substring(re.raw.length),G.push(re);continue}if(re=this.tokenizer.text(P)){P=P.substring(re.raw.length),it=G[G.length-1],it&&it.type==="text"?(it.raw+=`
`+re.raw,it.text+=`
`+re.text):G.push(re);continue}if(P){var ot="Infinite loop on byte: "+P.charCodeAt(0);if(this.options.silent){console.error(ot);break}else throw new Error(ot)}}return G},de.inline=function(P){var G,Q,re,ce,tt,it,ot=P.length;for(G=0;G<ot;G++)switch(it=P[G],it.type){case"paragraph":case"text":case"heading":{it.tokens=[],this.inlineTokens(it.text,it.tokens);break}case"table":{for(it.tokens={header:[],cells:[]},ce=it.header.length,Q=0;Q<ce;Q++)it.tokens.header[Q]=[],this.inlineTokens(it.header[Q],it.tokens.header[Q]);for(ce=it.cells.length,Q=0;Q<ce;Q++)for(tt=it.cells[Q],it.tokens.cells[Q]=[],re=0;re<tt.length;re++)it.tokens.cells[Q][re]=[],this.inlineTokens(tt[re],it.tokens.cells[Q][re]);break}case"blockquote":{this.inline(it.tokens);break}case"list":{for(ce=it.items.length,Q=0;Q<ce;Q++)this.inline(it.items[Q].tokens);break}}return P},de.inlineTokens=function(P,G,Q,re){G===void 0&&(G=[]),Q===void 0&&(Q=!1),re===void 0&&(re=!1);var ce,tt,it=P,ot,gt,kt;if(this.tokens.links){var Ut=Object.keys(this.tokens.links);if(Ut.length>0)for(;(ot=this.tokenizer.rules.inline.reflinkSearch.exec(it))!=null;)Ut.includes(ot[0].slice(ot[0].lastIndexOf("[")+1,-1))&&(it=it.slice(0,ot.index)+"["+ie("a",ot[0].length-2)+"]"+it.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ot=this.tokenizer.rules.inline.blockSkip.exec(it))!=null;)it=it.slice(0,ot.index)+"["+ie("a",ot[0].length-2)+"]"+it.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(ot=this.tokenizer.rules.inline.escapedEmSt.exec(it))!=null;)it=it.slice(0,ot.index)+"++"+it.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;P;){if(gt||(kt=""),gt=!1,ce=this.tokenizer.escape(P)){P=P.substring(ce.raw.length),G.push(ce);continue}if(ce=this.tokenizer.tag(P,Q,re)){P=P.substring(ce.raw.length),Q=ce.inLink,re=ce.inRawBlock;var Bt=G[G.length-1];Bt&&ce.type==="text"&&Bt.type==="text"?(Bt.raw+=ce.raw,Bt.text+=ce.text):G.push(ce);continue}if(ce=this.tokenizer.link(P)){P=P.substring(ce.raw.length),ce.type==="link"&&(ce.tokens=this.inlineTokens(ce.text,[],!0,re)),G.push(ce);continue}if(ce=this.tokenizer.reflink(P,this.tokens.links)){P=P.substring(ce.raw.length);var bt=G[G.length-1];ce.type==="link"?(ce.tokens=this.inlineTokens(ce.text,[],!0,re),G.push(ce)):bt&&ce.type==="text"&&bt.type==="text"?(bt.raw+=ce.raw,bt.text+=ce.text):G.push(ce);continue}if(ce=this.tokenizer.emStrong(P,it,kt)){P=P.substring(ce.raw.length),ce.tokens=this.inlineTokens(ce.text,[],Q,re),G.push(ce);continue}if(ce=this.tokenizer.codespan(P)){P=P.substring(ce.raw.length),G.push(ce);continue}if(ce=this.tokenizer.br(P)){P=P.substring(ce.raw.length),G.push(ce);continue}if(ce=this.tokenizer.del(P)){P=P.substring(ce.raw.length),ce.tokens=this.inlineTokens(ce.text,[],Q,re),G.push(ce);continue}if(ce=this.tokenizer.autolink(P,Y)){P=P.substring(ce.raw.length),G.push(ce);continue}if(!Q&&(ce=this.tokenizer.url(P,Y))){P=P.substring(ce.raw.length),G.push(ce);continue}if(ce=this.tokenizer.inlineText(P,re,ue)){P=P.substring(ce.raw.length),ce.raw.slice(-1)!=="_"&&(kt=ce.raw.slice(-1)),gt=!0,tt=G[G.length-1],tt&&tt.type==="text"?(tt.raw+=ce.raw,tt.text+=ce.text):G.push(ce);continue}if(P){var rn="Infinite loop on byte: "+P.charCodeAt(0);if(this.options.silent){console.error(rn);break}else throw new Error(rn)}}return G},W(ge,null,[{key:"rules",get:function(){return{block:Ae,inline:qe}}}]),ge}(),Te=oe.exports.defaults,Fe=K.cleanUrl,$=K.escape,se=function(){function ge(pe){this.options=pe||Te}var de=ge.prototype;return de.code=function(P,G,Q){var re=(G||"").match(/\S*/)[0];if(this.options.highlight){var ce=this.options.highlight(P,re);ce!=null&&ce!==P&&(Q=!0,P=ce)}return P=P.replace(/\n$/,"")+`
`,re?'<pre><code class="'+this.options.langPrefix+$(re,!0)+'">'+(Q?P:$(P,!0))+`</code></pre>
`:"<pre><code>"+(Q?P:$(P,!0))+`</code></pre>
`},de.blockquote=function(P){return`<blockquote>
`+P+`</blockquote>
`},de.html=function(P){return P},de.heading=function(P,G,Q,re){return this.options.headerIds?"<h"+G+' id="'+this.options.headerPrefix+re.slug(Q)+'">'+P+"</h"+G+`>
`:"<h"+G+">"+P+"</h"+G+`>
`},de.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},de.list=function(P,G,Q){var re=G?"ol":"ul",ce=G&&Q!==1?' start="'+Q+'"':"";return"<"+re+ce+`>
`+P+"</"+re+`>
`},de.listitem=function(P){return"<li>"+P+`</li>
`},de.checkbox=function(P){return"<input "+(P?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(P){return"<p>"+P+`</p>
`},de.table=function(P,G){return G&&(G="<tbody>"+G+"</tbody>"),`<table>
<thead>
`+P+`</thead>
`+G+`</table>
`},de.tablerow=function(P){return`<tr>
`+P+`</tr>
`},de.tablecell=function(P,G){var Q=G.header?"th":"td",re=G.align?"<"+Q+' align="'+G.align+'">':"<"+Q+">";return re+P+"</"+Q+`>
`},de.strong=function(P){return"<strong>"+P+"</strong>"},de.em=function(P){return"<em>"+P+"</em>"},de.codespan=function(P){return"<code>"+P+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(P){return"<del>"+P+"</del>"},de.link=function(P,G,Q){if(P=Fe(this.options.sanitize,this.options.baseUrl,P),P===null)return Q;var re='<a href="'+$(P)+'"';return G&&(re+=' title="'+G+'"'),re+=">"+Q+"</a>",re},de.image=function(P,G,Q){if(P=Fe(this.options.sanitize,this.options.baseUrl,P),P===null)return Q;var re='<img src="'+P+'" alt="'+Q+'"';return G&&(re+=' title="'+G+'"'),re+=this.options.xhtml?"/>":">",re},de.text=function(P){return P},ge}(),Se=function(){function ge(){}var de=ge.prototype;return de.strong=function(P){return P},de.em=function(P){return P},de.codespan=function(P){return P},de.del=function(P){return P},de.html=function(P){return P},de.text=function(P){return P},de.link=function(P,G,Q){return""+Q},de.image=function(P,G,Q){return""+Q},de.br=function(){return""},ge}(),Ie=function(){function ge(){this.seen={}}var de=ge.prototype;return de.serialize=function(P){return P.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},de.getNextSafeSlug=function(P,G){var Q=P,re=0;if(this.seen.hasOwnProperty(Q)){re=this.seen[P];do re++,Q=P+"-"+re;while(this.seen.hasOwnProperty(Q))}return G||(this.seen[P]=re,this.seen[Q]=0),Q},de.slug=function(P,G){G===void 0&&(G={});var Q=this.serialize(P);return this.getNextSafeSlug(Q,G.dryrun)},ge}(),Oe=se,Ve=Se,ut=Ie,He=oe.exports.defaults,Ye=K.unescape,We=function(){function ge(pe){this.options=pe||He,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ve,this.slugger=new ut}ge.parse=function(P,G){var Q=new ge(G);return Q.parse(P)},ge.parseInline=function(P,G){var Q=new ge(G);return Q.parseInline(P)};var de=ge.prototype;return de.parse=function(P,G){G===void 0&&(G=!0);var Q="",re,ce,tt,it,ot,gt,kt,Ut,Bt,bt,rn,fn,en,Qt,st,je,dt,Ft,Wt=P.length;for(re=0;re<Wt;re++)switch(bt=P[re],bt.type){case"space":continue;case"hr":{Q+=this.renderer.hr();continue}case"heading":{Q+=this.renderer.heading(this.parseInline(bt.tokens),bt.depth,Ye(this.parseInline(bt.tokens,this.textRenderer)),this.slugger);continue}case"code":{Q+=this.renderer.code(bt.text,bt.lang,bt.escaped);continue}case"table":{for(Ut="",kt="",it=bt.header.length,ce=0;ce<it;ce++)kt+=this.renderer.tablecell(this.parseInline(bt.tokens.header[ce]),{header:!0,align:bt.align[ce]});for(Ut+=this.renderer.tablerow(kt),Bt="",it=bt.cells.length,ce=0;ce<it;ce++){for(gt=bt.tokens.cells[ce],kt="",ot=gt.length,tt=0;tt<ot;tt++)kt+=this.renderer.tablecell(this.parseInline(gt[tt]),{header:!1,align:bt.align[tt]});Bt+=this.renderer.tablerow(kt)}Q+=this.renderer.table(Ut,Bt);continue}case"blockquote":{Bt=this.parse(bt.tokens),Q+=this.renderer.blockquote(Bt);continue}case"list":{for(rn=bt.ordered,fn=bt.start,en=bt.loose,it=bt.items.length,Bt="",ce=0;ce<it;ce++)st=bt.items[ce],je=st.checked,dt=st.task,Qt="",st.task&&(Ft=this.renderer.checkbox(je),en?st.tokens.length>0&&st.tokens[0].type==="text"?(st.tokens[0].text=Ft+" "+st.tokens[0].text,st.tokens[0].tokens&&st.tokens[0].tokens.length>0&&st.tokens[0].tokens[0].type==="text"&&(st.tokens[0].tokens[0].text=Ft+" "+st.tokens[0].tokens[0].text)):st.tokens.unshift({type:"text",text:Ft}):Qt+=Ft),Qt+=this.parse(st.tokens,en),Bt+=this.renderer.listitem(Qt,dt,je);Q+=this.renderer.list(Bt,rn,fn);continue}case"html":{Q+=this.renderer.html(bt.text);continue}case"paragraph":{Q+=this.renderer.paragraph(this.parseInline(bt.tokens));continue}case"text":{for(Bt=bt.tokens?this.parseInline(bt.tokens):bt.text;re+1<Wt&&P[re+1].type==="text";)bt=P[++re],Bt+=`
`+(bt.tokens?this.parseInline(bt.tokens):bt.text);Q+=G?this.renderer.paragraph(Bt):Bt;continue}default:{var tn='Token with "'+bt.type+'" type was not found.';if(this.options.silent){console.error(tn);return}else throw new Error(tn)}}return Q},de.parseInline=function(P,G){G=G||this.renderer;var Q="",re,ce,tt=P.length;for(re=0;re<tt;re++)switch(ce=P[re],ce.type){case"escape":{Q+=G.text(ce.text);break}case"html":{Q+=G.html(ce.text);break}case"link":{Q+=G.link(ce.href,ce.title,this.parseInline(ce.tokens,G));break}case"image":{Q+=G.image(ce.href,ce.title,ce.text);break}case"strong":{Q+=G.strong(this.parseInline(ce.tokens,G));break}case"em":{Q+=G.em(this.parseInline(ce.tokens,G));break}case"codespan":{Q+=G.codespan(ce.text);break}case"br":{Q+=G.br();break}case"del":{Q+=G.del(this.parseInline(ce.tokens,G));break}case"text":{Q+=G.text(ce.text);break}default:{var it='Token with "'+ce.type+'" type was not found.';if(this.options.silent){console.error(it);return}else throw new Error(it)}}return Q},ge}(),ht=xe,ft=We,rt=Ce,ve=se,at=Se,Xe=Ie,Ke=K.merge,pt=K.checkSanitizeDeprecation,Et=K.escape,ct=oe.exports.getDefaults,Dt=oe.exports.changeDefaults,Gt=oe.exports.defaults;function lt(ge,de,pe){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof de=="function"&&(pe=de,de=null),de=Ke({},lt.defaults,de||{}),pt(de),pe){var P=de.highlight,G;try{G=ht.lex(ge,de)}catch(tt){return pe(tt)}var Q=function(it){var ot;if(!it)try{de.walkTokens&&lt.walkTokens(G,de.walkTokens),ot=ft.parse(G,de)}catch(gt){it=gt}return de.highlight=P,it?pe(it):pe(null,ot)};if(!P||P.length<3||(delete de.highlight,!G.length))return Q();var re=0;lt.walkTokens(G,function(tt){tt.type==="code"&&(re++,setTimeout(function(){P(tt.text,tt.lang,function(it,ot){if(it)return Q(it);ot!=null&&ot!==tt.text&&(tt.text=ot,tt.escaped=!0),re--,re===0&&Q()})},0))}),re===0&&Q();return}try{var ce=ht.lex(ge,de);return de.walkTokens&&lt.walkTokens(ce,de.walkTokens),ft.parse(ce,de)}catch(tt){if(tt.message+=`
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Et(tt.message+"",!0)+"</pre>";throw tt}}lt.options=lt.setOptions=function(ge){return Ke(lt.defaults,ge),Dt(lt.defaults),lt},lt.getDefaults=ct,lt.defaults=Gt,lt.use=function(ge){var de=Ke({},ge);if(ge.renderer&&function(){var P=lt.defaults.renderer||new ve,G=function(ce){var tt=P[ce];P[ce]=function(){for(var it=arguments.length,ot=new Array(it),gt=0;gt<it;gt++)ot[gt]=arguments[gt];var kt=ge.renderer[ce].apply(P,ot);return kt===!1&&(kt=tt.apply(P,ot)),kt}};for(var Q in ge.renderer)G(Q);de.renderer=P}(),ge.tokenizer&&function(){var P=lt.defaults.tokenizer||new rt,G=function(ce){var tt=P[ce];P[ce]=function(){for(var it=arguments.length,ot=new Array(it),gt=0;gt<it;gt++)ot[gt]=arguments[gt];var kt=ge.tokenizer[ce].apply(P,ot);return kt===!1&&(kt=tt.apply(P,ot)),kt}};for(var Q in ge.tokenizer)G(Q);de.tokenizer=P}(),ge.walkTokens){var pe=lt.defaults.walkTokens;de.walkTokens=function(P){ge.walkTokens(P),pe&&pe(P)}}lt.setOptions(de)},lt.walkTokens=function(ge,de){for(var pe=ke(ge),P;!(P=pe()).done;){var G=P.value;switch(de(G),G.type){case"table":{for(var Q=ke(G.tokens.header),re;!(re=Q()).done;){var ce=re.value;lt.walkTokens(ce,de)}for(var tt=ke(G.tokens.cells),it;!(it=tt()).done;)for(var ot=it.value,gt=ke(ot),kt;!(kt=gt()).done;){var Ut=kt.value;lt.walkTokens(Ut,de)}break}case"list":{lt.walkTokens(G.items,de);break}default:G.tokens&&lt.walkTokens(G.tokens,de)}}},lt.parseInline=function(ge,de){if(typeof ge=="undefined"||ge===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");de=Ke({},lt.defaults,de||{}),pt(de);try{var pe=ht.lexInline(ge,de);return de.walkTokens&&lt.walkTokens(pe,de.walkTokens),ft.parseInline(pe,de)}catch(P){if(P.message+=`
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Et(P.message+"",!0)+"</pre>";throw P}},lt.Parser=ft,lt.parser=ft.parse,lt.Renderer=ve,lt.TextRenderer=at,lt.Lexer=ht,lt.lexer=ht.lex,lt.Tokenizer=rt,lt.Slugger=Xe,lt.parse=lt;var Tt=lt;return Tt})},11690:function(Rt){const nt=/[&<>"']/,W=/[&<>"']/g,T=/[<>"']|&(?!#?\w+;)/,fe=/[<>"']|&(?!#?\w+;)/g,ke={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},oe=ee=>ke[ee];function H(ee,X){if(X){if(nt.test(ee))return ee.replace(W,oe)}else if(T.test(ee))return ee.replace(fe,oe);return ee}const p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ae(ee){return ee.replace(p,(X,_e)=>(_e=_e.toLowerCase(),_e==="colon"?":":_e.charAt(0)==="#"?_e.charAt(1)==="x"?String.fromCharCode(parseInt(_e.substring(2),16)):String.fromCharCode(+_e.substring(1)):""))}const te=/(^|[^\[])\^/g;function l(ee,X){ee=ee.source||ee,X=X||"";const _e={replace:(ye,Ge)=>(Ge=Ge.source||Ge,Ge=Ge.replace(te,"$1"),ee=ee.replace(ye,Ge),_e),getRegex:()=>new RegExp(ee,X)};return _e}const M=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function g(ee,X,_e){if(ee){let ye;try{ye=decodeURIComponent(ae(_e)).replace(M,"").toLowerCase()}catch(Ge){return null}if(ye.indexOf("javascript:")===0||ye.indexOf("vbscript:")===0||ye.indexOf("data:")===0)return null}X&&!A.test(_e)&&(_e=L(X,_e));try{_e=encodeURI(_e).replace(/%25/g,"%")}catch(ye){return null}return _e}const b={},m=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,C=/^([^:]+:\/*[^/]*)[\s\S]*$/;function L(ee,X){b[" "+ee]||(m.test(ee)?b[" "+ee]=ee+"/":b[" "+ee]=N(ee,"/",!0)),ee=b[" "+ee];const _e=ee.indexOf(":")===-1;return X.substring(0,2)==="//"?_e?X:ee.replace(x,"$1")+X:X.charAt(0)==="/"?_e?X:ee.replace(C,"$1")+X:ee+X}const F={exec:function(){}};function w(ee){let X=1,_e,ye;for(;X<arguments.length;X++){_e=arguments[X];for(ye in _e)Object.prototype.hasOwnProperty.call(_e,ye)&&(ee[ye]=_e[ye])}return ee}function k(ee,X){const _e=ee.replace(/\|/g,(U,R,O)=>{let K=!1,j=R;for(;--j>=0&&O[j]==="\\";)K=!K;return K?"|":" |"}),ye=_e.split(/ \|/);let Ge=0;if(ye.length>X)ye.splice(X);else for(;ye.length<X;)ye.push("");for(;Ge<ye.length;Ge++)ye[Ge]=ye[Ge].trim().replace(/\\\|/g,"|");return ye}function N(ee,X,_e){const ye=ee.length;if(ye===0)return"";let Ge=0;for(;Ge<ye;){const U=ee.charAt(ye-Ge-1);if(U===X&&!_e)Ge++;else if(U!==X&&_e)Ge++;else break}return ee.substr(0,ye-Ge)}function V(ee,X){if(ee.indexOf(X[1])===-1)return-1;const _e=ee.length;let ye=0,Ge=0;for(;Ge<_e;Ge++)if(ee[Ge]==="\\")Ge++;else if(ee[Ge]===X[0])ye++;else if(ee[Ge]===X[1]&&(ye--,ye<0))return Ge;return-1}function q(ee){ee&&ee.sanitize&&!ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function le(ee,X){if(X<1)return"";let _e="";for(;X>1;)X&1&&(_e+=ee),X>>=1,ee+=ee;return _e+ee}Rt.exports={escape:H,unescape:ae,edit:l,cleanUrl:g,resolveUrl:L,noopTest:F,merge:w,splitCells:k,rtrim:N,findClosingBracket:V,checkSanitizeDeprecation:q,repeatString:le}},75918:function(Rt,nt,W){"use strict";W.d(nt,{Wi:function(){return p},Z0:function(){return ae},aU:function(){return H},eZ:function(){return l},wY:function(){return te}});var T=W(4348),fe=W(69323),ke=W(13268),oe=function(M,A,g,b){function m(x){return x instanceof g?x:new g(function(C){C(x)})}return new(g||(g=Promise))(function(x,C){function L(k){try{w(b.next(k))}catch(N){C(N)}}function F(k){try{w(b.throw(k))}catch(N){C(N)}}function w(k){k.done?x(k.value):m(k.value).then(L,F)}w((b=b.apply(M,A||[])).next())})};class H extends fe.JT{constructor(A,g="",b="",m=!0,x){super(),this._onDidChange=this._register(new T.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=A,this._label=g,this._cssClass=b,this._enabled=m,this._actionCallback=x}get id(){return this._id}get label(){return this._label}set label(A){this._setLabel(A)}_setLabel(A){this._label!==A&&(this._label=A,this._onDidChange.fire({label:A}))}get tooltip(){return this._tooltip||""}set tooltip(A){this._setTooltip(A)}_setTooltip(A){this._tooltip!==A&&(this._tooltip=A,this._onDidChange.fire({tooltip:A}))}get class(){return this._cssClass}set class(A){this._setClass(A)}_setClass(A){this._cssClass!==A&&(this._cssClass=A,this._onDidChange.fire({class:A}))}get enabled(){return this._enabled}set enabled(A){this._setEnabled(A)}_setEnabled(A){this._enabled!==A&&(this._enabled=A,this._onDidChange.fire({enabled:A}))}get checked(){return this._checked}set checked(A){this._setChecked(A)}_setChecked(A){this._checked!==A&&(this._checked=A,this._onDidChange.fire({checked:A}))}run(A,g){return oe(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(A))})}}class p extends fe.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new T.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new T.Q5),this.onDidRun=this._onDidRun.event}run(A,g){return oe(this,void 0,void 0,function*(){if(!A.enabled)return;this._onBeforeRun.fire({action:A});let b;try{yield this.runAction(A,g)}catch(m){b=m}this._onDidRun.fire({action:A,error:b})})}runAction(A,g){return oe(this,void 0,void 0,function*(){yield A.run(g)})}}class ae extends H{constructor(A){super(ae.ID,A,A?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ae.ID="vs.actions.separator";class te{constructor(A,g,b,m){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=A,this.label=g,this.class=m,this._actions=b}get actions(){return this._actions}dispose(){}run(){return oe(this,void 0,void 0,function*(){})}}class l extends H{constructor(){super(l.ID,ke.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Rt,nt,W){"use strict";W.d(nt,{ok:function(){return T}});function T(fe,ke){if(!fe)throw new Error(ke?`Assertion failed (${ke})`:"Assertion Failed")}},52615:function(Rt,nt,W){"use strict";W.d(nt,{CM:function(){return H},JL:function(){return p},dT:function(){return te},fK:function(){return oe},lA:function(){return ae}});var T=W(4348);class fe{constructor(){this._icons=new Map,this._onDidRegister=new T.Q5}add(M){const A=this._icons.get(M.id);A?M.description?A.description=M.description:console.error(`Duplicate registration of codicon ${M.id}`):(this._icons.set(M.id,M),this._onDidRegister.fire(M))}get(M){return this._icons.get(M)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const ke=new fe,oe=ke;function H(l,M){return new ae(l,M)}function p(l){return l?l.replace(/\$\((.*?)\)/g,(M,A)=>` ${A} `).trim():""}class ae{constructor(M,A,g){this.id=M,this.definition=A,this.description=g,ke.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var te;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const M=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function A(m){if(m instanceof ae)return["codicon","codicon-"+m.id];const x=M.exec(m.id);if(!x)return A(ae.error);let[,C,L]=x;const F=["codicon","codicon-"+C];return L&&F.push("codicon-modifier-"+L.substr(1)),F}l.asClassNameArray=A;function g(m){return A(m).join(" ")}l.asClassName=g;function b(m){return"."+A(m).join(".")}l.asCSSSelector=b})(te||(te={})),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"})}(ae||(ae={}))},79881:function(Rt,nt,W){"use strict";W.d(nt,{B8:function(){return A},Cp:function(){return oe},F0:function(){return te},L6:function(){return M},VV:function(){return ae},b1:function(){return l},dL:function(){return ke},ri:function(){return H}});class T{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(b){setTimeout(()=>{throw b.stack?new Error(b.message+`
`+b.stack):b},0)}}emit(b){this.listeners.forEach(m=>{m(b)})}onUnexpectedError(b){this.unexpectedErrorHandler(b),this.emit(b)}onUnexpectedExternalError(b){this.unexpectedErrorHandler(b)}}const fe=new T;function ke(g){ae(g)||fe.onUnexpectedError(g)}function oe(g){ae(g)||fe.onUnexpectedExternalError(g)}function H(g){if(g instanceof Error){let{name:b,message:m}=g;const x=g.stacktrace||g.stack;return{$isError:!0,name:b,message:m,stack:x}}return g}const p="Canceled";function ae(g){return g instanceof Error&&g.name===p&&g.message===p}function te(){const g=new Error(p);return g.name=g.message,g}function l(g){return g?new Error(`Illegal argument: ${g}`):new Error("Illegal argument")}function M(g){return g?new Error(`Illegal state: ${g}`):new Error("Illegal state")}class A extends Error{constructor(b){super("NotSupported"),b&&(this.message=b)}}},4348:function(Rt,nt,W){"use strict";W.d(nt,{D0:function(){return A},E7:function(){return g},K3:function(){return M},Q5:function(){return l},ZD:function(){return b},ju:function(){return H}});var T=W(79881),fe=W(69323),ke=W(34502),oe=W(95830),H;(function(m){m.None=()=>fe.JT.None;function x(O){return(K,j=null,z)=>{let y=!1,_;return _=O(I=>{if(!y)return _?_.dispose():y=!0,K.call(j,I)},null,z),y&&_.dispose(),_}}m.once=x;function C(O,K){return V((j,z=null,y)=>O(_=>j.call(z,K(_)),null,y))}m.map=C;function L(O,K){return V((j,z=null,y)=>O(_=>{K(_),j.call(z,_)},null,y))}m.forEach=L;function F(O,K){return V((j,z=null,y)=>O(_=>K(_)&&j.call(z,_),null,y))}m.filter=F;function w(O){return O}m.signal=w;function k(...O){return(K,j=null,z)=>(0,fe.F8)(...O.map(y=>y(_=>K.call(j,_),null,z)))}m.any=k;function N(O,K,j){let z=j;return C(O,y=>(z=K(z,y),z))}m.reduce=N;function V(O){let K;const j=new l({onFirstListenerAdd(){K=O(j.fire,j)},onLastListenerRemove(){K.dispose()}});return j.event}function q(O,K,j=100,z=!1,y){let _,I,Z,Ee=0;const Ce=new l({leakWarningThreshold:y,onFirstListenerAdd(){_=O(Ue=>{Ee++,I=K(I,Ue),z&&!Z&&(Ce.fire(I),I=void 0),clearTimeout(Z),Z=setTimeout(()=>{const Be=I;I=void 0,Z=void 0,(!z||Ee>1)&&Ce.fire(Be),Ee=0},j)})},onLastListenerRemove(){_.dispose()}});return Ce.event}m.debounce=q;function le(O,K=(j,z)=>j===z){let j=!0,z;return F(O,y=>{const _=j||!K(y,z);return j=!1,z=y,_})}m.latch=le;function ee(O,K){return[m.filter(O,K),m.filter(O,j=>!K(j))]}m.split=ee;function X(O,K=!1,j=[]){let z=j.slice(),y=O(Z=>{z?z.push(Z):I.fire(Z)});const _=()=>{z&&z.forEach(Z=>I.fire(Z)),z=null},I=new l({onFirstListenerAdd(){y||(y=O(Z=>I.fire(Z)))},onFirstListenerDidAdd(){z&&(K?setTimeout(_):_())},onLastListenerRemove(){y&&y.dispose(),y=null}});return I.event}m.buffer=X;class _e{constructor(K){this.event=K}map(K){return new _e(C(this.event,K))}forEach(K){return new _e(L(this.event,K))}filter(K){return new _e(F(this.event,K))}reduce(K,j){return new _e(N(this.event,K,j))}latch(){return new _e(le(this.event))}debounce(K,j=100,z=!1,y){return new _e(q(this.event,K,j,z,y))}on(K,j,z){return this.event(K,j,z)}once(K,j,z){return x(this.event)(K,j,z)}}function ye(O){return new _e(O)}m.chain=ye;function Ge(O,K,j=z=>z){const z=(...Z)=>I.fire(j(...Z)),y=()=>O.on(K,z),_=()=>O.removeListener(K,z),I=new l({onFirstListenerAdd:y,onLastListenerRemove:_});return I.event}m.fromNodeEventEmitter=Ge;function U(O,K,j=z=>z){const z=(...Z)=>I.fire(j(...Z)),y=()=>O.addEventListener(K,z),_=()=>O.removeEventListener(K,z),I=new l({onFirstListenerAdd:y,onLastListenerRemove:_});return I.event}m.fromDOMEventEmitter=U;function R(O){return new Promise(K=>x(O)(K))}m.toPromise=R})(H||(H={}));class p{constructor(x){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${x}_${p._idPool++}`}start(x){this._stopWatch=new oe.G(!0),this._listenerCount=x}stop(){if(this._stopWatch){const x=this._stopWatch.elapsed();this._elapsedOverall+=x,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${x.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let ae=-1;class te{constructor(x,C=Math.random().toString(18).slice(2,5)){this.customThreshold=x,this.name=C,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(x){let C=ae;if(typeof this.customThreshold=="number"&&(C=this.customThreshold),C<=0||x<C)return;this._stacks||(this._stacks=new Map);const L=new Error().stack.split(`
`).slice(3).join(`
`),F=this._stacks.get(L)||0;if(this._stacks.set(L,F+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=C*.5;let w,k=0;for(const[N,V]of this._stacks)(!w||k<V)&&(w=N,k=V);console.warn(`[${this.name}] potential listener LEAK detected, having ${x} listeners already. MOST frequent listener (${k}):`),console.warn(w)}return()=>{const w=this._stacks.get(L)||0;this._stacks.set(L,w-1)}}}class l{constructor(x){var C;this._disposed=!1,this._options=x,this._leakageMon=ae>0?new te(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((C=this._options)===null||C===void 0)&&C._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(x,C,L)=>{var F;this._listeners||(this._listeners=new ke.S);const w=this._listeners.isEmpty();w&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const k=this._listeners.push(C?[x,C]:x);w&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,x,C);const N=(F=this._leakageMon)===null||F===void 0?void 0:F.check(this._listeners.size),V=(0,fe.OF)(()=>{N&&N(),this._disposed||(k(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return L instanceof fe.SL?L.add(V):Array.isArray(L)&&L.push(V),V}),this._event}fire(x){var C,L;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new ke.S);for(let F of this._listeners)this._deliveryQueue.push([F,x]);for((C=this._perfMon)===null||C===void 0||C.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(k){(0,T.dL)(k)}}(L=this._perfMon)===null||L===void 0||L.stop()}}dispose(){var x,C,L,F,w;this._disposed||(this._disposed=!0,(x=this._listeners)===null||x===void 0||x.clear(),(C=this._deliveryQueue)===null||C===void 0||C.clear(),(F=(L=this._options)===null||L===void 0?void 0:L.onLastListenerRemove)===null||F===void 0||F.call(L),(w=this._leakageMon)===null||w===void 0||w.dispose())}}class M extends l{constructor(x){super(x),this._isPaused=0,this._eventQueue=new ke.S,this._mergeFn=x==null?void 0:x.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const x=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(x))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(x){this._listeners&&(this._isPaused!==0?this._eventQueue.push(x):super.fire(x))}}class A extends M{constructor(x){var C;super(x),this._delay=(C=x.delay)!==null&&C!==void 0?C:100}fire(x){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(x)}}class g{constructor(){this.buffers=[]}wrapEvent(x){return(C,L,F)=>x(w=>{const k=this.buffers[this.buffers.length-1];k?k.push(()=>C.call(L,w)):C.call(L,w)},void 0,F)}bufferEvents(x){const C=[];this.buffers.push(C);const L=x();return this.buffers.pop(),C.forEach(F=>F()),L}}class b{constructor(){this.listening=!1,this.inputEvent=H.None,this.inputEventListener=fe.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(x){this.inputEvent=x,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=x(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Rt,nt,W){"use strict";W.d(nt,{I:function(){return T}});function T(fe){const ke=this;let oe=!1,H;return function(){return oe||(oe=!0,H=fe.apply(ke,arguments)),H}}},88226:function(Rt,nt,W){"use strict";W.d(nt,{$:function(){return T}});var T;(function(fe){function ke(k){return k&&typeof k=="object"&&typeof k[Symbol.iterator]=="function"}fe.is=ke;const oe=Object.freeze([]);function H(){return oe}fe.empty=H;function*p(k){yield k}fe.single=p;function ae(k){return k||oe}fe.from=ae;function te(k){return!k||k[Symbol.iterator]().next().done===!0}fe.isEmpty=te;function l(k){return k[Symbol.iterator]().next().value}fe.first=l;function M(k,N){for(const V of k)if(N(V))return!0;return!1}fe.some=M;function A(k,N){for(const V of k)if(N(V))return V}fe.find=A;function*g(k,N){for(const V of k)N(V)&&(yield V)}fe.filter=g;function*b(k,N){let V=0;for(const q of k)yield N(q,V++)}fe.map=b;function*m(...k){for(const N of k)for(const V of N)yield V}fe.concat=m;function*x(k){for(const N of k)for(const V of N)yield V}fe.concatNested=x;function C(k,N,V){let q=V;for(const le of k)q=N(q,le);return q}fe.reduce=C;function*L(k,N,V=k.length){for(N<0&&(N+=k.length),V<0?V+=k.length:V>k.length&&(V=k.length);N<V;N++)yield k[N]}fe.slice=L;function F(k,N=Number.POSITIVE_INFINITY){const V=[];if(N===0)return[V,k];const q=k[Symbol.iterator]();for(let le=0;le<N;le++){const ee=q.next();if(ee.done)return[V,fe.empty()];V.push(ee.value)}return[V,{[Symbol.iterator](){return q}}]}fe.consume=F;function w(k,N,V=(q,le)=>q===le){const q=k[Symbol.iterator](),le=N[Symbol.iterator]();for(;;){const ee=q.next(),X=le.next();if(ee.done!==X.done)return!1;if(ee.done)return!0;if(!V(ee.value,X.value))return!1}}fe.equals=w})(T||(T={}))},69323:function(Rt,nt,W){"use strict";W.d(nt,{B9:function(){return b},F8:function(){return m},JT:function(){return L},Jz:function(){return w},OF:function(){return x},SL:function(){return C},Wf:function(){return g},XK:function(){return F},dk:function(){return M}});var T=W(17845),fe=W(88226);const ke=!1;let oe=null;function H(k){oe=k}if(ke){const k="__is_disposable_tracked__";H(new class{trackDisposable(N){const V=new Error("Potentially leaked disposable").stack;setTimeout(()=>{N[k]||console.log(V)},3e3)}setParent(N,V){if(N&&N!==L.None)try{N[k]=!0}catch(q){}}markAsDisposed(N){if(N&&N!==L.None)try{N[k]=!0}catch(V){}}markAsSingleton(N){}})}function p(k){return oe==null||oe.trackDisposable(k),k}function ae(k){oe==null||oe.markAsDisposed(k)}function te(k,N){oe==null||oe.setParent(k,N)}function l(k,N){if(oe)for(const V of k)oe.setParent(V,N)}function M(k){return oe==null||oe.markAsSingleton(k),k}class A extends Error{constructor(N){super(`Encountered errors while disposing of store. Errors: [${N.join(", ")}]`),this.errors=N}}function g(k){return typeof k.dispose=="function"&&k.dispose.length===0}function b(k){if(fe.$.is(k)){let N=[];for(const V of k)if(V)try{V.dispose()}catch(q){N.push(q)}if(N.length===1)throw N[0];if(N.length>1)throw new A(N);return Array.isArray(k)?[]:k}else if(k)return k.dispose(),k}function m(...k){const N=x(()=>b(k));return l(k,N),N}function x(k){const N=p({dispose:(0,T.I)(()=>{ae(N),k()})});return N}class C{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(ae(this),this._isDisposed=!0,this.clear())}clear(){try{b(this._toDispose.values())}finally{this._toDispose.clear()}}add(N){if(!N)return N;if(N===this)throw new Error("Cannot register a disposable on itself!");return te(N,this),this._isDisposed?C.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(N),N}}C.DISABLE_DISPOSED_WARNING=!1;class L{constructor(){this._store=new C,p(this),te(this._store,this)}dispose(){ae(this),this._store.dispose()}_register(N){if(N===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(N)}}L.None=Object.freeze({dispose(){}});class F{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(N){var V;this._isDisposed||N===this._value||((V=this._value)===null||V===void 0||V.dispose(),N&&te(N,this),this._value=N)}clear(){this.value=void 0}dispose(){var N;this._isDisposed=!0,ae(this),(N=this._value)===null||N===void 0||N.dispose(),this._value=void 0}clearAndLeak(){const N=this._value;return this._value=void 0,N&&te(N,null),N}}class w{constructor(N){this.object=N}dispose(){}}},34502:function(Rt,nt,W){"use strict";W.d(nt,{S:function(){return fe}});class T{constructor(oe){this.element=oe,this.next=T.Undefined,this.prev=T.Undefined}}T.Undefined=new T(void 0);class fe{constructor(){this._first=T.Undefined,this._last=T.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===T.Undefined}clear(){let oe=this._first;for(;oe!==T.Undefined;){const H=oe.next;oe.prev=T.Undefined,oe.next=T.Undefined,oe=H}this._first=T.Undefined,this._last=T.Undefined,this._size=0}unshift(oe){return this._insert(oe,!1)}push(oe){return this._insert(oe,!0)}_insert(oe,H){const p=new T(oe);if(this._first===T.Undefined)this._first=p,this._last=p;else if(H){const te=this._last;this._last=p,p.prev=te,te.next=p}else{const te=this._first;this._first=p,p.next=te,te.prev=p}this._size+=1;let ae=!1;return()=>{ae||(ae=!0,this._remove(p))}}shift(){if(this._first!==T.Undefined){const oe=this._first.element;return this._remove(this._first),oe}}pop(){if(this._last!==T.Undefined){const oe=this._last.element;return this._remove(this._last),oe}}_remove(oe){if(oe.prev!==T.Undefined&&oe.next!==T.Undefined){const H=oe.prev;H.next=oe.next,oe.next.prev=H}else oe.prev===T.Undefined&&oe.next===T.Undefined?(this._first=T.Undefined,this._last=T.Undefined):oe.next===T.Undefined?(this._last=this._last.prev,this._last.next=T.Undefined):oe.prev===T.Undefined&&(this._first=this._first.next,this._first.prev=T.Undefined);this._size-=1}*[Symbol.iterator](){let oe=this._first;for(;oe!==T.Undefined;)yield oe.element,oe=oe.next}}},23345:function(Rt,nt,W){"use strict";W.d(nt,{$L:function(){return q},ED:function(){return w},IJ:function(){return N},OS:function(){return _e},WE:function(){return ee},dz:function(){return k},gn:function(){return le},li:function(){return x},r:function(){return U},tY:function(){return V},xS:function(){return X}});var T=W(97671),fe;const ke="en";let oe=!1,H=!1,p=!1,ae=!1,te=!1,l=!1,M=!1,A,g=null,b=null,m;const x=typeof self=="object"?self:typeof W.g=="object"?W.g:{};let C;typeof x.vscode!="undefined"&&typeof x.vscode.process!="undefined"?C=x.vscode.process:typeof T!="undefined"&&(C=T);const L=typeof((fe=C==null?void 0:C.versions)===null||fe===void 0?void 0:fe.electron)=="string"&&C.type==="renderer";if(typeof navigator=="object"&&!L)m=navigator.userAgent,oe=m.indexOf("Windows")>=0,H=m.indexOf("Macintosh")>=0,M=(m.indexOf("Macintosh")>=0||m.indexOf("iPad")>=0||m.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=m.indexOf("Linux")>=0,l=!0,A=navigator.language,g=A;else if(typeof C=="object"){oe=C.platform==="win32",H=C.platform==="darwin",p=C.platform==="linux",ae=p&&!!C.env.SNAP&&!!C.env.SNAP_REVISION,A=ke,g=ke;const R=C.env.VSCODE_NLS_CONFIG;if(R)try{const O=JSON.parse(R),K=O.availableLanguages["*"];A=O.locale,g=K||ke,b=O._translationsConfigFile}catch(O){}te=!0}else console.error("Unable to resolve platform.");let F=0;H?F=1:oe?F=3:p&&(F=2);const w=oe,k=H,N=p,V=te,q=l,le=M,ee=m,X=function(){if(x.setImmediate)return x.setImmediate.bind(x);if(typeof x.postMessage=="function"&&!x.importScripts){let K=[];x.addEventListener("message",z=>{if(z.data&&z.data.vscodeSetImmediateId)for(let y=0,_=K.length;y<_;y++){const I=K[y];if(I.id===z.data.vscodeSetImmediateId){K.splice(y,1),I.callback();return}}});let j=0;return z=>{const y=++j;K.push({id:y,callback:z}),x.postMessage({vscodeSetImmediateId:y},"*")}}if(typeof(C==null?void 0:C.nextTick)=="function")return C.nextTick.bind(C);const O=Promise.resolve();return K=>O.then(K)}(),_e=H||M?2:oe?1:3;let ye=!0,Ge=!1;function U(){if(!Ge){Ge=!0;const R=new Uint8Array(2);R[0]=1,R[1]=2,ye=new Uint16Array(R.buffer)[0]===513}return ye}},95830:function(Rt,nt,W){"use strict";W.d(nt,{G:function(){return ke}});var T=W(23345);const fe=T.li.performance&&typeof T.li.performance.now=="function";class ke{constructor(H){this._highResolution=fe&&H,this._startTime=this._now(),this._stopTime=-1}static create(H=!0){return new ke(H)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?T.li.performance.now():Date.now()}}},82983:function(Rt,nt,W){"use strict";W.d(nt,{$i:function(){return Ee},C8:function(){return et},GF:function(){return A},HO:function(){return j},IO:function(){return g},K7:function(){return Ze},Kw:function(){return he},LC:function(){return x},Mh:function(){return X},P1:function(){return _e},PJ:function(){return we},Qe:function(){return Ce},R1:function(){return M},RP:function(){return I},S6:function(){return Ae},TT:function(){return w},Ut:function(){return y},V8:function(){return C},WU:function(){return ke},YK:function(){return Ge},YU:function(){return oe},ZG:function(){return ye},ZH:function(){return R},ab:function(){return Ue},c1:function(){return $e},df:function(){return q},ec:function(){return H},fi:function(){return qe},fy:function(){return p},j3:function(){return ae},j_:function(){return N},m5:function(){return T},mK:function(){return V},mr:function(){return b},oH:function(){return Y},oL:function(){return te},ok:function(){return ee},ow:function(){return L},qq:function(){return le},qu:function(){return F},rL:function(){return U},uS:function(){return be},un:function(){return l},uq:function(){return m},vH:function(){return K},xe:function(){return Be},zY:function(){return k}});function T($){return!$||typeof $!="string"?!0:$.trim().length===0}const fe=/{(\d+)}/g;function ke($,...se){return se.length===0?$:$.replace(fe,function(Se,Ie){const Oe=parseInt(Ie,10);return isNaN(Oe)||Oe<0||Oe>=se.length?Se:se[Oe]})}function oe($){return $.replace(/[<>&]/g,function(se){switch(se){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return se}})}function H($){return $.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p($,se=" "){const Se=ae($,se);return te(Se,se)}function ae($,se){if(!$||!se)return $;const Se=se.length;if(Se===0||$.length===0)return $;let Ie=0;for(;$.indexOf(se,Ie)===Ie;)Ie=Ie+Se;return $.substring(Ie)}function te($,se){if(!$||!se)return $;const Se=se.length,Ie=$.length;if(Se===0||Ie===0)return $;let Oe=Ie,Ve=-1;for(;Ve=$.lastIndexOf(se,Oe-1),!(Ve===-1||Ve+Se!==Oe);){if(Ve===0)return"";Oe=Ve}return $.substring(0,Oe)}function l($){return $.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function M($){return $.replace(/\*/g,"")}function A($,se,Se={}){if(!$)throw new Error("Cannot create regex from empty string");se||($=H($)),Se.wholeWord&&(/\B/.test($.charAt(0))||($="\\b"+$),/\B/.test($.charAt($.length-1))||($=$+"\\b"));let Ie="";return Se.global&&(Ie+="g"),Se.matchCase||(Ie+="i"),Se.multiline&&(Ie+="m"),Se.unicode&&(Ie+="u"),new RegExp($,Ie)}function g($){return $.source==="^"||$.source==="^$"||$.source==="$"||$.source==="^\\s*$"?!1:!!($.exec("")&&$.lastIndex===0)}function b($){return($.global?"g":"")+($.ignoreCase?"i":"")+($.multiline?"m":"")+($.unicode?"u":"")}function m($){return $.split(/\r\n|\r|\n/)}function x($){for(let se=0,Se=$.length;se<Se;se++){const Ie=$.charCodeAt(se);if(Ie!==32&&Ie!==9)return se}return-1}function C($,se=0,Se=$.length){for(let Ie=se;Ie<Se;Ie++){const Oe=$.charCodeAt(Ie);if(Oe!==32&&Oe!==9)return $.substring(se,Ie)}return $.substring(se,Se)}function L($,se=$.length-1){for(let Se=se;Se>=0;Se--){const Ie=$.charCodeAt(Se);if(Ie!==32&&Ie!==9)return Se}return-1}function F($,se){return $<se?-1:$>se?1:0}function w($,se,Se=0,Ie=$.length,Oe=0,Ve=se.length){for(;Se<Ie&&Oe<Ve;Se++,Oe++){let Ye=$.charCodeAt(Se),We=se.charCodeAt(Oe);if(Ye<We)return-1;if(Ye>We)return 1}const ut=Ie-Se,He=Ve-Oe;return ut<He?-1:ut>He?1:0}function k($,se){return N($,se,0,$.length,0,se.length)}function N($,se,Se=0,Ie=$.length,Oe=0,Ve=se.length){for(;Se<Ie&&Oe<Ve;Se++,Oe++){let Ye=$.charCodeAt(Se),We=se.charCodeAt(Oe);if(Ye===We)continue;if(Ye>=128||We>=128)return w($.toLowerCase(),se.toLowerCase(),Se,Ie,Oe,Ve);V(Ye)&&(Ye-=32),V(We)&&(We-=32);const ht=Ye-We;if(ht!==0)return ht}const ut=Ie-Se,He=Ve-Oe;return ut<He?-1:ut>He?1:0}function V($){return $>=97&&$<=122}function q($){return $>=65&&$<=90}function le($,se){return $.length===se.length&&N($,se)===0}function ee($,se){const Se=se.length;return se.length>$.length?!1:N($,se,0,Se)===0}function X($,se){let Se,Ie=Math.min($.length,se.length);for(Se=0;Se<Ie;Se++)if($.charCodeAt(Se)!==se.charCodeAt(Se))return Se;return Ie}function _e($,se){let Se,Ie=Math.min($.length,se.length);const Oe=$.length-1,Ve=se.length-1;for(Se=0;Se<Ie;Se++)if($.charCodeAt(Oe-Se)!==se.charCodeAt(Ve-Se))return Se;return Ie}function ye($){return 55296<=$&&$<=56319}function Ge($){return 56320<=$&&$<=57343}function U($,se){return($-55296<<10)+(se-56320)+65536}function R($,se,Se){const Ie=$.charCodeAt(Se);if(ye(Ie)&&Se+1<se){const Oe=$.charCodeAt(Se+1);if(Ge(Oe))return U(Ie,Oe)}return Ie}function O($,se){const Se=$.charCodeAt(se-1);if(Ge(Se)&&se>1){const Ie=$.charCodeAt(se-2);if(ye(Ie))return U(Ie,Se)}return Se}function K($,se){const Se=ie.getInstance(),Ie=se,Oe=$.length,Ve=R($,Oe,se);se+=Ve>=65536?2:1;let ut=Se.getGraphemeBreakType(Ve);for(;se<Oe;){const He=R($,Oe,se),Ye=Se.getGraphemeBreakType(He);if(qe(ut,Ye))break;se+=He>=65536?2:1,ut=Ye}return se-Ie}function j($,se){const Se=ie.getInstance(),Ie=se,Oe=O($,se);se-=Oe>=65536?2:1;let Ve=Se.getGraphemeBreakType(Oe);for(;se>0;){const ut=O($,se),He=Se.getGraphemeBreakType(ut);if(qe(He,Ve))break;se-=ut>=65536?2:1,Ve=He}return Ie-se}const z=/(?:[\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 y($){return z.test($)}const _=/(?:[\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 I($){return _.test($)}const Z=/^[\t\n\r\x20-\x7E]*$/;function Ee($){return Z.test($)}const Ce=/[\u2028\u2029]/;function Ue($){return Ce.test($)}function Be($){for(let se=0,Se=$.length;se<Se;se++)if(Ze($.charCodeAt(se)))return!0;return!1}function Ze($){return $=+$,$>=11904&&$<=55215||$>=63744&&$<=64255||$>=65281&&$<=65374}function et($){return $>=127462&&$<=127487||$===8986||$===8987||$===9200||$===9203||$>=9728&&$<=10175||$===11088||$===11093||$>=127744&&$<=128591||$>=128640&&$<=128764||$>=128992&&$<=129003||$>=129280&&$<=129535||$>=129648&&$<=129750}const $e="\uFEFF";function be($){return!!($&&$.length>0&&$.charCodeAt(0)===65279)}function he($,se=!1){return $?(se&&($=$.replace(/\\./g,"")),$.toLowerCase()!==$):!1}function we($){return $=$%(2*26),$<26?String.fromCharCode(97+$):String.fromCharCode(65+$-26)}function Ae($){return ie.getInstance().getGraphemeBreakType($)}function qe($,se){return $===0?se!==5&&se!==7:$===2&&se===3?!1:$===4||$===2||$===3||se===4||se===2||se===3?!0:!($===8&&(se===8||se===9||se===11||se===12)||($===11||$===9)&&(se===9||se===10)||($===12||$===10)&&se===10||se===5||se===13||se===7||$===1||$===13&&se===14||$===6&&se===6)}class ie{constructor(){this._data=ue()}static getInstance(){return ie._INSTANCE||(ie._INSTANCE=new ie),ie._INSTANCE}getGraphemeBreakType(se){if(se<32)return se===10?3:se===13?2:4;if(se<127)return 0;const Se=this._data,Ie=Se.length/3;let Oe=1;for(;Oe<=Ie;)if(se<Se[3*Oe])Oe=2*Oe;else if(se>Se[3*Oe+1])Oe=2*Oe+1;else return Se[3*Oe+2];return 0}}ie._INSTANCE=null;function ue(){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 Y($,se){if($===0)return 0;const Se=xe($,se);if(Se!==void 0)return Se;const Ie=O(se,$);return $-=Te(Ie),$}function xe($,se){let Se=O(se,$);for($-=Te(Se);Fe(Se)||Se===65039||Se===8419;){if($===0)return;Se=O(se,$),$-=Te(Se)}if(et(Se)){if($>=0){const Ie=O(se,$);Ie===8205&&($-=Te(Ie))}return $}}function Te($){return $>=65536?2:1}function Fe($){return 127995<=$&&$<=127999}},72999:function(Rt,nt,W){"use strict";W.d(nt,{$E:function(){return x},$K:function(){return ae},D8:function(){return g},HD:function(){return fe},IU:function(){return C},Jp:function(){return te},Kn:function(){return ke},cW:function(){return M},f6:function(){return L},hj:function(){return oe},jn:function(){return H},kJ:function(){return T},mf:function(){return A},o8:function(){return p},p_:function(){return l},vE:function(){return F}});function T(w){return Array.isArray(w)}function fe(w){return typeof w=="string"}function ke(w){return typeof w=="object"&&w!==null&&!Array.isArray(w)&&!(w instanceof RegExp)&&!(w instanceof Date)}function oe(w){return typeof w=="number"&&!isNaN(w)}function H(w){return w===!0||w===!1}function p(w){return typeof w=="undefined"}function ae(w){return!te(w)}function te(w){return p(w)||w===null}function l(w,k){if(!w)throw new Error(k?`Unexpected type, expected '${k}'`:"Unexpected type")}function M(w){if(te(w))throw new Error("Assertion Failed: argument is undefined or null");return w}function A(w){return typeof w=="function"}function g(w,k){const N=Math.min(w.length,k.length);for(let V=0;V<N;V++)b(w[V],k[V])}function b(w,k){if(fe(k)){if(typeof w!==k)throw new Error(`argument does not match constraint: typeof ${k}`)}else if(A(k)){try{if(w instanceof k)return}catch(N){}if(!te(w)&&w.constructor===k||k.length===1&&k.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 m(w){let k=[],N=Object.getPrototypeOf(w);for(;Object.prototype!==N;)k=k.concat(Object.getOwnPropertyNames(N)),N=Object.getPrototypeOf(N);return k}function x(w){const k=[];for(const N of m(w))typeof w[N]=="function"&&k.push(N);return k}function C(w,k){const N=q=>function(){const le=Array.prototype.slice.call(arguments,0);return k(q,le)};let V={};for(const q of w)V[q]=N(q);return V}function L(w){return w===null?void 0:w}function F(w,k="Unreachable"){throw new Error(k)}},13268:function(Rt,nt,W){"use strict";W.d(nt,{N:function(){return fe}});function T(ke,oe){let H;return oe.length===0?H=ke:H=ke.replace(/\{(\d+)\}/g,function(p,ae){const te=ae[0];return typeof oe[te]!="undefined"?oe[te]:p}),H}function fe(ke,oe,...H){return T(oe,H)}},96236:function(Rt,nt,W){"use strict";W.d(nt,{BH:function(){return C},NZ:function(){return L},U8:function(){return F},co:function(){return x},eH:function(){return m},vr:function(){return b}});var T=W(75918),fe=W(52615),ke=W(4348),oe=W(88226),H=W(69323),p=W(34502),ae=W(35884),te=W(90689),l=W(16925),M=W(49055),A=function(w,k,N,V){var q=arguments.length,le=q<3?k:V===null?V=Object.getOwnPropertyDescriptor(k,N):V,ee;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")le=Reflect.decorate(w,k,N,V);else for(var X=w.length-1;X>=0;X--)(ee=w[X])&&(le=(q<3?ee(le):q>3?ee(k,N,le):ee(k,N))||le);return q>3&&le&&Object.defineProperty(k,N,le),le},g=function(w,k){return function(N,V){k(N,V,w)}};function b(w){return w.command!==void 0}class m{constructor(k){this.id=m._idPool++,this._debugName=k}}m._idPool=0,m.CommandPalette=new m("CommandPalette"),m.EditorContext=new m("EditorContext"),m.SimpleEditorContext=new m("SimpleEditorContext"),m.EditorContextCopy=new m("EditorContextCopy"),m.EditorContextPeek=new m("EditorContextPeek"),m.MenubarEditMenu=new m("MenubarEditMenu"),m.MenubarCopy=new m("MenubarCopy"),m.MenubarGoMenu=new m("MenubarGoMenu"),m.MenubarSelectionMenu=new m("MenubarSelectionMenu"),m.InlineCompletionsActions=new m("InlineCompletionsActions");const x=(0,l.yh)("menuService"),C=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new ke.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:w=>w===m.CommandPalette}}addCommand(w){return this.addCommands(oe.$.single(w))}addCommands(w){for(const k of w)this._commands.set(k.id,k);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,H.OF)(()=>{let k=!1;for(const N of w)k=this._commands.delete(N.id)||k;k&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(w){return this._commands.get(w)}getCommands(){const w=new Map;return this._commands.forEach((k,N)=>w.set(N,k)),w}appendMenuItem(w,k){return this.appendMenuItems(oe.$.single({id:w,item:k}))}appendMenuItems(w){const k=new Set,N=new p.S;for(const{id:V,item:q}of w){let le=this._menuItems.get(V);le||(le=new p.S,this._menuItems.set(V,le)),N.push(le.push(q)),k.add(V)}return this._onDidChangeMenu.fire(k),(0,H.OF)(()=>{if(N.size>0){for(let V of N)V();this._onDidChangeMenu.fire(k),N.clear()}})}getMenuItems(w){let k;return this._menuItems.has(w)?k=[...this._menuItems.get(w)]:k=[],w===m.CommandPalette&&this._appendImplicitItems(k),k}_appendImplicitItems(w){const k=new Set;for(const N of w)b(N)&&(k.add(N.command.id),N.alt&&k.add(N.alt.id));this._commands.forEach((N,V)=>{k.has(V)||w.push({command:N})})}};class L extends T.wY{constructor(k,N,V,q){super(`submenuitem.${k.submenu.id}`,typeof k.title=="string"?k.title:k.title.value,[],"submenu"),this.item=k,this._menuService=N,this._contextKeyService=V,this._options=q}get actions(){const k=[],N=this._menuService.createMenu(this.item.submenu,this._contextKeyService),V=N.getActions(this._options);N.dispose();for(const[,q]of V)q.length>0&&(k.push(...q),k.push(new T.Z0));return k.length&&k.pop(),k}}let F=class nl{constructor(k,N,V,q,le){var ee,X;if(this._commandService=le,this.id=k.id,this.label=V!=null&&V.renderShortTitle&&k.shortTitle?typeof k.shortTitle=="string"?k.shortTitle:k.shortTitle.value:typeof k.title=="string"?k.title:k.title.value,this.tooltip=(X=typeof k.tooltip=="string"?k.tooltip:(ee=k.tooltip)===null||ee===void 0?void 0:ee.value)!==null&&X!==void 0?X:"",this.enabled=!k.precondition||q.contextMatchesRules(k.precondition),this.checked=void 0,k.toggled){const _e=k.toggled.condition?k.toggled:{condition:k.toggled};this.checked=q.contextMatchesRules(_e.condition),this.checked&&_e.tooltip&&(this.tooltip=typeof _e.tooltip=="string"?_e.tooltip:_e.tooltip.value),_e.title&&(this.label=typeof _e.title=="string"?_e.title:_e.title.value)}this.item=k,this.alt=N?new nl(N,void 0,V,q,le):void 0,this._options=V,M.kS.isThemeIcon(k.icon)&&(this.class=fe.dT.asClassName(k.icon))}dispose(){}run(...k){var N,V;let q=[];return!((N=this._options)===null||N===void 0)&&N.arg&&(q=[...q,this._options.arg]),!((V=this._options)===null||V===void 0)&&V.shouldForwardArgs&&(q=[...q,...k]),this._commandService.executeCommand(this.id,...q)}};F=A([g(3,te.i6),g(4,ae.H)],F)},35884:function(Rt,nt,W){"use strict";W.d(nt,{H:function(){return ae},P:function(){return te}});var T=W(4348),fe=W(88226),ke=W(69323),oe=W(34502),H=W(72999),p=W(16925);const ae=(0,p.yh)("commandService"),te=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new T.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,M){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!M)throw new Error("invalid command");return this.registerCommand({id:l,handler:M})}if(l.description){const x=[];for(let L of l.description.args)x.push(L.constraint);const C=l.handler;l.handler=function(L,...F){return(0,H.D8)(F,x),C(L,...F)}}const{id:A}=l;let g=this._commands.get(A);g||(g=new oe.S,this._commands.set(A,g));let b=g.unshift(l),m=(0,ke.OF)(()=>{b();const x=this._commands.get(A);x!=null&&x.isEmpty()&&this._commands.delete(A)});return this._onDidRegisterCommand.fire(A),m}registerCommandAlias(l,M){return te.registerCommand(l,(A,...g)=>A.get(ae).executeCommand(M,...g))}getCommand(l){const M=this._commands.get(l);if(!(!M||M.isEmpty()))return fe.$.first(M)}getCommands(){const l=new Map;for(const M of this._commands.keys()){const A=this.getCommand(M);A&&l.set(M,A)}return l}};te.registerCommand("noop",()=>{})},90689:function(Rt,nt,W){"use strict";W.d(nt,{Ao:function(){return ae},Eq:function(){return U},Fb:function(){return te},K8:function(){return K},i6:function(){return Ge},uy:function(){return ye}});var T=W(23345),fe=W(82983),ke=W(16925);let oe=T.WE||"";const H=new Map;H.set("false",!1),H.set("true",!0),H.set("isMac",T.dz),H.set("isLinux",T.IJ),H.set("isWindows",T.ED),H.set("isWeb",T.$L),H.set("isMacNative",T.dz&&!T.$L),H.set("isEdge",oe.indexOf("Edg/")>=0),H.set("isFirefox",oe.indexOf("Firefox")>=0),H.set("isChrome",oe.indexOf("Chrome")>=0),H.set("isSafari",oe.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class ae{static has(y){return g.create(y)}static equals(y,_){return b.create(y,_)}static regex(y,_){return q.create(y,_)}static not(y){return L.create(y)}static and(...y){return X.create(y,null)}static or(...y){return _e.create(y,null,!0)}static deserialize(y,_=!1){if(y)return this._deserializeOrExpression(y,_)}static _deserializeOrExpression(y,_){let I=y.split("||");return _e.create(I.map(Z=>this._deserializeAndExpression(Z,_)),null,!0)}static _deserializeAndExpression(y,_){let I=y.split("&&");return X.create(I.map(Z=>this._deserializeOne(Z,_)),null)}static _deserializeOne(y,_){if(y=y.trim(),y.indexOf("!=")>=0){let I=y.split("!=");return C.create(I[0].trim(),this._deserializeValue(I[1],_))}if(y.indexOf("==")>=0){let I=y.split("==");return b.create(I[0].trim(),this._deserializeValue(I[1],_))}if(y.indexOf("=~")>=0){let I=y.split("=~");return q.create(I[0].trim(),this._deserializeRegexValue(I[1],_))}if(y.indexOf(" in ")>=0){let I=y.split(" in ");return m.create(I[0].trim(),I[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(y)){const I=y.split(">=");return k.create(I[0].trim(),I[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(y)){const I=y.split(">");return w.create(I[0].trim(),I[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(y)){const I=y.split("<=");return V.create(I[0].trim(),I[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(y)){const I=y.split("<");return N.create(I[0].trim(),I[1].trim())}return/^\!\s*/.test(y)?L.create(y.substr(1).trim()):g.create(y)}static _deserializeValue(y,_){if(y=y.trim(),y==="true")return!0;if(y==="false")return!1;let I=/^'([^']*)'$/.exec(y);return I?I[1].trim():y}static _deserializeRegexValue(y,_){if((0,fe.m5)(y)){if(_)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let I=y.indexOf("/"),Z=y.lastIndexOf("/");if(I===Z||I<0){if(_)throw new Error(`bad regexp-value '${y}', missing /-enclosure`);return console.warn(`bad regexp-value '${y}', missing /-enclosure`),null}let Ee=y.slice(I+1,Z),Ce=y[Z+1]==="i"?"i":"";try{return new RegExp(Ee,Ce)}catch(Ue){if(_)throw new Error(`bad regexp-value '${y}', parse error: ${Ue}`);return console.warn(`bad regexp-value '${y}', parse error: ${Ue}`),null}}}function te(z,y){const _=z?z.substituteConstants():void 0,I=y?y.substituteConstants():void 0;return!_&&!I?!0:!_||!I?!1:_.equals(I)}function l(z,y){return z.cmp(y)}class M{constructor(){this.type=0}cmp(y){return this.type-y.type}equals(y){return y.type===this.type}substituteConstants(){return this}evaluate(y){return!1}serialize(){return"false"}keys(){return[]}negate(){return A.INSTANCE}}M.INSTANCE=new M;class A{constructor(){this.type=1}cmp(y){return this.type-y.type}equals(y){return y.type===this.type}substituteConstants(){return this}evaluate(y){return!0}serialize(){return"true"}keys(){return[]}negate(){return M.INSTANCE}}A.INSTANCE=new A;class g{constructor(y,_){this.key=y,this.negated=_,this.type=2}static create(y,_=null){const I=H.get(y);return typeof I=="boolean"?I?A.INSTANCE:M.INSTANCE:new g(y,_)}cmp(y){return y.type!==this.type?this.type-y.type:R(this.key,y.key)}equals(y){return y.type===this.type?this.key===y.key:!1}substituteConstants(){const y=H.get(this.key);return typeof y=="boolean"?y?A.INSTANCE:M.INSTANCE:this}evaluate(y){return!!y.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=L.create(this.key,this)),this.negated}}class b{constructor(y,_,I){this.key=y,this.value=_,this.negated=I,this.type=4}static create(y,_,I=null){if(typeof _=="boolean")return _?g.create(y,I):L.create(y,I);const Z=H.get(y);return typeof Z=="boolean"?_===(Z?"true":"false")?A.INSTANCE:M.INSTANCE:new b(y,_,I)}cmp(y){return y.type!==this.type?this.type-y.type:O(this.key,this.value,y.key,y.value)}equals(y){return y.type===this.type?this.key===y.key&&this.value===y.value:!1}substituteConstants(){const y=H.get(this.key);if(typeof y=="boolean"){const _=y?"true":"false";return this.value===_?A.INSTANCE:M.INSTANCE}return this}evaluate(y){return y.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=C.create(this.key,this.value,this)),this.negated}}class m{constructor(y,_){this.key=y,this.valueKey=_,this.type=10,this.negated=null}static create(y,_){return new m(y,_)}cmp(y){return y.type!==this.type?this.type-y.type:O(this.key,this.valueKey,y.key,y.valueKey)}equals(y){return y.type===this.type?this.key===y.key&&this.valueKey===y.valueKey:!1}substituteConstants(){return this}evaluate(y){const _=y.getValue(this.valueKey),I=y.getValue(this.key);return Array.isArray(_)?_.indexOf(I)>=0:typeof I=="string"&&typeof _=="object"&&_!==null?p.call(_,I):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=x.create(this)),this.negated}}class x{constructor(y){this._actual=y,this.type=11}static create(y){return new x(y)}cmp(y){return y.type!==this.type?this.type-y.type:this._actual.cmp(y._actual)}equals(y){return y.type===this.type?this._actual.equals(y._actual):!1}substituteConstants(){return this}evaluate(y){return!this._actual.evaluate(y)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class C{constructor(y,_,I){this.key=y,this.value=_,this.negated=I,this.type=5}static create(y,_,I=null){if(typeof _=="boolean")return _?L.create(y,I):g.create(y,I);const Z=H.get(y);return typeof Z=="boolean"?_===(Z?"true":"false")?M.INSTANCE:A.INSTANCE:new C(y,_,I)}cmp(y){return y.type!==this.type?this.type-y.type:O(this.key,this.value,y.key,y.value)}equals(y){return y.type===this.type?this.key===y.key&&this.value===y.value:!1}substituteConstants(){const y=H.get(this.key);if(typeof y=="boolean"){const _=y?"true":"false";return this.value===_?M.INSTANCE:A.INSTANCE}return this}evaluate(y){return y.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 L{constructor(y,_){this.key=y,this.negated=_,this.type=3}static create(y,_=null){const I=H.get(y);return typeof I=="boolean"?I?M.INSTANCE:A.INSTANCE:new L(y,_)}cmp(y){return y.type!==this.type?this.type-y.type:R(this.key,y.key)}equals(y){return y.type===this.type?this.key===y.key:!1}substituteConstants(){const y=H.get(this.key);return typeof y=="boolean"?y?M.INSTANCE:A.INSTANCE:this}evaluate(y){return!y.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=g.create(this.key,this)),this.negated}}function F(z,y){if(typeof z=="string"){const _=parseFloat(z);isNaN(_)||(z=_)}return typeof z=="string"||typeof z=="number"?y(z):M.INSTANCE}class w{constructor(y,_,I){this.key=y,this.value=_,this.negated=I,this.type=12}static create(y,_,I=null){return F(_,Z=>new w(y,Z,I))}cmp(y){return y.type!==this.type?this.type-y.type:O(this.key,this.value,y.key,y.value)}equals(y){return y.type===this.type?this.key===y.key&&this.value===y.value:!1}substituteConstants(){return this}evaluate(y){return typeof this.value=="string"?!1:parseFloat(y.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=V.create(this.key,this.value,this)),this.negated}}class k{constructor(y,_,I){this.key=y,this.value=_,this.negated=I,this.type=13}static create(y,_,I=null){return F(_,Z=>new k(y,Z,I))}cmp(y){return y.type!==this.type?this.type-y.type:O(this.key,this.value,y.key,y.value)}equals(y){return y.type===this.type?this.key===y.key&&this.value===y.value:!1}substituteConstants(){return this}evaluate(y){return typeof this.value=="string"?!1:parseFloat(y.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=N.create(this.key,this.value,this)),this.negated}}class N{constructor(y,_,I){this.key=y,this.value=_,this.negated=I,this.type=14}static create(y,_,I=null){return F(_,Z=>new N(y,Z,I))}cmp(y){return y.type!==this.type?this.type-y.type:O(this.key,this.value,y.key,y.value)}equals(y){return y.type===this.type?this.key===y.key&&this.value===y.value:!1}substituteConstants(){return this}evaluate(y){return typeof this.value=="string"?!1:parseFloat(y.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=k.create(this.key,this.value,this)),this.negated}}class V{constructor(y,_,I){this.key=y,this.value=_,this.negated=I,this.type=15}static create(y,_,I=null){return F(_,Z=>new V(y,Z,I))}cmp(y){return y.type!==this.type?this.type-y.type:O(this.key,this.value,y.key,y.value)}equals(y){return y.type===this.type?this.key===y.key&&this.value===y.value:!1}substituteConstants(){return this}evaluate(y){return typeof this.value=="string"?!1:parseFloat(y.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 q{constructor(y,_){this.key=y,this.regexp=_,this.type=7,this.negated=null}static create(y,_){return new q(y,_)}cmp(y){if(y.type!==this.type)return this.type-y.type;if(this.key<y.key)return-1;if(this.key>y.key)return 1;const _=this.regexp?this.regexp.source:"",I=y.regexp?y.regexp.source:"";return _<I?-1:_>I?1:0}equals(y){if(y.type===this.type){const _=this.regexp?this.regexp.source:"",I=y.regexp?y.regexp.source:"";return this.key===y.key&&_===I}return!1}substituteConstants(){return this}evaluate(y){let _=y.getValue(this.key);return this.regexp?this.regexp.test(_):!1}serialize(){const y=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${y}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=le.create(this)),this.negated}}class le{constructor(y){this._actual=y,this.type=8}static create(y){return new le(y)}cmp(y){return y.type!==this.type?this.type-y.type:this._actual.cmp(y._actual)}equals(y){return y.type===this.type?this._actual.equals(y._actual):!1}substituteConstants(){return this}evaluate(y){return!this._actual.evaluate(y)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function ee(z){let y=null;for(let _=0,I=z.length;_<I;_++){const Z=z[_].substituteConstants();if(z[_]!==Z&&y===null){y=[];for(let Ee=0;Ee<_;Ee++)y[Ee]=z[Ee]}y!==null&&(y[_]=Z)}return y===null?z:y}class X{constructor(y,_){this.expr=y,this.negated=_,this.type=6}static create(y,_){return X._normalizeArr(y,_)}cmp(y){if(y.type!==this.type)return this.type-y.type;if(this.expr.length<y.expr.length)return-1;if(this.expr.length>y.expr.length)return 1;for(let _=0,I=this.expr.length;_<I;_++){const Z=l(this.expr[_],y.expr[_]);if(Z!==0)return Z}return 0}equals(y){if(y.type===this.type){if(this.expr.length!==y.expr.length)return!1;for(let _=0,I=this.expr.length;_<I;_++)if(!this.expr[_].equals(y.expr[_]))return!1;return!0}return!1}substituteConstants(){const y=ee(this.expr);return y===this.expr?this:X.create(y,this.negated)}evaluate(y){for(let _=0,I=this.expr.length;_<I;_++)if(!this.expr[_].evaluate(y))return!1;return!0}static _normalizeArr(y,_){const I=[];let Z=!1;for(const Ee of y)if(Ee){if(Ee.type===1){Z=!0;continue}if(Ee.type===0)return M.INSTANCE;if(Ee.type===6){I.push(...Ee.expr);continue}I.push(Ee)}if(I.length===0&&Z)return A.INSTANCE;if(I.length!==0){if(I.length===1)return I[0];I.sort(l);for(let Ee=1;Ee<I.length;Ee++)I[Ee-1].equals(I[Ee])&&(I.splice(Ee,1),Ee--);if(I.length===1)return I[0];for(;I.length>1;){const Ee=I[I.length-1];if(Ee.type!==9)break;I.pop();const Ce=I.pop(),Ue=I.length===0,Be=_e.create(Ee.expr.map(Ze=>X.create([Ze,Ce],null)),null,Ue);Be&&(I.push(Be),I.sort(l))}return I.length===1?I[0]:new X(I,_)}}serialize(){return this.expr.map(y=>y.serialize()).join(" && ")}keys(){const y=[];for(let _ of this.expr)y.push(..._.keys());return y}negate(){if(!this.negated){const y=[];for(let _ of this.expr)y.push(_.negate());this.negated=_e.create(y,this,!0)}return this.negated}}class _e{constructor(y,_){this.expr=y,this.negated=_,this.type=9}static create(y,_,I){return _e._normalizeArr(y,_,I)}cmp(y){if(y.type!==this.type)return this.type-y.type;if(this.expr.length<y.expr.length)return-1;if(this.expr.length>y.expr.length)return 1;for(let _=0,I=this.expr.length;_<I;_++){const Z=l(this.expr[_],y.expr[_]);if(Z!==0)return Z}return 0}equals(y){if(y.type===this.type){if(this.expr.length!==y.expr.length)return!1;for(let _=0,I=this.expr.length;_<I;_++)if(!this.expr[_].equals(y.expr[_]))return!1;return!0}return!1}substituteConstants(){const y=ee(this.expr);return y===this.expr?this:_e.create(y,this.negated,!1)}evaluate(y){for(let _=0,I=this.expr.length;_<I;_++)if(this.expr[_].evaluate(y))return!0;return!1}static _normalizeArr(y,_,I){let Z=[],Ee=!1;if(y){for(let Ce=0,Ue=y.length;Ce<Ue;Ce++){const Be=y[Ce];if(Be){if(Be.type===0){Ee=!0;continue}if(Be.type===1)return A.INSTANCE;if(Be.type===9){Z=Z.concat(Be.expr);continue}Z.push(Be)}}if(Z.length===0&&Ee)return M.INSTANCE;Z.sort(l)}if(Z.length!==0){if(Z.length===1)return Z[0];for(let Ce=1;Ce<Z.length;Ce++)Z[Ce-1].equals(Z[Ce])&&(Z.splice(Ce,1),Ce--);if(Z.length===1)return Z[0];if(I){for(let Ce=0;Ce<Z.length;Ce++)for(let Ue=Ce+1;Ue<Z.length;Ue++)K(Z[Ce],Z[Ue])&&(Z.splice(Ue,1),Ue--);if(Z.length===1)return Z[0]}return new _e(Z,_)}}serialize(){return this.expr.map(y=>y.serialize()).join(" || ")}keys(){const y=[];for(let _ of this.expr)y.push(..._.keys());return y}negate(){if(!this.negated){let y=[];for(let _ of this.expr)y.push(_.negate());for(;y.length>1;){const _=y.shift(),I=y.shift(),Z=[];for(const Ce of j(_))for(const Ue of j(I))Z.push(X.create([Ce,Ue],null));const Ee=y.length===0;y.unshift(_e.create(Z,null,Ee))}this.negated=y[0]}return this.negated}}class ye extends g{constructor(y,_,I){super(y,null),this._defaultValue=_,typeof I=="object"?ye._info.push(Object.assign(Object.assign({},I),{key:y})):I!==!0&&ye._info.push({key:y,description:I,type:_!=null?typeof _:void 0})}static all(){return ye._info.values()}bindTo(y){return y.createKey(this.key,this._defaultValue)}getValue(y){return y.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(y){return b.create(this.key,y)}}ye._info=[];const Ge=(0,ke.yh)("contextKeyService"),U="setContext";function R(z,y){return z<y?-1:z>y?1:0}function O(z,y,_,I){return z<_?-1:z>_?1:y<I?-1:y>I?1:0}function K(z,y){if(y.type===6&&z.type!==9&&z.type!==6){for(const Z of y.expr)if(z.equals(Z))return!0}const _=z.negate(),I=j(_).concat(j(y));I.sort(l);for(let Z=0;Z<I.length;Z++){const Ce=I[Z].negate();for(let Ue=Z+1;Ue<I.length;Ue++){const Be=I[Ue];if(Ce.equals(Be))return!0}}return!1}function j(z){return z.type===9?z.expr:[z]}},16925:function(Rt,nt,W){"use strict";W.d(nt,{I8:function(){return T},TG:function(){return fe},jt:function(){return H},yh:function(){return oe}});var T;(function(p){p.serviceIds=new Map,p.DI_TARGET="$di$target",p.DI_DEPENDENCIES="$di$dependencies";function ae(te){return te[p.DI_DEPENDENCIES]||[]}p.getServiceDependencies=ae})(T||(T={}));const fe=oe("instantiationService");function ke(p,ae,te,l){ae[T.DI_TARGET]===ae?ae[T.DI_DEPENDENCIES].push({id:p,index:te,optional:l}):(ae[T.DI_DEPENDENCIES]=[{id:p,index:te,optional:l}],ae[T.DI_TARGET]=ae)}function oe(p){if(T.serviceIds.has(p))return T.serviceIds.get(p);const ae=function(te,l,M){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ke(ae,te,M,!1)};return ae.toString=()=>p,T.serviceIds.set(p,ae),ae}function H(p){return function(ae,te,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");ke(p,ae,l,!0)}}},44650:function(Rt,nt,W){"use strict";W.d(nt,{B:function(){return oe}});var T=W(76068),fe=W(72999);class ke{constructor(){this.data=new Map}add(p,ae){T.ok(fe.HD(p)),T.ok(fe.Kn(ae)),T.ok(!this.data.has(p),"There is already an extension with this id"),this.data.set(p,ae)}as(p){return this.data.get(p)||null}}const oe=new ke},66213:function(Rt,nt,W){"use strict";W.d(nt,{e:function(){return T}});var T;(function(fe){fe.DARK="dark",fe.LIGHT="light",fe.HIGH_CONTRAST="hc"})(T||(T={}))},49055:function(Rt,nt,W){"use strict";W.d(nt,{EN:function(){return l},IP:function(){return g},Ic:function(){return x},XE:function(){return ae},bB:function(){return C},kS:function(){return M},m6:function(){return A}});var T=W(52615),fe=W(4348),ke=W(69323),oe=W(16925),H=W(44650),p=W(66213);const ae=(0,oe.yh)("themeService");var te;(function(L){function F(w){return w&&typeof w=="object"&&typeof w.id=="string"}L.isThemeColor=F})(te||(te={}));function l(L){return{id:L}}var M;(function(L){function F(le){return le&&typeof le=="object"&&typeof le.id=="string"&&(typeof le.color=="undefined"||te.isThemeColor(le.color))}L.isThemeIcon=F;const w=new RegExp(`^\\$\\((${T.dT.iconNameExpression}(?:${T.dT.iconModifierExpression})?)\\)$`);function k(le){const ee=w.exec(le);if(!ee)return;let[,X]=ee;return{id:X}}L.fromString=k;function N(le,ee){let X=le.id;const _e=X.lastIndexOf("~");return _e!==-1&&(X=X.substring(0,_e)),ee&&(X=`${X}~${ee}`),{id:X}}L.modify=N;function V(le,ee){var X,_e;return le.id===ee.id&&((X=le.color)===null||X===void 0?void 0:X.id)===((_e=ee.color)===null||_e===void 0?void 0:_e.id)}L.isEqual=V;function q(le,ee){return{id:le.id,color:ee?l(ee):void 0}}L.asThemeIcon=q,L.asClassNameArray=T.dT.asClassNameArray,L.asClassName=T.dT.asClassName,L.asCSSSelector=T.dT.asCSSSelector})(M||(M={}));function A(L){switch(L){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const g={ThemingContribution:"base.contributions.theming"};class b{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new fe.Q5}onColorThemeChange(F){return this.themingParticipants.push(F),this.onThemingParticipantAddedEmitter.fire(F),(0,ke.OF)(()=>{const w=this.themingParticipants.indexOf(F);this.themingParticipants.splice(w,1)})}getThemingParticipants(){return this.themingParticipants}}let m=new b;H.B.add(g.ThemingContribution,m);function x(L){return m.onColorThemeChange(L)}class C extends ke.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(){}}},20922:function(Rt,nt,W){"use strict";W.d(nt,{Z:function(){return $e}});var T=W(32855),fe=W(74430),ke=W(34666),oe=W(11913),H=W(43079),p=W(33377),ae=W(93912);function te(){return typeof BigInt=="function"}function l(be){return!be&&be!==0&&!Number.isNaN(be)||!String(be).trim()}function M(be){var he=be.trim(),we=he.startsWith("-");we&&(he=he.slice(1)),he=he.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),he.startsWith(".")&&(he="0".concat(he));var Ae=he||"0",qe=Ae.split("."),ie=qe[0]||"0",ue=qe[1]||"0";ie==="0"&&ue==="0"&&(we=!1);var Y=we?"-":"";return{negative:we,negativeStr:Y,trimStr:Ae,integerStr:ie,decimalStr:ue,fullStr:"".concat(Y).concat(Ae)}}function A(be){var he=String(be);return!Number.isNaN(Number(he))&&he.includes("e")}function g(be){var he=String(be);if(A(be)){var we=Number(he.slice(he.indexOf("e-")+2)),Ae=he.match(/\.(\d+)/);return Ae!=null&&Ae[1]&&(we+=Ae[1].length),we}return he.includes(".")&&m(he)?he.length-he.indexOf(".")-1:0}function b(be){var he=String(be);if(A(be)){if(be>Number.MAX_SAFE_INTEGER)return String(te()?BigInt(be).toString():Number.MAX_SAFE_INTEGER);if(be<Number.MIN_SAFE_INTEGER)return String(te()?BigInt(be).toString():Number.MIN_SAFE_INTEGER);he=be.toFixed(g(he))}return M(he).fullStr}function m(be){return typeof be=="number"?!Number.isNaN(be):be?/^\s*-?\d+(\.\d+)?\s*$/.test(be)||/^\s*-?\d+\.\s*$/.test(be)||/^\s*-?\.\d+\s*$/.test(be):!1}var x=function(){function be(he){if((0,p.Z)(this,be),(0,fe.Z)(this,"origin",""),(0,fe.Z)(this,"negative",void 0),(0,fe.Z)(this,"integer",void 0),(0,fe.Z)(this,"decimal",void 0),(0,fe.Z)(this,"decimalLen",void 0),(0,fe.Z)(this,"empty",void 0),(0,fe.Z)(this,"nan",void 0),l(he)){this.empty=!0;return}if(this.origin=String(he),he==="-"||Number.isNaN(he)){this.nan=!0;return}var we=he;if(A(we)&&(we=Number(we)),we=typeof we=="string"?we:b(we),m(we)){var Ae=M(we);this.negative=Ae.negative;var qe=Ae.trimStr.split(".");this.integer=BigInt(qe[0]);var ie=qe[1]||"0";this.decimal=BigInt(ie),this.decimalLen=ie.length}else this.nan=!0}return(0,ae.Z)(be,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(we){var Ae="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(we,"0"));return BigInt(Ae)}},{key:"negate",value:function(){var we=new be(this.toString());return we.negative=!we.negative,we}},{key:"cal",value:function(we,Ae,qe){var ie=Math.max(this.getDecimalStr().length,we.getDecimalStr().length),ue=this.alignDecimal(ie),Y=we.alignDecimal(ie),xe=Ae(ue,Y).toString(),Te=qe(ie),Fe=M(xe),$=Fe.negativeStr,se=Fe.trimStr,Se="".concat($).concat(se.padStart(Te+1,"0"));return new be("".concat(Se.slice(0,-Te),".").concat(Se.slice(-Te)))}},{key:"add",value:function(we){if(this.isInvalidate())return new be(we);var Ae=new be(we);return Ae.isInvalidate()?this:this.cal(Ae,function(qe,ie){return qe+ie},function(qe){return qe})}},{key:"multi",value:function(we){var Ae=new be(we);return this.isInvalidate()||Ae.isInvalidate()?new be(NaN):this.cal(Ae,function(qe,ie){return qe*ie},function(qe){return qe*2})}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(we){return this.toString()===(we==null?void 0:we.toString())}},{key:"lessEquals",value:function(we){return this.add(we.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return we?this.isInvalidate()?"":M("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),be}(),C=function(){function be(he){if((0,p.Z)(this,be),(0,fe.Z)(this,"origin",""),(0,fe.Z)(this,"number",void 0),(0,fe.Z)(this,"empty",void 0),l(he)){this.empty=!0;return}this.origin=String(he),this.number=Number(he)}return(0,ae.Z)(be,[{key:"negate",value:function(){return new be(-this.toNumber())}},{key:"add",value:function(we){if(this.isInvalidate())return new be(we);var Ae=Number(we);if(Number.isNaN(Ae))return this;var qe=this.number+Ae;if(qe>Number.MAX_SAFE_INTEGER)return new be(Number.MAX_SAFE_INTEGER);if(qe<Number.MIN_SAFE_INTEGER)return new be(Number.MIN_SAFE_INTEGER);var ie=Math.max(g(this.number),g(Ae));return new be(qe.toFixed(ie))}},{key:"multi",value:function(we){var Ae=Number(we);if(this.isInvalidate()||Number.isNaN(Ae))return new be(NaN);var qe=this.number*Ae;if(qe>Number.MAX_SAFE_INTEGER)return new be(Number.MAX_SAFE_INTEGER);if(qe<Number.MIN_SAFE_INTEGER)return new be(Number.MIN_SAFE_INTEGER);var ie=Math.max(g(this.number),g(Ae));return new be(qe.toFixed(ie))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(we){return this.toNumber()===(we==null?void 0:we.toNumber())}},{key:"lessEquals",value:function(we){return this.add(we.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return we?this.isInvalidate()?"":b(this.number):this.origin}}]),be}();function L(be){return te()?new x(be):new C(be)}function F(be,he,we){var Ae=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(be==="")return"";var qe=M(be),ie=qe.negativeStr,ue=qe.integerStr,Y=qe.decimalStr,xe="".concat(he).concat(Y),Te="".concat(ie).concat(ue);if(we>=0){var Fe=Number(Y[we]);if(Fe>=5&&!Ae){var $=L(be).add("".concat(ie,"0.").concat("0".repeat(we)).concat(10-Fe));return F($.toString(),he,we,Ae)}return we===0?Te:"".concat(Te).concat(he).concat(Y.padEnd(we,"0").slice(0,we))}return xe===".0"?Te:"".concat(Te).concat(xe)}var w=L,k=W(92310),N=W.n(k),V=W(36901),q=W(34280);function le(be,he){return typeof Proxy!="undefined"&&be?new Proxy(be,{get:function(Ae,qe){if(he[qe])return he[qe];var ie=Ae[qe];return typeof ie=="function"?ie.bind(Ae):ie}}):be}var ee=W(8654),X=W(59301),_e=W(48736);function ye(be,he){var we=(0,X.useRef)(null);function Ae(){try{var ie=be.selectionStart,ue=be.selectionEnd,Y=be.value,xe=Y.substring(0,ie),Te=Y.substring(ue);we.current={start:ie,end:ue,value:Y,beforeTxt:xe,afterTxt:Te}}catch(Fe){}}function qe(){if(be&&we.current&&he)try{var ie=be.value,ue=we.current,Y=ue.beforeTxt,xe=ue.afterTxt,Te=ue.start,Fe=ie.length;if(ie.startsWith(Y))Fe=Y.length;else if(ie.endsWith(xe))Fe=ie.length-we.current.afterTxt.length;else{var $=Y[Te-1],se=ie.indexOf($,Te-1);se!==-1&&(Fe=se+1)}be.setSelectionRange(Fe,Fe)}catch(Se){(0,_e.ZP)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(Se.message))}}return[Ae,qe]}var Ge=W(49658),U=function(){var he=(0,X.useState)(!1),we=(0,oe.Z)(he,2),Ae=we[0],qe=we[1];return(0,q.Z)(function(){qe((0,Ge.Z)())},[]),Ae},R=U,O=W(16089),K=200,j=600;function z(be){var he=be.prefixCls,we=be.upNode,Ae=be.downNode,qe=be.upDisabled,ie=be.downDisabled,ue=be.onStep,Y=X.useRef(),xe=X.useRef([]),Te=X.useRef();Te.current=ue;var Fe=function(){clearTimeout(Y.current)},$=function(Ye,We){Ye.preventDefault(),Fe(),Te.current(We);function ht(){Te.current(We),Y.current=setTimeout(ht,K)}Y.current=setTimeout(ht,j)};X.useEffect(function(){return function(){Fe(),xe.current.forEach(function(He){return O.Z.cancel(He)})}},[]);var se=R();if(se)return null;var Se="".concat(he,"-handler"),Ie=N()(Se,"".concat(Se,"-up"),(0,fe.Z)({},"".concat(Se,"-up-disabled"),qe)),Oe=N()(Se,"".concat(Se,"-down"),(0,fe.Z)({},"".concat(Se,"-down-disabled"),ie)),Ve=function(){return xe.current.push((0,O.Z)(Fe))},ut={unselectable:"on",role:"button",onMouseUp:Ve,onMouseLeave:Ve};return X.createElement("div",{className:"".concat(Se,"-wrap")},X.createElement("span",(0,T.Z)({},ut,{onMouseDown:function(Ye){$(Ye,!0)},"aria-label":"Increase Value","aria-disabled":qe,className:Ie}),we||X.createElement("span",{unselectable:"on",className:"".concat(he,"-handler-up-inner")})),X.createElement("span",(0,T.Z)({},ut,{onMouseDown:function(Ye){$(Ye,!1)},"aria-label":"Decrease Value","aria-disabled":ie,className:Oe}),Ae||X.createElement("span",{unselectable:"on",className:"".concat(he,"-handler-down-inner")})))}function y(be){var he=typeof be=="number"?b(be):M(be).fullStr,we=he.includes(".");return we?M(he.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:be+"0"}var _=W(30292),I=function(){var be=(0,X.useRef)(0),he=function(){O.Z.cancel(be.current)};return(0,X.useEffect)(function(){return he},[]),function(we){he(),be.current=(0,O.Z)(function(){we()})}},Z=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],Ee=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],Ce=function(he,we){return he||we.isEmpty()?we.toString():we.toNumber()},Ue=function(he){var we=w(he);return we.isInvalidate()?null:we},Be=X.forwardRef(function(be,he){var we=be.prefixCls,Ae=be.className,qe=be.style,ie=be.min,ue=be.max,Y=be.step,xe=Y===void 0?1:Y,Te=be.defaultValue,Fe=be.value,$=be.disabled,se=be.readOnly,Se=be.upHandler,Ie=be.downHandler,Oe=be.keyboard,Ve=be.changeOnWheel,ut=Ve===void 0?!1:Ve,He=be.controls,Ye=He===void 0?!0:He,We=be.classNames,ht=be.stringMode,ft=be.parser,rt=be.formatter,ve=be.precision,at=be.decimalSeparator,Xe=be.onChange,Ke=be.onInput,pt=be.onPressEnter,Et=be.onStep,ct=be.changeOnBlur,Dt=ct===void 0?!0:ct,Gt=be.domRef,lt=(0,H.Z)(be,Z),Tt="".concat(we,"-input"),ge=X.useRef(null),de=X.useState(!1),pe=(0,oe.Z)(de,2),P=pe[0],G=pe[1],Q=X.useRef(!1),re=X.useRef(!1),ce=X.useRef(!1),tt=X.useState(function(){return w(Fe!=null?Fe:Te)}),it=(0,oe.Z)(tt,2),ot=it[0],gt=it[1];function kt($t){Fe===void 0&&gt($t)}var Ut=X.useCallback(function($t,Mt){if(!Mt)return ve>=0?ve:Math.max(g($t),g(xe))},[ve,xe]),Bt=X.useCallback(function($t){var Mt=String($t);if(ft)return ft(Mt);var jt=Mt;return at&&(jt=jt.replace(at,".")),jt.replace(/[^\w.-]+/g,"")},[ft,at]),bt=X.useRef(""),rn=X.useCallback(function($t,Mt){if(rt)return rt($t,{userTyping:Mt,input:String(bt.current)});var jt=typeof $t=="number"?b($t):$t;if(!Mt){var Vt=Ut(jt,Mt);if(m(jt)&&(at||Vt>=0)){var kn=at||".";jt=F(jt,kn,Vt)}}return jt},[rt,Ut,at]),fn=X.useState(function(){var $t=Te!=null?Te:Fe;return ot.isInvalidate()&&["string","number"].includes((0,ke.Z)($t))?Number.isNaN($t)?"":$t:rn(ot.toString(),!1)}),en=(0,oe.Z)(fn,2),Qt=en[0],st=en[1];bt.current=Qt;function je($t,Mt){st(rn($t.isInvalidate()?$t.toString(!1):$t.toString(!Mt),Mt))}var dt=X.useMemo(function(){return Ue(ue)},[ue,ve]),Ft=X.useMemo(function(){return Ue(ie)},[ie,ve]),Wt=X.useMemo(function(){return!dt||!ot||ot.isInvalidate()?!1:dt.lessEquals(ot)},[dt,ot]),tn=X.useMemo(function(){return!Ft||!ot||ot.isInvalidate()?!1:ot.lessEquals(Ft)},[Ft,ot]),An=ye(ge.current,P),yn=(0,oe.Z)(An,2),on=yn[0],wn=yn[1],zt=function(Mt){return dt&&!Mt.lessEquals(dt)?dt:Ft&&!Ft.lessEquals(Mt)?Ft:null},En=function(Mt){return!zt(Mt)},nn=function(Mt,jt){var Vt=Mt,kn=En(Vt)||Vt.isEmpty();if(!Vt.isEmpty()&&!jt&&(Vt=zt(Vt)||Vt,kn=!0),!se&&!$&&kn){var Gn=Vt.toString(),Kn=Ut(Gn,jt);return Kn>=0&&(Vt=w(F(Gn,".",Kn)),En(Vt)||(Vt=w(F(Gn,".",Kn,!0)))),Vt.equals(ot)||(kt(Vt),Xe==null||Xe(Vt.isEmpty()?null:Ce(ht,Vt)),Fe===void 0&&je(Vt,jt)),Vt}return ot},oi=I(),Ht=function $t(Mt){if(on(),bt.current=Mt,st(Mt),!re.current){var jt=Bt(Mt),Vt=w(jt);Vt.isNaN()||nn(Vt,!0)}Ke==null||Ke(Mt),oi(function(){var kn=Mt;ft||(kn=Mt.replace(/。/g,".")),kn!==Mt&&$t(kn)})},Zt=function(){re.current=!0},Pt=function(){re.current=!1,Ht(ge.current.value)},bn=function(Mt){Ht(Mt.target.value)},qt=function(Mt){var jt;if(!(Mt&&Wt||!Mt&&tn)){Q.current=!1;var Vt=w(ce.current?y(xe):xe);Mt||(Vt=Vt.negate());var kn=(ot||w(0)).add(Vt.toString()),Gn=nn(kn,!1);Et==null||Et(Ce(ht,Gn),{offset:ce.current?y(xe):xe,type:Mt?"up":"down"}),(jt=ge.current)===null||jt===void 0||jt.focus()}},xn=function(Mt){var jt=w(Bt(Qt)),Vt;jt.isNaN()?Vt=nn(ot,Mt):Vt=nn(jt,Mt),Fe!==void 0?je(ot,!1):Vt.isNaN()||je(Vt,!1)},On=function(){Q.current=!0},Nn=function(Mt){var jt=Mt.key,Vt=Mt.shiftKey;Q.current=!0,ce.current=Vt,jt==="Enter"&&(re.current||(Q.current=!1),xn(!1),pt==null||pt(Mt)),Oe!==!1&&!re.current&&["Up","ArrowUp","Down","ArrowDown"].includes(jt)&&(qt(jt==="Up"||jt==="ArrowUp"),Mt.preventDefault())},Rn=function(){Q.current=!1,ce.current=!1};X.useEffect(function(){if(ut&&P){var $t=function(Vt){qt(Vt.deltaY<0),Vt.preventDefault()},Mt=ge.current;if(Mt)return Mt.addEventListener("wheel",$t,{passive:!1}),function(){return Mt.removeEventListener("wheel",$t)}}});var mn=function(){Dt&&xn(!1),G(!1),Q.current=!1};return(0,q.o)(function(){ot.isInvalidate()||je(ot,!1)},[ve,rt]),(0,q.o)(function(){var $t=w(Fe);gt($t);var Mt=w(Bt(Qt));(!$t.equals(Mt)||!Q.current||rt)&&je($t,Q.current)},[Fe]),(0,q.o)(function(){rt&&wn()},[Qt]),X.createElement("div",{ref:Gt,className:N()(we,Ae,(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)({},"".concat(we,"-focused"),P),"".concat(we,"-disabled"),$),"".concat(we,"-readonly"),se),"".concat(we,"-not-a-number"),ot.isNaN()),"".concat(we,"-out-of-range"),!ot.isInvalidate()&&!En(ot))),style:qe,onFocus:function(){G(!0)},onBlur:mn,onKeyDown:Nn,onKeyUp:Rn,onCompositionStart:Zt,onCompositionEnd:Pt,onBeforeInput:On},Ye&&X.createElement(z,{prefixCls:we,upNode:Se,downNode:Ie,upDisabled:Wt,downDisabled:tn,onStep:qt}),X.createElement("div",{className:"".concat(Tt,"-wrap")},X.createElement("input",(0,T.Z)({autoComplete:"off",role:"spinbutton","aria-valuemin":ie,"aria-valuemax":ue,"aria-valuenow":ot.isInvalidate()?null:ot.toString(),step:xe},lt,{ref:(0,ee.sQ)(ge,he),className:Tt,value:Qt,onChange:bn,disabled:$,readOnly:se}))))}),Ze=X.forwardRef(function(be,he){var we=be.disabled,Ae=be.style,qe=be.prefixCls,ie=qe===void 0?"rc-input-number":qe,ue=be.value,Y=be.prefix,xe=be.suffix,Te=be.addonBefore,Fe=be.addonAfter,$=be.className,se=be.classNames,Se=(0,H.Z)(be,Ee),Ie=X.useRef(null),Oe=X.useRef(null),Ve=X.useRef(null),ut=function(Ye){Ve.current&&(0,_.nH)(Ve.current,Ye)};return X.useImperativeHandle(he,function(){return le(Ve.current,{focus:ut,nativeElement:Ie.current.nativeElement||Oe.current})}),X.createElement(V.BaseInput,{className:$,triggerFocus:ut,prefixCls:ie,value:ue,disabled:we,style:Ae,prefix:Y,suffix:xe,addonAfter:Fe,addonBefore:Te,classNames:se,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:Ie},X.createElement(Be,(0,T.Z)({prefixCls:ie,disabled:we,ref:Ve,domRef:Oe,className:se==null?void 0:se.input},Se)))}),et=Ze,$e=et},66003:function(Rt,nt,W){"use strict";W.d(nt,{Z:function(){return ae}});var T=W(43079),fe=W(27247),ke=W(34666),oe=W(59301),H=["show"];function p(te,l){if(!l.max)return!0;var M=l.strategy(te);return M<=l.max}function ae(te,l){return oe.useMemo(function(){var M={};l&&(M.show=(0,ke.Z)(l)==="object"&&l.formatter?l.formatter:!!l),M=(0,fe.Z)((0,fe.Z)({},M),te);var A=M,g=A.show,b=(0,T.Z)(A,H);return(0,fe.Z)((0,fe.Z)({},b),{},{show:!!g,showFormatter:typeof g=="function"?g:void 0,strategy:b.strategy||function(m){return m.length}})},[te,l])}},36901:function(Rt,nt,W){"use strict";W.r(nt),W.d(nt,{BaseInput:function(){return M},default:function(){return k}});var T=W(27247),fe=W(32855),ke=W(74430),oe=W(34666),H=W(92310),p=W.n(H),ae=W(59301),te=W(30292),l=ae.forwardRef(function(N,V){var q,le,ee,X=N.inputElement,_e=N.children,ye=N.prefixCls,Ge=N.prefix,U=N.suffix,R=N.addonBefore,O=N.addonAfter,K=N.className,j=N.style,z=N.disabled,y=N.readOnly,_=N.focused,I=N.triggerFocus,Z=N.allowClear,Ee=N.value,Ce=N.handleReset,Ue=N.hidden,Be=N.classes,Ze=N.classNames,et=N.dataAttrs,$e=N.styles,be=N.components,he=N.onClear,we=_e!=null?_e:X,Ae=(be==null?void 0:be.affixWrapper)||"span",qe=(be==null?void 0:be.groupWrapper)||"span",ie=(be==null?void 0:be.wrapper)||"span",ue=(be==null?void 0:be.groupAddon)||"span",Y=(0,ae.useRef)(null),xe=function(at){var Xe;(Xe=Y.current)!==null&&Xe!==void 0&&Xe.contains(at.target)&&(I==null||I())},Te=(0,te.X3)(N),Fe=(0,ae.cloneElement)(we,{value:Ee,className:p()((q=we.props)===null||q===void 0?void 0:q.className,!Te&&(Ze==null?void 0:Ze.variant))||null}),$=(0,ae.useRef)(null);if(ae.useImperativeHandle(V,function(){return{nativeElement:$.current||Y.current}}),Te){var se=null;if(Z){var Se=!z&&!y&&Ee,Ie="".concat(ye,"-clear-icon"),Oe=(0,oe.Z)(Z)==="object"&&Z!==null&&Z!==void 0&&Z.clearIcon?Z.clearIcon:"\u2716";se=ae.createElement("button",{type:"button",tabIndex:-1,onClick:function(at){Ce==null||Ce(at),he==null||he()},onMouseDown:function(at){return at.preventDefault()},className:p()(Ie,(0,ke.Z)((0,ke.Z)({},"".concat(Ie,"-hidden"),!Se),"".concat(Ie,"-has-suffix"),!!U))},Oe)}var Ve="".concat(ye,"-affix-wrapper"),ut=p()(Ve,(0,ke.Z)((0,ke.Z)((0,ke.Z)((0,ke.Z)((0,ke.Z)({},"".concat(ye,"-disabled"),z),"".concat(Ve,"-disabled"),z),"".concat(Ve,"-focused"),_),"".concat(Ve,"-readonly"),y),"".concat(Ve,"-input-with-clear-btn"),U&&Z&&Ee),Be==null?void 0:Be.affixWrapper,Ze==null?void 0:Ze.affixWrapper,Ze==null?void 0:Ze.variant),He=(U||Z)&&ae.createElement("span",{className:p()("".concat(ye,"-suffix"),Ze==null?void 0:Ze.suffix),style:$e==null?void 0:$e.suffix},se,U);Fe=ae.createElement(Ae,(0,fe.Z)({className:ut,style:$e==null?void 0:$e.affixWrapper,onClick:xe},et==null?void 0:et.affixWrapper,{ref:Y}),Ge&&ae.createElement("span",{className:p()("".concat(ye,"-prefix"),Ze==null?void 0:Ze.prefix),style:$e==null?void 0:$e.prefix},Ge),Fe,He)}if((0,te.He)(N)){var Ye="".concat(ye,"-group"),We="".concat(Ye,"-addon"),ht="".concat(Ye,"-wrapper"),ft=p()("".concat(ye,"-wrapper"),Ye,Be==null?void 0:Be.wrapper,Ze==null?void 0:Ze.wrapper),rt=p()(ht,(0,ke.Z)({},"".concat(ht,"-disabled"),z),Be==null?void 0:Be.group,Ze==null?void 0:Ze.groupWrapper);Fe=ae.createElement(qe,{className:rt,ref:$},ae.createElement(ie,{className:ft},R&&ae.createElement(ue,{className:We},R),Fe,O&&ae.createElement(ue,{className:We},O)))}return ae.cloneElement(Fe,{className:p()((le=Fe.props)===null||le===void 0?void 0:le.className,K)||null,style:(0,T.Z)((0,T.Z)({},(ee=Fe.props)===null||ee===void 0?void 0:ee.style),j),hidden:Ue})}),M=l,A=W(3300),g=W(11913),b=W(43079),m=W(18929),x=W(2738),C=W(66003),L=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],F=(0,ae.forwardRef)(function(N,V){var q=N.autoComplete,le=N.onChange,ee=N.onFocus,X=N.onBlur,_e=N.onPressEnter,ye=N.onKeyDown,Ge=N.onKeyUp,U=N.prefixCls,R=U===void 0?"rc-input":U,O=N.disabled,K=N.htmlSize,j=N.className,z=N.maxLength,y=N.suffix,_=N.showCount,I=N.count,Z=N.type,Ee=Z===void 0?"text":Z,Ce=N.classes,Ue=N.classNames,Be=N.styles,Ze=N.onCompositionStart,et=N.onCompositionEnd,$e=(0,b.Z)(N,L),be=(0,ae.useState)(!1),he=(0,g.Z)(be,2),we=he[0],Ae=he[1],qe=(0,ae.useRef)(!1),ie=(0,ae.useRef)(!1),ue=(0,ae.useRef)(null),Y=(0,ae.useRef)(null),xe=function(Tt){ue.current&&(0,te.nH)(ue.current,Tt)},Te=(0,m.Z)(N.defaultValue,{value:N.value}),Fe=(0,g.Z)(Te,2),$=Fe[0],se=Fe[1],Se=$==null?"":String($),Ie=(0,ae.useState)(null),Oe=(0,g.Z)(Ie,2),Ve=Oe[0],ut=Oe[1],He=(0,C.Z)(I,_),Ye=He.max||z,We=He.strategy(Se),ht=!!Ye&&We>Ye;(0,ae.useImperativeHandle)(V,function(){var lt;return{focus:xe,blur:function(){var ge;(ge=ue.current)===null||ge===void 0||ge.blur()},setSelectionRange:function(ge,de,pe){var P;(P=ue.current)===null||P===void 0||P.setSelectionRange(ge,de,pe)},select:function(){var ge;(ge=ue.current)===null||ge===void 0||ge.select()},input:ue.current,nativeElement:((lt=Y.current)===null||lt===void 0?void 0:lt.nativeElement)||ue.current}}),(0,ae.useEffect)(function(){ie.current&&(ie.current=!1),Ae(function(lt){return lt&&O?!1:lt})},[O]);var ft=function(Tt,ge,de){var pe=ge;if(!qe.current&&He.exceedFormatter&&He.max&&He.strategy(ge)>He.max){if(pe=He.exceedFormatter(ge,{max:He.max}),ge!==pe){var P,G;ut([((P=ue.current)===null||P===void 0?void 0:P.selectionStart)||0,((G=ue.current)===null||G===void 0?void 0:G.selectionEnd)||0])}}else if(de.source==="compositionEnd")return;se(pe),ue.current&&(0,te.rJ)(ue.current,Tt,le,pe)};(0,ae.useEffect)(function(){if(Ve){var lt;(lt=ue.current)===null||lt===void 0||lt.setSelectionRange.apply(lt,(0,A.Z)(Ve))}},[Ve]);var rt=function(Tt){ft(Tt,Tt.target.value,{source:"change"})},ve=function(Tt){qe.current=!1,ft(Tt,Tt.currentTarget.value,{source:"compositionEnd"}),et==null||et(Tt)},at=function(Tt){_e&&Tt.key==="Enter"&&!ie.current&&(ie.current=!0,_e(Tt)),ye==null||ye(Tt)},Xe=function(Tt){Tt.key==="Enter"&&(ie.current=!1),Ge==null||Ge(Tt)},Ke=function(Tt){Ae(!0),ee==null||ee(Tt)},pt=function(Tt){ie.current&&(ie.current=!1),Ae(!1),X==null||X(Tt)},Et=function(Tt){se(""),xe(),ue.current&&(0,te.rJ)(ue.current,Tt,le)},ct=ht&&"".concat(R,"-out-of-range"),Dt=function(){var Tt=(0,x.Z)(N,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return ae.createElement("input",(0,fe.Z)({autoComplete:q},Tt,{onChange:rt,onFocus:Ke,onBlur:pt,onKeyDown:at,onKeyUp:Xe,className:p()(R,(0,ke.Z)({},"".concat(R,"-disabled"),O),Ue==null?void 0:Ue.input),style:Be==null?void 0:Be.input,ref:ue,size:K,type:Ee,onCompositionStart:function(de){qe.current=!0,Ze==null||Ze(de)},onCompositionEnd:ve}))},Gt=function(){var Tt=Number(Ye)>0;if(y||He.show){var ge=He.showFormatter?He.showFormatter({value:Se,count:We,maxLength:Ye}):"".concat(We).concat(Tt?" / ".concat(Ye):"");return ae.createElement(ae.Fragment,null,He.show&&ae.createElement("span",{className:p()("".concat(R,"-show-count-suffix"),(0,ke.Z)({},"".concat(R,"-show-count-has-suffix"),!!y),Ue==null?void 0:Ue.count),style:(0,T.Z)({},Be==null?void 0:Be.count)},ge),y)}return null};return ae.createElement(M,(0,fe.Z)({},$e,{prefixCls:R,className:p()(j,ct),handleReset:Et,value:Se,focused:we,triggerFocus:xe,suffix:Gt(),disabled:O,classes:Ce,classNames:Ue,styles:Be}),Dt())}),w=F,k=w},30292:function(Rt,nt,W){"use strict";W.d(nt,{He:function(){return T},X3:function(){return fe},nH:function(){return H},rJ:function(){return oe}});function T(p){return!!(p.addonBefore||p.addonAfter)}function fe(p){return!!(p.prefix||p.suffix||p.allowClear)}function ke(p,ae,te){var l=ae.cloneNode(!0),M=Object.create(p,{target:{value:l},currentTarget:{value:l}});return l.value=te,typeof ae.selectionStart=="number"&&typeof ae.selectionEnd=="number"&&(l.selectionStart=ae.selectionStart,l.selectionEnd=ae.selectionEnd),l.setSelectionRange=function(){ae.setSelectionRange.apply(ae,arguments)},M}function oe(p,ae,te,l){if(te){var M=ae;if(ae.type==="click"){M=ke(ae,p,""),te(M);return}if(p.type!=="file"&&l!==void 0){M=ke(ae,p,l),te(M);return}te(M)}}function H(p,ae){if(p){p.focus(ae);var te=ae||{},l=te.cursor;if(l){var M=p.value.length;switch(l){case"start":p.setSelectionRange(0,0);break;case"end":p.setSelectionRange(M,M);break;default:p.setSelectionRange(0,M)}}}}},29301:function(Rt,nt,W){"use strict";W.d(nt,{Z:function(){return U}});var T=W(32855),fe=W(59301),ke=W(11592),oe=W(48736),H=W(27247),p=W(34666),ae=W(76846),te=W(8654),l=fe.createContext(null);function M(R){var O=R.children,K=R.onBatchResize,j=fe.useRef(0),z=fe.useRef([]),y=fe.useContext(l),_=fe.useCallback(function(I,Z,Ee){j.current+=1;var Ce=j.current;z.current.push({size:I,element:Z,data:Ee}),Promise.resolve().then(function(){Ce===j.current&&(K==null||K(z.current),z.current=[])}),y==null||y(I,Z,Ee)},[K,y]);return fe.createElement(l.Provider,{value:_},O)}var A=W(76374),g=new Map;function b(R){R.forEach(function(O){var K,j=O.target;(K=g.get(j))===null||K===void 0||K.forEach(function(z){return z(j)})})}var m=new A.Z(b),x=null,C=null;function L(R,O){g.has(R)||(g.set(R,new Set),m.observe(R)),g.get(R).add(O)}function F(R,O){g.has(R)&&(g.get(R).delete(O),g.get(R).size||(m.unobserve(R),g.delete(R)))}var w=W(33377),k=W(93912),N=W(18881),V=W(85461),q=function(R){(0,N.Z)(K,R);var O=(0,V.Z)(K);function K(){return(0,w.Z)(this,K),O.apply(this,arguments)}return(0,k.Z)(K,[{key:"render",value:function(){return this.props.children}}]),K}(fe.Component);function le(R,O){var K=R.children,j=R.disabled,z=fe.useRef(null),y=fe.useRef(null),_=fe.useContext(l),I=typeof K=="function",Z=I?K(z):K,Ee=fe.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ce=!I&&fe.isValidElement(Z)&&(0,te.Yr)(Z),Ue=Ce?(0,te.C4)(Z):null,Be=(0,te.x1)(Ue,z),Ze=function(){var he;return(0,ae.ZP)(z.current)||(z.current&&(0,p.Z)(z.current)==="object"?(0,ae.ZP)((he=z.current)===null||he===void 0?void 0:he.nativeElement):null)||(0,ae.ZP)(y.current)};fe.useImperativeHandle(O,function(){return Ze()});var et=fe.useRef(R);et.current=R;var $e=fe.useCallback(function(be){var he=et.current,we=he.onResize,Ae=he.data,qe=be.getBoundingClientRect(),ie=qe.width,ue=qe.height,Y=be.offsetWidth,xe=be.offsetHeight,Te=Math.floor(ie),Fe=Math.floor(ue);if(Ee.current.width!==Te||Ee.current.height!==Fe||Ee.current.offsetWidth!==Y||Ee.current.offsetHeight!==xe){var $={width:Te,height:Fe,offsetWidth:Y,offsetHeight:xe};Ee.current=$;var se=Y===Math.round(ie)?ie:Y,Se=xe===Math.round(ue)?ue:xe,Ie=(0,H.Z)((0,H.Z)({},$),{},{offsetWidth:se,offsetHeight:Se});_==null||_(Ie,be,Ae),we&&Promise.resolve().then(function(){we(Ie,be)})}},[]);return fe.useEffect(function(){var be=Ze();return be&&!j&&L(be,$e),function(){return F(be,$e)}},[z.current,j]),fe.createElement(q,{ref:y},Ce?fe.cloneElement(Z,{ref:Be}):Z)}var ee=fe.forwardRef(le),X=ee,_e="rc-observer-key";function ye(R,O){var K=R.children,j=typeof K=="function"?[K]:(0,ke.Z)(K);return j.map(function(z,y){var _=(z==null?void 0:z.key)||"".concat(_e,"-").concat(y);return fe.createElement(X,(0,T.Z)({},R,{key:_,ref:y===0?O:void 0}),z)})}var Ge=fe.forwardRef(ye);Ge.Collection=M;var U=Ge},22711:function(Rt,nt,W){"use strict";W.r(nt),W.d(nt,{ResizableTextArea:function(){return Ge},default:function(){return K}});var T=W(32855),fe=W(74430),ke=W(27247),oe=W(3300),H=W(11913),p=W(43079),ae=W(92310),te=W.n(ae),l=W(36901),M=W(66003),A=W(30292),g=W(18929),b=W(59301),m=W(34666),x=W(29301),C=W(34280),L=W(16089),F=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
pointer-events: none !important;
`,w=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],k={},N;function V(j){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,y=j.getAttribute("id")||j.getAttribute("data-reactid")||j.getAttribute("name");if(z&&k[y])return k[y];var _=window.getComputedStyle(j),I=_.getPropertyValue("box-sizing")||_.getPropertyValue("-moz-box-sizing")||_.getPropertyValue("-webkit-box-sizing"),Z=parseFloat(_.getPropertyValue("padding-bottom"))+parseFloat(_.getPropertyValue("padding-top")),Ee=parseFloat(_.getPropertyValue("border-bottom-width"))+parseFloat(_.getPropertyValue("border-top-width")),Ce=w.map(function(Be){return"".concat(Be,":").concat(_.getPropertyValue(Be))}).join(";"),Ue={sizingStyle:Ce,paddingSize:Z,borderSize:Ee,boxSizing:I};return z&&y&&(k[y]=Ue),Ue}function q(j){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;N||(N=document.createElement("textarea"),N.setAttribute("tab-index","-1"),N.setAttribute("aria-hidden","true"),N.setAttribute("name","hiddenTextarea"),document.body.appendChild(N)),j.getAttribute("wrap")?N.setAttribute("wrap",j.getAttribute("wrap")):N.removeAttribute("wrap");var I=V(j,z),Z=I.paddingSize,Ee=I.borderSize,Ce=I.boxSizing,Ue=I.sizingStyle;N.setAttribute("style","".concat(Ue,";").concat(F)),N.value=j.value||j.placeholder||"";var Be=void 0,Ze=void 0,et,$e=N.scrollHeight;if(Ce==="border-box"?$e+=Ee:Ce==="content-box"&&($e-=Z),y!==null||_!==null){N.value=" ";var be=N.scrollHeight-Z;y!==null&&(Be=be*y,Ce==="border-box"&&(Be=Be+Z+Ee),$e=Math.max(Be,$e)),_!==null&&(Ze=be*_,Ce==="border-box"&&(Ze=Ze+Z+Ee),et=$e>Ze?"":"hidden",$e=Math.min(Ze,$e))}var he={height:$e,overflowY:et,resize:"none"};return Be&&(he.minHeight=Be),Ze&&(he.maxHeight=Ze),he}var le=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],ee=0,X=1,_e=2,ye=b.forwardRef(function(j,z){var y=j,_=y.prefixCls,I=y.defaultValue,Z=y.value,Ee=y.autoSize,Ce=y.onResize,Ue=y.className,Be=y.style,Ze=y.disabled,et=y.onChange,$e=y.onInternalAutoSize,be=(0,p.Z)(y,le),he=(0,g.Z)(I,{value:Z,postState:function(pt){return pt!=null?pt:""}}),we=(0,H.Z)(he,2),Ae=we[0],qe=we[1],ie=function(pt){qe(pt.target.value),et==null||et(pt)},ue=b.useRef();b.useImperativeHandle(z,function(){return{textArea:ue.current}});var Y=b.useMemo(function(){return Ee&&(0,m.Z)(Ee)==="object"?[Ee.minRows,Ee.maxRows]:[]},[Ee]),xe=(0,H.Z)(Y,2),Te=xe[0],Fe=xe[1],$=!!Ee,se=function(){try{if(document.activeElement===ue.current){var pt=ue.current,Et=pt.selectionStart,ct=pt.selectionEnd,Dt=pt.scrollTop;ue.current.setSelectionRange(Et,ct),ue.current.scrollTop=Dt}}catch(Gt){}},Se=b.useState(_e),Ie=(0,H.Z)(Se,2),Oe=Ie[0],Ve=Ie[1],ut=b.useState(),He=(0,H.Z)(ut,2),Ye=He[0],We=He[1],ht=function(){Ve(ee)};(0,C.Z)(function(){$&&ht()},[Z,Te,Fe,$]),(0,C.Z)(function(){if(Oe===ee)Ve(X);else if(Oe===X){var Ke=q(ue.current,!1,Te,Fe);Ve(_e),We(Ke)}else se()},[Oe]);var ft=b.useRef(),rt=function(){L.Z.cancel(ft.current)},ve=function(pt){Oe===_e&&(Ce==null||Ce(pt),Ee&&(rt(),ft.current=(0,L.Z)(function(){ht()})))};b.useEffect(function(){return rt},[]);var at=$?Ye:null,Xe=(0,ke.Z)((0,ke.Z)({},Be),at);return(Oe===ee||Oe===X)&&(Xe.overflowY="hidden",Xe.overflowX="hidden"),b.createElement(x.Z,{onResize:ve,disabled:!(Ee||Ce)},b.createElement("textarea",(0,T.Z)({},be,{ref:ue,style:Xe,className:te()(_,Ue,(0,fe.Z)({},"".concat(_,"-disabled"),Ze)),disabled:Ze,value:Ae,onChange:ie})))}),Ge=ye,U=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],R=b.forwardRef(function(j,z){var y,_=j.defaultValue,I=j.value,Z=j.onFocus,Ee=j.onBlur,Ce=j.onChange,Ue=j.allowClear,Be=j.maxLength,Ze=j.onCompositionStart,et=j.onCompositionEnd,$e=j.suffix,be=j.prefixCls,he=be===void 0?"rc-textarea":be,we=j.showCount,Ae=j.count,qe=j.className,ie=j.style,ue=j.disabled,Y=j.hidden,xe=j.classNames,Te=j.styles,Fe=j.onResize,$=j.onClear,se=j.onPressEnter,Se=j.readOnly,Ie=j.autoSize,Oe=j.onKeyDown,Ve=(0,p.Z)(j,U),ut=(0,g.Z)(_,{value:I,defaultValue:_}),He=(0,H.Z)(ut,2),Ye=He[0],We=He[1],ht=Ye==null?"":String(Ye),ft=b.useState(!1),rt=(0,H.Z)(ft,2),ve=rt[0],at=rt[1],Xe=b.useRef(!1),Ke=b.useState(null),pt=(0,H.Z)(Ke,2),Et=pt[0],ct=pt[1],Dt=(0,b.useRef)(null),Gt=(0,b.useRef)(null),lt=function(){var dt;return(dt=Gt.current)===null||dt===void 0?void 0:dt.textArea},Tt=function(){lt().focus()};(0,b.useImperativeHandle)(z,function(){var je;return{resizableTextArea:Gt.current,focus:Tt,blur:function(){lt().blur()},nativeElement:((je=Dt.current)===null||je===void 0?void 0:je.nativeElement)||lt()}}),(0,b.useEffect)(function(){at(function(je){return!ue&&je})},[ue]);var ge=b.useState(null),de=(0,H.Z)(ge,2),pe=de[0],P=de[1];b.useEffect(function(){if(pe){var je;(je=lt()).setSelectionRange.apply(je,(0,oe.Z)(pe))}},[pe]);var G=(0,M.Z)(Ae,we),Q=(y=G.max)!==null&&y!==void 0?y:Be,re=Number(Q)>0,ce=G.strategy(ht),tt=!!Q&&ce>Q,it=function(dt,Ft){var Wt=Ft;!Xe.current&&G.exceedFormatter&&G.max&&G.strategy(Ft)>G.max&&(Wt=G.exceedFormatter(Ft,{max:G.max}),Ft!==Wt&&P([lt().selectionStart||0,lt().selectionEnd||0])),We(Wt),(0,A.rJ)(dt.currentTarget,dt,Ce,Wt)},ot=function(dt){Xe.current=!0,Ze==null||Ze(dt)},gt=function(dt){Xe.current=!1,it(dt,dt.currentTarget.value),et==null||et(dt)},kt=function(dt){it(dt,dt.target.value)},Ut=function(dt){dt.key==="Enter"&&se&&se(dt),Oe==null||Oe(dt)},Bt=function(dt){at(!0),Z==null||Z(dt)},bt=function(dt){at(!1),Ee==null||Ee(dt)},rn=function(dt){We(""),Tt(),(0,A.rJ)(lt(),dt,Ce)},fn=$e,en;G.show&&(G.showFormatter?en=G.showFormatter({value:ht,count:ce,maxLength:Q}):en="".concat(ce).concat(re?" / ".concat(Q):""),fn=b.createElement(b.Fragment,null,fn,b.createElement("span",{className:te()("".concat(he,"-data-count"),xe==null?void 0:xe.count),style:Te==null?void 0:Te.count},en)));var Qt=function(dt){var Ft;Fe==null||Fe(dt),(Ft=lt())!==null&&Ft!==void 0&&Ft.style.height&&ct(!0)},st=!Ie&&!we&&!Ue;return b.createElement(l.BaseInput,{ref:Dt,value:ht,allowClear:Ue,handleReset:rn,suffix:fn,prefixCls:he,classNames:(0,ke.Z)((0,ke.Z)({},xe),{},{affixWrapper:te()(xe==null?void 0:xe.affixWrapper,(0,fe.Z)((0,fe.Z)({},"".concat(he,"-show-count"),we),"".concat(he,"-textarea-allow-clear"),Ue))}),disabled:ue,focused:ve,className:te()(qe,tt&&"".concat(he,"-out-of-range")),style:(0,ke.Z)((0,ke.Z)({},ie),Et&&!st?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof en=="string"?en:void 0}},hidden:Y,readOnly:Se,onClear:$},b.createElement(Ge,(0,T.Z)({},Ve,{autoSize:Ie,maxLength:Be,onKeyDown:Ut,onChange:kt,onFocus:Bt,onBlur:bt,onCompositionStart:ot,onCompositionEnd:gt,className:te()(xe==null?void 0:xe.textarea),style:(0,ke.Z)((0,ke.Z)({},Te==null?void 0:Te.textarea),{},{resize:ie==null?void 0:ie.resize}),disabled:ue,prefixCls:he,onResize:Qt,ref:Gt,readOnly:Se})))}),O=R,K=O},29125:function(Rt,nt,W){"use strict";W.d(nt,{G:function(){return oe},Z:function(){return F}});var T=W(92310),fe=W.n(T),ke=W(59301);function oe(w){var k=w.children,N=w.prefixCls,V=w.id,q=w.overlayInnerStyle,le=w.bodyClassName,ee=w.className,X=w.style;return ke.createElement("div",{className:fe()("".concat(N,"-content"),ee),style:X},ke.createElement("div",{className:fe()("".concat(N,"-inner"),le),id:V,role:"tooltip",style:q},typeof k=="function"?k():k))}var H=W(32855),p=W(27247),ae=W(43079),te=W(65030),l={shiftX:64,adjustY:1},M={adjustX:1,shiftY:!0},A=[0,0],g={left:{points:["cr","cl"],overflow:M,offset:[-4,0],targetOffset:A},right:{points:["cl","cr"],overflow:M,offset:[4,0],targetOffset:A},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:A},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:A},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:A},leftTop:{points:["tr","tl"],overflow:M,offset:[-4,0],targetOffset:A},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:A},rightTop:{points:["tl","tr"],overflow:M,offset:[4,0],targetOffset:A},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:A},rightBottom:{points:["bl","br"],overflow:M,offset:[4,0],targetOffset:A},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:A},leftBottom:{points:["br","bl"],overflow:M,offset:[-4,0],targetOffset:A}},b=null,m=W(80402),x=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],C=function(k,N){var V=k.overlayClassName,q=k.trigger,le=q===void 0?["hover"]:q,ee=k.mouseEnterDelay,X=ee===void 0?0:ee,_e=k.mouseLeaveDelay,ye=_e===void 0?.1:_e,Ge=k.overlayStyle,U=k.prefixCls,R=U===void 0?"rc-tooltip":U,O=k.children,K=k.onVisibleChange,j=k.afterVisibleChange,z=k.transitionName,y=k.animation,_=k.motion,I=k.placement,Z=I===void 0?"right":I,Ee=k.align,Ce=Ee===void 0?{}:Ee,Ue=k.destroyTooltipOnHide,Be=Ue===void 0?!1:Ue,Ze=k.defaultVisible,et=k.getTooltipContainer,$e=k.overlayInnerStyle,be=k.arrowContent,he=k.overlay,we=k.id,Ae=k.showArrow,qe=Ae===void 0?!0:Ae,ie=k.classNames,ue=k.styles,Y=(0,ae.Z)(k,x),xe=(0,m.Z)(we),Te=(0,ke.useRef)(null);(0,ke.useImperativeHandle)(N,function(){return Te.current});var Fe=(0,p.Z)({},Y);"visible"in k&&(Fe.popupVisible=k.visible);var $=function(){return ke.createElement(oe,{key:"content",prefixCls:R,id:xe,bodyClassName:ie==null?void 0:ie.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},$e),ue==null?void 0:ue.body)},he)},se=function(){var Ie=ke.Children.only(O),Oe=(Ie==null?void 0:Ie.props)||{},Ve=(0,p.Z)((0,p.Z)({},Oe),{},{"aria-describedby":he?xe:null});return ke.cloneElement(O,Ve)};return ke.createElement(te.Z,(0,H.Z)({popupClassName:fe()(V,ie==null?void 0:ie.root),prefixCls:R,popup:$,action:le,builtinPlacements:g,popupPlacement:Z,ref:Te,popupAlign:Ce,getPopupContainer:et,onPopupVisibleChange:K,afterPopupVisibleChange:j,popupTransitionName:z,popupAnimation:y,popupMotion:_,defaultPopupVisible:Ze,autoDestroy:Be,mouseLeaveDelay:ye,popupStyle:(0,p.Z)((0,p.Z)({},Ge),ue==null?void 0:ue.root),mouseEnterDelay:X,arrow:qe},Fe),se())},L=(0,ke.forwardRef)(C),F=L},49658:function(Rt,nt){"use strict";nt.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var W=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(W)||/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(W==null?void 0:W.substr(0,4))}},83145:function(Rt,nt,W){"use strict";Object.defineProperty(nt,"__esModule",{value:!0}),nt.CopyToClipboard=void 0;var T=ke(W(59301)),fe=ke(W(25769));function ke(w){return w&&w.__esModule?w:{default:w}}function oe(w){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?oe=function(N){return typeof N}:oe=function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},oe(w)}function H(w,k){var N=Object.keys(w);if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(w);k&&(V=V.filter(function(q){return Object.getOwnPropertyDescriptor(w,q).enumerable})),N.push.apply(N,V)}return N}function p(w){for(var k=1;k<arguments.length;k++){var N=arguments[k]!=null?arguments[k]:{};k%2?H(N,!0).forEach(function(V){L(w,V,N[V])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(N)):H(N).forEach(function(V){Object.defineProperty(w,V,Object.getOwnPropertyDescriptor(N,V))})}return w}function ae(w,k){if(w==null)return{};var N=te(w,k),V,q;if(Object.getOwnPropertySymbols){var le=Object.getOwnPropertySymbols(w);for(q=0;q<le.length;q++)V=le[q],!(k.indexOf(V)>=0)&&Object.prototype.propertyIsEnumerable.call(w,V)&&(N[V]=w[V])}return N}function te(w,k){if(w==null)return{};var N={},V=Object.keys(w),q,le;for(le=0;le<V.length;le++)q=V[le],!(k.indexOf(q)>=0)&&(N[q]=w[q]);return N}function l(w,k){if(!(w instanceof k))throw new TypeError("Cannot call a class as a function")}function M(w,k){for(var N=0;N<k.length;N++){var V=k[N];V.enumerable=V.enumerable||!1,V.configurable=!0,"value"in V&&(V.writable=!0),Object.defineProperty(w,V.key,V)}}function A(w,k,N){return k&&M(w.prototype,k),N&&M(w,N),w}function g(w,k){return k&&(oe(k)==="object"||typeof k=="function")?k:m(w)}function b(w){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(N){return N.__proto__||Object.getPrototypeOf(N)},b(w)}function m(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function x(w,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(k&&k.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),k&&C(w,k)}function C(w,k){return C=Object.setPrototypeOf||function(V,q){return V.__proto__=q,V},C(w,k)}function L(w,k,N){return k in w?Object.defineProperty(w,k,{value:N,enumerable:!0,configurable:!0,writable:!0}):w[k]=N,w}var F=function(w){x(k,w);function k(){var N,V;l(this,k);for(var q=arguments.length,le=new Array(q),ee=0;ee<q;ee++)le[ee]=arguments[ee];return V=g(this,(N=b(k)).call.apply(N,[this].concat(le))),L(m(V),"onClick",function(X){var _e=V.props,ye=_e.text,Ge=_e.onCopy,U=_e.children,R=_e.options,O=T.default.Children.only(U),K=(0,fe.default)(ye,R);Ge&&Ge(ye,K),O&&O.props&&typeof O.props.onClick=="function"&&O.props.onClick(X)}),V}return A(k,[{key:"render",value:function(){var V=this.props,q=V.text,le=V.onCopy,ee=V.options,X=V.children,_e=ae(V,["text","onCopy","options","children"]),ye=T.default.Children.only(X);return T.default.cloneElement(ye,p({},_e,{onClick:this.onClick}))}}]),k}(T.default.PureComponent);nt.CopyToClipboard=F,L(F,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Rt,nt,W){"use strict";var T=W(83145),fe=T.CopyToClipboard;fe.CopyToClipboard=fe,Rt.exports=fe},76374:function(Rt,nt,W){"use strict";var T=function(){if(typeof Map!="undefined")return Map;function U(R,O){var K=-1;return R.some(function(j,z){return j[0]===O?(K=z,!0):!1}),K}return function(){function R(){this.__entries__=[]}return Object.defineProperty(R.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),R.prototype.get=function(O){var K=U(this.__entries__,O),j=this.__entries__[K];return j&&j[1]},R.prototype.set=function(O,K){var j=U(this.__entries__,O);~j?this.__entries__[j][1]=K:this.__entries__.push([O,K])},R.prototype.delete=function(O){var K=this.__entries__,j=U(K,O);~j&&K.splice(j,1)},R.prototype.has=function(O){return!!~U(this.__entries__,O)},R.prototype.clear=function(){this.__entries__.splice(0)},R.prototype.forEach=function(O,K){K===void 0&&(K=null);for(var j=0,z=this.__entries__;j<z.length;j++){var y=z[j];O.call(K,y[1],y[0])}},R}()}(),fe=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,ke=function(){return typeof W.g!="undefined"&&W.g.Math===Math?W.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),oe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(ke):function(U){return setTimeout(function(){return U(Date.now())},1e3/60)}}(),H=2;function p(U,R){var O=!1,K=!1,j=0;function z(){O&&(O=!1,U()),K&&_()}function y(){oe(z)}function _(){var I=Date.now();if(O){if(I-j<H)return;K=!0}else O=!0,K=!1,setTimeout(y,R);j=I}return _}var ae=20,te=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",M=function(){function U(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=p(this.refresh.bind(this),ae)}return U.prototype.addObserver=function(R){~this.observers_.indexOf(R)||this.observers_.push(R),this.connected_||this.connect_()},U.prototype.removeObserver=function(R){var O=this.observers_,K=O.indexOf(R);~K&&O.splice(K,1),!O.length&&this.connected_&&this.disconnect_()},U.prototype.refresh=function(){var R=this.updateObservers_();R&&this.refresh()},U.prototype.updateObservers_=function(){var R=this.observers_.filter(function(O){return O.gatherActive(),O.hasActive()});return R.forEach(function(O){return O.broadcastActive()}),R.length>0},U.prototype.connect_=function(){!fe||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)},U.prototype.disconnect_=function(){!fe||!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)},U.prototype.onTransitionEnd_=function(R){var O=R.propertyName,K=O===void 0?"":O,j=te.some(function(z){return!!~K.indexOf(z)});j&&this.refresh()},U.getInstance=function(){return this.instance_||(this.instance_=new U),this.instance_},U.instance_=null,U}(),A=function(U,R){for(var O=0,K=Object.keys(R);O<K.length;O++){var j=K[O];Object.defineProperty(U,j,{value:R[j],enumerable:!1,writable:!1,configurable:!0})}return U},g=function(U){var R=U&&U.ownerDocument&&U.ownerDocument.defaultView;return R||ke},b=q(0,0,0,0);function m(U){return parseFloat(U)||0}function x(U){for(var R=[],O=1;O<arguments.length;O++)R[O-1]=arguments[O];return R.reduce(function(K,j){var z=U["border-"+j+"-width"];return K+m(z)},0)}function C(U){for(var R=["top","right","bottom","left"],O={},K=0,j=R;K<j.length;K++){var z=j[K],y=U["padding-"+z];O[z]=m(y)}return O}function L(U){var R=U.getBBox();return q(0,0,R.width,R.height)}function F(U){var R=U.clientWidth,O=U.clientHeight;if(!R&&!O)return b;var K=g(U).getComputedStyle(U),j=C(K),z=j.left+j.right,y=j.top+j.bottom,_=m(K.width),I=m(K.height);if(K.boxSizing==="border-box"&&(Math.round(_+z)!==R&&(_-=x(K,"left","right")+z),Math.round(I+y)!==O&&(I-=x(K,"top","bottom")+y)),!k(U)){var Z=Math.round(_+z)-R,Ee=Math.round(I+y)-O;Math.abs(Z)!==1&&(_-=Z),Math.abs(Ee)!==1&&(I-=Ee)}return q(j.left,j.top,_,I)}var w=function(){return typeof SVGGraphicsElement!="undefined"?function(U){return U instanceof g(U).SVGGraphicsElement}:function(U){return U instanceof g(U).SVGElement&&typeof U.getBBox=="function"}}();function k(U){return U===g(U).document.documentElement}function N(U){return fe?w(U)?L(U):F(U):b}function V(U){var R=U.x,O=U.y,K=U.width,j=U.height,z=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,y=Object.create(z.prototype);return A(y,{x:R,y:O,width:K,height:j,top:O,right:R+K,bottom:j+O,left:R}),y}function q(U,R,O,K){return{x:U,y:R,width:O,height:K}}var le=function(){function U(R){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=q(0,0,0,0),this.target=R}return U.prototype.isActive=function(){var R=N(this.target);return this.contentRect_=R,R.width!==this.broadcastWidth||R.height!==this.broadcastHeight},U.prototype.broadcastRect=function(){var R=this.contentRect_;return this.broadcastWidth=R.width,this.broadcastHeight=R.height,R},U}(),ee=function(){function U(R,O){var K=V(O);A(this,{target:R,contentRect:K})}return U}(),X=function(){function U(R,O,K){if(this.activeObservations_=[],this.observations_=new T,typeof R!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=R,this.controller_=O,this.callbackCtx_=K}return U.prototype.observe=function(R){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(R instanceof g(R).Element))throw new TypeError('parameter 1 is not of type "Element".');var O=this.observations_;O.has(R)||(O.set(R,new le(R)),this.controller_.addObserver(this),this.controller_.refresh())}},U.prototype.unobserve=function(R){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(R instanceof g(R).Element))throw new TypeError('parameter 1 is not of type "Element".');var O=this.observations_;O.has(R)&&(O.delete(R),O.size||this.controller_.removeObserver(this))}},U.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},U.prototype.gatherActive=function(){var R=this;this.clearActive(),this.observations_.forEach(function(O){O.isActive()&&R.activeObservations_.push(O)})},U.prototype.broadcastActive=function(){if(this.hasActive()){var R=this.callbackCtx_,O=this.activeObservations_.map(function(K){return new ee(K.target,K.broadcastRect())});this.callback_.call(R,O,R),this.clearActive()}},U.prototype.clearActive=function(){this.activeObservations_.splice(0)},U.prototype.hasActive=function(){return this.activeObservations_.length>0},U}(),_e=typeof WeakMap!="undefined"?new WeakMap:new T,ye=function(){function U(R){if(!(this instanceof U))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var O=M.getInstance(),K=new X(R,O,this);_e.set(this,K)}return U}();["observe","unobserve","disconnect"].forEach(function(U){ye.prototype[U]=function(){var R;return(R=_e.get(this))[U].apply(R,arguments)}});var Ge=function(){return typeof ke.ResizeObserver!="undefined"?ke.ResizeObserver:ye}();nt.Z=Ge},98040:function(Rt){Rt.exports=function(){var nt=document.getSelection();if(!nt.rangeCount)return function(){};for(var W=document.activeElement,T=[],fe=0;fe<nt.rangeCount;fe++)T.push(nt.getRangeAt(fe));switch(W.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":W.blur();break;default:W=null;break}return nt.removeAllRanges(),function(){nt.type==="Caret"&&nt.removeAllRanges(),nt.rangeCount||T.forEach(function(ke){nt.addRange(ke)}),W&&W.focus()}}},93314:function(Rt){"use strict";Rt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAACaCAYAAADl9acYAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQd4U1Ubfs/NaJtO9kzLahFQEJkiUBBFUFFkCCjiAAVFERT5FREQQQXBBcpysWRP2RtkKRsEOphNodCZdDfjnv85CU2TZt2bhABNDw9PmtzvrO+c957xLQIP0pkz1yrQIEmwwcDzHhTj91klEo7jpcG5zetWUJdmRjmPvTM9GI9JgSGvadOoLE9KJJ5kPp2YXLtZdO1kT8ooz2vigCNelvPYezPEG7z0CDAn4pJqPvJA5A3vdcl/S3LEy3Iee29OeIOX5YDx3nh4VFI5YDxin6DM5YARxKb7g6gcMHd+nMoBc+d57LKGhCQ1ZURBCoVL2nKCO8sBZWW50x1TOWDuLP8FlV4OGEFs8glROWB8wmbPKikHjGf882bucsB4k5t3qKxywNwhxrpRbJkGTOx0ehlA3d9e5VEtzA3ulGe55zmg1QOfrCVo34BgQGvr5rLDRl4RRZG+5NjBESBc4FHw1LlrCAuPsCo0JjKi7J5hYqfTXADBq4byCJLf82Nf3kA3OfD9LgKdgeCzZ4CUTJ1VKQFyKQgpmeMSjiKvQC+oplspN/wOMDcBVFv0Bo+KwYJ4VE50H3Jg7j6CWzkEX74A3MrSgTfeKZpSaBCHcAVn/JunBHlFPDR5BkG9LMjPt7mZLOtbskQADea9wqOW9coqiGHlRPcHBxYcJriQQvB9P+v2cqCwWFxgoOJk6JeTNX4HmJMAHv6xP4/6VXw/+OxNx/bM/pIohdUE9VW/VxwjOHiJYO5A6xolpGSpYW3jIW4w/A8wM+h+UHSY2pvHgzV9NXymeor0wPc7Cf7XzWJ/4Nsm+Ly2LzZx+OwZ3yuVbzhNsPEMwcI3rM8wMikHiURi5gNbbQoKrc84zpjkj2eYzQC6f96DomUd305ctrp8tp5gSk/f1utzlFhUOHYthy9f8D1gdpwnWHiEYOVQ6zNM6QM/AY+CImHnF9YtfwTMCgB9P+5G0SHa9xP3bk2gT9cBU3r6Hjp95nBYNcz3gDlwkRhX843vlfS59PmFHfjFzgC/2pJ1nEEnEIpIAG+834Wia2Ox7PJ8wt0twLz7J8Gsl3zf316zCVYPsz5oe85F1yUcu0YwcQPBjlElZyjL8wsrQeyBn+XxK8DETqefgyACFCPe6kjxfDPfT6C7BpilBLMG+L6/A34h+P1VikCZ60nuTYpzN4AxqznjCqPOMZ1RSp9f2OVLYZH1lbOrNvjVlswIGEAKYOyrj1K82NL3E+huAWbEMnbFSn1+Qzd4AcE3fajPZV6X04D3lnHGM4xOawKFJwLLYiD5H2AoCkHwJQMLA42v090CzJjVBBN7UCh8rN3AgDrqCYq6lX3L6RQ1MGQRhwWvA7UrALbnFzCJjOhG+d2WjFCkUYKZPZpSDIv1PWDGrycY34NCahI0+yxN/Ivg3c4UlUN8VqWxok/XEfRrSdG0tm/rzcoHBv7KYc5AILqqLWDcOb/45RmGEFyhFL8/0Yga33y+Tl9uJhjxOEVIoG9rnrqVKSJSRFb0fb3tG1A81sC39TLRSu85HL57Eaii0Bm3oqEKqZXSJaUURUxTU0Tyuy0ZAc5SYCUbxE+6+x4w3+0kGNiWooqP3/Qz9xB0bUTRsLqI2eEFUlbvA9WBJxv5ltdMit9jFocpLwB1InQIkBEQTmLUHStOBoMBOr24K2+/AwwPHOKArS2iKCY9VzKIg34jyMgTv6f1wpwqL8JLHKgUTLHwjZIxZTKg0V2Bzg2tLzvYBYA75xe/25J1mkEnGAzYyXE40KQmMK23uLeLN8b1j0ME7epTxFTzRmnCy/jzXyCqIny+NVryDzFeKfd+xLcrDOMMO8MMfgx45iFrOZA7AstiTvvVoZ91usM3tClHcLpeZWDmAN8DZtlRgkY1KJr5+BC87hQQLAeebCwcZN6gXH6MgG2P+rfyDmD+WLoV8xZugkIRiNh2TTHghcfRoF4tFBZpkXgpGQ81rmdu9puLOLzwMPBYPR1Cgzw/v7CC/WpLxjrc/jtaT2LApRrhwC+DfA+Y9aeI0dKzbT3vTCChk3r7eaBABzzfTGgO79CtPUmM9b7U2jv9bf3kOyjSlihLcoSg93MdkZ2Th227j2Hoq8/inTeeNzZ+xFIOsTHAsw/pAeL5+cUvAdPuG1pVRnArQgEsGex7wGw7RxAgBTo19M4EEjqtD1wEkrPYm15oDu/QbfkPSM0hHsu8du0/gSnfLkFGVrbThjFLynULJ6FOZHUw2RNbyd/qUJLFHZV+ywr9aksWO4Ou0BK8KueRz/bVq++CUuD+RGbhB3R/0LeAOZEEnFIRvPGYb+vdGw+cvU7w3uOe1dv+mfeRk5svCMUfvz8AA3o9jgkbCJQVgPe7lGTz5MDvj4f+VXs/JH1ip1PmAkHy17u8z42bjl4lxjf9C809m0CCZo4FUVwKsDPOJLz0ZTp6Fdh6jtnWe1bvuCm/4q/tRwQ1/b03e2LIwGfw1RaCkADg425AOvPkYCHZd0cG43dbsk4zaDFgWHiHcG85wjBQoEhnMhAzf5r/Jihkf9/+fjXDtDXqGA108+Eqcy0DYAfwMU95NnEFzVgLovibwK8HCab19qze61s24Pf5K7A5KwB5vHM1CblMij9m/Q87rtc1jsek54CMPIBayGD0BgP0ImUw/gwYFiqjllhHGAcvAkuPcijU8cgv0KGgSGv8LNJqweu1MOh14A3ss+S78W+Dzuo3RsPoTy0YgIjQALFz0C36tBzg570EE3p4NnHFVn5TA0zaSPDzy57Vu2bIS6jF67BDHYBHgnVI0kow+6ZjLyZNm9RD+35jkZINfNO7ZIVhEn+e16NQ6157/OqWjJ1h9n1IXoydTi8AeGD+KzxqinCEsfkswfBJC2HQacXOG7v0B+e9CGXVUK+U5aoQdm5iE3eqh296R/XoDEBu0e3/hcz3FzF+Z292trI91Zgav7N2tKrDrrfFTdgTI4dAl61BipZDDXYINRCMvBrusNvBikAMHT8LTM3/pwElK4xMAuQV6uBuKK4yA5hEVfY8SvmmHCETGyjDtzqbQLHf0KMgaCnWEcaW/whGT1mAHHZP6oW09bueaFy3khdKcl0EO+y+v4xgphs2MWxbs+K46bLCDIoi6+9iVLKY4PbTp8UB5t8h/UB53qimz1aJA9lyLExz7H1vyMCnUa15L/x9EfhtkIk/nh74y9ShPz5JnUGA26qFZIdcTofWqR5xxd5Uip1O9wDoJNYRxs4LBB9PXYxUdaHrGSqAYuWUp9GmSQ0BlN4h8cTq8qVfOGgKStpBeAoJb4DEYPrPsU89b/5e/LvEYPubLCIQX06NEtWpfwa/yA4h0FEgqVCK71OCUeTARdLLfbpg9PAXsfGsBBtOA0uHmKpyV0PZsqFl5lo5QaXWgRqNw4pTHiEYGa2M+KX0yMROpxsA9BDrCGNvAsG4GcuQdMt45eJx+nXsk3iyNbOY9k161wOry8/GqZCr1t4GBA/O3T0Nm7gSDl/89IBRHiU0nRk3CgU3knEmT4pZN51rrjI5TN2oGmCOMP44BKx7B8jINemP8ZRCK2Y5LNXAMrMlS0hSpwKw9TRGME+XHf5ekybEfPCInU7/BDBArCOMw5cIPvt+JRJUGqHj7JRu2rsd0P+JGBuanELTTVpwwO3/cnjFxNcTwMz95hquxud5pd+skIEfR6NJA+F2y6o1S3Fj4xpj/X9lBmK7OsDuChMUKMf+v36AXC4Fc4QxYwew/X0gM8/k5VKvN0BvcF9gfc8CJuGWuh4twgoQnJSBzK+nDP+3eLTsBahJSNL8DdD29kaUAFsDSU4vpVJp3FTETqdzAbwl1hHGySSCCTPX41RimlcmzthBrTCsV1Obss5cJ2hWXQupTIoiHUW+1nRYZkcn5kRbTzlIOQq5hBmimfRu2RwoeU4gl5rAFiI3Odpmb/NRK0zXu+zgKzZtWZWK/VvTxWZzSP/EK5HoEivcxsFQWIBzk8caVxmWmMT+g6thNlfMg/p1xYfv9DXSMEcYEzYAu247wnBXQ9myE/fslixRpf6FUgw2N5bgDChmk6Lw33MMqkqlg8JeVKmn8hRjHI0QIdgbiJynGWhiZ9AZoPhgaEeK50Q4wmDCvwmzt+HwGe8EcH67V1N8MshWV4UBpnlNLQID3Lcn5nkKrZ6iUEex4azEqC08di0BW1XDgsTP+2NHsrH6F+/0m9Xetns1PN9b3IWHPi8XyetXIOPoEeg1WbhYKMGK9CCoiiSoWq0SnuvWzqhLVuyoz+wI411mmi3epZI9Lt2zgElIUht9INtpdDJPMUsSGf59NCFFxc8TknI6AoZ9LqbCmj+V4X33zMAEAOMHtaXoJ0KLVpUJjJuzD3v+vSh+xtnJ0ffxaMwY0dHuCtO8pg6BAcK3LI4axCTai/4hRsBM3kww5DGK6o5vYx32S52pw9QxbEi8k6o2DMeoj2q5VVhqNnB29JsI0TP5M6Dj5Gg7dwmkpVZOsyOMtyg4joDyBhRq3d+Osbru3S2ZSp0LCmf+9ZM5CUY3qBWx3LREUy5RpbkKQOl0FAimvrksPAME08Q6wmD74DGz/8H2A/+5NdClM8U2r4VFE7rZBcwjtXQIkHsOGLbSLP7XBJhvdxD0fJiinhs+pVk5n41IBM/UFryQSHggvpxRooovpsgdFwjoD8MQri3ZIso/XYzm9a2FwDfUAFPxX/AaRYSCeCR/KW7fvQuYJE0RQF3vSQh2UQn3bsOaYXEJSZrPADrJBfP5BceCVx+4LO0r1hGG3gC8//Np/LXrmJjxdUhbv1YE9vzU22eAmbOPBRmieNCNFzvP8/jhaxVSL3vn4M9zBJN/bgSZgJsyplZ0KQ24oSZgq8vmE4V4+9hrkNIS8O5uPhbNOz+CprWpWRhd7Ahj9svMYM871rT38pbM/q2XvelHoeU4bpxBgt+Jjr8MAqfi80NXZEW/H1UEuOMIY/zCRPyxZr9XABMSJMP5pbelahYlsjNMi1p6402Pp8lyhWEhIBpVp2hdV1yp6nwgPAhYvzQF/+zOEpfZCfXgz6LRIMrxKsq0B5YcKsL6UxRFvBygelBdLjhZGMCx/RfTKWMCUGZzbAClvJEmtiGH97oEGLdhzBHGjL4UDyvLOmBUmn9AaamAay7GimAXgdErzG1RlX36k9el+PlgsPFtK9YRxtwtNzBl7havTZoLywYhuJRbSCNgauvBlAg9TQYDjyVHOeOWbOVxoEoo0Mn2JttpNZvOcmhfn0KTXoTr8TlITSnCrRSt8TMvV7gj79KVPDskCo+1tb/rZkLScavzcTlTARBrZUu+MB1coHNHZ8rQXEzvH4T+8yWY9DzQrj6QptFDzzRlPUj37JbM5pZMeCfZK5CNgsPt3PlbEny3LwSlHWEIqWLzcTWGfbFaCKkgml0zeyNaaa3QdqcAs+msSa2k+4OCmmYm2nyWQ98W9idabo4eqSla3EopMn6m3mRgKkJ6KlM6dV5Plz418ES3CjZE7Ar9w2X5UGXbv3bmC1NBAiqBEOf34zFhKlzLq40PuxK0i8qFutBzRdd7FjDx1zSDCKELxA2tmZoyyztqqc9tUdDlDAm+2hUCdxxhHIwrwOAJy5EvIkSCsz78Nq4rnmhpfU/BANOytgEydwQmpSpjQro/b68we+JNArzej4jjKouz0q+luDwGAzWCxnI1Kr0qPfpEZTzXv6pVwUzf6+MVBTiX6vi+hxoKQfUF4AJswWZZGF+UCUN2IsYMaINnbcVd4jp0m/qePcNcvJlTldcaUm5vVN3qnKNM1zUcJm4LhTuOMP65qMWYGWtxJcU76jGT3nwUrz1j7ZnCCBilAbLS96RucIFJtv88ZpLD/HMZSEgFXmkrrqANp2yjEYsroYRar6f44I3zxh9qNwnH8FHWNxBLj2ix6F85SKltmGV9lBrAF6RConCuh8fotCn7MSC2Fob3ELkPddDBexYwrL2JSZqtFPQpdwfHUT7mf+zjTWFwxxHG8St6zPhtCw6cZXcSnqdhLzTF2FethZcMMK2UBki9DBgmbz18mYAJbMUk5shiYBsxORzT5ucZ8PHbcUaC4OpBGDe55AbiShqP9/40gHLOt058UZbxXMPJnQuUKK+DLi8DEs0R/PJBLIIVwjULHPXgnt2SsQbHq7JeIJSYFIi8mNgeeeT6cFRQAItFOsL4L5li0do9WLrLriK06FZ2e7QO5v3PwugcgDcBo9MbsPT2CnMxFcYwdiNFuMhlKjcs/J23AMMEoONHJhj5JA2T44tvS2TTo5cX4kKqY5X9YuYacq9CEhzlMngmr8uGQasFLUpDPcUV/DCiKwrcNBwrrvueBsyKFVTSvG32aQraRPRMdJKBWaa+vSrcqNAo1hEGsyD8Y/1R/LzmjFea1EBZAbtn9rIqywiYSB5Siecey3U6A5YeN23JmCCPORIcK8IWhV0ps1Wpj8hzjyPmsDPN5P+ZNCWInMOXPz9g/PtgohZfbpEZ3SE5TxSGXBUkIa61vPnCDLCzFEuGrOMY1q02Xunq2VS6p7dkrKOJ17N7UAPP1PG9moatCoOBJ9go0hEGe+P+vC4e3yw84JX2VAoLxMmFL9sApnUkD4kXAKPV6bHsuNQIGDb5p28nmCwixmZSJnA5jeCZh1x3NzfpKi7M/xlFGRmo0qoNqnfohPAG1mcH1dUCfDP+sqkwjuCreY2Mf478swiJGa6V3Az518EFVgHhXMu0DYUZ4G8Dhuqy0Sg0EfM+8myHf88DhjEzIUmzAaA9XA+ZcIqR60KRp+XgjiOM3Sdu4s0vtyAkSIrgQCmCg6QIYZ+BMuPf7Dfzs9vP2bPi34ICZTh2szJ6NM41HuyrV7f2G8tWmNZRPCSc5yuMJWCYGcjHawm+7Sv8DPPfdSBfS9C5oWveHhg+GFqNyfRBEhgIeWgY2kz7AZysRDh5KT4fP0y5vZ0lwBdzGoO9FwbOK4S6KMDpCkP1eaD6fCNghCSDNhe8zmTsVznrMD59XIGa7Wx194SUVUxzT2/JihuZmJJThWoNZ0HgNY/EH28MRUY+B7GOMFibcrJzkJuXB3Z1zXHc7U9ivNlh0mX2aXpm/7ekLA57E6R44zHm5slWAs0A0ybKpDDoaWLhHJafMK0wLIm1ujx0iYD56WgrQO3ryuplSN6xzajkqM83+RCr1aUrol95A5zUJIT971QO5n2bZPybXYRNntsYvx4guLJrL1qkbsD2moOQHP6wlUskRkt5PfiCm5AEC/exa9DmgNcVoVL2KQy59RsqhAQg6tPvwAU5U1F0zvH7AjCsC4mqnE6UGpitvsfSJ0IIHb8lmNzIlkCsIwxPJzDLf10NrDtJMNyBjzDvAkaH5SdkbgOGOf5oVAN4sKawnl+YOwspf+81EzPIh9VvgCbvfoDAKlVx9JAai+ZcNz4PVBBE9W+M07uPo9/laeBgknSeC22ObbVeQ06QCRzselivuQhZBNveCX+JGAoyEZEThyE3fkIYNa00yh69UPdF6y2wsJ6ZqO6LLZl5pUlW9wHFMkrh6mTokgdf7QzG5UwpxDrCcFmwAAImPPztIMHorva3RkbA1GEhGoRPDkfVMj/EVoARaabM2vliCxj9QQtJ1GDAtU3rcGPXDmjVWWDfWWJbtHp9BiCwRScU6KQICJRg4VEp4g8ex4tXvrFSpGT0JxXNsKraIEgVFaHLuQ5ZSE1wAeLsEioRFZ5PnAVlTok5hiQwCG1+mAupwr1V5r4CDGNkgkrzEij93Znqi5CB/XafAhduySDWEYaQsl3RFGiB6Tsce4NkgGlbx+WtqatqjM9ZlOAVJ0tWmPeWEvzYX3gYcOY9cuKzsLE1EVK5oagQJ7/4DDlXS67gZTVqI6dlXxwNaIXrJ06j75UZkFhoHbNyK7Zqh2E3usHAlCupDgFhtSAJEmdsxsqJqZSHevmJaHPoC6vm1nvpNdTu7t6R+L4DjAk06t7M+tKuDb+QkQTw00EFTl2XQawjDIHFOyVj6h+frSeY4uC2it1MRVXgIeUIpBLTWcjdxMJArDgpN2/JPlpF8PlzwoPDjl9v0vZ1N2k1apz+ehJyVaZzS3HimUMKIoWUWrusqtDqUTR46308/bUKekghU1QBkbq+PbPXPkNuEog8DAOS5+ABzVEzSWj9GDSf+JVbXbovAcNs+oODFYSjsp8oqCm2gcj06z9BOHJNbjTZ7RDt/oQQWa2ZXEw0ZWY1yYzYGdCYuj5L7AJNwgBlvHRgj3mjnfvtx0YlS/Zcp9dj6wU5nmpiysccdLMYm5UECr3HruHwQ3/P+KPLzcWZ6VOQfdG5xWbVzl0R9fJgEI7DjO0Eu85rQSTuH1lbV45HbmYSzl1OR+2im4g0ZEJpyETdAC26zpnv1tDdt4AptulPNJ1rplMKUY6uFh8PxL5LARDrCMMtLtvJJAYw3qqTlcOCw7JYLUoBwWHZWWvBIYJxz3jeAiZxv7R0AZJ3bIetdT1B7T4voebTPc0VMbe2G08Wur26sII+6JyD5x4JQU6+FkfOp+DA2es4fO4GsvO1qFk5BE3qVEaTupWNn9G1K0AmILT1fQ8YxhhKqfTi9ewBoPQjSiFAxAasOh2AbfGBRr0qMY4wPJ86phLuFmBm7ibo2oSioYAL+uPXgKvpBIMe9VavgctnE5C7fyuyz58Bc2oRVKMWaj7XBxVbWGuELjxMsOxIAYjUtaqMo9Z90CkHz7WwXkoNPMXZy2k4ePYGDvx3HVdSTHIjBqCVn7verJQJwBQzjKnzJyRlPcZJuJ6UxwsAHEoP/joXgA3nAiHWEYa3ps7dAgyTeTwSRdHcuecDYzdXHCN4oBrwaH3v9Fqr55GWmY2ICNe3XWtOEvyy17MVZmRsLnq2dH4bdv5qBt6Ytg3d29TDOAFvhjIFmNLDGp+c1UxCycs8xTu3jcrMJDvi5VhxOghiHWF4Z+rcvRXGGBy2EvCYABB8sZHggycpqoa6f+lgya/MXC20RUUIDXV9gGJueb/d5tkZ5r0OOejd2nldm/+5gkkLDuOzQe3QrY1r2+0yDZjiwbp4PUNJeelKSqlZSX3/ZRkWHVNArCMMbwFm/AaC8c9Qt65rPWkDCw7Lggw9YVLhcprWnCCoH5qKGmHUaC4tl8sgl0kgl7FPqWhdt6upuQiWc1AoXN96MSd849ez62/31YPeeSwHL7Z1DpixvxzA7hNJWP9lL1RmjgtcJL8ADOOBSkWDCqiGaQoYlYn+TZJh/hEF3HGE4YqpQp7/sC0PrzRPhYxPg9yQjmCkoTA/HUV5aZDq0wBZBQQ0my6kKFE028/BGODpOYHBYfPy8qDT6aDT6Y2flolpUxeDhznscAWkfxKzEFNDAbncteIk8xIzYinxSBj1VrtcvPSo4y0Zs0Z96qPVqFpBgcXjnhXEx/saMCZfZNmTQCjTmZCAEC0oUglPU3iOnDEYtCcb16nCrDaN6ZxKU1HK0xOEIOrMDSlmHnDPEYZLzhoKAW0aivLSQXRpCKRp4HTpKMxNAy1KN36XE+cRAHjKIb/pckhk7h967bXz70STao47wWHZ9bZebwJOMYDY38Zrb4vEtKwZeAKMq5IJSDKZFOuPpqFr8yqCNBjYDd3AXwwgnPu+2Qa3zccrjzleNY7G3cR7P+7G8+2jMWaAMH8r9zVg4pKynudA1jmawExnjKf8fwRkAwF+j46MuJSoyupEKdkdnyoh0/e65wjDUX1c3MdA3hUEEO+YL6fU+BwRNUQa07tAM7v5OpNM8LoXg8PqDXrotHrojUDSQafXgXmrKZ3i0uV4vKkwiT2TJ/WcqYWBBLp8PzkieK1NIV5r71iO8/2qE1i2O8542GeHfiHpvgbMRVX2RzzlpwnpKCGEOa76i5dynxCeTriaTvpP2RnqliMMhwC9MBaBBaeFNEcQTU7FvpDWeU0QrVCiCynA7jjHip9Cy3FFxxz/mVYi0//sPD2u5wWgXUOBSmkAXvtVj7R819s3R215ta0Orz/m2FVVnwkbkJyWa7xOZtfKQtJ9DZiEpKzXAfKbkI6W0JAiQrDyZjZ5adyWUM4dRxiO6qOqRVCkLRPXHCfUt2gjhLXw7jmGBYdl18Uf+Tg47K4LBCz0uZh6P1oJnL/p/qH/5dYGvNnBfv5rN7PRb9JGVAoLwoavrC1enQ3gfQ2YC1ey6kil3CV2lhE7S7MKuMIxf4UGuuMIw1FdhszjCLk6XmxTHNLrqRT5TVdAJnNfPaR04cbgsPsIJjzrmbqL2E4evgxsPy+uXubM7+Vfmbss9661X2lDMdhuABRgyc4LmLnmJGKbKfHlW8KNyu5rwLBBS0zSbKBuWGOyWCoj1rrnCMPRZNEX5SLk3ACmVih2PjmkV9WYiso1RHrec1I7i1HJ5Ct3Kjiso6rPXgeY9P6bPsKB2uSRWKSlZbjNy3FjhuOTD5kIzja9891OnEhMxVs9muHVbsL5e98DJu5ydkNOxh934enfhmPsUDl0ZRgCZUS0IwyHWzJmqPPfcATorrk9yKUzZld5DTKlKUCQNxLr98jlJhV/X6ZrmcBXmwnmDBReb2R0CxQWmiOaiG5uj+5dsOyPH23yMd2ybmNWg6nJfDv8cbRpLDzO6H0PGMaN2zYyi8Q6/Ru+Ogw6A8FfIh1hOBs5evE7KLJ3ih5cRxluSR5FWLNxXiuPFeRJ6D53G5KWC3y4gmDhG8IAw7Ssa9Vlpsrup8jaNXHh+A6bAnYcu4bPfjto/H3z1D4IZ5JcgalMAIb1NVGlHkwpmQ1QwRf3H6wPRU6Re44wHPHXcGMTQm7+LJD9rsnU+soIaO2ux1z75Yu163fdStcUuYXA6wsIVg4VBpjMLDUeaOrgAOK6OjNFcvwhVCiluzbh90PYdvQqqlcMxuovSjSkhRRbZgDDOnsxOaczpYaFlEKQp4Sxm0KQlidxyxGGI+Zqs+IRfuUDIbwXTJMWsxghIc79CAsu7C6Ndg0lAAAdVklEQVStMEws88Jsgg3DhQEmSXUdLdt55hLJuIKs/g2x7UvcdrJtWPcxq40q/h2bKfGViAM/K69MAYZ16NKlzHCDlHwBwr0FUKdr7efbQpCs8a4jjMKCfITHDQRH3d97l578qmqTUblWczGYcErLzjDT+/hej63HLA5r32YOCl135dyFeHTuahtsynVOa4qvPv8II4aVyLJOXUzFsG9NW+bXuz+EISK9lJc5wBSz69KNzEheLxlFQVnEIrvmUlN3B+NiuncdYWi1OsjjP0KQznvxIDVVh0Bem1kreCcZg8N2pwhzX4juVkN6zebwx+u8oHr/OXoCPXrZBpsSW/GAvj3wy6yvzdl+WnsKi3aYnKFPHtIBnZu79qBpWWeZBUxxJ69coYE6ae4zlOqfIyBPM59uxc++36/AuZvedYTBJNz6+OkIL3AVn1b40N8K6oawRu8Jz+CCcvImgiEdKKoLF7p7pe4B8zl8148XVO+uPQcwYNAwj+tt0iga/+4t0Z4a8MUms9HY0vE9ECnUHc7tlpR5wFhyfA+l0lqq7L4A/QlAhTmHgnA8We51Rxh5FxejcvZSjwe7uIAk/cOo0nqK18qbsYPghebUGO7Dl+n1Pzh89iwvqN71G7fhzbc/9Lh5LALCzr+PQVMkR2w0Na4u566m49J1tVElRqyDEb8CTDH3LyblPMhTw67fjwZVPXTV+44wspP2oVq6IBU3QRPiprYWwtvOE0QrhGj2PoKO0dSoR+fL9O5SDm/H8oLq/XP5Gowc7R2tic9/XIlNyU2wY5RH1gJGVvklYFjHL6k0Ty85EbhxV6KceNsRRuatS6h1fYTX5mK+IQR5TZcbDb+8kVhw2MY1KFrV8UZpwsv4ZC3BCw8LC0o7/7fF+HRCydnDWS1FOSmQh1S363aX5XtlxGTEBfbCxveAIMFCB/s1+i1gGDsGL9Cvvpgm6eVtRxgZGZmomTQYHNUKn01OKHlIcEG5AfWE+eB2WefKY0DVMCDWO0G5XNZXTMDOTu3qUzxuinDhNH0/cx6+nGYrpS+diflxLkhPgFRRGfIQ+wzq9OxA5DUei5VDgYruObw0V+vXgOn8LR3L85jibUcY6iw1KiV9CLnhpqt5Ieg5DxkOV16PRyKFyTBcFbrxDPNZJj44rKtyXT1nvsYaVqeC4k1OmfoDfpjl2ncYb9CiMOOS0edyUOVoEGM4cuvUuGkrBHdbgIVvALWs4++6arLNc78GTOx0yq6efvS2I4zs7ByEJY1HkNYUactZ4kkg9FwE9JIKMEgijH8bjN/Z36bftCQcudLaeKC6q9KEPd8dB2Tliw8OK6x0x1Q/7SWoGkrRt4XrksZN/Brzfl3skpB59S9IN13hy0KrQxZkK+ANCQ1Do7ePYO5AoIF1DFqX5Zcm8G/AfENfB8Fv3naEkZubi6CkbxCou2yc9CZARJgBwcCRVlgZV3KC0aSmAhwnQYBcYowHI5FIwIN9MjPfkt/shcUQPdq3Mxy5DLDwfQNFBod1t77ifMyxuVxCBdX7wZgJWLzUdXh3Zh7NtmSgPCQBIQgIt+8/qtmw3fj5zep4yDoGregu+TVgOk2nTNl8pbcdYeTnFyA9U2MMDhQYIIFcwoGTSGCgnHHLECTnIJVIMG2H1BjywtcCRBYc9shlgrdEBocVPbtKZVjyDwGLLyqk3mHvjsGa9ZtdV0k4FGZdBa/NM/JbUcX+wSy692z8PDoWAjwpOa3TvwEzjXajHLa0b0DxSXfvnA9cj3AJxfe7TG5bq4aKyeU5bWIqsOkswcguvu3zyuPE6IBDSL2DBr+Hrdv3uOxshVqNkZqwH7q8NCNtYKUG4CS2V2G1OozE7ClvoZOHFx3+DZjptD0F/m4RRTHpOd9OHja4c/cRdHuQGh3r+TKxScuMuXz9kmDRmM/dgKB6+wwYgv0HjrhkS6+Bb2PlbzNQpDbZILEtGdualU4VH3gaX0/92ii89HZSVpY7NQllzvOLfYG7W7d7Nqe3a/NGA1hR7WfQZhKKU0yAN62396wkhTKFyUPa1qVo6KXDvNB62YH/2x0EXzzv/cnjrA07zhPsT4SgepkeGdMnc5V++nE6Phz/PTITmEIlhSykOmQK24M/W3mmzV2Lpxp7f5z9BjCPT6P1DRwuetMRhqsBtnzOnFHEVAMeVvp24hbpmata4lHcFzH9LKZl8TJXn4Cgep98+kWcPmtSknSWVi/7BZNmrsc/G2eC1xVAqqgEeYjtVRjhpPji1wN49qE7x+uYyAi7C4E3XvA+XWFU6Vo1ABsP2MzJwvDlMnjTEYarAbZ8zrYoVUKBR+vduUF01J67YUR2OhmYs49g9suu+9uhy/OIT2DyFedpz/bVWLXtFL77/F3o8zMhCQxHQJh9nZ/RU5diYJc7p95QZgCTnKHLppTaHK3Zm3bwYhkqKIDFg72/VLsabLZFYbYhnRu6nkCuyhL7/G4AJuEWwKT9QsyUWz3WDdeSkl1268zR3ThwLgtDBzyFIo0KnDwYgRH2VfYrP/jCzKTdX3pPZ8ll60wE990Kk5yhi6OU2kSaZx5OBy2UIkDqPUcYAnloJDtwkSC7AHj6Dm4THK4wIoPDiumXI1pVJjBqBcGqYa5fEA+16IxbqaabL2cp+dJJ3MqRoGXL1si7cRKcNAiBFe2vIopqDZemn133kqsyvf38fgTMJkops4WxSUOWSFGoI9joRUcYQhl+SgUkZZK7EtBp3DpgsjhzdqHdckiXlQcMWcReTq4Bw+z5mV2/sxQcrMCVuH+NoQof7DwESf/+aTz4B1WyH8tDHl7zhDpxlwA9A4+7alXAfQcYVYb2V1C8YY8N7y6XQl1AsGoojyD3vZK6zWHm9siDmK9u13u3Mgrtb71GbZCbm+e0mbVq1cDJIyavMK99OAvrfp0IfVEOFJWj7earUKUG9mxZ45WuOzqv2Cv8vgNMcqZuCuXpWHudGb1GipvZxKuOMLwyIn5eSGSDR8AiQDtLDzZ+ALu3rTKSzPrzAMa//xK0OSlQVLHZfd8uhuDQ/p1QKDyPiFCmAaNK17KD3g/2mP/ZXxJcyeAw/xUeNT3UZPXzOe7V7tes2wx6vcFpme3btcaa5SbX2gfP56Dnk62NipiKqo7tB1at+BMPPdjE47a6kr1YVnD/rTAZ+r6U8ivscWnyVgnibnL4sT+P+l6yN/F4NMoLQLXIh2zizpRmy9PduuCP+ab3YE4h8OCjzyMzfrvDMwyjm/rVZPR8vofHHC7TgLmRpetoMFC7Ximm75TgVDJn1G96srHrw6jHnC4vQBAHqipd+zvu/2JP/Dhjsrm8zv0n4sSWHx3KYRjh0DcH44NRnt8sl2nApGTROnqD7oq9kZq1T4IjV0Q7/xc06OVE7nPg6DS2bXL+AqvW4hVEdvnEXEna2bW4uGY4pEGO99ZPPv4YZs3y3DNpmQYM42hyujaBAjbXJxvOcFhxggHGI+UD92dGeU67HDg6/SGAd36GqfHoMNTuULJaFGZexem5T4CTOL7ufCCmAf7dv0EQ11MyrWN6WmYq84C5lqEdyVF8J4hTlkQc+URZUSbMG4PowsVlSEhSO3zlBtm5+alR0UOPD+KaZ5fa0aQryM+3oi/d/ocfaYOCQudxQCeOHYUPRrxpLocZk8U0i8Wt1HSHLQ+Qy3Hj0jFjzE1Xya8Bw4IuJWfoFgJ42RWjip8TQlbVqijtbwz3dw8kfwJM23YdkaXWOOX6tMljMWzIQCuawW9/hJVrNznNt37Fr+jc8VGXI+rXgCnmjipT353w/Es80IIALDAIM56QMFBQSpmkLAUEJzmeX1qrSuBfLrnqQwJ/AkyXJ7sh+bo5ALZdLs+cPgmvDuxj9ezPFesxbETJucZexrfeeAnTv3QdQqTMAyY5TdeZEspcjdjXjfDm5Ka4REDerF1F5tos0Ev1+hNger7QGxfiLzrl3PyfpqJfb+sr4vSMTDR4qCOYy15HSVmrJs4ddx3Dp8wDRpWhvQQKYfGjvTGJCS4rK8nvPDhvt9WfADPwlUE4etx5ROpFv/6A55950mYkn+zxMv45etLpCB/esw5NGjm3Vy77gEnX+lyQIua2xFOM+hNghg8fjp17Djhl2aolc9C1i21A1x9//h3jJn3jNO+EsaPwocWFgT3isg+Y8hXGatzv51uyTz75GGvWb3E66Teu+h0dLYIlFRNfuapCs7bOgzG1a9MCW9ezKI+OU5kHTPkZxnrw72fAfP3VFPy+yK42k7mTOzf+idYt7cfB7PBkH6cmzsz/29ULhxAe5thlT5kHjOV0SUzKfp6CLwkMAnIjJjLcyo3bRZV6Kk8xxpyPIjsmqiQgYkKS5jpAzfauBFzP6Miw9Z5urdzN709bsjmzZ+K7mb84ZdWBnavR9MFGdmm+/XE+Jn7pXOy2cP536NnD8UrkX4BRaSZQSieauUnIphhl+LNWoFJpFlFKSy7yCYmLUYabRyBBpdkISp8pzkMImRitDP/c3QnvaT5/AsyyJQswYcq3Tll29O+NaBht/45HyLZs0Et9MOvbSQ7r8DfArKOUPm/BjSkxkRFWl++JKvUuSvF4CSCwO1oZ0aX4e0KSmmn2fWoBmPXRynAf2ymW9MCfALNt8zqMGD3BKWDOHt2BKKVj36+du/XD8VNnHZZRu2YNnD+xqxwwjAOJKvU1SlHiDYGgT4wywspZb8I19QUQlBhPULokJqqCecVJUKl7g8JkocS0zQiSopURUZ6uFO7m9yfA/HtoL14Z8r5TViWe2Y9qVR2HUftp7kJ84iLGjLNVqsysMKcTk2s3i67t0KXIheTsSlJK0yilJRqVFPVjoiIuW59z1Ew5q8T9EsE3McoI85km4Zq6HgjMvn4IIVRPSJVGtcMy3J30nuTzJ8AkXjiJZ3uXRD+2xzdV/BGEhzsO1JlyMxWNHnncqRDzmymfYuhg+9pS3gKMq/kqZE54pBp85sy1CjRIEmww2BfnKoKC23NEsrzk/IKc/PycRjzTzrudQoLCAi3BwH6mlH6eV5Bjjo3HEUIUitALoDBfpfDU0C+/IM+5gEAIB9ygCVGEXXeUrawpX2bcvIx2jzuPHJ167SQCA5yHZevR9w3s+9uxy9mnn+qMZQtYyFPb5Awwaek3BcUBkEg4jhQY8po2jcpyY8gtprAnuV3kTVCpPwKFOcgkIdgbrYzobJntokrTgKfUKjY4B/RvEBlRAjTT1m4Ppehk0fIxMcoI51KxO9Q3f1phaFEmHmhuNWQ2XNWknHMYpq+YePGytXhnpPkYalNGSEgwkuIOQyq11V721grjjeng0QrjqgGJKs0SSqmF/ynyfUxk+CjLfAlJWR0BYmWFKZVyHevVDPvbmk7zHUBHFv9GCPkzWhkuWOPZVVvFPPcnwFQI5lE1qrlD9jA1/bSkUy7Zl52TiwYPdkBhUZFD2u0blqBta9u6/AcwSZrzFNR8PcxR8mqDqHCm2m9O8Uma/gTUKjY4R0h0A2W4lcbfxWuaQTyhC8yAAbkQHRne2OVI3QECfwIME7pWr9sC+QUFdjkZFhqK5MR/BHH5taEfOtUa+GT0u/hk9Ds2ZfkFYG7coIo8gyabUpiDHUqItGl9ZYjV/WJikmYUBbW66A+RhgfXrEmsLJsuqXIfMlD9mZIVBoZgSXhYaTpBI+chkb8BpknLJ6BKvmGXa1WrVMbFs/sFcXT7rv3o8/Iwh7SO1GT8AjCJydmPUp4/ZMGdwmhleCghRG+11VKpp4HiI4vfNDGRETbG4JRSaaJKk8Ni9ZhBw3HtomuHHRY0Wl4kEgsYL1bt9aJcWVyyCnv1HYBz5+x78K9Zswb27NwqqF16gwGxnZ9Eerr9y01mffnv4QNQKIIElceIfKl0y+q7Y2eY+CTNOwS05NqDkKMxyvDWpTmRqNIsppRanEXIhRgHW60ElYb5I21VXAYFGd4wMtxzTwqCh8dE6G+AGfzW2zhwwPLdV8KwunXqYOtm4VpKX0+bjt//cKxs+cu8n9Gh/WOCR6TMACZRlT2PUr7E0Jtw82KUYUNLcyL+mno3ISi5hiFkV4wy/Al7HEtQZc8F5d8q2ZZx86OVYebvgrnsIaG/Aeaj/43Fhr/smxs3bBiDDWtXCubohbg49OzVzyH9kMGv46MPzXc7LsstO4BJ0hyloC3Nkxt4JzoyYnZpDiRcU8eBwOxTlFK6uGFUhVfscSoxSf02BcwrCgE5Fh0Zbl5xXHLXSwRiAXM/ayuztn88/mv8PM/qrsbMyRbNH8KeLVYSAJdcZnKd/87H26Vr3uxB7NtmrR1d5s8w7LxxUZWdQ0Etzhvk0eja4TaSq4Qko4cFs5iYI9y0Bsqw/9kFTLKmLeWp+cxCQAobKMNszkUuR8xDAn8DzLTv5mDy1B/tcq1d25bYus4+mByxedacBRg7cardxxzH4VrcYSt1/zIPmMuqzKZ6ylnatRpCpPlhNWvWtLr5unmTBmdrNbmWnCOUjIqOCv/eHjdv3LihyNUrspmzjOLnUsI3q6esaL498xALgrL7G2B+W7gcI8fYVw5/PPYxrFvO3DcIT2npGWj4cGfo9Vb3P+YCmMSfSf6LU5kHTPy17FcJ4f8o2Y6R89GR4Taepy+pNNEGShOsAYN+0VERDi2WEpM05yioWf5CKfdaw6gws3xG+LC5T+lvgNmwaQcGDravgNm9a2csX2hfpcUZh/u/+i42b9ttl2T40Ffx1eclm4wyD5jEJM131FoqvyRaGW7tuMqo7pIVSynZa8k1Cr5jw8iKVlJ+y+elb9UIyPfRpbQH3IeCsJz+BphDR46jW0+7x0qj4RczABObNm7ZhZdef89uNmaMxozS/GaFSVSp91KKWAtufBQTGTG9NHcuXtf05w3WUn4CNIiOjHAYhTQhST0agFmHjBDsi1ZGlOiYiR05N+j9DTDxiZfRqoOVzZ+Za/369MD8WfbPI85Yq9Pp0fDhTmDumEondo5hZssRtzWgy/QKw1T5L6o0WZbq+pTiiYZRETYWQolJ2R9Q8DMsGRakDFcoCbGvhwEg/pq6CyEwO7MigKaBMrwCU/l3Y+67lcXfAMNC9tVp1M4ur159uQ9mznBsLemMwWMnTMOsueaduxXp0j9m4ZluJpvCMg2YxCR1fQqY9cDYRA4MC6usDCc2r5KEJDVbKdiKUZzUMZERFZwxWaXSVCwE0i1tbFytSm6hwkkmR4Cxp9rPirnfr5WZM75KymYwGGw99Qr1XmmPnefjEtG2k6UxbgmV5TmmbAMmWd2H8jBLsgjBtWhlhN1wuglJmiWAlTbz+Rg7lwOlmZ2oUl+lFGaLS8Khb3TtCLNFprcBUro8fwMM6z/zYpmaZutc/L23X8eUCZaaTeK437l7Pxw/aWu+3Oyhxvh7h2lIyzZgktRTKGCOY0kI1kUrI+xaICUkqZl715LzB8WumKgIu1J+y2FIVKnXUgqzTT8BvoyOjHBsbCFuDF1SiwWMywLvIoEQXTLWvB49+yAhwcpsydjqYUOHYNT79g/vQrq1bPkqTPj8CxtSdo759/DfCA1lLrcdp/te0p+g0myCRWhx5jGmYVQFu5f4CSpNHCg1S/kJIYuileGDXDE6/lrWBOY5xkxHyOYYZbjZq4yr/J4+90fAvPbGWzh8xFaNf8S772D4OzYaT4JZnJubi/Ydu9gNqTF39kx0irX1qGlZuM8Bc+PGZa86k8jVVzwGwOwRQQLD4CCpxq5LkFxDxXOgCC5mAOEwO5jLdHnlUqAP72KA5FcLxqWHSDPNajiCR8tNwlx9xav2sjo6w9ymTeCobjTR3bpjQlaDvLbddjnrptAV5oPRH2PTZlsPmLVrVv1q7+bf57rJSmO2Zu36TM3LLzArmAVWqo+qD/dD96c6Y1T3CiASx/F1JNpku9t9T9rjLO8d01a+Uw0uL/fucCCoSqPvCYGN9JJS8n5B2nn7ejMCmxpUpUl7TsL9HRHdBVWbD0CYspXRNZA+Lz394IQq91SI4HLACBxUfydTVGs8FpROseUDHZafGufRCtNxOh1nyM+YKFVUMqs86fLSaW7y0U1n5j/teahlLw5eOWC8yMyyXJSiWqMhoLBRGiOUvpaXFueRalLsdPongAGMfwUZl6G4sARtcw4e/XrXNhv7qbvN43sCMGcSUyy1Asw8aRpdw+gcw9FzMcwrLktMnnLaEg4oqjV8DpSzsRSjPAYUpF9Y5gmvOs2gbXke069tm8A9l7enaYNQWXCAhKMNK4ZFdl6yxqHfO0/qdDfvPQEYdxtfns93HIj9xpBm0BVUpgYteH0ReL0W1FAEWXDl/w5+VvEhIS1JSbli98VYnLdGjbr7furWZVGYXDawYlAAgmTSMY8vXn1XXGk56k+ZBYw3ViV7TLvXVipXk1DIRHZGwyYxex47nf4LwJ6xXuK+0cR5CDERjdjzWs8IXsvdvJRTGDDt7HXt9QLtmIJbF34QUcQdJS2zgLmjXPPHwmu2UCj0+SxYr1XiCN8l91a8fT19kXwqBv9Xg975fuHZaw9reZN6YLWqlfYe2rGoRO4motxiwIvI4pS0HDDe4qSflDPrqS5aA6UyAtAR23dz3u52gyffH3vj9HYWrcE0Nyl0lCOjC255dnXtrXaWA8ZbnPSTcna/3PsyBa0LILPLkjWVvN3tyk2emp+fljTEVC5N43j0zU2Ps/KM6u06xZRXDhgx3Cqnxe6Xe12gYKFJSF6XJaudK3qJ5xdRVG3ETNvZJcI5nqPPFt6ME629IL5a4TnKNGAopfLkbIRIDAgBj2BQnUJPiUIqQRD7JNSgAIgCBIGUkkCOIIAHH0gIFwBKAkH5QEogJwRyUCKn4OWEcDJCIQeBnFLIACoFAfOgLQX7TnH7O5UCHAdQCQjhQKkEIKbvAGf8m4DAFAqEEGIcCnLbbMH4m3FDAtDbtj70dtADCmb7w/6B8gB4gBiMfxNiAGW/se8sogLRg0IPYvyvA2D6DqIn7DuFlhJoKeV1BJwWhGophZZQaEG4QhBaSClfxIEr/HbR1mZrli2unp/8X6tcHW92bhJdv/6cLRvW/AIiyweHPIMEubXDkEsI0QqfhibK4KqNXqEA86hxOF9X1B1Zl5mDlHsq3dOASU2lIQYZKuv0usrgSCUJIRUBvgLlSQVKEMGBhPOgEaB8OEDCKBBGYAyJEUKBEAI2ocuTOxw4dfoMzp0/j/j4RJw5+x/i4uJZGBKbotq0boWFf9jGwKSAjgDMwUkuBXIIkA3QbBBOw4GoeVANoVATjmYBXJaB0syWrR79SSaX33rhuef7zpr2P/u+ad3pjBfz3BXAUEq5lCzUNhj0dQmhUQBRArQWBalBCGoAtBqlqAZAuM9QLzKlvCjgzaHDceCgydslc+Eqk8nNoSiYIRn7r9PpUCEiAn/vMxvAepN1BYTgFkBuUYoUApoCEBYcWEUpuSaRSK/UqIBkQghbZX2W7jhgKKWylCx9WwOPdoTQhylIE0IRbemzzGe9La+oTHGA+aWjBIkE9Byl5JSEw6EaFaRHCCFs+3lH0h0FTHK6bjIFhoNtm8pTOQd8wgGiJsBPtSvLrAIPe6vqOw8YguGg5YDx1oCVl+OCA4SoCb1PAcO6Zt6SAe0IpQ9TigcBRANwHhSxfGaUc8A1B1g4s0RC8B8l5JQE9/mWzFF/iw/9hOjrGkCiYKDmQz9AaxKCqpSSagAtP/S7njRllIIUEELZgT+VgqZwIDeMh34JUUlAr1FaRg/9noxm8bUy1esq6+1cK5vORiS8/FrZEy7fmbzOrpUBqgGImhCoCUqulaU8zSBSWbpEh/SqVYmVz+0700rxpd7RM4z45ng3hz3BJSREoadQSDkSZKBQgPIKUAeCS8IHMiElE16aBZeAnICTWQouCYHUJMQ0Ci9vCy6JlIJKOJOAkqNMcGkrwCTMFJdYCCwtBZilBZbsO5NWwiQPoaUFlsQouGQSS8oTkzCzRHAJGIWVtLTgEryOAtpiwSUTWjJhJqi14JKnKCKEFoKgEITLlxDk63laICXIh4Hme0Nw6d3RvzOl/R8AdGoXzom1qQAAAABJRU5ErkJggg=="},68535:function(Rt,nt,W){"use strict";W.d(nt,{ZP:function(){return Zi}});const T=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},fe=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=ke},ke=Number.MAX_SAFE_INTEGER||9007199254740991;let oe=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}({}),H=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}({}),p=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 ae={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},te={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class l{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class M{constructor(e,t,n,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new l(e),this.fast_=new l(t),this.defaultTTFB_=i,this.ttfb_=new l(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new l(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new l(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new l(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,i=e/1e3,s=n/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function A(a,e,t){return(e=C(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function g(){return g=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(a[n]=t[n])}return a},g.apply(null,arguments)}function b(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(a,i).enumerable})),t.push.apply(t,n)}return t}function m(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?b(Object(t),!0).forEach(function(n){A(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function x(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var n=t.call(a,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function C(a){var e=x(a,"string");return typeof e=="symbol"?e:e+""}class L{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const n=`[${e}]:`;this.trace=F,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}}const F=function(){},w={trace:F,debug:F,log:F,warn:F,info:F,error:F};function k(){return g({},w)}function N(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):F}function V(a,e,t){return e[a]?e[a].bind(e):N(a,t)}const q=k();function le(a,e,t){const n=k();if(typeof console=="object"&&a===!0||typeof a=="object"){const i=["debug","log","info","warn","error"];i.forEach(s=>{n[s]=V(s,a,t)});try{n.log(`Debug logs enabled for "${e}" in hls.js version 1.6.11`)}catch(s){return k()}i.forEach(s=>{q[s]=V(s,a)})}else g(q,n);return n}const ee=q;function X(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function _e(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function ye(a,e){const t=Object.keys(a),n=Object.keys(e),i=t.length,s=n.length;return!i||!s||i===s&&!t.some(r=>n.indexOf(r)===-1)}function Ge(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 n,i,s,r="",o=0;for(;o<t;){if(n=a[o++],n===0&&e)return r;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(n);break;case 12:case 13:i=a[o++],r+=String.fromCharCode((n&31)<<6|i&63);break;case 14:i=a[o++],s=a[o++],r+=String.fromCharCode((n&15)<<12|(i&63)<<6|(s&63)<<0);break}}return r}function U(a){let e="";for(let t=0;t<a.length;t++){let n=a[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}function R(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function O(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var K={exports:{}},j;function z(){return j||(j=1,function(a,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\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 d=o.parseURL(u);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return h.alwaysNormalize?(d.path=o.normalizePath(d.path),o.buildURLFromParts(d)):u;var v=o.parseURL(c);if(!v)throw new Error("Error trying to parse base URL.");if(!v.netLoc&&v.path&&v.path[0]!=="/"){var E=i.exec(v.path);v.netLoc=E[1],v.path=E[2]}v.netLoc&&!v.path&&(v.path="/");var D={scheme:v.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(D.netLoc=v.netLoc,d.path[0]!=="/"))if(!d.path)D.path=v.path,d.params||(D.params=v.params,d.query||(D.query=v.query));else{var S=v.path,B=S.substring(0,S.lastIndexOf("/")+1)+d.path;D.path=o.normalizePath(B)}return D.path===null&&(D.path=h.alwaysNormalize?o.normalizePath(d.path):d.path),o.buildURLFromParts(D)},parseURL:function(c){var u=n.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})()}(K)),K.exports}var y=z();class _{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 I={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Z{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,Ze(this,"stats")}setByteRange(e,t){const n=e.split("@",2);let i;n.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}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={[I.AUDIO]:null,[I.VIDEO]:null,[I.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 _),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=y.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[I.AUDIO]=null,e[I.VIDEO]=null,e[I.AUDIOVIDEO]=null}}function Ee(a){return a.sn!=="initSegment"}class Ce extends Z{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.length){const e=this.byteRange[0],t=this.byteRange[1];if(T(e)&&T(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 n=Object.keys(this.levelkeys);if(n.length===1){const i=this._decryptdata=this.levelkeys[n[0]]||null;if(i)return i.getDecryptData(this.sn)}}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=T(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){var t;const n=Object.keys(this.levelkeys),i=n.length;if(i>1||i===1&&(t=this.levelkeys[n[0]])!=null&&t.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(!T(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return Ee(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,n,i,s,r=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:s,partial:r};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,n),c.startDTS=Math.min(c.startDTS,i),c.endDTS=Math.max(c.endDTS,s)}}class Ue extends Z{constructor(e,t,n,i,s){super(n),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=i;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 Be(a,e){const t=Object.getPrototypeOf(a);if(t){const n=Object.getOwnPropertyDescriptor(t,e);return n||Be(t,e)}}function Ze(a,e){const t=Be(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const et=Math.pow(2,32)-1,$e=[].push,be={video:1,audio:2,id3:3,text:4};function he(a){return String.fromCharCode.apply(null,a)}function we(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function Ae(a,e){const t=ie(a,e);return t<0?4294967296+t:t}function qe(a,e){let t=Ae(a,e);return t*=Math.pow(2,32),t+=Ae(a,e+4),t}function ie(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function ue(a){const e=a.byteLength;for(let t=0;t<e;){const n=Ae(a,t);if(n>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=n>1?t+n:e}return!1}function Y(a,e){const t=[];if(!e.length)return t;const n=a.byteLength;for(let i=0;i<n;){const s=Ae(a,i),r=he(a.subarray(i+4,i+8)),o=s>1?i+s:n;if(r===e[0])if(e.length===1)t.push(a.subarray(i+8,o));else{const c=Y(a.subarray(i+8,o),e.slice(1));c.length&&$e.apply(t,c)}i=o}return t}function xe(a){const e=[],t=a[0];let n=8;const i=Ae(a,n);n+=4;let s=0,r=0;t===0?(s=Ae(a,n),r=Ae(a,n+4),n+=8):(s=qe(a,n),r=qe(a,n+8),n+=16),n+=2;let o=a.length+r;const c=we(a,n);n+=2;for(let u=0;u<c;u++){let h=n;const f=Ae(a,h);h+=4;const d=f&2147483647;if((f&2147483648)>>>31===1)return ee.warn("SIDX has hierarchical references (not supported)"),null;const E=Ae(a,h);h+=4,e.push({referenceSize:d,subsegmentDuration:E,info:{duration:E/i,start:o,end:o+d-1}}),o+=d,h+=4,n=h}return{earliestPresentationTime:s,timescale:i,version:t,referencesCount:c,references:e}}function Te(a){const e=[],t=Y(a,["moov","trak"]);for(let i=0;i<t.length;i++){const s=t[i],r=Y(s,["tkhd"])[0];if(r){let o=r[0];const c=Ae(r,o===0?12:20),u=Y(s,["mdia","mdhd"])[0];if(u){o=u[0];const h=Ae(u,o===0?12:20),f=Y(s,["mdia","hdlr"])[0];if(f){const d=he(f.subarray(8,12)),v={soun:I.AUDIO,vide:I.VIDEO}[d],E=Y(s,["mdia","minf","stbl","stsd"])[0],D=Fe(E);v?(e[c]={timescale:h,type:v,stsd:D},e[v]=m({timescale:h,id:c},D)):e[c]={timescale:h,type:d,stsd:D}}}}}return Y(a,["moov","mvex","trex"]).forEach(i=>{const s=Ae(i,4),r=e[s];r&&(r.default={duration:Ae(i,12),flags:Ae(i,20)})}),e}function Fe(a){const e=a.subarray(8),t=e.subarray(86),n=he(e.subarray(4,8));let i=n,s;const r=n==="enca"||n==="encv";if(r){const u=Y(e,[n])[0].subarray(n==="enca"?28:78);Y(u,["sinf"]).forEach(f=>{const d=Y(f,["schm"])[0];if(d){const v=he(d.subarray(4,8));if(v==="cbcs"||v==="cenc"){const E=Y(f,["frma"])[0];E&&(i=he(E))}}})}const o=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const c=Y(t,["avcC"])[0];c&&c.length>3&&(i+="."+Ie(c[1])+Ie(c[2])+Ie(c[3]),s=$(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=Y(e,[n])[0],u=Y(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 d=u[h++];if(d===64)i+="."+Ie(d);else break;if(h+=12,u[h++]!==5)break;h=Se(u,h);const v=u[h++];let E=(v&248)>>3;E===31&&(E+=1+((v&7)<<3)+((u[h]&224)>>5)),i+="."+E}break}case"hvc1":case"hev1":{const c=Y(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],h=["","A","B","C"][u>>6],f=u&31,d=Ae(c,2),v=(u&32)>>5?"H":"L",E=c[12],D=c.subarray(6,12);i+="."+h+f,i+="."+se(d).toString(16).toUpperCase(),i+="."+v+E;let S="";for(let B=D.length;B--;){const ne=D[B];(ne||S)&&(S="."+ne.toString(16).toUpperCase()+S)}i+=S}s=$(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=$(i,t)||i;break}case"vp09":{const c=Y(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],h=c[5],f=c[6]>>4&15;i+="."+Oe(u)+"."+Oe(h)+"."+Oe(f)}break}case"av01":{const c=Y(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,h=c[1]&31,f=c[2]>>>7?"H":"M",d=(c[2]&64)>>6,v=(c[2]&32)>>5,E=u===2&&d?v?12:10:d?10:8,D=(c[2]&16)>>4,S=(c[2]&8)>>3,B=(c[2]&4)>>2,ne=c[2]&3;i+="."+u+"."+Oe(h)+f+"."+Oe(E)+"."+D+"."+S+B+ne+"."+Oe(1)+"."+Oe(1)+"."+Oe(1)+"."+0,s=$("dav1",t)}break}}return{codec:i,encrypted:r,supplemental:s}}function $(a,e){const t=Y(e,["dvvC"]),n=t.length?t[0]:Y(e,["dvcC"])[0];if(n){const i=n[2]>>1&127,s=n[2]<<5&32|n[3]>>3&31;return a+"."+Oe(i)+"."+Oe(s)}}function se(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function Se(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function Ie(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function Oe(a){return(a<10?"0":"")+a}function Ve(a,e){if(!a||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&Y(a,["moov","trak"]).forEach(i=>{const r=Y(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=Y(r,["enca"]);const c=o.length>0;c||(o=Y(r,["encv"])),o.forEach(u=>{const h=c?u.subarray(28):u.subarray(78);Y(h,["sinf"]).forEach(d=>{const v=ut(d);if(v){const E=v.subarray(8,24);E.some(D=>D!==0)||(ee.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${U(E)} -> ${U(t)}`),v.set(t,8))}})})})}function ut(a){const e=Y(a,["schm"])[0];if(e){const t=he(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Y(a,["schi","tenc"])[0]}return null}function He(a,e,t){const n={},i=Y(a,["moof","traf"]);for(let s=0;s<i.length;s++){const r=i[s],o=Y(r,["tfhd"])[0],c=Ae(o,4),u=e[c];if(!u)continue;n[c]||(n[c]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const h=n[c],f=Y(r,["tfdt"])[0];if(f){const J=f[0];let me=Ae(f,4);J===1&&(me===et?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(me*=et+1,me+=Ae(f,8))),T(me)&&(!T(h.start)||me<h.start)&&(h.start=me)}const d=u.default,v=Ae(o,0)|(d==null?void 0:d.flags);let E=(d==null?void 0:d.duration)||0;v&8&&(v&2?E=Ae(o,12):E=Ae(o,8));const D=Y(r,["trun"]);let S=h.start||0,B=0,ne=E;for(let J=0;J<D.length;J++){const me=D[J],Le=Ae(me,4),ze=h.sampleCount;h.sampleCount+=Le;const De=me[3]&1,Ne=me[3]&4,Me=me[2]&1,Re=me[2]&2,Qe=me[2]&4,yt=me[2]&8;let At=8,Ct=Le;for(De&&(At+=4),Ne&&Le&&(!(me[At+1]&1)&&h.keyFrameIndex===void 0&&(h.keyFrameIndex=ze),At+=4,Me?(ne=Ae(me,At),At+=4):ne=E,Re&&(At+=4),yt&&(At+=4),S+=ne,B+=ne,Ct--);Ct--;)Me?(ne=Ae(me,At),At+=4):ne=E,Re&&(At+=4),Qe&&(me[At+1]&1||h.keyFrameIndex===void 0&&(h.keyFrameIndex=h.sampleCount-(Ct+1),h.keyFrameStart=S),At+=4),yt&&(At+=4),S+=ne,B+=ne;!B&&E&&(B+=E*Le)}h.duration+=B}if(!Object.keys(n).some(s=>n[s].duration)){let s=1/0,r=0;const o=Y(a,["sidx"]);for(let c=0;c<o.length;c++){const u=xe(o[c]);if(u!=null&&u.references){s=Math.min(s,u.earliestPresentationTime/u.timescale);const h=u.references.reduce((f,d)=>f+d.info.duration||0,0);r=Math.max(r,h+u.earliestPresentationTime/u.timescale)}}r&&T(r)&&Object.keys(n).forEach(c=>{n[c].duration||(n[c].duration=r*n[c].timescale-n[c].start)})}return n}function Ye(a){const e={valid:null,remainder:null},t=Y(a,["moof"]);if(t.length<2)return e.remainder=a,e;const n=t[t.length-1];return e.valid=a.slice(0,n.byteOffset-8),e.remainder=a.slice(n.byteOffset-8),e}function We(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function ht(a,e){const t=[],n=e.samples,i=e.timescale,s=e.id;let r=!1;return Y(n,["moof"]).map(c=>{const u=c.byteOffset-8;Y(c,["traf"]).map(f=>{const d=Y(f,["tfdt"]).map(v=>{const E=v[0];let D=Ae(v,4);return E===1&&(D*=Math.pow(2,32),D+=Ae(v,8)),D/i})[0];return d!==void 0&&(a=d),Y(f,["tfhd"]).map(v=>{const E=Ae(v,4),D=Ae(v,0)&16777215,S=(D&1)!==0,B=(D&2)!==0,ne=(D&8)!==0;let J=0;const me=(D&16)!==0;let Le=0;const ze=(D&32)!==0;let De=8;E===s&&(S&&(De+=8),B&&(De+=4),ne&&(J=Ae(v,De),De+=4),me&&(Le=Ae(v,De),De+=4),ze&&(De+=4),e.type==="video"&&(r=ft(e.codec)),Y(f,["trun"]).map(Ne=>{const Me=Ne[0],Re=Ae(Ne,0)&16777215,Qe=(Re&1)!==0;let yt=0;const At=(Re&4)!==0,Ct=(Re&256)!==0;let wt=0;const mt=(Re&512)!==0;let It=0;const xt=(Re&1024)!==0,Lt=(Re&2048)!==0;let Kt=0;const _t=Ae(Ne,4);let vt=8;Qe&&(yt=Ae(Ne,vt),vt+=4),At&&(vt+=4);let Yt=yt+u;for(let an=0;an<_t;an++){if(Ct?(wt=Ae(Ne,vt),vt+=4):wt=J,mt?(It=Ae(Ne,vt),vt+=4):It=Le,xt&&(vt+=4),Lt&&(Me===0?Kt=Ae(Ne,vt):Kt=ie(Ne,vt),vt+=4),e.type===I.VIDEO){let Xt=0;for(;Xt<It;){const Jt=Ae(n,Yt);if(Yt+=4,rt(r,n[Yt])){const Un=n.subarray(Yt,Yt+Jt);ve(Un,r?2:1,a+Kt/i,t)}Yt+=Jt,Xt+=Jt+4}}a+=wt/i}}))})})}),t}function ft(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function rt(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function ve(a,e,t,n){const i=at(a);let s=0;s+=e;let r=0,o=0,c=0;for(;s<i.length;){r=0;do{if(s>=i.length)break;c=i[s++],r+=c}while(c===255);o=0;do{if(s>=i.length)break;c=i[s++],o+=c}while(c===255);const u=i.length-s;let h=s;if(o<u)s+=o;else if(o>u){ee.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(i[h++]===181){const d=we(i,h);if(h+=2,d===49){const v=Ae(i,h);if(h+=4,v===1195456820){const E=i[h++];if(E===3){const D=i[h++],S=31&D,B=64&D,ne=B?2+S*3:0,J=new Uint8Array(ne);if(B){J[0]=D;for(let me=1;me<ne;me++)J[me]=i[h++]}n.push({type:E,payloadType:r,pts:t,bytes:J})}}}}}else if(r===5&&o>16){const f=[];for(let E=0;E<16;E++){const D=i[h++].toString(16);f.push(D.length==1?"0"+D:D),(E===3||E===5||E===7||E===9)&&f.push("-")}const d=o-16,v=new Uint8Array(d);for(let E=0;E<d;E++)v[E]=i[h++];n.push({payloadType:r,pts:t,uuid:f.join(""),userData:Ge(v),userDataBytes:v})}}}function at(a){const e=a.byteLength,t=[];let n=1;for(;n<e-2;)a[n]===0&&a[n+1]===0&&a[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return a;const i=e-t.length,s=new Uint8Array(i);let r=0;for(n=0;n<i;r++,n++)r===t[0]&&(r++,t.shift()),s[n]=a[r];return s}function Xe(a){const e=a[0];let t="",n="",i=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;he(a.subarray(u,u+1))!=="\0";)t+=he(a.subarray(u,u+1)),u+=1;for(t+=he(a.subarray(u,u+1)),u+=1;he(a.subarray(u,u+1))!=="\0";)n+=he(a.subarray(u,u+1)),u+=1;n+=he(a.subarray(u,u+1)),u+=1,i=Ae(a,12),s=Ae(a,16),o=Ae(a,20),c=Ae(a,24),u=28}else if(e===1){u+=4,i=Ae(a,u),u+=4;const f=Ae(a,u);u+=4;const d=Ae(a,u);for(u+=4,r=el(2,32)*f+d,fe(r)||(r=Number.MAX_SAFE_INTEGER,ee.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ae(a,u),u+=4,c=Ae(a,u),u+=4;he(a.subarray(u,u+1))!=="\0";)t+=he(a.subarray(u,u+1)),u+=1;for(t+=he(a.subarray(u,u+1)),u+=1;he(a.subarray(u,u+1))!=="\0";)n+=he(a.subarray(u,u+1)),u+=1;n+=he(a.subarray(u,u+1)),u+=1}const h=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:n,timeScale:i,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:c,payload:h}}function Ke(a,...e){const t=e.length;let n=8,i=t;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(a,4),i=0,n=8;i<t;i++)s.set(e[i],n),n+=e[i].byteLength;return s}function pt(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let n,i;n=0,i=new Uint8Array;let s;n>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.byteLength>0&&new DataView(r.buffer).setUint32(0,t.byteLength,!1),Ke([112,115,115,104],new Uint8Array([n,0,0,0]),a,s,i,r,t)}const Et=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),ct={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 Dt(a,e){const t=ct[e];return!!t&&!!t[a.slice(0,4)]}function Gt(a,e,t=!0){return!a.split(",").some(n=>!lt(n,e,t))}function lt(a,e,t=!0){var n;const i=X(t);return(n=i==null?void 0:i.isTypeSupported(Tt(a,e)))!=null?n:!1}function Tt(a,e){return`${e}/mp4;codecs=${a}`}function ge(a){if(a){const e=a.substring(0,4);return ct.video[e]}return 2}function de(a){const e=Et();return a.split(",").reduce((t,n)=>{const s=e&&ft(n)?9:ct.video[n];return s?(s*2+t)/(t?3:2):(ct.audio[n]+t)/(t?2:1)},0)}const pe={};function P(a,e=!0){if(pe[a])return pe[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let i=0;i<t.length;i++){var n;if(lt(t[i],"audio",e))return pe[a]=t[i],t[i];if(t[i]==="mp3"&&(n=X(e))!=null&&n.isTypeSupported("audio/mpeg"))return""}return a}const G=/flac|opus|mp4a\.40\.34/i;function Q(a,e=!0){return a.replace(G,t=>P(t.toLowerCase(),e))}function re(a,e){const t=[];if(a){const n=a.split(",");for(let i=0;i<n.length;i++)Dt(n[i],"video")||t.push(n[i])}return e&&t.push(e),t.join(",")}function ce(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(tt(a,"audio")||tt(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let n=t.length;n--;)if(t[n].substring(0,4)===a.substring(0,4))return t[n]}return t[0]}}return e||a}function tt(a,e){return Dt(a,e)&&lt(a,e)}function it(a){const e=a.split(",");for(let t=0;t<e.length;t++){const n=e[t].split(".");n.length>2&&n[0]==="avc1"&&(e[t]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return e.join(",")}function ot(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let n=e.length;n>4&&n<10;n++)e[n]=t[n-4];return e.join(".")}return a}function gt(a){const e=X(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 kt(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Ut={supported:!0,powerEfficient:!0,smooth:!0},Bt={supported:!1,smooth:!1,powerEfficient:!1},bt={supported:!0,configurations:[],decodingInfoResults:[Ut]};function rn(a,e){return{supported:!1,configurations:e,decodingInfoResults:[Bt],error:a}}function fn(a,e,t,n,i,s){const r=a.videoCodec,o=a.audioCodec?a.audioGroups:null,c=s==null?void 0:s.audioCodec,u=s==null?void 0:s.channels,h=u?parseInt(u):c?1/0:2;let f=null;if(o!=null&&o.length)try{o.length===1&&o[0]?f=e.groups[o[0]].channels:f=o.reduce((d,v)=>{if(v){const E=e.groups[v];if(!E)throw new Error(`Audio track group ${v} not found`);Object.keys(E.channels).forEach(D=>{d[D]=(d[D]||0)+E.channels[D]})}return d},{2:0})}catch(d){return!0}return r!==void 0&&(r.split(",").some(d=>ft(d))||a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(n,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(i,8e6))||!!f&&T(h)&&Object.keys(f).some(d=>parseInt(d)>h)}function en(a,e,t,n={}){const i=a.videoCodec;if(!i&&!a.audioCodec||!t)return Promise.resolve(bt);const s=[],r=Qt(a),o=r.length,c=st(a,e,o>0),u=c.length;for(let h=o||1*u||1;h--;){const f={type:"media-source"};if(o&&(f.video=r[h%o]),u){f.audio=c[h%u];const d=f.audio.bitrate;f.video&&d&&(f.video.bitrate-=d)}s.push(f)}if(i){const h=navigator.userAgent;if(i.split(",").some(f=>ft(f))&&Et())return Promise.resolve(rn(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${h})`),s))}return Promise.all(s.map(h=>{const f=Ft(h);return n[f]||(n[f]=t.decodingInfo(h))})).then(h=>({supported:!h.some(f=>!f.supported),configurations:s,decodingInfoResults:h})).catch(h=>({supported:!1,configurations:s,decodingInfoResults:[],error:h}))}function Qt(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),n=dt(a),i=a.width||640,s=a.height||480,r=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(c=>{const u={contentType:Tt(ot(c),"video"),width:i,height:s,bitrate:n,framerate:r};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function st(a,e,t){var n;const i=(n=a.audioCodec)==null?void 0:n.split(","),s=dt(a);return i&&a.audioGroups?a.audioGroups.reduce((r,o)=>{var c;const u=o?(c=e.groups[o])==null?void 0:c.tracks:null;return u?u.reduce((h,f)=>{if(f.groupId===o){const d=parseFloat(f.channels||"");i.forEach(v=>{const E={contentType:Tt(v,"audio"),bitrate:t?je(v,s):s};d&&(E.channels=""+d),h.push(E)})}return h},r):r},[]):[]}function je(a,e){if(e<=1)return 1;let t=128e3;return a==="ec-3"?t=768e3:a==="ac-3"&&(t=64e4),Math.min(e/2,t)}function dt(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function Ft(a){let e="";const{audio:t,video:n}=a;if(n){const i=kt(n.contentType);e+=`${i}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(t){const i=kt(t.contentType);e+=`${n?"_":""}${i}_c${t.channels}`}return e}const Wt=["NONE","TYPE-0","TYPE-1",null];function tn(a){return Wt.indexOf(a)>-1}const An=["SDR","PQ","HLG"];function yn(a){return!!a&&An.indexOf(a)>-1}var on={No:"",Yes:"YES",v2:"v2"};function wn(a){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=a,i=n<e/2;return e&&i?t?on.v2:on.Yes:on.No}class zt{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class En{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(n=>!!n).map(n=>n.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const n=(t=e.supplemental)==null?void 0:t.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return nn(this._audioGroups,e)}hasSubtitleGroup(e){return nn(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function nn(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function oi(){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 Ht(a,e){let t=!1,n=[];if(a&&(t=a!=="SDR",n=[a]),e){n=e.allowedVideoRanges||An.slice(0);const i=n.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&oi(),t||(n=["SDR"])}return{preferHDR:t,allowedVideoRanges:n}}const Zt=a=>{const e=new WeakSet;return(t,n)=>{if(a&&(n=a(t,n)),typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}},Pt=(a,e)=>JSON.stringify(a,Zt(e));function bn(a,e,t,n,i){const s=Object.keys(a),r=n==null?void 0:n.channels,o=n==null?void 0:n.audioCodec,c=i==null?void 0:i.videoCodec,u=r&&parseInt(r)===2;let h=!1,f=!1,d=1/0,v=1/0,E=1/0,D=1/0,S=0,B=[];const{preferHDR:ne,allowedVideoRanges:J}=Ht(e,i);for(let Ne=s.length;Ne--;){const Me=a[s[Ne]];h||(h=Me.channels[2]>0),d=Math.min(d,Me.minHeight),v=Math.min(v,Me.minFramerate),E=Math.min(E,Me.minBitrate),J.filter(Qe=>Me.videoRanges[Qe]>0).length>0&&(f=!0)}d=T(d)?d:0,v=T(v)?v:0;const me=Math.max(1080,d),Le=Math.max(30,v);E=T(E)?E:t,t=Math.max(E,t),f||(e=void 0);const ze=s.length>1;return{codecSet:s.reduce((Ne,Me)=>{const Re=a[Me];if(Me===Ne)return Ne;if(B=f?J.filter(Qe=>Re.videoRanges[Qe]>0):[],ze){if(Re.minBitrate>t)return qt(Me,`min bitrate of ${Re.minBitrate} > current estimate of ${t}`),Ne;if(!Re.hasDefaultAudio)return qt(Me,"no renditions with default or auto-select sound found"),Ne;if(o&&Me.indexOf(o.substring(0,4))%5!==0)return qt(Me,`audio codec preference "${o}" not found`),Ne;if(r&&!u){if(!Re.channels[r])return qt(Me,`no renditions with ${r} channel sound found (channels options: ${Object.keys(Re.channels)})`),Ne}else if((!o||u)&&h&&Re.channels[2]===0)return qt(Me,"no renditions with stereo sound found"),Ne;if(Re.minHeight>me)return qt(Me,`min resolution of ${Re.minHeight} > maximum of ${me}`),Ne;if(Re.minFramerate>Le)return qt(Me,`min framerate of ${Re.minFramerate} > maximum of ${Le}`),Ne;if(!B.some(Qe=>Re.videoRanges[Qe]>0))return qt(Me,`no variants with VIDEO-RANGE of ${Pt(B)} found`),Ne;if(c&&Me.indexOf(c.substring(0,4))%5!==0)return qt(Me,`video codec preference "${c}" not found`),Ne;if(Re.maxScore<S)return qt(Me,`max score of ${Re.maxScore} < selected max of ${S}`),Ne}return Ne&&(de(Me)>=de(Ne)||Re.fragmentError>a[Ne].fragmentError)?Ne:(D=Re.minIndex,S=Re.maxScore,Me)},void 0),videoRanges:B,preferHDR:ne,minFramerate:v,minBitrate:E,minIndex:D}}function qt(a,e){ee.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function xn(a){return a.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function On(a,e,t,n){return a.slice(t,n+1).reduce((i,s,r)=>{if(!s.codecSet)return i;const o=s.audioGroups;let c=i[s.codecSet];c||(i[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(d=>{c.channels[d]=(c.channels[d]||0)+f.channels[d]}))}),i},{})}function Nn(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:n,channels:i,audioCodec:s}=a;return{lang:e,assocLang:t,characteristics:n,channels:i,audioCodec:s}}function Rn(a,e,t){if("attrs"in a){const n=e.indexOf(a);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(mn(a,i,t))return n}return-1}function mn(a,e,t){const{groupId:n,name:i,lang:s,assocLang:r,default:o}=a,c=a.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(s===void 0||$t(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||Mt(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function $t(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function Mt(a,e=""){const t=a.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function jt(a,e){const{audioCodec:t,channels:n}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function Vt(a,e,t,n,i){const s=e[n],o=e.reduce((d,v,E)=>{const D=v.uri;return(d[D]||(d[D]=[])).push(E),d},{})[s.uri];o.length>1&&(n=Math.max.apply(Math,o));const c=s.videoRange,u=s.frameRate,h=s.codecSet.substring(0,4),f=kn(e,n,d=>{if(d.videoRange!==c||d.frameRate!==u||d.codecSet.substring(0,4)!==h)return!1;const v=d.audioGroups,E=t.filter(D=>!v||v.indexOf(D.groupId)!==-1);return Rn(a,E,i)>-1});return f>-1?f:kn(e,n,d=>{const v=d.audioGroups,E=t.filter(D=>!v||v.indexOf(D.groupId)!==-1);return Rn(a,E,i)>-1})}function kn(a,e,t){for(let n=e;n>-1;n--)if(t(a[n]))return n;for(let n=e+1;n<a.length;n++)if(t(a[n]))return n;return-1}function Gn(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Kn extends L{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var n;const{fragCurrent:i,partCurrent:s,hls:r}=this,{autoLevelEnabled:o,media:c}=r;if(!i||!c)return;const u=performance.now(),h=s?s.stats:i.stats,f=s?s.duration:i.duration,d=u-h.loading.start,v=r.minAutoLevel,E=i.level,D=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||E<=v){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const S=D>-1&&D!==E,B=!!t||S;if(!B&&(c.paused||!c.playbackRate||!c.readyState))return;const ne=r.mainForwardBufferInfo;if(!B&&ne===null)return;const J=this.bwEstimator.getEstimateTTFB(),me=Math.abs(c.playbackRate);if(d<=Math.max(J,1e3*(f/(me*2))))return;const Le=ne?ne.len/me:0,ze=h.loading.first?h.loading.first-h.loading.start:-1,De=h.loaded&&ze>-1,Ne=this.getBwEstimate(),Me=r.levels,Re=Me[E],Qe=Math.max(h.loaded,Math.round(f*(i.bitrate||Re.averageBitrate)/8));let yt=De?d-ze:d;yt<1&&De&&(yt=Math.min(d,h.loaded*8/Ne));const At=De?h.loaded*1e3/yt:0,Ct=J/1e3,wt=At?(Qe-h.loaded)/At:Qe*8/Ne+Ct;if(wt<=Le)return;const mt=At?At*8:Ne,It=((n=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:n.live)===!0,xt=this.hls.config.abrBandWidthUpFactor;let Lt=Number.POSITIVE_INFINITY,Kt;for(Kt=E-1;Kt>v;Kt--){const an=Me[Kt].maxBitrate,Xt=!Me[Kt].details||It;if(Lt=this.getTimeToLoadFrag(Ct,mt,f*an,Xt),Lt<Math.min(Le,f+Ct))break}if(Lt>=wt||Lt>f*10)return;De?this.bwEstimator.sample(d-Math.min(J,ze),h.loaded):this.bwEstimator.sampleTTFB(d);const _t=Me[Kt].maxBitrate;this.getBwEstimate()*xt>_t&&this.resetEstimator(_t);const vt=this.findBestLevel(_t,v,Kt,0,Le,1,1);vt>-1&&(Kt=vt),this.warn(`Fragment ${i.sn}${s?" part "+s.index:""} of level ${E} is loading too slowly;
Fragment duration: ${i.duration.toFixed(3)}
Time to underbuffer: ${Le.toFixed(3)} s
Estimated load time for current fragment: ${wt.toFixed(3)} s
Estimated load time for down switch fragment: ${Lt.toFixed(3)} s
TTFB estimate: ${ze|0} ms
Current BW estimate: ${T(Ne)?Ne|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${Kt} @ ${_t|0} bps`),r.nextLoadLevel=r.nextAutoLevel=Kt,this.clearTimer();const Yt=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===Kt&&Kt>0){const an=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Kt>0?"and switching down":""}
Fragment duration: ${i.duration.toFixed(3)} s
Time to underbuffer: ${an.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,Kt>v){let Xt=this.findBestLevel(this.hls.levels[v].bitrate,v,Kt,0,an,1,1);Xt===-1&&(Xt=v),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Xt,this.resetEstimator(this.hls.levels[Xt].bitrate)}}};S||wt>Lt*2?Yt():this.timer=self.setInterval(Yt,Lt*1e3),r.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,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 M(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(p.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case H.BUFFER_ADD_CODEC_ERROR:case H.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case H.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:i,partCurrent:s}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const r=performance.now(),o=s?s.stats:n.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,n,i){const s=e+n/t,r=i?e+this.lastLevelLoadSec:0;return s+r}onLevelLoaded(e,t){const n=this.hls.config,{loading:i}=t.stats,s=i.end-i.first;T(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===te.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=n?n.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+i.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:i,frag:t,part:n,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,s=i!=null&&i.stats.loaded?i.stats:n.stats;if(s.aborted||this.ignoreFragment(n))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(),n.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==te.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,t,e,0,i,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,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=n&&i?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:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:i,config:s,minAutoLevel:r}=n,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let h=s.abrBandWidthFactor,f=s.abrBandWidthUpFactor;if(u){const S=this.findBestLevel(c,r,i,u,0,h,f);if(S>=0)return this.rebufferNotice=-1,S}let d=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const S=this.bitrateTestDelay;S&&(d=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-S,this.info(`bitrate test took ${Math.round(1e3*S)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),h=f=1)}const v=this.findBestLevel(c,r,i,u,d,h,f);if(this.rebufferNotice!==v&&(this.rebufferNotice=v,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${v}`)),v>-1)return v;const E=n.levels[r],D=n.loadLevelObj;return D&&(E==null?void 0:E.bitrate)<D.bitrate?r:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,i,s,r,o){var c;const u=i+s,h=this.lastLoadedFragLevel,f=h===-1?this.hls.firstLevel:h,{fragCurrent:d,partCurrent:v}=this,{levels:E,allAudioTracks:D,loadLevel:S,config:B}=this.hls;if(E.length===1)return 0;const ne=E[f],J=!!((c=this.hls.latestLevelDetails)!=null&&c.live),me=S===-1||h===-1;let Le,ze="SDR",De=(ne==null?void 0:ne.frameRate)||0;const{audioPreference:Ne,videoPreference:Me}=B,Re=this.audioTracksByGroup||(this.audioTracksByGroup=xn(D));let Qe=-1;if(me){if(this.firstSelection!==-1)return this.firstSelection;const mt=this.codecTiers||(this.codecTiers=On(E,Re,t,n)),It=bn(mt,ze,e,Ne,Me),{codecSet:xt,videoRanges:Lt,minFramerate:Kt,minBitrate:_t,minIndex:vt,preferHDR:Yt}=It;Qe=vt,Le=xt,ze=Yt?Lt[Lt.length-1]:Lt[0],De=Kt,e=Math.max(e,_t),this.log(`picked start tier ${Pt(It)}`)}else Le=ne==null?void 0:ne.codecSet,ze=ne==null?void 0:ne.videoRange;const yt=v?v.duration:d?d.duration:0,At=this.bwEstimator.getEstimateTTFB()/1e3,Ct=[];for(let mt=n;mt>=t;mt--){var wt;const It=E[mt],xt=mt>f;if(!It)continue;if(B.useMediaCapabilities&&!It.supportedResult&&!It.supportedPromise){const Xt=navigator.mediaCapabilities;typeof(Xt==null?void 0:Xt.decodingInfo)=="function"&&fn(It,Re,ze,De,e,Ne)?(It.supportedPromise=en(It,Re,Xt,this.supportedCache),It.supportedPromise.then(Jt=>{if(!this.hls)return;It.supportedResult=Jt;const Un=this.hls.levels,Fn=Un.indexOf(It);Jt.error?this.warn(`MediaCapabilities decodingInfo error: "${Jt.error}" for level ${Fn} ${Pt(Jt)}`):Jt.supported?Jt.decodingInfoResults.some(ri=>ri.smooth===!1||ri.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Fn} not smooth or powerEfficient: ${Pt(Jt)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Fn} ${Pt(Jt)}`),Fn>-1&&Un.length>1&&(this.log(`Removing unsupported level ${Fn}`),this.hls.removeLevel(Fn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Jt=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Jt}`)})):It.supportedResult=bt}if((Le&&It.codecSet!==Le||ze&&It.videoRange!==ze||xt&&De>It.frameRate||!xt&&De>0&&De<It.frameRate||(wt=It.supportedResult)!=null&&(wt=wt.decodingInfoResults)!=null&&wt.some(Xt=>Xt.smooth===!1))&&(!me||mt!==Qe)){Ct.push(mt);continue}const Lt=It.details,Kt=(v?Lt==null?void 0:Lt.partTarget:Lt==null?void 0:Lt.averagetargetduration)||yt;let _t;xt?_t=o*e:_t=r*e;const vt=yt&&i>=yt*2&&s===0?It.averageBitrate:It.maxBitrate,Yt=this.getTimeToLoadFrag(At,_t,vt*Kt,Lt===void 0);if(_t>=vt&&(mt===h||It.loadError===0&&It.fragmentError===0)&&(Yt<=At||!T(Yt)||J&&!this.bitrateTestDelay||Yt<u)){const Xt=this.forcedAutoLevel;return mt!==S&&(Xt===-1||Xt!==S)&&(Ct.length&&this.trace(`Skipped level(s) ${Ct.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${E[Ct[0]].codecs}" ${E[Ct[0]].videoRange}; not compatible with "${Le}" ${ze}`),this.info(`switch candidate:${f}->${mt} adjustedbw(${Math.round(_t)})-bitrate=${Math.round(_t-vt)} ttfb:${At.toFixed(1)} avgDuration:${Kt.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${Yt.toFixed(1)} firstSelection:${me} codecSet:${It.codecSet} videoRange:${It.videoRange} hls.loadLevel:${S}`)),me&&(this.firstSelection=mt),mt}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}}const Pn={search:function(a,e){let t=0,n=a.length-1,i=null,s=null;for(;t<=n;){i=(t+n)/2|0,s=a[i];const r=e(s);if(r>0)t=i+1;else if(r<0)n=i-1;else return s}return null}};function In(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!T(e))return null;const n=a[0].programDateTime;if(e<(n||0))return null;const i=a[a.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let s=0;s<a.length;++s){const r=a[s];if(pn(e,t,r))return r}return null}function ei(a,e,t=0,n=0,i=.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)&&ln(t,n,s)===0||jn(s,a,Math.min(i,n))))return s;const r=Pn.search(e,ln.bind(null,t,n));return r&&(r!==a||!s)?r:s}function jn(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),t);return a.start<=n}return!1}function ln(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=a?1:t.start-n>a&&t.start?-1:0}function pn(a,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>a}function Yn(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let n=a.fragments;const{fragmentHint:i}=a;i&&(n=n.concat(i));let s;return Pn.search(n,r=>r.cc<e?1:r.cc>e?-1:(s=r,r.end<=t?1:r.start>t?-1:0)),s||null}return null}function ti(a){switch(a.details){case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_TIMEOUT:case H.LEVEL_LOAD_TIMEOUT:case H.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Vn(a,e){const t=ti(e);return a.default[`${t?"timeout":"error"}Retry`]}function Bi(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function Ui(a){return m(m({},a),{errorRetry:null,timeoutRetry:null})}function ni(a,e,t,n){if(!a)return!1;const i=n==null?void 0:n.code,s=e<a.maxNumRetry&&(wi(i)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,n,s):s}function wi(a){return qi(a)||!!a&&(a<400||a>499)}function qi(a){return a===0&&navigator.onLine===!1}var _n={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Dn={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class Xi extends L{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.ERROR,this.onError,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.ERROR,this.onError,this),e.off(p.ERROR,this.onErrorOut,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===te.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,n=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||n===-1?t.loadLevel:n}variantHasKey(e,t){if(e){var n;if((n=e.details)!=null&&n.hasKey(t))return!0;const i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(r=>i.indexOf(r.groupId)>=0).some(r=>{var o;return(o=r.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;const i=this.hls,s=t.context;switch(t.details){case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case H.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=li();return}case H.FRAG_GAP:case H.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=_n.SendAlternateToPenaltyBox;return}case H.LEVEL_EMPTY_ERROR:case H.LEVEL_PARSING_ERROR:{var r;const c=t.parent===te.MAIN?t.level:i.loadLevel;t.details===H.LEVEL_EMPTY_ERROR&&((r=t.context)!=null&&(r=r.levelDetails)!=null&&r.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.SUBTITLE_LOAD_ERROR:case H.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const c=i.loadLevelObj;if(c&&(s.type===ae.AUDIO_TRACK&&c.hasAudioGroup(s.groupId)||s.type===ae.SUBTITLE_TRACK&&c.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=_n.SendAlternateToPenaltyBox,t.errorAction.flags=Dn.MoveAllAlternatesMatchingHost;return}}return;case H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:_n.SendAlternateToPenaltyBox,flags:Dn.MoveAllAlternatesMatchingHDCP};return;case H.KEY_SYSTEM_SESSION_UPDATE_FAILED:case H.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case H.KEY_SYSTEM_NO_SESSION:t.errorAction={action:_n.SendAlternateToPenaltyBox,flags:Dn.MoveAllAlternatesMatchingKey};return;case H.BUFFER_ADD_CODEC_ERROR:case H.REMUX_ALLOC_ERROR:case H.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:i.loadLevel)}return;case H.INTERNAL_EXCEPTION:case H.BUFFER_APPENDING_ERROR:case H.BUFFER_FULL_ERROR:case H.LEVEL_SWITCH_ERROR:case H.BUFFER_STALLED_ERROR:case H.BUFFER_SEEK_OVER_HOLE:case H.BUFFER_NUDGE_ON_STALL:t.errorAction=li();return}t.type===oe.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=li())}getPlaylistRetryOrSwitchAction(e,t){const n=this.hls,i=Vn(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(ni(i,s,ti(e),e.response))return{action:_n.RetryRequest,flags:Dn.None,retryConfig:i,retryCount:s};const o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:s,keyLoadPolicy:r}=t.config,o=Vn(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((h,f)=>h+f.fragmentError,0);if(i&&(e.details!==H.FRAG_GAP&&i.fragmentError++,ni(o,c,ti(e),e.response)))return{action:_n.RetryRequest,flags:Dn.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,n);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var s,r;const u=e.details;i.loadError++,u===H.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1;const{levels:f,loadLevel:d,minAutoLevel:v,maxAutoLevel:E}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);const D=(s=e.frag)==null?void 0:s.type,B=(D===te.AUDIO&&u===H.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===H.BUFFER_ADD_CODEC_ERROR||u===H.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:ze})=>i.audioCodec!==ze),J=e.sourceBufferName==="video"&&(u===H.BUFFER_ADD_CODEC_ERROR||u===H.BUFFER_APPEND_ERROR)&&f.some(({codecSet:ze,audioCodec:De})=>i.codecSet!==ze&&i.audioCodec===De),{type:me,groupId:Le}=(r=e.context)!=null?r:{};for(let ze=f.length;ze--;){const De=(ze+d)%f.length;if(De!==d&&De>=v&&De<=E&&f[De].loadError===0){var o,c;const Ne=f[De];if(u===H.FRAG_GAP&&D===te.MAIN&&e.frag){const Me=f[De].details;if(Me){const Re=ei(e.frag,Me.fragments,e.frag.start);if(Re!=null&&Re.gap)continue}}else{if(me===ae.AUDIO_TRACK&&Ne.hasAudioGroup(Le)||me===ae.SUBTITLE_TRACK&&Ne.hasSubtitleGroup(Le))continue;if(D===te.AUDIO&&(o=i.audioGroups)!=null&&o.some(Me=>Ne.hasAudioGroup(Me))||D===te.SUBTITLE&&(c=i.subtitleGroups)!=null&&c.some(Me=>Ne.hasSubtitleGroup(Me))||B&&i.audioCodec===Ne.audioCodec||J&&i.codecSet===Ne.codecSet||!B&&i.codecSet!==Ne.codecSet)continue}h=De;break}}if(h>-1&&n.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:_n.SendAlternateToPenaltyBox,flags:Dn.None,nextAutoLevel:h}}return{action:_n.SendAlternateToPenaltyBox,flags:Dn.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case _n.DoNothing:break;case _n.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==H.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 _n.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,n=e.errorAction;if(!n)return;const{flags:i}=n,s=n.nextAutoLevel;switch(i){case Dn.None:this.switchLevel(e,s);break;case Dn.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),u=t.levels[c],h=u==null?void 0:u.attrs["HDCP-LEVEL"];if(n.hdcpLevel=h,h){t.maxHdcpLevel=Wt[Wt.indexOf(h)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Dn.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const u=this.hls.levels;for(let h=u.length;h--;)if(this.variantHasKey(u[h],c)){var r,o;this.log(`Banned key found in level ${h} (${u[h].bitrate}bps) or audio group "${(r=u[h].audioGroups)==null?void 0:r.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${U(c.keyId||[])}`),u[h].fragmentError++,u[h].loadError++,this.log(`Removing level ${h} with key error (${e.error})`),this.hls.removeLevel(h)}u.length&&(n.resolved=!0)}break}}n.resolved||this.switchLevel(e,s)}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===H.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const n=kt(e.mimeType),i=this.hls.levels;for(let s=i.length;s--;)i[s][`${e.sourceBufferName}Codec`]===n&&(this.log(`Removing level ${s} for ${e.details} ("${n}" not supported)`),this.hls.removeLevel(s))}}}function li(a){const e={action:_n.DoNothing,flags:Dn.None};return a&&(e.resolved=!0),e}var un={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class gi{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&&(e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let i=n.length;i--;){const s=n[i];if(!s)break;if(s.start<=e&&e<=s.end&&s.loaded)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,n){const{fragments:i}=this,s=Object.keys(i);for(let r=s.length;r--;){const o=i[s[r]];if((o==null?void 0:o.body.type)===t&&(!n||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,n,i,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(i==null?void 0:i.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===n&&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 n=e.frag,i=Mn(n),s=this.fragments[i];if(!s||s.buffered&&n.gap)return;const r=!n.relurl;Object.keys(t).forEach(o=>{const c=n.elementaryStreams[o];if(!c)return;const u=t[o],h=r||c.partial===!0;s.range[o]=this.getBufferedTimes(n,e.part,h,u)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=n.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),ii(s)||this.removeParts(n.sn-1,n.type)):this.removeFragment(s.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=Qi(n,i=>i.fragment.sn>=e))}fragBuffered(e,t){const n=Mn(e);let i=this.fragments[n];!i&&t&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,n,i){const s={time:[],partial:n},r=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||r;for(let h=0;h<i.length;h++){const f=i.start(h)-this.bufferPadding,d=i.end(h)+this.bufferPadding;if(u>=f&&c<=d){s.time.push({startPTS:Math.max(r,i.start(h)),endPTS:Math.min(o,i.end(h))});break}else if(r<d&&o>f){const v=Math.max(r,i.start(h)),E=Math.min(o,i.end(h));E>v&&(s.partial=!0,s.time.push({startPTS:v,endPTS:E}))}else if(o<=f)break}return s}getPartialFragment(e){let t=null,n,i,s,r=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const h=c[u];h&&ii(h)&&(i=h.body.start-o,s=h.body.end+o,e>=i&&e<=s&&(n=Math.min(e-i,s-e),r<=n&&(t=h.body,r=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||ii(t))}getState(e){const t=Mn(e),n=this.fragments[t];return n?n.buffered?ii(n)?un.PARTIAL:un.OK:un.APPENDING:un.NOT_LOADED}isTimeBuffered(e,t,n){let i,s;for(let r=0;r<n.length;r++){if(i=n.start(r)-this.bufferPadding,s=n.end(r)+this.bufferPadding,e>=i&&t<=s)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const n=t.frag,i=t.part?null:t,s=Mn(n);this.fragments[s]={body:n,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:i,timeRanges:s,type:r}=t;if(n.sn==="initSegment")return;const o=n.type;if(i){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(i)}this.timeRanges=s;const c=s[r];this.detectEvictedFragments(r,c,o,i)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Mn(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let i=n.length;i--;){const s=t[n[i]];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,n,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const o=this.fragments[r];if(!o)return;const c=o.body;c.type!==n||i&&!c.gap||c.start<t&&c.end>e&&(o.buffered||s)&&this.removeFragment(c)})}removeFragment(e){const t=Mn(e);e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const i=e.sn;this.activePartLists[e.type]=Qi(n,s=>s.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(n=>n.clearElementaryStreamInfo())}}function ii(a){var e,t,n;return a.buffered&&!!(a.body.gap||(e=a.range.video)!=null&&e.partial||(t=a.range.audio)!=null&&t.partial||(n=a.range.audiovideo)!=null&&n.partial)}function Mn(a){return`${a.type}_${a.level}_${a.sn}`}function Qi(a,e){return a.filter(t=>{const n=e(t);return n||t.clearElementaryStreamInfo(),n})}var vn={cbc:0,ctr:1};class Di{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case vn.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case vn.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 ls(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class Ss{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=t.getUint32(i*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],s=n[1],r=n[2],o=n[3],c=this.invSubMix,u=c[0],h=c[1],f=c[2],d=c[3],v=new Uint32Array(256);let E=0,D=0,S=0;for(S=0;S<256;S++)S<128?v[S]=S<<1:v[S]=S<<1^283;for(S=0;S<256;S++){let B=D^D<<1^D<<2^D<<3^D<<4;B=B>>>8^B&255^99,e[E]=B,t[B]=E;const ne=v[E],J=v[ne],me=v[J];let Le=v[B]*257^B*16843008;i[E]=Le<<24|Le>>>8,s[E]=Le<<16|Le>>>16,r[E]=Le<<8|Le>>>24,o[E]=Le,Le=me*16843009^J*65537^ne*257^E*16843008,u[B]=Le<<24|Le>>>8,h[B]=Le<<16|Le>>>16,f[B]=Le<<8|Le>>>24,d[B]=Le,E?(E=ne^v[v[v[me^ne]]],D^=v[v[D]]):E=D=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)return;this.key=t;const 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,d=this.rcon,v=this.invSubMix,E=v[0],D=v[1],S=v[2],B=v[3];let ne,J;for(o=0;o<r;o++){if(o<s){ne=u[o]=t[o];continue}J=ne,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^=d[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]=ne=(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]=E[f[J>>>24]]^D[f[J>>>16&255]]^S[f[J>>>8&255]]^B[f[J&255]],h[c]=h[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,s=this.invKeySchedule,r=this.invSBox,o=this.invSubMix,c=o[0],u=o[1],h=o[2],f=o[3],d=this.uint8ArrayToUint32Array_(n);let v=d[0],E=d[1],D=d[2],S=d[3];const B=new Int32Array(e),ne=new Int32Array(B.length);let J,me,Le,ze,De,Ne,Me,Re,Qe,yt,At,Ct,wt,mt;const It=this.networkToHostOrderSwap;for(;t<B.length;){for(Qe=It(B[t]),yt=It(B[t+1]),At=It(B[t+2]),Ct=It(B[t+3]),De=Qe^s[0],Ne=Ct^s[1],Me=At^s[2],Re=yt^s[3],wt=4,mt=1;mt<i;mt++)J=c[De>>>24]^u[Ne>>16&255]^h[Me>>8&255]^f[Re&255]^s[wt],me=c[Ne>>>24]^u[Me>>16&255]^h[Re>>8&255]^f[De&255]^s[wt+1],Le=c[Me>>>24]^u[Re>>16&255]^h[De>>8&255]^f[Ne&255]^s[wt+2],ze=c[Re>>>24]^u[De>>16&255]^h[Ne>>8&255]^f[Me&255]^s[wt+3],De=J,Ne=me,Me=Le,Re=ze,wt=wt+4;J=r[De>>>24]<<24^r[Ne>>16&255]<<16^r[Me>>8&255]<<8^r[Re&255]^s[wt],me=r[Ne>>>24]<<24^r[Me>>16&255]<<16^r[Re>>8&255]<<8^r[De&255]^s[wt+1],Le=r[Me>>>24]<<24^r[Re>>16&255]<<16^r[De>>8&255]<<8^r[Ne&255]^s[wt+2],ze=r[Re>>>24]<<24^r[De>>16&255]<<16^r[Ne>>8&255]<<8^r[Me&255]^s[wt+3],ne[t]=It(J^v),ne[t+1]=It(ze^E),ne[t+2]=It(Le^D),ne[t+3]=It(me^S),v=Qe,E=yt,D=At,S=Ct,t=t+4}return ne.buffer}}class Ri{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){const e=us(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function us(a){switch(a){case vn.cbc:return"AES-CBC";case vn.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const As=16;class $i{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(n){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?ls(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n,i){return this.useSoftware?new Promise((s,r)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,n,i);const c=this.flush();c?s(c.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,i)}softwareDecrypt(e,t,n,i){const{currentIV:s,currentResult:r,remainderData:o}=this;if(i!==vn.cbc||t.byteLength!==16)return ee.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=We(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;s&&(n=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new Ss),u.expandKey(t);const h=r;return this.currentResult=u.decrypt(c.buffer,0,n),this.currentIV=c.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,n,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,i));this.key=t,this.fastAesKey=new Ri(this.subtle,t,i)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Di(this.subtle,new Uint8Array(n),i).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(ee.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,n,i)))}onWebCryptoError(e,t,n,i){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,i);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 n=e.length-e.length%As;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&(ee.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Ji=Math.pow(2,17);class Ii{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const n=e.url;if(!n)return Promise.reject(new zn({type:oe.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,s=i.fLoader,r=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(E=>E[0]==="GAP")){c(Gi(e));return}else e.gap=!1;const u=this.loader=s?new s(i):new r(i),h=mi(e);e.loader=u;const f=Ui(i.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Ji};e.stats=u.stats;const v={onSuccess:(E,D,S,B)=>{this.resetLoader(e,u);let ne=E.data;S.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ne.slice(0,16)),ne=ne.slice(16)),o({frag:e,part:null,payload:ne,networkDetails:B})},onError:(E,D,S,B)=>{this.resetLoader(e,u),c(new zn({type:oe.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:m({url:n,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:S,stats:B}))},onAbort:(E,D,S)=>{this.resetLoader(e,u),c(new zn({type:oe.NETWORK_ERROR,details:H.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:E}))},onTimeout:(E,D,S)=>{this.resetLoader(e,u),c(new zn({type:oe.NETWORK_ERROR,details:H.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:S,stats:E}))}};t&&(v.onProgress=(E,D,S,B)=>t({frag:e,part:null,payload:S,networkDetails:B})),u.load(h,d,v)})}loadPart(e,t,n){this.abort();const i=this.config,s=i.fLoader,r=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(Gi(e,t));return}const u=this.loader=s?new s(i):new r(i),h=mi(e,t);e.loader=u;const f=Ui(i.fragLoadPolicy.default),d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Ji};t.stats=u.stats,u.load(h,d,{onSuccess:(v,E,D,S)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const B={frag:e,part:t,payload:v.data,networkDetails:S};n(B),o(B)},onError:(v,E,D,S)=>{this.resetLoader(e,u),c(new zn({type:oe.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:m({url:h.url,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:D,stats:S}))},onAbort:(v,E,D)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new zn({type:oe.NETWORK_ERROR,details:H.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:D,stats:v}))},onTimeout:(v,E,D)=>{this.resetLoader(e,u),c(new zn({type:oe.NETWORK_ERROR,details:H.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:D,stats:v}))}})})}updateStatsFromPart(e,t){const n=e.stats,i=t.stats,s=i.total;if(n.loaded+=i.loaded,s){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(n.loaded/s),c),f=(c-u)*Math.round(n.loaded/u);n.total=n.loaded+f}else n.total=Math.max(n.loaded,n.total);const r=n.loading,o=i.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 mi(a,e=null){const t=e||a,n={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(T(i)&&T(s)){var r;let o=i,c=s;if(a.sn==="initSegment"&&Li((r=a.decryptdata)==null?void 0:r.method)){const u=s-i;u%16&&(c=s+(16-u%16)),i!==0&&(n.resetIV=!0,o=i-16)}n.rangeStart=o,n.rangeEnd=c}return n}function Gi(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),n={type:oe.MEDIA_ERROR,details:H.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(n.part=e),(e||a).stats.aborted=!0,new zn(n)}function Li(a){return a==="AES-128"||a==="AES-256"}class zn extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Ci extends L{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 Wn{constructor(e,t,n,i=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=Xn(),this.buffering={audio:Xn(),video:Xn(),audiovideo:Xn()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=r}}function Xn(){return{start:0,executeStart:0,executeEnd:0,end:0}}const ui={length:0,start:()=>0,end:()=>0};class Ot{static isBuffered(e,t){if(e){const n=Ot.getBuffered(e);for(let i=n.length;i--;)if(t>=n.start(i)&&t<=n.end(i))return!0}return!1}static bufferedRanges(e){if(e){const t=Ot.getBuffered(e);return Ot.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(e,t,n){if(e){const i=Ot.bufferedRanges(e);if(i.length)return Ot.bufferedInfo(i,t,n)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((h,f)=>h.start-f.start||f.end-h.end);let i=-1,s=[];if(n)for(let h=0;h<e.length;h++){t>=e[h].start&&t<=e[h].end&&(i=h);const f=s.length;if(f){const d=s[f-1].end;e[h].start-d<n?e[h].end>d&&(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,d=s[h].end;if(i===-1&&t>=f&&t<=d&&(i=h),t+n>=f&&t<d)c=f,u=d,r=u-t;else if(t+n<f){o=f;break}}return{len:r,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||ui}catch(t){return ee.log("failed to get media.buffered",t),ui}}}const Ki=/\{\$([a-zA-Z0-9-_]+)\}/g;function cs(a){return Ki.test(a)}function Vi(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(Ki,n=>{const i=n.substring(2,n.length-1),s=t==null?void 0:t[i];return s===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):s})}return e}function es(a,e,t){let n=a.variableList;n||(a.variableList=n={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(i))s=r.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(r){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else i=e.NAME,s=e.VALUE;i in n?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function hs(a,e,t){const n=e.IMPORT;if(t&&n in t){let i=a.variableList;i||(a.variableList=i={}),i[n]=t[n]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const ws=/^(\d+)x(\d+)$/,fs=/(.+?)=(".*?"|.*?)(?:,|$)/g;class cn{constructor(e,t){typeof e=="string"&&(e=cn.parseAttrList(e,t)),g(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const n=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(i*2,i*2+2),16);return n}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((i,s)=>(i[s.toLowerCase()]=!0,i),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=ws.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n;const i={},s='"';for(fs.lastIndex=0;(n=fs.exec(e))!==null;){const r=n[1].trim();let o=n[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=Vi(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":ee.warn(`${e}: attribute ${r} is missing quotes`)}i[r]=o}return i}}const Ds="com.apple.hls.interstitial";function Rs(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function ds(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class ps{constructor(e,t,n=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(i=t==null?void 0:t.tagOrder)!=null?i:n,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){ee.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=g(new cn({}),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"]);T(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?(ee.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(T(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===Ds}get isValid(){return!!this.id&&!this._badValueForSameId&&T(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 Is=10;class Ls{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,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let n=t.decryptdata;return n||(t.setKeyFormat(e.keyFormat),n=t.decryptdata),!!n&&e.matches(n)})}get hasProgramDateTime(){return this.fragments.length?T(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Is}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(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.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 n=e.length;n--;)if(e[n].index>t)return e[n].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 Qn(a,e){return a.length===e.length?!a.some((t,n)=>t!==e[n]):!1}function zi(a,e){return!a&&!e?!0:!a||!e?!1:Qn(a,e)}function _i(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Bn(a){switch(a){case"AES-128":case"AES-256":return vn.cbc;case"AES-256-CTR":return vn.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function vi(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function ki(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function ci(a){const e=ki(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function yi(a){const e=function(n,i,s){const r=n[i];n[i]=n[s],n[s]=r};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function ts(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),i=n[n.length-1].split(",");if(i.length===2){const s=i[0]==="base64",r=i[1];s?(n.splice(-1,1),t=vi(r)):t=ci(r)}}return t}const Pi=typeof self!="undefined"?self:void 0;var dn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ln={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Wi(a){switch(a){case Ln.FAIRPLAY:return dn.FAIRPLAY;case Ln.PLAYREADY:return dn.PLAYREADY;case Ln.WIDEVINE:return dn.WIDEVINE;case Ln.CLEARKEY:return dn.CLEARKEY}}function St(a){switch(a){case dn.FAIRPLAY:return Ln.FAIRPLAY;case dn.PLAYREADY:return Ln.PLAYREADY;case dn.WIDEVINE:return Ln.WIDEVINE;case dn.CLEARKEY:return Ln.CLEARKEY}}function Nt(a){const{drmSystems:e,widevineLicenseUrl:t}=a,n=e?[dn.FAIRPLAY,dn.WIDEVINE,dn.PLAYREADY,dn.CLEARKEY].filter(i=>!!e[i]):[];return!n[dn.WIDEVINE]&&t&&n.push(dn.WIDEVINE),n}const hn=function(a){return Pi!=null&&(a=Pi.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Sn(a,e,t,n){let i;switch(a){case dn.FAIRPLAY:i=["cenc","sinf"];break;case dn.WIDEVINE:case dn.PLAYREADY:i=["cenc"];break;case dn.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return gn(i,e,t,n)}function gn(a,e,t,n){return[{initDataTypes:a,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function gs(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Cs(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),n=t.substring(t.indexOf("<"),t.length),r=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(r){const o=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(o){const c=vi(o).subarray(0,16);return yi(c),c}}return null}let ns={};class Fi{static clearKeyUriToKeyIdMap(){ns={}}constructor(e,t,n,i=[1],s=null,r){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=n,this.keyFormatVersions=i,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!_i(e),r!=null&&r.startsWith("0x")&&(this.keyId=new Uint8Array(R(r)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Qn(e.keyFormatVersions,this.keyFormatVersions)&&zi(e.iv,this.iv)&&zi(e.keyId,this.keyId)}isSupported(){if(this.method){if(_i(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Ln.FAIRPLAY:case Ln.WIDEVINE:case Ln.PLAYREADY:case Ln.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(_i(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(ee.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const n=il(e);return new Fi(this.method,this.uri,"identity",this.keyFormatVersions,n)}if(this.pssh&&this.keyId)return this;const t=ts(this.uri);if(t)switch(this.keyFormat){case Ln.WIDEVINE:if(this.pssh=t,!this.keyId&&t.length>=22){const n=t.length-22;this.keyId=t.subarray(n,n+16)}break;case Ln.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=pt(n,null,t),this.keyId=Cs(t);break}default:{let n=t.subarray(0,16);if(n.length!==16){const i=new Uint8Array(16);i.set(n,16-n.length),n=i}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n=ns[this.uri];if(!n){const i=Object.keys(ns).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,i),ns[this.uri]=n}this.keyId=n}return this}}function il(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const na=/#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,ia=/#EXT-X-MEDIA:(.*)/g,sl=/^#EXT(?:INF|-X-TARGETDURATION):/m,ur=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),rl=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 Ei{static findGroup(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===t)return i}}static resolve(e,t){return y.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return sl.test(e)}static parseMasterPlaylist(e,t){const n=cs(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];na.lastIndex=0;let r;for(;(r=na.exec(e))!=null;)if(r[1]){var o;const u=new cn(r[1],i),h=Vi(i,r[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Ei.resolve(h,t)},d=u.decimalResolution("RESOLUTION");d&&(f.width=d.width,f.height=d.height),oa(u.CODECS,f);const v=u["SUPPLEMENTAL-CODECS"];v&&(f.supplemental={},oa(v,f.supplemental)),(o=f.unknownCodecs)!=null&&o.length||s.push(f),i.levels.push(f)}else if(r[3]){const u=r[3],h=r[4];switch(u){case"SESSION-DATA":{const f=new cn(h,i),d=f["DATA-ID"];d&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[d]=f);break}case"SESSION-KEY":{const f=ra(h,t,i);f.encrypted&&f.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(f)):ee.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const f=new cn(h,i);es(i,f,t)}break}case"CONTENT-STEERING":{const f=new cn(h,i);i.contentSteering={uri:Ei.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=aa(h);break}}}const c=s.length>0&&s.length<i.levels.length;return i.levels=c?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,n){let i;const s={},r=n.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(ia.lastIndex=0;(i=ia.exec(e))!==null;){const u=new cn(i[1],n),h=u.TYPE;if(h){const f=o[h],d=s[h]||[];s[h]=d;const v=u.LANGUAGE,E=u["ASSOC-LANGUAGE"],D=u.CHANNELS,S=u.CHARACTERISTICS,B=u["INSTREAM-ID"],ne={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||v||"",type:h,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:v,url:u.URI?Ei.resolve(u.URI,t):""};if(E&&(ne.assocLang=E),D&&(ne.channels=D),S&&(ne.characteristics=S),B&&(ne.instreamId=B),f!=null&&f.length){const J=Ei.findGroup(f,ne.groupId)||f[0];la(ne,J,"audioCodec"),la(ne,J,"textCodec")}d.push(ne)}}return s}static parseLevelPlaylist(e,t,n,i,s,r){var o;const c={url:t},u=new Ls(t),h=u.fragments,f=[];let d=null,v=0,E=0,D=0,S=0,B=0,ne=null,J=new Ce(i,c),me,Le,ze,De=-1,Ne=!1,Me=null,Re;if(ur.lastIndex=0,u.m3u8=e,u.hasVariableRefs=cs(e),((o=ur.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(me=ur.exec(e))!==null;){Ne&&(Ne=!1,J=new Ce(i,c),J.playlistOffset=D,J.setStart(D),J.sn=v,J.cc=S,B&&(J.bitrate=B),J.level=n,d&&(J.initSegment=d,d.rawProgramDateTime&&(J.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),Me&&(J.setByteRange(Me),Me=null)));const Ct=me[1];if(Ct){J.duration=parseFloat(Ct);const wt=(" "+me[2]).slice(1);J.title=wt||null,J.tagList.push(wt?["INF",Ct,wt]:["INF",Ct])}else if(me[3]){if(T(J.duration)){J.playlistOffset=D,J.setStart(D),ze&&ca(J,ze,u),J.sn=v,J.level=n,J.cc=S,h.push(J);const wt=(" "+me[3]).slice(1);J.relurl=Vi(u,wt),cr(J,ne,f),ne=J,D+=J.duration,v++,E=0,Ne=!0}}else{if(me=me[0].match(rl),!me){ee.warn("No matches on slow regex match for level playlist!");continue}for(Le=1;Le<me.length&&me[Le]===void 0;Le++);const wt=(" "+me[Le]).slice(1),mt=(" "+me[Le+1]).slice(1),It=me[Le+2]?(" "+me[Le+2]).slice(1):null;switch(wt){case"BYTERANGE":ne?J.setByteRange(mt,ne):J.setByteRange(mt);break;case"PROGRAM-DATE-TIME":J.rawProgramDateTime=mt,J.tagList.push(["PROGRAM-DATE-TIME",mt]),De===-1&&(De=h.length);break;case"PLAYLIST-TYPE":u.type&&Oi(u,wt,me),u.type=mt.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Oi(u,wt,me):h.length>0&&ha(u,wt,me),v=u.startSN=parseInt(mt);break;case"SKIP":{u.skippedSegments&&Oi(u,wt,me);const xt=new cn(mt,u),Lt=xt.decimalInteger("SKIPPED-SEGMENTS");if(T(Lt)){u.skippedSegments+=Lt;for(let _t=Lt;_t--;)h.push(null);v+=Lt}const Kt=xt.enumeratedString("RECENTLY-REMOVED-DATERANGES");Kt&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(Kt.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Oi(u,wt,me),u.targetduration=Math.max(parseInt(mt),1);break;case"VERSION":u.version!==null&&Oi(u,wt,me),u.version=parseInt(mt);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Oi(u,wt,me),u.live=!1;break;case"#":(mt||It)&&J.tagList.push(It?[mt,It]:[mt]);break;case"DISCONTINUITY":S++,J.tagList.push(["DIS"]);break;case"GAP":J.gap=!0,J.tagList.push([wt]);break;case"BITRATE":J.tagList.push([wt,mt]),B=parseInt(mt)*1e3,T(B)?J.bitrate=B:B=0;break;case"DATERANGE":{const xt=new cn(mt,u),Lt=new ps(xt,u.dateRanges[xt.ID],u.dateRangeTagCount);u.dateRangeTagCount++,Lt.isValid||u.skippedSegments?u.dateRanges[Lt.id]=Lt:ee.warn(`Ignoring invalid DATERANGE tag: "${mt}"`),J.tagList.push(["EXT-X-DATERANGE",mt]);break}case"DEFINE":{{const xt=new cn(mt,u);"IMPORT"in xt?hs(u,xt,r):es(u,xt,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?Oi(u,wt,me):h.length>0&&ha(u,wt,me),u.startCC=S=parseInt(mt);break;case"KEY":{const xt=ra(mt,t,u);if(xt.isSupported()){if(xt.method==="NONE"){ze=void 0;break}ze||(ze={});const Lt=ze[xt.keyFormat];Lt!=null&&Lt.matches(xt)||(Lt&&(ze=g({},ze)),ze[xt.keyFormat]=xt)}else ee.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${mt}"`);break}case"START":u.startTimeOffset=aa(mt);break;case"MAP":{const xt=new cn(mt,u);if(J.duration){const Lt=new Ce(i,c);ua(Lt,xt,n,ze),d=Lt,J.initSegment=d,d.rawProgramDateTime&&!J.rawProgramDateTime&&(J.rawProgramDateTime=d.rawProgramDateTime)}else{const Lt=J.byteRangeEndOffset;if(Lt){const Kt=J.byteRangeStartOffset;Me=`${Lt-Kt}@${Kt}`}else Me=null;ua(J,xt,n,ze),d=J,Ne=!0}d.cc=S;break}case"SERVER-CONTROL":{Re&&Oi(u,wt,me),Re=new cn(mt),u.canBlockReload=Re.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Re.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Re.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Re.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Re.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&Oi(u,wt,me);const xt=new cn(mt);u.partTarget=xt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let xt=u.partList;xt||(xt=u.partList=[]);const Lt=E>0?xt[xt.length-1]:void 0,Kt=E++,_t=new cn(mt,u),vt=new Ue(_t,J,c,Kt,Lt);xt.push(vt),J.duration+=vt.duration;break}case"PRELOAD-HINT":{const xt=new cn(mt,u);u.preloadHint=xt;break}case"RENDITION-REPORT":{const xt=new cn(mt,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(xt);break}default:ee.warn(`line parsed but not handled: ${me}`);break}}}ne&&!ne.relurl?(h.pop(),D-=ne.duration,u.partList&&(u.fragmentHint=ne)):u.partList&&(cr(J,ne,f),J.cc=S,u.fragmentHint=J,ze&&ca(J,ze,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Qe=h.length,yt=h[0],At=h[Qe-1];if(D+=u.skippedSegments*u.targetduration,D>0&&Qe&&At){u.averagetargetduration=D/Qe;const Ct=At.sn;u.endSN=Ct!=="initSegment"?Ct:0,u.live||(At.endList=!0),De>0&&(ol(h,De),yt&&f.unshift(yt))}return u.fragmentHint&&(D+=u.fragmentHint.duration),u.totalduration=D,f.length&&u.dateRangeTagCount&&yt&&sa(f,u),u.endCC=S,u}}function sa(a,e){let t=a.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];a.push(o),t++}else return;const n=a[t-1],i=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let o=s.length;o--;){const c=e.dateRanges[s[o]],u=c.startDate.getTime();c.tagAnchor=n.ref;for(let h=t;h--;){var r;if(((r=a[h])==null?void 0:r.sn)<e.startSN)break;const f=al(e,u,a,h,i);if(f!==-1){c.tagAnchor=e.fragments[f].ref;break}}}}function al(a,e,t,n,i){const s=t[n];if(s){const o=s.programDateTime;if(e>=o||n===0){var r;const c=(((r=t[n+1])==null?void 0:r.start)||i)-s.start;if(e<=o+c*1e3){const u=t[n].sn-a.startSN;if(u<0)return-1;const h=a.fragments;if(h.length>t.length){const d=(t[n+1]||h[h.length-1]).sn-a.startSN;for(let v=d;v>u;v--){const E=h[v].programDateTime;if(e>=E&&e<E+h[v].duration*1e3)return v}}return u}}}return-1}function ra(a,e,t){var n,i;const s=new cn(a,t),r=(n=s.METHOD)!=null?n:"",o=s.URI,c=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,h=(i=s.KEYFORMAT)!=null?i:"identity";o&&s.IV&&!c&&ee.error(`Invalid IV: ${s.IV}`);const f=o?Ei.resolve(o,e):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Fi(r,f,h,d,c,s.KEYID)}function aa(a){const t=new cn(a).decimalFloatingPoint("TIME-OFFSET");return T(t)?t:null}function oa(a,e){let t=(a||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>Dt(s,n));i.length&&(e[`${n}Codec`]=i.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function la(a,e,t){const n=e[t];n&&(a[t]=n)}function ol(a,e){let t=a[e];for(let n=e;n--;){const i=a[n];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function cr(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function ua(a,e,t,n){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",n&&(a.levelkeys=n),a.initSegment=null}function ca(a,e,t){a.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&n.push(a)}function Oi(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function ha(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function hr(a,e){const t=e.startPTS;if(T(t)){let n=0,i;e.sn>a.sn?(n=t-a.start,i=a):(n=a.start-t,i=e),i.duration!==n&&i.setDuration(n)}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 fa(a,e,t,n,i,s,r){n-t<=0&&(r.warn("Fragment should have a positive duration",e),n=t+e.duration,s=i+e.duration);let c=t,u=n;const h=e.startPTS,f=e.endPTS;if(T(h)){const B=Math.abs(h-t);a&&B>a.totalduration?r.warn(`media timestamps and playlist times differ by ${B}s for level ${e.level} ${a.url}`):T(e.deltaPTS)?e.deltaPTS=Math.max(B,e.deltaPTS):e.deltaPTS=B,c=Math.max(t,h),t=Math.min(t,h),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,u=Math.min(n,f),n=Math.max(n,f),s=e.endDTS!==void 0?Math.max(s,e.endDTS):s}const d=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(n-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=i,e.endPTS=n,e.minEndPTS=u,e.endDTS=s;const v=e.sn;if(!a||v<a.startSN||v>a.endSN)return 0;let E;const D=v-a.startSN,S=a.fragments;for(S[D]=e,E=D;E>0;E--)hr(S[E],S[E-1]);for(E=D;E<S.length-1;E++)hr(S[E],S[E+1]);return a.fragmentHint&&hr(S[S.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,d}function ll(a,e,t){if(a===e)return;let n=null;const i=a.fragments;for(let h=i.length-1;h>=0;h--){const f=i[h].initSegment;if(f){n=f;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let s;hl(a,e,(h,f,d,v)=>{if((!e.startCC||e.skippedSegments)&&f.cc!==h.cc){const E=h.cc-f.cc;for(let D=d;D<v.length;D++)v[D].cc+=E;e.endCC=v[v.length-1].cc}T(h.startPTS)&&T(h.endPTS)&&(f.setStart(f.startPTS=h.startPTS),f.startDTS=h.startDTS,f.maxStartPTS=h.maxStartPTS,f.endPTS=h.endPTS,f.endDTS=h.endDTS,f.minEndPTS=h.minEndPTS,f.setDuration(h.endPTS-h.startPTS),f.duration&&(s=f),e.PTSKnown=e.alignedSliding=!0),h.hasStreams&&(f.elementaryStreams=h.elementaryStreams),f.loader=h.loader,h.hasStats&&(f.stats=h.stats),h.initSegment&&(f.initSegment=h.initSegment,n=h.initSegment)});const r=e.fragments,o=e.fragmentHint?r.concat(e.fragmentHint):r;if(n&&o.forEach(h=>{var f;h&&(!h.initSegment||h.initSegment.relurl===((f=n)==null?void 0:f.relurl))&&(h.initSegment=n)}),e.skippedSegments){if(e.deltaUpdateFailed=r.some(h=>!h),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let h=e.skippedSegments;h--;)r.shift();e.startSN=r[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=ul(a.dateRanges,e,t));const h=a.fragments.filter(f=>f.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let f=1;f<o.length;f++)o[f].programDateTime===null&&cr(o[f],o[f-1],h);sa(h,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var c;const h=ma(a,e.startSN-1);e.startCC=(c=h==null?void 0:h.cc)!=null?c:r[0].cc}cl(a.partList,e.partList,(h,f)=>{f.elementaryStreams=h.elementaryStreams,f.stats=h.stats}),s?fa(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,t):pa(a,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const u=e.advancedDateTime;if(e.advanced&&u){const h=e.edge;e.driftStart||(e.driftStartTime=u,e.driftStart=h),e.driftEndTime=u,e.driftEnd=h}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function ul(a,e,t){const{dateRanges:n,recentlyRemovedDateranges:i}=e,s=g({},a);i&&i.forEach(c=>{delete s[c]});const o=Object.keys(s).length;return o?(Object.keys(n).forEach(c=>{const u=s[c],h=new ps(n[c].attr,u);h.isValid?(s[c]=h,u||(h.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Pt(n[c].attr)}"`)}),s):n}function cl(a,e,t){if(a&&e){let n=0;for(let i=0,s=a.length;i<=s;i++){const r=a[i],o=e[i+n];r&&o&&r.index===o.index&&r.fragment.sn===o.fragment.sn?t(r,o):n--}}}function hl(a,e,t){const n=e.skippedSegments,i=Math.max(a.startSN,e.startSN)-e.startSN,s=(a.fragmentHint?1:0)+(n?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=i;u<=s;u++){const h=c[r+u];let f=o[u];if(n&&!f&&h&&(f=e.fragments[u]=h),h&&f){t(h,f,u,o);const d=h.relurl,v=f.relurl;if(d&&fl(d,v)){e.playlistParsingError=da(`media sequence mismatch ${f.sn}:`,a,e,h,f);return}else if(h.cc!==f.cc){e.playlistParsingError=da(`discontinuity sequence mismatch (${h.cc}!=${f.cc})`,a,e,h,f);return}}}}function da(a,e,t,n,i){return new Error(`${a} ${i.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function pa(a,e,t=!0){const n=e.startSN+e.skippedSegments-a.startSN,i=a.fragments,s=n>=0;let r=0;if(s&&n<i.length)r=i[n].start;else if(s&&e.startSN===a.endSN+1)r=a.fragmentEnd;else if(s&&t)r=a.fragmentStart+n*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)r=a.fragmentStart;else return;fr(e,r)}function fr(a,e){if(e){const t=a.fragments;for(let n=a.skippedSegments;n<t.length;n++)t[n].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function ga(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const n=a.fragments;if(n.length&&t*4>e){const s=n[n.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function ma(a,e,t){if(!a)return null;let n=a.fragments[e-a.startSN];return n||(n=a.fragmentHint,n&&n.sn===e)?n:e<a.startSN&&t&&t.sn===e?t:null}function _a(a,e,t){return a?va(a.partList,e,t):null}function va(a,e,t){if(a)for(let n=a.length;n--;){const i=a[n];if(i.index===t&&i.fragment.sn===e)return i}return null}function ya(a){a.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t)})})}function fl(a,e){return a!==e&&e?Ea(a)!==Ea(e):!1}function Ea(a){return a.replace(/\?[^?]*$/,"")}function ks(a,e){for(let n=0,i=a.length;n<i;n++){var t;if(((t=a[n])==null?void 0:t.cc)===e)return a[n]}return null}function dl(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function ba(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function xa(a,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)ba(t[n],a);e.fragmentHint&&ba(e.fragmentHint,a),e.alignedSliding=!0}function pl(a,e){a&&(Ta(e,a),e.alignedSliding||Ks(e,a),!e.alignedSliding&&!e.skippedSegments&&pa(a,e,!1))}function Ta(a,e){if(!dl(e,a))return;const t=Math.min(e.endCC,a.endCC),n=ks(e.fragments,t),i=ks(a.fragments,t);if(!n||!i)return;ee.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=n.start-i.start;xa(s,a)}function Ks(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,n=e.fragments;if(!t.length||!n.length)return;let i,s;const r=Math.min(e.endCC,a.endCC);e.startCC<r&&a.startCC<r&&(i=ks(n,r),s=ks(t,r)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=ks(t,i.cc)||t[Math.floor(t.length/2)]);const o=i.programDateTime,c=s.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(s.start-i.start);xa(u,a)}function Hn(a,e,t){Zn(a,e,t),a.addEventListener(e,t)}function Zn(a,e,t){a.removeEventListener(e,t)}const gl={toString:function(a){let e="";const t=a.length;for(let n=0;n<t;n++)e+=`[${a.start(n).toFixed(3)}-${a.end(n).toFixed(3)}]`;return e}},Je={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 dr extends Ci{constructor(e,t,n,i,s){super(i,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Je.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,d=Ot.bufferInfo(u||c,f,r.maxBufferHole),v=!d.len;if(this.log(`Media seeking to ${T(f)?f.toFixed(3):f}, state: ${h}, ${v?"out of":"in"} buffer`),this.state===Je.ENDED)this.resetLoadingState();else if(o){const E=r.maxFragLookUpTolerance,D=o.start-E,S=o.start+o.duration+E;if(v||S<d.start||D>d.end){const B=f>S;(f<D||B)&&(B&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const E=this.lastCurrentTime;if(f>E&&(this.lastCurrentTime=f),!this.loadingParts){const D=Math.max(d.end,f),S=this.shouldLoadParts(this.getLevelDetails(),D);S&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${D.toFixed(2)}`),this.loadingParts=S)}}this.hls.hasEnoughToStart||(this.log(`Setting ${v?"startPosition":"nextLoadPosition"} to ${f} for seek without enough to start`),this.nextLoadPosition=f,v&&(this.startPosition=f)),v&&this.state===Je.IDLE&&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 Ii(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new $i(e.config)}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Je.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=Je.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const n=e.end||0,i=this.config.timelineOffset||0;if(n<=i)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=Ot.bufferedInfo(s,e.start,0));const r=e.nextStart;if(r&&r>i&&r<t.edge||this.media.currentTime<e.start)return!1;const c=t.partList;if(c!=null&&c.length){const h=c[c.length-1];return Ot.isBuffered(this.media,h.start+h.duration/2)}const u=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;Hn(n,"seeking",this.onMediaSeeking),Hn(n,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===Je.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(i!==null){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Zn(i,"seeking",this.onMediaSeeking),Zn(i,"ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Je.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const i=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,n,i).then(s=>{if(!s)return;const r=this.state,o=s.frag;if(this.fragContextChanged(o)){(r===Je.FRAG_LOADING||!this.fragCurrent&&r===Je.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=Je.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(p.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===Je.STOPPED||this.state===Je.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===un.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))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===un.PARTIAL&&n.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(p.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{const i=n==null?void 0:n.frag;if(!i||this.fragContextChanged(i)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{frag:s,payload:r}=n,o=s.decryptdata;if(r&&r.byteLength>0&&o!=null&&o.key&&o.iv&&_i(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,Bn(o.method)).catch(u=>{throw i.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const h=self.performance.now();return i.trigger(p.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:c,tdecrypt:h}}),n.payload=u,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===Je.STOPPED||this.state===Je.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==Je.STOPPED&&(this.state=Je.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var n,i;const s=e.tracks;if(s&&!t.encrypted&&((n=s.audio)!=null&&n.encrypted||(i=s.video)!=null&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const r=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${r?"attached mediaKeys: "+r.mediaKeys:"detached"})`);return this.warn(o.message),!r||r.mediaKeys?!1:(this.hls.trigger(p.ERROR,{type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${n?gl.toString(Ot.getBuffered(n)):"(detached)"})`),Ee(e)){var i;if(e.type!==te.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=Je.IDLE;return}}const s=(i=this.levels)==null?void 0:i[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=Je.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:n,part:i,partsLoaded:s}=e,r=!s||s.length===0||s.some(c=>!c),o=new Wn(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!r);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,i){var s;this.fragCurrent=e;const r=t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let o=null;if(e.encrypted&&!((s=e.decryptdata)!=null&&s.key)){if(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Je.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(p.KEY_LOADED,d),this.state===Je.KEY_LOADING&&(this.state=Je.IDLE),d}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,r.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(Ee(e)&&(!c||e.sn!==c.sn)){const d=this.shouldLoadParts(t.details,e.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=d)}if(n=Math.max(e.start,n||0),this.loadingParts&&Ee(e)){const d=r.partList;if(d&&i){n>r.fragmentEnd&&r.fragmentHint&&(e=r.fragmentHint);const v=this.getNextPart(d,e,n);if(v>-1){const E=d[v];e=this.fragCurrent=E.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${E.index} (${v}/${d.length-1}) of ${this.fragInfo(e,!1,E)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=E.start+E.duration,this.state=Je.FRAG_LOADING;let D;return o?D=o.then(S=>!S||this.fragContextChanged(S.frag)?null:this.doFragPartsLoad(e,E,t,i)).catch(S=>this.handleFragLoadError(S)):D=this.doFragPartsLoad(e,E,t,i).catch(S=>this.handleFragLoadError(S)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:E,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):D}else if(!e.url||this.loadedEndOfParts(d,n))return Promise.resolve(null)}}if(Ee(e)&&this.loadingParts){var u;this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(u=r.partList)==null?void 0:u.filter(d=>d.loaded).map(d=>`[${d.start}-${d.end}]`)}`),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.startSN+"-"+r.endSN+"]"}, target: ${parseFloat(n.toFixed(3))}`),T(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Je.FRAG_LOADING;const h=this.config.progressive;let f;return h&&o?f=o.then(d=>!d||this.fragContextChanged(d.frag)?null:this.fragmentLoader.load(e,i)).catch(d=>this.handleFragLoadError(d)):f=Promise.all([this.fragmentLoader.load(e,h?i:void 0),o]).then(([d])=>(!h&&i&&i(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):f}doFragPartsLoad(e,t,n,i){return new Promise((s,r)=>{var o;const c=[],u=(o=n.details)==null?void 0:o.partList,h=f=>{this.fragmentLoader.loadPart(e,f,i).then(d=>{c[f.index]=d;const v=d.part;this.hls.trigger(p.FRAG_LOADED,d);const E=_a(n.details,e.sn,f.index+1)||va(u,e.sn,f.index+1);if(E)h(E);else return s({frag:e,part:v,partsLoaded:c})}).catch(r)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===H.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===oe.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetFragmentLoading(t.frag)):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Je.PARSING){!this.fragCurrent&&this.state!==Je.STOPPED&&this.state!==Je.ERROR&&(this.state=Je.IDLE);return}const{frag:n,part:i,level:s}=t,r=self.performance.now();n.stats.parsing.end=r,i&&(i.stats.parsing.end=r);const o=this.getLevelDetails(),u=o&&n.sn>o.endSN||this.shouldLoadParts(o,n.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(n,i,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var n;const s=e.partList[0];if(s.fragment.type===te.SUBTITLE)return!1;const r=s.end+(((n=e.fragmentHint)==null?void 0:n.duration)||0);if(t>=r){var i;if((this.hls.hasEnoughToStart?((i=this.media)==null?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:s,part:r}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const o=t[i],c=o.details,u=r>-1?_a(c,s,r):null,h=u?u.fragment:ma(c,s,n);return h?(n&&n!==h&&(h.stats=n.stats),{frag:h,part:u,level:o}):null}bufferFragmentData(e,t,n,i,s){if(this.state!==Je.PARSING)return;const{data1:r,data2:o}=e;let c=r;if(o&&(c=We(r,o)),!c.length)return;const u=this.initPTS[t.cc],h=u?-u.baseTime/u.timescale:void 0,f={type:e.type,frag:t,part:n,chunkMeta:i,offset:h,parent:t.type,data:c};if(this.hls.trigger(p.BUFFER_APPENDING,f),e.dropped&&e.independent&&!n){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ot.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=Ot.bufferInfo(t,n,0),s=e.duration,r=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),o=Math.max(Math.min(e.start-r,i.end-r),n+r);e.start-o>r&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var n;const i=this.getLoadPosition();if(!T(i))return null;const r=this.lastCurrentTime>i||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,r)}getFwdBufferInfoAtPos(e,t,n,i){const s=Ot.bufferInfo(e,t,i);if(s.len===0&&s.nextStart!==void 0){const r=this.fragmentTracker.getBufferedFrag(t,n);if(r&&(s.nextStart<=r.end||r.gap)){const o=Math.max(Math.min(s.nextStart,r.end)-t,i);return Ot.bufferInfo(e,t,o)}}return s}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,i=Math.max(Math.min(e-t,n.maxBufferLength),t),s=Math.max(e-t*3,n.maxMaxBufferLength/2,i);return s>=i?(n.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=te.MAIN){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:s}=this,r=n[0].start,o=s.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const f=s.initialLiveManifestSize;if(i<f)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${f})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<r){var u;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t);const d=this.hls.startPosition,v=this.hls.liveSyncPosition,E=c?(d!==-1&&d>=r?d:v)||c.start:e;this.log(`Setting startPosition to ${E} to match start frag at live edge. mainStart: ${d} liveSyncPosition: ${v} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=E}}else e<=r&&(c=n[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(n[f+1]||null,t)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===un.OK||n===un.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,s){let r=null;if(e.gap&&(r=this.getNextFragment(this.nextLoadPosition,t),r&&!r.gap&&n.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i,0);if(o!==null&&n.len+o.len>=s){const c=r.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if(Sa(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Sa(this.config)&&e.type!==te.SUBTITLE){const n=this.hls.interstitialsManager,i=n==null?void 0:n.bufferingItem;if(i){const r=i.event;if(r){if(r.appendInPlace||Math.abs(e.start-i.start)>1||i.start===0)return null}else if(e.end<=i.start&&(t==null?void 0:t.live)===!1||e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}const s=n==null?void 0:n.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.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,n){let i=-1,s=!1,r=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(r=r&&!u.independent,i>-1&&n<u.start)break;const h=u.loaded;h?i=-1:(s||(u.independent||r)&&u.fragment===t)&&(u.fragment!==t&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${u.start}`),i=o),s=h}return i}loadedEndOfParts(e,t){let n;for(let i=e.length;i--;){if(n=e[i],!n.loaded)return!1;if(t>n.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=In(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const s=n.sn+1;if(s>=e.startSN&&s<=e.endSN){const r=t[s-e.startSN];n.cc===r.cc&&(i=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=Yn(e,n.cc,n.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:s}=this,{fragments:r,endSN:o}=n;const{fragmentHint:c}=n,{maxFragLookUpTolerance:u}=i,h=n.partList,f=!!(this.loadingParts&&h!=null&&h.length&&c);f&&!this.bitrateTest&&h[h.length-1].fragment.sn===c.sn&&(r=r.concat(c),o=c.sn);let d;if(e<t){var v;const D=e<this.lastCurrentTime||e>t-u||(v=this.media)!=null&&v.paused||!this.startFragRequested?0:u;d=ei(s,r,e,D)}else d=r[r.length-1];if(d){const E=d.sn-n.startSN,D=this.fragmentTracker.getState(d);if((D===un.OK||D===un.PARTIAL&&d.gap)&&(s=d),s&&d.sn===s.sn&&(!f||h[0].fragment.sn>d.sn||!n.live)&&d.level===s.level){const B=r[E+1];d.sn<o&&this.fragmentTracker.getState(B)!==un.OK?d=B:d=null}}return d}alignPlaylists(e,t,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,r=!t,o=e.alignedSliding&&T(s);if(r||!o&&!s){pl(n,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${i}`),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 n=this.startPosition;n<t&&(n=-1);const i=this.timelineOffset;if(n===-1){const s=this.startTimeOffset!==null,r=s?this.startTimeOffset:e.startTimeOffset;r!==null&&T(r)?(n=t+r,r<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${r} found in ${s?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+i}this.nextLoadPosition=n+i}getLoadPosition(){var e;const{media:t}=this;let n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&Ee(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==Je.FRAG_LOADING_WAITING_RETRY)&&(this.state=Je.IDLE)}onFragmentOrKeyLoadError(e,t){var n;if(t.chunkMeta&&!t.frag){const B=this.getCurrentContext(t.chunkMeta);B&&(t.frag=B.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var s;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const r=t.details===H.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction;if(!o){this.state=Je.ERROR;return}const{action:c,flags:u,retryCount:h=0,retryConfig:f}=o,d=!!f,v=d&&c===_n.RetryRequest,E=d&&!o.resolved&&u===Dn.MoveAllAlternatesMatchingHost,D=(n=this.hls.latestLevelDetails)==null?void 0:n.live;if(!v&&E&&Ee(i)&&!i.endList&&D)this.resetFragmentErrors(e),this.treatAsGap(i),o.resolved=!0;else if((v||E)&&h<f.maxNumRetry){var S;const B=qi((S=t.response)==null?void 0:S.code),ne=Bi(f,h);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+ne,this.state=Je.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,B){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${h+1}/${f.maxNumRetry} in ${ne}ms`)}else if(f)if(this.resetFragmentErrors(e),h<f.maxNumRetry)!r&&c!==_n.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${h})`);return}else c===_n.SendAlternateToPenaltyBox?this.state=Je.WAITING_LEVEL:this.state=Je.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,n=t===1/0;(!t||e>=t||n&&!qi(0))&&(n&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Je.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Je.PARSING||this.state===Je.PARSED){const t=e.frag,n=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,n),s=i&&i.len>.5;s&&this.reduceMaxBufferLength(i.len,(t==null?void 0:t.duration)||10);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===te.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Je.STOPPED&&(this.state=Je.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const i=Ot.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===Je.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Je.STOPPED&&(this.state=Je.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,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.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,n,i){const s=n.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 d=i?0:fa(s,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS,this);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:s,level:n,drift:d,type:u,frag:e,start:h.startPTS,end:h.endPTS}),!0}return c},!1)){var o;if(n.fragmentError===0&&this.treatAsGap(e,n),((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(p.ERROR,{type:oe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Je.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(p.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===te.MAIN?"level":"track"}fragInfo(e,t=!0,n){var i,s;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${((i=t&&!n?e.startPTS:(n||e).start)!=null?i:NaN).toFixed(3)}-${((s=t&&!n?e.endPTS:(n||e).end)!=null?s:NaN).toFixed(3)}]${n&&e.type==="main"?"INDEPENDENT="+(n.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Sa(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Aa{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=ml(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function ml(a,e){const t=new Uint8Array(e);let n=0;for(let i=0;i<a.length;i++){const s=a[i];t.set(s,n),n+=s.length}return t}var pr={exports:{}},wa;function _l(){return wa||(wa=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(c,u,h){this.fn=c,this.context=u,this.once=h||!1}function s(c,u,h,f,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var v=new i(h,f||c,d),E=t?t+u:u;return c._events[E]?c._events[E].fn?c._events[E]=[c._events[E],v]:c._events[E].push(v):(c._events[E]=v,c._eventsCount++),c}function r(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function o(){this._events=new n,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 d=0,v=f.length,E=new Array(v);d<v;d++)E[d]=f[d].fn;return E},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,d,v,E){var D=t?t+u:u;if(!this._events[D])return!1;var S=this._events[D],B=arguments.length,ne,J;if(S.fn){switch(S.once&&this.removeListener(u,S.fn,void 0,!0),B){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,h),!0;case 3:return S.fn.call(S.context,h,f),!0;case 4:return S.fn.call(S.context,h,f,d),!0;case 5:return S.fn.call(S.context,h,f,d,v),!0;case 6:return S.fn.call(S.context,h,f,d,v,E),!0}for(J=1,ne=new Array(B-1);J<B;J++)ne[J-1]=arguments[J];S.fn.apply(S.context,ne)}else{var me=S.length,Le;for(J=0;J<me;J++)switch(S[J].once&&this.removeListener(u,S[J].fn,void 0,!0),B){case 1:S[J].fn.call(S[J].context);break;case 2:S[J].fn.call(S[J].context,h);break;case 3:S[J].fn.call(S[J].context,h,f);break;case 4:S[J].fn.call(S[J].context,h,f,d);break;default:if(!ne)for(Le=1,ne=new Array(B-1);Le<B;Le++)ne[Le-1]=arguments[Le];S[J].fn.apply(S[J].context,ne)}}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,d){var v=t?t+u:u;if(!this._events[v])return this;if(!h)return r(this,v),this;var E=this._events[v];if(E.fn)E.fn===h&&(!d||E.once)&&(!f||E.context===f)&&r(this,v);else{for(var D=0,S=[],B=E.length;D<B;D++)(E[D].fn!==h||d&&!E[D].once||f&&E[D].context!==f)&&S.push(E[D]);S.length?this._events[v]=S.length===1?S[0]:S:r(this,v)}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 n,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}(pr)),pr.exports}var vl=_l(),gr=O(vl);const Ps="1.6.11",ms={};function yl(){return typeof __HLS_WORKER_BUNDLE__=="function"}function El(){const a=ms[Ps];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),i={worker:new self.Worker(t),objectURL:t,clientCount:1};return ms[Ps]=i,i}function bl(a){const e=ms[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,i={worker:new self.Worker(t),scriptURL:t,clientCount:1};return ms[a]=i,i}function xl(a){const e=ms[a||Ps];if(e&&e.clientCount--===1){const{worker:n,objectURL:i}=e;delete ms[a||Ps],i&&self.URL.revokeObjectURL(i),n.terminate()}}function Da(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 mr(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 Vs(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 Fs(a,e){const t=e;let n=0;for(;mr(a,e);){n+=10;const i=Vs(a,e+6);n+=i,Da(a,e+10)&&(n+=10),e+=n}if(n>0)return a.subarray(t,t+n)}function Tl(a,e,t,n){const i=[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 v=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:oe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!0,error:v,reason:v.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,h=i[r];let f=r;(o===5||o===29)&&(f-=3);const d=[o<<3|(f&14)>>1,(f&1)<<7|c<<3];return ee.log(`manifest codec:${n}, parsed codec:${u}, channels:${c}, rate:${h} (ADTS object type:${o} sampling index:${r})`),{config:d,samplerate:h,channelCount:c,codec:u,parsedCodec:u,manifestCodec:n}}function Ra(a,e){return a[e]===255&&(a[e+1]&246)===240}function Ia(a,e){return a[e+1]&1?7:9}function _r(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function Sl(a,e){return e+5<a.length}function zs(a,e){return e+1<a.length&&Ra(a,e)}function Al(a,e){return Sl(a,e)&&Ra(a,e)&&_r(a,e)<=a.length-e}function wl(a,e){if(zs(a,e)){const t=Ia(a,e);if(e+t>=a.length)return!1;const n=_r(a,e);if(n<=t)return!1;const i=e+n;return i===a.length||zs(a,i)}return!1}function La(a,e,t,n,i){if(!a.samplerate){const s=Tl(e,t,n,i);if(!s)return;g(a,s)}}function Ca(a){return 1024*9e4/a}function Dl(a,e){const t=Ia(a,e);if(e+t<=a.length){const n=_r(a,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function ka(a,e,t,n,i){const s=Ca(a.samplerate),r=n+i*s,o=Dl(e,t);let c;if(o){const{frameLength:f,headerLength:d}=o,v=d+f,E=Math.max(0,t+v-e.length);E?(c=new Uint8Array(v-d),c.set(e.subarray(t+d,e.length),0)):c=e.subarray(t+d,t+v);const D={unit:c,pts:r};return E||a.samples.push(D),{sample:D,length:v,missing:E}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:r},length:u,missing:-1}}function Rl(a,e){return mr(a,e)&&Vs(a,e+6)+10<=a.length-e}function Il(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function vr(a,e=0,t=1/0){return Ll(a,e,t,Uint8Array)}function Ll(a,e,t,n){const i=Cl(a);let s=1;"BYTES_PER_ELEMENT"in n&&(s=n.BYTES_PER_ELEMENT);const r=kl(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 n(i,u,h-u)}function Cl(a){return a instanceof ArrayBuffer?a:a.buffer}function kl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function Pl(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 n=a.data.subarray(1).indexOf(0);if(n===-1)return;const i=Ge(vr(a.data,1,n)),s=a.data[2+n],r=a.data.subarray(3+n).indexOf(0);if(r===-1)return;const o=Ge(vr(a.data,3+n,r));let c;return i==="-->"?c=Ge(vr(a.data,4+n+r)):c=Il(a.data.subarray(4+n+r)),e.mimeType=i,e.pictureType=s,e.description=o,e.data=c,e}function Fl(a){if(a.size<2)return;const e=Ge(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function Ol(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const n=Ge(a.data.subarray(t),!0);t+=n.length+1;const i=Ge(a.data.subarray(t));return{key:a.type,info:n,data:i}}const e=Ge(a.data.subarray(1));return{key:a.type,info:"",data:e}}function Nl(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const n=Ge(a.data.subarray(t),!0);t+=n.length+1;const i=Ge(a.data.subarray(t));return{key:a.type,info:n,data:i}}const e=Ge(a.data);return{key:a.type,info:"",data:e}}function Ml(a){return a.type==="PRIV"?Fl(a):a.type[0]==="W"?Nl(a):a.type==="APIC"?Pl(a):Ol(a)}function Bl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=Vs(a,4),n=10;return{type:e,size:t,data:a.subarray(n,n+t)}}const Ws=10,Ul=10;function Pa(a){let e=0;const t=[];for(;mr(a,e);){const n=Vs(a,e+6);a[e+5]>>6&1&&(e+=Ws),e+=Ws;const i=e+n;for(;e+Ul<i;){const s=Bl(a.subarray(e)),r=Ml(s);r&&t.push(r),e+=s.size+Ws}Da(a,e)&&(e+=Ws)}return t}function Fa(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function $l(a){if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}}function yr(a){const e=Pa(a);for(let t=0;t<e.length;t++){const n=e[t];if(Fa(n))return $l(n)}}let Jn=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 bi(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Er{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,n,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,n){}demux(e,t){this.cachedData&&(e=We(this.cachedData,e),this.cachedData=null);let n=Fs(e,0),i=n?n.length:0,s;const r=this._audioTrack,o=this._id3Track,c=n?yr(n):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&T(c))&&(this.basePTS=Gl(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Jn.audioId3,duration:Number.POSITIVE_INFINITY});i<u;){if(this.canParse(e,i)){const h=this.appendFrame(r,e,i);h?(this.frameIndex++,this.lastPTS=h.sample.pts,i+=h.length,s=i):i=u}else Rl(e,i)?(n=Fs(e,i),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Jn.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===u&&s!==u){const h=e.slice(s);this.cachedData?this.cachedData=We(this.cachedData,h):this.cachedData=h}}return{audioTrack:r,videoTrack:bi(),id3Track:o,textTrack:bi()}}demuxSampleAes(e,t,n){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:bi(),id3Track:this._id3Track,textTrack:bi()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Gl=(a,e,t)=>{if(T(a))return a*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};let Hs=null;const Kl=[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],Vl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],zl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Wl=[0,1,1,4];function Oa(a,e,t,n,i){if(t+24>e.length)return;const s=Na(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=n+i*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 Na(a,e){const t=a[e+1]>>3&3,n=a[e+1]>>1&3,i=a[e+2]>>4&15,s=a[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&s!==3){const r=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-n:n===3?3:4,u=Kl[c*14+i-1]*1e3,f=Vl[(t===3?0:t===2?1:2)*3+s],d=o===3?1:2,v=zl[t][n],E=Wl[n],D=v*8*E,S=Math.floor(v*u/f+r)*E;if(Hs===null){const J=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Hs=J?parseInt(J[1]):0}return!!Hs&&Hs<=87&&n===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:f,channelCount:d,frameLength:S,samplesPerFrame:D}}}function br(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Ma(a,e){return e+1<a.length&&br(a,e)}function Hl(a,e){return br(a,e)&&4<=a.length-e}function Ba(a,e){if(e+1<a.length&&br(a,e)){const n=Na(a,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===a.length||Ma(a,s)}return!1}class jl extends Er{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const n=Fs(e,0);let i=(n==null?void 0:n.length)||0;if(Ba(e,i))return!1;for(let s=e.length;i<s;i++)if(wl(e,i))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Al(e,t)}appendFrame(e,t,n){La(e,this.observer,t,n,e.manifestCodec);const i=ka(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const Ua=(a,e)=>{let t=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),r=new Uint8Array(1);for(;n>0;){r[0]=a[e];const o=Math.min(n,8),c=8-o;s[0]=4278190080>>>24+c<<c,i[0]=(r[0]&s[0])>>c,t=t?t<<o|i[0]:i[0],e+=1,n-=o}return t};class Yl extends Er{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=$a(e,t,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=Fs(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&yr(t)!==void 0&&Ua(e,n)<16}}function $a(a,e,t,n,i){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 d=0;f===2?d+=2:(f&1&&f!==1&&(d+=2),f&4&&(d+=2));const v=(e[t+6]<<8|e[t+7])>>12-d&1,D=[2,1,2,3,3,4,4,5][f]+v,S=e[t+5]>>3,B=e[t+5]&7,ne=new Uint8Array([s<<6|S<<1|B>>2,(B&3)<<6|f<<3|v<<2|c>>4,c<<4&224]),J=1536/o*9e4,me=n+i*J,Le=e.subarray(t,t+h);return a.config=ne,a.channelCount=D,a.samplerate=o,a.samples.push({unit:Le,pts:me}),h}class Zl extends Er{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Fs(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&yr(t)!==void 0&&Ua(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(Ba(e,n))return ee.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Hl(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return Oa(e,t,n,this.basePTS,this.frameIndex)}}const ql=/\/emsg[-/]ID3/i;class Xl{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,n,i){const s=this.videoTrack=bi("video",1),r=this.audioTrack=bi("audio",1),o=this.txtTrack=bi("text",1);if(this.id3Track=bi("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=Te(e);if(c.video){const{id:u,timescale:h,codec:f,supplemental:d}=c.video;s.id=u,s.timescale=o.timescale=h,s.codec=f,s.supplemental=d}if(c.audio){const{id:u,timescale:h,codec:f}=c.audio;r.id=u,r.timescale=h,r.codec=f}o.id=be.text,s.sampleDuration=0,s.duration=r.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return ue(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=We(this.remainderData,e));const o=Ye(n);this.remainderData=o.remainder,i.samples=o.valid||new Uint8Array}else i.samples=n;const r=this.extractID3Track(i,t);return s.samples=ht(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:r,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=ht(e,t),{videoTrack:t,audioTrack:bi(),id3Track:i,textTrack:bi()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=Y(e.samples,["emsg"]);i&&i.forEach(s=>{const r=Xe(s);if(ql.test(r.schemeIdUri)){const o=Ga(r,t);let c=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=r.payload;n.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Jn.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=Ga(r,t);n.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Jn.misbklv,duration:Number.POSITIVE_INFINITY})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function Ga(a,e){return T(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Ql{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new $i(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,vn.cbc)}decryptAacSample(e,t,n){const i=e[t].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),r=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(r).then(o=>{const c=new Uint8Array(o);i.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)}).catch(n)}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)n.set(e.subarray(s,s+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(n.subarray(i,i+16),s);return e}decryptAvcSample(e,t,n,i,s){const r=at(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,n+1,i)}).catch(i)}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){i();return}const s=e[t].units;for(;!(n>=s.length);n++){const r=s[n];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,n,i,r),!this.decrypter.isSync()))return}}}}class Ka{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const s=n.units;i=s[s.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,i=n.length;if(i){const s=n[i-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){const i=t.byteLength;let s=e.naluState||0;const r=s,o=[];let c=0,u,h,f,d=-1,v=0;for(s===-1&&(d=0,v=this.getNALuType(t,0),s=0,c=1);c<i;){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,d>=0){const E={data:t.subarray(d,h),type:v};o.push(E)}else{const E=this.getLastNalUnit(e.samples);E&&(r&&c<=4-r&&E.state&&(E.data=E.data.subarray(0,E.data.byteLength-r)),h>0&&(E.data=We(E.data,t.subarray(0,h)),E.state=0))}c<i?(f=this.getNALuType(t,c),d=c,v=f,s=0):s=-1}else s=0}if(d>=0&&s>=0){const E={data:t.subarray(d,i),type:v,state:s};o.push(E)}if(o.length===0){const E=this.getLastNalUnit(e.samples);E&&(E.data=We(E.data,t))}return e.naluState=s,o}}class Os{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,n=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");i.set(e.subarray(n,n+s)),this.word=new DataView(i.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 n=this.word>>>32-t;if(e>32&&ee.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?n<<t|this.readBits(t):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Jl extends Ka{parsePES(e,t,n,i){const s=this.parseNALu(e,n.data,i);let r=this.VideoSample,o,c=!1;n.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.forEach(u=>{var h,f;switch(u.type){case 1:{let D=!1;o=!0;const S=u.data;if(c&&S.length>4){const B=this.readSliceType(S);(B===2||B===4||B===7||B===9)&&(D=!0)}if(D){var d;(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,n.pts,n.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,n.pts,n.dts)),r.key=!0,r.frame=!0;break;case 6:{o=!0,ve(u.data,1,n.pts,t.samples);break}case 7:{var v,E;o=!0,c=!0;const D=u.data,S=this.readSPS(D);if(!e.sps||e.width!==S.width||e.height!==S.height||((v=e.pixelRatio)==null?void 0:v[0])!==S.pixelRatio[0]||((E=e.pixelRatio)==null?void 0:E[1])!==S.pixelRatio[1]){e.width=S.width,e.height=S.height,e.pixelRatio=S.pixelRatio,e.sps=[D];const B=D.subarray(1,4);let ne="avc1.";for(let J=0;J<3;J++){let me=B[J].toString(16);me.length<2&&(me="0"+me),ne+=me}e.codec=ne}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,n.pts,n.dts));break;case 12:o=!0;break;default:o=!1;break}r&&o&&r.units.push(u)}),i&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Os(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,i=8,s;for(let r=0;r<e;r++)i!==0&&(s=t.readEG(),i=(n+s+256)%256),n=i===0?n:i}readSPS(e){const t=new Os(e);let n=0,i=0,s=0,r=0,o,c,u;const h=t.readUByte.bind(t),f=t.readBits.bind(t),d=t.readUEG.bind(t),v=t.readBoolean.bind(t),E=t.skipBits.bind(t),D=t.skipEG.bind(t),S=t.skipUEG.bind(t),B=this.skipScalingList.bind(this);h();const ne=h();if(f(5),E(3),h(),S(),ne===100||ne===110||ne===122||ne===244||ne===44||ne===83||ne===86||ne===118||ne===128){const Ne=d();if(Ne===3&&E(1),S(),S(),E(1),v())for(c=Ne!==3?8:12,u=0;u<c;u++)v()&&(u<6?B(16,t):B(64,t))}S();const J=d();if(J===0)d();else if(J===1)for(E(1),D(),D(),o=d(),u=0;u<o;u++)D();S(),E(1);const me=d(),Le=d(),ze=f(1);ze===0&&E(1),E(1),v()&&(n=d(),i=d(),s=d(),r=d());let De=[1,1];if(v()&&v())switch(h()){case 1:De=[1,1];break;case 2:De=[12,11];break;case 3:De=[10,11];break;case 4:De=[16,11];break;case 5:De=[40,33];break;case 6:De=[24,11];break;case 7:De=[20,11];break;case 8:De=[32,11];break;case 9:De=[80,33];break;case 10:De=[18,11];break;case 11:De=[15,11];break;case 12:De=[64,33];break;case 13:De=[160,99];break;case 14:De=[4,3];break;case 15:De=[3,2];break;case 16:De=[2,1];break;case 255:{De=[h()<<8|h(),h()<<8|h()];break}}return{width:Math.ceil((me+1)*16-n*2-i*2),height:(2-ze)*(Le+1)*16-(ze?2:4)*(s+r),pixelRatio:De}}}class eu extends Ka{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,i){const s=this.parseNALu(e,n.data,i);let r=this.VideoSample,o,c=!1;n.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,n.pts,n.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,n.pts,n.dts)),r.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var d;(d=r)!=null&&d.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,n.pts,n.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,n.pts,n.dts)),r.key=!0,r.frame=!0;break;case 39:o=!0,ve(u.data,2,n.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=g(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 v=this.readSPS(u.data);e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.codec=v.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const E in v.params)e.params[E]=v.params[E]}this.pushParameterSet(e.sps,u.data,e.vps),r||(r=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),r.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const v=this.readPPS(u.data);for(const E in v)e.params[E]=v[E]}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,n.pts,n.dts));break;default:o=!1;break}r&&o&&r.units.push(u)}),i&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let n=0;for(let i=0;i<e.byteLength;i++)i>=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(t[n]=e[i],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Os(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const n=t.readBits(3),i=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:i}}readSPS(e){const t=new Os(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const n=t.readBits(3);t.readBoolean();const i=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(),d=t.readUByte(),v=t.readUByte(),E=t.readUByte(),D=t.readUByte(),S=t.readUByte(),B=t.readUByte(),ne=[],J=[];for(let sn=0;sn<n;sn++)ne.push(t.readBoolean()),J.push(t.readBoolean());if(n>0)for(let sn=n;sn<8;sn++)t.readBits(2);for(let sn=0;sn<n;sn++)ne[sn]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),J[sn]&&t.readUByte();t.readUEG();const me=t.readUEG();me==3&&t.skipBits(1);const Le=t.readUEG(),ze=t.readUEG(),De=t.readBoolean();let Ne=0,Me=0,Re=0,Qe=0;De&&(Ne+=t.readUEG(),Me+=t.readUEG(),Re+=t.readUEG(),Qe+=t.readUEG());const yt=t.readUEG(),At=t.readUEG(),Ct=t.readUEG(),wt=t.readBoolean();for(let sn=wt?0:n;sn<=n;sn++)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 $n=0;$n<4;$n++)for(let ai=0;ai<($n===3?2:6);ai++)if(!t.readBoolean())t.readUEG();else{const pi=Math.min(64,1<<4+($n<<1));$n>1&&t.readEG();for(let Ts=0;Ts<pi;Ts++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const xt=t.readUEG();let Lt=0;for(let sn=0;sn<xt;sn++){let $n=!1;if(sn!==0&&($n=t.readBoolean()),$n){sn===xt&&t.readUEG(),t.readBoolean(),t.readUEG();let ai=0;for(let as=0;as<=Lt;as++){const pi=t.readBoolean();let Ts=!1;pi||(Ts=t.readBoolean()),(pi||Ts)&&ai++}Lt=ai}else{const ai=t.readUEG(),as=t.readUEG();Lt=ai+as;for(let pi=0;pi<ai;pi++)t.readUEG(),t.readBoolean();for(let pi=0;pi<as;pi++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const sn=t.readUEG();for(let $n=0;$n<sn;$n++){for(let ai=0;ai<Ct+4;ai++)t.readBits(1);t.readBits(1)}}let _t=0,vt=1,Yt=1,an=!0,Xt=1,Jt=0;t.readBoolean(),t.readBoolean();let Un=!1;if(t.readBoolean()){if(t.readBoolean()){const os=t.readUByte(),Zo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],lr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];os>0&&os<16?(vt=Zo[os-1],Yt=lr[os-1]):os===255&&(vt=t.readBits(16),Yt=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(),Un=t.readBoolean(),Un&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Xt=t.readBits(32),Jt=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const lr=t.readBoolean(),qo=t.readBoolean();let $s=!1;(lr||qo)&&($s=t.readBoolean(),$s&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),$s&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Xo=0;Xo<=n;Xo++){an=t.readBoolean();const Ph=an||t.readBoolean();let Qo=!1;Ph?t.readEG():Qo=t.readBoolean();const Jo=Qo?1:t.readUEG()+1;if(lr)for(let Gs=0;Gs<Jo;Gs++)t.readUEG(),t.readUEG(),$s&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(qo)for(let Gs=0;Gs<Jo;Gs++)t.readUEG(),t.readUEG(),$s&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),_t=t.readUEG())}let ri=Le,Ai=ze;if(De){let sn=1,$n=1;me===1?sn=$n=2:me==2&&(sn=2),ri=Le-sn*Me-sn*Ne,Ai=ze-$n*Qe-$n*Re}const rs=i?["A","B","C"][i]:"",kh=o<<24|c<<16|u<<8|h;let ea=0;for(let sn=0;sn<32;sn++)ea=(ea|(kh>>sn&1)<<31-sn)>>>0;let ta=ea.toString(16);return r===1&&ta==="2"&&(ta="6"),{codecString:`hvc1.${rs}${r}.${ta}.${s?"H":"L"}${B}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:i,general_profile_compatibility_flags:[o,c,u,h],general_constraint_indicator_flags:[f,d,v,E,D,S],general_level_idc:B,bit_depth:yt+8,bit_depth_luma_minus8:yt,bit_depth_chroma_minus8:At,min_spatial_segmentation_idc:_t,chroma_format_idc:me,frame_rate:{fixed:an,fps:Jt/Xt}},width:ri,height:Ai,pixelRatio:[vt,Yt]}}readPPS(e){const t=new Os(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const i=t.readBoolean(),s=t.readBoolean();let r=1;return s&&i?r=0:s?r=3:i&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Cn=188;class Hi{constructor(e,t,n,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=i,this.videoParser=null}static probe(e,t){const n=Hi.syncOffset(e);return n>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),n!==-1}static syncOffset(e){const t=e.length;let n=Math.min(Cn*5,t-Cn)+1,i=0;for(;i<n;){let s=!1,r=-1,o=0;for(let c=i;c<t;c+=Cn)if(e[c]===71&&(t-c===Cn||e[c+Cn]===71)){if(o++,r===-1&&(r=c,r!==0&&(n=Math.min(r+Cn*99,e.length-Cn)+1)),s||(s=xr(e,c)===0),s&&o>1&&(r===0&&o>2||c+Cn>n))return r}else{if(o)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:be[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Hi.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=Hi.createTrack("audio",i),this._id3Track=Hi.createTrack("id3"),this._txtTrack=Hi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){n||(this.sampleAes=null);let s;const r=this._videoTrack,o=this._audioTrack,c=this._id3Track,u=this._txtTrack;let h=r.pid,f=r.pesData,d=o.pid,v=c.pid,E=o.pesData,D=c.pesData,S=null,B=this.pmtParsed,ne=this._pmtId,J=e.length;if(this.remainderData&&(e=We(this.remainderData,e),J=e.length,this.remainderData=null),J<Cn&&!i)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const me=Math.max(0,Hi.syncOffset(e));J-=(J-me)%Cn,J<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,J,e.buffer.byteLength-J));let Le=0;for(let De=me;De<J;De+=Cn)if(e[De]===71){const Ne=!!(e[De+1]&64),Me=xr(e,De),Re=(e[De+3]&48)>>4;let Qe;if(Re>1){if(Qe=De+5+e[De+4],Qe===De+Cn)continue}else Qe=De+4;switch(Me){case h:Ne&&(f&&(s=_s(f,this.logger))&&(this.readyVideoParser(r.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(r,u,s,!1)),f={data:[],size:0}),f&&(f.data.push(e.subarray(Qe,De+Cn)),f.size+=De+Cn-Qe);break;case d:if(Ne){if(E&&(s=_s(E,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}E={data:[],size:0}}E&&(E.data.push(e.subarray(Qe,De+Cn)),E.size+=De+Cn-Qe);break;case v:Ne&&(D&&(s=_s(D,this.logger))&&this.parseID3PES(c,s),D={data:[],size:0}),D&&(D.data.push(e.subarray(Qe,De+Cn)),D.size+=De+Cn-Qe);break;case 0:Ne&&(Qe+=e[Qe]+1),ne=this._pmtId=tu(e,Qe);break;case ne:{Ne&&(Qe+=e[Qe]+1);const yt=nu(e,Qe,this.typeSupported,n,this.observer,this.logger);h=yt.videoPid,h>0&&(r.pid=h,r.segmentCodec=yt.segmentVideoCodec),d=yt.audioPid,d>0&&(o.pid=d,o.segmentCodec=yt.segmentAudioCodec),v=yt.id3Pid,v>0&&(c.pid=v),S!==null&&!B&&(this.logger.warn(`MPEG-TS PMT found at ${De} after unknown PID '${S}'. Backtracking to sync byte @${me} to parse all TS packets.`),S=null,De=me-188),B=this.pmtParsed=!0;break}case 17:case 8191:break;default:S=Me;break}}else Le++;Le>0&&Tr(this.observer,new Error(`Found ${Le} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=f,o.pesData=E,c.pesData=D;const ze={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return i&&this.extractRemainingSamples(ze),ze}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:n,id3Track:i,textTrack:s}=e,r=n.pesData,o=t.pesData,c=i.pesData;let u;if(r&&(u=_s(r,this.logger))?(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(n,s,u,!0),n.pesData=null)):n.pesData=r,o&&(u=_s(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=_s(c,this.logger))?(this.parseID3PES(i,u),i.pesData=null):i.pesData=c}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),s=this.sampleAes=new Ql(this.observer,this.config,t);return this.decrypt(i,s)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Jl:e==="hevc"&&(this.videoParser=new eu))}decrypt(e,t){return new Promise(n=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{n(e)}):n(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{n(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let n=0;const i=this.aacOverFlow;let s=t.data;if(i){this.aacOverFlow=null;const f=i.missing,d=i.sample.unit.byteLength;if(f===-1)s=We(i.sample.unit,s);else{const v=d-f;i.sample.unit.set(s.subarray(0,f),v),e.samples.push(i.sample),n=i.missing}}let r,o;for(r=n,o=s.length;r<o-1&&!zs(s,r);r++);if(r!==n){let f;const d=r<o-1;if(d?f=`AAC PES did not start with ADTS header,offset:${r}`:f="No ADTS header found in AAC PES",Tr(this.observer,new Error(f),d,this.logger),!d)return}La(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(i){const f=Ca(e.samplerate);c=i.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,h;for(;r<o;)if(h=ka(e,s,r,c,u),r+=h.length,h.missing){this.aacOverFlow=h;break}else for(u++;r<o-1&&!zs(s,r);r++);}parseMPEGPES(e,t){const n=t.data,i=n.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<i;)if(Ma(n,r)){const c=Oa(e,n,r,o,s);if(c)r+=c.length,s++;else break}else r++}parseAC3PES(e,t){{const n=t.data,i=t.pts;if(i===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=n.length;let r=0,o=0,c;for(;o<s&&(c=$a(e,n,o,i,r++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=g({},t,{type:this._videoTrack?Jn.emsg:Jn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function xr(a,e){return((a[e+1]&31)<<8)+a[e+2]}function tu(a,e){return(a[e+10]&31)<<8|a[e+11]}function nu(a,e,t,n,i,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=xr(a,e),f=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!n){Sr("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(!n){Sr("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(!n){Sr("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 d=e+5,v=f;for(;v>2;){switch(a[d]){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[d+1]+2;d+=D,v-=D}}break;case 194:case 135:return Tr(i,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 Tr(a,e,t,n){n.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:oe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Sr(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function _s(a,e){let t=0,n,i,s,r,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=We(c[0],c[1]),c.splice(1,1);if(n=c[0],(n[0]<<16)+(n[1]<<8)+n[2]===1){if(i=(n[4]<<8)+n[5],i&&i>a.size-6)return null;const h=n[7];h&192&&(r=(n[9]&14)*536870912+(n[10]&255)*4194304+(n[11]&254)*16384+(n[12]&255)*128+(n[13]&254)/2,h&64?(o=(n[14]&14)*536870912+(n[15]&255)*4194304+(n[16]&254)*16384+(n[17]&255)*128+(n[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=n[8];let f=s+9;if(a.size<=f)return null;a.size-=f;const d=new Uint8Array(a.size);for(let v=0,E=c.length;v<E;v++){n=c[v];let D=n.byteLength;if(f)if(f>D){f-=D;continue}else n=n.subarray(f),D-=f,f=0;d.set(n,t),t+=D}return i&&(i-=s+3),{data:d,pts:r,dts:o,len:i}}return null}class iu{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 ji=Math.pow(2,32)-1;class Pe{static init(){Pe.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 Pe.types)Pe.types.hasOwnProperty(e)&&(Pe.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Pe.HDLR_TYPES={video:t,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);Pe.STTS=Pe.STSC=Pe.STCO=s,Pe.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Pe.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Pe.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Pe.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]);Pe.FTYP=Pe.box(Pe.types.ftyp,r,c,r,o),Pe.DINF=Pe.box(Pe.types.dinf,Pe.box(Pe.types.dref,i))}static box(e,...t){let n=8,i=t.length;const s=i;for(;i--;)n+=t[i].byteLength;const r=new Uint8Array(n);for(r[0]=n>>24&255,r[1]=n>>16&255,r[2]=n>>8&255,r[3]=n&255,r.set(e,4),i=0,n=8;i<s;i++)r.set(t[i],n),n+=t[i].byteLength;return r}static hdlr(e){return Pe.box(Pe.types.hdlr,Pe.HDLR_TYPES[e])}static mdat(e){return Pe.box(Pe.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(ji+1)),i=Math.floor(t%(ji+1));return Pe.box(Pe.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return Pe.box(Pe.types.mdia,Pe.mdhd(e.timescale||0,e.duration||0),Pe.hdlr(e.type),Pe.minf(e))}static mfhd(e){return Pe.box(Pe.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"?Pe.box(Pe.types.minf,Pe.box(Pe.types.smhd,Pe.SMHD),Pe.DINF,Pe.stbl(e)):Pe.box(Pe.types.minf,Pe.box(Pe.types.vmhd,Pe.VMHD),Pe.DINF,Pe.stbl(e))}static moof(e,t,n){return Pe.box(Pe.types.moof,Pe.mfhd(e),Pe.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=Pe.trak(e[t]);return Pe.box.apply(null,[Pe.types.moov,Pe.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(Pe.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=Pe.trex(e[t]);return Pe.box.apply(null,[Pe.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(ji+1)),i=Math.floor(t%(ji+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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Pe.box(Pe.types.mvhd,s)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,s;for(i=0;i<t.length;i++)s=t[i].flags,n[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return Pe.box(Pe.types.sdtp,n)}static stbl(e){return Pe.box(Pe.types.stbl,Pe.stsd(e),Pe.box(Pe.types.stts,Pe.STTS),Pe.box(Pe.types.stsc,Pe.STSC),Pe.box(Pe.types.stsz,Pe.STSZ),Pe.box(Pe.types.stco,Pe.STCO))}static avc1(e){let t=[],n=[],i,s,r;for(i=0;i<e.sps.length;i++)s=e.sps[i],r=s.byteLength,t.push(r>>>8&255),t.push(r&255),t=t.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],r=s.byteLength,n.push(r>>>8&255),n.push(r&255),n=n.concat(Array.prototype.slice.call(s));const o=Pe.box(Pe.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),c=e.width,u=e.height,h=e.pixelRatio[0],f=e.pixelRatio[1];return Pe.box(Pe.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,Pe.box(Pe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Pe.box(Pe.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 Pe.box(Pe.types.mp4a,Pe.audioStsd(e),Pe.box(Pe.types.esds,Pe.esds(e)))}static mp3(e){return Pe.box(Pe.types[".mp3"],Pe.audioStsd(e))}static ac3(e){return Pe.box(Pe.types["ac-3"],Pe.audioStsd(e),Pe.box(Pe.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Pe.box(Pe.types.stsd,Pe.STSD,Pe.mp4a(e));if(t==="ac3"&&e.config)return Pe.box(Pe.types.stsd,Pe.STSD,Pe.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Pe.box(Pe.types.stsd,Pe.STSD,Pe.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Pe.box(Pe.types.stsd,Pe.STSD,Pe.avc1(e));if(t==="hevc"&&e.vps)return Pe.box(Pe.types.stsd,Pe.STSD,Pe.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,n=(e.duration||0)*(e.timescale||0),i=e.width||0,s=e.height||0,r=Math.floor(n/(ji+1)),o=Math.floor(n%(ji+1));return Pe.box(Pe.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,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const n=Pe.sdtp(e),i=e.id,s=Math.floor(t/(ji+1)),r=Math.floor(t%(ji+1));return Pe.box(Pe.types.traf,Pe.box(Pe.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),Pe.box(Pe.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])),Pe.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,Pe.box(Pe.types.trak,Pe.tkhd(e),Pe.mdia(e))}static trex(e){const t=e.id;return Pe.box(Pe.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const n=e.samples||[],i=n.length,s=12+16*i,r=new Uint8Array(s);let o,c,u,h,f,d;for(t+=8+s,r.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<i;o++)c=n[o],u=c.duration,h=c.size,f=c.flags,d=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,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*o);return Pe.box(Pe.types.trun,r)}static initSegment(e){Pe.types||Pe.init();const t=Pe.moov(e);return We(Pe.FTYP,t)}static hvc1(e){const t=e.params,n=[e.vps,e.sps,e.pps],i=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),i-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),n.length]);let r=s.length;for(let E=0;E<n.length;E+=1){r+=3;for(let D=0;D<n[E].length;D+=1)r+=2+n[E][D].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=n.length-1;for(let E=0;E<n.length;E+=1){o.set(new Uint8Array([32+E|(E===c?128:0),0,n[E].length]),r),r+=3;for(let D=0;D<n[E].length;D+=1)o.set(new Uint8Array([n[E][D].length>>8,n[E][D].length&255]),r),r+=2,o.set(n[E][D],r),r+=n[E][D].length}const u=Pe.box(Pe.types.hvcC,o),h=e.width,f=e.height,d=e.pixelRatio[0],v=e.pixelRatio[1];return Pe.box(Pe.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,Pe.box(Pe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Pe.box(Pe.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,v>>24,v>>16&255,v>>8&255,v&255])))}}Pe.types=void 0,Pe.HDLR_TYPES=void 0,Pe.STTS=void 0,Pe.STSC=void 0,Pe.STCO=void 0,Pe.STSZ=void 0,Pe.VMHD=void 0,Pe.SMHD=void 0,Pe.STSD=void 0,Pe.FTYP=void 0,Pe.DINF=void 0;const Va=9e4;function Ar(a,e,t=1,n=!1){const i=a*e*t;return n?Math.round(i):i}function su(a,e,t=1,n=!1){return Ar(a,e,1/t,n)}function Ns(a,e=!1){return Ar(a,1e3,1/Va,e)}function ru(a,e=1){return Ar(a,Va,1/e)}const au=10*1e3,ou=1024,lu=1152,uu=1536;let vs=null,wr=null;function za(a,e,t,n){return{duration:e,size:t,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class js extends L{constructor(e,t,n,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,vs===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);vs=r?parseInt(r[1]):0}if(wr===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);wr=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e[0].pts,i=e.reduce((s,r)=>{let o=r.pts,c=o-s;return c<-4294967296&&(t=!0,o=si(o,n),c=o-s),c>0?s:o},n);return t&&this.debug("PTS rollover detected"),i}remux(e,t,n,i,s,r,o,c){let u,h,f,d,v,E,D=s,S=s;const B=e.pid>-1,ne=t.pid>-1,J=t.samples.length,me=e.samples.length>0,Le=o&&J>0||J>1;if((!B||me)&&(!ne||Le)||this.ISGenerated||o){if(this.ISGenerated){var De,Ne,Me,Re;const Ct=this.videoTrackConfig;(Ct&&(t.width!==Ct.width||t.height!==Ct.height||((De=t.pixelRatio)==null?void 0:De[0])!==((Ne=Ct.pixelRatio)==null?void 0:Ne[0])||((Me=t.pixelRatio)==null?void 0:Me[1])!==((Re=Ct.pixelRatio)==null?void 0:Re[1]))||!Ct&&Le||this.nextAudioTs===null&&me)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,r));const Qe=this.isVideoContiguous;let yt=-1,At;if(Le&&(yt=cu(t.samples),!Qe&&this.config.forceKeyFrameOnDiscontinuity))if(E=!0,yt>0){this.warn(`Dropped ${yt} out of ${J} video samples due to a missing keyframe`);const Ct=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(yt),t.dropped+=yt,S+=(t.samples[0].pts-Ct)/t.inputTimeScale,At=S}else yt===-1&&(this.warn(`No keyframe found out of ${J} video samples`),E=!1);if(this.ISGenerated){if(me&&Le){const Ct=this.getVideoStartPts(t.samples),mt=(si(e.samples[0].pts,Ct)-Ct)/t.inputTimeScale;D+=Math.max(0,mt),S+=Math.max(0,-mt)}if(me){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,r)),h=this.remuxAudio(e,D,this.isAudioContiguous,r,ne||Le||c===te.AUDIO?S:void 0),Le){const Ct=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),f=this.generateIS(e,t,s,r)),u=this.remuxVideo(t,S,Qe,Ct)}}else Le&&(u=this.remuxVideo(t,S,Qe,0));u&&(u.firstKeyFrame=yt,u.independent=yt!==-1,u.firstKeyFramePTS=At)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(v=Wa(n,s,this._initPTS,this._initDTS)),i.samples.length&&(d=Ha(i,s,this._initPTS))),{audio:h,video:u,initSegment:f,independent:E,text:d,id3:v}}generateIS(e,t,n,i){const s=e.samples,r=t.samples,o=this.typeSupported,c={},u=this._initPTS;let h=!u||i,f="audio/mp4",d,v,E,D=-1;if(h&&(d=v=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):Pe.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(D=e.id,E=e.inputTimeScale,!u||E!==u.timescale?d=v=s[0].pts-Math.round(E*n):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:Pe.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(D=t.id,E=t.inputTimeScale,!u||E!==u.timescale){const S=this.getVideoStartPts(r),B=Math.round(E*n);v=Math.min(v,si(r[0].dts,S)-B),d=Math.min(d,S-B)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,h?(u&&this.warn(`Timestamps at playlist time: ${i?"":"~"}${n} ${d/E} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${d/E} (${d}/${E}) trackId: ${D}`),this._initPTS={baseTime:d,timescale:E,trackId:D},this._initDTS={baseTime:v,timescale:E,trackId:D}):d=E=void 0,{tracks:c,initPTS:d,timescale:E,trackId:D}}remuxVideo(e,t,n,i){const s=e.inputTimeScale,r=e.samples,o=[],c=r.length,u=this._initPTS,h=u.baseTime*s/u.timescale;let f=this.nextVideoTs,d=8,v=this.videoSampleDuration,E,D,S=Number.POSITIVE_INFINITY,B=Number.NEGATIVE_INFINITY,ne=!1;if(!n||f===null){const _t=h+t*s,vt=r[0].pts-si(r[0].dts,r[0].pts);vs&&f!==null&&Math.abs(_t-vt-(f+h))<15e3?n=!0:f=_t-vt-h}const J=f+h;for(let _t=0;_t<c;_t++){const vt=r[_t];vt.pts=si(vt.pts,J),vt.dts=si(vt.dts,J),vt.dts<r[_t>0?_t-1:_t].dts&&(ne=!0)}ne&&r.sort(function(_t,vt){const Yt=_t.dts-vt.dts,an=_t.pts-vt.pts;return Yt||an}),E=r[0].dts,D=r[r.length-1].dts;const me=D-E,Le=me?Math.round(me/(c-1)):v||e.inputTimeScale/30;if(n){const _t=E-J,vt=_t>Le,Yt=_t<-1;if((vt||Yt)&&(vt?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Ns(_t,!0)} ms (${_t}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Ns(-_t,!0)} ms (${_t}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Yt||J>=r[0].pts||vs)){E=J;const an=r[0].pts-_t;if(vt)r[0].dts=E,r[0].pts=an;else{let Xt=!0;for(let Jt=0;Jt<r.length&&!(r[Jt].dts>an&&Xt);Jt++){const Un=r[Jt].pts;if(r[Jt].dts-=_t,r[Jt].pts-=_t,Jt<r.length-1){const Fn=r[Jt+1].pts,ri=r[Jt].pts,Ai=Fn<=ri,rs=Fn<=Un;Xt=Ai==rs}}}this.log(`Video: Initial PTS/DTS adjusted: ${Ns(an,!0)}/${Ns(E,!0)}, delta: ${Ns(_t,!0)} ms`)}}E=Math.max(0,E);let ze=0,De=0,Ne=E;for(let _t=0;_t<c;_t++){const vt=r[_t],Yt=vt.units,an=Yt.length;let Xt=0;for(let Jt=0;Jt<an;Jt++)Xt+=Yt[Jt].data.length;De+=Xt,ze+=an,vt.length=Xt,vt.dts<Ne?(vt.dts=Ne,Ne+=Le/4|0||1):Ne=vt.dts,S=Math.min(vt.pts,S),B=Math.max(vt.pts,B)}D=r[c-1].dts;const Me=De+4*ze+8;let Re;try{Re=new Uint8Array(Me)}catch(_t){this.observer.emit(p.ERROR,p.ERROR,{type:oe.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:_t,bytes:Me,reason:`fail allocating video mdat ${Me}`});return}const Qe=new DataView(Re.buffer);Qe.setUint32(0,Me),Re.set(Pe.types.mdat,4);let yt=!1,At=Number.POSITIVE_INFINITY,Ct=Number.POSITIVE_INFINITY,wt=Number.NEGATIVE_INFINITY,mt=Number.NEGATIVE_INFINITY;for(let _t=0;_t<c;_t++){const vt=r[_t],Yt=vt.units;let an=0;for(let Un=0,Fn=Yt.length;Un<Fn;Un++){const ri=Yt[Un],Ai=ri.data,rs=ri.data.byteLength;Qe.setUint32(d,rs),d+=4,Re.set(Ai,d),d+=rs,an+=4+rs}let Xt;if(_t<c-1)v=r[_t+1].dts-vt.dts,Xt=r[_t+1].pts-vt.pts;else{const Un=this.config,Fn=_t>0?vt.dts-r[_t-1].dts:Le;if(Xt=_t>0?vt.pts-r[_t-1].pts:Le,Un.stretchShortVideoTrack&&this.nextAudioTs!==null){const ri=Math.floor(Un.maxBufferHole*s),Ai=(i?S+i*s:this.nextAudioTs+h)-vt.pts;Ai>ri?(v=Ai-Fn,v<0?v=Fn:yt=!0,this.log(`It is approximately ${Ai/90} ms to the next segment; using duration ${v/90} ms for the last video frame.`)):v=Fn}else v=Fn}const Jt=Math.round(vt.pts-vt.dts);At=Math.min(At,v),wt=Math.max(wt,v),Ct=Math.min(Ct,Xt),mt=Math.max(mt,Xt),o.push(za(vt.key,v,an,Jt))}if(o.length){if(vs){if(vs<70){const _t=o[0].flags;_t.dependsOn=2,_t.isNonSync=0}}else if(wr&&mt-Ct<wt-At&&Le/wt<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let _t=E;for(let vt=0,Yt=o.length;vt<Yt;vt++){const an=_t+o[vt].duration,Xt=_t+o[vt].cts;if(vt<Yt-1){const Jt=an+o[vt+1].cts;o[vt].duration=Jt-Xt}else o[vt].duration=vt?o[vt-1].duration:Le;o[vt].cts=0,_t=an}}}v=yt||!v?Le:v;const It=D+v;this.nextVideoTs=f=It-h,this.videoSampleDuration=v,this.isVideoContiguous=!0;const Kt={data1:Pe.moof(e.sequenceNumber++,E,g(e,{samples:o})),data2:Re,startPTS:(S-h)/s,endPTS:(B+v-h)/s,startDTS:(E-h)/s,endDTS:f/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Kt}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return lu;case"ac3":return uu;default:return ou}}remuxAudio(e,t,n,i,s){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,c=r/o,u=this.getSamplesPerFrame(e),h=u*c,f=this._initPTS,d=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,v=[],E=s!==void 0;let D=e.samples,S=d?0:8,B=this.nextAudioTs||-1;const ne=f.baseTime*r/f.timescale,J=ne+t*r;if(this.isAudioContiguous=n=n||D.length&&B>0&&(i&&Math.abs(J-(B+ne))<9e3||Math.abs(si(D[0].pts,J)-(B+ne))<20*h),D.forEach(function(mt){mt.pts=si(mt.pts,J)}),!n||B<0){if(D=D.filter(mt=>mt.pts>=0),!D.length)return;s===0?B=0:i&&!E?B=Math.max(0,J-ne):B=D[0].pts-ne}if(e.segmentCodec==="aac"){const mt=this.config.maxAudioFramesDrift;for(let It=0,xt=B+ne;It<D.length;It++){const Lt=D[It],Kt=Lt.pts,_t=Kt-xt,vt=Math.abs(1e3*_t/r);if(_t<=-mt*h&&E)It===0&&(this.warn(`Audio frame @ ${(Kt/r).toFixed(3)}s overlaps marker by ${Math.round(1e3*_t/r)} ms.`),this.nextAudioTs=B=Kt-ne,xt=Kt);else if(_t>=mt*h&&vt<au&&E){let Yt=Math.round(_t/h);for(xt=Kt-Yt*h;xt<0&&Yt&&h;)Yt--,xt+=h;It===0&&(this.nextAudioTs=B=xt-ne),this.warn(`Injecting ${Yt} audio frames @ ${((xt-ne)/r).toFixed(3)}s due to ${Math.round(1e3*_t/r)} ms gap.`);for(let an=0;an<Yt;an++){let Xt=iu.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Xt||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Xt=Lt.unit.subarray()),D.splice(It,0,{unit:Xt,pts:xt}),xt+=h,It++}}Lt.pts=xt,xt+=h}}let me=null,Le=null,ze,De=0,Ne=D.length;for(;Ne--;)De+=D[Ne].unit.byteLength;for(let mt=0,It=D.length;mt<It;mt++){const xt=D[mt],Lt=xt.unit;let Kt=xt.pts;if(Le!==null){const vt=v[mt-1];vt.duration=Math.round((Kt-Le)/c)}else if(n&&e.segmentCodec==="aac"&&(Kt=B+ne),me=Kt,De>0){De+=S;try{ze=new Uint8Array(De)}catch(vt){this.observer.emit(p.ERROR,p.ERROR,{type:oe.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:vt,bytes:De,reason:`fail allocating audio mdat ${De}`});return}d||(new DataView(ze.buffer).setUint32(0,De),ze.set(Pe.types.mdat,4))}else return;ze.set(Lt,S);const _t=Lt.byteLength;S+=_t,v.push(za(!0,u,_t,0)),Le=Kt}const Me=v.length;if(!Me)return;const Re=v[v.length-1];B=Le-ne,this.nextAudioTs=B+c*Re.duration;const Qe=d?new Uint8Array(0):Pe.moof(e.sequenceNumber++,me/c,g({},e,{samples:v}));e.samples=[];const yt=(me-ne)/r,At=B/r,wt={data1:Qe,data2:ze,startPTS:yt,endPTS:At,startDTS:yt,endDTS:At,type:"audio",hasAudio:!0,hasVideo:!1,nb:Me};return this.isAudioContiguous=!0,wt}}function si(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 cu(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function Wa(a,e,t,n){const i=a.samples.length;if(!i)return;const s=a.inputTimeScale;for(let o=0;o<i;o++){const c=a.samples[o];c.pts=si(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=si(c.dts-n.baseTime*s/n.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function Ha(a,e,t){const n=a.samples.length;if(!n)return;const i=a.inputTimeScale;for(let r=0;r<n;r++){const o=a.samples[r];o.pts=si(o.pts-t.baseTime*i/t.timescale,e*i)/i}a.samples.sort((r,o)=>r.pts-o.pts);const s=a.samples;return a.samples=[],{samples:s}}class hu extends L{constructor(e,t,n,i){super("passthrough-remuxer",i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e,i),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:n,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:s,video:r}=this.initData=Te(e);if(t)Ve(e,t);else{const c=s||r;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}s&&(n=ja(s,I.AUDIO,this)),r&&(i=ja(r,I.VIDEO,this));const o={};s&&r?o.audiovideo={container:"video/mp4",codec:n+","+i,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:s?o.audio={container:"audio/mp4",codec:n,encrypted:s.encrypted,initSegment:e,id:"audio"}:r?o.video={container:"video/mp4",codec:i,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,n,i,s,r){var o,c;let{initPTS:u,lastEndTime:h}=this;const f={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};T(h)||(h=this.lastEndTime=s||0);const d=t.samples;if(!d.length)return f;const v={initPTS:void 0,timescale:void 0,trackId:void 0};let E=this.initData;if((o=E)!=null&&o.length||(this.generateInitSegment(d),E=this.initData),!((c=E)!=null&&c.length))return this.warn("Failed to generate initSegment."),f;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1);const D=He(d,E,this),S=E.audio?D[E.audio.id]:null,B=E.video?D[E.video.id]:null,ne=Ys(B,1/0),J=Ys(S,1/0),me=Ys(B,0,!0),Le=Ys(S,0,!0);let ze=s,De=0;const Ne=S&&(!B||!u&&J<ne||u&&u.trackId===E.audio.id),Me=Ne?S:B;if(Me){const xt=Me.timescale,Lt=Me.start-s*xt,Kt=Ne?E.audio.id:E.video.id;ze=Me.start/xt,De=Ne?Le-J:me-ne,(r||!u)&&(fu(u,ze,s,De)||xt!==u.timescale)&&(u&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${Lt/xt} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${ze-s} (${Lt}/${xt}) trackId: ${Kt}`),u=null,v.initPTS=Lt,v.timescale=xt,v.trackId=Kt)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);u?(v.initPTS=u.baseTime,v.timescale=u.timescale,v.trackId=u.trackId):((!v.timescale||v.trackId===void 0||v.initPTS===void 0)&&(this.warn("Could not set initPTS"),v.initPTS=ze,v.timescale=1,v.trackId=-1),this.initPTS=u={baseTime:v.initPTS,timescale:v.timescale,trackId:v.trackId});const Re=ze-u.baseTime/u.timescale,Qe=Re+De;De>0?this.lastEndTime=Qe:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const yt=!!E.audio,At=!!E.video;let Ct="";yt&&(Ct+="audio"),At&&(Ct+="video");const wt=(E.audio?E.audio.encrypted:!1)||(E.video?E.video.encrypted:!1),mt={data1:d,startPTS:Re,startDTS:Re,endPTS:Qe,endDTS:Qe,type:Ct,hasAudio:yt,hasVideo:At,nb:1,dropped:0,encrypted:wt};f.audio=yt&&!At?mt:void 0,f.video=At?mt:void 0;const It=B==null?void 0:B.sampleCount;if(It){const xt=B.keyFrameIndex,Lt=xt!==-1;mt.nb=It,mt.dropped=xt===0||this.isVideoContiguous?0:Lt?xt:It,mt.independent=Lt,mt.firstKeyFrame=xt,Lt&&B.keyFrameStart&&(mt.firstKeyFramePTS=(B.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(f.independent=Lt),this.isVideoContiguous||(this.isVideoContiguous=Lt),mt.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${xt}/${It} dropped: ${mt.dropped} start: ${mt.firstKeyFramePTS||"NA"}`)}return f.initSegment=v,f.id3=Wa(n,s,u,u),i.samples.length&&(f.text=Ha(i,s,u)),f}}function Ys(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function fu(a,e,t,n){if(a===null)return!0;const i=Math.max(n,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>i}function ja(a,e,t){const n=a.codec;return n&&n.length>4?n:e===I.AUDIO?n==="ec-3"||n==="ac-3"||n==="alac"?n:n==="fLaC"||n==="Opus"?Q(n,!1):(t.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"):(t.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1")}let Ni;try{Ni=self.performance.now.bind(self.performance)}catch(a){Ni=Date.now}const Zs=[{demux:Xl,remux:hu},{demux:Hi,remux:js},{demux:jl,remux:js},{demux:Zl,remux:js}];Zs.splice(2,0,{demux:Yl,remux:js});class Ya{constructor(e,t,n,i,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=n,this.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const s=n.transmuxing;s.executeStart=Ni();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;i&&(this.currentTransmuxState=i);const{contiguous:u,discontinuity:h,trackSwitch:f,accurateTimeOffset:d,timeOffset:v,initSegmentChange:E}=i||o,{audioCodec:D,videoCodec:S,defaultInitPts:B,duration:ne,initSegmentData:J}=c,me=du(r,t);if(me&&_i(me.method)){const Ne=this.getDecrypter(),Me=Bn(me.method);if(Ne.isSync()){let Re=Ne.softwareDecrypt(r,me.key.buffer,me.iv.buffer,Me);if(n.part>-1){const yt=Ne.flush();Re=yt&&yt.buffer}if(!Re)return s.executeEnd=Ni(),Dr(n);r=new Uint8Array(Re)}else return this.asyncResult=!0,this.decryptionPromise=Ne.webCryptoDecrypt(r,me.key.buffer,me.iv.buffer,Me).then(Re=>{const Qe=this.push(Re,null,n);return this.decryptionPromise=null,Qe}),this.decryptionPromise}const Le=this.needsProbing(h,f);if(Le){const Ne=this.configureTransmuxer(r);if(Ne)return this.logger.warn(`[transmuxer] ${Ne.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:oe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:Ne,reason:Ne.message}),s.executeEnd=Ni(),Dr(n)}(h||f||E||Le)&&this.resetInitSegment(J,D,S,ne,t),(h||E||Le)&&this.resetInitialTimestamp(B),u||this.resetContiguity();const ze=this.transmux(r,me,v,d,n);this.asyncResult=Ms(ze);const De=this.currentTransmuxState;return De.contiguous=!0,De.discontinuity=!1,De.trackSwitch=!1,s.executeEnd=Ni(),ze}flush(e){const t=e.transmuxing;t.executeStart=Ni();const{decrypter:n,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const r=[],{timeOffset:o}=i;if(n){const f=n.flush();f&&r.push(this.push(f.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=Ni();const f=[Dr(e)];return this.asyncResult?Promise.resolve(f):f}const h=c.flush(o);return Ms(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,n){const{audioTrack:i,videoTrack:s,id3Track:r,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===te.MAIN?"level":"track"} ${n.level}`);const h=this.remuxer.remux(i,s,r,o,u,c,!0,this.id);e.push({remuxResult:h,chunkMeta:n}),n.transmuxing.executeEnd=Ni()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,s){const{demuxer:r,remuxer:o}=this;!r||!o||(r.resetInitSegment(e,t,n,i),o.resetInitSegment(e,t,n,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,s){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,n,i,s):r=this.transmuxUnencrypted(e,n,i,s),r}transmuxUnencrypted(e,t,n,i){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,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,s){return this.demuxer.demuxSampleAes(e,t,n).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,n,i,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i}=this;let s;for(let f=0,d=Zs.length;f<d;f++){var r;if((r=Zs[f].demux)!=null&&r.probe(e,this.logger)){s=Zs[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(n,t,i,this.logger)),(!o||!(o instanceof h))&&(this.demuxer=new h(n,t,i,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 $i(this.config)),e}}function du(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 Dr=a=>({remuxResult:{},chunkMeta:a});function Ms(a){return"then"in a&&a.then instanceof Function}class pu{constructor(e,t,n,i,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=n,this.duration=i,this.defaultInitPts=s||null}}class gu{constructor(e,t,n,i,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=n,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=r}}let Za=0;class qa{constructor(e,t,n,i){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 d=(f=this.workerContext)==null?void 0:f.objectURL;d&&self.URL.revokeObjectURL(d);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(p.ERROR,{type:oe.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const r=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===p.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new gr,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=gt(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||yl()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=bl(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=El());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:Pt(s)})}catch(h){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new Ya(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new Ya(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,n=gt(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,config:Pt(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),xl(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,n,i,s,r,o,c,u,h){var f,d;u.transmuxing.start=self.performance.now();const{instanceNo:v,transmuxer:E}=this,D=r?r.start:s.start,S=s.decryptdata,B=this.frag,ne=!(B&&s.cc===B.cc),J=!(B&&u.level===B.level),me=B?u.sn-B.sn:-1,Le=this.part?u.part-this.part.index:-1,ze=me===0&&u.id>1&&u.id===(B==null?void 0:B.stats.chunkCount),De=!J&&(me===1||me===0&&(Le===1||ze&&Le<=0)),Ne=self.performance.now();(J||me||s.stats.parsing.start===0)&&(s.stats.parsing.start=Ne),r&&(Le||!De)&&(r.stats.parsing.start=Ne);const Me=!(B&&((f=s.initSegment)==null?void 0:f.url)===((d=B.initSegment)==null?void 0:d.url)),Re=new gu(ne,De,c,J,D,Me);if(!De||ne||Me){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===te.MAIN?"level":"track"}: ${u.level} id: ${u.id}
discontinuity: ${ne}
trackSwitch: ${J}
contiguous: ${De}
accurateTimeOffset: ${c}
timeOffset: ${D}
initSegmentChange: ${Me}`);const Qe=new pu(n,i,t,o,h);this.configureTransmuxer(Qe)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:v,cmd:"demux",data:e,decryptdata:S,chunkMeta:u,state:Re},e instanceof ArrayBuffer?[e]:[]);else if(E){const Qe=E.push(e,S,u,Re);Ms(Qe)?Qe.then(yt=>{this.handleTransmuxComplete(yt)}).catch(yt=>{this.transmuxerError(yt,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(Qe)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(n){const i=n.flush(e);Ms(i)?i.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(i,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Xa=100;class mu extends dr{constructor(e,t,n){super(e,t,n,"audio-stream-controller",te.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(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s,trackId:r}){if(n===te.MAIN){const o=t.cc,c=this.fragCurrent;if(this.initPTS[o]={baseTime:i,timescale:s,trackId:r},this.log(`InitPTS for cc: ${o} found from main: ${i/s} (${i}/${s}) trackId: ${r}`),this.mainAnchor=t,this.state===Je.WAITING_INIT_PTS){const u=this.waitingData;(!u&&!this.loadingParts||u&&u.frag.cc!==o)&&this.syncWithAnchor(t,u==null?void 0:u.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==o?(c.abortRequests(),this.syncWithAnchor(t,c)):this.state===Je.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var n;const i=((n=this.mainFragLoading)==null?void 0:n.frag)||null;if(t&&(i==null?void 0:i.cc)===t.cc)return;const s=(i||e).cc,r=this.getLevelDetails(),o=this.getLoadPosition(),c=Yn(r,s,o);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===Je.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=Je.STOPPED;return}const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(Xa),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=Je.IDLE):this.state=Je.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Je.IDLE:this.doTickIdle();break;case Je.WAITING_TRACK:{const{levels:e,trackId:t}=this,n=e==null?void 0:e[t],i=n==null?void 0:n.details;if(i&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(i))break;this.state=Je.WAITING_INIT_PTS}break}case Je.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Je.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:n,cache:i,complete:s}=e,r=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=Je.FRAG_LOADING;const o=i.flush().buffer,c={frag:t,part:n,payload:o,networkDetails:null};this._handleFragmentLoadProgress(c),s&&super._handleFragmentLoadComplete(c)}else r&&r.cc!==e.frag.cc&&this.syncWithAnchor(r,e.frag)}else this.state=Je.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:n,media:i,trackId:s}=this,r=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||!(n!=null&&n[s]))return;const o=n[s],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=Je.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,I.AUDIO,te.AUDIO));const h=this.getFwdBufferInfo(u,te.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=Je.ENDED;return}const f=h.len,d=t.maxBufferLength,v=c.fragments,E=v[0].start,D=this.getLoadPosition(),S=this.flushing?D:h.end;if(this.switchingTrack&&i){const J=D;c.PTSKnown&&J<E&&(h.end>E||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=E+.05)}if(f>=d&&!this.switchingTrack&&S<v[v.length-1].start)return;let B=this.getNextFragment(S,c);if(B&&this.isLoopLoading(B,S)&&(B=this.getNextFragmentLoopLoading(B,c,h,te.MAIN,d)),!B){this.bufferFlushed=!0;return}let ne=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ne&&Ee(B)&&!B.endList&&(!c.live||!this.loadingParts&&S<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ne)===un.OK&&(this.mainFragLoading=ne=null),ne&&Ee(ne))){if(B.start>ne.end){const me=this.fragmentTracker.getFragAtPos(S,te.MAIN);me&&me.end>ne.end&&(ne=me,this.mainFragLoading={frag:me,targetBufferTime:null})}if(B.start>ne.end)return}this.loadFragment(B,o,S)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(n=>new En(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==Je.STOPPED&&(this.setInterval(Xa),this.state=Je.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(p.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;const{levels:i}=this,{details:s,id:r,groupId:o,track:c}=t;if(!i){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!==Je.STOPPED&&(this.state=Je.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=i[r];let f=0;if(s.live||(n=h.details)!=null&&n.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(h.details){var d;f=this.alignPlaylists(s,h.details,(d=this.levelLastLoaded)==null?void 0:d.details)}s.alignedSliding||(Ta(s,u),s.alignedSliding||Ks(s,u),f=s.fragmentStart)}h.details=s,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(u,f),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===Je.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=Je.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,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 ${n.sn} of level ${n.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(n.start);return}const f=r.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let d=this.transmuxer;d||(d=this.transmuxer=new qa(this.hls,te.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const v=this.initPTS[n.cc],E=(t=n.initSegment)==null?void 0:t.data;if(v!==void 0){const S=i?i.index:-1,B=S!==-1,ne=new Wn(n.level,n.sn,n.stats.chunkCount,s.byteLength,S,B);d.push(s,E,f,"",n,i,h.totalduration,!1,ne,v)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:D}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new Aa,complete:!1};D.push(new Uint8Array(s)),this.state!==Je.STOPPED&&(this.state=Je.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===te.MAIN&&Ee(t.frag)&&(this.mainFragLoading=t,this.state===Je.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n.type!==te.AUDIO){!this.audioOnly&&n.type===te.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(Ee(n)){this.fragPrevious=n;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,m({},s)))}this.fragBufferedComplete(n,i),this.media&&this.tick()}onError(e,t){var n;if(t.fatal){this.state=Je.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(te.AUDIO,t);break;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Je.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===ae.AUDIO_TRACK&&(this.state=Je.IDLE);break;case H.BUFFER_ADD_CODEC_ERROR:case H.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case H.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==I.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==I.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Je.ENDED&&(this.state=Je.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,te.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=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:d,text:v,id3:E,initSegment:D}=s;if(this.fragContextChanged(c)||!f){this.fragmentTracker.removeFragment(c);return}if(this.state=Je.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),D!=null&&D.tracks){const S=c.initSegment||c;if(this.unhandledEncryptionError(D,c))return;this._bufferInitSegment(h,D.tracks,S,r),i.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:n,tracks:D.tracks})}if(d){const{startPTS:S,endPTS:B,startDTS:ne,endDTS:J}=d;u&&(u.elementaryStreams[I.AUDIO]={startPTS:S,endPTS:B,startDTS:ne,endDTS:J}),c.setElementaryStreamInfo(I.AUDIO,S,B,ne,J),this.bufferFragmentData(d,c,u,r)}if(E!=null&&(t=E.samples)!=null&&t.length){const S=g({id:n,frag:c,details:f},E);i.trigger(p.FRAG_PARSING_METADATA,S)}if(v){const S=g({id:n,frag:c,details:f},v);i.trigger(p.FRAG_PARSING_USERDATA,S)}}_bufferInitSegment(e,t,n,i){if(this.state!==Je.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=te.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(p.BUFFER_CODECS,t);const o=s.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:o};this.hls.trigger(p.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===un.NOT_LOADED||i===un.PARTIAL){var s;if(!Ee(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=Je.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&Ks(t.details,r)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:n,assocLang:i,characteristics:s,audioCodec:r,channels:o}=this.bufferedTrack;mn({name:t,lang:n,assocLang:i,characteristics:s,audioCodec:r,channels:o},e,jt)||(Gn(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(p.AUDIO_TRACK_SWITCHED,m({},e))}}class Rr extends L{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,n){const i=t==null?void 0:t.renditionReports;if(i){let s=-1;for(let r=0;r<i.length;r++){const o=i[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=i[s],o=parseInt(r["LAST-MSN"])||t.lastPartSn;let c=parseInt(r["LAST-PART"])||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=n&&wn(n);return new zt(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(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}return e}playlistLoaded(e,t,n){const{details:i,stats:s}=t,r=self.performance.now(),o=s.loading.first?Math.max(0,r-s.loading.first):0;i.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==i.appliedTimelineOffset){const h=Math.max(c||0,0);i.appliedTimelineOffset=h,i.fragments.forEach(f=>{f.setStart(f.playlistOffset+h)})}if(i.live||n!=null&&n.live){const h="levelInfo"in t?t.levelInfo:t.track;if(i.reloaded(n),n&&i.fragments.length>0){ll(n,i,this);const ne=i.playlistParsingError;if(ne){this.warn(ne);const J=this.hls;if(!J.config.ignorePlaylistParsingErrors){var u;const{networkDetails:me}=t;J.trigger(p.ERROR,{type:oe.NETWORK_ERROR,details:H.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:ne,reason:ne.message,level:t.level||void 0,parent:(u=i.fragments[0])==null?void 0:u.type,networkDetails:me,stats:s});return}i.playlistParsingError=null}}i.requestScheduled===-1&&(i.requestScheduled=s.loading.start);const f=this.hls.mainForwardBufferInfo,d=f?f.end-f.len:0,v=(i.edge-d)*1e3,E=ga(i,v);if(i.requestScheduled+E<r?i.requestScheduled=r:i.requestScheduled+=E,this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),!this.canLoad||!i.live)return;let D,S,B;if(i.canBlockReload&&i.endSN&&i.advanced){const ne=this.hls.config.lowLatencyMode,J=i.lastPartSn,me=i.endSN,Le=i.lastPartIndex,ze=Le!==-1,De=J===me;ze?De?(S=me+1,B=ne?0:Le):(S=J,B=ne?Le+1:i.maxPartIndex):S=me+1;const Ne=i.age,Me=Ne+i.ageHeader;let Re=Math.min(Me-i.partTarget,i.targetduration*1.5);if(Re>0){if(Me>i.targetduration*3)this.log(`Playlist last advanced ${Ne.toFixed(2)}s ago. Omitting segment and part directives.`),S=void 0,B=void 0;else if(n!=null&&n.tuneInGoal&&Me-i.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${Re} with playlist age: ${i.age}`),Re=0;else{const Qe=Math.floor(Re/i.targetduration);if(S+=Qe,B!==void 0){const yt=Math.round(Re%i.targetduration/i.partTarget);B+=yt}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${Ne.toFixed(2)}s goal: ${Re} skip sn ${Qe} to part ${B}`)}i.tuneInGoal=Re}if(D=this.getDeliveryDirectives(i,t.deliveryDirectives,S,B),ne||!De){i.requestScheduled=r,this.loadingPlaylist(h,D);return}}else(i.canBlockReload||i.canSkipUntil)&&(D=this.getDeliveryDirectives(i,t.deliveryDirectives,S,B));D&&S!==void 0&&i.canBlockReload&&(i.requestScheduled=s.loading.first+Math.max(E-o*2,E/2)),this.scheduleLoading(h,D,i)}else this.clearTimer()}scheduleLoading(e,t,n){const i=n||e.details;if(!i){this.loadingPlaylist(e,t);return}const s=self.performance.now(),r=i.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,n,i){let s=wn(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=on.No),new zt(n,i,s)}checkRetry(e){const t=e.details,n=ti(e),i=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=i||{},c=!!i&&!!o&&(s===_n.RetryRequest||!i.resolved&&s===_n.SendAlternateToPenaltyBox);if(c){var u;if(r>=o.maxNumRetry)return!1;if(n&&(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=Bi(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,i.resolved=!0}return c}}function Qa(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!Bs(a[t].attrs,e[t].attrs))return!1;return!0}function Bs(a,e,t){const n=a["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>a[i]!==e[i])}function Ir(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class _u extends Rr{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:n,groupId:i,details:s}=t,r=this.tracksInGroup[n];if(!r||r.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Audio track ${n} "${r.name}" lang:${r.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(d=>!n||n.indexOf(d.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(d=>d.default)&&(this.selectDefaultTrack=!1),o.forEach((d,v)=>{d.id=v});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const d=Rn(c,o,jt);if(d>-1)s=o[d];else{const v=Rn(c,this.tracks);s=this.tracks[v]}}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): ${n==null?void 0:n.join(",")}`),this.hls.trigger(p.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 d=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(d.message),this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:d})}}}onError(e,t){t.fatal||!t.context||t.context.type===ae.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&mn(e,i,jt))return i;const s=Rn(e,this.tracksInGroup,jt);if(s>-1){const r=this.tracksInGroup[s];return this.setAudioTrack(s),r}else if(i){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);const o=Vt(e,t.levels,n,r,jt);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=Rn(e,n);if(r>-1)return n[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 n=this.currentTrack,i=t[e],s=i.details&&!i.details.live;if(e===this.trackId&&i===n&&s||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,m({},i)),s))return;const r=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||mn(e,i,jt)))return n}if(e){const{name:n,lang:i,assocLang:s,characteristics:r,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const h=t[u];if(mn({name:n,lang:i,assocLang:s,characteristics:r,audioCodec:o,channels:c},h,jt))return u}for(let u=0;u<t.length;u++){const h=t[u];if(Bs(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const h=t[u];if(Bs(e.attrs,h.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Gn(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${i}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:t||null,track:e})}}class vu{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;const i=this.queues[t];i.push(e),i.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const n={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const n={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const n=(t=e[0])==null?void 0:t.label;(n==="async-blocker"||n==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(s){var n;if(i.onError(s),this.queues===null||this.tracks===null)return;const r=(n=this.tracks[e])==null?void 0:n.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,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const n=(t=this.tracks)==null?void 0:t[e],i=n==null?void 0:n.buffer;return i?`SourceBuffer${i.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(n=>n.label).join(", "))||""}}const Ja=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,eo="HlsJsTrackRemovedError";class yu extends Error{constructor(e){super(e),this.name=eo}}class Eu extends L{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=n=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=n=>{const{media:i,mediaSource:s}=this;n&&this.log("Media source opened"),!(!i||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:i,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:n,_objectUrl:i}=this;n!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=_e(X(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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_APPENDING,this.onBufferAppending,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.BUFFER_EOS,this.onBufferEos,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.FRAG_PARSED,this.onFragParsed,this),e.on(p.FRAG_CHANGED,this.onFragChanged,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_APPENDING,this.onBufferAppending,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_EOS,this.onBufferEos,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.FRAG_PARSED,this.onFragParsed,this),e.off(p.FRAG_CHANGED,this.onFragChanged,this),e.off(p.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const n={};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 i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===t?g(n,i.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(n[r]=g({},this.tracks[r]),this.removeBuffer(r)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:n}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var n;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){const n=this.media=t.media;this.transferData=this.overrides=void 0;const i=X(this.appendSource);if(i){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(r),s)this._objectUrl=n.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{n.removeAttribute("src");const c=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||c&&r instanceof c,to(n),bu(n,o),n.load()}catch(c){n.src=o}else n.src=o}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,n;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(n=e.constructor)==null?void 0:n.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const n=this.tracks,i=t.tracks,s=i?Object.keys(i):null,r=s?s.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(i&&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: ${Pt(n,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${Pt(i,(c,u)=>c==="initSegment"?void 0:u)}}`),!ye(i,n)){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(i)}"->"${Object.keys(n)}") start time: ${h} currentTime: ${c}`),this.onMediaDetaching(p.MEDIA_DETACHING,{}),this.onMediaAttaching(p.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,s.forEach(c=>{const u=c,h=i[u];if(h){const f=h.buffer;if(f){const d=this.fragmentTracker,v=h.id;if(d.hasFragments(v)||d.hasParts(v)){const S=Ot.getBuffered(f);d.detectEvictedFragments(u,S,v,null,!0)}const E=Lr(u),D=[u,f];this.sourceBuffers[E]=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 n=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:s,_objectUrl:r}=this;if(s){if(this.log(`media source ${n?"transferring":"detaching"}`),n)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}i&&(i.removeEventListener("emptied",this._onMediaEmptied),n||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(i.removeAttribute("src"),this.appendSource&&to(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(p.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const n=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),n)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Lr(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new vu(this.tracks)}onBufferCodecs(e,t){const n=this.tracks,i=Object.keys(t);this.log(`BUFFER_CODECS: "${i}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),r=!s&&this.sourceBufferCount&&this.media&&i.some(o=>!n[o]);if(s||r){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${i}" SourceBuffers`);return}i.forEach(o=>{var c,u;const h=t[o],{id:f,codec:d,levelCodec:v,container:E,metadata:D,supplemental:S}=h;let B=n[o];const ne=(c=this.transferData)==null||(c=c.tracks)==null?void 0:c[o],J=ne!=null&&ne.buffer?ne:B,me=(J==null?void 0:J.pendingCodec)||(J==null?void 0:J.codec),Le=J==null?void 0:J.levelCodec;B||(B=n[o]={buffer:void 0,listeners:[],codec:d,supplemental:S,container:E,levelCodec:v,metadata:D,id:f});const ze=ce(me,Le),De=ze==null?void 0:ze.replace(Ja,"$1");let Ne=ce(d,v);const Me=(u=Ne)==null?void 0:u.replace(Ja,"$1");Ne&&ze&&De!==Me&&(o.slice(0,5)==="audio"&&(Ne=Q(Ne,this.appendSource)),this.log(`switching codec ${me} to ${Ne}`),Ne!==(B.pendingCodec||B.codec)&&(B.pendingCodec=Ne),B.container=E,this.appendChangeType(o,E,Ne))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){const i=`${t};codecs=${n}`,s={label:`change-type=${i}`,execute:()=>{const r=this.tracks[e];if(r){const o=r.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),o.changeType(i),r.codec=n,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 n=e.start,i=n+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(n,te.MAIN))==null?void 0:t.gap)===!0)return;const r={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>i||c!=null&&c.buffer&&Ot.isBuffered(c.buffer,i)||((o=this.fragmentTracker.getAppendedFrag(i,te.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:n}=this,{data:i,type:s,parent:r,frag:o,part:c,chunkMeta:u,offset:h}=t,f=u.buffering[s],{sn:d,cc:v}=o,E=self.performance.now();f.start=E;const D=o.stats.buffering,S=c?c.stats.buffering:null;D.start===0&&(D.start=E),S&&S.start===0&&(S.start=E);const B=n.audio;let ne=!1;s==="audio"&&(B==null?void 0:B.container)==="audio/mpeg"&&(ne=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const J=n.video,me=J==null?void 0:J.buffer;if(me&&d!=="initSegment"){const De=c||o,Ne=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend&&!(J.ending||J.ended)){const Re=De.start+De.duration*.05,Qe=me.buffered,yt=this.currentOp("video");!Qe.length&&!yt?this.blockAudio(De):!yt&&!Ot.isBuffered(me,Re)&&this.lastVideoAppendEnd<Re&&this.blockAudio(De)}else if(s==="video"){const Me=De.end;if(Ne){const Re=Ne.frag.start;(Me>Re||Me<this.lastVideoAppendEnd||Ot.isBuffered(me,Re))&&this.unblockAudio()}this.lastVideoAppendEnd=Me}}const Le=(c||o).start,ze={label:`append-${s}`,execute:()=>{var De;f.executeStart=self.performance.now();const Ne=(De=this.tracks[s])==null?void 0:De.buffer;Ne&&(ne?this.updateTimestampOffset(Ne,Le,.1,s,d,v):h!==void 0&&T(h)&&this.updateTimestampOffset(Ne,h,1e-6,s,d,v)),this.appendExecutor(i,s)},onStart:()=>{},onComplete:()=>{const De=self.performance.now();f.executeEnd=f.end=De,D.first===0&&(D.first=De),S&&S.first===0&&(S.first=De);const Ne={};this.sourceBuffers.forEach(([Me,Re])=>{Me&&(Ne[Me]=Ot.getBuffered(Re))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:s,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:Ne})},onError:De=>{var Ne;const Me={type:oe.MEDIA_ERROR,parent:o.type,details:H.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:De,err:De,fatal:!1},Re=(Ne=this.media)==null?void 0:Ne.error;if(De.code===DOMException.QUOTA_EXCEEDED_ERR||De.name=="QuotaExceededError"||"quota"in De)Me.details=H.BUFFER_FULL_ERROR;else if(De.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Re)Me.errorAction=li(!0);else if(De.name===eo&&this.sourceBufferCount===0)Me.errorAction=li(!0);else{const Qe=++this.appendErrors[s];this.warn(`Failed ${Qe}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${Re||"no media error"})`),(Qe>=this.hls.config.appendErrorMaxRetry||Re)&&(Me.fatal=!0)}this.hls.trigger(p.ERROR,Me)}};this.append(ze,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,t){const{type:n,startOffset:i,endOffset:s}=t;n?this.append(this.getFlushOp(n,i,s),n):this.sourceBuffers.forEach(([r])=>{r&&this.append(this.getFlushOp(r,i,s),r)})}onFragParsed(e,t){const{frag:n,part:i}=t,s=[],r=i?i.elementaryStreams:n.elementaryStreams;r[I.AUDIOVIDEO]?s.push("audiovideo"):(r[I.AUDIO]&&s.push("audio"),r[I.VIDEO]&&s.push("video"));const o=()=>{const c=self.performance.now();n.stats.buffering.end=c,i&&(i.stats.buffering.end=c);const u=i?i.stats:n.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:n,part:i,stats:u,id:n.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.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])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var n;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 i=((n=this.overrides)==null?void 0:n.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([r])=>{var o;return r&&!((o=this.tracks[r])!=null&&o.ended)})?i?(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(p.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(p.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===H.BUFFER_APPEND_ERROR&&t.frag){var n;const i=(n=t.errorAction)==null?void 0:n.nextAutoLevel;T(i)&&i!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;const i=e.config,s=n.currentTime,r=t.levelTargetDuration,o=t.live&&i.liveBackBufferLength!==null?i.liveBackBufferLength:i.backBufferLength;if(T(o)&&o>=0){const u=Math.max(o,r),h=Math.floor(s/r)*r-u;this.flushBackBuffer(s,r,h)}const c=i.frontBufferFlushThreshold;if(T(c)&&c>0){const u=Math.max(i.maxBufferLength,c),h=Math.max(u,r),f=Math.floor(s/r)*r+h;this.flushFrontBuffer(s,r,f)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([i,s])=>{if(s){const o=Ot.getBuffered(s);if(o.length>0&&n>o.start(0)){var r;this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:n});const c=this.tracks[i];if((r=this.details)!=null&&r.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(c!=null&&c.ended){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:i})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([i,s])=>{if(s){const r=Ot.getBuffered(s),o=r.length;if(o<2)return;const c=r.start(o-1),u=r.end(o-1);if(n>c||e>=c&&e<=u)return;this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:i})}})}getDurationAndRange(){var e;const{details:t,mediaSource:n}=this;if(!t||!this.media||(n==null?void 0:n.readyState)!=="open")return null;const i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&n.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),h=Math.max(u,i);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 T(s)?{duration:s}:null;const r=this.media.duration,o=T(n.duration)?n.duration:0;return i>o&&i>r||!T(r)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:n}){const i=this.mediaSource;!this.media||!i||i.readyState!=="open"||(i.duration!==e&&(T(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${n}.`),i.setLiveSeekableRange(t,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Pt(n)}`),this.tracksReady){var i;const s=(i=this.transferData)==null?void 0:i.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,n])=>{if(t){const i=this.tracks[t];e[t]={buffer:n,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(p.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(p.ERROR,{type:oe.MEDIA_ERROR,details:H.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const 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":""} ${Pt(o)}`);try{const h=n.addSourceBuffer(u),f=Lr(r),d=[r,h];t[f]=d,o.buffer=h}catch(h){var i;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(r),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[r],this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.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 n=e.supplemental;let i=e.codec;n&&(t==="video"||t==="audiovideo")&&Gt(n,"video")&&(i=re(i,n));const s=ce(i,e.levelCodec);return s?t.slice(0,5)==="audio"?Q(s,this.appendSource):s:""}trackSourceBuffer(e,t){const n=t.buffer;if(!n)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,r)=>{const o=r.removedRanges;o!=null&&o.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:s})})}get mediaSrc(){var e,t;const n=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return n==null?void 0:n.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const s=this.currentOp(e);s&&s.onError(i)}updateTimestampOffset(e,t,n,i,s,r){const o=t-e.timestampOffset;Math.abs(o)>=n&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${s} cc: ${r})`),e.timestampOffset=t)}removeExecutor(e,t,n){const{media:i,mediaSource:s}=this,r=this.tracks[e],o=r==null?void 0:r.buffer;if(!i||!s||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=T(i.duration)?i.duration:1/0,u=T(s.duration)?s.duration:1/0,h=Math.max(0,t),f=Math.min(n,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 n=this.tracks[t],i=n==null?void 0:n.buffer;if(!i)throw new yu(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,i.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:n}=this,i=t.map(r=>this.appendBlocker(r));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(r=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var n;const i=(n=this.tracks[t])==null?void 0:n.buffer;!i||i.updating||this.shiftAndExecuteNext(t)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,n){const i=this.tracks[e];if(!i)return;const s=i.buffer;if(!s)return;const r=n.bind(this,e);i.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const n=t.buffer;n&&(t.listeners.forEach(i=>{n.removeEventListener(i.event,i.listener)}),t.listeners.length=0)}}function to(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function bu(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function Lr(a){return a==="audio"?1:0}class Cr{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(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&T(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const n=t.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.clientRect=null,Cr.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const i=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let s=e.length-1;const r=Math.max(t,n);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=r||c.height>=r)&&i(c,e[o+1])){s=o;break}}return s}}const qn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},xu={HLS:"h"};class xi{constructor(e,t){Array.isArray(e)&&(e=e.map(n=>n instanceof xi?n:new xi(n))),this.value=e,this.params=t}}const Tu="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 Au(a,e,t,n){return new Error(`failed to ${a} "${Su(e)}" as ${t}`,{cause:n})}function Ti(a,e,t){return Au("serialize",a,e,t)}class no{constructor(e){this.description=e}}const io="Bare Item",wu="Boolean";function Du(a){if(typeof a!="boolean")throw Ti(a,wu);return a?"?1":"?0"}function Ru(a){return btoa(String.fromCharCode(...a))}const Iu="Byte Sequence";function Lu(a){if(ArrayBuffer.isView(a)===!1)throw Ti(a,Iu);return`:${Ru(a)}:`}const Cu="Integer";function ku(a){return a<-999999999999999||999999999999999<a}function so(a){if(ku(a))throw Ti(a,Cu);return a.toString()}function Pu(a){return`@${so(a.getTime()/1e3)}`}function ro(a,e){if(a<0)return-ro(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const i=Math.floor(a*t);return(i%2===0?i:i+1)/t}else return Math.round(a*t)/t}const Fu="Decimal";function Ou(a){const e=ro(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ti(a,Fu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Nu="String",Mu=/[\x00-\x1f\x7f]+/;function Bu(a){if(Mu.test(a))throw Ti(a,Nu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Uu(a){return a.description||a.toString().slice(7,-1)}const $u="Token";function ao(a){const e=Uu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ti(e,$u);return e}function kr(a){switch(typeof a){case"number":if(!T(a))throw Ti(a,io);return Number.isInteger(a)?so(a):Ou(a);case"string":return Bu(a);case"symbol":return ao(a);case"boolean":return Du(a);case"object":if(a instanceof Date)return Pu(a);if(a instanceof Uint8Array)return Lu(a);if(a instanceof no)return ao(a);default:throw Ti(a,io)}}const Gu="Key";function Pr(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw Ti(a,Gu);return a}function Fr(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${Pr(e)}`:`;${Pr(e)}=${kr(t)}`).join("")}function oo(a){return a instanceof xi?`${kr(a.value)}${Fr(a.params)}`:kr(a)}function Ku(a){return`(${a.value.map(oo).join(" ")})${Fr(a.params)}`}function Vu(a,e={whitespace:!0}){if(typeof a!="object"||a==null)throw Ti(a,Tu);const t=a instanceof Map?a.entries():Object.entries(a),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof xi||(s=new xi(s));let r=Pr(i);return s.value===!0?r+=Fr(s.params):(r+="=",Array.isArray(s.value)?r+=Ku(s):r+=oo(s)),r}).join(`,${n}`)}function lo(a,e){return Vu(a,e)}const Si="CMCD-Object",Tn="CMCD-Request",is="CMCD-Session",Yi="CMCD-Status",zu={br:Si,ab:Si,d:Si,ot:Si,tb:Si,tpb:Si,lb:Si,tab:Si,lab:Si,url:Si,pb:Tn,bl:Tn,tbl:Tn,dl:Tn,ltc:Tn,mtp:Tn,nor:Tn,nrr:Tn,rc:Tn,sn:Tn,sta:Tn,su:Tn,ttfb:Tn,ttfbb:Tn,ttlb:Tn,cmsdd:Tn,cmsds:Tn,smrt:Tn,df:Tn,cs:Tn,ts:Tn,cid:is,pr:is,sf:is,sid:is,st:is,v:is,msd:is,bs:Yi,bsd:Yi,cdn:Yi,rtp:Yi,bg:Yi,pt:Yi,ec:Yi,e:Yi},Wu={REQUEST:Tn};function Hu(a){return Object.keys(a).reduce((e,t)=>{var n;return(n=a[t])===null||n===void 0||n.forEach(i=>e[i]=t),e},{})}function ju(a,e){const t={};if(!a)return t;const n=Object.keys(a),i=e?Hu(e):{};return n.reduce((s,r)=>{var o;const c=zu[r]||i[r]||Wu.REQUEST,u=(o=s[c])!==null&&o!==void 0?o:s[c]={};return u[r]=a[r],s},t)}function Yu(a){return["ot","sf","st","e","sta"].includes(a)}function Zu(a){return typeof a=="number"?T(a):a!=null&&a!==""&&a!==!1}const uo="event";function qu(a,e){const t=new URL(a),n=new URL(e);if(t.origin!==n.origin)return a;const i=t.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")+t.search+t.hash}const qs=a=>Math.round(a),Or=(a,e)=>Array.isArray(a)?a.map(t=>Or(t,e)):a instanceof xi&&typeof a.value=="string"?new xi(Or(a.value,e),a.params):(e.baseUrl&&(a=qu(a,e.baseUrl)),e.version===1?encodeURIComponent(a):a),Xs=a=>qs(a/100)*100,Xu={br:qs,d:qs,bl:Xs,dl:Xs,mtp:Xs,nor:(a,e)=>{let t=a;return e.version>=2&&(a instanceof xi&&typeof a.value=="string"?t=new xi([a]):typeof a=="string"&&(t=[a])),Or(t,e)},rtp:Xs,tb:qs},co="request",ho="response",Nr=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Qu=["e"],Ju=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Qs(a){return Ju.test(a)}function ec(a){return Nr.includes(a)||Qu.includes(a)||Qs(a)}const fo=["d","dl","nor","ot","rtp","su"];function tc(a){return Nr.includes(a)||fo.includes(a)||Qs(a)}const nc=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function ic(a){return Nr.includes(a)||fo.includes(a)||nc.includes(a)||Qs(a)}const sc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function rc(a){return sc.includes(a)||Qs(a)}const ac={[ho]:ic,[uo]:ec,[co]:tc};function po(a,e={}){const t={};if(a==null||typeof a!="object")return t;const n=e.version||a.v||1,i=e.reportingMode||co,s=n===1?rc:ac[i];let r=Object.keys(a).filter(s);const o=e.filter;typeof o=="function"&&(r=r.filter(o));const c=i===ho||i===uo;c&&!r.includes("ts")&&r.push("ts"),n>1&&!r.includes("v")&&r.push("v");const u=g({},Xu,e.formatters),h={version:n,reportingMode:i,baseUrl:e.baseUrl};return r.sort().forEach(f=>{let d=a[f];const v=u[f];if(typeof v=="function"&&(d=v(d,h)),f==="v"){if(n===1)return;d=n}f=="pr"&&d===1||(c&&f==="ts"&&!T(d)&&(d=Date.now()),Zu(d)&&(Yu(f)&&typeof d=="string"&&(d=new no(d)),t[f]=d))}),t}function oc(a,e={}){const t={};if(!a)return t;const n=po(a,e),i=ju(n,e==null?void 0:e.customHeaderMap);return Object.entries(i).reduce((s,[r,o])=>{const c=lo(o,{whitespace:!1});return c&&(s[r]=c),s},t)}function lc(a,e,t){return g(a,oc(e,t))}const uc="CMCD";function cc(a,e={}){return a?lo(po(a,e),{whitespace:!1}):""}function hc(a,e={}){if(!a)return"";const t=cc(a,e);return encodeURIComponent(t)}function fc(a,e={}){if(!a)return"";const t=hc(a,e);return`${uc}=${t}`}const go=/CMCD=[^&#]+/;function dc(a,e,t){const n=fc(e,t);if(!n)return a;if(go.test(a))return a.replace(go,n);const i=a.includes("?")?"&":"?";return`${a}${i}${n}`}class pc{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:qn.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const{frag:s,part:r}=i,o=this.hls.levels[s.level],c=this.getObjectType(s),u={d:(r||s).duration*1e3,ot:c};(c===qn.VIDEO||c===qn.AUDIO||c==qn.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(i,u)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var n,i;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:xu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){g(t,this.createData());const n=t.ot===qn.INIT||t.ot===qn.VIDEO||t.ot===qn.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((r,o)=>(i.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),lc(e.headers,t,s)):e.url=dc(e.url,t,s)}getNextFrag(e){var t;const n=(t=this.hls.levels[e.level])==null?void 0:t.details;if(n){const i=e.sn-n.startSN;return n.fragments[i+1]}}getNextPart(e){var t;const{index:n,fragment:i}=e,s=(t=this.hls.levels[i.level])==null||(t=t.details)==null?void 0:t.partList;if(s){const{sn:r}=i;for(let o=s.length-1;o>=0;o--){const c=s[o];if(c.index===n&&c.fragment.sn===r)return s[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return qn.TIMED_TEXT;if(e.sn==="initSegment")return qn.INIT;if(t==="audio")return qn.AUDIO;if(t==="main")return this.hls.audioTracks.length?qn.VIDEO:qn.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===qn.AUDIO)n=i.audioTracks;else{const s=i.maxAutoLevel,r=s>-1?s+1:i.levels.length;n=i.levels.slice(0,r)}return n.forEach(s=>{s.bitrate>t&&(t=s.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,n=e===qn.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:Ot.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(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,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(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 gc=3e5;class mc extends L{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(n=>n!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===_n.SendAlternateToPenaltyBox&&n.flags===Dn.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&i?r=this.getPathwayForGroupId(o,u,r):c&&(r=c)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&i&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),n.resolved=this.pathwayId!==r),t.details===H.BUFFER_APPEND_ERROR&&!t.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${i&&i.length} priorities: ${Pt(s)} penalized: ${Pt(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach(s=>{i-n[s]>gc&&delete n[s]});for(let s=0;s<e.length;s++){const r=e[s];if(r in n)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,ya(t),this.hls.trigger(p.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,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(t===ae.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===ae.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};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 cn(h.attrs);f["PATHWAY-ID"]=r;const d=f.AUDIO&&`${f.AUDIO}_clone_${r}`,v=f.SUBTITLES&&`${f.SUBTITLES}_clone_${r}`;d&&(n[f.AUDIO]=d,f.AUDIO=d),v&&(i[f.SUBTITLES]=v,f.SUBTITLES=v);const E=_o(h.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),D=new En({attrs:f,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:E,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let S=1;S<h.audioGroups.length;S++)D.addGroupId("audio",`${h.audioGroups[S]}_clone_${r}`);if(h.subtitleGroups)for(let S=1;S<h.subtitleGroups.length;S++)D.addGroupId("text",`${h.subtitleGroups[S]}_clone_${r}`);return D});t.push(...u),mo(this.audioTracks,n,c,r),mo(this.subtitleTracks,i,c,r)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let i;try{i=new self.URL(e)}catch(h){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+h)}const s={responseType:"json",url:i.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,d,v)=>{this.log(`Loaded steering manifest: "${i}"`);const E=h.data;if((E==null?void 0:E.VERSION)!==1){this.log(`Steering VERSION ${E.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=E.TTL;const{"RELOAD-URI":D,"PATHWAY-CLONES":S,"PATHWAY-PRIORITY":B}=E;if(D)try{this.uri=new self.URL(D,i).href}catch(J){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${D}`);return}this.scheduleRefresh(this.uri||d.url),S&&this.clonePathways(S);const ne={steeringManifest:E,url:i.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,ne),B&&this.updatePathwayPriority(B)},onError:(h,f,d,v)=>{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 E=this.timeToLoad*1e3;if(h.code===429){const D=this.loader;if(typeof(D==null?void 0:D.getResponseHeader)=="function"){const S=D.getResponseHeader("Retry-After");S&&(E=parseFloat(S)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,E)},onTimeout:(h,f,d)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function mo(a,e,t,n){a&&Object.keys(e).forEach(i=>{const s=a.filter(r=>r.groupId===i).map(r=>{const o=g({},r);return o.details=void 0,o.attrs=new cn(o.attrs),o.url=o.attrs.URI=_o(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[i],o.attrs["PATHWAY-ID"]=n,o});a.push(...s)})}function _o(a,e,t,n){const{HOST:i,PARAMS:s,[t]:r}=n;let o;e&&(o=r==null?void 0:r[e],o&&(a=o));const c=new self.URL(a);return i&&!o&&(c.host=i),s&&Object.keys(s).sort().forEach(u=>{u&&c.searchParams.set(u,s[u])}),c.href}class ys extends L{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=ys.CDMCleanupPromise?[ys.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:n,initData:i}=t,s=`"${t.type}" event: init data type: "${n}"`;if(this.debug(s),i!==null){if(!this.keyFormatPromise){let r=Object.keys(this.keySystemAccessPromises);r.length||(r=Nt(this.config));const o=r.map(St).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=Wi(r);if(n!=="sinf"||o!==dn.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${n}" for selected key-system ${o}`);return}let c;try{const v=he(new Uint8Array(i)),E=vi(JSON.parse(v).sinf),D=ut(E);if(!D)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(D.subarray(8,24))}catch(v){this.warn(`${s} Failed to parse sinf: ${v}`);return}const u=U(c),{keyIdToKeySessionPromise:h,mediaKeySessions:f}=this;let d=h[u];for(let v=0;v<f.length;v++){const E=f[v],D=E.decryptdata;if(!D.keyId)continue;const S=U(D.keyId);if(u===S||D.uri.replace(/-/g,"").indexOf(u)!==-1){if(d=h[S],!d)continue;if(D.pssh)break;delete h[S],D.pssh=new Uint8Array(i),D.keyId=c,d=h[u]=d.then(()=>this.generateRequestWithPreferredKeySession(E,n,i,"encrypted-event-key-match")),d.catch(B=>this.handleError(B));break}}d||this.handleError(new Error(`Key ID ${u} not encountered in playlist. Key-system sessions ${f.length}.`))}).catch(r=>this.handleError(r))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(p.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(p.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=t==null?void 0:t[e];if(i)return i.licenseUrl;if(e===dn.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t==null?void 0:t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(r,o,c)=>!!r&&c.indexOf(r)===o,i=t.map(r=>r.audioCodec).filter(n),s=t.map(r=>r.videoCodec).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((r,o)=>{const c=u=>{const h=u.shift();this.getMediaKeysPromise(h,i,s).then(f=>r({keySystem:h,mediaKeys:f})).catch(f=>{u.length?c(u):f instanceof hi?o(f):o(new hi({type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return hn===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,t)}getMediaKeysPromise(e,t,n){var i;const s=Sn(e,t,n,this.config.drmSystemOptions||{});let r=this.keySystemAccessPromises[e],o=(i=r)==null?void 0:i.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Pt(s)}`),o=this.requestMediaKeySystemAccess(e,s);const c=r=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(u=>{this.log(`Failed to obtain access to key-system "${e}": ${u}`)}),o.then(u=>{this.log(`Access for key-system "${u.keySystem}" obtained`);const h=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const f=c.mediaKeys=u.createMediaKeys().then(d=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,h.then(v=>v?this.setMediaKeysServerCertificate(d,e,v):d)));return f.catch(d=>{this.error(`Failed to create media-keys for "${e}"}: ${d}`)}),f})}return o.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${U(e.keyId||[])}`);const i=n.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,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 U(e.keyId)}updateKeySession(e,t){const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${U(e.decryptdata.keyId||[])}
} (data length: ${t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>St(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:n})=>this.attemptSetMediaKeys(t,n))}selectKeySystem(e){return new Promise((t,n)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:i})=>{const s=St(i);s?t(s):n(new Error(`Unable to find format for key-system "${i}"`))}).catch(n)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=Nt(this.config),n=e.map(Wi).filter(i=>!!i&&t.indexOf(i)!==-1);return this.selectKeySystem(n)}loadKey(e){const t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),i=this.bannedKeyIds[n];if(i){const o=vo(i,t);return this.handleError(o,e.frag),Promise.reject(o)}const s=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);const r=this.keyIdToKeySessionPromise[n];if(!r){const o=this.getKeySystemForKeyPromise(t).then(({keySystem:c,mediaKeys:u})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(c,u).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:u,decryptdata:t}))))).then(c=>{const u="cenc",h=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,u,h,"playlist-key")});return o.catch(c=>this.handleError(c,e.frag)),this.keyIdToKeySessionPromise[n]=o,o}return r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){this.hls&&(this.error(e.message),e instanceof hi?(t&&(e.data.frag=t),this.hls.trigger(p.ERROR,e.data)):this.hls.trigger(p.ERROR,{type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){const i=Wi(e.keyFormat),s=i?[i]:Nt(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=Nt(this.config)),e.length===0)throw new hi({type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Pt({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.mediaKeys=t,this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>n.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,n,i){var s;const r=(s=this.config.drmSystems)==null||(s=s[e.keySystem])==null?void 0:s.generateRequest;if(r)try{const d=r.call(this.hls,t,n,e);if(!d)throw new Error("Invalid response from configured generateRequest filter");t=d.initDataType,n=d.initData?d.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(d){if(this.warn(d.message),this.hls&&this.hls.config.debug)throw d}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const o=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${o} (init data type: ${t} length: ${n.byteLength})`);const c=new gr,u=e._onmessage=d=>{const v=e.mediaKeysSession;if(!v){c.emit("error",new Error("invalid state"));return}const{messageType:E,message:D}=d;this.log(`"${E}" message event for session "${v.sessionId}" message size: ${D.byteLength}`),E==="license-request"||E==="license-renewal"?this.renewLicense(e,D).catch(S=>{c.eventNames().length?c.emit("error",S):this.handleError(S)}):E==="license-release"?e.keySystem===dn.FAIRPLAY&&(this.updateKeySession(e,ki("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${E}"`)},h=e._onkeystatuseschange=d=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}const E=e.keyStatus;this.onKeyStatusChange(e);const D=e.keyStatus;D!==E&&(c.emit("keyStatus",D,e),D==="expired"&&(this.log(`${e.keySystem} expired for key ${o}`),this.renewKeySession(e)))};Hn(e.mediaKeysSession,"message",u),Hn(e.mediaKeysSession,"keystatuseschange",h);const f=new Promise((d,v)=>{c.on("error",v),c.on("keyStatus",(E,{decryptdata:D})=>{E.startsWith("usable")?d():E==="internal-error"||E==="output-restricted"?v(vo(E,D)):E==="expired"?v(new Error(`key expired while generating request (keyId: ${o})`)):this.warn(`unhandled key status change "${E}" (keyId: ${o})`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o}`)}).catch(d=>{throw new hi({type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_SESSION,error:d,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${d}`)}).then(()=>f).catch(d=>{throw c.removeAllListeners(),this.removeSession(e),d}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){const t=U(new Uint8Array(e.decryptdata.keyId||[]));e.mediaKeysSession.keyStatuses.forEach((n,i)=>{if(typeof i=="string"&&typeof n=="object"){const o=i;i=n,n=o}const s=U("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i));n==="internal-error"&&(this.bannedKeyIds[s]=n);const r=s===t;this.log(`${r?"":"un"}matched key status change "${n}" for keyStatuses keyId: ${s} session keyId: ${t} uri: ${e.decryptdata.uri}`),r&&(e.keyStatus=n)})}fetchServerCertificate(e){const t=this.config,n=t.loader,i=new n(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:(d,v,E,D)=>{r(d.data)},onError:(d,v,E,D)=>{o(new hi({type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:m({url:c.url,data:void 0},d)},`"${e}" certificate request failed (${s}). Status: ${d.code} (${d.text})`))},onTimeout:(d,v,E)=>{o(new hi({type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(d,v,E)=>{o(new Error("aborted"))}};i.load(c,h,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((i,s)=>{e.setServerCertificate(n).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${n.byteLength}) on "${t}"`),i(e)}).catch(r=>{s(new hi({type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new hi({type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:i,fatal:!1},i.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(n,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let h;for(let f=0,d=s.length;f<d;f++){var r,o;h=s[f];const v=(r=h.querySelector("name"))==null?void 0:r.textContent,E=(o=h.querySelector("value"))==null?void 0:o.textContent;v&&E&&e.setRequestHeader(v,E)}}const c=i.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return ki(atob(u))}setupLicenseXHR(e,t,n,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,n,i)}).catch(r=>{if(!n.decryptdata)throw r;return e.open("POST",t,!0),s.call(this.hls,e,t,n,i)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((i,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)}i(c)}else{const c=n.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)s(new hi({type:oe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,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(i,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==dn.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)}).catch(s)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,Hn(n,"encrypted",this.onMediaEncrypted),Hn(n,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Zn(e,"encrypted",this.onMediaEncrypted),Zn(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Fi.clearKeyUriToKeyIdMap();const i=n.length;ys.CDMCleanupPromise=Promise.all(n.map(s=>this.removeSession(s)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(s=>{this.log(`Could not clear media keys: ${s}`),this.hls&&this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:H.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`),this.hls&&this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:H.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})}).then(()=>{i&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=t.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n,decryptdata:i}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${U((i==null?void 0:i.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{drmSystemOptions:r}=this.config;return(gs(r)?new Promise((c,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(c).catch(u)}):Promise.resolve()).catch(c=>{this.log(`Could not remove session: ${c}`),this.hls&&this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:H.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${c}`)})}).then(()=>t.close()).catch(c=>{this.log(`Could not close session: ${c}`),this.hls&&this.hls.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:H.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${c}`)})})}}}ys.CDMCleanupPromise=void 0;class hi 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}}function vo(a,e){const t=a==="output-restricted",n=t?H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:H.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new hi({type:oe.KEY_SYSTEM_ERROR,details:n,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${a}"`)}class _c{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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const s=i-this.lastTime,r=n-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*r/s,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:n}),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(p.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function yo(a,e){let t;try{t=new Event("addtrack")}catch(n){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function Eo(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(n){ee.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,a.addCue(i)}catch(i){ee.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(a.mode=t)}function Es(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let n=a.cues.length;n--;)e&&a.cues[n].removeEventListener("enter",e),a.removeCue(a.cues[n]);t==="disabled"&&(a.mode=t)}function Mr(a,e,t,n){const i=a.mode;if(i==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=yc(a.cues,e,t);for(let r=0;r<s.length;r++)(!n||n(s[r]))&&a.removeCue(s[r])}i==="disabled"&&(a.mode=i)}function vc(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let n=0,i=t,s;for(;n<=i;)if(s=Math.floor((i+n)/2),e<a[s].startTime)i=s-1;else if(e>a[s].startTime&&n<t)n=s+1;else return s;return a[n].startTime-e<e-a[i].startTime?n:i}function yc(a,e,t){const n=[],i=vc(a,e);if(i>-1)for(let s=i,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)n.push(o);else if(o.startTime>t)return n}return n}function Js(a){const e=[];for(let t=0;t<a.length;t++){const n=a[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(a[t])}return e}class Ec extends Rr{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const n=Js(this.media.textTracks);for(let s=0;s<n.length;s++)if(n[s].mode==="hidden")t=n[s];else if(n[s].mode==="showing"){t=n[s];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const n=this.media;if(!n)return;const i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;Js(n.textTracks).forEach(r=>{Es(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:n,groupId:i,details:s}=t,r=this.tracksInGroup[n];if(!r||r.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Subtitle track ${n} "${r.name}" lang:${r.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(r=>(i==null?void 0:i.indexOf(r))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(h=>!n||n.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=Rn(o,r);if(h>-1)s=r[h];else{const f=Rn(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 "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const s=t[i];if(!(n&&!s.default||!n&&!e)&&(!e||mn(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(Bs(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(Bs(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(Ir(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ae.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const n=this.currentTrack;if(n&&mn(e,n))return n;const i=Rn(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=Rn(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 n=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${i}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Js(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>Ir(n,s))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==i&&(s.mode="disabled")}),i){const s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!T(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:r,groupId:o="",name:c,type:u,url:h}=i;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:u,url:h});const f=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(f)}}function bc(){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,i=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?s:s&3|8).toString(16)})}}}function Us(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const bs=.025;let er=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function xc(a,e,t){return`${a.identifier}-${t+1}-${Us(e)}`}class Tc{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const n=this.playoutLimit;return e<=0||isNaN(n)?!1:n===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>n}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Br(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,n=Br(t,e);return t-n<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=T(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 Br(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<bs))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?er.Range:er.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 Sc(this)}}function Br(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<bs)?e.start:e.start+e.duration}function bo(a,e,t){const n=new self.URL(a,t);return n.protocol!=="data:"&&n.searchParams.set("_HLS_primary_id",e),n}function Ur(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function Sc(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function xs(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Ac{constructor(e,t,n,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(p.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=n,this.assetItem=i;const r=()=>{this.hasDetails=!0};s.once(p.LEVEL_LOADED,r),s.once(p.AUDIO_TRACK_LOADED,r),s.once(p.SUBTITLE_TRACK_LOADED,r),s.on(p.MEDIA_ATTACHING,(o,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(p.BUFFER_APPENDED,()=>{const h=this.bufferedEnd;this.reachedPlayout(h)&&(this._bufferedEosTime=h,s.trigger(p.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=bo(t,e.config.primarySessionId||"").href}catch(n){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const n=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,s=Ot.bufferInfo(e,i,0);return this.getAssetTime(s.end)>=n-.02}reachedPlayout(e){const n=this.interstitial.playoutLimit;return this.startOffset+e>=n}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=Ot.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;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const n=t-this.startOffset;if(n>0&&n<e)return n}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const n=e-t;if(Math.abs(n)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,e-t),n)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=n=>delete n.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){var i;(i=this.hls)==null||i.on(e,t)}once(e,t,n){var i;(i=this.hls)==null||i.once(e,t)}off(e,t,n){var i;(i=this.hls)==null||i.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${xs(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const xo=.033;class wc extends L{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((n,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,n+1):n,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(s=i[n])!=null&&s.event;){var s;n--}return n}findItemIndexAtTime(e,t){const n=this.items;if(n)for(let i=0;i<n.length;i++){let s=n[i];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return i}return-1}findJumpRestrictedIndex(e,t){const n=this.items;if(n)for(let i=e;i<=t&&n[i];i++){const s=n[i].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return i}return-1}findEventIndex(e){const t=this.items;if(t)for(let i=t.length;i--;){var n;if(((n=t[i].event)==null?void 0:n.identifier)===e)return i}return-1}findAssetIndex(e,t){const n=e.assetList,i=n.length;if(i>1)for(let s=0;s<i;s++){const r=n[s];if(!r.error){const o=r.timelineStart;if(t===o||t>o&&(t<o+(r.duration||0)||s===i-1))return s}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const n=t.assetList,i=n[n.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){const n=e.main.details,{dateRanges:i}=n,s=this.events,r=this.parseDateRanges(i,{url:n.url},t),o=Object.keys(i),c=s?s.filter(u=>!o.includes(u.identifier)):[];r.length&&r.sort((u,h)=>{const f=u.cue.pre,d=u.cue.post,v=h.cue.pre,E=h.cue.post;if(f&&!v)return-1;if(v&&!f||d&&!E)return 1;if(E&&!d)return-1;if(!f&&!v&&!d&&!E){const D=u.startTime,S=h.startTime;if(D!==S)return D-S}return u.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=r,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],n=!1){const i=this.events||[];if(i.length||t.length||this.length<2){const s=this.items,r=this.parseSchedule(i,e);(n||t.length||(s==null?void 0:s.length)!==r.length||r.some((c,u)=>Math.abs(c.playout.start-s[u].playout.start)>.005||Math.abs(c.playout.end-s[u].playout.end)>.005))&&(this.items=r,this.onScheduleUpdate(t,s))}}parseDateRanges(e,t,n){const i=[],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 Tc(c,t),this.eventMap[o]=u,n===!1&&(u.appendInPlace=n)),i.push(u)}}return i}parseSchedule(e,t){const n=[],i=t.main.details,s=i.live?1/0:i.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 d=h.cue.pre,v=h.cue.post,E=e[f-1]||null,D=h.appendInPlace,S=v?s:h.startOffset,B=h.duration,ne=h.timelineOccupancy===er.Range?B:0,J=h.resumptionOffset,me=(E==null?void 0:E.startTime)===S,Le=S+h.cumulativeDuration;let ze=D?Le+B:S+J;if(d||!v&&S<=0){const Ne=u;u+=ne,h.timelineStart=Le;const Me=r;r+=B,n.push({event:h,start:Le,end:ze,playout:{start:Me,end:r},integrated:{start:Ne,end:u}})}else if(S<=s){if(!me){const Re=S-c;if(Re>xo){const Qe=c,yt=u;u+=Re;const At=r;r+=Re;const Ct={previousEvent:e[f-1]||null,nextEvent:h,start:Qe,end:Qe+Re,playout:{start:At,end:r},integrated:{start:yt,end:u}};n.push(Ct)}else Re>0&&E&&(E.cumulativeDuration+=Re,n[n.length-1].end=S)}v&&(ze=Le),h.timelineStart=Le;const Ne=u;u+=ne;const Me=r;r+=B,n.push({event:h,start:Le,end:ze,playout:{start:Me,end:r},integrated:{start:Ne,end:u}})}else return;const De=h.resumeTime;v||De>s?c=s:c=De}),c<s){var o;const h=c,f=u,d=s-c;u+=d;const v=r;r+=d,n.push({previousEvent:((o=n[n.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:h+d,playout:{start:v,end:r},integrated:{start:f,end:u}})}this.setDurations(s,r,u)}else n.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 n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){const n=t.main.details,i=n.live?1/0:n.edge;let s=0,r=-1;e.forEach((o,c)=>{const u=o.cue.pre,h=o.cue.post,f=u?0:h?i:o.startTime;this.updateAssetDurations(o),r===f?o.cumulativeDuration=s:(s=0,r=f),!h&&o.snapOptions.in&&(o.resumeAnchor=ei(null,n.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<xo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const v=T(o.resumeOffset)?o.resumeOffset:o.duration;s+=v})}primaryCanResumeInPlaceAt(e,t){const n=e.resumeTime,i=e.startTime+e.resumptionOffset;return Math.abs(n-i)>bs?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${i}`),!1):!Object.keys(t).some(r=>{const o=t[r].details,c=o.edge;if(n>=c)return this.log(`"${e.identifier}" resumption ${n} past ${r} playlist end ${c}`),!1;const u=ei(null,o.fragments,n);if(!u)return this.log(`"${e.identifier}" resumption ${n} 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-n)<bs+h||Math.abs(u.end-n)<bs+h?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${r} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let n=0,i=!1,s=!1;for(let r=0;r<e.assetList.length;r++){const o=e.assetList[r],c=t+n;o.startOffset=n,o.timelineStart=c,i||(i=o.duration===null),s||(s=!!o.error);const u=o.error?0:o.duration||0;n+=u}i&&!s?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function fi(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class Dc{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const n=e.assetListUrl;let i;try{i=bo(n,this.hls.sessionId,e.baseUrl)}catch(d){const v=this.assignAssetListError(e,H.ASSET_LIST_LOAD_ERROR,d,n);this.hls.trigger(p.ERROR,v);return}t&&i.protocol!=="data:"&&i.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=s.loader,o=new r(s),c={responseType:"json",url:i.href},u=s.interstitialAssetListLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,v,E,D)=>{const S=d.data,B=S==null?void 0:S.ASSETS;if(!Array.isArray(B)){const ne=this.assignAssetListError(e,H.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),E.url,v,D);this.hls.trigger(p.ERROR,ne);return}e.assetListResponse=S,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:S,networkDetails:D})},onError:(d,v,E,D)=>{const S=this.assignAssetListError(e,H.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${d.code} ${d.text} (${v.url})`),v.url,D,E);this.hls.trigger(p.ERROR,S)},onTimeout:(d,v,E)=>{const D=this.assignAssetListError(e,H.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${v.url})`),v.url,d,E);this.hls.trigger(p.ERROR,D)}};return o.load(c,h,f),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,n,i,s,r){return e.error=n,{type:oe.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:n,networkDetails:r,stats:s}}}function To(a){a==null||a.play().catch(()=>{})}function tr(a,e){return`[${a}] Advancing timeline position to ${e}`}class Rc extends L{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled||!this.schedule)return;const i=n-this.timelinePos;if(Math.abs(i)<1/7056e5)return;const r=i<=-.01;this.timelinePos=n,this.bufferedPos=n;const o=this.playingItem;if(!o){this.checkBuffer();return}if(r&&this.schedule.resetErrorsInRange(n,n-i)&&this.updateSchedule(!0),this.checkBuffer(),r&&n<o.start||n>=o.end){var c;const v=this.findItemIndex(o);let E=this.schedule.findItemIndexAtTime(n);if(E===-1&&(E=v+(r?-1:1),this.log(`seeked ${r?"back ":""}to position not covered by schedule ${n} (resolving from ${v} to ${E})`)),!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r&&E>v){const D=this.schedule.findJumpRestrictedIndex(v+1,E);if(D>v){this.setSchedulePosition(D);return}}this.setSchedulePosition(E);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const v=o.event.assetList[0];v&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(n,v))}return}const h=u.timelineStart,f=u.duration||0;if(r&&n<h||n>=h+f){var d;(d=o.event)!=null&&d.appendInPlace&&(this.clearInterstitial(o.event,o),this.flushFrontBuffer(n)),this.setScheduleToAssetAtTime(n,u)}},this.onTimeupdate=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;if(n>this.timelinePos)this.timelinePos=n,n>this.bufferedPos&&this.checkBuffer();else return;const i=this.playingItem;if(!i||this.playingLastItem)return;if(n>=i.end){this.timelinePos=i.end;const o=this.findItemIndex(i);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const r=s.timelineStart+(s.duration||0);n>=r&&this.setScheduleToAssetAtTime(n,s)},this.onScheduleUpdate=(n,i)=>{const s=this.schedule;if(!s)return;const r=this.playingItem,o=s.events||[],c=s.items||[],u=s.durations,h=n.map(D=>D.identifier),f=!!(o.length||h.length);(f||i)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(D=>fi(D))} pos: ${this.timelinePos}`),h.length&&this.log(`Removed events ${h}`);let d=null,v=null;r&&(d=this.updateItem(r,this.timelinePos),this.itemsMatch(r,d)?this.playingItem=d:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const E=this.bufferingItem;if(E&&(v=this.updateItem(E,this.bufferedPos),this.itemsMatch(E,v)?this.bufferingItem=v:E.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(E.event,null))),n.forEach(D=>{D.assetList.forEach(S=>{this.clearAssetPlayer(S.identifier,null)})}),this.playerQueue.forEach(D=>{if(D.interstitial.appendInPlace){const S=D.assetItem.timelineStart,B=D.timelineOffset-S;if(B)try{D.timelineOffset=S}catch(ne){Math.abs(B)>bs&&this.warn(`${ne} ("${D.assetId}" ${D.timelineOffset}->${S})`)}}}),f||i){if(this.hls.trigger(p.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}r&&this.trimInPlace(d,r),E&&v!==d&&this.trimInPlace(v,E),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Dc(e),this.schedule=new wc(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(p.MEDIA_ENDED,this.onMediaEnded,this),e.on(p.ERROR,this.onError,this),e.on(p.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(p.MEDIA_ENDED,this.onMediaEnded,this),e.off(p.ERROR,this.onError,this),e.off(p.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.schedule=this.manager=null,this.hls=this.HlsPlayerClass=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){Zn(e,"play",this.onPlay),Zn(e,"pause",this.onPause),Zn(e,"seeking",this.onSeeking),Zn(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const n=this.media=t.media;Hn(n,"seeking",this.onSeeking),Hn(n,"timeupdate",this.onTimeupdate),Hn(n,"play",this.onPlay),Hn(n,"pause",this.onPause)}onMediaAttached(e,t){const n=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!i){this.clearScheduleState();const s=this.findItemIndex(n);this.setSchedulePosition(s)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(this.media=null,!n&&(i&&this.removeMediaListeners(i),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.log(`Removing schedule state for detachedData and ${s}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,n=f=>f&&e.getAssetPlayer(f.identifier),i=(f,d,v,E,D)=>{if(f){let S=f[d].start;const B=f.event;if(B){if(d==="playout"||B.timelineOccupancy!==er.Point){const ne=n(v);(ne==null?void 0:ne.interstitial)===B&&(S+=ne.assetItem.startOffset+ne[D])}}else{const ne=E==="bufferedPos"?r():e[E];S+=ne-f.start}return S}return 0},s=(f,d)=>{var v;if(f!==0&&d!=="primary"&&(v=e.schedule)!=null&&v.length){var E;const D=e.schedule.findItemIndexAtTime(f),S=(E=e.schedule.items)==null?void 0:E[D];if(S){const B=S[d].start-S.start;return f+B}}return f},r=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?o("primary"):Math.max(f,0)},o=f=>{var d,v;return(d=e.primaryDetails)!=null&&d.live?e.primaryDetails.edge:((v=e.schedule)==null?void 0:v.durations[f])||0},c=(f,d)=>{var v,E;const D=e.effectivePlayingItem;if(D!=null&&(v=D.event)!=null&&v.restrictions.skip||!e.schedule)return;e.log(`seek to ${f} "${d}"`);const S=e.effectivePlayingItem,B=e.schedule.findItemIndexAtTime(f,d),ne=(E=e.schedule.items)==null?void 0:E[B],J=e.getBufferingPlayer(),me=J==null?void 0:J.interstitial,Le=me==null?void 0:me.appendInPlace,ze=S&&e.itemsMatch(S,ne);if(S&&(Le||ze)){const De=n(e.playingAsset),Ne=(De==null?void 0:De.media)||e.primaryMedia;if(Ne){const Me=d==="primary"?Ne.currentTime:i(S,d,e.playingAsset,"timelinePos","currentTime"),Re=f-Me,Qe=(Le?Me:Ne.currentTime)+Re;if(Qe>=0&&(!De||Le||Qe<=De.duration)){Ne.currentTime=Qe;return}}}if(ne){let De=f;if(d!=="primary"){const Me=ne[d].start,Re=f-Me;De=ne.start+Re}const Ne=!e.isInterstitial(ne);if((!e.isInterstitial(S)||S.event.appendInPlace)&&(Ne||ne.event.appendInPlace)){const Me=e.media||(Le?J==null?void 0:J.media:null);Me&&(Me.currentTime=De)}else if(S){const Me=e.findItemIndex(S);if(B>Me){const Qe=e.schedule.findJumpRestrictedIndex(Me+1,B);if(Qe>Me){e.setSchedulePosition(Qe);return}}let Re=0;if(Ne)e.timelinePos=De,e.checkBuffer();else{const Qe=ne.event.assetList,yt=f-(ne[d]||ne).start;for(let At=Qe.length;At--;){const Ct=Qe[At];if(Ct.duration&&yt>=Ct.startOffset&&yt<Ct.startOffset+Ct.duration){Re=At;break}}}e.setSchedulePosition(B,Re)}}},u=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const d=t();return e.isInterstitial(d)?d:null},h={get bufferedEnd(){const f=t(),d=e.bufferingItem;if(d&&d===f){var v;return i(d,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-d.playout.start||((v=e.bufferingAsset)==null?void 0:v.startOffset)||0}return 0},get currentTime(){const f=u(),d=e.effectivePlayingItem;return d&&d===f?i(d,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-d.playout.start:0},set currentTime(f){const d=u(),v=e.effectivePlayingItem;v&&v===d&&c(f+v.playout.start,"playout")},get duration(){const f=u();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const d=(f=u())==null?void 0:f.event.assetList;return d?d.map(v=>e.getAssetPlayer(v.identifier)):[]},get playingIndex(){var f;const d=(f=u())==null?void 0:f.event;return d&&e.effectivePlayingAsset?d.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};return this.manager={get events(){var f;return((f=e.schedule)==null||(f=f.events)==null?void 0:f.slice(0))||[]},get schedule(){var f;return((f=e.schedule)==null||(f=f.items)==null?void 0:f.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 i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(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,d=f==null?void 0:f.event;if(d&&!d.restrictions.skip){const v=e.findItemIndex(f);if(d.appendInPlace){const E=f.playout.start+f.event.duration;c(E+.001,"playout")}else e.advanceAfterAssetEnded(d,v,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,n=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!n?!1:this.findItemIndex(t)===n.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(i=this.primaryMedia);const s=(t=i)==null?void 0:t.currentTime;if(!(s===void 0||!T(s)))return s}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){const n=e.interstitial.appendInPlace,i=e.media;if(n&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i){this.detachedData={media:i};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Pt(s)}`),this.detachedData=s}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var n,i;if(e.media===t)return;let s=null;const r=this.hls,o=e!==r,c=o&&e.interstitial.appendInPlace,u=(n=this.detachedData)==null?void 0:n.mediaSource;let h;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),h="Primary";else if(u){const E=this.getBufferingPlayer();E?(s=E.transferMedia(),h=`${E}`):h="detached MediaSource"}else h="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${Pt(s)}`);else if(!this.detachedData||r.media===t){const E=this.playerQueue;E.length>1&&E.forEach(D=>{if(o&&D.interstitial.appendInPlace!==c){const S=D.interstitial;this.clearInterstitial(D.interstitial,null),S.appendInPlace=!1,S.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${S}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=s&&"mediaSource"in s&&((i=s.mediaSource)==null?void 0:i.readyState)!=="closed",d=f&&s?s:t;this.log(`${f?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${h} (media.currentTime: ${t.currentTime})`);const v=this.schedule;if(d===s&&v){const E=o&&e.assetId===v.assetIdAtEnd;d.overrides={duration:v.duration,endOfStream:!o||E,cueRemoval:!o}}e.attachMedia(d)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e==null?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const n=this.timelinePos,i=this.effectivePlayingItem;if(n===-1){const s=this.hls.startPosition;if(this.log(tr("checkStart",s)),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(i&&!this.playingItem){const s=e.findItemIndex(i);this.setSchedulePosition(s)}}advanceAssetBuffering(e,t){const n=e.event,i=n.findAssetIndex(t),s=Ur(n,i);if(!n.isAssetPastPlayoutLimit(s))this.bufferedToEvent(e,s);else if(this.schedule){var r;const o=(r=this.schedule.items)==null?void 0:r[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,n){const i=Ur(e,n);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){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.log(tr("advanceAfterAssetEnded",c)),this.timelinePos=c,e.appendInPlace&&this.advanceInPlace(c),this.checkBuffer(this.bufferedPos<c)),this.setSchedulePosition(r)}}}else{if(e.appendInPlace){const s=e.assetList[i];s&&this.advanceInPlace(s.timelineStart)}this.setSchedulePosition(t,i)}}setScheduleToAssetAtTime(e,t){const n=this.schedule;if(!n)return;const i=t.parentIdentifier,s=n.getEvent(i);if(s){const r=n.findEventIndex(i),o=n.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,r,o-1)}}setSchedulePosition(e,t){var n;const i=(n=this.schedule)==null?void 0:n.items;if(!i||this.playbackDisabled)return;const s=e>=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${s&&fi(s)}) pos: ${this.timelinePos}`);const r=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(r)){const h=r.event,f=this.playingAsset,d=f==null?void 0:f.identifier,v=d?this.getAssetPlayer(d):null;if(v&&d&&(!this.eventItemsMatch(r,s)||t!==void 0&&d!==h.assetList[t].identifier)){var c;const E=h.findAssetIndex(f);if(this.log(`INTERSTITIAL_ASSET_ENDED ${E+1}/${h.assetList.length} ${xs(f)}`),this.endedAsset=f,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:E,event:h,schedule:i.slice(0),scheduleIndex:e,player:v}),r!==this.playingItem){this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(h,this.findItemIndex(this.playingItem),E);return}this.retreiveMediaSource(d,s),v.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&v.detachMedia()}if(!this.eventItemsMatch(r,s)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${h} ${fi(r)}`),h.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:h,schedule:i.slice(0),scheduleIndex:e}),h.cue.once)){var u;this.updateSchedule();const E=(u=this.schedule)==null?void 0:u.items;if(s&&E){const D=this.findItemIndex(s);this.advanceSchedule(D,E,t,r,o)}return}}this.advanceSchedule(e,i,t,r,o)}advanceSchedule(e,t,n,i,s){const r=this.schedule;if(!r)return;const o=t[e]||null,c=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach(h=>{const f=h.interstitial,d=r.findEventIndex(f.identifier);(d<e||d>e+1)&&this.clearInterstitial(f,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const h=o.event;if(n===void 0){n=r.findAssetIndex(h,this.timelinePos);const E=Ur(h,n-1);if(h.isAssetPastPlayoutLimit(E)||h.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(h,e,n);return}n=E}const f=this.waitingItem;this.assetsBuffered(o,c)||this.setBufferingItem(o);let d=this.preloadAssets(h,n);if(this.eventItemsMatch(o,f||i)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${fi(o)} ${h.appendInPlace?"append in place":""}`),this.hls.trigger(p.INTERSTITIAL_STARTED,{event:h,schedule:t.slice(0),scheduleIndex:e})),!h.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${h}`);return}if(h.assetListLoader&&(h.assetListLoader.destroy(),h.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${h}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const v=h.assetList[n];if(!v){this.advanceAfterAssetEnded(h,e,n||0);return}if(d||(d=this.getAssetPlayer(v.identifier)),d===null||d.destroyed){const E=h.assetList.length;this.warn(`asset ${n+1}/${E} player destroyed ${h}`),d=this.createAssetPlayer(h,v,n),d.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&h.appendInPlace&&this.isAssetBuffered(v))return;this.startAssetPlayer(d,n,t,e,c),this.shouldPlay&&To(d.media)}else o?(this.resumePrimary(o,e,i),this.shouldPlay&&To(this.hls.media)):s&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(r.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,n){var i,s;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${fi(e)}`),!((i=this.detachedData)!=null&&i.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(tr("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!n)return;const r=(s=this.schedule)==null?void 0:s.items;r&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${fi(e)}`),this.hls.trigger(p.INTERSTITIALS_PRIMARY_RESUMED,{schedule:r.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const n=e.start;if(this.primaryLive){const i=this.primaryDetails;if(t===0)return this.hls.startPosition;if(i&&(n<i.fragmentStart||n>i.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:Ot.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,i),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(tr("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){var n;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs((((n=i.mainForwardBufferInfo)==null?void 0:n.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.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(p.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(p.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const n=this.hls.levels[t.level],i=m(m({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const n=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=m(m({},this.altSelection),{},{audio:n});return}const s=m(m({},i),{},{audio:n});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const n=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=m(m({},this.altSelection),{},{subtitles:n});return}const s=m(m({},i),{},{subtitles:n});this.mediaSelection=s}onAudioTrackSwitching(e,t){const n=Nn(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setAudioOption(t)||i.setAudioOption(n)))}onSubtitleTrackSwitch(e,t){const n=Nn(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setSubtitleOption(t)||t.id!==-1&&i.setSubtitleOption(n)))}onBufferCodecs(e,t){const n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let i=0;i<t.length;i++){const s=t[i];if(s.cue.post){var n;const r=this.schedule.findEventIndex(s.identifier),o=(n=this.schedule.items)==null?void 0:n[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 n=this.findItemIndex(t);this.setSchedulePosition(n+1)}else this.shouldPlay=!1}updateItem(e,t){var n;const i=(n=this.schedule)==null?void 0:n.items;if(e&&i){const s=this.findItemIndex(e,t);return i[s]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((s,r)=>{e.event.isAssetPastPlayoutLimit(r)&&this.clearAssetPlayer(s.identifier,null)});const n=e.end+.25,i=Ot.bufferInfo(this.primaryMedia,n,0);(i.end>n||(i.nextStart||0)>n)&&(this.log(`trim buffered interstitial ${fi(e)} (was ${fi(t)})`),this.attachPrimary(n,null,!0),this.flushFrontBuffer(n))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var n;return!!t&&(e===t||e.event.identifier===((n=t.event)==null?void 0:n.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const n=this.mediaSelection;n&&((t=this.schedule)==null||t.updateSchedule(n,[],e))}checkBuffer(e){var t;const n=(t=this.schedule)==null?void 0:t.items;if(!n)return;const i=Ot.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,n,e)}updateBufferedPos(e,t,n){const i=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const r=this.playingItem,o=this.findItemIndex(r);let c=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var u;const h=this.findItemIndex(s),f=Math.min(h+1,t.length-1),d=t[f];if((c===-1&&s&&e>=s.end||(u=d.event)!=null&&u.appendInPlace&&e+.01>=d.start)&&(c=f),this.isInterstitial(s)){const v=s.event;if(f-o>1&&v.appendInPlace===!1||v.assetList.length===0&&v.assetListLoader)return}if(this.bufferedPos=e,c>h&&c>o)this.bufferedToItem(d);else{const v=this.primaryDetails;this.primaryLive&&v&&e>v.edge-v.targetduration&&d.start<v.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(d)&&this.preloadAssets(d.event,0)}}else n&&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(i=>{const s=this.getAssetPlayer(i.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,t)&&n){const{items:i,events:s}=n;if(!i||!s)return t;const r=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${fi(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(r){const u=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((h,f)=>{const d=this.getAssetPlayer(h.identifier);d&&(f===u&&d.loadSource(),d.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering());this.hls.trigger(p.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;const i=this.detachedData;i?i.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){const n=e.event,i=n.assetList.length===0&&!n.assetListLoader,s=n.cue.once;if(i||!s){const r=this.preloadAssets(n,t);if(r!=null&&r.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(r,o)}}}preloadAssets(e,t){const n=e.assetUrl,i=e.assetList.length,s=i===0&&!e.assetListLoader,r=e.cue.once;if(s){const c=e.timelineStart;if(e.appendInPlace){var o;const d=this.playingItem;!this.isInterstitial(d)&&(d==null||(o=d.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 d=h-c;d>0&&(u=Math.round(d*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:i} ${e}${u?` live-start: ${h} start-offset: ${u}`:""}`),n)return this.createAsset(e,0,0,c,e.duration,n);const f=this.assetListLoader.loadAssetList(e,u);f&&(e.assetListLoader=f)}else if(!r&&i){for(let u=t;u<i;u++){const h=e.assetList[u],f=this.getAssetPlayerQueueIndex(h.identifier);(f===-1||this.playerQueue[f].destroyed)&&!h.error&&this.createAssetPlayer(e,h,u)}const c=e.assetList[t];if(c){const u=this.getAssetPlayer(c.identifier);return u&&u.loadSource(),u}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(i=>{this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,i,s,r){const o={parentIdentifier:e.identifier,identifier:xc(e,r,t),duration:s,startOffset:n,timelineStart:i,uri:r};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,n){const i=this.hls,s=i.userConfig;let r=s.videoPreference;const o=i.loadLevelObj||i.levels[i.currentLevel];(r||o)&&(r=g({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const c=i.audioTracks[i.audioTrack],u=i.subtitleTracks[i.subtitleTrack];let h=0;if(this.primaryLive||e.appendInPlace){const me=this.timelinePos-t.timelineStart;if(me>1){const Le=t.duration;Le&&me<Le&&(h=me)}}const f=t.identifier,d=m(m({},s),{},{maxMaxBufferLength:Math.min(180,i.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:i.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&&(d.timelineOffset=t.timelineStart));const v=d.cmcd;v!=null&&v.sessionId&&v.contentId&&(d.cmcd=g({},v,{contentId:Us(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const E=new Ac(this.HlsPlayerClass,d,e,t);this.playerQueue.push(E),e.assetList[n]=t;let D=!0;const S=me=>{if(me.live){var Le;const Ne=new Error(`Interstitials MUST be VOD assets ${e}`),Me={fatal:!0,type:oe.OTHER_ERROR,details:H.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ne},Re=((Le=this.schedule)==null?void 0:Le.findEventIndex(e.identifier))||-1;this.handleAssetItemError(Me,e,Re,n,Ne.message);return}const ze=me.edge-me.fragmentStart,De=t.duration;(D||De===null||ze>De)&&(D=!1,this.log(`Interstitial asset "${f}" duration change ${De} > ${ze}`),t.duration=ze,this.updateSchedule())};E.on(p.LEVEL_UPDATED,(me,{details:Le})=>S(Le)),E.on(p.LEVEL_PTS_UPDATED,(me,{details:Le})=>S(Le)),E.on(p.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const B=(me,Le)=>{const ze=this.getAssetPlayer(f);if(ze&&Le.tracks){ze.off(p.BUFFER_CODECS,B),ze.tracks=Le.tracks;const De=this.primaryMedia;this.bufferingAsset===ze.assetItem&&De&&!ze.media&&this.bufferAssetPlayer(ze,De)}};E.on(p.BUFFER_CODECS,B);const ne=()=>{var me;const Le=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${Le}`),!Le||!this.schedule)return;const ze=this.schedule.findEventIndex(e.identifier),De=(me=this.schedule.items)==null?void 0:me[ze];this.isInterstitial(De)&&this.advanceAssetBuffering(De,t)};E.on(p.BUFFERED_TO_END,ne);const J=me=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const ze=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,ze,me)};return E.once(p.MEDIA_ENDED,J(n)),E.once(p.PLAYOUT_LIMIT_REACHED,J(1/0)),E.on(p.ERROR,(me,Le)=>{if(!this.schedule)return;const ze=this.getAssetPlayer(f);if(Le.details===H.BUFFER_STALLED_ERROR){if(ze!=null&&ze.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(Le,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${Le.error} ${e}`)}),E.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const Le=new Error(`Asset player destroyed unexpectedly ${f}`),ze={fatal:!0,type:oe.OTHER_ERROR,details:H.INTERSTITIAL_ASSET_ITEM_ERROR,error:Le};this.handleAssetItemError(ze,e,this.schedule.findEventIndex(e.identifier),n,Le.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${xs(t)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:E}),E}clearInterstitial(e,t){e.assetList.forEach(n=>{this.clearAssetPlayer(n.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){const i=this.playerQueue[n];this.log(`clear ${i} toSegment: ${t&&fi(t)}`),this.transferMediaFromPlayer(i,t),this.playerQueue.splice(n,1),i.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,i,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,n[i]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${xs(o)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:r,schedule:n.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var n,i;if(!this.schedule)return;const{interstitial:s,assetItem:r}=e,o=this.schedule.findEventIndex(s.identifier),c=(n=this.schedule.items)==null?void 0:n[o];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=r;const u=this.getBufferingPlayer();if(u===e)return;const h=s.appendInPlace;if(h&&(u==null?void 0:u.interstitial.appendInPlace)===!1)return;const f=(u==null?void 0:u.tracks)||((i=this.detachedData)==null?void 0:i.tracks)||this.requiredTracks;if(h&&r!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(f&&!ye(f,e.tracks)){const d=new Error(`Asset ${xs(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),v={fatal:!0,type:oe.OTHER_ERROR,details:H.INTERSTITIAL_ASSET_ITEM_ERROR,error:d},E=s.findAssetIndex(r);this.handleAssetItemError(v,s,o,E,d.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,n=this.primaryMedia;if(!t||!n)return;const i=n.currentTime,s=t.findAssetIndex(e,i),r=e.assetList[s];if(r){const o=this.getAssetPlayer(r.identifier);if(o){const c=o.currentTime||i-r.timelineStart,u=o.duration-c;if(this.warn(`Stalled at ${c} of ${c+u} in ${o} ${e} (media.currentTime: ${i})`),c&&(u/n.playbackRate<.5||o.bufferedInPlaceToEnd(n))&&o.hls){const h=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,h,s)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,n,i,s){if(e.details===H.BUFFER_STALLED_ERROR)return;const r=t.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${r&&xs(r)} ${e.error}`),!this.schedule)return;const o=(r==null?void 0:r.identifier)||"",c=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[c]||null,h=this.schedule.items,f=g({},e,{fatal:!1,errorAction:li(!0),asset:r,assetListIndex:i,event:t,schedule:h,scheduleIndex:n,player:u});if(this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const d=this.playingAsset,v=this.bufferingAsset,E=new Error(s);if(r&&(this.clearAssetPlayer(o,null),r.error=E),!t.assetList.some(D=>!D.error))t.error=E;else for(let D=i;D<t.assetList.length;D++)this.resetAssetPlayer(t.assetList[D].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):d&&d.identifier===o?this.advanceAfterAssetEnded(t,n,i):v&&v.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,v)}primaryFallback(e){const t=e.timelineStart,n=this.effectivePlayingItem;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${fi(n)} error: ${e.error}`);let i=this.timelinePos;i===-1&&(i=this.hls.startPosition);const s=this.updateItem(n,i);if(this.itemsMatch(n,s)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const r=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(r)}else this.checkStart()}onAssetListLoaded(e,t){var n,i;const s=t.event,r=s.identifier,o=t.assetListResponse.ASSETS;if(!((n=this.schedule)!=null&&n.hasEvent(r)))return;const c=s.timelineStart,u=s.duration;let h=0;o.forEach((D,S)=>{const B=parseFloat(D.DURATION);this.createAsset(s,S,h,c+h,B,D.URI),h+=B}),s.duration=h,this.log(`Loaded asset-list with duration: ${h} (was: ${u}) ${s}`);const f=this.waitingItem,d=(f==null?void 0:f.event.identifier)===r;this.updateSchedule();const v=(i=this.bufferingItem)==null?void 0:i.event;if(d){var E;const D=this.schedule.findEventIndex(r),S=(E=this.schedule.items)==null?void 0:E[D];if(S){if(!this.playingItem&&this.timelinePos>S.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==D){s.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${s}`),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(S)}this.setSchedulePosition(D)}else if((v==null?void 0:v.identifier)===r){const D=s.assetList[0];if(D){const S=this.getAssetPlayer(D.identifier);if(v.appendInPlace){const B=this.primaryMedia;S&&B&&this.bufferAssetPlayer(S,B)}else S&&S.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case H.ASSET_LIST_PARSING_ERROR:case H.ASSET_LIST_LOAD_ERROR:case H.ASSET_LIST_LOAD_TIMEOUT:{const n=t.interstitial;n&&(this.updateSchedule(!0),this.primaryFallback(n));break}case H.BUFFER_STALLED_ERROR:{const n=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&n.event.appendInPlace){this.handleInPlaceStall(n.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const So=500;class Ic extends dr{constructor(e,t,n){super(e,t,n,"subtitle-stream-controller",te.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(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=Je.IDLE,this.setInterval(So),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:n,success:i}=t;if(this.fragContextChanged(n)||(Ee(n)&&(this.fragPrevious=n),this.state=Je.IDLE),!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const o=n.start;for(let u=0;u<s.length;u++)if(o>=s[u].start&&o<=s[u].end){r=s[u];break}const c=n.start+n.duration;r?r.end=c:(r={start:o,end:c},s.push(r)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:n,endOffset:i}=t;if(n===0&&i!==Number.POSITIVE_INFINITY){const s=i-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(n,s,te.SUBTITLE)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===te.SUBTITLE&&(t.details===H.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Je.STOPPED&&(this.state=Je.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Qa(this.levels,t)){this.levels=t.map(n=>new En(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new En(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,te.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==Je.STOPPED&&this.setInterval(So)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,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||(n=c.details)!=null&&n.live){if(r.deltaUpdateFailed)return;const f=this.mainDetails;if(!f){this.startFragRequested=!1;return}const d=f.fragments[0];if(!c.details)r.hasProgramDateTime&&f.hasProgramDateTime?(Ks(r,f),u=r.fragmentStart):d&&(u=d.start,fr(r,u));else{var h;u=this.alignPlaylists(r,c.details,(h=this.levelLastLoaded)==null?void 0:h.details),u===0&&d&&(u=d.start,fr(r,u))}f&&!this.startFragRequested&&this.setStartPosition(f,u)}c.details=r,this.levelLastLoaded=c,o===i&&(this.hls.trigger(p.SUBTITLE_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===Je.IDLE&&(ei(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:n}=e,i=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&_i(i.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer,Bn(i.method)).catch(o=>{throw s.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();s.trigger(p.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:r,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=Je.IDLE})}}doTick(){if(!this.media){this.state=Je.IDLE;return}if(this.state===Je.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;const{config:i}=this,s=this.getLoadPosition(),r=Ot.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:o,len:c}=r,u=n.details,h=this.hls.maxBufferLength+u.levelTargetDuration;if(c>h)return;const f=u.fragments,d=f.length,v=u.edge;let E=null;const D=this.fragPrevious;if(o<v){const ne=i.maxFragLookUpTolerance,J=o>v-ne?0:ne;E=ei(D,f,Math.max(f[0].start,o),J),!E&&D&&D.start<f[0].start&&(E=f[0])}else E=f[d-1];if(E=this.filterReplacedPrimary(E,n.details),!E)return;const S=E.sn-u.startSN,B=f[S-1];if(B&&B.cc===E.cc&&this.fragmentTracker.getState(B)===un.NOT_LOADED&&(E=B),this.fragmentTracker.getState(E)===un.NOT_LOADED){const ne=this.mapToInitFragWhenRequired(E);ne&&this.loadFragment(ne,n,o)}}}loadFragment(e,t,n){Ee(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Lc(this.tracksBuffered[this.currentTrackId]||[])}}class Lc{constructor(e){this.buffered=void 0;const t=(n,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}const Cc={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},Ao=a=>String.fromCharCode(Cc[a]||a),di=15,Mi=100,kc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Pc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Fc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Oc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Nc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Mc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;ee.log(`${this.time} [${e}] ${n}`)}}}const ss=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class wo{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class Bc{constructor(){this.uchar=" ",this.penState=new wo}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 Uc{constructor(e){this.chars=[],this.pos=0,this.currPenState=new wo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Mi;t++)this.chars.push(new Bc);this.logger=e}equals(e){for(let t=0;t<Mi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Mi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Mi;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>Mi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Mi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Ao(e);if(this.pos>=Mi){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<Mi;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let n=0;n<Mi;n++){const i=this.chars[n].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class $r{constructor(e){this.rows=[],this.currRow=di-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<di;t++)this.rows.push(new Uc(e));this.logger=e}reset(){for(let e=0;e<di;e++)this.rows[e].clear();this.currRow=di-1}equals(e){let t=!0;for(let n=0;n<di;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<di;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<di;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 = "+Pt(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<di;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 n=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,r=Math.max(s-1,0);n.setCursor(e.indent),e.color=n.chars[r].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Pt(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let n="",i=-1;for(let s=0;s<di;s++){const r=this.rows[s].getTextString();r&&(i=s+1,e?t.push("Row "+i+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
`)),n}getTextAndFormat(){return this.rows}}class Do{constructor(e,t,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new $r(n),this.nonDisplayedMemory=new $r(n),this.lastOutputScreen=new $r(n),this.currRollUpRow=this.displayedMemory.rows[di-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[di-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}this.logger.log(2,"MIDROW: "+Pt(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 Ro{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Gc(),this.logger=void 0;const i=this.logger=new Mc;this.channels=[null,new Do(e,t,i),new Do(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const i=t[n]&127,s=t[n+1]&127;let r=!1,o=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+ss([t[n],t[n+1]])+"] -> ("+ss([i,s])+")");const c=this.cmdHistory;if(i>=16&&i<=31){if($c(i,s,c)){nr(null,null,c),this.logger.log(3,()=>"Repeated command ("+ss([i,s])+") is dropped");continue}nr(i,s,this.cmdHistory),r=this.parseCmd(i,s),r||(r=this.parseMidrow(i,s)),r||(r=this.parsePAC(i,s)),r||(r=this.parseBackgroundAttributes(i,s))}else nr(null,null,c);if(!r&&(o=this.parseChars(i,s),o)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+ss([i,s])+" orig: "+ss([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(n||i))return!1;const 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 n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+ss([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(i||s))return!1;const r=e<=23?1:2;t>=64&&t<=95?n=r===1?kc[e]:Fc[e]:n=r===1?Pc[e]:Oc[e];const o=this.channels[r];return o?(o.setPAC(this.interpretPAC(n,t)),this.currentChannel=r,!0):!1}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,t){let n,i=null,s=null;if(e>=25?(n=2,s=e-8):(n=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 '"+Ao(r)+"' in channel "+n),i=[r]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+ss(i).join(",")),i}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(n||i))return!1;let s;const r={};e===16||e===24?(s=Math.floor((t-32)/2),r.background=Nc[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()}nr(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function nr(a,e,t){t.a=a,t.b=e}function $c(a,e,t){return t.a===a&&t.b===e}function Gc(){return{a:null,b:null}}var Gr=function(){if(Pi!=null&&Pi.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 n(o){return t(a,o)}function i(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 d="",v=!1,E=o,D=c,S=u,B=null,ne="",J=!0,me="auto",Le="start",ze=50,De="middle",Ne=50,Me="middle";Object.defineProperty(h,"id",s({},f,{get:function(){return d},set:function(Re){d=""+Re}})),Object.defineProperty(h,"pauseOnExit",s({},f,{get:function(){return v},set:function(Re){v=!!Re}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return E},set:function(Re){if(typeof Re!="number")throw new TypeError("Start time must be set to a number.");E=Re,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",s({},f,{get:function(){return D},set:function(Re){if(typeof Re!="number")throw new TypeError("End time must be set to a number.");D=Re,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",s({},f,{get:function(){return S},set:function(Re){S=""+Re,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",s({},f,{get:function(){return B},set:function(Re){B=Re,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",s({},f,{get:function(){return ne},set:function(Re){const Qe=n(Re);if(Qe===!1)throw new SyntaxError("An invalid or illegal string was specified.");ne=Qe,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",s({},f,{get:function(){return J},set:function(Re){J=!!Re,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",s({},f,{get:function(){return me},set:function(Re){if(typeof Re!="number"&&Re!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");me=Re,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",s({},f,{get:function(){return Le},set:function(Re){const Qe=i(Re);if(!Qe)throw new SyntaxError("An invalid or illegal string was specified.");Le=Qe,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",s({},f,{get:function(){return ze},set:function(Re){if(Re<0||Re>100)throw new Error("Position must be between 0 and 100.");ze=Re,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",s({},f,{get:function(){return De},set:function(Re){const Qe=i(Re);if(!Qe)throw new SyntaxError("An invalid or illegal string was specified.");De=Qe,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",s({},f,{get:function(){return Ne},set:function(Re){if(Re<0||Re>100)throw new Error("Size must be between 0 and 100.");Ne=Re,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",s({},f,{get:function(){return Me},set:function(Re){const Qe=i(Re);if(!Qe)throw new SyntaxError("An invalid or illegal string was specified.");Me=Qe,this.hasBeenReset=!0}})),h.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class Kc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Io(a){function e(n,i,s,r){return(n|0)*3600+(i|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 Vc{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function Lo(a,e,t,n){const i=n?a.split(n):[a];for(const s in i){if(typeof i[s]!="string")continue;const r=i[s].split(t);if(r.length!==2)continue;const o=r[0],c=r[1];e(o,c)}}const Kr=new Gr(0,0,""),ir=Kr.align==="middle"?"middle":"center";function zc(a,e,t){const n=a;function i(){const o=Io(a);if(o===null)throw new Error("Malformed timestamp: "+n);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,c){const u=new Vc;Lo(o,function(d,v){let E;switch(d){case"region":for(let D=t.length-1;D>=0;D--)if(t[D].id===v){u.set(d,t[D].region);break}break;case"vertical":u.alt(d,v,["rl","lr"]);break;case"line":E=v.split(","),u.integer(d,E[0]),u.percent(d,E[0])&&u.set("snapToLines",!1),u.alt(d,E[0],["auto"]),E.length===2&&u.alt("lineAlign",E[1],["start",ir,"end"]);break;case"position":E=v.split(","),u.percent(d,E[0]),E.length===2&&u.alt("positionAlign",E[1],["start",ir,"end","line-left","line-right","auto"]);break;case"size":u.percent(d,v);break;case"align":u.alt(d,v,["start",ir,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let h=u.get("line","auto");h==="auto"&&Kr.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",ir);let f=u.get("position","auto");f==="auto"&&Kr.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=i(),r(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);a=a.slice(3),r(),e.endTime=i(),r(),s(a,e)}function Co(a){return a.replace(/<br(?: \/)?>/gi,`
`)}class Wc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Kc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function n(){let s=t.buffer,r=0;for(s=Co(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 i(s){Lo(s,function(r,o){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=n();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=n(),t.state){case"HEADER":/:/.test(s)?i(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 Gr(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{zc(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,Vr=function(e,t,n=0){return e.slice(n,n+t.length)===t},jc=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!T(t)||!T(n)||!T(i)||!T(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*i,t+=60*60*1e3*s,t};function zr(a,e,t){return Us(a.toString())+Us(e.toString())+Us(t)}const Yc=function(e,t,n){let i=e[t],s=e[i.prevCC];if(!s||!s.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(r=s)!=null&&r.new;){var r;e.ccOffset+=i.start-s.start,i.new=!1,i=s,s=e[i.prevCC]}e.presentationOffset=n};function Zc(a,e,t,n,i,s,r){const o=new Wc,c=Ge(new Uint8Array(a)).trim().replace(Hc,`
`).split(`
`),u=[],h=e?ru(e.baseTime,e.timescale):0;let f="00:00.000",d=0,v=0,E,D=!0;o.oncue=function(S){const B=t[n];let ne=t.ccOffset;const J=(d-h)/9e4;if(B!=null&&B.new&&(v!==void 0?ne=t.ccOffset=B.start:Yc(t,n,J)),J){if(!e){E=new Error("Missing initPTS for VTT MPEGTS");return}ne=J-t.presentationOffset}const me=S.endTime-S.startTime,Le=si((S.startTime+ne-v)*9e4,i*9e4)/9e4;S.startTime=Math.max(Le,0),S.endTime=Math.max(Le+me,0);const ze=S.text.trim();S.text=decodeURIComponent(encodeURIComponent(ze)),S.id||(S.id=zr(S.startTime,S.endTime,ze)),S.endTime>0&&u.push(S)},o.onparsingerror=function(S){E=S},o.onflush=function(){if(E){r(E);return}s(u)},c.forEach(S=>{if(D)if(Vr(S,"X-TIMESTAMP-MAP=")){D=!1,S.slice(16).split(",").forEach(B=>{Vr(B,"LOCAL:")?f=B.slice(6):Vr(B,"MPEGTS:")&&(d=parseInt(B.slice(7)))});try{v=jc(f)/1e3}catch(B){E=B}return}else S===""&&(D=!1);o.parse(S+`
`)}),o.flush()}const Wr="stpp.ttml.im1t",ko=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Po=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,qc={left:"start",center:"center",right:"end",start:"start",end:"end"};function Fo(a,e,t,n){const i=Y(new Uint8Array(a),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(o=>Ge(o)),r=su(e.baseTime,1,e.timescale);try{s.forEach(o=>t(Xc(o,r)))}catch(o){n(o)}}function Xc(a,e){const i=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(s).reduce((f,d)=>(f[d]=i.getAttribute(`ttp:${d}`)||s[d],f),{}),o=i.getAttribute("xml:space")!=="preserve",c=Oo(Hr(i,"styling","style")),u=Oo(Hr(i,"layout","region")),h=Hr(i,"body","[begin]");return[].map.call(h,f=>{const d=No(f,o);if(!d||!f.hasAttribute("begin"))return null;const v=Yr(f.getAttribute("begin"),r),E=Yr(f.getAttribute("dur"),r);let D=Yr(f.getAttribute("end"),r);if(v===null)throw Mo(f);if(D===null){if(E===null)throw Mo(f);D=v+E}const S=new Gr(v-e,D-e,d);S.id=zr(S.startTime,S.endTime,S.text);const B=u[f.getAttribute("region")],ne=c[f.getAttribute("style")],J=Qc(B,ne,c),{textAlign:me}=J;if(me){const Le=qc[me];Le&&(S.lineAlign=Le),S.align=me}return g(S,J),S}).filter(f=>f!==null)}function Hr(a,e,t){const n=a.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function Oo(a){return a.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function No(a,e){return[].slice.call(a.childNodes).reduce((t,n,i)=>{var s;return n.nodeName==="br"&&i?t+`
`:(s=n.childNodes)!=null&&s.length?No(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function Qc(a,e,t){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(i=t[r]),s.reduce((o,c)=>{const u=jr(e,n,c)||jr(a,n,c)||jr(i,n,c);return u&&(o[c]=u),o},{})}function jr(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Mo(a){return new Error(`Could not parse ttml timestamp ${a}`)}function Yr(a,e){if(!a)return null;let t=Io(a);return t===null&&(ko.test(a)?t=Jc(a,e):Po.test(a)&&(t=eh(a,e))),t}function Jc(a,e){const t=ko.exec(a),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function eh(a,e){const t=Po.exec(a),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class sr{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class th{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=$o(),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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new sr(this,"textTrack1"),t=new sr(this,"textTrack2"),n=new sr(this,"textTrack3"),i=new sr(this,"textTrack4");this.cea608Parser1=new Ro(1,e,t),this.cea608Parser2=new Ro(3,n,i)}addCues(e,t,n,i,s){let r=!1;for(let o=s.length;o--;){const c=s[o],u=nh(c[0],c[1],t,n);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],n),r=!0,u/(n-t)>.5))return}if(r||s.push([t,n]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,n,i)}else{const o=this.Cues.newCue(null,t,n,i);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s,trackId:r}){const{unparsedVttFrags:o}=this;n===te.MAIN&&(this.initPTS[t.cc]={baseTime:i,timescale:s,trackId:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded(p.FRAG_LOADED,c):this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const s=n.textTracks[i];if(Uo(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:n,media:i}=this,{label:s,languageCode:r}=t[e],o=this.getExistingTrack(s,r);if(o)n[e]=o,Es(n[e]),yo(n[e],i);else{const c=this.createTextTrack("captions",s,r);c&&(c[e]=!0,n[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,i={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const n=!!t.transferMedia;if(this.media=null,n)return;const{captionsTracks:i}=this;Object.keys(i).forEach(s=>{Es(i[s]),delete i[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=$o(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let n=0;n<t.length;n++)Es(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(s=>s.textCodec===Wr);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Qa(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const r=this.media,o=r?Js(r.textTracks):null;if(this.tracks.forEach((c,u)=>{let h;if(o){let f=null;for(let d=0;d<o.length;d++)if(o[d]&&Uo(o[d],c)){f=o[d],o[d]=null;break}f&&(h=f)}if(h)Es(h);else{const f=Bo(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(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const s=`textTrack${i[1]}`,r=this.captionsProperties[s];r&&(r.label=n.name,n.lang&&(r.languageCode=n.lang),r.media=n)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===te.MAIN){var n,i;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:c,sn:u}=t.frag,h=(n=(i=t.part)==null?void 0:i.index)!=null?n:-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:n,payload:i}=t;if(n.type===te.SUBTITLE)if(i.byteLength){const s=n.decryptdata,r="stats"in t;if(s==null||!s.encrypted||r){const o=this.tracks[n.level],c=this.vttCCs;c[n.cc]||(c[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),o&&o.textCodec===Wr?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;Fo(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{n.logger.log(`Failed to parse IMSC1: ${i}`),n.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:s,unparsedVttFrags:r}=this,o=s.length-1;if(!s[n.cc]&&o===-1){r.push(e);return}const c=this.hls,u=(t=n.initSegment)!=null&&t.data?We(n.initSegment.data,new Uint8Array(i)).buffer:i;Zc(u,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,h=>{this._appendCues(h,n.level),c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},h=>{const f=h.message==="Missing initPTS for VTT MPEGTS";f?r.push(e):this._fallbackToIMSC1(n,i),c.logger.log(`Failed to parse VTT cue: ${h}`),!(f&&o>n.cc)&&c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:h})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||Fo(t,this.initPTS[e.cc],()=>{n.textCodec=Wr,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(s=>Eo(i,s))}else{const i=this.tracks[t];if(!i)return;const s=i.default?"default":"subtitles"+t;n.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===te.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:i}=t;if(!(n.type===te.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let s=0;s<i.length;s++){const r=i[s].bytes;if(r){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(r);this.cea608Parser1.addData(i[s].pts,o[0]),this.cea608Parser2.addData(i[s].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:s}){const{media:r}=this;if(!(!r||r.currentTime<n)){if(!s||s==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>Mr(o[c],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>Mr(o[c],t,i))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let i=2;for(let s=0;s<n;s++){const r=e[i++],o=127&e[i++],c=127&e[i++];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 Bo(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Uo(a,e){return!!a&&a.kind===Bo(e)&&Ir(e,a)}function nh(a,e,t,n){return Math.min(e,n)-Math.max(a,t)}function $o(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const ih=/\s/,sh={newCue(a,e,t,n){const i=[];let s,r,o,c,u;const h=self.VTTCue||self.TextTrackCue;for(let d=0;d<n.rows.length;d++)if(s=n.rows[d],o=!0,c=0,u="",!s.isEmpty()){var f;for(let D=0;D<s.chars.length;D++)ih.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 v=Co(u.trim()),E=zr(e,t,v);a!=null&&(f=a.cues)!=null&&f.getCueById(E)||(r=new h(e,t,v),r.id=E,r.line=d+1,r.align="left",r.position=10+Math.min(80,Math.floor(c*8/32)*10),i.push(r))}return a&&i.length&&(i.sort((d,v)=>d.line==="auto"||v.line==="auto"?0:d.line>8&&v.line>8?v.line-d.line:d.line-v.line),i.forEach(d=>Eo(a,d))),i}};function rh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const ah=/(\d+)-(\d+)\/(\d+)/;class Go{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||ch,this.controller=new self.AbortController,this.stats=new _}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,n){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=oh(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=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=c&&T(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},t.timeout),(Ms(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var d;this.response=this.loader=f;const v=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},u-(v-i.loading.start)),!f.ok){const{status:D,statusText:S}=f;throw new hh(S||"fetch, bad network response",D,f)}i.loading.first=v,i.total=uh(f.headers)||i.total;const E=(d=this.callbacks)==null?void 0:d.onProgress;return E&&T(t.highWaterMark)?this.loadProgressively(f,i,e,t.highWaterMark,E):r?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var d,v;const E=this.response;if(!E)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const D=f[o];D&&(i.loaded=i.total=D);const S={url:E.url,data:f,code:E.status},B=(d=this.callbacks)==null?void 0:d.onProgress;B&&!T(t.highWaterMark)&&B(i,e,f,E),(v=this.callbacks)==null||v.onSuccess(S,i,e,E)}).catch(f=>{var d;if(self.clearTimeout(this.requestTimeout),i.aborted)return;const v=f&&f.code||0,E=f?f.message:null;(d=this.callbacks)==null||d.onError({code:v,text:E},e,f?f.details:null,i)})}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,n,i=0,s){const r=new Aa,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return r.dataLength&&s(t,n,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const h=u.value,f=h.length;return t.loaded+=f,f<i||r.dataLength?(r.push(h),r.dataLength>=i&&s(t,n,r.flush().buffer,e)):s(t,n,h.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function oh(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(g({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function lh(a){const e=ah.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function uh(a){const e=a.get("Content-Range");if(e){const n=lh(e);if(T(n))return n}const t=a.get("Content-Length");if(t)return parseInt(t)}function ch(a,e){return new self.Request(a.url,e)}class hh extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const fh=/^age:\s*[\d.]+\s*$/im;class Ko{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 _,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return s(n,t.url)}).catch(r=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),s(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(r=>{var o;(o=this.callbacks)==null||o.onError({code:n.status,text:r.message},t,n,i)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:r}=n.loadPolicy;if(i)for(const o in i)e.setRequestHeader(o,i[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),n.timeout=s&&T(s)?s:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,s=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.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-(n.loading.first-n.loading.start)))),i===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 E=h!=null?h:t.response;if(E!=null){var r,o;n.loading.end=Math.max(self.performance.now(),n.loading.first);const D=t.responseType==="arraybuffer"?E.byteLength:E.length;n.loaded=n.total=D,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);const S=(r=this.callbacks)==null?void 0:r.onProgress;S&&S(n,e,E,t);const B={url:t.responseURL,data:E,code:u};(o=this.callbacks)==null||o.onSuccess(B,n,e,t);return}}const f=s.loadPolicy.errorRetry,d=n.retry,v={url:e.url,data:void 0,code:u};if(ni(f,d,!1,v))this.retry(f);else{var c;ee.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ni(e,t,!0))this.retry(e);else{var n;ee.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=Bi(e,n.retry),n.retry++,ee.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&fh.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 dh={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},ph=m(m({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Ko,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Kn,bufferController:Eu,capLevelController:Cr,errorController:Xi,fpsController:_c,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:hn,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:dh},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},gh()),{},{subtitleStreamController:Ic,subtitleTrackController:Ec,timelineController:th,audioStreamController:mu,audioTrackController:_u,emeController:ys,cmcdController:pc,contentSteeringController:mc,interstitialsController:Rc});function gh(){return{cueHandler:sh,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 mh(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 n=Zr(a),i=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(r=>{const o=`${r==="level"?"playlist":r}LoadPolicy`,c=e[o]===void 0,u=[];s.forEach(h=>{const f=`${r}Loading${h}`,d=e[f];if(d!==void 0&&c){u.push(f);const v=n[o].default;switch(e[o]={default:v},h){case"TimeOut":v.maxLoadTimeMs=d,v.maxTimeToFirstByteMs=d;break;case"MaxRetry":v.errorRetry.maxNumRetry=d,v.timeoutRetry.maxNumRetry=d;break;case"RetryDelay":v.errorRetry.retryDelayMs=d,v.timeoutRetry.retryDelayMs=d;break;case"MaxRetryTimeout":v.errorRetry.maxRetryDelayMs=d,v.timeoutRetry.maxRetryDelayMs=d;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${Pt(e[o])}`)}),m(m({},n),e)}function Zr(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(Zr):Object.keys(a).reduce((e,t)=>(e[t]=Zr(a[t]),e),{}):a}function _h(a,e){const t=a.loader;t!==Go&&t!==Ko?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):rh()&&(a.loader=Go,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const rr=2,vh=.1,yh=.05,Eh=100;class bh extends Ci{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,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 n;(n=this.media)!=null&&n.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var n;this.ended=((n=this.media)==null?void 0:n.currentTime)||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.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(Eh),this.mediaSource=t.mediaSource;const n=this.media=t.media;Hn(n,"playing",this.onMediaPlaying),Hn(n,"waiting",this.onMediaWaiting),Hn(n,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:n}=this;n&&(Zn(n,"playing",this.onMediaPlaying),Zn(n,"waiting",this.onMediaWaiting),Zn(n,"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 n,i;const s=(n=this.hls)==null?void 0:n.config;if(!s)return;const r=this.media;if(!r)return;const{seeking:o}=r,c=this.seeking&&!o,u=!this.seeking&&o,h=r.paused&&!o||r.ended||r.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!h&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(u||c){c&&this.stallResolved(e);return}if(h){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1}));return}if(!Ot.getBuffered(r).length){this.nudgeRetry=0;return}const f=Ot.bufferInfo(r,e,0),d=f.nextStart||0,v=this.fragmentTracker;if(o&&v&&this.hls){const ze=Vo(this.hls.inFlightFragments,e),De=f.len>rr,Ne=!d||ze||d-e>rr&&!v.getPartialFragment(e);if(De||Ne)return;this.moved=!1}const E=(i=this.hls)==null?void 0:i.latestLevelDetails;if(!this.moved&&this.stalled!==null&&v){if(!(f.len>0)&&!d)return;const De=Math.max(d,f.start||0)-e,Me=!!(E!=null&&E.live)?E.targetduration*2:rr,Re=ar(e,v);if(De>0&&(De<=Me||Re)){r.paused||this._trySkipBufferHole(Re);return}}const D=s.detectStallWithCurrentTimeMs,S=self.performance.now(),B=this.waiting;let ne=this.stalled;if(ne===null)if(B>0&&S-B<D)ne=this.stalled=B;else{this.stalled=S;return}const J=S-ne;if(!o&&(J>=D||B)&&this.hls){var me;if(((me=this.mediaSource)==null?void 0:me.readyState)==="ended"&&!(E!=null&&E.live)&&Math.abs(e-((E==null?void 0:E.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return}const Le=Ot.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(Le,J,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(p.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;const i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&i&&i.length>1&&e>i.end(0)){const s=Ot.bufferedInfo(Ot.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=Ot.timeRangesToArray(i),o=Ot.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=Ot.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;let d=ar(e,this.fragmentTracker);d&&"fragment"in d?d=d.fragment:d||(d=void 0);const v=Ot.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:d,buffer:v.len,bufferInfo:v})}}}}}_tryFixBufferStall(e,t,n){var i,s;const{fragmentTracker:r,media:o}=this,c=(i=this.hls)==null?void 0:i.config;if(!o||!r||!c)return;const u=(s=this.hls)==null?void 0:s.latestLevelDetails,h=ar(n,r);if((h||u!=null&&u.live&&n<u.fragmentStart)&&(this._trySkipBufferHole(h)||!this.media))return;const f=e.buffered,d=this.adjacentTraversal(e,n);(f&&f.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-n<c.maxBufferHole||d))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const n=this.fragmentTracker,i=e.nextStart;if(n&&i){const s=n.getFragAtPos(t,te.MAIN),r=n.getFragAtPos(i,te.MAIN);if(s&&r)return r.sn-s.sn<2}return!1}_reportStall(e){const{hls:t,media:n,stallReported:i,stalled:s}=this;if(!i&&s!==null&&n&&t){this.stallReported=!0;const r=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${Pt(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:n,media:i}=this,s=(t=this.hls)==null?void 0:t.config;if(!i||!n||!s)return 0;const r=i.currentTime,o=Ot.bufferInfo(i,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&&i.readyState<3,d=c-r;if(d>0&&(h||f)){if(d>s.maxBufferHole){let E=!1;if(r===0){const D=n.getAppendedFrag(0,te.MAIN);D&&c<D.end&&(E=!0)}if(!E&&e){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||Vo(this.hls.inFlightFragments,c))return 0;let S=!1,B=e.end;for(;B<c;){const ne=ar(B,n);if(ne)B+=ne.duration;else{S=!0;break}}if(S)return 0}}const v=Math.max(c+yh,r+vh);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${v}`),this.moved=!0,i.currentTime=v,!(e!=null&&e.gap)){const E=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${v}`),D={type:oe.MEDIA_ERROR,details:H.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:E,reason:E.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?D.part=e:D.frag=e),this.hls.trigger(p.ERROR,D)}return v}}return 0}_tryNudgeBuffer(e){const{hls:t,media:n,nudgeRetry:i}=this,s=t==null?void 0:t.config;if(!n||!s)return 0;const r=n.currentTime;if(this.nudgeRetry++,i<s.nudgeMaxRetry){const o=r+(i+1)*s.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${r} to ${o}`);this.warn(c.message),n.currentTime=o,t.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.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(p.ERROR,{type:oe.MEDIA_ERROR,details:H.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Vo(a,e){const t=zo(a.main);if(t&&t.start<=e)return t;const n=zo(a.audio);return n&&n.start<=e?n:null}function zo(a){if(!a)return null;switch(a.state){case Je.IDLE:case Je.STOPPED:case Je.ENDED:case Je.ERROR:return null}return a.frag}function ar(a,e){return e.getAppendedFrag(a,te.MAIN)||e.getPartialFragment(a)}const xh=.25;function qr(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Xr(a,e,t,n,i){let s=new a(e,t,"");try{s.value=n,i&&(s.type=i)}catch(r){s=new a(e,t,Pt(i?m({type:i},n):n))}return s}const or=(()=>{const a=qr();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Th{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(p.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&&(e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var n;this.media=t.media,((n=t.overrides)==null?void 0:n.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Es(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 n=e[t];if(n.kind==="metadata"&&n.label==="id3")return yo(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:n,enableID3MetadataCues:i}=this.hls.config;if(!n&&!i)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=qr();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Jn.emsg&&!n||!i)continue;const u=Pa(s[o].data),h=s[o].pts;let f=h+s[o].duration;f>or&&(f=or),f-h<=0&&(f=h+xh);for(let v=0;v<u.length;v++){const E=u[v];if(!Fa(E)){this.updateId3CueEnds(h,c);const D=Xr(r,h,f,E,c);D&&this.id3Track.addCue(D)}}}}updateId3CueEnds(e,t){var n;const i=(n=this.id3Track)==null?void 0:n.cues;if(i)for(let s=i.length;s--;){const r=i[s];r.type===t&&r.startTime<e&&r.endTime===or&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:i}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=r;if(s&&(o||c)){let u;i==="audio"?u=h=>h.type===Jn.audioId3&&c:i==="video"?u=h=>h.type===Jn.emsg&&o:u=h=>h.type===Jn.audioId3&&c||h.type===Jn.emsg&&o,Mr(s,t,n,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.hls||!this.media)return;const{assetPlayerId:n,timelineOffset:i,enableDateRangeMetadataCues:s,interstitialsController:r}=this.hls.config;if(!s)return;const o=qr();if(n&&i&&!r){const{fragmentStart:D,fragmentEnd:S}=e;let B=this.assetCue;B?(B.startTime=D,B.endTime=S):o&&(B=this.assetCue=Xr(o,D,S,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),B&&(B.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(B),B.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:u}=e,h=Object.keys(u);let f=this.dateRangeCuesAppended;if(c&&t){var d;if((d=c.cues)!=null&&d.length){const D=Object.keys(f).filter(S=>!h.includes(S));for(let S=D.length;S--;){var v;const B=D[S],ne=(v=f[B])==null?void 0:v.cues;delete f[B],ne&&Object.keys(ne).forEach(J=>{const me=ne[J];if(me){me.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(me)}catch(Le){}}})}}else f=this.dateRangeCuesAppended={}}const E=e.fragments[e.fragments.length-1];if(!(h.length===0||!T(E==null?void 0:E.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let D=0;D<h.length;D++){const S=h[D],B=u[S],ne=B.startTime,J=f[S],me=(J==null?void 0:J.cues)||{};let Le=(J==null?void 0:J.durationKnown)||!1,ze=or;const{duration:De,endDate:Ne}=B;if(Ne&&De!==null)ze=ne+De,Le=!0;else if(B.endOnNext&&!Le){const Re=h.reduce((Qe,yt)=>{if(yt!==B.id){const At=u[yt];if(At.class===B.class&&At.startDate>B.startDate&&(!Qe||B.startDate<Qe.startDate))return At}return Qe},null);Re&&(ze=Re.startTime,Le=!0)}const Me=Object.keys(B.attr);for(let Re=0;Re<Me.length;Re++){const Qe=Me[Re];if(!Rs(Qe))continue;const yt=me[Qe];if(yt)Le&&!(J!=null&&J.durationKnown)?yt.endTime=ze:Math.abs(yt.startTime-ne)>.01&&(yt.startTime=ne,yt.endTime=ze);else if(o){let At=B.attr[Qe];ds(Qe)&&(At=R(At));const wt=Xr(o,ne,ze,{key:Qe,data:At},Jn.dateRange);wt&&(wt.id=S,this.id3Track.addCue(wt),me[Qe]=wt,r&&(Qe==="X-ASSET-LIST"||Qe==="X-ASSET-URL")&&wt.addEventListener("enter",this.onEventCueEnter))}}f[S]={cues:me,dateRange:B,durationKnown:Le}}}}}class Sh{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,n=this.levelDetails;if(!t||!n)return;this.currentTime=t.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||r===1||!n.live)return;const o=this.targetLatency;if(o===null)return;const c=i-o,u=Math.min(this.maxLatency,o+n.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,r)),d=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,v=Math.min(f,Math.max(1,d));this.changeMediaPlaybackRate(t,v)}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:n,targetduration:i}=e,{liveSyncDuration:s,liveSyncDurationCount:r,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&n||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=s!==void 0?s:r*i);const h=i;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 n=this.levelDetails;if(n===null)return null;const i=n.edge,s=e-t-this.edgeStalled,r=i-n.totalduration,o=i-(this.config.lowLatencyMode&&n.partTarget||n.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 n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.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 n;t.details===H.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var n,i;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(i=this.targetLatency)==null?void 0:i.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 Ah extends Rr{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.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 n=this.hls.config.preferManagedMediaSource,i=[],s={},r={};let o=!1,c=!1,u=!1;t.levels.forEach(h=>{const f=h.attrs;let{audioCodec:d,videoCodec:v}=h;d&&(h.audioCodec=d=Q(d,n)||void 0),v&&(v=h.videoCodec=it(v));const{width:E,height:D,unknownCodecs:S}=h;let B=S?S.length:0;if(S)for(let Re=B;Re--;){const Qe=S[Re];this.isAudioSupported(Qe)?(h.audioCodec=d=d?`${d},${Qe}`:Qe,B--,ct.audio[d.substring(0,4)]=2):this.isVideoSupported(Qe)&&(h.videoCodec=v=v?`${v},${Qe}`:Qe,B--,ct.video[v.substring(0,4)]=2)}if(o||(o=!!(E&&D)),c||(c=!!v),u||(u=!!d),B||d&&!this.isAudioSupported(d)||v&&!this.isVideoSupported(v)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:ne,"FRAME-RATE":J,"HDCP-LEVEL":me,"PATHWAY-ID":Le,RESOLUTION:ze,"VIDEO-RANGE":De}=f,Me=`${`${Le||"."}-`}${h.bitrate}-${ze}-${J}-${ne}-${De}-${me}`;if(s[Me])if(s[Me].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const Re=r[Me]+=1;h.attrs["PATHWAY-ID"]=new Array(Re+1).join(".");const Qe=this.createLevel(h);s[Me]=Qe,i.push(Qe)}else s[Me].addGroupId("audio",f.AUDIO),s[Me].addGroupId("text",f.SUBTITLES);else{const Re=this.createLevel(h);s[Me]=Re,r[Me]=1,i.push(Re)}}),this.filterAndSortMediaOptions(i,t,o,c,u)}createLevel(e){const t=new En(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const i=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(i.message),t.supportedResult=rn(i,[])}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,n,i,s){let r=[],o=[],c=e;if((n||i)&&s&&(c=c.filter(({videoCodec:S,videoRange:B,width:ne,height:J})=>(!!S||!!(ne&&J))&&yn(B))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let S="no level with compatible codecs found in manifest",B=S;t.levels.length&&(B=`one or more CODECS in variant not supported: ${Pt(t.levels.map(J=>J.attrs.CODECS).filter((J,me,Le)=>Le.indexOf(J)===me))}`,this.warn(B),S+=` (${B})`);const ne=new Error(S);this.hls.trigger(p.ERROR,{type:oe.MEDIA_ERROR,details:H.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:ne,reason:B})}});return}t.audioTracks&&(r=t.audioTracks.filter(S=>!S.audioCodec||this.isAudioSupported(S.audioCodec)),Wo(r)),t.subtitles&&(o=t.subtitles,Wo(o));const u=c.slice(0);c.sort((S,B)=>{if(S.attrs["HDCP-LEVEL"]!==B.attrs["HDCP-LEVEL"])return(S.attrs["HDCP-LEVEL"]||"")>(B.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&S.height!==B.height)return S.height-B.height;if(S.frameRate!==B.frameRate)return S.frameRate-B.frameRate;if(S.videoRange!==B.videoRange)return An.indexOf(S.videoRange)-An.indexOf(B.videoRange);if(S.videoCodec!==B.videoCodec){const ne=ge(S.videoCodec),J=ge(B.videoCodec);if(ne!==J)return J-ne}if(S.uri===B.uri&&S.codecSet!==B.codecSet){const ne=de(S.codecSet),J=de(B.codecSet);if(ne!==J)return J-ne}return S.averageBitrate!==B.averageBitrate?S.averageBitrate-B.averageBitrate:0});let h=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let S=0;S<u.length;S++)if(u[S].pathwayId===c[0].pathwayId){h=u[S];break}}this._levels=c;for(let S=0;S<c.length;S++)if(c[S]===h){var f;this._firstLevel=S;const B=h.bitrate,ne=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${B}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const J=Math.min(B,this.hls.config.abrEwmaDefaultEstimateMax);J>ne&&ne===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=J)}break}const d=s&&!i,v=this.hls.config,E=!!(v.audioStreamController&&v.audioTrackController),D={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:i,altAudio:E&&!d&&r.some(S=>!!S.url)};this.hls.trigger(p.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(p.ERROR,{type:oe.OTHER_ERROR,details:H.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:h,reason:h.message}),f)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,r=t[e],o=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,n===e&&i&&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 ${n}${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(p.LEVEL_SWITCHING,c);const u=r.details;if(!u||u.live){const h=this.switchParams(r.uri,i==null?void 0:i.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(),n=e.filter(i=>t.indexOf(i)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===ae.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===te.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(s=>!!n[s]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var n;const{level:i,details:s}=t,r=t.levelInfo;if(!r){var o;this.warn(`Invalid level index ${i}`),(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(i,t,c)}else(n=t.deliveryDirectives)!=null&&n.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 n=this.getUrlWithDirectives(e.uri,t),i=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],r=e.details,o=r==null?void 0:r.age;this.log(`Loading level index ${i}${(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:""):""} ${n}`),this.hls.trigger(p.LEVEL_LOADING,{url:n,level:i,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 n=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));ya(n),this._levels=n,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 i=n.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(p.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(p.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function Wo(a){const e={};a.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}function Ho(){return self.SourceBuffer||self.WebKitSourceBuffer}function jo(){if(!X())return!1;const e=Ho();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function wh(){if(!jo())return!1;const a=X();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(Tt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(Tt(e,"audio"))))}function Dh(){var a;const e=Ho();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Rh=100;class Ih extends dr{constructor(e,t,n){super(e,t,n,"stream-controller",te.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 i=this.media,s=i?i.currentTime:null;if(s===null||!T(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(i,s,te.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(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:n,hls:i}=this;if(this.stopLoad(),this.setInterval(Rh),this.level=-1,!this.startFragRequested){let s=i.startLevel;s===-1&&(i.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=i.firstAutoLevel),i.nextLoadLevel=s,this.level=i.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=Je.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Je.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Je.WAITING_LEVEL:{const{levels:e,level:t}=this,n=e==null?void 0:e[t],i=n==null?void 0:n.details;if(i&&(!i.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(i))break;this.state=Je.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Je.IDLE;break}break}case Je.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Je.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:n,media:i}=this;if(t===null||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[s]))return;const r=n[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(p.BUFFER_EOS,D),this.state=Je.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===Je.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=Je.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 d=this.backtrackFragment?this.backtrackFragment.start:o.end;let v=this.getNextFragment(d,u);if(this.couldBacktrack&&!this.fragPrevious&&v&&Ee(v)&&this.fragmentTracker.getState(v)!==un.OK){var E;const S=((E=this.backtrackFragment)!=null?E:v).sn-u.startSN,B=u.fragments[S-1];B&&v.cc===B.cc&&(v=B,this.fragmentTracker.removeFragment(B))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(v&&this.isLoopLoading(v,d)){if(!v.gap){const S=this.audioOnly&&!this.altAudio?I.AUDIO:I.VIDEO,B=(S===I.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;B&&this.afterBufferFlushed(B,S,te.MAIN)}v=this.getNextFragmentLoopLoading(v,u,o,te.MAIN,f)}v&&(v.initSegment&&!v.initSegment.data&&!this.bitrateTest&&(v=v.initSegment),this.loadFragment(v,r,d))}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);i===un.NOT_LOADED||i===un.PARTIAL?Ee(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,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,te.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 n;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.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?n=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:n=0}else n=0;const r=this.getBufferedFrag(t.currentTime+n);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 Je.KEY_LOADING:case Je.FRAG_LOADING:case Je.FRAG_LOADING_WAITING_RETRY:case Je.PARSING:case Je.PARSED:this.state=Je.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 n=t.media;Hn(n,"playing",this.onMediaPlaying),Hn(n,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:n}=this;n&&(Zn(n,"playing",this.onMediaPlaying),Zn(n,"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(p.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 n=!1,i=!1;for(let s=0;s<t.levels.length;s++){const r=t.levels[s].audioCodec;r&&(n=n||r.indexOf("mp4a.40.2")!==-1,i=i||r.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=n&&i&&!Dh(),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:n}=this;if(!n||this.state!==Je.IDLE)return;const i=t.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=Je.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:i,startFragRequested:s}=this,r=t.level,o=t.details,c=o.totalduration;if(!i){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===Je.FRAG_LOADING||this.state===Je.FRAG_LOADING_WAITING_RETRY)&&h.level!==t.level&&h.loader&&this.abortCurrentFrag();let f=0;if(o.live||(n=u.details)!=null&&n.live){var d;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;f=this.alignPlaylists(o,u.details,(d=this.levelLastLoaded)==null?void 0:d.details)}if(u.details=o,this.levelLastLoaded=u,s||this.setStartPosition(o,f),this.hls.trigger(p.LEVEL_UPDATED,{details:o,level:r}),this.state===Je.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Je.IDLE}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,s=this.getLoadPosition(),r=e.fragmentStart,o=e.edge,c=s>=r-t.maxFragLookUpTolerance&&s<=o;if(i!==null&&n.duration>i&&(s<i||!c)){const h=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&n.readyState<4||s<o-h)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),n.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${i.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var u;const f=Ot.bufferInfo(n,i,0);if(!((u=f.buffered)!=null&&u.length)){n.currentTime=i;return}if(f.start<=s){n.currentTime=i;return}const{nextStart:v}=Ot.bufferedInfo(f.buffered,s,0);v&&(n.currentTime=v)}else n.currentTime=i}}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,payload:s}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const o=r[n.level];if(!o){this.warn(`Level ${n.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const u=o.videoCodec,h=c.PTSKnown||!c.live,f=(t=n.initSegment)==null?void 0:t.data,d=this._getAudioCodec(o),v=this.transmuxer=this.transmuxer||new qa(this.hls,te.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),E=i?i.index:-1,D=E!==-1,S=new Wn(n.level,n.sn,n.stats.chunkCount,s.byteLength,E,D),B=this.initPTS[n.cc];v.push(s,f,d,u,n,i,c.totalduration,h,S,B)}onAudioTrackSwitching(e,t){const n=this.hls,i=this.altAudio===2;if(Gn(t.url,n))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(i){this.fragmentTracker.removeAllFragments(),n.once(p.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(p.AUDIO_TRACK_SWITCHED,t)}),n.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}n.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=Gn(t.url,this.hls);if(n){const i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){const n=t.tracks;let i,s,r=!1;for(const o in n){const c=n[o];if(c.id==="main"){if(s=o,i=c,o==="video"){const u=n[o];u&&(this.videoBuffer=u.buffer)}}else r=!0}r&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:i}=t,s=n.type===te.MAIN;if(s){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Je.PARSED&&(this.state=Je.IDLE);return}const o=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),Ee(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}const r=this.media;r&&(!this._hasEnoughToStart&&Ot.getBuffered(r).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var n;if(t.fatal){this.state=Je.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(te.MAIN,t);break;case H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Je.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===ae.LEVEL&&(this.state=Je.IDLE);break;case H.BUFFER_ADD_CODEC_ERROR:case H.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case H.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=Je.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==I.AUDIO||!this.altAudio){const n=(t===I.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;n&&(this.afterBufferFlushed(n,t,te.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 n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const i=this.timelineOffset;i&&n&&(n+=i);const s=this.getLevelDetails(),r=Ot.getBuffered(e),o=r.length?r.start(0):0,c=o-n,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||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`),n+=c,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${o}`),e.currentTime=n)}}_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(n=>{const{hls:i}=this,s=n==null?void 0:n.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=Je.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(),i.trigger(p.FRAG_LOADED,n),s.bitrateTest=!1}).catch(n=>{this.state===Je.STOPPED||this.state===Je.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:n}=this,{remuxResult:i,chunkMeta:s}=e,r=this.getCurrentContext(s);if(!r){this.resetWhenMissingContext(s);return}const{frag:o,part:c,level:u}=r,{video:h,text:f,id3:d,initSegment:v}=i,{details:E}=u,D=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=Je.PARSING,v){const S=v.tracks;if(S){const me=o.initSegment||o;if(this.unhandledEncryptionError(v,o))return;this._bufferInitSegment(u,S,me,s),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:me,id:t,tracks:S})}const B=v.initPTS,ne=v.timescale,J=this.initPTS[o.cc];if(T(B)&&(!J||J.baseTime!==B||J.timescale!==ne)){const me=v.trackId;this.initPTS[o.cc]={baseTime:B,timescale:ne,trackId:me},n.trigger(p.INIT_PTS_FOUND,{frag:o,id:t,initPTS:B,timescale:ne,trackId:me})}}if(h&&E){D&&h.type==="audiovideo"&&this.logMuxedErr(o);const S=E.fragments[o.sn-1-E.startSN],B=o.sn===E.startSN,ne=!S||o.cc>S.cc;if(i.independent!==!1){const{startPTS:J,endPTS:me,startDTS:Le,endDTS:ze}=h;if(c)c.elementaryStreams[h.type]={startPTS:J,endPTS:me,startDTS:Le,endDTS:ze};else if(h.firstKeyFrame&&h.independent&&s.id===1&&!ne&&(this.couldBacktrack=!0),h.dropped&&h.independent){const De=this.getMainFwdBufferInfo(),Ne=(De?De.end:this.getLoadPosition())+this.config.maxBufferHole,Me=h.firstKeyFramePTS?h.firstKeyFramePTS:J;if(!B&&Ne<Me-this.config.maxBufferHole&&!ne){this.backtrack(o);return}else ne&&(o.gap=!0);o.setElementaryStreamInfo(h.type,o.start,me,o.start,ze,!0)}else B&&J-(E.appliedTimelineOffset||0)>rr&&(o.gap=!0);o.setElementaryStreamInfo(h.type,J,me,Le,ze),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,c,s,B||ne)}else if(B||ne)o.gap=!0;else{this.backtrack(o);return}}if(D){const{startPTS:S,endPTS:B,startDTS:ne,endDTS:J}=D;c&&(c.elementaryStreams[I.AUDIO]={startPTS:S,endPTS:B,startDTS:ne,endDTS:J}),o.setElementaryStreamInfo(I.AUDIO,S,B,ne,J),this.bufferFragmentData(D,o,c,s)}if(E&&d!=null&&d.samples.length){const S={id:t,frag:o,details:E,samples:d.samples};n.trigger(p.FRAG_PARSING_METADATA,S)}if(E&&f){const S={id:t,frag:o,details:E,samples:f.samples};n.trigger(p.FRAG_PARSING_USERDATA,S)}}logMuxedErr(e){this.warn(`${Ee(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,i){if(this.state!==Je.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));const{audio:s,video:r,audiovideo:o}=t;if(s){const u=e.audioCodec;let h=ce(s.codec,u);h==="mp4a"&&(h="mp4a.40.5");const f=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){h&&(h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5");const d=s.metadata;d&&"channelCount"in d&&(d.channelCount||1)!==1&&f.indexOf("firefox")===-1&&(h="mp4a.40.5")}h&&h.indexOf("mp4a.40.5")!==-1&&f.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(h="mp4a.40.2",this.log(`Android: force audio codec to ${h}`)),u&&u!==h&&this.log(`Swapping manifest audio codec "${u}" for "${h}"`),s.levelCodec=h,s.id=te.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${h||""}/${u||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=te.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(p.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const f=t[u].initSegment;f!=null&&f.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:u,data:f,frag:n,part:null,chunkMeta:i,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,te.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,n=e==null?void 0:e[t];return n?this.getMaxBufferLength(n.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=Je.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(Ot.isBuffered(e,n)?t=this.getAppendedFrag(n):Ot.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,s=t.level;(!i||t.sn!==i.sn||i.level!==s)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!i||i.level!==s)&&this.hls.trigger(p.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 T(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(T(t)){const n=this.getLevelDetails(),i=this.currentFrag||(n?ei(null,n.fragments,t):null);if(i){const s=i.programDateTime;if(s!==null){const r=s+(t-i.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 Lh extends L{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyIdToKeyInfo){const i=this.keyIdToKeyInfo[n].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=H.KEY_LOAD_ERROR,n,i,s){return new zn({type:oe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:n,networkDetails:i})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let i=0,s=t.length;i<s;i++){const r=t[i];if(e.cc<=r.cc&&(!Ee(e)||!Ee(r)||e.sn<r.sn)||!n&&i==s-1)return this.emeController.selectKeySystemFormat(r).then(o=>{if(!this.emeController)return;r.setKeyFormat(o);const c=Wi(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const i=Nt(this.config);if(i.length)return this.emeController.getKeySystemAccess(i)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var n,i;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const h=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,H.KEY_LOAD_ERROR,h))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,H.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const o=Qr(s);let c=this.keyIdToKeyInfo[o];if((n=c)!=null&&n.decryptdata.key)return s.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if((i=c)!=null&&i.keyLoadPromise){var u;switch((u=c.mediaKeySessionContext)==null?void 0:u.keyStatus){case"usable":case"usable-in-future":return c.keyLoadPromise.then(f=>{const{keyInfo:d}=f;return s.key=d.decryptdata.key,{frag:e,keyInfo:d}})}}switch(this.log(`Loading key ${U(s.keyId||[])} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[o]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,H.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(n);return(e.keyLoadPromise=i.then(s=>(e.mediaKeySessionContext=s,n))).catch(s=>{throw e.keyLoadPromise=null,s.data&&(s.data.frag=t),s})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,i=n.loader,s=new i(n);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=n.keyLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(d,v,E,D)=>{const{frag:S,keyInfo:B,url:ne}=E,J=Qr(B.decryptdata)||ne;if(!S.decryptdata||B!==this.keyIdToKeyInfo[J])return o(this.createKeyLoadError(S,H.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),D));B.decryptdata.key=S.decryptdata.key=new Uint8Array(d.data),S.keyLoader=null,B.loader=null,r({frag:S,keyInfo:B})},onError:(d,v,E,D)=>{this.resetLoader(v),o(this.createKeyLoadError(t,H.KEY_LOAD_ERROR,new Error(`HTTP Error ${d.code} loading key ${d.text}`),E,m({url:c.url,data:void 0},d)))},onTimeout:(d,v,E)=>{this.resetLoader(v),o(this.createKeyLoadError(t,H.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),E))},onAbort:(d,v,E)=>{this.resetLoader(v),o(this.createKeyLoadError(t,H.INTERNAL_ABORTED,new Error("key loading aborted"),E))}};s.load(c,h,f)})}resetLoader(e){const{frag:t,keyInfo:n,url:i}=e,s=n.loader;t.keyLoader===s&&(t.keyLoader=null,n.loader=null);const r=Qr(n.decryptdata)||i;delete this.keyIdToKeyInfo[r],s&&s.destroy()}}function Qr(a){const e=a.keyId;return e?U(e):a.uri}function Yo(a){const{type:e}=a;switch(e){case ae.AUDIO_TRACK:return te.AUDIO;case ae.SUBTITLE_TRACK:return te.SUBTITLE;default:return te.MAIN}}function Jr(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Ch{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,i=t.loader,s=n||i,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:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ae.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:n,level:i,pathwayId:s,url:r,deliveryDirectives:o,levelInfo:c}=t;this.load({id:n,level:i,pathwayId:s,responseType:"text",type:ae.LEVEL,url:r,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:r,track:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:ae.AUDIO_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:r,track:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:ae.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const n=this.loaders[ae.LEVEL];if(n){const i=n.context;i&&!t.levels.some(s=>s===i.levelOrTrack)&&(n.abort(),delete this.loaders[ae.LEVEL])}}load(e){var t;const n=this.hls.config;let i=this.getInternalLoader(e);if(i){const u=this.hls.logger,h=i.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}`),i.abort()}let s;if(e.type===ae.MANIFEST?s=n.manifestLoadPolicy.default:s=g({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),T((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ae.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ae.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ae.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const h=u.partTarget,f=u.targetduration;if(h&&f){const d=Math.max(h*3,f*.8)*1e3;s=g({},s,{maxTimeToFirstByteMs:Math.min(d,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,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,d)=>{const v=this.getInternalLoader(f);this.resetInternalLoader(f.type);const E=u.data;if(E.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,f,new Error("no EXTM3U delimiter"),d||null,h);return}h.parsing.start=performance.now(),Ei.isMediaPlaylist(E)||f.type!==ae.MANIFEST?this.handleTrackOrLevelPlaylist(u,h,f,d||null,v):this.handleMasterPlaylist(u,h,f,d)},onError:(u,h,f,d)=>{this.handleNetworkError(h,f,!1,u,d)},onTimeout:(u,h,f)=>{this.handleNetworkError(h,f,!0,void 0,u)}};i.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,i){const s=this.hls,r=e.data,o=Jr(e,n),c=Ei.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,n,c.playlistParsingError,i,t);return}const{contentSteering:u,levels:h,sessionData:f,sessionKeys:d,startTimeOffset:v,variableList:E}=c;this.variableList=E;const{AUDIO:D=[],SUBTITLES:S,"CLOSED-CAPTIONS":B}=Ei.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 cn({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:h,audioTracks:D,subtitles:S,captions:B,contentSteering:u,url:o,stats:t,networkDetails:i,sessionData:f,sessionKeys:d,startTimeOffset:v,variableList:E})}handleTrackOrLevelPlaylist(e,t,n,i,s){const r=this.hls,{id:o,level:c,type:u}=n,h=Jr(e,n),f=T(c)?c:T(o)?o:0,d=Yo(n),v=Ei.parseLevelPlaylist(e.data,h,f,d,0,this.variableList);if(u===ae.MANIFEST){const E={attrs:new cn({}),bitrate:0,details:v,name:"",url:h};v.requestScheduled=t.loading.start+ga(v,0),r.trigger(p.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:h,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=v,this.handlePlaylistLoaded(v,e,t,n,i,s)}handleManifestParsingError(e,t,n,i,s){this.hls.trigger(p.ERROR,{type:oe.NETWORK_ERROR,details:H.MANIFEST_PARSING_ERROR,fatal:t.type===ae.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:i,stats:s})}handleNetworkError(e,t,n=!1,i,s){let r=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===ae.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ae.AUDIO_TRACK||e.type===ae.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let c=H.UNKNOWN,u=!1;const h=this.getInternalLoader(e);switch(e.type){case ae.MANIFEST:c=n?H.MANIFEST_LOAD_TIMEOUT:H.MANIFEST_LOAD_ERROR,u=!0;break;case ae.LEVEL:c=n?H.LEVEL_LOAD_TIMEOUT:H.LEVEL_LOAD_ERROR,u=!1;break;case ae.AUDIO_TRACK:c=n?H.AUDIO_TRACK_LOAD_TIMEOUT:H.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ae.SUBTITLE_TRACK:c=n?H.SUBTITLE_TRACK_LOAD_TIMEOUT:H.SUBTITLE_LOAD_ERROR,u=!1;break}h&&this.resetInternalLoader(e.type);const f={type:oe.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:s};if(i){const d=(t==null?void 0:t.url)||e.url;f.response=m({url:d,data:void 0},i)}this.hls.trigger(p.ERROR,f)}handlePlaylistLoaded(e,t,n,i,s,r){const o=this.hls,{type:c,level:u,id:h,groupId:f,deliveryDirectives:d}=i,v=Jr(t,i),E=Yo(i),D=typeof i.level=="number"&&E===te.MAIN?u:void 0;if(!e.fragments.length){const B=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:oe.NETWORK_ERROR,details:H.LEVEL_EMPTY_ERROR,fatal:!1,url:v,error:B,reason:B.message,response:t,context:i,level:D,parent:E,networkDetails:s,stats:n});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const S=e.playlistParsingError;if(S){if(this.hls.logger.warn(`${S} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:oe.NETWORK_ERROR,details:H.LEVEL_PARSING_ERROR,fatal:!1,url:v,error:S,reason:S.message,response:t,context:i,level:D,parent:E,networkDetails:s,stats:n});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 ae.MANIFEST:case ae.LEVEL:o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:i.levelOrTrack||o.levels[0],level:D||0,id:h||0,stats:n,networkDetails:s,deliveryDirectives:d,withoutMultiVariant:c===ae.MANIFEST});break;case ae.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:i.levelOrTrack,id:h||0,groupId:f||"",stats:n,networkDetails:s,deliveryDirectives:d});break;case ae.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:i.levelOrTrack,id:h||0,groupId:f||"",stats:n,networkDetails:s,deliveryDirectives:d});break}}}class Zi{static get version(){return Ps}static isMSESupported(){return jo()}static isSupported(){return wh()}static getMediaSource(){return X()}static get Events(){return p}static get MetadataSchema(){return Jn}static get ErrorTypes(){return oe}static get ErrorDetails(){return H}static get DefaultConfig(){return Zi.defaultConfig?Zi.defaultConfig:ph}static set DefaultConfig(e){Zi.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 gr,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=le(e.debug||!1,"Hls instance",e.assetPlayerId),n=this.config=mh(Zi.DefaultConfig,e,t);this.userConfig=e,n.progressive&&_h(n,t);const{abrController:i,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=n,u=new o(this),h=this.abrController=new i(this),f=new gi(this),d=n.interstitialsController,v=d?this.interstitialsController=new d(this,Zi):null,E=this.bufferController=new s(this,f),D=this.capLevelController=new r(this),S=new c(this),B=new Ch(this),ne=n.contentSteeringController,J=ne?new ne(this):null,me=this.levelController=new Ah(this,J),Le=new Th(this),ze=new Lh(this.config,this.logger),De=this.streamController=new Ih(this,f,ze),Ne=this.gapController=new bh(this,f);D.setStreamController(De),S.setStreamController(De);const Me=[B,me,De];v&&Me.splice(1,0,v),J&&Me.splice(1,0,J),this.networkControllers=Me;const Re=[h,E,Ne,D,S,Le,f];this.audioTrackController=this.createController(n.audioTrackController,Me);const Qe=n.audioStreamController;Qe&&Me.push(this.audioStreamController=new Qe(this,f,ze)),this.subtitleTrackController=this.createController(n.subtitleTrackController,Me);const yt=n.subtitleStreamController;yt&&Me.push(this.subtititleStreamController=new yt(this,f,ze)),this.createController(n.timelineController,Re),ze.emeController=this.emeController=this.createController(n.emeController,Re),this.cmcdController=this.createController(n.cmcdController,Re),this.latencyController=this.createController(Sh,Re),this.coreComponents=Re,Me.push(u);const At=u.onErrorOut;typeof At=="function"&&this.on(p.ERROR,At,u),this.on(p.MANIFEST_LOADED,B.onManifestLoaded,B)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,i){this._emitter.off(e,t,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const i=e===p.ERROR;this.trigger(p.ERROR,{type:oe.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(p.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(p.ERROR,{type:oe.OTHER_ERROR,details:H.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,n=t?e.media:e,i=t?e:{media:n};this._media=n,this.trigger(p.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia"),this.trigger(p.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(p.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,n=this._url,i=this._url=y.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),t&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(p.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 n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}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={[te.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[te.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[te.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=bc()),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){tn(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 n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,n)for(let s=i;s--;){const r=e[s].attrs["HDCP-LEVEL"];if(r&&r<=n)return s}return i}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 n=xn(t);return en(e,n,navigator.mediaCapabilities)}}Zi.defaultConfig=void 0},16722:function(Rt,nt,W){"use strict";W.d(nt,{Z:function(){return te}});const T=l=>typeof l=="object"&&l!=null&&l.nodeType===1,fe=(l,M)=>(!M||l!=="hidden")&&l!=="visible"&&l!=="clip",ke=(l,M)=>{if(l.clientHeight<l.scrollHeight||l.clientWidth<l.scrollWidth){const A=getComputedStyle(l,null);return fe(A.overflowY,M)||fe(A.overflowX,M)||(g=>{const b=(m=>{if(!m.ownerDocument||!m.ownerDocument.defaultView)return null;try{return m.ownerDocument.defaultView.frameElement}catch(x){return null}})(g);return!!b&&(b.clientHeight<g.scrollHeight||b.clientWidth<g.scrollWidth)})(l)}return!1},oe=(l,M,A,g,b,m,x,C)=>m<l&&x>M||m>l&&x<M?0:m<=l&&C<=A||x>=M&&C>=A?m-l-g:x>M&&C<A||m<l&&C>A?x-M+b:0,H=l=>{const M=l.parentElement;return M==null?l.getRootNode().host||null:M},p=(l,M)=>{var A,g,b,m;if(typeof document=="undefined")return[];const{scrollMode:x,block:C,inline:L,boundary:F,skipOverflowHiddenElements:w}=M,k=typeof F=="function"?F:Ce=>Ce!==F;if(!T(l))throw new TypeError("Invalid target");const N=document.scrollingElement||document.documentElement,V=[];let q=l;for(;T(q)&&k(q);){if(q=H(q),q===N){V.push(q);break}q!=null&&q===document.body&&ke(q)&&!ke(document.documentElement)||q!=null&&ke(q,w)&&V.push(q)}const le=(g=(A=window.visualViewport)==null?void 0:A.width)!=null?g:innerWidth,ee=(m=(b=window.visualViewport)==null?void 0:b.height)!=null?m:innerHeight,{scrollX:X,scrollY:_e}=window,{height:ye,width:Ge,top:U,right:R,bottom:O,left:K}=l.getBoundingClientRect(),{top:j,right:z,bottom:y,left:_}=(Ce=>{const Ue=window.getComputedStyle(Ce);return{top:parseFloat(Ue.scrollMarginTop)||0,right:parseFloat(Ue.scrollMarginRight)||0,bottom:parseFloat(Ue.scrollMarginBottom)||0,left:parseFloat(Ue.scrollMarginLeft)||0}})(l);let I=C==="start"||C==="nearest"?U-j:C==="end"?O+y:U+ye/2-j+y,Z=L==="center"?K+Ge/2-_+z:L==="end"?R+z:K-_;const Ee=[];for(let Ce=0;Ce<V.length;Ce++){const Ue=V[Ce],{height:Be,width:Ze,top:et,right:$e,bottom:be,left:he}=Ue.getBoundingClientRect();if(x==="if-needed"&&U>=0&&K>=0&&O<=ee&&R<=le&&(Ue===N&&!ke(Ue)||U>=et&&O<=be&&K>=he&&R<=$e))return Ee;const we=getComputedStyle(Ue),Ae=parseInt(we.borderLeftWidth,10),qe=parseInt(we.borderTopWidth,10),ie=parseInt(we.borderRightWidth,10),ue=parseInt(we.borderBottomWidth,10);let Y=0,xe=0;const Te="offsetWidth"in Ue?Ue.offsetWidth-Ue.clientWidth-Ae-ie:0,Fe="offsetHeight"in Ue?Ue.offsetHeight-Ue.clientHeight-qe-ue:0,$="offsetWidth"in Ue?Ue.offsetWidth===0?0:Ze/Ue.offsetWidth:0,se="offsetHeight"in Ue?Ue.offsetHeight===0?0:Be/Ue.offsetHeight:0;if(N===Ue)Y=C==="start"?I:C==="end"?I-ee:C==="nearest"?oe(_e,_e+ee,ee,qe,ue,_e+I,_e+I+ye,ye):I-ee/2,xe=L==="start"?Z:L==="center"?Z-le/2:L==="end"?Z-le:oe(X,X+le,le,Ae,ie,X+Z,X+Z+Ge,Ge),Y=Math.max(0,Y+_e),xe=Math.max(0,xe+X);else{Y=C==="start"?I-et-qe:C==="end"?I-be+ue+Fe:C==="nearest"?oe(et,be,Be,qe,ue+Fe,I,I+ye,ye):I-(et+Be/2)+Fe/2,xe=L==="start"?Z-he-Ae:L==="center"?Z-(he+Ze/2)+Te/2:L==="end"?Z-$e+ie+Te:oe(he,$e,Ze,Ae,ie+Te,Z,Z+Ge,Ge);const{scrollLeft:Se,scrollTop:Ie}=Ue;Y=se===0?0:Math.max(0,Math.min(Ie+Y/se,Ue.scrollHeight-Be/se+Fe)),xe=$===0?0:Math.max(0,Math.min(Se+xe/$,Ue.scrollWidth-Ze/$+Te)),I+=Ie-Y,Z+=Se-xe}Ee.push({el:Ue,top:Y,left:xe})}return Ee},ae=l=>l===!1?{block:"end",inline:"nearest"}:(M=>M===Object(M)&&Object.keys(M).length!==0)(l)?l:{block:"start",inline:"nearest"};function te(l,M){if(!l.isConnected||!(b=>{let m=b;for(;m&&m.parentNode;){if(m.parentNode===document)return!0;m=m.parentNode instanceof ShadowRoot?m.parentNode.host:m.parentNode}return!1})(l))return;const A=(b=>{const m=window.getComputedStyle(b);return{top:parseFloat(m.scrollMarginTop)||0,right:parseFloat(m.scrollMarginRight)||0,bottom:parseFloat(m.scrollMarginBottom)||0,left:parseFloat(m.scrollMarginLeft)||0}})(l);if((b=>typeof b=="object"&&typeof b.behavior=="function")(M))return M.behavior(p(l,M));const g=typeof M=="boolean"||M==null?void 0:M.behavior;for(const{el:b,top:m,left:x}of p(l,ae(M))){const C=m-A.top+A.bottom,L=x-A.left+A.right;b.scroll({top:C,left:L,behavior:g})}}}}]);
}());