|
|
!(function(){var al=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[9716],{65030:function(yt,me,b){"use strict";b.d(me,{Z:function(){return bt}});var I=b(33885),P=b(42978),G=b(75931),D=b(43403),w=b(92310),_=b.n(w),F=b(29301),v=b(76846),s=b(96452),y=b(6089),f=b(80402),c=b(34280),l=b(49658),h=b(59301),d=b(54476),E=b(77900),T=b(8654);function L(Ee){var be=Ee.prefixCls,ue=Ee.align,ke=Ee.arrow,Fe=Ee.arrowPos,We=ke||{},ie=We.className,fe=We.content,De=Fe.x,Re=De===void 0?0:De,Oe=Fe.y,Ve=Oe===void 0?0:Oe,lt=h.useRef();if(!ue||!ue.points)return null;var Qe={position:"absolute"};if(ue.autoArrow!==!1){var Ze=ue.points[0],Xe=ue.points[1],ht=Ze[0],st=Ze[1],it=Xe[0],Ae=Xe[1];ht===it||!["t","b"].includes(ht)?Qe.top=Ve:ht==="t"?Qe.top=0:Qe.bottom=0,st===Ae||!["l","r"].includes(st)?Qe.left=Re:st==="l"?Qe.left=0:Qe.right=0}return h.createElement("div",{ref:lt,className:_()("".concat(be,"-arrow"),ie),style:Qe},fe)}function x(Ee){var be=Ee.prefixCls,ue=Ee.open,ke=Ee.zIndex,Fe=Ee.mask,We=Ee.motion;return Fe?h.createElement(E.default,(0,d.Z)({},We,{motionAppear:!0,visible:ue,removeOnLeave:!0}),function(ie){var fe=ie.className;return h.createElement("div",{style:{zIndex:ke},className:_()("".concat(be,"-mask"),fe)})}):null}var A=h.memo(function(Ee){var be=Ee.children;return be},function(Ee,be){return be.cache}),O=A,U=h.forwardRef(function(Ee,be){var ue=Ee.popup,ke=Ee.className,Fe=Ee.prefixCls,We=Ee.style,ie=Ee.target,fe=Ee.onVisibleChanged,De=Ee.open,Re=Ee.keepDom,Oe=Ee.fresh,Ve=Ee.onClick,lt=Ee.mask,Qe=Ee.arrow,Ze=Ee.arrowPos,Xe=Ee.align,ht=Ee.motion,st=Ee.maskMotion,it=Ee.forceRender,Ae=Ee.getPopupContainer,rt=Ee.autoDestroy,qe=Ee.portal,je=Ee.zIndex,mt=Ee.onMouseEnter,Et=Ee.onMouseLeave,at=Ee.onPointerEnter,kt=Ee.onPointerDownCapture,Bt=Ee.ready,nt=Ee.offsetX,Tt=Ee.offsetY,xe=Ee.offsetR,ge=Ee.offsetB,ye=Ee.onAlign,ee=Ee.onPrepare,te=Ee.stretch,le=Ee.targetWidth,he=Ee.targetHeight,_e=typeof ue=="function"?ue():ue,Je=De||Re,et=(Ae==null?void 0:Ae.length)>0,ct=h.useState(!Ae||!et),gt=(0,P.Z)(ct,2),It=gt[0],Yt=gt[1];if((0,c.Z)(function(){!It&&et&&ie&&Yt(!0)},[It,et,ie]),!It)return null;var Nt="auto",Lt={left:"-1000vw",top:"-1000vh",right:Nt,bottom:Nt};if(Bt||!De){var oi,di=Xe.points,ri=Xe.dynamicInset||((oi=Xe._experimental)===null||oi===void 0?void 0:oi.dynamicInset),ni=ri&&di[0][1]==="r",tt=ri&&di[0][0]==="b";ni?(Lt.right=xe,Lt.left=Nt):(Lt.left=nt,Lt.right=Nt),tt?(Lt.bottom=ge,Lt.top=Nt):(Lt.top=Tt,Lt.bottom=Nt)}var Ge={};return te&&(te.includes("height")&&he?Ge.height=he:te.includes("minHeight")&&he&&(Ge.minHeight=he),te.includes("width")&&le?Ge.width=le:te.includes("minWidth")&&le&&(Ge.minWidth=le)),De||(Ge.pointerEvents="none"),h.createElement(qe,{open:it||Je,getContainer:Ae&&function(){return Ae(ie)},autoDestroy:rt},h.createElement(x,{prefixCls:Fe,open:De,zIndex:je,mask:lt,motion:st}),h.createElement(F.Z,{onResize:ye,disabled:!De},function(pt){return h.createElement(E.default,(0,d.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:it,leavedClassName:"".concat(Fe,"-hidden")},ht,{onAppearPrepare:ee,onEnterPrepare:ee,visible:De,onVisibleChanged:function(Vt){var Jt;ht==null||(Jt=ht.onVisibleChanged)===null||Jt===void 0||Jt.call(ht,Vt),fe(Vt)}}),function(Mt,Vt){var Jt=Mt.className,Ci=Mt.style,mi=_()(Fe,Jt,ke);return h.createElement("div",{ref:(0,T.sQ)(pt,be,Vt),className:mi,style:(0,I.Z)((0,I.Z)((0,I.Z)((0,I.Z)({"--arrow-x":"".concat(Ze.x||0,"px"),"--arrow-y":"".concat(Ze.y||0,"px")},Lt),Ge),Ci),{},{boxSizing:"border-box",zIndex:je},We),onMouseEnter:mt,onMouseLeave:Et,onPointerEnter:at,onClick:Ve,onPointerDownCapture:kt},Qe&&h.createElement(L,{prefixCls:Fe,arrow:Qe,arrowPos:Ze,align:Xe}),h.createElement(O,{cache:!De&&!Oe},_e))})}))}),B=U,$=h.forwardRef(function(Ee,be){var ue=Ee.children,ke=Ee.getTriggerDOMNode,Fe=(0,T.Yr)(ue),We=h.useCallback(function(fe){(0,T.mH)(be,ke?ke(fe):fe)},[ke]),ie=(0,T.x1)(We,(0,T.C4)(ue));return Fe?h.cloneElement(ue,{ref:ie}):ue}),M=$,Y=h.createContext(null),q=Y;function se(Ee){return Ee?Array.isArray(Ee)?Ee:[Ee]:[]}function ce(Ee,be,ue,ke){return h.useMemo(function(){var Fe=se(ue!=null?ue:be),We=se(ke!=null?ke:be),ie=new Set(Fe),fe=new Set(We);return Ee&&(ie.has("hover")&&(ie.delete("hover"),ie.add("click")),fe.has("hover")&&(fe.delete("hover"),fe.add("click"))),[ie,fe]},[Ee,be,ue,ke])}var J=b(29194);function z(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ue=arguments.length>2?arguments[2]:void 0;return ue?Ee[0]===be[0]:Ee[0]===be[0]&&Ee[1]===be[1]}function Z(Ee,be,ue,ke){for(var Fe=ue.points,We=Object.keys(Ee),ie=0;ie<We.length;ie+=1){var fe,De=We[ie];if(z((fe=Ee[De])===null||fe===void 0?void 0:fe.points,Fe,ke))return"".concat(be,"-placement-").concat(De)}return""}function N(Ee,be,ue,ke){return be||(ue?{motionName:"".concat(Ee,"-").concat(ue)}:ke?{motionName:ke}:null)}function W(Ee){return Ee.ownerDocument.defaultView}function K(Ee){for(var be=[],ue=Ee==null?void 0:Ee.parentElement,ke=["hidden","scroll","clip","auto"];ue;){var Fe=W(ue).getComputedStyle(ue),We=Fe.overflowX,ie=Fe.overflowY,fe=Fe.overflow;[We,ie,fe].some(function(De){return ke.includes(De)})&&be.push(ue),ue=ue.parentElement}return be}function k(Ee){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ee)?be:Ee}function C(Ee){return k(parseFloat(Ee),0)}function V(Ee,be){var ue=(0,I.Z)({},Ee);return(be||[]).forEach(function(ke){if(!(ke instanceof HTMLBodyElement||ke instanceof HTMLHtmlElement)){var Fe=W(ke).getComputedStyle(ke),We=Fe.overflow,ie=Fe.overflowClipMargin,fe=Fe.borderTopWidth,De=Fe.borderBottomWidth,Re=Fe.borderLeftWidth,Oe=Fe.borderRightWidth,Ve=ke.getBoundingClientRect(),lt=ke.offsetHeight,Qe=ke.clientHeight,Ze=ke.offsetWidth,Xe=ke.clientWidth,ht=C(fe),st=C(De),it=C(Re),Ae=C(Oe),rt=k(Math.round(Ve.width/Ze*1e3)/1e3),qe=k(Math.round(Ve.height/lt*1e3)/1e3),je=(Ze-Xe-it-Ae)*rt,mt=(lt-Qe-ht-st)*qe,Et=ht*qe,at=st*qe,kt=it*rt,Bt=Ae*rt,nt=0,Tt=0;if(We==="clip"){var xe=C(ie);nt=xe*rt,Tt=xe*qe}var ge=Ve.x+kt-nt,ye=Ve.y+Et-Tt,ee=ge+Ve.width+2*nt-kt-Bt-je,te=ye+Ve.height+2*Tt-Et-at-mt;ue.left=Math.max(ue.left,ge),ue.top=Math.max(ue.top,ye),ue.right=Math.min(ue.right,ee),ue.bottom=Math.min(ue.bottom,te)}}),ue}function ne(Ee){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ue="".concat(be),ke=ue.match(/^(.*)\%$/);return ke?Ee*(parseFloat(ke[1])/100):parseFloat(ue)}function pe(Ee,be){var ue=be||[],ke=(0,P.Z)(ue,2),Fe=ke[0],We=ke[1];return[ne(Ee.width,Fe),ne(Ee.height,We)]}function Te(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ee[0],Ee[1]]}function Ke(Ee,be){var ue=be[0],ke=be[1],Fe,We;return ue==="t"?We=Ee.y:ue==="b"?We=Ee.y+Ee.height:We=Ee.y+Ee.height/2,ke==="l"?Fe=Ee.x:ke==="r"?Fe=Ee.x+Ee.width:Fe=Ee.x+Ee.width/2,{x:Fe,y:We}}function ve(Ee,be){var ue={t:"b",b:"t",l:"r",r:"l"};return Ee.map(function(ke,Fe){return Fe===be?ue[ke]||"c":ke}).join("")}function Ue(Ee,be,ue,ke,Fe,We,ie){var fe=h.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Fe[ke]||{}}),De=(0,P.Z)(fe,2),Re=De[0],Oe=De[1],Ve=h.useRef(0),lt=h.useMemo(function(){return be?K(be):[]},[be]),Qe=h.useRef({}),Ze=function(){Qe.current={}};Ee||Ze();var Xe=(0,y.Z)(function(){if(be&&ue&&Ee){let Pi=function(Zr,Ui){var rr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fi,Qi=Je.x+Zr,Br=Je.y+Ui,Xr=Qi+tt,Qr=Br+ni,In=Math.max(Qi,rr.left),wt=Math.max(Br,rr.top),Pt=Math.min(Xr,rr.right),ti=Math.min(Qr,rr.bottom);return Math.max(0,(Pt-In)*(ti-wt))},Mr=function(){hr=Je.y+hi,Yi=hr+ni,ci=Je.x+ii,fi=ci+tt};var it,Ae,rt,qe,je=be,mt=je.ownerDocument,Et=W(je),at=Et.getComputedStyle(je),kt=at.position,Bt=je.style.left,nt=je.style.top,Tt=je.style.right,xe=je.style.bottom,ge=je.style.overflow,ye=(0,I.Z)((0,I.Z)({},Fe[ke]),We),ee=mt.createElement("div");(it=je.parentElement)===null||it===void 0||it.appendChild(ee),ee.style.left="".concat(je.offsetLeft,"px"),ee.style.top="".concat(je.offsetTop,"px"),ee.style.position=kt,ee.style.height="".concat(je.offsetHeight,"px"),ee.style.width="".concat(je.offsetWidth,"px"),je.style.left="0",je.style.top="0",je.style.right="auto",je.style.bottom="auto",je.style.overflow="hidden";var te;if(Array.isArray(ue))te={x:ue[0],y:ue[1],width:0,height:0};else{var le,he,_e=ue.getBoundingClientRect();_e.x=(le=_e.x)!==null&&le!==void 0?le:_e.left,_e.y=(he=_e.y)!==null&&he!==void 0?he:_e.top,te={x:_e.x,y:_e.y,width:_e.width,height:_e.height}}var Je=je.getBoundingClientRect(),et=Et.getComputedStyle(je),ct=et.height,gt=et.width;Je.x=(Ae=Je.x)!==null&&Ae!==void 0?Ae:Je.left,Je.y=(rt=Je.y)!==null&&rt!==void 0?rt:Je.top;var It=mt.documentElement,Yt=It.clientWidth,Nt=It.clientHeight,Lt=It.scrollWidth,oi=It.scrollHeight,di=It.scrollTop,ri=It.scrollLeft,ni=Je.height,tt=Je.width,Ge=te.height,pt=te.width,Mt={left:0,top:0,right:Yt,bottom:Nt},Vt={left:-ri,top:-di,right:Lt-ri,bottom:oi-di},Jt=ye.htmlRegion,Ci="visible",mi="visibleFirst";Jt!=="scroll"&&Jt!==mi&&(Jt=Ci);var li=Jt===mi,Si=V(Vt,lt),Ht=V(Mt,lt),Fi=Jt===Ci?Ht:Si,ei=li?Ht:Fi;je.style.left="auto",je.style.top="auto",je.style.right="0",je.style.bottom="0";var or=je.getBoundingClientRect();je.style.left=Bt,je.style.top=nt,je.style.right=Tt,je.style.bottom=xe,je.style.overflow=ge,(qe=je.parentElement)===null||qe===void 0||qe.removeChild(ee);var zt=k(Math.round(tt/parseFloat(gt)*1e3)/1e3),$t=k(Math.round(ni/parseFloat(ct)*1e3)/1e3);if(zt===0||$t===0||(0,v.Sh)(ue)&&!(0,J.Z)(ue))return;var Xt=ye.offset,gi=ye.targetOffset,ui=pe(Je,Xt),bi=(0,P.Z)(ui,2),jt=bi[0],ji=bi[1],wi=pe(te,gi),Ti=(0,P.Z)(wi,2),lr=Ti[0],ln=Ti[1];te.x-=lr,te.y-=ln;var Mi=ye.points||[],Vi=(0,P.Z)(Mi,2),Ln=Vi[0],un=Vi[1],xi=Te(un),Di=Te(Ln),vi=Ke(te,xi),yr=Ke(Je,Di),Bi=(0,I.Z)({},ye),ii=vi.x-yr.x+jt,hi=vi.y-yr.y+ji,yi=Pi(ii,hi),br=Pi(ii,hi,Ht),ki=Ke(te,["t","l"]),cn=Ke(Je,["t","l"]),Ir=Ke(te,["b","r"]),qi=Ke(Je,["b","r"]),ur=ye.overflow||{},hn=ur.adjustX,Kr=ur.adjustY,cr=ur.shiftX,Pr=ur.shiftY,Er=function(Ui){return typeof Ui=="boolean"?Ui:Ui>=0},hr,Yi,ci,fi;Mr();var fn=Er(Kr),_i=Di[0]===xi[0];if(fn&&Di[0]==="t"&&(Yi>ei.bottom||Qe.current.bt)){var si=hi;_i?si-=ni-Ge:si=ki.y-qi.y-ji;var dn=Pi(ii,si),Or=Pi(ii,si,Ht);dn>yi||dn===yi&&(!li||Or>=br)?(Qe.current.bt=!0,hi=si,ji=-ji,Bi.points=[ve(Di,0),ve(xi,0)]):Qe.current.bt=!1}if(fn&&Di[0]==="b"&&(hr<ei.top||Qe.current.tb)){var Ni=hi;_i?Ni+=ni-Ge:Ni=Ir.y-cn.y-ji;var Wr=Pi(ii,Ni),Zi=Pi(ii,Ni,Ht);Wr>yi||Wr===yi&&(!li||Zi>=br)?(Qe.current.tb=!0,hi=Ni,ji=-ji,Bi.points=[ve(Di,0),ve(xi,0)]):Qe.current.tb=!1}var pn=Er(hn),_n=Di[1]===xi[1];if(pn&&Di[1]==="l"&&(fi>ei.right||Qe.current.rl)){var Sr=ii;_n?Sr-=tt-pt:Sr=ki.x-qi.x-jt;var wr=Pi(Sr,hi),Gr=Pi(Sr,hi,Ht);wr>yi||wr===yi&&(!li||Gr>=br)?(Qe.current.rl=!0,ii=Sr,jt=-jt,Bi.points=[ve(Di,1),ve(xi,1)]):Qe.current.rl=!1}if(pn&&Di[1]==="r"&&(ci<ei.left||Qe.current.lr)){var xr=ii;_n?xr+=tt-pt:xr=Ir.x-cn.x-jt;var Ar=Pi(xr,hi),Cr=Pi(xr,hi,Ht);Ar>yi||Ar===yi&&(!li||Cr>=br)?(Qe.current.lr=!0,ii=xr,jt=-jt,Bi.points=[ve(Di,1),ve(xi,1)]):Qe.current.lr=!1}Mr();var Ki=cr===!0?0:cr;typeof Ki=="number"&&(ci<Ht.left&&(ii-=ci-Ht.left-jt,te.x+pt<Ht.left+Ki&&(ii+=te.x-Ht.left+pt-Ki)),fi>Ht.right&&(ii-=fi-Ht.right-jt,te.x>Ht.right-Ki&&(ii+=te.x-Ht.right+Ki)));var tr=Pr===!0?0:Pr;typeof tr=="number"&&(hr<Ht.top&&(hi-=hr-Ht.top-ji,te.y+Ge<Ht.top+tr&&(hi+=te.y-Ht.top+Ge-tr)),Yi>Ht.bottom&&(hi-=Yi-Ht.bottom-ji,te.y>Ht.bottom-tr&&(hi+=te.y-Ht.bottom+tr)));var ir=Je.x+ii,fr=ir+tt,Ii=Je.y+hi,gn=Ii+ni,Fr=te.x,Tr=Fr+pt,zr=te.y,Ot=zr+Ge,mn=Math.max(ir,Fr),Vr=Math.min(fr,Tr),qr=(mn+Vr)/2,vn=qr-ir,yn=Math.max(Ii,zr),Rn=Math.min(gn,Ot),bn=(yn+Rn)/2,ai=bn-Ii;ie==null||ie(be,Bi);var Xi=or.right-Je.x-(ii+Je.width),Yr=or.bottom-Je.y-(hi+Je.height);zt===1&&(ii=Math.round(ii),Xi=Math.round(Xi)),$t===1&&(hi=Math.round(hi),Yr=Math.round(Yr));var kn={ready:!0,offsetX:ii/zt,offsetY:hi/$t,offsetR:Xi/zt,offsetB:Yr/$t,arrowX:vn/zt,arrowY:ai/$t,scaleX:zt,scaleY:$t,align:Bi};Oe(kn)}}),ht=function(){Ve.current+=1;var Ae=Ve.current;Promise.resolve().then(function(){Ve.current===Ae&&Xe()})},st=function(){Oe(function(Ae){return(0,I.Z)((0,I.Z)({},Ae),{},{ready:!1})})};return(0,c.Z)(st,[ke]),(0,c.Z)(function(){Ee||st()},[Ee]),[Re.ready,Re.offsetX,Re.offsetY,Re.offsetR,Re.offsetB,Re.arrowX,Re.arrowY,Re.scaleX,Re.scaleY,Re.align,ht]}var Be=b(94480);function Me(Ee,be,ue,ke,Fe){(0,c.Z)(function(){if(Ee&&be&&ue){let Ve=function(){ke(),Fe()};var We=be,ie=ue,fe=K(We),De=K(ie),Re=W(ie),Oe=new Set([Re].concat((0,Be.Z)(fe),(0,Be.Z)(De)));return Oe.forEach(function(lt){lt.addEventListener("scroll",Ve,{passive:!0})}),Re.addEventListener("resize",Ve,{passive:!0}),ke(),function(){Oe.forEach(function(lt){lt.removeEventListener("scroll",Ve),Re.removeEventListener("resize",Ve)})}}},[Ee,be,ue])}var St=b(48736);function He(Ee,be,ue,ke,Fe,We,ie,fe){var De=h.useRef(Ee);De.current=Ee;var Re=h.useRef(!1);h.useEffect(function(){if(be&&ke&&(!Fe||We)){var Ve=function(){Re.current=!1},lt=function(rt){var qe;De.current&&!ie(((qe=rt.composedPath)===null||qe===void 0||(qe=qe.call(rt))===null||qe===void 0?void 0:qe[0])||rt.target)&&!Re.current&&fe(!1)},Qe=W(ke);Qe.addEventListener("pointerdown",Ve,!0),Qe.addEventListener("mousedown",lt,!0),Qe.addEventListener("contextmenu",lt,!0);var Ze=(0,s.A)(ue);if(Ze&&(Ze.addEventListener("mousedown",lt,!0),Ze.addEventListener("contextmenu",lt,!0)),0)var Xe,ht,st,it;return function(){Qe.removeEventListener("pointerdown",Ve,!0),Qe.removeEventListener("mousedown",lt,!0),Qe.removeEventListener("contextmenu",lt,!0),Ze&&(Ze.removeEventListener("mousedown",lt,!0),Ze.removeEventListener("contextmenu",lt,!0))}}},[be,ue,ke,Fe,We]);function Oe(){Re.current=!0}return Oe}var ut=["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 $e(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D.Z,be=h.forwardRef(function(ue,ke){var Fe=ue.prefixCls,We=Fe===void 0?"rc-trigger-popup":Fe,ie=ue.children,fe=ue.action,De=fe===void 0?"hover":fe,Re=ue.showAction,Oe=ue.hideAction,Ve=ue.popupVisible,lt=ue.defaultPopupVisible,Qe=ue.onPopupVisibleChange,Ze=ue.afterPopupVisibleChange,Xe=ue.mouseEnterDelay,ht=ue.mouseLeaveDelay,st=ht===void 0?.1:ht,it=ue.focusDelay,Ae=ue.blurDelay,rt=ue.mask,qe=ue.maskClosable,je=qe===void 0?!0:qe,mt=ue.getPopupContainer,Et=ue.forceRender,at=ue.autoDestroy,kt=ue.destroyPopupOnHide,Bt=ue.popup,nt=ue.popupClassName,Tt=ue.popupStyle,xe=ue.popupPlacement,ge=ue.builtinPlacements,ye=ge===void 0?{}:ge,ee=ue.popupAlign,te=ue.zIndex,le=ue.stretch,he=ue.getPopupClassNameFromAlign,_e=ue.fresh,Je=ue.alignPoint,et=ue.onPopupClick,ct=ue.onPopupAlign,gt=ue.arrow,It=ue.popupMotion,Yt=ue.maskMotion,Nt=ue.popupTransitionName,Lt=ue.popupAnimation,oi=ue.maskTransitionName,di=ue.maskAnimation,ri=ue.className,ni=ue.getTriggerDOMNode,tt=(0,G.Z)(ue,ut),Ge=at||kt||!1,pt=h.useState(!1),Mt=(0,P.Z)(pt,2),Vt=Mt[0],Jt=Mt[1];(0,c.Z)(function(){Jt((0,l.Z)())},[]);var Ci=h.useRef({}),mi=h.useContext(q),li=h.useMemo(function(){return{registerSubPopup:function(Pt,ti){Ci.current[Pt]=ti,mi==null||mi.registerSubPopup(Pt,ti)}}},[mi]),Si=(0,f.Z)(),Ht=h.useState(null),Fi=(0,P.Z)(Ht,2),ei=Fi[0],or=Fi[1],zt=h.useRef(null),$t=(0,y.Z)(function(wt){zt.current=wt,(0,v.Sh)(wt)&&ei!==wt&&or(wt),mi==null||mi.registerSubPopup(Si,wt)}),Xt=h.useState(null),gi=(0,P.Z)(Xt,2),ui=gi[0],bi=gi[1],jt=h.useRef(null),ji=(0,y.Z)(function(wt){(0,v.Sh)(wt)&&ui!==wt&&(bi(wt),jt.current=wt)}),wi=h.Children.only(ie),Ti=(wi==null?void 0:wi.props)||{},lr={},ln=(0,y.Z)(function(wt){var Pt,ti,Ut=ui;return(Ut==null?void 0:Ut.contains(wt))||((Pt=(0,s.A)(Ut))===null||Pt===void 0?void 0:Pt.host)===wt||wt===Ut||(ei==null?void 0:ei.contains(wt))||((ti=(0,s.A)(ei))===null||ti===void 0?void 0:ti.host)===wt||wt===ei||Object.values(Ci.current).some(function(Kt){return(Kt==null?void 0:Kt.contains(wt))||wt===Kt})}),Mi=N(We,It,Lt,Nt),Vi=N(We,Yt,di,oi),Ln=h.useState(lt||!1),un=(0,P.Z)(Ln,2),xi=un[0],Di=un[1],vi=Ve!=null?Ve:xi,yr=(0,y.Z)(function(wt){Ve===void 0&&Di(wt)});(0,c.Z)(function(){Di(Ve||!1)},[Ve]);var Bi=h.useRef(vi);Bi.current=vi;var ii=h.useRef([]);ii.current=[];var hi=(0,y.Z)(function(wt){var Pt;yr(wt),((Pt=ii.current[ii.current.length-1])!==null&&Pt!==void 0?Pt:vi)!==wt&&(ii.current.push(wt),Qe==null||Qe(wt))}),yi=h.useRef(),br=function(){clearTimeout(yi.current)},ki=function(Pt){var ti=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;br(),ti===0?hi(Pt):yi.current=setTimeout(function(){hi(Pt)},ti*1e3)};h.useEffect(function(){return br},[]);var cn=h.useState(!1),Ir=(0,P.Z)(cn,2),qi=Ir[0],ur=Ir[1];(0,c.Z)(function(wt){(!wt||vi)&&ur(!0)},[vi]);var hn=h.useState(null),Kr=(0,P.Z)(hn,2),cr=Kr[0],Pr=Kr[1],Er=h.useState(null),hr=(0,P.Z)(Er,2),Yi=hr[0],ci=hr[1],fi=function(Pt){ci([Pt.clientX,Pt.clientY])},fn=Ue(vi,ei,Je&&Yi!==null?Yi:ui,xe,ye,ee,ct),_i=(0,P.Z)(fn,11),si=_i[0],dn=_i[1],Or=_i[2],Ni=_i[3],Wr=_i[4],Zi=_i[5],pn=_i[6],_n=_i[7],Sr=_i[8],wr=_i[9],Gr=_i[10],xr=ce(Vt,De,Re,Oe),Ar=(0,P.Z)(xr,2),Cr=Ar[0],Ki=Ar[1],tr=Cr.has("click"),ir=Ki.has("click")||Ki.has("contextMenu"),fr=(0,y.Z)(function(){qi||Gr()}),Ii=function(){Bi.current&&Je&&ir&&ki(!1)};Me(vi,ui,ei,fr,Ii),(0,c.Z)(function(){fr()},[Yi,xe]),(0,c.Z)(function(){vi&&!(ye!=null&&ye[xe])&&fr()},[JSON.stringify(ee)]);var gn=h.useMemo(function(){var wt=Z(ye,We,wr,Je);return _()(wt,he==null?void 0:he(wr))},[wr,he,ye,We,Je]);h.useImperativeHandle(ke,function(){return{nativeElement:jt.current,popupElement:zt.current,forceAlign:fr}});var Fr=h.useState(0),Tr=(0,P.Z)(Fr,2),zr=Tr[0],Ot=Tr[1],mn=h.useState(0),Vr=(0,P.Z)(mn,2),qr=Vr[0],vn=Vr[1],yn=function(){if(le&&ui){var Pt=ui.getBoundingClientRect();Ot(Pt.width),vn(Pt.height)}},Rn=function(){yn(),fr()},bn=function(Pt){ur(!1),Gr(),Ze==null||Ze(Pt)},ai=function(){return new Promise(function(Pt){yn(),Pr(function(){return Pt})})};(0,c.Z)(function(){cr&&(Gr(),cr(),Pr(null))},[cr]);function Xi(wt,Pt,ti,Ut){lr[wt]=function(Kt){var Dr;Ut==null||Ut(Kt),ki(Pt,ti);for(var Jr=arguments.length,Nr=new Array(Jr>1?Jr-1:0),en=1;en<Jr;en++)Nr[en-1]=arguments[en];(Dr=Ti[wt])===null||Dr===void 0||Dr.call.apply(Dr,[Ti,Kt].concat(Nr))}}(tr||ir)&&(lr.onClick=function(wt){var Pt;Bi.current&&ir?ki(!1):!Bi.current&&tr&&(fi(wt),ki(!0));for(var ti=arguments.length,Ut=new Array(ti>1?ti-1:0),Kt=1;Kt<ti;Kt++)Ut[Kt-1]=arguments[Kt];(Pt=Ti.onClick)===null||Pt===void 0||Pt.call.apply(Pt,[Ti,wt].concat(Ut))});var Yr=He(vi,ir,ui,ei,rt,je,ln,ki),kn=Cr.has("hover"),Pi=Ki.has("hover"),Mr,Zr;kn&&(Xi("onMouseEnter",!0,Xe,function(wt){fi(wt)}),Xi("onPointerEnter",!0,Xe,function(wt){fi(wt)}),Mr=function(Pt){(vi||qi)&&ei!==null&&ei!==void 0&&ei.contains(Pt.target)&&ki(!0,Xe)},Je&&(lr.onMouseMove=function(wt){var Pt;(Pt=Ti.onMouseMove)===null||Pt===void 0||Pt.call(Ti,wt)})),Pi&&(Xi("onMouseLeave",!1,st),Xi("onPointerLeave",!1,st),Zr=function(){ki(!1,st)}),Cr.has("focus")&&Xi("onFocus",!0,it),Ki.has("focus")&&Xi("onBlur",!1,Ae),Cr.has("contextMenu")&&(lr.onContextMenu=function(wt){var Pt;Bi.current&&Ki.has("contextMenu")?ki(!1):(fi(wt),ki(!0)),wt.preventDefault();for(var ti=arguments.length,Ut=new Array(ti>1?ti-1:0),Kt=1;Kt<ti;Kt++)Ut[Kt-1]=arguments[Kt];(Pt=Ti.onContextMenu)===null||Pt===void 0||Pt.call.apply(Pt,[Ti,wt].concat(Ut))}),ri&&(lr.className=_()(Ti.className,ri));var Ui=h.useRef(!1);Ui.current||(Ui.current=Et||vi||qi);var rr=(0,I.Z)((0,I.Z)({},Ti),lr),Qi={},Br=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Br.forEach(function(wt){tt[wt]&&(Qi[wt]=function(){for(var Pt,ti=arguments.length,Ut=new Array(ti),Kt=0;Kt<ti;Kt++)Ut[Kt]=arguments[Kt];(Pt=rr[wt])===null||Pt===void 0||Pt.call.apply(Pt,[rr].concat(Ut)),tt[wt].apply(tt,Ut)})});var Xr=h.cloneElement(wi,(0,I.Z)((0,I.Z)({},rr),Qi)),Qr={x:Zi,y:pn},In=gt?(0,I.Z)({},gt!==!0?gt:{}):null;return h.createElement(h.Fragment,null,h.createElement(F.Z,{disabled:!vi,ref:ji,onResize:Rn},h.createElement(M,{getTriggerDOMNode:ni},Xr)),Ui.current&&h.createElement(q.Provider,{value:li},h.createElement(B,{portal:Ee,ref:$t,prefixCls:We,popup:Bt,className:_()(nt,gn),style:Tt,target:ui,onMouseEnter:Mr,onMouseLeave:Zr,onPointerEnter:Mr,zIndex:te,open:vi,keepDom:qi,fresh:_e,onClick:et,onPointerDownCapture:Yr,mask:rt,motion:Mi,maskMotion:Vi,onVisibleChanged:bn,onPrepare:ai,forceRender:Et,autoDestroy:Ge,getPopupContainer:mt,align:wr,arrow:In,arrowPos:Qr,ready:si,offsetX:dn,offsetY:Or,offsetR:Ni,offsetB:Wr,onAlign:fr,stretch:le,targetWidth:zr/_n,targetHeight:qr/Sr})))});return be}var bt=$e(D.Z)},97197:function(yt,me){"use strict";me.Z={header:"header___HqHSe",checkboxs:"checkboxs___ObBnD",field:"field___w_sM6","oj-form-container":"oj-form-container____odYP","oj-left-panel":"oj-left-panel___emEB2","oj-form-info":"oj-form-info___m00Ag",footer:"footer___O4iSJ",collapse:"collapse___Ltfkj","test-case-name":"test-case-name___miZcb","btn-remove-case":"btn-remove-case___cHap2","icon-tag":"icon-tag___gmyTb",btn_back:"btn_back___tNmX3",testJi:"testJi___L3fHb",upBtn:"upBtn___RGH6X",djs:"djs____TS0n",time:"time___IAdHc"}},59243:function(yt,me,b){"use strict";var I=b(59301),P=b(93314),G=b(7939),D=Object.defineProperty,w=Object.defineProperties,_=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,y=(h,d,E)=>d in h?D(h,d,{enumerable:!0,configurable:!0,writable:!0,value:E}):h[d]=E,f=(h,d)=>{for(var E in d||(d={}))v.call(d,E)&&y(h,E,d[E]);if(F)for(var E of F(d))s.call(d,E)&&y(h,E,d[E]);return h},c=(h,d)=>w(h,_(d));const l=({img:h,buttonProps:d={},styles:E={},customText:T,ButtonText:L,ButtonClick:x,Buttonclass:A,ButtonTwo:O,imgStyles:U,loading:B=!1,className:$=""})=>I.createElement("section",{className:`tc animated fadeIn ${$}`,style:f({color:"#999",margin:"100px auto",visibility:B?"hidden":"visible"},E)},I.createElement("img",{src:h||P,style:c(f({},U),{pointerEvents:"none",userSelect:"none"})}),I.createElement("p",{className:"mt20 font14"},T||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),L&&I.createElement(G.ZP,f({className:A,onClick:x},d),L),O&&O);me.Z=l},47199:function(yt,me,b){"use strict";b.d(me,{Z:function(){return A}});var I=b(59301),P={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},G=b(7939),D=b(70557),w=b(58478),_=b(25399),F=b(31735),v=b(22167),s=b(59243),y=b(26869),f=b(38609),c=b(59301),l=Object.defineProperty,h=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,T=(O,U,B)=>U in O?l(O,U,{enumerable:!0,configurable:!0,writable:!0,value:B}):O[U]=B,L=(O,U)=>{for(var B in U||(U={}))d.call(U,B)&&T(O,B,U[B]);if(h)for(var B of h(U))E.call(U,B)&&T(O,B,U[B]);return O},x=(O,U,B)=>new Promise(($,M)=>{var Y=ce=>{try{se(B.next(ce))}catch(J){M(J)}},q=ce=>{try{se(B.throw(ce))}catch(J){M(J)}},se=ce=>ce.done?$(ce.value):Promise.resolve(ce.value).then(Y,q);se((B=B.apply(O,U)).next())}),A=({editOffice:O="view",data:U,issaver:B,onSaver:$,theme:M,type:Y,filename:q,monacoEditor:se,className:ce,style:J,close:z,onClose:Z,hasMask:N,disabledDownload:W,onImgDimensions:K,showNodata:k,recordInfo:C})=>{const[V,ne]=(0,I.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[pe,Te]=(0,I.useState)(""),[Ke,ve]=(0,I.useState)(),Ue=window.ENV==="build"?"/react/build":"",Be=location.host.startsWith("localhost")?y.Z.PROXY_SERVER:y.Z.API_SERVER,St=10*(1024*1024),He=(0,I.useRef)();U!=null&&U.startsWith("/api")&&Y!=="txt"&&(U=y.Z.API_SERVER+U);const ut=ue=>ue.substring(ue.lastIndexOf("/")+1).split(".").pop();q&&se&&(se.filename=q),(0,I.useEffect)(()=>{var ue,ke;const Fe=(ke=(ue=document.cookie)==null?void 0:ue.replace(/\s/g,""))==null?void 0:ke.split(";");Fe==null||Fe.map(We=>{let ie=We.split("=");ie[0]==="_educoder_session"&&Te(ie[1])})},[]),(0,I.useEffect)(()=>{Y==="office"&&(U.indexOf("bigfilescdn.")>-1||U.indexOf("bigfiles1")>-1?ve({url:U,fileType:ut(U),model:U.indexOf("model=edit")?"edit":"view"}):bt())},[Y,U]);function $e(ue){return x(this,null,function*(){ue.data.type==="pdfdata"&&($(ue.data.data),window.removeEventListener("message",$e,!1)),console.log("mess---:",ue.data)})}const bt=()=>x(void 0,null,function*(){console.log("data:",U);let ue=U;U.startsWith("http")||(ue=location.origin+ue);let ke=new URL(ue).pathname.split("/").pop();const Fe=yield(0,v.gJ)({attachment_id:ke});Fe.url=Be+Fe.url,ve(Fe)}),Ee=()=>{if(U.startsWith("http")||U.startsWith("blob:")){be();return}(0,F.Sv)(q||"educoder",U,q)},be=()=>{C&&(0,f.fc)({id:C==null?void 0:C.id,watch_type:1,course_id:C==null?void 0:C.course_id}),(0,F.Nd)(q||"educoder",decodeURIComponent(U))};return c.createElement("div",{style:L({},J||{}),className:`${N&&P.bgBlack} ${Y?P.wrp:"hide"}`},z&&c.createElement("div",{className:P.close,ref:He},!!K&&c.createElement(_.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>He.current},c.createElement("span",{onClick:()=>{Z(),K()}},c.createElement("i",{className:"icon-yulanpizhu"}))),!W&&c.createElement(_.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>He.current},c.createElement("span",{onClick:be},c.createElement("i",{className:"icon-quxiaozhiding"}))),B&&c.createElement(_.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>He.current},c.createElement("span",{className:"",onClick:()=>{const ue=document.getElementById("pdfiframe");window.addEventListener("message",$e,!1),setTimeout(()=>{ue.contentWindow.postMessage("getData","*")},300)}},c.createElement("i",{className:"icon-baocun"}))),c.createElement(_.Z,{title:"\u5173\u95ED",getPopupContainer:()=>He.current},c.createElement("span",{className:"",onClick:()=>{Z()}},c.createElement("i",{className:"icon-guanbi1"})))),c.createElement("div",{className:`${P[ce]} ${ce} ${P.monaco} ${Y==="txt"?"show":"hide"}`},Y==="txt"&&c.createElement(c.Fragment,null,c.createElement(w.ZP,L({},se)))),Y==="audio"&&c.createElement("audio",{src:`${(U==null?void 0:U.indexOf("http://"))>-1||(U==null?void 0:U.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${U}`,autoPlay:!0}),Y==="video"&&c.createElement(c.Fragment,null,(U==null?void 0:U.indexOf("http"))>-1?c.createElement("video",{controls:!0,src:`${U}`,autoPlay:!0}):c.createElement("video",{controls:!0,src:`data:video/mp4;base64,${U}`,autoPlay:!0})),Y==="office"&&Ke&&c.createElement("iframe",{src:`${Ue}/office.html?key=${Ke.key}&url=${btoa(Ke.url)}&callbackUrl=${Be+(Ke.callbackUrl||"")}&fileType=${Ke.fileType}&title=${Ke.title||""}&model=${O}&officeServer=${y.Z.ONLYOFFICE}&disabledDownload=${!!W}`}),Y==="html"&&c.createElement("iframe",{src:U+"&disposition=inline"}),Y==="pdf"&&B&&c.createElement("iframe",{id:"pdfiframe",src:`${Ue}/js/pdfview/index.html?filename=${q||"educoder.pdf"}&url=${encodeURIComponent(U)}&disabledDownload=${!!W}&model=${O}`}),Y==="pdf"&&!B&&c.createElement("embed",{className:P.embed,src:U+"#toolbar=0&statusbar=0&navpanes=0&scrollbars=0"}),Y==="image"&&c.createElement("img",{src:`${(U==null?void 0:U.indexOf("http://"))>-1||(U==null?void 0:U.indexOf("https://"))>-1?"":"data:image/png;base64,"}${U}`}),(Y==="other"||Y==="download")&&c.createElement(c.Fragment,null,k?c.createElement(s.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:c.createElement(G.ZP,{icon:c.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:Ee,disabled:W},"\u4E0B\u8F7D")}):c.createElement(G.ZP,{type:"primary",size:"middle",onClick:Ee,disabled:W},c.createElement(D.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")),Y==="flowChart"&&c.createElement("div",{className:"embed"},c.createElement("iframe",{src:`/drawio/src/main/webapp/viewer.html?id=${U||""}&gapi=0&od=0&db=0&gh=0&gl=0`,width:"100%",height:"100%",frameBorder:"0"})))}},59944:function(yt,me,b){"use strict";b.d(me,{z:function(){return se},Z:function(){return ce}});var I=b(59301),P=b(54196),G=b(58489),D=b(64018),w=b(80360),_=b(26869),F=b(31735),v=b(15342),s=b(44104),y=b(7939),f=b(1012),c=b(47199),l=b(59301),d=({html:J})=>{const z=(0,I.useRef)(null),Z=(0,I.useRef)(null),N=`.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,I.useEffect)(()=>{const W=z.current.attachShadow({mode:"open"});Z.current=document.createElement("div"),Z.current.className="markdown-body",Z.current.innerHTML=J,W.appendChild(Z.current);const K=document.createElement("style");return K.textContent=N,W.appendChild(K),()=>{W.innerHTML=""}},[]),(0,I.useEffect)(()=>{Z.current&&(Z.current.innerHTML=J)},[J]),l.createElement("div",{ref:z})};function E(J){const z=["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"],Z=new RegExp(`\\b(${z.join("|")})\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]*)`,"gi");return J.replace(Z,"").trim()}var T={mdBody:"mdBody___raKXb",button:"button___Ch5Pc",previewFlowChart:"previewFlowChart___vY1dq"},L=Object.defineProperty,x=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,U=(J,z,Z)=>z in J?L(J,z,{enumerable:!0,configurable:!0,writable:!0,value:Z}):J[z]=Z,B=(J,z)=>{for(var Z in z||(z={}))A.call(z,Z)&&U(J,Z,z[Z]);if(x)for(var Z of x(z))O.call(z,Z)&&U(J,Z,z[Z]);return J};const $="@\u2581\u2581@",M="@\u2581@",Y=/<pre[^>]*>/g;function q(J){let z=document.createElement("div");return z.innerHTML=J,z.childNodes.length===0?"":z.childNodes[0].nodeValue}const se=(J,z)=>{J=J||"";const Z=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,N=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,W=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,K=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return z?J.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(Z,(k,C,V,ne,pe,Te,Ke)=>{const ve=C||ne||Te,Ue=V||pe||Ke||"?";return _.Z.API_SERVER+"/api/attachments/"+ve+Ue+"&t="+(0,F.Jn)(ve,Date.now())+(k.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(J=J.replace(K,(k,C,V,ne,pe,Te,Ke)=>{const ve=C||ne||Te,Ue=V||pe||Ke||"?";return _.Z.API_SERVER+"/attachments/download/"+ve+Ue+"&t="+(0,F.Jn)(ve,Date.now())+(k.indexOf(")")>-1?")":"&")}).replace(Z,(k,C,V,ne,pe,Te,Ke)=>{const ve=C||ne||Te,Ue=V||pe||Ke||"?";return _.Z.API_SERVER+"/api/attachments/"+ve+Ue+"&t="+(0,F.Jn)(ve,Date.now())+(k.indexOf(")")>-1?")":"&")}).replace(N,(k,C,V,ne,pe)=>{const Te=C||ne,Ke=V||pe||"";return'"'+_.Z.API_SERVER+"/api/attachments/"+Te+Ke+Te+Ke+"&t="+(0,F.Jn)(Te,Date.now())}).replace(W,(k,C,V,ne,pe)=>{const Te=C||ne,Ke=V||pe||"";return"("+_.Z.API_SERVER+"/files/uploads/"+Te+Ke+Te+Ke+"&t="+(0,F.Jn)(Te,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,`
|
|
|
`),J)};var ce=({value:J="",edit:z=!1,className:Z,showTextOnly:N,showLines:W,style:K={},stylesPrev:k={},highlightKeywords:C,showProgramFill:V,isProgramFill:ne,disabledFill:pe=!1,programFillValue:Te,openEditor:Ke=()=>{},onFillChange:ve=Me=>{},onFillBlur:Ue=()=>{},onFillFocus:Be=()=>{}})=>{let Me=E(String(J||""));const St=(0,I.useRef)(),He=(0,I.useRef)(),[ut,$e]=(0,I.useState)(""),[bt,Ee]=(0,I.useState)("office"),[be,ue]=(0,I.useState)([]),ke=(0,I.useRef)("a"+(0,f.Z)()),Fe={},We=Ae=>/<style[\s\S]*?>/i.test(Ae||""),ie=(Ae,rt,qe)=>{const je=document.createElement(Ae===M?"input":"textarea");je.style.width="100%",je.style.height=Ae===M?"40px":"151px",je.rows=5,je.spellcheck=!1,je.name="edu-program-fill",je.placeholder="\u8BF7\u8F93\u5165",je.dataset.id=rt;const mt=Object.keys(Fe).length;return Fe[mt]=je,`<span class="edu-program-fill-wrap ${Ae===M?"":"show"}" style="width:${Ae===M?"600px":"100%"}" title=${qe||""}><span>${je.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function fe(Ae){return Ae=Ae.replace(/!\[.*?\]\(.*?\)/g,""),Ae=Ae.replace(/\[.*?\]\(.*?\)/g,""),Ae=Ae.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),Ae=Ae.replace(/<embed.*?>/g,""),Ae=Ae.replace(/<img.*?>/g,""),Ae=Ae.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),Ae=Ae.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),Ae=Ae.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),Ae=Ae.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),Ae}const De=Ae=>!N&&We(Me)?Ae:Ae.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(rt,qe){let je=qe.replace(/(\n|\r)/g,"").split("}"),mt=[];return je.map(Et=>{Et!=""&&mt.push(`.${ke.current} ${Et}`)}),`<style>${mt.join("}")}</style>`}),Re=(0,I.useMemo)(()=>{try{const je=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,mt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Et=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,at=/\(\/attachments\/download\//g;Me=Me.replace(at,"("+_.Z.API_SERVER+"/attachments/download/").replace(je,"("+_.Z.API_SERVER+"/api/attachments/").replace(mt,'"'+_.Z.API_SERVER+"/api/attachments/").replace(Et,'"'+_.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,`
|
|
|
`),St.current.style.display="none"}catch(je){}if(V){let je=-1;return Me=Me.replaceAll("<","<").replaceAll(">",">").replace(/(@▁▁@|@▁@)/g,function(mt,Et,at){var kt;return++je,ie(mt,je,(kt=Te==null?void 0:Te[je])==null?void 0:kt.value.replaceAll("<","<").replaceAll(">",">"))}),`<pre style="background:#fff;padding:4px">${De(Me||"")}</pre>`}let Ae=De(Me);Ae=(0,G.ZP)(Ae);const rt=(0,G.ez)();Me.match(/\[TOC\]/)&&(Ae=Ae.replace("<p>[TOC]</p>",(0,G.Qv)()),(0,G.Iy)()),Ae=Ae.replace(/(__special_katext_id_\d+__)/g,(je,mt)=>{const{type:Et,expression:at}=rt[mt];return(0,v.renderToString)(q(at)||"",{displayMode:Et==="block",throwOnError:!1,output:"html"})}),Ae=Ae.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,G.AL)();const qe=document.createElement("div");if(qe.innerHTML=Ae,N)return qe.innerText;if(C){const je=C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return Qe(qe,je),qe.innerHTML}return setTimeout(()=>ht(),500),qe.innerHTML},[Me,C]);(0,I.useEffect)(()=>{Ze.current&&Ze.current.querySelectorAll(["input","textarea"]).forEach(rt=>{rt.oninput=Oe,rt.onblur=Ve,rt.onfocus=lt})},[be]),(0,I.useEffect)(()=>{var Ae,rt,qe,je,mt;if(Te!=null&&Te.length)try{const Et=Ze.current.querySelectorAll(".edu-program-fill-score"),at=Ze.current.querySelectorAll('[name="edu-program-fill"]');for(const[kt,Bt]of at.entries())Bt.value=((Ae=Te==null?void 0:Te[kt])==null?void 0:Ae.value)||"",((rt=Te==null?void 0:Te[kt])==null?void 0:rt.type)==="warning"?Bt.className="program-fill-warning":((qe=Te==null?void 0:Te[kt])==null?void 0:qe.type)==="success"?Bt.className="program-fill-success":Bt.className="";for(const[kt,Bt]of Et.entries())Bt.innerHTML=(je=Te==null?void 0:Te[kt])!=null&&je.score?`${(mt=Te==null?void 0:Te[kt])==null?void 0:mt.score}\u5206`:"";ue(Te)}catch(Et){console.log(Et,"error")}},[Te]);const Oe=Ae=>{be[Ae.target.dataset.id]=be[Ae.target.dataset.id]||{},be[Ae.target.dataset.id].value=Ae.target.value,ue([...be]),ve(be,Ae.target.dataset.id)},Ve=Ae=>{be[Ae.target.dataset.id]=be[Ae.target.dataset.id]||{},be[Ae.target.dataset.id].value=Ae.target.value,ue([...be]),Ue(be,Ae.target.dataset.id)},lt=Ae=>{be[Ae.target.dataset.id]=be[Ae.target.dataset.id]||{},be[Ae.target.dataset.id].value=Ae.target.value,ue([...be]),Be(be,Ae.target.dataset.id)};function Qe(Ae,rt){return Ae.childNodes.forEach(qe=>{var je;if(qe.childNodes.length>0)Qe(qe,rt);else if(qe.nodeName!=="IMG")if(qe.innerHTML)qe.innerHTML=(je=qe.innerHTML)==null?void 0:je.replace(new RegExp(rt,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const mt=document.createElement("span");mt.innerHTML=qe.textContent.replace(new RegExp(rt,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),qe.replaceWith(mt)}})}const Ze=(0,I.useRef)();G.jb.WebkitLineClamp=W,W&&(K=B(B({},K),G.jb));function Xe(Ae){let rt=Ae.target;if(rt.tagName.toUpperCase()==="A"){let qe=rt.getAttribute("href");if(qe.indexOf("office")>-1)Ae.preventDefault(),$e(qe),Ee("office");else if(qe.indexOf("application/pdf")>-1)Ae.preventDefault(),$e(qe),Ee("pdf");else if(qe.indexOf("text/html")>-1)Ae.preventDefault(),$e(qe),Ee("html");else if(qe.startsWith("#")){Ae.preventDefault();let je=document.getElementById(qe.replace("#",""));je&&je.scrollIntoView(!0)}}}const ht=()=>{var Ae;const rt=(Ae=Ze.current)==null?void 0:Ae.querySelectorAll("video");rt==null||rt.forEach(qe=>{if(qe.oncontextmenu=()=>!1,qe.src.indexOf(".m3u8")>-1&&!qe.canPlayType("application/vnd.apple.mpegurl")){if(w.ZP.isSupported()){var je=new w.ZP;je.loadSource(qe.src),je.attachMedia(qe)}}})};(0,I.useEffect)(()=>{if(Ze.current&&Re&&Re.match(Y)&&window.PR.prettyPrint(),Ze.current)return Ze.current.addEventListener("click",Xe),()=>{var Ae;(Ae=Ze.current)==null||Ae.removeEventListener("click",Xe),(0,G.AL)(),(0,G.Iy)()}},[Re,Ze.current,Xe]);const st=Ae=>{Ae.target.nodeName==="IMG"&&Ae.target.className.indexOf("draw-flowchart")>-1?(St.current.style.zIndex=1,St.current.style.display="flex",St.current.style.width=Ae.target.clientWidth+"px",St.current.style.height=Ae.target.clientHeight+"px",St.current.style.top=Ae.target.offsetTop+"px",St.current.style.left=Ae.target.offsetLeft+"px",Ae.target.id&&(He.current=Ae.target.id)):St.current.style.display="none"},it=()=>{St.current.style.display="none"};return(0,I.useEffect)(()=>{var Ae;const rt=qe=>{qe.preventDefault(),qe.clipboardData.setData("text",window.getSelection().toString())};return(Ae=Ze.current)==null||Ae.addEventListener("copy",rt),()=>{var qe;(qe=Ze.current)==null||qe.removeEventListener("copy",rt)}},[Ze.current]),I.createElement("div",{style:{position:"relative"},onMouseLeave:it},N&&I.createElement("div",{ref:Ze,className:`${T.mdBody} `},Re),!N&&!We(Re)&&I.createElement("div",{ref:Ze,style:B({},K),onMouseOver:st,className:`${Z||""} ${pe?"disabled-fill":""} markdown-body ${T.mdBody} ${ke.current}`,dangerouslySetInnerHTML:{__html:Re}}),!N&&We(Re)&&I.createElement(d,{html:Re}),I.createElement("div",{ref:St,className:`${T.button} ${z?"":T.previewFlowChart}`},I.createElement(s.Z,null,I.createElement(y.ZP,{onClick:()=>{z?Ke(He.current):($e(He.current),Ee("flowChart"))}},z?"\u7F16\u8F91":"\u9884\u89C8"))),I.createElement(c.Z,{close:!0,data:ut,type:ut!=null&&ut.length?bt:"",style:B({},k),onClose:()=>$e("")}))}},69654:function(yt,me,b){"use strict";b.d(me,{Z:function(){return D}});var I=b(58106),P={ldsRing:"ldsRing___mpBZC",idsRingWrapper:"idsRingWrapper___Of9_n",ldsring:"ldsring___o0w2t"},G=b(59301),D=({message:w,className:_,children:F,style:v={}})=>G.createElement("div",{className:`custom-spinner ${P.idsRingWrapper} ${_}`},G.createElement("div",{className:P.ldsRing},G.createElement("div",null),G.createElement("div",null),G.createElement("div",null),G.createElement("div",null)),w?G.createElement("p",{style:v},w):null,F,G.createElement(I.Outlet,null))},41556:function(yt,me,b){"use strict";b.d(me,{Z:function(){return _}});var I=b(59301),P={flex_box_center:"flex_box_center___Gc4dd",flex_space_between:"flex_space_between___K2f1v",flex_box_vertical_center:"flex_box_vertical_center___pupRp",flex_box_center_end:"flex_box_center_end___UDLRC",flex_box_column:"flex_box_column___a5uDo",result:"result___gu5zt",title:"title___xrnx2",left:"left___IAxp9",leftNode:"leftNode___HL8fG",right:"right___ZXYmw",rightNode:"rightNode___jYL5_"},G=b(92310),D=b.n(G),_=({className:F,style:v={},leftNode:s,leftTitle:y="\u81EA\u6D4B\u8F93\u5165",rightNode:f,rightTitle:c="\u8FD0\u884C\u7ED3\u679C"})=>I.createElement("div",{className:D()(P.result,F),style:v},I.createElement("div",{className:P.left},I.createElement("div",{className:P.title},I.createElement("i",{style:{color:"#08CF76"},className:"iconfont iconfont icon-zidingyiceshiyongli font14 mr5"}),I.createElement("span",null,y)),I.createElement("div",{className:P.leftNode},s)),I.createElement("div",{className:P.right},I.createElement("div",{className:P.title},I.createElement("i",{style:{color:"#00DFFF"},className:"iconfont iconfont icon-daimazhihangjieguo font14 mr5"}),I.createElement("span",null,c)),I.createElement("div",{className:P.rightNode},f)))},58478:function(yt,me,b){"use strict";b.d(me,{SV:function(){return St},ZP:function(){return Me}});var I=b(59301),P=b(76374);const G={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"]},D={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"]},w={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(`
|
|
|
`)}]},_={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(`
|
|
|
`)}]},F={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 v=b(53184),s=b.n(v),y=(He,ut,$e)=>new Promise((bt,Ee)=>{var be=Fe=>{try{ke($e.next(Fe))}catch(We){Ee(We)}},ue=Fe=>{try{ke($e.throw(Fe))}catch(We){Ee(We)}},ke=Fe=>Fe.done?bt(Fe.value):Promise.resolve(Fe.value).then(be,ue);ke(($e=$e.apply(He,ut)).next())});const f={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"]}},c=(He,ut,$e,bt)=>{const Ee=ut.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:$e.lineNumber,endColumn:$e.column});return Array.from(new Set(Ee.match(/\b\w{2,}\b/g)||[])).map(ue=>({label:ue,kind:He.languages.CompletionItemKind.Text,insertText:ue,range:bt}))},l=(He,ut,$e,bt)=>{He.languages.registerCompletionItemProvider(ut,{provideCompletionItems(Ee,be){const ue=Ee.getWordUntilPosition(be),ke={startLineNumber:be.lineNumber,endLineNumber:be.lineNumber,startColumn:ue.startColumn,endColumn:ue.endColumn},Fe=Ee.getLineContent(be.lineNumber).substring(ue.startColumn-2,ue.endColumn);return{suggestions:[...c(He,Ee,be,ke),...$e.map(ie=>({label:ie,kind:He.languages.CompletionItemKind.Keyword,documentation:ie,insertText:ie,insertTextRules:He.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ke})),...bt.map(ie=>({label:ie.label,kind:He.languages.CompletionItemKind.Snippet,documentation:ie.content,insertText:Fe.startsWith("#")?ie.content.replace(/#/,""):ie.content,insertTextRules:He.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ke}))]}}})};var h=He=>{f.languages.forEach(ut=>{He.languages.registerDocumentFormattingEditProvider(ut,{provideDocumentFormattingEdits($e){return y(this,null,function*(){const bt=s()($e.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:$e.getFullModelRange(),text:bt}]})}})}),l(He,"java",D.keywords,D.quickKey),l(He,"cpp",w.keywords,w.quickKey),l(He,"c",G.keywords,[]),l(He,"python",_.keywords,_.quickKey),l(He,"scala",F.keywords,F.quickKey)};const d="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var E=Object.defineProperty,T=(He,ut,$e)=>ut in He?E(He,ut,{enumerable:!0,configurable:!0,writable:!0,value:$e}):He[ut]=$e,L=(He,ut,$e)=>T(He,typeof ut!="symbol"?ut+"":ut,$e);const x=class ol{constructor(ut,$e,bt){this.placeholder=ut,this.editor=$e,this.monaco=bt,$e.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return ol.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)}};L(x,"ID","editor.widget.placeholderHint");var O=x,U=b(96236),B=b(6767),$=b(25399),M=b(89392),Y=b(94276),q=b(56102),se=Object.defineProperty,ce=Object.defineProperties,J=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,W=(He,ut,$e)=>ut in He?se(He,ut,{enumerable:!0,configurable:!0,writable:!0,value:$e}):He[ut]=$e,K=(He,ut)=>{for(var $e in ut||(ut={}))Z.call(ut,$e)&&W(He,$e,ut[$e]);if(z)for(var $e of z(ut))N.call(ut,$e)&&W(He,$e,ut[$e]);return He},k=(He,ut)=>ce(He,J(ut)),C=(He,ut)=>{var $e={};for(var bt in He)Z.call(He,bt)&&ut.indexOf(bt)<0&&($e[bt]=He[bt]);if(He!=null&&z)for(var bt of z(He))ut.indexOf(bt)<0&&N.call(He,bt)&&($e[bt]=He[bt]);return $e},V=(He,ut,$e)=>new Promise((bt,Ee)=>{var be=Fe=>{try{ke($e.next(Fe))}catch(We){Ee(We)}},ue=Fe=>{try{ke($e.throw(Fe))}catch(We){Ee(We)}},ke=Fe=>Fe.done?bt(Fe.value):Promise.resolve(Fe.value).then(be,ue);ke(($e=$e.apply(He,ut)).next())});function ne(He){return/^\d+$/.test(He)?`${He}px`:He}function pe(){}let Te=!1;const Ke={"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 ve(He=[]){let ut=He;if(Array.isArray(He)){for(let $e=0;$e<He.length;$e++){let bt=Ke[He[$e]];if(bt)return bt}return ut[0]}return Ke[ut]||ut}let Ue=null;const Be=()=>V(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 Me=He=>{var ut=He,{width:$e="100%",height:bt="100%",value:Ee,language:be="javascript",style:ue={},options:ke={},overrideServices:Fe={},theme:We="vs-dark",onEditBlur:ie,isCopy:fe=!1,onSave:De,autoHeight:Re=!1,forbidCopy:Oe=!1,onChange:Ve=pe,editorDidMount:lt=pe,onFocus:Qe=pe,onBreakPoint:Ze=pe,breakPointValue:Xe=[],filename:ht="educoder.txt",errorLine:st,errorContent:it="",highlightLine:Ae,openBreakPoint:rt=!1,placeholder:qe="",showMiniMap:je=!0}=ut,mt=C(ut,["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,I.useRef)(),at=(0,I.useRef)({}),kt=(0,I.useRef)(),Bt=(0,I.useRef)(),nt=(0,I.useRef)([]),Tt=(0,I.useRef)(!1),xe=(0,I.useRef)(),ge=(0,I.useRef)(),ye=(0,I.useRef)(!1),[ee,te]=(0,I.useState)(!1);function le(){let tt;return Et.current&&(tt=new P.Z(Ge=>{for(let pt of Ge)(pt.target.offsetHeight>0||pt.target.offsetWidth>0)&&at.current.instance.layout()}),tt.observe(Et.current)),tt}function he(){B.ZP.warning({content:decodeURIComponent(d),key:"monaco-editor-tip"})}const _e=()=>{let tt=at.current.instance;if(Ee!=null&&tt&&ee){const Ge=tt.getModel();Ge&&Ee!==Ge.getValue()&&(Te=!0,Ge.setValue(Ee),tt.layout(),Te=!1)}};(0,I.useEffect)(()=>{const tt=Y.Z.subscribe("formatDocument",Ge=>{var pt;let Mt=at.current.instance;(pt=Mt==null?void 0:Mt.getAction)==null||pt.call(Mt,"editor.action.formatDocument").run()});return window.updateMonacoValue=Ge=>{Ve(Ge)},tt},[]),(0,I.useEffect)(()=>{var tt;let Ge=at.current.instance;Bt.current&&clearTimeout(Bt.current),Bt.current=setTimeout(()=>{_e()},500),Ee&&(Ee!=null&&Ee.length)&&((tt=Ge==null?void 0:Ge.updateOptions)==null||tt.call(Ge,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(Ee.split(/\r\n|\r|\n/g).length))+3,5)}))},[Ee,ee,at.current]),(0,I.useEffect)(()=>{if(st&&at.current&&at.current.instance){let Ge=at.current.instance;Ge.changeViewZones(function(pt){var Mt=document.createElement("div");Mt.style.padding="10px 20px",Mt.style.width="calc(100% - 20px)",Mt.className="my-error-line-wrp",Mt.innerHTML=it,pt.addZone({afterLineNumber:st||11,heightInLines:3,domNode:Mt})});var tt={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}};Ge.addOverlayWidget(tt),Ge.revealPositionInCenter({lineNumber:20,column:1})}},[st,at.current,ee]);const Je=(tt="",Ge)=>{if(!tt||tt.trim()==="")return!0;const Mt=at.current.instance.getModel().getLineTokens(Ge);let Vt=!1;for(let Jt=0;Jt<2;Jt++)Mt.getStandardTokenType(Jt)===1&&(Vt=!0);return Vt};(0,I.useEffect)(()=>{var tt;const Ge=(tt=at.current)==null?void 0:tt.instance;if(Ge&&ee&&Oe){const pt=Ge.onDidBlurEditorWidget(()=>{ye.current=!1}),Mt=Ge.onDidFocusEditorText(()=>{ye.current=!0});return()=>{pt.dispose(),Mt.dispose()}}},[at.current,ee,Oe]),(0,I.useEffect)(()=>{var tt;if((tt=at.current)!=null&&tt.instance&&ee&&rt){let Ge=at.current.instance,pt=Ge.getModel();if(!pt)return;(()=>{var zt;let $t=[],Xt=[];const gi=pt.getAllDecorations();for(let bi of gi)bi.options.className==="highlighted-line"&&($t.push((zt=bi==null?void 0:bi.range)==null?void 0:zt.startLineNumber),Xt.push(bi==null?void 0:bi.id));if(Ae===$t[0])return;pt.deltaDecorations(Xt,[]);const ui=pt.getLineCount();Ae&&Ae<=ui&&(Ge.deltaDecorations([],[{range:new Ue.Range(Ae,1,Ae,pt.getLineMaxColumn(Ae)),options:{isWholeLine:!0,className:"highlighted-line"}}]),Ge.revealLineInCenter(Ae))})();const Vt=(zt=!1)=>{var $t;let Xt=[],gi=[];const ui=pt.getAllDecorations();for(let bi of ui)bi.options.linesDecorationsClassName==="breakpoints-select"&&(Xt.push(($t=bi==null?void 0:bi.range)==null?void 0:$t.startLineNumber),gi.push(bi==null?void 0:bi.id));if(zt)return{lines:Xt,ids:gi};Ze(Xt)},Jt=zt=>V(void 0,null,function*(){let $t={range:new Ue.Range(zt,1,zt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield pt.deltaDecorations([],[$t]),Vt()}),Ci=zt=>V(void 0,null,function*(){let $t=[];const Xt=Ge.getLineDecorations(zt);for(let gi of Xt)gi.options.linesDecorationsClassName==="breakpoints-select"&&$t.push(gi.id);yield pt.deltaDecorations($t,[]),Vt()}),mi=zt=>{let $t=Ge.getLineDecorations(zt);for(let Xt of $t)if(Xt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,M.isEqual)(Xe,Vt(!0).lines)){pt.deltaDecorations(Vt(!0).ids,[]);const zt=Xe.map($t=>({range:new Ue.Range($t,1,$t,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));pt.deltaDecorations([],zt)}const li=Ge.onDidChangeModelContent(zt=>{let $t=Ge.getPosition();if($t){let Xt=$t.lineNumber;clearTimeout(ge.current),ge.current=setTimeout(()=>{Je(pt.getLineContent(Xt),Xt)?Ci(Xt):mi(Xt)?(Ci(Xt),Jt(Xt)):Vt()},100)}}),Si=Ge.onMouseDown(zt=>{var $t,Xt,gi;if(zt.target.detail&&((gi=(Xt=($t=zt.target)==null?void 0:$t.element)==null?void 0:Xt.className)!=null&&gi.includes("line-numbers"))){let ui=zt.target.position.lineNumber;if(Je(pt.getLineContent(ui),ui))return;mi(ui)?Ci(ui):Jt(ui)}}),Ht=zt=>{let $t={range:new Ue.Range(zt,1,zt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};nt.current=Ge.deltaDecorations(nt.current,[$t])},Fi=()=>{nt.current=Ge.deltaDecorations(nt.current,[])},ei=Ge.onMouseMove(zt=>{var $t,Xt,gi;if(Fi(),zt.target.detail&&((gi=(Xt=($t=zt.target)==null?void 0:$t.element)==null?void 0:Xt.className)!=null&&gi.includes("line-numbers"))){let ui=zt.target.position.lineNumber;if(Je(pt.getLineContent(ui),ui))return;Ht(ui)}}),or=Ge.onMouseLeave(()=>{Fi()});return()=>{li.dispose(),Si.dispose(),ei.dispose(),or.dispose()}}},[at.current,ee,Xe,Ae,rt,be]),(0,I.useEffect)(()=>{var tt;(tt=at.current)!=null&&tt.instance&&rt&&at.current.instance.setPosition({lineNumber:0,column:0})},[Ae]);function et(){let tt=at.current.instance;if(tt){const Ge=tt.getSelection(),pt=at.current.pastePos||{},Mt=new Ue.Range(pt.startLineNumber||Ge.endLineNumber,pt.startColumn||Ge.endColumn,pt.endLineNumber||Ge.endLineNumber,pt.endColumn||Ge.endColumn);setTimeout(()=>{tt.executeEdits("",[{range:Mt,text:""}])},300)}}function ct(tt){(window.navigator.platform.match("Mac")?tt.metaKey:tt.ctrlKey)&&tt.keyCode==83&&(tt.preventDefault(),De())}const gt=()=>{if(Re&&at.current.instance){const tt=at.current.instance.getContentHeight();ri(tt<bt?bt:tt)}else ri(bt)};function It(tt){var Ge=document.createEvent("MouseEvents");Ge.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),tt.dispatchEvent(Ge)}const Yt=tt=>{if(!ye.current)return;const{keyCode:Ge,ctrlKey:pt,metaKey:Mt,target:Vt,type:Jt}=tt;return(Jt==="paste"||(Ge===67||Ge===86)&&(Mt||pt))&&Vt.nodeName==="TEXTAREA"&&(he(),tt.preventDefault()),!1};function Nt(tt,Ge){var pt=window.URL||window.webkitURL||window,Mt=new Blob([Ge]),Vt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Vt.href=pt.createObjectURL(Mt),Vt.download=tt,It(Vt)}(0,I.useEffect)(()=>{gt()},[gt]),(0,I.useEffect)(()=>{Et.current&&!ee&&Promise.all([b.e(8909),b.e(4474)]).then(b.bind(b,71448)).then(tt=>{try{Ue=tt,at.current.instance=Ue.editor.create(Et.current,{value:Ee,language:ve(be),theme:We,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:je||!1}},Fe);const Ge=at.current.instance;let Vt=[...U.BH._menuItems].find(li=>li[0]._debugName=="EditorContext")[1],Jt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],Ci=(li,Si)=>{var Ht,Fi;let ei=li._first;do Si.includes((Fi=(Ht=ei.element)==null?void 0:Ht.command)==null?void 0:Fi.id)&&li._remove(ei);while(ei=ei.next)};if(lt(Ge,Ue),setTimeout(()=>{gt(),at.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{Nt(ht||"educoder.txt",Ge.getValue())}})},500),at.current.subscription=Ge.onDidChangeModelContent(li=>{Tt.current?clearTimeout(xe.current):(gt(),Ve(Ge.getValue(),li)),xe.current=setTimeout(()=>{Tt.current=!1},500)}),window.Monaco||h(Ue,ve(be)),Oe&&(Ci(Vt,Jt),Et.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Yt),window.removeEventListener("paste",Yt),window.addEventListener("keydown",Yt),window.addEventListener("paste",Yt)),window.Monaco=Ue,ie&&Ge.onDidBlurEditorWidget(()=>{ie(Ge.getValue())}),Qe&&Ge.onDidFocusEditorText(()=>{Oe&&Be(),Qe(Ge.getValue())}),Oe){Be();try{Ge.onDidPaste(li=>{const Si=Ge.getSelection(),Ht=at.current.pastePos||{},Fi=new Ue.Range(Ht.startLineNumber||Si.endLineNumber,Ht.startColumn||Si.endColumn,Ht.endLineNumber||Si.endLineNumber,Ht.endColumn||Si.endColumn);Ge.executeEdits("",[{range:li.range,text:""}])})}catch(li){}}let mi=le();return qe&&typeof qe=="string"&&new O(qe,Ge,Ue),te(!0),()=>{const li=at.current.instance;li.dispose();const Si=li.getModel();Si&&Si.dispose(),at.current.subscription&&at.current.subscription.dispose(),mi.unobserve(Et.current)}}catch(Ge){}})},[]),(0,I.useEffect)(()=>{if(at.current.instance&&ee)return document.addEventListener("keydown",ct,!1),()=>{document.removeEventListener("keydown",ct)}},[De,ee]),(0,I.useEffect)(()=>{let tt=at.current.instance;if(tt&&ee){let Ge=ve(be);Ue.editor.setModelLanguage(tt.getModel(),Ge)}},[be,ee]),(0,I.useEffect)(()=>{at.current.instance&&ee&&Ue.editor.setTheme(We)},[We,ee]),(0,I.useEffect)(()=>{let tt=at.current.instance;kt.current=ke,tt&&ee&&(tt.updateOptions(K({},ke)),setTimeout(()=>{tt.getModel().updateOptions(K({},ke))},200))},[JSON.stringify(ke),ee]),(0,I.useEffect)(()=>{let tt=at.current.instance;tt&&ee&&tt.layout()},[$e,bt,ee]);const[Lt,oi]=(0,I.useState)(ne($e)),[di,ri]=(0,I.useState)(ne(bt)),ni=k(K({},ue),{width:Lt,height:di,position:"relative"});return I.createElement("div",{className:"my-monaco-editor",ref:Et,style:ni,onFocus:()=>{Oe&&Be()}},fe&&I.createElement(q.CopyToClipboard,{text:Ee,onCopy:()=>B.ZP.success("\u590D\u5236\u6210\u529F")},I.createElement($.Z,{title:"\u590D\u5236\u4EE3\u7801"},I.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},I.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function St({width:He="100%",height:ut="100%",original:$e,modified:bt,language:Ee,options:be={}}){const ue=(0,I.useRef)(),[ke,Fe]=(0,I.useState)(null);function We(Re){let Oe;return ue.current&&(Oe=new P.Z(Ve=>{for(let lt of Ve)(lt.target.offsetHeight>0||lt.target.offsetWidth>0)&&Re.layout()}),Oe.observe(ue.current)),Oe}(0,I.useEffect)(()=>(ue.current&&Promise.all([b.e(8909),b.e(9404)]).then(b.bind(b,2550)).then(Re=>{Ue=Re;const Oe=Ue.editor.createDiffEditor(ue.current,k(K({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},be),{wordWrap:!0}));Fe(Oe);let Ve=We(Oe);return()=>{Oe.dispose();const lt=Oe.getModel();lt&<.dispose(),Ve.unobserve(ue.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,I.useEffect)(()=>{ke&&ke.setModel({original:Ue.editor.createModel($e,Ee),modified:Ue.editor.createModel(bt,Ee)})},[$e,bt,Ee,ke]);const ie=ne(He),fe=ne(ut),De={width:ie,height:fe};return I.createElement("div",{className:"my-diff-editor",ref:ue,style:De})}},93434:function(yt,me,b){"use strict";b.r(me),b.d(me,{default:function(){return l}});var I=b(59301),P=b(97197),G=b(26869),D=b(58106),w=b(29787),_=b(85627),F=b(30097),v=b(58478),s=b(24334),y=b(56656),f=b.n(y),c=(h,d,E)=>new Promise((T,L)=>{var x=U=>{try{O(E.next(U))}catch(B){L(B)}},A=U=>{try{O(E.throw(U))}catch(B){L(B)}},O=U=>U.done?T(U.value):Promise.resolve(U.value).then(x,A);O((E=E.apply(h,d)).next())}),l=()=>{const{submitId:h,id:d}=(0,D.useParams)(),[E,T]=(0,I.useState)(void 0);console.log((0,D.useLocation)(),33);const L=(0,D.useLocation)();function x(){var V;D.history.push(`/problems/${d}/oj/${(V=L==null?void 0:L.query)==null?void 0:V.backId}?tab=1`)}(0,I.useEffect)(()=>((0,D.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!1}),(0,D.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),()=>{(0,D.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!0}),(0,D.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!1})}),[]),(0,I.useEffect)(()=>{document.title="\u5728\u7EBF\u5237\u9898"}),(0,I.useEffect)(()=>{h&&function(){return c(this,null,function*(){const ne=yield(0,_.X6)(h);T(ne.data)})}()},[h]);const{status:A,created_at:O,code:U,name:B,language:$,pass_sets_count:M,set_count:Y,error_msg:q,output:se,input:ce,expected_output:J,execute_memory:z,user:Z,execute_time:N,input_file_url:W,output_file_url:K,is_file:k,expected_output_file_url:C}=E||{};return I.createElement(w.Z,{spinning:!E,delay:500},I.createElement("div",{className:"record-detail-info"},E?I.createElement(I.Fragment,null,I.createElement("header",{className:P.Z.header},I.createElement("div",null,I.createElement("img",{src:`${G.Z.IMG_SERVER}/images/${Z.image_url}`,alt:"user",width:30}),I.createElement("span",null,Z.name)),I.createElement("h2",null," ",B," "),I.createElement("button",{className:"ant-btn",onClick:x,style:{border:"1px solid #bacffe",color:"#3061d0"}},"\u8FD4\u56DE\u8BE5\u9898")),I.createElement("div",{className:"record-detail-body"},I.createElement("h2",null," \u63D0\u4EA4\u8BB0\u5F55 "),I.createElement("ul",{className:"record-info"},I.createElement("li",null," \u72B6\u6001\uFF1A",I.createElement("span",{className:A===0?"c-green":"c-red"},F.Im[A])," "),I.createElement("li",null," \u63D0\u4EA4\u65F6\u95F4\uFF1A",I.createElement("span",null,f()(O).format("YYYY-MM-DD HH:mm:ss"))," "),I.createElement("li",null," \u8BED\u8A00\uFF1A",I.createElement("span",null,$)," "),I.createElement("li",null," \u6267\u884C\u7528\u65F6\uFF1A",I.createElement("span",null,N*1e3,"ms")," "),I.createElement("li",null," ",`${M} / ${Y} \u4E2A\u901A\u8FC7\u7684\u6D4B\u8BD5\u7528\u4F8B`," ")),(0,F.gZ)({status:A,error_msg:q,execute_time:N,output:se,input:ce,expected_output:J,input_file_url:W,output_file_url:K,is_file:k,expected_output_file_url:C}),I.createElement("h2",null," \u63D0\u4EA4\u7684\u5185\u5BB9 "),I.createElement(v.ZP,{height:"200px",width:"100%",language:$==null?void 0:$.toLocaleLowerCase(),value:s.Base64.decode(U),options:{readOnly:!0}}))):null))}},30097:function(yt,me,b){"use strict";b.d(me,{Im:function(){return q},ZP:function(){return N},gZ:function(){return z}});var I=b(59301),P=b(37568),G=b(7939),D=b(84105),w=b(87395),_=b(17713),F=b(24334),v=b(69654),s=b(59944),y=b(31735),f=b(41556),c=b(34376),l=b(92310),h=b.n(l),d=b(59301),E=Object.defineProperty,T=Object.defineProperties,L=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,U=(W,K,k)=>K in W?E(W,K,{enumerable:!0,configurable:!0,writable:!0,value:k}):W[K]=k,B=(W,K)=>{for(var k in K||(K={}))A.call(K,k)&&U(W,k,K[k]);if(x)for(var k of x(K))O.call(K,k)&&U(W,k,K[k]);return W},$=(W,K)=>T(W,L(K));const{TextArea:M}=P.default,Y={visible:!1,tabIndex:"0"},q={[_.h.HIDE_COMPILE_STATUS]:"\u6682\u4E0D\u652F\u6301\u67E5\u770B",[_.h.NOMATCH]:"\u6D4B\u8BD5\u7528\u4F8B\u7ED3\u679C\u4E0D\u5339\u914D",[_.h.OK]:"\u8C03\u8BD5\u901A\u8FC7",2:"\u8C03\u8BD5\u8D85\u65F6",3:"\u8C03\u8BD5pod\u5931\u8D25",4:"\u7F16\u8BD1\u5931\u8D25",5:"\u6267\u884C\u5931\u8D25"};var se=(W=>(W[W.SET_VISIBLE=0]="SET_VISIBLE",W[W.SET_TABINDEX=1]="SET_TABINDEX",W))(se||{});function ce(W,K){switch(K.type){case 0:return $(B({},W),{visible:K.payload});case 1:return $(B({},W),{tabIndex:K.payload});default:throw new Error}}function J({value:W,className:K}){const[k,C]=(0,I.useState)(!1),V=(0,I.useRef)(),ne=(0,I.useRef)();return(0,I.useEffect)(()=>{k&&(ne.current.reset(),ne.current.write((0,y.pp)(W||"")))},[W,k]),(0,I.useEffect)(()=>{var pe,Te,Ke,ve;if(V.current){ne.current=new c.Terminal({fontSize:14,disableStdin:!0}),ne.current.open(V.current);const Ue=V.current.offsetWidth-14,Be=((ve=(Ke=(Te=(pe=ne.current)==null?void 0:pe._core)==null?void 0:Te._renderService)==null?void 0:Ke.dimensions)==null?void 0:ve.actualCellWidth)||9.5,Me=Math.ceil(Ue/Be);ne.current.resize(Me,8),C(!0)}},[]),d.createElement("div",{ref:V,className:h()("XtermText-valueRef",K)})}function z(W){const{status:K,error_msg:k,output:C,input:V,expected_output:ne,is_file:pe,input_file_url:Te,output_file_url:Ke,expected_output_file_url:ve}=W;let Ue=null;const Be={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(K){case _.h.NOMATCH:Ue=d.createElement(d.Fragment,null,d.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),!pe&&d.createElement(J,{className:"mb10",value:V}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(Te,V)},V)),d.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),!pe&&d.createElement(J,{className:"mb10",value:C&&F.Base64.decode(C)||""}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(Ke,C)},C)),d.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),!pe&&d.createElement(J,{className:"mb10",value:ne&&F.Base64.decode(ne)||""}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(ve,ne)},ne)));break;case _.h.EXECUTEFAILURE:Ue=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!pe&&d.createElement(s.Z,{value:V,style:Be}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(Te,V)},V)),d.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),d.createElement("pre",{className:"error"},F.Base64.decode(k)));break;case _.h.COMPILEFAILURE:Ue=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!pe&&d.createElement(s.Z,{value:V,style:Be}),pe&&d.createElement("div",{style:Be},d.createElement("a",{onClick:()=>(0,y.LR)(Te,V)},V)),d.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),d.createElement("pre",{className:"error"},F.Base64.decode(k)));break;case _.h.PODFAILURE:Ue=d.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case _.h.TIMEOUT:Ue=d.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return d.createElement(d.Fragment,null," ",Ue," ")}function Z(W){const{status:K,error_msg:k,execute_time:C,output:V,input:ne,expected_output:pe,is_file:Te,input_file_url:Ke,output_file_url:ve,expected_output_file_url:Ue}=W;let Be=null;switch(K){case _.h.OK:Be=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6267\u884C\u7528\u65F6\uFF1A",C,"\u79D2"),d.createElement("p",null,"\u6267\u884C\u7ED3\u679C\uFF1A"),d.createElement("pre",null,F.Base64.decode(V)));break;case _.h.NOMATCH:Be=d.createElement(d.Fragment,null,d.createElement("p",null,"\u8F93\u5165\uFF1A",d.createElement("pre",null,ne)),d.createElement("p",null,"\u8F93\u51FA\uFF1A",V&&F.Base64.decode(V)),d.createElement("p",null,"\u9884\u671F\u8F93\u51FA\uFF1A",pe&&F.Base64.decode(pe)));break;case _.h.EXECUTEFAILURE:Be=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",d.createElement("pre",null,ne)),d.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),d.createElement("pre",{className:"error"},F.Base64.decode(k)));break;case _.h.COMPILEFAILURE:Be=d.createElement(d.Fragment,null,d.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",d.createElement("pre",null,ne)),d.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),d.createElement("pre",{className:"error"},F.Base64.decode(k)));break;case _.h.PODFAILURE:Be=d.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case _.h.TIMEOUT:Be=d.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return d.createElement(d.Fragment,null," ",Be," ")}var N=({id:W,is_file:K,input:k,debuging:C,submitting:V,executingMessage:ne,debugResult:pe,onChangeInput:Te,onDebugCode:Ke,onSubmitCode:ve})=>{const[Ue,Be]=(0,I.useReducer)(ce,Y),{visible:Me,tabIndex:St}=Ue;(0,I.useEffect)(()=>{Be({type:0,payload:!1})},[W]);function He(Ee){let be=Ee.target.id;Be({type:1,payload:be})}function ut(){Be({type:0,payload:!Me})}const $e=(0,I.useMemo)(()=>{if(pe){const{status:Ee}=pe;return d.createElement(d.Fragment,null,Z(pe))}return null},[pe]);function bt(){Be({type:0,payload:!0}),Be({type:1,payload:"1"}),Ke()}return d.createElement("div",{className:"test-case-panel"},d.createElement("div",{className:`test-case-panel-body ${Me?"active":""}`},d.createElement("ul",{className:"s-navs"},d.createElement("li",null,d.createElement("a",{className:"active"},"\u8C03\u8BD5\u4EE3\u7801\u7ED3\u679C"))),d.createElement(f.Z,{leftTitle:"\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B",rightTitle:"\u4EE3\u7801\u6267\u884C\u7ED3\u679C",style:{height:240},leftNode:d.createElement(M,{placeholder:"\u8BF7\u8F93\u5165\u81EA\u6D4B\u7528\u4F8B\uFF08\u5982\u679C\u672A\u586B\u5199\uFF0C\u9996\u6B21\u81EA\u6D4B\u8FD0\u884C\u65F6\uFF0C\u7CFB\u7EDF\u4F1A\u81EA\u52A8\u586B\u5145\u7B2C\u4E00\u4E2A\u975E\u9690\u85CF\u7684\u6587\u672C\u7C7B\u578B\u7684\u6D4B\u8BD5\u7528\u4F8B\uFF09",value:K?"":k,onChange:Te}),rightNode:C?d.createElement(v.Z,{message:"\u4EE3\u7801\u6267\u884C\u4E2D..."}):pe?$e:d.createElement("p",{style:{color:"#536879"}},"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D")})),d.createElement("a",{className:`btn-collapse ${Me?"up":""}`,onClick:ut},Me?d.createElement(D.Z,null):d.createElement(w.Z,null)),d.createElement("footer",{className:"footer"},d.createElement("span",{style:{visibility:"hidden"}},"\u63A7\u5236\u53F0"),d.createElement("div",{className:"flex-container"},d.createElement(G.ZP,{id:"oj-prev",className:"btn-blue",type:"ghost"},"\u4E0A\u4E00\u9898"),d.createElement(G.ZP,{id:"oj-next",className:"btn-blue",type:"ghost"},"\u4E0B\u4E00\u9898"),d.createElement(G.ZP,{className:"btn-green",type:"ghost",loading:C,onClick:bt},"\u8C03\u8BD5\u4EE3\u7801"),d.createElement(G.ZP,{type:"primary",className:"custom-ant-disabled",loading:V,disabled:V,onClick:()=>{Be({type:0,payload:!1}),ve()}},"\u8BC4\u6D4B\u5E76\u63D0\u4EA4"))))}},17713:function(yt,me,b){"use strict";b.d(me,{h:function(){return I}});var I=(P=>(P[P.NOMATCH=-1]="NOMATCH",P[P.OK=0]="OK",P[P.TIMEOUT=2]="TIMEOUT",P[P.PODFAILURE=3]="PODFAILURE",P[P.COMPILEFAILURE=4]="COMPILEFAILURE",P[P.EXECUTEFAILURE=5]="EXECUTEFAILURE",P[P.HIDE_COMPILE_STATUS=11]="HIDE_COMPILE_STATUS",P))(I||{})},85627:function(yt,me,b){"use strict";b.d(me,{H7:function(){return s},KC:function(){return h},M3:function(){return L},MK:function(){return v},MU:function(){return D},Rg:function(){return O},WH:function(){return d},X6:function(){return _},bM:function(){return G},bx:function(){return E},dd:function(){return c},de:function(){return B},fi:function(){return y},fu:function(){return P},gu:function(){return T},n4:function(){return f},qe:function(){return A},rL:function(){return U},rX:function(){return F},uc:function(){return $},vl:function(){return l},wO:function(){return x},zO:function(){return w}});var I=b(97013);function P(M){return(0,I.U2)(`mypractices/${M}.json`,{hidePopLogin:!0})}function G(M,Y){return(0,I.v_)(`mypractices/${M}/code_submit.json`,Y)}function D(M,Y){return(0,I.v_)(`mypractices/${M}/code_debug.json`,Y)}function w(M,Y){return Y.language&&(Y.language=encodeURIComponent(Y.language)),(0,I.U2)(`mypractices/${M}/submit_records.json`,Y)}function _(M){return(0,I.U2)("mypractices/record_detail.json",{id:M})}function F(M,Y){return(0,I.U2)(`mypractices/${M}/result.json`,{mode:Y})}function v(M,Y){return(0,I.v_)(`mypractices/${M}/add_notes.json`,Y)}function s(M,Y){return(0,I.v_)(`mypractices/${M}/restore_initial_code.json`,Y)}function y(M,Y){return(0,I.v_)(`mypractices/${M}/sync_code.json`,Y)}function f(M,Y){return(0,I.v_)(`mypractices/${M}/update_code.json`,Y)}function c(M){return(0,I.v_)(`mypractices/${M}/initial_codes.json`)}function l(M,Y){return(0,I.v_)(`discusses/${M}/plus.json`,Y)}function h(M){return(0,I.U2)("practices/practices_list.json",M)}function d(M,Y){return(0,I.U2)(`practices/${M}/question_solution_articles`,Y)}function E(M,Y){return(0,I.v_)(`practices/${M}/question_solution_articles`,Y)}function T(M,Y){return(0,I.gz)(`practices/${M}/question_solution_articles/${Y==null?void 0:Y.active}`,Y)}function L(M,Y){return(0,I.U2)(`practices/${M}/question_solution_articles/${Y==null?void 0:Y.active}/edit`,Y)}function x(M,Y){return(0,I.U2)(`practices/${M}/question_solution_articles/${Y==null?void 0:Y.active}`,Y)}function A(M,Y){return(0,I.v_)(`practices/${M}/question_solution_articles/${Y==null?void 0:Y.active}/set_authority_or_excellent`,Y)}function O(M,Y){return(0,I.v_)(`practices/${M}/question_solution_articles/${Y==null?void 0:Y.active}/praise_or_treads`,Y)}function U(M,Y){return(0,I.v_)(`practices/${M}/question_solution_articles/${Y==null?void 0:Y.active}/hide`)}function B(M,Y){return(0,I.IV)(`practices/${M}/question_solution_articles/${Y==null?void 0:Y.active}`,Y)}function $(M,Y){return(0,I.v_)(`mypractices/${M}/update_practice_time_sum`,Y)}},58489:function(yt,me,b){"use strict";b.d(me,{AL:function(){return O},Iy:function(){return f},Qv:function(){return h},ez:function(){return A},jb:function(){return c}});var I=b(32834),P=b.n(I),G=b(11690),D=b.n(G);let w=1;function _(Y,q){const se=Y.match(/^(\s+)(?:```)/);if(se===null)return q;const ce=se[1];return q.split(`
|
|
|
`).map(J=>{const z=J.match(/^\s+/);if(z===null)return J;const[Z]=z;return Z.length>=ce.length?J.slice(ce.length):J}).join(`
|
|
|
`)}let F=[],v=["<ul>"];const s=new(P()).Renderer,y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function f(){F.length=0,v=["<ul>"]}const c={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(Y,q,se,ce){if(q>=Y.length||Y[q].level<=se)return q;var J=Y[q];ce.push("<li><a href='#"+w+J.anchor+"'>"+J.text+"</a>"),q++;var z=[];return q=l(Y,q,J.level,z),z.length>0&&(ce.push("<ul>"),z.forEach(function(Z){ce.push(Z)}),ce.push("</ul>")),ce.push("</li>"),q=l(Y,q,se,ce),q}function h(){return l(F,0,0,v),v.push("</ul>"),v.join("")}const d={heading(Y){const q=y.exec(Y);if(w+=1,q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},fences(Y){const q=this.rules.block.fences.exec(Y);if(q){const se=q[0];let ce=_(se,q[3]||"");const J=q[2]?q[2].trim():q[2];if(["latex","katex","math"].indexOf(J)>=0){const z=L(),Z=ce;ce=z,x[z]={type:"block",expression:Z}}return{type:"code",raw:se,lang:J,text:ce}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let T=0;const L=()=>`__special_katext_id_${T++}__`;let x={};function A(){return x}function O(){T=0,x={}}function U(Y){return Y=Y.replace(E,(q,se)=>{const ce=L();return x[ce]={type:"inline",expression:se},ce}),Y}const B=s.listitem;s.listitem=function(Y){return B(U(Y))};const $=s.paragraph;s.paragraph=function(Y){return $(U(Y))};const M=s.tablecell;s.tablecell=function(Y,q){return M(U(Y),q)},s.code=function(Y,q,se){const ce=(q||"").match(/\S*/)[0];return ce?["latex","katex","math"].indexOf(ce)>=0?`<p class='editormd-tex'>${Y}</p>`:`<pre class="prettyprint linenums"><code class="language-${q}">${se?Y:(0,G.escape)(Y,!0)}</code></pre>
|
|
|
`:'<pre class="prettyprint linenums"><code>'+(se?Y:(0,G.escape)(Y,!0))+"</code></pre>"},s.heading=function(Y,q,se){let ce=this.options.headerPrefix+se.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return F.push({anchor:ce,level:q,text:Y}),"<h"+q+' id="'+w+ce+'">'+Y+"</h"+q+">"},P().setOptions({silent:!0,gfm:!0,pedantic:!1}),P().use({tokenizer:d,renderer:s}),me.ZP=P()},64018:function(){var yt,me,b,I=!1,P,G;window.PR_SHOULD_USE_CONTINUATION=!0;var D,w;(function(){var _=window,F=["break,continue,do,else,for,if,return,while"],v=[F,"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"],s=[v,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],y=[s,"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"],f=[s,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],c=[s,"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"],l="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",h=[s,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="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",E=[F,"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"],T=[F,"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"],L=[F,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],x=[y,c,f,h,d,E,T,L],A=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,O="str",U="kwd",B="com",$="typ",M="lit",Y="pun",q="pln",se="tag",ce="dec",J="src",z="atn",Z="atv",N="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function K(be){for(var ue=0,ke=!1,Fe=!1,We=0,ie=be.length;We<ie;++We){var fe=be[We];if(fe.ignoreCase)Fe=!0;else if(/[a-z]/i.test(fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ke=!0,Fe=!1;break}}var De={b:8,t:9,n:10,v:11,f:12,r:13};function Re(Ze){var Xe=Ze.charCodeAt(0);if(Xe!==92)return Xe;var ht=Ze.charAt(1);return Xe=De[ht],Xe||("0"<=ht&&ht<="7"?parseInt(Ze.substring(1),8):ht==="u"||ht==="x"?parseInt(Ze.substring(2),16):Ze.charCodeAt(1))}function Oe(Ze){if(Ze<32)return(Ze<16?"\\x0":"\\x")+Ze.toString(16);var Xe=String.fromCharCode(Ze);return Xe==="\\"||Xe==="-"||Xe==="]"||Xe==="^"?"\\"+Xe:Xe}function Ve(Ze){var Xe=Ze.substring(1,Ze.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=[],st=Xe[0]==="^",it=["["];st&&it.push("^");for(var Ae=st?1:0,rt=Xe.length;Ae<rt;++Ae){var qe=Xe[Ae];if(/\\[bdsw]/i.test(qe))it.push(qe);else{var je=Re(qe),mt;Ae+2<rt&&Xe[Ae+1]==="-"?(mt=Re(Xe[Ae+2]),Ae+=2):mt=je,ht.push([je,mt]),mt<65||je>122||(mt<65||je>90||ht.push([Math.max(65,je)|32,Math.min(mt,90)|32]),mt<97||je>122||ht.push([Math.max(97,je)&-33,Math.min(mt,122)&-33]))}}ht.sort(function(Bt,nt){return Bt[0]-nt[0]||nt[1]-Bt[1]});for(var Et=[],at=[],Ae=0;Ae<ht.length;++Ae){var kt=ht[Ae];kt[0]<=at[1]+1?at[1]=Math.max(at[1],kt[1]):Et.push(at=kt)}for(var Ae=0;Ae<Et.length;++Ae){var kt=Et[Ae];it.push(Oe(kt[0])),kt[1]>kt[0]&&(kt[1]+1>kt[0]&&it.push("-"),it.push(Oe(kt[1])))}return it.push("]"),it.join("")}function lt(Ze){for(var Xe=Ze.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=Xe.length,st=[],it=0,Ae=0;it<ht;++it){var rt=Xe[it];if(rt==="(")++Ae;else if(rt.charAt(0)==="\\"){var qe=+rt.substring(1);qe&&(qe<=Ae?st[qe]=-1:Xe[it]=Oe(qe))}}for(var it=1;it<st.length;++it)st[it]===-1&&(st[it]=++ue);for(var it=0,Ae=0;it<ht;++it){var rt=Xe[it];if(rt==="(")++Ae,st[Ae]||(Xe[it]="(?:");else if(rt.charAt(0)==="\\"){var qe=+rt.substring(1);qe&&qe<=Ae&&(Xe[it]="\\"+st[qe])}}for(var it=0;it<ht;++it)Xe[it]==="^"&&Xe[it+1]!=="^"&&(Xe[it]="");if(Ze.ignoreCase&&ke)for(var it=0;it<ht;++it){var rt=Xe[it],je=rt.charAt(0);rt.length>=2&&je==="["?Xe[it]=Ve(rt):je!=="\\"&&(Xe[it]=rt.replace(/[a-zA-Z]/g,function(at){var kt=at.charCodeAt(0);return"["+String.fromCharCode(kt&-33,kt|32)+"]"}))}return Xe.join("")}for(var Qe=[],We=0,ie=be.length;We<ie;++We){var fe=be[We];if(fe.global||fe.multiline)throw new Error(""+fe);Qe.push("(?:"+lt(fe)+")")}return new RegExp(Qe.join("|"),Fe?"gi":"g")}function k(be,ue){var ke=/(?:^|\s)nocode(?:\s|$)/,Fe=[],We=0,ie=[],fe=0;function De(Re){var Oe=Re.nodeType;if(Oe==1){if(ke.test(Re.className))return;for(var Ve=Re.firstChild;Ve;Ve=Ve.nextSibling)De(Ve);var lt=Re.nodeName.toLowerCase();(lt==="br"||lt==="li")&&(Fe[fe]=`
|
|
|
`,ie[fe<<1]=We++,ie[fe++<<1|1]=Re)}else if(Oe==3||Oe==4){var Qe=Re.nodeValue;Qe.length&&(ue?Qe=Qe.replace(/\r\n?/g,`
|
|
|
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),Fe[fe]=Qe,ie[fe<<1]=We,We+=Qe.length,ie[fe++<<1|1]=Re)}}return De(be),{sourceCode:Fe.join("").replace(/\n$/,""),spans:ie}}function C(be,ue,ke,Fe,We){if(ke){var ie={sourceNode:be,pre:1,langExtension:null,numberLines:null,sourceCode:ke,spans:null,basePos:ue,decorations:null};Fe(ie),We.push.apply(We,ie.decorations)}}var V=/\S/;function ne(be){for(var ue=void 0,ke=be.firstChild;ke;ke=ke.nextSibling){var Fe=ke.nodeType;ue=Fe===1?ue?be:ke:Fe===3&&V.test(ke.nodeValue)?be:ue}return ue===be?void 0:ue}function pe(be,ue){var ke={},Fe;(function(){for(var fe=be.concat(ue),De=[],Re={},Oe=0,Ve=fe.length;Oe<Ve;++Oe){var lt=fe[Oe],Qe=lt[3];if(Qe)for(var Ze=Qe.length;--Ze>=0;)ke[Qe.charAt(Ze)]=lt;var Xe=lt[1],ht=""+Xe;Re.hasOwnProperty(ht)||(De.push(Xe),Re[ht]=null)}De.push(/[\0-\uffff]/),Fe=K(De)})();var We=ue.length,ie=function(fe){for(var De=fe.sourceCode,Re=fe.basePos,Oe=fe.sourceNode,Ve=[Re,q],lt=0,Qe=De.match(Fe)||[],Ze={},Xe=0,ht=Qe.length;Xe<ht;++Xe){var st=Qe[Xe],it=Ze[st],Ae=void 0,rt;if(typeof it=="string")rt=!1;else{var qe=ke[st.charAt(0)];if(qe)Ae=st.match(qe[1]),it=qe[0];else{for(var je=0;je<We;++je)if(qe=ue[je],Ae=st.match(qe[1]),Ae){it=qe[0];break}Ae||(it=q)}rt=it.length>=5&&it.substring(0,5)==="lang-",rt&&!(Ae&&typeof Ae[1]=="string")&&(rt=!1,it=J),rt||(Ze[st]=it)}var mt=lt;if(lt+=st.length,!rt)Ve.push(Re+mt,it);else{var Et=Ae[1],at=st.indexOf(Et),kt=at+Et.length;Ae[2]&&(kt=st.length-Ae[2].length,at=kt-Et.length);var Bt=it.substring(5);C(Oe,Re+mt,st.substring(0,at),ie,Ve),C(Oe,Re+mt+at,Et,St(Bt,Et),Ve),C(Oe,Re+mt+kt,st.substring(kt),ie,Ve)}}fe.decorations=Ve};return ie}function Te(be){var ue=[],ke=[];be.tripleQuotedStrings?ue.push([O,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):be.multiLineStrings?ue.push([O,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ue.push([O,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),be.verbatimStrings&&ke.push([O,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Fe=be.hashComments;Fe&&(be.cStyleComments?(Fe>1?ue.push([B,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ue.push([B,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ke.push([O,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ue.push([B,/^#[^\r\n]*/,null,"#"])),be.cStyleComments&&(ke.push([B,/^\/\/[^\r\n]*/,null]),ke.push([B,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=be.regexLiterals;if(We){var ie=We>1?"":`
|
|
|
\r`,fe=ie?".":"[\\S\\s]",De="/(?=[^/*"+ie+"])(?:[^/\\x5B\\x5C"+ie+"]|\\x5C"+fe+"|\\x5B(?:[^\\x5C\\x5D"+ie+"]|\\x5C"+fe+")*(?:\\x5D|$))+/";ke.push(["lang-regex",RegExp("^"+W+"("+De+")")])}var Re=be.types;Re&&ke.push([$,Re]);var Oe=(""+be.keywords).replace(/^ | $/g,"");Oe.length&&ke.push([U,new RegExp("^(?:"+Oe.replace(/[\s,]+/g,"|")+")\\b"),null]),ue.push([q,/^\s+/,null,` \r
|
|
|
\xA0`]);var Ve="^.[^\\s\\w.$@'\"`/\\\\]*";return be.regexLiterals&&(Ve+="(?!s*/)"),ke.push([M,/^@[a-z_$][a-z_$@0-9]*/i,null],[$,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[q,/^[a-z_$][a-z_$@0-9]*/i,null],[M,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[q,/^\\[\s\S]?/,null],[Y,new RegExp(Ve),null]),pe(ue,ke)}var Ke=Te({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ve(be,ue,ke){for(var Fe=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,ie=be.ownerDocument,fe=ie.createElement("li");be.firstChild;)fe.appendChild(be.firstChild);var De=[fe];function Re(Xe){var ht=Xe.nodeType;if(ht==1&&!Fe.test(Xe.className))if(Xe.nodeName==="br")Oe(Xe),Xe.parentNode&&Xe.parentNode.removeChild(Xe);else for(var st=Xe.firstChild;st;st=st.nextSibling)Re(st);else if((ht==3||ht==4)&&ke){var it=Xe.nodeValue,Ae=it.match(We);if(Ae){var rt=it.substring(0,Ae.index);Xe.nodeValue=rt;var qe=it.substring(Ae.index+Ae[0].length);if(qe){var je=Xe.parentNode;je.insertBefore(ie.createTextNode(qe),Xe.nextSibling)}Oe(Xe),rt||Xe.parentNode.removeChild(Xe)}}}function Oe(Xe){for(;!Xe.nextSibling;)if(Xe=Xe.parentNode,!Xe)return;function ht(Ae,rt){var qe=rt?Ae.cloneNode(!1):Ae,je=Ae.parentNode;if(je){var mt=ht(je,1),Et=Ae.nextSibling;mt.appendChild(qe);for(var at=Et;at;at=Et)Et=at.nextSibling,mt.appendChild(at)}return qe}for(var st=ht(Xe.nextSibling,0),it;(it=st.parentNode)&&it.nodeType===1;)st=it;De.push(st)}for(var Ve=0;Ve<De.length;++Ve)Re(De[Ve]);ue===(ue|0)&&De[0].setAttribute("value",ue);var lt=ie.createElement("ol");lt.className="linenums";for(var Qe=Math.max(0,ue-1|0)||0,Ve=0,Ze=De.length;Ve<Ze;++Ve)fe=De[Ve],fe.className="L"+(Ve+Qe)%10,fe.firstChild||fe.appendChild(ie.createTextNode("\xA0")),lt.appendChild(fe);be.appendChild(lt)}function Ue(be){var ue=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ue=ue&&+ue[1]<=8;var ke=/\n/g,Fe=be.sourceCode,We=Fe.length,ie=0,fe=be.spans,De=fe.length,Re=0,Oe=be.decorations,Ve=Oe.length,lt=0;Oe[Ve]=We;var Qe,Ze;for(Ze=Qe=0;Ze<Ve;)Oe[Ze]!==Oe[Ze+2]?(Oe[Qe++]=Oe[Ze++],Oe[Qe++]=Oe[Ze++]):Ze+=2;for(Ve=Qe,Ze=Qe=0;Ze<Ve;){for(var Xe=Oe[Ze],ht=Oe[Ze+1],st=Ze+2;st+2<=Ve&&Oe[st+1]===ht;)st+=2;Oe[Qe++]=Xe,Oe[Qe++]=ht,Ze=st}Ve=Oe.length=Qe;var it=be.sourceNode,Ae="";it&&(Ae=it.style.display,it.style.display="none");try{for(var rt=null;Re<De;){var qe=fe[Re],je=fe[Re+2]||We,mt=Oe[lt+2]||We,st=Math.min(je,mt),Et=fe[Re+1],at;if(Et.nodeType!==1&&(at=Fe.substring(ie,st))){ue&&(at=at.replace(ke,"\r")),Et.nodeValue=at;var kt=Et.ownerDocument,Bt=kt.createElement("span");Bt.className=Oe[lt+1];var nt=Et.parentNode;nt.replaceChild(Bt,Et),Bt.appendChild(Et),ie<je&&(fe[Re+1]=Et=kt.createTextNode(Fe.substring(st,je)),nt.insertBefore(Et,Bt.nextSibling))}ie=st,ie>=je&&(Re+=2),ie>=mt&&(lt+=2)}}finally{it&&(it.style.display=Ae)}}var Be={};function Me(be,ue){for(var ke=ue.length;--ke>=0;){var Fe=ue[ke];Be.hasOwnProperty(Fe)?_.console&&console.warn("cannot override language handler %s",Fe):Be[Fe]=be}}function St(be,ue){return be&&Be.hasOwnProperty(be)||(be=/^\s*</.test(ue)?"default-markup":"default-code"),Be[be]}Me(Ke,["default-code"]),Me(pe([],[[q,/^[^<?]+/],[ce,/^<!\w[^>]*(?:>|$)/],[B,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[Y,/^(?:<[%?]|[%?]>)/],["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"]),Me(pe([[q,/^[\s]+/,null,` \r
|
|
|
`],[Z,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[se,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[z,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[Y,/^[=<>\/]+/],["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"]),Me(pe([],[[Z,/^[\s\S]+/]]),["uq.val"]),Me(Te({keywords:y,hashComments:!0,cStyleComments:!0,types:A}),["c","cc","cpp","cxx","cyc","m"]),Me(Te({keywords:"null,true,false"}),["json"]),Me(Te({keywords:c,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:A}),["cs"]),Me(Te({keywords:f,cStyleComments:!0}),["java"]),Me(Te({keywords:L,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Me(Te({keywords:E,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Me(Te({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Me(Te({keywords:T,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Me(Te({keywords:h,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Me(Te({keywords:l,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Me(pe([],[[O,/^[\s\S]+/]]),["regex"]);function He(be){var ue=be.langExtension;try{var ke=k(be.sourceNode,be.pre),Fe=ke.sourceCode;be.sourceCode=Fe,be.spans=ke.spans,be.basePos=0,St(ue,Fe)(be),Ue(be)}catch(We){_.console&&console.log(We&&We.stack||We)}}function ut(be,ue,ke){var Fe=ke||!1,We=ue||null,ie=document.createElement("div");ie.innerHTML="<pre>"+be+"</pre>",ie=ie.firstChild,Fe&&ve(ie,Fe,!0);var fe={langExtension:We,numberLines:Fe,sourceNode:ie,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return He(fe),ie.innerHTML}function $e(be,ue){var ke=ue||document.body,Fe=ke.ownerDocument||document;function We(qe){return ke.getElementsByTagName(qe)}for(var ie=[We("pre"),We("code"),We("xmp")],fe=[],De=0;De<ie.length;++De)for(var Re=0,Oe=ie[De].length;Re<Oe;++Re)fe.push(ie[De][Re]);ie=null;var Ve=Date;Ve.now||(Ve={now:function(){return+new Date}});var lt=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ze=/\bprettyprint\b/,Xe=/\bprettyprinted\b/,ht=/pre|xmp/i,st=/^code$/i,it=/^(?:pre|code|xmp)$/i,Ae={};function rt(){for(var qe=_.PR_SHOULD_USE_CONTINUATION?Ve.now()+250:1/0;lt<fe.length&&Ve.now()<qe;lt++){for(var je=fe[lt],mt=Ae,Et=je;Et=Et.previousSibling;){var at=Et.nodeType,kt=(at===7||at===8)&&Et.nodeValue;if(kt?!/^\??prettify\b/.test(kt):at!==3||/\S/.test(Et.nodeValue))break;if(kt){mt={},kt.replace(/\b(\w+)=([\w:.%+-]+)/g,function(et,ct,gt){mt[ct]=gt});break}}var Bt=je.className;if((mt!==Ae||Ze.test(Bt))&&!Xe.test(Bt)){for(var nt=!1,Tt=je.parentNode;Tt;Tt=Tt.parentNode){var xe=Tt.tagName;if(it.test(xe)&&Tt.className&&Ze.test(Tt.className)){nt=!0;break}}if(!nt){je.className+=" prettyprinted";var ge=mt.lang;if(!ge){ge=Bt.match(Qe);var ye;!ge&&(ye=ne(je))&&st.test(ye.tagName)&&(ge=ye.className.match(Qe)),ge&&(ge=ge[1])}var ee;if(ht.test(je.tagName))ee=1;else{var te=je.currentStyle,le=Fe.defaultView,he=te?te.whiteSpace:le&&le.getComputedStyle?le.getComputedStyle(je,null).getPropertyValue("white-space"):0;ee=he&&he.substring(0,3)==="pre"}var _e=mt.linenums;(_e=_e==="true"||+_e)||(_e=Bt.match(/\blinenums\b(?::(\d+))?/),_e=_e?_e[1]&&_e[1].length?+_e[1]:!0:!1),_e&&ve(je,_e,ee);var Je={langExtension:ge,sourceNode:je,numberLines:_e,pre:ee,sourceCode:null,basePos:null,spans:null,decorations:null};He(Je)}}}lt<fe.length?_.setTimeout(rt,250):typeof be=="function"&&be()}rt()}var bt=_.PR={createSimpleLexer:pe,registerLangHandler:Me,sourceDecorator:Te,PR_ATTRIB_NAME:z,PR_ATTRIB_VALUE:Z,PR_COMMENT:B,PR_DECLARATION:ce,PR_KEYWORD:U,PR_LITERAL:M,PR_NOCODE:N,PR_PLAIN:q,PR_PUNCTUATION:Y,PR_SOURCE:J,PR_STRING:O,PR_TAG:se,PR_TYPE:$,prettyPrintOne:I?_.prettyPrintOne=ut:D=ut,prettyPrint:w=I?_.prettyPrint=$e:w=$e},Ee=_.define;typeof Ee=="function"&&Ee.amd&&Ee("google-code-prettify",[],function(){return bt})})()},25769:function(yt,me,b){"use strict";var I=b(98040),P={"text/plain":"Text","text/html":"Url",default:"Text"},G="Copy to clipboard: #{key}, Enter";function D(_){var F=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return _.replace(/#{\s*key\s*}/g,F)}function w(_,F){var v,s,y,f,c,l,h=!1;F||(F={}),v=F.debug||!1;try{y=I(),f=document.createRange(),c=document.getSelection(),l=document.createElement("span"),l.textContent=_,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(E){if(E.stopPropagation(),F.format)if(E.preventDefault(),typeof E.clipboardData=="undefined"){v&&console.warn("unable to use e.clipboardData"),v&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var T=P[F.format]||P.default;window.clipboardData.setData(T,_)}else E.clipboardData.clearData(),E.clipboardData.setData(F.format,_);F.onCopy&&(E.preventDefault(),F.onCopy(E.clipboardData))}),document.body.appendChild(l),f.selectNodeContents(l),c.addRange(f);var d=document.execCommand("copy");if(!d)throw new Error("copy command was unsuccessful");h=!0}catch(E){v&&console.error("unable to copy using execCommand: ",E),v&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(F.format||"text",_),F.onCopy&&F.onCopy(window.clipboardData),h=!0}catch(T){v&&console.error("unable to copy using clipboardData: ",T),v&&console.error("falling back to prompt"),s=D("message"in F?F.message:G),window.prompt(s,_)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(f):c.removeAllRanges()),l&&document.body.removeChild(l),y()}return h}yt.exports=w},24334:function(yt,me,b){var I,P;(function(G,D){yt.exports=D(G)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof b.g!="undefined"?b.g:this,function(G){"use strict";G=G||{};var D=G.Base64,w="2.6.4",_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",F=function(z){for(var Z={},N=0,W=z.length;N<W;N++)Z[z.charAt(N)]=N;return Z}(_),v=String.fromCharCode,s=function(z){if(z.length<2){var Z=z.charCodeAt(0);return Z<128?z:Z<2048?v(192|Z>>>6)+v(128|Z&63):v(224|Z>>>12&15)+v(128|Z>>>6&63)+v(128|Z&63)}else{var Z=65536+(z.charCodeAt(0)-55296)*1024+(z.charCodeAt(1)-56320);return v(240|Z>>>18&7)+v(128|Z>>>12&63)+v(128|Z>>>6&63)+v(128|Z&63)}},y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,f=function(z){return z.replace(y,s)},c=function(z){var Z=[0,2,1][z.length%3],N=z.charCodeAt(0)<<16|(z.length>1?z.charCodeAt(1):0)<<8|(z.length>2?z.charCodeAt(2):0),W=[_.charAt(N>>>18),_.charAt(N>>>12&63),Z>=2?"=":_.charAt(N>>>6&63),Z>=1?"=":_.charAt(N&63)];return W.join("")},l=G.btoa&&typeof G.btoa=="function"?function(z){return G.btoa(z)}:function(z){if(z.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return z.replace(/[\s\S]{1,3}/g,c)},h=function(z){return l(f(String(z)))},d=function(z){return z.replace(/[+\/]/g,function(Z){return Z=="+"?"-":"_"}).replace(/=/g,"")},E=function(z,Z){return Z?d(h(z)):h(z)},T=function(z){return E(z,!0)},L;G.Uint8Array&&(L=function(z,Z){for(var N="",W=0,K=z.length;W<K;W+=3){var k=z[W],C=z[W+1],V=z[W+2],ne=k<<16|C<<8|V;N+=_.charAt(ne>>>18)+_.charAt(ne>>>12&63)+(typeof C!="undefined"?_.charAt(ne>>>6&63):"=")+(typeof V!="undefined"?_.charAt(ne&63):"=")}return Z?d(N):N});var x=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,A=function(z){switch(z.length){case 4:var Z=(7&z.charCodeAt(0))<<18|(63&z.charCodeAt(1))<<12|(63&z.charCodeAt(2))<<6|63&z.charCodeAt(3),N=Z-65536;return v((N>>>10)+55296)+v((N&1023)+56320);case 3:return v((15&z.charCodeAt(0))<<12|(63&z.charCodeAt(1))<<6|63&z.charCodeAt(2));default:return v((31&z.charCodeAt(0))<<6|63&z.charCodeAt(1))}},O=function(z){return z.replace(x,A)},U=function(z){var Z=z.length,N=Z%4,W=(Z>0?F[z.charAt(0)]<<18:0)|(Z>1?F[z.charAt(1)]<<12:0)|(Z>2?F[z.charAt(2)]<<6:0)|(Z>3?F[z.charAt(3)]:0),K=[v(W>>>16),v(W>>>8&255),v(W&255)];return K.length-=[0,0,2,1][N],K.join("")},B=G.atob&&typeof G.atob=="function"?function(z){return G.atob(z)}:function(z){return z.replace(/\S{1,4}/g,U)},$=function(z){return B(String(z).replace(/[^A-Za-z0-9\+\/]/g,""))},M=function(z){return O(B(z))},Y=function(z){return String(z).replace(/[-_]/g,function(Z){return Z=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},q=function(z){return M(Y(z))},se;G.Uint8Array&&(se=function(z){return Uint8Array.from($(Y(z)),function(Z){return Z.charCodeAt(0)})});var ce=function(){var z=G.Base64;return G.Base64=D,z};if(G.Base64={VERSION:w,atob:$,btoa:l,fromBase64:q,toBase64:E,utob:f,encode:E,encodeURI:T,btou:O,decode:q,noConflict:ce,fromUint8Array:L,toUint8Array:se},typeof Object.defineProperty=="function"){var J=function(z){return{value:z,enumerable:!1,writable:!0,configurable:!0}};G.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",J(function(){return q(this)})),Object.defineProperty(String.prototype,"toBase64",J(function(z){return E(this,z)})),Object.defineProperty(String.prototype,"toBase64URI",J(function(){return E(this,!0)}))}}return G.Meteor&&(Base64=G.Base64),yt.exports?yt.exports.Base64=G.Base64:(I=[],P=function(){return G.Base64}.apply(me,I),P!==void 0&&(yt.exports=P)),{Base64:G.Base64}})},53184:function(yt,me,b){"use strict";var I,P;function G(D,w,_){var F=function(v,s){return D.js_beautify(v,s)};return F.js=D.js_beautify,F.css=w.css_beautify,F.html=_.html_beautify,F.js_beautify=D.js_beautify,F.css_beautify=w.css_beautify,F.html_beautify=_.html_beautify,F}I=[b(58553),b(87804),b(40998)],P=function(D,w,_){return G(D,w,_)}.apply(me,I),P!==void 0&&(yt.exports=P)},87804:function(yt,me){var b,I;(function(){var P;(function(){"use strict";var D=[,,function(v){function s(c){this.__parent=c,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=[]}s.prototype.clone_empty=function(){var c=new s(this.__parent);return c.set_indent(this.__indent_count,this.__alignment_count),c},s.prototype.item=function(c){return c<0?this.__items[this.__items.length+c]:this.__items[c]},s.prototype.has_match=function(c){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(c))return!0;return!1},s.prototype.set_indent=function(c,l){this.is_empty()&&(this.__indent_count=c||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},s.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)},s.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},s.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var c=this.__parent.current_line;return c.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),c.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),c.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,c.__items[0]===" "&&(c.__items.splice(0,1),c.__character_count-=1),!0}return!1},s.prototype.is_empty=function(){return this.__items.length===0},s.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},s.prototype.push=function(c){this.__items.push(c);var l=c.lastIndexOf(`
|
|
|
`);l!==-1?this.__character_count=c.length-l:this.__character_count+=c.length},s.prototype.pop=function(){var c=null;return this.is_empty()||(c=this.__items.pop(),this.__character_count-=c.length),c},s.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},s.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},s.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},s.prototype.toString=function(){var c="";return this.is_empty()?this.__parent.indent_empty_lines&&(c=this.__parent.get_indent_string(this.__indent_count)):(c=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),c+=this.__items.join("")),c};function y(c,l){this.__cache=[""],this.__indent_size=c.indent_size,this.__indent_string=c.indent_char,c.indent_with_tabs||(this.__indent_string=new Array(c.indent_size+1).join(c.indent_char)),l=l||"",c.indent_level>0&&(l=new Array(c.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}y.prototype.get_indent_size=function(c,l){var h=this.__base_string_length;return l=l||0,c<0&&(h=0),h+=c*this.__indent_size,h+=l,h},y.prototype.get_indent_string=function(c,l){var h=this.__base_string;return l=l||0,c<0&&(c=0,h=""),l+=c*this.__indent_size,this.__ensure_cache(l),h+=this.__cache[l],h},y.prototype.__ensure_cache=function(c){for(;c>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var c=this.__cache.length,l=0,h="";this.__indent_size&&c>=this.__indent_size&&(l=Math.floor(c/this.__indent_size),c-=l*this.__indent_size,h=new Array(l+1).join(this.__indent_string)),c&&(h+=new Array(c+1).join(" ")),this.__cache.push(h)};function f(c,l){this.__indent_cache=new y(c,l),this.raw=!1,this._end_with_newline=c.end_with_newline,this.indent_size=c.indent_size,this.wrap_line_length=c.wrap_line_length,this.indent_empty_lines=c.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new s(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}f.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},f.prototype.get_line_number=function(){return this.__lines.length},f.prototype.get_indent_string=function(c,l){return this.__indent_cache.get_indent_string(c,l)},f.prototype.get_indent_size=function(c,l){return this.__indent_cache.get_indent_size(c,l)},f.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},f.prototype.add_new_line=function(c){return this.is_empty()||!c&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},f.prototype.get_code=function(c){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var h=this.__lines.join(`
|
|
|
`);return c!==`
|
|
|
`&&(h=h.replace(/[\n]/g,c)),h},f.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},f.prototype.set_indent=function(c,l){return c=c||0,l=l||0,this.next_line.set_indent(c,l),this.__lines.length>1?(this.current_line.set_indent(c,l),!0):(this.current_line.set_indent(),!1)},f.prototype.add_raw_token=function(c){for(var l=0;l<c.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(c.whitespace_before),this.current_line.push(c.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},f.prototype.add_token=function(c){this.__add_space_before_token(),this.current_line.push(c),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},f.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(" "))},f.prototype.remove_indent=function(c){for(var l=this.__lines.length;c<l;)this.__lines[c]._remove_indent(),c++;this.current_line._remove_wrap_indent()},f.prototype.trim=function(c){for(c=c===void 0?!1:c,this.current_line.trim();c&&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},f.prototype.just_added_newline=function(){return this.current_line.is_empty()},f.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},f.prototype.ensure_empty_line_above=function(c,l){for(var h=this.__lines.length-2;h>=0;){var d=this.__lines[h];if(d.is_empty())break;if(d.item(0).indexOf(c)!==0&&d.item(-1)!==l){this.__lines.splice(h+1,0,new s(this)),this.previous_line=this.__lines[this.__lines.length-2];break}h--}},v.exports.Output=f},,,,function(v){function s(c,l){this.raw_options=y(c,l),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"])}s.prototype._get_array=function(c,l){var h=this.raw_options[c],d=l||[];return typeof h=="object"?h!==null&&typeof h.concat=="function"&&(d=h.concat()):typeof h=="string"&&(d=h.split(/[^a-zA-Z0-9_\/\-]+/)),d},s.prototype._get_boolean=function(c,l){var h=this.raw_options[c],d=h===void 0?!!l:!!h;return d},s.prototype._get_characters=function(c,l){var h=this.raw_options[c],d=l||"";return typeof h=="string"&&(d=h.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),d},s.prototype._get_number=function(c,l){var h=this.raw_options[c];l=parseInt(l,10),isNaN(l)&&(l=0);var d=parseInt(h,10);return isNaN(d)&&(d=l),d},s.prototype._get_selection=function(c,l,h){var d=this._get_selection_list(c,l,h);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+c+`' can only be one of the following values:
|
|
|
`+l+`
|
|
|
You passed in: '`+this.raw_options[c]+"'");return d[0]},s.prototype._get_selection_list=function(c,l,h){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(h=h||[l[0]],!this._is_valid_selection(h,l))throw new Error("Invalid Default Value!");var d=this._get_array(c,h);if(!this._is_valid_selection(d,l))throw new Error("Invalid Option Value: The option '"+c+`' can contain only the following values:
|
|
|
`+l+`
|
|
|
You passed in: '`+this.raw_options[c]+"'");return d},s.prototype._is_valid_selection=function(c,l){return c.length&&l.length&&!c.some(function(h){return l.indexOf(h)===-1})};function y(c,l){var h={};c=f(c);var d;for(d in c)d!==l&&(h[d]=c[d]);if(l&&c[l])for(d in c[l])h[d]=c[l][d];return h}function f(c){var l={},h;for(h in c){var d=h.replace(/-/g,"_");l[d]=c[h]}return l}v.exports.Options=s,v.exports.normalizeOpts=f,v.exports.mergeOpts=y},,function(v){var s=RegExp.prototype.hasOwnProperty("sticky");function y(f){this.__input=f||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__input.charAt(this.__position),this.__position+=1),f},y.prototype.peek=function(f){var c=null;return f=f||0,f+=this.__position,f>=0&&f<this.__input_length&&(c=this.__input.charAt(f)),c},y.prototype.__match=function(f,c){f.lastIndex=c;var l=f.exec(this.__input);return l&&!(s&&f.sticky)&&l.index!==c&&(l=null),l},y.prototype.test=function(f,c){return c=c||0,c+=this.__position,c>=0&&c<this.__input_length?!!this.__match(f,c):!1},y.prototype.testChar=function(f,c){var l=this.peek(c);return f.lastIndex=0,l!==null&&f.test(l)},y.prototype.match=function(f){var c=this.__match(f,this.__position);return c?this.__position+=c[0].length:c=null,c},y.prototype.read=function(f,c,l){var h="",d;return f&&(d=this.match(f),d&&(h+=d[0])),c&&(d||!f)&&(h+=this.readUntil(c,l)),h},y.prototype.readUntil=function(f,c){var l="",h=this.__position;f.lastIndex=this.__position;var d=f.exec(this.__input);return d?(h=d.index,c&&(h+=d[0].length)):h=this.__input_length,l=this.__input.substring(this.__position,h),this.__position=h,l},y.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},y.prototype.get_regexp=function(f,c){var l=null,h="g";return c&&s&&(h="y"),typeof f=="string"&&f!==""?l=new RegExp(f,h):f&&(l=new RegExp(f.source,h)),l},y.prototype.get_literal_regexp=function(f){return RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(f){var c=this.__position,l=this.readUntilAfter(f);return this.__position=c,l},y.prototype.lookBack=function(f){var c=this.__position-1;return c>=f.length&&this.__input.substring(c-f.length,c).toLowerCase()===f},v.exports.InputScanner=y},,,,,function(v){function s(y,f){y=typeof y=="string"?y:y.source,f=typeof f=="string"?f:f.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+f,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+f,"g")}s.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var f={};this.__directive_pattern.lastIndex=0;for(var c=this.__directive_pattern.exec(y);c;)f[c[1]]=c[2],c=this.__directive_pattern.exec(y);return f},s.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},v.exports.Directives=s},,function(v,s,y){var f=y(16).Beautifier,c=y(17).Options;function l(h,d){var E=new f(h,d);return E.beautify()}v.exports=l,v.exports.defaultOptions=function(){return new c}},function(v,s,y){var f=y(17).Options,c=y(2).Output,l=y(8).InputScanner,h=y(13).Directives,d=new h(/\/\*/,/\*\//),E=/\r\n|[\r\n]/,T=/\r\n|[\r\n]/g,L=/\s/,x=/(?:\s|\n)+/g,A=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,O=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function U(B,$){this._source_text=B||"",this._options=new f($),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"]}U.prototype.eatString=function(B){var $="";for(this._ch=this._input.next();this._ch;){if($+=this._ch,this._ch==="\\")$+=this._input.next();else if(B.indexOf(this._ch)!==-1||this._ch===`
|
|
|
`)break;this._ch=this._input.next()}return $},U.prototype.eatWhitespace=function(B){for(var $=L.test(this._input.peek()),M=0;L.test(this._input.peek());)this._ch=this._input.next(),B&&this._ch===`
|
|
|
`&&(M===0||M<this._options.max_preserve_newlines)&&(M++,this._output.add_new_line(!0));return $},U.prototype.foundNestedPseudoClass=function(){for(var B=0,$=1,M=this._input.peek($);M;){if(M==="{")return!0;if(M==="(")B+=1;else if(M===")"){if(B===0)return!1;B-=1}else if(M===";"||M==="}")return!1;$++,M=this._input.peek($)}return!1},U.prototype.print_string=function(B){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(B)},U.prototype.preserveSingleSpace=function(B){B&&(this._output.space_before_token=!0)},U.prototype.indent=function(){this._indentLevel++},U.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},U.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var B=this._source_text,$=this._options.eol;$==="auto"&&($=`
|
|
|
`,B&&E.test(B||"")&&($=B.match(E)[0])),B=B.replace(T,`
|
|
|
`);var M=B.match(/^[\t ]*/)[0];this._output=new c(this._options,M),this._input=new l(B),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var Y=0,q=!1,se=!1,ce=!1,J=!1,z=!1,Z=this._ch,N=!1,W,K,k;W=this._input.read(x),K=W!=="",k=Z,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),Z=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var C=this._input.read(A),V=d.get_directives(C);V&&V.ignore==="start"&&(C+=d.readIgnored(this._input)),this.print_string(C),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(O)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(K),this.print_string(this._ch);var ne=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ne.match(/[ :]$/)&&(ne=this.eatString(": ").replace(/\s+$/,""),this.print_string(ne),this._output.space_before_token=!0),Y===0&&ne.indexOf(":")!==-1&&(se=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(K),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var pe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);pe.match(/[ :]$/)&&(pe=this.eatString(": ").replace(/\s+$/,""),this.print_string(pe),this._output.space_before_token=!0),Y===0&&pe.indexOf(":")!==-1?(se=!0,this.indent()):pe in this.NESTED_AT_RULE?(this._nestedLevel+=1,pe in this.CONDITIONAL_GROUP_RULE&&(ce=!0)):Y===0&&!se&&(J=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(K),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")se&&(se=!1,this.outdent()),J=!1,ce?(ce=!1,q=this._indentLevel>=this._nestedLevel):q=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&q&&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)):(k==="("?this._output.space_before_token=!1:k!==","&&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(),k==="{"&&this._output.trim(!0),se&&(this.outdent(),se=!1),this.print_string(this._ch),q=!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 Te=0;Te<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Te++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Te])){N=!0;break}(q||ce)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!J&&Y===0?(this.print_string(":"),se||(se=!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 Ke=k==='"'||k==="'";this.preserveSingleSpace(Ke||K),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")N=!1,Y===0?(se&&(this.outdent(),se=!1),J=!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(),Y++,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(")")),Y&&(Y--,this.outdent()));else{var ve=!1;this._input.lookBack("with")&&(ve=!0),this.preserveSingleSpace(K||ve),this.print_string(this._ch),se&&k==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),z=!0):(this.eatWhitespace(),Y++,this.indent())}else if(this._ch===")")Y&&(Y--,this.outdent()),z&&this._input.peek()===";"&&this._options.selector_separator_newline&&(z=!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&&(!se||z)&&Y===0&&!J?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!se&&Y===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&&L.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(K),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),L.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 Ue=k==='"'||k==="'";this.preserveSingleSpace(Ue||K),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
|
`&&N&&this._output.add_new_line()}var Be=this._output.get_code($);return Be},v.exports.Beautifier=U},function(v,s,y){var f=y(6).Options;function c(l){f.call(this,l,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var h=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||h;var d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var E=0;E<d.length;E++)d[E]!=="expand"?this.brace_style="collapse":this.brace_style=d[E]}c.prototype=new f,v.exports.Options=c}],w={};function _(v){var s=w[v];if(s!==void 0)return s.exports;var y=w[v]={exports:{}};return D[v](y,y.exports,_),y.exports}var F=_(15);P=F})();var G=P;b=[],I=function(){return{css_beautify:G}}.apply(me,b),I!==void 0&&(yt.exports=I)})()},40998:function(yt,me,b){var I,P;(function(){var G;(function(){"use strict";var F=[,,function(f){function c(d){this.__parent=d,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=[]}c.prototype.clone_empty=function(){var d=new c(this.__parent);return d.set_indent(this.__indent_count,this.__alignment_count),d},c.prototype.item=function(d){return d<0?this.__items[this.__items.length+d]:this.__items[d]},c.prototype.has_match=function(d){for(var E=this.__items.length-1;E>=0;E--)if(this.__items[E].match(d))return!0;return!1},c.prototype.set_indent=function(d,E){this.is_empty()&&(this.__indent_count=d||0,this.__alignment_count=E||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},c.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)},c.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},c.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var d=this.__parent.current_line;return d.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),d.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),d.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,d.__items[0]===" "&&(d.__items.splice(0,1),d.__character_count-=1),!0}return!1},c.prototype.is_empty=function(){return this.__items.length===0},c.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},c.prototype.push=function(d){this.__items.push(d);var E=d.lastIndexOf(`
|
|
|
`);E!==-1?this.__character_count=d.length-E:this.__character_count+=d.length},c.prototype.pop=function(){var d=null;return this.is_empty()||(d=this.__items.pop(),this.__character_count-=d.length),d},c.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},c.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},c.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},c.prototype.toString=function(){var d="";return this.is_empty()?this.__parent.indent_empty_lines&&(d=this.__parent.get_indent_string(this.__indent_count)):(d=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),d+=this.__items.join("")),d};function l(d,E){this.__cache=[""],this.__indent_size=d.indent_size,this.__indent_string=d.indent_char,d.indent_with_tabs||(this.__indent_string=new Array(d.indent_size+1).join(d.indent_char)),E=E||"",d.indent_level>0&&(E=new Array(d.indent_level+1).join(this.__indent_string)),this.__base_string=E,this.__base_string_length=E.length}l.prototype.get_indent_size=function(d,E){var T=this.__base_string_length;return E=E||0,d<0&&(T=0),T+=d*this.__indent_size,T+=E,T},l.prototype.get_indent_string=function(d,E){var T=this.__base_string;return E=E||0,d<0&&(d=0,T=""),E+=d*this.__indent_size,this.__ensure_cache(E),T+=this.__cache[E],T},l.prototype.__ensure_cache=function(d){for(;d>=this.__cache.length;)this.__add_column()},l.prototype.__add_column=function(){var d=this.__cache.length,E=0,T="";this.__indent_size&&d>=this.__indent_size&&(E=Math.floor(d/this.__indent_size),d-=E*this.__indent_size,T=new Array(E+1).join(this.__indent_string)),d&&(T+=new Array(d+1).join(" ")),this.__cache.push(T)};function h(d,E){this.__indent_cache=new l(d,E),this.raw=!1,this._end_with_newline=d.end_with_newline,this.indent_size=d.indent_size,this.wrap_line_length=d.wrap_line_length,this.indent_empty_lines=d.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new c(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(d,E){return this.__indent_cache.get_indent_string(d,E)},h.prototype.get_indent_size=function(d,E){return this.__indent_cache.get_indent_size(d,E)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(d){return this.is_empty()||!d&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(d){this.trim(!0);var E=this.current_line.pop();E&&(E[E.length-1]===`
|
|
|
`&&(E=E.replace(/\n+$/g,"")),this.current_line.push(E)),this._end_with_newline&&this.__add_outputline();var T=this.__lines.join(`
|
|
|
`);return d!==`
|
|
|
`&&(T=T.replace(/[\n]/g,d)),T},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(d,E){return d=d||0,E=E||0,this.next_line.set_indent(d,E),this.__lines.length>1?(this.current_line.set_indent(d,E),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(d){for(var E=0;E<d.newlines;E++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(d.whitespace_before),this.current_line.push(d.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(d){this.__add_space_before_token(),this.current_line.push(d),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.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(" "))},h.prototype.remove_indent=function(d){for(var E=this.__lines.length;d<E;)this.__lines[d]._remove_indent(),d++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(d){for(d=d===void 0?!1:d,this.current_line.trim();d&&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},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(d,E){for(var T=this.__lines.length-2;T>=0;){var L=this.__lines[T];if(L.is_empty())break;if(L.item(0).indexOf(d)!==0&&L.item(-1)!==E){this.__lines.splice(T+1,0,new c(this)),this.previous_line=this.__lines[this.__lines.length-2];break}T--}},f.exports.Output=h},function(f){function c(l,h,d,E){this.type=l,this.text=h,this.comments_before=null,this.newlines=d||0,this.whitespace_before=E||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}f.exports.Token=c},,,function(f){function c(d,E){this.raw_options=l(d,E),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"])}c.prototype._get_array=function(d,E){var T=this.raw_options[d],L=E||[];return typeof T=="object"?T!==null&&typeof T.concat=="function"&&(L=T.concat()):typeof T=="string"&&(L=T.split(/[^a-zA-Z0-9_\/\-]+/)),L},c.prototype._get_boolean=function(d,E){var T=this.raw_options[d],L=T===void 0?!!E:!!T;return L},c.prototype._get_characters=function(d,E){var T=this.raw_options[d],L=E||"";return typeof T=="string"&&(L=T.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),L},c.prototype._get_number=function(d,E){var T=this.raw_options[d];E=parseInt(E,10),isNaN(E)&&(E=0);var L=parseInt(T,10);return isNaN(L)&&(L=E),L},c.prototype._get_selection=function(d,E,T){var L=this._get_selection_list(d,E,T);if(L.length!==1)throw new Error("Invalid Option Value: The option '"+d+`' can only be one of the following values:
|
|
|
`+E+`
|
|
|
You passed in: '`+this.raw_options[d]+"'");return L[0]},c.prototype._get_selection_list=function(d,E,T){if(!E||E.length===0)throw new Error("Selection list cannot be empty.");if(T=T||[E[0]],!this._is_valid_selection(T,E))throw new Error("Invalid Default Value!");var L=this._get_array(d,T);if(!this._is_valid_selection(L,E))throw new Error("Invalid Option Value: The option '"+d+`' can contain only the following values:
|
|
|
`+E+`
|
|
|
You passed in: '`+this.raw_options[d]+"'");return L},c.prototype._is_valid_selection=function(d,E){return d.length&&E.length&&!d.some(function(T){return E.indexOf(T)===-1})};function l(d,E){var T={};d=h(d);var L;for(L in d)L!==E&&(T[L]=d[L]);if(E&&d[E])for(L in d[E])T[L]=d[E][L];return T}function h(d){var E={},T;for(T in d){var L=T.replace(/-/g,"_");E[L]=d[T]}return E}f.exports.Options=c,f.exports.normalizeOpts=h,f.exports.mergeOpts=l},,function(f){var c=RegExp.prototype.hasOwnProperty("sticky");function l(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}l.prototype.restart=function(){this.__position=0},l.prototype.back=function(){this.__position>0&&(this.__position-=1)},l.prototype.hasNext=function(){return this.__position<this.__input_length},l.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},l.prototype.peek=function(h){var d=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(d=this.__input.charAt(h)),d},l.prototype.__match=function(h,d){h.lastIndex=d;var E=h.exec(this.__input);return E&&!(c&&h.sticky)&&E.index!==d&&(E=null),E},l.prototype.test=function(h,d){return d=d||0,d+=this.__position,d>=0&&d<this.__input_length?!!this.__match(h,d):!1},l.prototype.testChar=function(h,d){var E=this.peek(d);return h.lastIndex=0,E!==null&&h.test(E)},l.prototype.match=function(h){var d=this.__match(h,this.__position);return d?this.__position+=d[0].length:d=null,d},l.prototype.read=function(h,d,E){var T="",L;return h&&(L=this.match(h),L&&(T+=L[0])),d&&(L||!h)&&(T+=this.readUntil(d,E)),T},l.prototype.readUntil=function(h,d){var E="",T=this.__position;h.lastIndex=this.__position;var L=h.exec(this.__input);return L?(T=L.index,d&&(T+=L[0].length)):T=this.__input_length,E=this.__input.substring(this.__position,T),this.__position=T,E},l.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},l.prototype.get_regexp=function(h,d){var E=null,T="g";return d&&c&&(T="y"),typeof h=="string"&&h!==""?E=new RegExp(h,T):h&&(E=new RegExp(h.source,T)),E},l.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},l.prototype.peekUntilAfter=function(h){var d=this.__position,E=this.readUntilAfter(h);return this.__position=d,E},l.prototype.lookBack=function(h){var d=this.__position-1;return d>=h.length&&this.__input.substring(d-h.length,d).toLowerCase()===h},f.exports.InputScanner=l},function(f,c,l){var h=l(8).InputScanner,d=l(3).Token,E=l(10).TokenStream,T=l(11).WhitespacePattern,L={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},x=function(A,O){this._input=new h(A),this._options=O||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new T(this._input)};x.prototype.tokenize=function(){this._input.restart(),this.__tokens=new E,this._reset();for(var A,O=new d(L.START,""),U=null,B=[],$=new E;O.type!==L.EOF;){for(A=this._get_next_token(O,U);this._is_comment(A);)$.add(A),A=this._get_next_token(O,U);$.isEmpty()||(A.comments_before=$,$=new E),A.parent=U,this._is_opening(A)?(B.push(U),U=A):U&&this._is_closing(A,U)&&(A.opened=U,U.closed=A,U=B.pop(),A.parent=U),A.previous=O,O.next=A,this.__tokens.add(A),O=A}return this.__tokens},x.prototype._is_first_token=function(){return this.__tokens.isEmpty()},x.prototype._reset=function(){},x.prototype._get_next_token=function(A,O){this._readWhitespace();var U=this._input.read(/.+/g);return U?this._create_token(L.RAW,U):this._create_token(L.EOF,"")},x.prototype._is_comment=function(A){return!1},x.prototype._is_opening=function(A){return!1},x.prototype._is_closing=function(A,O){return!1},x.prototype._create_token=function(A,O){var U=new d(A,O,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return U},x.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},f.exports.Tokenizer=x,f.exports.TOKEN=L},function(f){function c(l){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=l}c.prototype.restart=function(){this.__position=0},c.prototype.isEmpty=function(){return this.__tokens_length===0},c.prototype.hasNext=function(){return this.__position<this.__tokens_length},c.prototype.next=function(){var l=null;return this.hasNext()&&(l=this.__tokens[this.__position],this.__position+=1),l},c.prototype.peek=function(l){var h=null;return l=l||0,l+=this.__position,l>=0&&l<this.__tokens_length&&(h=this.__tokens[l]),h},c.prototype.add=function(l){this.__parent_token&&(l.parent=this.__parent_token),this.__tokens.push(l),this.__tokens_length+=1},f.exports.TokenStream=c},function(f,c,l){var h=l(12).Pattern;function d(E,T){h.call(this,E,T),T?this._line_regexp=this._input.get_regexp(T._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}d.prototype=new h,d.prototype.__set_whitespace_patterns=function(E,T){E+="\\t ",T+="\\n\\r",this._match_pattern=this._input.get_regexp("["+E+T+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+T+"]")},d.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var E=this._input.read(this._match_pattern);if(E===" ")this.whitespace_before_token=" ";else if(E){var T=this.__split(this._newline_regexp,E);this.newline_count=T.length-1,this.whitespace_before_token=T[this.newline_count]}return E},d.prototype.matching=function(E,T){var L=this._create();return L.__set_whitespace_patterns(E,T),L._update(),L},d.prototype._create=function(){return new d(this._input,this)},d.prototype.__split=function(E,T){E.lastIndex=0;for(var L=0,x=[],A=E.exec(T);A;)x.push(T.substring(L,A.index)),L=A.index+A[0].length,A=E.exec(T);return L<T.length?x.push(T.substring(L,T.length)):x.push(""),x},f.exports.WhitespacePattern=d},function(f){function c(l,h){this._input=l,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}c.prototype.read=function(){var l=this._input.read(this._starting_pattern);return(!this._starting_pattern||l)&&(l+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),l},c.prototype.read_match=function(){return this._input.match(this._match_pattern)},c.prototype.until_after=function(l){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(l),h._update(),h},c.prototype.until=function(l){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(l),h._update(),h},c.prototype.starting_with=function(l){var h=this._create();return h._starting_pattern=this._input.get_regexp(l,!0),h._update(),h},c.prototype.matching=function(l){var h=this._create();return h._match_pattern=this._input.get_regexp(l,!0),h._update(),h},c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){},f.exports.Pattern=c},function(f){function c(l,h){l=typeof l=="string"?l:l.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(l+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(l+/\sbeautify\signore:end\s/.source+h,"g")}c.prototype.get_directives=function(l){if(!l.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var d=this.__directive_pattern.exec(l);d;)h[d[1]]=d[2],d=this.__directive_pattern.exec(l);return h},c.prototype.readIgnored=function(l){return l.readUntilAfter(this.__directives_end_ignore_pattern)},f.exports.Directives=c},function(f,c,l){var h=l(12).Pattern,d={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function E(T,L){h.call(this,T,L),this.__template_pattern=null,this._disabled=Object.assign({},d),this._excluded=Object.assign({},d),L&&(this.__template_pattern=this._input.get_regexp(L.__template_pattern),this._excluded=Object.assign(this._excluded,L._excluded),this._disabled=Object.assign(this._disabled,L._disabled));var x=new h(T);this.__patterns={handlebars_comment:x.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:x.starting_with(/{{{/).until_after(/}}}/),handlebars:x.starting_with(/{{/).until_after(/}}/),php:x.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:x.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:x.starting_with(/{%/).until_after(/%}/),django_value:x.starting_with(/{{/).until_after(/}}/),django_comment:x.starting_with(/{#/).until_after(/#}/),smarty:x.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:x.starting_with(/{\*/).until_after(/\*}/),smarty_literal:x.starting_with(/{literal}/).until_after(/{\/literal}/)}}E.prototype=new h,E.prototype._create=function(){return new E(this._input,this)},E.prototype._update=function(){this.__set_templated_pattern()},E.prototype.disable=function(T){var L=this._create();return L._disabled[T]=!0,L._update(),L},E.prototype.read_options=function(T){var L=this._create();for(var x in d)L._disabled[x]=T.templating.indexOf(x)===-1;return L._update(),L},E.prototype.exclude=function(T){var L=this._create();return L._excluded[T]=!0,L._update(),L},E.prototype.read=function(){var T="";this._match_pattern?T=this._input.read(this._starting_pattern):T=this._input.read(this._starting_pattern,this.__template_pattern);for(var L=this._read_template();L;)this._match_pattern?L+=this._input.read(this._match_pattern):L+=this._input.readUntil(this.__template_pattern),T+=L,L=this._read_template();return this._until_after&&(T+=this._input.readUntilAfter(this._until_pattern)),T},E.prototype.__set_templated_pattern=function(){var T=[];this._disabled.php||T.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||T.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||T.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||T.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(T.push(this.__patterns.django._starting_pattern.source),T.push(this.__patterns.django_value._starting_pattern.source),T.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||T.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&T.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+T.join("|")+")")},E.prototype._read_template=function(){var T="",L=this._input.peek();if(L==="<"){var x=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&x==="?"&&(T=T||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&x==="%"&&(T=T||this.__patterns.erb.read())}else L==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(T=T||this.__patterns.handlebars_comment.read(),T=T||this.__patterns.handlebars_unescaped.read(),T=T||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(T=T||this.__patterns.django_value.read()),this._excluded.django||(T=T||this.__patterns.django_comment.read(),T=T||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(T=T||this.__patterns.smarty_comment.read(),T=T||this.__patterns.smarty_literal.read(),T=T||this.__patterns.smarty.read()));return T},f.exports.TemplatablePattern=E},,,,function(f,c,l){var h=l(19).Beautifier,d=l(20).Options;function E(T,L,x,A){var O=new h(T,L,x,A);return O.beautify()}f.exports=E,f.exports.defaultOptions=function(){return new d}},function(f,c,l){var h=l(20).Options,d=l(2).Output,E=l(21).Tokenizer,T=l(21).TOKEN,L=/\r\n|[\r\n]/,x=/\r\n|[\r\n]/g,A=function(J,z){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=J.max_preserve_newlines,this.preserve_newlines=J.preserve_newlines,this._output=new d(J,z)};A.prototype.current_line_has_match=function(J){return this._output.current_line.has_match(J)},A.prototype.set_space_before_token=function(J,z){this._output.space_before_token=J,this._output.non_breaking_space=z},A.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},A.prototype.add_raw_token=function(J){this._output.add_raw_token(J)},A.prototype.print_preserved_newlines=function(J){var z=0;J.type!==T.TEXT&&J.previous.type!==T.TEXT&&(z=J.newlines?1:0),this.preserve_newlines&&(z=J.newlines<this.max_preserve_newlines+1?J.newlines:this.max_preserve_newlines+1);for(var Z=0;Z<z;Z++)this.print_newline(Z>0);return z!==0},A.prototype.traverse_whitespace=function(J){return J.whitespace_before||J.newlines?(this.print_preserved_newlines(J)||(this._output.space_before_token=!0),!0):!1},A.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},A.prototype.print_newline=function(J){this._output.add_new_line(J)},A.prototype.print_token=function(J){J.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(J.text))},A.prototype.indent=function(){this.indent_level++},A.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},A.prototype.get_full_indent=function(J){return J=this.indent_level+(J||0),J<1?"":this._output.get_indent_string(J)};var O=function(J){for(var z=null,Z=J.next;Z.type!==T.EOF&&J.closed!==Z;){if(Z.type===T.ATTRIBUTE&&Z.text==="type"){Z.next&&Z.next.type===T.EQUALS&&Z.next.next&&Z.next.next.type===T.VALUE&&(z=Z.next.next.text);break}Z=Z.next}return z},U=function(J,z){var Z=null,N=null;return z.closed?(J==="script"?Z="text/javascript":J==="style"&&(Z="text/css"),Z=O(z)||Z,Z.search("text/css")>-1?N="css":Z.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?N="javascript":Z.search(/(text|application|dojo)\/(x-)?(html)/)>-1?N="html":Z.search(/test\/null/)>-1&&(N="null"),N):null};function B(J,z){return z.indexOf(J)!==-1}function $(J,z,Z){this.parent=J||null,this.tag=z?z.tag_name:"",this.indent_level=Z||0,this.parser_token=z||null}function M(J){this._printer=J,this._current_frame=null}M.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},M.prototype.record_tag=function(J){var z=new $(this._current_frame,J,this._printer.indent_level);this._current_frame=z},M.prototype._try_pop_frame=function(J){var z=null;return J&&(z=J.parser_token,this._printer.indent_level=J.indent_level,this._current_frame=J.parent),z},M.prototype._get_frame=function(J,z){for(var Z=this._current_frame;Z&&J.indexOf(Z.tag)===-1;){if(z&&z.indexOf(Z.tag)!==-1){Z=null;break}Z=Z.parent}return Z},M.prototype.try_pop=function(J,z){var Z=this._get_frame([J],z);return this._try_pop_frame(Z)},M.prototype.indent_to_tag=function(J){var z=this._get_frame(J);z&&(this._printer.indent_level=z.indent_level)};function Y(J,z,Z,N){this._source_text=J||"",z=z||{},this._js_beautify=Z,this._css_beautify=N,this._tag_stack=null;var W=new h(z,"html");this._options=W,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"}Y.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var J=this._source_text,z=this._options.eol;this._options.eol==="auto"&&(z=`
|
|
|
`,J&&L.test(J)&&(z=J.match(L)[0])),J=J.replace(x,`
|
|
|
`);var Z=J.match(/^[\t ]*/)[0],N={text:"",type:""},W=new q(this._options),K=new A(this._options,Z),k=new E(J,this._options).tokenize();this._tag_stack=new M(K);for(var C=null,V=k.next();V.type!==T.EOF;)V.type===T.TAG_OPEN||V.type===T.COMMENT?(C=this._handle_tag_open(K,V,W,N,k),W=C):V.type===T.ATTRIBUTE||V.type===T.EQUALS||V.type===T.VALUE||V.type===T.TEXT&&!W.tag_complete?C=this._handle_inside_tag(K,V,W,N):V.type===T.TAG_CLOSE?C=this._handle_tag_close(K,V,W):V.type===T.TEXT?C=this._handle_text(K,V,W):V.type===T.CONTROL_FLOW_OPEN?C=this._handle_control_flow_open(K,V):V.type===T.CONTROL_FLOW_CLOSE?C=this._handle_control_flow_close(K,V):K.add_raw_token(V),N=C,V=k.next();var ne=K._output.get_code(z);return ne},Y.prototype._handle_control_flow_open=function(J,z){var Z={text:z.text,type:z.type};return J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),z.newlines?J.print_preserved_newlines(z):J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),J.print_token(z),J.indent(),Z},Y.prototype._handle_control_flow_close=function(J,z){var Z={text:z.text,type:z.type};return J.deindent(),z.newlines?J.print_preserved_newlines(z):J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),J.print_token(z),Z},Y.prototype._handle_tag_close=function(J,z,Z){var N={text:z.text,type:z.type};return J.alignment_size=0,Z.tag_complete=!0,J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),Z.is_unformatted?J.add_raw_token(z):(Z.tag_start_char==="<"&&(J.set_space_before_token(z.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&Z.has_wrapped_attrs&&J.print_newline(!1)),J.print_token(z)),Z.indent_content&&!(Z.is_unformatted||Z.is_content_unformatted)&&(J.indent(),Z.indent_content=!1),!Z.is_inline_element&&!(Z.is_unformatted||Z.is_content_unformatted)&&J.set_wrap_point(),N},Y.prototype._handle_inside_tag=function(J,z,Z,N){var W=Z.has_wrapped_attrs,K={text:z.text,type:z.type};return J.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),Z.is_unformatted?J.add_raw_token(z):Z.tag_start_char==="{"&&z.type===T.TEXT?J.print_preserved_newlines(z)?(z.newlines=0,J.add_raw_token(z)):J.print_token(z):(z.type===T.ATTRIBUTE?J.set_space_before_token(!0):(z.type===T.EQUALS||z.type===T.VALUE&&z.previous.type===T.EQUALS)&&J.set_space_before_token(!1),z.type===T.ATTRIBUTE&&Z.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(J.traverse_whitespace(z),W=W||z.newlines!==0),this._is_wrap_attributes_force&&Z.attr_count>=this._options.wrap_attributes_min_attrs&&(N.type!==T.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(J.print_newline(!1),W=!0)),J.print_token(z),W=W||J.previous_token_wrapped(),Z.has_wrapped_attrs=W),K},Y.prototype._handle_text=function(J,z,Z){var N={text:z.text,type:"TK_CONTENT"};return Z.custom_beautifier_name?this._print_custom_beatifier_text(J,z,Z):Z.is_unformatted||Z.is_content_unformatted?J.add_raw_token(z):(J.traverse_whitespace(z),J.print_token(z)),N},Y.prototype._print_custom_beatifier_text=function(J,z,Z){var N=this;if(z.text!==""){var W=z.text,K,k=1,C="",V="";Z.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?K=this._js_beautify:Z.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?K=this._css_beautify:Z.custom_beautifier_name==="html"&&(K=function(Ue,Be){var Me=new Y(Ue,Be,N._js_beautify,N._css_beautify);return Me.beautify()}),this._options.indent_scripts==="keep"?k=0:this._options.indent_scripts==="separate"&&(k=-J.indent_level);var ne=J.get_full_indent(k);if(W=W.replace(/\n[ \t]*$/,""),Z.custom_beautifier_name!=="html"&&W[0]==="<"&&W.match(/^(<!--|<!\[CDATA\[)/)){var pe=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(W);if(!pe){J.add_raw_token(z);return}C=ne+pe[1]+`
|
|
|
`,W=pe[4],pe[5]&&(V=ne+pe[5]),W=W.replace(/\n[ \t]*$/,""),(pe[2]||pe[3].indexOf(`
|
|
|
`)!==-1)&&(pe=pe[3].match(/[ \t]+$/),pe&&(z.whitespace_before=pe[0]))}if(W)if(K){var Te=function(){this.eol=`
|
|
|
`};Te.prototype=this._options.raw_options;var Ke=new Te;W=K(ne+W,Ke)}else{var ve=z.whitespace_before;ve&&(W=W.replace(new RegExp(`
|
|
|
(`+ve+")?","g"),`
|
|
|
`)),W=ne+W.replace(/\n/g,`
|
|
|
`+ne)}C&&(W?W=C+W+`
|
|
|
`+V:W=C+V),J.print_newline(!1),W&&(z.text=W,z.whitespace_before="",z.newlines=0,J.add_raw_token(z),J.print_newline(!0))}},Y.prototype._handle_tag_open=function(J,z,Z,N,W){var K=this._get_tag_open_token(z);if((Z.is_unformatted||Z.is_content_unformatted)&&!Z.is_empty_element&&z.type===T.TAG_OPEN&&!K.is_start_tag?(J.add_raw_token(z),K.start_tag_token=this._tag_stack.try_pop(K.tag_name)):(J.traverse_whitespace(z),this._set_tag_position(J,z,K,Z,N),K.is_inline_element||J.set_wrap_point(),J.print_token(z)),K.is_start_tag&&this._is_wrap_attributes_force){var k=0,C;do C=W.peek(k),C.type===T.ATTRIBUTE&&(K.attr_count+=1),k+=1;while(C.type!==T.EOF&&C.type!==T.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(K.alignment_size=z.text.length+1),!K.tag_complete&&!K.is_unformatted&&(J.alignment_size=K.alignment_size),K};var q=function(J,z,Z){if(this.parent=z||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="",!Z)this.tag_complete=!0;else{var N;this.tag_start_char=Z.text[0],this.text=Z.text,this.tag_start_char==="<"?(N=Z.text.match(/^<([^\s>]*)/),this.tag_check=N?N[1]:""):(N=Z.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=N?N[1]:"",(Z.text.startsWith("{{#>")||Z.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&Z.next!==null?this.tag_check=Z.next.text.split(" ")[0]:this.tag_check=Z.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),Z.type===T.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||Z.closed&&Z.closed.text==="/>";var W=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(W=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!J.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(W)))}};Y.prototype._get_tag_open_token=function(J){var z=new q(this._options,this._tag_stack.get_parser_token(),J);return z.alignment_size=this._options.wrap_attributes_indent_size,z.is_end_tag=z.is_end_tag||B(z.tag_check,this._options.void_elements),z.is_empty_element=z.tag_complete||z.is_start_tag&&z.is_end_tag,z.is_unformatted=!z.tag_complete&&B(z.tag_check,this._options.unformatted),z.is_content_unformatted=!z.is_empty_element&&B(z.tag_check,this._options.content_unformatted),z.is_inline_element=B(z.tag_name,this._options.inline)||this._options.inline_custom_elements&&z.tag_name.includes("-")||z.tag_start_char==="{",z},Y.prototype._set_tag_position=function(J,z,Z,N,W){if(Z.is_empty_element||(Z.is_end_tag?Z.start_tag_token=this._tag_stack.try_pop(Z.tag_name):(this._do_optional_end_element(Z)&&(Z.is_inline_element||J.print_newline(!1)),this._tag_stack.record_tag(Z),(Z.tag_name==="script"||Z.tag_name==="style")&&!(Z.is_unformatted||Z.is_content_unformatted)&&(Z.custom_beautifier_name=U(Z.tag_check,z)))),B(Z.tag_check,this._options.extra_liners)&&(J.print_newline(!1),J._output.just_added_blankline()||J.print_newline(!0)),Z.is_empty_element){if(Z.tag_start_char==="{"&&Z.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),Z.indent_content=!0;var K=J.current_line_has_match(/{{#if/);K||J.print_newline(!1)}Z.tag_name==="!--"&&W.type===T.TAG_CLOSE&&N.is_end_tag&&Z.text.indexOf(`
|
|
|
`)===-1||(Z.is_inline_element||Z.is_unformatted||J.print_newline(!1),this._calcluate_parent_multiline(J,Z))}else if(Z.is_end_tag){var k=!1;k=Z.start_tag_token&&Z.start_tag_token.multiline_content,k=k||!Z.is_inline_element&&!(N.is_inline_element||N.is_unformatted)&&!(W.type===T.TAG_CLOSE&&Z.start_tag_token===N)&&W.type!=="TK_CONTENT",(Z.is_content_unformatted||Z.is_unformatted)&&(k=!1),k&&J.print_newline(!1)}else Z.indent_content=!Z.custom_beautifier_name,Z.tag_start_char==="<"&&(Z.tag_name==="html"?Z.indent_content=this._options.indent_inner_html:Z.tag_name==="head"?Z.indent_content=this._options.indent_head_inner_html:Z.tag_name==="body"&&(Z.indent_content=this._options.indent_body_inner_html)),!(Z.is_inline_element||Z.is_unformatted)&&(W.type!=="TK_CONTENT"||Z.is_content_unformatted)&&J.print_newline(!1),this._calcluate_parent_multiline(J,Z)},Y.prototype._calcluate_parent_multiline=function(J,z){z.parent&&J._output.just_added_newline()&&!((z.is_inline_element||z.is_unformatted)&&z.parent.is_inline_element)&&(z.parent.multiline_content=!0)};var se=["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"],ce=["a","audio","del","ins","map","noscript","video"];Y.prototype._do_optional_end_element=function(J){var z=null;if(!(J.is_empty_element||!J.is_start_tag||!J.parent)){if(J.tag_name==="body")z=z||this._tag_stack.try_pop("head");else if(J.tag_name==="li")z=z||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(J.tag_name==="dd"||J.tag_name==="dt")z=z||this._tag_stack.try_pop("dt",["dl"]),z=z||this._tag_stack.try_pop("dd",["dl"]);else if(J.parent.tag_name==="p"&&se.indexOf(J.tag_name)!==-1){var Z=J.parent.parent;(!Z||ce.indexOf(Z.tag_name)===-1)&&(z=z||this._tag_stack.try_pop("p"))}else J.tag_name==="rp"||J.tag_name==="rt"?(z=z||this._tag_stack.try_pop("rt",["ruby","rtc"]),z=z||this._tag_stack.try_pop("rp",["ruby","rtc"])):J.tag_name==="optgroup"?z=z||this._tag_stack.try_pop("optgroup",["select"]):J.tag_name==="option"?z=z||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):J.tag_name==="colgroup"?z=z||this._tag_stack.try_pop("caption",["table"]):J.tag_name==="thead"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"])):J.tag_name==="tbody"||J.tag_name==="tfoot"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"]),z=z||this._tag_stack.try_pop("thead",["table"]),z=z||this._tag_stack.try_pop("tbody",["table"])):J.tag_name==="tr"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"]),z=z||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(J.tag_name==="th"||J.tag_name==="td")&&(z=z||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),z=z||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return J.parent=this._tag_stack.get_parser_token(),z}},f.exports.Beautifier=Y},function(f,c,l){var h=l(6).Options;function d(E){h.call(this,E,"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"])}d.prototype=new h,f.exports.Options=d},function(f,c,l){var h=l(9).Tokenizer,d=l(9).TOKEN,E=l(13).Directives,T=l(14).TemplatablePattern,L=l(12).Pattern,x={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:d.START,RAW:d.RAW,EOF:d.EOF},A=new E(/<\!--/,/-->/),O=function(U,B){h.call(this,U,B),this._current_tag_name="";var $=new T(this._input).read_options(this._options),M=new L(this._input);if(this.__patterns={word:$.until(/[\n\r\t <]/),word_control_flow_close_excluded:$.until(/[\n\r\t <}]/),single_quote:$.until_after(/'/),double_quote:$.until_after(/"/),attribute:$.until(/[\n\r\t =>]|\/>/),element_name:$.until(/[\n\r\t >\/]/),angular_control_flow_start:M.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:M.starting_with(/{{!--/).until_after(/--}}/),handlebars:M.starting_with(/{{/).until_after(/}}/),handlebars_open:M.until(/[\n\r\t }]/),handlebars_raw_close:M.until(/}}/),comment:M.starting_with(/<!--/).until_after(/-->/),cdata:M.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:M.starting_with(/<!\[/).until_after(/]>/),processing:M.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 Y=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=M.matching(Y).until_after(Y)}};O.prototype=new h,O.prototype._is_comment=function(U){return!1},O.prototype._is_opening=function(U){return U.type===x.TAG_OPEN||U.type===x.CONTROL_FLOW_OPEN},O.prototype._is_closing=function(U,B){return U.type===x.TAG_CLOSE&&B&&((U.text===">"||U.text==="/>")&&B.text[0]==="<"||U.text==="}}"&&B.text[0]==="{"&&B.text[1]==="{")||U.type===x.CONTROL_FLOW_CLOSE&&U.text==="}"&&B.text.endsWith("{")},O.prototype._reset=function(){this._current_tag_name=""},O.prototype._get_next_token=function(U,B){var $=null;this._readWhitespace();var M=this._input.peek();return M===null?this._create_token(x.EOF,""):($=$||this._read_open_handlebars(M,B),$=$||this._read_attribute(M,U,B),$=$||this._read_close(M,B),$=$||this._read_script_and_style(M,U),$=$||this._read_control_flows(M,B),$=$||this._read_raw_content(M,U,B),$=$||this._read_content_word(M,B),$=$||this._read_comment_or_cdata(M),$=$||this._read_processing(M),$=$||this._read_open(M,B),$=$||this._create_token(x.UNKNOWN,this._input.next()),$)},O.prototype._read_comment_or_cdata=function(U){var B=null,$=null,M=null;if(U==="<"){var Y=this._input.peek(1);Y==="!"&&($=this.__patterns.comment.read(),$?(M=A.get_directives($),M&&M.ignore==="start"&&($+=A.readIgnored(this._input))):$=this.__patterns.cdata.read()),$&&(B=this._create_token(x.COMMENT,$),B.directives=M)}return B},O.prototype._read_processing=function(U){var B=null,$=null,M=null;if(U==="<"){var Y=this._input.peek(1);(Y==="!"||Y==="?")&&($=this.__patterns.conditional_comment.read(),$=$||this.__patterns.processing.read()),$&&(B=this._create_token(x.COMMENT,$),B.directives=M)}return B},O.prototype._read_open=function(U,B){var $=null,M=null;return(!B||B.type===x.CONTROL_FLOW_OPEN)&&U==="<"&&($=this._input.next(),this._input.peek()==="/"&&($+=this._input.next()),$+=this.__patterns.element_name.read(),M=this._create_token(x.TAG_OPEN,$)),M},O.prototype._read_open_handlebars=function(U,B){var $=null,M=null;return(!B||B.type===x.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&U==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?($=this.__patterns.handlebars_comment.read(),$=$||this.__patterns.handlebars.read(),M=this._create_token(x.COMMENT,$)):($=this.__patterns.handlebars_open.read(),M=this._create_token(x.TAG_OPEN,$))),M},O.prototype._read_control_flows=function(U,B){var $="",M=null;if(!this._options.templating.includes("angular"))return M;if(U==="@"){if($=this.__patterns.angular_control_flow_start.read(),$==="")return M;for(var Y=$.endsWith("(")?1:0,q=0;!($.endsWith("{")&&Y===q);){var se=this._input.next();if(se===null)break;se==="("?Y++:se===")"&&q++,$+=se}M=this._create_token(x.CONTROL_FLOW_OPEN,$)}else U==="}"&&B&&B.type===x.CONTROL_FLOW_OPEN&&($=this._input.next(),M=this._create_token(x.CONTROL_FLOW_CLOSE,$));return M},O.prototype._read_close=function(U,B){var $=null,M=null;return B&&B.type===x.TAG_OPEN&&(B.text[0]==="<"&&(U===">"||U==="/"&&this._input.peek(1)===">")?($=this._input.next(),U==="/"&&($+=this._input.next()),M=this._create_token(x.TAG_CLOSE,$)):B.text[0]==="{"&&U==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),M=this._create_token(x.TAG_CLOSE,"}}"))),M},O.prototype._read_attribute=function(U,B,$){var M=null,Y="";if($&&$.text[0]==="<")if(U==="=")M=this._create_token(x.EQUALS,this._input.next());else if(U==='"'||U==="'"){var q=this._input.next();U==='"'?q+=this.__patterns.double_quote.read():q+=this.__patterns.single_quote.read(),M=this._create_token(x.VALUE,q)}else Y=this.__patterns.attribute.read(),Y&&(B.type===x.EQUALS?M=this._create_token(x.VALUE,Y):M=this._create_token(x.ATTRIBUTE,Y));return M},O.prototype._is_content_unformatted=function(U){return this._options.void_elements.indexOf(U)===-1&&(this._options.content_unformatted.indexOf(U)!==-1||this._options.unformatted.indexOf(U)!==-1)},O.prototype._read_raw_content=function(U,B,$){var M="";if($&&$.text[0]==="{")M=this.__patterns.handlebars_raw_close.read();else if(B.type===x.TAG_CLOSE&&B.opened.text[0]==="<"&&B.text[0]!=="/"){var Y=B.opened.text.substr(1).toLowerCase();this._is_content_unformatted(Y)&&(M=this._input.readUntil(new RegExp("</"+Y+"[\\n\\r\\t ]*?>","ig")))}return M?this._create_token(x.TEXT,M):null},O.prototype._read_script_and_style=function(U,B){if(B.type===x.TAG_CLOSE&&B.opened.text[0]==="<"&&B.text[0]!=="/"){var $=B.opened.text.substr(1).toLowerCase();if($==="script"||$==="style"){var M=this._read_comment_or_cdata(U);if(M)return M.type=x.TEXT,M;var Y=this._input.readUntil(new RegExp("</"+$+"[\\n\\r\\t ]*?>","ig"));if(Y)return this._create_token(x.TEXT,Y)}}return null},O.prototype._read_content_word=function(U,B){var $="";return this._options.unformatted_content_delimiter&&U===this._options.unformatted_content_delimiter[0]&&($=this.__patterns.unformatted_content_delimiter.read()),$||($=B&&B.type===x.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),$?this._create_token(x.TEXT,$):null},f.exports.Tokenizer=O,f.exports.TOKEN=x}],v={};function s(f){var c=v[f];if(c!==void 0)return c.exports;var l=v[f]={exports:{}};return F[f](l,l.exports,s),l.exports}var y=s(18);G=y})();var D=G;if(1)I=[b,b(58553),b(87804)],P=function(F){var v=b(58553),s=b(87804);return{html_beautify:function(y,f){return D(y,f,v.js_beautify,s.css_beautify)}}}.apply(me,I),P!==void 0&&(yt.exports=P);else var w,_})()},58553:function(yt,me){var b,I;(function(){var P;(function(){"use strict";var D=[function(v,s,y){var f=y(1).Beautifier,c=y(5).Options;function l(h,d){var E=new f(h,d);return E.beautify()}v.exports=l,v.exports.defaultOptions=function(){return new c}},function(v,s,y){var f=y(2).Output,c=y(3).Token,l=y(4),h=y(5).Options,d=y(7).Tokenizer,E=y(7).line_starters,T=y(7).positionable_operators,L=y(7).TOKEN;function x(C,V){return V.indexOf(C)!==-1}function A(C){return C.replace(/^\s+/g,"")}function O(C){for(var V={},ne=0;ne<C.length;ne++)V[C[ne].replace(/-/g,"_")]=C[ne];return V}function U(C,V){return C&&C.type===L.RESERVED&&C.text===V}function B(C,V){return C&&C.type===L.RESERVED&&x(C.text,V)}var $=["case","return","do","if","throw","else","await","break","continue","async"],M=["before-newline","after-newline","preserve-newline"],Y=O(M),q=[Y.before_newline,Y.preserve_newline],se={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function ce(C,V){V.multiline_frame||V.mode===se.ForInitializer||V.mode===se.Conditional||C.remove_indent(V.start_line_index)}function J(C){C=C.replace(l.allLineBreaks,`
|
|
|
`);for(var V=[],ne=C.indexOf(`
|
|
|
`);ne!==-1;)V.push(C.substring(0,ne)),C=C.substring(ne+1),ne=C.indexOf(`
|
|
|
`);return C.length&&V.push(C),V}function z(C){return C===se.ArrayLiteral}function Z(C){return x(C,[se.Expression,se.ForInitializer,se.Conditional])}function N(C,V){for(var ne=0;ne<C.length;ne++){var pe=C[ne].trim();if(pe.charAt(0)!==V)return!1}return!0}function W(C,V){for(var ne=0,pe=C.length,Te;ne<pe;ne++)if(Te=C[ne],Te&&Te.indexOf(V)!==0)return!1;return!0}function K(C,V){V=V||{},this._source_text=C||"",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 h(V)}K.prototype.create_flags=function(C,V){var ne=0;C&&(ne=C.indentation_level,!this._output.just_added_newline()&&C.line_indent_level>ne&&(ne=C.line_indent_level));var pe={mode:V,parent:C,last_token:C?C.last_token:new c(L.START_BLOCK,""),last_word:C?C.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:ne,alignment:0,line_indent_level:C?C.line_indent_level:ne,start_line_index:this._output.get_line_number(),ternary_depth:0};return pe},K.prototype._reset=function(C){var V=C.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new f(this._options,V),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(se.BlockStatement);var ne=new d(C,this._options);return this._tokens=ne.tokenize(),C},K.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var C,V=this._reset(this._source_text),ne=this._options.eol;this._options.eol==="auto"&&(ne=`
|
|
|
`,V&&l.lineBreak.test(V||"")&&(ne=V.match(l.lineBreak)[0]));for(var pe=this._tokens.next();pe;)this.handle_token(pe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=pe,pe=this._tokens.next();return C=this._output.get_code(ne),C},K.prototype.handle_token=function(C,V){C.type===L.START_EXPR?this.handle_start_expr(C):C.type===L.END_EXPR?this.handle_end_expr(C):C.type===L.START_BLOCK?this.handle_start_block(C):C.type===L.END_BLOCK?this.handle_end_block(C):C.type===L.WORD?this.handle_word(C):C.type===L.RESERVED?this.handle_word(C):C.type===L.SEMICOLON?this.handle_semicolon(C):C.type===L.STRING?this.handle_string(C):C.type===L.EQUALS?this.handle_equals(C):C.type===L.OPERATOR?this.handle_operator(C):C.type===L.COMMA?this.handle_comma(C):C.type===L.BLOCK_COMMENT?this.handle_block_comment(C,V):C.type===L.COMMENT?this.handle_comment(C,V):C.type===L.DOT?this.handle_dot(C):C.type===L.EOF?this.handle_eof(C):C.type===L.UNKNOWN?this.handle_unknown(C,V):this.handle_unknown(C,V)},K.prototype.handle_whitespace_and_comments=function(C,V){var ne=C.newlines,pe=this._options.keep_array_indentation&&z(this._flags.mode);if(C.comments_before)for(var Te=C.comments_before.next();Te;)this.handle_whitespace_and_comments(Te,V),this.handle_token(Te,V),Te=C.comments_before.next();if(pe)for(var Ke=0;Ke<ne;Ke+=1)this.print_newline(Ke>0,V);else if(this._options.max_preserve_newlines&&ne>this._options.max_preserve_newlines&&(ne=this._options.max_preserve_newlines),this._options.preserve_newlines&&ne>1){this.print_newline(!1,V);for(var ve=1;ve<ne;ve+=1)this.print_newline(!0,V)}};var k=["async","break","continue","return","throw","yield"];K.prototype.allow_wrap_or_preserved_newline=function(C,V){if(V=V===void 0?!1:V,!this._output.just_added_newline()){var ne=this._options.preserve_newlines&&C.newlines||V,pe=x(this._flags.last_token.text,T)||x(C.text,T);if(pe){var Te=x(this._flags.last_token.text,T)&&x(this._options.operator_position,q)||x(C.text,T);ne=ne&&Te}if(ne)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(B(this._flags.last_token,k))return;this._output.set_wrap_point()}}},K.prototype.print_newline=function(C,V){if(!V&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==L.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var ne=this._tokens.peek();this._flags.mode===se.Statement&&!(this._flags.if_block&&U(ne,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(C)&&(this._flags.multiline_frame=!0)},K.prototype.print_token_line_indentation=function(C){this._output.just_added_newline()&&(this._options.keep_array_indentation&&C.newlines&&(C.text==="["||z(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(C.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},K.prototype.print_token=function(C){if(this._output.raw){this._output.add_raw_token(C);return}if(this._options.comma_first&&C.previous&&C.previous.type===L.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var V=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(V),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(C),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(C),this._output.non_breaking_space=!0,this._output.add_token(C.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},K.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},K.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},K.prototype.set_mode=function(C){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,C),this._flags=this.create_flags(this._previous_flags,C),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},K.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===se.Statement&&ce(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},K.prototype.start_of_object_property=function(){return this._flags.parent.mode===se.ObjectLiteral&&this._flags.mode===se.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||B(this._flags.last_token,["get","set"]))},K.prototype.start_of_statement=function(C){var V=!1;return V=V||B(this._flags.last_token,["var","let","const"])&&C.type===L.WORD,V=V||U(this._flags.last_token,"do"),V=V||!(this._flags.parent.mode===se.ObjectLiteral&&this._flags.mode===se.Statement)&&B(this._flags.last_token,k)&&!C.newlines,V=V||U(this._flags.last_token,"else")&&!(U(C,"if")&&!C.comments_before),V=V||this._flags.last_token.type===L.END_EXPR&&(this._previous_flags.mode===se.ForInitializer||this._previous_flags.mode===se.Conditional),V=V||this._flags.last_token.type===L.WORD&&this._flags.mode===se.BlockStatement&&!this._flags.in_case&&!(C.text==="--"||C.text==="++")&&this._last_last_text!=="function"&&C.type!==L.WORD&&C.type!==L.RESERVED,V=V||this._flags.mode===se.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||B(this._flags.last_token,["get","set"])),V?(this.set_mode(se.Statement),this.indent(),this.handle_whitespace_and_comments(C,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C,B(C,["do","for","if","while"])),!0):!1},K.prototype.handle_start_expr=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C);var V=se.Expression;if(C.text==="["){if(this._flags.last_token.type===L.WORD||this._flags.last_token.text===")"){B(this._flags.last_token,E)&&(this._output.space_before_token=!0),this.print_token(C),this.set_mode(V),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}V=se.ArrayLiteral,z(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()),x(this._flags.last_token.type,[L.START_EXPR,L.END_EXPR,L.WORD,L.OPERATOR,L.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===L.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,V=se.ForInitializer):x(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,V=se.Conditional):x(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&C.whitespace_before===""?this._output.space_before_token=!1:(x(this._flags.last_token.text,E)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===L.EQUALS||this._flags.last_token.type===L.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C);else if(this._flags.last_token.type===L.WORD){this._output.space_before_token=!1;var ne=this._tokens.peek(-3);if(this._options.space_after_named_function&&ne){var pe=this._tokens.peek(-4);B(ne,["async","function"])||ne.text==="*"&&B(pe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===se.ObjectLiteral?(ne.text==="{"||ne.text===","||ne.text==="*"&&(pe.text==="{"||pe.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(C);(this._flags.last_token.type===L.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(x(this._last_last_text,["function","yield"])||this._flags.mode===se.ObjectLiteral&&x(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===L.START_BLOCK?this.print_newline():(this._flags.last_token.type===L.END_EXPR||this._flags.last_token.type===L.START_EXPR||this._flags.last_token.type===L.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===L.COMMA)&&this.allow_wrap_or_preserved_newline(C,C.newlines),this.print_token(C),this.set_mode(V),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},K.prototype.handle_end_expr=function(C){for(;this._flags.mode===se.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(C,C.text==="]"&&z(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===L.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(C),this.restore_mode(),ce(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===se.Conditional&&(this._previous_flags.mode=se.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},K.prototype.handle_start_block=function(C){this.handle_whitespace_and_comments(C);var V=this._tokens.peek(),ne=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===L.END_EXPR?(this.set_mode(se.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(se.BlockStatement):ne&&(x(ne.text,[":",","])&&x(V.type,[L.STRING,L.WORD,L.RESERVED])||x(V.text,["get","set","..."])&&x(ne.type,[L.WORD,L.RESERVED]))?x(this._last_last_text,["class","interface"])&&!x(ne.text,[":",","])?this.set_mode(se.BlockStatement):this.set_mode(se.ObjectLiteral):this._flags.last_token.type===L.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(se.BlockStatement):x(this._flags.last_token.type,[L.EQUALS,L.START_EXPR,L.COMMA,L.OPERATOR])||B(this._flags.last_token,["return","throw","import","default"])?this.set_mode(se.ObjectLiteral):this.set_mode(se.BlockStatement),this._flags.last_token&&B(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var pe=!V.comments_before&&V.text==="}",Te=pe&&this._flags.last_word==="function"&&this._flags.last_token.type===L.END_EXPR;if(this._options.brace_preserve_inline){var Ke=0,ve=null;this._flags.inline_frame=!0;do if(Ke+=1,ve=this._tokens.peek(Ke-1),ve.newlines){this._flags.inline_frame=!1;break}while(ve.type!==L.EOF&&!(ve.type===L.END_BLOCK&&ve.opened===C))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&C.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==L.OPERATOR&&(Te||this._flags.last_token.type===L.EQUALS||B(this._flags.last_token,$)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(z(this._previous_flags.mode)&&(this._flags.last_token.type===L.START_EXPR||this._flags.last_token.type===L.COMMA)&&((this._flags.last_token.type===L.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(C),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==L.OPERATOR&&this._flags.last_token.type!==L.START_EXPR&&(x(this._flags.last_token.type,[L.START_BLOCK,L.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(C),this.indent(),!pe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},K.prototype.handle_end_block=function(C){for(this.handle_whitespace_and_comments(C);this._flags.mode===se.Statement;)this.restore_mode();var V=this._flags.last_token.type===L.START_BLOCK;this._flags.inline_frame&&!V?this._output.space_before_token=!0:this._options.brace_style==="expand"?V||this.print_newline():V||(z(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(C)},K.prototype.handle_word=function(C){if(C.type===L.RESERVED){if(x(C.text,["set","get"])&&this._flags.mode!==se.ObjectLiteral)C.type=L.WORD;else if(C.text==="import"&&x(this._tokens.peek().text,["(","."]))C.type=L.WORD;else if(x(C.text,["as","from"])&&!this._flags.import_block)C.type=L.WORD;else if(this._flags.mode===se.ObjectLiteral){var V=this._tokens.peek();V.text===":"&&(C.type=L.WORD)}}if(this.start_of_statement(C)?B(this._flags.last_token,["var","let","const"])&&C.type===L.WORD&&(this._flags.declaration_statement=!0):C.newlines&&!Z(this._flags.mode)&&(this._flags.last_token.type!==L.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==L.EQUALS&&(this._options.preserve_newlines||!B(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(C),this.print_newline()):this.handle_whitespace_and_comments(C),this._flags.do_block&&!this._flags.do_while)if(U(C,"while")){this._output.space_before_token=!0,this.print_token(C),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&&U(C,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===se.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&B(C,["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(C),this._flags.in_case=!0;return}if((this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR||this._flags.last_token.type===L.EQUALS||this._flags.last_token.type===L.OPERATOR)&&!this.start_of_object_property()&&!(x(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===se.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(C),U(C,"function")){(x(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(x(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===L.OPERATOR))&&!this._output.just_added_blankline()&&!C.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===L.RESERVED||this._flags.last_token.type===L.WORD?B(this._flags.last_token,["get","set","new","export"])||B(this._flags.last_token,k)?this._output.space_before_token=!0:U(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===L.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(Z(this._flags.mode)||z(this._flags.mode))||this.print_newline(),this.print_token(C),this._flags.last_word=C.text;return}var ne="NONE";if(this._flags.last_token.type===L.END_BLOCK?this._previous_flags.inline_frame?ne="SPACE":B(C,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&C.newlines?ne="NEWLINE":(ne="SPACE",this._output.space_before_token=!0):ne="NEWLINE":this._flags.last_token.type===L.SEMICOLON&&this._flags.mode===se.BlockStatement?ne="NEWLINE":this._flags.last_token.type===L.SEMICOLON&&Z(this._flags.mode)?ne="SPACE":this._flags.last_token.type===L.STRING?ne="NEWLINE":this._flags.last_token.type===L.RESERVED||this._flags.last_token.type===L.WORD||this._flags.last_token.text==="*"&&(x(this._last_last_text,["function","yield"])||this._flags.mode===se.ObjectLiteral&&x(this._last_last_text,["{",","]))?ne="SPACE":this._flags.last_token.type===L.START_BLOCK?this._flags.inline_frame?ne="SPACE":ne="NEWLINE":this._flags.last_token.type===L.END_EXPR&&(this._output.space_before_token=!0,ne="NEWLINE"),B(C,E)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?ne="SPACE":ne="NEWLINE"),B(C,["else","catch","finally"]))if((!(this._flags.last_token.type===L.END_BLOCK&&this._previous_flags.mode===se.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&C.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var pe=this._output.current_line;pe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ne==="NEWLINE"?B(this._flags.last_token,$)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&B(C,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==L.END_EXPR?(this._flags.last_token.type!==L.START_EXPR||!B(C,["var","let","const"]))&&this._flags.last_token.text!==":"&&(U(C,"if")&&U(C.previous,"else")?this._output.space_before_token=!0:this.print_newline()):B(C,E)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&z(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():ne==="SPACE"&&(this._output.space_before_token=!0);C.previous&&(C.previous.type===L.WORD||C.previous.type===L.RESERVED)&&(this._output.space_before_token=!0),this.print_token(C),this._flags.last_word=C.text,C.type===L.RESERVED&&(C.text==="do"?this._flags.do_block=!0:C.text==="if"?this._flags.if_block=!0:C.text==="import"?this._flags.import_block=!0:this._flags.import_block&&U(C,"from")&&(this._flags.import_block=!1))},K.prototype.handle_semicolon=function(C){this.start_of_statement(C)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(C);for(var V=this._tokens.peek();this._flags.mode===se.Statement&&!(this._flags.if_block&&U(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(C)},K.prototype.handle_string=function(C){C.text.startsWith("`")&&C.newlines===0&&C.whitespace_before===""&&(C.previous.text===")"||this._flags.last_token.type===L.WORD)||(this.start_of_statement(C)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(C),this._flags.last_token.type===L.RESERVED||this._flags.last_token.type===L.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR||this._flags.last_token.type===L.EQUALS||this._flags.last_token.type===L.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C):C.text.startsWith("`")&&this._flags.last_token.type===L.END_EXPR&&(C.previous.text==="]"||C.previous.text===")")&&C.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(C)},K.prototype.handle_equals=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0},K.prototype.handle_comma=function(C){this.handle_whitespace_and_comments(C,!0),this.print_token(C),this._output.space_before_token=!0,this._flags.declaration_statement?(Z(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(C)):this._flags.mode===se.ObjectLiteral||this._flags.mode===se.Statement&&this._flags.parent.mode===se.ObjectLiteral?(this._flags.mode===se.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(C)},K.prototype.handle_operator=function(C){var V=C.text==="*"&&(B(this._flags.last_token,["function","yield"])||x(this._flags.last_token.type,[L.START_BLOCK,L.COMMA,L.END_BLOCK,L.SEMICOLON])),ne=x(C.text,["-","+"])&&(x(this._flags.last_token.type,[L.START_BLOCK,L.START_EXPR,L.EQUALS,L.OPERATOR])||x(this._flags.last_token.text,E)||this._flags.last_token.text===",");if(!this.start_of_statement(C)){var pe=!V;this.handle_whitespace_and_comments(C,pe)}if(C.text==="*"&&this._flags.last_token.type===L.DOT){this.print_token(C);return}if(C.text==="::"){this.print_token(C);return}if(x(C.text,["-","+"])&&this.start_of_object_property()){this.print_token(C);return}if(this._flags.last_token.type===L.OPERATOR&&x(this._options.operator_position,q)&&this.allow_wrap_or_preserved_newline(C),C.text===":"&&this._flags.in_case){this.print_token(C),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==L.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 Te=!0,Ke=!0,ve=!1;if(C.text===":"?this._flags.ternary_depth===0?Te=!1:(this._flags.ternary_depth-=1,ve=!0):C.text==="?"&&(this._flags.ternary_depth+=1),!ne&&!V&&this._options.preserve_newlines&&x(C.text,T)){var Ue=C.text===":",Be=Ue&&ve,Me=Ue&&!ve;switch(this._options.operator_position){case Y.before_newline:this._output.space_before_token=!Me,this.print_token(C),(!Ue||Be)&&this.allow_wrap_or_preserved_newline(C),this._output.space_before_token=!0;return;case Y.after_newline:this._output.space_before_token=!0,!Ue||Be?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(C):this._output.space_before_token=!1,this.print_token(C),this._output.space_before_token=!0;return;case Y.preserve_newline:Me||this.allow_wrap_or_preserved_newline(C),Te=!(this._output.just_added_newline()||Me),this._output.space_before_token=Te,this.print_token(C),this._output.space_before_token=!0;return}}if(V){this.allow_wrap_or_preserved_newline(C),Te=!1;var St=this._tokens.peek();Ke=St&&x(St.type,[L.WORD,L.RESERVED])}else if(C.text==="...")this.allow_wrap_or_preserved_newline(C),Te=this._flags.last_token.type===L.START_BLOCK,Ke=!1;else if(x(C.text,["--","++","!","~"])||ne){if((this._flags.last_token.type===L.COMMA||this._flags.last_token.type===L.START_EXPR)&&this.allow_wrap_or_preserved_newline(C),Te=!1,Ke=!1,C.newlines&&(C.text==="--"||C.text==="++"||C.text==="~")){var He=B(this._flags.last_token,$)&&C.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===";"&&Z(this._flags.mode)&&(Te=!0),this._flags.last_token.type===L.RESERVED?Te=!0:this._flags.last_token.type===L.END_EXPR?Te=!(this._flags.last_token.text==="]"&&(C.text==="--"||C.text==="++")):this._flags.last_token.type===L.OPERATOR&&(Te=x(C.text,["--","-","++","+"])&&x(this._flags.last_token.text,["--","-","++","+"]),x(C.text,["+","-"])&&x(this._flags.last_token.text,["--","++"])&&(Ke=!0)),(this._flags.mode===se.BlockStatement&&!this._flags.inline_frame||this._flags.mode===se.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Te,this.print_token(C),this._output.space_before_token=Ke},K.prototype.handle_block_comment=function(C,V){if(this._output.raw){this._output.add_raw_token(C),C.directives&&C.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(C.directives){this.print_newline(!1,V),this.print_token(C),C.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!l.newline.test(C.text)&&!C.newlines){this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0;return}else this.print_block_commment(C,V)},K.prototype.print_block_commment=function(C,V){var ne=J(C.text),pe,Te=!1,Ke=!1,ve=C.whitespace_before,Ue=ve.length;if(this.print_newline(!1,V),this.print_token_line_indentation(C),this._output.add_token(ne[0]),this.print_newline(!1,V),ne.length>1){for(ne=ne.slice(1),Te=N(ne,"*"),Ke=W(ne,ve),Te&&(this._flags.alignment=1),pe=0;pe<ne.length;pe++)Te?(this.print_token_line_indentation(C),this._output.add_token(A(ne[pe]))):Ke&&ne[pe]?(this.print_token_line_indentation(C),this._output.add_token(ne[pe].substring(Ue))):(this._output.current_line.set_indent(-1),this._output.add_token(ne[pe])),this.print_newline(!1,V);this._flags.alignment=0}},K.prototype.handle_comment=function(C,V){C.newlines?this.print_newline(!1,V):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(C),this.print_newline(!1,V)},K.prototype.handle_dot=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),B(this._flags.last_token,$)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(C,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(C)},K.prototype.handle_unknown=function(C,V){this.print_token(C),C.text[C.text.length-1]===`
|
|
|
`&&this.print_newline(!1,V)},K.prototype.handle_eof=function(C){for(;this._flags.mode===se.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C)},v.exports.Beautifier=K},function(v){function s(c){this.__parent=c,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=[]}s.prototype.clone_empty=function(){var c=new s(this.__parent);return c.set_indent(this.__indent_count,this.__alignment_count),c},s.prototype.item=function(c){return c<0?this.__items[this.__items.length+c]:this.__items[c]},s.prototype.has_match=function(c){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(c))return!0;return!1},s.prototype.set_indent=function(c,l){this.is_empty()&&(this.__indent_count=c||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},s.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)},s.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},s.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var c=this.__parent.current_line;return c.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),c.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),c.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,c.__items[0]===" "&&(c.__items.splice(0,1),c.__character_count-=1),!0}return!1},s.prototype.is_empty=function(){return this.__items.length===0},s.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},s.prototype.push=function(c){this.__items.push(c);var l=c.lastIndexOf(`
|
|
|
`);l!==-1?this.__character_count=c.length-l:this.__character_count+=c.length},s.prototype.pop=function(){var c=null;return this.is_empty()||(c=this.__items.pop(),this.__character_count-=c.length),c},s.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},s.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},s.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},s.prototype.toString=function(){var c="";return this.is_empty()?this.__parent.indent_empty_lines&&(c=this.__parent.get_indent_string(this.__indent_count)):(c=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),c+=this.__items.join("")),c};function y(c,l){this.__cache=[""],this.__indent_size=c.indent_size,this.__indent_string=c.indent_char,c.indent_with_tabs||(this.__indent_string=new Array(c.indent_size+1).join(c.indent_char)),l=l||"",c.indent_level>0&&(l=new Array(c.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}y.prototype.get_indent_size=function(c,l){var h=this.__base_string_length;return l=l||0,c<0&&(h=0),h+=c*this.__indent_size,h+=l,h},y.prototype.get_indent_string=function(c,l){var h=this.__base_string;return l=l||0,c<0&&(c=0,h=""),l+=c*this.__indent_size,this.__ensure_cache(l),h+=this.__cache[l],h},y.prototype.__ensure_cache=function(c){for(;c>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var c=this.__cache.length,l=0,h="";this.__indent_size&&c>=this.__indent_size&&(l=Math.floor(c/this.__indent_size),c-=l*this.__indent_size,h=new Array(l+1).join(this.__indent_string)),c&&(h+=new Array(c+1).join(" ")),this.__cache.push(h)};function f(c,l){this.__indent_cache=new y(c,l),this.raw=!1,this._end_with_newline=c.end_with_newline,this.indent_size=c.indent_size,this.wrap_line_length=c.wrap_line_length,this.indent_empty_lines=c.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new s(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}f.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},f.prototype.get_line_number=function(){return this.__lines.length},f.prototype.get_indent_string=function(c,l){return this.__indent_cache.get_indent_string(c,l)},f.prototype.get_indent_size=function(c,l){return this.__indent_cache.get_indent_size(c,l)},f.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},f.prototype.add_new_line=function(c){return this.is_empty()||!c&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},f.prototype.get_code=function(c){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var h=this.__lines.join(`
|
|
|
`);return c!==`
|
|
|
`&&(h=h.replace(/[\n]/g,c)),h},f.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},f.prototype.set_indent=function(c,l){return c=c||0,l=l||0,this.next_line.set_indent(c,l),this.__lines.length>1?(this.current_line.set_indent(c,l),!0):(this.current_line.set_indent(),!1)},f.prototype.add_raw_token=function(c){for(var l=0;l<c.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(c.whitespace_before),this.current_line.push(c.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},f.prototype.add_token=function(c){this.__add_space_before_token(),this.current_line.push(c),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},f.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(" "))},f.prototype.remove_indent=function(c){for(var l=this.__lines.length;c<l;)this.__lines[c]._remove_indent(),c++;this.current_line._remove_wrap_indent()},f.prototype.trim=function(c){for(c=c===void 0?!1:c,this.current_line.trim();c&&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},f.prototype.just_added_newline=function(){return this.current_line.is_empty()},f.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},f.prototype.ensure_empty_line_above=function(c,l){for(var h=this.__lines.length-2;h>=0;){var d=this.__lines[h];if(d.is_empty())break;if(d.item(0).indexOf(c)!==0&&d.item(-1)!==l){this.__lines.splice(h+1,0,new s(this)),this.previous_line=this.__lines[this.__lines.length-2];break}h--}},v.exports.Output=f},function(v){function s(y,f,c,l){this.type=y,this.text=f,this.comments_before=null,this.newlines=c||0,this.whitespace_before=l||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}v.exports.Token=s},function(v,s){var y="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",c="\\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",l="\\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",h="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",d="(?:"+h+"|["+y+c+"])",E="(?:"+h+"|["+f+c+l+"])*";s.identifier=new RegExp(d+E,"g"),s.identifierStart=new RegExp(d),s.identifierMatch=new RegExp("(?:"+h+"|["+f+c+l+"])+");var T=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;s.newline=/[\n\r\u2028\u2029]/,s.lineBreak=new RegExp(`\r
|
|
|
|`+s.newline.source),s.allLineBreaks=new RegExp(s.lineBreak.source,"g")},function(v,s,y){var f=y(6).Options,c=["before-newline","after-newline","preserve-newline"];function l(h){f.call(this,h,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="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 E=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var T=0;T<E.length;T++)E[T]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=E[T];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",c),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}l.prototype=new f,v.exports.Options=l},function(v){function s(c,l){this.raw_options=y(c,l),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"])}s.prototype._get_array=function(c,l){var h=this.raw_options[c],d=l||[];return typeof h=="object"?h!==null&&typeof h.concat=="function"&&(d=h.concat()):typeof h=="string"&&(d=h.split(/[^a-zA-Z0-9_\/\-]+/)),d},s.prototype._get_boolean=function(c,l){var h=this.raw_options[c],d=h===void 0?!!l:!!h;return d},s.prototype._get_characters=function(c,l){var h=this.raw_options[c],d=l||"";return typeof h=="string"&&(d=h.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),d},s.prototype._get_number=function(c,l){var h=this.raw_options[c];l=parseInt(l,10),isNaN(l)&&(l=0);var d=parseInt(h,10);return isNaN(d)&&(d=l),d},s.prototype._get_selection=function(c,l,h){var d=this._get_selection_list(c,l,h);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+c+`' can only be one of the following values:
|
|
|
`+l+`
|
|
|
You passed in: '`+this.raw_options[c]+"'");return d[0]},s.prototype._get_selection_list=function(c,l,h){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(h=h||[l[0]],!this._is_valid_selection(h,l))throw new Error("Invalid Default Value!");var d=this._get_array(c,h);if(!this._is_valid_selection(d,l))throw new Error("Invalid Option Value: The option '"+c+`' can contain only the following values:
|
|
|
`+l+`
|
|
|
You passed in: '`+this.raw_options[c]+"'");return d},s.prototype._is_valid_selection=function(c,l){return c.length&&l.length&&!c.some(function(h){return l.indexOf(h)===-1})};function y(c,l){var h={};c=f(c);var d;for(d in c)d!==l&&(h[d]=c[d]);if(l&&c[l])for(d in c[l])h[d]=c[l][d];return h}function f(c){var l={},h;for(h in c){var d=h.replace(/-/g,"_");l[d]=c[h]}return l}v.exports.Options=s,v.exports.normalizeOpts=f,v.exports.mergeOpts=y},function(v,s,y){var f=y(8).InputScanner,c=y(9).Tokenizer,l=y(9).TOKEN,h=y(13).Directives,d=y(4),E=y(12).Pattern,T=y(14).TemplatablePattern;function L(N,W){return W.indexOf(N)!==-1}var x={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:l.START,RAW:l.RAW,EOF:l.EOF},A=new h(/\/\*/,/\*\//),O=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,U=/[0-9]/,B=/[^\d\.]/,$=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),M=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";M=M.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),M="\\?\\.(?!\\d) "+M,M=M.replace(/ /g,"|");var Y=new RegExp(M),q="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),se=q.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),ce=new RegExp("^(?:"+se.join("|")+")$"),J,z=function(N,W){c.call(this,N,W),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var K=new E(this._input),k=new T(this._input).read_options(this._options);this.__patterns={template:k,identifier:k.starting_with(d.identifier).matching(d.identifierMatch),number:K.matching(O),punct:K.matching(Y),comment:K.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:K.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:K.matching(/<!--/),html_comment_end:K.matching(/-->/),include:K.starting_with(/#include/).until_after(d.lineBreak),shebang:K.starting_with(/#!/).until_after(d.lineBreak),xml:K.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:k.until(/['\\\n\r\u2028\u2029]/),double_quote:k.until(/["\\\n\r\u2028\u2029]/),template_text:k.until(/[`\\$]/),template_expression:k.until(/[`}\\]/)}};z.prototype=new c,z.prototype._is_comment=function(N){return N.type===x.COMMENT||N.type===x.BLOCK_COMMENT||N.type===x.UNKNOWN},z.prototype._is_opening=function(N){return N.type===x.START_BLOCK||N.type===x.START_EXPR},z.prototype._is_closing=function(N,W){return(N.type===x.END_BLOCK||N.type===x.END_EXPR)&&W&&(N.text==="]"&&W.text==="["||N.text===")"&&W.text==="("||N.text==="}"&&W.text==="{")},z.prototype._reset=function(){J=!1},z.prototype._get_next_token=function(N,W){var K=null;this._readWhitespace();var k=this._input.peek();return k===null?this._create_token(x.EOF,""):(K=K||this._read_non_javascript(k),K=K||this._read_string(k),K=K||this._read_pair(k,this._input.peek(1)),K=K||this._read_word(N),K=K||this._read_singles(k),K=K||this._read_comment(k),K=K||this._read_regexp(k,N),K=K||this._read_xml(k,N),K=K||this._read_punctuation(),K=K||this._create_token(x.UNKNOWN,this._input.next()),K)},z.prototype._read_word=function(N){var W;if(W=this.__patterns.identifier.read(),W!=="")return W=W.replace(d.allLineBreaks,`
|
|
|
`),!(N.type===x.DOT||N.type===x.RESERVED&&(N.text==="set"||N.text==="get"))&&ce.test(W)?(W==="in"||W==="of")&&(N.type===x.WORD||N.type===x.STRING)?this._create_token(x.OPERATOR,W):this._create_token(x.RESERVED,W):this._create_token(x.WORD,W);if(W=this.__patterns.number.read(),W!=="")return this._create_token(x.WORD,W)},z.prototype._read_singles=function(N){var W=null;return N==="("||N==="["?W=this._create_token(x.START_EXPR,N):N===")"||N==="]"?W=this._create_token(x.END_EXPR,N):N==="{"?W=this._create_token(x.START_BLOCK,N):N==="}"?W=this._create_token(x.END_BLOCK,N):N===";"?W=this._create_token(x.SEMICOLON,N):N==="."&&B.test(this._input.peek(1))?W=this._create_token(x.DOT,N):N===","&&(W=this._create_token(x.COMMA,N)),W&&this._input.next(),W},z.prototype._read_pair=function(N,W){var K=null;return N==="#"&&W==="{"&&(K=this._create_token(x.START_BLOCK,N+W)),K&&(this._input.next(),this._input.next()),K},z.prototype._read_punctuation=function(){var N=this.__patterns.punct.read();if(N!=="")return N==="="?this._create_token(x.EQUALS,N):N==="?."?this._create_token(x.DOT,N):this._create_token(x.OPERATOR,N)},z.prototype._read_non_javascript=function(N){var W="";if(N==="#"){if(this._is_first_token()&&(W=this.__patterns.shebang.read(),W))return this._create_token(x.UNKNOWN,W.trim()+`
|
|
|
`);if(W=this.__patterns.include.read(),W)return this._create_token(x.UNKNOWN,W.trim()+`
|
|
|
`);N=this._input.next();var K="#";if(this._input.hasNext()&&this._input.testChar(U)){do N=this._input.next(),K+=N;while(this._input.hasNext()&&N!=="#"&&N!=="=");return N==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(K+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(K+="{}",this._input.next(),this._input.next())),this._create_token(x.WORD,K)}this._input.back()}else if(N==="<"&&this._is_first_token()){if(W=this.__patterns.html_comment_start.read(),W){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)W+=this._input.next();return J=!0,this._create_token(x.COMMENT,W)}}else if(J&&N==="-"&&(W=this.__patterns.html_comment_end.read(),W))return J=!1,this._create_token(x.COMMENT,W);return null},z.prototype._read_comment=function(N){var W=null;if(N==="/"){var K="";if(this._input.peek(1)==="*"){K=this.__patterns.block_comment.read();var k=A.get_directives(K);k&&k.ignore==="start"&&(K+=A.readIgnored(this._input)),K=K.replace(d.allLineBreaks,`
|
|
|
`),W=this._create_token(x.BLOCK_COMMENT,K),W.directives=k}else this._input.peek(1)==="/"&&(K=this.__patterns.comment.read(),W=this._create_token(x.COMMENT,K))}return W},z.prototype._read_string=function(N){if(N==="`"||N==="'"||N==='"'){var W=this._input.next();return this.has_char_escapes=!1,N==="`"?W+=this._read_string_recursive("`",!0,"${"):W+=this._read_string_recursive(N),this.has_char_escapes&&this._options.unescape_strings&&(W=Z(W)),this._input.peek()===N&&(W+=this._input.next()),W=W.replace(d.allLineBreaks,`
|
|
|
`),this._create_token(x.STRING,W)}return null},z.prototype._allow_regexp_or_xml=function(N){return N.type===x.RESERVED&&L(N.text,["return","case","throw","else","do","typeof","yield"])||N.type===x.END_EXPR&&N.text===")"&&N.opened.previous.type===x.RESERVED&&L(N.opened.previous.text,["if","while","for"])||L(N.type,[x.COMMENT,x.START_EXPR,x.START_BLOCK,x.START,x.END_BLOCK,x.OPERATOR,x.EQUALS,x.EOF,x.SEMICOLON,x.COMMA])},z.prototype._read_regexp=function(N,W){if(N==="/"&&this._allow_regexp_or_xml(W)){for(var K=this._input.next(),k=!1,C=!1;this._input.hasNext()&&(k||C||this._input.peek()!==N)&&!this._input.testChar(d.newline);)K+=this._input.peek(),k?k=!1:(k=this._input.peek()==="\\",this._input.peek()==="["?C=!0:this._input.peek()==="]"&&(C=!1)),this._input.next();return this._input.peek()===N&&(K+=this._input.next(),K+=this._input.read(d.identifier)),this._create_token(x.STRING,K)}return null},z.prototype._read_xml=function(N,W){if(this._options.e4x&&N==="<"&&this._allow_regexp_or_xml(W)){var K="",k=this.__patterns.xml.read_match();if(k){for(var C=k[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),V=C.indexOf("{")===0,ne=0;k;){var pe=!!k[1],Te=k[2],Ke=!!k[k.length-1]||Te.slice(0,8)==="![CDATA[";if(!Ke&&(Te===C||V&&Te.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(pe?--ne:++ne),K+=k[0],ne<=0)break;k=this.__patterns.xml.read_match()}return k||(K+=this._input.match(/[\s\S]*/g)[0]),K=K.replace(d.allLineBreaks,`
|
|
|
`),this._create_token(x.STRING,K)}}return null};function Z(N){for(var W="",K=0,k=new f(N),C=null;k.hasNext();)if(C=k.match(/([\s]|[^\\]|\\\\)+/g),C&&(W+=C[0]),k.peek()==="\\"){if(k.next(),k.peek()==="x")C=k.match(/x([0-9A-Fa-f]{2})/g);else if(k.peek()==="u")C=k.match(/u([0-9A-Fa-f]{4})/g),C||(C=k.match(/u\{([0-9A-Fa-f]+)\}/g));else{W+="\\",k.hasNext()&&(W+=k.next());continue}if(!C||(K=parseInt(C[1],16),K>126&&K<=255&&C[0].indexOf("x")===0))return N;K>=0&&K<32||K>1114111?W+="\\"+C[0]:K===34||K===39||K===92?W+="\\"+String.fromCharCode(K):W+=String.fromCharCode(K)}return W}z.prototype._read_string_recursive=function(N,W,K){var k,C;N==="'"?C=this.__patterns.single_quote:N==='"'?C=this.__patterns.double_quote:N==="`"?C=this.__patterns.template_text:N==="}"&&(C=this.__patterns.template_expression);for(var V=C.read(),ne="";this._input.hasNext();){if(ne=this._input.next(),ne===N||!W&&d.newline.test(ne)){this._input.back();break}else ne==="\\"&&this._input.hasNext()?(k=this._input.peek(),k==="x"||k==="u"?this.has_char_escapes=!0:k==="\r"&&this._input.peek(1)===`
|
|
|
`&&this._input.next(),ne+=this._input.next()):K&&(K==="${"&&ne==="$"&&this._input.peek()==="{"&&(ne+=this._input.next()),K===ne&&(N==="`"?ne+=this._read_string_recursive("}",W,"`"):ne+=this._read_string_recursive("`",W,"${"),this._input.hasNext()&&(ne+=this._input.next())));ne+=C.read(),V+=ne}return V},v.exports.Tokenizer=z,v.exports.TOKEN=x,v.exports.positionable_operators=$.slice(),v.exports.line_starters=q.slice()},function(v){var s=RegExp.prototype.hasOwnProperty("sticky");function y(f){this.__input=f||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__input.charAt(this.__position),this.__position+=1),f},y.prototype.peek=function(f){var c=null;return f=f||0,f+=this.__position,f>=0&&f<this.__input_length&&(c=this.__input.charAt(f)),c},y.prototype.__match=function(f,c){f.lastIndex=c;var l=f.exec(this.__input);return l&&!(s&&f.sticky)&&l.index!==c&&(l=null),l},y.prototype.test=function(f,c){return c=c||0,c+=this.__position,c>=0&&c<this.__input_length?!!this.__match(f,c):!1},y.prototype.testChar=function(f,c){var l=this.peek(c);return f.lastIndex=0,l!==null&&f.test(l)},y.prototype.match=function(f){var c=this.__match(f,this.__position);return c?this.__position+=c[0].length:c=null,c},y.prototype.read=function(f,c,l){var h="",d;return f&&(d=this.match(f),d&&(h+=d[0])),c&&(d||!f)&&(h+=this.readUntil(c,l)),h},y.prototype.readUntil=function(f,c){var l="",h=this.__position;f.lastIndex=this.__position;var d=f.exec(this.__input);return d?(h=d.index,c&&(h+=d[0].length)):h=this.__input_length,l=this.__input.substring(this.__position,h),this.__position=h,l},y.prototype.readUntilAfter=function(f){return this.readUntil(f,!0)},y.prototype.get_regexp=function(f,c){var l=null,h="g";return c&&s&&(h="y"),typeof f=="string"&&f!==""?l=new RegExp(f,h):f&&(l=new RegExp(f.source,h)),l},y.prototype.get_literal_regexp=function(f){return RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(f){var c=this.__position,l=this.readUntilAfter(f);return this.__position=c,l},y.prototype.lookBack=function(f){var c=this.__position-1;return c>=f.length&&this.__input.substring(c-f.length,c).toLowerCase()===f},v.exports.InputScanner=y},function(v,s,y){var f=y(8).InputScanner,c=y(3).Token,l=y(10).TokenStream,h=y(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},E=function(T,L){this._input=new f(T),this._options=L||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new h(this._input)};E.prototype.tokenize=function(){this._input.restart(),this.__tokens=new l,this._reset();for(var T,L=new c(d.START,""),x=null,A=[],O=new l;L.type!==d.EOF;){for(T=this._get_next_token(L,x);this._is_comment(T);)O.add(T),T=this._get_next_token(L,x);O.isEmpty()||(T.comments_before=O,O=new l),T.parent=x,this._is_opening(T)?(A.push(x),x=T):x&&this._is_closing(T,x)&&(T.opened=x,x.closed=T,x=A.pop(),T.parent=x),T.previous=L,L.next=T,this.__tokens.add(T),L=T}return this.__tokens},E.prototype._is_first_token=function(){return this.__tokens.isEmpty()},E.prototype._reset=function(){},E.prototype._get_next_token=function(T,L){this._readWhitespace();var x=this._input.read(/.+/g);return x?this._create_token(d.RAW,x):this._create_token(d.EOF,"")},E.prototype._is_comment=function(T){return!1},E.prototype._is_opening=function(T){return!1},E.prototype._is_closing=function(T,L){return!1},E.prototype._create_token=function(T,L){var x=new c(T,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return x},E.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},v.exports.Tokenizer=E,v.exports.TOKEN=d},function(v){function s(y){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=y}s.prototype.restart=function(){this.__position=0},s.prototype.isEmpty=function(){return this.__tokens_length===0},s.prototype.hasNext=function(){return this.__position<this.__tokens_length},s.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__tokens[this.__position],this.__position+=1),y},s.prototype.peek=function(y){var f=null;return y=y||0,y+=this.__position,y>=0&&y<this.__tokens_length&&(f=this.__tokens[y]),f},s.prototype.add=function(y){this.__parent_token&&(y.parent=this.__parent_token),this.__tokens.push(y),this.__tokens_length+=1},v.exports.TokenStream=s},function(v,s,y){var f=y(12).Pattern;function c(l,h){f.call(this,l,h),h?this._line_regexp=this._input.get_regexp(h._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}c.prototype=new f,c.prototype.__set_whitespace_patterns=function(l,h){l+="\\t ",h+="\\n\\r",this._match_pattern=this._input.get_regexp("["+l+h+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+h+"]")},c.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var l=this._input.read(this._match_pattern);if(l===" ")this.whitespace_before_token=" ";else if(l){var h=this.__split(this._newline_regexp,l);this.newline_count=h.length-1,this.whitespace_before_token=h[this.newline_count]}return l},c.prototype.matching=function(l,h){var d=this._create();return d.__set_whitespace_patterns(l,h),d._update(),d},c.prototype._create=function(){return new c(this._input,this)},c.prototype.__split=function(l,h){l.lastIndex=0;for(var d=0,E=[],T=l.exec(h);T;)E.push(h.substring(d,T.index)),d=T.index+T[0].length,T=l.exec(h);return d<h.length?E.push(h.substring(d,h.length)):E.push(""),E},v.exports.WhitespacePattern=c},function(v){function s(y,f){this._input=y,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,f&&(this._starting_pattern=this._input.get_regexp(f._starting_pattern,!0),this._match_pattern=this._input.get_regexp(f._match_pattern,!0),this._until_pattern=this._input.get_regexp(f._until_pattern),this._until_after=f._until_after)}s.prototype.read=function(){var y=this._input.read(this._starting_pattern);return(!this._starting_pattern||y)&&(y+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),y},s.prototype.read_match=function(){return this._input.match(this._match_pattern)},s.prototype.until_after=function(y){var f=this._create();return f._until_after=!0,f._until_pattern=this._input.get_regexp(y),f._update(),f},s.prototype.until=function(y){var f=this._create();return f._until_after=!1,f._until_pattern=this._input.get_regexp(y),f._update(),f},s.prototype.starting_with=function(y){var f=this._create();return f._starting_pattern=this._input.get_regexp(y,!0),f._update(),f},s.prototype.matching=function(y){var f=this._create();return f._match_pattern=this._input.get_regexp(y,!0),f._update(),f},s.prototype._create=function(){return new s(this._input,this)},s.prototype._update=function(){},v.exports.Pattern=s},function(v){function s(y,f){y=typeof y=="string"?y:y.source,f=typeof f=="string"?f:f.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+f,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+f,"g")}s.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var f={};this.__directive_pattern.lastIndex=0;for(var c=this.__directive_pattern.exec(y);c;)f[c[1]]=c[2],c=this.__directive_pattern.exec(y);return f},s.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},v.exports.Directives=s},function(v,s,y){var f=y(12).Pattern,c={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function l(h,d){f.call(this,h,d),this.__template_pattern=null,this._disabled=Object.assign({},c),this._excluded=Object.assign({},c),d&&(this.__template_pattern=this._input.get_regexp(d.__template_pattern),this._excluded=Object.assign(this._excluded,d._excluded),this._disabled=Object.assign(this._disabled,d._disabled));var E=new f(h);this.__patterns={handlebars_comment:E.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:E.starting_with(/{{{/).until_after(/}}}/),handlebars:E.starting_with(/{{/).until_after(/}}/),php:E.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:E.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:E.starting_with(/{%/).until_after(/%}/),django_value:E.starting_with(/{{/).until_after(/}}/),django_comment:E.starting_with(/{#/).until_after(/#}/),smarty:E.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:E.starting_with(/{\*/).until_after(/\*}/),smarty_literal:E.starting_with(/{literal}/).until_after(/{\/literal}/)}}l.prototype=new f,l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){this.__set_templated_pattern()},l.prototype.disable=function(h){var d=this._create();return d._disabled[h]=!0,d._update(),d},l.prototype.read_options=function(h){var d=this._create();for(var E in c)d._disabled[E]=h.templating.indexOf(E)===-1;return d._update(),d},l.prototype.exclude=function(h){var d=this._create();return d._excluded[h]=!0,d._update(),d},l.prototype.read=function(){var h="";this._match_pattern?h=this._input.read(this._starting_pattern):h=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),h+=d,d=this._read_template();return this._until_after&&(h+=this._input.readUntilAfter(this._until_pattern)),h},l.prototype.__set_templated_pattern=function(){var h=[];this._disabled.php||h.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||h.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||h.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||h.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(h.push(this.__patterns.django._starting_pattern.source),h.push(this.__patterns.django_value._starting_pattern.source),h.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||h.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&h.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+h.join("|")+")")},l.prototype._read_template=function(){var h="",d=this._input.peek();if(d==="<"){var E=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&E==="?"&&(h=h||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&E==="%"&&(h=h||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(h=h||this.__patterns.handlebars_comment.read(),h=h||this.__patterns.handlebars_unescaped.read(),h=h||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(h=h||this.__patterns.django_value.read()),this._excluded.django||(h=h||this.__patterns.django_comment.read(),h=h||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(h=h||this.__patterns.smarty_comment.read(),h=h||this.__patterns.smarty_literal.read(),h=h||this.__patterns.smarty.read()));return h},v.exports.TemplatablePattern=l}],w={};function _(v){var s=w[v];if(s!==void 0)return s.exports;var y=w[v]={exports:{}};return D[v](y,y.exports,_),y.exports}var F=_(0);P=F})();var G=P;b=[],I=function(){return{js_beautify:G}}.apply(me,b),I!==void 0&&(yt.exports=I)})()},32834:function(yt){(function(me,b){yt.exports=b()})(this,function(){"use strict";function me(xe,ge){for(var ye=0;ye<ge.length;ye++){var ee=ge[ye];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(xe,ee.key,ee)}}function b(xe,ge,ye){return ge&&me(xe.prototype,ge),ye&&me(xe,ye),xe}function I(xe,ge){if(xe){if(typeof xe=="string")return P(xe,ge);var ye=Object.prototype.toString.call(xe).slice(8,-1);if(ye==="Object"&&xe.constructor&&(ye=xe.constructor.name),ye==="Map"||ye==="Set")return Array.from(xe);if(ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ye))return P(xe,ge)}}function P(xe,ge){(ge==null||ge>xe.length)&&(ge=xe.length);for(var ye=0,ee=new Array(ge);ye<ge;ye++)ee[ye]=xe[ye];return ee}function G(xe,ge){var ye=typeof Symbol!="undefined"&&xe[Symbol.iterator]||xe["@@iterator"];if(ye)return(ye=ye.call(xe)).next.bind(ye);if(Array.isArray(xe)||(ye=I(xe))||ge&&xe&&typeof xe.length=="number"){ye&&(xe=ye);var ee=0;return function(){return ee>=xe.length?{done:!0}:{done:!1,value:xe[ee++]}}}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 D={exports:{}};function w(){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 _(xe){D.exports.defaults=xe}D.exports={defaults:w(),getDefaults:w,changeDefaults:_};var F=/[&<>"']/,v=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,y=/[<>"']|&(?!#?\w+;)/g,f={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(ge){return f[ge]};function l(xe,ge){if(ge){if(F.test(xe))return xe.replace(v,c)}else if(s.test(xe))return xe.replace(y,c);return xe}var h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function d(xe){return xe.replace(h,function(ge,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var E=/(^|[^\[])\^/g;function T(xe,ge){xe=xe.source||xe,ge=ge||"";var ye={replace:function(te,le){return le=le.source||le,le=le.replace(E,"$1"),xe=xe.replace(te,le),ye},getRegex:function(){return new RegExp(xe,ge)}};return ye}var L=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(xe,ge,ye){if(xe){var ee;try{ee=decodeURIComponent(d(ye)).replace(L,"").toLowerCase()}catch(te){return null}if(ee.indexOf("javascript:")===0||ee.indexOf("vbscript:")===0||ee.indexOf("data:")===0)return null}ge&&!x.test(ye)&&(ye=M(ge,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(te){return null}return ye}var O={},U=/^[^:]+:\/*[^/]*$/,B=/^([^:]+:)[\s\S]*$/,$=/^([^:]+:\/*[^/]*)[\s\S]*$/;function M(xe,ge){O[" "+xe]||(U.test(xe)?O[" "+xe]=xe+"/":O[" "+xe]=ce(xe,"/",!0)),xe=O[" "+xe];var ye=xe.indexOf(":")===-1;return ge.substring(0,2)==="//"?ye?ge:xe.replace(B,"$1")+ge:ge.charAt(0)==="/"?ye?ge:xe.replace($,"$1")+ge:xe+ge}var Y={exec:function(){}};function q(xe){for(var ge=1,ye,ee;ge<arguments.length;ge++){ye=arguments[ge];for(ee in ye)Object.prototype.hasOwnProperty.call(ye,ee)&&(xe[ee]=ye[ee])}return xe}function se(xe,ge){var ye=xe.replace(/\|/g,function(le,he,_e){for(var Je=!1,et=he;--et>=0&&_e[et]==="\\";)Je=!Je;return Je?"|":" |"}),ee=ye.split(/ \|/),te=0;if(ee.length>ge)ee.splice(ge);else for(;ee.length<ge;)ee.push("");for(;te<ee.length;te++)ee[te]=ee[te].trim().replace(/\\\|/g,"|");return ee}function ce(xe,ge,ye){var ee=xe.length;if(ee===0)return"";for(var te=0;te<ee;){var le=xe.charAt(ee-te-1);if(le===ge&&!ye)te++;else if(le!==ge&&ye)te++;else break}return xe.substr(0,ee-te)}function J(xe,ge){if(xe.indexOf(ge[1])===-1)return-1;for(var ye=xe.length,ee=0,te=0;te<ye;te++)if(xe[te]==="\\")te++;else if(xe[te]===ge[0])ee++;else if(xe[te]===ge[1]&&(ee--,ee<0))return te;return-1}function z(xe){xe&&xe.sanitize&&!xe.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 Z(xe,ge){if(ge<1)return"";for(var ye="";ge>1;)ge&1&&(ye+=xe),ge>>=1,xe+=xe;return ye+xe}var N={escape:l,unescape:d,edit:T,cleanUrl:A,resolveUrl:M,noopTest:Y,merge:q,splitCells:se,rtrim:ce,findClosingBracket:J,checkSanitizeDeprecation:z,repeatString:Z},W=D.exports.defaults,K=N.rtrim,k=N.splitCells,C=N.escape,V=N.findClosingBracket;function ne(xe,ge,ye){var ee=ge.href,te=ge.title?C(ge.title):null,le=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:ye,href:ee,title:te,text:le}:{type:"image",raw:ye,href:ee,title:te,text:C(le)}}function pe(xe,ge){var ye=xe.match(/^(\s+)(?:```)/);if(ye===null)return ge;var ee=ye[1];return ge.split(`
|
|
|
`).map(function(te){var le=te.match(/^\s+/);if(le===null)return te;var he=le[0];return he.length>=ee.length?te.slice(ee.length):te}).join(`
|
|
|
`)}var Te=function(){function xe(ye){this.options=ye||W}var ge=xe.prototype;return ge.space=function(ee){var te=this.rules.block.newline.exec(ee);if(te)return te[0].length>1?{type:"space",raw:te[0]}:{raw:`
|
|
|
`}},ge.code=function(ee){var te=this.rules.block.code.exec(ee);if(te){var le=te[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?le:K(le,`
|
|
|
`)}}},ge.fences=function(ee){var te=this.rules.block.fences.exec(ee);if(te){var le=te[0],he=pe(le,te[3]||"");return{type:"code",raw:le,lang:te[2]?te[2].trim():te[2],text:he}}},ge.heading=function(ee){var te=this.rules.block.heading.exec(ee);if(te){var le=te[2].trim();if(/#$/.test(le)){var he=K(le,"#");(this.options.pedantic||!he||/ $/.test(he))&&(le=he.trim())}return{type:"heading",raw:te[0],depth:te[1].length,text:le}}},ge.nptable=function(ee){var te=this.rules.block.nptable.exec(ee);if(te){var le={type:"table",header:k(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
|
|
|
`):[],raw:te[0]};if(le.header.length===le.align.length){var he=le.align.length,_e;for(_e=0;_e<he;_e++)/^ *-+: *$/.test(le.align[_e])?le.align[_e]="right":/^ *:-+: *$/.test(le.align[_e])?le.align[_e]="center":/^ *:-+ *$/.test(le.align[_e])?le.align[_e]="left":le.align[_e]=null;for(he=le.cells.length,_e=0;_e<he;_e++)le.cells[_e]=k(le.cells[_e],le.header.length);return le}}},ge.hr=function(ee){var te=this.rules.block.hr.exec(ee);if(te)return{type:"hr",raw:te[0]}},ge.blockquote=function(ee){var te=this.rules.block.blockquote.exec(ee);if(te){var le=te[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:te[0],text:le}}},ge.list=function(ee){var te=this.rules.block.list.exec(ee);if(te){var le=te[0],he=te[2],_e=he.length>1,Je={type:"list",raw:le,ordered:_e,start:_e?+he.slice(0,-1):"",loose:!1,items:[]},et=te[0].match(this.rules.block.item),ct=!1,gt,It,Yt,Nt,Lt,oi,di,ri,ni,tt=et.length;Yt=this.rules.block.listItemStart.exec(et[0]);for(var Ge=0;Ge<tt;Ge++){if(gt=et[Ge],le=gt,this.options.pedantic||(ni=gt.match(new RegExp("\\n\\s*\\n {0,"+(Yt[0].length-1)+"}\\S")),ni&&(Lt=gt.length-ni.index+et.slice(Ge+1).join(`
|
|
|
`).length,Je.raw=Je.raw.substring(0,Je.raw.length-Lt),gt=gt.substring(0,ni.index),le=gt,tt=Ge+1)),Ge!==tt-1){if(Nt=this.rules.block.listItemStart.exec(et[Ge+1]),this.options.pedantic?Nt[1].length>Yt[1].length:Nt[1].length>=Yt[0].length||Nt[1].length>3){et.splice(Ge,2,et[Ge]+(!this.options.pedantic&&Nt[1].length<Yt[0].length&&!et[Ge].match(/\n$/)?"":`
|
|
|
`)+et[Ge+1]),Ge--,tt--;continue}else(!this.options.pedantic||this.options.smartLists?Nt[2][Nt[2].length-1]!==he[he.length-1]:_e===(Nt[2].length===1))&&(Lt=et.slice(Ge+1).join(`
|
|
|
`).length,Je.raw=Je.raw.substring(0,Je.raw.length-Lt),Ge=tt-1);Yt=Nt}It=gt.length,gt=gt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~gt.indexOf(`
|
|
|
`)&&(It-=gt.length,gt=this.options.pedantic?gt.replace(/^ {1,4}/gm,""):gt.replace(new RegExp("^ {1,"+It+"}","gm"),"")),gt=K(gt,`
|
|
|
`),Ge!==tt-1&&(le=le+`
|
|
|
`),oi=ct||/\n\n(?!\s*$)/.test(le),Ge!==tt-1&&(ct=le.slice(-2)===`
|
|
|
|
|
|
`,oi||(oi=ct)),oi&&(Je.loose=!0),this.options.gfm&&(di=/^\[[ xX]\] /.test(gt),ri=void 0,di&&(ri=gt[1]!==" ",gt=gt.replace(/^\[[ xX]\] +/,""))),Je.items.push({type:"list_item",raw:le,task:di,checked:ri,loose:oi,text:gt})}return Je}},ge.html=function(ee){var te=this.rules.block.html.exec(ee);if(te)return{type:this.options.sanitize?"paragraph":"html",raw:te[0],pre:!this.options.sanitizer&&(te[1]==="pre"||te[1]==="script"||te[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):C(te[0]):te[0]}},ge.def=function(ee){var te=this.rules.block.def.exec(ee);if(te){te[3]&&(te[3]=te[3].substring(1,te[3].length-1));var le=te[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:le,raw:te[0],href:te[2],title:te[3]}}},ge.table=function(ee){var te=this.rules.block.table.exec(ee);if(te){var le={type:"table",header:k(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
|
|
|
`):[]};if(le.header.length===le.align.length){le.raw=te[0];var he=le.align.length,_e;for(_e=0;_e<he;_e++)/^ *-+: *$/.test(le.align[_e])?le.align[_e]="right":/^ *:-+: *$/.test(le.align[_e])?le.align[_e]="center":/^ *:-+ *$/.test(le.align[_e])?le.align[_e]="left":le.align[_e]=null;for(he=le.cells.length,_e=0;_e<he;_e++)le.cells[_e]=k(le.cells[_e].replace(/^ *\| *| *\| *$/g,""),le.header.length);return le}}},ge.lheading=function(ee){var te=this.rules.block.lheading.exec(ee);if(te)return{type:"heading",raw:te[0],depth:te[2].charAt(0)==="="?1:2,text:te[1]}},ge.paragraph=function(ee){var te=this.rules.block.paragraph.exec(ee);if(te)return{type:"paragraph",raw:te[0],text:te[1].charAt(te[1].length-1)===`
|
|
|
`?te[1].slice(0,-1):te[1]}},ge.text=function(ee){var te=this.rules.block.text.exec(ee);if(te)return{type:"text",raw:te[0],text:te[0]}},ge.escape=function(ee){var te=this.rules.inline.escape.exec(ee);if(te)return{type:"escape",raw:te[0],text:C(te[1])}},ge.tag=function(ee,te,le){var he=this.rules.inline.tag.exec(ee);if(he)return!te&&/^<a /i.test(he[0])?te=!0:te&&/^<\/a>/i.test(he[0])&&(te=!1),!le&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?le=!0:le&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(le=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:te,inRawBlock:le,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):C(he[0]):he[0]}},ge.link=function(ee){var te=this.rules.inline.link.exec(ee);if(te){var le=te[2].trim();if(!this.options.pedantic&&/^</.test(le)){if(!/>$/.test(le))return;var he=K(le.slice(0,-1),"\\");if((le.length-he.length)%2===0)return}else{var _e=V(te[2],"()");if(_e>-1){var Je=te[0].indexOf("!")===0?5:4,et=Je+te[1].length+_e;te[2]=te[2].substring(0,_e),te[0]=te[0].substring(0,et).trim(),te[3]=""}}var ct=te[2],gt="";if(this.options.pedantic){var It=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ct);It&&(ct=It[1],gt=It[3])}else gt=te[3]?te[3].slice(1,-1):"";return ct=ct.trim(),/^</.test(ct)&&(this.options.pedantic&&!/>$/.test(le)?ct=ct.slice(1):ct=ct.slice(1,-1)),ne(te,{href:ct&&ct.replace(this.rules.inline._escapes,"$1"),title:gt&>.replace(this.rules.inline._escapes,"$1")},te[0])}},ge.reflink=function(ee,te){var le;if((le=this.rules.inline.reflink.exec(ee))||(le=this.rules.inline.nolink.exec(ee))){var he=(le[2]||le[1]).replace(/\s+/g," ");if(he=te[he.toLowerCase()],!he||!he.href){var _e=le[0].charAt(0);return{type:"text",raw:_e,text:_e}}return ne(le,he,le[0])}},ge.emStrong=function(ee,te,le){le===void 0&&(le="");var he=this.rules.inline.emStrong.lDelim.exec(ee);if(he&&!(he[3]&&le.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 _e=he[1]||he[2]||"";if(!_e||_e&&(le===""||this.rules.inline.punctuation.exec(le))){var Je=he[0].length-1,et,ct,gt=Je,It=0,Yt=he[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(Yt.lastIndex=0,te=te.slice(-1*ee.length+Je);(he=Yt.exec(te))!=null;)if(et=he[1]||he[2]||he[3]||he[4]||he[5]||he[6],!!et){if(ct=et.length,he[3]||he[4]){gt+=ct;continue}else if((he[5]||he[6])&&Je%3&&!((Je+ct)%3)){It+=ct;continue}if(gt-=ct,!(gt>0))return ct=Math.min(ct,ct+gt+It),Math.min(Je,ct)%2?{type:"em",raw:ee.slice(0,Je+he.index+ct+1),text:ee.slice(1,Je+he.index+ct)}:{type:"strong",raw:ee.slice(0,Je+he.index+ct+1),text:ee.slice(2,Je+he.index+ct-1)}}}}},ge.codespan=function(ee){var te=this.rules.inline.code.exec(ee);if(te){var le=te[2].replace(/\n/g," "),he=/[^ ]/.test(le),_e=/^ /.test(le)&&/ $/.test(le);return he&&_e&&(le=le.substring(1,le.length-1)),le=C(le,!0),{type:"codespan",raw:te[0],text:le}}},ge.br=function(ee){var te=this.rules.inline.br.exec(ee);if(te)return{type:"br",raw:te[0]}},ge.del=function(ee){var te=this.rules.inline.del.exec(ee);if(te)return{type:"del",raw:te[0],text:te[2]}},ge.autolink=function(ee,te){var le=this.rules.inline.autolink.exec(ee);if(le){var he,_e;return le[2]==="@"?(he=C(this.options.mangle?te(le[1]):le[1]),_e="mailto:"+he):(he=C(le[1]),_e=he),{type:"link",raw:le[0],text:he,href:_e,tokens:[{type:"text",raw:he,text:he}]}}},ge.url=function(ee,te){var le;if(le=this.rules.inline.url.exec(ee)){var he,_e;if(le[2]==="@")he=C(this.options.mangle?te(le[0]):le[0]),_e="mailto:"+he;else{var Je;do Je=le[0],le[0]=this.rules.inline._backpedal.exec(le[0])[0];while(Je!==le[0]);he=C(le[0]),le[1]==="www."?_e="http://"+he:_e=he}return{type:"link",raw:le[0],text:he,href:_e,tokens:[{type:"text",raw:he,text:he}]}}},ge.inlineText=function(ee,te,le){var he=this.rules.inline.text.exec(ee);if(he){var _e;return te?_e=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):C(he[0]):he[0]:_e=C(this.options.smartypants?le(he[0]):he[0]),{type:"text",raw:he[0],text:_e}}},xe}(),Ke=N.noopTest,ve=N.edit,Ue=N.merge,Be={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:Ke,table:Ke,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};Be._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Be._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Be.def=ve(Be.def).replace("label",Be._label).replace("title",Be._title).getRegex(),Be.bullet=/(?:[*+-]|\d{1,9}[.)])/,Be.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Be.item=ve(Be.item,"gm").replace(/bull/g,Be.bullet).getRegex(),Be.listItemStart=ve(/^( *)(bull) */).replace("bull",Be.bullet).getRegex(),Be.list=ve(Be.list).replace(/bull/g,Be.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Be.def.source+")").getRegex(),Be._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",Be._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Be.html=ve(Be.html,"i").replace("comment",Be._comment).replace("tag",Be._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Be.paragraph=ve(Be._paragraph).replace("hr",Be.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",Be._tag).getRegex(),Be.blockquote=ve(Be.blockquote).replace("paragraph",Be.paragraph).getRegex(),Be.normal=Ue({},Be),Be.gfm=Ue({},Be.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*|$)"}),Be.gfm.nptable=ve(Be.gfm.nptable).replace("hr",Be.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",Be._tag).getRegex(),Be.gfm.table=ve(Be.gfm.table).replace("hr",Be.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",Be._tag).getRegex(),Be.pedantic=Ue({},Be.normal,{html:ve(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Be._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:Ke,paragraph:ve(Be.normal._paragraph).replace("hr",Be.hr).replace("heading",` *#{1,6} *[^
|
|
|
]`).replace("lheading",Be.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ke,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:Ke,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};Me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Me.punctuation=ve(Me.punctuation).replace(/punctuation/g,Me._punctuation).getRegex(),Me.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Me.escapedEmSt=/\\\*|\\_/g,Me._comment=ve(Be._comment).replace("(?:-->|$)","-->").getRegex(),Me.emStrong.lDelim=ve(Me.emStrong.lDelim).replace(/punct/g,Me._punctuation).getRegex(),Me.emStrong.rDelimAst=ve(Me.emStrong.rDelimAst,"g").replace(/punct/g,Me._punctuation).getRegex(),Me.emStrong.rDelimUnd=ve(Me.emStrong.rDelimUnd,"g").replace(/punct/g,Me._punctuation).getRegex(),Me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Me._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])?)+(?![-_])/,Me.autolink=ve(Me.autolink).replace("scheme",Me._scheme).replace("email",Me._email).getRegex(),Me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Me.tag=ve(Me.tag).replace("comment",Me._comment).replace("attribute",Me._attribute).getRegex(),Me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Me._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Me.link=ve(Me.link).replace("label",Me._label).replace("href",Me._href).replace("title",Me._title).getRegex(),Me.reflink=ve(Me.reflink).replace("label",Me._label).getRegex(),Me.reflinkSearch=ve(Me.reflinkSearch,"g").replace("reflink",Me.reflink).replace("nolink",Me.nolink).getRegex(),Me.normal=Ue({},Me),Me.pedantic=Ue({},Me.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:ve(/^!?\[(label)\]\((.*?)\)/).replace("label",Me._label).getRegex(),reflink:ve(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Me._label).getRegex()}),Me.gfm=Ue({},Me.normal,{escape:ve(Me.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Me.gfm.url=ve(Me.gfm.url,"i").replace("email",Me.gfm._extended_email).getRegex(),Me.breaks=Ue({},Me.gfm,{br:ve(Me.br).replace("{2,}","*").getRegex(),text:ve(Me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var St={block:Be,inline:Me},He=Te,ut=D.exports.defaults,$e=St.block,bt=St.inline,Ee=N.repeatString;function be(xe){return xe.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 ue(xe){var ge="",ye,ee,te=xe.length;for(ye=0;ye<te;ye++)ee=xe.charCodeAt(ye),Math.random()>.5&&(ee="x"+ee.toString(16)),ge+="&#"+ee+";";return ge}var ke=function(){function xe(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||ut,this.options.tokenizer=this.options.tokenizer||new He,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ee={block:$e.normal,inline:bt.normal};this.options.pedantic?(ee.block=$e.pedantic,ee.inline=bt.pedantic):this.options.gfm&&(ee.block=$e.gfm,this.options.breaks?ee.inline=bt.breaks:ee.inline=bt.gfm),this.tokenizer.rules=ee}xe.lex=function(ee,te){var le=new xe(te);return le.lex(ee)},xe.lexInline=function(ee,te){var le=new xe(te);return le.inlineTokens(ee)};var ge=xe.prototype;return ge.lex=function(ee){return ee=ee.replace(/\r\n|\r/g,`
|
|
|
`).replace(/\t/g," "),this.blockTokens(ee,this.tokens,!0),this.inline(this.tokens),this.tokens},ge.blockTokens=function(ee,te,le){te===void 0&&(te=[]),le===void 0&&(le=!0),this.options.pedantic&&(ee=ee.replace(/^ +$/gm,""));for(var he,_e,Je,et;ee;){if(he=this.tokenizer.space(ee)){ee=ee.substring(he.raw.length),he.type&&te.push(he);continue}if(he=this.tokenizer.code(ee)){ee=ee.substring(he.raw.length),et=te[te.length-1],et&&et.type==="paragraph"?(et.raw+=`
|
|
|
`+he.raw,et.text+=`
|
|
|
`+he.text):te.push(he);continue}if(he=this.tokenizer.fences(ee)){ee=ee.substring(he.raw.length),te.push(he);continue}if(he=this.tokenizer.heading(ee)){ee=ee.substring(he.raw.length),te.push(he);continue}if(he=this.tokenizer.nptable(ee)){ee=ee.substring(he.raw.length),te.push(he);continue}if(he=this.tokenizer.hr(ee)){ee=ee.substring(he.raw.length),te.push(he);continue}if(he=this.tokenizer.blockquote(ee)){ee=ee.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],le),te.push(he);continue}if(he=this.tokenizer.list(ee)){for(ee=ee.substring(he.raw.length),Je=he.items.length,_e=0;_e<Je;_e++)he.items[_e].tokens=this.blockTokens(he.items[_e].text,[],!1);te.push(he);continue}if(he=this.tokenizer.html(ee)){ee=ee.substring(he.raw.length),te.push(he);continue}if(le&&(he=this.tokenizer.def(ee))){ee=ee.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(ee)){ee=ee.substring(he.raw.length),te.push(he);continue}if(he=this.tokenizer.lheading(ee)){ee=ee.substring(he.raw.length),te.push(he);continue}if(le&&(he=this.tokenizer.paragraph(ee))){ee=ee.substring(he.raw.length),te.push(he);continue}if(he=this.tokenizer.text(ee)){ee=ee.substring(he.raw.length),et=te[te.length-1],et&&et.type==="text"?(et.raw+=`
|
|
|
`+he.raw,et.text+=`
|
|
|
`+he.text):te.push(he);continue}if(ee){var ct="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(ct);break}else throw new Error(ct)}}return te},ge.inline=function(ee){var te,le,he,_e,Je,et,ct=ee.length;for(te=0;te<ct;te++)switch(et=ee[te],et.type){case"paragraph":case"text":case"heading":{et.tokens=[],this.inlineTokens(et.text,et.tokens);break}case"table":{for(et.tokens={header:[],cells:[]},_e=et.header.length,le=0;le<_e;le++)et.tokens.header[le]=[],this.inlineTokens(et.header[le],et.tokens.header[le]);for(_e=et.cells.length,le=0;le<_e;le++)for(Je=et.cells[le],et.tokens.cells[le]=[],he=0;he<Je.length;he++)et.tokens.cells[le][he]=[],this.inlineTokens(Je[he],et.tokens.cells[le][he]);break}case"blockquote":{this.inline(et.tokens);break}case"list":{for(_e=et.items.length,le=0;le<_e;le++)this.inline(et.items[le].tokens);break}}return ee},ge.inlineTokens=function(ee,te,le,he){te===void 0&&(te=[]),le===void 0&&(le=!1),he===void 0&&(he=!1);var _e,Je,et=ee,ct,gt,It;if(this.tokens.links){var Yt=Object.keys(this.tokens.links);if(Yt.length>0)for(;(ct=this.tokenizer.rules.inline.reflinkSearch.exec(et))!=null;)Yt.includes(ct[0].slice(ct[0].lastIndexOf("[")+1,-1))&&(et=et.slice(0,ct.index)+"["+Ee("a",ct[0].length-2)+"]"+et.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ct=this.tokenizer.rules.inline.blockSkip.exec(et))!=null;)et=et.slice(0,ct.index)+"["+Ee("a",ct[0].length-2)+"]"+et.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(ct=this.tokenizer.rules.inline.escapedEmSt.exec(et))!=null;)et=et.slice(0,ct.index)+"++"+et.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;ee;){if(gt||(It=""),gt=!1,_e=this.tokenizer.escape(ee)){ee=ee.substring(_e.raw.length),te.push(_e);continue}if(_e=this.tokenizer.tag(ee,le,he)){ee=ee.substring(_e.raw.length),le=_e.inLink,he=_e.inRawBlock;var Nt=te[te.length-1];Nt&&_e.type==="text"&&Nt.type==="text"?(Nt.raw+=_e.raw,Nt.text+=_e.text):te.push(_e);continue}if(_e=this.tokenizer.link(ee)){ee=ee.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,he)),te.push(_e);continue}if(_e=this.tokenizer.reflink(ee,this.tokens.links)){ee=ee.substring(_e.raw.length);var Lt=te[te.length-1];_e.type==="link"?(_e.tokens=this.inlineTokens(_e.text,[],!0,he),te.push(_e)):Lt&&_e.type==="text"&&Lt.type==="text"?(Lt.raw+=_e.raw,Lt.text+=_e.text):te.push(_e);continue}if(_e=this.tokenizer.emStrong(ee,et,It)){ee=ee.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],le,he),te.push(_e);continue}if(_e=this.tokenizer.codespan(ee)){ee=ee.substring(_e.raw.length),te.push(_e);continue}if(_e=this.tokenizer.br(ee)){ee=ee.substring(_e.raw.length),te.push(_e);continue}if(_e=this.tokenizer.del(ee)){ee=ee.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],le,he),te.push(_e);continue}if(_e=this.tokenizer.autolink(ee,ue)){ee=ee.substring(_e.raw.length),te.push(_e);continue}if(!le&&(_e=this.tokenizer.url(ee,ue))){ee=ee.substring(_e.raw.length),te.push(_e);continue}if(_e=this.tokenizer.inlineText(ee,he,be)){ee=ee.substring(_e.raw.length),_e.raw.slice(-1)!=="_"&&(It=_e.raw.slice(-1)),gt=!0,Je=te[te.length-1],Je&&Je.type==="text"?(Je.raw+=_e.raw,Je.text+=_e.text):te.push(_e);continue}if(ee){var oi="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(oi);break}else throw new Error(oi)}}return te},b(xe,null,[{key:"rules",get:function(){return{block:$e,inline:bt}}}]),xe}(),Fe=D.exports.defaults,We=N.cleanUrl,ie=N.escape,fe=function(){function xe(ye){this.options=ye||Fe}var ge=xe.prototype;return ge.code=function(ee,te,le){var he=(te||"").match(/\S*/)[0];if(this.options.highlight){var _e=this.options.highlight(ee,he);_e!=null&&_e!==ee&&(le=!0,ee=_e)}return ee=ee.replace(/\n$/,"")+`
|
|
|
`,he?'<pre><code class="'+this.options.langPrefix+ie(he,!0)+'">'+(le?ee:ie(ee,!0))+`</code></pre>
|
|
|
`:"<pre><code>"+(le?ee:ie(ee,!0))+`</code></pre>
|
|
|
`},ge.blockquote=function(ee){return`<blockquote>
|
|
|
`+ee+`</blockquote>
|
|
|
`},ge.html=function(ee){return ee},ge.heading=function(ee,te,le,he){return this.options.headerIds?"<h"+te+' id="'+this.options.headerPrefix+he.slug(le)+'">'+ee+"</h"+te+`>
|
|
|
`:"<h"+te+">"+ee+"</h"+te+`>
|
|
|
`},ge.hr=function(){return this.options.xhtml?`<hr/>
|
|
|
`:`<hr>
|
|
|
`},ge.list=function(ee,te,le){var he=te?"ol":"ul",_e=te&&le!==1?' start="'+le+'"':"";return"<"+he+_e+`>
|
|
|
`+ee+"</"+he+`>
|
|
|
`},ge.listitem=function(ee){return"<li>"+ee+`</li>
|
|
|
`},ge.checkbox=function(ee){return"<input "+(ee?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ge.paragraph=function(ee){return"<p>"+ee+`</p>
|
|
|
`},ge.table=function(ee,te){return te&&(te="<tbody>"+te+"</tbody>"),`<table>
|
|
|
<thead>
|
|
|
`+ee+`</thead>
|
|
|
`+te+`</table>
|
|
|
`},ge.tablerow=function(ee){return`<tr>
|
|
|
`+ee+`</tr>
|
|
|
`},ge.tablecell=function(ee,te){var le=te.header?"th":"td",he=te.align?"<"+le+' align="'+te.align+'">':"<"+le+">";return he+ee+"</"+le+`>
|
|
|
`},ge.strong=function(ee){return"<strong>"+ee+"</strong>"},ge.em=function(ee){return"<em>"+ee+"</em>"},ge.codespan=function(ee){return"<code>"+ee+"</code>"},ge.br=function(){return this.options.xhtml?"<br/>":"<br>"},ge.del=function(ee){return"<del>"+ee+"</del>"},ge.link=function(ee,te,le){if(ee=We(this.options.sanitize,this.options.baseUrl,ee),ee===null)return le;var he='<a href="'+ie(ee)+'"';return te&&(he+=' title="'+te+'"'),he+=">"+le+"</a>",he},ge.image=function(ee,te,le){if(ee=We(this.options.sanitize,this.options.baseUrl,ee),ee===null)return le;var he='<img src="'+ee+'" alt="'+le+'"';return te&&(he+=' title="'+te+'"'),he+=this.options.xhtml?"/>":">",he},ge.text=function(ee){return ee},xe}(),De=function(){function xe(){}var ge=xe.prototype;return ge.strong=function(ee){return ee},ge.em=function(ee){return ee},ge.codespan=function(ee){return ee},ge.del=function(ee){return ee},ge.html=function(ee){return ee},ge.text=function(ee){return ee},ge.link=function(ee,te,le){return""+le},ge.image=function(ee,te,le){return""+le},ge.br=function(){return""},xe}(),Re=function(){function xe(){this.seen={}}var ge=xe.prototype;return ge.serialize=function(ee){return ee.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},ge.getNextSafeSlug=function(ee,te){var le=ee,he=0;if(this.seen.hasOwnProperty(le)){he=this.seen[ee];do he++,le=ee+"-"+he;while(this.seen.hasOwnProperty(le))}return te||(this.seen[ee]=he,this.seen[le]=0),le},ge.slug=function(ee,te){te===void 0&&(te={});var le=this.serialize(ee);return this.getNextSafeSlug(le,te.dryrun)},xe}(),Oe=fe,Ve=De,lt=Re,Qe=D.exports.defaults,Ze=N.unescape,Xe=function(){function xe(ye){this.options=ye||Qe,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 lt}xe.parse=function(ee,te){var le=new xe(te);return le.parse(ee)},xe.parseInline=function(ee,te){var le=new xe(te);return le.parseInline(ee)};var ge=xe.prototype;return ge.parse=function(ee,te){te===void 0&&(te=!0);var le="",he,_e,Je,et,ct,gt,It,Yt,Nt,Lt,oi,di,ri,ni,tt,Ge,pt,Mt,Vt=ee.length;for(he=0;he<Vt;he++)switch(Lt=ee[he],Lt.type){case"space":continue;case"hr":{le+=this.renderer.hr();continue}case"heading":{le+=this.renderer.heading(this.parseInline(Lt.tokens),Lt.depth,Ze(this.parseInline(Lt.tokens,this.textRenderer)),this.slugger);continue}case"code":{le+=this.renderer.code(Lt.text,Lt.lang,Lt.escaped);continue}case"table":{for(Yt="",It="",et=Lt.header.length,_e=0;_e<et;_e++)It+=this.renderer.tablecell(this.parseInline(Lt.tokens.header[_e]),{header:!0,align:Lt.align[_e]});for(Yt+=this.renderer.tablerow(It),Nt="",et=Lt.cells.length,_e=0;_e<et;_e++){for(gt=Lt.tokens.cells[_e],It="",ct=gt.length,Je=0;Je<ct;Je++)It+=this.renderer.tablecell(this.parseInline(gt[Je]),{header:!1,align:Lt.align[Je]});Nt+=this.renderer.tablerow(It)}le+=this.renderer.table(Yt,Nt);continue}case"blockquote":{Nt=this.parse(Lt.tokens),le+=this.renderer.blockquote(Nt);continue}case"list":{for(oi=Lt.ordered,di=Lt.start,ri=Lt.loose,et=Lt.items.length,Nt="",_e=0;_e<et;_e++)tt=Lt.items[_e],Ge=tt.checked,pt=tt.task,ni="",tt.task&&(Mt=this.renderer.checkbox(Ge),ri?tt.tokens.length>0&&tt.tokens[0].type==="text"?(tt.tokens[0].text=Mt+" "+tt.tokens[0].text,tt.tokens[0].tokens&&tt.tokens[0].tokens.length>0&&tt.tokens[0].tokens[0].type==="text"&&(tt.tokens[0].tokens[0].text=Mt+" "+tt.tokens[0].tokens[0].text)):tt.tokens.unshift({type:"text",text:Mt}):ni+=Mt),ni+=this.parse(tt.tokens,ri),Nt+=this.renderer.listitem(ni,pt,Ge);le+=this.renderer.list(Nt,oi,di);continue}case"html":{le+=this.renderer.html(Lt.text);continue}case"paragraph":{le+=this.renderer.paragraph(this.parseInline(Lt.tokens));continue}case"text":{for(Nt=Lt.tokens?this.parseInline(Lt.tokens):Lt.text;he+1<Vt&&ee[he+1].type==="text";)Lt=ee[++he],Nt+=`
|
|
|
`+(Lt.tokens?this.parseInline(Lt.tokens):Lt.text);le+=te?this.renderer.paragraph(Nt):Nt;continue}default:{var Jt='Token with "'+Lt.type+'" type was not found.';if(this.options.silent){console.error(Jt);return}else throw new Error(Jt)}}return le},ge.parseInline=function(ee,te){te=te||this.renderer;var le="",he,_e,Je=ee.length;for(he=0;he<Je;he++)switch(_e=ee[he],_e.type){case"escape":{le+=te.text(_e.text);break}case"html":{le+=te.html(_e.text);break}case"link":{le+=te.link(_e.href,_e.title,this.parseInline(_e.tokens,te));break}case"image":{le+=te.image(_e.href,_e.title,_e.text);break}case"strong":{le+=te.strong(this.parseInline(_e.tokens,te));break}case"em":{le+=te.em(this.parseInline(_e.tokens,te));break}case"codespan":{le+=te.codespan(_e.text);break}case"br":{le+=te.br();break}case"del":{le+=te.del(this.parseInline(_e.tokens,te));break}case"text":{le+=te.text(_e.text);break}default:{var et='Token with "'+_e.type+'" type was not found.';if(this.options.silent){console.error(et);return}else throw new Error(et)}}return le},xe}(),ht=ke,st=Xe,it=Te,Ae=fe,rt=De,qe=Re,je=N.merge,mt=N.checkSanitizeDeprecation,Et=N.escape,at=D.exports.getDefaults,kt=D.exports.changeDefaults,Bt=D.exports.defaults;function nt(xe,ge,ye){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof ge=="function"&&(ye=ge,ge=null),ge=je({},nt.defaults,ge||{}),mt(ge),ye){var ee=ge.highlight,te;try{te=ht.lex(xe,ge)}catch(Je){return ye(Je)}var le=function(et){var ct;if(!et)try{ge.walkTokens&&nt.walkTokens(te,ge.walkTokens),ct=st.parse(te,ge)}catch(gt){et=gt}return ge.highlight=ee,et?ye(et):ye(null,ct)};if(!ee||ee.length<3||(delete ge.highlight,!te.length))return le();var he=0;nt.walkTokens(te,function(Je){Je.type==="code"&&(he++,setTimeout(function(){ee(Je.text,Je.lang,function(et,ct){if(et)return le(et);ct!=null&&ct!==Je.text&&(Je.text=ct,Je.escaped=!0),he--,he===0&&le()})},0))}),he===0&&le();return}try{var _e=ht.lex(xe,ge);return ge.walkTokens&&nt.walkTokens(_e,ge.walkTokens),st.parse(_e,ge)}catch(Je){if(Je.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+Et(Je.message+"",!0)+"</pre>";throw Je}}nt.options=nt.setOptions=function(xe){return je(nt.defaults,xe),kt(nt.defaults),nt},nt.getDefaults=at,nt.defaults=Bt,nt.use=function(xe){var ge=je({},xe);if(xe.renderer&&function(){var ee=nt.defaults.renderer||new Ae,te=function(_e){var Je=ee[_e];ee[_e]=function(){for(var et=arguments.length,ct=new Array(et),gt=0;gt<et;gt++)ct[gt]=arguments[gt];var It=xe.renderer[_e].apply(ee,ct);return It===!1&&(It=Je.apply(ee,ct)),It}};for(var le in xe.renderer)te(le);ge.renderer=ee}(),xe.tokenizer&&function(){var ee=nt.defaults.tokenizer||new it,te=function(_e){var Je=ee[_e];ee[_e]=function(){for(var et=arguments.length,ct=new Array(et),gt=0;gt<et;gt++)ct[gt]=arguments[gt];var It=xe.tokenizer[_e].apply(ee,ct);return It===!1&&(It=Je.apply(ee,ct)),It}};for(var le in xe.tokenizer)te(le);ge.tokenizer=ee}(),xe.walkTokens){var ye=nt.defaults.walkTokens;ge.walkTokens=function(ee){xe.walkTokens(ee),ye&&ye(ee)}}nt.setOptions(ge)},nt.walkTokens=function(xe,ge){for(var ye=G(xe),ee;!(ee=ye()).done;){var te=ee.value;switch(ge(te),te.type){case"table":{for(var le=G(te.tokens.header),he;!(he=le()).done;){var _e=he.value;nt.walkTokens(_e,ge)}for(var Je=G(te.tokens.cells),et;!(et=Je()).done;)for(var ct=et.value,gt=G(ct),It;!(It=gt()).done;){var Yt=It.value;nt.walkTokens(Yt,ge)}break}case"list":{nt.walkTokens(te.items,ge);break}default:te.tokens&&nt.walkTokens(te.tokens,ge)}}},nt.parseInline=function(xe,ge){if(typeof xe=="undefined"||xe===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");ge=je({},nt.defaults,ge||{}),mt(ge);try{var ye=ht.lexInline(xe,ge);return ge.walkTokens&&nt.walkTokens(ye,ge.walkTokens),st.parseInline(ye,ge)}catch(ee){if(ee.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+Et(ee.message+"",!0)+"</pre>";throw ee}},nt.Parser=st,nt.parser=st.parse,nt.Renderer=Ae,nt.TextRenderer=rt,nt.Lexer=ht,nt.lexer=ht.lex,nt.Tokenizer=it,nt.Slugger=qe,nt.parse=nt;var Tt=nt;return Tt})},11690:function(yt){const me=/[&<>"']/,b=/[&<>"']/g,I=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},D=M=>G[M];function w(M,Y){if(Y){if(me.test(M))return M.replace(b,D)}else if(I.test(M))return M.replace(P,D);return M}const _=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(M){return M.replace(_,(Y,q)=>(q=q.toLowerCase(),q==="colon"?":":q.charAt(0)==="#"?q.charAt(1)==="x"?String.fromCharCode(parseInt(q.substring(2),16)):String.fromCharCode(+q.substring(1)):""))}const v=/(^|[^\[])\^/g;function s(M,Y){M=M.source||M,Y=Y||"";const q={replace:(se,ce)=>(ce=ce.source||ce,ce=ce.replace(v,"$1"),M=M.replace(se,ce),q),getRegex:()=>new RegExp(M,Y)};return q}const y=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function c(M,Y,q){if(M){let se;try{se=decodeURIComponent(F(q)).replace(y,"").toLowerCase()}catch(ce){return null}if(se.indexOf("javascript:")===0||se.indexOf("vbscript:")===0||se.indexOf("data:")===0)return null}Y&&!f.test(q)&&(q=T(Y,q));try{q=encodeURI(q).replace(/%25/g,"%")}catch(se){return null}return q}const l={},h=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,E=/^([^:]+:\/*[^/]*)[\s\S]*$/;function T(M,Y){l[" "+M]||(h.test(M)?l[" "+M]=M+"/":l[" "+M]=O(M,"/",!0)),M=l[" "+M];const q=M.indexOf(":")===-1;return Y.substring(0,2)==="//"?q?Y:M.replace(d,"$1")+Y:Y.charAt(0)==="/"?q?Y:M.replace(E,"$1")+Y:M+Y}const L={exec:function(){}};function x(M){let Y=1,q,se;for(;Y<arguments.length;Y++){q=arguments[Y];for(se in q)Object.prototype.hasOwnProperty.call(q,se)&&(M[se]=q[se])}return M}function A(M,Y){const q=M.replace(/\|/g,(J,z,Z)=>{let N=!1,W=z;for(;--W>=0&&Z[W]==="\\";)N=!N;return N?"|":" |"}),se=q.split(/ \|/);let ce=0;if(se.length>Y)se.splice(Y);else for(;se.length<Y;)se.push("");for(;ce<se.length;ce++)se[ce]=se[ce].trim().replace(/\\\|/g,"|");return se}function O(M,Y,q){const se=M.length;if(se===0)return"";let ce=0;for(;ce<se;){const J=M.charAt(se-ce-1);if(J===Y&&!q)ce++;else if(J!==Y&&q)ce++;else break}return M.substr(0,se-ce)}function U(M,Y){if(M.indexOf(Y[1])===-1)return-1;const q=M.length;let se=0,ce=0;for(;ce<q;ce++)if(M[ce]==="\\")ce++;else if(M[ce]===Y[0])se++;else if(M[ce]===Y[1]&&(se--,se<0))return ce;return-1}function B(M){M&&M.sanitize&&!M.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 $(M,Y){if(Y<1)return"";let q="";for(;Y>1;)Y&1&&(q+=M),Y>>=1,M+=M;return q+M}yt.exports={escape:w,unescape:F,edit:s,cleanUrl:c,resolveUrl:T,noopTest:L,merge:x,splitCells:A,rtrim:O,findClosingBracket:U,checkSanitizeDeprecation:B,repeatString:$}},75918:function(yt,me,b){"use strict";b.d(me,{Wi:function(){return _},Z0:function(){return F},aU:function(){return w},eZ:function(){return s},wY:function(){return v}});var I=b(4348),P=b(69323),G=b(13268),D=function(y,f,c,l){function h(d){return d instanceof c?d:new c(function(E){E(d)})}return new(c||(c=Promise))(function(d,E){function T(A){try{x(l.next(A))}catch(O){E(O)}}function L(A){try{x(l.throw(A))}catch(O){E(O)}}function x(A){A.done?d(A.value):h(A.value).then(T,L)}x((l=l.apply(y,f||[])).next())})};class w extends P.JT{constructor(f,c="",l="",h=!0,d){super(),this._onDidChange=this._register(new I.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=f,this._label=c,this._cssClass=l,this._enabled=h,this._actionCallback=d}get id(){return this._id}get label(){return this._label}set label(f){this._setLabel(f)}_setLabel(f){this._label!==f&&(this._label=f,this._onDidChange.fire({label:f}))}get tooltip(){return this._tooltip||""}set tooltip(f){this._setTooltip(f)}_setTooltip(f){this._tooltip!==f&&(this._tooltip=f,this._onDidChange.fire({tooltip:f}))}get class(){return this._cssClass}set class(f){this._setClass(f)}_setClass(f){this._cssClass!==f&&(this._cssClass=f,this._onDidChange.fire({class:f}))}get enabled(){return this._enabled}set enabled(f){this._setEnabled(f)}_setEnabled(f){this._enabled!==f&&(this._enabled=f,this._onDidChange.fire({enabled:f}))}get checked(){return this._checked}set checked(f){this._setChecked(f)}_setChecked(f){this._checked!==f&&(this._checked=f,this._onDidChange.fire({checked:f}))}run(f,c){return D(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(f))})}}class _ extends P.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new I.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new I.Q5),this.onDidRun=this._onDidRun.event}run(f,c){return D(this,void 0,void 0,function*(){if(!f.enabled)return;this._onBeforeRun.fire({action:f});let l;try{yield this.runAction(f,c)}catch(h){l=h}this._onDidRun.fire({action:f,error:l})})}runAction(f,c){return D(this,void 0,void 0,function*(){yield f.run(c)})}}class F extends w{constructor(f){super(F.ID,f,f?"separator text":"separator"),this.checked=!1,this.enabled=!1}}F.ID="vs.actions.separator";class v{constructor(f,c,l,h){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=f,this.label=c,this.class=h,this._actions=l}get actions(){return this._actions}dispose(){}run(){return D(this,void 0,void 0,function*(){})}}class s extends w{constructor(){super(s.ID,G.N("submenu.empty","(empty)"),void 0,!1)}}s.ID="vs.actions.empty"},76068:function(yt,me,b){"use strict";b.d(me,{ok:function(){return I}});function I(P,G){if(!P)throw new Error(G?`Assertion failed (${G})`:"Assertion Failed")}},52615:function(yt,me,b){"use strict";b.d(me,{CM:function(){return w},JL:function(){return _},dT:function(){return v},fK:function(){return D},lA:function(){return F}});var I=b(4348);class P{constructor(){this._icons=new Map,this._onDidRegister=new I.Q5}add(y){const f=this._icons.get(y.id);f?y.description?f.description=y.description:console.error(`Duplicate registration of codicon ${y.id}`):(this._icons.set(y.id,y),this._onDidRegister.fire(y))}get(y){return this._icons.get(y)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const G=new P,D=G;function w(s,y){return new F(s,y)}function _(s){return s?s.replace(/\$\((.*?)\)/g,(y,f)=>` ${f} `).trim():""}class F{constructor(y,f,c){this.id=y,this.definition=f,this.description=c,G.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var v;(function(s){s.iconNameSegment="[A-Za-z0-9]+",s.iconNameExpression="[A-Za-z0-9\\-]+",s.iconModifierExpression="~[A-Za-z]+";const y=new RegExp(`^(${s.iconNameExpression})(${s.iconModifierExpression})?$`);function f(h){if(h instanceof F)return["codicon","codicon-"+h.id];const d=y.exec(h.id);if(!d)return f(F.error);let[,E,T]=d;const L=["codicon","codicon-"+E];return T&&L.push("codicon-modifier-"+T.substr(1)),L}s.asClassNameArray=f;function c(h){return f(h).join(" ")}s.asClassName=c;function l(h){return"."+f(h).join(".")}s.asCSSSelector=l})(v||(v={})),function(s){s.add=new s("add",{fontCharacter:"\\ea60"}),s.plus=new s("plus",s.add.definition),s.gistNew=new s("gist-new",s.add.definition),s.repoCreate=new s("repo-create",s.add.definition),s.lightbulb=new s("lightbulb",{fontCharacter:"\\ea61"}),s.lightBulb=new s("light-bulb",{fontCharacter:"\\ea61"}),s.repo=new s("repo",{fontCharacter:"\\ea62"}),s.repoDelete=new s("repo-delete",{fontCharacter:"\\ea62"}),s.gistFork=new s("gist-fork",{fontCharacter:"\\ea63"}),s.repoForked=new s("repo-forked",{fontCharacter:"\\ea63"}),s.gitPullRequest=new s("git-pull-request",{fontCharacter:"\\ea64"}),s.gitPullRequestAbandoned=new s("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),s.recordKeys=new s("record-keys",{fontCharacter:"\\ea65"}),s.keyboard=new s("keyboard",{fontCharacter:"\\ea65"}),s.tag=new s("tag",{fontCharacter:"\\ea66"}),s.tagAdd=new s("tag-add",{fontCharacter:"\\ea66"}),s.tagRemove=new s("tag-remove",{fontCharacter:"\\ea66"}),s.person=new s("person",{fontCharacter:"\\ea67"}),s.personFollow=new s("person-follow",{fontCharacter:"\\ea67"}),s.personOutline=new s("person-outline",{fontCharacter:"\\ea67"}),s.personFilled=new s("person-filled",{fontCharacter:"\\ea67"}),s.gitBranch=new s("git-branch",{fontCharacter:"\\ea68"}),s.gitBranchCreate=new s("git-branch-create",{fontCharacter:"\\ea68"}),s.gitBranchDelete=new s("git-branch-delete",{fontCharacter:"\\ea68"}),s.sourceControl=new s("source-control",{fontCharacter:"\\ea68"}),s.mirror=new s("mirror",{fontCharacter:"\\ea69"}),s.mirrorPublic=new s("mirror-public",{fontCharacter:"\\ea69"}),s.star=new s("star",{fontCharacter:"\\ea6a"}),s.starAdd=new s("star-add",{fontCharacter:"\\ea6a"}),s.starDelete=new s("star-delete",{fontCharacter:"\\ea6a"}),s.starEmpty=new s("star-empty",{fontCharacter:"\\ea6a"}),s.comment=new s("comment",{fontCharacter:"\\ea6b"}),s.commentAdd=new s("comment-add",{fontCharacter:"\\ea6b"}),s.alert=new s("alert",{fontCharacter:"\\ea6c"}),s.warning=new s("warning",{fontCharacter:"\\ea6c"}),s.search=new s("search",{fontCharacter:"\\ea6d"}),s.searchSave=new s("search-save",{fontCharacter:"\\ea6d"}),s.logOut=new s("log-out",{fontCharacter:"\\ea6e"}),s.signOut=new s("sign-out",{fontCharacter:"\\ea6e"}),s.logIn=new s("log-in",{fontCharacter:"\\ea6f"}),s.signIn=new s("sign-in",{fontCharacter:"\\ea6f"}),s.eye=new s("eye",{fontCharacter:"\\ea70"}),s.eyeUnwatch=new s("eye-unwatch",{fontCharacter:"\\ea70"}),s.eyeWatch=new s("eye-watch",{fontCharacter:"\\ea70"}),s.circleFilled=new s("circle-filled",{fontCharacter:"\\ea71"}),s.primitiveDot=new s("primitive-dot",{fontCharacter:"\\ea71"}),s.closeDirty=new s("close-dirty",{fontCharacter:"\\ea71"}),s.debugBreakpoint=new s("debug-breakpoint",{fontCharacter:"\\ea71"}),s.debugBreakpointDisabled=new s("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),s.debugHint=new s("debug-hint",{fontCharacter:"\\ea71"}),s.primitiveSquare=new s("primitive-square",{fontCharacter:"\\ea72"}),s.edit=new s("edit",{fontCharacter:"\\ea73"}),s.pencil=new s("pencil",{fontCharacter:"\\ea73"}),s.info=new s("info",{fontCharacter:"\\ea74"}),s.issueOpened=new s("issue-opened",{fontCharacter:"\\ea74"}),s.gistPrivate=new s("gist-private",{fontCharacter:"\\ea75"}),s.gitForkPrivate=new s("git-fork-private",{fontCharacter:"\\ea75"}),s.lock=new s("lock",{fontCharacter:"\\ea75"}),s.mirrorPrivate=new s("mirror-private",{fontCharacter:"\\ea75"}),s.close=new s("close",{fontCharacter:"\\ea76"}),s.removeClose=new s("remove-close",{fontCharacter:"\\ea76"}),s.x=new s("x",{fontCharacter:"\\ea76"}),s.repoSync=new s("repo-sync",{fontCharacter:"\\ea77"}),s.sync=new s("sync",{fontCharacter:"\\ea77"}),s.clone=new s("clone",{fontCharacter:"\\ea78"}),s.desktopDownload=new s("desktop-download",{fontCharacter:"\\ea78"}),s.beaker=new s("beaker",{fontCharacter:"\\ea79"}),s.microscope=new s("microscope",{fontCharacter:"\\ea79"}),s.vm=new s("vm",{fontCharacter:"\\ea7a"}),s.deviceDesktop=new s("device-desktop",{fontCharacter:"\\ea7a"}),s.file=new s("file",{fontCharacter:"\\ea7b"}),s.fileText=new s("file-text",{fontCharacter:"\\ea7b"}),s.more=new s("more",{fontCharacter:"\\ea7c"}),s.ellipsis=new s("ellipsis",{fontCharacter:"\\ea7c"}),s.kebabHorizontal=new s("kebab-horizontal",{fontCharacter:"\\ea7c"}),s.mailReply=new s("mail-reply",{fontCharacter:"\\ea7d"}),s.reply=new s("reply",{fontCharacter:"\\ea7d"}),s.organization=new s("organization",{fontCharacter:"\\ea7e"}),s.organizationFilled=new s("organization-filled",{fontCharacter:"\\ea7e"}),s.organizationOutline=new s("organization-outline",{fontCharacter:"\\ea7e"}),s.newFile=new s("new-file",{fontCharacter:"\\ea7f"}),s.fileAdd=new s("file-add",{fontCharacter:"\\ea7f"}),s.newFolder=new s("new-folder",{fontCharacter:"\\ea80"}),s.fileDirectoryCreate=new s("file-directory-create",{fontCharacter:"\\ea80"}),s.trash=new s("trash",{fontCharacter:"\\ea81"}),s.trashcan=new s("trashcan",{fontCharacter:"\\ea81"}),s.history=new s("history",{fontCharacter:"\\ea82"}),s.clock=new s("clock",{fontCharacter:"\\ea82"}),s.folder=new s("folder",{fontCharacter:"\\ea83"}),s.fileDirectory=new s("file-directory",{fontCharacter:"\\ea83"}),s.symbolFolder=new s("symbol-folder",{fontCharacter:"\\ea83"}),s.logoGithub=new s("logo-github",{fontCharacter:"\\ea84"}),s.markGithub=new s("mark-github",{fontCharacter:"\\ea84"}),s.github=new s("github",{fontCharacter:"\\ea84"}),s.terminal=new s("terminal",{fontCharacter:"\\ea85"}),s.console=new s("console",{fontCharacter:"\\ea85"}),s.repl=new s("repl",{fontCharacter:"\\ea85"}),s.zap=new s("zap",{fontCharacter:"\\ea86"}),s.symbolEvent=new s("symbol-event",{fontCharacter:"\\ea86"}),s.error=new s("error",{fontCharacter:"\\ea87"}),s.stop=new s("stop",{fontCharacter:"\\ea87"}),s.variable=new s("variable",{fontCharacter:"\\ea88"}),s.symbolVariable=new s("symbol-variable",{fontCharacter:"\\ea88"}),s.array=new s("array",{fontCharacter:"\\ea8a"}),s.symbolArray=new s("symbol-array",{fontCharacter:"\\ea8a"}),s.symbolModule=new s("symbol-module",{fontCharacter:"\\ea8b"}),s.symbolPackage=new s("symbol-package",{fontCharacter:"\\ea8b"}),s.symbolNamespace=new s("symbol-namespace",{fontCharacter:"\\ea8b"}),s.symbolObject=new s("symbol-object",{fontCharacter:"\\ea8b"}),s.symbolMethod=new s("symbol-method",{fontCharacter:"\\ea8c"}),s.symbolFunction=new s("symbol-function",{fontCharacter:"\\ea8c"}),s.symbolConstructor=new s("symbol-constructor",{fontCharacter:"\\ea8c"}),s.symbolBoolean=new s("symbol-boolean",{fontCharacter:"\\ea8f"}),s.symbolNull=new s("symbol-null",{fontCharacter:"\\ea8f"}),s.symbolNumeric=new s("symbol-numeric",{fontCharacter:"\\ea90"}),s.symbolNumber=new s("symbol-number",{fontCharacter:"\\ea90"}),s.symbolStructure=new s("symbol-structure",{fontCharacter:"\\ea91"}),s.symbolStruct=new s("symbol-struct",{fontCharacter:"\\ea91"}),s.symbolParameter=new s("symbol-parameter",{fontCharacter:"\\ea92"}),s.symbolTypeParameter=new s("symbol-type-parameter",{fontCharacter:"\\ea92"}),s.symbolKey=new s("symbol-key",{fontCharacter:"\\ea93"}),s.symbolText=new s("symbol-text",{fontCharacter:"\\ea93"}),s.symbolReference=new s("symbol-reference",{fontCharacter:"\\ea94"}),s.goToFile=new s("go-to-file",{fontCharacter:"\\ea94"}),s.symbolEnum=new s("symbol-enum",{fontCharacter:"\\ea95"}),s.symbolValue=new s("symbol-value",{fontCharacter:"\\ea95"}),s.symbolRuler=new s("symbol-ruler",{fontCharacter:"\\ea96"}),s.symbolUnit=new s("symbol-unit",{fontCharacter:"\\ea96"}),s.activateBreakpoints=new s("activate-breakpoints",{fontCharacter:"\\ea97"}),s.archive=new s("archive",{fontCharacter:"\\ea98"}),s.arrowBoth=new s("arrow-both",{fontCharacter:"\\ea99"}),s.arrowDown=new s("arrow-down",{fontCharacter:"\\ea9a"}),s.arrowLeft=new s("arrow-left",{fontCharacter:"\\ea9b"}),s.arrowRight=new s("arrow-right",{fontCharacter:"\\ea9c"}),s.arrowSmallDown=new s("arrow-small-down",{fontCharacter:"\\ea9d"}),s.arrowSmallLeft=new s("arrow-small-left",{fontCharacter:"\\ea9e"}),s.arrowSmallRight=new s("arrow-small-right",{fontCharacter:"\\ea9f"}),s.arrowSmallUp=new s("arrow-small-up",{fontCharacter:"\\eaa0"}),s.arrowUp=new s("arrow-up",{fontCharacter:"\\eaa1"}),s.bell=new s("bell",{fontCharacter:"\\eaa2"}),s.bold=new s("bold",{fontCharacter:"\\eaa3"}),s.book=new s("book",{fontCharacter:"\\eaa4"}),s.bookmark=new s("bookmark",{fontCharacter:"\\eaa5"}),s.debugBreakpointConditionalUnverified=new s("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),s.debugBreakpointConditional=new s("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),s.debugBreakpointConditionalDisabled=new s("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),s.debugBreakpointDataUnverified=new s("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),s.debugBreakpointData=new s("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),s.debugBreakpointDataDisabled=new s("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),s.debugBreakpointLogUnverified=new s("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),s.debugBreakpointLog=new s("debug-breakpoint-log",{fontCharacter:"\\eaab"}),s.debugBreakpointLogDisabled=new s("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),s.briefcase=new s("briefcase",{fontCharacter:"\\eaac"}),s.broadcast=new s("broadcast",{fontCharacter:"\\eaad"}),s.browser=new s("browser",{fontCharacter:"\\eaae"}),s.bug=new s("bug",{fontCharacter:"\\eaaf"}),s.calendar=new s("calendar",{fontCharacter:"\\eab0"}),s.caseSensitive=new s("case-sensitive",{fontCharacter:"\\eab1"}),s.check=new s("check",{fontCharacter:"\\eab2"}),s.checklist=new s("checklist",{fontCharacter:"\\eab3"}),s.chevronDown=new s("chevron-down",{fontCharacter:"\\eab4"}),s.dropDownButton=new s("drop-down-button",s.chevronDown.definition),s.chevronLeft=new s("chevron-left",{fontCharacter:"\\eab5"}),s.chevronRight=new s("chevron-right",{fontCharacter:"\\eab6"}),s.chevronUp=new s("chevron-up",{fontCharacter:"\\eab7"}),s.chromeClose=new s("chrome-close",{fontCharacter:"\\eab8"}),s.chromeMaximize=new s("chrome-maximize",{fontCharacter:"\\eab9"}),s.chromeMinimize=new s("chrome-minimize",{fontCharacter:"\\eaba"}),s.chromeRestore=new s("chrome-restore",{fontCharacter:"\\eabb"}),s.circleOutline=new s("circle-outline",{fontCharacter:"\\eabc"}),s.debugBreakpointUnverified=new s("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),s.circleSlash=new s("circle-slash",{fontCharacter:"\\eabd"}),s.circuitBoard=new s("circuit-board",{fontCharacter:"\\eabe"}),s.clearAll=new s("clear-all",{fontCharacter:"\\eabf"}),s.clippy=new s("clippy",{fontCharacter:"\\eac0"}),s.closeAll=new s("close-all",{fontCharacter:"\\eac1"}),s.cloudDownload=new s("cloud-download",{fontCharacter:"\\eac2"}),s.cloudUpload=new s("cloud-upload",{fontCharacter:"\\eac3"}),s.code=new s("code",{fontCharacter:"\\eac4"}),s.collapseAll=new s("collapse-all",{fontCharacter:"\\eac5"}),s.colorMode=new s("color-mode",{fontCharacter:"\\eac6"}),s.commentDiscussion=new s("comment-discussion",{fontCharacter:"\\eac7"}),s.compareChanges=new s("compare-changes",{fontCharacter:"\\eafd"}),s.creditCard=new s("credit-card",{fontCharacter:"\\eac9"}),s.dash=new s("dash",{fontCharacter:"\\eacc"}),s.dashboard=new s("dashboard",{fontCharacter:"\\eacd"}),s.database=new s("database",{fontCharacter:"\\eace"}),s.debugContinue=new s("debug-continue",{fontCharacter:"\\eacf"}),s.debugDisconnect=new s("debug-disconnect",{fontCharacter:"\\ead0"}),s.debugPause=new s("debug-pause",{fontCharacter:"\\ead1"}),s.debugRestart=new s("debug-restart",{fontCharacter:"\\ead2"}),s.debugStart=new s("debug-start",{fontCharacter:"\\ead3"}),s.debugStepInto=new s("debug-step-into",{fontCharacter:"\\ead4"}),s.debugStepOut=new s("debug-step-out",{fontCharacter:"\\ead5"}),s.debugStepOver=new s("debug-step-over",{fontCharacter:"\\ead6"}),s.debugStop=new s("debug-stop",{fontCharacter:"\\ead7"}),s.debug=new s("debug",{fontCharacter:"\\ead8"}),s.deviceCameraVideo=new s("device-camera-video",{fontCharacter:"\\ead9"}),s.deviceCamera=new s("device-camera",{fontCharacter:"\\eada"}),s.deviceMobile=new s("device-mobile",{fontCharacter:"\\eadb"}),s.diffAdded=new s("diff-added",{fontCharacter:"\\eadc"}),s.diffIgnored=new s("diff-ignored",{fontCharacter:"\\eadd"}),s.diffModified=new s("diff-modified",{fontCharacter:"\\eade"}),s.diffRemoved=new s("diff-removed",{fontCharacter:"\\eadf"}),s.diffRenamed=new s("diff-renamed",{fontCharacter:"\\eae0"}),s.diff=new s("diff",{fontCharacter:"\\eae1"}),s.discard=new s("discard",{fontCharacter:"\\eae2"}),s.editorLayout=new s("editor-layout",{fontCharacter:"\\eae3"}),s.emptyWindow=new s("empty-window",{fontCharacter:"\\eae4"}),s.exclude=new s("exclude",{fontCharacter:"\\eae5"}),s.extensions=new s("extensions",{fontCharacter:"\\eae6"}),s.eyeClosed=new s("eye-closed",{fontCharacter:"\\eae7"}),s.fileBinary=new s("file-binary",{fontCharacter:"\\eae8"}),s.fileCode=new s("file-code",{fontCharacter:"\\eae9"}),s.fileMedia=new s("file-media",{fontCharacter:"\\eaea"}),s.filePdf=new s("file-pdf",{fontCharacter:"\\eaeb"}),s.fileSubmodule=new s("file-submodule",{fontCharacter:"\\eaec"}),s.fileSymlinkDirectory=new s("file-symlink-directory",{fontCharacter:"\\eaed"}),s.fileSymlinkFile=new s("file-symlink-file",{fontCharacter:"\\eaee"}),s.fileZip=new s("file-zip",{fontCharacter:"\\eaef"}),s.files=new s("files",{fontCharacter:"\\eaf0"}),s.filter=new s("filter",{fontCharacter:"\\eaf1"}),s.flame=new s("flame",{fontCharacter:"\\eaf2"}),s.foldDown=new s("fold-down",{fontCharacter:"\\eaf3"}),s.foldUp=new s("fold-up",{fontCharacter:"\\eaf4"}),s.fold=new s("fold",{fontCharacter:"\\eaf5"}),s.folderActive=new s("folder-active",{fontCharacter:"\\eaf6"}),s.folderOpened=new s("folder-opened",{fontCharacter:"\\eaf7"}),s.gear=new s("gear",{fontCharacter:"\\eaf8"}),s.gift=new s("gift",{fontCharacter:"\\eaf9"}),s.gistSecret=new s("gist-secret",{fontCharacter:"\\eafa"}),s.gist=new s("gist",{fontCharacter:"\\eafb"}),s.gitCommit=new s("git-commit",{fontCharacter:"\\eafc"}),s.gitCompare=new s("git-compare",{fontCharacter:"\\eafd"}),s.gitMerge=new s("git-merge",{fontCharacter:"\\eafe"}),s.githubAction=new s("github-action",{fontCharacter:"\\eaff"}),s.githubAlt=new s("github-alt",{fontCharacter:"\\eb00"}),s.globe=new s("globe",{fontCharacter:"\\eb01"}),s.grabber=new s("grabber",{fontCharacter:"\\eb02"}),s.graph=new s("graph",{fontCharacter:"\\eb03"}),s.gripper=new s("gripper",{fontCharacter:"\\eb04"}),s.heart=new s("heart",{fontCharacter:"\\eb05"}),s.home=new s("home",{fontCharacter:"\\eb06"}),s.horizontalRule=new s("horizontal-rule",{fontCharacter:"\\eb07"}),s.hubot=new s("hubot",{fontCharacter:"\\eb08"}),s.inbox=new s("inbox",{fontCharacter:"\\eb09"}),s.issueClosed=new s("issue-closed",{fontCharacter:"\\eba4"}),s.issueReopened=new s("issue-reopened",{fontCharacter:"\\eb0b"}),s.issues=new s("issues",{fontCharacter:"\\eb0c"}),s.italic=new s("italic",{fontCharacter:"\\eb0d"}),s.jersey=new s("jersey",{fontCharacter:"\\eb0e"}),s.json=new s("json",{fontCharacter:"\\eb0f"}),s.kebabVertical=new s("kebab-vertical",{fontCharacter:"\\eb10"}),s.key=new s("key",{fontCharacter:"\\eb11"}),s.law=new s("law",{fontCharacter:"\\eb12"}),s.lightbulbAutofix=new s("lightbulb-autofix",{fontCharacter:"\\eb13"}),s.linkExternal=new s("link-external",{fontCharacter:"\\eb14"}),s.link=new s("link",{fontCharacter:"\\eb15"}),s.listOrdered=new s("list-ordered",{fontCharacter:"\\eb16"}),s.listUnordered=new s("list-unordered",{fontCharacter:"\\eb17"}),s.liveShare=new s("live-share",{fontCharacter:"\\eb18"}),s.loading=new s("loading",{fontCharacter:"\\eb19"}),s.location=new s("location",{fontCharacter:"\\eb1a"}),s.mailRead=new s("mail-read",{fontCharacter:"\\eb1b"}),s.mail=new s("mail",{fontCharacter:"\\eb1c"}),s.markdown=new s("markdown",{fontCharacter:"\\eb1d"}),s.megaphone=new s("megaphone",{fontCharacter:"\\eb1e"}),s.mention=new s("mention",{fontCharacter:"\\eb1f"}),s.milestone=new s("milestone",{fontCharacter:"\\eb20"}),s.mortarBoard=new s("mortar-board",{fontCharacter:"\\eb21"}),s.move=new s("move",{fontCharacter:"\\eb22"}),s.multipleWindows=new s("multiple-windows",{fontCharacter:"\\eb23"}),s.mute=new s("mute",{fontCharacter:"\\eb24"}),s.noNewline=new s("no-newline",{fontCharacter:"\\eb25"}),s.note=new s("note",{fontCharacter:"\\eb26"}),s.octoface=new s("octoface",{fontCharacter:"\\eb27"}),s.openPreview=new s("open-preview",{fontCharacter:"\\eb28"}),s.package_=new s("package",{fontCharacter:"\\eb29"}),s.paintcan=new s("paintcan",{fontCharacter:"\\eb2a"}),s.pin=new s("pin",{fontCharacter:"\\eb2b"}),s.play=new s("play",{fontCharacter:"\\eb2c"}),s.run=new s("run",{fontCharacter:"\\eb2c"}),s.plug=new s("plug",{fontCharacter:"\\eb2d"}),s.preserveCase=new s("preserve-case",{fontCharacter:"\\eb2e"}),s.preview=new s("preview",{fontCharacter:"\\eb2f"}),s.project=new s("project",{fontCharacter:"\\eb30"}),s.pulse=new s("pulse",{fontCharacter:"\\eb31"}),s.question=new s("question",{fontCharacter:"\\eb32"}),s.quote=new s("quote",{fontCharacter:"\\eb33"}),s.radioTower=new s("radio-tower",{fontCharacter:"\\eb34"}),s.reactions=new s("reactions",{fontCharacter:"\\eb35"}),s.references=new s("references",{fontCharacter:"\\eb36"}),s.refresh=new s("refresh",{fontCharacter:"\\eb37"}),s.regex=new s("regex",{fontCharacter:"\\eb38"}),s.remoteExplorer=new s("remote-explorer",{fontCharacter:"\\eb39"}),s.remote=new s("remote",{fontCharacter:"\\eb3a"}),s.remove=new s("remove",{fontCharacter:"\\eb3b"}),s.replaceAll=new s("replace-all",{fontCharacter:"\\eb3c"}),s.replace=new s("replace",{fontCharacter:"\\eb3d"}),s.repoClone=new s("repo-clone",{fontCharacter:"\\eb3e"}),s.repoForcePush=new s("repo-force-push",{fontCharacter:"\\eb3f"}),s.repoPull=new s("repo-pull",{fontCharacter:"\\eb40"}),s.repoPush=new s("repo-push",{fontCharacter:"\\eb41"}),s.report=new s("report",{fontCharacter:"\\eb42"}),s.requestChanges=new s("request-changes",{fontCharacter:"\\eb43"}),s.rocket=new s("rocket",{fontCharacter:"\\eb44"}),s.rootFolderOpened=new s("root-folder-opened",{fontCharacter:"\\eb45"}),s.rootFolder=new s("root-folder",{fontCharacter:"\\eb46"}),s.rss=new s("rss",{fontCharacter:"\\eb47"}),s.ruby=new s("ruby",{fontCharacter:"\\eb48"}),s.saveAll=new s("save-all",{fontCharacter:"\\eb49"}),s.saveAs=new s("save-as",{fontCharacter:"\\eb4a"}),s.save=new s("save",{fontCharacter:"\\eb4b"}),s.screenFull=new s("screen-full",{fontCharacter:"\\eb4c"}),s.screenNormal=new s("screen-normal",{fontCharacter:"\\eb4d"}),s.searchStop=new s("search-stop",{fontCharacter:"\\eb4e"}),s.server=new s("server",{fontCharacter:"\\eb50"}),s.settingsGear=new s("settings-gear",{fontCharacter:"\\eb51"}),s.settings=new s("settings",{fontCharacter:"\\eb52"}),s.shield=new s("shield",{fontCharacter:"\\eb53"}),s.smiley=new s("smiley",{fontCharacter:"\\eb54"}),s.sortPrecedence=new s("sort-precedence",{fontCharacter:"\\eb55"}),s.splitHorizontal=new s("split-horizontal",{fontCharacter:"\\eb56"}),s.splitVertical=new s("split-vertical",{fontCharacter:"\\eb57"}),s.squirrel=new s("squirrel",{fontCharacter:"\\eb58"}),s.starFull=new s("star-full",{fontCharacter:"\\eb59"}),s.starHalf=new s("star-half",{fontCharacter:"\\eb5a"}),s.symbolClass=new s("symbol-class",{fontCharacter:"\\eb5b"}),s.symbolColor=new s("symbol-color",{fontCharacter:"\\eb5c"}),s.symbolConstant=new s("symbol-constant",{fontCharacter:"\\eb5d"}),s.symbolEnumMember=new s("symbol-enum-member",{fontCharacter:"\\eb5e"}),s.symbolField=new s("symbol-field",{fontCharacter:"\\eb5f"}),s.symbolFile=new s("symbol-file",{fontCharacter:"\\eb60"}),s.symbolInterface=new s("symbol-interface",{fontCharacter:"\\eb61"}),s.symbolKeyword=new s("symbol-keyword",{fontCharacter:"\\eb62"}),s.symbolMisc=new s("symbol-misc",{fontCharacter:"\\eb63"}),s.symbolOperator=new s("symbol-operator",{fontCharacter:"\\eb64"}),s.symbolProperty=new s("symbol-property",{fontCharacter:"\\eb65"}),s.wrench=new s("wrench",{fontCharacter:"\\eb65"}),s.wrenchSubaction=new s("wrench-subaction",{fontCharacter:"\\eb65"}),s.symbolSnippet=new s("symbol-snippet",{fontCharacter:"\\eb66"}),s.tasklist=new s("tasklist",{fontCharacter:"\\eb67"}),s.telescope=new s("telescope",{fontCharacter:"\\eb68"}),s.textSize=new s("text-size",{fontCharacter:"\\eb69"}),s.threeBars=new s("three-bars",{fontCharacter:"\\eb6a"}),s.thumbsdown=new s("thumbsdown",{fontCharacter:"\\eb6b"}),s.thumbsup=new s("thumbsup",{fontCharacter:"\\eb6c"}),s.tools=new s("tools",{fontCharacter:"\\eb6d"}),s.triangleDown=new s("triangle-down",{fontCharacter:"\\eb6e"}),s.triangleLeft=new s("triangle-left",{fontCharacter:"\\eb6f"}),s.triangleRight=new s("triangle-right",{fontCharacter:"\\eb70"}),s.triangleUp=new s("triangle-up",{fontCharacter:"\\eb71"}),s.twitter=new s("twitter",{fontCharacter:"\\eb72"}),s.unfold=new s("unfold",{fontCharacter:"\\eb73"}),s.unlock=new s("unlock",{fontCharacter:"\\eb74"}),s.unmute=new s("unmute",{fontCharacter:"\\eb75"}),s.unverified=new s("unverified",{fontCharacter:"\\eb76"}),s.verified=new s("verified",{fontCharacter:"\\eb77"}),s.versions=new s("versions",{fontCharacter:"\\eb78"}),s.vmActive=new s("vm-active",{fontCharacter:"\\eb79"}),s.vmOutline=new s("vm-outline",{fontCharacter:"\\eb7a"}),s.vmRunning=new s("vm-running",{fontCharacter:"\\eb7b"}),s.watch=new s("watch",{fontCharacter:"\\eb7c"}),s.whitespace=new s("whitespace",{fontCharacter:"\\eb7d"}),s.wholeWord=new s("whole-word",{fontCharacter:"\\eb7e"}),s.window=new s("window",{fontCharacter:"\\eb7f"}),s.wordWrap=new s("word-wrap",{fontCharacter:"\\eb80"}),s.zoomIn=new s("zoom-in",{fontCharacter:"\\eb81"}),s.zoomOut=new s("zoom-out",{fontCharacter:"\\eb82"}),s.listFilter=new s("list-filter",{fontCharacter:"\\eb83"}),s.listFlat=new s("list-flat",{fontCharacter:"\\eb84"}),s.listSelection=new s("list-selection",{fontCharacter:"\\eb85"}),s.selection=new s("selection",{fontCharacter:"\\eb85"}),s.listTree=new s("list-tree",{fontCharacter:"\\eb86"}),s.debugBreakpointFunctionUnverified=new s("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),s.debugBreakpointFunction=new s("debug-breakpoint-function",{fontCharacter:"\\eb88"}),s.debugBreakpointFunctionDisabled=new s("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),s.debugStackframeActive=new s("debug-stackframe-active",{fontCharacter:"\\eb89"}),s.debugStackframeDot=new s("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),s.debugStackframe=new s("debug-stackframe",{fontCharacter:"\\eb8b"}),s.debugStackframeFocused=new s("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),s.debugBreakpointUnsupported=new s("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),s.symbolString=new s("symbol-string",{fontCharacter:"\\eb8d"}),s.debugReverseContinue=new s("debug-reverse-continue",{fontCharacter:"\\eb8e"}),s.debugStepBack=new s("debug-step-back",{fontCharacter:"\\eb8f"}),s.debugRestartFrame=new s("debug-restart-frame",{fontCharacter:"\\eb90"}),s.callIncoming=new s("call-incoming",{fontCharacter:"\\eb92"}),s.callOutgoing=new s("call-outgoing",{fontCharacter:"\\eb93"}),s.menu=new s("menu",{fontCharacter:"\\eb94"}),s.expandAll=new s("expand-all",{fontCharacter:"\\eb95"}),s.feedback=new s("feedback",{fontCharacter:"\\eb96"}),s.groupByRefType=new s("group-by-ref-type",{fontCharacter:"\\eb97"}),s.ungroupByRefType=new s("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),s.account=new s("account",{fontCharacter:"\\eb99"}),s.bellDot=new s("bell-dot",{fontCharacter:"\\eb9a"}),s.debugConsole=new s("debug-console",{fontCharacter:"\\eb9b"}),s.library=new s("library",{fontCharacter:"\\eb9c"}),s.output=new s("output",{fontCharacter:"\\eb9d"}),s.runAll=new s("run-all",{fontCharacter:"\\eb9e"}),s.syncIgnored=new s("sync-ignored",{fontCharacter:"\\eb9f"}),s.pinned=new s("pinned",{fontCharacter:"\\eba0"}),s.githubInverted=new s("github-inverted",{fontCharacter:"\\eba1"}),s.debugAlt=new s("debug-alt",{fontCharacter:"\\eb91"}),s.serverProcess=new s("server-process",{fontCharacter:"\\eba2"}),s.serverEnvironment=new s("server-environment",{fontCharacter:"\\eba3"}),s.pass=new s("pass",{fontCharacter:"\\eba4"}),s.stopCircle=new s("stop-circle",{fontCharacter:"\\eba5"}),s.playCircle=new s("play-circle",{fontCharacter:"\\eba6"}),s.record=new s("record",{fontCharacter:"\\eba7"}),s.debugAltSmall=new s("debug-alt-small",{fontCharacter:"\\eba8"}),s.vmConnect=new s("vm-connect",{fontCharacter:"\\eba9"}),s.cloud=new s("cloud",{fontCharacter:"\\ebaa"}),s.merge=new s("merge",{fontCharacter:"\\ebab"}),s.exportIcon=new s("export",{fontCharacter:"\\ebac"}),s.graphLeft=new s("graph-left",{fontCharacter:"\\ebad"}),s.magnet=new s("magnet",{fontCharacter:"\\ebae"}),s.notebook=new s("notebook",{fontCharacter:"\\ebaf"}),s.redo=new s("redo",{fontCharacter:"\\ebb0"}),s.checkAll=new s("check-all",{fontCharacter:"\\ebb1"}),s.pinnedDirty=new s("pinned-dirty",{fontCharacter:"\\ebb2"}),s.passFilled=new s("pass-filled",{fontCharacter:"\\ebb3"}),s.circleLargeFilled=new s("circle-large-filled",{fontCharacter:"\\ebb4"}),s.circleLargeOutline=new s("circle-large-outline",{fontCharacter:"\\ebb5"}),s.combine=new s("combine",{fontCharacter:"\\ebb6"}),s.gather=new s("gather",{fontCharacter:"\\ebb6"}),s.table=new s("table",{fontCharacter:"\\ebb7"}),s.variableGroup=new s("variable-group",{fontCharacter:"\\ebb8"}),s.typeHierarchy=new s("type-hierarchy",{fontCharacter:"\\ebb9"}),s.typeHierarchySub=new s("type-hierarchy-sub",{fontCharacter:"\\ebba"}),s.typeHierarchySuper=new s("type-hierarchy-super",{fontCharacter:"\\ebbb"}),s.gitPullRequestCreate=new s("git-pull-request-create",{fontCharacter:"\\ebbc"}),s.runAbove=new s("run-above",{fontCharacter:"\\ebbd"}),s.runBelow=new s("run-below",{fontCharacter:"\\ebbe"}),s.notebookTemplate=new s("notebook-template",{fontCharacter:"\\ebbf"}),s.debugRerun=new s("debug-rerun",{fontCharacter:"\\ebc0"}),s.workspaceTrusted=new s("workspace-trusted",{fontCharacter:"\\ebc1"}),s.workspaceUntrusted=new s("workspace-untrusted",{fontCharacter:"\\ebc2"}),s.workspaceUnspecified=new s("workspace-unspecified",{fontCharacter:"\\ebc3"}),s.terminalCmd=new s("terminal-cmd",{fontCharacter:"\\ebc4"}),s.terminalDebian=new s("terminal-debian",{fontCharacter:"\\ebc5"}),s.terminalLinux=new s("terminal-linux",{fontCharacter:"\\ebc6"}),s.terminalPowershell=new s("terminal-powershell",{fontCharacter:"\\ebc7"}),s.terminalTmux=new s("terminal-tmux",{fontCharacter:"\\ebc8"}),s.terminalUbuntu=new s("terminal-ubuntu",{fontCharacter:"\\ebc9"}),s.terminalBash=new s("terminal-bash",{fontCharacter:"\\ebca"}),s.arrowSwap=new s("arrow-swap",{fontCharacter:"\\ebcb"}),s.copy=new s("copy",{fontCharacter:"\\ebcc"}),s.personAdd=new s("person-add",{fontCharacter:"\\ebcd"}),s.filterFilled=new s("filter-filled",{fontCharacter:"\\ebce"}),s.wand=new s("wand",{fontCharacter:"\\ebcf"}),s.debugLineByLine=new s("debug-line-by-line",{fontCharacter:"\\ebd0"}),s.inspect=new s("inspect",{fontCharacter:"\\ebd1"}),s.layers=new s("layers",{fontCharacter:"\\ebd2"}),s.layersDot=new s("layers-dot",{fontCharacter:"\\ebd3"}),s.layersActive=new s("layers-active",{fontCharacter:"\\ebd4"}),s.compass=new s("compass",{fontCharacter:"\\ebd5"}),s.compassDot=new s("compass-dot",{fontCharacter:"\\ebd6"}),s.compassActive=new s("compass-active",{fontCharacter:"\\ebd7"}),s.azure=new s("azure",{fontCharacter:"\\ebd8"}),s.issueDraft=new s("issue-draft",{fontCharacter:"\\ebd9"}),s.gitPullRequestClosed=new s("git-pull-request-closed",{fontCharacter:"\\ebda"}),s.gitPullRequestDraft=new s("git-pull-request-draft",{fontCharacter:"\\ebdb"}),s.debugAll=new s("debug-all",{fontCharacter:"\\ebdc"}),s.debugCoverage=new s("debug-coverage",{fontCharacter:"\\ebdd"}),s.runErrors=new s("run-errors",{fontCharacter:"\\ebde"}),s.folderLibrary=new s("folder-library",{fontCharacter:"\\ebdf"}),s.debugContinueSmall=new s("debug-continue-small",{fontCharacter:"\\ebe0"}),s.beakerStop=new s("beaker-stop",{fontCharacter:"\\ebe1"}),s.graphLine=new s("graph-line",{fontCharacter:"\\ebe2"}),s.graphScatter=new s("graph-scatter",{fontCharacter:"\\ebe3"}),s.pieChart=new s("pie-chart",{fontCharacter:"\\ebe4"}),s.bracket=new s("bracket",s.json.definition),s.bracketDot=new s("bracket-dot",{fontCharacter:"\\ebe5"}),s.bracketError=new s("bracket-error",{fontCharacter:"\\ebe6"}),s.lockSmall=new s("lock-small",{fontCharacter:"\\ebe7"}),s.azureDevops=new s("azure-devops",{fontCharacter:"\\ebe8"}),s.verifiedFilled=new s("verified-filled",{fontCharacter:"\\ebe9"})}(F||(F={}))},79881:function(yt,me,b){"use strict";b.d(me,{B8:function(){return f},Cp:function(){return D},F0:function(){return v},L6:function(){return y},VV:function(){return F},b1:function(){return s},dL:function(){return G},ri:function(){return w}});class I{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(l){setTimeout(()=>{throw l.stack?new Error(l.message+`
|
|
|
|
|
|
`+l.stack):l},0)}}emit(l){this.listeners.forEach(h=>{h(l)})}onUnexpectedError(l){this.unexpectedErrorHandler(l),this.emit(l)}onUnexpectedExternalError(l){this.unexpectedErrorHandler(l)}}const P=new I;function G(c){F(c)||P.onUnexpectedError(c)}function D(c){F(c)||P.onUnexpectedExternalError(c)}function w(c){if(c instanceof Error){let{name:l,message:h}=c;const d=c.stacktrace||c.stack;return{$isError:!0,name:l,message:h,stack:d}}return c}const _="Canceled";function F(c){return c instanceof Error&&c.name===_&&c.message===_}function v(){const c=new Error(_);return c.name=c.message,c}function s(c){return c?new Error(`Illegal argument: ${c}`):new Error("Illegal argument")}function y(c){return c?new Error(`Illegal state: ${c}`):new Error("Illegal state")}class f extends Error{constructor(l){super("NotSupported"),l&&(this.message=l)}}},4348:function(yt,me,b){"use strict";b.d(me,{D0:function(){return f},E7:function(){return c},K3:function(){return y},Q5:function(){return s},ZD:function(){return l},ju:function(){return w}});var I=b(79881),P=b(69323),G=b(34502),D=b(95830),w;(function(h){h.None=()=>P.JT.None;function d(Z){return(N,W=null,K)=>{let k=!1,C;return C=Z(V=>{if(!k)return C?C.dispose():k=!0,N.call(W,V)},null,K),k&&C.dispose(),C}}h.once=d;function E(Z,N){return U((W,K=null,k)=>Z(C=>W.call(K,N(C)),null,k))}h.map=E;function T(Z,N){return U((W,K=null,k)=>Z(C=>{N(C),W.call(K,C)},null,k))}h.forEach=T;function L(Z,N){return U((W,K=null,k)=>Z(C=>N(C)&&W.call(K,C),null,k))}h.filter=L;function x(Z){return Z}h.signal=x;function A(...Z){return(N,W=null,K)=>(0,P.F8)(...Z.map(k=>k(C=>N.call(W,C),null,K)))}h.any=A;function O(Z,N,W){let K=W;return E(Z,k=>(K=N(K,k),K))}h.reduce=O;function U(Z){let N;const W=new s({onFirstListenerAdd(){N=Z(W.fire,W)},onLastListenerRemove(){N.dispose()}});return W.event}function B(Z,N,W=100,K=!1,k){let C,V,ne,pe=0;const Te=new s({leakWarningThreshold:k,onFirstListenerAdd(){C=Z(Ke=>{pe++,V=N(V,Ke),K&&!ne&&(Te.fire(V),V=void 0),clearTimeout(ne),ne=setTimeout(()=>{const ve=V;V=void 0,ne=void 0,(!K||pe>1)&&Te.fire(ve),pe=0},W)})},onLastListenerRemove(){C.dispose()}});return Te.event}h.debounce=B;function $(Z,N=(W,K)=>W===K){let W=!0,K;return L(Z,k=>{const C=W||!N(k,K);return W=!1,K=k,C})}h.latch=$;function M(Z,N){return[h.filter(Z,N),h.filter(Z,W=>!N(W))]}h.split=M;function Y(Z,N=!1,W=[]){let K=W.slice(),k=Z(ne=>{K?K.push(ne):V.fire(ne)});const C=()=>{K&&K.forEach(ne=>V.fire(ne)),K=null},V=new s({onFirstListenerAdd(){k||(k=Z(ne=>V.fire(ne)))},onFirstListenerDidAdd(){K&&(N?setTimeout(C):C())},onLastListenerRemove(){k&&k.dispose(),k=null}});return V.event}h.buffer=Y;class q{constructor(N){this.event=N}map(N){return new q(E(this.event,N))}forEach(N){return new q(T(this.event,N))}filter(N){return new q(L(this.event,N))}reduce(N,W){return new q(O(this.event,N,W))}latch(){return new q($(this.event))}debounce(N,W=100,K=!1,k){return new q(B(this.event,N,W,K,k))}on(N,W,K){return this.event(N,W,K)}once(N,W,K){return d(this.event)(N,W,K)}}function se(Z){return new q(Z)}h.chain=se;function ce(Z,N,W=K=>K){const K=(...ne)=>V.fire(W(...ne)),k=()=>Z.on(N,K),C=()=>Z.removeListener(N,K),V=new s({onFirstListenerAdd:k,onLastListenerRemove:C});return V.event}h.fromNodeEventEmitter=ce;function J(Z,N,W=K=>K){const K=(...ne)=>V.fire(W(...ne)),k=()=>Z.addEventListener(N,K),C=()=>Z.removeEventListener(N,K),V=new s({onFirstListenerAdd:k,onLastListenerRemove:C});return V.event}h.fromDOMEventEmitter=J;function z(Z){return new Promise(N=>d(Z)(N))}h.toPromise=z})(w||(w={}));class _{constructor(d){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${d}_${_._idPool++}`}start(d){this._stopWatch=new D.G(!0),this._listenerCount=d}stop(){if(this._stopWatch){const d=this._stopWatch.elapsed();this._elapsedOverall+=d,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${d.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}_._idPool=0;let F=-1;class v{constructor(d,E=Math.random().toString(18).slice(2,5)){this.customThreshold=d,this.name=E,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(d){let E=F;if(typeof this.customThreshold=="number"&&(E=this.customThreshold),E<=0||d<E)return;this._stacks||(this._stacks=new Map);const T=new Error().stack.split(`
|
|
|
`).slice(3).join(`
|
|
|
`),L=this._stacks.get(T)||0;if(this._stacks.set(T,L+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=E*.5;let x,A=0;for(const[O,U]of this._stacks)(!x||A<U)&&(x=O,A=U);console.warn(`[${this.name}] potential listener LEAK detected, having ${d} listeners already. MOST frequent listener (${A}):`),console.warn(x)}return()=>{const x=this._stacks.get(T)||0;this._stacks.set(T,x-1)}}}class s{constructor(d){var E;this._disposed=!1,this._options=d,this._leakageMon=F>0?new v(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((E=this._options)===null||E===void 0)&&E._profName?new _(this._options._profName):void 0}get event(){return this._event||(this._event=(d,E,T)=>{var L;this._listeners||(this._listeners=new G.S);const x=this._listeners.isEmpty();x&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const A=this._listeners.push(E?[d,E]:d);x&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,d,E);const O=(L=this._leakageMon)===null||L===void 0?void 0:L.check(this._listeners.size),U=(0,P.OF)(()=>{O&&O(),this._disposed||(A(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return T instanceof P.SL?T.add(U):Array.isArray(T)&&T.push(U),U}),this._event}fire(d){var E,T;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new G.S);for(let L of this._listeners)this._deliveryQueue.push([L,d]);for((E=this._perfMon)===null||E===void 0||E.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[L,x]=this._deliveryQueue.shift();try{typeof L=="function"?L.call(void 0,x):L[0].call(L[1],x)}catch(A){(0,I.dL)(A)}}(T=this._perfMon)===null||T===void 0||T.stop()}}dispose(){var d,E,T,L,x;this._disposed||(this._disposed=!0,(d=this._listeners)===null||d===void 0||d.clear(),(E=this._deliveryQueue)===null||E===void 0||E.clear(),(L=(T=this._options)===null||T===void 0?void 0:T.onLastListenerRemove)===null||L===void 0||L.call(T),(x=this._leakageMon)===null||x===void 0||x.dispose())}}class y extends s{constructor(d){super(d),this._isPaused=0,this._eventQueue=new G.S,this._mergeFn=d==null?void 0:d.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const d=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(d))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(d){this._listeners&&(this._isPaused!==0?this._eventQueue.push(d):super.fire(d))}}class f extends y{constructor(d){var E;super(d),this._delay=(E=d.delay)!==null&&E!==void 0?E:100}fire(d){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(d)}}class c{constructor(){this.buffers=[]}wrapEvent(d){return(E,T,L)=>d(x=>{const A=this.buffers[this.buffers.length-1];A?A.push(()=>E.call(T,x)):E.call(T,x)},void 0,L)}bufferEvents(d){const E=[];this.buffers.push(E);const T=d();return this.buffers.pop(),E.forEach(L=>L()),T}}class l{constructor(){this.listening=!1,this.inputEvent=w.None,this.inputEventListener=P.JT.None,this.emitter=new s({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(d){this.inputEvent=d,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=d(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(yt,me,b){"use strict";b.d(me,{I:function(){return I}});function I(P){const G=this;let D=!1,w;return function(){return D||(D=!0,w=P.apply(G,arguments)),w}}},88226:function(yt,me,b){"use strict";b.d(me,{$:function(){return I}});var I;(function(P){function G(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}P.is=G;const D=Object.freeze([]);function w(){return D}P.empty=w;function*_(A){yield A}P.single=_;function F(A){return A||D}P.from=F;function v(A){return!A||A[Symbol.iterator]().next().done===!0}P.isEmpty=v;function s(A){return A[Symbol.iterator]().next().value}P.first=s;function y(A,O){for(const U of A)if(O(U))return!0;return!1}P.some=y;function f(A,O){for(const U of A)if(O(U))return U}P.find=f;function*c(A,O){for(const U of A)O(U)&&(yield U)}P.filter=c;function*l(A,O){let U=0;for(const B of A)yield O(B,U++)}P.map=l;function*h(...A){for(const O of A)for(const U of O)yield U}P.concat=h;function*d(A){for(const O of A)for(const U of O)yield U}P.concatNested=d;function E(A,O,U){let B=U;for(const $ of A)B=O(B,$);return B}P.reduce=E;function*T(A,O,U=A.length){for(O<0&&(O+=A.length),U<0?U+=A.length:U>A.length&&(U=A.length);O<U;O++)yield A[O]}P.slice=T;function L(A,O=Number.POSITIVE_INFINITY){const U=[];if(O===0)return[U,A];const B=A[Symbol.iterator]();for(let $=0;$<O;$++){const M=B.next();if(M.done)return[U,P.empty()];U.push(M.value)}return[U,{[Symbol.iterator](){return B}}]}P.consume=L;function x(A,O,U=(B,$)=>B===$){const B=A[Symbol.iterator](),$=O[Symbol.iterator]();for(;;){const M=B.next(),Y=$.next();if(M.done!==Y.done)return!1;if(M.done)return!0;if(!U(M.value,Y.value))return!1}}P.equals=x})(I||(I={}))},69323:function(yt,me,b){"use strict";b.d(me,{B9:function(){return l},F8:function(){return h},JT:function(){return T},Jz:function(){return x},OF:function(){return d},SL:function(){return E},Wf:function(){return c},XK:function(){return L},dk:function(){return y}});var I=b(17845),P=b(88226);const G=!1;let D=null;function w(A){D=A}if(G){const A="__is_disposable_tracked__";w(new class{trackDisposable(O){const U=new Error("Potentially leaked disposable").stack;setTimeout(()=>{O[A]||console.log(U)},3e3)}setParent(O,U){if(O&&O!==T.None)try{O[A]=!0}catch(B){}}markAsDisposed(O){if(O&&O!==T.None)try{O[A]=!0}catch(U){}}markAsSingleton(O){}})}function _(A){return D==null||D.trackDisposable(A),A}function F(A){D==null||D.markAsDisposed(A)}function v(A,O){D==null||D.setParent(A,O)}function s(A,O){if(D)for(const U of A)D.setParent(U,O)}function y(A){return D==null||D.markAsSingleton(A),A}class f extends Error{constructor(O){super(`Encountered errors while disposing of store. Errors: [${O.join(", ")}]`),this.errors=O}}function c(A){return typeof A.dispose=="function"&&A.dispose.length===0}function l(A){if(P.$.is(A)){let O=[];for(const U of A)if(U)try{U.dispose()}catch(B){O.push(B)}if(O.length===1)throw O[0];if(O.length>1)throw new f(O);return Array.isArray(A)?[]:A}else if(A)return A.dispose(),A}function h(...A){const O=d(()=>l(A));return s(A,O),O}function d(A){const O=_({dispose:(0,I.I)(()=>{F(O),A()})});return O}class E{constructor(){this._toDispose=new Set,this._isDisposed=!1,_(this)}dispose(){this._isDisposed||(F(this),this._isDisposed=!0,this.clear())}clear(){try{l(this._toDispose.values())}finally{this._toDispose.clear()}}add(O){if(!O)return O;if(O===this)throw new Error("Cannot register a disposable on itself!");return v(O,this),this._isDisposed?E.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(O),O}}E.DISABLE_DISPOSED_WARNING=!1;class T{constructor(){this._store=new E,_(this),v(this._store,this)}dispose(){F(this),this._store.dispose()}_register(O){if(O===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(O)}}T.None=Object.freeze({dispose(){}});class L{constructor(){this._isDisposed=!1,_(this)}get value(){return this._isDisposed?void 0:this._value}set value(O){var U;this._isDisposed||O===this._value||((U=this._value)===null||U===void 0||U.dispose(),O&&v(O,this),this._value=O)}clear(){this.value=void 0}dispose(){var O;this._isDisposed=!0,F(this),(O=this._value)===null||O===void 0||O.dispose(),this._value=void 0}clearAndLeak(){const O=this._value;return this._value=void 0,O&&v(O,null),O}}class x{constructor(O){this.object=O}dispose(){}}},34502:function(yt,me,b){"use strict";b.d(me,{S:function(){return P}});class I{constructor(D){this.element=D,this.next=I.Undefined,this.prev=I.Undefined}}I.Undefined=new I(void 0);class P{constructor(){this._first=I.Undefined,this._last=I.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===I.Undefined}clear(){let D=this._first;for(;D!==I.Undefined;){const w=D.next;D.prev=I.Undefined,D.next=I.Undefined,D=w}this._first=I.Undefined,this._last=I.Undefined,this._size=0}unshift(D){return this._insert(D,!1)}push(D){return this._insert(D,!0)}_insert(D,w){const _=new I(D);if(this._first===I.Undefined)this._first=_,this._last=_;else if(w){const v=this._last;this._last=_,_.prev=v,v.next=_}else{const v=this._first;this._first=_,_.next=v,v.prev=_}this._size+=1;let F=!1;return()=>{F||(F=!0,this._remove(_))}}shift(){if(this._first!==I.Undefined){const D=this._first.element;return this._remove(this._first),D}}pop(){if(this._last!==I.Undefined){const D=this._last.element;return this._remove(this._last),D}}_remove(D){if(D.prev!==I.Undefined&&D.next!==I.Undefined){const w=D.prev;w.next=D.next,D.next.prev=w}else D.prev===I.Undefined&&D.next===I.Undefined?(this._first=I.Undefined,this._last=I.Undefined):D.next===I.Undefined?(this._last=this._last.prev,this._last.next=I.Undefined):D.prev===I.Undefined&&(this._first=this._first.next,this._first.prev=I.Undefined);this._size-=1}*[Symbol.iterator](){let D=this._first;for(;D!==I.Undefined;)yield D.element,D=D.next}}},23345:function(yt,me,b){"use strict";b.d(me,{$L:function(){return B},ED:function(){return x},IJ:function(){return O},OS:function(){return q},WE:function(){return M},dz:function(){return A},gn:function(){return $},li:function(){return d},r:function(){return J},tY:function(){return U},xS:function(){return Y}});var I=b(97671),P;const G="en";let D=!1,w=!1,_=!1,F=!1,v=!1,s=!1,y=!1,f,c=null,l=null,h;const d=typeof self=="object"?self:typeof b.g=="object"?b.g:{};let E;typeof d.vscode!="undefined"&&typeof d.vscode.process!="undefined"?E=d.vscode.process:typeof I!="undefined"&&(E=I);const T=typeof((P=E==null?void 0:E.versions)===null||P===void 0?void 0:P.electron)=="string"&&E.type==="renderer";if(typeof navigator=="object"&&!T)h=navigator.userAgent,D=h.indexOf("Windows")>=0,w=h.indexOf("Macintosh")>=0,y=(h.indexOf("Macintosh")>=0||h.indexOf("iPad")>=0||h.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_=h.indexOf("Linux")>=0,s=!0,f=navigator.language,c=f;else if(typeof E=="object"){D=E.platform==="win32",w=E.platform==="darwin",_=E.platform==="linux",F=_&&!!E.env.SNAP&&!!E.env.SNAP_REVISION,f=G,c=G;const z=E.env.VSCODE_NLS_CONFIG;if(z)try{const Z=JSON.parse(z),N=Z.availableLanguages["*"];f=Z.locale,c=N||G,l=Z._translationsConfigFile}catch(Z){}v=!0}else console.error("Unable to resolve platform.");let L=0;w?L=1:D?L=3:_&&(L=2);const x=D,A=w,O=_,U=v,B=s,$=y,M=h,Y=function(){if(d.setImmediate)return d.setImmediate.bind(d);if(typeof d.postMessage=="function"&&!d.importScripts){let N=[];d.addEventListener("message",K=>{if(K.data&&K.data.vscodeSetImmediateId)for(let k=0,C=N.length;k<C;k++){const V=N[k];if(V.id===K.data.vscodeSetImmediateId){N.splice(k,1),V.callback();return}}});let W=0;return K=>{const k=++W;N.push({id:k,callback:K}),d.postMessage({vscodeSetImmediateId:k},"*")}}if(typeof(E==null?void 0:E.nextTick)=="function")return E.nextTick.bind(E);const Z=Promise.resolve();return N=>Z.then(N)}(),q=w||y?2:D?1:3;let se=!0,ce=!1;function J(){if(!ce){ce=!0;const z=new Uint8Array(2);z[0]=1,z[1]=2,se=new Uint16Array(z.buffer)[0]===513}return se}},95830:function(yt,me,b){"use strict";b.d(me,{G:function(){return G}});var I=b(23345);const P=I.li.performance&&typeof I.li.performance.now=="function";class G{constructor(w){this._highResolution=P&&w,this._startTime=this._now(),this._stopTime=-1}static create(w=!0){return new G(w)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?I.li.performance.now():Date.now()}}},82983:function(yt,me,b){"use strict";b.d(me,{$i:function(){return pe},C8:function(){return Be},GF:function(){return f},HO:function(){return W},IO:function(){return c},K7:function(){return Ue},Kw:function(){return He},LC:function(){return d},Mh:function(){return Y},P1:function(){return q},PJ:function(){return ut},Qe:function(){return Te},R1:function(){return y},RP:function(){return V},S6:function(){return $e},TT:function(){return x},Ut:function(){return k},V8:function(){return E},WU:function(){return G},YK:function(){return ce},YU:function(){return D},ZG:function(){return se},ZH:function(){return z},ab:function(){return Ke},c1:function(){return Me},df:function(){return B},ec:function(){return w},fi:function(){return bt},fy:function(){return _},j3:function(){return F},j_:function(){return O},m5:function(){return I},mK:function(){return U},mr:function(){return l},oH:function(){return ue},oL:function(){return v},ok:function(){return M},ow:function(){return T},qq:function(){return $},qu:function(){return L},rL:function(){return J},uS:function(){return St},un:function(){return s},uq:function(){return h},vH:function(){return N},xe:function(){return ve},zY:function(){return A}});function I(ie){return!ie||typeof ie!="string"?!0:ie.trim().length===0}const P=/{(\d+)}/g;function G(ie,...fe){return fe.length===0?ie:ie.replace(P,function(De,Re){const Oe=parseInt(Re,10);return isNaN(Oe)||Oe<0||Oe>=fe.length?De:fe[Oe]})}function D(ie){return ie.replace(/[<>&]/g,function(fe){switch(fe){case"<":return"<";case">":return">";case"&":return"&";default:return fe}})}function w(ie){return ie.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function _(ie,fe=" "){const De=F(ie,fe);return v(De,fe)}function F(ie,fe){if(!ie||!fe)return ie;const De=fe.length;if(De===0||ie.length===0)return ie;let Re=0;for(;ie.indexOf(fe,Re)===Re;)Re=Re+De;return ie.substring(Re)}function v(ie,fe){if(!ie||!fe)return ie;const De=fe.length,Re=ie.length;if(De===0||Re===0)return ie;let Oe=Re,Ve=-1;for(;Ve=ie.lastIndexOf(fe,Oe-1),!(Ve===-1||Ve+De!==Oe);){if(Ve===0)return"";Oe=Ve}return ie.substring(0,Oe)}function s(ie){return ie.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function y(ie){return ie.replace(/\*/g,"")}function f(ie,fe,De={}){if(!ie)throw new Error("Cannot create regex from empty string");fe||(ie=w(ie)),De.wholeWord&&(/\B/.test(ie.charAt(0))||(ie="\\b"+ie),/\B/.test(ie.charAt(ie.length-1))||(ie=ie+"\\b"));let Re="";return De.global&&(Re+="g"),De.matchCase||(Re+="i"),De.multiline&&(Re+="m"),De.unicode&&(Re+="u"),new RegExp(ie,Re)}function c(ie){return ie.source==="^"||ie.source==="^$"||ie.source==="$"||ie.source==="^\\s*$"?!1:!!(ie.exec("")&&ie.lastIndex===0)}function l(ie){return(ie.global?"g":"")+(ie.ignoreCase?"i":"")+(ie.multiline?"m":"")+(ie.unicode?"u":"")}function h(ie){return ie.split(/\r\n|\r|\n/)}function d(ie){for(let fe=0,De=ie.length;fe<De;fe++){const Re=ie.charCodeAt(fe);if(Re!==32&&Re!==9)return fe}return-1}function E(ie,fe=0,De=ie.length){for(let Re=fe;Re<De;Re++){const Oe=ie.charCodeAt(Re);if(Oe!==32&&Oe!==9)return ie.substring(fe,Re)}return ie.substring(fe,De)}function T(ie,fe=ie.length-1){for(let De=fe;De>=0;De--){const Re=ie.charCodeAt(De);if(Re!==32&&Re!==9)return De}return-1}function L(ie,fe){return ie<fe?-1:ie>fe?1:0}function x(ie,fe,De=0,Re=ie.length,Oe=0,Ve=fe.length){for(;De<Re&&Oe<Ve;De++,Oe++){let Ze=ie.charCodeAt(De),Xe=fe.charCodeAt(Oe);if(Ze<Xe)return-1;if(Ze>Xe)return 1}const lt=Re-De,Qe=Ve-Oe;return lt<Qe?-1:lt>Qe?1:0}function A(ie,fe){return O(ie,fe,0,ie.length,0,fe.length)}function O(ie,fe,De=0,Re=ie.length,Oe=0,Ve=fe.length){for(;De<Re&&Oe<Ve;De++,Oe++){let Ze=ie.charCodeAt(De),Xe=fe.charCodeAt(Oe);if(Ze===Xe)continue;if(Ze>=128||Xe>=128)return x(ie.toLowerCase(),fe.toLowerCase(),De,Re,Oe,Ve);U(Ze)&&(Ze-=32),U(Xe)&&(Xe-=32);const ht=Ze-Xe;if(ht!==0)return ht}const lt=Re-De,Qe=Ve-Oe;return lt<Qe?-1:lt>Qe?1:0}function U(ie){return ie>=97&&ie<=122}function B(ie){return ie>=65&&ie<=90}function $(ie,fe){return ie.length===fe.length&&O(ie,fe)===0}function M(ie,fe){const De=fe.length;return fe.length>ie.length?!1:O(ie,fe,0,De)===0}function Y(ie,fe){let De,Re=Math.min(ie.length,fe.length);for(De=0;De<Re;De++)if(ie.charCodeAt(De)!==fe.charCodeAt(De))return De;return Re}function q(ie,fe){let De,Re=Math.min(ie.length,fe.length);const Oe=ie.length-1,Ve=fe.length-1;for(De=0;De<Re;De++)if(ie.charCodeAt(Oe-De)!==fe.charCodeAt(Ve-De))return De;return Re}function se(ie){return 55296<=ie&&ie<=56319}function ce(ie){return 56320<=ie&&ie<=57343}function J(ie,fe){return(ie-55296<<10)+(fe-56320)+65536}function z(ie,fe,De){const Re=ie.charCodeAt(De);if(se(Re)&&De+1<fe){const Oe=ie.charCodeAt(De+1);if(ce(Oe))return J(Re,Oe)}return Re}function Z(ie,fe){const De=ie.charCodeAt(fe-1);if(ce(De)&&fe>1){const Re=ie.charCodeAt(fe-2);if(se(Re))return J(Re,De)}return De}function N(ie,fe){const De=Ee.getInstance(),Re=fe,Oe=ie.length,Ve=z(ie,Oe,fe);fe+=Ve>=65536?2:1;let lt=De.getGraphemeBreakType(Ve);for(;fe<Oe;){const Qe=z(ie,Oe,fe),Ze=De.getGraphemeBreakType(Qe);if(bt(lt,Ze))break;fe+=Qe>=65536?2:1,lt=Ze}return fe-Re}function W(ie,fe){const De=Ee.getInstance(),Re=fe,Oe=Z(ie,fe);fe-=Oe>=65536?2:1;let Ve=De.getGraphemeBreakType(Oe);for(;fe>0;){const lt=Z(ie,fe),Qe=De.getGraphemeBreakType(lt);if(bt(Qe,Ve))break;fe-=lt>=65536?2:1,Ve=Qe}return Re-fe}const K=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function k(ie){return K.test(ie)}const C=/(?:[\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 V(ie){return C.test(ie)}const ne=/^[\t\n\r\x20-\x7E]*$/;function pe(ie){return ne.test(ie)}const Te=/[\u2028\u2029]/;function Ke(ie){return Te.test(ie)}function ve(ie){for(let fe=0,De=ie.length;fe<De;fe++)if(Ue(ie.charCodeAt(fe)))return!0;return!1}function Ue(ie){return ie=+ie,ie>=11904&&ie<=55215||ie>=63744&&ie<=64255||ie>=65281&&ie<=65374}function Be(ie){return ie>=127462&&ie<=127487||ie===8986||ie===8987||ie===9200||ie===9203||ie>=9728&&ie<=10175||ie===11088||ie===11093||ie>=127744&&ie<=128591||ie>=128640&&ie<=128764||ie>=128992&&ie<=129003||ie>=129280&&ie<=129535||ie>=129648&&ie<=129750}const Me="\uFEFF";function St(ie){return!!(ie&&ie.length>0&&ie.charCodeAt(0)===65279)}function He(ie,fe=!1){return ie?(fe&&(ie=ie.replace(/\\./g,"")),ie.toLowerCase()!==ie):!1}function ut(ie){return ie=ie%(2*26),ie<26?String.fromCharCode(97+ie):String.fromCharCode(65+ie-26)}function $e(ie){return Ee.getInstance().getGraphemeBreakType(ie)}function bt(ie,fe){return ie===0?fe!==5&&fe!==7:ie===2&&fe===3?!1:ie===4||ie===2||ie===3||fe===4||fe===2||fe===3?!0:!(ie===8&&(fe===8||fe===9||fe===11||fe===12)||(ie===11||ie===9)&&(fe===9||fe===10)||(ie===12||ie===10)&&fe===10||fe===5||fe===13||fe===7||ie===1||ie===13&&fe===14||ie===6&&fe===6)}class Ee{constructor(){this._data=be()}static getInstance(){return Ee._INSTANCE||(Ee._INSTANCE=new Ee),Ee._INSTANCE}getGraphemeBreakType(fe){if(fe<32)return fe===10?3:fe===13?2:4;if(fe<127)return 0;const De=this._data,Re=De.length/3;let Oe=1;for(;Oe<=Re;)if(fe<De[3*Oe])Oe=2*Oe;else if(fe>De[3*Oe+1])Oe=2*Oe+1;else return De[3*Oe+2];return 0}}Ee._INSTANCE=null;function be(){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 ue(ie,fe){if(ie===0)return 0;const De=ke(ie,fe);if(De!==void 0)return De;const Re=Z(fe,ie);return ie-=Fe(Re),ie}function ke(ie,fe){let De=Z(fe,ie);for(ie-=Fe(De);We(De)||De===65039||De===8419;){if(ie===0)return;De=Z(fe,ie),ie-=Fe(De)}if(Be(De)){if(ie>=0){const Re=Z(fe,ie);Re===8205&&(ie-=Fe(Re))}return ie}}function Fe(ie){return ie>=65536?2:1}function We(ie){return 127995<=ie&&ie<=127999}},72999:function(yt,me,b){"use strict";b.d(me,{$E:function(){return d},$K:function(){return F},D8:function(){return c},HD:function(){return P},IU:function(){return E},Jp:function(){return v},Kn:function(){return G},cW:function(){return y},f6:function(){return T},hj:function(){return D},jn:function(){return w},kJ:function(){return I},mf:function(){return f},o8:function(){return _},p_:function(){return s},vE:function(){return L}});function I(x){return Array.isArray(x)}function P(x){return typeof x=="string"}function G(x){return typeof x=="object"&&x!==null&&!Array.isArray(x)&&!(x instanceof RegExp)&&!(x instanceof Date)}function D(x){return typeof x=="number"&&!isNaN(x)}function w(x){return x===!0||x===!1}function _(x){return typeof x=="undefined"}function F(x){return!v(x)}function v(x){return _(x)||x===null}function s(x,A){if(!x)throw new Error(A?`Unexpected type, expected '${A}'`:"Unexpected type")}function y(x){if(v(x))throw new Error("Assertion Failed: argument is undefined or null");return x}function f(x){return typeof x=="function"}function c(x,A){const O=Math.min(x.length,A.length);for(let U=0;U<O;U++)l(x[U],A[U])}function l(x,A){if(P(A)){if(typeof x!==A)throw new Error(`argument does not match constraint: typeof ${A}`)}else if(f(A)){try{if(x instanceof A)return}catch(O){}if(!v(x)&&x.constructor===A||A.length===1&&A.call(void 0,x)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function h(x){let A=[],O=Object.getPrototypeOf(x);for(;Object.prototype!==O;)A=A.concat(Object.getOwnPropertyNames(O)),O=Object.getPrototypeOf(O);return A}function d(x){const A=[];for(const O of h(x))typeof x[O]=="function"&&A.push(O);return A}function E(x,A){const O=B=>function(){const $=Array.prototype.slice.call(arguments,0);return A(B,$)};let U={};for(const B of x)U[B]=O(B);return U}function T(x){return x===null?void 0:x}function L(x,A="Unreachable"){throw new Error(A)}},13268:function(yt,me,b){"use strict";b.d(me,{N:function(){return P}});function I(G,D){let w;return D.length===0?w=G:w=G.replace(/\{(\d+)\}/g,function(_,F){const v=F[0];return typeof D[v]!="undefined"?D[v]:_}),w}function P(G,D,...w){return I(D,w)}},96236:function(yt,me,b){"use strict";b.d(me,{BH:function(){return E},NZ:function(){return T},U8:function(){return L},co:function(){return d},eH:function(){return h},vr:function(){return l}});var I=b(75918),P=b(52615),G=b(4348),D=b(88226),w=b(69323),_=b(34502),F=b(35884),v=b(90689),s=b(16925),y=b(49055),f=function(x,A,O,U){var B=arguments.length,$=B<3?A:U===null?U=Object.getOwnPropertyDescriptor(A,O):U,M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(x,A,O,U);else for(var Y=x.length-1;Y>=0;Y--)(M=x[Y])&&($=(B<3?M($):B>3?M(A,O,$):M(A,O))||$);return B>3&&$&&Object.defineProperty(A,O,$),$},c=function(x,A){return function(O,U){A(O,U,x)}};function l(x){return x.command!==void 0}class h{constructor(A){this.id=h._idPool++,this._debugName=A}}h._idPool=0,h.CommandPalette=new h("CommandPalette"),h.EditorContext=new h("EditorContext"),h.SimpleEditorContext=new h("SimpleEditorContext"),h.EditorContextCopy=new h("EditorContextCopy"),h.EditorContextPeek=new h("EditorContextPeek"),h.MenubarEditMenu=new h("MenubarEditMenu"),h.MenubarCopy=new h("MenubarCopy"),h.MenubarGoMenu=new h("MenubarGoMenu"),h.MenubarSelectionMenu=new h("MenubarSelectionMenu"),h.InlineCompletionsActions=new h("InlineCompletionsActions");const d=(0,s.yh)("menuService"),E=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new G.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:x=>x===h.CommandPalette}}addCommand(x){return this.addCommands(D.$.single(x))}addCommands(x){for(const A of x)this._commands.set(A.id,A);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,w.OF)(()=>{let A=!1;for(const O of x)A=this._commands.delete(O.id)||A;A&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(x){return this._commands.get(x)}getCommands(){const x=new Map;return this._commands.forEach((A,O)=>x.set(O,A)),x}appendMenuItem(x,A){return this.appendMenuItems(D.$.single({id:x,item:A}))}appendMenuItems(x){const A=new Set,O=new _.S;for(const{id:U,item:B}of x){let $=this._menuItems.get(U);$||($=new _.S,this._menuItems.set(U,$)),O.push($.push(B)),A.add(U)}return this._onDidChangeMenu.fire(A),(0,w.OF)(()=>{if(O.size>0){for(let U of O)U();this._onDidChangeMenu.fire(A),O.clear()}})}getMenuItems(x){let A;return this._menuItems.has(x)?A=[...this._menuItems.get(x)]:A=[],x===h.CommandPalette&&this._appendImplicitItems(A),A}_appendImplicitItems(x){const A=new Set;for(const O of x)l(O)&&(A.add(O.command.id),O.alt&&A.add(O.alt.id));this._commands.forEach((O,U)=>{A.has(U)||x.push({command:O})})}};class T extends I.wY{constructor(A,O,U,B){super(`submenuitem.${A.submenu.id}`,typeof A.title=="string"?A.title:A.title.value,[],"submenu"),this.item=A,this._menuService=O,this._contextKeyService=U,this._options=B}get actions(){const A=[],O=this._menuService.createMenu(this.item.submenu,this._contextKeyService),U=O.getActions(this._options);O.dispose();for(const[,B]of U)B.length>0&&(A.push(...B),A.push(new I.Z0));return A.length&&A.pop(),A}}let L=class ll{constructor(A,O,U,B,$){var M,Y;if(this._commandService=$,this.id=A.id,this.label=U!=null&&U.renderShortTitle&&A.shortTitle?typeof A.shortTitle=="string"?A.shortTitle:A.shortTitle.value:typeof A.title=="string"?A.title:A.title.value,this.tooltip=(Y=typeof A.tooltip=="string"?A.tooltip:(M=A.tooltip)===null||M===void 0?void 0:M.value)!==null&&Y!==void 0?Y:"",this.enabled=!A.precondition||B.contextMatchesRules(A.precondition),this.checked=void 0,A.toggled){const q=A.toggled.condition?A.toggled:{condition:A.toggled};this.checked=B.contextMatchesRules(q.condition),this.checked&&q.tooltip&&(this.tooltip=typeof q.tooltip=="string"?q.tooltip:q.tooltip.value),q.title&&(this.label=typeof q.title=="string"?q.title:q.title.value)}this.item=A,this.alt=O?new ll(O,void 0,U,B,$):void 0,this._options=U,y.kS.isThemeIcon(A.icon)&&(this.class=P.dT.asClassName(A.icon))}dispose(){}run(...A){var O,U;let B=[];return!((O=this._options)===null||O===void 0)&&O.arg&&(B=[...B,this._options.arg]),!((U=this._options)===null||U===void 0)&&U.shouldForwardArgs&&(B=[...B,...A]),this._commandService.executeCommand(this.id,...B)}};L=f([c(3,v.i6),c(4,F.H)],L)},35884:function(yt,me,b){"use strict";b.d(me,{H:function(){return F},P:function(){return v}});var I=b(4348),P=b(88226),G=b(69323),D=b(34502),w=b(72999),_=b(16925);const F=(0,_.yh)("commandService"),v=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new I.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(s,y){if(!s)throw new Error("invalid command");if(typeof s=="string"){if(!y)throw new Error("invalid command");return this.registerCommand({id:s,handler:y})}if(s.description){const d=[];for(let T of s.description.args)d.push(T.constraint);const E=s.handler;s.handler=function(T,...L){return(0,w.D8)(L,d),E(T,...L)}}const{id:f}=s;let c=this._commands.get(f);c||(c=new D.S,this._commands.set(f,c));let l=c.unshift(s),h=(0,G.OF)(()=>{l();const d=this._commands.get(f);d!=null&&d.isEmpty()&&this._commands.delete(f)});return this._onDidRegisterCommand.fire(f),h}registerCommandAlias(s,y){return v.registerCommand(s,(f,...c)=>f.get(F).executeCommand(y,...c))}getCommand(s){const y=this._commands.get(s);if(!(!y||y.isEmpty()))return P.$.first(y)}getCommands(){const s=new Map;for(const y of this._commands.keys()){const f=this.getCommand(y);f&&s.set(y,f)}return s}};v.registerCommand("noop",()=>{})},90689:function(yt,me,b){"use strict";b.d(me,{Ao:function(){return F},Eq:function(){return J},Fb:function(){return v},K8:function(){return N},i6:function(){return ce},uy:function(){return se}});var I=b(23345),P=b(82983),G=b(16925);let D=I.WE||"";const w=new Map;w.set("false",!1),w.set("true",!0),w.set("isMac",I.dz),w.set("isLinux",I.IJ),w.set("isWindows",I.ED),w.set("isWeb",I.$L),w.set("isMacNative",I.dz&&!I.$L),w.set("isEdge",D.indexOf("Edg/")>=0),w.set("isFirefox",D.indexOf("Firefox")>=0),w.set("isChrome",D.indexOf("Chrome")>=0),w.set("isSafari",D.indexOf("Safari")>=0);const _=Object.prototype.hasOwnProperty;class F{static has(k){return c.create(k)}static equals(k,C){return l.create(k,C)}static regex(k,C){return B.create(k,C)}static not(k){return T.create(k)}static and(...k){return Y.create(k,null)}static or(...k){return q.create(k,null,!0)}static deserialize(k,C=!1){if(k)return this._deserializeOrExpression(k,C)}static _deserializeOrExpression(k,C){let V=k.split("||");return q.create(V.map(ne=>this._deserializeAndExpression(ne,C)),null,!0)}static _deserializeAndExpression(k,C){let V=k.split("&&");return Y.create(V.map(ne=>this._deserializeOne(ne,C)),null)}static _deserializeOne(k,C){if(k=k.trim(),k.indexOf("!=")>=0){let V=k.split("!=");return E.create(V[0].trim(),this._deserializeValue(V[1],C))}if(k.indexOf("==")>=0){let V=k.split("==");return l.create(V[0].trim(),this._deserializeValue(V[1],C))}if(k.indexOf("=~")>=0){let V=k.split("=~");return B.create(V[0].trim(),this._deserializeRegexValue(V[1],C))}if(k.indexOf(" in ")>=0){let V=k.split(" in ");return h.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(k)){const V=k.split(">=");return A.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(k)){const V=k.split(">");return x.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(k)){const V=k.split("<=");return U.create(V[0].trim(),V[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(k)){const V=k.split("<");return O.create(V[0].trim(),V[1].trim())}return/^\!\s*/.test(k)?T.create(k.substr(1).trim()):c.create(k)}static _deserializeValue(k,C){if(k=k.trim(),k==="true")return!0;if(k==="false")return!1;let V=/^'([^']*)'$/.exec(k);return V?V[1].trim():k}static _deserializeRegexValue(k,C){if((0,P.m5)(k)){if(C)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let V=k.indexOf("/"),ne=k.lastIndexOf("/");if(V===ne||V<0){if(C)throw new Error(`bad regexp-value '${k}', missing /-enclosure`);return console.warn(`bad regexp-value '${k}', missing /-enclosure`),null}let pe=k.slice(V+1,ne),Te=k[ne+1]==="i"?"i":"";try{return new RegExp(pe,Te)}catch(Ke){if(C)throw new Error(`bad regexp-value '${k}', parse error: ${Ke}`);return console.warn(`bad regexp-value '${k}', parse error: ${Ke}`),null}}}function v(K,k){const C=K?K.substituteConstants():void 0,V=k?k.substituteConstants():void 0;return!C&&!V?!0:!C||!V?!1:C.equals(V)}function s(K,k){return K.cmp(k)}class y{constructor(){this.type=0}cmp(k){return this.type-k.type}equals(k){return k.type===this.type}substituteConstants(){return this}evaluate(k){return!1}serialize(){return"false"}keys(){return[]}negate(){return f.INSTANCE}}y.INSTANCE=new y;class f{constructor(){this.type=1}cmp(k){return this.type-k.type}equals(k){return k.type===this.type}substituteConstants(){return this}evaluate(k){return!0}serialize(){return"true"}keys(){return[]}negate(){return y.INSTANCE}}f.INSTANCE=new f;class c{constructor(k,C){this.key=k,this.negated=C,this.type=2}static create(k,C=null){const V=w.get(k);return typeof V=="boolean"?V?f.INSTANCE:y.INSTANCE:new c(k,C)}cmp(k){return k.type!==this.type?this.type-k.type:z(this.key,k.key)}equals(k){return k.type===this.type?this.key===k.key:!1}substituteConstants(){const k=w.get(this.key);return typeof k=="boolean"?k?f.INSTANCE:y.INSTANCE:this}evaluate(k){return!!k.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=T.create(this.key,this)),this.negated}}class l{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=4}static create(k,C,V=null){if(typeof C=="boolean")return C?c.create(k,V):T.create(k,V);const ne=w.get(k);return typeof ne=="boolean"?C===(ne?"true":"false")?f.INSTANCE:y.INSTANCE:new l(k,C,V)}cmp(k){return k.type!==this.type?this.type-k.type:Z(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){const k=w.get(this.key);if(typeof k=="boolean"){const C=k?"true":"false";return this.value===C?f.INSTANCE:y.INSTANCE}return this}evaluate(k){return k.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=E.create(this.key,this.value,this)),this.negated}}class h{constructor(k,C){this.key=k,this.valueKey=C,this.type=10,this.negated=null}static create(k,C){return new h(k,C)}cmp(k){return k.type!==this.type?this.type-k.type:Z(this.key,this.valueKey,k.key,k.valueKey)}equals(k){return k.type===this.type?this.key===k.key&&this.valueKey===k.valueKey:!1}substituteConstants(){return this}evaluate(k){const C=k.getValue(this.valueKey),V=k.getValue(this.key);return Array.isArray(C)?C.indexOf(V)>=0:typeof V=="string"&&typeof C=="object"&&C!==null?_.call(C,V):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=d.create(this)),this.negated}}class d{constructor(k){this._actual=k,this.type=11}static create(k){return new d(k)}cmp(k){return k.type!==this.type?this.type-k.type:this._actual.cmp(k._actual)}equals(k){return k.type===this.type?this._actual.equals(k._actual):!1}substituteConstants(){return this}evaluate(k){return!this._actual.evaluate(k)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class E{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=5}static create(k,C,V=null){if(typeof C=="boolean")return C?T.create(k,V):c.create(k,V);const ne=w.get(k);return typeof ne=="boolean"?C===(ne?"true":"false")?y.INSTANCE:f.INSTANCE:new E(k,C,V)}cmp(k){return k.type!==this.type?this.type-k.type:Z(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){const k=w.get(this.key);if(typeof k=="boolean"){const C=k?"true":"false";return this.value===C?y.INSTANCE:f.INSTANCE}return this}evaluate(k){return k.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=l.create(this.key,this.value,this)),this.negated}}class T{constructor(k,C){this.key=k,this.negated=C,this.type=3}static create(k,C=null){const V=w.get(k);return typeof V=="boolean"?V?y.INSTANCE:f.INSTANCE:new T(k,C)}cmp(k){return k.type!==this.type?this.type-k.type:z(this.key,k.key)}equals(k){return k.type===this.type?this.key===k.key:!1}substituteConstants(){const k=w.get(this.key);return typeof k=="boolean"?k?y.INSTANCE:f.INSTANCE:this}evaluate(k){return!k.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=c.create(this.key,this)),this.negated}}function L(K,k){if(typeof K=="string"){const C=parseFloat(K);isNaN(C)||(K=C)}return typeof K=="string"||typeof K=="number"?k(K):y.INSTANCE}class x{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=12}static create(k,C,V=null){return L(C,ne=>new x(k,ne,V))}cmp(k){return k.type!==this.type?this.type-k.type:Z(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){return this}evaluate(k){return typeof this.value=="string"?!1:parseFloat(k.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=U.create(this.key,this.value,this)),this.negated}}class A{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=13}static create(k,C,V=null){return L(C,ne=>new A(k,ne,V))}cmp(k){return k.type!==this.type?this.type-k.type:Z(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){return this}evaluate(k){return typeof this.value=="string"?!1:parseFloat(k.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=O.create(this.key,this.value,this)),this.negated}}class O{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=14}static create(k,C,V=null){return L(C,ne=>new O(k,ne,V))}cmp(k){return k.type!==this.type?this.type-k.type:Z(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){return this}evaluate(k){return typeof this.value=="string"?!1:parseFloat(k.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=A.create(this.key,this.value,this)),this.negated}}class U{constructor(k,C,V){this.key=k,this.value=C,this.negated=V,this.type=15}static create(k,C,V=null){return L(C,ne=>new U(k,ne,V))}cmp(k){return k.type!==this.type?this.type-k.type:Z(this.key,this.value,k.key,k.value)}equals(k){return k.type===this.type?this.key===k.key&&this.value===k.value:!1}substituteConstants(){return this}evaluate(k){return typeof this.value=="string"?!1:parseFloat(k.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=x.create(this.key,this.value,this)),this.negated}}class B{constructor(k,C){this.key=k,this.regexp=C,this.type=7,this.negated=null}static create(k,C){return new B(k,C)}cmp(k){if(k.type!==this.type)return this.type-k.type;if(this.key<k.key)return-1;if(this.key>k.key)return 1;const C=this.regexp?this.regexp.source:"",V=k.regexp?k.regexp.source:"";return C<V?-1:C>V?1:0}equals(k){if(k.type===this.type){const C=this.regexp?this.regexp.source:"",V=k.regexp?k.regexp.source:"";return this.key===k.key&&C===V}return!1}substituteConstants(){return this}evaluate(k){let C=k.getValue(this.key);return this.regexp?this.regexp.test(C):!1}serialize(){const k=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${k}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=$.create(this)),this.negated}}class ${constructor(k){this._actual=k,this.type=8}static create(k){return new $(k)}cmp(k){return k.type!==this.type?this.type-k.type:this._actual.cmp(k._actual)}equals(k){return k.type===this.type?this._actual.equals(k._actual):!1}substituteConstants(){return this}evaluate(k){return!this._actual.evaluate(k)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function M(K){let k=null;for(let C=0,V=K.length;C<V;C++){const ne=K[C].substituteConstants();if(K[C]!==ne&&k===null){k=[];for(let pe=0;pe<C;pe++)k[pe]=K[pe]}k!==null&&(k[C]=ne)}return k===null?K:k}class Y{constructor(k,C){this.expr=k,this.negated=C,this.type=6}static create(k,C){return Y._normalizeArr(k,C)}cmp(k){if(k.type!==this.type)return this.type-k.type;if(this.expr.length<k.expr.length)return-1;if(this.expr.length>k.expr.length)return 1;for(let C=0,V=this.expr.length;C<V;C++){const ne=s(this.expr[C],k.expr[C]);if(ne!==0)return ne}return 0}equals(k){if(k.type===this.type){if(this.expr.length!==k.expr.length)return!1;for(let C=0,V=this.expr.length;C<V;C++)if(!this.expr[C].equals(k.expr[C]))return!1;return!0}return!1}substituteConstants(){const k=M(this.expr);return k===this.expr?this:Y.create(k,this.negated)}evaluate(k){for(let C=0,V=this.expr.length;C<V;C++)if(!this.expr[C].evaluate(k))return!1;return!0}static _normalizeArr(k,C){const V=[];let ne=!1;for(const pe of k)if(pe){if(pe.type===1){ne=!0;continue}if(pe.type===0)return y.INSTANCE;if(pe.type===6){V.push(...pe.expr);continue}V.push(pe)}if(V.length===0&&ne)return f.INSTANCE;if(V.length!==0){if(V.length===1)return V[0];V.sort(s);for(let pe=1;pe<V.length;pe++)V[pe-1].equals(V[pe])&&(V.splice(pe,1),pe--);if(V.length===1)return V[0];for(;V.length>1;){const pe=V[V.length-1];if(pe.type!==9)break;V.pop();const Te=V.pop(),Ke=V.length===0,ve=q.create(pe.expr.map(Ue=>Y.create([Ue,Te],null)),null,Ke);ve&&(V.push(ve),V.sort(s))}return V.length===1?V[0]:new Y(V,C)}}serialize(){return this.expr.map(k=>k.serialize()).join(" && ")}keys(){const k=[];for(let C of this.expr)k.push(...C.keys());return k}negate(){if(!this.negated){const k=[];for(let C of this.expr)k.push(C.negate());this.negated=q.create(k,this,!0)}return this.negated}}class q{constructor(k,C){this.expr=k,this.negated=C,this.type=9}static create(k,C,V){return q._normalizeArr(k,C,V)}cmp(k){if(k.type!==this.type)return this.type-k.type;if(this.expr.length<k.expr.length)return-1;if(this.expr.length>k.expr.length)return 1;for(let C=0,V=this.expr.length;C<V;C++){const ne=s(this.expr[C],k.expr[C]);if(ne!==0)return ne}return 0}equals(k){if(k.type===this.type){if(this.expr.length!==k.expr.length)return!1;for(let C=0,V=this.expr.length;C<V;C++)if(!this.expr[C].equals(k.expr[C]))return!1;return!0}return!1}substituteConstants(){const k=M(this.expr);return k===this.expr?this:q.create(k,this.negated,!1)}evaluate(k){for(let C=0,V=this.expr.length;C<V;C++)if(this.expr[C].evaluate(k))return!0;return!1}static _normalizeArr(k,C,V){let ne=[],pe=!1;if(k){for(let Te=0,Ke=k.length;Te<Ke;Te++){const ve=k[Te];if(ve){if(ve.type===0){pe=!0;continue}if(ve.type===1)return f.INSTANCE;if(ve.type===9){ne=ne.concat(ve.expr);continue}ne.push(ve)}}if(ne.length===0&&pe)return y.INSTANCE;ne.sort(s)}if(ne.length!==0){if(ne.length===1)return ne[0];for(let Te=1;Te<ne.length;Te++)ne[Te-1].equals(ne[Te])&&(ne.splice(Te,1),Te--);if(ne.length===1)return ne[0];if(V){for(let Te=0;Te<ne.length;Te++)for(let Ke=Te+1;Ke<ne.length;Ke++)N(ne[Te],ne[Ke])&&(ne.splice(Ke,1),Ke--);if(ne.length===1)return ne[0]}return new q(ne,C)}}serialize(){return this.expr.map(k=>k.serialize()).join(" || ")}keys(){const k=[];for(let C of this.expr)k.push(...C.keys());return k}negate(){if(!this.negated){let k=[];for(let C of this.expr)k.push(C.negate());for(;k.length>1;){const C=k.shift(),V=k.shift(),ne=[];for(const Te of W(C))for(const Ke of W(V))ne.push(Y.create([Te,Ke],null));const pe=k.length===0;k.unshift(q.create(ne,null,pe))}this.negated=k[0]}return this.negated}}class se extends c{constructor(k,C,V){super(k,null),this._defaultValue=C,typeof V=="object"?se._info.push(Object.assign(Object.assign({},V),{key:k})):V!==!0&&se._info.push({key:k,description:V,type:C!=null?typeof C:void 0})}static all(){return se._info.values()}bindTo(k){return k.createKey(this.key,this._defaultValue)}getValue(k){return k.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(k){return l.create(this.key,k)}}se._info=[];const ce=(0,G.yh)("contextKeyService"),J="setContext";function z(K,k){return K<k?-1:K>k?1:0}function Z(K,k,C,V){return K<C?-1:K>C?1:k<V?-1:k>V?1:0}function N(K,k){if(k.type===6&&K.type!==9&&K.type!==6){for(const ne of k.expr)if(K.equals(ne))return!0}const C=K.negate(),V=W(C).concat(W(k));V.sort(s);for(let ne=0;ne<V.length;ne++){const Te=V[ne].negate();for(let Ke=ne+1;Ke<V.length;Ke++){const ve=V[Ke];if(Te.equals(ve))return!0}}return!1}function W(K){return K.type===9?K.expr:[K]}},16925:function(yt,me,b){"use strict";b.d(me,{I8:function(){return I},TG:function(){return P},jt:function(){return w},yh:function(){return D}});var I;(function(_){_.serviceIds=new Map,_.DI_TARGET="$di$target",_.DI_DEPENDENCIES="$di$dependencies";function F(v){return v[_.DI_DEPENDENCIES]||[]}_.getServiceDependencies=F})(I||(I={}));const P=D("instantiationService");function G(_,F,v,s){F[I.DI_TARGET]===F?F[I.DI_DEPENDENCIES].push({id:_,index:v,optional:s}):(F[I.DI_DEPENDENCIES]=[{id:_,index:v,optional:s}],F[I.DI_TARGET]=F)}function D(_){if(I.serviceIds.has(_))return I.serviceIds.get(_);const F=function(v,s,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");G(F,v,y,!1)};return F.toString=()=>_,I.serviceIds.set(_,F),F}function w(_){return function(F,v,s){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");G(_,F,s,!0)}}},44650:function(yt,me,b){"use strict";b.d(me,{B:function(){return D}});var I=b(76068),P=b(72999);class G{constructor(){this.data=new Map}add(_,F){I.ok(P.HD(_)),I.ok(P.Kn(F)),I.ok(!this.data.has(_),"There is already an extension with this id"),this.data.set(_,F)}as(_){return this.data.get(_)||null}}const D=new G},66213:function(yt,me,b){"use strict";b.d(me,{e:function(){return I}});var I;(function(P){P.DARK="dark",P.LIGHT="light",P.HIGH_CONTRAST="hc"})(I||(I={}))},49055:function(yt,me,b){"use strict";b.d(me,{EN:function(){return s},IP:function(){return c},Ic:function(){return d},XE:function(){return F},bB:function(){return E},kS:function(){return y},m6:function(){return f}});var I=b(52615),P=b(4348),G=b(69323),D=b(16925),w=b(44650),_=b(66213);const F=(0,D.yh)("themeService");var v;(function(T){function L(x){return x&&typeof x=="object"&&typeof x.id=="string"}T.isThemeColor=L})(v||(v={}));function s(T){return{id:T}}var y;(function(T){function L($){return $&&typeof $=="object"&&typeof $.id=="string"&&(typeof $.color=="undefined"||v.isThemeColor($.color))}T.isThemeIcon=L;const x=new RegExp(`^\\$\\((${I.dT.iconNameExpression}(?:${I.dT.iconModifierExpression})?)\\)$`);function A($){const M=x.exec($);if(!M)return;let[,Y]=M;return{id:Y}}T.fromString=A;function O($,M){let Y=$.id;const q=Y.lastIndexOf("~");return q!==-1&&(Y=Y.substring(0,q)),M&&(Y=`${Y}~${M}`),{id:Y}}T.modify=O;function U($,M){var Y,q;return $.id===M.id&&((Y=$.color)===null||Y===void 0?void 0:Y.id)===((q=M.color)===null||q===void 0?void 0:q.id)}T.isEqual=U;function B($,M){return{id:$.id,color:M?s(M):void 0}}T.asThemeIcon=B,T.asClassNameArray=I.dT.asClassNameArray,T.asClassName=I.dT.asClassName,T.asCSSSelector=I.dT.asCSSSelector})(y||(y={}));function f(T){switch(T){case _.e.DARK:return"vs-dark";case _.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const c={ThemingContribution:"base.contributions.theming"};class l{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new P.Q5}onColorThemeChange(L){return this.themingParticipants.push(L),this.onThemingParticipantAddedEmitter.fire(L),(0,G.OF)(()=>{const x=this.themingParticipants.indexOf(L);this.themingParticipants.splice(x,1)})}getThemingParticipants(){return this.themingParticipants}}let h=new l;w.B.add(c.ThemingContribution,h);function d(T){return h.onColorThemeChange(T)}class E extends G.JT{constructor(L){super(),this.themeService=L,this.theme=L.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(x=>this.onThemeChange(x)))}onThemeChange(L){this.theme=L,this.updateStyles()}updateStyles(){}}},66003:function(yt,me,b){"use strict";b.d(me,{Z:function(){return F}});var I=b(75931),P=b(33885),G=b(76190),D=b(59301),w=["show"];function _(v,s){if(!s.max)return!0;var y=s.strategy(v);return y<=s.max}function F(v,s){return D.useMemo(function(){var y={};s&&(y.show=(0,G.Z)(s)==="object"&&s.formatter?s.formatter:!!s),y=(0,P.Z)((0,P.Z)({},y),v);var f=y,c=f.show,l=(0,I.Z)(f,w);return(0,P.Z)((0,P.Z)({},l),{},{show:!!c,showFormatter:typeof c=="function"?c:void 0,strategy:l.strategy||function(h){return h.length}})},[v,s])}},36901:function(yt,me,b){"use strict";b.r(me),b.d(me,{BaseInput:function(){return y},default:function(){return A}});var I=b(33885),P=b(54476),G=b(20068),D=b(76190),w=b(92310),_=b.n(w),F=b(59301),v=b(30292),s=F.forwardRef(function(O,U){var B,$,M,Y=O.inputElement,q=O.children,se=O.prefixCls,ce=O.prefix,J=O.suffix,z=O.addonBefore,Z=O.addonAfter,N=O.className,W=O.style,K=O.disabled,k=O.readOnly,C=O.focused,V=O.triggerFocus,ne=O.allowClear,pe=O.value,Te=O.handleReset,Ke=O.hidden,ve=O.classes,Ue=O.classNames,Be=O.dataAttrs,Me=O.styles,St=O.components,He=O.onClear,ut=q!=null?q:Y,$e=(St==null?void 0:St.affixWrapper)||"span",bt=(St==null?void 0:St.groupWrapper)||"span",Ee=(St==null?void 0:St.wrapper)||"span",be=(St==null?void 0:St.groupAddon)||"span",ue=(0,F.useRef)(null),ke=function(rt){var qe;(qe=ue.current)!==null&&qe!==void 0&&qe.contains(rt.target)&&(V==null||V())},Fe=(0,v.X3)(O),We=(0,F.cloneElement)(ut,{value:pe,className:_()((B=ut.props)===null||B===void 0?void 0:B.className,!Fe&&(Ue==null?void 0:Ue.variant))||null}),ie=(0,F.useRef)(null);if(F.useImperativeHandle(U,function(){return{nativeElement:ie.current||ue.current}}),Fe){var fe=null;if(ne){var De=!K&&!k&&pe,Re="".concat(se,"-clear-icon"),Oe=(0,D.Z)(ne)==="object"&&ne!==null&&ne!==void 0&&ne.clearIcon?ne.clearIcon:"\u2716";fe=F.createElement("button",{type:"button",tabIndex:-1,onClick:function(rt){Te==null||Te(rt),He==null||He()},onMouseDown:function(rt){return rt.preventDefault()},className:_()(Re,(0,G.Z)((0,G.Z)({},"".concat(Re,"-hidden"),!De),"".concat(Re,"-has-suffix"),!!J))},Oe)}var Ve="".concat(se,"-affix-wrapper"),lt=_()(Ve,(0,G.Z)((0,G.Z)((0,G.Z)((0,G.Z)((0,G.Z)({},"".concat(se,"-disabled"),K),"".concat(Ve,"-disabled"),K),"".concat(Ve,"-focused"),C),"".concat(Ve,"-readonly"),k),"".concat(Ve,"-input-with-clear-btn"),J&&ne&&pe),ve==null?void 0:ve.affixWrapper,Ue==null?void 0:Ue.affixWrapper,Ue==null?void 0:Ue.variant),Qe=(J||ne)&&F.createElement("span",{className:_()("".concat(se,"-suffix"),Ue==null?void 0:Ue.suffix),style:Me==null?void 0:Me.suffix},fe,J);We=F.createElement($e,(0,P.Z)({className:lt,style:Me==null?void 0:Me.affixWrapper,onClick:ke},Be==null?void 0:Be.affixWrapper,{ref:ue}),ce&&F.createElement("span",{className:_()("".concat(se,"-prefix"),Ue==null?void 0:Ue.prefix),style:Me==null?void 0:Me.prefix},ce),We,Qe)}if((0,v.He)(O)){var Ze="".concat(se,"-group"),Xe="".concat(Ze,"-addon"),ht="".concat(Ze,"-wrapper"),st=_()("".concat(se,"-wrapper"),Ze,ve==null?void 0:ve.wrapper,Ue==null?void 0:Ue.wrapper),it=_()(ht,(0,G.Z)({},"".concat(ht,"-disabled"),K),ve==null?void 0:ve.group,Ue==null?void 0:Ue.groupWrapper);We=F.createElement(bt,{className:it,ref:ie},F.createElement(Ee,{className:st},z&&F.createElement(be,{className:Xe},z),We,Z&&F.createElement(be,{className:Xe},Z)))}return F.cloneElement(We,{className:_()(($=We.props)===null||$===void 0?void 0:$.className,N)||null,style:(0,I.Z)((0,I.Z)({},(M=We.props)===null||M===void 0?void 0:M.style),W),hidden:Ke})}),y=s,f=b(94480),c=b(42978),l=b(75931),h=b(18929),d=b(2738),E=b(66003),T=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],L=(0,F.forwardRef)(function(O,U){var B=O.autoComplete,$=O.onChange,M=O.onFocus,Y=O.onBlur,q=O.onPressEnter,se=O.onKeyDown,ce=O.onKeyUp,J=O.prefixCls,z=J===void 0?"rc-input":J,Z=O.disabled,N=O.htmlSize,W=O.className,K=O.maxLength,k=O.suffix,C=O.showCount,V=O.count,ne=O.type,pe=ne===void 0?"text":ne,Te=O.classes,Ke=O.classNames,ve=O.styles,Ue=O.onCompositionStart,Be=O.onCompositionEnd,Me=(0,l.Z)(O,T),St=(0,F.useState)(!1),He=(0,c.Z)(St,2),ut=He[0],$e=He[1],bt=(0,F.useRef)(!1),Ee=(0,F.useRef)(!1),be=(0,F.useRef)(null),ue=(0,F.useRef)(null),ke=function(Tt){be.current&&(0,v.nH)(be.current,Tt)},Fe=(0,h.Z)(O.defaultValue,{value:O.value}),We=(0,c.Z)(Fe,2),ie=We[0],fe=We[1],De=ie==null?"":String(ie),Re=(0,F.useState)(null),Oe=(0,c.Z)(Re,2),Ve=Oe[0],lt=Oe[1],Qe=(0,E.Z)(V,C),Ze=Qe.max||K,Xe=Qe.strategy(De),ht=!!Ze&&Xe>Ze;(0,F.useImperativeHandle)(U,function(){var nt;return{focus:ke,blur:function(){var xe;(xe=be.current)===null||xe===void 0||xe.blur()},setSelectionRange:function(xe,ge,ye){var ee;(ee=be.current)===null||ee===void 0||ee.setSelectionRange(xe,ge,ye)},select:function(){var xe;(xe=be.current)===null||xe===void 0||xe.select()},input:be.current,nativeElement:((nt=ue.current)===null||nt===void 0?void 0:nt.nativeElement)||be.current}}),(0,F.useEffect)(function(){Ee.current&&(Ee.current=!1),$e(function(nt){return nt&&Z?!1:nt})},[Z]);var st=function(Tt,xe,ge){var ye=xe;if(!bt.current&&Qe.exceedFormatter&&Qe.max&&Qe.strategy(xe)>Qe.max){if(ye=Qe.exceedFormatter(xe,{max:Qe.max}),xe!==ye){var ee,te;lt([((ee=be.current)===null||ee===void 0?void 0:ee.selectionStart)||0,((te=be.current)===null||te===void 0?void 0:te.selectionEnd)||0])}}else if(ge.source==="compositionEnd")return;fe(ye),be.current&&(0,v.rJ)(be.current,Tt,$,ye)};(0,F.useEffect)(function(){if(Ve){var nt;(nt=be.current)===null||nt===void 0||nt.setSelectionRange.apply(nt,(0,f.Z)(Ve))}},[Ve]);var it=function(Tt){st(Tt,Tt.target.value,{source:"change"})},Ae=function(Tt){bt.current=!1,st(Tt,Tt.currentTarget.value,{source:"compositionEnd"}),Be==null||Be(Tt)},rt=function(Tt){q&&Tt.key==="Enter"&&!Ee.current&&(Ee.current=!0,q(Tt)),se==null||se(Tt)},qe=function(Tt){Tt.key==="Enter"&&(Ee.current=!1),ce==null||ce(Tt)},je=function(Tt){$e(!0),M==null||M(Tt)},mt=function(Tt){Ee.current&&(Ee.current=!1),$e(!1),Y==null||Y(Tt)},Et=function(Tt){fe(""),ke(),be.current&&(0,v.rJ)(be.current,Tt,$)},at=ht&&"".concat(z,"-out-of-range"),kt=function(){var Tt=(0,d.Z)(O,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return F.createElement("input",(0,P.Z)({autoComplete:B},Tt,{onChange:it,onFocus:je,onBlur:mt,onKeyDown:rt,onKeyUp:qe,className:_()(z,(0,G.Z)({},"".concat(z,"-disabled"),Z),Ke==null?void 0:Ke.input),style:ve==null?void 0:ve.input,ref:be,size:N,type:pe,onCompositionStart:function(ge){bt.current=!0,Ue==null||Ue(ge)},onCompositionEnd:Ae}))},Bt=function(){var Tt=Number(Ze)>0;if(k||Qe.show){var xe=Qe.showFormatter?Qe.showFormatter({value:De,count:Xe,maxLength:Ze}):"".concat(Xe).concat(Tt?" / ".concat(Ze):"");return F.createElement(F.Fragment,null,Qe.show&&F.createElement("span",{className:_()("".concat(z,"-show-count-suffix"),(0,G.Z)({},"".concat(z,"-show-count-has-suffix"),!!k),Ke==null?void 0:Ke.count),style:(0,I.Z)({},ve==null?void 0:ve.count)},xe),k)}return null};return F.createElement(y,(0,P.Z)({},Me,{prefixCls:z,className:_()(W,at),handleReset:Et,value:De,focused:ut,triggerFocus:ke,suffix:Bt(),disabled:Z,classes:Te,classNames:Ke,styles:ve}),kt())}),x=L,A=x},30292:function(yt,me,b){"use strict";b.d(me,{He:function(){return I},X3:function(){return P},nH:function(){return w},rJ:function(){return D}});function I(_){return!!(_.addonBefore||_.addonAfter)}function P(_){return!!(_.prefix||_.suffix||_.allowClear)}function G(_,F,v){var s=F.cloneNode(!0),y=Object.create(_,{target:{value:s},currentTarget:{value:s}});return s.value=v,typeof F.selectionStart=="number"&&typeof F.selectionEnd=="number"&&(s.selectionStart=F.selectionStart,s.selectionEnd=F.selectionEnd),s.setSelectionRange=function(){F.setSelectionRange.apply(F,arguments)},y}function D(_,F,v,s){if(v){var y=F;if(F.type==="click"){y=G(F,_,""),v(y);return}if(_.type!=="file"&&s!==void 0){y=G(F,_,s),v(y);return}v(y)}}function w(_,F){if(_){_.focus(F);var v=F||{},s=v.cursor;if(s){var y=_.value.length;switch(s){case"start":_.setSelectionRange(0,0);break;case"end":_.setSelectionRange(y,y);break;default:_.setSelectionRange(0,y)}}}}},29301:function(yt,me,b){"use strict";b.d(me,{Z:function(){return J}});var I=b(54476),P=b(59301),G=b(11592),D=b(48736),w=b(33885),_=b(76190),F=b(76846),v=b(8654),s=P.createContext(null);function y(z){var Z=z.children,N=z.onBatchResize,W=P.useRef(0),K=P.useRef([]),k=P.useContext(s),C=P.useCallback(function(V,ne,pe){W.current+=1;var Te=W.current;K.current.push({size:V,element:ne,data:pe}),Promise.resolve().then(function(){Te===W.current&&(N==null||N(K.current),K.current=[])}),k==null||k(V,ne,pe)},[N,k]);return P.createElement(s.Provider,{value:C},Z)}var f=b(76374),c=new Map;function l(z){z.forEach(function(Z){var N,W=Z.target;(N=c.get(W))===null||N===void 0||N.forEach(function(K){return K(W)})})}var h=new f.Z(l),d=null,E=null;function T(z,Z){c.has(z)||(c.set(z,new Set),h.observe(z)),c.get(z).add(Z)}function L(z,Z){c.has(z)&&(c.get(z).delete(Z),c.get(z).size||(h.unobserve(z),c.delete(z)))}var x=b(67732),A=b(83652),O=b(42403),U=b(158),B=function(z){(0,O.Z)(N,z);var Z=(0,U.Z)(N);function N(){return(0,x.Z)(this,N),Z.apply(this,arguments)}return(0,A.Z)(N,[{key:"render",value:function(){return this.props.children}}]),N}(P.Component);function $(z,Z){var N=z.children,W=z.disabled,K=P.useRef(null),k=P.useRef(null),C=P.useContext(s),V=typeof N=="function",ne=V?N(K):N,pe=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Te=!V&&P.isValidElement(ne)&&(0,v.Yr)(ne),Ke=Te?(0,v.C4)(ne):null,ve=(0,v.x1)(Ke,K),Ue=function(){var He;return(0,F.ZP)(K.current)||(K.current&&(0,_.Z)(K.current)==="object"?(0,F.ZP)((He=K.current)===null||He===void 0?void 0:He.nativeElement):null)||(0,F.ZP)(k.current)};P.useImperativeHandle(Z,function(){return Ue()});var Be=P.useRef(z);Be.current=z;var Me=P.useCallback(function(St){var He=Be.current,ut=He.onResize,$e=He.data,bt=St.getBoundingClientRect(),Ee=bt.width,be=bt.height,ue=St.offsetWidth,ke=St.offsetHeight,Fe=Math.floor(Ee),We=Math.floor(be);if(pe.current.width!==Fe||pe.current.height!==We||pe.current.offsetWidth!==ue||pe.current.offsetHeight!==ke){var ie={width:Fe,height:We,offsetWidth:ue,offsetHeight:ke};pe.current=ie;var fe=ue===Math.round(Ee)?Ee:ue,De=ke===Math.round(be)?be:ke,Re=(0,w.Z)((0,w.Z)({},ie),{},{offsetWidth:fe,offsetHeight:De});C==null||C(Re,St,$e),ut&&Promise.resolve().then(function(){ut(Re,St)})}},[]);return P.useEffect(function(){var St=Ue();return St&&!W&&T(St,Me),function(){return L(St,Me)}},[K.current,W]),P.createElement(B,{ref:k},Te?P.cloneElement(ne,{ref:ve}):ne)}var M=P.forwardRef($),Y=M,q="rc-observer-key";function se(z,Z){var N=z.children,W=typeof N=="function"?[N]:(0,G.Z)(N);return W.map(function(K,k){var C=(K==null?void 0:K.key)||"".concat(q,"-").concat(k);return P.createElement(Y,(0,I.Z)({},z,{key:C,ref:k===0?Z:void 0}),K)})}var ce=P.forwardRef(se);ce.Collection=y;var J=ce},22711:function(yt,me,b){"use strict";b.r(me),b.d(me,{ResizableTextArea:function(){return ce},default:function(){return N}});var I=b(54476),P=b(20068),G=b(33885),D=b(94480),w=b(42978),_=b(75931),F=b(92310),v=b.n(F),s=b(36901),y=b(66003),f=b(30292),c=b(18929),l=b(59301),h=b(76190),d=b(29301),E=b(34280),T=b(16089),L=`
|
|
|
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;
|
|
|
`,x=["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"],A={},O;function U(W){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=W.getAttribute("id")||W.getAttribute("data-reactid")||W.getAttribute("name");if(K&&A[k])return A[k];var C=window.getComputedStyle(W),V=C.getPropertyValue("box-sizing")||C.getPropertyValue("-moz-box-sizing")||C.getPropertyValue("-webkit-box-sizing"),ne=parseFloat(C.getPropertyValue("padding-bottom"))+parseFloat(C.getPropertyValue("padding-top")),pe=parseFloat(C.getPropertyValue("border-bottom-width"))+parseFloat(C.getPropertyValue("border-top-width")),Te=x.map(function(ve){return"".concat(ve,":").concat(C.getPropertyValue(ve))}).join(";"),Ke={sizingStyle:Te,paddingSize:ne,borderSize:pe,boxSizing:V};return K&&k&&(A[k]=Ke),Ke}function B(W){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;O||(O=document.createElement("textarea"),O.setAttribute("tab-index","-1"),O.setAttribute("aria-hidden","true"),O.setAttribute("name","hiddenTextarea"),document.body.appendChild(O)),W.getAttribute("wrap")?O.setAttribute("wrap",W.getAttribute("wrap")):O.removeAttribute("wrap");var V=U(W,K),ne=V.paddingSize,pe=V.borderSize,Te=V.boxSizing,Ke=V.sizingStyle;O.setAttribute("style","".concat(Ke,";").concat(L)),O.value=W.value||W.placeholder||"";var ve=void 0,Ue=void 0,Be,Me=O.scrollHeight;if(Te==="border-box"?Me+=pe:Te==="content-box"&&(Me-=ne),k!==null||C!==null){O.value=" ";var St=O.scrollHeight-ne;k!==null&&(ve=St*k,Te==="border-box"&&(ve=ve+ne+pe),Me=Math.max(ve,Me)),C!==null&&(Ue=St*C,Te==="border-box"&&(Ue=Ue+ne+pe),Be=Me>Ue?"":"hidden",Me=Math.min(Ue,Me))}var He={height:Me,overflowY:Be,resize:"none"};return ve&&(He.minHeight=ve),Ue&&(He.maxHeight=Ue),He}var $=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],M=0,Y=1,q=2,se=l.forwardRef(function(W,K){var k=W,C=k.prefixCls,V=k.defaultValue,ne=k.value,pe=k.autoSize,Te=k.onResize,Ke=k.className,ve=k.style,Ue=k.disabled,Be=k.onChange,Me=k.onInternalAutoSize,St=(0,_.Z)(k,$),He=(0,c.Z)(V,{value:ne,postState:function(mt){return mt!=null?mt:""}}),ut=(0,w.Z)(He,2),$e=ut[0],bt=ut[1],Ee=function(mt){bt(mt.target.value),Be==null||Be(mt)},be=l.useRef();l.useImperativeHandle(K,function(){return{textArea:be.current}});var ue=l.useMemo(function(){return pe&&(0,h.Z)(pe)==="object"?[pe.minRows,pe.maxRows]:[]},[pe]),ke=(0,w.Z)(ue,2),Fe=ke[0],We=ke[1],ie=!!pe,fe=function(){try{if(document.activeElement===be.current){var mt=be.current,Et=mt.selectionStart,at=mt.selectionEnd,kt=mt.scrollTop;be.current.setSelectionRange(Et,at),be.current.scrollTop=kt}}catch(Bt){}},De=l.useState(q),Re=(0,w.Z)(De,2),Oe=Re[0],Ve=Re[1],lt=l.useState(),Qe=(0,w.Z)(lt,2),Ze=Qe[0],Xe=Qe[1],ht=function(){Ve(M)};(0,E.Z)(function(){ie&&ht()},[ne,Fe,We,ie]),(0,E.Z)(function(){if(Oe===M)Ve(Y);else if(Oe===Y){var je=B(be.current,!1,Fe,We);Ve(q),Xe(je)}else fe()},[Oe]);var st=l.useRef(),it=function(){T.Z.cancel(st.current)},Ae=function(mt){Oe===q&&(Te==null||Te(mt),pe&&(it(),st.current=(0,T.Z)(function(){ht()})))};l.useEffect(function(){return it},[]);var rt=ie?Ze:null,qe=(0,G.Z)((0,G.Z)({},ve),rt);return(Oe===M||Oe===Y)&&(qe.overflowY="hidden",qe.overflowX="hidden"),l.createElement(d.Z,{onResize:Ae,disabled:!(pe||Te)},l.createElement("textarea",(0,I.Z)({},St,{ref:be,style:qe,className:v()(C,Ke,(0,P.Z)({},"".concat(C,"-disabled"),Ue)),disabled:Ue,value:$e,onChange:Ee})))}),ce=se,J=["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"],z=l.forwardRef(function(W,K){var k,C=W.defaultValue,V=W.value,ne=W.onFocus,pe=W.onBlur,Te=W.onChange,Ke=W.allowClear,ve=W.maxLength,Ue=W.onCompositionStart,Be=W.onCompositionEnd,Me=W.suffix,St=W.prefixCls,He=St===void 0?"rc-textarea":St,ut=W.showCount,$e=W.count,bt=W.className,Ee=W.style,be=W.disabled,ue=W.hidden,ke=W.classNames,Fe=W.styles,We=W.onResize,ie=W.onClear,fe=W.onPressEnter,De=W.readOnly,Re=W.autoSize,Oe=W.onKeyDown,Ve=(0,_.Z)(W,J),lt=(0,c.Z)(C,{value:V,defaultValue:C}),Qe=(0,w.Z)(lt,2),Ze=Qe[0],Xe=Qe[1],ht=Ze==null?"":String(Ze),st=l.useState(!1),it=(0,w.Z)(st,2),Ae=it[0],rt=it[1],qe=l.useRef(!1),je=l.useState(null),mt=(0,w.Z)(je,2),Et=mt[0],at=mt[1],kt=(0,l.useRef)(null),Bt=(0,l.useRef)(null),nt=function(){var pt;return(pt=Bt.current)===null||pt===void 0?void 0:pt.textArea},Tt=function(){nt().focus()};(0,l.useImperativeHandle)(K,function(){var Ge;return{resizableTextArea:Bt.current,focus:Tt,blur:function(){nt().blur()},nativeElement:((Ge=kt.current)===null||Ge===void 0?void 0:Ge.nativeElement)||nt()}}),(0,l.useEffect)(function(){rt(function(Ge){return!be&&Ge})},[be]);var xe=l.useState(null),ge=(0,w.Z)(xe,2),ye=ge[0],ee=ge[1];l.useEffect(function(){if(ye){var Ge;(Ge=nt()).setSelectionRange.apply(Ge,(0,D.Z)(ye))}},[ye]);var te=(0,y.Z)($e,ut),le=(k=te.max)!==null&&k!==void 0?k:ve,he=Number(le)>0,_e=te.strategy(ht),Je=!!le&&_e>le,et=function(pt,Mt){var Vt=Mt;!qe.current&&te.exceedFormatter&&te.max&&te.strategy(Mt)>te.max&&(Vt=te.exceedFormatter(Mt,{max:te.max}),Mt!==Vt&&ee([nt().selectionStart||0,nt().selectionEnd||0])),Xe(Vt),(0,f.rJ)(pt.currentTarget,pt,Te,Vt)},ct=function(pt){qe.current=!0,Ue==null||Ue(pt)},gt=function(pt){qe.current=!1,et(pt,pt.currentTarget.value),Be==null||Be(pt)},It=function(pt){et(pt,pt.target.value)},Yt=function(pt){pt.key==="Enter"&&fe&&fe(pt),Oe==null||Oe(pt)},Nt=function(pt){rt(!0),ne==null||ne(pt)},Lt=function(pt){rt(!1),pe==null||pe(pt)},oi=function(pt){Xe(""),Tt(),(0,f.rJ)(nt(),pt,Te)},di=Me,ri;te.show&&(te.showFormatter?ri=te.showFormatter({value:ht,count:_e,maxLength:le}):ri="".concat(_e).concat(he?" / ".concat(le):""),di=l.createElement(l.Fragment,null,di,l.createElement("span",{className:v()("".concat(He,"-data-count"),ke==null?void 0:ke.count),style:Fe==null?void 0:Fe.count},ri)));var ni=function(pt){var Mt;We==null||We(pt),(Mt=nt())!==null&&Mt!==void 0&&Mt.style.height&&at(!0)},tt=!Re&&!ut&&!Ke;return l.createElement(s.BaseInput,{ref:kt,value:ht,allowClear:Ke,handleReset:oi,suffix:di,prefixCls:He,classNames:(0,G.Z)((0,G.Z)({},ke),{},{affixWrapper:v()(ke==null?void 0:ke.affixWrapper,(0,P.Z)((0,P.Z)({},"".concat(He,"-show-count"),ut),"".concat(He,"-textarea-allow-clear"),Ke))}),disabled:be,focused:Ae,className:v()(bt,Je&&"".concat(He,"-out-of-range")),style:(0,G.Z)((0,G.Z)({},Ee),Et&&!tt?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof ri=="string"?ri:void 0}},hidden:ue,readOnly:De,onClear:ie},l.createElement(ce,(0,I.Z)({},Ve,{autoSize:Re,maxLength:ve,onKeyDown:Yt,onChange:It,onFocus:Nt,onBlur:Lt,onCompositionStart:ct,onCompositionEnd:gt,className:v()(ke==null?void 0:ke.textarea),style:(0,G.Z)((0,G.Z)({},Fe==null?void 0:Fe.textarea),{},{resize:Ee==null?void 0:Ee.resize}),disabled:be,prefixCls:He,onResize:ni,ref:Bt,readOnly:De})))}),Z=z,N=Z},29125:function(yt,me,b){"use strict";b.d(me,{G:function(){return D},Z:function(){return L}});var I=b(92310),P=b.n(I),G=b(59301);function D(x){var A=x.children,O=x.prefixCls,U=x.id,B=x.overlayInnerStyle,$=x.bodyClassName,M=x.className,Y=x.style;return G.createElement("div",{className:P()("".concat(O,"-content"),M),style:Y},G.createElement("div",{className:P()("".concat(O,"-inner"),$),id:U,role:"tooltip",style:B},typeof A=="function"?A():A))}var w=b(54476),_=b(33885),F=b(75931),v=b(65030),s={shiftX:64,adjustY:1},y={adjustX:1,shiftY:!0},f=[0,0],c={left:{points:["cr","cl"],overflow:y,offset:[-4,0],targetOffset:f},right:{points:["cl","cr"],overflow:y,offset:[4,0],targetOffset:f},top:{points:["bc","tc"],overflow:s,offset:[0,-4],targetOffset:f},bottom:{points:["tc","bc"],overflow:s,offset:[0,4],targetOffset:f},topLeft:{points:["bl","tl"],overflow:s,offset:[0,-4],targetOffset:f},leftTop:{points:["tr","tl"],overflow:y,offset:[-4,0],targetOffset:f},topRight:{points:["br","tr"],overflow:s,offset:[0,-4],targetOffset:f},rightTop:{points:["tl","tr"],overflow:y,offset:[4,0],targetOffset:f},bottomRight:{points:["tr","br"],overflow:s,offset:[0,4],targetOffset:f},rightBottom:{points:["bl","br"],overflow:y,offset:[4,0],targetOffset:f},bottomLeft:{points:["tl","bl"],overflow:s,offset:[0,4],targetOffset:f},leftBottom:{points:["br","bl"],overflow:y,offset:[-4,0],targetOffset:f}},l=null,h=b(80402),d=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],E=function(A,O){var U=A.overlayClassName,B=A.trigger,$=B===void 0?["hover"]:B,M=A.mouseEnterDelay,Y=M===void 0?0:M,q=A.mouseLeaveDelay,se=q===void 0?.1:q,ce=A.overlayStyle,J=A.prefixCls,z=J===void 0?"rc-tooltip":J,Z=A.children,N=A.onVisibleChange,W=A.afterVisibleChange,K=A.transitionName,k=A.animation,C=A.motion,V=A.placement,ne=V===void 0?"right":V,pe=A.align,Te=pe===void 0?{}:pe,Ke=A.destroyTooltipOnHide,ve=Ke===void 0?!1:Ke,Ue=A.defaultVisible,Be=A.getTooltipContainer,Me=A.overlayInnerStyle,St=A.arrowContent,He=A.overlay,ut=A.id,$e=A.showArrow,bt=$e===void 0?!0:$e,Ee=A.classNames,be=A.styles,ue=(0,F.Z)(A,d),ke=(0,h.Z)(ut),Fe=(0,G.useRef)(null);(0,G.useImperativeHandle)(O,function(){return Fe.current});var We=(0,_.Z)({},ue);"visible"in A&&(We.popupVisible=A.visible);var ie=function(){return G.createElement(D,{key:"content",prefixCls:z,id:ke,bodyClassName:Ee==null?void 0:Ee.body,overlayInnerStyle:(0,_.Z)((0,_.Z)({},Me),be==null?void 0:be.body)},He)},fe=function(){var Re=G.Children.only(Z),Oe=(Re==null?void 0:Re.props)||{},Ve=(0,_.Z)((0,_.Z)({},Oe),{},{"aria-describedby":He?ke:null});return G.cloneElement(Z,Ve)};return G.createElement(v.Z,(0,w.Z)({popupClassName:P()(U,Ee==null?void 0:Ee.root),prefixCls:z,popup:ie,action:$,builtinPlacements:c,popupPlacement:ne,ref:Fe,popupAlign:Te,getPopupContainer:Be,onPopupVisibleChange:N,afterPopupVisibleChange:W,popupTransitionName:K,popupAnimation:k,popupMotion:C,defaultPopupVisible:Ue,autoDestroy:ve,mouseLeaveDelay:se,popupStyle:(0,_.Z)((0,_.Z)({},ce),be==null?void 0:be.root),mouseEnterDelay:Y,arrow:bt},We),fe())},T=(0,G.forwardRef)(E),L=T},49658:function(yt,me){"use strict";me.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var b=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(b)||/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(b==null?void 0:b.substr(0,4))}},83145:function(yt,me,b){"use strict";Object.defineProperty(me,"__esModule",{value:!0}),me.CopyToClipboard=void 0;var I=G(b(59301)),P=G(b(25769));function G(x){return x&&x.__esModule?x:{default:x}}function D(x){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(O){return typeof O}:D=function(O){return O&&typeof Symbol=="function"&&O.constructor===Symbol&&O!==Symbol.prototype?"symbol":typeof O},D(x)}function w(x,A){var O=Object.keys(x);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(x);A&&(U=U.filter(function(B){return Object.getOwnPropertyDescriptor(x,B).enumerable})),O.push.apply(O,U)}return O}function _(x){for(var A=1;A<arguments.length;A++){var O=arguments[A]!=null?arguments[A]:{};A%2?w(O,!0).forEach(function(U){T(x,U,O[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(O)):w(O).forEach(function(U){Object.defineProperty(x,U,Object.getOwnPropertyDescriptor(O,U))})}return x}function F(x,A){if(x==null)return{};var O=v(x,A),U,B;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(x);for(B=0;B<$.length;B++)U=$[B],!(A.indexOf(U)>=0)&&Object.prototype.propertyIsEnumerable.call(x,U)&&(O[U]=x[U])}return O}function v(x,A){if(x==null)return{};var O={},U=Object.keys(x),B,$;for($=0;$<U.length;$++)B=U[$],!(A.indexOf(B)>=0)&&(O[B]=x[B]);return O}function s(x,A){if(!(x instanceof A))throw new TypeError("Cannot call a class as a function")}function y(x,A){for(var O=0;O<A.length;O++){var U=A[O];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(x,U.key,U)}}function f(x,A,O){return A&&y(x.prototype,A),O&&y(x,O),x}function c(x,A){return A&&(D(A)==="object"||typeof A=="function")?A:h(x)}function l(x){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(O){return O.__proto__||Object.getPrototypeOf(O)},l(x)}function h(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function d(x,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(A&&A.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),A&&E(x,A)}function E(x,A){return E=Object.setPrototypeOf||function(U,B){return U.__proto__=B,U},E(x,A)}function T(x,A,O){return A in x?Object.defineProperty(x,A,{value:O,enumerable:!0,configurable:!0,writable:!0}):x[A]=O,x}var L=function(x){d(A,x);function A(){var O,U;s(this,A);for(var B=arguments.length,$=new Array(B),M=0;M<B;M++)$[M]=arguments[M];return U=c(this,(O=l(A)).call.apply(O,[this].concat($))),T(h(U),"onClick",function(Y){var q=U.props,se=q.text,ce=q.onCopy,J=q.children,z=q.options,Z=I.default.Children.only(J),N=(0,P.default)(se,z);ce&&ce(se,N),Z&&Z.props&&typeof Z.props.onClick=="function"&&Z.props.onClick(Y)}),U}return f(A,[{key:"render",value:function(){var U=this.props,B=U.text,$=U.onCopy,M=U.options,Y=U.children,q=F(U,["text","onCopy","options","children"]),se=I.default.Children.only(Y);return I.default.cloneElement(se,_({},q,{onClick:this.onClick}))}}]),A}(I.default.PureComponent);me.CopyToClipboard=L,T(L,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(yt,me,b){"use strict";var I=b(83145),P=I.CopyToClipboard;P.CopyToClipboard=P,yt.exports=P},76374:function(yt,me,b){"use strict";var I=function(){if(typeof Map!="undefined")return Map;function J(z,Z){var N=-1;return z.some(function(W,K){return W[0]===Z?(N=K,!0):!1}),N}return function(){function z(){this.__entries__=[]}return Object.defineProperty(z.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),z.prototype.get=function(Z){var N=J(this.__entries__,Z),W=this.__entries__[N];return W&&W[1]},z.prototype.set=function(Z,N){var W=J(this.__entries__,Z);~W?this.__entries__[W][1]=N:this.__entries__.push([Z,N])},z.prototype.delete=function(Z){var N=this.__entries__,W=J(N,Z);~W&&N.splice(W,1)},z.prototype.has=function(Z){return!!~J(this.__entries__,Z)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(Z,N){N===void 0&&(N=null);for(var W=0,K=this.__entries__;W<K.length;W++){var k=K[W];Z.call(N,k[1],k[0])}},z}()}(),P=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,G=function(){return typeof b.g!="undefined"&&b.g.Math===Math?b.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),D=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(G):function(J){return setTimeout(function(){return J(Date.now())},1e3/60)}}(),w=2;function _(J,z){var Z=!1,N=!1,W=0;function K(){Z&&(Z=!1,J()),N&&C()}function k(){D(K)}function C(){var V=Date.now();if(Z){if(V-W<w)return;N=!0}else Z=!0,N=!1,setTimeout(k,z);W=V}return C}var F=20,v=["top","right","bottom","left","width","height","size","weight"],s=typeof MutationObserver!="undefined",y=function(){function J(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=_(this.refresh.bind(this),F)}return J.prototype.addObserver=function(z){~this.observers_.indexOf(z)||this.observers_.push(z),this.connected_||this.connect_()},J.prototype.removeObserver=function(z){var Z=this.observers_,N=Z.indexOf(z);~N&&Z.splice(N,1),!Z.length&&this.connected_&&this.disconnect_()},J.prototype.refresh=function(){var z=this.updateObservers_();z&&this.refresh()},J.prototype.updateObservers_=function(){var z=this.observers_.filter(function(Z){return Z.gatherActive(),Z.hasActive()});return z.forEach(function(Z){return Z.broadcastActive()}),z.length>0},J.prototype.connect_=function(){!P||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),s?(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)},J.prototype.disconnect_=function(){!P||!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)},J.prototype.onTransitionEnd_=function(z){var Z=z.propertyName,N=Z===void 0?"":Z,W=v.some(function(K){return!!~N.indexOf(K)});W&&this.refresh()},J.getInstance=function(){return this.instance_||(this.instance_=new J),this.instance_},J.instance_=null,J}(),f=function(J,z){for(var Z=0,N=Object.keys(z);Z<N.length;Z++){var W=N[Z];Object.defineProperty(J,W,{value:z[W],enumerable:!1,writable:!1,configurable:!0})}return J},c=function(J){var z=J&&J.ownerDocument&&J.ownerDocument.defaultView;return z||G},l=B(0,0,0,0);function h(J){return parseFloat(J)||0}function d(J){for(var z=[],Z=1;Z<arguments.length;Z++)z[Z-1]=arguments[Z];return z.reduce(function(N,W){var K=J["border-"+W+"-width"];return N+h(K)},0)}function E(J){for(var z=["top","right","bottom","left"],Z={},N=0,W=z;N<W.length;N++){var K=W[N],k=J["padding-"+K];Z[K]=h(k)}return Z}function T(J){var z=J.getBBox();return B(0,0,z.width,z.height)}function L(J){var z=J.clientWidth,Z=J.clientHeight;if(!z&&!Z)return l;var N=c(J).getComputedStyle(J),W=E(N),K=W.left+W.right,k=W.top+W.bottom,C=h(N.width),V=h(N.height);if(N.boxSizing==="border-box"&&(Math.round(C+K)!==z&&(C-=d(N,"left","right")+K),Math.round(V+k)!==Z&&(V-=d(N,"top","bottom")+k)),!A(J)){var ne=Math.round(C+K)-z,pe=Math.round(V+k)-Z;Math.abs(ne)!==1&&(C-=ne),Math.abs(pe)!==1&&(V-=pe)}return B(W.left,W.top,C,V)}var x=function(){return typeof SVGGraphicsElement!="undefined"?function(J){return J instanceof c(J).SVGGraphicsElement}:function(J){return J instanceof c(J).SVGElement&&typeof J.getBBox=="function"}}();function A(J){return J===c(J).document.documentElement}function O(J){return P?x(J)?T(J):L(J):l}function U(J){var z=J.x,Z=J.y,N=J.width,W=J.height,K=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,k=Object.create(K.prototype);return f(k,{x:z,y:Z,width:N,height:W,top:Z,right:z+N,bottom:W+Z,left:z}),k}function B(J,z,Z,N){return{x:J,y:z,width:Z,height:N}}var $=function(){function J(z){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=B(0,0,0,0),this.target=z}return J.prototype.isActive=function(){var z=O(this.target);return this.contentRect_=z,z.width!==this.broadcastWidth||z.height!==this.broadcastHeight},J.prototype.broadcastRect=function(){var z=this.contentRect_;return this.broadcastWidth=z.width,this.broadcastHeight=z.height,z},J}(),M=function(){function J(z,Z){var N=U(Z);f(this,{target:z,contentRect:N})}return J}(),Y=function(){function J(z,Z,N){if(this.activeObservations_=[],this.observations_=new I,typeof z!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=z,this.controller_=Z,this.callbackCtx_=N}return J.prototype.observe=function(z){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(z instanceof c(z).Element))throw new TypeError('parameter 1 is not of type "Element".');var Z=this.observations_;Z.has(z)||(Z.set(z,new $(z)),this.controller_.addObserver(this),this.controller_.refresh())}},J.prototype.unobserve=function(z){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(z instanceof c(z).Element))throw new TypeError('parameter 1 is not of type "Element".');var Z=this.observations_;Z.has(z)&&(Z.delete(z),Z.size||this.controller_.removeObserver(this))}},J.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},J.prototype.gatherActive=function(){var z=this;this.clearActive(),this.observations_.forEach(function(Z){Z.isActive()&&z.activeObservations_.push(Z)})},J.prototype.broadcastActive=function(){if(this.hasActive()){var z=this.callbackCtx_,Z=this.activeObservations_.map(function(N){return new M(N.target,N.broadcastRect())});this.callback_.call(z,Z,z),this.clearActive()}},J.prototype.clearActive=function(){this.activeObservations_.splice(0)},J.prototype.hasActive=function(){return this.activeObservations_.length>0},J}(),q=typeof WeakMap!="undefined"?new WeakMap:new I,se=function(){function J(z){if(!(this instanceof J))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var Z=y.getInstance(),N=new Y(z,Z,this);q.set(this,N)}return J}();["observe","unobserve","disconnect"].forEach(function(J){se.prototype[J]=function(){var z;return(z=q.get(this))[J].apply(z,arguments)}});var ce=function(){return typeof G.ResizeObserver!="undefined"?G.ResizeObserver:se}();me.Z=ce},98040:function(yt){yt.exports=function(){var me=document.getSelection();if(!me.rangeCount)return function(){};for(var b=document.activeElement,I=[],P=0;P<me.rangeCount;P++)I.push(me.getRangeAt(P));switch(b.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":b.blur();break;default:b=null;break}return me.removeAllRanges(),function(){me.type==="Caret"&&me.removeAllRanges(),me.rangeCount||I.forEach(function(G){me.addRange(G)}),b&&b.focus()}}},34376:function(yt){(function(me,b){if(1)yt.exports=b();else var I,P})(window,function(){return function(me){var b={};function I(P){if(b[P])return b[P].exports;var G=b[P]={i:P,l:!1,exports:{}};return me[P].call(G.exports,G,G.exports,I),G.l=!0,G.exports}return I.m=me,I.c=b,I.d=function(P,G,D){I.o(P,G)||Object.defineProperty(P,G,{enumerable:!0,get:D})},I.r=function(P){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(P,"__esModule",{value:!0})},I.t=function(P,G){if(1&G&&(P=I(P)),8&G||4&G&&typeof P=="object"&&P&&P.__esModule)return P;var D=Object.create(null);if(I.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:P}),2&G&&typeof P!="string")for(var w in P)I.d(D,w,function(_){return P[_]}.bind(null,w));return D},I.n=function(P){var G=P&&P.__esModule?function(){return P.default}:function(){return P};return I.d(G,"a",G),G},I.o=function(P,G){return Object.prototype.hasOwnProperty.call(P,G)},I.p="",I(I.s=34)}([function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.forwardEvent=b.EventEmitter=void 0;var P=function(){function G(){this._listeners=[],this._disposed=!1}return Object.defineProperty(G.prototype,"event",{get:function(){var D=this;return this._event||(this._event=function(w){return D._listeners.push(w),{dispose:function(){if(!D._disposed){for(var _=0;_<D._listeners.length;_++)if(D._listeners[_]===w)return void D._listeners.splice(_,1)}}}}),this._event},enumerable:!1,configurable:!0}),G.prototype.fire=function(D,w){for(var _=[],F=0;F<this._listeners.length;F++)_.push(this._listeners[F]);for(F=0;F<_.length;F++)_[F].call(void 0,D,w)},G.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},G}();b.EventEmitter=P,b.forwardEvent=function(G,D){return G(function(w){return D.fire(w)})}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.IUnicodeService=b.IOptionsService=b.ILogService=b.IInstantiationService=b.IDirtyRowService=b.ICharsetService=b.ICoreService=b.ICoreMouseService=b.IBufferService=void 0;var P=I(14);b.IBufferService=P.createDecorator("BufferService"),b.ICoreMouseService=P.createDecorator("CoreMouseService"),b.ICoreService=P.createDecorator("CoreService"),b.ICharsetService=P.createDecorator("CharsetService"),b.IDirtyRowService=P.createDecorator("DirtyRowService"),b.IInstantiationService=P.createDecorator("InstantiationService"),b.ILogService=P.createDecorator("LogService"),b.IOptionsService=P.createDecorator("OptionsService"),b.IUnicodeService=P.createDecorator("UnicodeService")},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.getDisposeArrayDisposable=b.disposeArray=b.Disposable=void 0;var P=function(){function D(){this._disposables=[],this._isDisposed=!1}return D.prototype.dispose=function(){this._isDisposed=!0;for(var w=0,_=this._disposables;w<_.length;w++)_[w].dispose();this._disposables.length=0},D.prototype.register=function(w){return this._disposables.push(w),w},D.prototype.unregister=function(w){var _=this._disposables.indexOf(w);_!==-1&&this._disposables.splice(_,1)},D}();function G(D){for(var w=0,_=D;w<_.length;w++)_[w].dispose();D.length=0}b.Disposable=P,b.disposeArray=G,b.getDisposeArrayDisposable=function(D){return{dispose:function(){return G(D)}}}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.WHITESPACE_CELL_CODE=b.WHITESPACE_CELL_WIDTH=b.WHITESPACE_CELL_CHAR=b.NULL_CELL_CODE=b.NULL_CELL_WIDTH=b.NULL_CELL_CHAR=b.CHAR_DATA_CODE_INDEX=b.CHAR_DATA_WIDTH_INDEX=b.CHAR_DATA_CHAR_INDEX=b.CHAR_DATA_ATTR_INDEX=b.DEFAULT_ATTR=b.DEFAULT_COLOR=void 0,b.DEFAULT_COLOR=256,b.DEFAULT_ATTR=256|b.DEFAULT_COLOR<<9,b.CHAR_DATA_ATTR_INDEX=0,b.CHAR_DATA_CHAR_INDEX=1,b.CHAR_DATA_WIDTH_INDEX=2,b.CHAR_DATA_CODE_INDEX=3,b.NULL_CELL_CHAR="",b.NULL_CELL_WIDTH=1,b.NULL_CELL_CODE=0,b.WHITESPACE_CELL_CHAR=" ",b.WHITESPACE_CELL_WIDTH=1,b.WHITESPACE_CELL_CODE=32},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(v,s){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,f){y.__proto__=f}||function(y,f){for(var c in f)f.hasOwnProperty(c)&&(y[c]=f[c])})(v,s)},function(v,s){function y(){this.constructor=v}P(v,s),v.prototype=s===null?Object.create(s):(y.prototype=s.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.CellData=void 0;var D=I(8),w=I(3),_=I(6),F=function(v){function s(){var y=v!==null&&v.apply(this,arguments)||this;return y.content=0,y.fg=0,y.bg=0,y.extended=new _.ExtendedAttrs,y.combinedData="",y}return G(s,v),s.fromCharData=function(y){var f=new s;return f.setFromCharData(y),f},s.prototype.isCombined=function(){return 2097152&this.content},s.prototype.getWidth=function(){return this.content>>22},s.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?D.stringFromCodePoint(2097151&this.content):""},s.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},s.prototype.setFromCharData=function(y){this.fg=y[w.CHAR_DATA_ATTR_INDEX],this.bg=0;var f=!1;if(y[w.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(y[w.CHAR_DATA_CHAR_INDEX].length===2){var c=y[w.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){var l=y[w.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=l&&l<=57343?this.content=1024*(c-55296)+l-56320+65536|y[w.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=y[w.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[w.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=y[w.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[w.CHAR_DATA_WIDTH_INDEX]<<22)},s.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},s}(_.AttributeData);b.CellData=F},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ISoundService=b.ISelectionService=b.IRenderService=b.IMouseService=b.ICoreBrowserService=b.ICharSizeService=void 0;var P=I(14);b.ICharSizeService=P.createDecorator("CharSizeService"),b.ICoreBrowserService=P.createDecorator("CoreBrowserService"),b.IMouseService=P.createDecorator("MouseService"),b.IRenderService=P.createDecorator("RenderService"),b.ISelectionService=P.createDecorator("SelectionService"),b.ISoundService=P.createDecorator("SoundService")},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ExtendedAttrs=b.AttributeData=void 0;var P=function(){function D(){this.fg=0,this.bg=0,this.extended=new G}return D.toColorRGB=function(w){return[w>>>16&255,w>>>8&255,255&w]},D.fromColorRGB=function(w){return(255&w[0])<<16|(255&w[1])<<8|255&w[2]},D.prototype.clone=function(){var w=new D;return w.fg=this.fg,w.bg=this.bg,w.extended=this.extended.clone(),w},D.prototype.isInverse=function(){return 67108864&this.fg},D.prototype.isBold=function(){return 134217728&this.fg},D.prototype.isUnderline=function(){return 268435456&this.fg},D.prototype.isBlink=function(){return 536870912&this.fg},D.prototype.isInvisible=function(){return 1073741824&this.fg},D.prototype.isItalic=function(){return 67108864&this.bg},D.prototype.isDim=function(){return 134217728&this.bg},D.prototype.getFgColorMode=function(){return 50331648&this.fg},D.prototype.getBgColorMode=function(){return 50331648&this.bg},D.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},D.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},D.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},D.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},D.prototype.isFgDefault=function(){return(50331648&this.fg)==0},D.prototype.isBgDefault=function(){return(50331648&this.bg)==0},D.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},D.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},D.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},D.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},D.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},D.prototype.getUnderlineColor=function(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()},D.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},D.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()},D.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()},D.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()},D.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},D}();b.AttributeData=P;var G=function(){function D(w,_){w===void 0&&(w=0),_===void 0&&(_=-1),this.underlineStyle=w,this.underlineColor=_}return D.prototype.clone=function(){return new D(this.underlineStyle,this.underlineColor)},D.prototype.isEmpty=function(){return this.underlineStyle===0},D}();b.ExtendedAttrs=G},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.addDisposableDomListener=void 0,b.addDisposableDomListener=function(P,G,D,w){P.addEventListener(G,D,w);var _=!1;return{dispose:function(){_||(_=!0,P.removeEventListener(G,D,w))}}}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Utf8ToUtf32=b.StringToUtf32=b.utf32ToString=b.stringFromCodePoint=void 0,b.stringFromCodePoint=function(D){return D>65535?(D-=65536,String.fromCharCode(55296+(D>>10))+String.fromCharCode(D%1024+56320)):String.fromCharCode(D)},b.utf32ToString=function(D,w,_){w===void 0&&(w=0),_===void 0&&(_=D.length);for(var F="",v=w;v<_;++v){var s=D[v];s>65535?(s-=65536,F+=String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):F+=String.fromCharCode(s)}return F};var P=function(){function D(){this._interim=0}return D.prototype.clear=function(){this._interim=0},D.prototype.decode=function(w,_){var F=w.length;if(!F)return 0;var v=0,s=0;this._interim&&(56320<=(c=w.charCodeAt(s++))&&c<=57343?_[v++]=1024*(this._interim-55296)+c-56320+65536:(_[v++]=this._interim,_[v++]=c),this._interim=0);for(var y=s;y<F;++y){var f=w.charCodeAt(y);if(55296<=f&&f<=56319){if(++y>=F)return this._interim=f,v;var c;56320<=(c=w.charCodeAt(y))&&c<=57343?_[v++]=1024*(f-55296)+c-56320+65536:(_[v++]=f,_[v++]=c)}else _[v++]=f}return v},D}();b.StringToUtf32=P;var G=function(){function D(){this.interim=new Uint8Array(3)}return D.prototype.clear=function(){this.interim.fill(0)},D.prototype.decode=function(w,_){var F=w.length;if(!F)return 0;var v,s,y,f,c=0,l=0,h=0;if(this.interim[0]){var d=!1,E=this.interim[0];E&=(224&E)==192?31:(240&E)==224?15:7;for(var T=0,L=void 0;(L=63&this.interim[++T])&&T<4;)E<<=6,E|=L;for(var x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,A=x-T;h<A;){if(h>=F)return 0;if((192&(L=w[h++]))!=128){h--,d=!0;break}this.interim[T++]=L,E<<=6,E|=63&L}d||(x===2?E<128?h--:_[c++]=E:x===3?E<2048||E>=55296&&E<=57343||(_[c++]=E):E<65536||E>1114111||(_[c++]=E)),this.interim.fill(0)}for(var O=F-4,U=h;U<F;){for(;!(!(U<O)||128&(v=w[U])||128&(s=w[U+1])||128&(y=w[U+2])||128&(f=w[U+3]));)_[c++]=v,_[c++]=s,_[c++]=y,_[c++]=f,U+=4;if((v=w[U++])<128)_[c++]=v;else if((224&v)==192){if(U>=F)return this.interim[0]=v,c;if((192&(s=w[U++]))!=128){U--;continue}if((l=(31&v)<<6|63&s)<128){U--;continue}_[c++]=l}else if((240&v)==224){if(U>=F)return this.interim[0]=v,c;if((192&(s=w[U++]))!=128){U--;continue}if(U>=F)return this.interim[0]=v,this.interim[1]=s,c;if((192&(y=w[U++]))!=128){U--;continue}if((l=(15&v)<<12|(63&s)<<6|63&y)<2048||l>=55296&&l<=57343)continue;_[c++]=l}else if((248&v)==240){if(U>=F)return this.interim[0]=v,c;if((192&(s=w[U++]))!=128){U--;continue}if(U>=F)return this.interim[0]=v,this.interim[1]=s,c;if((192&(y=w[U++]))!=128){U--;continue}if(U>=F)return this.interim[0]=v,this.interim[1]=s,this.interim[2]=y,c;if((192&(f=w[U++]))!=128){U--;continue}if((l=(7&v)<<18|(63&s)<<12|(63&y)<<6|63&f)<65536||l>1114111)continue;_[c++]=l}}return c},D}();b.Utf8ToUtf32=G},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CHAR_ATLAS_CELL_SPACING=b.DIM_OPACITY=b.INVERTED_DEFAULT_COLOR=void 0,b.INVERTED_DEFAULT_COLOR=257,b.DIM_OPACITY=.5,b.CHAR_ATLAS_CELL_SPACING=1},function(me,b,I){"use strict";var P,G,D,w;function _(v){var s=v.toString(16);return s.length<2?"0"+s:s}function F(v,s){return v<s?(s+.05)/(v+.05):(v+.05)/(s+.05)}Object.defineProperty(b,"__esModule",{value:!0}),b.contrastRatio=b.toPaddedHex=b.rgba=b.rgb=b.css=b.color=b.channels=void 0,function(v){v.toCss=function(s,y,f,c){return c!==void 0?"#"+_(s)+_(y)+_(f)+_(c):"#"+_(s)+_(y)+_(f)},v.toRgba=function(s,y,f,c){return c===void 0&&(c=255),(s<<24|y<<16|f<<8|c)>>>0}}(P=b.channels||(b.channels={})),(G=b.color||(b.color={})).blend=function(v,s){var y=(255&s.rgba)/255;if(y===1)return{css:s.css,rgba:s.rgba};var f=s.rgba>>24&255,c=s.rgba>>16&255,l=s.rgba>>8&255,h=v.rgba>>24&255,d=v.rgba>>16&255,E=v.rgba>>8&255,T=h+Math.round((f-h)*y),L=d+Math.round((c-d)*y),x=E+Math.round((l-E)*y);return{css:P.toCss(T,L,x),rgba:P.toRgba(T,L,x)}},G.isOpaque=function(v){return(255&v.rgba)==255},G.ensureContrastRatio=function(v,s,y){var f=w.ensureContrastRatio(v.rgba,s.rgba,y);if(f)return w.toColor(f>>24&255,f>>16&255,f>>8&255)},G.opaque=function(v){var s=(255|v.rgba)>>>0,y=w.toChannels(s),f=y[0],c=y[1],l=y[2];return{css:P.toCss(f,c,l),rgba:s}},G.opacity=function(v,s){var y=Math.round(255*s),f=w.toChannels(v.rgba),c=f[0],l=f[1],h=f[2];return{css:P.toCss(c,l,h,y),rgba:P.toRgba(c,l,h,y)}},(b.css||(b.css={})).toColor=function(v){switch(v.length){case 7:return{css:v,rgba:(parseInt(v.slice(1),16)<<8|255)>>>0};case 9:return{css:v,rgba:parseInt(v.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(v){function s(y,f,c){var l=y/255,h=f/255,d=c/255;return .2126*(l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4))+.7152*(h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4))+.0722*(d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4))}v.relativeLuminance=function(y){return s(y>>16&255,y>>8&255,255&y)},v.relativeLuminance2=s}(D=b.rgb||(b.rgb={})),function(v){function s(f,c,l){for(var h=f>>24&255,d=f>>16&255,E=f>>8&255,T=c>>24&255,L=c>>16&255,x=c>>8&255,A=F(D.relativeLuminance2(T,x,L),D.relativeLuminance2(h,d,E));A<l&&(T>0||L>0||x>0);)T-=Math.max(0,Math.ceil(.1*T)),L-=Math.max(0,Math.ceil(.1*L)),x-=Math.max(0,Math.ceil(.1*x)),A=F(D.relativeLuminance2(T,x,L),D.relativeLuminance2(h,d,E));return(T<<24|L<<16|x<<8|255)>>>0}function y(f,c,l){for(var h=f>>24&255,d=f>>16&255,E=f>>8&255,T=c>>24&255,L=c>>16&255,x=c>>8&255,A=F(D.relativeLuminance2(T,x,L),D.relativeLuminance2(h,d,E));A<l&&(T<255||L<255||x<255);)T=Math.min(255,T+Math.ceil(.1*(255-T))),L=Math.min(255,L+Math.ceil(.1*(255-L))),x=Math.min(255,x+Math.ceil(.1*(255-x))),A=F(D.relativeLuminance2(T,x,L),D.relativeLuminance2(h,d,E));return(T<<24|L<<16|x<<8|255)>>>0}v.ensureContrastRatio=function(f,c,l){var h=D.relativeLuminance(f>>8),d=D.relativeLuminance(c>>8);if(F(h,d)<l)return d<h?s(f,c,l):y(f,c,l)},v.reduceLuminance=s,v.increaseLuminance=y,v.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]},v.toColor=function(f,c,l){return{css:P.toCss(f,c,l),rgba:P.toRgba(f,c,l)}}}(w=b.rgba||(b.rgba={})),b.toPaddedHex=_,b.contrastRatio=F},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.isLinux=b.isWindows=b.isIphone=b.isIpad=b.isMac=b.isSafari=b.isFirefox=void 0;var P=typeof navigator=="undefined",G=P?"node":navigator.userAgent,D=P?"node":navigator.platform;function w(_,F){return _.indexOf(F)>=0}b.isFirefox=!!~G.indexOf("Firefox"),b.isSafari=/^((?!chrome|android).)*safari/i.test(G),b.isMac=w(["Macintosh","MacIntel","MacPPC","Mac68K"],D),b.isIpad=D==="iPad",b.isIphone=D==="iPhone",b.isWindows=w(["Windows","Win16","Win32","WinCE"],D),b.isLinux=D.indexOf("Linux")>=0},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.C1=b.C0=void 0,function(P){P.NUL="\0",P.SOH="",P.STX="",P.ETX="",P.EOT="",P.ENQ="",P.ACK="",P.BEL="\x07",P.BS="\b",P.HT=" ",P.LF=`
|
|
|
`,P.VT="\v",P.FF="\f",P.CR="\r",P.SO="",P.SI="",P.DLE="",P.DC1="",P.DC2="",P.DC3="",P.DC4="",P.NAK="",P.SYN="",P.ETB="",P.CAN="",P.EM="",P.SUB="",P.ESC="\x1B",P.FS="",P.GS="",P.RS="",P.US="",P.SP=" ",P.DEL="\x7F"}(b.C0||(b.C0={})),function(P){P.PAD="\x80",P.HOP="\x81",P.BPH="\x82",P.NBH="\x83",P.IND="\x84",P.NEL="\x85",P.SSA="\x86",P.ESA="\x87",P.HTS="\x88",P.HTJ="\x89",P.VTS="\x8A",P.PLD="\x8B",P.PLU="\x8C",P.RI="\x8D",P.SS2="\x8E",P.SS3="\x8F",P.DCS="\x90",P.PU1="\x91",P.PU2="\x92",P.STS="\x93",P.CCH="\x94",P.MW="\x95",P.SPA="\x96",P.EPA="\x97",P.SOS="\x98",P.SGCI="\x99",P.SCI="\x9A",P.CSI="\x9B",P.ST="\x9C",P.OSC="\x9D",P.PM="\x9E",P.APC="\x9F"}(b.C1||(b.C1={}))},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BaseRenderLayer=void 0;var P=I(3),G=I(9),D=I(25),w=I(6),_=I(28),F=I(10),v=I(17),s=function(){function y(f,c,l,h,d,E,T,L){this._container=f,this._alpha=h,this._colors=d,this._rendererId=E,this._bufferService=T,this._optionsService=L,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+c+"-layer"),this._canvas.style.zIndex=l.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return y.prototype.dispose=function(){var f;v.removeElementFromParent(this._canvas),(f=this._charAtlas)===null||f===void 0||f.dispose()},y.prototype._initCanvas=function(){this._ctx=_.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},y.prototype.onOptionsChanged=function(){},y.prototype.onBlur=function(){},y.prototype.onFocus=function(){},y.prototype.onCursorMove=function(){},y.prototype.onGridChanged=function(f,c){},y.prototype.onSelectionChanged=function(f,c,l){l===void 0&&(l=!1)},y.prototype.setColors=function(f){this._refreshCharAtlas(f)},y.prototype._setTransparency=function(f){if(f!==this._alpha){var c=this._canvas;this._alpha=f,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,c),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},y.prototype._refreshCharAtlas=function(f){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=D.acquireCharAtlas(this._optionsService.options,this._rendererId,f,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},y.prototype.resize=function(f){this._scaledCellWidth=f.scaledCellWidth,this._scaledCellHeight=f.scaledCellHeight,this._scaledCharWidth=f.scaledCharWidth,this._scaledCharHeight=f.scaledCharHeight,this._scaledCharLeft=f.scaledCharLeft,this._scaledCharTop=f.scaledCharTop,this._canvas.width=f.scaledCanvasWidth,this._canvas.height=f.scaledCanvasHeight,this._canvas.style.width=f.canvasWidth+"px",this._canvas.style.height=f.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},y.prototype._fillCells=function(f,c,l,h){this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,h*this._scaledCellHeight)},y.prototype._fillBottomLineAtCells=function(f,c,l){l===void 0&&(l=1),this._ctx.fillRect(f*this._scaledCellWidth,(c+1)*this._scaledCellHeight-window.devicePixelRatio-1,l*this._scaledCellWidth,window.devicePixelRatio)},y.prototype._fillLeftLineAtCell=function(f,c,l){this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,window.devicePixelRatio*l,this._scaledCellHeight)},y.prototype._strokeRectAtCell=function(f,c,l,h){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(f*this._scaledCellWidth+window.devicePixelRatio/2,c*this._scaledCellHeight+window.devicePixelRatio/2,l*this._scaledCellWidth-window.devicePixelRatio,h*this._scaledCellHeight-window.devicePixelRatio)},y.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},y.prototype._clearCells=function(f,c,l,h){this._alpha?this._ctx.clearRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,h*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(f*this._scaledCellWidth,c*this._scaledCellHeight,l*this._scaledCellWidth,h*this._scaledCellHeight))},y.prototype._fillCharTrueColor=function(f,c,l){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(l),this._ctx.fillText(f.getChars(),c*this._scaledCellWidth+this._scaledCharLeft,l*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},y.prototype._drawChars=function(f,c,l){var h,d,E=this._getContrastColor(f);E||f.isFgRGB()||f.isBgRGB()?this._drawUncachedChars(f,c,l,E):(f.isInverse()?(h=f.isBgDefault()?G.INVERTED_DEFAULT_COLOR:f.getBgColor(),d=f.isFgDefault()?G.INVERTED_DEFAULT_COLOR:f.getFgColor()):(d=f.isBgDefault()?P.DEFAULT_COLOR:f.getBgColor(),h=f.isFgDefault()?P.DEFAULT_COLOR:f.getFgColor()),h+=this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&h<8?8:0,this._currentGlyphIdentifier.chars=f.getChars()||P.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=f.getCode()||P.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=d,this._currentGlyphIdentifier.fg=h,this._currentGlyphIdentifier.bold=!!f.isBold(),this._currentGlyphIdentifier.dim=!!f.isDim(),this._currentGlyphIdentifier.italic=!!f.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,c*this._scaledCellWidth+this._scaledCharLeft,l*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(f,c,l))},y.prototype._drawUncachedChars=function(f,c,l,h){if(this._ctx.save(),this._ctx.font=this._getFont(!!f.isBold(),!!f.isItalic()),this._ctx.textBaseline="middle",f.isInverse())if(h)this._ctx.fillStyle=h.css;else if(f.isBgDefault())this._ctx.fillStyle=F.color.opaque(this._colors.background).css;else if(f.isBgRGB())this._ctx.fillStyle="rgb("+w.AttributeData.toColorRGB(f.getBgColor()).join(",")+")";else{var d=f.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&d<8&&(d+=8),this._ctx.fillStyle=this._colors.ansi[d].css}else if(h)this._ctx.fillStyle=h.css;else if(f.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(f.isFgRGB())this._ctx.fillStyle="rgb("+w.AttributeData.toColorRGB(f.getFgColor()).join(",")+")";else{var E=f.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&E<8&&(E+=8),this._ctx.fillStyle=this._colors.ansi[E].css}this._clipRow(l),f.isDim()&&(this._ctx.globalAlpha=G.DIM_OPACITY),this._ctx.fillText(f.getChars(),c*this._scaledCellWidth+this._scaledCharLeft,l*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},y.prototype._clipRow=function(f){this._ctx.beginPath(),this._ctx.rect(0,f*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},y.prototype._getFont=function(f,c){return(c?"italic":"")+" "+(f?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},y.prototype._getContrastColor=function(f){if(this._optionsService.options.minimumContrastRatio!==1){var c=this._colors.contrastCache.getColor(f.bg,f.fg);if(c!==void 0)return c||void 0;var l=f.getFgColor(),h=f.getFgColorMode(),d=f.getBgColor(),E=f.getBgColorMode(),T=!!f.isInverse(),L=!!f.isInverse();if(T){var x=l;l=d,d=x;var A=h;h=E,E=A}var O=this._resolveBackgroundRgba(E,d,T),U=this._resolveForegroundRgba(h,l,T,L),B=F.rgba.ensureContrastRatio(O,U,this._optionsService.options.minimumContrastRatio);if(B){var $={css:F.channels.toCss(B>>24&255,B>>16&255,B>>8&255),rgba:B};return this._colors.contrastCache.setColor(f.bg,f.fg,$),$}this._colors.contrastCache.setColor(f.bg,f.fg,null)}},y.prototype._resolveBackgroundRgba=function(f,c,l){switch(f){case 16777216:case 33554432:return this._colors.ansi[c].rgba;case 50331648:return c<<8;case 0:default:return l?this._colors.foreground.rgba:this._colors.background.rgba}},y.prototype._resolveForegroundRgba=function(f,c,l,h){switch(f){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&h&&c<8&&(c+=8),this._colors.ansi[c].rgba;case 50331648:return c<<8;case 0:default:return l?this._colors.background.rgba:this._colors.foreground.rgba}},y}();b.BaseRenderLayer=s},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.createDecorator=b.getServiceDependencies=b.serviceRegistry=void 0;function P(G,D,w){D.di$target===D?D.di$dependencies.push({id:G,index:w}):(D.di$dependencies=[{id:G,index:w}],D.di$target=D)}b.serviceRegistry=new Map,b.getServiceDependencies=function(G){return G.di$dependencies||[]},b.createDecorator=function(G){if(b.serviceRegistry.has(G))return b.serviceRegistry.get(G);var D=function(w,_,F){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");P(D,w,F)};return D.toString=function(){return G},b.serviceRegistry.set(G,D),D}},function(me,b,I){"use strict";function P(G,D,w,_){if(w===void 0&&(w=0),_===void 0&&(_=G.length),w>=G.length)return G;w=(G.length+w)%G.length,_=_>=G.length?G.length:(G.length+_)%G.length;for(var F=w;F<_;++F)G[F]=D;return G}Object.defineProperty(b,"__esModule",{value:!0}),b.concat=b.fillFallback=b.fill=void 0,b.fill=function(G,D,w,_){return G.fill?G.fill(D,w,_):P(G,D,w,_)},b.fillFallback=P,b.concat=function(G,D){var w=new G.constructor(G.length+D.length);return w.set(G),w.set(D,G.length),w}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BufferLine=b.DEFAULT_ATTR_DATA=void 0;var P=I(8),G=I(3),D=I(4),w=I(6);b.DEFAULT_ATTR_DATA=Object.freeze(new w.AttributeData);var _=function(){function F(v,s,y){y===void 0&&(y=!1),this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);for(var f=s||D.CellData.fromCharData([0,G.NULL_CELL_CHAR,G.NULL_CELL_WIDTH,G.NULL_CELL_CODE]),c=0;c<v;++c)this.setCell(c,f);this.length=v}return F.prototype.get=function(v){var s=this._data[3*v+0],y=2097151&s;return[this._data[3*v+1],2097152&s?this._combined[v]:y?P.stringFromCodePoint(y):"",s>>22,2097152&s?this._combined[v].charCodeAt(this._combined[v].length-1):y]},F.prototype.set=function(v,s){this._data[3*v+1]=s[G.CHAR_DATA_ATTR_INDEX],s[G.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=s[1],this._data[3*v+0]=2097152|v|s[G.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=s[G.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[G.CHAR_DATA_WIDTH_INDEX]<<22},F.prototype.getWidth=function(v){return this._data[3*v+0]>>22},F.prototype.hasWidth=function(v){return 12582912&this._data[3*v+0]},F.prototype.getFg=function(v){return this._data[3*v+1]},F.prototype.getBg=function(v){return this._data[3*v+2]},F.prototype.hasContent=function(v){return 4194303&this._data[3*v+0]},F.prototype.getCodePoint=function(v){var s=this._data[3*v+0];return 2097152&s?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&s},F.prototype.isCombined=function(v){return 2097152&this._data[3*v+0]},F.prototype.getString=function(v){var s=this._data[3*v+0];return 2097152&s?this._combined[v]:2097151&s?P.stringFromCodePoint(2097151&s):""},F.prototype.loadCell=function(v,s){var y=3*v;return s.content=this._data[y+0],s.fg=this._data[y+1],s.bg=this._data[y+2],2097152&s.content&&(s.combinedData=this._combined[v]),268435456&s.bg&&(s.extended=this._extendedAttrs[v]),s},F.prototype.setCell=function(v,s){2097152&s.content&&(this._combined[v]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[v]=s.extended),this._data[3*v+0]=s.content,this._data[3*v+1]=s.fg,this._data[3*v+2]=s.bg},F.prototype.setCellFromCodePoint=function(v,s,y,f,c,l){268435456&c&&(this._extendedAttrs[v]=l),this._data[3*v+0]=s|y<<22,this._data[3*v+1]=f,this._data[3*v+2]=c},F.prototype.addCodepointToCell=function(v,s){var y=this._data[3*v+0];2097152&y?this._combined[v]+=P.stringFromCodePoint(s):(2097151&y?(this._combined[v]=P.stringFromCodePoint(2097151&y)+P.stringFromCodePoint(s),y&=-2097152,y|=2097152):y=s|1<<22,this._data[3*v+0]=y)},F.prototype.insertCells=function(v,s,y,f){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodePoint(v-1,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs),s<this.length-v){for(var c=new D.CellData,l=this.length-v-s-1;l>=0;--l)this.setCell(v+s+l,this.loadCell(v+l,c));for(l=0;l<s;++l)this.setCell(v+l,y)}else for(l=v;l<this.length;++l)this.setCell(l,y);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs)},F.prototype.deleteCells=function(v,s,y,f){if(v%=this.length,s<this.length-v){for(var c=new D.CellData,l=0;l<this.length-v-s;++l)this.setCell(v+l,this.loadCell(v+s+l,c));for(l=this.length-s;l<this.length;++l)this.setCell(l,y)}else for(l=v;l<this.length;++l)this.setCell(l,y);v&&this.getWidth(v-1)===2&&this.setCellFromCodePoint(v-1,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodePoint(v,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs)},F.prototype.replaceCells=function(v,s,y,f){for(v&&this.getWidth(v-1)===2&&this.setCellFromCodePoint(v-1,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodePoint(s,0,1,(f==null?void 0:f.fg)||0,(f==null?void 0:f.bg)||0,(f==null?void 0:f.extended)||new w.ExtendedAttrs);v<s&&v<this.length;)this.setCell(v++,y)},F.prototype.resize=function(v,s){if(v!==this.length){if(v>this.length){var y=new Uint32Array(3*v);this.length&&(3*v<this._data.length?y.set(this._data.subarray(0,3*v)):y.set(this._data)),this._data=y;for(var f=this.length;f<v;++f)this.setCell(f,s)}else if(v){(y=new Uint32Array(3*v)).set(this._data.subarray(0,3*v)),this._data=y;var c=Object.keys(this._combined);for(f=0;f<c.length;f++){var l=parseInt(c[f],10);l>=v&&delete this._combined[l]}}else this._data=new Uint32Array(0),this._combined={};this.length=v}},F.prototype.fill=function(v){this._combined={},this._extendedAttrs={};for(var s=0;s<this.length;++s)this.setCell(s,v)},F.prototype.copyFrom=function(v){for(var s in this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={},v._combined)this._combined[s]=v._combined[s];for(var s in this._extendedAttrs={},v._extendedAttrs)this._extendedAttrs[s]=v._extendedAttrs[s];this.isWrapped=v.isWrapped},F.prototype.clone=function(){var v=new F(0);for(var s in v._data=new Uint32Array(this._data),v.length=this.length,this._combined)v._combined[s]=this._combined[s];for(var s in this._extendedAttrs)v._extendedAttrs[s]=this._extendedAttrs[s];return v.isWrapped=this.isWrapped,v},F.prototype.getTrimmedLength=function(){for(var v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0},F.prototype.copyCellsFrom=function(v,s,y,f,c){var l=v._data;if(c)for(var h=f-1;h>=0;h--)for(var d=0;d<3;d++)this._data[3*(y+h)+d]=l[3*(s+h)+d];else for(h=0;h<f;h++)for(d=0;d<3;d++)this._data[3*(y+h)+d]=l[3*(s+h)+d];var E=Object.keys(v._combined);for(d=0;d<E.length;d++){var T=parseInt(E[d],10);T>=s&&(this._combined[T-s+y]=v._combined[T])}},F.prototype.translateToString=function(v,s,y){v===void 0&&(v=!1),s===void 0&&(s=0),y===void 0&&(y=this.length),v&&(y=Math.min(y,this.getTrimmedLength()));for(var f="";s<y;){var c=this._data[3*s+0],l=2097151&c;f+=2097152&c?this._combined[s]:l?P.stringFromCodePoint(l):G.WHITESPACE_CELL_CHAR,s+=c>>22||1}return f},F}();b.BufferLine=_},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.removeElementFromParent=void 0,b.removeElementFromParent=function(){for(var P,G=[],D=0;D<arguments.length;D++)G[D]=arguments[D];for(var w=0,_=G;w<_.length;w++){var F=_[w];(P=F==null?void 0:F.parentElement)===null||P===void 0||P.removeChild(F)}}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.tooMuchOutput=b.promptLabel=void 0,b.promptLabel="Terminal input",b.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(U,B){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function($,M){$.__proto__=M}||function($,M){for(var Y in M)M.hasOwnProperty(Y)&&($[Y]=M[Y])})(U,B)},function(U,B){function $(){this.constructor=U}P(U,B),U.prototype=B===null?Object.create(B):($.prototype=B.prototype,new $)});Object.defineProperty(b,"__esModule",{value:!0}),b.InputHandler=b.WindowsOptionsReportType=void 0;var D,w=I(12),_=I(20),F=I(39),v=I(2),s=I(15),y=I(8),f=I(16),c=I(0),l=I(3),h=I(4),d=I(6),E=I(22),T=I(24),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function x(U,B){if(U>24)return B.setWinLines||!1;switch(U){case 1:return!!B.restoreWin;case 2:return!!B.minimizeWin;case 3:return!!B.setWinPosition;case 4:return!!B.setWinSizePixels;case 5:return!!B.raiseWin;case 6:return!!B.lowerWin;case 7:return!!B.refreshWin;case 8:return!!B.setWinSizeChars;case 9:return!!B.maximizeWin;case 10:return!!B.fullscreenWin;case 11:return!!B.getWinState;case 13:return!!B.getWinPosition;case 14:return!!B.getWinSizePixels;case 15:return!!B.getScreenSizePixels;case 16:return!!B.getCellSizePixels;case 18:return!!B.getWinSizeChars;case 19:return!!B.getScreenSizeChars;case 20:return!!B.getIconTitle;case 21:return!!B.getWinTitle;case 22:return!!B.pushTitle;case 23:return!!B.popTitle;case 24:return!!B.setWinLines}return!1}(function(U){U[U.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",U[U.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D=b.WindowsOptionsReportType||(b.WindowsOptionsReportType={}));var A=function(){function U(B,$,M,Y){this._bufferService=B,this._coreService=$,this._logService=M,this._optionsService=Y,this._data=new Uint32Array(0)}return U.prototype.hook=function(B){this._data=new Uint32Array(0)},U.prototype.put=function(B,$,M){this._data=s.concat(this._data,B.subarray($,M))},U.prototype.unhook=function(B){if(B){var $=y.utf32ToString(this._data);switch(this._data=new Uint32Array(0),$){case'"q':return this._coreService.triggerDataEvent(w.C0.ESC+'P1$r0"q'+w.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(w.C0.ESC+'P1$r61;1"p'+w.C0.ESC+"\\");case"r":var M=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(w.C0.ESC+"P1$r"+M+w.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(w.C0.ESC+"P1$r0m"+w.C0.ESC+"\\");case" q":var Y={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return Y-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(w.C0.ESC+"P1$r"+Y+" q"+w.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",$),this._coreService.triggerDataEvent(w.C0.ESC+"P0$r"+w.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},U}(),O=function(U){function B($,M,Y,q,se,ce,J,z,Z){Z===void 0&&(Z=new F.EscapeSequenceParser);var N=U.call(this)||this;N._bufferService=$,N._charsetService=M,N._coreService=Y,N._dirtyRowService=q,N._logService=se,N._optionsService=ce,N._coreMouseService=J,N._unicodeService=z,N._parser=Z,N._parseBuffer=new Uint32Array(4096),N._stringDecoder=new y.StringToUtf32,N._utf8Decoder=new y.Utf8ToUtf32,N._workCell=new h.CellData,N._windowTitle="",N._iconName="",N._windowTitleStack=[],N._iconNameStack=[],N._curAttrData=f.DEFAULT_ATTR_DATA.clone(),N._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),N._onRequestBell=new c.EventEmitter,N._onRequestRefreshRows=new c.EventEmitter,N._onRequestReset=new c.EventEmitter,N._onRequestScroll=new c.EventEmitter,N._onRequestSyncScrollBar=new c.EventEmitter,N._onRequestWindowsOptionsReport=new c.EventEmitter,N._onA11yChar=new c.EventEmitter,N._onA11yTab=new c.EventEmitter,N._onCursorMove=new c.EventEmitter,N._onLineFeed=new c.EventEmitter,N._onScroll=new c.EventEmitter,N._onTitleChange=new c.EventEmitter,N.register(N._parser),N._parser.setCsiHandlerFallback(function(C,V){N._logService.debug("Unknown CSI code: ",{identifier:N._parser.identToString(C),params:V.toArray()})}),N._parser.setEscHandlerFallback(function(C){N._logService.debug("Unknown ESC code: ",{identifier:N._parser.identToString(C)})}),N._parser.setExecuteHandlerFallback(function(C){N._logService.debug("Unknown EXECUTE code: ",{code:C})}),N._parser.setOscHandlerFallback(function(C,V,ne){N._logService.debug("Unknown OSC code: ",{identifier:C,action:V,data:ne})}),N._parser.setDcsHandlerFallback(function(C,V,ne){V==="HOOK"&&(ne=ne.toArray()),N._logService.debug("Unknown DCS code: ",{identifier:N._parser.identToString(C),action:V,payload:ne})}),N._parser.setPrintHandler(function(C,V,ne){return N.print(C,V,ne)}),N._parser.setCsiHandler({final:"@"},function(C){return N.insertChars(C)}),N._parser.setCsiHandler({intermediates:" ",final:"@"},function(C){return N.scrollLeft(C)}),N._parser.setCsiHandler({final:"A"},function(C){return N.cursorUp(C)}),N._parser.setCsiHandler({intermediates:" ",final:"A"},function(C){return N.scrollRight(C)}),N._parser.setCsiHandler({final:"B"},function(C){return N.cursorDown(C)}),N._parser.setCsiHandler({final:"C"},function(C){return N.cursorForward(C)}),N._parser.setCsiHandler({final:"D"},function(C){return N.cursorBackward(C)}),N._parser.setCsiHandler({final:"E"},function(C){return N.cursorNextLine(C)}),N._parser.setCsiHandler({final:"F"},function(C){return N.cursorPrecedingLine(C)}),N._parser.setCsiHandler({final:"G"},function(C){return N.cursorCharAbsolute(C)}),N._parser.setCsiHandler({final:"H"},function(C){return N.cursorPosition(C)}),N._parser.setCsiHandler({final:"I"},function(C){return N.cursorForwardTab(C)}),N._parser.setCsiHandler({final:"J"},function(C){return N.eraseInDisplay(C)}),N._parser.setCsiHandler({prefix:"?",final:"J"},function(C){return N.eraseInDisplay(C)}),N._parser.setCsiHandler({final:"K"},function(C){return N.eraseInLine(C)}),N._parser.setCsiHandler({prefix:"?",final:"K"},function(C){return N.eraseInLine(C)}),N._parser.setCsiHandler({final:"L"},function(C){return N.insertLines(C)}),N._parser.setCsiHandler({final:"M"},function(C){return N.deleteLines(C)}),N._parser.setCsiHandler({final:"P"},function(C){return N.deleteChars(C)}),N._parser.setCsiHandler({final:"S"},function(C){return N.scrollUp(C)}),N._parser.setCsiHandler({final:"T"},function(C){return N.scrollDown(C)}),N._parser.setCsiHandler({final:"X"},function(C){return N.eraseChars(C)}),N._parser.setCsiHandler({final:"Z"},function(C){return N.cursorBackwardTab(C)}),N._parser.setCsiHandler({final:"`"},function(C){return N.charPosAbsolute(C)}),N._parser.setCsiHandler({final:"a"},function(C){return N.hPositionRelative(C)}),N._parser.setCsiHandler({final:"b"},function(C){return N.repeatPrecedingCharacter(C)}),N._parser.setCsiHandler({final:"c"},function(C){return N.sendDeviceAttributesPrimary(C)}),N._parser.setCsiHandler({prefix:">",final:"c"},function(C){return N.sendDeviceAttributesSecondary(C)}),N._parser.setCsiHandler({final:"d"},function(C){return N.linePosAbsolute(C)}),N._parser.setCsiHandler({final:"e"},function(C){return N.vPositionRelative(C)}),N._parser.setCsiHandler({final:"f"},function(C){return N.hVPosition(C)}),N._parser.setCsiHandler({final:"g"},function(C){return N.tabClear(C)}),N._parser.setCsiHandler({final:"h"},function(C){return N.setMode(C)}),N._parser.setCsiHandler({prefix:"?",final:"h"},function(C){return N.setModePrivate(C)}),N._parser.setCsiHandler({final:"l"},function(C){return N.resetMode(C)}),N._parser.setCsiHandler({prefix:"?",final:"l"},function(C){return N.resetModePrivate(C)}),N._parser.setCsiHandler({final:"m"},function(C){return N.charAttributes(C)}),N._parser.setCsiHandler({final:"n"},function(C){return N.deviceStatus(C)}),N._parser.setCsiHandler({prefix:"?",final:"n"},function(C){return N.deviceStatusPrivate(C)}),N._parser.setCsiHandler({intermediates:"!",final:"p"},function(C){return N.softReset(C)}),N._parser.setCsiHandler({intermediates:" ",final:"q"},function(C){return N.setCursorStyle(C)}),N._parser.setCsiHandler({final:"r"},function(C){return N.setScrollRegion(C)}),N._parser.setCsiHandler({final:"s"},function(C){return N.saveCursor(C)}),N._parser.setCsiHandler({final:"t"},function(C){return N.windowOptions(C)}),N._parser.setCsiHandler({final:"u"},function(C){return N.restoreCursor(C)}),N._parser.setCsiHandler({intermediates:"'",final:"}"},function(C){return N.insertColumns(C)}),N._parser.setCsiHandler({intermediates:"'",final:"~"},function(C){return N.deleteColumns(C)}),N._parser.setExecuteHandler(w.C0.BEL,function(){return N.bell()}),N._parser.setExecuteHandler(w.C0.LF,function(){return N.lineFeed()}),N._parser.setExecuteHandler(w.C0.VT,function(){return N.lineFeed()}),N._parser.setExecuteHandler(w.C0.FF,function(){return N.lineFeed()}),N._parser.setExecuteHandler(w.C0.CR,function(){return N.carriageReturn()}),N._parser.setExecuteHandler(w.C0.BS,function(){return N.backspace()}),N._parser.setExecuteHandler(w.C0.HT,function(){return N.tab()}),N._parser.setExecuteHandler(w.C0.SO,function(){return N.shiftOut()}),N._parser.setExecuteHandler(w.C0.SI,function(){return N.shiftIn()}),N._parser.setExecuteHandler(w.C1.IND,function(){return N.index()}),N._parser.setExecuteHandler(w.C1.NEL,function(){return N.nextLine()}),N._parser.setExecuteHandler(w.C1.HTS,function(){return N.tabSet()}),N._parser.setOscHandler(0,new E.OscHandler(function(C){N.setTitle(C),N.setIconName(C)})),N._parser.setOscHandler(1,new E.OscHandler(function(C){return N.setIconName(C)})),N._parser.setOscHandler(2,new E.OscHandler(function(C){return N.setTitle(C)})),N._parser.setEscHandler({final:"7"},function(){return N.saveCursor()}),N._parser.setEscHandler({final:"8"},function(){return N.restoreCursor()}),N._parser.setEscHandler({final:"D"},function(){return N.index()}),N._parser.setEscHandler({final:"E"},function(){return N.nextLine()}),N._parser.setEscHandler({final:"H"},function(){return N.tabSet()}),N._parser.setEscHandler({final:"M"},function(){return N.reverseIndex()}),N._parser.setEscHandler({final:"="},function(){return N.keypadApplicationMode()}),N._parser.setEscHandler({final:">"},function(){return N.keypadNumericMode()}),N._parser.setEscHandler({final:"c"},function(){return N.fullReset()}),N._parser.setEscHandler({final:"n"},function(){return N.setgLevel(2)}),N._parser.setEscHandler({final:"o"},function(){return N.setgLevel(3)}),N._parser.setEscHandler({final:"|"},function(){return N.setgLevel(3)}),N._parser.setEscHandler({final:"}"},function(){return N.setgLevel(2)}),N._parser.setEscHandler({final:"~"},function(){return N.setgLevel(1)}),N._parser.setEscHandler({intermediates:"%",final:"@"},function(){return N.selectDefaultCharset()}),N._parser.setEscHandler({intermediates:"%",final:"G"},function(){return N.selectDefaultCharset()});var W=function(C){K._parser.setEscHandler({intermediates:"(",final:C},function(){return N.selectCharset("("+C)}),K._parser.setEscHandler({intermediates:")",final:C},function(){return N.selectCharset(")"+C)}),K._parser.setEscHandler({intermediates:"*",final:C},function(){return N.selectCharset("*"+C)}),K._parser.setEscHandler({intermediates:"+",final:C},function(){return N.selectCharset("+"+C)}),K._parser.setEscHandler({intermediates:"-",final:C},function(){return N.selectCharset("-"+C)}),K._parser.setEscHandler({intermediates:".",final:C},function(){return N.selectCharset("."+C)}),K._parser.setEscHandler({intermediates:"/",final:C},function(){return N.selectCharset("/"+C)})},K=this;for(var k in _.CHARSETS)W(k);return N._parser.setEscHandler({intermediates:"#",final:"8"},function(){return N.screenAlignmentPattern()}),N._parser.setErrorHandler(function(C){return N._logService.error("Parsing error: ",C),C}),N._parser.setDcsHandler({intermediates:"$",final:"q"},new A(N._bufferService,N._coreService,N._logService,N._optionsService)),N}return G(B,U),Object.defineProperty(B.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),B.prototype.dispose=function(){U.prototype.dispose.call(this)},B.prototype.parse=function($){var M=this._bufferService.buffer,Y=M.x,q=M.y;if(this._logService.debug("parsing data",$),this._parseBuffer.length<$.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min($.length,131072))),this._dirtyRowService.clearRange(),$.length>131072)for(var se=0;se<$.length;se+=131072){var ce=se+131072<$.length?se+131072:$.length,J=typeof $=="string"?this._stringDecoder.decode($.substring(se,ce),this._parseBuffer):this._utf8Decoder.decode($.subarray(se,ce),this._parseBuffer);this._parser.parse(this._parseBuffer,J)}else J=typeof $=="string"?this._stringDecoder.decode($,this._parseBuffer):this._utf8Decoder.decode($,this._parseBuffer),this._parser.parse(this._parseBuffer,J);(M=this._bufferService.buffer).x===Y&&M.y===q||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},B.prototype.print=function($,M,Y){var q,se,ce=this._bufferService.buffer,J=this._charsetService.charset,z=this._optionsService.options.screenReaderMode,Z=this._bufferService.cols,N=this._coreService.decPrivateModes.wraparound,W=this._coreService.modes.insertMode,K=this._curAttrData,k=ce.lines.get(ce.ybase+ce.y);this._dirtyRowService.markDirty(ce.y),ce.x&&Y-M>0&&k.getWidth(ce.x-1)===2&&k.setCellFromCodePoint(ce.x-1,0,1,K.fg,K.bg,K.extended);for(var C=M;C<Y;++C){if(q=$[C],se=this._unicodeService.wcwidth(q),q<127&&J){var V=J[String.fromCharCode(q)];V&&(q=V.charCodeAt(0))}if(z&&this._onA11yChar.fire(y.stringFromCodePoint(q)),se||!ce.x){if(ce.x+se-1>=Z){if(N){for(;ce.x<Z;)k.setCellFromCodePoint(ce.x++,0,1,K.fg,K.bg,K.extended);ce.x=0,ce.y++,ce.y===ce.scrollBottom+1?(ce.y--,this._onRequestScroll.fire(this._eraseAttrData(),!0)):(ce.y>=this._bufferService.rows&&(ce.y=this._bufferService.rows-1),ce.lines.get(ce.ybase+ce.y).isWrapped=!0),k=ce.lines.get(ce.ybase+ce.y)}else if(ce.x=Z-1,se===2)continue}if(W&&(k.insertCells(ce.x,se,ce.getNullCell(K),K),k.getWidth(Z-1)===2&&k.setCellFromCodePoint(Z-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,K.fg,K.bg,K.extended)),k.setCellFromCodePoint(ce.x++,q,se,K.fg,K.bg,K.extended),se>0)for(;--se;)k.setCellFromCodePoint(ce.x++,0,0,K.fg,K.bg,K.extended)}else k.getWidth(ce.x-1)?k.addCodepointToCell(ce.x-1,q):k.addCodepointToCell(ce.x-2,q)}Y-M>0&&(k.loadCell(ce.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),ce.x<Z&&Y-M>0&&k.getWidth(ce.x)===0&&!k.hasContent(ce.x)&&k.setCellFromCodePoint(ce.x,0,1,K.fg,K.bg,K.extended),this._dirtyRowService.markDirty(ce.y)},B.prototype.addCsiHandler=function($,M){var Y=this;return $.final!=="t"||$.prefix||$.intermediates?this._parser.addCsiHandler($,M):this._parser.addCsiHandler($,function(q){return!x(q.params[0],Y._optionsService.options.windowOptions)||M(q)})},B.prototype.addDcsHandler=function($,M){return this._parser.addDcsHandler($,new T.DcsHandler(M))},B.prototype.addEscHandler=function($,M){return this._parser.addEscHandler($,M)},B.prototype.addOscHandler=function($,M){return this._parser.addOscHandler($,new E.OscHandler(M))},B.prototype.bell=function(){this._onRequestBell.fire()},B.prototype.lineFeed=function(){var $=this._bufferService.buffer;this._dirtyRowService.markDirty($.y),this._optionsService.options.convertEol&&($.x=0),$.y++,$.y===$.scrollBottom+1?($.y--,this._onRequestScroll.fire(this._eraseAttrData())):$.y>=this._bufferService.rows&&($.y=this._bufferService.rows-1),$.x>=this._bufferService.cols&&$.x--,this._dirtyRowService.markDirty($.y),this._onLineFeed.fire()},B.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},B.prototype.backspace=function(){var $,M=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(M.x>0&&M.x--);if(this._restrictCursor(this._bufferService.cols),M.x>0)M.x--;else if(M.x===0&&M.y>M.scrollTop&&M.y<=M.scrollBottom&&(!(($=M.lines.get(M.ybase+M.y))===null||$===void 0)&&$.isWrapped)){M.lines.get(M.ybase+M.y).isWrapped=!1,M.y--,M.x=this._bufferService.cols-1;var Y=M.lines.get(M.ybase+M.y);Y.hasWidth(M.x)&&!Y.hasContent(M.x)&&M.x--}this._restrictCursor()},B.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var $=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-$)}},B.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},B.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},B.prototype._restrictCursor=function($){$===void 0&&($=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min($,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},B.prototype._setCursor=function($,M){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=$,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+M):(this._bufferService.buffer.x=$,this._bufferService.buffer.y=M),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},B.prototype._moveCursor=function($,M){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+$,this._bufferService.buffer.y+M)},B.prototype.cursorUp=function($){var M=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;M>=0?this._moveCursor(0,-Math.min(M,$.params[0]||1)):this._moveCursor(0,-($.params[0]||1))},B.prototype.cursorDown=function($){var M=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;M>=0?this._moveCursor(0,Math.min(M,$.params[0]||1)):this._moveCursor(0,$.params[0]||1)},B.prototype.cursorForward=function($){this._moveCursor($.params[0]||1,0)},B.prototype.cursorBackward=function($){this._moveCursor(-($.params[0]||1),0)},B.prototype.cursorNextLine=function($){this.cursorDown($),this._bufferService.buffer.x=0},B.prototype.cursorPrecedingLine=function($){this.cursorUp($),this._bufferService.buffer.x=0},B.prototype.cursorCharAbsolute=function($){this._setCursor(($.params[0]||1)-1,this._bufferService.buffer.y)},B.prototype.cursorPosition=function($){this._setCursor($.length>=2?($.params[1]||1)-1:0,($.params[0]||1)-1)},B.prototype.charPosAbsolute=function($){this._setCursor(($.params[0]||1)-1,this._bufferService.buffer.y)},B.prototype.hPositionRelative=function($){this._moveCursor($.params[0]||1,0)},B.prototype.linePosAbsolute=function($){this._setCursor(this._bufferService.buffer.x,($.params[0]||1)-1)},B.prototype.vPositionRelative=function($){this._moveCursor(0,$.params[0]||1)},B.prototype.hVPosition=function($){this.cursorPosition($)},B.prototype.tabClear=function($){var M=$.params[0];M===0?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:M===3&&(this._bufferService.buffer.tabs={})},B.prototype.cursorForwardTab=function($){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var M=$.params[0]||1;M--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},B.prototype.cursorBackwardTab=function($){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var M=$.params[0]||1,Y=this._bufferService.buffer;M--;)Y.x=Y.prevStop()},B.prototype._eraseInBufferLine=function($,M,Y,q){q===void 0&&(q=!1);var se=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+$);se.replaceCells(M,Y,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),q&&(se.isWrapped=!1)},B.prototype._resetBufferLine=function($){var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+$);M.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1},B.prototype.eraseInDisplay=function($){var M;switch(this._restrictCursor(),$.params[0]){case 0:for(M=this._bufferService.buffer.y,this._dirtyRowService.markDirty(M),this._eraseInBufferLine(M++,this._bufferService.buffer.x,this._bufferService.cols,this._bufferService.buffer.x===0);M<this._bufferService.rows;M++)this._resetBufferLine(M);this._dirtyRowService.markDirty(M);break;case 1:for(M=this._bufferService.buffer.y,this._dirtyRowService.markDirty(M),this._eraseInBufferLine(M,0,this._bufferService.buffer.x+1,!0),this._bufferService.buffer.x+1>=this._bufferService.cols&&(this._bufferService.buffer.lines.get(M+1).isWrapped=!1);M--;)this._resetBufferLine(M);this._dirtyRowService.markDirty(0);break;case 2:for(M=this._bufferService.rows,this._dirtyRowService.markDirty(M-1);M--;)this._resetBufferLine(M);this._dirtyRowService.markDirty(0);break;case 3:var Y=this._bufferService.buffer.lines.length-this._bufferService.rows;Y>0&&(this._bufferService.buffer.lines.trimStart(Y),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-Y,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-Y,0),this._onScroll.fire(0))}},B.prototype.eraseInLine=function($){switch(this._restrictCursor(),$.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}this._dirtyRowService.markDirty(this._bufferService.buffer.y)},B.prototype.insertLines=function($){this._restrictCursor();var M=$.params[0]||1,Y=this._bufferService.buffer;if(!(Y.y>Y.scrollBottom||Y.y<Y.scrollTop)){for(var q=Y.ybase+Y.y,se=this._bufferService.rows-1-Y.scrollBottom,ce=this._bufferService.rows-1+Y.ybase-se+1;M--;)Y.lines.splice(ce-1,1),Y.lines.splice(q,0,Y.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Y.y,Y.scrollBottom),Y.x=0}},B.prototype.deleteLines=function($){this._restrictCursor();var M=$.params[0]||1,Y=this._bufferService.buffer;if(!(Y.y>Y.scrollBottom||Y.y<Y.scrollTop)){var q,se=Y.ybase+Y.y;for(q=this._bufferService.rows-1-Y.scrollBottom,q=this._bufferService.rows-1+Y.ybase-q;M--;)Y.lines.splice(se,1),Y.lines.splice(q,0,Y.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Y.y,Y.scrollBottom),Y.x=0}},B.prototype.insertChars=function($){this._restrictCursor();var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);M&&(M.insertCells(this._bufferService.buffer.x,$.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},B.prototype.deleteChars=function($){this._restrictCursor();var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);M&&(M.deleteCells(this._bufferService.buffer.x,$.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},B.prototype.scrollUp=function($){for(var M=$.params[0]||1,Y=this._bufferService.buffer;M--;)Y.lines.splice(Y.ybase+Y.scrollTop,1),Y.lines.splice(Y.ybase+Y.scrollBottom,0,Y.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(Y.scrollTop,Y.scrollBottom)},B.prototype.scrollDown=function($){for(var M=$.params[0]||1,Y=this._bufferService.buffer;M--;)Y.lines.splice(Y.ybase+Y.scrollBottom,1),Y.lines.splice(Y.ybase+Y.scrollTop,0,Y.getBlankLine(f.DEFAULT_ATTR_DATA));this._dirtyRowService.markRangeDirty(Y.scrollTop,Y.scrollBottom)},B.prototype.scrollLeft=function($){var M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var Y=$.params[0]||1,q=M.scrollTop;q<=M.scrollBottom;++q){var se=M.lines.get(M.ybase+q);se.deleteCells(0,Y,M.getNullCell(this._eraseAttrData()),this._eraseAttrData()),se.isWrapped=!1}this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)}},B.prototype.scrollRight=function($){var M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var Y=$.params[0]||1,q=M.scrollTop;q<=M.scrollBottom;++q){var se=M.lines.get(M.ybase+q);se.insertCells(0,Y,M.getNullCell(this._eraseAttrData()),this._eraseAttrData()),se.isWrapped=!1}this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)}},B.prototype.insertColumns=function($){var M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var Y=$.params[0]||1,q=M.scrollTop;q<=M.scrollBottom;++q){var se=this._bufferService.buffer.lines.get(M.ybase+q);se.insertCells(M.x,Y,M.getNullCell(this._eraseAttrData()),this._eraseAttrData()),se.isWrapped=!1}this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)}},B.prototype.deleteColumns=function($){var M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var Y=$.params[0]||1,q=M.scrollTop;q<=M.scrollBottom;++q){var se=M.lines.get(M.ybase+q);se.deleteCells(M.x,Y,M.getNullCell(this._eraseAttrData()),this._eraseAttrData()),se.isWrapped=!1}this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)}},B.prototype.eraseChars=function($){this._restrictCursor();var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);M&&(M.replaceCells(this._bufferService.buffer.x,this._bufferService.buffer.x+($.params[0]||1),this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},B.prototype.repeatPrecedingCharacter=function($){if(this._parser.precedingCodepoint){for(var M=$.params[0]||1,Y=new Uint32Array(M),q=0;q<M;++q)Y[q]=this._parser.precedingCodepoint;this.print(Y,0,Y.length)}},B.prototype.sendDeviceAttributesPrimary=function($){$.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(w.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(w.C0.ESC+"[?6c"))},B.prototype.sendDeviceAttributesSecondary=function($){$.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(w.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(w.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent($.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(w.C0.ESC+"[>83;40003;0c"))},B.prototype._is=function($){return(this._optionsService.options.termName+"").indexOf($)===0},B.prototype.setMode=function($){for(var M=0;M<$.length;M++)switch($.params[M]){case 4:this._coreService.modes.insertMode=!0}},B.prototype.setModePrivate=function($){for(var M=0;M<$.length;M++)switch($.params[M]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0;break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}},B.prototype.resetMode=function($){for(var M=0;M<$.length;M++)switch($.params[M]){case 4:this._coreService.modes.insertMode=!1}},B.prototype.resetModePrivate=function($){for(var M=0;M<$.length;M++)switch($.params[M]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),$.params[M]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}},B.prototype._updateAttrColor=function($,M,Y,q,se){return M===2?($|=50331648,$&=-16777216,$|=d.AttributeData.fromColorRGB([Y,q,se])):M===5&&($&=-50331904,$|=33554432|255&Y),$},B.prototype._extractColor=function($,M,Y){var q=[0,0,-1,0,0,0],se=0,ce=0;do{if(q[ce+se]=$.params[M+ce],$.hasSubParams(M+ce)){var J=$.getSubParams(M+ce),z=0;do q[1]===5&&(se=1),q[ce+z+1+se]=J[z];while(++z<J.length&&z+ce+1+se<q.length);break}if(q[1]===5&&ce+se>=2||q[1]===2&&ce+se>=5)break;q[1]&&(se=1)}while(++ce+M<$.length&&ce+se<q.length);for(z=2;z<q.length;++z)q[z]===-1&&(q[z]=0);switch(q[0]){case 38:Y.fg=this._updateAttrColor(Y.fg,q[1],q[3],q[4],q[5]);break;case 48:Y.bg=this._updateAttrColor(Y.bg,q[1],q[3],q[4],q[5]);break;case 58:Y.extended=Y.extended.clone(),Y.extended.underlineColor=this._updateAttrColor(Y.extended.underlineColor,q[1],q[3],q[4],q[5])}return ce},B.prototype._processUnderline=function($,M){M.extended=M.extended.clone(),(!~$||$>5)&&($=1),M.extended.underlineStyle=$,M.fg|=268435456,$===0&&(M.fg&=-268435457),M.updateExtended()},B.prototype.charAttributes=function($){if($.length===1&&$.params[0]===0)return this._curAttrData.fg=f.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=f.DEFAULT_ATTR_DATA.bg);for(var M,Y=$.length,q=this._curAttrData,se=0;se<Y;se++)(M=$.params[se])>=30&&M<=37?(q.fg&=-50331904,q.fg|=16777216|M-30):M>=40&&M<=47?(q.bg&=-50331904,q.bg|=16777216|M-40):M>=90&&M<=97?(q.fg&=-50331904,q.fg|=16777224|M-90):M>=100&&M<=107?(q.bg&=-50331904,q.bg|=16777224|M-100):M===0?(q.fg=f.DEFAULT_ATTR_DATA.fg,q.bg=f.DEFAULT_ATTR_DATA.bg):M===1?q.fg|=134217728:M===3?q.bg|=67108864:M===4?(q.fg|=268435456,this._processUnderline($.hasSubParams(se)?$.getSubParams(se)[0]:1,q)):M===5?q.fg|=536870912:M===7?q.fg|=67108864:M===8?q.fg|=1073741824:M===2?q.bg|=134217728:M===21?this._processUnderline(2,q):M===22?(q.fg&=-134217729,q.bg&=-134217729):M===23?q.bg&=-67108865:M===24?q.fg&=-268435457:M===25?q.fg&=-536870913:M===27?q.fg&=-67108865:M===28?q.fg&=-1073741825:M===39?(q.fg&=-67108864,q.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):M===49?(q.bg&=-67108864,q.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):M===38||M===48||M===58?se+=this._extractColor($,se,q):M===59?(q.extended=q.extended.clone(),q.extended.underlineColor=-1,q.updateExtended()):M===100?(q.fg&=-67108864,q.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,q.bg&=-67108864,q.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",M)},B.prototype.deviceStatus=function($){switch($.params[0]){case 5:this._coreService.triggerDataEvent(w.C0.ESC+"[0n");break;case 6:var M=this._bufferService.buffer.y+1,Y=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(w.C0.ESC+"["+M+";"+Y+"R")}},B.prototype.deviceStatusPrivate=function($){switch($.params[0]){case 6:var M=this._bufferService.buffer.y+1,Y=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(w.C0.ESC+"[?"+M+";"+Y+"R")}},B.prototype.softReset=function($){this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1},B.prototype.setCursorStyle=function($){var M=$.params[0]||1;switch(M){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}var Y=M%2==1;this._optionsService.options.cursorBlink=Y},B.prototype.setScrollRegion=function($){var M,Y=$.params[0]||1;($.length<2||(M=$.params[1])>this._bufferService.rows||M===0)&&(M=this._bufferService.rows),M>Y&&(this._bufferService.buffer.scrollTop=Y-1,this._bufferService.buffer.scrollBottom=M-1,this._setCursor(0,0))},B.prototype.windowOptions=function($){if(x($.params[0],this._optionsService.options.windowOptions)){var M=$.length>1?$.params[1]:0;switch($.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(w.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},B.prototype.saveCursor=function($){this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset},B.prototype.restoreCursor=function($){this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor()},B.prototype.setTitle=function($){this._windowTitle=$,this._onTitleChange.fire($)},B.prototype.setIconName=function($){this._iconName=$},B.prototype.nextLine=function(){this._bufferService.buffer.x=0,this.index()},B.prototype.keypadApplicationMode=function(){this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire()},B.prototype.keypadNumericMode=function(){this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire()},B.prototype.selectDefaultCharset=function(){this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET)},B.prototype.selectCharset=function($){$.length===2?$[0]!=="/"&&this._charsetService.setgCharset(L[$[0]],_.CHARSETS[$[1]]||_.DEFAULT_CHARSET):this.selectDefaultCharset()},B.prototype.index=function(){this._restrictCursor();var $=this._bufferService.buffer;this._bufferService.buffer.y++,$.y===$.scrollBottom+1?($.y--,this._onRequestScroll.fire(this._eraseAttrData())):$.y>=this._bufferService.rows&&($.y=this._bufferService.rows-1),this._restrictCursor()},B.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},B.prototype.reverseIndex=function(){this._restrictCursor();var $=this._bufferService.buffer;if($.y===$.scrollTop){var M=$.scrollBottom-$.scrollTop;$.lines.shiftElements($.ybase+$.y,M,1),$.lines.set($.ybase+$.y,$.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty($.scrollTop,$.scrollBottom)}else $.y--,this._restrictCursor()},B.prototype.fullReset=function(){this._parser.reset(),this._onRequestReset.fire()},B.prototype.reset=function(){this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()},B.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},B.prototype.setgLevel=function($){this._charsetService.setgLevel($)},B.prototype.screenAlignmentPattern=function(){var $=new h.CellData;$.content=1<<22|69,$.fg=this._curAttrData.fg,$.bg=this._curAttrData.bg;var M=this._bufferService.buffer;this._setCursor(0,0);for(var Y=0;Y<this._bufferService.rows;++Y){var q=M.ybase+M.y+Y,se=M.lines.get(q);se&&(se.fill($),se.isWrapped=!1)}this._dirtyRowService.markAllDirty(),this._setCursor(0,0)},B}(v.Disposable);b.InputHandler=O},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DEFAULT_CHARSET=b.CHARSETS=void 0,b.CHARSETS={},b.DEFAULT_CHARSET=b.CHARSETS.B,b.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},b.CHARSETS.A={"#":"\xA3"},b.CHARSETS.B=void 0,b.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},b.CHARSETS.C=b.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},b.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},b.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},b.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},b.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},b.CHARSETS.E=b.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},b.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},b.CHARSETS.H=b.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},b.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Params=void 0;var P=function(){function G(D,w){if(D===void 0&&(D=32),w===void 0&&(w=32),this.maxLength=D,this.maxSubParamsLength=w,w>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(D),this.length=0,this._subParams=new Int32Array(w),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(D),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return G.fromArray=function(D){var w=new G;if(!D.length)return w;for(var _=D[0]instanceof Array?1:0;_<D.length;++_){var F=D[_];if(F instanceof Array)for(var v=0;v<F.length;++v)w.addSubParam(F[v]);else w.addParam(F)}return w},G.prototype.clone=function(){var D=new G(this.maxLength,this.maxSubParamsLength);return D.params.set(this.params),D.length=this.length,D._subParams.set(this._subParams),D._subParamsLength=this._subParamsLength,D._subParamsIdx.set(this._subParamsIdx),D._rejectDigits=this._rejectDigits,D._rejectSubDigits=this._rejectSubDigits,D._digitIsSub=this._digitIsSub,D},G.prototype.toArray=function(){for(var D=[],w=0;w<this.length;++w){D.push(this.params[w]);var _=this._subParamsIdx[w]>>8,F=255&this._subParamsIdx[w];F-_>0&&D.push(Array.prototype.slice.call(this._subParams,_,F))}return D},G.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},G.prototype.addParam=function(D){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(D<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=D>2147483647?2147483647:D}},G.prototype.addSubParam=function(D){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(D<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=D>2147483647?2147483647:D,this._subParamsIdx[this.length-1]++}},G.prototype.hasSubParams=function(D){return(255&this._subParamsIdx[D])-(this._subParamsIdx[D]>>8)>0},G.prototype.getSubParams=function(D){var w=this._subParamsIdx[D]>>8,_=255&this._subParamsIdx[D];return _-w>0?this._subParams.subarray(w,_):null},G.prototype.getSubParamsAll=function(){for(var D={},w=0;w<this.length;++w){var _=this._subParamsIdx[w]>>8,F=255&this._subParamsIdx[w];F-_>0&&(D[w]=this._subParams.slice(_,F))}return D},G.prototype.addDigit=function(D){var w;if(!(this._rejectDigits||!(w=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var _=this._digitIsSub?this._subParams:this.params,F=_[w-1];_[w-1]=~F?Math.min(10*F+D,2147483647):D}},G}();b.Params=P},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.OscHandler=b.OscParser=void 0;var P=I(23),G=I(8),D=function(){function _(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return _.prototype.addHandler=function(F,v){this._handlers[F]===void 0&&(this._handlers[F]=[]);var s=this._handlers[F];return s.push(v),{dispose:function(){var y=s.indexOf(v);y!==-1&&s.splice(y,1)}}},_.prototype.setHandler=function(F,v){this._handlers[F]=[v]},_.prototype.clearHandler=function(F){this._handlers[F]&&delete this._handlers[F]},_.prototype.setHandlerFallback=function(F){this._handlerFb=F},_.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},_.prototype.reset=function(){this._state===2&&this.end(!1),this._id=-1,this._state=0},_.prototype._start=function(){var F=this._handlers[this._id];if(F)for(var v=F.length-1;v>=0;v--)F[v].start();else this._handlerFb(this._id,"START")},_.prototype._put=function(F,v,s){var y=this._handlers[this._id];if(y)for(var f=y.length-1;f>=0;f--)y[f].put(F,v,s);else this._handlerFb(this._id,"PUT",G.utf32ToString(F,v,s))},_.prototype._end=function(F){var v=this._handlers[this._id];if(v){for(var s=v.length-1;s>=0&&v[s].end(F)===!1;s--);for(s--;s>=0;s--)v[s].end(!1)}else this._handlerFb(this._id,"END",F)},_.prototype.start=function(){this.reset(),this._id=-1,this._state=1},_.prototype.put=function(F,v,s){if(this._state!==3){if(this._state===1)for(;v<s;){var y=F[v++];if(y===59){this._state=2,this._start();break}if(y<48||57<y)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+y-48}this._state===2&&s-v>0&&this._put(F,v,s)}},_.prototype.end=function(F){this._state!==0&&(this._state!==3&&(this._state===1&&this._start(),this._end(F)),this._id=-1,this._state=0)},_}();b.OscParser=D;var w=function(){function _(F){this._handler=F,this._data="",this._hitLimit=!1}return _.prototype.start=function(){this._data="",this._hitLimit=!1},_.prototype.put=function(F,v,s){this._hitLimit||(this._data+=G.utf32ToString(F,v,s),this._data.length>P.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},_.prototype.end=function(F){var v;return this._hitLimit?v=!1:F&&(v=this._handler(this._data)),this._data="",this._hitLimit=!1,v},_}();b.OscHandler=w},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.PAYLOAD_LIMIT=void 0,b.PAYLOAD_LIMIT=1e7},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DcsHandler=b.DcsParser=void 0;var P=I(8),G=I(21),D=I(23),w=[],_=function(){function v(){this._handlers=Object.create(null),this._active=w,this._ident=0,this._handlerFb=function(){}}return v.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},v.prototype.addHandler=function(s,y){this._handlers[s]===void 0&&(this._handlers[s]=[]);var f=this._handlers[s];return f.push(y),{dispose:function(){var c=f.indexOf(y);c!==-1&&f.splice(c,1)}}},v.prototype.setHandler=function(s,y){this._handlers[s]=[y]},v.prototype.clearHandler=function(s){this._handlers[s]&&delete this._handlers[s]},v.prototype.setHandlerFallback=function(s){this._handlerFb=s},v.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=w,this._ident=0},v.prototype.hook=function(s,y){if(this.reset(),this._ident=s,this._active=this._handlers[s]||w,this._active.length)for(var f=this._active.length-1;f>=0;f--)this._active[f].hook(y);else this._handlerFb(this._ident,"HOOK",y)},v.prototype.put=function(s,y,f){if(this._active.length)for(var c=this._active.length-1;c>=0;c--)this._active[c].put(s,y,f);else this._handlerFb(this._ident,"PUT",P.utf32ToString(s,y,f))},v.prototype.unhook=function(s){if(this._active.length){for(var y=this._active.length-1;y>=0&&this._active[y].unhook(s)===!1;y--);for(y--;y>=0;y--)this._active[y].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",s);this._active=w,this._ident=0},v}();b.DcsParser=_;var F=function(){function v(s){this._handler=s,this._data="",this._hitLimit=!1}return v.prototype.hook=function(s){this._params=s.clone(),this._data="",this._hitLimit=!1},v.prototype.put=function(s,y,f){this._hitLimit||(this._data+=P.utf32ToString(s,y,f),this._data.length>D.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},v.prototype.unhook=function(s){var y;return this._hitLimit?y=!1:s&&(y=this._handler(this._data,this._params||new G.Params)),this._params=void 0,this._data="",this._hitLimit=!1,y},v}();b.DcsHandler=F},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.removeTerminalFromCache=b.acquireCharAtlas=void 0;var P=I(26),G=I(43),D=[];b.acquireCharAtlas=function(w,_,F,v,s){for(var y=P.generateConfig(v,s,w,F),f=0;f<D.length;f++){var c=(l=D[f]).ownedBy.indexOf(_);if(c>=0){if(P.configEquals(l.config,y))return l.atlas;l.ownedBy.length===1?(l.atlas.dispose(),D.splice(f,1)):l.ownedBy.splice(c,1);break}}for(f=0;f<D.length;f++){var l=D[f];if(P.configEquals(l.config,y))return l.ownedBy.push(_),l.atlas}var h={atlas:new G.DynamicCharAtlas(document,y),config:y,ownedBy:[_]};return D.push(h),h.atlas},b.removeTerminalFromCache=function(w){for(var _=0;_<D.length;_++){var F=D[_].ownedBy.indexOf(w);if(F!==-1){D[_].ownedBy.length===1?(D[_].atlas.dispose(),D.splice(_,1)):D[_].ownedBy.splice(F,1);break}}}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.is256Color=b.configEquals=b.generateConfig=void 0;var P=I(3);b.generateConfig=function(G,D,w,_){var F={foreground:_.foreground,background:_.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:_.ansi.slice(0,16)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:G,scaledCharHeight:D,fontFamily:w.fontFamily,fontSize:w.fontSize,fontWeight:w.fontWeight,fontWeightBold:w.fontWeightBold,allowTransparency:w.allowTransparency,colors:F}},b.configEquals=function(G,D){for(var w=0;w<G.colors.ansi.length;w++)if(G.colors.ansi[w].rgba!==D.colors.ansi[w].rgba)return!1;return G.devicePixelRatio===D.devicePixelRatio&&G.fontFamily===D.fontFamily&&G.fontSize===D.fontSize&&G.fontWeight===D.fontWeight&&G.fontWeightBold===D.fontWeightBold&&G.allowTransparency===D.allowTransparency&&G.scaledCharWidth===D.scaledCharWidth&&G.scaledCharHeight===D.scaledCharHeight&&G.colors.foreground===D.colors.foreground&&G.colors.background===D.colors.background},b.is256Color=function(G){return G<P.DEFAULT_COLOR}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ColorManager=b.DEFAULT_ANSI_COLORS=void 0;var P=I(10),G=I(45),D=P.css.toColor("#ffffff"),w=P.css.toColor("#000000"),_=P.css.toColor("#ffffff"),F=P.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};b.DEFAULT_ANSI_COLORS=function(){for(var y=[P.css.toColor("#2e3436"),P.css.toColor("#cc0000"),P.css.toColor("#4e9a06"),P.css.toColor("#c4a000"),P.css.toColor("#3465a4"),P.css.toColor("#75507b"),P.css.toColor("#06989a"),P.css.toColor("#d3d7cf"),P.css.toColor("#555753"),P.css.toColor("#ef2929"),P.css.toColor("#8ae234"),P.css.toColor("#fce94f"),P.css.toColor("#729fcf"),P.css.toColor("#ad7fa8"),P.css.toColor("#34e2e2"),P.css.toColor("#eeeeec")],f=[0,95,135,175,215,255],c=0;c<216;c++){var l=f[c/36%6|0],h=f[c/6%6|0],d=f[c%6];y.push({css:P.channels.toCss(l,h,d),rgba:P.channels.toRgba(l,h,d)})}for(c=0;c<24;c++){var E=8+10*c;y.push({css:P.channels.toCss(E,E,E),rgba:P.channels.toRgba(E,E,E)})}return y}();var s=function(){function y(f,c){this.allowTransparency=c;var l=f.createElement("canvas");l.width=1,l.height=1;var h=l.getContext("2d");if(!h)throw new Error("Could not get rendering context");this._ctx=h,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new G.ColorContrastCache,this.colors={foreground:D,background:w,cursor:_,cursorAccent:F,selectionTransparent:v,selectionOpaque:P.color.blend(w,v),ansi:b.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return y.prototype.onOptionsChange=function(f){f==="minimumContrastRatio"&&this._contrastCache.clear()},y.prototype.setTheme=function(f){f===void 0&&(f={}),this.colors.foreground=this._parseColor(f.foreground,D),this.colors.background=this._parseColor(f.background,w),this.colors.cursor=this._parseColor(f.cursor,_,!0),this.colors.cursorAccent=this._parseColor(f.cursorAccent,F,!0),this.colors.selectionTransparent=this._parseColor(f.selection,v,!0),this.colors.selectionOpaque=P.color.blend(this.colors.background,this.colors.selectionTransparent),P.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=P.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(f.black,b.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(f.red,b.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(f.green,b.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(f.yellow,b.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(f.blue,b.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(f.magenta,b.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(f.cyan,b.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(f.white,b.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(f.brightBlack,b.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(f.brightRed,b.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(f.brightGreen,b.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(f.brightYellow,b.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(f.brightBlue,b.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(f.brightMagenta,b.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(f.brightCyan,b.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(f.brightWhite,b.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},y.prototype._parseColor=function(f,c,l){if(l===void 0&&(l=this.allowTransparency),f===void 0)return c;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=f,typeof this._ctx.fillStyle!="string")return console.warn("Color: "+f+" is invalid using fallback "+c.css),c;this._ctx.fillRect(0,0,1,1);var h=this._ctx.getImageData(0,0,1,1).data;if(h[3]!==255){if(!l)return console.warn("Color: "+f+" is using transparency, but allowTransparency is false. Using fallback "+c.css+"."),c;var d=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(O){return Number(O)}),E=d[0],T=d[1],L=d[2],x=d[3],A=Math.round(255*x);return{rgba:P.channels.toRgba(E,T,L,A),css:f}}return{css:this._ctx.fillStyle,rgba:P.channels.toRgba(h[0],h[1],h[2],h[3])}},y}();b.ColorManager=s},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.throwIfFalsy=void 0,b.throwIfFalsy=function(P){if(!P)throw new Error("value must not be falsy");return P}},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(s,y){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,c){f.__proto__=c}||function(f,c){for(var l in c)c.hasOwnProperty(l)&&(f[l]=c[l])})(s,y)},function(s,y){function f(){this.constructor=s}P(s,y),s.prototype=y===null?Object.create(y):(f.prototype=y.prototype,new f)});Object.defineProperty(b,"__esModule",{value:!0}),b.CharacterJoinerRegistry=b.JoinedCellData=void 0;var D=I(6),w=I(3),_=I(4),F=function(s){function y(f,c,l){var h=s.call(this)||this;return h.content=0,h.combinedData="",h.fg=f.fg,h.bg=f.bg,h.combinedData=c,h._width=l,h}return G(y,s),y.prototype.isCombined=function(){return 2097152},y.prototype.getWidth=function(){return this._width},y.prototype.getChars=function(){return this.combinedData},y.prototype.getCode=function(){return 2097151},y.prototype.setFromCharData=function(f){throw new Error("not implemented")},y.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},y}(D.AttributeData);b.JoinedCellData=F;var v=function(){function s(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}return s.prototype.registerCharacterJoiner=function(y){var f={id:this._nextCharacterJoinerId++,handler:y};return this._characterJoiners.push(f),f.id},s.prototype.deregisterCharacterJoiner=function(y){for(var f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===y)return this._characterJoiners.splice(f,1),!0;return!1},s.prototype.getJoinedCharacters=function(y){if(this._characterJoiners.length===0)return[];var f=this._bufferService.buffer.lines.get(y);if(!f||f.length===0)return[];for(var c=[],l=f.translateToString(!0),h=0,d=0,E=0,T=f.getFg(0),L=f.getBg(0),x=0;x<f.getTrimmedLength();x++)if(f.loadCell(x,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==L){if(x-h>1)for(var A=this._getJoinedRanges(l,E,d,f,h),O=0;O<A.length;O++)c.push(A[O]);h=x,E=d,T=this._workCell.fg,L=this._workCell.bg}d+=this._workCell.getChars().length||w.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-h>1)for(A=this._getJoinedRanges(l,E,d,f,h),O=0;O<A.length;O++)c.push(A[O]);return c},s.prototype._getJoinedRanges=function(y,f,c,l,h){for(var d=y.substring(f,c),E=this._characterJoiners[0].handler(d),T=1;T<this._characterJoiners.length;T++)for(var L=this._characterJoiners[T].handler(d),x=0;x<L.length;x++)s._mergeRanges(E,L[x]);return this._stringRangesToCellRanges(E,l,h),E},s.prototype._stringRangesToCellRanges=function(y,f,c){var l=0,h=!1,d=0,E=y[l];if(E){for(var T=c;T<this._bufferService.cols;T++){var L=f.getWidth(T),x=f.getString(T).length||w.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!h&&E[0]<=d&&(E[0]=T,h=!0),E[1]<=d){if(E[1]=T,!(E=y[++l]))break;E[0]<=d?(E[0]=T,h=!0):h=!1}d+=x}}E&&(E[1]=this._bufferService.cols)}},s._mergeRanges=function(y,f){for(var c=!1,l=0;l<y.length;l++){var h=y[l];if(c){if(f[1]<=h[0])return y[l-1][1]=f[1],y;if(f[1]<=h[1])return y[l-1][1]=Math.max(f[1],h[1]),y.splice(l,1),y;y.splice(l,1),l--}else{if(f[1]<=h[0])return y.splice(l,0,f),y;if(f[1]<=h[1])return h[0]=Math.min(f[0],h[0]),y;f[0]<h[1]&&(h[0]=Math.min(f[0],h[0]),c=!0)}}return c?y[y.length-1][1]=f[1]:y.push(f),y},s}();b.CharacterJoinerRegistry=v},function(me,b,I){"use strict";function P(G,D){var w=D.getBoundingClientRect();return[G.clientX-w.left,G.clientY-w.top]}Object.defineProperty(b,"__esModule",{value:!0}),b.getRawByteCoords=b.getCoords=b.getCoordsRelativeToElement=void 0,b.getCoordsRelativeToElement=P,b.getCoords=function(G,D,w,_,F,v,s,y){if(F){var f=P(G,D);if(f)return f[0]=Math.ceil((f[0]+(y?v/2:0))/v),f[1]=Math.ceil(f[1]/s),f[0]=Math.min(Math.max(f[0],1),w+(y?1:0)),f[1]=Math.min(Math.max(f[1],1),_),f}},b.getRawByteCoords=function(G){if(G)return{x:G[0]+32,y:G[1]+32}}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.RenderDebouncer=void 0;var P=function(){function G(D){this._renderCallback=D}return G.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},G.prototype.refresh=function(D,w,_){var F=this;this._rowCount=_,D=D!==void 0?D:0,w=w!==void 0?w:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,D):D,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,w):w,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return F._innerRefresh()}))},G.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var D=Math.max(this._rowStart,0),w=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(D,w)}},G}();b.RenderDebouncer=P},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(w,_){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,v){F.__proto__=v}||function(F,v){for(var s in v)v.hasOwnProperty(s)&&(F[s]=v[s])})(w,_)},function(w,_){function F(){this.constructor=w}P(w,_),w.prototype=_===null?Object.create(_):(F.prototype=_.prototype,new F)});Object.defineProperty(b,"__esModule",{value:!0}),b.ScreenDprMonitor=void 0;var D=function(w){function _(){var F=w!==null&&w.apply(this,arguments)||this;return F._currentDevicePixelRatio=window.devicePixelRatio,F}return G(_,w),_.prototype.setListener=function(F){var v=this;this._listener&&this.clearListener(),this._listener=F,this._outerListener=function(){v._listener&&(v._listener(window.devicePixelRatio,v._currentDevicePixelRatio),v._updateDpr())},this._updateDpr()},_.prototype.dispose=function(){w.prototype.dispose.call(this),this.clearListener()},_.prototype._updateDpr=function(){var F;this._outerListener&&((F=this._resolutionMediaMatchList)===null||F===void 0||F.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},_.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},_}(I(2).Disposable);b.ScreenDprMonitor=D},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.clone=void 0,b.clone=function P(G,D){if(D===void 0&&(D=5),typeof G!="object")return G;var w=Array.isArray(G)?[]:{};for(var _ in G)w[_]=D<=1?G[_]:G[_]?P(G[_],D-1):G[_];return w}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;var P=I(4),G=I(35),D=I(18),w=I(0),_=I(83),F=function(){function l(h){this._core=new G.Terminal(h),this._addonManager=new _.AddonManager}return l.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(l.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new f(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"unicode",{get:function(){return this._checkProposedApi(),new c(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._checkProposedApi(),new s(this._core.buffers)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),l.prototype.blur=function(){this._core.blur()},l.prototype.focus=function(){this._core.focus()},l.prototype.resize=function(h,d){this._verifyIntegers(h,d),this._core.resize(h,d)},l.prototype.open=function(h){this._core.open(h)},l.prototype.attachCustomKeyEventHandler=function(h){this._core.attachCustomKeyEventHandler(h)},l.prototype.registerLinkMatcher=function(h,d,E){return this._checkProposedApi(),this._core.registerLinkMatcher(h,d,E)},l.prototype.deregisterLinkMatcher=function(h){this._checkProposedApi(),this._core.deregisterLinkMatcher(h)},l.prototype.registerLinkProvider=function(h){return this._checkProposedApi(),this._core.registerLinkProvider(h)},l.prototype.registerCharacterJoiner=function(h){return this._checkProposedApi(),this._core.registerCharacterJoiner(h)},l.prototype.deregisterCharacterJoiner=function(h){this._checkProposedApi(),this._core.deregisterCharacterJoiner(h)},l.prototype.registerMarker=function(h){return this._checkProposedApi(),this._verifyIntegers(h),this._core.addMarker(h)},l.prototype.addMarker=function(h){return this.registerMarker(h)},l.prototype.hasSelection=function(){return this._core.hasSelection()},l.prototype.select=function(h,d,E){this._verifyIntegers(h,d,E),this._core.select(h,d,E)},l.prototype.getSelection=function(){return this._core.getSelection()},l.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},l.prototype.clearSelection=function(){this._core.clearSelection()},l.prototype.selectAll=function(){this._core.selectAll()},l.prototype.selectLines=function(h,d){this._verifyIntegers(h,d),this._core.selectLines(h,d)},l.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},l.prototype.scrollLines=function(h){this._verifyIntegers(h),this._core.scrollLines(h)},l.prototype.scrollPages=function(h){this._verifyIntegers(h),this._core.scrollPages(h)},l.prototype.scrollToTop=function(){this._core.scrollToTop()},l.prototype.scrollToBottom=function(){this._core.scrollToBottom()},l.prototype.scrollToLine=function(h){this._verifyIntegers(h),this._core.scrollToLine(h)},l.prototype.clear=function(){this._core.clear()},l.prototype.write=function(h,d){this._core.write(h,d)},l.prototype.writeUtf8=function(h,d){this._core.write(h,d)},l.prototype.writeln=function(h,d){this._core.write(h),this._core.write(`\r
|
|
|
`,d)},l.prototype.paste=function(h){this._core.paste(h)},l.prototype.getOption=function(h){return this._core.optionsService.getOption(h)},l.prototype.setOption=function(h,d){this._core.optionsService.setOption(h,d)},l.prototype.refresh=function(h,d){this._verifyIntegers(h,d),this._core.refresh(h,d)},l.prototype.reset=function(){this._core.reset()},l.prototype.loadAddon=function(h){return this._addonManager.loadAddon(this,h)},Object.defineProperty(l,"strings",{get:function(){return D},enumerable:!1,configurable:!0}),l.prototype._verifyIntegers=function(){for(var h=[],d=0;d<arguments.length;d++)h[d]=arguments[d];for(var E=0,T=h;E<T.length;E++){var L=T[E];if(L===1/0||isNaN(L)||L%1!=0)throw new Error("This API only accepts integers")}},l}();b.Terminal=F;var v=function(){function l(h,d){this._buffer=h,this.type=d}return l.prototype.init=function(h){return this._buffer=h,this},Object.defineProperty(l.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!1,configurable:!0}),l.prototype.getLine=function(h){var d=this._buffer.lines.get(h);if(d)return new y(d)},l.prototype.getNullCell=function(){return new P.CellData},l}(),s=function(){function l(h){var d=this;this._buffers=h,this._onBufferChange=new w.EventEmitter,this._normal=new v(this._buffers.normal,"normal"),this._alternate=new v(this._buffers.alt,"alternate"),this._buffers.onBufferActivate(function(){return d._onBufferChange.fire(d.active)})}return Object.defineProperty(l.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"active",{get:function(){if(this._buffers.active===this._buffers.normal)return this.normal;if(this._buffers.active===this._buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"normal",{get:function(){return this._normal.init(this._buffers.normal)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"alternate",{get:function(){return this._alternate.init(this._buffers.alt)},enumerable:!1,configurable:!0}),l}(),y=function(){function l(h){this._line=h}return Object.defineProperty(l.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"length",{get:function(){return this._line.length},enumerable:!1,configurable:!0}),l.prototype.getCell=function(h,d){if(!(h<0||h>=this._line.length))return d?(this._line.loadCell(h,d),d):this._line.loadCell(h,new P.CellData)},l.prototype.translateToString=function(h,d,E){return this._line.translateToString(h,d,E)},l}(),f=function(){function l(h){this._core=h}return l.prototype.registerCsiHandler=function(h,d){return this._core.addCsiHandler(h,function(E){return d(E.toArray())})},l.prototype.addCsiHandler=function(h,d){return this.registerCsiHandler(h,d)},l.prototype.registerDcsHandler=function(h,d){return this._core.addDcsHandler(h,function(E,T){return d(E,T.toArray())})},l.prototype.addDcsHandler=function(h,d){return this.registerDcsHandler(h,d)},l.prototype.registerEscHandler=function(h,d){return this._core.addEscHandler(h,d)},l.prototype.addEscHandler=function(h,d){return this.registerEscHandler(h,d)},l.prototype.registerOscHandler=function(h,d){return this._core.addOscHandler(h,d)},l.prototype.addOscHandler=function(h,d){return this.registerOscHandler(h,d)},l}(),c=function(){function l(h){this._core=h}return l.prototype.register=function(h){this._core.unicodeService.register(h)},Object.defineProperty(l.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(h){this._core.unicodeService.activeVersion=h},enumerable:!1,configurable:!0}),l}()},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(Z,N){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(W,K){W.__proto__=K}||function(W,K){for(var k in K)K.hasOwnProperty(k)&&(W[k]=K[k])})(Z,N)},function(Z,N){function W(){this.constructor=Z}P(Z,N),Z.prototype=N===null?Object.create(N):(W.prototype=N.prototype,new W)});Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;var D=I(36),w=I(37),_=I(38),F=I(12),v=I(19),s=I(40),y=I(50),f=I(51),c=I(11),l=I(7),h=I(18),d=I(54),E=I(55),T=I(56),L=I(57),x=I(59),A=I(0),O=I(16),U=I(27),B=I(60),$=I(5),M=I(61),Y=I(62),q=I(63),se=I(64),ce=I(65),J=typeof window!="undefined"?window.document:null,z=function(Z){function N(W){W===void 0&&(W={});var K=Z.call(this,W)||this;return K.browser=c,K._keyDownHandled=!1,K._onCursorMove=new A.EventEmitter,K._onKey=new A.EventEmitter,K._onRender=new A.EventEmitter,K._onSelectionChange=new A.EventEmitter,K._onTitleChange=new A.EventEmitter,K._onFocus=new A.EventEmitter,K._onBlur=new A.EventEmitter,K._onA11yCharEmitter=new A.EventEmitter,K._onA11yTabEmitter=new A.EventEmitter,K._setup(),K.linkifier=K._instantiationService.createInstance(y.Linkifier),K.linkifier2=K.register(K._instantiationService.createInstance(q.Linkifier2)),K.register(K._inputHandler.onRequestBell(function(){return K.bell()})),K.register(K._inputHandler.onRequestRefreshRows(function(k,C){return K.refresh(k,C)})),K.register(K._inputHandler.onRequestReset(function(){return K.reset()})),K.register(K._inputHandler.onRequestScroll(function(k,C){return K.scroll(k,C||void 0)})),K.register(K._inputHandler.onRequestWindowsOptionsReport(function(k){return K._reportWindowsOptions(k)})),K.register(A.forwardEvent(K._inputHandler.onCursorMove,K._onCursorMove)),K.register(A.forwardEvent(K._inputHandler.onTitleChange,K._onTitleChange)),K.register(A.forwardEvent(K._inputHandler.onA11yChar,K._onA11yCharEmitter)),K.register(A.forwardEvent(K._inputHandler.onA11yTab,K._onA11yTabEmitter)),K.register(K._bufferService.onResize(function(k){return K._afterResize(k.cols,k.rows)})),K}return G(N,Z),Object.defineProperty(N.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),N.prototype.dispose=function(){var W,K,k;this._isDisposed||(Z.prototype.dispose.call(this),(W=this._renderService)===null||W===void 0||W.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(k=(K=this.element)===null||K===void 0?void 0:K.parentNode)===null||k===void 0||k.removeChild(this.element))},N.prototype._setup=function(){Z.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(N.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),N.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},N.prototype._updateOptions=function(W){var K,k,C,V;switch(Z.prototype._updateOptions.call(this,W),W){case"fontFamily":case"fontSize":(K=this._renderService)===null||K===void 0||K.clear(),(k=this._charSizeService)===null||k===void 0||k.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":(C=this.viewport)===null||C===void 0||C.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new T.AccessibilityManager(this,this._renderService)):((V=this._accessibilityManager)===null||V===void 0||V.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},N.prototype._onTextAreaFocus=function(W){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(F.C0.ESC+"[I"),this.updateCursorStyle(W),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},N.prototype.blur=function(){var W;return(W=this.textarea)===null||W===void 0?void 0:W.blur()},N.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(F.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},N.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var W=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),K=this._bufferService.buffer.y*W,k=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=k+"px",this.textarea.style.top=K+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}},N.prototype._initGlobal=function(){var W=this;this._bindKeys(),this.register(l.addDisposableDomListener(this.element,"copy",function(k){W.hasSelection()&&_.copyHandler(k,W._selectionService)}));var K=function(k){return _.handlePasteEvent(k,W.textarea,W._coreService)};this.register(l.addDisposableDomListener(this.textarea,"paste",K)),this.register(l.addDisposableDomListener(this.element,"paste",K)),c.isFirefox?this.register(l.addDisposableDomListener(this.element,"mousedown",function(k){k.button===2&&_.rightClickHandler(k,W.textarea,W.screenElement,W._selectionService,W.options.rightClickSelectsWord)})):this.register(l.addDisposableDomListener(this.element,"contextmenu",function(k){_.rightClickHandler(k,W.textarea,W.screenElement,W._selectionService,W.options.rightClickSelectsWord)})),c.isLinux&&this.register(l.addDisposableDomListener(this.element,"auxclick",function(k){k.button===1&&_.moveTextAreaUnderMouseCursor(k,W.textarea,W.screenElement)}))},N.prototype._bindKeys=function(){var W=this;this.register(l.addDisposableDomListener(this.textarea,"keyup",function(K){return W._keyUp(K)},!0)),this.register(l.addDisposableDomListener(this.textarea,"keydown",function(K){return W._keyDown(K)},!0)),this.register(l.addDisposableDomListener(this.textarea,"keypress",function(K){return W._keyPress(K)},!0)),this.register(l.addDisposableDomListener(this.textarea,"compositionstart",function(){return W._compositionHelper.compositionstart()})),this.register(l.addDisposableDomListener(this.textarea,"compositionupdate",function(K){return W._compositionHelper.compositionupdate(K)})),this.register(l.addDisposableDomListener(this.textarea,"compositionend",function(){return W._compositionHelper.compositionend()})),this.register(this.onRender(function(){return W._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(K){return W._queueLinkification(K.start,K.end)}))},N.prototype.open=function(W){var K=this;if(!W)throw new Error("Terminal requires a parent element.");J.body.contains(W)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=W.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),W.appendChild(this.element);var k=J.createDocumentFragment();this._viewportElement=J.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.appendChild(this._viewportElement),this._viewportScrollArea=J.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=J.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=J.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=J.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",h.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register(l.addDisposableDomListener(this.textarea,"focus",function(ne){return K._onTextAreaFocus(ne)})),this.register(l.addDisposableDomListener(this.textarea,"blur",function(){return K._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var C=this._instantiationService.createInstance(se.CoreBrowserService,this.textarea);this._instantiationService.setService($.ICoreBrowserService,C),this._charSizeService=this._instantiationService.createInstance(M.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService($.ICharSizeService,this._charSizeService),this._compositionView=J.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(D.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(k),this._theme=this.options.theme||this._theme,this._colorManager=new U.ColorManager(J,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(ne){return K._colorManager.onOptionsChange(ne)})),this._colorManager.setTheme(this._theme);var V=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(B.RenderService,V,this.rows,this.screenElement)),this._instantiationService.setService($.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(ne){return K._onRender.fire(ne)})),this.onResize(function(ne){return K._renderService.resize(ne.cols,ne.rows)}),this._soundService=this._instantiationService.createInstance(d.SoundService),this._instantiationService.setService($.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(Y.MouseService),this._instantiationService.setService($.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(w.Viewport,function(ne,pe){return K.scrollLines(ne,pe)},this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(function(){return K.viewport.syncScrollArea()})),this.register(this.viewport),this.register(this.onCursorMove(function(){K._renderService.onCursorMove(),K._syncTextArea()})),this.register(this.onResize(function(){return K._renderService.onResize(K.cols,K.rows)})),this.register(this.onBlur(function(){return K._renderService.onBlur()})),this.register(this.onFocus(function(){return K._renderService.onFocus()})),this.register(this._renderService.onDimensionsChange(function(){return K.viewport.syncScrollArea()})),this._selectionService=this.register(this._instantiationService.createInstance(f.SelectionService,this.element,this.screenElement)),this._instantiationService.setService($.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(function(ne){return K.scrollLines(ne.amount,ne.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return K._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(ne){return K._renderService.onSelectionChanged(ne.start,ne.end,ne.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(ne){K.textarea.value=ne,K.textarea.focus(),K.textarea.select()})),this.register(this.onScroll(function(){K.viewport.syncScrollArea(),K._selectionService.refresh()})),this.register(l.addDisposableDomListener(this._viewportElement,"scroll",function(){return K._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(E.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll(function(){return K._mouseZoneManager.clearAll()})),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(l.addDisposableDomListener(this.element,"mousedown",function(ne){return K._selectionService.onMouseDown(ne)})),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new T.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},N.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(s.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(L.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},N.prototype._setTheme=function(W){var K,k,C;this._theme=W,(K=this._colorManager)===null||K===void 0||K.setTheme(W),(k=this._renderService)===null||k===void 0||k.setColors(this._colorManager.colors),(C=this.viewport)===null||C===void 0||C.onThemeChange(this._colorManager.colors)},N.prototype.bindMouse=function(){var W=this,K=this,k=this.element;function C(ve){var Ue,Be,Me=K._mouseService.getRawByteCoords(ve,K.screenElement,K.cols,K.rows);if(!Me)return!1;switch(ve.overrideType||ve.type){case"mousemove":Be=32,ve.buttons===void 0?(Ue=3,ve.button!==void 0&&(Ue=ve.button<3?ve.button:3)):Ue=1&ve.buttons?0:4&ve.buttons?1:2&ve.buttons?2:3;break;case"mouseup":Be=0,Ue=ve.button<3?ve.button:3;break;case"mousedown":Be=1,Ue=ve.button<3?ve.button:3;break;case"wheel":ve.deltaY!==0&&(Be=ve.deltaY<0?0:1),Ue=4;break;default:return!1}return!(Be===void 0||Ue===void 0||Ue>4)&&K._coreMouseService.triggerMouseEvent({col:Me.x-33,row:Me.y-33,button:Ue,action:Be,ctrl:ve.ctrlKey,alt:ve.altKey,shift:ve.shiftKey})}var V={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ne=function(ve){return C(ve),ve.buttons||(W._document.removeEventListener("mouseup",V.mouseup),V.mousedrag&&W._document.removeEventListener("mousemove",V.mousedrag)),W.cancel(ve)},pe=function(ve){return C(ve),ve.preventDefault(),W.cancel(ve)},Te=function(ve){ve.buttons&&C(ve)},Ke=function(ve){ve.buttons||C(ve)};this.register(this._coreMouseService.onProtocolChange(function(ve){ve?(W.optionsService.options.logLevel==="debug"&&W._logService.debug("Binding to mouse events:",W._coreMouseService.explainEvents(ve)),W.element.classList.add("enable-mouse-events"),W._selectionService.disable()):(W._logService.debug("Unbinding from mouse events."),W.element.classList.remove("enable-mouse-events"),W._selectionService.enable()),8&ve?V.mousemove||(k.addEventListener("mousemove",Ke),V.mousemove=Ke):(k.removeEventListener("mousemove",V.mousemove),V.mousemove=null),16&ve?V.wheel||(k.addEventListener("wheel",pe,{passive:!1}),V.wheel=pe):(k.removeEventListener("wheel",V.wheel),V.wheel=null),2&ve?V.mouseup||(V.mouseup=ne):(W._document.removeEventListener("mouseup",V.mouseup),V.mouseup=null),4&ve?V.mousedrag||(V.mousedrag=Te):(W._document.removeEventListener("mousemove",V.mousedrag),V.mousedrag=null)})),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(l.addDisposableDomListener(k,"mousedown",function(ve){if(ve.preventDefault(),W.focus(),W._coreMouseService.areMouseEventsActive&&!W._selectionService.shouldForceSelection(ve))return C(ve),V.mouseup&&W._document.addEventListener("mouseup",V.mouseup),V.mousedrag&&W._document.addEventListener("mousemove",V.mousedrag),W.cancel(ve)})),this.register(l.addDisposableDomListener(k,"wheel",function(ve){if(!V.wheel){if(!W.buffer.hasScrollback){var Ue=W.viewport.getLinesScrolled(ve);if(Ue===0)return;for(var Be=F.C0.ESC+(W._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ve.deltaY<0?"A":"B"),Me="",St=0;St<Math.abs(Ue);St++)Me+=Be;W._coreService.triggerDataEvent(Me,!0)}}},{passive:!0})),this.register(l.addDisposableDomListener(k,"wheel",function(ve){if(!V.wheel)return W.viewport.onWheel(ve)?void 0:W.cancel(ve)},{passive:!1})),this.register(l.addDisposableDomListener(k,"touchstart",function(ve){if(!W._coreMouseService.areMouseEventsActive)return W.viewport.onTouchStart(ve),W.cancel(ve)},{passive:!0})),this.register(l.addDisposableDomListener(k,"touchmove",function(ve){if(!W._coreMouseService.areMouseEventsActive)return W.viewport.onTouchMove(ve)?void 0:W.cancel(ve)},{passive:!1}))},N.prototype.refresh=function(W,K){var k;(k=this._renderService)===null||k===void 0||k.refreshRows(W,K)},N.prototype._queueLinkification=function(W,K){var k;(k=this.linkifier)===null||k===void 0||k.linkifyRows(W,K)},N.prototype.updateCursorStyle=function(W){this._selectionService&&this._selectionService.shouldColumnSelect(W)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},N.prototype._showCursor=function(){this._coreService.isCursorInitialized||(this._coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},N.prototype.scrollLines=function(W,K){Z.prototype.scrollLines.call(this,W,K),this.refresh(0,this.rows-1)},N.prototype.paste=function(W){_.paste(W,this.textarea,this._coreService)},N.prototype.attachCustomKeyEventHandler=function(W){this._customKeyEventHandler=W},N.prototype.registerLinkMatcher=function(W,K,k){var C=this.linkifier.registerLinkMatcher(W,K,k);return this.refresh(0,this.rows-1),C},N.prototype.deregisterLinkMatcher=function(W){this.linkifier.deregisterLinkMatcher(W)&&this.refresh(0,this.rows-1)},N.prototype.registerLinkProvider=function(W){return this.linkifier2.registerLinkProvider(W)},N.prototype.registerCharacterJoiner=function(W){var K=this._renderService.registerCharacterJoiner(W);return this.refresh(0,this.rows-1),K},N.prototype.deregisterCharacterJoiner=function(W){this._renderService.deregisterCharacterJoiner(W)&&this.refresh(0,this.rows-1)},Object.defineProperty(N.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),N.prototype.addMarker=function(W){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+W)},N.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},N.prototype.select=function(W,K,k){this._selectionService.setSelection(W,K,k)},N.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},N.prototype.getSelectionPosition=function(){if(this._selectionService&&this._selectionService.hasSelection)return{startColumn:this._selectionService.selectionStart[0],startRow:this._selectionService.selectionStart[1],endColumn:this._selectionService.selectionEnd[0],endRow:this._selectionService.selectionEnd[1]}},N.prototype.clearSelection=function(){var W;(W=this._selectionService)===null||W===void 0||W.clearSelection()},N.prototype.selectAll=function(){var W;(W=this._selectionService)===null||W===void 0||W.selectAll()},N.prototype.selectLines=function(W,K){var k;(k=this._selectionService)===null||k===void 0||k.selectLines(W,K)},N.prototype._keyDown=function(W){if(this._keyDownHandled=!1,this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1)return!1;if(!this._compositionHelper.keydown(W))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var K=x.evaluateKeyboardEvent(W,this._coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(W),K.type===3||K.type===2){var k=this.rows-1;return this.scrollLines(K.type===2?-k:k),this.cancel(W,!0)}return K.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,W)||(K.cancel&&this.cancel(W,!0),!K.key||(K.key!==F.C0.ETX&&K.key!==F.C0.CR||(this.textarea.value=""),this._onKey.fire({key:K.key,domEvent:W}),this._showCursor(),this._coreService.triggerDataEvent(K.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(W,!0)))},N.prototype._isThirdLevelShift=function(W,K){var k=W.isMac&&!this.options.macOptionIsMeta&&K.altKey&&!K.ctrlKey&&!K.metaKey||W.isWindows&&K.altKey&&K.ctrlKey&&!K.metaKey;return K.type==="keypress"?k:k&&(!K.keyCode||K.keyCode>47)},N.prototype._keyUp=function(W){this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1||(function(K){return K.keyCode===16||K.keyCode===17||K.keyCode===18}(W)||this.focus(),this.updateCursorStyle(W))},N.prototype._keyPress=function(W){var K;if(this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1)return!1;if(this.cancel(W),W.charCode)K=W.charCode;else if(W.which===null||W.which===void 0)K=W.keyCode;else{if(W.which===0||W.charCode===0)return!1;K=W.which}return!(!K||(W.altKey||W.ctrlKey||W.metaKey)&&!this._isThirdLevelShift(this.browser,W))&&(K=String.fromCharCode(K),this._onKey.fire({key:K,domEvent:W}),this._showCursor(),this._coreService.triggerDataEvent(K,!0),!0)},N.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},N.prototype.resize=function(W,K){W!==this.cols||K!==this.rows?Z.prototype.resize.call(this,W,K):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},N.prototype._afterResize=function(W,K){var k,C;(k=this._charSizeService)===null||k===void 0||k.measure(),(C=this.viewport)===null||C===void 0||C.syncScrollArea(!0)},N.prototype.clear=function(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var W=1;W<this.rows;W++)this.buffer.lines.push(this.buffer.getBlankLine(O.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire(this.buffer.ydisp)}},N.prototype.reset=function(){var W,K;this.options.rows=this.rows,this.options.cols=this.cols;var k=this._customKeyEventHandler;this._setup(),Z.prototype.reset.call(this),(W=this._selectionService)===null||W===void 0||W.reset(),this._customKeyEventHandler=k,this.refresh(0,this.rows-1),(K=this.viewport)===null||K===void 0||K.syncScrollArea()},N.prototype._reportWindowsOptions=function(W){if(this._renderService)switch(W){case v.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var K=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),k=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this._coreService.triggerDataEvent(F.C0.ESC+"[4;"+k+";"+K+"t");break;case v.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var C=this._renderService.dimensions.scaledCellWidth.toFixed(0),V=this._renderService.dimensions.scaledCellHeight.toFixed(0);this._coreService.triggerDataEvent(F.C0.ESC+"[6;"+V+";"+C+"t")}},N.prototype.cancel=function(W,K){if(this.options.cancelEvents||K)return W.preventDefault(),W.stopPropagation(),!1},N.prototype._visualBell=function(){return!1},N.prototype._soundBell=function(){return this.options.bellStyle==="sound"},N}(ce.CoreTerminal);b.Terminal=z},function(me,b,I){"use strict";var P=this&&this.__decorate||function(F,v,s,y){var f,c=arguments.length,l=c<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,s):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(F,v,s,y);else for(var h=F.length-1;h>=0;h--)(f=F[h])&&(l=(c<3?f(l):c>3?f(v,s,l):f(v,s))||l);return c>3&&l&&Object.defineProperty(v,s,l),l},G=this&&this.__param||function(F,v){return function(s,y){v(s,y,F)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CompositionHelper=void 0;var D=I(5),w=I(1),_=function(){function F(v,s,y,f,c,l){this._textarea=v,this._compositionView=s,this._bufferService=y,this._optionsService=f,this._charSizeService=c,this._coreService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0}}return Object.defineProperty(F.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),F.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},F.prototype.compositionupdate=function(v){var s=this;this._compositionView.textContent=v.data,this.updateCompositionElements(),setTimeout(function(){s._compositionPosition.end=s._textarea.value.length},0)},F.prototype.compositionend=function(){this._finalizeComposition(!0)},F.prototype.keydown=function(v){if(this._isComposing||this._isSendingComposition){if(v.keyCode===229||v.keyCode===16||v.keyCode===17||v.keyCode===18)return!1;this._finalizeComposition(!1)}return v.keyCode!==229||(this._handleAnyTextareaChanges(),!1)},F.prototype._finalizeComposition=function(v){var s=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,v){var y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(function(){if(s._isSendingComposition){s._isSendingComposition=!1;var c=void 0;c=s._isComposing?s._textarea.value.substring(y.start,y.end):s._textarea.value.substring(y.start),s._coreService.triggerDataEvent(c,!0)}},0)}else{this._isSendingComposition=!1;var f=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(f,!0)}},F.prototype._handleAnyTextareaChanges=function(){var v=this,s=this._textarea.value;setTimeout(function(){if(!v._isComposing){var y=v._textarea.value.replace(s,"");y.length>0&&v._coreService.triggerDataEvent(y,!0)}},0)},F.prototype.updateCompositionElements=function(v){var s=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var y=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),f=this._bufferService.buffer.y*y,c=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=c+"px",this._compositionView.style.top=f+"px",this._compositionView.style.height=y+"px",this._compositionView.style.lineHeight=y+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var l=this._compositionView.getBoundingClientRect();this._textarea.style.left=c+"px",this._textarea.style.top=f+"px",this._textarea.style.width=l.width+"px",this._textarea.style.height=l.height+"px",this._textarea.style.lineHeight=l.height+"px"}v||setTimeout(function(){return s.updateCompositionElements(!0)},0)}},F=P([G(2,w.IBufferService),G(3,w.IOptionsService),G(4,D.ICharSizeService),G(5,w.ICoreService)],F)}();b.CompositionHelper=_},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Viewport=void 0;var _=I(2),F=I(7),v=I(5),s=I(1),y=function(f){function c(l,h,d,E,T,L,x){var A=f.call(this)||this;return A._scrollLines=l,A._viewportElement=h,A._scrollArea=d,A._bufferService=E,A._optionsService=T,A._charSizeService=L,A._renderService=x,A.scrollBarWidth=0,A._currentRowHeight=0,A._lastRecordedBufferLength=0,A._lastRecordedViewportHeight=0,A._lastRecordedBufferHeight=0,A._lastTouchY=0,A._lastScrollTop=0,A._wheelPartialScroll=0,A._refreshAnimationFrame=null,A._ignoreNextScrollEvent=!1,A.scrollBarWidth=A._viewportElement.offsetWidth-A._scrollArea.offsetWidth||15,A.register(F.addDisposableDomListener(A._viewportElement,"scroll",A._onScroll.bind(A))),setTimeout(function(){return A.syncScrollArea()},0),A}return G(c,f),c.prototype.onThemeChange=function(l){this._viewportElement.style.backgroundColor=l.background.css},c.prototype._refresh=function(l){var h=this;if(l)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return h._innerRefresh()}))},c.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var h=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==h&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=h),this._refreshAnimationFrame=null},c.prototype.syncScrollArea=function(l){if(l===void 0&&(l=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(l);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var h=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===h&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(l)}else this._refresh(l)},c.prototype._onScroll=function(l){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var h=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(h,!0)}},c.prototype._bubbleScroll=function(l,h){var d=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&d<this._lastRecordedBufferHeight)||(l.cancelable&&l.preventDefault(),!1)},c.prototype.onWheel=function(l){var h=this._getPixelsScrolled(l);return h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(l,h))},c.prototype._getPixelsScrolled=function(l){if(l.deltaY===0)return 0;var h=this._applyScrollModifier(l.deltaY,l);return l.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:l.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h},c.prototype.getLinesScrolled=function(l){if(l.deltaY===0)return 0;var h=this._applyScrollModifier(l.deltaY,l);return l.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(h/=this._currentRowHeight+0,this._wheelPartialScroll+=h,h=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):l.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h},c.prototype._applyScrollModifier=function(l,h){var d=this._optionsService.options.fastScrollModifier;return d==="alt"&&h.altKey||d==="ctrl"&&h.ctrlKey||d==="shift"&&h.shiftKey?l*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:l*this._optionsService.options.scrollSensitivity},c.prototype.onTouchStart=function(l){this._lastTouchY=l.touches[0].pageY},c.prototype.onTouchMove=function(l){var h=this._lastTouchY-l.touches[0].pageY;return this._lastTouchY=l.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(l,h))},c=D([w(3,s.IBufferService),w(4,s.IOptionsService),w(5,v.ICharSizeService),w(6,v.IRenderService)],c)}(_.Disposable);b.Viewport=y},function(me,b,I){"use strict";function P(_){return _.replace(/\r?\n/g,"\r")}function G(_,F){return F?"\x1B[200~"+_+"\x1B[201~":_}function D(_,F,v){_=G(_=P(_),v.decPrivateModes.bracketedPasteMode),v.triggerDataEvent(_,!0),F.value=""}function w(_,F,v){var s=v.getBoundingClientRect(),y=_.clientX-s.left-10,f=_.clientY-s.top-10;F.style.width="20px",F.style.height="20px",F.style.left=y+"px",F.style.top=f+"px",F.style.zIndex="1000",F.focus()}Object.defineProperty(b,"__esModule",{value:!0}),b.rightClickHandler=b.moveTextAreaUnderMouseCursor=b.paste=b.handlePasteEvent=b.copyHandler=b.bracketTextForPaste=b.prepareTextForTerminal=void 0,b.prepareTextForTerminal=P,b.bracketTextForPaste=G,b.copyHandler=function(_,F){_.clipboardData&&_.clipboardData.setData("text/plain",F.selectionText),_.preventDefault()},b.handlePasteEvent=function(_,F,v){_.stopPropagation(),_.clipboardData&&D(_.clipboardData.getData("text/plain"),F,v)},b.paste=D,b.moveTextAreaUnderMouseCursor=w,b.rightClickHandler=function(_,F,v,s,y){w(_,F,v),y&&!s.isClickInSelection(_)&&s.selectWordAtCursor(_),F.value=s.selectionText,F.select()}},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)});Object.defineProperty(b,"__esModule",{value:!0}),b.EscapeSequenceParser=b.VT500_TRANSITION_TABLE=b.TransitionTable=void 0;var D=I(2),w=I(15),_=I(21),F=I(22),v=I(24),s=function(){function f(c){this.table=new Uint8Array(c)}return f.prototype.setDefault=function(c,l){w.fill(this.table,c<<4|l)},f.prototype.add=function(c,l,h,d){this.table[l<<8|c]=h<<4|d},f.prototype.addMany=function(c,l,h,d){for(var E=0;E<c.length;E++)this.table[l<<8|c[E]]=h<<4|d},f}();b.TransitionTable=s,b.VT500_TRANSITION_TABLE=function(){var f=new s(4095),c=Array.apply(null,Array(256)).map(function(L,x){return x}),l=function(L,x){return c.slice(L,x)},h=l(32,127),d=l(0,24);d.push(25),d.push.apply(d,l(28,32));var E,T=l(0,14);for(E in f.setDefault(1,0),f.addMany(h,0,2,0),T)f.addMany([24,26,153,154],E,3,0),f.addMany(l(128,144),E,3,0),f.addMany(l(144,152),E,3,0),f.add(156,E,0,0),f.add(27,E,11,1),f.add(157,E,4,8),f.addMany([152,158,159],E,0,7),f.add(155,E,11,3),f.add(144,E,11,9);return f.addMany(d,0,3,0),f.addMany(d,1,3,1),f.add(127,1,0,1),f.addMany(d,8,0,8),f.addMany(d,3,3,3),f.add(127,3,0,3),f.addMany(d,4,3,4),f.add(127,4,0,4),f.addMany(d,6,3,6),f.addMany(d,5,3,5),f.add(127,5,0,5),f.addMany(d,2,3,2),f.add(127,2,0,2),f.add(93,1,4,8),f.addMany(h,8,5,8),f.add(127,8,5,8),f.addMany([156,27,24,26,7],8,6,0),f.addMany(l(28,32),8,0,8),f.addMany([88,94,95],1,0,7),f.addMany(h,7,0,7),f.addMany(d,7,0,7),f.add(156,7,0,0),f.add(127,7,0,7),f.add(91,1,11,3),f.addMany(l(64,127),3,7,0),f.addMany(l(48,60),3,8,4),f.addMany([60,61,62,63],3,9,4),f.addMany(l(48,60),4,8,4),f.addMany(l(64,127),4,7,0),f.addMany([60,61,62,63],4,0,6),f.addMany(l(32,64),6,0,6),f.add(127,6,0,6),f.addMany(l(64,127),6,0,0),f.addMany(l(32,48),3,9,5),f.addMany(l(32,48),5,9,5),f.addMany(l(48,64),5,0,6),f.addMany(l(64,127),5,7,0),f.addMany(l(32,48),4,9,5),f.addMany(l(32,48),1,9,2),f.addMany(l(32,48),2,9,2),f.addMany(l(48,127),2,10,0),f.addMany(l(48,80),1,10,0),f.addMany(l(81,88),1,10,0),f.addMany([89,90,92],1,10,0),f.addMany(l(96,127),1,10,0),f.add(80,1,11,9),f.addMany(d,9,0,9),f.add(127,9,0,9),f.addMany(l(28,32),9,0,9),f.addMany(l(32,48),9,9,12),f.addMany(l(48,60),9,8,10),f.addMany([60,61,62,63],9,9,10),f.addMany(d,11,0,11),f.addMany(l(32,128),11,0,11),f.addMany(l(28,32),11,0,11),f.addMany(d,10,0,10),f.add(127,10,0,10),f.addMany(l(28,32),10,0,10),f.addMany(l(48,60),10,8,10),f.addMany([60,61,62,63],10,0,11),f.addMany(l(32,48),10,9,12),f.addMany(d,12,0,12),f.add(127,12,0,12),f.addMany(l(28,32),12,0,12),f.addMany(l(32,48),12,9,12),f.addMany(l(48,64),12,0,11),f.addMany(l(64,127),12,12,13),f.addMany(l(64,127),10,12,13),f.addMany(l(64,127),9,12,13),f.addMany(d,13,13,13),f.addMany(h,13,13,13),f.add(127,13,0,13),f.addMany([27,156,24,26],13,14,0),f.add(160,0,2,0),f.add(160,8,5,8),f.add(160,6,0,6),f.add(160,11,0,11),f.add(160,13,13,13),f}();var y=function(f){function c(l){l===void 0&&(l=b.VT500_TRANSITION_TABLE);var h=f.call(this)||this;return h._transitions=l,h.initialState=0,h.currentState=h.initialState,h._params=new _.Params,h._params.addParam(0),h._collect=0,h.precedingCodepoint=0,h._printHandlerFb=function(d,E,T){},h._executeHandlerFb=function(d){},h._csiHandlerFb=function(d,E){},h._escHandlerFb=function(d){},h._errorHandlerFb=function(d){return d},h._printHandler=h._printHandlerFb,h._executeHandlers=Object.create(null),h._csiHandlers=Object.create(null),h._escHandlers=Object.create(null),h._oscParser=new F.OscParser,h._dcsParser=new v.DcsParser,h._errorHandler=h._errorHandlerFb,h.setEscHandler({final:"\\"},function(){}),h}return G(c,f),c.prototype._identifier=function(l,h){h===void 0&&(h=[64,126]);var d=0;if(l.prefix){if(l.prefix.length>1)throw new Error("only one byte as prefix supported");if((d=l.prefix.charCodeAt(0))&&60>d||d>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(l.intermediates){if(l.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var E=0;E<l.intermediates.length;++E){var T=l.intermediates.charCodeAt(E);if(32>T||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");d<<=8,d|=T}}if(l.final.length!==1)throw new Error("final must be a single byte");var L=l.final.charCodeAt(0);if(h[0]>L||L>h[1])throw new Error("final must be in range "+h[0]+" .. "+h[1]);return d<<=8,d|=L},c.prototype.identToString=function(l){for(var h=[];l;)h.push(String.fromCharCode(255&l)),l>>=8;return h.reverse().join("")},c.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},c.prototype.setPrintHandler=function(l){this._printHandler=l},c.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},c.prototype.addEscHandler=function(l,h){var d=this._identifier(l,[48,126]);this._escHandlers[d]===void 0&&(this._escHandlers[d]=[]);var E=this._escHandlers[d];return E.push(h),{dispose:function(){var T=E.indexOf(h);T!==-1&&E.splice(T,1)}}},c.prototype.setEscHandler=function(l,h){this._escHandlers[this._identifier(l,[48,126])]=[h]},c.prototype.clearEscHandler=function(l){this._escHandlers[this._identifier(l,[48,126])]&&delete this._escHandlers[this._identifier(l,[48,126])]},c.prototype.setEscHandlerFallback=function(l){this._escHandlerFb=l},c.prototype.setExecuteHandler=function(l,h){this._executeHandlers[l.charCodeAt(0)]=h},c.prototype.clearExecuteHandler=function(l){this._executeHandlers[l.charCodeAt(0)]&&delete this._executeHandlers[l.charCodeAt(0)]},c.prototype.setExecuteHandlerFallback=function(l){this._executeHandlerFb=l},c.prototype.addCsiHandler=function(l,h){var d=this._identifier(l);this._csiHandlers[d]===void 0&&(this._csiHandlers[d]=[]);var E=this._csiHandlers[d];return E.push(h),{dispose:function(){var T=E.indexOf(h);T!==-1&&E.splice(T,1)}}},c.prototype.setCsiHandler=function(l,h){this._csiHandlers[this._identifier(l)]=[h]},c.prototype.clearCsiHandler=function(l){this._csiHandlers[this._identifier(l)]&&delete this._csiHandlers[this._identifier(l)]},c.prototype.setCsiHandlerFallback=function(l){this._csiHandlerFb=l},c.prototype.addDcsHandler=function(l,h){return this._dcsParser.addHandler(this._identifier(l),h)},c.prototype.setDcsHandler=function(l,h){this._dcsParser.setHandler(this._identifier(l),h)},c.prototype.clearDcsHandler=function(l){this._dcsParser.clearHandler(this._identifier(l))},c.prototype.setDcsHandlerFallback=function(l){this._dcsParser.setHandlerFallback(l)},c.prototype.addOscHandler=function(l,h){return this._oscParser.addHandler(l,h)},c.prototype.setOscHandler=function(l,h){this._oscParser.setHandler(l,h)},c.prototype.clearOscHandler=function(l){this._oscParser.clearHandler(l)},c.prototype.setOscHandlerFallback=function(l){this._oscParser.setHandlerFallback(l)},c.prototype.setErrorHandler=function(l){this._errorHandler=l},c.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},c.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},c.prototype.parse=function(l,h){for(var d=0,E=0,T=this.currentState,L=this._oscParser,x=this._dcsParser,A=this._collect,O=this._params,U=this._transitions.table,B=0;B<h;++B){switch((E=U[T<<8|((d=l[B])<160?d:160)])>>4){case 2:for(var $=B+1;;++$){if($>=h||(d=l[$])<32||d>126&&d<160){this._printHandler(l,B,$),B=$-1;break}if(++$>=h||(d=l[$])<32||d>126&&d<160){this._printHandler(l,B,$),B=$-1;break}if(++$>=h||(d=l[$])<32||d>126&&d<160){this._printHandler(l,B,$),B=$-1;break}if(++$>=h||(d=l[$])<32||d>126&&d<160){this._printHandler(l,B,$),B=$-1;break}}break;case 3:this._executeHandlers[d]?this._executeHandlers[d]():this._executeHandlerFb(d),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:B,code:d,currentState:T,collect:A,params:O,abort:!1}).abort)return;break;case 7:for(var M=this._csiHandlers[A<<8|d],Y=M?M.length-1:-1;Y>=0&&M[Y](O)===!1;Y--);Y<0&&this._csiHandlerFb(A<<8|d,O),this.precedingCodepoint=0;break;case 8:do switch(d){case 59:O.addParam(0);break;case 58:O.addSubParam(-1);break;default:O.addDigit(d-48)}while(++B<h&&(d=l[B])>47&&d<60);B--;break;case 9:A<<=8,A|=d;break;case 10:for(var q=this._escHandlers[A<<8|d],se=q?q.length-1:-1;se>=0&&q[se]()===!1;se--);se<0&&this._escHandlerFb(A<<8|d),this.precedingCodepoint=0;break;case 11:O.reset(),O.addParam(0),A=0;break;case 12:x.hook(A<<8|d,O);break;case 13:for(var ce=B+1;;++ce)if(ce>=h||(d=l[ce])===24||d===26||d===27||d>127&&d<160){x.put(l,B,ce),B=ce-1;break}break;case 14:x.unhook(d!==24&&d!==26),d===27&&(E|=1),O.reset(),O.addParam(0),A=0,this.precedingCodepoint=0;break;case 4:L.start();break;case 5:for(var J=B+1;;J++)if(J>=h||(d=l[J])<32||d>127&&d<=159){L.put(l,B,J),B=J-1;break}break;case 6:L.end(d!==24&&d!==26),d===27&&(E|=1),O.reset(),O.addParam(0),A=0,this.precedingCodepoint=0}T=15&E}this._collect=A,this.currentState=T},c}(D.Disposable);b.EscapeSequenceParser=y},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(L,x){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,O){A.__proto__=O}||function(A,O){for(var U in O)O.hasOwnProperty(U)&&(A[U]=O[U])})(L,x)},function(L,x){function A(){this.constructor=L}P(L,x),L.prototype=x===null?Object.create(x):(A.prototype=x.prototype,new A)}),D=this&&this.__decorate||function(L,x,A,O){var U,B=arguments.length,$=B<3?x:O===null?O=Object.getOwnPropertyDescriptor(x,A):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(L,x,A,O);else for(var M=L.length-1;M>=0;M--)(U=L[M])&&($=(B<3?U($):B>3?U(x,A,$):U(x,A))||$);return B>3&&$&&Object.defineProperty(x,A,$),$},w=this&&this.__param||function(L,x){return function(A,O){x(A,O,L)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Renderer=void 0;var _=I(41),F=I(47),v=I(48),s=I(49),y=I(29),f=I(2),c=I(5),l=I(1),h=I(25),d=I(0),E=1,T=function(L){function x(A,O,U,B,$,M,Y,q,se){var ce=L.call(this)||this;ce._colors=A,ce._screenElement=O,ce._bufferService=$,ce._charSizeService=M,ce._optionsService=Y,ce._id=E++,ce._onRequestRedraw=new d.EventEmitter;var J=ce._optionsService.options.allowTransparency;return ce._characterJoinerRegistry=new y.CharacterJoinerRegistry(ce._bufferService),ce._renderLayers=[new _.TextRenderLayer(ce._screenElement,0,ce._colors,ce._characterJoinerRegistry,J,ce._id,ce._bufferService,Y),new F.SelectionRenderLayer(ce._screenElement,1,ce._colors,ce._id,ce._bufferService,Y),new s.LinkRenderLayer(ce._screenElement,2,ce._colors,ce._id,U,B,ce._bufferService,Y),new v.CursorRenderLayer(ce._screenElement,3,ce._colors,ce._id,ce._onRequestRedraw,ce._bufferService,Y,q,se)],ce.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},ce._devicePixelRatio=window.devicePixelRatio,ce._updateDimensions(),ce.onOptionsChanged(),ce}return G(x,L),Object.defineProperty(x.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),x.prototype.dispose=function(){for(var A=0,O=this._renderLayers;A<O.length;A++)O[A].dispose();L.prototype.dispose.call(this),h.removeTerminalFromCache(this._id)},x.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},x.prototype.setColors=function(A){this._colors=A;for(var O=0,U=this._renderLayers;O<U.length;O++){var B=U[O];B.setColors(this._colors),B.reset()}},x.prototype.onResize=function(A,O){this._updateDimensions();for(var U=0,B=this._renderLayers;U<B.length;U++)B[U].resize(this.dimensions);this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},x.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},x.prototype.onBlur=function(){this._runOperation(function(A){return A.onBlur()})},x.prototype.onFocus=function(){this._runOperation(function(A){return A.onFocus()})},x.prototype.onSelectionChanged=function(A,O,U){U===void 0&&(U=!1),this._runOperation(function(B){return B.onSelectionChanged(A,O,U)})},x.prototype.onCursorMove=function(){this._runOperation(function(A){return A.onCursorMove()})},x.prototype.onOptionsChanged=function(){this._runOperation(function(A){return A.onOptionsChanged()})},x.prototype.clear=function(){this._runOperation(function(A){return A.reset()})},x.prototype._runOperation=function(A){for(var O=0,U=this._renderLayers;O<U.length;O++)A(U[O])},x.prototype.renderRows=function(A,O){for(var U=0,B=this._renderLayers;U<B.length;U++)B[U].onGridChanged(A,O)},x.prototype._updateDimensions=function(){this._charSizeService.hasValidSize&&(this.dimensions.scaledCharWidth=Math.floor(this._charSizeService.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharTop=this._optionsService.options.lineHeight===1?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._optionsService.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._bufferService.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._bufferService.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols)},x.prototype.registerCharacterJoiner=function(A){return this._characterJoinerRegistry.registerCharacterJoiner(A)},x.prototype.deregisterCharacterJoiner=function(A){return this._characterJoinerRegistry.deregisterCharacterJoiner(A)},x=D([w(4,l.IBufferService),w(5,c.ICharSizeService),w(6,l.IOptionsService),w(7,l.ICoreService),w(8,c.ICoreBrowserService)],x)}(f.Disposable);b.Renderer=T},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)});Object.defineProperty(b,"__esModule",{value:!0}),b.TextRenderLayer=void 0;var D=I(42),w=I(13),_=I(6),F=I(3),v=I(29),s=I(4),y=function(f){function c(l,h,d,E,T,L,x,A){var O=f.call(this,l,"text",h,T,d,L,x,A)||this;return O._characterWidth=0,O._characterFont="",O._characterOverlapCache={},O._workCell=new s.CellData,O._state=new D.GridCache,O._characterJoinerRegistry=E,O}return G(c,f),c.prototype.resize=function(l){f.prototype.resize.call(this,l);var h=this._getFont(!1,!1);this._characterWidth===l.scaledCharWidth&&this._characterFont===h||(this._characterWidth=l.scaledCharWidth,this._characterFont=h,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},c.prototype.reset=function(){this._state.clear(),this._clearAll()},c.prototype._forEachCell=function(l,h,d,E){for(var T=l;T<=h;T++)for(var L=T+this._bufferService.buffer.ydisp,x=this._bufferService.buffer.lines.get(L),A=d?d.getJoinedCharacters(L):[],O=0;O<this._bufferService.cols;O++){x.loadCell(O,this._workCell);var U=this._workCell,B=!1,$=O;if(U.getWidth()!==0){if(A.length>0&&O===A[0][0]){B=!0;var M=A.shift();U=new v.JoinedCellData(this._workCell,x.translateToString(!0,M[0],M[1]),M[1]-M[0]),$=M[1]-1}!B&&this._isOverlapping(U)&&$<x.length-1&&x.getCodePoint($+1)===F.NULL_CELL_CODE&&(U.content&=-12582913,U.content|=2<<22),E(U,O,T),O=$}}},c.prototype._drawBackground=function(l,h){var d=this,E=this._ctx,T=this._bufferService.cols,L=0,x=0,A=null;E.save(),this._forEachCell(l,h,null,function(O,U,B){var $=null;O.isInverse()?$=O.isFgDefault()?d._colors.foreground.css:O.isFgRGB()?"rgb("+_.AttributeData.toColorRGB(O.getFgColor()).join(",")+")":d._colors.ansi[O.getFgColor()].css:O.isBgRGB()?$="rgb("+_.AttributeData.toColorRGB(O.getBgColor()).join(",")+")":O.isBgPalette()&&($=d._colors.ansi[O.getBgColor()].css),A===null&&(L=U,x=B),B!==x?(E.fillStyle=A||"",d._fillCells(L,x,T-L,1),L=U,x=B):A!==$&&(E.fillStyle=A||"",d._fillCells(L,x,U-L,1),L=U,x=B),A=$}),A!==null&&(E.fillStyle=A,this._fillCells(L,x,T-L,1)),E.restore()},c.prototype._drawForeground=function(l,h){var d=this;this._forEachCell(l,h,this._characterJoinerRegistry,function(E,T,L){if(!E.isInvisible()&&(d._drawChars(E,T,L),E.isUnderline())){if(d._ctx.save(),E.isInverse())if(E.isBgDefault())d._ctx.fillStyle=d._colors.background.css;else if(E.isBgRGB())d._ctx.fillStyle="rgb("+_.AttributeData.toColorRGB(E.getBgColor()).join(",")+")";else{var x=E.getBgColor();d._optionsService.options.drawBoldTextInBrightColors&&E.isBold()&&x<8&&(x+=8),d._ctx.fillStyle=d._colors.ansi[x].css}else if(E.isFgDefault())d._ctx.fillStyle=d._colors.foreground.css;else if(E.isFgRGB())d._ctx.fillStyle="rgb("+_.AttributeData.toColorRGB(E.getFgColor()).join(",")+")";else{var A=E.getFgColor();d._optionsService.options.drawBoldTextInBrightColors&&E.isBold()&&A<8&&(A+=8),d._ctx.fillStyle=d._colors.ansi[A].css}d._fillBottomLineAtCells(T,L,E.getWidth()),d._ctx.restore()}})},c.prototype.onGridChanged=function(l,h){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,l,this._bufferService.cols,h-l+1),this._drawBackground(l,h),this._drawForeground(l,h))},c.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},c.prototype._isOverlapping=function(l){if(l.getWidth()!==1||l.getCode()<256)return!1;var h=l.getChars();if(this._characterOverlapCache.hasOwnProperty(h))return this._characterOverlapCache[h];this._ctx.save(),this._ctx.font=this._characterFont;var d=Math.floor(this._ctx.measureText(h).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[h]=d,d},c}(w.BaseRenderLayer);b.TextRenderLayer=y},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GridCache=void 0;var P=function(){function G(){this.cache=[]}return G.prototype.resize=function(D,w){for(var _=0;_<D;_++){this.cache.length<=_&&this.cache.push([]);for(var F=this.cache[_].length;F<w;F++)this.cache[_].push(void 0);this.cache[_].length=w}this.cache.length=D},G.prototype.clear=function(){for(var D=0;D<this.cache.length;D++)for(var w=0;w<this.cache[D].length;w++)this.cache[D][w]=void 0},G}();b.GridCache=P},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(d,E){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,L){T.__proto__=L}||function(T,L){for(var x in L)L.hasOwnProperty(x)&&(T[x]=L[x])})(d,E)},function(d,E){function T(){this.constructor=d}P(d,E),d.prototype=E===null?Object.create(E):(T.prototype=E.prototype,new T)});Object.defineProperty(b,"__esModule",{value:!0}),b.NoneCharAtlas=b.DynamicCharAtlas=b.getGlyphCacheKey=void 0;var D=I(9),w=I(44),_=I(27),F=I(46),v=I(11),s=I(28),y=I(10),f={css:"rgba(0, 0, 0, 0)",rgba:0};function c(d){return d.code<<21|d.bg<<12|d.fg<<3|(d.bold?0:4)+(d.dim?0:2)+(d.italic?0:1)}b.getGlyphCacheKey=c;var l=function(d){function E(T,L){var x=d.call(this)||this;x._config=L,x._drawToCacheCount=0,x._glyphsWaitingOnBitmap=[],x._bitmapCommitTimeout=null,x._bitmap=null,x._cacheCanvas=T.createElement("canvas"),x._cacheCanvas.width=1024,x._cacheCanvas.height=1024,x._cacheCtx=s.throwIfFalsy(x._cacheCanvas.getContext("2d",{alpha:!0}));var A=T.createElement("canvas");A.width=x._config.scaledCharWidth,A.height=x._config.scaledCharHeight,x._tmpCtx=s.throwIfFalsy(A.getContext("2d",{alpha:x._config.allowTransparency})),x._width=Math.floor(1024/x._config.scaledCharWidth),x._height=Math.floor(1024/x._config.scaledCharHeight);var O=x._width*x._height;return x._cacheMap=new F.LRUMap(O),x._cacheMap.prealloc(O),x}return G(E,d),E.prototype.dispose=function(){this._bitmapCommitTimeout!==null&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},E.prototype.beginFrame=function(){this._drawToCacheCount=0},E.prototype.draw=function(T,L,x,A){if(L.code===32)return!0;if(!this._canCache(L))return!1;var O=c(L),U=this._cacheMap.get(O);if(U!=null)return this._drawFromCache(T,U,x,A),!0;if(this._drawToCacheCount<100){var B=void 0;B=this._cacheMap.size<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index;var $=this._drawToCache(L,B);return this._cacheMap.set(O,$),this._drawFromCache(T,$,x,A),!0}return!1},E.prototype._canCache=function(T){return T.code<256},E.prototype._toCoordinateX=function(T){return T%this._width*this._config.scaledCharWidth},E.prototype._toCoordinateY=function(T){return Math.floor(T/this._width)*this._config.scaledCharHeight},E.prototype._drawFromCache=function(T,L,x,A){if(!L.isEmpty){var O=this._toCoordinateX(L.index),U=this._toCoordinateY(L.index);T.drawImage(L.inBitmap?this._bitmap:this._cacheCanvas,O,U,this._config.scaledCharWidth,this._config.scaledCharHeight,x,A,this._config.scaledCharWidth,this._config.scaledCharHeight)}},E.prototype._getColorFromAnsiIndex=function(T){return T<this._config.colors.ansi.length?this._config.colors.ansi[T]:_.DEFAULT_ANSI_COLORS[T]},E.prototype._getBackgroundColor=function(T){return this._config.allowTransparency?f:T.bg===D.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:T.bg<256?this._getColorFromAnsiIndex(T.bg):this._config.colors.background},E.prototype._getForegroundColor=function(T){return T.fg===D.INVERTED_DEFAULT_COLOR?y.color.opaque(this._config.colors.background):T.fg<256?this._getColorFromAnsiIndex(T.fg):this._config.colors.foreground},E.prototype._drawToCache=function(T,L){this._drawToCacheCount++,this._tmpCtx.save();var x=this._getBackgroundColor(T);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var A=T.bold?this._config.fontWeightBold:this._config.fontWeight,O=T.italic?"italic":"";this._tmpCtx.font=O+" "+A+" "+this._config.fontSize*this._config.devicePixelRatio+"px "+this._config.fontFamily,this._tmpCtx.textBaseline="middle",this._tmpCtx.fillStyle=this._getForegroundColor(T).css,T.dim&&(this._tmpCtx.globalAlpha=D.DIM_OPACITY),this._tmpCtx.fillText(T.chars,0,this._config.scaledCharHeight/2),this._tmpCtx.restore();var U=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),B=!1;this._config.allowTransparency||(B=function(q,se){for(var ce=!0,J=se.rgba>>>24,z=se.rgba>>>16&255,Z=se.rgba>>>8&255,N=0;N<q.data.length;N+=4)q.data[N]===J&&q.data[N+1]===z&&q.data[N+2]===Z?q.data[N+3]=0:ce=!1;return ce}(U,x));var $=this._toCoordinateX(L),M=this._toCoordinateY(L);this._cacheCtx.putImageData(U,$,M);var Y={index:L,isEmpty:B,inBitmap:!1};return this._addGlyphToBitmap(Y),Y},E.prototype._addGlyphToBitmap=function(T){var L=this;!("createImageBitmap"in window)||v.isFirefox||v.isSafari||(this._glyphsWaitingOnBitmap.push(T),this._bitmapCommitTimeout===null&&(this._bitmapCommitTimeout=window.setTimeout(function(){return L._generateBitmap()},100)))},E.prototype._generateBitmap=function(){var T=this,L=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then(function(x){T._bitmap=x;for(var A=0;A<L.length;A++)L[A].inBitmap=!0}),this._bitmapCommitTimeout=null},E}(w.BaseCharAtlas);b.DynamicCharAtlas=l;var h=function(d){function E(T,L){return d.call(this)||this}return G(E,d),E.prototype.draw=function(T,L,x,A){return!1},E}(w.BaseCharAtlas);b.NoneCharAtlas=h},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BaseCharAtlas=void 0;var P=function(){function G(){this._didWarmUp=!1}return G.prototype.dispose=function(){},G.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},G.prototype._doWarmUp=function(){},G.prototype.beginFrame=function(){},G}();b.BaseCharAtlas=P},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ColorContrastCache=void 0;var P=function(){function G(){this._color={},this._rgba={}}return G.prototype.clear=function(){this._color={},this._rgba={}},G.prototype.setCss=function(D,w,_){this._rgba[D]||(this._rgba[D]={}),this._rgba[D][w]=_},G.prototype.getCss=function(D,w){return this._rgba[D]?this._rgba[D][w]:void 0},G.prototype.setColor=function(D,w,_){this._color[D]||(this._color[D]={}),this._color[D][w]=_},G.prototype.getColor=function(D,w){return this._color[D]?this._color[D][w]:void 0},G}();b.ColorContrastCache=P},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.LRUMap=void 0;var P=function(){function G(D){this.capacity=D,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return G.prototype._unlinkNode=function(D){var w=D.prev,_=D.next;D===this._head&&(this._head=_),D===this._tail&&(this._tail=w),w!==null&&(w.next=_),_!==null&&(_.prev=w)},G.prototype._appendNode=function(D){var w=this._tail;w!==null&&(w.next=D),D.prev=w,D.next=null,this._tail=D,this._head===null&&(this._head=D)},G.prototype.prealloc=function(D){for(var w=this._nodePool,_=0;_<D;_++)w.push({prev:null,next:null,key:null,value:null})},G.prototype.get=function(D){var w=this._map[D];return w!==void 0?(this._unlinkNode(w),this._appendNode(w),w.value):null},G.prototype.peekValue=function(D){var w=this._map[D];return w!==void 0?w.value:null},G.prototype.peek=function(){var D=this._head;return D===null?null:D.value},G.prototype.set=function(D,w){var _=this._map[D];if(_!==void 0)_=this._map[D],this._unlinkNode(_),_.value=w;else if(this.size>=this.capacity)_=this._head,this._unlinkNode(_),delete this._map[_.key],_.key=D,_.value=w,this._map[D]=_;else{var F=this._nodePool;F.length>0?((_=F.pop()).key=D,_.value=w):_={prev:null,next:null,key:D,value:w},this._map[D]=_,this.size++}this._appendNode(_)},G}();b.LRUMap=P},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(w,_){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,v){F.__proto__=v}||function(F,v){for(var s in v)v.hasOwnProperty(s)&&(F[s]=v[s])})(w,_)},function(w,_){function F(){this.constructor=w}P(w,_),w.prototype=_===null?Object.create(_):(F.prototype=_.prototype,new F)});Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionRenderLayer=void 0;var D=function(w){function _(F,v,s,y,f,c){var l=w.call(this,F,"selection",v,!0,s,y,f,c)||this;return l._clearState(),l}return G(_,w),_.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},_.prototype.resize=function(F){w.prototype.resize.call(this,F),this._clearState()},_.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},_.prototype.onSelectionChanged=function(F,v,s){if(this._didStateChange(F,v,s,this._bufferService.buffer.ydisp))if(this._clearAll(),F&&v){var y=F[1]-this._bufferService.buffer.ydisp,f=v[1]-this._bufferService.buffer.ydisp,c=Math.max(y,0),l=Math.min(f,this._bufferService.rows-1);if(!(c>=this._bufferService.rows||l<0)){if(this._ctx.fillStyle=this._colors.selectionTransparent.css,s){var h=F[0],d=v[0]-h,E=l-c+1;this._fillCells(h,c,d,E)}else{h=y===c?F[0]:0;var T=c===l?v[0]:this._bufferService.cols;this._fillCells(h,c,T-h,1);var L=Math.max(l-c-1,0);if(this._fillCells(0,c+1,this._bufferService.cols,L),c!==l){var x=f===l?v[0]:this._bufferService.cols;this._fillCells(0,l,x,1)}}this._state.start=[F[0],F[1]],this._state.end=[v[0],v[1]],this._state.columnSelectMode=s,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},_.prototype._didStateChange=function(F,v,s,y){return!this._areCoordinatesEqual(F,this._state.start)||!this._areCoordinatesEqual(v,this._state.end)||s!==this._state.columnSelectMode||y!==this._state.ydisp},_.prototype._areCoordinatesEqual=function(F,v){return!(!F||!v)&&F[0]===v[0]&&F[1]===v[1]},_}(I(13).BaseRenderLayer);b.SelectionRenderLayer=D},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(v,s){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,f){y.__proto__=f}||function(y,f){for(var c in f)f.hasOwnProperty(c)&&(y[c]=f[c])})(v,s)},function(v,s){function y(){this.constructor=v}P(v,s),v.prototype=s===null?Object.create(s):(y.prototype=s.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.CursorRenderLayer=void 0;var D=I(13),w=I(4),_=function(v){function s(y,f,c,l,h,d,E,T,L){var x=v.call(this,y,"cursor",f,!0,c,l,d,E)||this;return x._onRequestRedraw=h,x._coreService=T,x._coreBrowserService=L,x._cell=new w.CellData,x._state={x:0,y:0,isFocused:!1,style:"",width:0},x._cursorRenderers={bar:x._renderBarCursor.bind(x),block:x._renderBlockCursor.bind(x),underline:x._renderUnderlineCursor.bind(x)},x}return G(s,v),s.prototype.resize=function(y){v.prototype.resize.call(this,y),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},s.prototype.reset=function(){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},s.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onOptionsChanged=function(){var y,f=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new F(this._coreBrowserService.isFocused,function(){f._render(!0)})):((y=this._cursorBlinkStateManager)===null||y===void 0||y.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},s.prototype.onGridChanged=function(y,f){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},s.prototype._render=function(y){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var f=this._bufferService.buffer.ybase+this._bufferService.buffer.y,c=f-this._bufferService.buffer.ydisp;if(c<0||c>=this._bufferService.rows)this._clearCursor();else{var l=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(f).loadCell(l,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var h=this._optionsService.options.cursorStyle;return h&&h!=="block"?this._cursorRenderers[h](l,c,this._cell):this._renderBlurCursor(l,c,this._cell),this._ctx.restore(),this._state.x=l,this._state.y=c,this._state.isFocused=!1,this._state.style=h,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===l&&this._state.y===c&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](l,c,this._cell),this._ctx.restore(),this._state.x=l,this._state.y=c,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},s.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},s.prototype._renderBarCursor=function(y,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(y,f,this._optionsService.options.cursorWidth),this._ctx.restore()},s.prototype._renderBlockCursor=function(y,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(y,f,c.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(c,y,f),this._ctx.restore()},s.prototype._renderUnderlineCursor=function(y,f,c){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(y,f),this._ctx.restore()},s.prototype._renderBlurCursor=function(y,f,c){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(y,f,c.getWidth(),1),this._ctx.restore()},s}(D.BaseRenderLayer);b.CursorRenderLayer=_;var F=function(){function v(s,y){this._renderCallback=y,this.isCursorVisible=!0,s&&this._restartInterval()}return Object.defineProperty(v.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),v.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},v.prototype.restartBlinkAnimation=function(){var s=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){s._renderCallback(),s._animationFrame=void 0})))},v.prototype._restartInterval=function(s){var y=this;s===void 0&&(s=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout(function(){if(y._animationTimeRestarted){var f=600-(Date.now()-y._animationTimeRestarted);if(y._animationTimeRestarted=void 0,f>0)return void y._restartInterval(f)}y.isCursorVisible=!1,y._animationFrame=window.requestAnimationFrame(function(){y._renderCallback(),y._animationFrame=void 0}),y._blinkInterval=window.setInterval(function(){if(y._animationTimeRestarted){var c=600-(Date.now()-y._animationTimeRestarted);return y._animationTimeRestarted=void 0,void y._restartInterval(c)}y.isCursorVisible=!y.isCursorVisible,y._animationFrame=window.requestAnimationFrame(function(){y._renderCallback(),y._animationFrame=void 0})},600)},s)},v.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},v.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},v}()},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(v,s){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,f){y.__proto__=f}||function(y,f){for(var c in f)f.hasOwnProperty(c)&&(y[c]=f[c])})(v,s)},function(v,s){function y(){this.constructor=v}P(v,s),v.prototype=s===null?Object.create(s):(y.prototype=s.prototype,new y)});Object.defineProperty(b,"__esModule",{value:!0}),b.LinkRenderLayer=void 0;var D=I(13),w=I(9),_=I(26),F=function(v){function s(y,f,c,l,h,d,E,T){var L=v.call(this,y,"link",f,!0,c,l,E,T)||this;return h.onShowLinkUnderline(function(x){return L._onShowLinkUnderline(x)}),h.onHideLinkUnderline(function(x){return L._onHideLinkUnderline(x)}),d.onShowLinkUnderline(function(x){return L._onShowLinkUnderline(x)}),d.onHideLinkUnderline(function(x){return L._onHideLinkUnderline(x)}),L}return G(s,v),s.prototype.resize=function(y){v.prototype.resize.call(this,y),this._state=void 0},s.prototype.reset=function(){this._clearCurrentLink()},s.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var y=this._state.y2-this._state.y1-1;y>0&&this._clearCells(0,this._state.y1+1,this._state.cols,y),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},s.prototype._onShowLinkUnderline=function(y){if(y.fg===w.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:y.fg&&_.is256Color(y.fg)?this._ctx.fillStyle=this._colors.ansi[y.fg].css:this._ctx.fillStyle=this._colors.foreground.css,y.y1===y.y2)this._fillBottomLineAtCells(y.x1,y.y1,y.x2-y.x1);else{this._fillBottomLineAtCells(y.x1,y.y1,y.cols-y.x1);for(var f=y.y1+1;f<y.y2;f++)this._fillBottomLineAtCells(0,f,y.cols);this._fillBottomLineAtCells(0,y.y2,y.x2)}this._state=y},s.prototype._onHideLinkUnderline=function(y){this._clearCurrentLink()},s}(D.BaseRenderLayer);b.LinkRenderLayer=F},function(me,b,I){"use strict";var P=this&&this.__decorate||function(v,s,y,f){var c,l=arguments.length,h=l<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,y):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(v,s,y,f);else for(var d=v.length-1;d>=0;d--)(c=v[d])&&(h=(l<3?c(h):l>3?c(s,y,h):c(s,y))||h);return l>3&&h&&Object.defineProperty(s,y,h),h},G=this&&this.__param||function(v,s){return function(y,f){s(y,f,v)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseZone=b.Linkifier=void 0;var D=I(0),w=I(1),_=function(){function v(s,y,f){this._bufferService=s,this._logService=y,this._unicodeService=f,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new D.EventEmitter,this._onHideLinkUnderline=new D.EventEmitter,this._onLinkTooltip=new D.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(v.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),v.prototype.attachToDom=function(s,y){this._element=s,this._mouseZoneManager=y},v.prototype.linkifyRows=function(s,y){var f=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=s,this._rowsToLinkify.end=y):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,s),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,y)),this._mouseZoneManager.clearAll(s,y),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return f._linkifyRows()},v._timeBeforeLatency))},v.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var s=this._bufferService.buffer;if(this._rowsToLinkify.start!==void 0&&this._rowsToLinkify.end!==void 0){var y=s.ydisp+this._rowsToLinkify.start;if(!(y>=s.lines.length)){for(var f=s.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,c=Math.ceil(2e3/this._bufferService.cols),l=this._bufferService.buffer.iterator(!1,y,f,c,c);l.hasNext();)for(var h=l.next(),d=0;d<this._linkMatchers.length;d++)this._doLinkifyRow(h.range.first,h.content,this._linkMatchers[d]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},v.prototype.registerLinkMatcher=function(s,y,f){if(f===void 0&&(f={}),!y)throw new Error("handler must be defined");var c={id:this._nextLinkMatcherId++,regex:s,handler:y,matchIndex:f.matchIndex,validationCallback:f.validationCallback,hoverTooltipCallback:f.tooltipCallback,hoverLeaveCallback:f.leaveCallback,willLinkActivate:f.willLinkActivate,priority:f.priority||0};return this._addLinkMatcherToList(c),c.id},v.prototype._addLinkMatcherToList=function(s){if(this._linkMatchers.length!==0){for(var y=this._linkMatchers.length-1;y>=0;y--)if(s.priority<=this._linkMatchers[y].priority)return void this._linkMatchers.splice(y+1,0,s);this._linkMatchers.splice(0,0,s)}else this._linkMatchers.push(s)},v.prototype.deregisterLinkMatcher=function(s){for(var y=0;y<this._linkMatchers.length;y++)if(this._linkMatchers[y].id===s)return this._linkMatchers.splice(y,1),!0;return!1},v.prototype._doLinkifyRow=function(s,y,f){for(var c,l=this,h=new RegExp(f.regex.source,(f.regex.flags||"")+"g"),d=-1,E=function(){var L=c[typeof f.matchIndex!="number"?0:f.matchIndex];if(!L)return T._logService.debug("match found without corresponding matchIndex",c,f),"break";if(d=y.indexOf(L,d+1),h.lastIndex=d+L.length,d<0)return"break";var x=T._bufferService.buffer.stringIndexToBufferIndex(s,d);if(x[0]<0)return"break";var A=T._bufferService.buffer.lines.get(x[0]);if(!A)return"break";var O=A.getFg(x[1]),U=O?O>>9&511:void 0;f.validationCallback?f.validationCallback(L,function(B){l._rowsTimeoutId||B&&l._addLink(x[1],x[0]-l._bufferService.buffer.ydisp,L,f,U)}):T._addLink(x[1],x[0]-T._bufferService.buffer.ydisp,L,f,U)},T=this;(c=h.exec(y))!==null&&E()!=="break";);},v.prototype._addLink=function(s,y,f,c,l){var h=this;if(this._mouseZoneManager&&this._element){var d=this._unicodeService.getStringCellWidth(f),E=s%this._bufferService.cols,T=y+Math.floor(s/this._bufferService.cols),L=(E+d)%this._bufferService.cols,x=T+Math.floor((E+d)/this._bufferService.cols);L===0&&(L=this._bufferService.cols,x--),this._mouseZoneManager.add(new F(E+1,T+1,L+1,x+1,function(A){if(c.handler)return c.handler(A,f);var O=window.open();O?(O.opener=null,O.location.href=f):console.warn("Opening link blocked as opener could not be cleared")},function(){h._onShowLinkUnderline.fire(h._createLinkHoverEvent(E,T,L,x,l)),h._element.classList.add("xterm-cursor-pointer")},function(A){h._onLinkTooltip.fire(h._createLinkHoverEvent(E,T,L,x,l)),c.hoverTooltipCallback&&c.hoverTooltipCallback(A,f,{start:{x:E,y:T},end:{x:L,y:x}})},function(){h._onHideLinkUnderline.fire(h._createLinkHoverEvent(E,T,L,x,l)),h._element.classList.remove("xterm-cursor-pointer"),c.hoverLeaveCallback&&c.hoverLeaveCallback()},function(A){return!c.willLinkActivate||c.willLinkActivate(A,f)}))}},v.prototype._createLinkHoverEvent=function(s,y,f,c,l){return{x1:s,y1:y,x2:f,y2:c,cols:this._bufferService.cols,fg:l}},v._timeBeforeLatency=200,v=P([G(0,w.IBufferService),G(1,w.ILogService),G(2,w.IUnicodeService)],v)}();b.Linkifier=_;var F=function(v,s,y,f,c,l,h,d,E){this.x1=v,this.y1=s,this.x2=y,this.y2=f,this.clickCallback=c,this.hoverCallback=l,this.tooltipCallback=h,this.leaveCallback=d,this.willLinkActivate=E};b.MouseZone=F},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(L,x){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,O){A.__proto__=O}||function(A,O){for(var U in O)O.hasOwnProperty(U)&&(A[U]=O[U])})(L,x)},function(L,x){function A(){this.constructor=L}P(L,x),L.prototype=x===null?Object.create(x):(A.prototype=x.prototype,new A)}),D=this&&this.__decorate||function(L,x,A,O){var U,B=arguments.length,$=B<3?x:O===null?O=Object.getOwnPropertyDescriptor(x,A):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(L,x,A,O);else for(var M=L.length-1;M>=0;M--)(U=L[M])&&($=(B<3?U($):B>3?U(x,A,$):U(x,A))||$);return B>3&&$&&Object.defineProperty(x,A,$),$},w=this&&this.__param||function(L,x){return function(A,O){x(A,O,L)}};Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionService=void 0;var _=I(11),F=I(52),v=I(4),s=I(0),y=I(5),f=I(1),c=I(30),l=I(53),h=I(2),d="\xA0",E=new RegExp(d,"g"),T=function(L){function x(A,O,U,B,$,M,Y){var q=L.call(this)||this;return q._element=A,q._screenElement=O,q._bufferService=U,q._coreService=B,q._mouseService=$,q._optionsService=M,q._renderService=Y,q._dragScrollAmount=0,q._enabled=!0,q._workCell=new v.CellData,q._mouseDownTimeStamp=0,q._onLinuxMouseSelection=q.register(new s.EventEmitter),q._onRedrawRequest=q.register(new s.EventEmitter),q._onSelectionChange=q.register(new s.EventEmitter),q._onRequestScrollLines=q.register(new s.EventEmitter),q._mouseMoveListener=function(se){return q._onMouseMove(se)},q._mouseUpListener=function(se){return q._onMouseUp(se)},q._coreService.onUserInput(function(){q.hasSelection&&q.clearSelection()}),q._trimListener=q._bufferService.buffer.lines.onTrim(function(se){return q._onTrim(se)}),q.register(q._bufferService.buffers.onBufferActivate(function(se){return q._onBufferActivate(se)})),q.enable(),q._model=new F.SelectionModel(q._bufferService),q._activeSelectionMode=0,q}return G(x,L),Object.defineProperty(x.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),x.prototype.dispose=function(){this._removeMouseDownListeners()},x.prototype.reset=function(){this.clearSelection()},x.prototype.disable=function(){this.clearSelection(),this._enabled=!1},x.prototype.enable=function(){this._enabled=!0},Object.defineProperty(x.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasSelection",{get:function(){var A=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!A||!O)&&(A[0]!==O[0]||A[1]!==O[1])},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"selectionText",{get:function(){var A=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;if(!A||!O)return"";var U=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(A[0]===O[0])return"";for(var $=A[1];$<=O[1];$++){var M=U.translateBufferLineToString($,!0,A[0],O[0]);B.push(M)}}else{var Y=A[1]===O[1]?O[0]:void 0;for(B.push(U.translateBufferLineToString(A[1],!0,A[0],Y)),$=A[1]+1;$<=O[1]-1;$++){var q=U.lines.get($);M=U.translateBufferLineToString($,!0),q&&q.isWrapped?B[B.length-1]+=M:B.push(M)}A[1]!==O[1]&&(q=U.lines.get(O[1]),M=U.translateBufferLineToString(O[1],!0,0,O[0]),q&&q.isWrapped?B[B.length-1]+=M:B.push(M))}return B.map(function(se){return se.replace(E," ")}).join(_.isWindows?`\r
|
|
|
`:`
|
|
|
`)},enumerable:!1,configurable:!0}),x.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},x.prototype.refresh=function(A){var O=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return O._refresh()})),_.isLinux&&A&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},x.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})},x.prototype.isClickInSelection=function(A){var O=this._getMouseBufferCoords(A),U=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(U&&B&&O)&&this._areCoordsInSelection(O,U,B)},x.prototype._areCoordsInSelection=function(A,O,U){return A[1]>O[1]&&A[1]<U[1]||O[1]===U[1]&&A[1]===O[1]&&A[0]>=O[0]&&A[0]<U[0]||O[1]<U[1]&&A[1]===U[1]&&A[0]<U[0]||O[1]<U[1]&&A[1]===O[1]&&A[0]>=O[0]},x.prototype.selectWordAtCursor=function(A){var O=this._getMouseBufferCoords(A);O&&(this._selectWordAt(O,!1),this._model.selectionEnd=void 0,this.refresh(!0))},x.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},x.prototype.selectLines=function(A,O){this._model.clearSelection(),A=Math.max(A,0),O=Math.min(O,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,O],this.refresh(),this._onSelectionChange.fire()},x.prototype._onTrim=function(A){this._model.onTrim(A)&&this.refresh()},x.prototype._getMouseBufferCoords=function(A){var O=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(O)return O[0]--,O[1]--,O[1]+=this._bufferService.buffer.ydisp,O},x.prototype._getMouseEventScrollAmount=function(A){var O=c.getCoordsRelativeToElement(A,this._screenElement)[1],U=this._renderService.dimensions.canvasHeight;return O>=0&&O<=U?0:(O>U&&(O-=U),O=Math.min(Math.max(O,-50),50),(O/=50)/Math.abs(O)+Math.round(14*O))},x.prototype.shouldForceSelection=function(A){return _.isMac?A.altKey&&this._optionsService.options.macOptionClickForcesSelection:A.shiftKey},x.prototype.onMouseDown=function(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._onIncrementalClick(A):A.detail===1?this._onSingleClick(A):A.detail===2?this._onDoubleClick(A):A.detail===3&&this._onTripleClick(A),this._addMouseDownListeners(),this.refresh(!0)}},x.prototype._addMouseDownListeners=function(){var A=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval(function(){return A._dragScroll()},50)},x.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},x.prototype._onIncrementalClick=function(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))},x.prototype._onSingleClick=function(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),this._model.selectionStart){this._model.selectionEnd=void 0;var O=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);O&&O.length!==this._model.selectionStart[0]&&O.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}},x.prototype._onDoubleClick=function(A){var O=this._getMouseBufferCoords(A);O&&(this._activeSelectionMode=1,this._selectWordAt(O,!0))},x.prototype._onTripleClick=function(A){var O=this._getMouseBufferCoords(A);O&&(this._activeSelectionMode=2,this._selectLineAt(O[1]))},x.prototype.shouldColumnSelect=function(A){return A.altKey&&!(_.isMac&&this._optionsService.options.macOptionClickForcesSelection)},x.prototype._onMouseMove=function(A){if(A.stopImmediatePropagation(),this._model.selectionStart){var O=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),this._model.selectionEnd){this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var U=this._bufferService.buffer;if(this._model.selectionEnd[1]<U.lines.length){var B=U.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}O&&O[0]===this._model.selectionEnd[0]&&O[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},x.prototype._dragScroll=function(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});var A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}},x.prototype._onMouseUp=function(A){var O=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&O<500&&A.altKey){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var U=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(U&&U[0]!==void 0&&U[1]!==void 0){var B=l.moveToCellSequence(U[0]-1,U[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this.hasSelection&&this._onSelectionChange.fire()},x.prototype._onBufferActivate=function(A){var O=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim(function(U){return O._onTrim(U)})},x.prototype._convertViewportColToCharacterIndex=function(A,O){for(var U=O[0],B=0;O[0]>=B;B++){var $=A.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?U--:$>1&&O[0]!==B&&(U+=$-1)}return U},x.prototype.setSelection=function(A,O,U){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,O],this._model.selectionStartLength=U,this.refresh()},x.prototype._getWordAt=function(A,O,U,B){if(U===void 0&&(U=!0),B===void 0&&(B=!0),!(A[0]>=this._bufferService.cols)){var $=this._bufferService.buffer,M=$.lines.get(A[1]);if(M){var Y=$.translateBufferLineToString(A[1],!1),q=this._convertViewportColToCharacterIndex(M,A),se=q,ce=A[0]-q,J=0,z=0,Z=0,N=0;if(Y.charAt(q)===" "){for(;q>0&&Y.charAt(q-1)===" ";)q--;for(;se<Y.length&&Y.charAt(se+1)===" ";)se++}else{var W=A[0],K=A[0];M.getWidth(W)===0&&(J++,W--),M.getWidth(K)===2&&(z++,K++);var k=M.getString(K).length;for(k>1&&(N+=k-1,se+=k-1);W>0&&q>0&&!this._isCharWordSeparator(M.loadCell(W-1,this._workCell));){M.loadCell(W-1,this._workCell);var C=this._workCell.getChars().length;this._workCell.getWidth()===0?(J++,W--):C>1&&(Z+=C-1,q-=C-1),q--,W--}for(;K<M.length&&se+1<Y.length&&!this._isCharWordSeparator(M.loadCell(K+1,this._workCell));){M.loadCell(K+1,this._workCell);var V=this._workCell.getChars().length;this._workCell.getWidth()===2?(z++,K++):V>1&&(N+=V-1,se+=V-1),se++,K++}}se++;var ne=q+ce-J+Z,pe=Math.min(this._bufferService.cols,se-q+J+z-Z-N);if(O||Y.slice(q,se).trim()!==""){if(U&&ne===0&&M.getCodePoint(0)!==32){var Te=$.lines.get(A[1]-1);if(Te&&M.isWrapped&&Te.getCodePoint(this._bufferService.cols-1)!==32){var Ke=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(Ke){var ve=this._bufferService.cols-Ke.start;ne-=ve,pe+=ve}}}if(B&&ne+pe===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){var Ue=$.lines.get(A[1]+1);if(Ue&&Ue.isWrapped&&Ue.getCodePoint(0)!==32){var Be=this._getWordAt([0,A[1]+1],!1,!1,!0);Be&&(pe+=Be.length)}}return{start:ne,length:pe}}}}},x.prototype._selectWordAt=function(A,O){var U=this._getWordAt(A,O);if(U){for(;U.start<0;)U.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[U.start,A[1]],this._model.selectionStartLength=U.length}},x.prototype._selectToWordAt=function(A){var O=this._getWordAt(A,!0);if(O){for(var U=A[1];O.start<0;)O.start+=this._bufferService.cols,U--;if(!this._model.areSelectionValuesReversed())for(;O.start+O.length>this._bufferService.cols;)O.length-=this._bufferService.cols,U++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?O.start:O.start+O.length,U]}},x.prototype._isCharWordSeparator=function(A){return A.getWidth()!==0&&this._optionsService.options.wordSeparator.indexOf(A.getChars())>=0},x.prototype._selectLineAt=function(A){var O=this._bufferService.buffer.getWrappedRangeForLine(A);this._model.selectionStart=[0,O.first],this._model.selectionEnd=[this._bufferService.cols,O.last],this._model.selectionStartLength=0},x=D([w(2,f.IBufferService),w(3,f.ICoreService),w(4,y.IMouseService),w(5,f.IOptionsService),w(6,y.IRenderService)],x)}(h.Disposable);b.SelectionService=T},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.SelectionModel=void 0;var P=function(){function G(D){this._bufferService=D,this.isSelectAllActive=!1,this.selectionStartLength=0}return G.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(G.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var D=this.selectionStart[0]+this.selectionStartLength;return D>this._bufferService.cols?[D%this._bufferService.cols,this.selectionStart[1]+Math.floor(D/this._bufferService.cols)]:[D,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),G.prototype.areSelectionValuesReversed=function(){var D=this.selectionStart,w=this.selectionEnd;return!(!D||!w)&&(D[1]>w[1]||D[1]===w[1]&&D[0]>w[0])},G.prototype.onTrim=function(D){return this.selectionStart&&(this.selectionStart[1]-=D),this.selectionEnd&&(this.selectionEnd[1]-=D),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},G}();b.SelectionModel=P},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.moveToCellSequence=void 0;var P=I(12);function G(s,y,f,c){var l=s-D(f,s),h=y-D(f,y);return v(Math.abs(l-h)-function(d,E,T){for(var L=0,x=d-D(T,d),A=E-D(T,E),O=0;O<Math.abs(x-A);O++){var U=w(d,E)==="A"?-1:1,B=T.buffer.lines.get(x+U*O);B&&B.isWrapped&&L++}return L}(s,y,f),F(w(s,y),c))}function D(s,y){for(var f=0,c=s.buffer.lines.get(y),l=c&&c.isWrapped;l&&y>=0&&y<s.rows;)f++,l=(c=s.buffer.lines.get(--y))&&c.isWrapped;return f}function w(s,y){return s>y?"A":"B"}function _(s,y,f,c,l,h){for(var d=s,E=y,T="";d!==f||E!==c;)d+=l?1:-1,l&&d>h.cols-1?(T+=h.buffer.translateBufferLineToString(E,!1,s,d),d=0,s=0,E++):!l&&d<0&&(T+=h.buffer.translateBufferLineToString(E,!1,0,s+1),s=d=h.cols-1,E--);return T+h.buffer.translateBufferLineToString(E,!1,s,d)}function F(s,y){var f=y?"O":"[";return P.C0.ESC+f+s}function v(s,y){s=Math.floor(s);for(var f="",c=0;c<s;c++)f+=y;return f}b.moveToCellSequence=function(s,y,f,c){var l,h=f.buffer.x,d=f.buffer.y;if(!f.buffer.hasScrollback)return function(T,L,x,A,O,U){return G(L,A,O,U).length===0?"":v(_(T,L,T,L-D(O,L),!1,O).length,F("D",U))}(h,d,0,y,f,c)+G(d,y,f,c)+function(T,L,x,A,O,U){var B;B=G(L,A,O,U).length>0?A-D(O,A):L;var $=A,M=function(Y,q,se,ce,J,z){var Z;return Z=G(se,ce,J,z).length>0?ce-D(J,ce):q,Y<se&&Z<=ce||Y>=se&&Z<ce?"C":"D"}(T,L,x,A,O,U);return v(_(T,B,x,$,M==="C",O).length,F(M,U))}(h,d,s,y,f,c);if(d===y)return l=h>s?"D":"C",v(Math.abs(h-s),F(l,c));l=d>y?"D":"C";var E=Math.abs(d-y);return v(function(T,L){return L.cols-T}(d>y?s:h,f)+(E-1)*f.cols+1+((d>y?h:s)-1),F(l,c))}},function(me,b,I){"use strict";var P=this&&this.__decorate||function(_,F,v,s){var y,f=arguments.length,c=f<3?F:s===null?s=Object.getOwnPropertyDescriptor(F,v):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(_,F,v,s);else for(var l=_.length-1;l>=0;l--)(y=_[l])&&(c=(f<3?y(c):f>3?y(F,v,c):y(F,v))||c);return f>3&&c&&Object.defineProperty(F,v,c),c},G=this&&this.__param||function(_,F){return function(v,s){F(v,s,_)}};Object.defineProperty(b,"__esModule",{value:!0}),b.SoundService=void 0;var D=I(1),w=function(){function _(F){this._optionsService=F}return Object.defineProperty(_,"audioContext",{get:function(){if(!_._audioContext){var F=window.AudioContext||window.webkitAudioContext;if(!F)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;_._audioContext=new F}return _._audioContext},enumerable:!1,configurable:!0}),_.prototype.playBellSound=function(){var F=_.audioContext;if(F){var v=F.createBufferSource();F.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(s){v.buffer=s,v.connect(F.destination),v.start(0)})}},_.prototype._base64ToArrayBuffer=function(F){for(var v=window.atob(F),s=v.length,y=new Uint8Array(s),f=0;f<s;f++)y[f]=v.charCodeAt(f);return y.buffer},_.prototype._removeMimeType=function(F){return F.split(",")[1]},_=P([G(0,D.IOptionsService)],_)}();b.SoundService=w},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseZoneManager=void 0;var _=I(2),F=I(7),v=I(5),s=I(1),y=function(f){function c(l,h,d,E,T,L){var x=f.call(this)||this;return x._element=l,x._screenElement=h,x._bufferService=d,x._mouseService=E,x._selectionService=T,x._optionsService=L,x._zones=[],x._areZonesActive=!1,x._lastHoverCoords=[void 0,void 0],x._initialSelectionLength=0,x.register(F.addDisposableDomListener(x._element,"mousedown",function(A){return x._onMouseDown(A)})),x._mouseMoveListener=function(A){return x._onMouseMove(A)},x._mouseLeaveListener=function(A){return x._onMouseLeave(A)},x._clickListener=function(A){return x._onClick(A)},x}return G(c,f),c.prototype.dispose=function(){f.prototype.dispose.call(this),this._deactivate()},c.prototype.add=function(l){this._zones.push(l),this._zones.length===1&&this._activate()},c.prototype.clearAll=function(l,h){if(this._zones.length!==0){l&&h||(l=0,h=this._bufferService.rows-1);for(var d=0;d<this._zones.length;d++){var E=this._zones[d];(E.y1>l&&E.y1<=h+1||E.y2>l&&E.y2<=h+1||E.y1<l&&E.y2>h+1)&&(this._currentZone&&this._currentZone===E&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(d--,1))}this._zones.length===0&&this._deactivate()}},c.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},c.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},c.prototype._onMouseMove=function(l){this._lastHoverCoords[0]===l.pageX&&this._lastHoverCoords[1]===l.pageY||(this._onHover(l),this._lastHoverCoords=[l.pageX,l.pageY])},c.prototype._onHover=function(l){var h=this,d=this._findZoneEventAt(l);d!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),d&&(this._currentZone=d,d.hoverCallback&&d.hoverCallback(l),this._tooltipTimeout=window.setTimeout(function(){return h._onTooltip(l)},this._optionsService.options.linkTooltipHoverDuration)))},c.prototype._onTooltip=function(l){this._tooltipTimeout=void 0;var h=this._findZoneEventAt(l);h&&h.tooltipCallback&&h.tooltipCallback(l)},c.prototype._onMouseDown=function(l){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var h=this._findZoneEventAt(l);h!=null&&h.willLinkActivate(l)&&(l.preventDefault(),l.stopImmediatePropagation())}},c.prototype._onMouseLeave=function(l){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},c.prototype._onClick=function(l){var h=this._findZoneEventAt(l),d=this._getSelectionLength();h&&d===this._initialSelectionLength&&(h.clickCallback(l),l.preventDefault(),l.stopImmediatePropagation())},c.prototype._getSelectionLength=function(){var l=this._selectionService.selectionText;return l?l.length:0},c.prototype._findZoneEventAt=function(l){var h=this._mouseService.getCoords(l,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(h)for(var d=h[0],E=h[1],T=0;T<this._zones.length;T++){var L=this._zones[T];if(L.y1===L.y2){if(E===L.y1&&d>=L.x1&&d<L.x2)return L}else if(E===L.y1&&d>=L.x1||E===L.y2&&d<L.x2||E>L.y1&&E<L.y2)return L}},c=D([w(2,s.IBufferService),w(3,v.IMouseService),w(4,v.ISelectionService),w(5,s.IOptionsService)],c)}(_.Disposable);b.MouseZoneManager=y},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(c,l){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,d){h.__proto__=d}||function(h,d){for(var E in d)d.hasOwnProperty(E)&&(h[E]=d[E])})(c,l)},function(c,l){function h(){this.constructor=c}P(c,l),c.prototype=l===null?Object.create(l):(h.prototype=l.prototype,new h)});Object.defineProperty(b,"__esModule",{value:!0}),b.AccessibilityManager=void 0;var D=I(18),w=I(11),_=I(31),F=I(7),v=I(2),s=I(32),y=I(17),f=function(c){function l(h,d){var E=c.call(this)||this;E._terminal=h,E._renderService=d,E._liveRegionLineCount=0,E._charsToConsume=[],E._charsToAnnounce="",E._accessibilityTreeRoot=document.createElement("div"),E._accessibilityTreeRoot.classList.add("xterm-accessibility"),E._rowContainer=document.createElement("div"),E._rowContainer.classList.add("xterm-accessibility-tree"),E._rowContainer.setAttribute("role","list"),E._rowElements=[];for(var T=0;T<E._terminal.rows;T++)E._rowElements[T]=E._createAccessibilityTreeNode(),E._rowContainer.appendChild(E._rowElements[T]);if(E._topBoundaryFocusListener=function(L){return E._onBoundaryFocus(L,0)},E._bottomBoundaryFocusListener=function(L){return E._onBoundaryFocus(L,1)},E._rowElements[0].addEventListener("focus",E._topBoundaryFocusListener),E._rowElements[E._rowElements.length-1].addEventListener("focus",E._bottomBoundaryFocusListener),E._refreshRowsDimensions(),E._accessibilityTreeRoot.appendChild(E._rowContainer),E._renderRowsDebouncer=new _.RenderDebouncer(E._renderRows.bind(E)),E._refreshRows(),E._liveRegion=document.createElement("div"),E._liveRegion.classList.add("live-region"),E._liveRegion.setAttribute("aria-live","assertive"),E._accessibilityTreeRoot.appendChild(E._liveRegion),!E._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");return E._terminal.element.insertAdjacentElement("afterbegin",E._accessibilityTreeRoot),E.register(E._renderRowsDebouncer),E.register(E._terminal.onResize(function(L){return E._onResize(L.rows)})),E.register(E._terminal.onRender(function(L){return E._refreshRows(L.start,L.end)})),E.register(E._terminal.onScroll(function(){return E._refreshRows()})),E.register(E._terminal.onA11yChar(function(L){return E._onChar(L)})),E.register(E._terminal.onLineFeed(function(){return E._onChar(`
|
|
|
`)})),E.register(E._terminal.onA11yTab(function(L){return E._onTab(L)})),E.register(E._terminal.onKey(function(L){return E._onKey(L.key)})),E.register(E._terminal.onBlur(function(){return E._clearLiveRegion()})),E.register(E._renderService.onDimensionsChange(function(){return E._refreshRowsDimensions()})),E._screenDprMonitor=new s.ScreenDprMonitor,E.register(E._screenDprMonitor),E._screenDprMonitor.setListener(function(){return E._refreshRowsDimensions()}),E.register(F.addDisposableDomListener(window,"resize",function(){return E._refreshRowsDimensions()})),E}return G(l,c),l.prototype.dispose=function(){c.prototype.dispose.call(this),y.removeElementFromParent(this._accessibilityTreeRoot),this._rowElements.length=0},l.prototype._onBoundaryFocus=function(h,d){var E=h.target,T=this._rowElements[d===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")!==(d===0?"1":""+this._terminal.buffer.lines.length)&&h.relatedTarget===T){var L,x;if(d===0?(L=E,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(L=this._rowElements.shift(),x=E,this._rowContainer.removeChild(L)),L.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),d===0){var A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else A=this._createAccessibilityTreeNode(),this._rowElements.push(A),this._rowContainer.appendChild(A);this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(d===0?-1:1),this._rowElements[d===0?1:this._rowElements.length-2].focus(),h.preventDefault(),h.stopImmediatePropagation()}},l.prototype._onResize=function(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var d=this._rowContainer.children.length;d<this._terminal.rows;d++)this._rowElements[d]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[d]);for(;this._rowElements.length>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},l.prototype._createAccessibilityTreeNode=function(){var h=document.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h},l.prototype._onTab=function(h){for(var d=0;d<h;d++)this._onChar(" ")},l.prototype._onChar=function(h){var d=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==h&&(this._charsToAnnounce+=h):this._charsToAnnounce+=h,h===`
|
|
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=D.tooMuchOutput)),w.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(function(){d._accessibilityTreeRoot.appendChild(d._liveRegion)},0))},l.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,w.isMac&&y.removeElementFromParent(this._liveRegion)},l.prototype._onKey=function(h){this._clearLiveRegion(),this._charsToConsume.push(h)},l.prototype._refreshRows=function(h,d){this._renderRowsDebouncer.refresh(h,d,this._terminal.rows)},l.prototype._renderRows=function(h,d){for(var E=this._terminal.buffer,T=E.lines.length.toString(),L=h;L<=d;L++){var x=E.translateBufferLineToString(E.ydisp+L,!0),A=(E.ydisp+L+1).toString(),O=this._rowElements[L];O&&(x.length===0?O.innerHTML=" ":O.textContent=x,O.setAttribute("aria-posinset",A),O.setAttribute("aria-setsize",T))}this._announceCharacters()},l.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}},l.prototype._refreshRowDimensions=function(h){h.style.height=this._renderService.dimensions.actualCellHeight+"px"},l.prototype._announceCharacters=function(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},l}(v.Disposable);b.AccessibilityManager=f},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(E,T){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,x){L.__proto__=x}||function(L,x){for(var A in x)x.hasOwnProperty(A)&&(L[A]=x[A])})(E,T)},function(E,T){function L(){this.constructor=E}P(E,T),E.prototype=T===null?Object.create(T):(L.prototype=T.prototype,new L)}),D=this&&this.__decorate||function(E,T,L,x){var A,O=arguments.length,U=O<3?T:x===null?x=Object.getOwnPropertyDescriptor(T,L):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(E,T,L,x);else for(var B=E.length-1;B>=0;B--)(A=E[B])&&(U=(O<3?A(U):O>3?A(T,L,U):A(T,L))||U);return O>3&&U&&Object.defineProperty(T,L,U),U},w=this&&this.__param||function(E,T){return function(L,x){T(L,x,E)}};Object.defineProperty(b,"__esModule",{value:!0}),b.DomRenderer=void 0;var _=I(58),F=I(9),v=I(2),s=I(5),y=I(1),f=I(0),c=I(10),l=I(17),h=1,d=function(E){function T(L,x,A,O,U,B,$,M,Y){var q=E.call(this)||this;return q._colors=L,q._element=x,q._screenElement=A,q._viewportElement=O,q._linkifier=U,q._linkifier2=B,q._charSizeService=$,q._optionsService=M,q._bufferService=Y,q._terminalClass=h++,q._rowElements=[],q._rowContainer=document.createElement("div"),q._rowContainer.classList.add("xterm-rows"),q._rowContainer.style.lineHeight="normal",q._rowContainer.setAttribute("aria-hidden","true"),q._refreshRowElements(q._bufferService.cols,q._bufferService.rows),q._selectionContainer=document.createElement("div"),q._selectionContainer.classList.add("xterm-selection"),q._selectionContainer.setAttribute("aria-hidden","true"),q.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},q._updateDimensions(),q._injectCss(),q._rowFactory=new _.DomRendererRowFactory(document,q._optionsService,q._colors),q._element.classList.add("xterm-dom-renderer-owner-"+q._terminalClass),q._screenElement.appendChild(q._rowContainer),q._screenElement.appendChild(q._selectionContainer),q._linkifier.onShowLinkUnderline(function(se){return q._onLinkHover(se)}),q._linkifier.onHideLinkUnderline(function(se){return q._onLinkLeave(se)}),q._linkifier2.onShowLinkUnderline(function(se){return q._onLinkHover(se)}),q._linkifier2.onHideLinkUnderline(function(se){return q._onLinkLeave(se)}),q}return G(T,E),Object.defineProperty(T.prototype,"onRequestRedraw",{get:function(){return new f.EventEmitter().event},enumerable:!1,configurable:!0}),T.prototype.dispose=function(){this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),l.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),E.prototype.dispose.call(this)},T.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var L=0,x=this._rowElements;L<x.length;L++){var A=x[L];A.style.width=this.dimensions.canvasWidth+"px",A.style.height=this.dimensions.actualCellHeight+"px",A.style.lineHeight=this.dimensions.actualCellHeight+"px",A.style.overflow="hidden"}this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));var O=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.innerHTML=O,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},T.prototype.setColors=function(L){this._colors=L,this._injectCss()},T.prototype._injectCss=function(){var L=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var x=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";x+=this._terminalSelector+" span:not(."+_.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+_.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+_.ITALIC_CLASS+" { font-style: italic;}",x+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",x+="@keyframes blink_block_"+this._terminalClass+" { 0% { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+"; } 50% { background-color: "+this._colors.cursorAccent.css+"; color: "+this._colors.cursor.css+"; }}",x+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_BLINK_CLASS+":not(."+_.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_BLINK_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",x+=this._terminalSelector+" .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" .xterm-selection div { position: absolute; background-color: "+this._colors.selectionTransparent.css+";}",this._colors.ansi.forEach(function(A,O){x+=L._terminalSelector+" .xterm-fg-"+O+" { color: "+A.css+"; }"+L._terminalSelector+" .xterm-bg-"+O+" { background-color: "+A.css+"; }"}),x+=this._terminalSelector+" .xterm-fg-"+F.INVERTED_DEFAULT_COLOR+" { color: "+c.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" .xterm-bg-"+F.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.innerHTML=x},T.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},T.prototype._refreshRowElements=function(L,x){for(var A=this._rowElements.length;A<=x;A++){var O=document.createElement("div");this._rowContainer.appendChild(O),this._rowElements.push(O)}for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop())},T.prototype.onResize=function(L,x){this._refreshRowElements(L,x),this._updateDimensions()},T.prototype.onCharSizeChanged=function(){this._updateDimensions()},T.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},T.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},T.prototype.onSelectionChanged=function(L,x,A){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(L&&x){var O=L[1]-this._bufferService.buffer.ydisp,U=x[1]-this._bufferService.buffer.ydisp,B=Math.max(O,0),$=Math.min(U,this._bufferService.rows-1);if(!(B>=this._bufferService.rows||$<0)){var M=document.createDocumentFragment();if(A)M.appendChild(this._createSelectionElement(B,L[0],x[0],$-B+1));else{var Y=O===B?L[0]:0,q=B===$?x[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(B,Y,q));var se=$-B-1;if(M.appendChild(this._createSelectionElement(B+1,0,this._bufferService.cols,se)),B!==$){var ce=U===$?x[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement($,0,ce))}}this._selectionContainer.appendChild(M)}}},T.prototype._createSelectionElement=function(L,x,A,O){O===void 0&&(O=1);var U=document.createElement("div");return U.style.height=O*this.dimensions.actualCellHeight+"px",U.style.top=L*this.dimensions.actualCellHeight+"px",U.style.left=x*this.dimensions.actualCellWidth+"px",U.style.width=this.dimensions.actualCellWidth*(A-x)+"px",U},T.prototype.onCursorMove=function(){},T.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},T.prototype.clear=function(){for(var L=0,x=this._rowElements;L<x.length;L++)x[L].innerHTML=""},T.prototype.renderRows=function(L,x){for(var A=this._bufferService.buffer.ybase+this._bufferService.buffer.y,O=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),U=this._optionsService.options.cursorBlink,B=L;B<=x;B++){var $=this._rowElements[B];$.innerHTML="";var M=B+this._bufferService.buffer.ydisp,Y=this._bufferService.buffer.lines.get(M),q=this._optionsService.options.cursorStyle;$.appendChild(this._rowFactory.createRow(Y,M===A,q,O,U,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(T.prototype,"_terminalSelector",{get:function(){return".xterm-dom-renderer-owner-"+this._terminalClass},enumerable:!1,configurable:!0}),T.prototype.registerCharacterJoiner=function(L){return-1},T.prototype.deregisterCharacterJoiner=function(L){return!1},T.prototype._onLinkHover=function(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!0)},T.prototype._onLinkLeave=function(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!1)},T.prototype._setCellUnderline=function(L,x,A,O,U,B){for(;L!==x||A!==O;){var $=this._rowElements[A];if(!$)return;var M=$.children[L];M&&(M.style.textDecoration=B?"underline":"none"),++L>=U&&(L=0,A++)}},T=D([w(6,s.ICharSizeService),w(7,y.IOptionsService),w(8,y.IBufferService)],T)}(v.Disposable);b.DomRenderer=d},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DomRendererRowFactory=b.CURSOR_STYLE_UNDERLINE_CLASS=b.CURSOR_STYLE_BAR_CLASS=b.CURSOR_STYLE_BLOCK_CLASS=b.CURSOR_BLINK_CLASS=b.CURSOR_CLASS=b.UNDERLINE_CLASS=b.ITALIC_CLASS=b.DIM_CLASS=b.BOLD_CLASS=void 0;var P=I(9),G=I(3),D=I(4),w=I(10);b.BOLD_CLASS="xterm-bold",b.DIM_CLASS="xterm-dim",b.ITALIC_CLASS="xterm-italic",b.UNDERLINE_CLASS="xterm-underline",b.CURSOR_CLASS="xterm-cursor",b.CURSOR_BLINK_CLASS="xterm-cursor-blink",b.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",b.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",b.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var _=function(){function v(s,y,f){this._document=s,this._optionsService=y,this._colors=f,this._workCell=new D.CellData}return v.prototype.setColors=function(s){this._colors=s},v.prototype.createRow=function(s,y,f,c,l,h,d){for(var E=this._document.createDocumentFragment(),T=0,L=Math.min(s.length,d)-1;L>=0;L--)if(s.loadCell(L,this._workCell).getCode()!==G.NULL_CELL_CODE||y&&L===c){T=L+1;break}for(L=0;L<T;L++){s.loadCell(L,this._workCell);var x=this._workCell.getWidth();if(x!==0){var A=this._document.createElement("span");if(x>1&&(A.style.width=h*x+"px"),y&&L===c)switch(A.classList.add(b.CURSOR_CLASS),l&&A.classList.add(b.CURSOR_BLINK_CLASS),f){case"bar":A.classList.add(b.CURSOR_STYLE_BAR_CLASS);break;case"underline":A.classList.add(b.CURSOR_STYLE_UNDERLINE_CLASS);break;default:A.classList.add(b.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&A.classList.add(b.BOLD_CLASS),this._workCell.isItalic()&&A.classList.add(b.ITALIC_CLASS),this._workCell.isDim()&&A.classList.add(b.DIM_CLASS),this._workCell.isUnderline()&&A.classList.add(b.UNDERLINE_CLASS),this._workCell.isInvisible()?A.textContent=G.WHITESPACE_CELL_CHAR:A.textContent=this._workCell.getChars()||G.WHITESPACE_CELL_CHAR;var O=this._workCell.getFgColor(),U=this._workCell.getFgColorMode(),B=this._workCell.getBgColor(),$=this._workCell.getBgColorMode(),M=!!this._workCell.isInverse();if(M){var Y=O;O=B,B=Y;var q=U;U=$,$=q}switch(U){case 16777216:case 33554432:this._workCell.isBold()&&O<8&&this._optionsService.options.drawBoldTextInBrightColors&&(O+=8),this._applyMinimumContrast(A,this._colors.background,this._colors.ansi[O])||A.classList.add("xterm-fg-"+O);break;case 50331648:var se=w.rgba.toColor(O>>16&255,O>>8&255,255&O);this._applyMinimumContrast(A,this._colors.background,se)||this._addStyle(A,"color:#"+F(O.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(A,this._colors.background,this._colors.foreground)||M&&A.classList.add("xterm-fg-"+P.INVERTED_DEFAULT_COLOR)}switch($){case 16777216:case 33554432:A.classList.add("xterm-bg-"+B);break;case 50331648:this._addStyle(A,"background-color:#"+F(B.toString(16),"0",6));break;case 0:default:M&&A.classList.add("xterm-bg-"+P.INVERTED_DEFAULT_COLOR)}E.appendChild(A)}}return E},v.prototype._applyMinimumContrast=function(s,y,f){if(this._optionsService.options.minimumContrastRatio===1)return!1;var c=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return c===void 0&&(c=w.color.ensureContrastRatio(y,f,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,c!=null?c:null)),!!c&&(this._addStyle(s,"color:"+c.css),!0)},v.prototype._addStyle=function(s,y){s.setAttribute("style",""+(s.getAttribute("style")||"")+y+";")},v}();function F(v,s,y){for(;v.length<y;)v=s+v;return v}b.DomRendererRowFactory=_},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.evaluateKeyboardEvent=void 0;var P=I(12),G={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};b.evaluateKeyboardEvent=function(D,w,_,F){var v={type:0,cancel:!1,key:void 0},s=(D.shiftKey?1:0)|(D.altKey?2:0)|(D.ctrlKey?4:0)|(D.metaKey?8:0);switch(D.keyCode){case 0:D.key==="UIKeyInputUpArrow"?v.key=w?P.C0.ESC+"OA":P.C0.ESC+"[A":D.key==="UIKeyInputLeftArrow"?v.key=w?P.C0.ESC+"OD":P.C0.ESC+"[D":D.key==="UIKeyInputRightArrow"?v.key=w?P.C0.ESC+"OC":P.C0.ESC+"[C":D.key==="UIKeyInputDownArrow"&&(v.key=w?P.C0.ESC+"OB":P.C0.ESC+"[B");break;case 8:if(D.shiftKey){v.key=P.C0.BS;break}if(D.altKey){v.key=P.C0.ESC+P.C0.DEL;break}v.key=P.C0.DEL;break;case 9:if(D.shiftKey){v.key=P.C0.ESC+"[Z";break}v.key=P.C0.HT,v.cancel=!0;break;case 13:v.key=D.altKey?P.C0.ESC+P.C0.CR:P.C0.CR,v.cancel=!0;break;case 27:v.key=P.C0.ESC,D.altKey&&(v.key=P.C0.ESC+P.C0.ESC),v.cancel=!0;break;case 37:if(D.metaKey)break;s?(v.key=P.C0.ESC+"[1;"+(s+1)+"D",v.key===P.C0.ESC+"[1;3D"&&(v.key=P.C0.ESC+(_?"b":"[1;5D"))):v.key=w?P.C0.ESC+"OD":P.C0.ESC+"[D";break;case 39:if(D.metaKey)break;s?(v.key=P.C0.ESC+"[1;"+(s+1)+"C",v.key===P.C0.ESC+"[1;3C"&&(v.key=P.C0.ESC+(_?"f":"[1;5C"))):v.key=w?P.C0.ESC+"OC":P.C0.ESC+"[C";break;case 38:if(D.metaKey)break;s?(v.key=P.C0.ESC+"[1;"+(s+1)+"A",_||v.key!==P.C0.ESC+"[1;3A"||(v.key=P.C0.ESC+"[1;5A")):v.key=w?P.C0.ESC+"OA":P.C0.ESC+"[A";break;case 40:if(D.metaKey)break;s?(v.key=P.C0.ESC+"[1;"+(s+1)+"B",_||v.key!==P.C0.ESC+"[1;3B"||(v.key=P.C0.ESC+"[1;5B")):v.key=w?P.C0.ESC+"OB":P.C0.ESC+"[B";break;case 45:D.shiftKey||D.ctrlKey||(v.key=P.C0.ESC+"[2~");break;case 46:v.key=s?P.C0.ESC+"[3;"+(s+1)+"~":P.C0.ESC+"[3~";break;case 36:v.key=s?P.C0.ESC+"[1;"+(s+1)+"H":w?P.C0.ESC+"OH":P.C0.ESC+"[H";break;case 35:v.key=s?P.C0.ESC+"[1;"+(s+1)+"F":w?P.C0.ESC+"OF":P.C0.ESC+"[F";break;case 33:D.shiftKey?v.type=2:v.key=P.C0.ESC+"[5~";break;case 34:D.shiftKey?v.type=3:v.key=P.C0.ESC+"[6~";break;case 112:v.key=s?P.C0.ESC+"[1;"+(s+1)+"P":P.C0.ESC+"OP";break;case 113:v.key=s?P.C0.ESC+"[1;"+(s+1)+"Q":P.C0.ESC+"OQ";break;case 114:v.key=s?P.C0.ESC+"[1;"+(s+1)+"R":P.C0.ESC+"OR";break;case 115:v.key=s?P.C0.ESC+"[1;"+(s+1)+"S":P.C0.ESC+"OS";break;case 116:v.key=s?P.C0.ESC+"[15;"+(s+1)+"~":P.C0.ESC+"[15~";break;case 117:v.key=s?P.C0.ESC+"[17;"+(s+1)+"~":P.C0.ESC+"[17~";break;case 118:v.key=s?P.C0.ESC+"[18;"+(s+1)+"~":P.C0.ESC+"[18~";break;case 119:v.key=s?P.C0.ESC+"[19;"+(s+1)+"~":P.C0.ESC+"[19~";break;case 120:v.key=s?P.C0.ESC+"[20;"+(s+1)+"~":P.C0.ESC+"[20~";break;case 121:v.key=s?P.C0.ESC+"[21;"+(s+1)+"~":P.C0.ESC+"[21~";break;case 122:v.key=s?P.C0.ESC+"[23;"+(s+1)+"~":P.C0.ESC+"[23~";break;case 123:v.key=s?P.C0.ESC+"[24;"+(s+1)+"~":P.C0.ESC+"[24~";break;default:if(!D.ctrlKey||D.shiftKey||D.altKey||D.metaKey)if(_&&!F||!D.altKey||D.metaKey)_&&!D.altKey&&!D.ctrlKey&&D.metaKey?D.keyCode===65&&(v.type=1):D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.keyCode>=48&&D.key.length===1?v.key=D.key:D.key&&D.ctrlKey&&D.key==="_"&&(v.key=P.C0.US);else{var y=G[D.keyCode],f=y&&y[D.shiftKey?1:0];if(f)v.key=P.C0.ESC+f;else if(D.keyCode>=65&&D.keyCode<=90){var c=D.ctrlKey?D.keyCode-64:D.keyCode+32;v.key=P.C0.ESC+String.fromCharCode(c)}}else D.keyCode>=65&&D.keyCode<=90?v.key=String.fromCharCode(D.keyCode-64):D.keyCode===32?v.key=P.C0.NUL:D.keyCode>=51&&D.keyCode<=55?v.key=String.fromCharCode(D.keyCode-51+27):D.keyCode===56?v.key=P.C0.DEL:D.keyCode===219?v.key=P.C0.ESC:D.keyCode===220?v.key=P.C0.FS:D.keyCode===221&&(v.key=P.C0.GS)}return v}},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(h,d){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,T){E.__proto__=T}||function(E,T){for(var L in T)T.hasOwnProperty(L)&&(E[L]=T[L])})(h,d)},function(h,d){function E(){this.constructor=h}P(h,d),h.prototype=d===null?Object.create(d):(E.prototype=d.prototype,new E)}),D=this&&this.__decorate||function(h,d,E,T){var L,x=arguments.length,A=x<3?d:T===null?T=Object.getOwnPropertyDescriptor(d,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(h,d,E,T);else for(var O=h.length-1;O>=0;O--)(L=h[O])&&(A=(x<3?L(A):x>3?L(d,E,A):L(d,E))||A);return x>3&&A&&Object.defineProperty(d,E,A),A},w=this&&this.__param||function(h,d){return function(E,T){d(E,T,h)}};Object.defineProperty(b,"__esModule",{value:!0}),b.RenderService=void 0;var _=I(31),F=I(0),v=I(2),s=I(32),y=I(7),f=I(1),c=I(5),l=function(h){function d(E,T,L,x,A,O){var U=h.call(this)||this;if(U._renderer=E,U._rowCount=T,U._isPaused=!1,U._needsFullRefresh=!1,U._isNextRenderRedrawOnly=!0,U._needsSelectionRefresh=!1,U._canvasWidth=0,U._canvasHeight=0,U._selectionState={start:void 0,end:void 0,columnSelectMode:!1},U._onDimensionsChange=new F.EventEmitter,U._onRender=new F.EventEmitter,U._onRefreshRequest=new F.EventEmitter,U.register({dispose:function(){return U._renderer.dispose()}}),U._renderDebouncer=new _.RenderDebouncer(function($,M){return U._renderRows($,M)}),U.register(U._renderDebouncer),U._screenDprMonitor=new s.ScreenDprMonitor,U._screenDprMonitor.setListener(function(){return U.onDevicePixelRatioChange()}),U.register(U._screenDprMonitor),U.register(O.onResize(function($){return U._fullRefresh()})),U.register(x.onOptionChange(function(){return U._renderer.onOptionsChanged()})),U.register(A.onCharSizeChange(function(){return U.onCharSizeChanged()})),U._renderer.onRequestRedraw(function($){return U.refreshRows($.start,$.end,!0)}),U.register(y.addDisposableDomListener(window,"resize",function(){return U.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var B=new IntersectionObserver(function($){return U._onIntersectionChange($[$.length-1])},{threshold:0});B.observe(L),U.register({dispose:function(){return B.disconnect()}})}return U}return G(d,h),Object.defineProperty(d.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),d.prototype._onIntersectionChange=function(E){this._isPaused=E.intersectionRatio===0,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},d.prototype.refreshRows=function(E,T,L){L===void 0&&(L=!1),this._isPaused?this._needsFullRefresh=!0:(L||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(E,T,this._rowCount))},d.prototype._renderRows=function(E,T){this._renderer.renderRows(E,T),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:E,end:T}),this._isNextRenderRedrawOnly=!0},d.prototype.resize=function(E,T){this._rowCount=T,this._fireOnCanvasResize()},d.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},d.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},d.prototype.dispose=function(){h.prototype.dispose.call(this)},d.prototype.setRenderer=function(E){var T=this;this._renderer.dispose(),this._renderer=E,this._renderer.onRequestRedraw(function(L){return T.refreshRows(L.start,L.end,!0)}),this._needsSelectionRefresh=!0,this._fullRefresh()},d.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},d.prototype.setColors=function(E){this._renderer.setColors(E),this._fullRefresh()},d.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},d.prototype.onResize=function(E,T){this._renderer.onResize(E,T),this._fullRefresh()},d.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},d.prototype.onBlur=function(){this._renderer.onBlur()},d.prototype.onFocus=function(){this._renderer.onFocus()},d.prototype.onSelectionChanged=function(E,T,L){this._selectionState.start=E,this._selectionState.end=T,this._selectionState.columnSelectMode=L,this._renderer.onSelectionChanged(E,T,L)},d.prototype.onCursorMove=function(){this._renderer.onCursorMove()},d.prototype.clear=function(){this._renderer.clear()},d.prototype.registerCharacterJoiner=function(E){return this._renderer.registerCharacterJoiner(E)},d.prototype.deregisterCharacterJoiner=function(E){return this._renderer.deregisterCharacterJoiner(E)},d=D([w(3,f.IOptionsService),w(4,c.ICharSizeService),w(5,f.IBufferService)],d)}(v.Disposable);b.RenderService=l},function(me,b,I){"use strict";var P=this&&this.__decorate||function(v,s,y,f){var c,l=arguments.length,h=l<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,y):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(v,s,y,f);else for(var d=v.length-1;d>=0;d--)(c=v[d])&&(h=(l<3?c(h):l>3?c(s,y,h):c(s,y))||h);return l>3&&h&&Object.defineProperty(s,y,h),h},G=this&&this.__param||function(v,s){return function(y,f){s(y,f,v)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CharSizeService=void 0;var D=I(1),w=I(0),_=function(){function v(s,y,f){this._optionsService=f,this.width=0,this.height=0,this._onCharSizeChange=new w.EventEmitter,this._measureStrategy=new F(s,y,this._optionsService)}return Object.defineProperty(v.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),v.prototype.measure=function(){var s=this._measureStrategy.measure();s.width===this.width&&s.height===this.height||(this.width=s.width,this.height=s.height,this._onCharSizeChange.fire())},v=P([G(2,D.IOptionsService)],v)}();b.CharSizeService=_;var F=function(){function v(s,y,f){this._document=s,this._parentElement=y,this._optionsService=f,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return v.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var s=this._measureElement.getBoundingClientRect();return s.width!==0&&s.height!==0&&(this._result.width=s.width,this._result.height=Math.ceil(s.height)),this._result},v}()},function(me,b,I){"use strict";var P=this&&this.__decorate||function(F,v,s,y){var f,c=arguments.length,l=c<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,s):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(F,v,s,y);else for(var h=F.length-1;h>=0;h--)(f=F[h])&&(l=(c<3?f(l):c>3?f(v,s,l):f(v,s))||l);return c>3&&l&&Object.defineProperty(v,s,l),l},G=this&&this.__param||function(F,v){return function(s,y){v(s,y,F)}};Object.defineProperty(b,"__esModule",{value:!0}),b.MouseService=void 0;var D=I(5),w=I(30),_=function(){function F(v,s){this._renderService=v,this._charSizeService=s}return F.prototype.getCoords=function(v,s,y,f,c){return w.getCoords(v,s,y,f,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,c)},F.prototype.getRawByteCoords=function(v,s,y,f){var c=this.getCoords(v,s,y,f);return w.getRawByteCoords(c)},F=P([G(0,D.IRenderService),G(1,D.ICharSizeService)],F)}();b.MouseService=_},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.Linkifier2=void 0;var _=I(1),F=I(0),v=I(2),s=I(7),y=function(f){function c(l){var h=f.call(this)||this;return h._bufferService=l,h._linkProviders=[],h._linkCacheDisposables=[],h._isMouseOut=!0,h._activeLine=-1,h._onShowLinkUnderline=h.register(new F.EventEmitter),h._onHideLinkUnderline=h.register(new F.EventEmitter),h.register(v.getDisposeArrayDisposable(h._linkCacheDisposables)),h}return G(c,f),Object.defineProperty(c.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),c.prototype.registerLinkProvider=function(l){var h=this;return this._linkProviders.push(l),{dispose:function(){var d=h._linkProviders.indexOf(l);d!==-1&&h._linkProviders.splice(d,1)}}},c.prototype.attachToDom=function(l,h,d){var E=this;this._element=l,this._mouseService=h,this._renderService=d,this.register(s.addDisposableDomListener(this._element,"mouseleave",function(){E._isMouseOut=!0,E._clearCurrentLink()})),this.register(s.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(s.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},c.prototype._onMouseMove=function(l){if(this._lastMouseEvent=l,this._element&&this._mouseService){var h=this._positionFromMouseEvent(l,this._element,this._mouseService);if(h){this._isMouseOut=!1;for(var d=l.composedPath(),E=0;E<d.length;E++){var T=d[E];if(T.classList.contains("xterm"))break;if(T.classList.contains("xterm-hover"))return}this._lastBufferCell&&h.x===this._lastBufferCell.x&&h.y===this._lastBufferCell.y||(this._onHover(h),this._lastBufferCell=h)}}},c.prototype._onHover=function(l){if(this._activeLine!==l.y)return this._clearCurrentLink(),void this._askForLink(l,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,l)||(this._clearCurrentLink(),this._askForLink(l,!0))},c.prototype._askForLink=function(l,h){var d=this;this._activeProviderReplies&&h||(this._activeProviderReplies=new Map,this._activeLine=l.y);var E=!1;this._linkProviders.forEach(function(T,L){var x;h?!((x=d._activeProviderReplies)===null||x===void 0)&&x.get(L)&&(E=d._checkLinkProviderResult(L,l,E)):T.provideLinks(l.y,function(A){var O,U;if(!d._isMouseOut){var B=A==null?void 0:A.map(function($){return{link:$}});(O=d._activeProviderReplies)===null||O===void 0||O.set(L,B),E=d._checkLinkProviderResult(L,l,E),((U=d._activeProviderReplies)===null||U===void 0?void 0:U.size)===d._linkProviders.length&&d._removeIntersectingLinks(l.y,d._activeProviderReplies)}})})},c.prototype._removeIntersectingLinks=function(l,h){for(var d=new Set,E=0;E<h.size;E++){var T=h.get(E);if(T)for(var L=0;L<T.length;L++)for(var x=T[L],A=x.link.range.start.y<l?0:x.link.range.start.x,O=x.link.range.end.y>l?this._bufferService.cols:x.link.range.end.x,U=A;U<=O;U++){if(d.has(U)){T.splice(L--,1);break}d.add(U)}}},c.prototype._checkLinkProviderResult=function(l,h,d){var E,T=this;if(!this._activeProviderReplies)return d;for(var L=this._activeProviderReplies.get(l),x=!1,A=0;A<l;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(x=!0);if(!x&&L){var O=L.find(function(B){return T._linkAtPosition(B.link,h)});O&&(d=!0,this._handleNewLink(O))}if(this._activeProviderReplies.size===this._linkProviders.length&&!d)for(A=0;A<this._activeProviderReplies.size;A++){var U=(E=this._activeProviderReplies.get(A))===null||E===void 0?void 0:E.find(function(B){return T._linkAtPosition(B.link,h)});if(U){d=!0,this._handleNewLink(U);break}}return d},c.prototype._onClick=function(l){if(this._element&&this._mouseService&&this._currentLink){var h=this._positionFromMouseEvent(l,this._element,this._mouseService);h&&this._linkAtPosition(this._currentLink.link,h)&&this._currentLink.link.activate(l,this._currentLink.link.text)}},c.prototype._clearCurrentLink=function(l,h){this._element&&this._currentLink&&this._lastMouseEvent&&(!l||!h||this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=h)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,v.disposeArray(this._linkCacheDisposables))},c.prototype._handleNewLink=function(l){var h=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(l.link,d)&&(this._currentLink=l,this._currentLink.state={decorations:{underline:l.link.decorations===void 0||l.link.decorations.underline,pointerCursor:l.link.decorations===void 0||l.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,l.link,this._lastMouseEvent),l.link.decorations={},Object.defineProperties(l.link.decorations,{pointerCursor:{get:function(){var E,T;return(T=(E=h._currentLink)===null||E===void 0?void 0:E.state)===null||T===void 0?void 0:T.decorations.pointerCursor},set:function(E){var T,L;!((T=h._currentLink)===null||T===void 0)&&T.state&&h._currentLink.state.decorations.pointerCursor!==E&&(h._currentLink.state.decorations.pointerCursor=E,h._currentLink.state.isHovered&&((L=h._element)===null||L===void 0||L.classList.toggle("xterm-cursor-pointer",E)))}},underline:{get:function(){var E,T;return(T=(E=h._currentLink)===null||E===void 0?void 0:E.state)===null||T===void 0?void 0:T.decorations.underline},set:function(E){var T,L,x;!((T=h._currentLink)===null||T===void 0)&&T.state&&((x=(L=h._currentLink)===null||L===void 0?void 0:L.state)===null||x===void 0?void 0:x.decorations.underline)!==E&&(h._currentLink.state.decorations.underline=E,h._currentLink.state.isHovered&&h._fireUnderlineEvent(l.link,E))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(function(E){var T=E.start===0?0:E.start+1+h._bufferService.buffer.ydisp;h._clearCurrentLink(T,E.end+1+h._bufferService.buffer.ydisp)})))}},c.prototype._linkHover=function(l,h,d){var E;!((E=this._currentLink)===null||E===void 0)&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!0),this._currentLink.state.decorations.pointerCursor&&l.classList.add("xterm-cursor-pointer")),h.hover&&h.hover(d,h.text)},c.prototype._fireUnderlineEvent=function(l,h){var d=l.range,E=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(d.start.x-1,d.start.y-E-1,d.end.x,d.end.y-E-1,void 0);(h?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)},c.prototype._linkLeave=function(l,h,d){var E;!((E=this._currentLink)===null||E===void 0)&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!1),this._currentLink.state.decorations.pointerCursor&&l.classList.remove("xterm-cursor-pointer")),h.leave&&h.leave(d,h.text)},c.prototype._linkAtPosition=function(l,h){var d=l.range.start.y===l.range.end.y,E=l.range.start.y<h.y,T=l.range.end.y>h.y;return(d&&l.range.start.x<=h.x&&l.range.end.x>=h.x||E&&l.range.end.x>=h.x||T&&l.range.start.x<=h.x||E&&T)&&l.range.start.y<=h.y&&l.range.end.y>=h.y},c.prototype._positionFromMouseEvent=function(l,h,d){var E=d.getCoords(l,h,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}},c.prototype._createLinkUnderlineEvent=function(l,h,d,E,T){return{x1:l,y1:h,x2:d,y2:E,cols:this._bufferService.cols,fg:T}},c=D([w(0,_.IBufferService)],c)}(v.Disposable);b.Linkifier2=y},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CoreBrowserService=void 0;var P=function(){function G(D){this._textarea=D}return Object.defineProperty(G.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),G}();b.CoreBrowserService=P},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(A,O){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(U,B){U.__proto__=B}||function(U,B){for(var $ in B)B.hasOwnProperty($)&&(U[$]=B[$])})(A,O)},function(A,O){function U(){this.constructor=A}P(A,O),A.prototype=O===null?Object.create(O):(U.prototype=O.prototype,new U)});Object.defineProperty(b,"__esModule",{value:!0}),b.CoreTerminal=void 0;var D=I(2),w=I(1),_=I(66),F=I(67),v=I(68),s=I(74),y=I(75),f=I(0),c=I(76),l=I(77),h=I(78),d=I(80),E=I(81),T=I(19),L=I(82),x=function(A){function O(U){var B=A.call(this)||this;return B._onBinary=new f.EventEmitter,B._onData=new f.EventEmitter,B._onLineFeed=new f.EventEmitter,B._onResize=new f.EventEmitter,B._onScroll=new f.EventEmitter,B._instantiationService=new _.InstantiationService,B.optionsService=new s.OptionsService(U),B._instantiationService.setService(w.IOptionsService,B.optionsService),B._bufferService=B.register(B._instantiationService.createInstance(v.BufferService)),B._instantiationService.setService(w.IBufferService,B._bufferService),B._logService=B._instantiationService.createInstance(F.LogService),B._instantiationService.setService(w.ILogService,B._logService),B._coreService=B.register(B._instantiationService.createInstance(y.CoreService,function(){return B.scrollToBottom()})),B._instantiationService.setService(w.ICoreService,B._coreService),B._coreMouseService=B._instantiationService.createInstance(c.CoreMouseService),B._instantiationService.setService(w.ICoreMouseService,B._coreMouseService),B._dirtyRowService=B._instantiationService.createInstance(l.DirtyRowService),B._instantiationService.setService(w.IDirtyRowService,B._dirtyRowService),B.unicodeService=B._instantiationService.createInstance(h.UnicodeService),B._instantiationService.setService(w.IUnicodeService,B.unicodeService),B._charsetService=B._instantiationService.createInstance(d.CharsetService),B._instantiationService.setService(w.ICharsetService,B._charsetService),B._inputHandler=new T.InputHandler(B._bufferService,B._charsetService,B._coreService,B._dirtyRowService,B._logService,B.optionsService,B._coreMouseService,B.unicodeService),B.register(f.forwardEvent(B._inputHandler.onLineFeed,B._onLineFeed)),B.register(B._inputHandler),B.register(f.forwardEvent(B._bufferService.onResize,B._onResize)),B.register(f.forwardEvent(B._coreService.onData,B._onData)),B.register(f.forwardEvent(B._coreService.onBinary,B._onBinary)),B.register(B.optionsService.onOptionChange(function($){return B._updateOptions($)})),B._writeBuffer=new L.WriteBuffer(function($){return B._inputHandler.parse($)}),B}return G(O,A),Object.defineProperty(O.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),O.prototype.dispose=function(){var U;this._isDisposed||(A.prototype.dispose.call(this),(U=this._windowsMode)===null||U===void 0||U.dispose(),this._windowsMode=void 0)},O.prototype.write=function(U,B){this._writeBuffer.write(U,B)},O.prototype.writeSync=function(U){this._writeBuffer.writeSync(U)},O.prototype.resize=function(U,B){isNaN(U)||isNaN(B)||(U=Math.max(U,v.MINIMUM_COLS),B=Math.max(B,v.MINIMUM_ROWS),this._bufferService.resize(U,B))},O.prototype.scroll=function(U,B){B===void 0&&(B=!1);var $,M=this._bufferService.buffer;($=this._cachedBlankLine)&&$.length===this.cols&&$.getFg(0)===U.fg&&$.getBg(0)===U.bg||($=M.getBlankLine(U,B),this._cachedBlankLine=$),$.isWrapped=B;var Y=M.ybase+M.scrollTop,q=M.ybase+M.scrollBottom;if(M.scrollTop===0){var se=M.lines.isFull;q===M.lines.length-1?se?M.lines.recycle().copyFrom($):M.lines.push($.clone()):M.lines.splice(q+1,0,$.clone()),se?this._bufferService.isUserScrolling&&(M.ydisp=Math.max(M.ydisp-1,0)):(M.ybase++,this._bufferService.isUserScrolling||M.ydisp++)}else{var ce=q-Y+1;M.lines.shiftElements(Y+1,ce-1,-1),M.lines.set(q,$.clone())}this._bufferService.isUserScrolling||(M.ydisp=M.ybase),this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom),this._onScroll.fire(M.ydisp)},O.prototype.scrollLines=function(U,B){var $=this._bufferService.buffer;if(U<0){if($.ydisp===0)return;this._bufferService.isUserScrolling=!0}else U+$.ydisp>=$.ybase&&(this._bufferService.isUserScrolling=!1);var M=$.ydisp;$.ydisp=Math.max(Math.min($.ydisp+U,$.ybase),0),M!==$.ydisp&&(B||this._onScroll.fire($.ydisp))},O.prototype.scrollPages=function(U){this.scrollLines(U*(this.rows-1))},O.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},O.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},O.prototype.scrollToLine=function(U){var B=U-this._bufferService.buffer.ydisp;B!==0&&this.scrollLines(B)},O.prototype.addEscHandler=function(U,B){return this._inputHandler.addEscHandler(U,B)},O.prototype.addDcsHandler=function(U,B){return this._inputHandler.addDcsHandler(U,B)},O.prototype.addCsiHandler=function(U,B){return this._inputHandler.addCsiHandler(U,B)},O.prototype.addOscHandler=function(U,B){return this._inputHandler.addOscHandler(U,B)},O.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},O.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},O.prototype._updateOptions=function(U){var B;switch(U){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():((B=this._windowsMode)===null||B===void 0||B.dispose(),this._windowsMode=void 0)}},O.prototype._enableWindowsMode=function(){var U=this;if(!this._windowsMode){var B=[];B.push(this.onLineFeed(E.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.addCsiHandler({final:"H"},function(){return E.updateWindowsModeWrappedState(U._bufferService),!1})),this._windowsMode={dispose:function(){for(var $=0,M=B;$<M.length;$++)M[$].dispose()}}}},O}(D.Disposable);b.CoreTerminal=x},function(me,b,I){"use strict";var P=this&&this.__spreadArrays||function(){for(var F=0,v=0,s=arguments.length;v<s;v++)F+=arguments[v].length;var y=Array(F),f=0;for(v=0;v<s;v++)for(var c=arguments[v],l=0,h=c.length;l<h;l++,f++)y[f]=c[l];return y};Object.defineProperty(b,"__esModule",{value:!0}),b.InstantiationService=b.ServiceCollection=void 0;var G=I(1),D=I(14),w=function(){function F(){for(var v=[],s=0;s<arguments.length;s++)v[s]=arguments[s];this._entries=new Map;for(var y=0,f=v;y<f.length;y++){var c=f[y],l=c[0],h=c[1];this.set(l,h)}}return F.prototype.set=function(v,s){var y=this._entries.get(v);return this._entries.set(v,s),y},F.prototype.forEach=function(v){this._entries.forEach(function(s,y){return v(y,s)})},F.prototype.has=function(v){return this._entries.has(v)},F.prototype.get=function(v){return this._entries.get(v)},F}();b.ServiceCollection=w;var _=function(){function F(){this._services=new w,this._services.set(G.IInstantiationService,this)}return F.prototype.setService=function(v,s){this._services.set(v,s)},F.prototype.getService=function(v){return this._services.get(v)},F.prototype.createInstance=function(v){for(var s=[],y=1;y<arguments.length;y++)s[y-1]=arguments[y];for(var f=D.getServiceDependencies(v).sort(function(L,x){return L.index-x.index}),c=[],l=0,h=f;l<h.length;l++){var d=h[l],E=this._services.get(d.id);if(!E)throw new Error("[createInstance] "+v.name+" depends on UNKNOWN service "+d.id+".");c.push(E)}var T=f.length>0?f[0].index:s.length;if(s.length!==T)throw new Error("[createInstance] First service dependency of "+v.name+" at position "+(T+1)+" conflicts with "+s.length+" static arguments");return new(v.bind.apply(v,P([void 0],P(s,c))))},F}();b.InstantiationService=_},function(me,b,I){"use strict";var P=this&&this.__decorate||function(s,y,f,c){var l,h=arguments.length,d=h<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,f):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(s,y,f,c);else for(var E=s.length-1;E>=0;E--)(l=s[E])&&(d=(h<3?l(d):h>3?l(y,f,d):l(y,f))||d);return h>3&&d&&Object.defineProperty(y,f,d),d},G=this&&this.__param||function(s,y){return function(f,c){y(f,c,s)}},D=this&&this.__spreadArrays||function(){for(var s=0,y=0,f=arguments.length;y<f;y++)s+=arguments[y].length;var c=Array(s),l=0;for(y=0;y<f;y++)for(var h=arguments[y],d=0,E=h.length;d<E;d++,l++)c[l]=h[d];return c};Object.defineProperty(b,"__esModule",{value:!0}),b.LogService=b.LogLevel=void 0;var w,_=I(1);(function(s){s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.OFF=4]="OFF"})(w=b.LogLevel||(b.LogLevel={}));var F={debug:w.DEBUG,info:w.INFO,warn:w.WARN,error:w.ERROR,off:w.OFF},v=function(){function s(y){var f=this;this._optionsService=y,this._updateLogLevel(),this._optionsService.onOptionChange(function(c){c==="logLevel"&&f._updateLogLevel()})}return s.prototype._updateLogLevel=function(){this._logLevel=F[this._optionsService.options.logLevel]},s.prototype._evalLazyOptionalParams=function(y){for(var f=0;f<y.length;f++)typeof y[f]=="function"&&(y[f]=y[f]())},s.prototype._log=function(y,f,c){this._evalLazyOptionalParams(c),y.call.apply(y,D([console,"xterm.js: "+f],c))},s.prototype.debug=function(y){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=w.DEBUG&&this._log(console.log,y,f)},s.prototype.info=function(y){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=w.INFO&&this._log(console.info,y,f)},s.prototype.warn=function(y){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=w.WARN&&this._log(console.warn,y,f)},s.prototype.error=function(y){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];this._logLevel<=w.ERROR&&this._log(console.error,y,f)},s=P([G(0,_.IOptionsService)],s)}();b.LogService=v},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(f,c){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])})(f,c)},function(f,c){function l(){this.constructor=f}P(f,c),f.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}),D=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},w=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.BufferService=b.MINIMUM_ROWS=b.MINIMUM_COLS=void 0;var _=I(1),F=I(69),v=I(0),s=I(2);b.MINIMUM_COLS=2,b.MINIMUM_ROWS=1;var y=function(f){function c(l){var h=f.call(this)||this;return h._optionsService=l,h.isUserScrolling=!1,h._onResize=new v.EventEmitter,h.cols=Math.max(l.options.cols,b.MINIMUM_COLS),h.rows=Math.max(l.options.rows,b.MINIMUM_ROWS),h.buffers=new F.BufferSet(l,h),h}return G(c,f),Object.defineProperty(c.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),c.prototype.dispose=function(){f.prototype.dispose.call(this),this.buffers.dispose()},c.prototype.resize=function(l,h){this.cols=l,this.rows=h,this.buffers.resize(l,h),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:l,rows:h})},c.prototype.reset=function(){this.buffers.dispose(),this.buffers=new F.BufferSet(this._optionsService,this),this.isUserScrolling=!1},c=D([w(0,_.IOptionsService)],c)}(s.Disposable);b.BufferService=y},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(F,v){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,y){s.__proto__=y}||function(s,y){for(var f in y)y.hasOwnProperty(f)&&(s[f]=y[f])})(F,v)},function(F,v){function s(){this.constructor=F}P(F,v),F.prototype=v===null?Object.create(v):(s.prototype=v.prototype,new s)});Object.defineProperty(b,"__esModule",{value:!0}),b.BufferSet=void 0;var D=I(70),w=I(0),_=function(F){function v(s,y){var f=F.call(this)||this;return f._onBufferActivate=f.register(new w.EventEmitter),f._normal=new D.Buffer(!0,s,y),f._normal.fillViewportRows(),f._alt=new D.Buffer(!1,s,y),f._activeBuffer=f._normal,f.setupTabStops(),f}return G(v,F),Object.defineProperty(v.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),v.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},v.prototype.activateAltBuffer=function(s){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(s),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},v.prototype.resize=function(s,y){this._normal.resize(s,y),this._alt.resize(s,y)},v.prototype.setupTabStops=function(s){this._normal.setupTabStops(s),this._alt.setupTabStops(s)},v}(I(2).Disposable);b.BufferSet=_},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BufferStringIterator=b.Buffer=b.MAX_BUFFER_SIZE=void 0;var P=I(71),G=I(16),D=I(4),w=I(3),_=I(72),F=I(73),v=I(20),s=I(6);b.MAX_BUFFER_SIZE=4294967295;var y=function(){function c(l,h,d){this._hasScrollback=l,this._optionsService=h,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=G.DEFAULT_ATTR_DATA.clone(),this.savedCharset=v.DEFAULT_CHARSET,this.markers=[],this._nullCell=D.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=D.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new P.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return c.prototype.getNullCell=function(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new s.ExtendedAttrs),this._nullCell},c.prototype.getWhitespaceCell=function(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new s.ExtendedAttrs),this._whitespaceCell},c.prototype.getBlankLine=function(l,h){return new G.BufferLine(this._bufferService.cols,this.getNullCell(l),h)},Object.defineProperty(c.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isCursorInViewport",{get:function(){var l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows},enumerable:!1,configurable:!0}),c.prototype._getCorrectBufferLength=function(l){if(!this._hasScrollback)return l;var h=l+this._optionsService.options.scrollback;return h>b.MAX_BUFFER_SIZE?b.MAX_BUFFER_SIZE:h},c.prototype.fillViewportRows=function(l){if(this.lines.length===0){l===void 0&&(l=G.DEFAULT_ATTR_DATA);for(var h=this._rows;h--;)this.lines.push(this.getBlankLine(l))}},c.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new P.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},c.prototype.resize=function(l,h){var d=this.getNullCell(G.DEFAULT_ATTR_DATA),E=this._getCorrectBufferLength(h);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<l)for(var T=0;T<this.lines.length;T++)this.lines.get(T).resize(l,d);var L=0;if(this._rows<h)for(var x=this._rows;x<h;x++)this.lines.length<h+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new G.BufferLine(l,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+L+1?(this.ybase--,L++,this.ydisp>0&&this.ydisp--):this.lines.push(new G.BufferLine(l,d)));else for(x=this._rows;x>h;x--)this.lines.length>h+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(E<this.lines.maxLength){var A=this.lines.length-E;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=E}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,h-1),L&&(this.y+=L),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=h-1,this._isReflowEnabled&&(this._reflow(l,h),this._cols>l))for(T=0;T<this.lines.length;T++)this.lines.get(T).resize(l,d);this._cols=l,this._rows=h},Object.defineProperty(c.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),c.prototype._reflow=function(l,h){this._cols!==l&&(l>this._cols?this._reflowLarger(l,h):this._reflowSmaller(l,h))},c.prototype._reflowLarger=function(l,h){var d=_.reflowLargerGetLinesToRemove(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(G.DEFAULT_ATTR_DATA));if(d.length>0){var E=_.reflowLargerCreateNewLayout(this.lines,d);_.reflowLargerApplyNewLayout(this.lines,E.layout),this._reflowLargerAdjustViewport(l,h,E.countRemoved)}},c.prototype._reflowLargerAdjustViewport=function(l,h,d){for(var E=this.getNullCell(G.DEFAULT_ATTR_DATA),T=d;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<h&&this.lines.push(new G.BufferLine(l,E))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)},c.prototype._reflowSmaller=function(l,h){for(var d=this.getNullCell(G.DEFAULT_ATTR_DATA),E=[],T=0,L=this.lines.length-1;L>=0;L--){var x=this.lines.get(L);if(!(!x||!x.isWrapped&&x.getTrimmedLength()<=l)){for(var A=[x];x.isWrapped&&L>0;)x=this.lines.get(--L),A.unshift(x);var O=this.ybase+this.y;if(!(O>=L&&O<L+A.length)){var U=A[A.length-1].getTrimmedLength(),B=_.reflowSmallerGetNewLineLengths(A,this._cols,l),$=B.length-A.length,M=void 0;M=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+$):Math.max(0,this.lines.length-this.lines.maxLength+$);for(var Y=[],q=0;q<$;q++){var se=this.getBlankLine(G.DEFAULT_ATTR_DATA,!0);Y.push(se)}Y.length>0&&(E.push({start:L+A.length+T,newLines:Y}),T+=Y.length),A.push.apply(A,Y);var ce=B.length-1,J=B[ce];J===0&&(J=B[--ce]);for(var z=A.length-$-1,Z=U;z>=0;){var N=Math.min(Z,J);if(A[ce].copyCellsFrom(A[z],Z-N,J-N,N,!0),(J-=N)===0&&(J=B[--ce]),(Z-=N)===0){z--;var W=Math.max(z,0);Z=_.getWrappedLineTrimmedLength(A,W,this._cols)}}for(q=0;q<A.length;q++)B[q]<l&&A[q].setCell(B[q],d);for(var K=$-M;K-- >0;)this.ybase===0?this.y<h-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-h&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+$,this.ybase+h-1)}}}if(E.length>0){var k=[],C=[];for(q=0;q<this.lines.length;q++)C.push(this.lines.get(q));var V=this.lines.length,ne=V-1,pe=0,Te=E[pe];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);var Ke=0;for(q=Math.min(this.lines.maxLength-1,V+T-1);q>=0;q--)if(Te&&Te.start>ne+Ke){for(var ve=Te.newLines.length-1;ve>=0;ve--)this.lines.set(q--,Te.newLines[ve]);q++,k.push({index:ne+1,amount:Te.newLines.length}),Ke+=Te.newLines.length,Te=E[++pe]}else this.lines.set(q,C[ne--]);var Ue=0;for(q=k.length-1;q>=0;q--)k[q].index+=Ue,this.lines.onInsertEmitter.fire(k[q]),Ue+=k[q].amount;var Be=Math.max(0,V+T-this.lines.maxLength);Be>0&&this.lines.onTrimEmitter.fire(Be)}},c.prototype.stringIndexToBufferIndex=function(l,h,d){for(d===void 0&&(d=!1);h;){var E=this.lines.get(l);if(!E)return[-1,-1];for(var T=d?E.getTrimmedLength():E.length,L=0;L<T;++L)if(E.get(L)[w.CHAR_DATA_WIDTH_INDEX]&&(h-=E.get(L)[w.CHAR_DATA_CHAR_INDEX].length||1),h<0)return[l,L];l++}return[l,0]},c.prototype.translateBufferLineToString=function(l,h,d,E){d===void 0&&(d=0);var T=this.lines.get(l);return T?T.translateToString(h,d,E):""},c.prototype.getWrappedRangeForLine=function(l){for(var h=l,d=l;h>0&&this.lines.get(h).isWrapped;)h--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:h,last:d}},c.prototype.setupTabStops=function(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.options.tabStopWidth)this.tabs[l]=!0},c.prototype.prevStop=function(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l},c.prototype.nextStop=function(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l},c.prototype.addMarker=function(l){var h=this,d=new F.Marker(l);return this.markers.push(d),d.register(this.lines.onTrim(function(E){d.line-=E,d.line<0&&d.dispose()})),d.register(this.lines.onInsert(function(E){d.line>=E.index&&(d.line+=E.amount)})),d.register(this.lines.onDelete(function(E){d.line>=E.index&&d.line<E.index+E.amount&&d.dispose(),d.line>E.index&&(d.line-=E.amount)})),d.register(d.onDispose(function(){return h._removeMarker(d)})),d},c.prototype._removeMarker=function(l){this.markers.splice(this.markers.indexOf(l),1)},c.prototype.iterator=function(l,h,d,E,T){return new f(this,l,h,d,E,T)},c}();b.Buffer=y;var f=function(){function c(l,h,d,E,T,L){d===void 0&&(d=0),E===void 0&&(E=l.lines.length),T===void 0&&(T=0),L===void 0&&(L=0),this._buffer=l,this._trimRight=h,this._startIndex=d,this._endIndex=E,this._startOverscan=T,this._endOverscan=L,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return c.prototype.hasNext=function(){return this._current<this._endIndex},c.prototype.next=function(){var l=this._buffer.getWrappedRangeForLine(this._current);l.first<this._startIndex-this._startOverscan&&(l.first=this._startIndex-this._startOverscan),l.last>this._endIndex+this._endOverscan&&(l.last=this._endIndex+this._endOverscan),l.first=Math.max(l.first,0),l.last=Math.min(l.last,this._buffer.lines.length);for(var h="",d=l.first;d<=l.last;++d)h+=this._buffer.translateBufferLineToString(d,this._trimRight);return this._current=l.last+1,{range:l,content:h}},c}();b.BufferStringIterator=f},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CircularList=void 0;var P=I(0),G=function(){function D(w){this._maxLength=w,this.onDeleteEmitter=new P.EventEmitter,this.onInsertEmitter=new P.EventEmitter,this.onTrimEmitter=new P.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(D.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"maxLength",{get:function(){return this._maxLength},set:function(w){if(this._maxLength!==w){for(var _=new Array(w),F=0;F<Math.min(w,this.length);F++)_[F]=this._array[this._getCyclicIndex(F)];this._array=_,this._maxLength=w,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"length",{get:function(){return this._length},set:function(w){if(w>this._length)for(var _=this._length;_<w;_++)this._array[_]=void 0;this._length=w},enumerable:!1,configurable:!0}),D.prototype.get=function(w){return this._array[this._getCyclicIndex(w)]},D.prototype.set=function(w,_){this._array[this._getCyclicIndex(w)]=_},D.prototype.push=function(w){this._array[this._getCyclicIndex(this._length)]=w,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},D.prototype.recycle=function(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(D.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),D.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},D.prototype.splice=function(w,_){for(var F=[],v=2;v<arguments.length;v++)F[v-2]=arguments[v];if(_){for(var s=w;s<this._length-_;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+_)];this._length-=_}for(s=this._length-1;s>=w;s--)this._array[this._getCyclicIndex(s+F.length)]=this._array[this._getCyclicIndex(s)];for(s=0;s<F.length;s++)this._array[this._getCyclicIndex(w+s)]=F[s];if(this._length+F.length>this._maxLength){var y=this._length+F.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=F.length},D.prototype.trimStart=function(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)},D.prototype.shiftElements=function(w,_,F){if(!(_<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+F<0)throw new Error("Cannot shift elements in list beyond index 0");if(F>0){for(var v=_-1;v>=0;v--)this.set(w+v+F,this.get(w+v));var s=w+_+F-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(v=0;v<_;v++)this.set(w+v+F,this.get(w+v))}},D.prototype._getCyclicIndex=function(w){return(this._startIndex+w)%this._maxLength},D}();b.CircularList=G},function(me,b,I){"use strict";function P(G,D,w){if(D===G.length-1)return G[D].getTrimmedLength();var _=!G[D].hasContent(w-1)&&G[D].getWidth(w-1)===1,F=G[D+1].getWidth(0)===2;return _&&F?w-1:w}Object.defineProperty(b,"__esModule",{value:!0}),b.getWrappedLineTrimmedLength=b.reflowSmallerGetNewLineLengths=b.reflowLargerApplyNewLayout=b.reflowLargerCreateNewLayout=b.reflowLargerGetLinesToRemove=void 0,b.reflowLargerGetLinesToRemove=function(G,D,w,_,F){for(var v=[],s=0;s<G.length-1;s++){var y=s,f=G.get(++y);if(f.isWrapped){for(var c=[G.get(s)];y<G.length&&f.isWrapped;)c.push(f),f=G.get(++y);if(_>=s&&_<y)s+=c.length-1;else{for(var l=0,h=P(c,l,D),d=1,E=0;d<c.length;){var T=P(c,d,D),L=T-E,x=w-h,A=Math.min(L,x);c[l].copyCellsFrom(c[d],E,h,A,!1),(h+=A)===w&&(l++,h=0),(E+=A)===T&&(d++,E=0),h===0&&l!==0&&c[l-1].getWidth(w-1)===2&&(c[l].copyCellsFrom(c[l-1],w-1,h++,1,!1),c[l-1].setCell(w-1,F))}c[l].replaceCells(h,w,F);for(var O=0,U=c.length-1;U>0&&(U>l||c[U].getTrimmedLength()===0);U--)O++;O>0&&(v.push(s+c.length-O),v.push(O)),s+=c.length-1}}}return v},b.reflowLargerCreateNewLayout=function(G,D){for(var w=[],_=0,F=D[_],v=0,s=0;s<G.length;s++)if(F===s){var y=D[++_];G.onDeleteEmitter.fire({index:s-v,amount:y}),s+=y-1,v+=y,F=D[++_]}else w.push(s);return{layout:w,countRemoved:v}},b.reflowLargerApplyNewLayout=function(G,D){for(var w=[],_=0;_<D.length;_++)w.push(G.get(D[_]));for(_=0;_<w.length;_++)G.set(_,w[_]);G.length=D.length},b.reflowSmallerGetNewLineLengths=function(G,D,w){for(var _=[],F=G.map(function(h,d){return P(G,d,D)}).reduce(function(h,d){return h+d}),v=0,s=0,y=0;y<F;){if(F-y<w){_.push(F-y);break}v+=w;var f=P(G,s,D);v>f&&(v-=f,s++);var c=G[s].getWidth(v-1)===2;c&&v--;var l=c?w-1:w;_.push(l),y+=l}return _},b.getWrappedLineTrimmedLength=P},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(_,F){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,s){v.__proto__=s}||function(v,s){for(var y in s)s.hasOwnProperty(y)&&(v[y]=s[y])})(_,F)},function(_,F){function v(){this.constructor=_}P(_,F),_.prototype=F===null?Object.create(F):(v.prototype=F.prototype,new v)});Object.defineProperty(b,"__esModule",{value:!0}),b.Marker=void 0;var D=I(0),w=function(_){function F(v){var s=_.call(this)||this;return s.line=v,s._id=F._nextId++,s.isDisposed=!1,s._onDispose=new D.EventEmitter,s}return G(F,_),Object.defineProperty(F.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),F.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},F._nextId=1,F}(I(2).Disposable);b.Marker=w},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.OptionsService=b.DEFAULT_OPTIONS=b.DEFAULT_BELL_SOUND=void 0;var P=I(0),G=I(11),D=I(33);b.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",b.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:b.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:G.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var w=["cols","rows"],_=function(){function F(v){this._onOptionChange=new P.EventEmitter,this.options=D.clone(b.DEFAULT_OPTIONS);for(var s=0,y=Object.keys(v);s<y.length;s++){var f=y[s];if(f in this.options){var c=v[f];this.options[f]=c}}}return Object.defineProperty(F.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!1,configurable:!0}),F.prototype.setOption=function(v,s){if(!(v in b.DEFAULT_OPTIONS))throw new Error('No option with key "'+v+'"');if(w.indexOf(v)!==-1)throw new Error('Option "'+v+'" can only be set in the constructor');this.options[v]!==s&&(s=this._sanitizeAndValidateOption(v,s),this.options[v]!==s&&(this.options[v]=s,this._onOptionChange.fire(v)))},F.prototype._sanitizeAndValidateOption=function(v,s){switch(v){case"bellStyle":case"cursorStyle":case"fontWeight":case"fontWeightBold":case"rendererType":case"wordSeparator":s||(s=b.DEFAULT_OPTIONS[v]);break;case"cursorWidth":s=Math.floor(s);case"lineHeight":case"tabStopWidth":if(s<1)throw new Error(v+" cannot be less than 1, value: "+s);break;case"minimumContrastRatio":s=Math.max(1,Math.min(21,Math.round(10*s)/10));break;case"scrollback":if((s=Math.min(s,4294967295))<0)throw new Error(v+" cannot be less than 0, value: "+s);break;case"fastScrollSensitivity":case"scrollSensitivity":if(s<=0)throw new Error(v+" cannot be less than or equal to 0, value: "+s)}return s},F.prototype.getOption=function(v){if(!(v in b.DEFAULT_OPTIONS))throw new Error('No option with key "'+v+'"');return this.options[v]},F}();b.OptionsService=_},function(me,b,I){"use strict";var P,G=this&&this.__extends||(P=function(l,h){return(P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,E){d.__proto__=E}||function(d,E){for(var T in E)E.hasOwnProperty(T)&&(d[T]=E[T])})(l,h)},function(l,h){function d(){this.constructor=l}P(l,h),l.prototype=h===null?Object.create(h):(d.prototype=h.prototype,new d)}),D=this&&this.__decorate||function(l,h,d,E){var T,L=arguments.length,x=L<3?h:E===null?E=Object.getOwnPropertyDescriptor(h,d):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(l,h,d,E);else for(var A=l.length-1;A>=0;A--)(T=l[A])&&(x=(L<3?T(x):L>3?T(h,d,x):T(h,d))||x);return L>3&&x&&Object.defineProperty(h,d,x),x},w=this&&this.__param||function(l,h){return function(d,E){h(d,E,l)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CoreService=void 0;var _=I(1),F=I(0),v=I(33),s=I(2),y=Object.freeze({insertMode:!1}),f=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),c=function(l){function h(d,E,T,L){var x=l.call(this)||this;return x._bufferService=E,x._logService=T,x._optionsService=L,x.isCursorInitialized=!1,x.isCursorHidden=!1,x._onData=x.register(new F.EventEmitter),x._onUserInput=x.register(new F.EventEmitter),x._onBinary=x.register(new F.EventEmitter),x._scrollToBottom=d,x.register({dispose:function(){return x._scrollToBottom=void 0}}),x.modes=v.clone(y),x.decPrivateModes=v.clone(f),x}return G(h,l),Object.defineProperty(h.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),h.prototype.reset=function(){this.modes=v.clone(y),this.decPrivateModes=v.clone(f)},h.prototype.triggerDataEvent=function(d,E){if(E===void 0&&(E=!1),!this._optionsService.options.disableStdin){var T=this._bufferService.buffer;T.ybase!==T.ydisp&&this._scrollToBottom(),E&&this._onUserInput.fire(),this._logService.debug('sending data "'+d+'"',function(){return d.split("").map(function(L){return L.charCodeAt(0)})}),this._onData.fire(d)}},h.prototype.triggerBinaryEvent=function(d){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+d+'"',function(){return d.split("").map(function(E){return E.charCodeAt(0)})}),this._onBinary.fire(d))},h=D([w(1,_.IBufferService),w(2,_.ILogService),w(3,_.IOptionsService)],h)}(s.Disposable);b.CoreService=c},function(me,b,I){"use strict";var P=this&&this.__decorate||function(f,c,l,h){var d,E=arguments.length,T=E<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,c,l,h);else for(var L=f.length-1;L>=0;L--)(d=f[L])&&(T=(E<3?d(T):E>3?d(c,l,T):d(c,l))||T);return E>3&&T&&Object.defineProperty(c,l,T),T},G=this&&this.__param||function(f,c){return function(l,h){c(l,h,f)}};Object.defineProperty(b,"__esModule",{value:!0}),b.CoreMouseService=void 0;var D=I(1),w=I(0),_={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(f){return f.button!==4&&f.action===1&&(f.ctrl=!1,f.alt=!1,f.shift=!1,!0)}},VT200:{events:19,restrict:function(f){return f.action!==32}},DRAG:{events:23,restrict:function(f){return f.action!==32||f.button!==3}},ANY:{events:31,restrict:function(f){return!0}}};function F(f,c){var l=(f.ctrl?16:0)|(f.shift?4:0)|(f.alt?8:0);return f.button===4?(l|=64,l|=f.action):(l|=3&f.button,4&f.button&&(l|=64),8&f.button&&(l|=128),f.action===32?l|=32:f.action!==0||c||(l|=3)),l}var v=String.fromCharCode,s={DEFAULT:function(f){var c=[F(f,!1)+32,f.col+32,f.row+32];return c[0]>255||c[1]>255||c[2]>255?"":"\x1B[M"+v(c[0])+v(c[1])+v(c[2])},SGR:function(f){var c=f.action===0&&f.button!==4?"m":"M";return"\x1B[<"+F(f,!0)+";"+f.col+";"+f.row+c}},y=function(){function f(c,l){this._bufferService=c,this._coreService=l,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new w.EventEmitter,this._lastEvent=null;for(var h=0,d=Object.keys(_);h<d.length;h++){var E=d[h];this.addProtocol(E,_[E])}for(var T=0,L=Object.keys(s);T<L.length;T++){var x=L[T];this.addEncoding(x,s[x])}this.reset()}return f.prototype.addProtocol=function(c,l){this._protocols[c]=l},f.prototype.addEncoding=function(c,l){this._encodings[c]=l},Object.defineProperty(f.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(c){if(!this._protocols[c])throw new Error('unknown protocol "'+c+'"');this._activeProtocol=c,this._onProtocolChange.fire(this._protocols[c].events)},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"areMouseEventsActive",{get:function(){return this._protocols[this._activeProtocol].events!==0},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(c){if(!this._encodings[c])throw new Error('unknown encoding "'+c+'"');this._activeEncoding=c},enumerable:!1,configurable:!0}),f.prototype.reset=function(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null},Object.defineProperty(f.prototype,"onProtocolChange",{get:function(){return this._onProtocolChange.event},enumerable:!1,configurable:!0}),f.prototype.triggerMouseEvent=function(c){if(c.col<0||c.col>=this._bufferService.cols||c.row<0||c.row>=this._bufferService.rows||c.button===4&&c.action===32||c.button===3&&c.action!==32||c.button!==4&&(c.action===2||c.action===3)||(c.col++,c.row++,c.action===32&&this._lastEvent&&this._compareEvents(this._lastEvent,c))||!this._protocols[this._activeProtocol].restrict(c))return!1;var l=this._encodings[this._activeEncoding](c);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!0)),this._lastEvent=c,!0},f.prototype.explainEvents=function(c){return{down:!!(1&c),up:!!(2&c),drag:!!(4&c),move:!!(8&c),wheel:!!(16&c)}},f.prototype._compareEvents=function(c,l){return c.col===l.col&&c.row===l.row&&c.button===l.button&&c.action===l.action&&c.ctrl===l.ctrl&&c.alt===l.alt&&c.shift===l.shift},f=P([G(0,D.IBufferService),G(1,D.ICoreService)],f)}();b.CoreMouseService=y},function(me,b,I){"use strict";var P=this&&this.__decorate||function(_,F,v,s){var y,f=arguments.length,c=f<3?F:s===null?s=Object.getOwnPropertyDescriptor(F,v):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(_,F,v,s);else for(var l=_.length-1;l>=0;l--)(y=_[l])&&(c=(f<3?y(c):f>3?y(F,v,c):y(F,v))||c);return f>3&&c&&Object.defineProperty(F,v,c),c},G=this&&this.__param||function(_,F){return function(v,s){F(v,s,_)}};Object.defineProperty(b,"__esModule",{value:!0}),b.DirtyRowService=void 0;var D=I(1),w=function(){function _(F){this._bufferService=F,this.clearRange()}return Object.defineProperty(_.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),_.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},_.prototype.markDirty=function(F){F<this._start?this._start=F:F>this._end&&(this._end=F)},_.prototype.markRangeDirty=function(F,v){if(F>v){var s=F;F=v,v=s}F<this._start&&(this._start=F),v>this._end&&(this._end=v)},_.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},_=P([G(0,D.IBufferService)],_)}();b.DirtyRowService=w},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UnicodeService=void 0;var P=I(0),G=I(79),D=function(){function w(){this._providers=Object.create(null),this._active="",this._onChange=new P.EventEmitter;var _=new G.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}return Object.defineProperty(w.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"activeVersion",{get:function(){return this._active},set:function(_){if(!this._providers[_])throw new Error('unknown Unicode version "'+_+'"');this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)},enumerable:!1,configurable:!0}),w.prototype.register=function(_){this._providers[_.version]=_},w.prototype.wcwidth=function(_){return this._activeProvider.wcwidth(_)},w.prototype.getStringCellWidth=function(_){for(var F=0,v=_.length,s=0;s<v;++s){var y=_.charCodeAt(s);if(55296<=y&&y<=56319){if(++s>=v)return F+this.wcwidth(y);var f=_.charCodeAt(s);56320<=f&&f<=57343?y=1024*(y-55296)+f-56320+65536:F+=this.wcwidth(f)}F+=this.wcwidth(y)}return F},w}();b.UnicodeService=D},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UnicodeV6=void 0;var P,G=I(15),D=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],w=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],_=function(){function F(){if(this.version="6",!P){P=new Uint8Array(65536),G.fill(P,1),P[0]=0,G.fill(P,0,1,32),G.fill(P,0,127,160),G.fill(P,2,4352,4448),P[9001]=2,P[9002]=2,G.fill(P,2,11904,42192),P[12351]=1,G.fill(P,2,44032,55204),G.fill(P,2,63744,64256),G.fill(P,2,65040,65050),G.fill(P,2,65072,65136),G.fill(P,2,65280,65377),G.fill(P,2,65504,65511);for(var v=0;v<D.length;++v)G.fill(P,0,D[v][0],D[v][1]+1)}}return F.prototype.wcwidth=function(v){return v<32?0:v<127?1:v<65536?P[v]:function(s,y){var f,c=0,l=y.length-1;if(s<y[0][0]||s>y[l][1])return!1;for(;l>=c;)if(s>y[f=c+l>>1][1])c=f+1;else{if(!(s<y[f][0]))return!0;l=f-1}return!1}(v,w)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1},F}();b.UnicodeV6=_},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CharsetService=void 0;var P=function(){function G(){this.glevel=0,this._charsets=[]}return G.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},G.prototype.setgLevel=function(D){this.glevel=D,this.charset=this._charsets[D]},G.prototype.setgCharset=function(D,w){this._charsets[D]=w,this.glevel===D&&(this.charset=w)},G}();b.CharsetService=P},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.updateWindowsModeWrappedState=void 0;var P=I(3);b.updateWindowsModeWrappedState=function(G){var D=G.buffer.lines.get(G.buffer.ybase+G.buffer.y-1),w=D==null?void 0:D.get(G.cols-1),_=G.buffer.lines.get(G.buffer.ybase+G.buffer.y);_&&w&&(_.isWrapped=w[P.CHAR_DATA_CODE_INDEX]!==P.NULL_CELL_CODE&&w[P.CHAR_DATA_CODE_INDEX]!==P.WHITESPACE_CELL_CODE)}},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.WriteBuffer=void 0;var P=function(){function G(D){this._action=D,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return G.prototype.writeSync=function(D){if(this._writeBuffer.length){for(var w=this._bufferOffset;w<this._writeBuffer.length;++w){var _=this._writeBuffer[w],F=this._callbacks[w];this._action(_),F&&F()}this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=2147483647}this._action(D)},G.prototype.write=function(D,w){var _=this;if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(function(){return _._innerWrite()})),this._pendingData+=D.length,this._writeBuffer.push(D),this._callbacks.push(w)},G.prototype._innerWrite=function(){for(var D=this,w=Date.now();this._writeBuffer.length>this._bufferOffset;){var _=this._writeBuffer[this._bufferOffset],F=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(_),this._pendingData-=_.length,F&&F(),Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(function(){return D._innerWrite()},0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},G}();b.WriteBuffer=P},function(me,b,I){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.AddonManager=void 0;var P=function(){function G(){this._addons=[]}return G.prototype.dispose=function(){for(var D=this._addons.length-1;D>=0;D--)this._addons[D].instance.dispose()},G.prototype.loadAddon=function(D,w){var _=this,F={instance:w,dispose:w.dispose,isDisposed:!1};this._addons.push(F),w.dispose=function(){return _._wrappedAddonDispose(F)},w.activate(D)},G.prototype._wrappedAddonDispose=function(D){if(!D.isDisposed){for(var w=-1,_=0;_<this._addons.length;_++)if(this._addons[_]===D){w=_;break}if(w===-1)throw new Error("Could not dispose an addon that has not been loaded");D.isDisposed=!0,D.dispose.apply(D.instance),this._addons.splice(w,1)}},G}();b.AddonManager=P}])})},93314:function(yt){"use strict";yt.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=="},80360:function(yt,me,b){"use strict";b.d(me,{ZP:function(){return jr}});const I=Number.isFinite||function(o){return typeof o=="number"&&isFinite(o)},P=Number.isSafeInteger||function(o){return typeof o=="number"&&Math.abs(o)<=G},G=Number.MAX_SAFE_INTEGER||9007199254740991;let D=function(o){return o.NETWORK_ERROR="networkError",o.MEDIA_ERROR="mediaError",o.KEY_SYSTEM_ERROR="keySystemError",o.MUX_ERROR="muxError",o.OTHER_ERROR="otherError",o}({}),w=function(o){return o.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",o.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",o.KEY_SYSTEM_NO_SESSION="keySystemNoSession",o.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",o.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",o.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",o.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",o.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",o.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",o.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",o.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",o.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",o.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",o.MANIFEST_LOAD_ERROR="manifestLoadError",o.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",o.MANIFEST_PARSING_ERROR="manifestParsingError",o.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",o.LEVEL_EMPTY_ERROR="levelEmptyError",o.LEVEL_LOAD_ERROR="levelLoadError",o.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",o.LEVEL_PARSING_ERROR="levelParsingError",o.LEVEL_SWITCH_ERROR="levelSwitchError",o.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",o.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",o.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",o.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",o.FRAG_LOAD_ERROR="fragLoadError",o.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",o.FRAG_DECRYPT_ERROR="fragDecryptError",o.FRAG_PARSING_ERROR="fragParsingError",o.FRAG_GAP="fragGap",o.REMUX_ALLOC_ERROR="remuxAllocError",o.KEY_LOAD_ERROR="keyLoadError",o.KEY_LOAD_TIMEOUT="keyLoadTimeOut",o.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",o.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",o.BUFFER_APPEND_ERROR="bufferAppendError",o.BUFFER_APPENDING_ERROR="bufferAppendingError",o.BUFFER_STALLED_ERROR="bufferStalledError",o.BUFFER_FULL_ERROR="bufferFullError",o.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",o.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",o.ASSET_LIST_LOAD_ERROR="assetListLoadError",o.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",o.ASSET_LIST_PARSING_ERROR="assetListParsingError",o.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",o.INTERNAL_EXCEPTION="internalException",o.INTERNAL_ABORTED="aborted",o.ATTACH_MEDIA_ERROR="attachMediaError",o.UNKNOWN="unknown",o}({}),_=function(o){return o.MEDIA_ATTACHING="hlsMediaAttaching",o.MEDIA_ATTACHED="hlsMediaAttached",o.MEDIA_DETACHING="hlsMediaDetaching",o.MEDIA_DETACHED="hlsMediaDetached",o.MEDIA_ENDED="hlsMediaEnded",o.STALL_RESOLVED="hlsStallResolved",o.BUFFER_RESET="hlsBufferReset",o.BUFFER_CODECS="hlsBufferCodecs",o.BUFFER_CREATED="hlsBufferCreated",o.BUFFER_APPENDING="hlsBufferAppending",o.BUFFER_APPENDED="hlsBufferAppended",o.BUFFER_EOS="hlsBufferEos",o.BUFFERED_TO_END="hlsBufferedToEnd",o.BUFFER_FLUSHING="hlsBufferFlushing",o.BUFFER_FLUSHED="hlsBufferFlushed",o.MANIFEST_LOADING="hlsManifestLoading",o.MANIFEST_LOADED="hlsManifestLoaded",o.MANIFEST_PARSED="hlsManifestParsed",o.LEVEL_SWITCHING="hlsLevelSwitching",o.LEVEL_SWITCHED="hlsLevelSwitched",o.LEVEL_LOADING="hlsLevelLoading",o.LEVEL_LOADED="hlsLevelLoaded",o.LEVEL_UPDATED="hlsLevelUpdated",o.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",o.LEVELS_UPDATED="hlsLevelsUpdated",o.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",o.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",o.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",o.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",o.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",o.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",o.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",o.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",o.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",o.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",o.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",o.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",o.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",o.CUES_PARSED="hlsCuesParsed",o.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",o.INIT_PTS_FOUND="hlsInitPtsFound",o.FRAG_LOADING="hlsFragLoading",o.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",o.FRAG_LOADED="hlsFragLoaded",o.FRAG_DECRYPTED="hlsFragDecrypted",o.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",o.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",o.FRAG_PARSING_METADATA="hlsFragParsingMetadata",o.FRAG_PARSED="hlsFragParsed",o.FRAG_BUFFERED="hlsFragBuffered",o.FRAG_CHANGED="hlsFragChanged",o.FPS_DROP="hlsFpsDrop",o.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",o.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",o.ERROR="hlsError",o.DESTROYING="hlsDestroying",o.KEY_LOADING="hlsKeyLoading",o.KEY_LOADED="hlsKeyLoaded",o.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",o.BACK_BUFFER_REACHED="hlsBackBufferReached",o.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",o.ASSET_LIST_LOADING="hlsAssetListLoading",o.ASSET_LIST_LOADED="hlsAssetListLoaded",o.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",o.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",o.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",o.INTERSTITIAL_STARTED="hlsInterstitialStarted",o.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",o.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",o.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",o.INTERSTITIAL_ENDED="hlsInterstitialEnded",o.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",o.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",o.EVENT_CUE_ENTER="hlsEventCueEnter",o}({});var F={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},v={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class s{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class y{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new s(e),this.fast_=new s(t),this.defaultTTFB_=r,this.ttfb_=new s(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new s(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new s(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new s(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function f(o,e,t){return(e=E(e))in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function c(){return c=Object.assign?Object.assign.bind():function(o){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(o[i]=t[i])}return o},c.apply(null,arguments)}function l(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(o,r).enumerable})),t.push.apply(t,i)}return t}function h(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?l(Object(t),!0).forEach(function(i){f(o,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach(function(i){Object.defineProperty(o,i,Object.getOwnPropertyDescriptor(t,i))})}return o}function d(o,e){if(typeof o!="object"||!o)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var i=t.call(o,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function E(o){var e=d(o,"string");return typeof e=="symbol"?e:e+""}class T{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=L,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const L=function(){},x={trace:L,debug:L,log:L,warn:L,info:L,error:L};function A(){return c({},x)}function O(o,e){const t=self.console[o];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${o}] >`):L}function U(o,e,t){return e[o]?e[o].bind(e):O(o,t)}const B=A();function $(o,e,t){const i=A();if(typeof console=="object"&&o===!0||typeof o=="object"){const r=["debug","log","info","warn","error"];r.forEach(n=>{i[n]=U(n,o,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.13`)}catch(n){return A()}r.forEach(n=>{B[n]=U(n,o)})}else c(B,i);return i}const M=B;function Y(o=!0){return typeof self=="undefined"?void 0:(o||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function q(o){return typeof self!="undefined"&&o===self.ManagedMediaSource}function se(o,e){const t=Object.keys(o),i=Object.keys(e),r=t.length,n=i.length;return!r||!n||r===n&&!t.some(a=>i.indexOf(a)===-1)}function ce(o,e=!1){if(typeof TextDecoder!="undefined"){const p=new TextDecoder("utf-8").decode(o);if(e){const m=p.indexOf("\0");return m!==-1?p.substring(0,m):p}return p.replace(/\0/g,"")}const t=o.length;let i,r,n,a="",u=0;for(;u<t;){if(i=o[u++],i===0&&e)return a;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:r=o[u++],a+=String.fromCharCode((i&31)<<6|r&63);break;case 14:r=o[u++],n=o[u++],a+=String.fromCharCode((i&15)<<12|(r&63)<<6|(n&63)<<0);break}}return a}function J(o){let e="";for(let t=0;t<o.length;t++){let i=o[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function z(o){return Uint8Array.from(o.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function Z(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var N={exports:{}},W;function K(){return W||(W=1,function(o,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,u={buildAbsoluteURL:function(g,p,m){if(m=m||{},g=g.trim(),p=p.trim(),!p){if(!m.alwaysNormalize)return g;var S=u.parseURL(g);if(!S)throw new Error("Error trying to parse base URL.");return S.path=u.normalizePath(S.path),u.buildURLFromParts(S)}var R=u.parseURL(p);if(!R)throw new Error("Error trying to parse relative URL.");if(R.scheme)return m.alwaysNormalize?(R.path=u.normalizePath(R.path),u.buildURLFromParts(R)):p;var H=u.parseURL(g);if(!H)throw new Error("Error trying to parse base URL.");if(!H.netLoc&&H.path&&H.path[0]!=="/"){var j=r.exec(H.path);H.netLoc=j[1],H.path=j[2]}H.netLoc&&!H.path&&(H.path="/");var Q={scheme:H.scheme,netLoc:R.netLoc,path:null,params:R.params,query:R.query,fragment:R.fragment};if(!R.netLoc&&(Q.netLoc=H.netLoc,R.path[0]!=="/"))if(!R.path)Q.path=H.path,R.params||(Q.params=H.params,R.query||(Q.query=H.query));else{var X=H.path,re=X.substring(0,X.lastIndexOf("/")+1)+R.path;Q.path=u.normalizePath(re)}return Q.path===null&&(Q.path=m.alwaysNormalize?u.normalizePath(R.path):R.path),u.buildURLFromParts(Q)},parseURL:function(g){var p=i.exec(g);return p?{scheme:p[1]||"",netLoc:p[2]||"",path:p[3]||"",params:p[4]||"",query:p[5]||"",fragment:p[6]||""}:null},normalizePath:function(g){for(g=g.split("").reverse().join("").replace(n,"");g.length!==(g=g.replace(a,"")).length;);return g.split("").reverse().join("")},buildURLFromParts:function(g){return g.scheme+g.netLoc+g.path+g.params+g.query+g.fragment}};o.exports=u})()}(N)),N.exports}var k=K();class C{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 V={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class ne{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,Ue(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let r;i.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}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={[V.AUDIO]:null,[V.VIDEO]:null,[V.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 C),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=k.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[V.AUDIO]=null,e[V.VIDEO]=null,e[V.AUDIOVIDEO]=null}}function pe(o){return o.sn!=="initSegment"}class Te extends ne{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(I(e)&&I(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(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const i=Object.keys(t);if(i.length===1){const r=this._decryptdata=t[i[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=I(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 i=Object.keys(this.levelkeys),r=i.length;if(r>1||r===1&&(t=this.levelkeys[i[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(!I(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return pe(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){const t=this.levelkeys;if(t){var i;const r=t[e];r&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,n,a=!1){const{elementaryStreams:u}=this,g=u[e];if(!g){u[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:a};return}g.startPTS=Math.min(g.startPTS,t),g.endPTS=Math.max(g.endPTS,i),g.startDTS=Math.min(g.startDTS,r),g.endDTS=Math.max(g.endDTS,n)}}class Ke extends ne{constructor(e,t,i,r,n){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,n),n&&(this.fragOffset=n.fragOffset+n.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 ve(o,e){const t=Object.getPrototypeOf(o);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||ve(t,e)}}function Ue(o,e){const t=ve(o,e);t&&(t.enumerable=!0,Object.defineProperty(o,e,t))}const Be=Math.pow(2,32)-1,Me=[].push,St={video:1,audio:2,id3:3,text:4};function He(o){return String.fromCharCode.apply(null,o)}function ut(o,e){const t=o[e]<<8|o[e+1];return t<0?65536+t:t}function $e(o,e){const t=Ee(o,e);return t<0?4294967296+t:t}function bt(o,e){let t=$e(o,e);return t*=Math.pow(2,32),t+=$e(o,e+4),t}function Ee(o,e){return o[e]<<24|o[e+1]<<16|o[e+2]<<8|o[e+3]}function be(o){const e=o.byteLength;for(let t=0;t<e;){const i=$e(o,t);if(i>8&&o[t+4]===109&&o[t+5]===111&&o[t+6]===111&&o[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ue(o,e){const t=[];if(!e.length)return t;const i=o.byteLength;for(let r=0;r<i;){const n=$e(o,r),a=He(o.subarray(r+4,r+8)),u=n>1?r+n:i;if(a===e[0])if(e.length===1)t.push(o.subarray(r+8,u));else{const g=ue(o.subarray(r+8,u),e.slice(1));g.length&&Me.apply(t,g)}r=u}return t}function ke(o){const e=[],t=o[0];let i=8;const r=$e(o,i);i+=4;let n=0,a=0;t===0?(n=$e(o,i),a=$e(o,i+4),i+=8):(n=bt(o,i),a=bt(o,i+8),i+=16),i+=2;let u=o.length+a;const g=ut(o,i);i+=2;for(let p=0;p<g;p++){let m=i;const S=$e(o,m);m+=4;const R=S&2147483647;if((S&2147483648)>>>31===1)return M.warn("SIDX has hierarchical references (not supported)"),null;const j=$e(o,m);m+=4,e.push({referenceSize:R,subsegmentDuration:j,info:{duration:j/r,start:u,end:u+R-1}}),u+=R,m+=4,i=m}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:g,references:e}}function Fe(o){const e=[],t=ue(o,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],a=ue(n,["tkhd"])[0];if(a){let u=a[0];const g=$e(a,u===0?12:20),p=ue(n,["mdia","mdhd"])[0];if(p){u=p[0];const m=$e(p,u===0?12:20),S=ue(n,["mdia","hdlr"])[0];if(S){const R=He(S.subarray(8,12)),H={soun:V.AUDIO,vide:V.VIDEO}[R],j=ue(n,["mdia","minf","stbl","stsd"])[0],Q=We(j);H?(e[g]={timescale:m,type:H,stsd:Q},e[H]=h({timescale:m,id:g},Q)):e[g]={timescale:m,type:R,stsd:Q}}}}}return ue(o,["moov","mvex","trex"]).forEach(r=>{const n=$e(r,4),a=e[n];a&&(a.default={duration:$e(r,12),flags:$e(r,20)})}),e}function We(o){const e=o.subarray(8),t=e.subarray(86),i=He(e.subarray(4,8));let r=i,n;const a=i==="enca"||i==="encv";if(a){const p=ue(e,[i])[0].subarray(i==="enca"?28:78);ue(p,["sinf"]).forEach(S=>{const R=ue(S,["schm"])[0];if(R){const H=He(R.subarray(4,8));if(H==="cbcs"||H==="cenc"){const j=ue(S,["frma"])[0];j&&(r=He(j))}}})}const u=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const g=ue(t,["avcC"])[0];g&&g.length>3&&(r+="."+Re(g[1])+Re(g[2])+Re(g[3]),n=ie(u==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const g=ue(e,[i])[0],p=ue(g.subarray(28),["esds"])[0];if(p&&p.length>7){let m=4;if(p[m++]!==3)break;m=De(p,m),m+=2;const S=p[m++];if(S&128&&(m+=2),S&64&&(m+=p[m++]),p[m++]!==4)break;m=De(p,m);const R=p[m++];if(R===64)r+="."+Re(R);else break;if(m+=12,p[m++]!==5)break;m=De(p,m);const H=p[m++];let j=(H&248)>>3;j===31&&(j+=1+((H&7)<<3)+((p[m]&224)>>5)),r+="."+j}break}case"hvc1":case"hev1":{const g=ue(t,["hvcC"])[0];if(g&&g.length>12){const p=g[1],m=["","A","B","C"][p>>6],S=p&31,R=$e(g,2),H=(p&32)>>5?"H":"L",j=g[12],Q=g.subarray(6,12);r+="."+m+S,r+="."+fe(R).toString(16).toUpperCase(),r+="."+H+j;let X="";for(let re=Q.length;re--;){const ae=Q[re];(ae||X)&&(X="."+ae.toString(16).toUpperCase()+X)}r+=X}n=ie(u=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=ie(r,t)||r;break}case"vp09":{const g=ue(t,["vpcC"])[0];if(g&&g.length>6){const p=g[4],m=g[5],S=g[6]>>4&15;r+="."+Oe(p)+"."+Oe(m)+"."+Oe(S)}break}case"av01":{const g=ue(t,["av1C"])[0];if(g&&g.length>2){const p=g[1]>>>5,m=g[1]&31,S=g[2]>>>7?"H":"M",R=(g[2]&64)>>6,H=(g[2]&32)>>5,j=p===2&&R?H?12:10:R?10:8,Q=(g[2]&16)>>4,X=(g[2]&8)>>3,re=(g[2]&4)>>2,ae=g[2]&3;r+="."+p+"."+Oe(m)+S+"."+Oe(j)+"."+Q+"."+X+re+ae+"."+Oe(1)+"."+Oe(1)+"."+Oe(1)+"."+0,n=ie("dav1",t)}break}}return{codec:r,encrypted:a,supplemental:n}}function ie(o,e){const t=ue(e,["dvvC"]),i=t.length?t[0]:ue(e,["dvcC"])[0];if(i){const r=i[2]>>1&127,n=i[2]<<5&32|i[3]>>3&31;return o+"."+Oe(r)+"."+Oe(n)}}function fe(o){let e=0;for(let t=0;t<32;t++)e|=(o>>t&1)<<31-t;return e>>>0}function De(o,e){const t=e+5;for(;o[e++]&128&&e<t;);return e}function Re(o){return("0"+o.toString(16).toUpperCase()).slice(-2)}function Oe(o){return(o<10?"0":"")+o}function Ve(o,e){if(!o||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&Qe(o,(i,r)=>{const n=i.subarray(8,24);n.some(a=>a!==0)||(M.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${J(n)} -> ${J(t)}`),i.set(t,8))})}function lt(o){const e=[];return Qe(o,t=>e.push(t.subarray(8,24))),e}function Qe(o,e){ue(o,["moov","trak"]).forEach(i=>{const r=ue(i,["mdia","minf","stbl","stsd"])[0];if(!r)return;const n=r.subarray(8);let a=ue(n,["enca"]);const u=a.length>0;u||(a=ue(n,["encv"])),a.forEach(g=>{const p=u?g.subarray(28):g.subarray(78);ue(p,["sinf"]).forEach(S=>{const R=Ze(S);R&&e(R,u)})})})}function Ze(o){const e=ue(o,["schm"])[0];if(e){const t=He(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const i=ue(o,["schi","tenc"])[0];if(i)return i}}}function Xe(o,e,t){const i={},r=ue(o,["moof","traf"]);for(let n=0;n<r.length;n++){const a=r[n],u=ue(a,["tfhd"])[0],g=$e(u,4),p=e[g];if(!p)continue;i[g]||(i[g]={start:NaN,duration:0,sampleCount:0,timescale:p.timescale,type:p.type});const m=i[g],S=ue(a,["tfdt"])[0];if(S){const oe=S[0];let de=$e(S,4);oe===1&&(de===Be?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(de*=Be+1,de+=$e(S,8))),I(de)&&(!I(m.start)||de<m.start)&&(m.start=de)}const R=p.default,H=$e(u,0)|(R==null?void 0:R.flags);let j=(R==null?void 0:R.duration)||0;H&8&&(H&2?j=$e(u,12):j=$e(u,8));const Q=ue(a,["trun"]);let X=m.start||0,re=0,ae=j;for(let oe=0;oe<Q.length;oe++){const de=Q[oe],Se=$e(de,4),Ne=m.sampleCount;m.sampleCount+=Se;const we=de[3]&1,Pe=de[3]&4,Ie=de[2]&1,Ce=de[2]&2,Ye=de[2]&4,_t=de[2]&8;let xt=8,Rt=Se;for(we&&(xt+=4),Pe&&Se&&(!(de[xt+1]&1)&&m.keyFrameIndex===void 0&&(m.keyFrameIndex=Ne),xt+=4,Ie?(ae=$e(de,xt),xt+=4):ae=j,Ce&&(xt+=4),_t&&(xt+=4),X+=ae,re+=ae,Rt--);Rt--;)Ie?(ae=$e(de,xt),xt+=4):ae=j,Ce&&(xt+=4),Ye&&(de[xt+1]&1||m.keyFrameIndex===void 0&&(m.keyFrameIndex=m.sampleCount-(Rt+1),m.keyFrameStart=X),xt+=4),_t&&(xt+=4),X+=ae,re+=ae;!re&&j&&(re+=j*Se)}m.duration+=re}if(!Object.keys(i).some(n=>i[n].duration)){let n=1/0,a=0;const u=ue(o,["sidx"]);for(let g=0;g<u.length;g++){const p=ke(u[g]);if(p!=null&&p.references){n=Math.min(n,p.earliestPresentationTime/p.timescale);const m=p.references.reduce((S,R)=>S+R.info.duration||0,0);a=Math.max(a,m+p.earliestPresentationTime/p.timescale)}}a&&I(a)&&Object.keys(i).forEach(g=>{i[g].duration||(i[g].duration=a*i[g].timescale-i[g].start)})}return i}function ht(o){const e={valid:null,remainder:null},t=ue(o,["moof"]);if(t.length<2)return e.remainder=o,e;const i=t[t.length-1];return e.valid=o.slice(0,i.byteOffset-8),e.remainder=o.slice(i.byteOffset-8),e}function st(o,e){const t=new Uint8Array(o.length+e.length);return t.set(o),t.set(e,o.length),t}function it(o,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let a=!1;return ue(i,["moof"]).map(g=>{const p=g.byteOffset-8;ue(g,["traf"]).map(S=>{const R=ue(S,["tfdt"]).map(H=>{const j=H[0];let Q=$e(H,4);return j===1&&(Q*=Math.pow(2,32),Q+=$e(H,8)),Q/r})[0];return R!==void 0&&(o=R),ue(S,["tfhd"]).map(H=>{const j=$e(H,4),Q=$e(H,0)&16777215,X=(Q&1)!==0,re=(Q&2)!==0,ae=(Q&8)!==0;let oe=0;const de=(Q&16)!==0;let Se=0;const Ne=(Q&32)!==0;let we=8;j===n&&(X&&(we+=8),re&&(we+=4),ae&&(oe=$e(H,we),we+=4),de&&(Se=$e(H,we),we+=4),Ne&&(we+=4),e.type==="video"&&(a=Ae(e.codec)),ue(S,["trun"]).map(Pe=>{const Ie=Pe[0],Ce=$e(Pe,0)&16777215,Ye=(Ce&1)!==0;let _t=0;const xt=(Ce&4)!==0,Rt=(Ce&256)!==0;let At=0;const ot=(Ce&512)!==0;let Ct=0;const vt=(Ce&1024)!==0,Dt=(Ce&2048)!==0;let Ft=0;const ft=$e(Pe,4);let dt=8;Ye&&(_t=$e(Pe,dt),dt+=4),xt&&(dt+=4);let Wt=_t+p;for(let Qt=0;Qt<ft;Qt++){if(Rt?(At=$e(Pe,dt),dt+=4):At=oe,ot?(Ct=$e(Pe,dt),dt+=4):Ct=Se,vt&&(dt+=4),Dt&&(Ie===0?Ft=$e(Pe,dt):Ft=Ee(Pe,dt),dt+=4),e.type===V.VIDEO){let Gt=0;for(;Gt<Ct;){const qt=$e(i,Wt);if(Wt+=4,rt(a,i[Wt])){const Li=i.subarray(Wt,Wt+qt);qe(Li,a?2:1,o+Ft/r,t)}Wt+=qt,Gt+=qt+4}}o+=At/r}}))})})}),t}function Ae(o){if(!o)return!1;const e=o.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function rt(o,e){if(o){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function qe(o,e,t,i){const r=je(o);let n=0;n+=e;let a=0,u=0,g=0;for(;n<r.length;){a=0;do{if(n>=r.length)break;g=r[n++],a+=g}while(g===255);u=0;do{if(n>=r.length)break;g=r[n++],u+=g}while(g===255);const p=r.length-n;let m=n;if(u<p)n+=u;else if(u>p){M.error(`Malformed SEI payload. ${u} is too small, only ${p} bytes left to parse.`);break}if(a===4){if(r[m++]===181){const R=ut(r,m);if(m+=2,R===49){const H=$e(r,m);if(m+=4,H===1195456820){const j=r[m++];if(j===3){const Q=r[m++],X=31&Q,re=64&Q,ae=re?2+X*3:0,oe=new Uint8Array(ae);if(re){oe[0]=Q;for(let de=1;de<ae;de++)oe[de]=r[m++]}i.push({type:j,payloadType:a,pts:t,bytes:oe})}}}}}else if(a===5&&u>16){const S=[];for(let j=0;j<16;j++){const Q=r[m++].toString(16);S.push(Q.length==1?"0"+Q:Q),(j===3||j===5||j===7||j===9)&&S.push("-")}const R=u-16,H=new Uint8Array(R);for(let j=0;j<R;j++)H[j]=r[m++];i.push({payloadType:a,pts:t,uuid:S.join(""),userData:ce(H),userDataBytes:H})}}}function je(o){const e=o.byteLength,t=[];let i=1;for(;i<e-2;)o[i]===0&&o[i+1]===0&&o[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return o;const r=e-t.length,n=new Uint8Array(r);let a=0;for(i=0;i<r;a++,i++)a===t[0]&&(a++,t.shift()),n[i]=o[a];return n}function mt(o){const e=o[0];let t="",i="",r=0,n=0,a=0,u=0,g=0,p=0;if(e===0){for(;He(o.subarray(p,p+1))!=="\0";)t+=He(o.subarray(p,p+1)),p+=1;for(t+=He(o.subarray(p,p+1)),p+=1;He(o.subarray(p,p+1))!=="\0";)i+=He(o.subarray(p,p+1)),p+=1;i+=He(o.subarray(p,p+1)),p+=1,r=$e(o,12),n=$e(o,16),u=$e(o,20),g=$e(o,24),p=28}else if(e===1){p+=4,r=$e(o,p),p+=4;const S=$e(o,p);p+=4;const R=$e(o,p);for(p+=4,a=al(2,32)*S+R,P(a)||(a=Number.MAX_SAFE_INTEGER,M.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),u=$e(o,p),p+=4,g=$e(o,p),p+=4;He(o.subarray(p,p+1))!=="\0";)t+=He(o.subarray(p,p+1)),p+=1;for(t+=He(o.subarray(p,p+1)),p+=1;He(o.subarray(p,p+1))!=="\0";)i+=He(o.subarray(p,p+1)),p+=1;i+=He(o.subarray(p,p+1)),p+=1}const m=o.subarray(p,o.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:a,presentationTimeDelta:n,eventDuration:u,id:g,payload:m}}function Et(o,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(o,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function at(o,e,t){if(o.byteLength!==16)throw new RangeError("Invalid system id");let i,r;i=0,r=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),Et([112,115,115,104],new Uint8Array([i,0,0,0]),o,n,r,a,t)}function kt(o){const e=[];if(o instanceof ArrayBuffer){const t=o.byteLength;let i=0;for(;i+32<t;){const r=new DataView(o,i),n=Bt(r);e.push(n),i+=n.size}}return e}function Bt(o){const e=o.getUint32(0),t=o.byteOffset,i=o.byteLength;if(i<e)return{offset:t,size:i};if(o.getUint32(4)!==1886614376)return{offset:t,size:e};const n=o.getUint32(8)>>>24;if(n!==0&&n!==1)return{offset:t,size:e};const a=o.buffer,u=J(new Uint8Array(a,t+12,16));let g=null,p=null,m=0;if(n===0)m=28;else{const R=o.getUint32(28);if(!R||i<32+R*16)return{offset:t,size:e};g=[];for(let H=0;H<R;H++)g.push(new Uint8Array(a,t+32+H*16,16));m=32+R*16}if(!m)return{offset:t,size:e};const S=o.getUint32(m);return e-32<S?{offset:t,size:e}:(p=new Uint8Array(a,t+m+4,S),{version:n,systemId:u,kids:g,data:p,offset:t,size:e})}const nt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Tt={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 xe(o,e){const t=Tt[e];return!!t&&!!t[o.slice(0,4)]}function ge(o,e,t=!0){return!o.split(",").some(i=>!ye(i,e,t))}function ye(o,e,t=!0){var i;const r=Y(t);return(i=r==null?void 0:r.isTypeSupported(ee(o,e)))!=null?i:!1}function ee(o,e){return`${e}/mp4;codecs=${o}`}function te(o){if(o){const e=o.substring(0,4);return Tt.video[e]}return 2}function le(o){const e=nt();return o.split(",").reduce((t,i)=>{const n=e&&Ae(i)?9:Tt.video[i];return n?(n*2+t)/(t?3:2):(Tt.audio[i]+t)/(t?2:1)},0)}const he={};function _e(o,e=!0){if(he[o])return he[o];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[o];for(let r=0;r<t.length;r++){var i;if(ye(t[r],"audio",e))return he[o]=t[r],t[r];if(t[r]==="mp3"&&(i=Y(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return o}const Je=/flac|opus|mp4a\.40\.34/i;function et(o,e=!0){return o.replace(Je,t=>_e(t.toLowerCase(),e))}function ct(o,e){const t=[];if(o){const i=o.split(",");for(let r=0;r<i.length;r++)xe(i[r],"video")||t.push(i[r])}return e&&t.push(e),t.join(",")}function gt(o,e){if(o&&(o.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(o)!==-1)&&(It(o,"audio")||It(o,"video")))return o;if(e){const t=e.split(",");if(t.length>1){if(o){for(let i=t.length;i--;)if(t[i].substring(0,4)===o.substring(0,4))return t[i]}return t[0]}}return e||o}function It(o,e){return xe(o,e)&&ye(o,e)}function Yt(o){const e=o.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function Nt(o){if(o.startsWith("av01.")){const e=o.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return o}function Lt(o){const e=Y(o)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function oi(o){return o.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const di={supported:!0,powerEfficient:!0,smooth:!0},ri={supported:!1,smooth:!1,powerEfficient:!1},ni={supported:!0,configurations:[],decodingInfoResults:[di]};function tt(o,e){return{supported:!1,configurations:e,decodingInfoResults:[ri],error:o}}function Ge(o,e,t,i,r,n){const a=o.videoCodec,u=o.audioCodec?o.audioGroups:null,g=n==null?void 0:n.audioCodec,p=n==null?void 0:n.channels,m=p?parseInt(p):g?1/0:2;let S=null;if(u!=null&&u.length)try{u.length===1&&u[0]?S=e.groups[u[0]].channels:S=u.reduce((R,H)=>{if(H){const j=e.groups[H];if(!j)throw new Error(`Audio track group ${H} not found`);Object.keys(j.channels).forEach(Q=>{R[Q]=(R[Q]||0)+j.channels[Q]})}return R},{2:0})}catch(R){return!0}return a!==void 0&&(a.split(",").some(R=>Ae(R))||o.width>1920&&o.height>1088||o.height>1920&&o.width>1088||o.frameRate>Math.max(i,30)||o.videoRange!=="SDR"&&o.videoRange!==t||o.bitrate>Math.max(r,8e6))||!!S&&I(m)&&Object.keys(S).some(R=>parseInt(R)>m)}function pt(o,e,t,i={}){const r=o.videoCodec;if(!r&&!o.audioCodec||!t)return Promise.resolve(ni);const n=[],a=Mt(o),u=a.length,g=Vt(o,e,u>0),p=g.length;for(let m=u||1*p||1;m--;){const S={type:"media-source"};if(u&&(S.video=a[m%u]),p){S.audio=g[m%p];const R=S.audio.bitrate;S.video&&R&&(S.video.bitrate-=R)}n.push(S)}if(r){const m=navigator.userAgent;if(r.split(",").some(S=>Ae(S))&&nt())return Promise.resolve(tt(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${m})`),n))}return Promise.all(n.map(m=>{const S=mi(m);return i[S]||(i[S]=t.decodingInfo(m))})).then(m=>({supported:!m.some(S=>!S.supported),configurations:n,decodingInfoResults:m})).catch(m=>({supported:!1,configurations:n,decodingInfoResults:[],error:m}))}function Mt(o){var e;const t=(e=o.videoCodec)==null?void 0:e.split(","),i=Ci(o),r=o.width||640,n=o.height||480,a=o.frameRate||30,u=o.videoRange.toLowerCase();return t?t.map(g=>{const p={contentType:ee(Nt(g),"video"),width:r,height:n,bitrate:i,framerate:a};return u!=="sdr"&&(p.transferFunction=u),p}):[]}function Vt(o,e,t){var i;const r=(i=o.audioCodec)==null?void 0:i.split(","),n=Ci(o);return r&&o.audioGroups?o.audioGroups.reduce((a,u)=>{var g;const p=u?(g=e.groups[u])==null?void 0:g.tracks:null;return p?p.reduce((m,S)=>{if(S.groupId===u){const R=parseFloat(S.channels||"");r.forEach(H=>{const j={contentType:ee(H,"audio"),bitrate:t?Jt(H,n):n};R&&(j.channels=""+R),m.push(j)})}return m},a):a},[]):[]}function Jt(o,e){if(e<=1)return 1;let t=128e3;return o==="ec-3"?t=768e3:o==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Ci(o){return Math.ceil(Math.max(o.bitrate*.9,o.averageBitrate)/1e3)*1e3||1}function mi(o){let e="";const{audio:t,video:i}=o;if(i){const r=oi(i.contentType);e+=`${r}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const r=oi(t.contentType);e+=`${i?"_":""}${r}_c${t.channels}`}return e}const li=["NONE","TYPE-0","TYPE-1",null];function Si(o){return li.indexOf(o)>-1}const Ht=["SDR","PQ","HLG"];function Fi(o){return!!o&&Ht.indexOf(o)>-1}var ei={No:"",Yes:"YES",v2:"v2"};function or(o){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=o,r=i<e/2;return e&&r?t?ei.v2:ei.Yes:ei.No}class zt{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class $t{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Xt(this._audioGroups,e)}hasSubtitleGroup(e){return Xt(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Xt(o,e){return!e||!o?!1:o.indexOf(e)!==-1}function gi(){if(typeof matchMedia=="function"){const o=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(o.media!==e.media)return o.matches===!0}return!1}function ui(o,e){let t=!1,i=[];if(o&&(t=o!=="SDR",i=[o]),e){i=e.allowedVideoRanges||Ht.slice(0);const r=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&gi(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const bi=o=>{const e=new WeakSet;return(t,i)=>{if(o&&(i=o(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},jt=(o,e)=>JSON.stringify(o,bi(e));function ji(o,e,t,i,r){const n=Object.keys(o),a=i==null?void 0:i.channels,u=i==null?void 0:i.audioCodec,g=r==null?void 0:r.videoCodec,p=a&&parseInt(a)===2;let m=!1,S=!1,R=1/0,H=1/0,j=1/0,Q=1/0,X=0,re=[];const{preferHDR:ae,allowedVideoRanges:oe}=ui(e,r);for(let Pe=n.length;Pe--;){const Ie=o[n[Pe]];m||(m=Ie.channels[2]>0),R=Math.min(R,Ie.minHeight),H=Math.min(H,Ie.minFramerate),j=Math.min(j,Ie.minBitrate),oe.filter(Ye=>Ie.videoRanges[Ye]>0).length>0&&(S=!0)}R=I(R)?R:0,H=I(H)?H:0;const de=Math.max(1080,R),Se=Math.max(30,H);j=I(j)?j:t,t=Math.max(j,t),S||(e=void 0);const Ne=n.length>1;return{codecSet:n.reduce((Pe,Ie)=>{const Ce=o[Ie];if(Ie===Pe)return Pe;if(re=S?oe.filter(Ye=>Ce.videoRanges[Ye]>0):[],Ne){if(Ce.minBitrate>t)return wi(Ie,`min bitrate of ${Ce.minBitrate} > current estimate of ${t}`),Pe;if(!Ce.hasDefaultAudio)return wi(Ie,"no renditions with default or auto-select sound found"),Pe;if(u&&Ie.indexOf(u.substring(0,4))%5!==0)return wi(Ie,`audio codec preference "${u}" not found`),Pe;if(a&&!p){if(!Ce.channels[a])return wi(Ie,`no renditions with ${a} channel sound found (channels options: ${Object.keys(Ce.channels)})`),Pe}else if((!u||p)&&m&&Ce.channels[2]===0)return wi(Ie,"no renditions with stereo sound found"),Pe;if(Ce.minHeight>de)return wi(Ie,`min resolution of ${Ce.minHeight} > maximum of ${de}`),Pe;if(Ce.minFramerate>Se)return wi(Ie,`min framerate of ${Ce.minFramerate} > maximum of ${Se}`),Pe;if(!re.some(Ye=>Ce.videoRanges[Ye]>0))return wi(Ie,`no variants with VIDEO-RANGE of ${jt(re)} found`),Pe;if(g&&Ie.indexOf(g.substring(0,4))%5!==0)return wi(Ie,`video codec preference "${g}" not found`),Pe;if(Ce.maxScore<X)return wi(Ie,`max score of ${Ce.maxScore} < selected max of ${X}`),Pe}return Pe&&(le(Ie)>=le(Pe)||Ce.fragmentError>o[Pe].fragmentError)?Pe:(Q=Ce.minIndex,X=Ce.maxScore,Ie)},void 0),videoRanges:re,preferHDR:ae,minFramerate:H,minBitrate:j,minIndex:Q}}function wi(o,e){M.log(`[abr] start candidates with "${o}" ignored because ${e}`)}function Ti(o){return o.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function lr(o,e,t,i){return o.slice(t,i+1).reduce((r,n,a)=>{if(!n.codecSet)return r;const u=n.audioGroups;let g=r[n.codecSet];g||(r[n.codecSet]=g={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!u,fragmentError:0}),g.minBitrate=Math.min(g.minBitrate,n.bitrate);const p=Math.min(n.height,n.width);return g.minHeight=Math.min(g.minHeight,p),g.minFramerate=Math.min(g.minFramerate,n.frameRate),g.minIndex=Math.min(g.minIndex,a),g.maxScore=Math.max(g.maxScore,n.score),g.fragmentError+=n.fragmentError,g.videoRanges[n.videoRange]=(g.videoRanges[n.videoRange]||0)+1,u&&u.forEach(m=>{if(!m)return;const S=e.groups[m];S&&(g.hasDefaultAudio=g.hasDefaultAudio||e.hasDefaultAudio?S.hasDefault:S.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(S.channels).forEach(R=>{g.channels[R]=(g.channels[R]||0)+S.channels[R]}))}),r},{})}function ln(o){if(!o)return o;const{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:n}=o;return{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:n}}function Mi(o,e,t){if("attrs"in o){const i=e.indexOf(o);if(i!==-1)return i}for(let i=0;i<e.length;i++){const r=e[i];if(Vi(o,r,t))return i}return-1}function Vi(o,e,t){const{groupId:i,name:r,lang:n,assocLang:a,default:u}=o,g=o.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(n===void 0||Ln(n,e.lang))&&(n===void 0||e.assocLang===a)&&(u===void 0||e.default===u)&&(g===void 0||e.forced===g)&&(!("characteristics"in o)||un(o.characteristics||"",e.characteristics))&&(t===void 0||t(o,e))}function Ln(o,e="--"){return o.length===e.length?o===e:o.startsWith(e)||e.startsWith(o)}function un(o,e=""){const t=o.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function xi(o,e){const{audioCodec:t,channels:i}=o;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function Di(o,e,t,i,r){const n=e[i],u=e.reduce((R,H,j)=>{const Q=H.uri;return(R[Q]||(R[Q]=[])).push(j),R},{})[n.uri];u.length>1&&(i=Math.max.apply(Math,u));const g=n.videoRange,p=n.frameRate,m=n.codecSet.substring(0,4),S=vi(e,i,R=>{if(R.videoRange!==g||R.frameRate!==p||R.codecSet.substring(0,4)!==m)return!1;const H=R.audioGroups,j=t.filter(Q=>!H||H.indexOf(Q.groupId)!==-1);return Mi(o,j,r)>-1});return S>-1?S:vi(e,i,R=>{const H=R.audioGroups,j=t.filter(Q=>!H||H.indexOf(Q.groupId)!==-1);return Mi(o,j,r)>-1})}function vi(o,e,t){for(let i=e;i>-1;i--)if(t(o[i]))return i;for(let i=e+1;i<o.length;i++)if(t(o[i]))return i;return-1}function yr(o,e){var t;return!!o&&o!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Bi extends T{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 i;const{fragCurrent:r,partCurrent:n,hls:a}=this,{autoLevelEnabled:u,media:g}=a;if(!r||!g)return;const p=performance.now(),m=n?n.stats:r.stats,S=n?n.duration:r.duration,R=p-m.loading.start,H=a.minAutoLevel,j=r.level,Q=this._nextAutoLevel;if(m.aborted||m.loaded&&m.loaded===m.total||j<=H){this.clearTimer(),this._nextAutoLevel=-1;return}if(!u)return;const X=Q>-1&&Q!==j,re=!!t||X;if(!re&&(g.paused||!g.playbackRate||!g.readyState))return;const ae=a.mainForwardBufferInfo;if(!re&&ae===null)return;const oe=this.bwEstimator.getEstimateTTFB(),de=Math.abs(g.playbackRate);if(R<=Math.max(oe,1e3*(S/(de*2))))return;const Se=ae?ae.len/de:0,Ne=m.loading.first?m.loading.first-m.loading.start:-1,we=m.loaded&&Ne>-1,Pe=this.getBwEstimate(),Ie=a.levels,Ce=Ie[j],Ye=Math.max(m.loaded,Math.round(S*(r.bitrate||Ce.averageBitrate)/8));let _t=we?R-Ne:R;_t<1&&we&&(_t=Math.min(R,m.loaded*8/Pe));const xt=we?m.loaded*1e3/_t:0,Rt=oe/1e3,At=xt?(Ye-m.loaded)/xt:Ye*8/Pe+Rt;if(At<=Se)return;const ot=xt?xt*8:Pe,Ct=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,vt=this.hls.config.abrBandWidthUpFactor;let Dt=Number.POSITIVE_INFINITY,Ft;for(Ft=j-1;Ft>H;Ft--){const Qt=Ie[Ft].maxBitrate,Gt=!Ie[Ft].details||Ct;if(Dt=this.getTimeToLoadFrag(Rt,ot,S*Qt,Gt),Dt<Math.min(Se,S+Rt))break}if(Dt>=At||Dt>S*10)return;we?this.bwEstimator.sample(R-Math.min(oe,Ne),m.loaded):this.bwEstimator.sampleTTFB(R);const ft=Ie[Ft].maxBitrate;this.getBwEstimate()*vt>ft&&this.resetEstimator(ft);const dt=this.findBestLevel(ft,H,Ft,0,Se,1,1);dt>-1&&(Ft=dt),this.warn(`Fragment ${r.sn}${n?" part "+n.index:""} of level ${j} is loading too slowly;
|
|
|
Fragment duration: ${r.duration.toFixed(3)}
|
|
|
Time to underbuffer: ${Se.toFixed(3)} s
|
|
|
Estimated load time for current fragment: ${At.toFixed(3)} s
|
|
|
Estimated load time for down switch fragment: ${Dt.toFixed(3)} s
|
|
|
TTFB estimate: ${Ne|0} ms
|
|
|
Current BW estimate: ${I(Pe)?Pe|0:"Unknown"} bps
|
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
|
Switching to level ${Ft} @ ${ft|0} bps`),a.nextLoadLevel=a.nextAutoLevel=Ft,this.clearTimer();const Wt=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===Ft&&Ft>0){const Qt=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Ft>0?"and switching down":""}
|
|
|
Fragment duration: ${r.duration.toFixed(3)} s
|
|
|
Time to underbuffer: ${Qt.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,Ft>H){let Gt=this.findBestLevel(this.hls.levels[H].bitrate,H,Ft,0,Qt,1,1);Gt===-1&&(Gt=H),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Gt,this.resetEstimator(this.hls.levels[Gt].bitrate)}}};X||At>Dt*2?Wt():this.timer=self.setInterval(Wt,Dt*1e3),a.trigger(_.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:n,stats:m})},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 y(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(_.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 i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=(r=t.part)!=null?r: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 w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case w.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:r,partCurrent:n}=this;if(i&&r&&i.sn===r.sn&&i.level===r.level){const a=performance.now(),u=n?n.stats:i.stats,g=a-u.loading.start,p=u.loading.first?u.loading.first-u.loading.start:-1;if(u.loaded&&p>-1){const S=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(g-Math.min(S,p),u.loaded)}else this.bwEstimator.sampleTTFB(g)}break}}}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,a=r?e+this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,n=r.end-r.first;I(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===v.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,a=this.hls.levels[t.level],u=(a.loaded?a.loaded.bytes:0)+r.loaded,g=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:u,duration:g},a.realBitrate=Math.round(8*u/g)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(_.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==v.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,r,1,1);if(n>-1)return n;const a=this.hls.firstLevel,u=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${u}`),u}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=i&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:r,config:n,minAutoLevel:a}=i,u=t?t.duration:e?e.duration:0,g=this.getBwEstimate(),p=this.getStarvationDelay();let m=n.abrBandWidthFactor,S=n.abrBandWidthUpFactor;if(p){const X=this.findBestLevel(g,a,r,p,0,m,S);if(X>=0)return this.rebufferNotice=-1,X}let R=u?Math.min(u,n.maxStarvationDelay):n.maxStarvationDelay;if(!p){const X=this.bitrateTestDelay;X&&(R=(u?Math.min(u,n.maxLoadingDelay):n.maxLoadingDelay)-X,this.info(`bitrate test took ${Math.round(1e3*X)}ms, set first fragment max fetchDuration to ${Math.round(1e3*R)} ms`),m=S=1)}const H=this.findBestLevel(g,a,r,p,R,m,S);if(this.rebufferNotice!==H&&(this.rebufferNotice=H,this.info(`${p?"rebuffering expected":"buffer is empty"}, optimal quality level ${H}`)),H>-1)return H;const j=i.levels[a],Q=i.loadLevelObj;return Q&&(j==null?void 0:j.bitrate)<Q.bitrate?a:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,n,a,u){var g;const p=r+n,m=this.lastLoadedFragLevel,S=m===-1?this.hls.firstLevel:m,{fragCurrent:R,partCurrent:H}=this,{levels:j,allAudioTracks:Q,loadLevel:X,config:re}=this.hls;if(j.length===1)return 0;const ae=j[S],oe=!!((g=this.hls.latestLevelDetails)!=null&&g.live),de=X===-1||m===-1;let Se,Ne="SDR",we=(ae==null?void 0:ae.frameRate)||0;const{audioPreference:Pe,videoPreference:Ie}=re,Ce=this.audioTracksByGroup||(this.audioTracksByGroup=Ti(Q));let Ye=-1;if(de){if(this.firstSelection!==-1)return this.firstSelection;const ot=this.codecTiers||(this.codecTiers=lr(j,Ce,t,i)),Ct=ji(ot,Ne,e,Pe,Ie),{codecSet:vt,videoRanges:Dt,minFramerate:Ft,minBitrate:ft,minIndex:dt,preferHDR:Wt}=Ct;Ye=dt,Se=vt,Ne=Wt?Dt[Dt.length-1]:Dt[0],we=Ft,e=Math.max(e,ft),this.log(`picked start tier ${jt(Ct)}`)}else Se=ae==null?void 0:ae.codecSet,Ne=ae==null?void 0:ae.videoRange;const _t=H?H.duration:R?R.duration:0,xt=this.bwEstimator.getEstimateTTFB()/1e3,Rt=[];for(let ot=i;ot>=t;ot--){var At;const Ct=j[ot],vt=ot>S;if(!Ct)continue;if(re.useMediaCapabilities&&!Ct.supportedResult&&!Ct.supportedPromise){const Gt=navigator.mediaCapabilities;typeof(Gt==null?void 0:Gt.decodingInfo)=="function"&&Ge(Ct,Ce,Ne,we,e,Pe)?(Ct.supportedPromise=pt(Ct,Ce,Gt,this.supportedCache),Ct.supportedPromise.then(qt=>{if(!this.hls)return;Ct.supportedResult=qt;const Li=this.hls.levels,Ai=Li.indexOf(Ct);qt.error?this.warn(`MediaCapabilities decodingInfo error: "${qt.error}" for level ${Ai} ${jt(qt)}`):qt.supported?qt.decodingInfoResults.some(Ji=>Ji.smooth===!1||Ji.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Ai} not smooth or powerEfficient: ${jt(qt)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Ai} ${jt(qt)}`),Ai>-1&&Li.length>1&&(this.log(`Removing unsupported level ${Ai}`),this.hls.removeLevel(Ai),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(qt=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${qt}`)})):Ct.supportedResult=ni}if((Se&&Ct.codecSet!==Se||Ne&&Ct.videoRange!==Ne||vt&&we>Ct.frameRate||!vt&&we>0&&we<Ct.frameRate||(At=Ct.supportedResult)!=null&&(At=At.decodingInfoResults)!=null&&At.some(Gt=>Gt.smooth===!1))&&(!de||ot!==Ye)){Rt.push(ot);continue}const Dt=Ct.details,Ft=(H?Dt==null?void 0:Dt.partTarget:Dt==null?void 0:Dt.averagetargetduration)||_t;let ft;vt?ft=u*e:ft=a*e;const dt=_t&&r>=_t*2&&n===0?Ct.averageBitrate:Ct.maxBitrate,Wt=this.getTimeToLoadFrag(xt,ft,dt*Ft,Dt===void 0);if(ft>=dt&&(ot===m||Ct.loadError===0&&Ct.fragmentError===0)&&(Wt<=xt||!I(Wt)||oe&&!this.bitrateTestDelay||Wt<p)){const Gt=this.forcedAutoLevel;return ot!==X&&(Gt===-1||Gt!==X)&&(Rt.length&&this.trace(`Skipped level(s) ${Rt.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${j[Rt[0]].codecs}" ${j[Rt[0]].videoRange}; not compatible with "${Se}" ${Ne}`),this.info(`switch candidate:${S}->${ot} adjustedbw(${Math.round(ft)})-bitrate=${Math.round(ft-dt)} ttfb:${xt.toFixed(1)} avgDuration:${Ft.toFixed(1)} maxFetchDuration:${p.toFixed(1)} fetchDuration:${Wt.toFixed(1)} firstSelection:${de} codecSet:${Ct.codecSet} videoRange:${Ct.videoRange} hls.loadLevel:${X}`)),de&&(this.firstSelection=ot),ot}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const ii={search:function(o,e){let t=0,i=o.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=o[r];const a=e(n);if(a>0)t=r+1;else if(a<0)i=r-1;else return n}return null}};function hi(o,e,t){if(e===null||!Array.isArray(o)||!o.length||!I(e))return null;const i=o[0].programDateTime;if(e<(i||0))return null;const r=o[o.length-1].endProgramDateTime;if(e>=(r||0))return null;for(let n=0;n<o.length;++n){const a=o[n];if(cn(e,t,a))return a}return null}function yi(o,e,t=0,i=0,r=.005){let n=null;if(o){n=e[1+o.sn-e[0].sn]||null;const u=o.endDTS-t;u>0&&u<15e-7&&(t+=15e-7),n&&o.level!==n.level&&n.end<=o.end&&(n=e[2+o.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!o||o.level===n.level)&&ki(t,i,n)===0||br(n,o,Math.min(r,i))))return n;const a=ii.search(e,ki.bind(null,t,i));return a&&(a!==o||!n)?a:n}function br(o,e,t){if(e&&e.start===0&&e.level<o.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((r,n)=>(n[0]==="INF"&&(r+=parseFloat(n[1])),r),t);return o.start<=i}return!1}function ki(o=0,e=0,t){if(t.start<=o&&t.start+t.duration>o)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=o?1:t.start-i>o&&t.start?-1:0}function cn(o,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>o}function Ir(o,e,t){if(o&&o.startCC<=e&&o.endCC>=e){let i=o.fragments;const{fragmentHint:r}=o;r&&(i=i.concat(r));let n;return ii.search(i,a=>a.cc<e?1:a.cc>e?-1:(n=a,a.end<=t?1:a.start>t?-1:0)),n||null}return null}function qi(o){switch(o.details){case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_TIMEOUT:case w.LEVEL_LOAD_TIMEOUT:case w.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function ur(o){return o.details.startsWith("key")}function hn(o){return ur(o)&&!!o.frag&&!o.frag.decryptdata}function Kr(o,e){const t=qi(e);return o.default[`${t?"timeout":"error"}Retry`]}function cr(o,e){const t=o.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*o.retryDelayMs,o.maxRetryDelayMs)}function Pr(o){return h(h({},o),{errorRetry:null,timeoutRetry:null})}function Er(o,e,t,i){if(!o)return!1;const r=i==null?void 0:i.code,n=e<o.maxNumRetry&&(hr(r)||!!t);return o.shouldRetry?o.shouldRetry(o,e,t,i,n):n}function hr(o){return Yi(o)||!!o&&(o<400||o>499)}function Yi(o){return o===0&&navigator.onLine===!1}var ci={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},fi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class fn extends T{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(_.ERROR,this.onError,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.ERROR,this.onError,this),e.off(_.ERROR,this.onErrorOut,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.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)===v.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||i===-1?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if((i=e.details)!=null&&i.hasKey(t))return!0;const r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(a=>r.indexOf(a.groupId)>=0).some(a=>{var u;return(u=a.details)==null?void 0:u.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const r=this.hls,n=t.context;switch(t.details){case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case w.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=_i();return}case w.FRAG_GAP:case w.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ci.SendAlternateToPenaltyBox;return}case w.LEVEL_EMPTY_ERROR:case w.LEVEL_PARSING_ERROR:{var a;const g=t.parent===v.MAIN?t.level:r.loadLevel;t.details===w.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,g):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,g))}return;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:typeof(n==null?void 0:n.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.SUBTITLE_LOAD_ERROR:case w.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const g=r.loadLevelObj;if(g&&(n.type===F.AUDIO_TRACK&&g.hasAudioGroup(n.groupId)||n.type===F.SUBTITLE_TRACK&&g.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=ci.SendAlternateToPenaltyBox,t.errorAction.flags=fi.MoveAllAlternatesMatchingHost;return}}return;case w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:ci.SendAlternateToPenaltyBox,flags:fi.MoveAllAlternatesMatchingHDCP};return;case w.KEY_SYSTEM_SESSION_UPDATE_FAILED:case w.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case w.KEY_SYSTEM_NO_SESSION:t.errorAction={action:ci.SendAlternateToPenaltyBox,flags:fi.MoveAllAlternatesMatchingKey};return;case w.BUFFER_ADD_CODEC_ERROR:case w.REMUX_ALLOC_ERROR:case w.BUFFER_APPEND_ERROR:if(!t.errorAction){var u;t.errorAction=this.getLevelSwitchAction(t,(u=t.level)!=null?u:r.loadLevel)}return;case w.INTERNAL_EXCEPTION:case w.BUFFER_APPENDING_ERROR:case w.BUFFER_FULL_ERROR:case w.LEVEL_SWITCH_ERROR:case w.BUFFER_STALLED_ERROR:case w.BUFFER_SEEK_OVER_HOLE:case w.BUFFER_NUDGE_ON_STALL:t.errorAction=_i();return}t.type===D.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=_i())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,r=Kr(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(Er(r,n,qi(e),e.response))return{action:ci.RetryRequest,flags:fi.None,retryConfig:r,retryCount:n};const u=this.getLevelSwitchAction(e,t);return r&&(u.retryConfig=r,u.retryCount=n),u}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,u=Kr(ur(e)?a:n,e),g=t.levels.reduce((m,S)=>m+S.fragmentError,0);if(r&&(e.details!==w.FRAG_GAP&&r.fragmentError++,!hn(e)&&Er(u,g,qi(e),e.response)))return{action:ci.RetryRequest,flags:fi.None,retryConfig:u,retryCount:g};const p=this.getLevelSwitchAction(e,i);return u&&(p.retryConfig=u,p.retryCount=g),p}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r){var n,a;const p=e.details;r.loadError++,p===w.BUFFER_APPEND_ERROR&&r.fragmentError++;let m=-1;const{levels:S,loadLevel:R,minAutoLevel:H,maxAutoLevel:j}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const Q=(n=e.frag)==null?void 0:n.type,re=(Q===v.AUDIO&&p===w.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(p===w.BUFFER_ADD_CODEC_ERROR||p===w.BUFFER_APPEND_ERROR))&&S.some(({audioCodec:Ne})=>r.audioCodec!==Ne),oe=e.sourceBufferName==="video"&&(p===w.BUFFER_ADD_CODEC_ERROR||p===w.BUFFER_APPEND_ERROR)&&S.some(({codecSet:Ne,audioCodec:we})=>r.codecSet!==Ne&&r.audioCodec===we),{type:de,groupId:Se}=(a=e.context)!=null?a:{};for(let Ne=S.length;Ne--;){const we=(Ne+R)%S.length;if(we!==R&&we>=H&&we<=j&&S[we].loadError===0){var u,g;const Pe=S[we];if(p===w.FRAG_GAP&&Q===v.MAIN&&e.frag){const Ie=S[we].details;if(Ie){const Ce=yi(e.frag,Ie.fragments,e.frag.start);if(Ce!=null&&Ce.gap)continue}}else{if(de===F.AUDIO_TRACK&&Pe.hasAudioGroup(Se)||de===F.SUBTITLE_TRACK&&Pe.hasSubtitleGroup(Se))continue;if(Q===v.AUDIO&&(u=r.audioGroups)!=null&&u.some(Ie=>Pe.hasAudioGroup(Ie))||Q===v.SUBTITLE&&(g=r.subtitleGroups)!=null&&g.some(Ie=>Pe.hasSubtitleGroup(Ie))||re&&r.audioCodec===Pe.audioCodec||oe&&r.codecSet===Pe.codecSet||!re&&r.codecSet!==Pe.codecSet)continue}m=we;break}}if(m>-1&&i.loadLevel!==m)return e.levelRetry=!0,this.playlistError=0,{action:ci.SendAlternateToPenaltyBox,flags:fi.None,nextAutoLevel:m}}return{action:ci.SendAlternateToPenaltyBox,flags:fi.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ci.DoNothing:break;case ci.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==w.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 ci.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r}=i,n=i.nextAutoLevel;switch(r){case fi.None:this.switchLevel(e,n);break;case fi.MoveAllAlternatesMatchingHDCP:{const g=this.getVariantLevelIndex(e.frag),p=t.levels[g],m=p==null?void 0:p.attrs["HDCP-LEVEL"];if(i.hdcpLevel=m,m==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(m){t.maxHdcpLevel=li[li.indexOf(m)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case fi.MoveAllAlternatesMatchingKey:{const g=e.decryptdata;if(g){const p=this.hls.levels,m=p.length;for(let R=m;R--;)if(this.variantHasKey(p[R],g)){var a,u;this.log(`Banned key found in level ${R} (${p[R].bitrate}bps) or audio group "${(a=p[R].audioGroups)==null?void 0:a.join(",")}" (${(u=e.frag)==null?void 0:u.type} fragment) ${J(g.keyId||[])}`),p[R].fragmentError++,p[R].loadError++,this.log(`Removing level ${R} with key error (${e.error})`),this.hls.removeLevel(R)}const S=e.frag;if(this.hls.levels.length<m)i.resolved=!0;else if(S&&S.type!==v.MAIN){const R=S.decryptdata;R&&!g.matches(R)&&(i.resolved=!0)}}break}}i.resolved||this.switchLevel(e,n)}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===w.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=oi(e.mimeType),r=this.hls.levels;for(let n=r.length;n--;)r[n][`${e.sourceBufferName}Codec`]===i&&(this.log(`Removing level ${n} for ${e.details} ("${i}" not supported)`),this.hls.removeLevel(n))}}}function _i(o){const e={action:ci.DoNothing,flags:fi.None};return o&&(e.resolved=!0),e}var si={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class dn{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.BUFFER_APPENDED,this.onBufferAppended,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.BUFFER_APPENDED,this.onBufferAppended,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];if(!n)break;if(n.start<=e&&e<=n.end&&n.loaded)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:r}=this,n=Object.keys(r);for(let a=n.length;a--;){const u=r[n[a]];if((u==null?void 0:u.body.type)===t&&(!i||u.buffered)){const g=u.body;if(g.start<=e&&e<=g.end)return g}}return null}detectEvictedFragments(e,t,i,r,n){this.timeRanges&&(this.timeRanges[e]=t);const a=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(u=>{const g=this.fragments[u];if(!g||a>=g.body.sn)return;if(!g.buffered&&(!g.loaded||n)){g.body.type===i&&this.removeFragment(g.body);return}const p=g.range[e];if(p){if(p.time.length===0){this.removeFragment(g.body);return}p.time.some(m=>{const S=!this.isTimeBuffered(m.startPTS,m.endPTS,t);return S&&this.removeFragment(g.body),S})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,r=Ni(i),n=this.fragments[r];if(!n||n.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(u=>{const g=i.elementaryStreams[u];if(!g)return;const p=t[u],m=a||g.partial===!0;n.range[u]=this.getBufferedTimes(i,e.part,m,p)}),n.loaded=null,Object.keys(n.range).length?(n.buffered=!0,(n.body.endList=i.endList||n.body.endList)&&(this.endListFragments[n.body.type]=n),Or(n)||this.removeParts(i.sn-1,i.type)):this.removeFragment(n.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=Wr(i,r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=Ni(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},a=e.start,u=e.end,g=e.minEndPTS||u,p=e.maxStartPTS||a;for(let m=0;m<r.length;m++){const S=r.start(m)-this.bufferPadding,R=r.end(m)+this.bufferPadding;if(p>=S&&g<=R){n.time.push({startPTS:Math.max(a,r.start(m)),endPTS:Math.min(u,r.end(m))});break}else if(a<R&&u>S){const H=Math.max(a,r.start(m)),j=Math.min(u,r.end(m));j>H&&(n.partial=!0,n.time.push({startPTS:H,endPTS:j}))}else if(u<=S)break}return n}getPartialFragment(e){let t=null,i,r,n,a=0;const{bufferPadding:u,fragments:g}=this;return Object.keys(g).forEach(p=>{const m=g[p];m&&Or(m)&&(r=m.body.start-u,n=m.body.end+u,e>=r&&e<=n&&(i=Math.min(e-r,n-e),a<=i&&(t=m.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Or(t))}getState(e){const t=Ni(e),i=this.fragments[t];return i?i.buffered?Or(i)?si.PARTIAL:si.OK:si.APPENDING:si.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let a=0;a<i.length;a++){if(r=i.start(a)-this.bufferPadding,n=i.end(a)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,r=t.part?null:t,n=Ni(i);this.fragments[n]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n,type:a}=t;if(i.sn==="initSegment")return;const u=i.type;if(r){let p=this.activePartLists[u];p||(this.activePartLists[u]=p=[]),p.push(r)}this.timeRanges=n;const g=n[a];this.detectEvictedFragments(a,g,u,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Ni(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let r=i.length;r--;){const n=t[i[r]];if((n==null?void 0:n.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const u=this.fragments[a];if(!u)return;const g=u.body;g.type!==i||r&&!g.gap||g.start<t&&g.end>e&&(u.buffered||n)&&this.removeFragment(g)})}removeFragment(e){const t=Ni(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=Wr(i,n=>n.fragment.sn!==r)}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(i=>i.clearElementaryStreamInfo())}}function Or(o){var e,t,i;return o.buffered&&!!(o.body.gap||(e=o.range.video)!=null&&e.partial||(t=o.range.audio)!=null&&t.partial||(i=o.range.audiovideo)!=null&&i.partial)}function Ni(o){return`${o.type}_${o.level}_${o.sn}`}function Wr(o,e){return o.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Zi={cbc:0,ctr:1};class pn{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Zi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Zi.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 _n(o){const e=o.byteLength,t=e&&new DataView(o.buffer).getUint8(e-1);return t?o.slice(0,e-t):o}class Sr{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],a=i[2],u=i[3],g=this.invSubMix,p=g[0],m=g[1],S=g[2],R=g[3],H=new Uint32Array(256);let j=0,Q=0,X=0;for(X=0;X<256;X++)X<128?H[X]=X<<1:H[X]=X<<1^283;for(X=0;X<256;X++){let re=Q^Q<<1^Q<<2^Q<<3^Q<<4;re=re>>>8^re&255^99,e[j]=re,t[re]=j;const ae=H[j],oe=H[ae],de=H[oe];let Se=H[re]*257^re*16843008;r[j]=Se<<24|Se>>>8,n[j]=Se<<16|Se>>>16,a[j]=Se<<8|Se>>>24,u[j]=Se,Se=de*16843009^oe*65537^ae*257^j*16843008,p[re]=Se<<24|Se>>>8,m[re]=Se<<16|Se>>>16,S[re]=Se<<8|Se>>>24,R[re]=Se,j?(j=ae^H[H[H[de^ae]]],Q^=H[H[Q]]):j=Q=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const a=this.ksRows=(n+6+1)*4;let u,g;const p=this.keySchedule=new Uint32Array(a),m=this.invKeySchedule=new Uint32Array(a),S=this.sBox,R=this.rcon,H=this.invSubMix,j=H[0],Q=H[1],X=H[2],re=H[3];let ae,oe;for(u=0;u<a;u++){if(u<n){ae=p[u]=t[u];continue}oe=ae,u%n===0?(oe=oe<<8|oe>>>24,oe=S[oe>>>24]<<24|S[oe>>>16&255]<<16|S[oe>>>8&255]<<8|S[oe&255],oe^=R[u/n|0]<<24):n>6&&u%n===4&&(oe=S[oe>>>24]<<24|S[oe>>>16&255]<<16|S[oe>>>8&255]<<8|S[oe&255]),p[u]=ae=(p[u-n]^oe)>>>0}for(g=0;g<a;g++)u=a-g,g&3?oe=p[u]:oe=p[u-4],g<4||u<=4?m[g]=oe:m[g]=j[S[oe>>>24]]^Q[S[oe>>>16&255]]^X[S[oe>>>8&255]]^re[S[oe&255]],m[g]=m[g]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,u=this.invSubMix,g=u[0],p=u[1],m=u[2],S=u[3],R=this.uint8ArrayToUint32Array_(i);let H=R[0],j=R[1],Q=R[2],X=R[3];const re=new Int32Array(e),ae=new Int32Array(re.length);let oe,de,Se,Ne,we,Pe,Ie,Ce,Ye,_t,xt,Rt,At,ot;const Ct=this.networkToHostOrderSwap;for(;t<re.length;){for(Ye=Ct(re[t]),_t=Ct(re[t+1]),xt=Ct(re[t+2]),Rt=Ct(re[t+3]),we=Ye^n[0],Pe=Rt^n[1],Ie=xt^n[2],Ce=_t^n[3],At=4,ot=1;ot<r;ot++)oe=g[we>>>24]^p[Pe>>16&255]^m[Ie>>8&255]^S[Ce&255]^n[At],de=g[Pe>>>24]^p[Ie>>16&255]^m[Ce>>8&255]^S[we&255]^n[At+1],Se=g[Ie>>>24]^p[Ce>>16&255]^m[we>>8&255]^S[Pe&255]^n[At+2],Ne=g[Ce>>>24]^p[we>>16&255]^m[Pe>>8&255]^S[Ie&255]^n[At+3],we=oe,Pe=de,Ie=Se,Ce=Ne,At=At+4;oe=a[we>>>24]<<24^a[Pe>>16&255]<<16^a[Ie>>8&255]<<8^a[Ce&255]^n[At],de=a[Pe>>>24]<<24^a[Ie>>16&255]<<16^a[Ce>>8&255]<<8^a[we&255]^n[At+1],Se=a[Ie>>>24]<<24^a[Ce>>16&255]<<16^a[we>>8&255]<<8^a[Pe&255]^n[At+2],Ne=a[Ce>>>24]<<24^a[we>>16&255]<<16^a[Pe>>8&255]<<8^a[Ie&255]^n[At+3],ae[t]=Ct(oe^H),ae[t+1]=Ct(Ne^j),ae[t+2]=Ct(Se^Q),ae[t+3]=Ct(de^X),H=Ye,j=_t,Q=xt,X=Rt,t=t+4}return ae.buffer}}class wr{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=Gr(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Gr(o){switch(o){case Zi.cbc:return"AES-CBC";case Zi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${o}`)}}const xr=16;class Ar{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(i){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?_n(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,r){return this.useSoftware?new Promise((n,a)=>{const u=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(u,t,i,r);const g=this.flush();g?n(g.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,r)}softwareDecrypt(e,t,i,r){const{currentIV:n,currentResult:a,remainderData:u}=this;if(r!==Zi.cbc||t.byteLength!==16)return M.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),u&&(e=st(u,e),this.remainderData=null);const g=this.getValidChunk(e);if(!g.length)return null;n&&(i=n);let p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new Sr),p.expandKey(t);const m=a;return this.currentResult=p.decrypt(g.buffer,0,i),this.currentIV=g.slice(-16).buffer,m||null}webCryptoDecrypt(e,t,i,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,r));this.key=t,this.fastAesKey=new wr(this.subtle,t,r)}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new pn(this.subtle,new Uint8Array(i),r).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(M.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i,r)))}onWebCryptoError(e,t,i,r){const n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,r);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%xr;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(M.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Cr=Math.pow(2,17);class Ki{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new Ii({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((u,g)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(j=>j[0]==="GAP")){g(ir(e));return}else e.gap=!1;const p=this.loader=n?new n(r):new a(r),m=tr(e);e.loader=p;const S=Pr(r.fragLoadPolicy.default),R={loadPolicy:S,timeout:S.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Cr};e.stats=p.stats;const H={onSuccess:(j,Q,X,re)=>{this.resetLoader(e,p);let ae=j.data;X.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ae.slice(0,16)),ae=ae.slice(16)),u({frag:e,part:null,payload:ae,networkDetails:re})},onError:(j,Q,X,re)=>{this.resetLoader(e,p),g(new Ii({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:h({url:i,data:void 0},j),error:new Error(`HTTP Error ${j.code} ${j.text}`),networkDetails:X,stats:re}))},onAbort:(j,Q,X)=>{this.resetLoader(e,p),g(new Ii({type:D.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:X,stats:j}))},onTimeout:(j,Q,X)=>{this.resetLoader(e,p),g(new Ii({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${R.timeout}ms`),networkDetails:X,stats:j}))}};t&&(H.onProgress=(j,Q,X,re)=>t({frag:e,part:null,payload:X,networkDetails:re})),p.load(m,R,H)})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((u,g)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){g(ir(e,t));return}const p=this.loader=n?new n(r):new a(r),m=tr(e,t);e.loader=p;const S=Pr(r.fragLoadPolicy.default),R={loadPolicy:S,timeout:S.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Cr};t.stats=p.stats,p.load(m,R,{onSuccess:(H,j,Q,X)=>{this.resetLoader(e,p),this.updateStatsFromPart(e,t);const re={frag:e,part:t,payload:H.data,networkDetails:X};i(re),u(re)},onError:(H,j,Q,X)=>{this.resetLoader(e,p),g(new Ii({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:h({url:m.url,data:void 0},H),error:new Error(`HTTP Error ${H.code} ${H.text}`),networkDetails:Q,stats:X}))},onAbort:(H,j,Q)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,p),g(new Ii({type:D.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:Q,stats:H}))},onTimeout:(H,j,Q)=>{this.resetLoader(e,p),g(new Ii({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${R.timeout}ms`),networkDetails:Q,stats:H}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const g=Math.round(e.duration/t.duration),p=Math.min(Math.round(i.loaded/n),g),S=(g-p)*Math.round(i.loaded/p);i.total=i.loaded+S}else i.total=Math.max(i.loaded,i.total);const a=i.loading,u=r.loading;a.start?a.first+=u.first-u.start:(a.start=u.start,a.first=u.first),a.end=u.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function tr(o,e=null){const t=e||o,i={frag:o,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(I(r)&&I(n)){var a;let u=r,g=n;if(o.sn==="initSegment"&&fr((a=o.decryptdata)==null?void 0:a.method)){const p=n-r;p%16&&(g=n+(16-p%16)),r!==0&&(i.resetIV=!0,u=r-16)}i.rangeStart=u,i.rangeEnd=g}return i}function ir(o,e){const t=new Error(`GAP ${o.gap?"tag":"attribute"} found`),i={type:D.MEDIA_ERROR,details:w.FRAG_GAP,fatal:!1,frag:o,error:t,networkDetails:null};return e&&(i.part=e),(e||o).stats.aborted=!0,new Ii(i)}function fr(o){return o==="AES-128"||o==="AES-256"}class Ii extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class gn extends T{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 Fr{constructor(e,t,i,r=0,n=-1,a=!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=Tr(),this.buffering={audio:Tr(),video:Tr(),audiovideo:Tr()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=a}}function Tr(){return{start:0,executeStart:0,executeEnd:0,end:0}}const zr={length:0,start:()=>0,end:()=>0};class Ot{static isBuffered(e,t){if(e){const i=Ot.getBuffered(e);for(let r=i.length;r--;)if(t>=i.start(r)&&t<=i.end(r))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 i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const r=Ot.bufferedRanges(e);if(r.length)return Ot.bufferedInfo(r,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((m,S)=>m.start-S.start||S.end-m.end);let r=-1,n=[];if(i)for(let m=0;m<e.length;m++){t>=e[m].start&&t<=e[m].end&&(r=m);const S=n.length;if(S){const R=n[S-1].end;e[m].start-R<i?e[m].end>R&&(n[S-1].end=e[m].end):n.push(e[m])}else n.push(e[m])}else n=e;let a=0,u,g=t,p=t;for(let m=0;m<n.length;m++){const S=n[m].start,R=n[m].end;if(r===-1&&t>=S&&t<=R&&(r=m),t+i>=S&&t<R)g=S,p=R,a=p-t;else if(t+i<S){u=S;break}}return{len:a,start:g||0,end:p||0,nextStart:u,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||zr}catch(t){return M.log("failed to get media.buffered",t),zr}}}const mn=/\{\$([a-zA-Z0-9-_]+)\}/g;function Vr(o){return mn.test(o)}function qr(o,e){if(o.variableList!==null||o.hasVariableRefs){const t=o.variableList;return e.replace(mn,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(o.playlistParsingError||(o.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function vn(o,e,t){let i=o.variableList;i||(o.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(r))n=a.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(a){o.playlistParsingError||(o.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else r=e.NAME,n=e.VALUE;r in i?o.playlistParsingError||(o.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function yn(o,e,t){const i=e.IMPORT;if(t&&i in t){let r=o.variableList;r||(o.variableList=r={}),r[i]=t[i]}else o.playlistParsingError||(o.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const Rn=/^(\d+)x(\d+)$/,bn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ai{constructor(e,t){typeof e=="string"&&(e=ai.parseAttrList(e,t)),c(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((r,n)=>(r[n.toLowerCase()]=!0,r),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Rn.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const r={},n='"';for(bn.lastIndex=0;(i=bn.exec(e))!==null;){const a=i[1].trim();let u=i[2];const g=u.indexOf(n)===0&&u.lastIndexOf(n)===u.length-1;let p=!1;if(g)u=u.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":p=!0}if(t&&(g||p))u=qr(t,u);else if(!p&&!g)switch(a){case"CLOSED-CAPTIONS":if(u==="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":M.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=u}return r}}const Xi="com.apple.hls.interstitial";function Yr(o){return o!=="ID"&&o!=="CLASS"&&o!=="CUE"&&o!=="START-DATE"&&o!=="DURATION"&&o!=="END-DATE"&&o!=="END-ON-NEXT"}function kn(o){return o==="SCTE35-OUT"||o==="SCTE35-IN"||o==="SCTE35-CMD"}class Pi{constructor(e,t,i=0){var r;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=(r=t==null?void 0:t.tagOrder)!=null?r:i,t){const n=t.attr;for(const a in n)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==n[a]){M.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=c(new ai({}),n,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 n=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);I(n.getTime())&&(this._endDate=n)}}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?(M.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(I(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===Xi}get isValid(){return!!this.id&&!this._badValueForSameId&&I(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 Mr=10;class Zr{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return this.fragments.length?I(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Mr}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 i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Ui(o,e){return o.length===e.length?!o.some((t,i)=>t!==e[i]):!1}function rr(o,e){return!o&&!e?!0:!o||!e?!1:Ui(o,e)}function Qi(o){return o==="AES-128"||o==="AES-256"||o==="AES-256-CTR"}function Br(o){switch(o){case"AES-128":case"AES-256":return Zi.cbc;case"AES-256-CTR":return Zi.ctr;default:throw new Error(`invalid full segment method ${o}`)}}function Xr(o){return Uint8Array.from(atob(o),e=>e.charCodeAt(0))}function Qr(o){return Uint8Array.from(unescape(encodeURIComponent(o)),e=>e.charCodeAt(0))}function In(o){const e=Qr(o).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function wt(o){const e=function(i,r,n){const a=i[r];i[r]=i[n],i[n]=a};e(o,0,3),e(o,1,2),e(o,4,5),e(o,6,7)}function Pt(o){const e=o.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",a=r[1];n?(i.splice(-1,1),t=Xr(a)):t=In(a)}}return t}const ti=typeof self!="undefined"?self:void 0;var Ut={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Kt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Dr(o){switch(o){case Kt.FAIRPLAY:return Ut.FAIRPLAY;case Kt.PLAYREADY:return Ut.PLAYREADY;case Kt.WIDEVINE:return Ut.WIDEVINE;case Kt.CLEARKEY:return Ut.CLEARKEY}}function Jr(o){switch(o){case Ut.FAIRPLAY:return Kt.FAIRPLAY;case Ut.PLAYREADY:return Kt.PLAYREADY;case Ut.WIDEVINE:return Kt.WIDEVINE;case Ut.CLEARKEY:return Kt.CLEARKEY}}function Nr(o){const{drmSystems:e,widevineLicenseUrl:t}=o,i=e?[Ut.FAIRPLAY,Ut.WIDEVINE,Ut.PLAYREADY,Ut.CLEARKEY].filter(r=>!!e[r]):[];return!i[Ut.WIDEVINE]&&t&&i.push(Ut.WIDEVINE),i}const en=function(o){return ti!=null&&(o=ti.navigator)!=null&&o.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function ul(o,e,t,i){let r;switch(o){case Ut.FAIRPLAY:r=["cenc","sinf"];break;case Ut.WIDEVINE:case Ut.PLAYREADY:r=["cenc"];break;case Ut.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${o}`)}return cl(r,e,t,i)}function cl(o,e,t,i){return[{initDataTypes:o,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs=${n}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs=${n}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function hl(o){var e;return!!o&&(o.sessionType==="persistent-license"||!!((e=o.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function sa(o){const e=new Uint16Array(o.buffer,o.byteOffset,o.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(a){const u=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(u){const g=Xr(u).subarray(0,16);return wt(g),g}}return null}let Kn={};class tn{static clearKeyUriToKeyIdMap(){Kn={}}static setKeyIdForUri(e,t){Kn[e]=t}constructor(e,t,i,r=[1],n=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Qi(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(z(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Ui(e.keyFormatVersions,this.keyFormatVersions)&&rr(e.iv,this.iv)&&rr(e.keyId,this.keyId)}isSupported(){if(this.method){if(Qi(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Kt.FAIRPLAY:case Kt.WIDEVINE:case Kt.PLAYREADY:case Kt.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Qi(this.method)){let n=this.iv;return n||(typeof e!="number"&&(M.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),n=dl(e)),new tn(this.method,this.uri,"identity",this.keyFormatVersions,n)}if(this.keyId){const n=Kn[this.uri];if(n&&!Ui(this.keyId,n)&&tn.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=Pt(this.uri);if(i)switch(this.keyFormat){case Kt.WIDEVINE:if(this.pssh=i,!this.keyId){const n=kt(i.buffer);if(n.length){var r;const a=n[0];this.keyId=(r=a.kids)!=null&&r.length?a.kids[0]:null}}this.keyId||(this.keyId=aa(t));break;case Kt.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=at(n,null,i),this.keyId=sa(i);break}default:{let n=i.subarray(0,16);if(n.length!==16){const a=new Uint8Array(16);a.set(n,16-n.length),n=a}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n;n=fl(t),n||(n=aa(t),n||(n=Kn[this.uri])),n&&(this.keyId=n,tn.setKeyIdForUri(this.uri,n))}return this}}function fl(o){const e=o==null?void 0:o[Kt.WIDEVINE];return e?e.keyId:null}function aa(o){const e=o==null?void 0:o[Kt.PLAYREADY];if(e){const t=Pt(e.uri);if(t)return sa(t)}return null}function dl(o){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=o>>8*(15-t)&255;return e}const oa=/#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,la=/#EXT-X-MEDIA:(.*)/g,pl=/^#EXT(?:INF|-X-TARGETDURATION):/m,fs=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),_l=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 dr{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static resolve(e,t){return k.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return pl.test(e)}static parseMasterPlaylist(e,t){const i=Vr(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];if(oa.lastIndex=0,!e.startsWith("#EXTM3U"))return r.playlistParsingError=new Error("no EXTM3U delimiter"),r;let a;for(;(a=oa.exec(e))!=null;)if(a[1]){var u;const p=new ai(a[1],r),m=qr(r,a[2]),S={attrs:p,bitrate:p.decimalInteger("BANDWIDTH")||p.decimalInteger("AVERAGE-BANDWIDTH"),name:p.NAME,url:dr.resolve(m,t)},R=p.decimalResolution("RESOLUTION");R&&(S.width=R.width,S.height=R.height),fa(p.CODECS,S);const H=p["SUPPLEMENTAL-CODECS"];H&&(S.supplemental={},fa(H,S.supplemental)),(u=S.unknownCodecs)!=null&&u.length||n.push(S),r.levels.push(S)}else if(a[3]){const p=a[3],m=a[4];switch(p){case"SESSION-DATA":{const S=new ai(m,r),R=S["DATA-ID"];R&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[R]=S);break}case"SESSION-KEY":{const S=ca(m,t,r);S.encrypted&&S.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(S)):M.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${m}"`);break}case"DEFINE":{{const S=new ai(m,r);vn(r,S,t)}break}case"CONTENT-STEERING":{const S=new ai(m,r);r.contentSteering={uri:dr.resolve(S["SERVER-URI"],t),pathwayId:S["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=ha(m);break}}}const g=n.length>0&&n.length<r.levels.length;return r.levels=g?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},a=i.levels,u={AUDIO:a.map(p=>({id:p.attrs.AUDIO,audioCodec:p.audioCodec})),SUBTITLES:a.map(p=>({id:p.attrs.SUBTITLES,textCodec:p.textCodec})),"CLOSED-CAPTIONS":[]};let g=0;for(la.lastIndex=0;(r=la.exec(e))!==null;){const p=new ai(r[1],i),m=p.TYPE;if(m){const S=u[m],R=n[m]||[];n[m]=R;const H=p.LANGUAGE,j=p["ASSOC-LANGUAGE"],Q=p.CHANNELS,X=p.CHARACTERISTICS,re=p["INSTREAM-ID"],ae={attrs:p,bitrate:0,id:g++,groupId:p["GROUP-ID"]||"",name:p.NAME||H||"",type:m,default:p.bool("DEFAULT"),autoselect:p.bool("AUTOSELECT"),forced:p.bool("FORCED"),lang:H,url:p.URI?dr.resolve(p.URI,t):""};if(j&&(ae.assocLang=j),Q&&(ae.channels=Q),X&&(ae.characteristics=X),re&&(ae.instreamId=re),S!=null&&S.length){const oe=dr.findGroup(S,ae.groupId)||S[0];da(ae,oe,"audioCodec"),da(ae,oe,"textCodec")}R.push(ae)}}return n}static parseLevelPlaylist(e,t,i,r,n,a){var u;const g={url:t},p=new Zr(t),m=p.fragments,S=[];let R=null,H=0,j=0,Q=0,X=0,re=0,ae=null,oe=new Te(r,g),de,Se,Ne,we=-1,Pe=!1,Ie=null,Ce;if(fs.lastIndex=0,p.m3u8=e,p.hasVariableRefs=Vr(e),((u=fs.exec(e))==null?void 0:u[0])!=="#EXTM3U")return p.playlistParsingError=new Error("Missing format identifier #EXTM3U"),p;for(;(de=fs.exec(e))!==null;){Pe&&(Pe=!1,oe=new Te(r,g),oe.playlistOffset=Q,oe.setStart(Q),oe.sn=H,oe.cc=X,re&&(oe.bitrate=re),oe.level=i,R&&(oe.initSegment=R,R.rawProgramDateTime&&(oe.rawProgramDateTime=R.rawProgramDateTime,R.rawProgramDateTime=null),Ie&&(oe.setByteRange(Ie),Ie=null)));const Rt=de[1];if(Rt){oe.duration=parseFloat(Rt);const At=(" "+de[2]).slice(1);oe.title=At||null,oe.tagList.push(At?["INF",Rt,At]:["INF",Rt])}else if(de[3]){if(I(oe.duration)){oe.playlistOffset=Q,oe.setStart(Q),Ne&&_a(oe,Ne,p),oe.sn=H,oe.level=i,oe.cc=X,m.push(oe);const At=(" "+de[3]).slice(1);oe.relurl=qr(p,At),ds(oe,ae,S),ae=oe,Q+=oe.duration,H++,j=0,Pe=!0}}else{if(de=de[0].match(_l),!de){M.warn("No matches on slow regex match for level playlist!");continue}for(Se=1;Se<de.length&&de[Se]===void 0;Se++);const At=(" "+de[Se]).slice(1),ot=(" "+de[Se+1]).slice(1),Ct=de[Se+2]?(" "+de[Se+2]).slice(1):null;switch(At){case"BYTERANGE":ae?oe.setByteRange(ot,ae):oe.setByteRange(ot);break;case"PROGRAM-DATE-TIME":oe.rawProgramDateTime=ot,oe.tagList.push(["PROGRAM-DATE-TIME",ot]),we===-1&&(we=m.length);break;case"PLAYLIST-TYPE":p.type&&Lr(p,At,de),p.type=ot.toUpperCase();break;case"MEDIA-SEQUENCE":p.startSN!==0?Lr(p,At,de):m.length>0&&ga(p,At,de),H=p.startSN=parseInt(ot);break;case"SKIP":{p.skippedSegments&&Lr(p,At,de);const vt=new ai(ot,p),Dt=vt.decimalInteger("SKIPPED-SEGMENTS");if(I(Dt)){p.skippedSegments+=Dt;for(let ft=Dt;ft--;)m.push(null);H+=Dt}const Ft=vt.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ft&&(p.recentlyRemovedDateranges=(p.recentlyRemovedDateranges||[]).concat(Ft.split(" ")));break}case"TARGETDURATION":p.targetduration!==0&&Lr(p,At,de),p.targetduration=Math.max(parseInt(ot),1);break;case"VERSION":p.version!==null&&Lr(p,At,de),p.version=parseInt(ot);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":p.live||Lr(p,At,de),p.live=!1;break;case"#":(ot||Ct)&&oe.tagList.push(Ct?[ot,Ct]:[ot]);break;case"DISCONTINUITY":X++,oe.tagList.push(["DIS"]);break;case"GAP":oe.gap=!0,oe.tagList.push([At]);break;case"BITRATE":oe.tagList.push([At,ot]),re=parseInt(ot)*1e3,I(re)?oe.bitrate=re:re=0;break;case"DATERANGE":{const vt=new ai(ot,p),Dt=new Pi(vt,p.dateRanges[vt.ID],p.dateRangeTagCount);p.dateRangeTagCount++,Dt.isValid||p.skippedSegments?p.dateRanges[Dt.id]=Dt:M.warn(`Ignoring invalid DATERANGE tag: "${ot}"`),oe.tagList.push(["EXT-X-DATERANGE",ot]);break}case"DEFINE":{{const vt=new ai(ot,p);"IMPORT"in vt?yn(p,vt,a):vn(p,vt,t)}break}case"DISCONTINUITY-SEQUENCE":p.startCC!==0?Lr(p,At,de):m.length>0&&ga(p,At,de),p.startCC=X=parseInt(ot);break;case"KEY":{const vt=ca(ot,t,p);if(vt.isSupported()){if(vt.method==="NONE"){Ne=void 0;break}Ne||(Ne={});const Dt=Ne[vt.keyFormat];Dt!=null&&Dt.matches(vt)||(Dt&&(Ne=c({},Ne)),Ne[vt.keyFormat]=vt)}else M.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${ot}"`);break}case"START":p.startTimeOffset=ha(ot);break;case"MAP":{const vt=new ai(ot,p);if(oe.duration){const Dt=new Te(r,g);pa(Dt,vt,i,Ne),R=Dt,oe.initSegment=R,R.rawProgramDateTime&&!oe.rawProgramDateTime&&(oe.rawProgramDateTime=R.rawProgramDateTime)}else{const Dt=oe.byteRangeEndOffset;if(Dt){const Ft=oe.byteRangeStartOffset;Ie=`${Dt-Ft}@${Ft}`}else Ie=null;pa(oe,vt,i,Ne),R=oe,Pe=!0}R.cc=X;break}case"SERVER-CONTROL":{Ce&&Lr(p,At,de),Ce=new ai(ot),p.canBlockReload=Ce.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=Ce.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&Ce.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=Ce.optionalFloat("PART-HOLD-BACK",0),p.holdBack=Ce.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{p.partTarget&&Lr(p,At,de);const vt=new ai(ot);p.partTarget=vt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let vt=p.partList;vt||(vt=p.partList=[]);const Dt=j>0?vt[vt.length-1]:void 0,Ft=j++,ft=new ai(ot,p),dt=new Ke(ft,oe,g,Ft,Dt);vt.push(dt),oe.duration+=dt.duration;break}case"PRELOAD-HINT":{const vt=new ai(ot,p);p.preloadHint=vt;break}case"RENDITION-REPORT":{const vt=new ai(ot,p);p.renditionReports=p.renditionReports||[],p.renditionReports.push(vt);break}default:M.warn(`line parsed but not handled: ${de}`);break}}}ae&&!ae.relurl?(m.pop(),Q-=ae.duration,p.partList&&(p.fragmentHint=ae)):p.partList&&(ds(oe,ae,S),oe.cc=X,p.fragmentHint=oe,Ne&&_a(oe,Ne,p)),p.targetduration||(p.playlistParsingError=new Error("Missing Target Duration"));const Ye=m.length,_t=m[0],xt=m[Ye-1];if(Q+=p.skippedSegments*p.targetduration,Q>0&&Ye&&xt){p.averagetargetduration=Q/Ye;const Rt=xt.sn;p.endSN=Rt!=="initSegment"?Rt:0,p.live||(xt.endList=!0),we>0&&(ml(m,we),_t&&S.unshift(_t))}return p.fragmentHint&&(Q+=p.fragmentHint.duration),p.totalduration=Q,S.length&&p.dateRangeTagCount&&_t&&ua(S,p),p.endCC=X,p}}function ua(o,e){let t=o.length;if(!t)if(e.hasProgramDateTime){const u=e.fragments[e.fragments.length-1];o.push(u),t++}else return;const i=o[t-1],r=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let u=n.length;u--;){const g=e.dateRanges[n[u]],p=g.startDate.getTime();g.tagAnchor=i.ref;for(let m=t;m--;){var a;if(((a=o[m])==null?void 0:a.sn)<e.startSN)break;const S=gl(e,p,o,m,r);if(S!==-1){g.tagAnchor=e.fragments[S].ref;break}}}}function gl(o,e,t,i,r){const n=t[i];if(n){const u=n.programDateTime;if(e>=u||i===0){var a;const g=(((a=t[i+1])==null?void 0:a.start)||r)-n.start;if(e<=u+g*1e3){const p=t[i].sn-o.startSN;if(p<0)return-1;const m=o.fragments;if(m.length>t.length){const R=(t[i+1]||m[m.length-1]).sn-o.startSN;for(let H=R;H>p;H--){const j=m[H].programDateTime;if(e>=j&&e<j+m[H].duration*1e3)return H}}return p}}}return-1}function ca(o,e,t){var i,r;const n=new ai(o,t),a=(i=n.METHOD)!=null?i:"",u=n.URI,g=n.hexadecimalInteger("IV"),p=n.KEYFORMATVERSIONS,m=(r=n.KEYFORMAT)!=null?r:"identity";u&&n.IV&&!g&&M.error(`Invalid IV: ${n.IV}`);const S=u?dr.resolve(u,e):"",R=(p||"1").split("/").map(Number).filter(Number.isFinite);return new tn(a,S,m,R,g,n.KEYID)}function ha(o){const t=new ai(o).decimalFloatingPoint("TIME-OFFSET");return I(t)?t:null}function fa(o,e){let t=(o||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>xe(n,i));r.length&&(e[`${i}Codec`]=r.map(n=>n.split("/")[0]).join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function da(o,e,t){const i=e[t];i&&(o[t]=i)}function ml(o,e){let t=o[e];for(let i=e;i--;){const r=o[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function ds(o,e,t){o.rawProgramDateTime?t.push(o):e!=null&&e.programDateTime&&(o.programDateTime=e.endProgramDateTime)}function pa(o,e,t,i){o.relurl=e.URI,e.BYTERANGE&&o.setByteRange(e.BYTERANGE),o.level=t,o.sn="initSegment",i&&(o.levelkeys=i),o.initSegment=null}function _a(o,e,t){o.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(o)}function Lr(o,e,t){o.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function ga(o,e,t){o.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function ps(o,e){const t=e.startPTS;if(I(t)){let i=0,r;e.sn>o.sn?(i=t-o.start,r=o):(i=o.start-t,r=e),r.duration!==i&&r.setDuration(i)}else e.sn>o.sn?o.cc===e.cc&&o.minEndPTS?e.setStart(o.start+(o.minEndPTS-o.start)):e.setStart(o.start+o.duration):e.setStart(Math.max(o.start-e.duration,0))}function ma(o,e,t,i,r,n,a){i-t<=0&&(a.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let g=t,p=i;const m=e.startPTS,S=e.endPTS;if(I(m)){const re=Math.abs(m-t);o&&re>o.totalduration?a.warn(`media timestamps and playlist times differ by ${re}s for level ${e.level} ${o.url}`):I(e.deltaPTS)?e.deltaPTS=Math.max(re,e.deltaPTS):e.deltaPTS=re,g=Math.max(t,m),t=Math.min(t,m),r=e.startDTS!==void 0?Math.min(r,e.startDTS):r,p=Math.min(i,S),i=Math.max(i,S),n=e.endDTS!==void 0?Math.max(n,e.endDTS):n}const R=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=g,e.startDTS=r,e.endPTS=i,e.minEndPTS=p,e.endDTS=n;const H=e.sn;if(!o||H<o.startSN||H>o.endSN)return 0;let j;const Q=H-o.startSN,X=o.fragments;for(X[Q]=e,j=Q;j>0;j--)ps(X[j],X[j-1]);for(j=Q;j<X.length-1;j++)ps(X[j],X[j+1]);return o.fragmentHint&&ps(X[X.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,R}function vl(o,e,t){if(o===e)return;let i=null;const r=o.fragments;for(let m=r.length-1;m>=0;m--){const S=r[m].initSegment;if(S){i=S;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;let n;El(o,e,(m,S,R,H)=>{if((!e.startCC||e.skippedSegments)&&S.cc!==m.cc){const j=m.cc-S.cc;for(let Q=R;Q<H.length;Q++)H[Q].cc+=j;e.endCC=H[H.length-1].cc}I(m.startPTS)&&I(m.endPTS)&&(S.setStart(S.startPTS=m.startPTS),S.startDTS=m.startDTS,S.maxStartPTS=m.maxStartPTS,S.endPTS=m.endPTS,S.endDTS=m.endDTS,S.minEndPTS=m.minEndPTS,S.setDuration(m.endPTS-m.startPTS),S.duration&&(n=S),e.PTSKnown=e.alignedSliding=!0),m.hasStreams&&(S.elementaryStreams=m.elementaryStreams),S.loader=m.loader,m.hasStats&&(S.stats=m.stats),m.initSegment&&(S.initSegment=m.initSegment,i=m.initSegment)});const a=e.fragments,u=e.fragmentHint?a.concat(e.fragmentHint):a;if(i&&u.forEach(m=>{var S;m&&(!m.initSegment||m.initSegment.relurl===((S=i)==null?void 0:S.relurl))&&(m.initSegment=i)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(m=>!m),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let m=e.skippedSegments;m--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=yl(o.dateRanges,e,t));const m=o.fragments.filter(S=>S.rawProgramDateTime);if(o.hasProgramDateTime&&!e.hasProgramDateTime)for(let S=1;S<u.length;S++)u[S].programDateTime===null&&ds(u[S],u[S-1],m);ua(m,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var g;const m=Ea(o,e.startSN-1);e.startCC=(g=m==null?void 0:m.cc)!=null?g:a[0].cc}bl(o.partList,e.partList,(m,S)=>{S.elementaryStreams=m.elementaryStreams,S.stats=m.stats}),n?ma(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS,t):ya(o,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=o.driftStartTime,e.driftStart=o.driftStart;const p=e.advancedDateTime;if(e.advanced&&p){const m=e.edge;e.driftStart||(e.driftStartTime=p,e.driftStart=m),e.driftEndTime=p,e.driftEnd=m}else e.driftEndTime=o.driftEndTime,e.driftEnd=o.driftEnd,e.advancedDateTime=o.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=o.requestScheduled)}function yl(o,e,t){const{dateRanges:i,recentlyRemovedDateranges:r}=e,n=c({},o);r&&r.forEach(g=>{delete n[g]});const u=Object.keys(n).length;return u?(Object.keys(i).forEach(g=>{const p=n[g],m=new Pi(i[g].attr,p);m.isValid?(n[g]=m,p||(m.tagOrder+=u)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${jt(i[g].attr)}"`)}),n):i}function bl(o,e,t){if(o&&e){let i=0;for(let r=0,n=o.length;r<=n;r++){const a=o[r],u=e[r+i];a&&u&&a.index===u.index&&a.fragment.sn===u.fragment.sn?t(a,u):i--}}}function El(o,e,t){const i=e.skippedSegments,r=Math.max(o.startSN,e.startSN)-e.startSN,n=(o.fragmentHint?1:0)+(i?e.endSN:Math.min(o.endSN,e.endSN))-e.startSN,a=e.startSN-o.startSN,u=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,g=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments;for(let p=r;p<=n;p++){const m=g[a+p];let S=u[p];if(i&&!S&&m&&(S=e.fragments[p]=m),m&&S){t(m,S,p,u);const R=m.relurl,H=S.relurl;if(R&&Sl(R,H)){e.playlistParsingError=va(`media sequence mismatch ${S.sn}:`,o,e,m,S);return}else if(m.cc!==S.cc){e.playlistParsingError=va(`discontinuity sequence mismatch (${m.cc}!=${S.cc})`,o,e,m,S);return}}}}function va(o,e,t,i,r){return new Error(`${o} ${r.url}
|
|
|
Playlist starting @${e.startSN}
|
|
|
${e.m3u8}
|
|
|
|
|
|
Playlist starting @${t.startSN}
|
|
|
${t.m3u8}`)}function ya(o,e,t=!0){const i=e.startSN+e.skippedSegments-o.startSN,r=o.fragments,n=i>=0;let a=0;if(n&&i<r.length)a=r[i].start;else if(n&&e.startSN===o.endSN+1)a=o.fragmentEnd;else if(n&&t)a=o.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)a=o.fragmentStart;else return;_s(e,a)}function _s(o,e){if(e){const t=o.fragments;for(let i=o.skippedSegments;i<t.length;i++)t[i].addStart(e);o.fragmentHint&&o.fragmentHint.addStart(e)}}function ba(o,e=1/0){let t=1e3*o.targetduration;if(o.updated){const i=o.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function Ea(o,e,t){if(!o)return null;let i=o.fragments[e-o.startSN];return i||(i=o.fragmentHint,i&&i.sn===e)?i:e<o.startSN&&t&&t.sn===e?t:null}function Sa(o,e,t){return o?wa(o.partList,e,t):null}function wa(o,e,t){if(o)for(let i=o.length;i--;){const r=o[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function xa(o){o.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(r=>{r.level=t,r.initSegment&&(r.initSegment.level=t)})})}function Sl(o,e){return o!==e&&e?Aa(o)!==Aa(e):!1}function Aa(o){return o.replace(/\?[^?]*$/,"")}function Pn(o,e){for(let i=0,r=o.length;i<r;i++){var t;if(((t=o[i])==null?void 0:t.cc)===e)return o[i]}return null}function wl(o,e){return!!(o&&e.startCC<o.endCC&&e.endCC>o.startCC)}function Ca(o,e){const t=o.start+e;o.startPTS=t,o.setStart(t),o.endPTS=t+o.duration}function Ta(o,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)Ca(t[i],o);e.fragmentHint&&Ca(e.fragmentHint,o),e.alignedSliding=!0}function xl(o,e){o&&(Da(e,o),e.alignedSliding||Wn(e,o),!e.alignedSliding&&!e.skippedSegments&&ya(o,e,!1))}function Da(o,e){if(!wl(e,o))return;const t=Math.min(e.endCC,o.endCC),i=Pn(e.fragments,t),r=Pn(o.fragments,t);if(!i||!r)return;M.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const n=i.start-r.start;Ta(n,o)}function Wn(o,e){if(!o.hasProgramDateTime||!e.hasProgramDateTime)return;const t=o.fragments,i=e.fragments;if(!t.length||!i.length)return;let r,n;const a=Math.min(e.endCC,o.endCC);e.startCC<a&&o.startCC<a&&(r=Pn(i,a),n=Pn(t,a)),(!r||!n)&&(r=i[Math.floor(i.length/2)],n=Pn(t,r.cc)||t[Math.floor(t.length/2)]);const u=r.programDateTime,g=n.programDateTime;if(!u||!g)return;const p=(g-u)/1e3-(n.start-r.start);Ta(p,o)}function Oi(o,e,t){$i(o,e,t),o.addEventListener(e,t)}function $i(o,e,t){o.removeEventListener(e,t)}const Al={toString:function(o){let e="";const t=o.length;for(let i=0;i<t;i++)e+=`[${o.start(i).toFixed(3)}-${o.end(i).toFixed(3)}]`;return e}},ze={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 gs extends gn{constructor(e,t,i,r,n){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=ze.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:a,fragCurrent:u,media:g,mediaBuffer:p,state:m}=this,S=g?g.currentTime:0,R=Ot.bufferInfo(p||g,S,a.maxBufferHole),H=!R.len;if(this.log(`Media seeking to ${I(S)?S.toFixed(3):S}, state: ${m}, ${H?"out of":"in"} buffer`),this.state===ze.ENDED)this.resetLoadingState();else if(u){const j=a.maxFragLookUpTolerance,Q=u.start-j,X=u.start+u.duration+j;if(H||X<R.start||Q>R.end){const re=S>X;(S<Q||re)&&(re&&u.loader&&(this.log(`Cancelling fragment load for seek (sn: ${u.sn})`),u.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(g){this.fragmentTracker.removeFragmentsInRange(S,1/0,this.playlistType,!0);const j=this.lastCurrentTime;if(S>j&&(this.lastCurrentTime=S),!this.loadingParts){const Q=Math.max(R.end,S),X=this.shouldLoadParts(this.getLevelDetails(),Q);X&&(this.log(`LL-Part loading ON after seeking to ${S.toFixed(2)} with buffer @${Q.toFixed(2)}`),this.loadingParts=X)}}this.hls.hasEnoughToStart||(this.log(`Setting ${H?"startPosition":"nextLoadPosition"} to ${S} for seek without enough to start`),this.nextLoadPosition=S,H&&(this.startPosition=S)),H&&this.state===ze.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new Ki(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Ar(e.config)}registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===ze.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=ze.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,r=this.config.timelineOffset||0;if(i<=r)return!1;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=Ot.bufferedInfo(n,e.start,0));const a=e.nextStart;if(a&&a>r&&a<t.edge||this.media.currentTime<e.start)return!1;const g=t.partList;if(g!=null&&g.length){const m=g[g.length-1];return Ot.isBuffered(this.media,m.start+m.duration/2)}const p=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(p)}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 i=this.media=this.mediaBuffer=t.media;Oi(i,"seeking",this.onMediaSeeking),Oi(i,"ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===ze.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),$i(r,"seeking",this.onMediaSeeking),$i(r,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=ze.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=n=>{const a=n.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${n.part?" part: "+n.part.index:""} of ${this.fragInfo(a,!1,n.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const a=this.state,u=n.frag;if(this.fragContextChanged(u)){(a===ze.FRAG_LOADING||!this.fragCurrent&&a===ze.PARSING)&&(this.fragmentTracker.removeFragment(u),this.state=ze.IDLE);return}"payload"in n&&(this.log(`Loaded ${u.type} sn: ${u.sn} of ${this.playlistLabel()} ${u.level}`),this.hls.trigger(_.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===ze.STOPPED||this.state===ze.ERROR||(this.warn(`Frag error: ${(n==null?void 0:n.message)||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===si.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),u=Math.max(e.duration,a?a.len:this.config.maxBufferLength),g=this.backtrackFragment;((g?e.sn-g.sn:0)===1||this.reduceMaxBufferLength(u,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===si.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(_.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const r=i==null?void 0:i.frag;if(!r||this.fragContextChanged(r)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{frag:n,payload:a}=i,u=n.decryptdata;if(a&&a.byteLength>0&&u!=null&&u.key&&u.iv&&Qi(u.method)){const g=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),u.key.buffer,u.iv.buffer,Br(u.method)).catch(p=>{throw r.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:p,reason:p.message,frag:n}),p}).then(p=>{const m=self.performance.now();return r.trigger(_.FRAG_DECRYPTED,{frag:n,payload:p,stats:{tstart:g,tdecrypt:m}}),i.payload=p,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===ze.STOPPED||this.state===ze.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==ze.STOPPED&&(this.state=ze.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,r;const n=e.tracks;if(n&&!t.encrypted&&((i=n.audio)!=null&&i.encrypted||(r=n.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,u=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(u.message),!a||a.mediaKeys?!1:(this.hls.trigger(_.ERROR,{type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,fatal:!1,error:u,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 i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?Al.toString(Ot.getBuffered(i)):"(detached)"})`),pe(e)){var r;if(e.type!==v.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(u=>!!a[u])){this.state=ze.IDLE;return}}const n=(r=this.levels)==null?void 0:r[e.level];n!=null&&n.fragmentError&&(this.log(`Resetting level fragment error count of ${n.fragmentError} on frag buffered`),n.fragmentError=0)}this.state=ze.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,a=!n||n.length===0||n.some(g=>!g),u=new Fr(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(u)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var n;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let u=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=ze.KEY_LOADING,this.fragCurrent=e,u=this.keyLoader.load(e).then(R=>{if(!this.fragContextChanged(R.frag))return this.hls.trigger(_.KEY_LOADED,R),this.state===ze.KEY_LOADING&&(this.state=ze.IDLE),R}),this.hls.trigger(_.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(u=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),u&&this.log("[eme] blocking frag load until media-keys acquired"));const g=this.fragPrevious;if(pe(e)&&(!g||e.sn!==g.sn)){const R=this.shouldLoadParts(t.details,e.end);R!==this.loadingParts&&(this.log(`LL-Part loading ${R?"ON":"OFF"} loading sn ${g==null?void 0:g.sn}->${e.sn}`),this.loadingParts=R)}if(i=Math.max(e.start,i||0),this.loadingParts&&pe(e)){const R=a.partList;if(R&&r){i>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const H=this.getNextPart(R,e,i);if(H>-1){const j=R[H];e=this.fragCurrent=j.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${j.index} (${H}/${R.length-1}) of ${this.fragInfo(e,!1,j)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=j.start+j.duration,this.state=ze.FRAG_LOADING;let Q;return u?Q=u.then(X=>!X||this.fragContextChanged(X.frag)?null:this.doFragPartsLoad(e,j,t,r)).catch(X=>this.handleFragLoadError(X)):Q=this.doFragPartsLoad(e,j,t,r).catch(X=>this.handleFragLoadError(X)),this.hls.trigger(_.FRAG_LOADING,{frag:e,part:j,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):Q}else if(!e.url||this.loadedEndOfParts(R,i))return Promise.resolve(null)}}if(pe(e)&&this.loadingParts){var p;this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(p=a.partList)==null?void 0:p.filter(R=>R.loaded).map(R=>`[${R.start}-${R.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} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),I(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ze.FRAG_LOADING;const m=this.config.progressive;let S;return m&&u?S=u.then(R=>!R||this.fragContextChanged(R.frag)?null:this.fragmentLoader.load(e,r)).catch(R=>this.handleFragLoadError(R)):S=Promise.all([this.fragmentLoader.load(e,m?r:void 0),u]).then(([R])=>(!m&&r&&r(R),R)).catch(R=>this.handleFragLoadError(R)),this.hls.trigger(_.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):S}doFragPartsLoad(e,t,i,r){return new Promise((n,a)=>{var u;const g=[],p=(u=i.details)==null?void 0:u.partList,m=S=>{this.fragmentLoader.loadPart(e,S,r).then(R=>{g[S.index]=R;const H=R.part;this.hls.trigger(_.FRAG_LOADED,R);const j=Sa(i.details,e.sn,S.index+1)||wa(p,e.sn,S.index+1);if(j)m(j);else return n({frag:e,part:H,partsLoaded:g})}).catch(a)};m(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===w.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===D.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(_.ERROR,t)}else this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==ze.PARSING){!this.fragCurrent&&this.state!==ze.STOPPED&&this.state!==ze.ERROR&&(this.state=ze.IDLE);return}const{frag:i,part:r,level:n}=t,a=self.performance.now();i.stats.parsing.end=a,r&&(r.stats.parsing.end=a);const u=this.getLevelDetails(),p=u&&i.sn>u.endSN||this.shouldLoadParts(u,i.end);p!==this.loadingParts&&(this.log(`LL-Part loading ${p?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=p),this.updateLevelTiming(i,r,n,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const n=e.partList[0];if(n.fragment.type===v.SUBTITLE)return!1;const a=n.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=a){var r;if((this.hls.hasEnoughToStart?((r=this.media)==null?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const u=t[r],g=u.details,p=a>-1?Sa(g,n,a):null,m=p?p.fragment:Ea(g,n,i);return m?(i&&i!==m&&(m.stats=i.stats),{frag:m,part:p,level:u}):null}bufferFragmentData(e,t,i,r,n){if(this.state!==ze.PARSING)return;const{data1:a,data2:u}=e;let g=a;if(u&&(g=st(a,u)),!g.length)return;const p=this.initPTS[t.cc],m=p?-p.baseTime/p.timescale:void 0,S={type:e.type,frag:t,part:i,chunkMeta:r,offset:m,parent:t.type,data:g};if(this.hls.trigger(_.BUFFER_APPENDING,S),e.dropped&&e.independent&&!i){if(n)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 i=t.currentTime,r=Ot.bufferInfo(t,i,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),u=Math.max(Math.min(e.start-a,r.end-a),i+a);e.start-u>a&&this.flushMainBuffer(u,e.start)}getFwdBufferInfo(e,t){var i;const r=this.getLoadPosition();if(!I(r))return null;const a=this.lastCurrentTime>r||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,a)}getFwdBufferInfoAtPos(e,t,i,r){const n=Ot.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(n.nextStart<=a.end||a.gap)){const u=Math.max(Math.min(n.nextStart,a.end)-t,r);return Ot.bufferInfo(e,t,u)}}return n}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,r=Math.max(Math.min(e-t,i.maxBufferLength),t),n=Math.max(e-t*3,i.maxMaxBufferLength/2,r);return n>=r?(i.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),!0):!1}getAppendedFrag(e,t=v.MAIN){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,a=i[0].start,u=n.lowLatencyMode&&!!t.partList;let g=null;if(t.live){const S=n.initialLiveManifestSize;if(r<S)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${S})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var p;u&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),g=this.getInitialLiveFragment(t);const R=this.hls.startPosition,H=this.hls.liveSyncPosition,j=g?(R!==-1&&R>=a?R:H)||g.start:e;this.log(`Setting startPosition to ${j} to match start frag at live edge. mainStart: ${R} liveSyncPosition: ${H} frag.start: ${(p=g)==null?void 0:p.start}`),this.startPosition=this.nextLoadPosition=j}}else e<=a&&(g=i[0]);if(!g){const S=this.loadingParts?t.partEnd:t.fragmentEnd;g=this.getFragmentAtPosition(e,S,t)}let m=this.filterReplacedPrimary(g,t);if(!m&&g){const S=g.sn-t.startSN;m=this.filterReplacedPrimary(i[S+1]||null,t)}return this.mapToInitFragWhenRequired(m)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===si.OK||i===si.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&i.nextStart)){const u=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r,0);if(u!==null&&i.len+u.len>=n){const g=a.sn;return this.loopSn!==g&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${g}`),this.loopSn=g),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(La(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(La(this.config)&&e.type!==v.SUBTITLE){const i=this.hls.interstitialsManager,r=i==null?void 0:i.bufferingItem;if(r){const a=r.event;if(a){if(a.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&(t==null?void 0:t.live)===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const n=i==null?void 0:i.playerQueue;if(n)for(let a=n.length;a--;){const u=n[a].interstitial;if(u.appendInPlace&&e.start>=u.startTime&&e.end<=u.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,a=!0;for(let u=0,g=e.length;u<g;u++){const p=e[u];if(a=a&&!p.independent,r>-1&&i<p.start)break;const m=p.loaded;m?r=-1:(n||(p.independent||a)&&p.fragment===t)&&(p.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${p.start}`),r=u),n=m}return r}loadedEndOfParts(e,t){let i;for(let r=e.length;r--;){if(i=e[r],!i.loaded)return!1;if(t>i.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=hi(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];i.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=Ir(e,i.cc,i.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:a,endSN:u}=i;const{fragmentHint:g}=i,{maxFragLookUpTolerance:p}=r,m=i.partList,S=!!(this.loadingParts&&m!=null&&m.length&&g);S&&!this.bitrateTest&&m[m.length-1].fragment.sn===g.sn&&(a=a.concat(g),u=g.sn);let R;if(e<t){var H;const Q=e<this.lastCurrentTime||e>t-p||(H=this.media)!=null&&H.paused||!this.startFragRequested?0:p;R=yi(n,a,e,Q)}else R=a[a.length-1];if(R){const j=R.sn-i.startSN,Q=this.fragmentTracker.getState(R);if((Q===si.OK||Q===si.PARTIAL&&R.gap)&&(n=R),n&&R.sn===n.sn&&(!S||m[0].fragment.sn>R.sn||!i.live)&&R.level===n.level){const re=a[j+1];R.sn<u&&this.fragmentTracker.getState(re)!==si.OK?R=re:R=null}}return R}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragmentStart,a=!t,u=e.alignedSliding&&I(n);if(a||!u&&!n){xl(i,e);const g=e.fragmentStart;return this.log(`Live playlist sliding: ${g.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),g}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const r=this.timelineOffset;if(i===-1){const n=this.startTimeOffset!==null,a=n?this.startTimeOffset:e.startTimeOffset;a!==null&&I(a)?(i=t+a,a<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${a} found in ${n?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+r}this.nextLoadPosition=i+r}getLoadPosition(){var e;const{media:t}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&pe(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!==ze.FRAG_LOADING_WAITING_RETRY)&&(this.state=ze.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const re=this.getCurrentContext(t.chunkMeta);re&&(t.frag=re.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var n;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const a=t.details===w.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(r,!0);const u=t.errorAction;if(!u){this.state=ze.ERROR;return}const{action:g,flags:p,retryCount:m=0,retryConfig:S}=u,R=!!S,H=R&&g===ci.RetryRequest,j=R&&!u.resolved&&p===fi.MoveAllAlternatesMatchingHost,Q=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!H&&j&&pe(r)&&!r.endList&&Q&&!hn(t))this.resetFragmentErrors(e),this.treatAsGap(r),u.resolved=!0;else if((H||j)&&m<S.maxNumRetry){var X;const re=Yi((X=t.response)==null?void 0:X.code),ae=cr(S,m);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+ae,this.state=ze.FRAG_LOADING_WAITING_RETRY,u.resolved=!0,re){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${m+1}/${S.maxNumRetry} in ${ae}ms`)}else if(S)if(this.resetFragmentErrors(e),m<S.maxNumRetry)!a&&g!==ci.RemoveAlternatePermanently&&(u.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${m})`);return}else g===ci.SendAlternateToPenaltyBox?this.state=ze.WAITING_LEVEL:this.state=ze.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!Yi(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=ze.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===ze.PARSING||this.state===ze.PARSED){const t=e.frag,i=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),n=r&&r.len>.5;n&&this.reduceMaxBufferLength(r.len,(t==null?void 0:t.duration)||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===v.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==ze.STOPPED&&(this.state=ze.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=Ot.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===ze.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==ze.STOPPED&&(this.state=ze.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,i,r){const n=i.details;if(!n){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((g,p)=>{const m=e.elementaryStreams[p];if(m){const S=m.endPTS-m.startPTS;if(S<=0)return this.warn(`Could not parse fragment ${e.sn} ${p} duration reliably (${S})`),g||!1;const R=r?0:ma(n,e,m.startPTS,m.endPTS,m.startDTS,m.endDTS,this);return this.hls.trigger(_.LEVEL_PTS_UPDATED,{details:n,level:i,drift:R,type:p,frag:e,start:m.startPTS,end:m.endPTS}),!0}return g},!1)){var u;if(i.fragmentError===0&&this.treatAsGap(e,i),((u=this.transmuxer)==null?void 0:u.error)===null){const g=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(g.message),this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:g,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=ze.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(_.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===v.MAIN?"level":"track"}fragInfo(e,t=!0,i){var r,n;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((r=t&&!i?e.startPTS:(i||e).start)!=null?r:NaN).toFixed(3)}-${((n=t&&!i?e.endPTS:(i||e).end)!=null?n:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function La(o){return!!o.interstitialsController&&o.enableInterstitialPlayback!==!1}class Ra{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=Cl(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Cl(o,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<o.length;r++){const n=o[r];t.set(n,i),i+=n.length}return t}var ms={exports:{}},ka;function Tl(){return ka||(ka=1,function(o){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(g,p,m){this.fn=g,this.context=p,this.once=m||!1}function n(g,p,m,S,R){if(typeof m!="function")throw new TypeError("The listener must be a function");var H=new r(m,S||g,R),j=t?t+p:p;return g._events[j]?g._events[j].fn?g._events[j]=[g._events[j],H]:g._events[j].push(H):(g._events[j]=H,g._eventsCount++),g}function a(g,p){--g._eventsCount===0?g._events=new i:delete g._events[p]}function u(){this._events=new i,this._eventsCount=0}u.prototype.eventNames=function(){var p=[],m,S;if(this._eventsCount===0)return p;for(S in m=this._events)e.call(m,S)&&p.push(t?S.slice(1):S);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(m)):p},u.prototype.listeners=function(p){var m=t?t+p:p,S=this._events[m];if(!S)return[];if(S.fn)return[S.fn];for(var R=0,H=S.length,j=new Array(H);R<H;R++)j[R]=S[R].fn;return j},u.prototype.listenerCount=function(p){var m=t?t+p:p,S=this._events[m];return S?S.fn?1:S.length:0},u.prototype.emit=function(p,m,S,R,H,j){var Q=t?t+p:p;if(!this._events[Q])return!1;var X=this._events[Q],re=arguments.length,ae,oe;if(X.fn){switch(X.once&&this.removeListener(p,X.fn,void 0,!0),re){case 1:return X.fn.call(X.context),!0;case 2:return X.fn.call(X.context,m),!0;case 3:return X.fn.call(X.context,m,S),!0;case 4:return X.fn.call(X.context,m,S,R),!0;case 5:return X.fn.call(X.context,m,S,R,H),!0;case 6:return X.fn.call(X.context,m,S,R,H,j),!0}for(oe=1,ae=new Array(re-1);oe<re;oe++)ae[oe-1]=arguments[oe];X.fn.apply(X.context,ae)}else{var de=X.length,Se;for(oe=0;oe<de;oe++)switch(X[oe].once&&this.removeListener(p,X[oe].fn,void 0,!0),re){case 1:X[oe].fn.call(X[oe].context);break;case 2:X[oe].fn.call(X[oe].context,m);break;case 3:X[oe].fn.call(X[oe].context,m,S);break;case 4:X[oe].fn.call(X[oe].context,m,S,R);break;default:if(!ae)for(Se=1,ae=new Array(re-1);Se<re;Se++)ae[Se-1]=arguments[Se];X[oe].fn.apply(X[oe].context,ae)}}return!0},u.prototype.on=function(p,m,S){return n(this,p,m,S,!1)},u.prototype.once=function(p,m,S){return n(this,p,m,S,!0)},u.prototype.removeListener=function(p,m,S,R){var H=t?t+p:p;if(!this._events[H])return this;if(!m)return a(this,H),this;var j=this._events[H];if(j.fn)j.fn===m&&(!R||j.once)&&(!S||j.context===S)&&a(this,H);else{for(var Q=0,X=[],re=j.length;Q<re;Q++)(j[Q].fn!==m||R&&!j[Q].once||S&&j[Q].context!==S)&&X.push(j[Q]);X.length?this._events[H]=X.length===1?X[0]:X:a(this,H)}return this},u.prototype.removeAllListeners=function(p){var m;return p?(m=t?t+p:p,this._events[m]&&a(this,m)):(this._events=new i,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=t,u.EventEmitter=u,o.exports=u}(ms)),ms.exports}var Dl=Tl(),vs=Z(Dl);const On="1.6.13",En={};function Ll(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Rl(){const o=En[On];if(o)return o.clientCount++,o;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),r={worker:new self.Worker(t),objectURL:t,clientCount:1};return En[On]=r,r}function kl(o){const e=En[o];if(e)return e.clientCount++,e;const t=new self.URL(o,self.location.href).href,r={worker:new self.Worker(t),scriptURL:t,clientCount:1};return En[o]=r,r}function Il(o){const e=En[o||On];if(e&&e.clientCount--===1){const{worker:i,objectURL:r}=e;delete En[o||On],r&&self.URL.revokeObjectURL(r),i.terminate()}}function Ia(o,e){return e+10<=o.length&&o[e]===51&&o[e+1]===68&&o[e+2]===73&&o[e+3]<255&&o[e+4]<255&&o[e+6]<128&&o[e+7]<128&&o[e+8]<128&&o[e+9]<128}function ys(o,e){return e+10<=o.length&&o[e]===73&&o[e+1]===68&&o[e+2]===51&&o[e+3]<255&&o[e+4]<255&&o[e+6]<128&&o[e+7]<128&&o[e+8]<128&&o[e+9]<128}function Gn(o,e){let t=0;return t=(o[e]&127)<<21,t|=(o[e+1]&127)<<14,t|=(o[e+2]&127)<<7,t|=o[e+3]&127,t}function Fn(o,e){const t=e;let i=0;for(;ys(o,e);){i+=10;const r=Gn(o,e+6);i+=r,Ia(o,e+10)&&(i+=10),e+=i}if(i>0)return o.subarray(t,t+i)}function Pl(o,e,t,i){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],n=e[t+2],a=n>>2&15;if(a>12){const H=new Error(`invalid ADTS sampling index:${a}`);o.emit(_.ERROR,_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!0,error:H,reason:H.message});return}const u=(n>>6&3)+1,g=e[t+3]>>6&3|(n&1)<<2,p="mp4a.40."+u,m=r[a];let S=a;(u===5||u===29)&&(S-=3);const R=[u<<3|(S&14)>>1,(S&1)<<7|g<<3];return M.log(`manifest codec:${i}, parsed codec:${p}, channels:${g}, rate:${m} (ADTS object type:${u} sampling index:${a})`),{config:R,samplerate:m,channelCount:g,codec:p,parsedCodec:p,manifestCodec:i}}function Pa(o,e){return o[e]===255&&(o[e+1]&246)===240}function Oa(o,e){return o[e+1]&1?7:9}function bs(o,e){return(o[e+3]&3)<<11|o[e+4]<<3|(o[e+5]&224)>>>5}function Ol(o,e){return e+5<o.length}function zn(o,e){return e+1<o.length&&Pa(o,e)}function Fl(o,e){return Ol(o,e)&&Pa(o,e)&&bs(o,e)<=o.length-e}function Ml(o,e){if(zn(o,e)){const t=Oa(o,e);if(e+t>=o.length)return!1;const i=bs(o,e);if(i<=t)return!1;const r=e+i;return r===o.length||zn(o,r)}return!1}function Fa(o,e,t,i,r){if(!o.samplerate){const n=Pl(e,t,i,r);if(!n)return;c(o,n)}}function Ma(o){return 1024*9e4/o}function Bl(o,e){const t=Oa(o,e);if(e+t<=o.length){const i=bs(o,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ba(o,e,t,i,r){const n=Ma(o.samplerate),a=i+r*n,u=Bl(e,t);let g;if(u){const{frameLength:S,headerLength:R}=u,H=R+S,j=Math.max(0,t+H-e.length);j?(g=new Uint8Array(H-R),g.set(e.subarray(t+R,e.length),0)):g=e.subarray(t+R,t+H);const Q={unit:g,pts:a};return j||o.samples.push(Q),{sample:Q,length:H,missing:j}}const p=e.length-t;return g=new Uint8Array(p),g.set(e.subarray(t,e.length),0),{sample:{unit:g,pts:a},length:p,missing:-1}}function Nl(o,e){return ys(o,e)&&Gn(o,e+6)+10<=o.length-e}function Ul(o){return o instanceof ArrayBuffer?o:o.byteOffset==0&&o.byteLength==o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer}function Es(o,e=0,t=1/0){return $l(o,e,t,Uint8Array)}function $l(o,e,t,i){const r=Hl(o);let n=1;"BYTES_PER_ELEMENT"in i&&(n=i.BYTES_PER_ELEMENT);const a=jl(o)?o.byteOffset:0,u=(a+o.byteLength)/n,g=(a+e)/n,p=Math.floor(Math.max(0,Math.min(g,u))),m=Math.floor(Math.min(p+Math.max(t,0),u));return new i(r,p,m-p)}function Hl(o){return o instanceof ArrayBuffer?o:o.buffer}function jl(o){return o&&o.buffer instanceof ArrayBuffer&&o.byteLength!==void 0&&o.byteOffset!==void 0}function Kl(o){const e={key:o.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(o.size<2)return;if(o.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=o.data.subarray(1).indexOf(0);if(i===-1)return;const r=ce(Es(o.data,1,i)),n=o.data[2+i],a=o.data.subarray(3+i).indexOf(0);if(a===-1)return;const u=ce(Es(o.data,3+i,a));let g;return r==="-->"?g=ce(Es(o.data,4+i+a)):g=Ul(o.data.subarray(4+i+a)),e.mimeType=r,e.pictureType=n,e.description=u,e.data=g,e}function Wl(o){if(o.size<2)return;const e=ce(o.data,!0),t=new Uint8Array(o.data.subarray(e.length+1));return{key:o.type,info:e,data:t.buffer}}function Gl(o){if(o.size<2)return;if(o.type==="TXXX"){let t=1;const i=ce(o.data.subarray(t),!0);t+=i.length+1;const r=ce(o.data.subarray(t));return{key:o.type,info:i,data:r}}const e=ce(o.data.subarray(1));return{key:o.type,info:"",data:e}}function zl(o){if(o.type==="WXXX"){if(o.size<2)return;let t=1;const i=ce(o.data.subarray(t),!0);t+=i.length+1;const r=ce(o.data.subarray(t));return{key:o.type,info:i,data:r}}const e=ce(o.data);return{key:o.type,info:"",data:e}}function Vl(o){return o.type==="PRIV"?Wl(o):o.type[0]==="W"?zl(o):o.type==="APIC"?Kl(o):Gl(o)}function ql(o){const e=String.fromCharCode(o[0],o[1],o[2],o[3]),t=Gn(o,4),i=10;return{type:e,size:t,data:o.subarray(i,i+t)}}const Vn=10,Yl=10;function Na(o){let e=0;const t=[];for(;ys(o,e);){const i=Gn(o,e+6);o[e+5]>>6&1&&(e+=Vn),e+=Vn;const r=e+i;for(;e+Yl<r;){const n=ql(o.subarray(e)),a=Vl(n);a&&t.push(a),e+=n.size+Vn}Ia(o,e)&&(e+=Vn)}return t}function Ua(o){return o&&o.key==="PRIV"&&o.info==="com.apple.streaming.transportStreamTimestamp"}function Zl(o){if(o.data.byteLength===8){const e=new Uint8Array(o.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function Ss(o){const e=Na(o);for(let t=0;t<e.length;t++){const i=e[t];if(Ua(i))return Zl(i)}}let Wi=function(o){return o.audioId3="org.id3",o.dateRange="com.apple.quicktime.HLS",o.emsg="https://aomedia.org/emsg/ID3",o.misbklv="urn:misb:KLV:bin:1910.1",o}({});function pr(o="",e=9e4){return{type:o,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ws{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=st(this.cachedData,e),this.cachedData=null);let i=Fn(e,0),r=i?i.length:0,n;const a=this._audioTrack,u=this._id3Track,g=i?Ss(i):void 0,p=e.length;for((this.basePTS===null||this.frameIndex===0&&I(g))&&(this.basePTS=Xl(g,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&u.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Wi.audioId3,duration:Number.POSITIVE_INFINITY});r<p;){if(this.canParse(e,r)){const m=this.appendFrame(a,e,r);m?(this.frameIndex++,this.lastPTS=m.sample.pts,r+=m.length,n=r):r=p}else Nl(e,r)?(i=Fn(e,r),u.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Wi.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===p&&n!==p){const m=e.slice(n);this.cachedData?this.cachedData=st(this.cachedData,m):this.cachedData=m}}return{audioTrack:a,videoTrack:pr(),id3Track:u,textTrack:pr()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:pr(),id3Track:this._id3Track,textTrack:pr()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Xl=(o,e,t)=>{if(I(o))return o*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let qn=null;const Ql=[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],Jl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],eu=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],tu=[0,1,1,4];function $a(o,e,t,i,r){if(t+24>e.length)return;const n=Ha(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,u=i+r*a,g={unit:e.subarray(t,t+n.frameLength),pts:u,dts:u};return o.config=[],o.channelCount=n.channelCount,o.samplerate=n.sampleRate,o.samples.push(g),{sample:g,length:n.frameLength,missing:0}}}function Ha(o,e){const t=o[e+1]>>3&3,i=o[e+1]>>1&3,r=o[e+2]>>4&15,n=o[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const a=o[e+2]>>1&1,u=o[e+3]>>6,g=t===3?3-i:i===3?3:4,p=Ql[g*14+r-1]*1e3,S=Jl[(t===3?0:t===2?1:2)*3+n],R=u===3?1:2,H=eu[t][i],j=tu[i],Q=H*8*j,X=Math.floor(H*p/S+a)*j;if(qn===null){const oe=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);qn=oe?parseInt(oe[1]):0}return!!qn&&qn<=87&&i===2&&p>=224e3&&u===0&&(o[e+3]=o[e+3]|128),{sampleRate:S,channelCount:R,frameLength:X,samplesPerFrame:Q}}}function xs(o,e){return o[e]===255&&(o[e+1]&224)===224&&(o[e+1]&6)!==0}function ja(o,e){return e+1<o.length&&xs(o,e)}function iu(o,e){return xs(o,e)&&4<=o.length-e}function Ka(o,e){if(e+1<o.length&&xs(o,e)){const i=Ha(o,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===o.length||ja(o,n)}return!1}class ru extends ws{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=Fn(e,0);let r=(i==null?void 0:i.length)||0;if(Ka(e,r))return!1;for(let n=e.length;r<n;r++)if(Ml(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Fl(e,t)}appendFrame(e,t,i){Fa(e,this.observer,t,i,e.manifestCodec);const r=Ba(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Wa=(o,e)=>{let t=0,i=5;e+=i;const r=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=o[e];const u=Math.min(i,8),g=8-u;n[0]=4278190080>>>24+g<<g,r[0]=(a[0]&n[0])>>g,t=t?t<<u|r[0]:r[0],e+=1,i-=u}return t};class nu extends ws{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const r=Ga(e,t,i,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=Fn(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Ss(t)!==void 0&&Wa(e,i)<16}}function Ga(o,e,t,i,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const u=[48e3,44100,32e3][n],g=e[t+4]&63,m=[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][g*3+n]*2;if(t+m>e.length)return-1;const S=e[t+6]>>5;let R=0;S===2?R+=2:(S&1&&S!==1&&(R+=2),S&4&&(R+=2));const H=(e[t+6]<<8|e[t+7])>>12-R&1,Q=[2,1,2,3,3,4,4,5][S]+H,X=e[t+5]>>3,re=e[t+5]&7,ae=new Uint8Array([n<<6|X<<1|re>>2,(re&3)<<6|S<<3|H<<2|g>>4,g<<4&224]),oe=1536/u*9e4,de=i+r*oe,Se=e.subarray(t,t+m);return o.config=ae,o.channelCount=Q,o.samplerate=u,o.samples.push({unit:Se,pts:de}),m}class su extends ws{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Fn(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Ss(t)!==void 0&&Wa(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(Ka(e,i))return M.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return iu(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return $a(e,t,i,this.basePTS,this.frameIndex)}}const au=/\/emsg[-/]ID3/i;class ou{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,r){const n=this.videoTrack=pr("video",1),a=this.audioTrack=pr("audio",1),u=this.txtTrack=pr("text",1);if(this.id3Track=pr("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const g=Fe(e);if(g.video){const{id:p,timescale:m,codec:S,supplemental:R}=g.video;n.id=p,n.timescale=u.timescale=m,n.codec=S,n.supplemental=R}if(g.audio){const{id:p,timescale:m,codec:S}=g.audio;a.id=p,a.timescale=m,a.codec=S}u.id=St.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return be(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=st(this.remainderData,e));const u=ht(i);this.remainderData=u.remainder,r.samples=u.valid||new Uint8Array}else r.samples=i;const a=this.extractID3Track(r,t);return n.samples=it(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=it(e,t),{videoTrack:t,audioTrack:pr(),id3Track:r,textTrack:pr()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=ue(e.samples,["emsg"]);r&&r.forEach(n=>{const a=mt(n);if(au.test(a.schemeIdUri)){const u=za(a,t);let g=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;g<=.001&&(g=Number.POSITIVE_INFINITY);const p=a.payload;i.samples.push({data:p,len:p.byteLength,dts:u,pts:u,type:Wi.emsg,duration:g})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const u=za(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:u,pts:u,type:Wi.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function za(o,e){return I(o.presentationTime)?o.presentationTime/o.timeScale:e+o.presentationTimeDelta/o.timeScale}class lu{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Ar(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Zi.cbc)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(u=>{const g=new Uint8Array(u);r.set(g,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const a=je(n.data),u=this.getAvcEncryptedData(a);this.decryptBuffer(u.buffer).then(g=>{n.data=this.getAvcDecryptedUnit(a,g),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)}).catch(r)}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const a=n[i];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,i,r,a),!this.decrypter.isSync()))return}}}}class Va{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,r=i.length;if(r){const n=i[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const r=t.byteLength;let n=e.naluState||0;const a=n,u=[];let g=0,p,m,S,R=-1,H=0;for(n===-1&&(R=0,H=this.getNALuType(t,0),n=0,g=1);g<r;){if(p=t[g++],!n){n=p?0:1;continue}if(n===1){n=p?0:2;continue}if(!p)n=3;else if(p===1){if(m=g-n-1,R>=0){const j={data:t.subarray(R,m),type:H};u.push(j)}else{const j=this.getLastNalUnit(e.samples);j&&(a&&g<=4-a&&j.state&&(j.data=j.data.subarray(0,j.data.byteLength-a)),m>0&&(j.data=st(j.data,t.subarray(0,m)),j.state=0))}g<r?(S=this.getNALuType(t,g),R=g,H=S,n=0):n=-1}else n=0}if(R>=0&&n>=0){const j={data:t.subarray(R,r),type:H,state:n};u.push(j)}if(u.length===0){const j=this.getLastNalUnit(e.samples);j&&(j.data=st(j.data,t))}return e.naluState=n,u}}class Mn{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&M.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class uu extends Va{parsePES(e,t,i,r){const n=this.parseNALu(e,i.data,r);let a=this.VideoSample,u,g=!1;i.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),n.forEach(p=>{var m,S;switch(p.type){case 1:{let Q=!1;u=!0;const X=p.data;if(g&&X.length>4){const re=this.readSliceType(X);(re===2||re===4||re===7||re===9)&&(Q=!0)}if(Q){var R;(R=a)!=null&&R.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=Q;break}case 5:u=!0,(m=a)!=null&&m.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:{u=!0,qe(p.data,1,i.pts,t.samples);break}case 7:{var H,j;u=!0,g=!0;const Q=p.data,X=this.readSPS(Q);if(!e.sps||e.width!==X.width||e.height!==X.height||((H=e.pixelRatio)==null?void 0:H[0])!==X.pixelRatio[0]||((j=e.pixelRatio)==null?void 0:j[1])!==X.pixelRatio[1]){e.width=X.width,e.height=X.height,e.pixelRatio=X.pixelRatio,e.sps=[Q];const re=Q.subarray(1,4);let ae="avc1.";for(let oe=0;oe<3;oe++){let de=re[oe].toString(16);de.length<2&&(de="0"+de),ae+=de}e.codec=ae}break}case 8:u=!0,e.pps=[p.data];break;case 9:u=!0,e.audFound=!0,(S=a)!=null&&S.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:u=!0;break;default:u=!1;break}a&&u&&a.units.push(p)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Mn(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,r=8,n;for(let a=0;a<e;a++)r!==0&&(n=t.readEG(),r=(i+n+256)%256),i=r===0?i:r}readSPS(e){const t=new Mn(e);let i=0,r=0,n=0,a=0,u,g,p;const m=t.readUByte.bind(t),S=t.readBits.bind(t),R=t.readUEG.bind(t),H=t.readBoolean.bind(t),j=t.skipBits.bind(t),Q=t.skipEG.bind(t),X=t.skipUEG.bind(t),re=this.skipScalingList.bind(this);m();const ae=m();if(S(5),j(3),m(),X(),ae===100||ae===110||ae===122||ae===244||ae===44||ae===83||ae===86||ae===118||ae===128){const Pe=R();if(Pe===3&&j(1),X(),X(),j(1),H())for(g=Pe!==3?8:12,p=0;p<g;p++)H()&&(p<6?re(16,t):re(64,t))}X();const oe=R();if(oe===0)R();else if(oe===1)for(j(1),Q(),Q(),u=R(),p=0;p<u;p++)Q();X(),j(1);const de=R(),Se=R(),Ne=S(1);Ne===0&&j(1),j(1),H()&&(i=R(),r=R(),n=R(),a=R());let we=[1,1];if(H()&&H())switch(m()){case 1:we=[1,1];break;case 2:we=[12,11];break;case 3:we=[10,11];break;case 4:we=[16,11];break;case 5:we=[40,33];break;case 6:we=[24,11];break;case 7:we=[20,11];break;case 8:we=[32,11];break;case 9:we=[80,33];break;case 10:we=[18,11];break;case 11:we=[15,11];break;case 12:we=[64,33];break;case 13:we=[160,99];break;case 14:we=[4,3];break;case 15:we=[3,2];break;case 16:we=[2,1];break;case 255:{we=[m()<<8|m(),m()<<8|m()];break}}return{width:Math.ceil((de+1)*16-i*2-r*2),height:(2-Ne)*(Se+1)*16-(Ne?2:4)*(n+a),pixelRatio:we}}}class cu extends Va{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,r){const n=this.parseNALu(e,i.data,r);let a=this.VideoSample,u,g=!1;i.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),n.forEach(p=>{var m,S;switch(p.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,u=!0;break;case 16:case 17:case 18:case 21:if(u=!0,g){var R;(R=a)!=null&&R.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:u=!0,(m=a)!=null&&m.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:u=!0,qe(p.data,2,i.pts,t.samples);break;case 32:u=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=c(e.params,this.readVPS(p.data)),this.initVPS=p.data),e.vps=[p.data];break;case 33:if(u=!0,g=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],p.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const H=this.readSPS(p.data);e.width=H.width,e.height=H.height,e.pixelRatio=H.pixelRatio,e.codec=H.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const j in H.params)e.params[j]=H.params[j]}this.pushParameterSet(e.sps,p.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(u=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const H=this.readPPS(p.data);for(const j in H)e.params[j]=H[j]}this.pushParameterSet(e.pps,p.data,e.vps)}break;case 35:u=!0,e.audFound=!0,(S=a)!=null&&S.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:u=!1;break}a&&u&&a.units.push(p)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[i]=e[r],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Mn(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:r}}readSPS(e){const t=new Mn(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const r=t.readBits(2),n=t.readBoolean(),a=t.readBits(5),u=t.readUByte(),g=t.readUByte(),p=t.readUByte(),m=t.readUByte(),S=t.readUByte(),R=t.readUByte(),H=t.readUByte(),j=t.readUByte(),Q=t.readUByte(),X=t.readUByte(),re=t.readUByte(),ae=[],oe=[];for(let Zt=0;Zt<i;Zt++)ae.push(t.readBoolean()),oe.push(t.readBoolean());if(i>0)for(let Zt=i;Zt<8;Zt++)t.readBits(2);for(let Zt=0;Zt<i;Zt++)ae[Zt]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),oe[Zt]&&t.readUByte();t.readUEG();const de=t.readUEG();de==3&&t.skipBits(1);const Se=t.readUEG(),Ne=t.readUEG(),we=t.readBoolean();let Pe=0,Ie=0,Ce=0,Ye=0;we&&(Pe+=t.readUEG(),Ie+=t.readUEG(),Ce+=t.readUEG(),Ye+=t.readUEG());const _t=t.readUEG(),xt=t.readUEG(),Rt=t.readUEG(),At=t.readBoolean();for(let Zt=At?0:i;Zt<=i;Zt++)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 Ri=0;Ri<4;Ri++)for(let er=0;er<(Ri===3?2:6);er++)if(!t.readBoolean())t.readUEG();else{const ar=Math.min(64,1<<4+(Ri<<1));Ri>1&&t.readEG();for(let Dn=0;Dn<ar;Dn++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const vt=t.readUEG();let Dt=0;for(let Zt=0;Zt<vt;Zt++){let Ri=!1;if(Zt!==0&&(Ri=t.readBoolean()),Ri){Zt===vt&&t.readUEG(),t.readBoolean(),t.readUEG();let er=0;for(let an=0;an<=Dt;an++){const ar=t.readBoolean();let Dn=!1;ar||(Dn=t.readBoolean()),(ar||Dn)&&er++}Dt=er}else{const er=t.readUEG(),an=t.readUEG();Dt=er+an;for(let ar=0;ar<er;ar++)t.readUEG(),t.readBoolean();for(let ar=0;ar<an;ar++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Zt=t.readUEG();for(let Ri=0;Ri<Zt;Ri++){for(let er=0;er<Rt+4;er++)t.readBits(1);t.readBits(1)}}let ft=0,dt=1,Wt=1,Qt=!0,Gt=1,qt=0;t.readBoolean(),t.readBoolean();let Li=!1;if(t.readBoolean()){if(t.readBoolean()){const on=t.readUByte(),tl=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],hs=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];on>0&&on<16?(dt=tl[on-1],Wt=hs[on-1]):on===255&&(dt=t.readBits(16),Wt=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(),Li=t.readBoolean(),Li&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Gt=t.readBits(32),qt=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const hs=t.readBoolean(),il=t.readBoolean();let Hn=!1;(hs||il)&&(Hn=t.readBoolean(),Hn&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Hn&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let rl=0;rl<=i;rl++){Qt=t.readBoolean();const Wh=Qt||t.readBoolean();let nl=!1;Wh?t.readEG():nl=t.readBoolean();const sl=nl?1:t.readUEG()+1;if(hs)for(let jn=0;jn<sl;jn++)t.readUEG(),t.readUEG(),Hn&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(il)for(let jn=0;jn<sl;jn++)t.readUEG(),t.readUEG(),Hn&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),ft=t.readUEG())}let Ji=Se,vr=Ne;if(we){let Zt=1,Ri=1;de===1?Zt=Ri=2:de==2&&(Zt=2),Ji=Se-Zt*Ie-Zt*Pe,vr=Ne-Ri*Ye-Ri*Ce}const sn=r?["A","B","C"][r]:"",Kh=u<<24|g<<16|p<<8|m;let ra=0;for(let Zt=0;Zt<32;Zt++)ra=(ra|(Kh>>Zt&1)<<31-Zt)>>>0;let na=ra.toString(16);return a===1&&na==="2"&&(na="6"),{codecString:`hvc1.${sn}${a}.${na}.${n?"H":"L"}${re}.B0`,params:{general_tier_flag:n,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[u,g,p,m],general_constraint_indicator_flags:[S,R,H,j,Q,X],general_level_idc:re,bit_depth:_t+8,bit_depth_luma_minus8:_t,bit_depth_chroma_minus8:xt,min_spatial_segmentation_idc:ft,chroma_format_idc:de,frame_rate:{fixed:Qt,fps:qt/Gt}},width:Ji,height:vr,pixelRatio:[dt,Wt]}}readPPS(e){const t=new Mn(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 r=t.readBoolean(),n=t.readBoolean();let a=1;return n&&r?a=0:n?a=3:r&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Ei=188;class Ur{constructor(e,t,i,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=r,this.videoParser=null}static probe(e,t){const i=Ur.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(Ei*5,t-Ei)+1,r=0;for(;r<i;){let n=!1,a=-1,u=0;for(let g=r;g<t;g+=Ei)if(e[g]===71&&(t-g===Ei||e[g+Ei]===71)){if(u++,a===-1&&(a=g,a!==0&&(i=Math.min(a+Ei*99,e.length-Ei)+1)),n||(n=As(e,g)===0),n&&u>1&&(a===0&&u>2||g+Ei>i))return a}else{if(u)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:St[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Ur.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Ur.createTrack("audio",r),this._id3Track=Ur.createTrack("id3"),this._txtTrack=Ur.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,r=!1){i||(this.sampleAes=null);let n;const a=this._videoTrack,u=this._audioTrack,g=this._id3Track,p=this._txtTrack;let m=a.pid,S=a.pesData,R=u.pid,H=g.pid,j=u.pesData,Q=g.pesData,X=null,re=this.pmtParsed,ae=this._pmtId,oe=e.length;if(this.remainderData&&(e=st(this.remainderData,e),oe=e.length,this.remainderData=null),oe<Ei&&!r)return this.remainderData=e,{audioTrack:u,videoTrack:a,id3Track:g,textTrack:p};const de=Math.max(0,Ur.syncOffset(e));oe-=(oe-de)%Ei,oe<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,oe,e.buffer.byteLength-oe));let Se=0;for(let we=de;we<oe;we+=Ei)if(e[we]===71){const Pe=!!(e[we+1]&64),Ie=As(e,we),Ce=(e[we+3]&48)>>4;let Ye;if(Ce>1){if(Ye=we+5+e[we+4],Ye===we+Ei)continue}else Ye=we+4;switch(Ie){case m:Pe&&(S&&(n=Sn(S,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,p,n,!1)),S={data:[],size:0}),S&&(S.data.push(e.subarray(Ye,we+Ei)),S.size+=we+Ei-Ye);break;case R:if(Pe){if(j&&(n=Sn(j,this.logger)))switch(u.segmentCodec){case"aac":this.parseAACPES(u,n);break;case"mp3":this.parseMPEGPES(u,n);break;case"ac3":this.parseAC3PES(u,n);break}j={data:[],size:0}}j&&(j.data.push(e.subarray(Ye,we+Ei)),j.size+=we+Ei-Ye);break;case H:Pe&&(Q&&(n=Sn(Q,this.logger))&&this.parseID3PES(g,n),Q={data:[],size:0}),Q&&(Q.data.push(e.subarray(Ye,we+Ei)),Q.size+=we+Ei-Ye);break;case 0:Pe&&(Ye+=e[Ye]+1),ae=this._pmtId=hu(e,Ye);break;case ae:{Pe&&(Ye+=e[Ye]+1);const _t=fu(e,Ye,this.typeSupported,i,this.observer,this.logger);m=_t.videoPid,m>0&&(a.pid=m,a.segmentCodec=_t.segmentVideoCodec),R=_t.audioPid,R>0&&(u.pid=R,u.segmentCodec=_t.segmentAudioCodec),H=_t.id3Pid,H>0&&(g.pid=H),X!==null&&!re&&(this.logger.warn(`MPEG-TS PMT found at ${we} after unknown PID '${X}'. Backtracking to sync byte @${de} to parse all TS packets.`),X=null,we=de-188),re=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=Ie;break}}else Se++;Se>0&&Cs(this.observer,new Error(`Found ${Se} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=S,u.pesData=j,g.pesData=Q;const Ne={audioTrack:u,videoTrack:a,id3Track:g,textTrack:p};return r&&this.extractRemainingSamples(Ne),Ne}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:r,textTrack:n}=e,a=i.pesData,u=t.pesData,g=r.pesData;let p;if(a&&(p=Sn(a,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,n,p,!0),i.pesData=null)):i.pesData=a,u&&(p=Sn(u,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,p);break;case"mp3":this.parseMPEGPES(t,p);break;case"ac3":this.parseAC3PES(t,p);break}t.pesData=null}else u!=null&&u.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=u;g&&(p=Sn(g,this.logger))?(this.parseID3PES(r,p),r.pesData=null):r.pesData=g}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new lu(this.observer,this.config,t);return this.decrypt(r,n)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new uu:e==="hevc"&&(this.videoParser=new cu))}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const S=r.missing,R=r.sample.unit.byteLength;if(S===-1)n=st(r.sample.unit,n);else{const H=R-S;r.sample.unit.set(n.subarray(0,S),H),e.samples.push(r.sample),i=r.missing}}let a,u;for(a=i,u=n.length;a<u-1&&!zn(n,a);a++);if(a!==i){let S;const R=a<u-1;if(R?S=`AAC PES did not start with ADTS header,offset:${a}`:S="No ADTS header found in AAC PES",Cs(this.observer,new Error(S),R,this.logger),!R)return}Fa(e,this.observer,n,a,this.audioCodec);let g;if(t.pts!==void 0)g=t.pts;else if(r){const S=Ma(e.samplerate);g=r.sample.pts+S}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let p=0,m;for(;a<u;)if(m=Ba(e,n,a,g,p),a+=m.length,m.missing){this.aacOverFlow=m;break}else for(p++;a<u-1&&!zn(n,a);a++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,a=0;const u=t.pts;if(u===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<r;)if(ja(i,a)){const g=$a(e,i,a,u,n);if(g)a+=g.length,n++;else break}else a++}parseAC3PES(e,t){{const i=t.data,r=t.pts;if(r===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=i.length;let a=0,u=0,g;for(;u<n&&(g=Ga(e,i,u,r,a++))>0;)u+=g}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=c({},t,{type:this._videoTrack?Wi.emsg:Wi.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function As(o,e){return((o[e+1]&31)<<8)+o[e+2]}function hu(o,e){return(o[e+10]&31)<<8|o[e+11]}function fu(o,e,t,i,r,n){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},u=(o[e+1]&15)<<8|o[e+2],g=e+3+u-4,p=(o[e+10]&15)<<8|o[e+11];for(e+=12+p;e<g;){const m=As(o,e),S=(o[e+3]&15)<<8|o[e+4];switch(o[e]){case 207:if(!i){Ts("ADTS AAC",n);break}case 15:a.audioPid===-1&&(a.audioPid=m);break;case 21:a.id3Pid===-1&&(a.id3Pid=m);break;case 219:if(!i){Ts("H.264",n);break}case 27:a.videoPid===-1&&(a.videoPid=m);break;case 3:case 4:!t.mpeg&&!t.mp3?n.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=m,a.segmentAudioCodec="mp3");break;case 193:if(!i){Ts("AC-3",n);break}case 129:t.ac3?a.audioPid===-1&&(a.audioPid=m,a.segmentAudioCodec="ac3"):n.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&S>0){let R=e+5,H=S;for(;H>2;){switch(o[R]){case 106:t.ac3!==!0?n.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=m,a.segmentAudioCodec="ac3");break}const Q=o[R+1]+2;R+=Q,H-=Q}}break;case 194:case 135:return Cs(r,new Error("Unsupported EC-3 in M2TS found"),void 0,n),a;case 36:a.videoPid===-1&&(a.videoPid=m,a.segmentVideoCodec="hevc",n.log("HEVC in M2TS found"));break}e+=S+5}return a}function Cs(o,e,t,i){i.warn(`parsing error: ${e.message}`),o.emit(_.ERROR,_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Ts(o,e){e.log(`${o} with AES-128-CBC encryption found in unencrypted stream`)}function Sn(o,e){let t=0,i,r,n,a,u;const g=o.data;if(!o||o.size===0)return null;for(;g[0].length<19&&g.length>1;)g[0]=st(g[0],g[1]),g.splice(1,1);if(i=g[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(r=(i[4]<<8)+i[5],r&&r>o.size-6)return null;const m=i[7];m&192&&(a=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,m&64?(u=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,a-u>60*9e4&&(e.warn(`${Math.round((a-u)/9e4)}s delta between PTS and DTS, align them`),a=u)):u=a),n=i[8];let S=n+9;if(o.size<=S)return null;o.size-=S;const R=new Uint8Array(o.size);for(let H=0,j=g.length;H<j;H++){i=g[H];let Q=i.byteLength;if(S)if(S>Q){S-=Q;continue}else i=i.subarray(S),Q-=S,S=0;R.set(i,t),t+=Q}return r&&(r-=n+3),{data:R,pts:a,dts:u,len:r}}return null}class du{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 $r=Math.pow(2,32)-1;class Le{static init(){Le.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 Le.types)Le.types.hasOwnProperty(e)&&(Le.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Le.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);Le.STTS=Le.STSC=Le.STCO=n,Le.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Le.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Le.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Le.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),g=new Uint8Array([0,0,0,1]);Le.FTYP=Le.box(Le.types.ftyp,a,g,a,u),Le.DINF=Le.box(Le.types.dinf,Le.box(Le.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=i&255,a.set(e,4),r=0,i=8;r<n;r++)a.set(t[r],i),i+=t[r].byteLength;return a}static hdlr(e){return Le.box(Le.types.hdlr,Le.HDLR_TYPES[e])}static mdat(e){return Le.box(Le.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/($r+1)),r=Math.floor(t%($r+1));return Le.box(Le.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return Le.box(Le.types.mdia,Le.mdhd(e.timescale||0,e.duration||0),Le.hdlr(e.type),Le.minf(e))}static mfhd(e){return Le.box(Le.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"?Le.box(Le.types.minf,Le.box(Le.types.smhd,Le.SMHD),Le.DINF,Le.stbl(e)):Le.box(Le.types.minf,Le.box(Le.types.vmhd,Le.VMHD),Le.DINF,Le.stbl(e))}static moof(e,t,i){return Le.box(Le.types.moof,Le.mfhd(e),Le.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Le.trak(e[t]);return Le.box.apply(null,[Le.types.moov,Le.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(Le.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Le.trex(e[t]);return Le.box.apply(null,[Le.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/($r+1)),r=Math.floor(t%($r+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&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 Le.box(Le.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return Le.box(Le.types.sdtp,i)}static stbl(e){return Le.box(Le.types.stbl,Le.stsd(e),Le.box(Le.types.stts,Le.STTS),Le.box(Le.types.stsc,Le.STSC),Le.box(Le.types.stsz,Le.STSZ),Le.box(Le.types.stco,Le.STCO))}static avc1(e){let t=[],i=[],r,n,a;for(r=0;r<e.sps.length;r++)n=e.sps[r],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],a=n.byteLength,i.push(a>>>8&255),i.push(a&255),i=i.concat(Array.prototype.slice.call(n));const u=Le.box(Le.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),g=e.width,p=e.height,m=e.pixelRatio[0],S=e.pixelRatio[1];return Le.box(Le.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,g>>8&255,g&255,p>>8&255,p&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,Le.box(Le.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Le.box(Le.types.pasp,new Uint8Array([m>>24,m>>16&255,m>>8&255,m&255,S>>24,S>>16&255,S>>8&255,S&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 Le.box(Le.types.mp4a,Le.audioStsd(e),Le.box(Le.types.esds,Le.esds(e)))}static mp3(e){return Le.box(Le.types[".mp3"],Le.audioStsd(e))}static ac3(e){return Le.box(Le.types["ac-3"],Le.audioStsd(e),Le.box(Le.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Le.box(Le.types.stsd,Le.STSD,Le.mp4a(e));if(t==="ac3"&&e.config)return Le.box(Le.types.stsd,Le.STSD,Le.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Le.box(Le.types.stsd,Le.STSD,Le.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Le.box(Le.types.stsd,Le.STSD,Le.avc1(e));if(t==="hevc"&&e.vps)return Le.box(Le.types.stsd,Le.STSD,Le.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),r=e.width||0,n=e.height||0,a=Math.floor(i/($r+1)),u=Math.floor(i%($r+1));return Le.box(Le.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,a>>24,a>>16&255,a>>8&255,a&255,u>>24,u>>16&255,u>>8&255,u&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,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=Le.sdtp(e),r=e.id,n=Math.floor(t/($r+1)),a=Math.floor(t%($r+1));return Le.box(Le.types.traf,Le.box(Le.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),Le.box(Le.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),Le.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Le.box(Le.types.trak,Le.tkhd(e),Le.mdia(e))}static trex(e){const t=e.id;return Le.box(Le.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],r=i.length,n=12+16*r,a=new Uint8Array(n);let u,g,p,m,S,R;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),u=0;u<r;u++)g=i[u],p=g.duration,m=g.size,S=g.flags,R=g.cts,a.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255,S.isLeading<<2|S.dependsOn,S.isDependedOn<<6|S.hasRedundancy<<4|S.paddingValue<<1|S.isNonSync,S.degradPrio&61440,S.degradPrio&15,R>>>24&255,R>>>16&255,R>>>8&255,R&255],12+16*u);return Le.box(Le.types.trun,a)}static initSegment(e){Le.types||Le.init();const t=Le.moov(e);return st(Le.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],r=4,n=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),r-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let a=n.length;for(let j=0;j<i.length;j+=1){a+=3;for(let Q=0;Q<i[j].length;Q+=1)a+=2+i[j][Q].length}const u=new Uint8Array(a);u.set(n,0),a=n.length;const g=i.length-1;for(let j=0;j<i.length;j+=1){u.set(new Uint8Array([32+j|(j===g?128:0),0,i[j].length]),a),a+=3;for(let Q=0;Q<i[j].length;Q+=1)u.set(new Uint8Array([i[j][Q].length>>8,i[j][Q].length&255]),a),a+=2,u.set(i[j][Q],a),a+=i[j][Q].length}const p=Le.box(Le.types.hvcC,u),m=e.width,S=e.height,R=e.pixelRatio[0],H=e.pixelRatio[1];return Le.box(Le.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,m>>8&255,m&255,S>>8&255,S&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]),p,Le.box(Le.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Le.box(Le.types.pasp,new Uint8Array([R>>24,R>>16&255,R>>8&255,R&255,H>>24,H>>16&255,H>>8&255,H&255])))}}Le.types=void 0,Le.HDLR_TYPES=void 0,Le.STTS=void 0,Le.STSC=void 0,Le.STCO=void 0,Le.STSZ=void 0,Le.VMHD=void 0,Le.SMHD=void 0,Le.STSD=void 0,Le.FTYP=void 0,Le.DINF=void 0;const qa=9e4;function Ds(o,e,t=1,i=!1){const r=o*e*t;return i?Math.round(r):r}function pu(o,e,t=1,i=!1){return Ds(o,e,1/t,i)}function Bn(o,e=!1){return Ds(o,1e3,1/qa,e)}function _u(o,e=1){return Ds(o,qa,1/e)}function Ya(o){const{baseTime:e,timescale:t,trackId:i}=o;return`${e/t} (${e}/${t}) trackId: ${i}`}const gu=10*1e3,mu=1024,vu=1152,yu=1536;let wn=null,Ls=null;function Za(o,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:o?2:1,isNonSync:o?0:1}}}class Yn extends T{constructor(e,t,i,r){if(super("mp4-remuxer",r),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=i,this.ISGenerated=!1,wn===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);wn=a?parseInt(a[1]):0}if(Ls===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);Ls=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&Ya(t)} > ${e&&Ya(e)}`),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 i=e[0].pts,r=e.reduce((n,a)=>{let u=a.pts,g=u-n;return g<-4294967296&&(t=!0,u=Gi(u,i),g=u-n),g>0?n:u},i);return t&&this.debug("PTS rollover detected"),r}remux(e,t,i,r,n,a,u,g){let p,m,S,R,H,j,Q=n,X=n;const re=e.pid>-1,ae=t.pid>-1,oe=t.samples.length,de=e.samples.length>0,Se=u&&oe>0||oe>1;if((!re||de)&&(!ae||Se)||this.ISGenerated||u){if(this.ISGenerated){var we,Pe,Ie,Ce;const Rt=this.videoTrackConfig;(Rt&&(t.width!==Rt.width||t.height!==Rt.height||((we=t.pixelRatio)==null?void 0:we[0])!==((Pe=Rt.pixelRatio)==null?void 0:Pe[0])||((Ie=t.pixelRatio)==null?void 0:Ie[1])!==((Ce=Rt.pixelRatio)==null?void 0:Ce[1]))||!Rt&&Se||this.nextAudioTs===null&&de)&&this.resetInitSegment()}this.ISGenerated||(S=this.generateIS(e,t,n,a));const Ye=this.isVideoContiguous;let _t=-1,xt;if(Se&&(_t=bu(t.samples),!Ye&&this.config.forceKeyFrameOnDiscontinuity))if(j=!0,_t>0){this.warn(`Dropped ${_t} out of ${oe} video samples due to a missing keyframe`);const Rt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(_t),t.dropped+=_t,X+=(t.samples[0].pts-Rt)/t.inputTimeScale,xt=X}else _t===-1&&(this.warn(`No keyframe found out of ${oe} video samples`),j=!1);if(this.ISGenerated){if(de&&Se){const Rt=this.getVideoStartPts(t.samples),ot=(Gi(e.samples[0].pts,Rt)-Rt)/t.inputTimeScale;Q+=Math.max(0,ot),X+=Math.max(0,-ot)}if(de){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),S=this.generateIS(e,t,n,a)),m=this.remuxAudio(e,Q,this.isAudioContiguous,a,ae||Se||g===v.AUDIO?X:void 0),Se){const Rt=m?m.endPTS-m.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),S=this.generateIS(e,t,n,a)),p=this.remuxVideo(t,X,Ye,Rt)}}else Se&&(p=this.remuxVideo(t,X,Ye,0));p&&(p.firstKeyFrame=_t,p.independent=_t!==-1,p.firstKeyFramePTS=xt)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(H=Xa(i,n,this._initPTS,this._initDTS)),r.samples.length&&(R=Qa(r,n,this._initPTS))),{audio:m,video:p,initSegment:S,independent:j,text:R,id3:H}}computeInitPts(e,t,i,r){const n=Math.round(i*t);let a=Gi(e,n);if(a<n+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(n-a)/t} ${r}`);a<n+t;)a+=8589934592;return a-n}generateIS(e,t,i,r){const n=e.samples,a=t.samples,u=this.typeSupported,g={},p=this._initPTS;let m=!p||r,S="audio/mp4",R,H,j,Q=-1;if(m&&(R=H=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":u.mpeg?(S="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}g.audio={id:"audio",container:S,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&u.mpeg?new Uint8Array(0):Le.initSegment([e]),metadata:{channelCount:e.channelCount}},m&&(Q=e.id,j=e.inputTimeScale,!p||j!==p.timescale?R=H=this.computeInitPts(n[0].pts,j,i,"audio"):m=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,g.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Le.initSegment([t]),metadata:{width:t.width,height:t.height}},m)if(Q=t.id,j=t.inputTimeScale,!p||j!==p.timescale){const X=this.getVideoStartPts(a),re=Gi(a[0].dts,X),ae=this.computeInitPts(re,j,i,"video"),oe=this.computeInitPts(X,j,i,"video");H=Math.min(H,ae),R=Math.min(R,oe)}else m=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(g).length)return this.ISGenerated=!0,m?(p&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${i} ${R/j} != initPTS: ${p.baseTime/p.timescale} (${p.baseTime}/${p.timescale}) trackId: ${p.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${R/j} (${R}/${j}) trackId: ${Q}`),this._initPTS={baseTime:R,timescale:j,trackId:Q},this._initDTS={baseTime:H,timescale:j,trackId:Q}):R=j=void 0,{tracks:g,initPTS:R,timescale:j,trackId:Q}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,a=e.samples,u=[],g=a.length,p=this._initPTS,m=p.baseTime*n/p.timescale;let S=this.nextVideoTs,R=8,H=this.videoSampleDuration,j,Q,X=Number.POSITIVE_INFINITY,re=Number.NEGATIVE_INFINITY,ae=!1;if(!i||S===null){const ft=m+t*n,dt=a[0].pts-Gi(a[0].dts,a[0].pts);wn&&S!==null&&Math.abs(ft-dt-(S+m))<15e3?i=!0:S=ft-dt-m}const oe=S+m;for(let ft=0;ft<g;ft++){const dt=a[ft];dt.pts=Gi(dt.pts,oe),dt.dts=Gi(dt.dts,oe),dt.dts<a[ft>0?ft-1:ft].dts&&(ae=!0)}ae&&a.sort(function(ft,dt){const Wt=ft.dts-dt.dts,Qt=ft.pts-dt.pts;return Wt||Qt}),j=a[0].dts,Q=a[a.length-1].dts;const de=Q-j,Se=de?Math.round(de/(g-1)):H||e.inputTimeScale/30;if(i){const ft=j-oe,dt=ft>Se,Wt=ft<-1;if((dt||Wt)&&(dt?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Bn(ft,!0)} ms (${ft}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Bn(-ft,!0)} ms (${ft}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Wt||oe>=a[0].pts||wn)){j=oe;const Qt=a[0].pts-ft;if(dt)a[0].dts=j,a[0].pts=Qt;else{let Gt=!0;for(let qt=0;qt<a.length&&!(a[qt].dts>Qt&&Gt);qt++){const Li=a[qt].pts;if(a[qt].dts-=ft,a[qt].pts-=ft,qt<a.length-1){const Ai=a[qt+1].pts,Ji=a[qt].pts,vr=Ai<=Ji,sn=Ai<=Li;Gt=vr==sn}}}this.log(`Video: Initial PTS/DTS adjusted: ${Bn(Qt,!0)}/${Bn(j,!0)}, delta: ${Bn(ft,!0)} ms`)}}j=Math.max(0,j);let Ne=0,we=0,Pe=j;for(let ft=0;ft<g;ft++){const dt=a[ft],Wt=dt.units,Qt=Wt.length;let Gt=0;for(let qt=0;qt<Qt;qt++)Gt+=Wt[qt].data.length;we+=Gt,Ne+=Qt,dt.length=Gt,dt.dts<Pe?(dt.dts=Pe,Pe+=Se/4|0||1):Pe=dt.dts,X=Math.min(dt.pts,X),re=Math.max(dt.pts,re)}Q=a[g-1].dts;const Ie=we+4*Ne+8;let Ce;try{Ce=new Uint8Array(Ie)}catch(ft){this.observer.emit(_.ERROR,_.ERROR,{type:D.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:ft,bytes:Ie,reason:`fail allocating video mdat ${Ie}`});return}const Ye=new DataView(Ce.buffer);Ye.setUint32(0,Ie),Ce.set(Le.types.mdat,4);let _t=!1,xt=Number.POSITIVE_INFINITY,Rt=Number.POSITIVE_INFINITY,At=Number.NEGATIVE_INFINITY,ot=Number.NEGATIVE_INFINITY;for(let ft=0;ft<g;ft++){const dt=a[ft],Wt=dt.units;let Qt=0;for(let Li=0,Ai=Wt.length;Li<Ai;Li++){const Ji=Wt[Li],vr=Ji.data,sn=Ji.data.byteLength;Ye.setUint32(R,sn),R+=4,Ce.set(vr,R),R+=sn,Qt+=4+sn}let Gt;if(ft<g-1)H=a[ft+1].dts-dt.dts,Gt=a[ft+1].pts-dt.pts;else{const Li=this.config,Ai=ft>0?dt.dts-a[ft-1].dts:Se;if(Gt=ft>0?dt.pts-a[ft-1].pts:Se,Li.stretchShortVideoTrack&&this.nextAudioTs!==null){const Ji=Math.floor(Li.maxBufferHole*n),vr=(r?X+r*n:this.nextAudioTs+m)-dt.pts;vr>Ji?(H=vr-Ai,H<0?H=Ai:_t=!0,this.log(`It is approximately ${vr/90} ms to the next segment; using duration ${H/90} ms for the last video frame.`)):H=Ai}else H=Ai}const qt=Math.round(dt.pts-dt.dts);xt=Math.min(xt,H),At=Math.max(At,H),Rt=Math.min(Rt,Gt),ot=Math.max(ot,Gt),u.push(Za(dt.key,H,Qt,qt))}if(u.length){if(wn){if(wn<70){const ft=u[0].flags;ft.dependsOn=2,ft.isNonSync=0}}else if(Ls&&ot-Rt<At-xt&&Se/At<.025&&u[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let ft=j;for(let dt=0,Wt=u.length;dt<Wt;dt++){const Qt=ft+u[dt].duration,Gt=ft+u[dt].cts;if(dt<Wt-1){const qt=Qt+u[dt+1].cts;u[dt].duration=qt-Gt}else u[dt].duration=dt?u[dt-1].duration:Se;u[dt].cts=0,ft=Qt}}}H=_t||!H?Se:H;const Ct=Q+H;this.nextVideoTs=S=Ct-m,this.videoSampleDuration=H,this.isVideoContiguous=!0;const Ft={data1:Le.moof(e.sequenceNumber++,j,c(e,{samples:u})),data2:Ce,startPTS:(X-m)/n,endPTS:(re+H-m)/n,startDTS:(j-m)/n,endDTS:S/n,type:"video",hasAudio:!1,hasVideo:!0,nb:u.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Ft}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return vu;case"ac3":return yu;default:return mu}}remuxAudio(e,t,i,r,n){const a=e.inputTimeScale,u=e.samplerate?e.samplerate:a,g=a/u,p=this.getSamplesPerFrame(e),m=p*g,S=this._initPTS,R=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,H=[],j=n!==void 0;let Q=e.samples,X=R?0:8,re=this.nextAudioTs||-1;const ae=S.baseTime*a/S.timescale,oe=ae+t*a;if(this.isAudioContiguous=i=i||Q.length&&re>0&&(r&&Math.abs(oe-(re+ae))<9e3||Math.abs(Gi(Q[0].pts,oe)-(re+ae))<20*m),Q.forEach(function(ot){ot.pts=Gi(ot.pts,oe)}),!i||re<0){const ot=Q.length;if(Q=Q.filter(Ct=>Ct.pts>=0),ot!==Q.length&&this.warn(`Removed ${Q.length-ot} of ${ot} samples (initPTS ${ae} / ${a})`),!Q.length)return;n===0?re=0:r&&!j?re=Math.max(0,oe-ae):re=Q[0].pts-ae}if(e.segmentCodec==="aac"){const ot=this.config.maxAudioFramesDrift;for(let Ct=0,vt=re+ae;Ct<Q.length;Ct++){const Dt=Q[Ct],Ft=Dt.pts,ft=Ft-vt,dt=Math.abs(1e3*ft/a);if(ft<=-ot*m&&j)Ct===0&&(this.warn(`Audio frame @ ${(Ft/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*ft/a)} ms.`),this.nextAudioTs=re=Ft-ae,vt=Ft);else if(ft>=ot*m&&dt<gu&&j){let Wt=Math.round(ft/m);for(vt=Ft-Wt*m;vt<0&&Wt&&m;)Wt--,vt+=m;Ct===0&&(this.nextAudioTs=re=vt-ae),this.warn(`Injecting ${Wt} audio frames @ ${((vt-ae)/a).toFixed(3)}s due to ${Math.round(1e3*ft/a)} ms gap.`);for(let Qt=0;Qt<Wt;Qt++){let Gt=du.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Gt||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Gt=Dt.unit.subarray()),Q.splice(Ct,0,{unit:Gt,pts:vt}),vt+=m,Ct++}}Dt.pts=vt,vt+=m}}let de=null,Se=null,Ne,we=0,Pe=Q.length;for(;Pe--;)we+=Q[Pe].unit.byteLength;for(let ot=0,Ct=Q.length;ot<Ct;ot++){const vt=Q[ot],Dt=vt.unit;let Ft=vt.pts;if(Se!==null){const dt=H[ot-1];dt.duration=Math.round((Ft-Se)/g)}else if(i&&e.segmentCodec==="aac"&&(Ft=re+ae),de=Ft,we>0){we+=X;try{Ne=new Uint8Array(we)}catch(dt){this.observer.emit(_.ERROR,_.ERROR,{type:D.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:dt,bytes:we,reason:`fail allocating audio mdat ${we}`});return}R||(new DataView(Ne.buffer).setUint32(0,we),Ne.set(Le.types.mdat,4))}else return;Ne.set(Dt,X);const ft=Dt.byteLength;X+=ft,H.push(Za(!0,p,ft,0)),Se=Ft}const Ie=H.length;if(!Ie)return;const Ce=H[H.length-1];re=Se-ae,this.nextAudioTs=re+g*Ce.duration;const Ye=R?new Uint8Array(0):Le.moof(e.sequenceNumber++,de/g,c({},e,{samples:H}));e.samples=[];const _t=(de-ae)/a,xt=re/a,At={data1:Ye,data2:Ne,startPTS:_t,endPTS:xt,startDTS:_t,endDTS:xt,type:"audio",hasAudio:!0,hasVideo:!1,nb:Ie};return this.isAudioContiguous=!0,At}}function Gi(o,e){let t;if(e===null)return o;for(e<o?t=-8589934592:t=8589934592;Math.abs(o-e)>4294967296;)o+=t;return o}function bu(o){for(let e=0;e<o.length;e++)if(o[e].key)return e;return-1}function Xa(o,e,t,i){const r=o.samples.length;if(!r)return;const n=o.inputTimeScale;for(let u=0;u<r;u++){const g=o.samples[u];g.pts=Gi(g.pts-t.baseTime*n/t.timescale,e*n)/n,g.dts=Gi(g.dts-i.baseTime*n/i.timescale,e*n)/n}const a=o.samples;return o.samples=[],{samples:a}}function Qa(o,e,t){const i=o.samples.length;if(!i)return;const r=o.inputTimeScale;for(let a=0;a<i;a++){const u=o.samples[a];u.pts=Gi(u.pts-t.baseTime*r/t.timescale,e*r)/r}o.samples.sort((a,u)=>a.pts-u.pts);const n=o.samples;return o.samples=[],{samples:n}}class Eu extends T{constructor(e,t,i,r){super("passthrough-remuxer",r),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,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:n,video:a}=this.initData=Fe(e);if(t)Ve(e,t);else{const g=n||a;g!=null&&g.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${g.codec}")!`)}n&&(i=Ja(n,V.AUDIO,this)),a&&(r=Ja(a,V.VIDEO,this));const u={};n&&a?u.audiovideo={container:"video/mp4",codec:i+","+r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:n?u.audio={container:"audio/mp4",codec:i,encrypted:n.encrypted,initSegment:e,id:"audio"}:a?u.video={container:"video/mp4",codec:r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=u}remux(e,t,i,r,n,a){var u,g;let{initPTS:p,lastEndTime:m}=this;const S={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};I(m)||(m=this.lastEndTime=n||0);const R=t.samples;if(!R.length)return S;const H={initPTS:void 0,timescale:void 0,trackId:void 0};let j=this.initData;if((u=j)!=null&&u.length||(this.generateInitSegment(R),j=this.initData),!((g=j)!=null&&g.length))return this.warn("Failed to generate initSegment."),S;this.emitInitSegment&&(H.tracks=this.initTracks,this.emitInitSegment=!1);const Q=Xe(R,j,this),X=j.audio?Q[j.audio.id]:null,re=j.video?Q[j.video.id]:null,ae=Zn(re,1/0),oe=Zn(X,1/0),de=Zn(re,0,!0),Se=Zn(X,0,!0);let Ne=n,we=0;const Pe=X&&(!re||!p&&oe<ae||p&&p.trackId===j.audio.id),Ie=Pe?X:re;if(Ie){const vt=Ie.timescale,Dt=Ie.start-n*vt,Ft=Pe?j.audio.id:j.video.id;Ne=Ie.start/vt,we=Pe?Se-oe:de-ae,(a||!p)&&(Su(p,Ne,n,we)||vt!==p.timescale)&&(p&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${n} ${Dt/vt} != initPTS: ${p.baseTime/p.timescale} (${p.baseTime}/${p.timescale}) trackId: ${p.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${Ne-n} (${Dt}/${vt}) trackId: ${Ft}`),p=null,H.initPTS=Dt,H.timescale=vt,H.trackId=Ft)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${n}`);p?(H.initPTS=p.baseTime,H.timescale=p.timescale,H.trackId=p.trackId):((!H.timescale||H.trackId===void 0||H.initPTS===void 0)&&(this.warn("Could not set initPTS"),H.initPTS=Ne,H.timescale=1,H.trackId=-1),this.initPTS=p={baseTime:H.initPTS,timescale:H.timescale,trackId:H.trackId});const Ce=Ne-p.baseTime/p.timescale,Ye=Ce+we;we>0?this.lastEndTime=Ye:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const _t=!!j.audio,xt=!!j.video;let Rt="";_t&&(Rt+="audio"),xt&&(Rt+="video");const At=(j.audio?j.audio.encrypted:!1)||(j.video?j.video.encrypted:!1),ot={data1:R,startPTS:Ce,startDTS:Ce,endPTS:Ye,endDTS:Ye,type:Rt,hasAudio:_t,hasVideo:xt,nb:1,dropped:0,encrypted:At};S.audio=_t&&!xt?ot:void 0,S.video=xt?ot:void 0;const Ct=re==null?void 0:re.sampleCount;if(Ct){const vt=re.keyFrameIndex,Dt=vt!==-1;ot.nb=Ct,ot.dropped=vt===0||this.isVideoContiguous?0:Dt?vt:Ct,ot.independent=Dt,ot.firstKeyFrame=vt,Dt&&re.keyFrameStart&&(ot.firstKeyFramePTS=(re.keyFrameStart-p.baseTime)/p.timescale),this.isVideoContiguous||(S.independent=Dt),this.isVideoContiguous||(this.isVideoContiguous=Dt),ot.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${vt}/${Ct} dropped: ${ot.dropped} start: ${ot.firstKeyFramePTS||"NA"}`)}return S.initSegment=H,S.id3=Xa(i,n,p,p),r.samples.length&&(S.text=Qa(r,n,p)),S}}function Zn(o,e,t=!1){return(o==null?void 0:o.start)!==void 0?(o.start+(t?o.duration:0))/o.timescale:e}function Su(o,e,t,i){if(o===null)return!0;const r=Math.max(i,1),n=e-o.baseTime/o.timescale;return Math.abs(n-t)>r}function Ja(o,e,t){const i=o.codec;return i&&i.length>4?i:e===V.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?et(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let Rr;try{Rr=self.performance.now.bind(self.performance)}catch(o){Rr=Date.now}const Xn=[{demux:ou,remux:Eu},{demux:Ur,remux:Yn},{demux:ru,remux:Yn},{demux:su,remux:Yn}];Xn.splice(2,0,{demux:nu,remux:Yn});class eo{constructor(e,t,i,r,n,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=n,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=Rr();let a=new Uint8Array(e);const{currentTransmuxState:u,transmuxConfig:g}=this;r&&(this.currentTransmuxState=r);const{contiguous:p,discontinuity:m,trackSwitch:S,accurateTimeOffset:R,timeOffset:H,initSegmentChange:j}=r||u,{audioCodec:Q,videoCodec:X,defaultInitPts:re,duration:ae,initSegmentData:oe}=g,de=wu(a,t);if(de&&Qi(de.method)){const Pe=this.getDecrypter(),Ie=Br(de.method);if(Pe.isSync()){let Ce=Pe.softwareDecrypt(a,de.key.buffer,de.iv.buffer,Ie);if(i.part>-1){const _t=Pe.flush();Ce=_t&&_t.buffer}if(!Ce)return n.executeEnd=Rr(),Rs(i);a=new Uint8Array(Ce)}else return this.asyncResult=!0,this.decryptionPromise=Pe.webCryptoDecrypt(a,de.key.buffer,de.iv.buffer,Ie).then(Ce=>{const Ye=this.push(Ce,null,i);return this.decryptionPromise=null,Ye}),this.decryptionPromise}const Se=this.needsProbing(m,S);if(Se){const Pe=this.configureTransmuxer(a);if(Pe)return this.logger.warn(`[transmuxer] ${Pe.message}`),this.observer.emit(_.ERROR,_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:Pe,reason:Pe.message}),n.executeEnd=Rr(),Rs(i)}(m||S||j||Se)&&this.resetInitSegment(oe,Q,X,ae,t),(m||j||Se)&&this.resetInitialTimestamp(re),p||this.resetContiguity();const Ne=this.transmux(a,de,H,R,i);this.asyncResult=Nn(Ne);const we=this.currentTransmuxState;return we.contiguous=!0,we.discontinuity=!1,we.trackSwitch=!1,n.executeEnd=Rr(),Ne}flush(e){const t=e.transmuxing;t.executeStart=Rr();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return this.asyncResult=!0,n.then(()=>this.flush(e));const a=[],{timeOffset:u}=r;if(i){const S=i.flush();S&&a.push(this.push(S.buffer,null,e))}const{demuxer:g,remuxer:p}=this;if(!g||!p){t.executeEnd=Rr();const S=[Rs(e)];return this.asyncResult?Promise.resolve(S):S}const m=g.flush(u);return Nn(m)?(this.asyncResult=!0,m.then(S=>(this.flushRemux(a,S,e),a))):(this.flushRemux(a,m,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:u}=t,{accurateTimeOffset:g,timeOffset:p}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===v.MAIN?"level":"track"} ${i.level}`);const m=this.remuxer.remux(r,n,a,u,p,g,!0,this.id);e.push({remuxResult:m,chunkMeta:i}),i.transmuxing.executeEnd=Rr()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,n){const{demuxer:a,remuxer:u}=this;!a||!u||(a.resetInitSegment(e,t,i,r),u.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,i,r,n):a=this.transmuxUnencrypted(e,i,r,n),a}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:a,id3Track:u,textTrack:g}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,u,g,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r}=this;let n;for(let S=0,R=Xn.length;S<R;S++){var a;if((a=Xn[S].demux)!=null&&a.probe(e,this.logger)){n=Xn[S];break}}if(!n)return new Error("Failed to find demuxer by probing fragment data");const u=this.demuxer,g=this.remuxer,p=n.remux,m=n.demux;(!g||!(g instanceof p))&&(this.remuxer=new p(i,t,r,this.logger)),(!u||!(u instanceof m))&&(this.demuxer=new m(i,t,r,this.logger),this.probe=m.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Ar(this.config)),e}}function wu(o,e){let t=null;return o.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Rs=o=>({remuxResult:{},chunkMeta:o});function Nn(o){return"then"in o&&o.then instanceof Function}class xu{constructor(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n||null}}class Au{constructor(e,t,i,r,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}}let to=0;class io{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=to++,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=g=>{const p=g.data,m=this.hls;if(!(!m||!(p!=null&&p.event)||p.instanceNo!==this.instanceNo))switch(p.event){case"init":{var S;const R=(S=this.workerContext)==null?void 0:S.objectURL;R&&self.URL.revokeObjectURL(R);break}case"transmuxComplete":{this.handleTransmuxComplete(p.data);break}case"flush":{this.onFlush(p.data);break}case"workerLog":{m.logger[p.data.logType]&&m.logger[p.data.logType](p.data.message);break}default:{p.data=p.data||{},p.data.frag=this.frag,p.data.part=this.part,p.data.id=this.id,m.trigger(p.event,p.data);break}}},this.onWorkerError=g=>{if(!this.hls)return;const p=new Error(`${g.message} (${g.filename}:${g.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:p})};const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const a=(g,p)=>{p=p||{},p.frag=this.frag||void 0,g===_.ERROR&&(p=p,p.parent=this.id,p.part=this.part,this.error=p.error),this.hls.trigger(g,p)};this.observer=new vs,this.observer.on(_.FRAG_DECRYPTED,a),this.observer.on(_.ERROR,a);const u=Lt(n.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const g=this.hls.logger;if(n.workerPath||Ll()){try{n.workerPath?(g.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=kl(n.workerPath)):(g.log(`injecting Web Worker for "${t}"`),this.workerContext=Rl());const{worker:m}=this.workerContext;m.addEventListener("message",this.onWorkerMessage),m.addEventListener("error",this.onWorkerError),m.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:u,id:t,config:jt(n)})}catch(m){g.warn(`Error setting up "${t}" Web Worker, fallback to inline`,m),this.terminateWorker(),this.error=null,this.transmuxer=new eo(this.observer,u,n,"",t,e.logger)}return}}this.transmuxer=new eo(this.observer,u,n,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=to++;const t=this.hls.config,i=Lt(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:jt(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),Il(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,r,n,a,u,g,p,m){var S,R;p.transmuxing.start=self.performance.now();const{instanceNo:H,transmuxer:j}=this,Q=a?a.start:n.start,X=n.decryptdata,re=this.frag,ae=!(re&&n.cc===re.cc),oe=!(re&&p.level===re.level),de=re?p.sn-re.sn:-1,Se=this.part?p.part-this.part.index:-1,Ne=de===0&&p.id>1&&p.id===(re==null?void 0:re.stats.chunkCount),we=!oe&&(de===1||de===0&&(Se===1||Ne&&Se<=0)),Pe=self.performance.now();(oe||de||n.stats.parsing.start===0)&&(n.stats.parsing.start=Pe),a&&(Se||!we)&&(a.stats.parsing.start=Pe);const Ie=!(re&&((S=n.initSegment)==null?void 0:S.url)===((R=re.initSegment)==null?void 0:R.url)),Ce=new Au(ae,we,g,oe,Q,Ie);if(!we||ae||Ie){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${p.sn}${p.part>-1?" part: "+p.part:""} ${this.id===v.MAIN?"level":"track"}: ${p.level} id: ${p.id}
|
|
|
discontinuity: ${ae}
|
|
|
trackSwitch: ${oe}
|
|
|
contiguous: ${we}
|
|
|
accurateTimeOffset: ${g}
|
|
|
timeOffset: ${Q}
|
|
|
initSegmentChange: ${Ie}`);const Ye=new xu(i,r,t,u,m);this.configureTransmuxer(Ye)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:H,cmd:"demux",data:e,decryptdata:X,chunkMeta:p,state:Ce},e instanceof ArrayBuffer?[e]:[]);else if(j){const Ye=j.push(e,X,p,Ce);Nn(Ye)?Ye.then(_t=>{this.handleTransmuxComplete(_t)}).catch(_t=>{this.transmuxerError(_t,p,"transmuxer-interface push error")}):this.handleTransmuxComplete(Ye)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const r=i.flush(e);Nn(r)?r.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")}):this.handleFlushResult(r,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const ro=100;class Cu extends gs{constructor(e,t,i){super(e,t,i,"audio-stream-controller",v.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(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n,trackId:a}){if(i===v.MAIN){const u=t.cc,g=this.fragCurrent;if(this.initPTS[u]={baseTime:r,timescale:n,trackId:a},this.log(`InitPTS for cc: ${u} found from main: ${r/n} (${r}/${n}) trackId: ${a}`),this.mainAnchor=t,this.state===ze.WAITING_INIT_PTS){const p=this.waitingData;(!p&&!this.loadingParts||p&&p.frag.cc!==u)&&this.syncWithAnchor(t,p==null?void 0:p.frag)}else!this.hls.hasEnoughToStart&&g&&g.cc!==u?(g.abortRequests(),this.syncWithAnchor(t,g)):this.state===ze.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const r=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&(r==null?void 0:r.cc)===t.cc)return;const n=(r||e).cc,a=this.getLevelDetails(),u=this.getLoadPosition(),g=Ir(a,n,u);g&&(this.log(`Syncing with main frag at ${g.start} cc ${g.cc}`),this.startFragRequested=!1,this.nextLoadPosition=g.start,this.resetLoadingState(),this.state===ze.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=ze.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(ro),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=ze.IDLE):this.state=ze.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case ze.IDLE:this.doTickIdle();break;case ze.WAITING_TRACK:{const{levels:e,trackId:t}=this,i=e==null?void 0:e[t],r=i==null?void 0:i.details;if(r&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(r))break;this.state=ze.WAITING_INIT_PTS}break}case ze.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case ze.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:r,complete:n}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=ze.FRAG_LOADING;const u=r.flush().buffer,g={frag:t,part:i,payload:u,networkDetails:null};this._handleFragmentLoadProgress(g),n&&super._handleFragmentLoadComplete(g)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=ze.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:i,media:r,trackId:n}=this,a=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(i!=null&&i[n]))return;const u=i[n],g=u.details;if(!g||this.waitForLive(u)||this.waitForCdnTuneIn(g)){this.state=ze.WAITING_TRACK,this.startFragRequested=!1;return}const p=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&p&&(this.bufferFlushed=!1,this.afterBufferFlushed(p,V.AUDIO,v.AUDIO));const m=this.getFwdBufferInfo(p,v.AUDIO);if(m===null)return;if(!this.switchingTrack&&this._streamEnded(m,g)){t.trigger(_.BUFFER_EOS,{type:"audio"}),this.state=ze.ENDED;return}const S=m.len,R=t.maxBufferLength,H=g.fragments,j=H[0].start,Q=this.getLoadPosition(),X=this.flushing?Q:m.end;if(this.switchingTrack&&r){const oe=Q;g.PTSKnown&&oe<j&&(m.end>j||m.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=j+.05)}if(S>=R&&!this.switchingTrack&&X<H[H.length-1].start)return;let re=this.getNextFragment(X,g);if(re&&this.isLoopLoading(re,X)&&(re=this.getNextFragmentLoopLoading(re,g,m,v.MAIN,R)),!re){this.bufferFlushed=!0;return}let ae=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ae&&pe(re)&&!re.endList&&(!g.live||!this.loadingParts&&X<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ae)===si.OK&&(this.mainFragLoading=ae=null),ae&&pe(ae))){if(re.start>ae.end){const de=this.fragmentTracker.getFragAtPos(X,v.MAIN);de&&de.end>ae.end&&(ae=de,this.mainFragLoading={frag:de,targetBufferTime:null})}if(re.start>ae.end)return}this.loadFragment(re,u,X)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new $t(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==ze.STOPPED&&(this.setInterval(ro),this.state=ze.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(_.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:r}=this,{details:n,id:a,groupId:u,track:g}=t;if(!r){this.warn(`Audio tracks reset while loading track ${a} "${g.name}" of "${u}"`);return}const p=this.mainDetails;if(!p||n.endCC>p.endCC||p.expired){this.cachedTrackLoadedData=t,this.state!==ze.STOPPED&&(this.state=ze.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${g.name}" of "${u}" loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const m=r[a];let S=0;if(n.live||(i=m.details)!=null&&i.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;if(m.details){var R;S=this.alignPlaylists(n,m.details,(R=this.levelLastLoaded)==null?void 0:R.details)}n.alignedSliding||(Da(n,p),n.alignedSliding||Wn(n,p),S=n.fragmentStart)}m.details=n,this.levelLastLoaded=m,this.startFragRequested||this.setStartPosition(p,S),this.hls.trigger(_.AUDIO_TRACK_UPDATED,{details:n,id:a,groupId:t.groupId}),this.state===ze.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=ze.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:r,payload:n}=e,{config:a,trackId:u,levels:g}=this;if(!g){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const p=g[u];if(!p){this.warn("Audio track is undefined on fragment load progress");return}const m=p.details;if(!m){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const S=a.defaultAudioCodec||p.audioCodec||"mp4a.40.2";let R=this.transmuxer;R||(R=this.transmuxer=new io(this.hls,v.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const H=this.initPTS[i.cc],j=(t=i.initSegment)==null?void 0:t.data;if(H!==void 0){const X=r?r.index:-1,re=X!==-1,ae=new Fr(i.level,i.sn,i.stats.chunkCount,n.byteLength,X,re);R.push(n,j,S,"",i,r,m.totalduration,!1,ae,H)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${m.startSN} ,${m.endSN}],track ${u}`);const{cache:Q}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new Ra,complete:!1};Q.push(new Uint8Array(n)),this.state!==ze.STOPPED&&(this.state=ze.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===v.MAIN&&pe(t.frag)&&(this.mainFragLoading=t,this.state===ze.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==v.AUDIO){!this.audioOnly&&i.type===v.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(pe(i)){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(_.AUDIO_TRACK_SWITCHED,h({},n)))}this.fragBufferedComplete(i,r),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=ze.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(v.AUDIO,t);break;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ze.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===F.AUDIO_TRACK&&(this.state=ze.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case w.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==V.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==V.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===ze.ENDED&&(this.state=ze.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,v.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,u=this.getCurrentContext(a);if(!u){this.resetWhenMissingContext(a);return}const{frag:g,part:p,level:m}=u,{details:S}=m,{audio:R,text:H,id3:j,initSegment:Q}=n;if(this.fragContextChanged(g)||!S){this.fragmentTracker.removeFragment(g);return}if(this.state=ze.PARSING,this.switchingTrack&&R&&this.completeAudioSwitch(this.switchingTrack),Q!=null&&Q.tracks){const X=g.initSegment||g;if(this.unhandledEncryptionError(Q,g))return;this._bufferInitSegment(m,Q.tracks,X,a),r.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:X,id:i,tracks:Q.tracks})}if(R){const{startPTS:X,endPTS:re,startDTS:ae,endDTS:oe}=R;p&&(p.elementaryStreams[V.AUDIO]={startPTS:X,endPTS:re,startDTS:ae,endDTS:oe}),g.setElementaryStreamInfo(V.AUDIO,X,re,ae,oe),this.bufferFragmentData(R,g,p,a)}if(j!=null&&(t=j.samples)!=null&&t.length){const X=c({id:i,frag:g,details:S},j);r.trigger(_.FRAG_PARSING_METADATA,X)}if(H){const X=c({id:i,frag:g,details:S},H);r.trigger(_.FRAG_PARSING_USERDATA,X)}}_bufferInitSegment(e,t,i,r){if(this.state!==ze.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const n=t.audio;n.id=v.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(_.BUFFER_CODECS,t);const u=n.initSegment;if(u!=null&&u.byteLength){const g={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:u};this.hls.trigger(_.BUFFER_APPENDING,g)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===si.NOT_LOADED||r===si.PARTIAL){var n;if(!pe(e))this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.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=ze.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Wn(t.details,a)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:r,characteristics:n,audioCodec:a,channels:u}=this.bufferedTrack;Vi({name:t,lang:i,assocLang:r,characteristics:n,audioCodec:a,channels:u},e,xi)||(yr(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(_.AUDIO_TRACK_SWITCHED,h({},e))}}class ks extends T{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const r=t==null?void 0:t.renditionReports;if(r){let n=-1;for(let a=0;a<r.length;a++){const u=r[a];let g;try{g=new self.URL(u.URI,t.url).href}catch(p){this.warn(`Could not construct new URL for Rendition Report: ${p}`),g=u.URI||""}if(g===e){n=a;break}else g===e.substring(0,g.length)&&(n=a)}if(n!==-1){const a=r[n],u=parseInt(a["LAST-MSN"])||t.lastPartSn;let g=parseInt(a["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const m=Math.min(t.age-t.partTarget,t.targetduration);g>=0&&m>t.partTarget&&(g+=1)}const p=i&&or(i);return new zt(u,g>=0?g:void 0,p)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:r,stats:n}=t,a=self.performance.now(),u=n.loading.first?Math.max(0,a-n.loading.first):0;r.advancedDateTime=Date.now()-u;const g=this.hls.config.timelineOffset;if(g!==r.appliedTimelineOffset){const m=Math.max(g||0,0);r.appliedTimelineOffset=m,r.fragments.forEach(S=>{S.setStart(S.playlistOffset+m)})}if(r.live||i!=null&&i.live){const m="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(i),i&&r.fragments.length>0){vl(i,r,this);const ae=r.playlistParsingError;if(ae){this.warn(ae);const oe=this.hls;if(!oe.config.ignorePlaylistParsingErrors){var p;const{networkDetails:de}=t;oe.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:ae,reason:ae.message,level:t.level||void 0,parent:(p=r.fragments[0])==null?void 0:p.type,networkDetails:de,stats:n});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=n.loading.start);const S=this.hls.mainForwardBufferInfo,R=S?S.end-S.len:0,H=(r.edge-R)*1e3,j=ba(r,H);if(r.requestScheduled+j<a?r.requestScheduled=a:r.requestScheduled+=j,this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),!this.canLoad||!r.live)return;let Q,X,re;if(r.canBlockReload&&r.endSN&&r.advanced){const ae=this.hls.config.lowLatencyMode,oe=r.lastPartSn,de=r.endSN,Se=r.lastPartIndex,Ne=Se!==-1,we=oe===de;Ne?we?(X=de+1,re=ae?0:Se):(X=oe,re=ae?Se+1:r.maxPartIndex):X=de+1;const Pe=r.age,Ie=Pe+r.ageHeader;let Ce=Math.min(Ie-r.partTarget,r.targetduration*1.5);if(Ce>0){if(Ie>r.targetduration*3)this.log(`Playlist last advanced ${Pe.toFixed(2)}s ago. Omitting segment and part directives.`),X=void 0,re=void 0;else if(i!=null&&i.tuneInGoal&&Ie-r.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${Ce} with playlist age: ${r.age}`),Ce=0;else{const Ye=Math.floor(Ce/r.targetduration);if(X+=Ye,re!==void 0){const _t=Math.round(Ce%r.targetduration/r.partTarget);re+=_t}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${Pe.toFixed(2)}s goal: ${Ce} skip sn ${Ye} to part ${re}`)}r.tuneInGoal=Ce}if(Q=this.getDeliveryDirectives(r,t.deliveryDirectives,X,re),ae||!we){r.requestScheduled=a,this.loadingPlaylist(m,Q);return}}else(r.canBlockReload||r.canSkipUntil)&&(Q=this.getDeliveryDirectives(r,t.deliveryDirectives,X,re));Q&&X!==void 0&&r.canBlockReload&&(r.requestScheduled=n.loading.first+Math.max(j-u*2,j/2)),this.scheduleLoading(m,Q,r)}else this.clearTimer()}scheduleLoading(e,t,i){const r=i||e.details;if(!r){this.loadingPlaylist(e,t);return}const n=self.performance.now(),a=r.requestScheduled;if(n>=a){this.loadingPlaylist(e,t);return}const u=a-n;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(u)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),u)}getDeliveryDirectives(e,t,i,r){let n=or(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=ei.No),new zt(i,r,n)}checkRetry(e){const t=e.details,i=qi(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:u}=r||{},g=!!r&&!!u&&(n===ci.RetryRequest||!r.resolved&&n===ci.SendAlternateToPenaltyBox);if(g){var p;if(a>=u.maxNumRetry)return!1;if(i&&(p=e.context)!=null&&p.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${u.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const m=cr(u,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),m),this.warn(`Retrying playlist loading ${a+1}/${u.maxNumRetry} after "${t}" in ${m}ms`)}e.levelRetry=!0,r.resolved=!0}return g}}function no(o,e){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(!Un(o[t].attrs,e[t].attrs))return!1;return!0}function Un(o,e,t){const i=o["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>o[r]!==e[r])}function Is(o,e){return e.label.toLowerCase()===o.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(o.lang||"").toLowerCase())}class Tu extends ks{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(_.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==r){this.warn(`Audio track with id:${i} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const u=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,u)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(u=>(r==null?void 0:r.indexOf(u))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const u=this.tracks.filter(R=>!i||i.indexOf(R.groupId)!==-1);if(u.length)this.selectDefaultTrack&&!u.some(R=>R.default)&&(this.selectDefaultTrack=!1),u.forEach((R,H)=>{R.id=H});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=u;const g=this.hls.config.audioPreference;if(!n&&g){const R=Mi(g,u,xi);if(R>-1)n=u[R];else{const H=Mi(g,this.tracks);n=this.tracks[H]}}let p=this.findTrackId(n);p===-1&&n&&(p=this.findTrackId(null));const m={audioTracks:u};this.log(`Updating audio tracks, ${u.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(_.AUDIO_TRACKS_UPDATED,m);const S=this.trackId;if(p!==-1&&S===-1)this.setAudioTrack(p);else if(u.length&&S===-1){var a;const R=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${u.length}`);this.warn(R.message),this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:R})}}}onError(e,t){t.fatal||!t.context||t.context.type===F.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const r=this.currentTrack;if(r&&Vi(e,r,xi))return r;const n=Mi(e,this.tracksInGroup,xi);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(r){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const u=Di(e,t.levels,i,a,xi);if(u===-1)return null;t.nextLoadLevel=u}if(e.channels||e.audioCodec){const a=Mi(e,i);if(a>-1)return i[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===i&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(_.AUDIO_TRACK_SWITCHING,h({},r)),n))return;const a=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(!(this.selectDefaultTrack&&!r.default)&&(!e||Vi(e,r,xi)))return i}if(e){const{name:i,lang:r,assocLang:n,characteristics:a,audioCodec:u,channels:g}=e;for(let p=0;p<t.length;p++){const m=t[p];if(Vi({name:i,lang:r,assocLang:n,characteristics:a,audioCodec:u,channels:g},m,xi))return p}for(let p=0;p<t.length;p++){const m=t[p];if(Un(e.attrs,m.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return p}for(let p=0;p<t.length;p++){const m=t[p];if(Un(e.attrs,m.attrs,["LANGUAGE"]))return p}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&yr(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,u=a==null?void 0:a.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${u&&a.live?" age "+u.toFixed(1)+(a.type?" "+a.type||0:""):""} ${n}`),this.hls.trigger(_.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:t||null,track:e})}}class Du{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const r=this.queues[t];r.push(e),r.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const r=t[0];try{r.execute()}catch(n){var i;if(r.onError(n),this.queues===null||this.tracks===null)return;const a=(i=this.tracks[e])==null?void 0:i.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
|
|
|
${this.list("video")}
|
|
|
${this.list("audio")}
|
|
|
${this.list("audiovideo")}}`}list(e){var t,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],r=i==null?void 0:i.buffer;return r?`SourceBuffer${r.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const so=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,ao="HlsJsTrackRemovedError";class Lu extends Error{constructor(e){super(e),this.name=ao}}class Ru extends T{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var r;this.hls&&((r=this.mediaSource)==null?void 0:r.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:r,mediaSource:n}=this;i&&this.log("Media source opened"),!(!r||!n)&&(n.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(_.MEDIA_ATTACHED,{media:r,mediaSource:n}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:r}=this;i!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=q(Y(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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.BUFFER_RESET,this.onBufferReset,this),e.on(_.BUFFER_APPENDING,this.onBufferAppending,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.BUFFER_EOS,this.onBufferEos,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.FRAG_PARSED,this.onFragParsed,this),e.on(_.FRAG_CHANGED,this.onFragChanged,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.BUFFER_RESET,this.onBufferReset,this),e.off(_.BUFFER_APPENDING,this.onBufferAppending,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.BUFFER_EOS,this.onBufferEos,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.FRAG_PARSED,this.onFragParsed,this),e.off(_.FRAG_CHANGED,this.onFragChanged,this),e.off(_.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const n=this.isUpdating();n||this.operationQueue.removeBlockers();const a=this.isQueued();(n||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${n?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?c(i,r.tracks):this.sourceBuffers.forEach(n=>{const[a]=n;a&&(i[a]=c({},this.tracks[a]),this.removeBuffer(a)),n[0]=n[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const r=Y(this.appendSource);if(r){const n=!!t.mediaSource;(n||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(a),n)this._objectUrl=i.src,this.attachTransferred();else{const u=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{i.removeAttribute("src");const g=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||g&&a instanceof g,oo(i),ku(i,u),i.load()}catch(g){i.src=u}else i.src=u}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,r=t.tracks,n=r?Object.keys(r):null,a=n?n.length:0,u=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&n&&a){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: ${jt(i,(g,p)=>g==="initSegment"?void 0:p)};
|
|
|
transfer tracks: ${jt(r,(g,p)=>g==="initSegment"?void 0:p)}}`),!se(r,i)){t.mediaSource=null,t.tracks=void 0;const g=e.currentTime,p=this.details,m=Math.max(g,(p==null?void 0:p.fragments[0].start)||0);if(m-g>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${g} -> ${m}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(i)}") start time: ${m} currentTime: ${g}`),this.onMediaDetaching(_.MEDIA_DETACHING,{}),this.onMediaAttaching(_.MEDIA_ATTACHING,t),e.currentTime=m;return}this.transferData=void 0,n.forEach(g=>{const p=g,m=r[p];if(m){const S=m.buffer;if(S){const R=this.fragmentTracker,H=m.id;if(R.hasFragments(H)||R.hasParts(H)){const X=Ot.getBuffered(S);R.detectEvictedFragments(p,X,H,null,!0)}const j=Ps(p),Q=[p,S];this.sourceBuffers[j]=Q,S.updating&&this.operationQueue&&this.operationQueue.prependBlocker(p),this.trackSourceBuffer(p,m)}}}),u(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),u()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:r,mediaSource:n,_objectUrl:a}=this;if(n){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([u])=>{u&&this.removeBuffer(u)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const u=n.readyState==="open";try{const g=n.sourceBuffers;for(let p=g.length;p--;)u&&g[p].abort(),n.removeSourceBuffer(g[p]);u&&n.endOfStream()}catch(g){this.warn(`onMediaDetaching: ${g.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),i||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(r.removeAttribute("src"),this.appendSource&&oo(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(_.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var r;(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(n){this.warn(`onBufferReset ${e}`,n)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Ps(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Du(this.tracks)}onBufferCodecs(e,t){var i;const r=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),u=!a&&this.sourceBufferCount&&this.media&&n.some(g=>!r[g]);if(a||u){this.warn(`Unsupported transition between "${Object.keys(r)}" and "${n}" SourceBuffers`);return}n.forEach(g=>{var p,m;const S=t[g],{id:R,codec:H,levelCodec:j,container:Q,metadata:X,supplemental:re}=S;let ae=r[g];const oe=(p=this.transferData)==null||(p=p.tracks)==null?void 0:p[g],de=oe!=null&&oe.buffer?oe:ae,Se=(de==null?void 0:de.pendingCodec)||(de==null?void 0:de.codec),Ne=de==null?void 0:de.levelCodec;ae||(ae=r[g]={buffer:void 0,listeners:[],codec:H,supplemental:re,container:Q,levelCodec:j,metadata:X,id:R});const we=gt(Se,Ne),Pe=we==null?void 0:we.replace(so,"$1");let Ie=gt(H,j);const Ce=(m=Ie)==null?void 0:m.replace(so,"$1");Ie&&we&&Pe!==Ce&&(g.slice(0,5)==="audio"&&(Ie=et(Ie,this.appendSource)),this.log(`switching codec ${Se} to ${Ie}`),Ie!==(ae.pendingCodec||ae.codec)&&(ae.pendingCodec=Ie),ae.container=Q,this.appendChangeType(g,Q,Ie))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((i=t.audio)==null?void 0:i.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const r=`${t};codecs=${i}`,n={label:`change-type=${r}`,execute:()=>{const a=this.tracks[e];if(a){const u=a.buffer;u!=null&&u.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),u.changeType(r),a.codec=i,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(n,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,r=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,v.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var u;const g=this.tracks.video;(this.lastVideoAppendEnd>r||g!=null&&g.buffer&&Ot.isBuffered(g.buffer,r)||((u=this.fragmentTracker.getAppendedFrag(r,v.MAIN))==null?void 0:u.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:u=>{this.warn("Error executing block-audio operation",u)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:r,type:n,parent:a,frag:u,part:g,chunkMeta:p,offset:m}=t,S=p.buffering[n],{sn:R,cc:H}=u,j=self.performance.now();S.start=j;const Q=u.stats.buffering,X=g?g.stats.buffering:null;Q.start===0&&(Q.start=j),X&&X.start===0&&(X.start=j);const re=i.audio;let ae=!1;n==="audio"&&(re==null?void 0:re.container)==="audio/mpeg"&&(ae=!this.lastMpegAudioChunk||p.id===1||this.lastMpegAudioChunk.sn!==p.sn,this.lastMpegAudioChunk=p);const oe=i.video,de=oe==null?void 0:oe.buffer;if(de&&R!=="initSegment"){const we=g||u,Pe=this.blockedAudioAppend;if(n==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(oe.ending||oe.ended)){const Ce=we.start+we.duration*.05,Ye=de.buffered,_t=this.currentOp("video");!Ye.length&&!_t?this.blockAudio(we):!_t&&!Ot.isBuffered(de,Ce)&&this.lastVideoAppendEnd<Ce&&this.blockAudio(we)}else if(n==="video"){const Ie=we.end;if(Pe){const Ce=Pe.frag.start;(Ie>Ce||Ie<this.lastVideoAppendEnd||Ot.isBuffered(de,Ce))&&this.unblockAudio()}this.lastVideoAppendEnd=Ie}}const Se=(g||u).start,Ne={label:`append-${n}`,execute:()=>{var we;S.executeStart=self.performance.now();const Pe=(we=this.tracks[n])==null?void 0:we.buffer;Pe&&(ae?this.updateTimestampOffset(Pe,Se,.1,n,R,H):m!==void 0&&I(m)&&this.updateTimestampOffset(Pe,m,1e-6,n,R,H)),this.appendExecutor(r,n)},onStart:()=>{},onComplete:()=>{const we=self.performance.now();S.executeEnd=S.end=we,Q.first===0&&(Q.first=we),X&&X.first===0&&(X.first=we);const Pe={};this.sourceBuffers.forEach(([Ie,Ce])=>{Ie&&(Pe[Ie]=Ot.getBuffered(Ce))}),this.appendErrors[n]=0,n==="audio"||n==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(_.BUFFER_APPENDED,{type:n,frag:u,part:g,chunkMeta:p,parent:u.type,timeRanges:Pe})},onError:we=>{var Pe;const Ie={type:D.MEDIA_ERROR,parent:u.type,details:w.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:u,part:g,chunkMeta:p,error:we,err:we,fatal:!1},Ce=(Pe=this.media)==null?void 0:Pe.error;if(we.code===DOMException.QUOTA_EXCEEDED_ERR||we.name=="QuotaExceededError"||"quota"in we)Ie.details=w.BUFFER_FULL_ERROR;else if(we.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Ce)Ie.errorAction=_i(!0);else if(we.name===ao&&this.sourceBufferCount===0)Ie.errorAction=_i(!0);else{const Ye=++this.appendErrors[n];this.warn(`Failed ${Ye}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${Ce||"no media error"})`),(Ye>=this.hls.config.appendErrorMaxRetry||Ce)&&(Ie.fatal=!0)}this.hls.trigger(_.ERROR,Ie)}};this.log(`queuing "${n}" append sn: ${R}${g?" p: "+g.index:""} of ${u.type===v.MAIN?"level":"track"} ${u.level} cc: ${H}`),this.append(Ne,n,this.isPending(this.tracks[n]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(_.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){const{type:i,startOffset:r,endOffset:n}=t;i?this.append(this.getFlushOp(i,r,n),i):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,r,n),a)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],a=r?r.elementaryStreams:i.elementaryStreams;a[V.AUDIOVIDEO]?n.push("audiovideo"):(a[V.AUDIO]&&n.push("audio"),a[V.VIDEO]&&n.push("video"));const u=()=>{const g=self.performance.now();i.stats.buffering.end=g,r&&(r.stats.buffering.end=g);const p=r?r.stats:i.stats;this.hls.trigger(_.FRAG_BUFFERED,{frag:i,part:r,stats:p,id:i.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(u,n).catch(g=>{this.warn(`Fragment buffered callback ${g}`),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 i;this.sourceBuffers.forEach(([a])=>{if(a){const u=this.tracks[a];(!t.type||t.type===a)&&(u.ending=!0,u.ended||(u.ended=!0,this.log(`${a} buffer reached EOS`)))}});const r=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var u;return a&&!((u=this.tracks[a])!=null&&u.ended)})?r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(_.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(_.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===w.BUFFER_APPEND_ERROR&&t.frag){var i;const r=(i=t.errorAction)==null?void 0:i.nextAutoLevel;I(r)&&r!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const r=e.config,n=i.currentTime,a=t.levelTargetDuration,u=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(I(u)&&u>=0){const p=Math.max(u,a),m=Math.floor(n/a)*a-p;this.flushBackBuffer(n,a,m)}const g=r.frontBufferFlushThreshold;if(I(g)&&g>0){const p=Math.max(r.maxBufferLength,g),m=Math.max(p,a),S=Math.floor(n/a)*a+m;this.flushFrontBuffer(n,a,S)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([r,n])=>{if(n){const u=Ot.getBuffered(n);if(u.length>0&&i>u.start(0)){var a;this.hls.trigger(_.BACK_BUFFER_REACHED,{bufferEnd:i});const g=this.tracks[r];if((a=this.details)!=null&&a.live)this.hls.trigger(_.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(g!=null&&g.ended){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:r})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([r,n])=>{if(n){const a=Ot.getBuffered(n),u=a.length;if(u<2)return;const g=a.start(u-1),p=a.end(u-1);if(i>g||e>=g&&e<=p)return;this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:g,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||(i==null?void 0:i.readyState)!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const p=Math.max(0,t.fragmentStart),m=Math.max(p,r);return{duration:1/0,start:p,end:m}}return{duration:1/0}}const n=(e=this.overrides)==null?void 0:e.duration;if(n)return I(n)?{duration:n}:null;const a=this.media.duration,u=I(i.duration)?i.duration:0;return r>u&&r>a||!I(a)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:i}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(I(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${i}.`),r.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${jt(i)}`),this.tracksReady){var r;const n=(r=this.transferData)==null?void 0:r.tracks;n&&Object.keys(n).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const r=this.tracks[t];e[t]={buffer:i,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(_.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(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const n in e){const a=n,u=e[a];if(this.isPending(u)){const g=this.getTrackCodec(u,a),p=`${u.container};codecs=${g}`;u.codec=g,this.log(`creating sourceBuffer(${p})${this.currentOp(a)?" Queued":""} ${jt(u)}`);try{const m=i.addSourceBuffer(p),S=Ps(a),R=[a,m];t[S]=R,u.buffer=m}catch(m){var r;this.error(`error while trying to add sourceBuffer: ${m.message}`),this.shiftAndExecuteNext(a),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[a],this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:m,sourceBufferName:a,mimeType:p,parent:u.id});return}this.trackSourceBuffer(a,u)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let r=e.codec;i&&(t==="video"||t==="audiovideo")&&ge(i,"video")&&(r=ct(r,i));const n=gt(r,e.levelCodec);return n?t.slice(0,5)==="audio"?et(n,this.appendSource):n:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const r=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:r,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",(n,a)=>{const u=a.removedRanges;u!=null&&u.length&&this.hls.trigger(_.BUFFER_FLUSHED,{type:n})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i==null?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.currentOp(e);n&&n.onError(r)}updateTimestampOffset(e,t,i,r,n,a){const u=t-e.timestampOffset;Math.abs(u)>=i&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${n} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:r,mediaSource:n}=this,a=this.tracks[e],u=a==null?void 0:a.buffer;if(!r||!n||!u){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const g=I(r.duration)?r.duration:1/0,p=I(n.duration)?n.duration:1/0,m=Math.max(0,t),S=Math.min(i,g,p);S>m&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${m},${S}] from the ${e} SourceBuffer`),u.remove(m,S)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],r=i==null?void 0:i.buffer;if(!r)throw new Lu(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,r=t.map(a=>this.appendBlocker(a));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(a=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const r=(i=this.tracks[t])==null?void 0:i.buffer;!r||r.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const r=this.tracks[e];if(!r)return;const n=r.buffer;if(!n)return;const a=i.bind(this,e);r.listeners.push({event:t,listener:a}),n.addEventListener(t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(r=>{i.removeEventListener(r.event,r.listener)}),t.listeners.length=0)}}function oo(o){const e=o.querySelectorAll("source");[].slice.call(e).forEach(t=>{o.removeChild(t)})}function ku(o,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,o.appendChild(t)}function Ps(o){return o==="audio"?1:0}class Os{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(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&I(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,Os.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const r=(u,g)=>g?u.width!==g.width||u.height!==g.height:!0;let n=e.length-1;const a=Math.max(t,i);for(let u=0;u<e.length;u+=1){const g=e[u];if((g.width>=a||g.height>=a)&&r(g,e[u+1])){n=u;break}}return n}}const Hi={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Iu={HLS:"h"};class _r{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof _r?i:new _r(i))),this.value=e,this.params=t}}const Pu="Dict";function Ou(o){return Array.isArray(o)?JSON.stringify(o):o instanceof Map?"Map{}":o instanceof Set?"Set{}":typeof o=="object"?JSON.stringify(o):String(o)}function Fu(o,e,t,i){return new Error(`failed to ${o} "${Ou(e)}" as ${t}`,{cause:i})}function gr(o,e,t){return Fu("serialize",o,e,t)}class lo{constructor(e){this.description=e}}const uo="Bare Item",Mu="Boolean";function Bu(o){if(typeof o!="boolean")throw gr(o,Mu);return o?"?1":"?0"}function Nu(o){return btoa(String.fromCharCode(...o))}const Uu="Byte Sequence";function $u(o){if(ArrayBuffer.isView(o)===!1)throw gr(o,Uu);return`:${Nu(o)}:`}const Hu="Integer";function ju(o){return o<-999999999999999||999999999999999<o}function co(o){if(ju(o))throw gr(o,Hu);return o.toString()}function Ku(o){return`@${co(o.getTime()/1e3)}`}function ho(o,e){if(o<0)return-ho(-o,e);const t=Math.pow(10,e);if(Math.abs(o*t%1-.5)<Number.EPSILON){const r=Math.floor(o*t);return(r%2===0?r:r+1)/t}else return Math.round(o*t)/t}const Wu="Decimal";function Gu(o){const e=ho(o,3);if(Math.floor(Math.abs(e)).toString().length>12)throw gr(o,Wu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const zu="String",Vu=/[\x00-\x1f\x7f]+/;function qu(o){if(Vu.test(o))throw gr(o,zu);return`"${o.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Yu(o){return o.description||o.toString().slice(7,-1)}const Zu="Token";function fo(o){const e=Yu(o);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw gr(e,Zu);return e}function Fs(o){switch(typeof o){case"number":if(!I(o))throw gr(o,uo);return Number.isInteger(o)?co(o):Gu(o);case"string":return qu(o);case"symbol":return fo(o);case"boolean":return Bu(o);case"object":if(o instanceof Date)return Ku(o);if(o instanceof Uint8Array)return $u(o);if(o instanceof lo)return fo(o);default:throw gr(o,uo)}}const Xu="Key";function Ms(o){if(/^[a-z*][a-z0-9\-_.*]*$/.test(o)===!1)throw gr(o,Xu);return o}function Bs(o){return o==null?"":Object.entries(o).map(([e,t])=>t===!0?`;${Ms(e)}`:`;${Ms(e)}=${Fs(t)}`).join("")}function po(o){return o instanceof _r?`${Fs(o.value)}${Bs(o.params)}`:Fs(o)}function Qu(o){return`(${o.value.map(po).join(" ")})${Bs(o.params)}`}function Ju(o,e={whitespace:!0}){if(typeof o!="object"||o==null)throw gr(o,Pu);const t=o instanceof Map?o.entries():Object.entries(o),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof _r||(n=new _r(n));let a=Ms(r);return n.value===!0?a+=Bs(n.params):(a+="=",Array.isArray(n.value)?a+=Qu(n):a+=po(n)),a}).join(`,${i}`)}function _o(o,e){return Ju(o,e)}const mr="CMCD-Object",pi="CMCD-Request",rn="CMCD-Session",Hr="CMCD-Status",ec={br:mr,ab:mr,d:mr,ot:mr,tb:mr,tpb:mr,lb:mr,tab:mr,lab:mr,url:mr,pb:pi,bl:pi,tbl:pi,dl:pi,ltc:pi,mtp:pi,nor:pi,nrr:pi,rc:pi,sn:pi,sta:pi,su:pi,ttfb:pi,ttfbb:pi,ttlb:pi,cmsdd:pi,cmsds:pi,smrt:pi,df:pi,cs:pi,ts:pi,cid:rn,pr:rn,sf:rn,sid:rn,st:rn,v:rn,msd:rn,bs:Hr,bsd:Hr,cdn:Hr,rtp:Hr,bg:Hr,pt:Hr,ec:Hr,e:Hr},tc={REQUEST:pi};function ic(o){return Object.keys(o).reduce((e,t)=>{var i;return(i=o[t])===null||i===void 0||i.forEach(r=>e[r]=t),e},{})}function rc(o,e){const t={};if(!o)return t;const i=Object.keys(o),r=e?ic(e):{};return i.reduce((n,a)=>{var u;const g=ec[a]||r[a]||tc.REQUEST,p=(u=n[g])!==null&&u!==void 0?u:n[g]={};return p[a]=o[a],n},t)}function nc(o){return["ot","sf","st","e","sta"].includes(o)}function sc(o){return typeof o=="number"?I(o):o!=null&&o!==""&&o!==!1}const go="event";function ac(o,e){const t=new URL(o),i=new URL(e);if(t.origin!==i.origin)return o;const r=t.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}const Qn=o=>Math.round(o),Ns=(o,e)=>Array.isArray(o)?o.map(t=>Ns(t,e)):o instanceof _r&&typeof o.value=="string"?new _r(Ns(o.value,e),o.params):(e.baseUrl&&(o=ac(o,e.baseUrl)),e.version===1?encodeURIComponent(o):o),Jn=o=>Qn(o/100)*100,oc={br:Qn,d:Qn,bl:Jn,dl:Jn,mtp:Jn,nor:(o,e)=>{let t=o;return e.version>=2&&(o instanceof _r&&typeof o.value=="string"?t=new _r([o]):typeof o=="string"&&(t=[o])),Ns(t,e)},rtp:Jn,tb:Qn},mo="request",vo="response",Us=["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"],lc=["e"],uc=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function es(o){return uc.test(o)}function cc(o){return Us.includes(o)||lc.includes(o)||es(o)}const yo=["d","dl","nor","ot","rtp","su"];function hc(o){return Us.includes(o)||yo.includes(o)||es(o)}const fc=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function dc(o){return Us.includes(o)||yo.includes(o)||fc.includes(o)||es(o)}const pc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function _c(o){return pc.includes(o)||es(o)}const gc={[vo]:dc,[go]:cc,[mo]:hc};function bo(o,e={}){const t={};if(o==null||typeof o!="object")return t;const i=e.version||o.v||1,r=e.reportingMode||mo,n=i===1?_c:gc[r];let a=Object.keys(o).filter(n);const u=e.filter;typeof u=="function"&&(a=a.filter(u));const g=r===vo||r===go;g&&!a.includes("ts")&&a.push("ts"),i>1&&!a.includes("v")&&a.push("v");const p=c({},oc,e.formatters),m={version:i,reportingMode:r,baseUrl:e.baseUrl};return a.sort().forEach(S=>{let R=o[S];const H=p[S];if(typeof H=="function"&&(R=H(R,m)),S==="v"){if(i===1)return;R=i}S=="pr"&&R===1||(g&&S==="ts"&&!I(R)&&(R=Date.now()),sc(R)&&(nc(S)&&typeof R=="string"&&(R=new lo(R)),t[S]=R))}),t}function mc(o,e={}){const t={};if(!o)return t;const i=bo(o,e),r=rc(i,e==null?void 0:e.customHeaderMap);return Object.entries(r).reduce((n,[a,u])=>{const g=_o(u,{whitespace:!1});return g&&(n[a]=g),n},t)}function vc(o,e,t){return c(o,mc(e,t))}const yc="CMCD";function bc(o,e={}){return o?_o(bo(o,e),{whitespace:!1}):""}function Ec(o,e={}){if(!o)return"";const t=bc(o,e);return encodeURIComponent(t)}function Sc(o,e={}){if(!o)return"";const t=Ec(o,e);return`${yc}=${t}`}const Eo=/CMCD=[^&#]+/;function wc(o,e,t){const i=Sc(e,t);if(!i)return o;if(Eo.test(o))return o.replace(Eo,i);const r=o.includes("?")?"&":"?";return`${o}${r}${i}`}class xc{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=r=>{try{this.apply(r,{ot:Hi.MANIFEST,su:!this.initialized})}catch(n){this.hls.logger.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const{frag:n,part:a}=r,u=this.hls.levels[n.level],g=this.getObjectType(n),p={d:(a||n).duration*1e3,ot:g};(g===Hi.VIDEO||g===Hi.AUDIO||g==Hi.MUXED)&&(p.br=u.bitrate/1e3,p.tb=this.getTopBandwidth(g)/1e3,p.bl=this.getBufferLength(g));const m=a?this.getNextPart(a):this.getNextFrag(n);m!=null&&m.url&&m.url!==n.url&&(p.nor=m.url),this.apply(r,p)}catch(n){this.hls.logger.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHED,this.onMediaDetached,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHED,this.onMediaDetached,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:Iu.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){c(t,this.createData());const i=t.ot===Hi.INIT||t.ot===Hi.VIDEO||t.ot===Hi.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((a,u)=>(r.includes(u)&&(a[u]=t[u]),a),{}));const n={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),vc(e.headers,t,n)):e.url=wc(e.url,t,n)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const r=e.sn-i.startSN;return i.fragments[r+1]}}getNextPart(e){var t;const{index:i,fragment:r}=e,n=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(n){const{sn:a}=r;for(let u=n.length-1;u>=0;u--){const g=n[u];if(g.index===i&&g.fragment.sn===a)return n[u+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Hi.TIMED_TEXT;if(e.sn==="initSegment")return Hi.INIT;if(t==="audio")return Hi.AUDIO;if(t==="main")return this.hls.audioTracks.length?Hi.VIDEO:Hi.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===Hi.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,a=n>-1?n+1:r.levels.length;i=r.levels.slice(0,a)}return i.forEach(n=>{n.bitrate>t&&(t=n.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===Hi.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Ot.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,u){t(n),this.loader.load(n,a,u)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,u){t(n),this.loader.load(n,a,u)}}}}const Ac=3e5;class Cc extends T{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===ci.SendAlternateToPenaltyBox&&i.flags===fi.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:u,pathwayId:g,type:p}=t.context;u&&r?a=this.getPathwayForGroupId(u,p,a):g&&(a=g)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&r&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==a),t.details===w.BUFFER_APPEND_ERROR&&!t.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${r&&r.length} priorities: ${jt(n)} penalized: ${jt(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>Ac&&delete i[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in i)continue;if(a===this.pathwayId)return;const u=this.hls.nextLoadLevel,g=this.hls.levels[u];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,xa(t),this.hls.trigger(_.LEVELS_UPDATED,{levels:t});const p=this.hls.levels[u];g&&p&&this.levels&&(p.attrs["STABLE-VARIANT-ID"]!==g.attrs["STABLE-VARIANT-ID"]&&p.bitrate!==g.bitrate&&this.log(`Unstable Pathways change from bitrate ${g.bitrate} to ${p.bitrate}`),this.hls.nextLoadLevel=u);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===F.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===F.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:a,"BASE-ID":u,"URI-REPLACEMENT":g}=n;if(t.some(m=>m.pathwayId===a))return;const p=this.getLevelsForPathway(u).map(m=>{const S=new ai(m.attrs);S["PATHWAY-ID"]=a;const R=S.AUDIO&&`${S.AUDIO}_clone_${a}`,H=S.SUBTITLES&&`${S.SUBTITLES}_clone_${a}`;R&&(i[S.AUDIO]=R,S.AUDIO=R),H&&(r[S.SUBTITLES]=H,S.SUBTITLES=H);const j=wo(m.uri,S["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",g),Q=new $t({attrs:S,audioCodec:m.audioCodec,bitrate:m.bitrate,height:m.height,name:m.name,url:j,videoCodec:m.videoCodec,width:m.width});if(m.audioGroups)for(let X=1;X<m.audioGroups.length;X++)Q.addGroupId("audio",`${m.audioGroups[X]}_clone_${a}`);if(m.subtitleGroups)for(let X=1;X<m.subtitleGroups.length;X++)Q.addGroupId("text",`${m.subtitleGroups[X]}_clone_${a}`);return Q});t.push(...p),So(this.audioTracks,i,g,a),So(this.subtitleTracks,r,g,a)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch(m){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const m=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+m)}const n={responseType:"json",url:r.href},a=t.steeringManifestLoadPolicy.default,u=a.errorRetry||a.timeoutRetry||{},g={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:u.maxNumRetry||0,retryDelay:u.retryDelayMs||0,maxRetryDelay:u.maxRetryDelayMs||0},p={onSuccess:(m,S,R,H)=>{this.log(`Loaded steering manifest: "${r}"`);const j=m.data;if((j==null?void 0:j.VERSION)!==1){this.log(`Steering VERSION ${j.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=j.TTL;const{"RELOAD-URI":Q,"PATHWAY-CLONES":X,"PATHWAY-PRIORITY":re}=j;if(Q)try{this.uri=new self.URL(Q,r).href}catch(oe){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${Q}`);return}this.scheduleRefresh(this.uri||R.url),X&&this.clonePathways(X);const ae={steeringManifest:j,url:r.toString()};this.hls.trigger(_.STEERING_MANIFEST_LOADED,ae),re&&this.updatePathwayPriority(re)},onError:(m,S,R,H)=>{if(this.log(`Error loading steering manifest: ${m.code} ${m.text} (${S.url})`),this.stopLoad(),m.code===410){this.enabled=!1,this.log(`Steering manifest ${S.url} no longer available`);return}let j=this.timeToLoad*1e3;if(m.code===429){const Q=this.loader;if(typeof(Q==null?void 0:Q.getResponseHeader)=="function"){const X=Q.getResponseHeader("Retry-After");X&&(j=parseFloat(X)*1e3)}this.log(`Steering manifest ${S.url} rate limited`);return}this.scheduleRefresh(this.uri||S.url,j)},onTimeout:(m,S,R)=>{this.log(`Timeout loading steering manifest (${S.url})`),this.scheduleRefresh(this.uri||S.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,g,p)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const r=(i=this.hls)==null?void 0:i.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function So(o,e,t,i){o&&Object.keys(e).forEach(r=>{const n=o.filter(a=>a.groupId===r).map(a=>{const u=c({},a);return u.details=void 0,u.attrs=new ai(u.attrs),u.url=u.attrs.URI=wo(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),u.groupId=u.attrs["GROUP-ID"]=e[r],u.attrs["PATHWAY-ID"]=i,u});o.push(...n)})}function wo(o,e,t,i){const{HOST:r,PARAMS:n,[t]:a}=i;let u;e&&(u=a==null?void 0:a[e],u&&(o=u));const g=new self.URL(o);return r&&!u&&(g.host=r),n&&Object.keys(n).sort().forEach(p=>{p&&g.searchParams.set(p,n[p])}),g.href}class xn extends T{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=xn.CDMCleanupPromise?[xn.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:i,initData:r}=t,n=`"${t.type}" event: init data type: "${i}"`;if(this.debug(n),r!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=Nr(this.config));const u=a.map(Jr).filter(g=>!!g);this.keyFormatPromise=this.getKeyFormatPromise(u)}this.keyFormatPromise.then(a=>{const u=Dr(a);if(i!=="sinf"||u!==Ut.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${u}`);return}let g;try{const H=He(new Uint8Array(r)),j=Xr(JSON.parse(H).sinf),Q=Ze(j);if(!Q)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");g=new Uint8Array(Q.subarray(8,24))}catch(H){this.warn(`${n} Failed to parse sinf: ${H}`);return}const p=J(g),{keyIdToKeySessionPromise:m,mediaKeySessions:S}=this;let R=m[p];for(let H=0;H<S.length;H++){const j=S[H],Q=j.decryptdata;if(!Q.keyId)continue;const X=J(Q.keyId);if(Ui(g,Q.keyId)||Q.uri.replace(/-/g,"").indexOf(p)!==-1){if(R=m[X],!R)continue;if(Q.pssh)break;delete m[X],Q.pssh=new Uint8Array(r),Q.keyId=g,R=m[p]=R.then(()=>this.generateRequestWithPreferredKeySession(j,i,r,"encrypted-event-key-match")),R.catch(re=>this.handleError(re));break}}R||this.handleError(new Error(`Key ID ${p} not encountered in playlist. Key-system sessions ${S.length}.`))}).catch(a=>this.handleError(a))}},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(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(_.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(_.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t==null?void 0:t[e];if(r)return r.licenseUrl;if(e===Ut.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t==null?void 0:t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(a,u,g)=>!!a&&g.indexOf(a)===u,r=t.map(a=>a.audioCodec).filter(i),n=t.map(a=>a.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,u)=>{const g=p=>{const m=p.shift();this.getMediaKeysPromise(m,r,n).then(S=>a({keySystem:m,mediaKeys:S})).catch(S=>{p.length?g(p):S instanceof zi?u(S):u(new zi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_ACCESS,error:S,fatal:!0},S.message))})};g(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return en===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){var r;const n=ul(e,t,i,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],u=(r=a)==null?void 0:r.keySystemAccess;if(!u){this.log(`Requesting encrypted media "${e}" key-system access with config: ${jt(n)}`),u=this.requestMediaKeySystemAccess(e,n);const g=a=this.keySystemAccessPromises[e]={keySystemAccess:u};return u.catch(p=>{this.log(`Failed to obtain access to key-system "${e}": ${p}`)}),u.then(p=>{this.log(`Access for key-system "${p.keySystem}" obtained`);const m=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const S=g.mediaKeys=p.createMediaKeys().then(R=>(this.log(`Media-keys created for "${e}"`),g.hasMediaKeys=!0,m.then(H=>H?this.setMediaKeysServerCertificate(R,e,H):R)));return S.catch(R=>{this.error(`Failed to create media-keys for "${e}"}: ${R}`)}),S})}return u.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${J(e.keyId||[])} keyUri: ${e.uri}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=ts(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${J(e.decryptdata.keyId||[])}
|
|
|
} (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Jr(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:r})=>{const n=Jr(r);n?t(n):i(new Error(`Unable to find format for key-system "${r}"`))}).catch(i)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=Nr(this.config),i=e.map(Dr).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i<t.length;i++){const r=Tc(e,t[i]);if(r)return r}}loadKey(e){const t=e.keyInfo.decryptdata,i=ts(t),r=this.bannedKeyIds[i];if(r||this.getKeyStatus(t)==="internal-error"){const u=xo(r||"internal-error",t);return this.handleError(u,e.frag),Promise.reject(u)}const n=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);const a=this.keyIdToKeySessionPromise[i];if(!a){const u=this.getKeySystemForKeyPromise(t).then(({keySystem:g,mediaKeys:p})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(g,p).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:g,mediaKeys:p,decryptdata:t}))))).then(g=>{const p="cenc",m=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(g,p,m,"playlist-key")});return u.catch(g=>this.handleError(g,e.frag)),this.keyIdToKeySessionPromise[i]=u,u}return a.catch(u=>{if(u instanceof zi){const g=h({},u.data);this.getKeyStatus(t)==="internal-error"&&(g.decryptdata=t);const p=new zi(g,u.message);this.handleError(p,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof zi){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${J(i.keyId||[])})`:""}`),this.hls.trigger(_.ERROR,e.data)}else this.error(e.message),this.hls.trigger(_.ERROR,{type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=ts(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Dr(e.keyFormat),n=r?[r]:Nr(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Nr(this.config)),e.length===0)throw new zi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${jt({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).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(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n;const a=(n=this.config.drmSystems)==null||(n=n[e.keySystem])==null?void 0:n.generateRequest;if(a)try{const j=a.call(this.hls,t,i,e);if(!j)throw new Error("Invalid response from configured generateRequest filter");t=j.initDataType,i=j.initData?j.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(j){if(this.warn(j.message),this.hls&&this.hls.config.debug)throw j}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const u=ts(e.decryptdata),g=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${u} URI: ${g} (init data type: ${t} length: ${i.byteLength})`);const p=new vs,m=e._onmessage=j=>{const Q=e.mediaKeysSession;if(!Q){p.emit("error",new Error("invalid state"));return}const{messageType:X,message:re}=j;this.log(`"${X}" message event for session "${Q.sessionId}" message size: ${re.byteLength}`),X==="license-request"||X==="license-renewal"?this.renewLicense(e,re).catch(ae=>{p.eventNames().length?p.emit("error",ae):this.handleError(ae)}):X==="license-release"?e.keySystem===Ut.FAIRPLAY&&this.updateKeySession(e,Qr("acknowledged")).then(()=>this.removeSession(e)).catch(ae=>this.handleError(ae)):this.warn(`unhandled media key message type "${X}"`)},S=(j,Q)=>{Q.keyStatus=j;let X;j.startsWith("usable")?p.emit("resolved"):j==="internal-error"||j==="output-restricted"||j==="output-downscaled"?X=xo(j,Q.decryptdata):j==="expired"?X=new Error(`key expired (keyId: ${u})`):j==="released"?X=new Error("key released"):j==="status-pending"||this.warn(`unhandled key status change "${j}" (keyId: ${u})`),X&&(p.eventNames().length?p.emit("error",X):this.handleError(X))},R=e._onkeystatuseschange=j=>{if(!e.mediaKeysSession){p.emit("error",new Error("invalid state"));return}const X=this.getKeyStatuses(e);if(!Object.keys(X).some(de=>X[de]!=="status-pending"))return;if(X[u]==="expired"){this.log(`Expired key ${jt(X)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let ae=X[u];if(ae)S(ae,e);else{var oe;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(oe=e.keyStatusTimeouts)[u]||(oe[u]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const Se=this.getKeyStatus(e.decryptdata);if(Se&&Se!=="status-pending")return this.log(`No status for keyId ${u} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${Se} from other session.`),S(Se,e);this.log(`key status for ${u} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),ae="internal-error",S(ae,e)},1e3)),this.log(`No status for keyId ${u} (${jt(X)}).`)}};Oi(e.mediaKeysSession,"message",m),Oi(e.mediaKeysSession,"keystatuseschange",R);const H=new Promise((j,Q)=>{p.on("error",Q),p.on("resolved",j)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${u} URI: ${g}`)}).catch(j=>{throw new zi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_SESSION,error:j,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${j}`)}).then(()=>H).catch(j=>(p.removeAllListeners(),this.removeSession(e).then(()=>{throw j}))).then(()=>(p.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((i,r)=>{if(typeof r=="string"&&typeof i=="object"){const u=r;r=i,i=u}const n="buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);e.keySystem===Ut.PLAYREADY&&n.length===16&&wt(n);const a=J(n);i==="internal-error"&&(this.bannedKeyIds[a]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=i}),t}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,u)=>{const g={responseType:"arraybuffer",url:n},p=t.certLoadPolicy.default,m={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(R,H,j,Q)=>{a(R.data)},onError:(R,H,j,Q)=>{u(new zi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:j,response:h({url:g.url,data:void 0},R)},`"${e}" certificate request failed (${n}). Status: ${R.code} (${R.text})`))},onTimeout:(R,H,j)=>{u(new zi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:j,response:{url:g.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(R,H,j)=>{u(new Error("aborted"))}};r.load(g,m,S)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new zi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new zi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:r,fatal:!1},r.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let m;for(let S=0,R=n.length;S<R;S++){var a,u;m=n[S];const H=(a=m.querySelector("name"))==null?void 0:a.textContent,j=(u=m.querySelector("value"))==null?void 0:u.textContent;H&&j&&e.setRequestHeader(H,j)}}const g=r.querySelector("Challenge"),p=g==null?void 0:g.textContent;if(!p)throw new Error("Cannot find <Challenge> in key message");return Qr(atob(p))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(u.readyState===4)if(u.status===200){this._requestLicenseFailureCount=0;let g=u.response;this.log(`License received ${g instanceof ArrayBuffer?g.byteLength:g}`);const p=this.config.licenseResponseCallback;if(p)try{g=p.call(this.hls,u,a,e)}catch(m){this.error(m)}r(g)}else{const g=i.errorRetry,p=g?g.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>p||u.status>=400&&u.status<500)n(new zi({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:u,response:{url:a,data:void 0,code:u.status,text:u.statusText}},`License Request XHR failed (${a}). Status: ${u.status} (${u.statusText})`));else{const m=p-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${m} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=u,this.setupLicenseXHR(u,a,e,t).then(({xhr:g,licenseChallenge:p})=>{e.keySystem==Ut.PLAYREADY&&(p=this.unpackPlayReadyKeyMessage(g,p)),g.send(p)}).catch(n)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,Oi(i,"encrypted",this.onMediaEncrypted),Oi(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&($i(e,"encrypted",this.onMediaEncrypted),$i(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,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,tn.clearKeyUriToKeyIdMap();const r=i.length;xn.CDMCleanupPromise=Promise.all(i.map(n=>this.removeSession(n)).concat((t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(n=>{this.log(`Could not clear media keys: ${n}`),this.hls&&this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${n}`)})}))||Promise.resolve())).catch(n=>{this.log(`Could not close sessions and clear media keys: ${n}`),this.hls&&this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${n}`)})}).then(()=>{r&&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 i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${J((r==null?void 0:r.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(p=>self.clearTimeout(a[p]));const{drmSystemOptions:u}=this.config;return(hl(u)?new Promise((p,m)=>{self.setTimeout(()=>m(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(p).catch(m)}):Promise.resolve()).catch(p=>{this.log(`Could not remove session: ${p}`),this.hls&&this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${p}`)})}).then(()=>t.close()).catch(p=>{this.log(`Could not close session: ${p}`),this.hls&&this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${p}`)})})}return Promise.resolve()}}xn.CDMCleanupPromise=void 0;function ts(o){if(!o)throw new Error("Could not read keyId of undefined decryptdata");if(o.keyId===null)throw new Error("keyId is null");return J(o.keyId)}function Tc(o,e){if(o.keyId&&e.mediaKeysSession.keyStatuses.has(o.keyId))return e.mediaKeysSession.keyStatuses.get(o.keyId);if(o.matches(e.decryptdata))return e.keyStatus}class zi 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 xo(o,e){const t=o==="output-restricted",i=t?w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:w.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new zi({type:D.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${o}"`)}class Dc{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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(_.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,a=i-this.lastDroppedFrames,u=t-this.lastDecodedFrames,g=1e3*a/n,p=this.hls;if(p.trigger(_.FPS_DROP,{currentDropped:a,currentDecoded:u,totalDroppedFrames:i}),g>0&&a>p.config.fpsDroppedMonitoringThreshold*u){let m=p.currentLevel;p.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+m),m>0&&(p.autoLevelCapping===-1||p.autoLevelCapping>=m)&&(m=m-1,p.trigger(_.FPS_DROP_LEVEL_CAPPING,{level:m,droppedLevel:p.currentLevel}),p.autoLevelCapping=m,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function Ao(o,e){let t;try{t=new Event("addtrack")}catch(i){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=o,e.dispatchEvent(t)}function Co(o,e){const t=o.mode;if(t==="disabled"&&(o.mode="hidden"),o.cues&&!o.cues.getCueById(e.id))try{if(o.addCue(e),!o.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){M.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,o.addCue(r)}catch(r){M.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(o.mode=t)}function An(o,e){const t=o.mode;if(t==="disabled"&&(o.mode="hidden"),o.cues)for(let i=o.cues.length;i--;)e&&o.cues[i].removeEventListener("enter",e),o.removeCue(o.cues[i]);t==="disabled"&&(o.mode=t)}function $s(o,e,t,i){const r=o.mode;if(r==="disabled"&&(o.mode="hidden"),o.cues&&o.cues.length>0){const n=Rc(o.cues,e,t);for(let a=0;a<n.length;a++)(!i||i(n[a]))&&o.removeCue(n[a])}r==="disabled"&&(o.mode=r)}function Lc(o,e){if(e<=o[0].startTime)return 0;const t=o.length-1;if(e>o[t].endTime)return-1;let i=0,r=t,n;for(;i<=r;)if(n=Math.floor((r+i)/2),e<o[n].startTime)r=n-1;else if(e>o[n].startTime&&i<t)i=n+1;else return n;return o[i].startTime-e<e-o[r].startTime?i:r}function Rc(o,e,t){const i=[],r=Lc(o,e);if(r>-1)for(let n=r,a=o.length;n<a;n++){const u=o[n];if(u.startTime>=e&&u.endTime<=t)i.push(u);else if(u.startTime>t)return i}return i}function is(o){const e=[];for(let t=0;t<o.length;t++){const i=o[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(o[t])}return e}class kc extends ks{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=is(this.media.textTracks);for(let n=0;n<i.length;n++)if(i[n].mode==="hidden")t=i[n];else if(i[n].mode==="showing"){t=i[n];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},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(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const r=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,r)return;is(i.textTracks).forEach(a=>{An(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${a==null?void 0:a.groupId}`);return}const u=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,u)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(m=>!i||i.indexOf(m.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(m=>m.default)&&(this.selectDefaultTrack=!1),a.forEach((m,S)=>{m.id=S});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const u=this.hls.config.subtitlePreference;if(!n&&u){this.selectDefaultTrack=!1;const m=Mi(u,a);if(m>-1)n=a[m];else{const S=Mi(u,this.tracks);n=this.tracks[S]}}let g=this.findTrackId(n);g===-1&&n&&(g=this.findTrackId(null));const p={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(_.SUBTITLE_TRACKS_UPDATED,p),g!==-1&&this.trackId===-1&&this.setSubtitleTrack(g)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(i&&!n.default||!i&&!e)&&(!e||Vi(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Un(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Un(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(Is(r,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===F.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&Vi(e,i))return i;const r=Mi(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=Mi(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,u=a==null?void 0:a.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${u&&a.live?" age "+u.toFixed(1)+(a.type?" "+a.type||0:""):""} ${n}`),this.hls.trigger(_.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=is(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(n=>Is(i,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!I(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:u="",name:g,type:p,url:m}=r;this.hls.trigger(_.SUBTITLE_TRACK_SWITCH,{id:a,groupId:u,name:g,type:p,url:m});const S=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(S)}}function Ic(){try{return crypto.randomUUID()}catch(o){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,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}function $n(o){let e=5381,t=o.length;for(;t;)e=e*33^o.charCodeAt(--t);return(e>>>0).toString()}const Cn=.025;let rs=function(o){return o[o.Point=0]="Point",o[o.Range=1]="Range",o}({});function Pc(o,e,t){return`${o.identifier}-${t+1}-${$n(e)}`}class Oc{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 i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}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 Hs(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=Hs(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=I(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 Hs(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)<Cn))}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"?rs.Range:rs.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 Fc(this)}}function Hs(o,e){return o-e.start<e.duration/2&&!(Math.abs(o-(e.start+e.duration))<Cn)?e.start:e.start+e.duration}function To(o,e,t){const i=new self.URL(o,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function js(o,e){for(;(t=o.assetList[++e])!=null&&t.error;)var t;return e}function Fc(o){return`["${o.identifier}" ${o.cue.pre?"<pre>":o.cue.post?"<post>":""}${o.timelineStart.toFixed(2)}-${o.resumeTime.toFixed(2)}]`}function Tn(o){const e=o.timelineStart,t=o.duration||0;return`["${o.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Mc{constructor(e,t,i,r){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(_.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=i,this.assetItem=r;const a=()=>{this.hasDetails=!0};n.once(_.LEVEL_LOADED,a),n.once(_.AUDIO_TRACK_LOADED,a),n.once(_.SUBTITLE_TRACK_LOADED,a),n.on(_.MEDIA_ATTACHING,(u,{media:g})=>{this.removeMediaListeners(),this.mediaAttached=g,this.interstitial.playoutLimit&&(g.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(_.BUFFER_APPENDED,()=>{const m=this.bufferedEnd;this.reachedPlayout(m)&&(this._bufferedEosTime=m,n.trigger(_.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=To(t,e.config.primarySessionId||"").href}catch(i){}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 i=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,n=Ot.bufferInfo(e,r,0);return this.getAssetTime(n.end)>=i-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}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 i=t-this.startOffset;if(i>0&&i<e)return i}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 i=e-t;if(Math.abs(i)>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,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&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=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,i){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,i){var r;(r=this.hls)==null||r.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Tn(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Do=.033;class Bc extends T{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(n=r[i])!=null&&n.event;){var n;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let r=0;r<i.length;r++){let n=i[r];if(t&&t!=="primary"&&(n=n[t]),e===n.start||e>n.start&&e<n.end)return r}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let r=e;r<=t&&i[r];r++){const n=i[r].event;if(n!=null&&n.restrictions.jump&&!n.appendInPlace)return r}return-1}findEventIndex(e){const t=this.items;if(t)for(let r=t.length;r--;){var i;if(((i=t[r].event)==null?void 0:i.identifier)===e)return r}return-1}findAssetIndex(e,t){const i=e.assetList,r=i.length;if(r>1)for(let n=0;n<r;n++){const a=i[n];if(!a.error){const u=a.timelineStart;if(t===u||t>u&&(t<u+(a.duration||0)||n===r-1))return n}}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 i=t.assetList,r=i[i.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:r}=i,n=this.events,a=this.parseDateRanges(r,{url:i.url},t),u=Object.keys(r),g=n?n.filter(p=>!u.includes(p.identifier)):[];a.length&&a.sort((p,m)=>{const S=p.cue.pre,R=p.cue.post,H=m.cue.pre,j=m.cue.post;if(S&&!H)return-1;if(H&&!S||R&&!j)return 1;if(j&&!R)return-1;if(!S&&!H&&!R&&!j){const Q=p.startTime,X=m.startTime;if(Q!==X)return Q-X}return p.dateRange.tagOrder-m.dateRange.tagOrder}),this.events=a,g.forEach(p=>{this.removeEvent(p)}),this.updateSchedule(e,g)}updateSchedule(e,t=[],i=!1){const r=this.events||[];if(r.length||t.length||this.length<2){const n=this.items,a=this.parseSchedule(r,e);(i||t.length||(n==null?void 0:n.length)!==a.length||a.some((g,p)=>Math.abs(g.playout.start-n[p].playout.start)>.005||Math.abs(g.playout.end-n[p].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,i){const r=[],n=Object.keys(e);for(let a=0;a<n.length;a++){const u=n[a],g=e[u];if(g.isInterstitial){let p=this.eventMap[u];p?p.setDateRange(g):(p=new Oc(g,t),this.eventMap[u]=p,i===!1&&(p.appendInPlace=i)),r.push(p)}}return r}parseSchedule(e,t){const i=[],r=t.main.details,n=r.live?1/0:r.edge;let a=0;if(e=e.filter(g=>!g.error&&!(g.cue.once&&g.hasPlayed)),e.length){this.resolveOffsets(e,t);let g=0,p=0;if(e.forEach((m,S)=>{const R=m.cue.pre,H=m.cue.post,j=e[S-1]||null,Q=m.appendInPlace,X=H?n:m.startOffset,re=m.duration,ae=m.timelineOccupancy===rs.Range?re:0,oe=m.resumptionOffset,de=(j==null?void 0:j.startTime)===X,Se=X+m.cumulativeDuration;let Ne=Q?Se+re:X+oe;if(R||!H&&X<=0){const Pe=p;p+=ae,m.timelineStart=Se;const Ie=a;a+=re,i.push({event:m,start:Se,end:Ne,playout:{start:Ie,end:a},integrated:{start:Pe,end:p}})}else if(X<=n){if(!de){const Ce=X-g;if(Ce>Do){const Ye=g,_t=p;p+=Ce;const xt=a;a+=Ce;const Rt={previousEvent:e[S-1]||null,nextEvent:m,start:Ye,end:Ye+Ce,playout:{start:xt,end:a},integrated:{start:_t,end:p}};i.push(Rt)}else Ce>0&&j&&(j.cumulativeDuration+=Ce,i[i.length-1].end=X)}H&&(Ne=Se),m.timelineStart=Se;const Pe=p;p+=ae;const Ie=a;a+=re,i.push({event:m,start:Se,end:Ne,playout:{start:Ie,end:a},integrated:{start:Pe,end:p}})}else return;const we=m.resumeTime;H||we>n?g=n:g=we}),g<n){var u;const m=g,S=p,R=n-g;p+=R;const H=a;a+=R,i.push({previousEvent:((u=i[i.length-1])==null?void 0:u.event)||null,nextEvent:null,start:g,end:m+R,playout:{start:H,end:a},integrated:{start:S,end:p}})}this.setDurations(n,a,p)}else i.push({previousEvent:null,nextEvent:null,start:0,end:n,playout:{start:0,end:n},integrated:{start:0,end:n}}),this.setDurations(n,n,n);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,r=i.live?1/0:i.edge;let n=0,a=-1;e.forEach((u,g)=>{const p=u.cue.pre,m=u.cue.post,S=p?0:m?r:u.startTime;this.updateAssetDurations(u),a===S?u.cumulativeDuration=n:(n=0,a=S),!m&&u.snapOptions.in&&(u.resumeAnchor=yi(null,i.fragments,u.startOffset+u.resumptionOffset,0,0)||void 0),u.appendInPlace&&!u.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(u,t)||(u.appendInPlace=!1)),!u.appendInPlace&&g+1<e.length&&e[g+1].startTime-e[g].resumeTime<Do&&(e[g+1].appendInPlace=!1,e[g+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${u}`));const H=I(u.resumeOffset)?u.resumeOffset:u.duration;n+=H})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(i-r)>Cn?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(a=>{const u=t[a].details,g=u.edge;if(i>=g)return this.log(`"${e.identifier}" resumption ${i} past ${a} playlist end ${g}`),!1;const p=yi(null,u.fragments,i);if(!p)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${a} playlist (${u.fragStart}-${u.fragmentEnd})`),!0;const m=a==="audio"?.175:0;return Math.abs(p.start-i)<Cn+m||Math.abs(p.end-i)<Cn+m?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${a} fragment bounds (${p.start}-${p.end} sn: ${p.sn} cc: ${p.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,r=!1,n=!1;for(let a=0;a<e.assetList.length;a++){const u=e.assetList[a],g=t+i;u.startOffset=i,u.timelineStart=g,r||(r=u.duration===null),n||(n=!!u.error);const p=u.error?0:u.duration||0;i+=p}r&&!n?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function nr(o){return`[${o.event?'"'+o.event.identifier+'"':"primary"}: ${o.start.toFixed(2)}-${o.end.toFixed(2)}]`}class Nc{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let r;try{r=To(i,this.hls.sessionId,e.baseUrl)}catch(R){const H=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,R,i);this.hls.trigger(_.ERROR,H);return}t&&r.protocol!=="data:"&&r.searchParams.set("_HLS_start_offset",""+t);const n=this.hls.config,a=n.loader,u=new a(n),g={responseType:"json",url:r.href},p=n.interstitialAssetListLoadPolicy.default,m={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(R,H,j,Q)=>{const X=R.data,re=X==null?void 0:X.ASSETS;if(!Array.isArray(re)){const ae=this.assignAssetListError(e,w.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),j.url,H,Q);this.hls.trigger(_.ERROR,ae);return}e.assetListResponse=X,this.hls.trigger(_.ASSET_LIST_LOADED,{event:e,assetListResponse:X,networkDetails:Q})},onError:(R,H,j,Q)=>{const X=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${R.code} ${R.text} (${H.url})`),H.url,Q,j);this.hls.trigger(_.ERROR,X)},onTimeout:(R,H,j)=>{const Q=this.assignAssetListError(e,w.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${H.url})`),H.url,R,j);this.hls.trigger(_.ERROR,Q)}};return u.load(g,m,S),this.hls.trigger(_.ASSET_LIST_LOADING,{event:e}),u}assignAssetListError(e,t,i,r,n,a){return e.error=i,{type:D.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:i,networkDetails:a,stats:n}}}function Lo(o){o==null||o.play().catch(()=>{})}function ns(o,e){return`[${o}] Advancing timeline position to ${e}`}class Uc extends T{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled||!this.schedule)return;const r=i-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const a=r<=-.01;this.timelinePos=i,this.bufferedPos=i;const u=this.playingItem;if(!u){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(i,i-r)&&this.updateSchedule(!0),this.checkBuffer(),a&&i<u.start||i>=u.end){var g;const H=this.findItemIndex(u);let j=this.schedule.findItemIndexAtTime(i);if(j===-1&&(j=H+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${i} (resolving from ${H} to ${j})`)),!this.isInterstitial(u)&&(g=this.media)!=null&&g.paused&&(this.shouldPlay=!1),!a&&j>H){const Q=this.schedule.findJumpRestrictedIndex(H+1,j);if(Q>H){this.setSchedulePosition(Q);return}}this.setSchedulePosition(j);return}const p=this.playingAsset;if(!p){if(this.playingLastItem&&this.isInterstitial(u)){const H=u.event.assetList[0];H&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,H))}return}const m=p.timelineStart,S=p.duration||0;if(a&&i<m||i>=m+S){var R;(R=u.event)!=null&&R.appendInPlace&&(this.clearInterstitial(u.event,u),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,p)}},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const r=this.playingItem;if(!r||this.playingLastItem)return;if(i>=r.end){this.timelinePos=r.end;const u=this.findItemIndex(r);this.setSchedulePosition(u+1)}const n=this.playingAsset;if(!n)return;const a=n.timelineStart+(n.duration||0);i>=a&&this.setScheduleToAssetAtTime(i,n)},this.onScheduleUpdate=(i,r)=>{const n=this.schedule;if(!n)return;const a=this.playingItem,u=n.events||[],g=n.items||[],p=n.durations,m=i.map(Q=>Q.identifier),S=!!(u.length||m.length);(S||r)&&this.log(`INTERSTITIALS_UPDATED (${u.length}): ${u}
|
|
|
Schedule: ${g.map(Q=>nr(Q))} pos: ${this.timelinePos}`),m.length&&this.log(`Removed events ${m}`);let R=null,H=null;a&&(R=this.updateItem(a,this.timelinePos),this.itemsMatch(a,R)?this.playingItem=R:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const j=this.bufferingItem;if(j&&(H=this.updateItem(j,this.bufferedPos),this.itemsMatch(j,H)?this.bufferingItem=H:j.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(j.event,null))),i.forEach(Q=>{Q.assetList.forEach(X=>{this.clearAssetPlayer(X.identifier,null)})}),this.playerQueue.forEach(Q=>{if(Q.interstitial.appendInPlace){const X=Q.assetItem.timelineStart,re=Q.timelineOffset-X;if(re)try{Q.timelineOffset=X}catch(ae){Math.abs(re)>Cn&&this.warn(`${ae} ("${Q.assetId}" ${Q.timelineOffset}->${X})`)}}}),S||r){if(this.hls.trigger(_.INTERSTITIALS_UPDATED,{events:u.slice(0),schedule:g.slice(0),durations:p,removedIds:m}),this.isInterstitial(a)&&m.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(R,a),j&&H!==R&&this.trimInPlace(H,j),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Nc(e),this.schedule=new Bc(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(_.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(_.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(_.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(_.BUFFER_APPENDED,this.onBufferAppended,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(_.MEDIA_ENDED,this.onMediaEnded,this),e.on(_.ERROR,this.onError,this),e.on(_.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(_.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(_.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(_.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.BUFFER_APPENDED,this.onBufferAppended,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(_.MEDIA_ENDED,this.onMediaEnded,this),e.off(_.ERROR,this.onError,this),e.off(_.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){$i(e,"play",this.onPlay),$i(e,"pause",this.onPause),$i(e,"seeking",this.onSeeking),$i(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Oi(i,"seeking",this.onSeeking),Oi(i,"timeupdate",this.onTimeupdate),Oi(i,"play",this.onPlay),Oi(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!r){this.clearScheduleState();const n=this.findItemIndex(i);this.setSchedulePosition(n)}}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 i=!!t.transferMedia,r=this.media;if(this.media=null,!i&&(r&&this.removeMediaListeners(r),this.detachedData)){const n=this.getBufferingPlayer();n&&(this.log(`Removing schedule state for detachedData and ${n}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.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,i=S=>S&&e.getAssetPlayer(S.identifier),r=(S,R,H,j,Q)=>{if(S){let X=S[R].start;const re=S.event;if(re){if(R==="playout"||re.timelineOccupancy!==rs.Point){const ae=i(H);(ae==null?void 0:ae.interstitial)===re&&(X+=ae.assetItem.startOffset+ae[Q])}}else{const ae=j==="bufferedPos"?a():e[j];X+=ae-S.start}return X}return 0},n=(S,R)=>{var H;if(S!==0&&R!=="primary"&&(H=e.schedule)!=null&&H.length){var j;const Q=e.schedule.findItemIndexAtTime(S),X=(j=e.schedule.items)==null?void 0:j[Q];if(X){const re=X[R].start-X.start;return S+re}}return S},a=()=>{const S=e.bufferedPos;return S===Number.MAX_VALUE?u("primary"):Math.max(S,0)},u=S=>{var R,H;return(R=e.primaryDetails)!=null&&R.live?e.primaryDetails.edge:((H=e.schedule)==null?void 0:H.durations[S])||0},g=(S,R)=>{var H,j;const Q=e.effectivePlayingItem;if(Q!=null&&(H=Q.event)!=null&&H.restrictions.skip||!e.schedule)return;e.log(`seek to ${S} "${R}"`);const X=e.effectivePlayingItem,re=e.schedule.findItemIndexAtTime(S,R),ae=(j=e.schedule.items)==null?void 0:j[re],oe=e.getBufferingPlayer(),de=oe==null?void 0:oe.interstitial,Se=de==null?void 0:de.appendInPlace,Ne=X&&e.itemsMatch(X,ae);if(X&&(Se||Ne)){const we=i(e.playingAsset),Pe=(we==null?void 0:we.media)||e.primaryMedia;if(Pe){const Ie=R==="primary"?Pe.currentTime:r(X,R,e.playingAsset,"timelinePos","currentTime"),Ce=S-Ie,Ye=(Se?Ie:Pe.currentTime)+Ce;if(Ye>=0&&(!we||Se||Ye<=we.duration)){Pe.currentTime=Ye;return}}}if(ae){let we=S;if(R!=="primary"){const Ie=ae[R].start,Ce=S-Ie;we=ae.start+Ce}const Pe=!e.isInterstitial(ae);if((!e.isInterstitial(X)||X.event.appendInPlace)&&(Pe||ae.event.appendInPlace)){const Ie=e.media||(Se?oe==null?void 0:oe.media:null);Ie&&(Ie.currentTime=we)}else if(X){const Ie=e.findItemIndex(X);if(re>Ie){const Ye=e.schedule.findJumpRestrictedIndex(Ie+1,re);if(Ye>Ie){e.setSchedulePosition(Ye);return}}let Ce=0;if(Pe)e.timelinePos=we,e.checkBuffer();else{const Ye=ae.event.assetList,_t=S-(ae[R]||ae).start;for(let xt=Ye.length;xt--;){const Rt=Ye[xt];if(Rt.duration&&_t>=Rt.startOffset&&_t<Rt.startOffset+Rt.duration){Ce=xt;break}}}e.setSchedulePosition(re,Ce)}}},p=()=>{const S=e.effectivePlayingItem;if(e.isInterstitial(S))return S;const R=t();return e.isInterstitial(R)?R:null},m={get bufferedEnd(){const S=t(),R=e.bufferingItem;if(R&&R===S){var H;return r(R,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-R.playout.start||((H=e.bufferingAsset)==null?void 0:H.startOffset)||0}return 0},get currentTime(){const S=p(),R=e.effectivePlayingItem;return R&&R===S?r(R,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-R.playout.start:0},set currentTime(S){const R=p(),H=e.effectivePlayingItem;H&&H===R&&g(S+H.playout.start,"playout")},get duration(){const S=p();return S?S.playout.end-S.playout.start:0},get assetPlayers(){var S;const R=(S=p())==null?void 0:S.event.assetList;return R?R.map(H=>e.getAssetPlayer(H.identifier)):[]},get playingIndex(){var S;const R=(S=p())==null?void 0:S.event;return R&&e.effectivePlayingAsset?R.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return p()}};return this.manager={get events(){var S;return((S=e.schedule)==null||(S=S.events)==null?void 0:S.slice(0))||[]},get schedule(){var S;return((S=e.schedule)==null||(S=S.items)==null?void 0:S.slice(0))||[]},get interstitialPlayer(){return p()?m:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const S=t();return e.findItemIndex(S)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const S=e.effectivePlayingItem;return e.findItemIndex(S)},primary:{get bufferedEnd(){return a()},get currentTime(){const S=e.timelinePos;return S>0?S:0},set currentTime(S){g(S,"primary")},get duration(){return u("primary")},get seekableStart(){var S;return((S=e.primaryDetails)==null?void 0:S.fragmentStart)||0}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(S){g(S,"integrated")},get duration(){return u("integrated")},get seekableStart(){var S;return n(((S=e.primaryDetails)==null?void 0:S.fragmentStart)||0,"integrated")}},skip:()=>{const S=e.effectivePlayingItem,R=S==null?void 0:S.event;if(R&&!R.restrictions.skip){const H=e.findItemIndex(S);if(R.appendInPlace){const j=S.playout.start+S.event.duration;g(j+.001,"playout")}else e.advanceAfterAssetEnded(R,H,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,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(r=this.primaryMedia);const n=(t=r)==null?void 0:t.currentTime;if(!(n===void 0||!I(n)))return n}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,r=e.media;if(i&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}const n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${jt(n)}`),this.detachedData=n}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var i,r;if(e.media===t)return;let n=null;const a=this.hls,u=e!==a,g=u&&e.interstitial.appendInPlace,p=(i=this.detachedData)==null?void 0:i.mediaSource;let m;if(a.media)g&&(n=a.transferMedia(),this.detachedData=n),m="Primary";else if(p){const j=this.getBufferingPlayer();j?(n=j.transferMedia(),m=`${j}`):m="detached MediaSource"}else m="detached media";if(!n){if(p)n=this.detachedData,this.log(`using detachedData: MediaSource ${jt(n)}`);else if(!this.detachedData||a.media===t){const j=this.playerQueue;j.length>1&&j.forEach(Q=>{if(u&&Q.interstitial.appendInPlace!==g){const X=Q.interstitial;this.clearInterstitial(Q.interstitial,null),X.appendInPlace=!1,X.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${X}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const S=n&&"mediaSource"in n&&((r=n.mediaSource)==null?void 0:r.readyState)!=="closed",R=S&&n?n:t;this.log(`${S?"transfering MediaSource":"attaching media"} to ${u?e:"Primary"} from ${m} (media.currentTime: ${t.currentTime})`);const H=this.schedule;if(R===n&&H){const j=u&&e.assetId===H.assetIdAtEnd;R.overrides={duration:H.duration,endOfStream:!u||j,cueRemoval:!u}}e.attachMedia(R)}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 i=this.timelinePos,r=this.effectivePlayingItem;if(i===-1){const n=this.hls.startPosition;if(this.log(ns("checkStart",n)),this.timelinePos=n,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(n>=0||!this.primaryLive){const a=this.timelinePos=n>0?n:0,u=e.findItemIndexAtTime(a);this.setSchedulePosition(u)}}else if(r&&!this.playingItem){const n=e.findItemIndex(r);this.setSchedulePosition(n)}}advanceAssetBuffering(e,t){const i=e.event,r=i.findAssetIndex(t),n=js(i,r);if(!i.isAssetPastPlayoutLimit(n))this.bufferedToEvent(e,n);else if(this.schedule){var a;const u=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];u&&this.bufferedToItem(u)}}advanceAfterAssetEnded(e,t,i){const r=js(e,i);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){const n=this.schedule.items;if(n){const a=t+1,u=n.length;if(a>=u){this.setSchedulePosition(-1);return}const g=e.resumeTime;this.timelinePos<g&&(this.log(ns("advanceAfterAssetEnded",g)),this.timelinePos=g,e.appendInPlace&&this.advanceInPlace(g),this.checkBuffer(this.bufferedPos<g)),this.setSchedulePosition(a)}}}else{if(e.appendInPlace){const n=e.assetList[r];n&&this.advanceInPlace(n.timelineStart)}this.setSchedulePosition(t,r)}}setScheduleToAssetAtTime(e,t){const i=this.schedule;if(!i)return;const r=t.parentIdentifier,n=i.getEvent(r);if(n){const a=i.findEventIndex(r),u=i.findAssetIndex(n,e);this.advanceAfterAssetEnded(n,a,u-1)}}setSchedulePosition(e,t){var i;const r=(i=this.schedule)==null?void 0:i.items;if(!r||this.playbackDisabled)return;const n=e>=0?r[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n&&nr(n)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,u=this.playingLastItem;if(this.isInterstitial(a)){const m=a.event,S=this.playingAsset,R=S==null?void 0:S.identifier,H=R?this.getAssetPlayer(R):null;if(H&&R&&(!this.eventItemsMatch(a,n)||t!==void 0&&R!==m.assetList[t].identifier)){var g;const j=m.findAssetIndex(S);if(this.log(`INTERSTITIAL_ASSET_ENDED ${j+1}/${m.assetList.length} ${Tn(S)}`),this.endedAsset=S,this.playingAsset=null,this.hls.trigger(_.INTERSTITIAL_ASSET_ENDED,{asset:S,assetListIndex:j,event:m,schedule:r.slice(0),scheduleIndex:e,player:H}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(m,this.findItemIndex(this.playingItem),j);return}this.retreiveMediaSource(R,n),H.media&&!((g=this.detachedData)!=null&&g.mediaSource)&&H.detachMedia()}if(!this.eventItemsMatch(a,n)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${m} ${nr(a)}`),m.hasPlayed=!0,this.hls.trigger(_.INTERSTITIAL_ENDED,{event:m,schedule:r.slice(0),scheduleIndex:e}),m.cue.once)){var p;this.updateSchedule();const j=(p=this.schedule)==null?void 0:p.items;if(n&&j){const Q=this.findItemIndex(n);this.advanceSchedule(Q,j,t,a,u)}return}}this.advanceSchedule(e,r,t,a,u)}advanceSchedule(e,t,i,r,n){const a=this.schedule;if(!a)return;const u=t[e]||null,g=this.primaryMedia,p=this.playerQueue;if(p.length&&p.forEach(m=>{const S=m.interstitial,R=a.findEventIndex(S.identifier);(R<e||R>e+1)&&this.clearInterstitial(S,u)}),this.isInterstitial(u)){this.timelinePos=Math.min(Math.max(this.timelinePos,u.start),u.end);const m=u.event;if(i===void 0){i=a.findAssetIndex(m,this.timelinePos);const j=js(m,i-1);if(m.isAssetPastPlayoutLimit(j)||m.appendInPlace&&this.timelinePos===u.end){this.advanceAfterAssetEnded(m,e,i);return}i=j}const S=this.waitingItem;this.assetsBuffered(u,g)||this.setBufferingItem(u);let R=this.preloadAssets(m,i);if(this.eventItemsMatch(u,S||r)||(this.waitingItem=u,this.log(`INTERSTITIAL_STARTED ${nr(u)} ${m.appendInPlace?"append in place":""}`),this.hls.trigger(_.INTERSTITIAL_STARTED,{event:m,schedule:t.slice(0),scheduleIndex:e})),!m.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${m}`);return}if(m.assetListLoader&&(m.assetListLoader.destroy(),m.assetListLoader=void 0),!g){this.log(`Waiting for attachMedia to start Interstitial ${m}`);return}this.waitingItem=this.endedItem=null,this.playingItem=u;const H=m.assetList[i];if(!H){this.advanceAfterAssetEnded(m,e,i||0);return}if(R||(R=this.getAssetPlayer(H.identifier)),R===null||R.destroyed){const j=m.assetList.length;this.warn(`asset ${i+1}/${j} player destroyed ${m}`),R=this.createAssetPlayer(m,H,i),R.loadSource()}if(!this.eventItemsMatch(u,this.bufferingItem)&&m.appendInPlace&&this.isAssetBuffered(H))return;this.startAssetPlayer(R,i,t,e,g),this.shouldPlay&&Lo(R.media)}else u?(this.resumePrimary(u,e,r),this.shouldPlay&&Lo(this.hls.media)):n&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(a.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,i){var r,n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${nr(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let u=this.timelinePos;(u<e.start||u>=e.end)&&(u=this.getPrimaryResumption(e,t),this.log(ns("resumePrimary",u)),this.timelinePos=u),this.attachPrimary(u,e)}if(!i)return;const a=(n=this.schedule)==null?void 0:n.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${nr(e)}`),this.hls.trigger(_.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const r=this.primaryDetails;if(t===0)return this.hls.startPosition;if(r&&(i<r.fragmentStart||i>r.edge))return this.hls.liveSyncPosition||-1}return i}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,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,r),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(ns("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const r=this.hls;!r.loadingEnabled||!r.media||Math.abs((((i=r.mainForwardBufferInfo)==null?void 0:i.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.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(_.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(_.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const i=this.hls.levels[t.level];if(!i.details)return;const r=h(h({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=h(h({},this.altSelection),{},{audio:i});return}const n=h(h({},r),{},{audio:i});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=h(h({},this.altSelection),{},{subtitles:i});return}const n=h(h({},r),{},{subtitles:i});this.mediaSelection=n}onAudioTrackSwitching(e,t){const i=ln(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setAudioOption(t)||r.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=ln(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setSubtitleOption(t)||t.id!==-1&&r.setSubtitleOption(i)))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const n=t[r];if(n.cue.post){var i;const a=this.schedule.findEventIndex(n.identifier),u=(i=this.schedule.items)==null?void 0:i[a];this.isInterstitial(u)&&this.eventItemsMatch(u,this.bufferingItem)&&this.bufferedToItem(u,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){var i;const r=(i=this.schedule)==null?void 0:i.items;if(e&&r){const n=this.findItemIndex(e,t);return r[n]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((n,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(n.identifier,null)});const i=e.end+.25,r=Ot.bufferInfo(this.primaryMedia,i,0);(r.end>i||(r.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${nr(e)} (was ${nr(t)})`),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&((t=this.schedule)==null||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=(t=this.schedule)==null?void 0:t.items;if(!i)return;const r=Ot.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,i,e)}updateBufferedPos(e,t,i){const r=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],n)){this.bufferedPos=e;return}const a=this.playingItem,u=this.findItemIndex(a);let g=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var p;const m=this.findItemIndex(n),S=Math.min(m+1,t.length-1),R=t[S];if((g===-1&&n&&e>=n.end||(p=R.event)!=null&&p.appendInPlace&&e+.01>=R.start)&&(g=S),this.isInterstitial(n)){const H=n.event;if(S-u>1&&H.appendInPlace===!1||H.assetList.length===0&&H.assetListLoader)return}if(this.bufferedPos=e,g>m&&g>u)this.bufferedToItem(R);else{const H=this.primaryDetails;this.primaryLive&&H&&e>H.edge-H.targetduration&&R.start<H.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(R)&&this.preloadAssets(R.event,0)}}else i&&a&&!this.itemsMatch(a,n)&&(g===u?this.bufferedToItem(a):g===u+1&&this.bufferedToItem(t[g]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const n=this.getAssetPlayer(r.identifier);return!(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:r,events:n}=i;if(!r||!n)return t;const a=this.isInterstitial(e),u=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const g=u?u.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${nr(e)}`+(t?` (${g.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const p=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((m,S)=>{const R=this.getAssetPlayer(m.identifier);R&&(S===p&&R.loadSource(),R.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(p=>p.pauseBuffering());this.hls.trigger(_.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:r.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 i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const r=this.detachedData;r?r.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,r=i.assetList.length===0&&!i.assetListLoader,n=i.cue.once;if(r||!n){const a=this.preloadAssets(i,t);if(a!=null&&a.interstitial.appendInPlace){const u=this.primaryMedia;u&&this.bufferAssetPlayer(a,u)}}}preloadAssets(e,t){const i=e.assetUrl,r=e.assetList.length,n=r===0&&!e.assetListLoader,a=e.cue.once;if(n){const g=e.timelineStart;if(e.appendInPlace){var u;const R=this.playingItem;!this.isInterstitial(R)&&(R==null||(u=R.nextEvent)==null?void 0:u.identifier)===e.identifier&&this.flushFrontBuffer(g+.25)}let p,m=0;if(!this.playingItem&&this.primaryLive&&(m=this.hls.startPosition,m===-1&&(m=this.hls.liveSyncPosition||0)),m&&!(e.cue.pre||e.cue.post)){const R=m-g;R>0&&(p=Math.round(R*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:r} ${e}${p?` live-start: ${m} start-offset: ${p}`:""}`),i)return this.createAsset(e,0,0,g,e.duration,i);const S=this.assetListLoader.loadAssetList(e,p);S&&(e.assetListLoader=S)}else if(!a&&r){for(let p=t;p<r;p++){const m=e.assetList[p],S=this.getAssetPlayerQueueIndex(m.identifier);(S===-1||this.playerQueue[S].destroyed)&&!m.error&&this.createAssetPlayer(e,m,p)}const g=e.assetList[t];if(g){const p=this.getAssetPlayer(g.identifier);return p&&p.loadSource(),p}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(r=>{this.hls.trigger(_.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:r})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,r,n,a){const u={parentIdentifier:e.identifier,identifier:Pc(e,a,t),duration:n,startOffset:i,timelineStart:r,uri:a};return this.createAssetPlayer(e,u,t)}createAssetPlayer(e,t,i){const r=this.hls,n=r.userConfig;let a=n.videoPreference;const u=r.loadLevelObj||r.levels[r.currentLevel];(a||u)&&(a=c({},a),u.videoCodec&&(a.videoCodec=u.videoCodec),u.videoRange&&(a.allowedVideoRanges=[u.videoRange]));const g=r.audioTracks[r.audioTrack],p=r.subtitleTracks[r.subtitleTrack];let m=0;if(this.primaryLive||e.appendInPlace){const de=this.timelinePos-t.timelineStart;if(de>1){const Se=t.duration;Se&&de<Se&&(m=de)}}const S=t.identifier,R=h(h({},n),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:S,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:m,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:g||n.audioPreference,subtitlePreference:p||n.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(R.timelineOffset=t.timelineStart));const H=R.cmcd;H!=null&&H.sessionId&&H.contentId&&(R.cmcd=c({},H,{contentId:$n(t.uri)})),this.getAssetPlayer(S)&&this.warn(`Duplicate date range identifier ${e} and asset ${S}`);const j=new Mc(this.HlsPlayerClass,R,e,t);this.playerQueue.push(j),e.assetList[i]=t;let Q=!0;const X=de=>{if(de.live){var Se;const Pe=new Error(`Interstitials MUST be VOD assets ${e}`),Ie={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:Pe},Ce=((Se=this.schedule)==null?void 0:Se.findEventIndex(e.identifier))||-1;this.handleAssetItemError(Ie,e,Ce,i,Pe.message);return}const Ne=de.edge-de.fragmentStart,we=t.duration;(Q||we===null||Ne>we)&&(Q=!1,this.log(`Interstitial asset "${S}" duration change ${we} > ${Ne}`),t.duration=Ne,this.updateSchedule())};j.on(_.LEVEL_UPDATED,(de,{details:Se})=>X(Se)),j.on(_.LEVEL_PTS_UPDATED,(de,{details:Se})=>X(Se)),j.on(_.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const re=(de,Se)=>{const Ne=this.getAssetPlayer(S);if(Ne&&Se.tracks){Ne.off(_.BUFFER_CODECS,re),Ne.tracks=Se.tracks;const we=this.primaryMedia;this.bufferingAsset===Ne.assetItem&&we&&!Ne.media&&this.bufferAssetPlayer(Ne,we)}};j.on(_.BUFFER_CODECS,re);const ae=()=>{var de;const Se=this.getAssetPlayer(S);if(this.log(`buffered to end of asset ${Se}`),!Se||!this.schedule)return;const Ne=this.schedule.findEventIndex(e.identifier),we=(de=this.schedule.items)==null?void 0:de[Ne];this.isInterstitial(we)&&this.advanceAssetBuffering(we,t)};j.on(_.BUFFERED_TO_END,ae);const oe=de=>()=>{if(!this.getAssetPlayer(S)||!this.schedule)return;this.shouldPlay=!0;const Ne=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,Ne,de)};return j.once(_.MEDIA_ENDED,oe(i)),j.once(_.PLAYOUT_LIMIT_REACHED,oe(1/0)),j.on(_.ERROR,(de,Se)=>{if(!this.schedule)return;const Ne=this.getAssetPlayer(S);if(Se.details===w.BUFFER_STALLED_ERROR){if(Ne!=null&&Ne.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(Se,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${Se.error} ${e}`)}),j.on(_.DESTROYING,()=>{if(!this.getAssetPlayer(S)||!this.schedule)return;const Se=new Error(`Asset player destroyed unexpectedly ${S}`),Ne={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:Se};this.handleAssetItemError(Ne,e,this.schedule.findEventIndex(e.identifier),i,Se.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Tn(t)}`),this.hls.trigger(_.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:j}),j}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){const r=this.playerQueue[i];this.log(`clear ${r} toSegment: ${t&&nr(t)}`),this.transferMediaFromPlayer(r,t),this.playerQueue.splice(i,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,r,n){const{interstitial:a,assetItem:u,assetId:g}=e,p=a.assetList.length,m=this.playingAsset;this.endedAsset=null,this.playingAsset=u,(!m||m.identifier!==g)&&(m&&(this.clearAssetPlayer(m.identifier,i[r]),delete m.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${p} ${Tn(u)}`),this.hls.trigger(_.INTERSTITIAL_ASSET_STARTED,{asset:u,assetListIndex:t,event:a,schedule:i.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,n)}bufferAssetPlayer(e,t){var i,r;if(!this.schedule)return;const{interstitial:n,assetItem:a}=e,u=this.schedule.findEventIndex(n.identifier),g=(i=this.schedule.items)==null?void 0:i[u];if(!g)return;e.loadSource(),this.setBufferingItem(g),this.bufferingAsset=a;const p=this.getBufferingPlayer();if(p===e)return;const m=n.appendInPlace;if(m&&(p==null?void 0:p.interstitial.appendInPlace)===!1)return;const S=(p==null?void 0:p.tracks)||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(m&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(S&&!se(S,e.tracks)){const R=new Error(`Asset ${Tn(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(S)}')`),H={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:R},j=n.findAssetIndex(a);this.handleAssetItemError(H,n,u,j,R.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const r=i.currentTime,n=t.findAssetIndex(e,r),a=e.assetList[n];if(a){const u=this.getAssetPlayer(a.identifier);if(u){const g=u.currentTime||r-a.timelineStart,p=u.duration-g;if(this.warn(`Stalled at ${g} of ${g+p} in ${u} ${e} (media.currentTime: ${r})`),g&&(p/i.playbackRate<.5||u.bufferedInPlaceToEnd(i))&&u.hls){const m=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,m,n)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,r,n){if(e.details===w.BUFFER_STALLED_ERROR)return;const a=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&Tn(a)} ${e.error}`),!this.schedule)return;const u=(a==null?void 0:a.identifier)||"",g=this.getAssetPlayerQueueIndex(u),p=this.playerQueue[g]||null,m=this.schedule.items,S=c({},e,{fatal:!1,errorAction:_i(!0),asset:a,assetListIndex:r,event:t,schedule:m,scheduleIndex:i,player:p});if(this.hls.trigger(_.INTERSTITIAL_ASSET_ERROR,S),!e.fatal)return;const R=this.playingAsset,H=this.bufferingAsset,j=new Error(n);if(a&&(this.clearAssetPlayer(u,null),a.error=j),!t.assetList.some(Q=>!Q.error))t.error=j;else for(let Q=r;Q<t.assetList.length;Q++)this.resetAssetPlayer(t.assetList[Q].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):R&&R.identifier===u?this.advanceAfterAssetEnded(t,i,r):H&&H.identifier===u&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,H)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${nr(i)} error: ${e.error}`);let r=this.timelinePos;r===-1&&(r=this.hls.startPosition);const n=this.updateItem(i,r);if(this.itemsMatch(i,n)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const a=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(a)}else this.checkStart()}onAssetListLoaded(e,t){var i,r;const n=t.event,a=n.identifier,u=t.assetListResponse.ASSETS;if(!((i=this.schedule)!=null&&i.hasEvent(a)))return;const g=n.timelineStart,p=n.duration;let m=0;u.forEach((Q,X)=>{const re=parseFloat(Q.DURATION);this.createAsset(n,X,m,g+m,re,Q.URI),m+=re}),n.duration=m,this.log(`Loaded asset-list with duration: ${m} (was: ${p}) ${n}`);const S=this.waitingItem,R=(S==null?void 0:S.event.identifier)===a;this.updateSchedule();const H=(r=this.bufferingItem)==null?void 0:r.event;if(R){var j;const Q=this.schedule.findEventIndex(a),X=(j=this.schedule.items)==null?void 0:j[Q];if(X){if(!this.playingItem&&this.timelinePos>X.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==Q){n.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${n}`),this.updateSchedule(!0),this.primaryFallback(n);return}this.setBufferingItem(X)}this.setSchedulePosition(Q)}else if((H==null?void 0:H.identifier)===a){const Q=n.assetList[0];if(Q){const X=this.getAssetPlayer(Q.identifier);if(H.appendInPlace){const re=this.primaryMedia;X&&re&&this.bufferAssetPlayer(X,re)}else X&&X.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case w.ASSET_LIST_PARSING_ERROR:case w.ASSET_LIST_LOAD_ERROR:case w.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case w.BUFFER_STALLED_ERROR:{const i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace){this.handleInPlaceStall(i.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Ro=500;class $c extends gs{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",v.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(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(_.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=ze.IDLE,this.setInterval(Ro),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragContextChanged(i)||(pe(i)&&(this.fragPrevious=i),this.state=ze.IDLE),!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const u=i.start;for(let p=0;p<n.length;p++)if(u>=n[p].start&&u<=n[p].end){a=n[p];break}const g=i.start+i.duration;a?a.end=g:(a={start:u,end:g},n.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let u=0;u<a.length;){if(a[u].end<=n){a.shift();continue}else if(a[u].start<n)a[u].start=n;else break;u++}}),this.fragmentTracker.removeFragmentsInRange(i,n,v.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===v.SUBTITLE&&(t.details===w.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==ze.STOPPED&&(this.state=ze.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&no(this.levels,t)){this.levels=t.map(i=>new $t(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new $t(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,v.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==ze.STOPPED&&this.setInterval(Ro)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:n}=this,{details:a,id:u}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${u}`);return}const g=n[u];if(u>=n.length||!g)return;this.log(`Subtitle track ${u} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let p=0;if(a.live||(i=g.details)!=null&&i.live){if(a.deltaUpdateFailed)return;const S=this.mainDetails;if(!S){this.startFragRequested=!1;return}const R=S.fragments[0];if(!g.details)a.hasProgramDateTime&&S.hasProgramDateTime?(Wn(a,S),p=a.fragmentStart):R&&(p=R.start,_s(a,p));else{var m;p=this.alignPlaylists(a,g.details,(m=this.levelLastLoaded)==null?void 0:m.details),p===0&&R&&(p=R.start,_s(a,p))}S&&!this.startFragRequested&&this.setStartPosition(S,p)}g.details=a,this.levelLastLoaded=g,u===r&&(this.hls.trigger(_.SUBTITLE_TRACK_UPDATED,{details:a,id:u,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===ze.IDLE&&(yi(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r!=null&&r.key&&r.iv&&Qi(r.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer,Br(r.method)).catch(u=>{throw n.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:t}),u}).then(u=>{const g=performance.now();n.trigger(_.FRAG_DECRYPTED,{frag:t,payload:u,stats:{tstart:a,tdecrypt:g}})}).catch(u=>{this.warn(`${u.name}: ${u.message}`),this.state=ze.IDLE})}}doTick(){if(!this.media){this.state=ze.IDLE;return}if(this.state===ze.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:r}=this,n=this.getLoadPosition(),a=Ot.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:u,len:g}=a,p=i.details,m=this.hls.maxBufferLength+p.levelTargetDuration;if(g>m)return;const S=p.fragments,R=S.length,H=p.edge;let j=null;const Q=this.fragPrevious;if(u<H){const ae=r.maxFragLookUpTolerance,oe=u>H-ae?0:ae;j=yi(Q,S,Math.max(S[0].start,u),oe),!j&&Q&&Q.start<S[0].start&&(j=S[0])}else j=S[R-1];if(j=this.filterReplacedPrimary(j,i.details),!j)return;const X=j.sn-p.startSN,re=S[X-1];if(re&&re.cc===j.cc&&this.fragmentTracker.getState(re)===si.NOT_LOADED&&(j=re),this.fragmentTracker.getState(j)===si.NOT_LOADED){const ae=this.mapToInitFragWhenRequired(j);ae&&this.loadFragment(ae,i,u)}}}loadFragment(e,t,i){pe(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Hc(this.tracksBuffered[this.currentTrackId]||[])}}class Hc{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const jc={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},ko=o=>String.fromCharCode(jc[o]||o),sr=15,kr=100,Kc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Wc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Gc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},zc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Vc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class qc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;M.log(`${this.time} [${e}] ${i}`)}}}const nn=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Io{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}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 Yc{constructor(){this.uchar=" ",this.penState=new Io}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 Zc{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Io,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<kr;t++)this.chars.push(new Yc);this.logger=e}equals(e){for(let t=0;t<kr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<kr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<kr;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>kr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=kr)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=ko(e);if(this.pos>=kr){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<kr;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<kr;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Ks{constructor(e){this.rows=[],this.currRow=sr-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<sr;t++)this.rows.push(new Zc(e));this.logger=e}reset(){for(let e=0;e<sr;e++)this.rows[e].clear();this.currRow=sr-1}equals(e){let t=!0;for(let i=0;i<sr;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<sr;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<sr;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 = "+jt(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let u=0;u<sr;u++)this.rows[u].clear();const n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const u=a.rows[n].cueStartTime,g=this.logger.time;if(u!==null&&g!==null&&u<g)for(let p=0;p<this.nrRollUpRows;p++)this.rows[t-this.nrRollUpRows+p+1].copy(a.rows[n+p])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[a].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+jt(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",r=-1;for(let n=0;n<sr;n++){const a=this.rows[n].getTextString();a&&(r=n+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
|
|
|
`)),i}getTextAndFormat(){return this.rows}}class Po{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ks(i),this.nonDisplayedMemory=new Ks(i),this.lastOutputScreen=new Ks(i),this.currRollUpRow=this.displayedMemory.rows[sr-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[sr-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+jt(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 Oo{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Qc(),this.logger=void 0;const r=this.logger=new qc;this.channels=[null,new Po(e,t,r),new Po(e+1,i,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const r=t[i]&127,n=t[i+1]&127;let a=!1,u=null;if(r===0&&n===0)continue;this.logger.log(3,()=>"["+nn([t[i],t[i+1]])+"] -> ("+nn([r,n])+")");const g=this.cmdHistory;if(r>=16&&r<=31){if(Xc(r,n,g)){ss(null,null,g),this.logger.log(3,()=>"Repeated command ("+nn([r,n])+") is dropped");continue}ss(r,n,this.cmdHistory),a=this.parseCmd(r,n),a||(a=this.parseMidrow(r,n)),a||(a=this.parsePAC(r,n)),a||(a=this.parseBackgroundAttributes(r,n))}else ss(null,null,g);if(!a&&(u=this.parseChars(r,n),u)){const m=this.currentChannel;m&&m>0?this.channels[m].insertChars(u):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!u&&this.logger.log(2,()=>"Couldn't parse cleaned data "+nn([r,n])+" orig: "+nn([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(i||r))return!1;const n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+nn([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(r||n))return!1;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?Kc[e]:Gc[e]:i=a===1?Wc[e]:zc[e];const u=this.channels[a];return u?(u.setPAC(this.interpretPAC(i,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+ko(a)+"' in channel "+i),r=[a]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+nn(r).join(",")),r}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=Vc[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const u=e<=23?1:2;return this.channels[u].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}ss(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function ss(o,e,t){t.a=o,t.b=e}function Xc(o,e,t){return t.a===o&&t.b===e}function Qc(){return{a:null,b:null}}var Ws=function(){if(ti!=null&&ti.VTTCue)return self.VTTCue;const o=["","lr","rl"],e=["start","middle","end","left","right"];function t(u,g){if(typeof g!="string"||!Array.isArray(u))return!1;const p=g.toLowerCase();return~u.indexOf(p)?p:!1}function i(u){return t(o,u)}function r(u){return t(e,u)}function n(u,...g){let p=1;for(;p<arguments.length;p++){const m=arguments[p];for(const S in m)u[S]=m[S]}return u}function a(u,g,p){const m=this,S={enumerable:!0};m.hasBeenReset=!1;let R="",H=!1,j=u,Q=g,X=p,re=null,ae="",oe=!0,de="auto",Se="start",Ne=50,we="middle",Pe=50,Ie="middle";Object.defineProperty(m,"id",n({},S,{get:function(){return R},set:function(Ce){R=""+Ce}})),Object.defineProperty(m,"pauseOnExit",n({},S,{get:function(){return H},set:function(Ce){H=!!Ce}})),Object.defineProperty(m,"startTime",n({},S,{get:function(){return j},set:function(Ce){if(typeof Ce!="number")throw new TypeError("Start time must be set to a number.");j=Ce,this.hasBeenReset=!0}})),Object.defineProperty(m,"endTime",n({},S,{get:function(){return Q},set:function(Ce){if(typeof Ce!="number")throw new TypeError("End time must be set to a number.");Q=Ce,this.hasBeenReset=!0}})),Object.defineProperty(m,"text",n({},S,{get:function(){return X},set:function(Ce){X=""+Ce,this.hasBeenReset=!0}})),Object.defineProperty(m,"region",n({},S,{get:function(){return re},set:function(Ce){re=Ce,this.hasBeenReset=!0}})),Object.defineProperty(m,"vertical",n({},S,{get:function(){return ae},set:function(Ce){const Ye=i(Ce);if(Ye===!1)throw new SyntaxError("An invalid or illegal string was specified.");ae=Ye,this.hasBeenReset=!0}})),Object.defineProperty(m,"snapToLines",n({},S,{get:function(){return oe},set:function(Ce){oe=!!Ce,this.hasBeenReset=!0}})),Object.defineProperty(m,"line",n({},S,{get:function(){return de},set:function(Ce){if(typeof Ce!="number"&&Ce!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");de=Ce,this.hasBeenReset=!0}})),Object.defineProperty(m,"lineAlign",n({},S,{get:function(){return Se},set:function(Ce){const Ye=r(Ce);if(!Ye)throw new SyntaxError("An invalid or illegal string was specified.");Se=Ye,this.hasBeenReset=!0}})),Object.defineProperty(m,"position",n({},S,{get:function(){return Ne},set:function(Ce){if(Ce<0||Ce>100)throw new Error("Position must be between 0 and 100.");Ne=Ce,this.hasBeenReset=!0}})),Object.defineProperty(m,"positionAlign",n({},S,{get:function(){return we},set:function(Ce){const Ye=r(Ce);if(!Ye)throw new SyntaxError("An invalid or illegal string was specified.");we=Ye,this.hasBeenReset=!0}})),Object.defineProperty(m,"size",n({},S,{get:function(){return Pe},set:function(Ce){if(Ce<0||Ce>100)throw new Error("Size must be between 0 and 100.");Pe=Ce,this.hasBeenReset=!0}})),Object.defineProperty(m,"align",n({},S,{get:function(){return Ie},set:function(Ce){const Ye=r(Ce);if(!Ye)throw new SyntaxError("An invalid or illegal string was specified.");Ie=Ye,this.hasBeenReset=!0}})),m.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class Jc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Fo(o){function e(i,r,n,a){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(a||0)}const t=o.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 eh{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function Mo(o,e,t,i){const r=i?o.split(i):[o];for(const n in r){if(typeof r[n]!="string")continue;const a=r[n].split(t);if(a.length!==2)continue;const u=a[0],g=a[1];e(u,g)}}const Gs=new Ws(0,0,""),as=Gs.align==="middle"?"middle":"center";function th(o,e,t){const i=o;function r(){const u=Fo(o);if(u===null)throw new Error("Malformed timestamp: "+i);return o=o.replace(/^[^\sa-zA-Z-]+/,""),u}function n(u,g){const p=new eh;Mo(u,function(R,H){let j;switch(R){case"region":for(let Q=t.length-1;Q>=0;Q--)if(t[Q].id===H){p.set(R,t[Q].region);break}break;case"vertical":p.alt(R,H,["rl","lr"]);break;case"line":j=H.split(","),p.integer(R,j[0]),p.percent(R,j[0])&&p.set("snapToLines",!1),p.alt(R,j[0],["auto"]),j.length===2&&p.alt("lineAlign",j[1],["start",as,"end"]);break;case"position":j=H.split(","),p.percent(R,j[0]),j.length===2&&p.alt("positionAlign",j[1],["start",as,"end","line-left","line-right","auto"]);break;case"size":p.percent(R,H);break;case"align":p.alt(R,H,["start",as,"end","left","right"]);break}},/:/,/\s/),g.region=p.get("region",null),g.vertical=p.get("vertical","");let m=p.get("line","auto");m==="auto"&&Gs.line===-1&&(m=-1),g.line=m,g.lineAlign=p.get("lineAlign","start"),g.snapToLines=p.get("snapToLines",!0),g.size=p.get("size",100),g.align=p.get("align",as);let S=p.get("position","auto");S==="auto"&&Gs.position===50&&(S=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=S}function a(){o=o.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),o.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);o=o.slice(3),a(),e.endTime=r(),a(),n(o,e)}function Bo(o){return o.replace(/<br(?: \/)?>/gi,`
|
|
|
`)}class ih{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Jc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let n=t.buffer,a=0;for(n=Bo(n);a<n.length&&n[a]!=="\r"&&n[a]!==`
|
|
|
`;)++a;const u=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===`
|
|
|
`&&++a,t.buffer=n.slice(a),u}function r(n){Mo(n,function(a,u){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const u=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(u!=null&&u[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new Ws(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{th(n,t.cue,t.regionList)}catch(u){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const u=n.indexOf("-->")!==-1;if(!n||u&&(a=!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+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch(n){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 rh=/\r\n|\n\r|\n|\r/g,zs=function(e,t,i=0){return e.slice(i,i+t.length)===t},nh=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!I(t)||!I(i)||!I(r)||!I(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t};function Vs(o,e,t){return $n(o.toString())+$n(e.toString())+$n(t)}const sh=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function ah(o,e,t,i,r,n,a){const u=new ih,g=ce(new Uint8Array(o)).trim().replace(rh,`
|
|
|
`).split(`
|
|
|
`),p=[],m=e?_u(e.baseTime,e.timescale):0;let S="00:00.000",R=0,H=0,j,Q=!0;u.oncue=function(X){const re=t[i];let ae=t.ccOffset;const oe=(R-m)/9e4;if(re!=null&&re.new&&(H!==void 0?ae=t.ccOffset=re.start:sh(t,i,oe)),oe){if(!e){j=new Error("Missing initPTS for VTT MPEGTS");return}ae=oe-t.presentationOffset}const de=X.endTime-X.startTime,Se=Gi((X.startTime+ae-H)*9e4,r*9e4)/9e4;X.startTime=Math.max(Se,0),X.endTime=Math.max(Se+de,0);const Ne=X.text.trim();X.text=decodeURIComponent(encodeURIComponent(Ne)),X.id||(X.id=Vs(X.startTime,X.endTime,Ne)),X.endTime>0&&p.push(X)},u.onparsingerror=function(X){j=X},u.onflush=function(){if(j){a(j);return}n(p)},g.forEach(X=>{if(Q)if(zs(X,"X-TIMESTAMP-MAP=")){Q=!1,X.slice(16).split(",").forEach(re=>{zs(re,"LOCAL:")?S=re.slice(6):zs(re,"MPEGTS:")&&(R=parseInt(re.slice(7)))});try{H=nh(S)/1e3}catch(re){j=re}return}else X===""&&(Q=!1);u.parse(X+`
|
|
|
`)}),u.flush()}const qs="stpp.ttml.im1t",No=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Uo=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,oh={left:"start",center:"center",right:"end",start:"start",end:"end"};function $o(o,e,t,i){const r=ue(new Uint8Array(o),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(u=>ce(u)),a=pu(e.baseTime,1,e.timescale);try{n.forEach(u=>t(lh(u,a)))}catch(u){i(u)}}function lh(o,e){const r=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((S,R)=>(S[R]=r.getAttribute(`ttp:${R}`)||n[R],S),{}),u=r.getAttribute("xml:space")!=="preserve",g=Ho(Ys(r,"styling","style")),p=Ho(Ys(r,"layout","region")),m=Ys(r,"body","[begin]");return[].map.call(m,S=>{const R=jo(S,u);if(!R||!S.hasAttribute("begin"))return null;const H=Xs(S.getAttribute("begin"),a),j=Xs(S.getAttribute("dur"),a);let Q=Xs(S.getAttribute("end"),a);if(H===null)throw Ko(S);if(Q===null){if(j===null)throw Ko(S);Q=H+j}const X=new Ws(H-e,Q-e,R);X.id=Vs(X.startTime,X.endTime,X.text);const re=p[S.getAttribute("region")],ae=g[S.getAttribute("style")],oe=uh(re,ae,g),{textAlign:de}=oe;if(de){const Se=oh[de];Se&&(X.lineAlign=Se),X.align=de}return c(X,oe),X}).filter(S=>S!==null)}function Ys(o,e,t){const i=o.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Ho(o){return o.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function jo(o,e){return[].slice.call(o.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
|
|
|
`:(n=i.childNodes)!=null&&n.length?jo(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function uh(o,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=o!=null&&o.hasAttribute("style")?o.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(r=t[a]),n.reduce((u,g)=>{const p=Zs(e,i,g)||Zs(o,i,g)||Zs(r,i,g);return p&&(u[g]=p),u},{})}function Zs(o,e,t){return o&&o.hasAttributeNS(e,t)?o.getAttributeNS(e,t):null}function Ko(o){return new Error(`Could not parse ttml timestamp ${o}`)}function Xs(o,e){if(!o)return null;let t=Fo(o);return t===null&&(No.test(o)?t=ch(o,e):Uo.test(o)&&(t=hh(o,e))),t}function ch(o,e){const t=No.exec(o),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function hh(o,e){const t=Uo.exec(o),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class os{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class fh{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=zo(),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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new os(this,"textTrack1"),t=new os(this,"textTrack2"),i=new os(this,"textTrack3"),r=new os(this,"textTrack4");this.cea608Parser1=new Oo(1,e,t),this.cea608Parser2=new Oo(3,i,r)}addCues(e,t,i,r,n){let a=!1;for(let u=n.length;u--;){const g=n[u],p=dh(g[0],g[1],t,i);if(p>=0&&(g[0]=Math.min(g[0],t),g[1]=Math.max(g[1],i),a=!0,p/(i-t)>.5))return}if(a||n.push([t,i]),this.config.renderTextTracksNatively){const u=this.captionsTracks[e];this.Cues.newCue(u,t,i,r)}else{const u=this.Cues.newCue(null,t,i,r);this.hls.trigger(_.CUES_PARSED,{type:"captions",cues:u,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n,trackId:a}){const{unparsedVttFrags:u}=this;i===v.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:n,trackId:a}),u.length&&(this.unparsedVttFrags=[],u.forEach(g=>{this.initPTS[g.frag.cc]?this.onFragLoaded(_.FRAG_LOADED,g):this.hls.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){const n=i.textTracks[r];if(Go(n,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:r}=this,{label:n,languageCode:a}=t[e],u=this.getExistingTrack(n,a);if(u)i[e]=u,An(i[e]),Ao(i[e],r);else{const g=this.createTextTrack("captions",n,a);g&&(g[e]=!0,i[e]=g)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(_.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:r}=this;Object.keys(r).forEach(n=>{An(r[n]),delete r[n]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=zo(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)An(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===qs);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(no(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media,u=a?is(a.textTracks):null;if(this.tracks.forEach((g,p)=>{let m;if(u){let S=null;for(let R=0;R<u.length;R++)if(u[R]&&Go(u[R],g)){S=u[R],u[R]=null;break}S&&(m=S)}if(m)An(m);else{const S=Wo(g);m=this.createTextTrack(S,g.name,g.lang),m&&(m.mode="disabled")}m&&this.textTracks.push(m)}),u!=null&&u.length){const g=u.filter(p=>p!==null).map(p=>p.label);g.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${g.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(u=>({label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}));this.hls.trigger(_.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,a=this.captionsProperties[n];a&&(a.label=i.name,i.lang&&(a.languageCode=i.lang),a.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===v.MAIN){var i,r;const{cea608Parser1:n,cea608Parser2:a,lastSn:u}=this,{cc:g,sn:p}=t.frag,m=(i=(r=t.part)==null?void 0:r.index)!=null?i:-1;n&&a&&(p!==u+1||p===u&&m!==this.lastPartIndex+1||g!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=g,this.lastSn=p,this.lastPartIndex=m}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===v.SUBTITLE)if(r.byteLength){const n=i.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const u=this.tracks[i.level],g=this.vttCCs;g[i.cc]||(g[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),u&&u.textCodec===qs?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;$o(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{i.logger.log(`Failed to parse IMSC1: ${r}`),i.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:a}=this,u=n.length-1;if(!n[i.cc]&&u===-1){a.push(e);return}const g=this.hls,p=(t=i.initSegment)!=null&&t.data?st(i.initSegment.data,new Uint8Array(r)).buffer:r;ah(p,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,m=>{this._appendCues(m,i.level),g.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},m=>{const S=m.message==="Missing initPTS for VTT MPEGTS";S?a.push(e):this._fallbackToIMSC1(i,r),g.logger.log(`Failed to parse VTT cue: ${m}`),!(S&&u>i.cc)&&g.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:m})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||$o(t,this.initPTS[e.cc],()=>{i.textCodec=qs,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>Co(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(_.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===v.SUBTITLE&&this.onFragLoaded(_.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:r}=t;if(!(i.type===v.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let n=0;n<r.length;n++){const a=r[n].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const u=this.extractCea608Data(a);this.cea608Parser1.addData(r[n].pts,u[0]),this.cea608Parser2.addData(r[n].pts,u[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:a}=this;if(!(!a||a.currentTime<i)){if(!n||n==="video"){const{captionsTracks:u}=this;Object.keys(u).forEach(g=>$s(u[g],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:u}=this;Object.keys(u).forEach(g=>$s(u[g],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const a=e[r++],u=127&e[r++],g=127&e[r++];if(u===0&&g===0)continue;if((4&a)!==0){const m=3&a;(m===0||m===1)&&(t[m].push(u),t[m].push(g))}}return t}}function Wo(o){return o.characteristics&&/transcribes-spoken-dialog/gi.test(o.characteristics)&&/describes-music-and-sound/gi.test(o.characteristics)?"captions":"subtitles"}function Go(o,e){return!!o&&o.kind===Wo(e)&&Is(e,o)}function dh(o,e,t,i){return Math.min(e,i)-Math.max(o,t)}function zo(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const ph=/\s/,_h={newCue(o,e,t,i){const r=[];let n,a,u,g,p;const m=self.VTTCue||self.TextTrackCue;for(let R=0;R<i.rows.length;R++)if(n=i.rows[R],u=!0,g=0,p="",!n.isEmpty()){var S;for(let Q=0;Q<n.chars.length;Q++)ph.test(n.chars[Q].uchar)&&u?g++:(p+=n.chars[Q].uchar,u=!1);n.cueStartTime=e,e===t&&(t+=1e-4),g>=16?g--:g++;const H=Bo(p.trim()),j=Vs(e,t,H);o!=null&&(S=o.cues)!=null&&S.getCueById(j)||(a=new m(e,t,H),a.id=j,a.line=R+1,a.align="left",a.position=10+Math.min(80,Math.floor(g*8/32)*10),r.push(a))}return o&&r.length&&(r.sort((R,H)=>R.line==="auto"||H.line==="auto"?0:R.line>8&&H.line>8?H.line-R.line:R.line-H.line),r.forEach(R=>Co(o,R))),r}};function gh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(o){}return!1}const mh=/(\d+)-(\d+)\/(\d+)/;class Vo{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||Eh,this.controller=new self.AbortController,this.stats=new C}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=vh(e,this.controller.signal),a=e.responseType==="arraybuffer",u=a?"byteLength":"length",{maxTimeToFirstByteMs:g,maxLoadTimeMs:p}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=g&&I(g)?g:p,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(Nn(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(S=>{var R;this.response=this.loader=S;const H=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=p,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},p-(H-r.loading.start)),!S.ok){const{status:Q,statusText:X}=S;throw new Sh(X||"fetch, bad network response",Q,S)}r.loading.first=H,r.total=bh(S.headers)||r.total;const j=(R=this.callbacks)==null?void 0:R.onProgress;return j&&I(t.highWaterMark)?this.loadProgressively(S,r,e,t.highWaterMark,j):a?S.arrayBuffer():e.responseType==="json"?S.json():S.text()}).then(S=>{var R,H;const j=this.response;if(!j)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const Q=S[u];Q&&(r.loaded=r.total=Q);const X={url:j.url,data:S,code:j.status},re=(R=this.callbacks)==null?void 0:R.onProgress;re&&!I(t.highWaterMark)&&re(r,e,S,j),(H=this.callbacks)==null||H.onSuccess(X,r,e,j)}).catch(S=>{var R;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const H=S&&S.code||0,j=S?S.message:null;(R=this.callbacks)==null||R.onError({code:H,text:j},e,S?S.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,r=0,n){const a=new Ra,u=e.body.getReader(),g=()=>u.read().then(p=>{if(p.done)return a.dataLength&&n(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const m=p.value,S=m.length;return t.loaded+=S,S<r||a.dataLength?(a.push(m),a.dataLength>=r&&n(t,i,a.flush().buffer,e)):n(t,i,m.buffer,e),g()}).catch(()=>Promise.reject());return g()}}function vh(o,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(c({},o.headers))};return o.rangeEnd&&t.headers.set("Range","bytes="+o.rangeStart+"-"+String(o.rangeEnd-1)),t}function yh(o){const e=mh.exec(o);if(e)return parseInt(e[2])-parseInt(e[1])+1}function bh(o){const e=o.get("Content-Range");if(e){const i=yh(e);if(I(i))return i}const t=o.get("Content-Length");if(t)return parseInt(t)}function Eh(o,e){return new self.Request(o.url,e)}class Sh extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const wh=/^age:\s*[\d.]+\s*$/im;class qo{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 C,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return n(i,t.url)}).catch(a=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),n(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(a=>{var u;(u=this.callbacks)==null||u.onError({code:i.status,text:a.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=i.loadPolicy;if(r)for(const u in r)e.setRequestHeader(u,r[u]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&I(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const p=t.status,m=t.responseType==="text"?t.responseText:null;if(p>=200&&p<300){const j=m!=null?m:t.response;if(j!=null){var a,u;i.loading.end=Math.max(self.performance.now(),i.loading.first);const Q=t.responseType==="arraybuffer"?j.byteLength:j.length;i.loaded=i.total=Q,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const X=(a=this.callbacks)==null?void 0:a.onProgress;X&&X(i,e,j,t);const re={url:t.responseURL,data:j,code:p};(u=this.callbacks)==null||u.onSuccess(re,i,e,t);return}}const S=n.loadPolicy.errorRetry,R=i.retry,H={url:e.url,data:void 0,code:p};if(Er(S,R,!1,H))this.retry(S);else{var g;M.error(`${p} while loading ${e.url}`),(g=this.callbacks)==null||g.onError({code:p,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Er(e,t,!0))this.retry(e);else{var i;M.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=cr(e,i.retry),i.retry++,M.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&wh.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 xh={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Ah=h(h({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:qo,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Bi,bufferController:Ru,capLevelController:Os,errorController:fn,fpsController:Dc,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:en,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:xh},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},Ch()),{},{subtitleStreamController:$c,subtitleTrackController:kc,timelineController:fh,audioStreamController:Cu,audioTrackController:Tu,emeController:xn,cmcdController:xc,contentSteeringController:Cc,interstitialsController:Uc});function Ch(){return{cueHandler:_h,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 Th(o,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=Qs(o),r=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const u=`${a==="level"?"playlist":a}LoadPolicy`,g=e[u]===void 0,p=[];n.forEach(m=>{const S=`${a}Loading${m}`,R=e[S];if(R!==void 0&&g){p.push(S);const H=i[u].default;switch(e[u]={default:H},m){case"TimeOut":H.maxLoadTimeMs=R,H.maxTimeToFirstByteMs=R;break;case"MaxRetry":H.errorRetry.maxNumRetry=R,H.timeoutRetry.maxNumRetry=R;break;case"RetryDelay":H.errorRetry.retryDelayMs=R,H.timeoutRetry.retryDelayMs=R;break;case"MaxRetryTimeout":H.errorRetry.maxRetryDelayMs=R,H.timeoutRetry.maxRetryDelayMs=R;break}}}),p.length&&t.warn(`hls.js config: "${p.join('", "')}" setting(s) are deprecated, use "${u}": ${jt(e[u])}`)}),h(h({},i),e)}function Qs(o){return o&&typeof o=="object"?Array.isArray(o)?o.map(Qs):Object.keys(o).reduce((e,t)=>(e[t]=Qs(o[t]),e),{}):o}function Dh(o,e){const t=o.loader;t!==Vo&&t!==qo?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),o.progressive=!1):gh()&&(o.loader=Vo,o.progressive=!0,o.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const ls=2,Lh=.1,Rh=.05,kh=100;class Ih extends gn{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 i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(_.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.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(kh),this.mediaSource=t.mediaSource;const i=this.media=t.media;Oi(i,"playing",this.onMediaPlaying),Oi(i,"waiting",this.onMediaWaiting),Oi(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&($i(i,"playing",this.onMediaPlaying),$i(i,"waiting",this.onMediaWaiting),$i(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,r;const n=(i=this.hls)==null?void 0:i.config;if(!n)return;const a=this.media;if(!a)return;const{seeking:u}=a,g=this.seeking&&!u,p=!this.seeking&&u,m=a.paused&&!u||a.ended||a.playbackRate===0;if(this.seeking=u,e!==t){t&&(this.ended=0),this.moved=!0,u||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!m&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(p||g){g&&this.stallResolved(e);return}if(m){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(_.MEDIA_ENDED,{stalled:!1}));return}if(!Ot.getBuffered(a).length){this.nudgeRetry=0;return}const S=Ot.bufferInfo(a,e,0),R=S.nextStart||0,H=this.fragmentTracker;if(u&&H&&this.hls){const Ne=Yo(this.hls.inFlightFragments,e),we=S.len>ls,Pe=!R||Ne||R-e>ls&&!H.getPartialFragment(e);if(we||Pe)return;this.moved=!1}const j=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&H){if(!(S.len>0)&&!R)return;const we=Math.max(R,S.start||0)-e,Ie=!!(j!=null&&j.live)?j.targetduration*2:ls,Ce=us(e,H);if(we>0&&(we<=Ie||Ce)){a.paused||this._trySkipBufferHole(Ce);return}}const Q=n.detectStallWithCurrentTimeMs,X=self.performance.now(),re=this.waiting;let ae=this.stalled;if(ae===null)if(re>0&&X-re<Q)ae=this.stalled=re;else{this.stalled=X;return}const oe=X-ae;if(!u&&(oe>=Q||re)&&this.hls){var de;if(((de=this.mediaSource)==null?void 0:de.readyState)==="ended"&&!(j!=null&&j.live)&&Math.abs(e-((j==null?void 0:j.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(_.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(S),!this.media||!this.hls)return}const Se=Ot.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(Se,oe,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(_.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&r&&r.length>1&&e>r.end(0)){const n=Ot.bufferedInfo(Ot.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const a=Ot.timeRangesToArray(r),u=Ot.bufferedInfo(a,t,0).bufferedIndex;if(u>-1&&u<a.length-1){const g=Ot.bufferedInfo(a,e,0).bufferedIndex,p=a[u].end,m=a[u+1].start;if((g===-1||g>u)&&m-p<1&&e-p<2){const S=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${p} -> ${m} buffered index: ${g}`);this.warn(S.message),this.media.currentTime+=1e-6;let R=us(e,this.fragmentTracker);R&&"fragment"in R?R=R.fragment:R||(R=void 0);const H=Ot.bufferInfo(this.media,e,0);this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:S,reason:S.message,frag:R,buffer:H.len,bufferInfo:H})}}}}}_tryFixBufferStall(e,t,i){var r,n;const{fragmentTracker:a,media:u}=this,g=(r=this.hls)==null?void 0:r.config;if(!u||!a||!g)return;const p=(n=this.hls)==null?void 0:n.latestLevelDetails,m=us(i,a);if((m||p!=null&&p.live&&i<p.fragmentStart)&&(this._trySkipBufferHole(m)||!this.media))return;const S=e.buffered,R=this.adjacentTraversal(e,i);(S&&S.length>1&&e.len>g.maxBufferHole||e.nextStart&&(e.nextStart-i<g.maxBufferHole||R))&&(t>g.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,r=e.nextStart;if(i&&r){const n=i.getFragAtPos(t,v.MAIN),a=i.getFragAtPos(r,v.MAIN);if(n&&a)return a.sn-n.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:r,stalled:n}=this;if(!r&&n!==null&&i&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${jt(e)})`);this.warn(a.message),t.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:r}=this,n=(t=this.hls)==null?void 0:t.config;if(!r||!i||!n)return 0;const a=r.currentTime,u=Ot.bufferInfo(r,a,0),g=a<u.start?u.start:u.nextStart;if(g&&this.hls){const m=u.len<=n.maxBufferHole,S=u.len>0&&u.len<1&&r.readyState<3,R=g-a;if(R>0&&(m||S)){if(R>n.maxBufferHole){let j=!1;if(a===0){const Q=i.getAppendedFrag(0,v.MAIN);Q&&g<Q.end&&(j=!0)}if(!j&&e){var p;if(!((p=this.hls.loadLevelObj)!=null&&p.details)||Yo(this.hls.inFlightFragments,g))return 0;let X=!1,re=e.end;for(;re<g;){const ae=us(re,i);if(ae)re+=ae.duration;else{X=!0;break}}if(X)return 0}}const H=Math.max(g+Rh,a+Lh);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${H}`),this.moved=!0,r.currentTime=H,!(e!=null&&e.gap)){const j=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${H}`),Q={type:D.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:j,reason:j.message,buffer:u.len,bufferInfo:u};e&&("fragment"in e?Q.part=e:Q.frag=e),this.hls.trigger(_.ERROR,Q)}return H}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:r}=this,n=t==null?void 0:t.config;if(!i||!n)return 0;const a=i.currentTime;if(this.nudgeRetry++,r<n.nudgeMaxRetry){const u=a+(r+1)*n.nudgeOffset,g=new Error(`Nudging 'currentTime' from ${a} to ${u}`);this.warn(g.message),i.currentTime=u,t.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_NUDGE_ON_STALL,error:g,fatal:!1,buffer:e.len,bufferInfo:e})}else{const u=new Error(`Playhead still not moving while enough data buffered @${a} after ${n.nudgeMaxRetry} nudges`);this.error(u.message),t.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,error:u,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Yo(o,e){const t=Zo(o.main);if(t&&t.start<=e)return t;const i=Zo(o.audio);return i&&i.start<=e?i:null}function Zo(o){if(!o)return null;switch(o.state){case ze.IDLE:case ze.STOPPED:case ze.ENDED:case ze.ERROR:return null}return o.frag}function us(o,e){return e.getAppendedFrag(o,v.MAIN)||e.getPartialFragment(o)}const Ph=.25;function Js(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function ea(o,e,t,i,r){let n=new o(e,t,"");try{n.value=i,r&&(n.type=r)}catch(a){n=new o(e,t,jt(r?h({type:r},i):i))}return n}const cs=(()=>{const o=Js();try{o&&new o(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Oh{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(_.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(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){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&&An(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Ao(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:r}=this.hls.config;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=Js();if(a)for(let u=0;u<n.length;u++){const g=n[u].type;if(g===Wi.emsg&&!i||!r)continue;const p=Na(n[u].data),m=n[u].pts;let S=m+n[u].duration;S>cs&&(S=cs),S-m<=0&&(S=m+Ph);for(let H=0;H<p.length;H++){const j=p[H];if(!Ua(j)){this.updateId3CueEnds(m,g);const Q=ea(a,m,S,j,g);Q&&this.id3Track.addCue(Q)}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const a=r[n];a.type===t&&a.startTime<e&&a.endTime===cs&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:u,enableID3MetadataCues:g}}=a;if(n&&(u||g)){let p;r==="audio"?p=m=>m.type===Wi.audioId3&&g:r==="video"?p=m=>m.type===Wi.emsg&&u:p=m=>m.type===Wi.audioId3&&g||m.type===Wi.emsg&&u,$s(n,t,i,p)}}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:i,timelineOffset:r,enableDateRangeMetadataCues:n,interstitialsController:a}=this.hls.config;if(!n)return;const u=Js();if(i&&r&&!a){const{fragmentStart:Q,fragmentEnd:X}=e;let re=this.assetCue;re?(re.startTime=Q,re.endTime=X):u&&(re=this.assetCue=ea(u,Q,X,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),re&&(re.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(re),re.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:g}=this,{dateRanges:p}=e,m=Object.keys(p);let S=this.dateRangeCuesAppended;if(g&&t){var R;if((R=g.cues)!=null&&R.length){const Q=Object.keys(S).filter(X=>!m.includes(X));for(let X=Q.length;X--;){var H;const re=Q[X],ae=(H=S[re])==null?void 0:H.cues;delete S[re],ae&&Object.keys(ae).forEach(oe=>{const de=ae[oe];if(de){de.removeEventListener("enter",this.onEventCueEnter);try{g.removeCue(de)}catch(Se){}}})}}else S=this.dateRangeCuesAppended={}}const j=e.fragments[e.fragments.length-1];if(!(m.length===0||!I(j==null?void 0:j.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let Q=0;Q<m.length;Q++){const X=m[Q],re=p[X],ae=re.startTime,oe=S[X],de=(oe==null?void 0:oe.cues)||{};let Se=(oe==null?void 0:oe.durationKnown)||!1,Ne=cs;const{duration:we,endDate:Pe}=re;if(Pe&&we!==null)Ne=ae+we,Se=!0;else if(re.endOnNext&&!Se){const Ce=m.reduce((Ye,_t)=>{if(_t!==re.id){const xt=p[_t];if(xt.class===re.class&&xt.startDate>re.startDate&&(!Ye||re.startDate<Ye.startDate))return xt}return Ye},null);Ce&&(Ne=Ce.startTime,Se=!0)}const Ie=Object.keys(re.attr);for(let Ce=0;Ce<Ie.length;Ce++){const Ye=Ie[Ce];if(!Yr(Ye))continue;const _t=de[Ye];if(_t)Se&&!(oe!=null&&oe.durationKnown)?_t.endTime=Ne:Math.abs(_t.startTime-ae)>.01&&(_t.startTime=ae,_t.endTime=Ne);else if(u){let xt=re.attr[Ye];kn(Ye)&&(xt=z(xt));const At=ea(u,ae,Ne,{key:Ye,data:xt},Wi.dateRange);At&&(At.id=X,this.id3Track.addCue(At),de[Ye]=At,a&&(Ye==="X-ASSET-LIST"||Ye==="X-ASSET-URL")&&At.addEventListener("enter",this.onEventCueEnter))}}S[X]={cues:de,dateRange:re,durationKnown:Se}}}}}class Fh{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:a}=this.config;if(!n||a===1||!i.live)return;const u=this.targetLatency;if(u===null)return;const g=r-u,p=Math.min(this.maxLatency,u+i.targetduration);if(g<p&&g>.05&&this.forwardBufferLength>1){const S=Math.min(2,Math.max(1,a)),R=Math.round(2/(1+Math.exp(-.75*g-this.edgeStalled))*20)/20,H=Math.min(S,Math.max(1,R));this.changeMediaPlaybackRate(t,H)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:u}=this.config,g=this.hls.userConfig;let p=u&&i||t;(this._targetLatencyUpdated||g.liveSyncDuration||g.liveSyncDurationCount||p===0)&&(p=n!==void 0?n:a*r);const m=r;return p+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,m)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,a=r-i.totalduration,u=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,n),u)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(_.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(_.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===w.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,r;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.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 Mh extends ks{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,r=[],n={},a={};let u=!1,g=!1,p=!1;t.levels.forEach(m=>{const S=m.attrs;let{audioCodec:R,videoCodec:H}=m;R&&(m.audioCodec=R=et(R,i)||void 0),H&&(H=m.videoCodec=Yt(H));const{width:j,height:Q,unknownCodecs:X}=m,re=(X==null?void 0:X.length)||0;if(u||(u=!!(j&&Q)),g||(g=!!H),p||(p=!!R),re||R&&!this.isAudioSupported(R)||H&&!this.isVideoSupported(H)){this.log(`Some or all CODECS not supported "${S.CODECS}"`);return}const{CODECS:ae,"FRAME-RATE":oe,"HDCP-LEVEL":de,"PATHWAY-ID":Se,RESOLUTION:Ne,"VIDEO-RANGE":we}=S,Ie=`${`${Se||"."}-`}${m.bitrate}-${Ne}-${oe}-${ae}-${we}-${de}`;if(n[Ie])if(n[Ie].uri!==m.url&&!m.attrs["PATHWAY-ID"]){const Ce=a[Ie]+=1;m.attrs["PATHWAY-ID"]=new Array(Ce+1).join(".");const Ye=this.createLevel(m);n[Ie]=Ye,r.push(Ye)}else n[Ie].addGroupId("audio",S.AUDIO),n[Ie].addGroupId("text",S.SUBTITLES);else{const Ce=this.createLevel(m);n[Ie]=Ce,a[Ie]=1,r.push(Ce)}}),this.filterAndSortMediaOptions(r,t,u,g,p)}createLevel(e){const t=new $t(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(r.message),t.supportedResult=tt(r,[])}return t}isAudioSupported(e){return ge(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return ge(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,r,n){var a;let u=[],g=[],p=e;const m=((a=t.stats)==null?void 0:a.parsing)||{};if((i||r)&&n&&(p=p.filter(({videoCodec:ae,videoRange:oe,width:de,height:Se})=>(!!ae||!!(de&&Se))&&Fi(oe))),p.length===0){Promise.resolve().then(()=>{if(this.hls){let ae="no level with compatible codecs found in manifest",oe=ae;t.levels.length&&(oe=`one or more CODECS in variant not supported: ${jt(t.levels.map(Se=>Se.attrs.CODECS).filter((Se,Ne,we)=>we.indexOf(Se)===Ne))}`,this.warn(oe),ae+=` (${oe})`);const de=new Error(ae);this.hls.trigger(_.ERROR,{type:D.MEDIA_ERROR,details:w.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:de,reason:oe})}}),m.end=performance.now();return}t.audioTracks&&(u=t.audioTracks.filter(ae=>!ae.audioCodec||this.isAudioSupported(ae.audioCodec)),Xo(u)),t.subtitles&&(g=t.subtitles,Xo(g));const S=p.slice(0);p.sort((ae,oe)=>{if(ae.attrs["HDCP-LEVEL"]!==oe.attrs["HDCP-LEVEL"])return(ae.attrs["HDCP-LEVEL"]||"")>(oe.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&ae.height!==oe.height)return ae.height-oe.height;if(ae.frameRate!==oe.frameRate)return ae.frameRate-oe.frameRate;if(ae.videoRange!==oe.videoRange)return Ht.indexOf(ae.videoRange)-Ht.indexOf(oe.videoRange);if(ae.videoCodec!==oe.videoCodec){const de=te(ae.videoCodec),Se=te(oe.videoCodec);if(de!==Se)return Se-de}if(ae.uri===oe.uri&&ae.codecSet!==oe.codecSet){const de=le(ae.codecSet),Se=le(oe.codecSet);if(de!==Se)return Se-de}return ae.averageBitrate!==oe.averageBitrate?ae.averageBitrate-oe.averageBitrate:0});let R=S[0];if(this.steering&&(p=this.steering.filterParsedLevels(p),p.length!==S.length)){for(let ae=0;ae<S.length;ae++)if(S[ae].pathwayId===p[0].pathwayId){R=S[ae];break}}this._levels=p;for(let ae=0;ae<p.length;ae++)if(p[ae]===R){var H;this._firstLevel=ae;const oe=R.bitrate,de=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${p.length} level(s) found, first bitrate: ${oe}`),((H=this.hls.userConfig)==null?void 0:H.abrEwmaDefaultEstimate)===void 0){const Se=Math.min(oe,this.hls.config.abrEwmaDefaultEstimateMax);Se>de&&de===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=Se)}break}const j=n&&!r,Q=this.hls.config,X=!!(Q.audioStreamController&&Q.audioTrackController),re={levels:p,audioTracks:u,subtitleTracks:g,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:X&&!j&&u.some(ae=>!!ae.url)};m.end=performance.now(),this.hls.trigger(_.MANIFEST_PARSED,re)}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 m=new Error("invalid level idx"),S=e<0;if(this.hls.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.LEVEL_SWITCH_ERROR,level:e,fatal:S,error:m,reason:m.message}),S)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],u=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&r&&n===u)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${u?" with Pathway "+u:""} from level ${i}${n?" with Pathway "+n:""}`);const g={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(_.LEVEL_SWITCHING,g);const p=a.details;if(!p||p.live){const m=this.switchParams(a.uri,r==null?void 0:r.details,p);this.loadPlaylist(m)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(r=>t.indexOf(r)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===F.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===v.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(n=>!!i[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,a=t.levelInfo;if(!a){var u;this.warn(`Invalid level index ${r}`),(u=t.deliveryDirectives)!=null&&u.skip&&(n.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let g=a.details;g===t.details&&g.advanced&&(g=void 0),this.playlistLoaded(r,t,g)}else(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],a=e.details,u=a==null?void 0:a.age;this.log(`Loading level index ${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${n?" Pathway "+n:""}${u&&a.live?" age "+u.toFixed(1)+(a.type?" "+a.type||0:""):""} ${i}`),this.hls.trigger(_.LEVEL_LOADING,{url:i,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((n,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(n),n===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,n.details&&n.details.fragments.forEach(u=>u.level=-1)),!1));xa(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const r=i.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(_.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(_.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Xo(o){const e={};o.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function Qo(){return self.SourceBuffer||self.WebKitSourceBuffer}function Jo(){if(!Y())return!1;const e=Qo();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Bh(){if(!Jo())return!1;const o=Y();return typeof(o==null?void 0:o.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>o.isTypeSupported(ee(e,"video")))||["mp4a.40.2","fLaC"].some(e=>o.isTypeSupported(ee(e,"audio"))))}function Nh(){var o;const e=Qo();return typeof(e==null||(o=e.prototype)==null?void 0:o.changeType)=="function"}const Uh=100;class $h extends gs{constructor(e,t,i){super(e,t,i,"stream-controller",v.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 r=this.media,n=r?r.currentTime:null;if(n===null||!I(n)||(this.log(`Media seeked to ${n.toFixed(3)}`),!this.getBufferedFrag(n)))return;const a=this.getFwdBufferInfoAtPos(r,n,v.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${n} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:r}=this;if(this.stopLoad(),this.setInterval(Uh),this.level=-1,!this.startFragRequested){let n=r.startLevel;n===-1&&(r.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=r.firstAutoLevel),r.nextLoadLevel=n,this.level=r.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=ze.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=ze.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case ze.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e==null?void 0:e[t],r=i==null?void 0:i.details;if(r&&(!r.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(r))break;this.state=ze.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=ze.IDLE;break}break}case ze.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===ze.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[n]))return;const a=i[n],u=this.getMainFwdBufferInfo();if(u===null)return;const g=this.getLevelDetails();if(g&&this._streamEnded(u,g)){const Q={};this.altAudio===2&&(Q.type="video"),this.hls.trigger(_.BUFFER_EOS,Q),this.state=ze.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const p=a.details;if(!p||this.state===ze.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=ze.WAITING_LEVEL,this.startFragRequested=!1;return}const m=u.len,S=this.getMaxBufferLength(a.maxBitrate);if(m>=S)return;this.backtrackFragment&&this.backtrackFragment.start>u.end&&(this.backtrackFragment=null);const R=this.backtrackFragment?this.backtrackFragment.start:u.end;let H=this.getNextFragment(R,p);if(this.couldBacktrack&&!this.fragPrevious&&H&&pe(H)&&this.fragmentTracker.getState(H)!==si.OK){var j;const X=((j=this.backtrackFragment)!=null?j:H).sn-p.startSN,re=p.fragments[X-1];re&&H.cc===re.cc&&(H=re,this.fragmentTracker.removeFragment(re))}else this.backtrackFragment&&u.len&&(this.backtrackFragment=null);if(H&&this.isLoopLoading(H,R)){if(!H.gap){const X=this.audioOnly&&!this.altAudio?V.AUDIO:V.VIDEO,re=(X===V.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;re&&this.afterBufferFlushed(re,X,v.MAIN)}H=this.getNextFragmentLoopLoading(H,p,u,v.MAIN,S)}H&&(H.initSegment&&!H.initSegment.data&&!this.bitrateTest&&(H=H.initSegment),this.loadFragment(H,a,R))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);r===si.NOT_LOADED||r===si.PARTIAL?pe(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,v.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const u=this.getMainFwdBufferInfo();if(!u||u.len<n.targetduration*2)return}if(!t.paused&&e){const u=this.hls.nextLoadLevel,g=e[u],p=this.fragLastKbps;p&&this.fragCurrent?i=this.fragCurrent.duration*g.maxBitrate/(1e3*p)+1:i=0}else i=0;const a=this.getBufferedFrag(t.currentTime+i);if(a){const u=this.followingBufferedFrag(a);if(u){this.abortCurrentFrag();const g=u.maxStartPTS?u.maxStartPTS:u.start,p=u.duration,m=Math.max(a.end,g+Math.min(Math.max(p-this.config.maxFragLookUpTolerance,p*(this.couldBacktrack?.5:.125)),p*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(m,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 ze.KEY_LOADING:case ze.FRAG_LOADING:case ze.FRAG_LOADING_WAITING_RETRY:case ze.PARSING:case ze.PARSED:this.state=ze.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;Oi(i,"playing",this.onMediaPlaying),Oi(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&($i(i,"playing",this.onMediaPlaying),$i(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(_.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,r=!1;for(let n=0;n<t.levels.length;n++){const a=t.levels[n].audioCodec;a&&(i=i||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=i&&r&&!Nh(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==ze.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=ze.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r,startFragRequested:n}=this,a=t.level,u=t.details,g=u.totalduration;if(!r){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${u.startSN},${u.endSN}]${u.lastPartSn?`[part-${u.lastPartSn}-${u.lastPartIndex}]`:""}, cc [${u.startCC}, ${u.endCC}] duration:${g}`);const p=t.levelInfo,m=this.fragCurrent;m&&(this.state===ze.FRAG_LOADING||this.state===ze.FRAG_LOADING_WAITING_RETRY)&&m.level!==t.level&&m.loader&&this.abortCurrentFrag();let S=0;if(u.live||(i=p.details)!=null&&i.live){var R;if(this.checkLiveUpdate(u),u.deltaUpdateFailed)return;S=this.alignPlaylists(u,p.details,(R=this.levelLastLoaded)==null?void 0:R.details)}if(p.details=u,this.levelLastLoaded=p,n||this.setStartPosition(u,S),this.hls.trigger(_.LEVEL_UPDATED,{details:u,level:a}),this.state===ze.WAITING_LEVEL){if(this.waitForCdnTuneIn(u))return;this.state=ze.IDLE}n&&u.live&&this.synchronizeToLiveEdge(u),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=this.getLoadPosition(),a=e.fragmentStart,u=e.edge,g=n>=a-t.maxFragLookUpTolerance&&n<=u;if(r!==null&&i.duration>r&&(n<r||!g)){const m=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!g&&i.readyState<4||n<u-m)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),i.readyState))if(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${u}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var p;const S=Ot.bufferInfo(i,r,0);if(!((p=S.buffered)!=null&&p.length)){i.currentTime=r;return}if(S.start<=n){i.currentTime=r;return}const{nextStart:H}=Ot.bufferedInfo(S.buffered,n,0);H&&(i.currentTime=H)}else i.currentTime=r}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:r,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const u=a[i.level];if(!u){this.warn(`Level ${i.level} not found on progress`);return}const g=u.details;if(!g){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const p=u.videoCodec,m=g.PTSKnown||!g.live,S=(t=i.initSegment)==null?void 0:t.data,R=this._getAudioCodec(u),H=this.transmuxer=this.transmuxer||new io(this.hls,v.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),j=r?r.index:-1,Q=j!==-1,X=new Fr(i.level,i.sn,i.stats.chunkCount,n.byteLength,j,Q),re=this.initPTS[i.cc];H.push(n,S,R,p,i,r,g.totalduration,m,X,re)}onAudioTrackSwitching(e,t){const i=this.hls,r=this.altAudio===2;if(yr(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.fragmentTracker.removeAllFragments(),i.once(_.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(_.AUDIO_TRACK_SWITCHED,t)}),i.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(_.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=yr(t.url,this.hls);if(i){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,a=!1;for(const u in i){const g=i[u];if(g.id==="main"){if(n=u,r=g,u==="video"){const p=i[u];p&&(this.videoBuffer=p.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t,n=i.type===v.MAIN;if(n){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===ze.PARSED&&(this.state=ze.IDLE);return}const u=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*u.total/(u.buffering.end-u.loading.first)),pe(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}const a=this.media;a&&(!this._hasEnoughToStart&&Ot.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=ze.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(v.MAIN,t);break;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ze.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===F.LEVEL&&(this.state=ze.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case w.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 w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=ze.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==V.AUDIO||!this.altAudio){const i=(t===V.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,v.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const r=this.timelineOffset;r&&i&&(i+=r);const n=this.getLevelDetails(),a=Ot.getBuffered(e),u=a.length?a.start(0):0,g=u-i,p=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||g>0&&(g<p||this.loadingParts&&g<2*((n==null?void 0:n.partTarget)||0)))&&(this.log(`adjusting start position by ${g} to match buffer start`),i+=g,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${u}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:r}=this,n=i==null?void 0:i.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=ze.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(_.FRAG_LOADED,i),n.bitrateTest=!1}).catch(i=>{this.state===ze.STOPPED||this.state===ze.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:r,chunkMeta:n}=e,a=this.getCurrentContext(n);if(!a){this.resetWhenMissingContext(n);return}const{frag:u,part:g,level:p}=a,{video:m,text:S,id3:R,initSegment:H}=r,{details:j}=p,Q=this.altAudio?void 0:r.audio;if(this.fragContextChanged(u)){this.fragmentTracker.removeFragment(u);return}if(this.state=ze.PARSING,H){const X=H.tracks;if(X){const de=u.initSegment||u;if(this.unhandledEncryptionError(H,u))return;this._bufferInitSegment(p,X,de,n),i.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:de,id:t,tracks:X})}const re=H.initPTS,ae=H.timescale,oe=this.initPTS[u.cc];if(I(re)&&(!oe||oe.baseTime!==re||oe.timescale!==ae)){const de=H.trackId;this.initPTS[u.cc]={baseTime:re,timescale:ae,trackId:de},i.trigger(_.INIT_PTS_FOUND,{frag:u,id:t,initPTS:re,timescale:ae,trackId:de})}}if(m&&j){Q&&m.type==="audiovideo"&&this.logMuxedErr(u);const X=j.fragments[u.sn-1-j.startSN],re=u.sn===j.startSN,ae=!X||u.cc>X.cc;if(r.independent!==!1){const{startPTS:oe,endPTS:de,startDTS:Se,endDTS:Ne}=m;if(g)g.elementaryStreams[m.type]={startPTS:oe,endPTS:de,startDTS:Se,endDTS:Ne};else if(m.firstKeyFrame&&m.independent&&n.id===1&&!ae&&(this.couldBacktrack=!0),m.dropped&&m.independent){const we=this.getMainFwdBufferInfo(),Pe=(we?we.end:this.getLoadPosition())+this.config.maxBufferHole,Ie=m.firstKeyFramePTS?m.firstKeyFramePTS:oe;if(!re&&Pe<Ie-this.config.maxBufferHole&&!ae){this.backtrack(u);return}else ae&&(u.gap=!0);u.setElementaryStreamInfo(m.type,u.start,de,u.start,Ne,!0)}else re&&oe-(j.appliedTimelineOffset||0)>ls&&(u.gap=!0);u.setElementaryStreamInfo(m.type,oe,de,Se,Ne),this.backtrackFragment&&(this.backtrackFragment=u),this.bufferFragmentData(m,u,g,n,re||ae)}else if(re||ae)u.gap=!0;else{this.backtrack(u);return}}if(Q){const{startPTS:X,endPTS:re,startDTS:ae,endDTS:oe}=Q;g&&(g.elementaryStreams[V.AUDIO]={startPTS:X,endPTS:re,startDTS:ae,endDTS:oe}),u.setElementaryStreamInfo(V.AUDIO,X,re,ae,oe),this.bufferFragmentData(Q,u,g,n)}if(j&&R!=null&&R.samples.length){const X={id:t,frag:u,details:j,samples:R.samples};i.trigger(_.FRAG_PARSING_METADATA,X)}if(j&&S){const X={id:t,frag:u,details:j,samples:S.samples};i.trigger(_.FRAG_PARSING_USERDATA,X)}}logMuxedErr(e){this.warn(`${pe(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,r){if(this.state!==ze.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:n,video:a,audiovideo:u}=t;if(n){const p=e.audioCodec;let m=gt(n.codec,p);m==="mp4a"&&(m="mp4a.40.5");const S=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){m&&(m.indexOf("mp4a.40.5")!==-1?m="mp4a.40.2":m="mp4a.40.5");const R=n.metadata;R&&"channelCount"in R&&(R.channelCount||1)!==1&&S.indexOf("firefox")===-1&&(m="mp4a.40.5")}m&&m.indexOf("mp4a.40.5")!==-1&&S.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(m="mp4a.40.2",this.log(`Android: force audio codec to ${m}`)),p&&p!==m&&this.log(`Swapping manifest audio codec "${p}" for "${m}"`),n.levelCodec=m,n.id=v.MAIN,this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${m||""}/${p||""}/${n.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=v.MAIN;const p=a.codec;if((p==null?void 0:p.length)===4)switch(p){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${p}]${a.codec!==p?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}u&&(this.log(`Init audiovideo buffer, container:${u.container}, codecs[level/parsed]=[${e.codecs}/${u.codec}]`),delete t.video,delete t.audio);const g=Object.keys(t);if(g.length){if(this.hls.trigger(_.BUFFER_CODECS,t),!this.hls)return;g.forEach(p=>{const S=t[p].initSegment;S!=null&&S.byteLength&&this.hls.trigger(_.BUFFER_APPENDING,{type:p,data:S,frag:i,part:null,chunkMeta:r,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,v.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=ze.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Ot.isBuffered(e,i)?t=this.getAppendedFrag(i):Ot.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(_.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(_.LEVEL_SWITCHED,{level:n}))}}}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 I(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(I(t)){const i=this.getLevelDetails(),r=this.currentFrag||(i?yi(null,i.fragments,t):null);if(r){const n=r.programDateTime;if(n!==null){const a=n+(t-r.start)*1e3;return new Date(a)}}}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 Hh extends T{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[i].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.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=w.KEY_LOAD_ERROR,i,r,n){return new Ii({type:D.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,n=t.length;r<n;r++){const a=t[r];if(e.cc<=a.cc&&(!pe(e)||!pe(a)||e.sn<a.sn)||!i&&r==n-1)return this.emeController.selectKeySystemFormat(a).then(u=>{if(!this.emeController)return;a.setKeyFormat(u);const g=Dr(u);if(g)return this.emeController.getKeySystemAccess([g])})}if(this.config.requireKeySystemAccessOnStart){const r=Nr(this.config);if(r.length)return this.emeController.getKeySystemAccess(r)}}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 i,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const p=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,p))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const u=ta(n);let g=this.keyIdToKeyInfo[u];if((i=g)!=null&&i.decryptdata.key)return n.key=g.decryptdata.key,Promise.resolve({frag:e,keyInfo:g});if(this.emeController&&(r=g)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(g.decryptdata)){case"usable":case"usable-in-future":return g.keyLoadPromise.then(m=>{const{keyInfo:S}=m;return n.key=S.decryptdata.key,{frag:e,keyInfo:S}})}switch(this.log(`${this.keyIdToKeyInfo[u]?"Rel":"L"}oading${n.keyId?" keyId: "+J(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`),g=this.keyIdToKeyInfo[u]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(g,e):this.loadKeyEME(g,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(g,e);default:return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){const a=lt(t.initSegment.data);if(a.length){const u=a[0];u.some(g=>g!==0)&&(this.log(`Using keyId found in init segment ${J(u)}`),e.decryptdata.keyId=u,tn.setKeyIdForUri(e.decryptdata.uri,u))}}const n=this.emeController.loadKey(i);return(e.keyLoadPromise=n.then(a=>(e.mediaKeySessionContext=a,i))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,u)=>{const g={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},p=i.keyLoadPolicy.default,m={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},S={onSuccess:(R,H,j,Q)=>{const{frag:X,keyInfo:re}=j,ae=ta(re.decryptdata);if(!X.decryptdata||re!==this.keyIdToKeyInfo[ae])return u(this.createKeyLoadError(X,w.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),Q));re.decryptdata.key=X.decryptdata.key=new Uint8Array(R.data),X.keyLoader=null,re.loader=null,a({frag:X,keyInfo:re})},onError:(R,H,j,Q)=>{this.resetLoader(H),u(this.createKeyLoadError(t,w.KEY_LOAD_ERROR,new Error(`HTTP Error ${R.code} loading key ${R.text}`),j,h({url:g.url,data:void 0},R)))},onTimeout:(R,H,j)=>{this.resetLoader(H),u(this.createKeyLoadError(t,w.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),j))},onAbort:(R,H,j)=>{this.resetLoader(H),u(this.createKeyLoadError(t,w.INTERNAL_ABORTED,new Error("key loading aborted"),j))}};n.load(g,m,S)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null);const a=ta(i.decryptdata)||r;delete this.keyIdToKeyInfo[a],n&&n.destroy()}}function ta(o){if(o.keyFormat!==Kt.FAIRPLAY){const e=o.keyId;if(e)return J(e)}return o.uri}function el(o){const{type:e}=o;switch(e){case F.AUDIO_TRACK:return v.AUDIO;case F.SUBTITLE_TRACK:return v.SUBTITLE;default:return v.MAIN}}function ia(o,e){let t=o.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class jh{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(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(_.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,a=new n(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:F.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:n,url:a,deliveryDirectives:u,levelInfo:g}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:F.LEVEL,url:a,deliveryDirectives:u,levelOrTrack:g})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:a,track:u}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:F.AUDIO_TRACK,url:n,deliveryDirectives:a,levelOrTrack:u})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:a,track:u}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:F.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:u})}onLevelsUpdated(e,t){const i=this.loaders[F.LEVEL];if(i){const r=i.context;r&&!t.levels.some(n=>n===r.levelOrTrack)&&(i.abort(),delete this.loaders[F.LEVEL])}}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const p=this.hls.logger,m=r.context;if(m&&m.levelOrTrack===e.levelOrTrack&&(m.url===e.url||m.deliveryDirectives&&!e.deliveryDirectives)){m.url===e.url?p.log(`[playlist-loader]: ignore ${e.url} ongoing request`):p.log(`[playlist-loader]: ignore ${e.url} in favor of ${m.url}`);return}p.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===F.MANIFEST?n=i.manifestLoadPolicy.default:n=c({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),I((t=e.deliveryDirectives)==null?void 0:t.part)){let p;if(e.type===F.LEVEL&&e.level!==null?p=this.hls.levels[e.level].details:e.type===F.AUDIO_TRACK&&e.id!==null?p=this.hls.audioTracks[e.id].details:e.type===F.SUBTITLE_TRACK&&e.id!==null&&(p=this.hls.subtitleTracks[e.id].details),p){const m=p.partTarget,S=p.targetduration;if(m&&S){const R=Math.max(m*3,S*.8)*1e3;n=c({},n,{maxTimeToFirstByteMs:Math.min(R,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(R,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},u={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},g={onSuccess:(p,m,S,R)=>{const H=this.getInternalLoader(S);this.resetInternalLoader(S.type);const j=p.data;m.parsing.start=performance.now(),dr.isMediaPlaylist(j)||S.type!==F.MANIFEST?this.handleTrackOrLevelPlaylist(p,m,S,R||null,H):this.handleMasterPlaylist(p,m,S,R)},onError:(p,m,S,R)=>{this.handleNetworkError(m,S,!1,p,R)},onTimeout:(p,m,S)=>{this.handleNetworkError(m,S,!0,void 0,p)}};r.load(e,u,g)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,r){const n=this.hls,a=e.data,u=ia(e,i),g=dr.parseMasterPlaylist(a,u);if(g.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,g.playlistParsingError,r,t);return}const{contentSteering:p,levels:m,sessionData:S,sessionKeys:R,startTimeOffset:H,variableList:j}=g;this.variableList=j,m.forEach(ae=>{const{unknownCodecs:oe}=ae;if(oe){const{preferManagedMediaSource:de}=this.hls.config;let{audioCodec:Se,videoCodec:Ne}=ae;for(let we=oe.length;we--;){const Pe=oe[we];ge(Pe,"audio",de)?(ae.audioCodec=Se=Se?`${Se},${Pe}`:Pe,Tt.audio[Se.substring(0,4)]=2,oe.splice(we,1)):ge(Pe,"video",de)&&(ae.videoCodec=Ne=Ne?`${Ne},${Pe}`:Pe,Tt.video[Ne.substring(0,4)]=2,oe.splice(we,1))}}});const{AUDIO:Q=[],SUBTITLES:X,"CLOSED-CAPTIONS":re}=dr.parseMasterPlaylistMedia(a,u,g);Q.length&&!Q.some(oe=>!oe.url)&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),Q.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ai({}),bitrate:0,url:""})),n.trigger(_.MANIFEST_LOADED,{levels:m,audioTracks:Q,subtitles:X,captions:re,contentSteering:p,url:u,stats:t,networkDetails:r,sessionData:S,sessionKeys:R,startTimeOffset:H,variableList:j})}handleTrackOrLevelPlaylist(e,t,i,r,n){const a=this.hls,{id:u,level:g,type:p}=i,m=ia(e,i),S=I(g)?g:I(u)?u:0,R=el(i),H=dr.parseLevelPlaylist(e.data,m,S,R,0,this.variableList);if(p===F.MANIFEST){const j={attrs:new ai({}),bitrate:0,details:H,name:"",url:m};H.requestScheduled=t.loading.start+ba(H,0),a.trigger(_.MANIFEST_LOADED,{levels:[j],audioTracks:[],url:m,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=H,this.handlePlaylistLoaded(H,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.MANIFEST_PARSING_ERROR,fatal:t.type===F.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let a=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===F.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===F.AUDIO_TRACK||e.type===F.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const u=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let g=w.UNKNOWN,p=!1;const m=this.getInternalLoader(e);switch(e.type){case F.MANIFEST:g=i?w.MANIFEST_LOAD_TIMEOUT:w.MANIFEST_LOAD_ERROR,p=!0;break;case F.LEVEL:g=i?w.LEVEL_LOAD_TIMEOUT:w.LEVEL_LOAD_ERROR,p=!1;break;case F.AUDIO_TRACK:g=i?w.AUDIO_TRACK_LOAD_TIMEOUT:w.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case F.SUBTITLE_TRACK:g=i?w.SUBTITLE_TRACK_LOAD_TIMEOUT:w.SUBTITLE_LOAD_ERROR,p=!1;break}m&&this.resetInternalLoader(e.type);const S={type:D.NETWORK_ERROR,details:g,fatal:p,url:e.url,loader:m,context:e,error:u,networkDetails:t,stats:n};if(r){const R=(t==null?void 0:t.url)||e.url;S.response=h({url:R,data:void 0},r)}this.hls.trigger(_.ERROR,S)}handlePlaylistLoaded(e,t,i,r,n,a){const u=this.hls,{type:g,level:p,levelOrTrack:m,id:S,groupId:R,deliveryDirectives:H}=r,j=ia(t,r),Q=el(r);let X=typeof r.level=="number"&&Q===v.MAIN?p:void 0;const re=e.playlistParsingError;if(re){if(this.hls.logger.warn(`${re} ${e.url}`),!u.config.ignorePlaylistParsingErrors){u.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:j,error:re,reason:re.message,response:t,context:r,level:X,parent:Q,networkDetails:n,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const ae=e.playlistParsingError=new Error("No Segments found in Playlist");u.trigger(_.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_EMPTY_ERROR,fatal:!1,url:j,error:ae,reason:ae.message,response:t,context:r,level:X,parent:Q,networkDetails:n,stats:i});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),g){case F.MANIFEST:case F.LEVEL:if(X){if(!m)X=0;else if(m!==u.levels[X]){const ae=u.levels.indexOf(m);ae>-1&&(X=ae)}}u.trigger(_.LEVEL_LOADED,{details:e,levelInfo:m||u.levels[0],level:X||0,id:S||0,stats:i,networkDetails:n,deliveryDirectives:H,withoutMultiVariant:g===F.MANIFEST});break;case F.AUDIO_TRACK:u.trigger(_.AUDIO_TRACK_LOADED,{details:e,track:m,id:S||0,groupId:R||"",stats:i,networkDetails:n,deliveryDirectives:H});break;case F.SUBTITLE_TRACK:u.trigger(_.SUBTITLE_TRACK_LOADED,{details:e,track:m,id:S||0,groupId:R||"",stats:i,networkDetails:n,deliveryDirectives:H});break}}}class jr{static get version(){return On}static isMSESupported(){return Jo()}static isSupported(){return Bh()}static getMediaSource(){return Y()}static get Events(){return _}static get MetadataSchema(){return Wi}static get ErrorTypes(){return D}static get ErrorDetails(){return w}static get DefaultConfig(){return jr.defaultConfig?jr.defaultConfig:Ah}static set DefaultConfig(e){jr.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 vs,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=$(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=Th(jr.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Dh(i,t);const{abrController:r,bufferController:n,capLevelController:a,errorController:u,fpsController:g}=i,p=new u(this),m=this.abrController=new r(this),S=new dn(this),R=i.interstitialsController,H=R?this.interstitialsController=new R(this,jr):null,j=this.bufferController=new n(this,S),Q=this.capLevelController=new a(this),X=new g(this),re=new jh(this),ae=i.contentSteeringController,oe=ae?new ae(this):null,de=this.levelController=new Mh(this,oe),Se=new Oh(this),Ne=new Hh(this.config,this.logger),we=this.streamController=new $h(this,S,Ne),Pe=this.gapController=new Ih(this,S);Q.setStreamController(we),X.setStreamController(we);const Ie=[re,de,we];H&&Ie.splice(1,0,H),oe&&Ie.splice(1,0,oe),this.networkControllers=Ie;const Ce=[m,j,Pe,Q,X,Se,S];this.audioTrackController=this.createController(i.audioTrackController,Ie);const Ye=i.audioStreamController;Ye&&Ie.push(this.audioStreamController=new Ye(this,S,Ne)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Ie);const _t=i.subtitleStreamController;_t&&Ie.push(this.subtititleStreamController=new _t(this,S,Ne)),this.createController(i.timelineController,Ce),Ne.emeController=this.emeController=this.createController(i.emeController,Ce),this.cmcdController=this.createController(i.cmcdController,Ce),this.latencyController=this.createController(Fh,Ce),this.coreComponents=Ce,Ie.push(p);const xt=p.onErrorOut;typeof xt=="function"&&this.on(_.ERROR,xt,p),this.on(_.MANIFEST_LOADED,re.onManifestLoaded,re)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,r){this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const r=e===_.ERROR;this.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:r,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(_.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 n=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(_.ERROR,{type:D.OTHER_ERROR,details:w.ATTACH_MEDIA_ERROR,fatal:!0,error:n});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,r=t?e:{media:i};this._media=i,this.trigger(_.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(_.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(_.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,r=this._url=k.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(_.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[v.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[v.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[v.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=Ic()),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){Si(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=i)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=Ti(t);return pt(e,i,navigator.mediaCapabilities)}}jr.defaultConfig=void 0}}]);
|
|
|
}()); |